content
stringlengths
1
15.9M
\subsection{\@startsection{subsection}{2}{\z@}% {-3.25ex\@plus -1ex \@minus -.2ex}% {1.5ex \@plus .2ex}% {\normalfont\bfseries}} \makeatother \input{orcid.tex} \newcommand{0000-0002-1490-0304}{0000-0002-1490-0304} \newcommand{\orcidauthorB}{0000-0003-3310-7915} \usepackage{newunicodechar} \newunicodechar{ä}{\"a} \newunicodechar{ü}{\"u} \newunicodechar{ö}{\"o} \newunicodechar{Ä}{\"A} \newunicodechar{Ü}{\"U} \newunicodechar{Ö}{\"O} \newunicodechar{ß}{\ss} \DeclareSymbolFont{mathscrLC}{OT1}{pzc}{m}{n} % \DeclareMathSymbol{\scrd}{0}{mathscrLC}{`d} \newunicodechar{∂}{\ensuremath{\scrd}} \newunicodechar{σ}{\ensuremath{\sigma}} % \newunicodechar{α}{\ensuremath{\alpha}} \newunicodechar{β}{\ensuremath{\beta}} \newunicodechar{θ}{\ensuremath{\theta}} \newunicodechar{μ}{\ensuremath{\mu}} \newunicodechar{ν}{\ensuremath{\nu}} \newunicodechar{⊙}{\ensuremath{\odot}} \newunicodechar{κ}{\ensuremath{\kappa}} \newunicodechar{η}{\ensuremath{\eta}} \newunicodechar{∫}{\ensuremath{\int}} \newunicodechar{ℓ}{\ensuremath{\ell}} \newunicodechar{√}{\ensuremath{\sqrt{}}} \newunicodechar{⊗}{\ensuremath{\otimes}} \usepackage{booktabs} \usepackage{multirow} \renewcommand{\arraystretch}{1.2} \usepackage{inconsolata} \usepackage[normalem]{ulem} % \usepackage{centernot} % \usepackage{hyperref} \setcounter{page}{1} \include{moritzdefs} \setlength{\parskip}{0.5em} \newcommand{\operatorname{supp}}{\operatorname{supp}} \newcommand{\chad}[2][] {\todo[inline,backgroundcolor=orange!20!white, size=\footnotesize,#1]{(Chad) #2 }} \newcommand{\moritz}[2][] {\todo[inline,backgroundcolor=blue!10!white, size=\footnotesize,#1]{(Moritz) #2 }} \begin{document} \input{header} \affil[*]{Corresponding author: \url{<EMAIL>}} \maketitle \begin{abstract} Probabilistic programming and statistical computing are vibrant areas in the development of the Julia programming language, but the underlying infrastructure dramatically predates recent developments. The goal of \texttt{MeasureTheory.jl} is to provide Julia with the right vocabulary and tools for these tasks. In the package we introduce a well-chosen set of notions from the foundations of probability together with powerful combinators and transforms, giving a gentle introduction to the concepts in this article. The task is foremost achieved by recognizing \href{https://en.wikipedia.org/wiki/Measure_(mathematics)}{\emph{measure}} as the central object. This enables us to develop a proper concept of \href{https://en.wikipedia.org/wiki/Probability_density_function}{\emph{densities}} as objects relating measures with each others. As densities provide local perspective on measures, they are the key to efficient implementations. The need to preserve this computationally so important locality leads to the new notion of \emph{locally-dominated measure} solving the so-called ``base measure problem'' and making work with densities and distributions in Julia easier and more flexible. \end{abstract} \section{Why measures?} \emph{Distributions are an insufficient abstraction for probabilistic modeling.} Let's first consider Bayesian modeling. In the posterior density of the parameter $\theta$ given the observation or data $x$, \[ p(\theta \mid x) = \frac{p(\theta)\ p(x \mid \theta)}{p(x)}\ , \] the denominator is called the \href{https://en.wikipedia.org/wiki/Marginal_likelihood}{\emph{model evidence}}. Computing it efficiently is often difficult or unfeasible. Some sampling algorithms circumvent this problem and only require knowing the density up to a constant factor. We then can work with the ``unnormalized posterior density'' instead, but we want to distinguish it from a proper probability density, because that difference determines which algorithms are available. In developments like this using distributions, it's common to begin in terms of a distribution, but then carry around the unnormalized posterior as a function. Fortunately, the meaning of this function is usually clear from context. But structurally, this representation is now divorced from its meaning. It's no longer a Distribution object, so the tools from the original library can no longer help. This is a perspective we will take often. Thus, starting with elements of our class of interest, a simple and common operation has led us to something outside of this class. This is analogous to the way polynomials over the reals lead to the complex numbers. If ``the shortest path between two truths in the real domain passes through the complex domain'' (Hadamard), then the same argument can be made for measures as connection between distributions. As a second example, people working in Bayesian modeling sometimes use \href{https://en.wikipedia.org/wiki/Prior_probability#Improper_priors}{\emph{improper priors}}. Whatever one's position on the merits of this, we think it's reasonable to make this approach possible. But an improper prior does not integrate to one, so it's not a distribution. Also, there's an elegant correspondence between frequentist and Bayesian methods, where regularization corresponds to a prior. But limiting ourselves to distributions restrains us from fully realizing this, because the corresponding ``prior'' might be improper or even flat, as in maximum likelihood estimation. A final and very different concern is the structure of most distribution libraries, in which distributions are classified primarily according to whether they are ``discrete'' or ``continuous''. Such systems often lack facilities to use these in combination; some go so far as to encode the distinction in the type system, making them fundamentally incompatible. But ``discrete vs continuous'' is a false dichotomy. For example, in three dimensions we can (and often do) work with distributions over points, lines, planes, or the entire space, or over spaces like a simplex or the surface of a sphere. These can be combined in rich ways, for example as a spike and slab prior for sparse modeling, or as a parameterized subspace for low-rank modeling. We can address all of these points by extending the system we work with. Instead of distributions, our primary class of interest is \emph{measures}, with distributions as a special case. Of course, this special case is particularly useful. The point is not to disregard distributions, but to change our focus to one allowing a richer calculus for reasoning. Adapting Hadamard's argument, \emph{The shortest path between two distributional truths passes through non-distributional measures}. \subsection*{Contributions} Our work is novel in several ways. \verb|MeasureTheory.jl| has \begin{enumerate} \item Explicitly represented \emph{base measures} with the same sophistication as the rest of the system, in particular more than just ``discrete or continuous''; \item A \emph{local} approach for determining \href{https://en.wikipedia.org/wiki/Absolute_continuity}{\emph{absolute continuity}}, which is usually a global characteristic; \item Multiple parameterizations for a given measure, without a proliferation of constructors; and \item Normalization and support constraints held separately from the data-dependent computation, allowing for greater efficiency. \end{enumerate} Some parts of our approach can been seen in existing systems, though these are still far from universal: \begin{itemize} \item[$\bullet\!$] A rich set of \emph{combinators} for building new measures from existing ones; \item[$\bullet\!$] Flexible type constraints, for example allowing measures with symbolic parameters; \item[$\bullet\!$] Light-weight measure construction, replacing a common assumption that once constructed, a measure will be used many times. This is especially important for probabilistic programming applications. \end{itemize} \section{What are measures?} We'll now describe some foundations to help the reader get a deeper understanding of our approach, in particular what measures and probability distributions are and how they relate to notions such as the probability of something happening in the real world or the notion of volume of the space we are living in. Throughout this discussion, it's important to keep in mind that for us the measure-theoretic abstractions are only means to an end.% \footnote{The stackoverflow discussion \url{https://mathoverflow.net/q/11591} discusses books on measure theory; M.S.~likes \cite{Shiryaev1996} as starting point and uses \cite{Elstrodt2011} and \cite{Bauer_Heinz1982-01-01} as reference. As we anticipate interest in connecting with the actual theory, we give some pointers to more technical details in the footnotes.} Our primary interest, and the goal of \verb|MeasureTheory|, is to offer support for \emph{applied probabilistic modeling}. The package name is owed to the fact, that the word measure alone is too vague. Given a space $X$ of possible outcomes and a set of subsets of $X$ called \href{https://en.wikipedia.org/wiki/Event_(probability_theory)}{\emph{events}}, a probability distribution assigns each event a non-negative quantity, called the \emph{probability} or \emph{probability mass}. Likewise, a \emph{measure} assigns each \emph{measurable set} a non-negative quantity, also called a ``mass''. The space $X$ could be the space $\{1,2,3,4,5,6\}$ suitable to model a six-sided die, or $X$ might be the 3-dimensional Euclidean space $\RR^3$ suitable to model ``volume'', to give two examples. One further such space that deserves mention is traditionally denoted $\Omega$. This is an abstract space connected to the real-world notion of \emph{probability}, which we denote as $\operatorname{Prob}$. Computationally, $\Omega$ can be considered to be the set of possible states of a random number generator \verb|rng::AbstractRNG|, which is the source of computational randomness. $\Omega$ has a special role of tying random quantities a program produces and their distributions together, through the notion of random variables, which are functions $\bX$, $\bY$ from $\Omega$ taking values in spaces $X$, $Y$ such as $\{1,2,3,4,5,6\}$ or $\RR^3$.\footnote{Additionally, one requires a random variable to be a \href{https://en.wikipedia.org/wiki/Measurable_function}{\emph{measurable function}}, that is, one for which the inverse image of an event $\subset X$ is also an event of $\Omega$. This is a similar, but much weaker requirement to the definition of a continuous function (``the inverse image of an open set is also open'').} The package \verb|Omega.jl| \cite{tavares2019language} uses random variables derived from $\Omega$ as core principle. From a computational perspective, a Julia function taking only an \verb|rng::AbstractRNG| argument, making a number of calls to \verb|rand(rng)|, and returning a value $x\in X$ is a random variable $\bX \colon \Omega\to X$. A simple example is \verb|X(rng=Random.GLOBAL_RNG) = rand(rng, 1:6)|. While mathematically $\bX$ is a function from $\Omega$, the argument $\omega$ is often hidden like the function argument \verb|rng| of its computational counterpart---not a coincidence. Each random variable $\bX$ is tied to its \emph{probability law} $D$, the distribution assigning probability to the events $\{\bX \in A\}$ for each (measurable) set $A$ \[\operatorname{Prob}(\bX \in A) = D(A). \] In that sense, classical distribution packages restrict themselves very much to the task of providing a catalogue of useful probability laws, and a simple mechanism to provide a random draw (a random variable) with that law, as function \verb|rand(rng, D)|. In the example, \[\operatorname{Prob}(\bX \in A) = D(A) = \dfrac{|A|}{6}\] where $|A|$ denotes the number of elements of $A \subset \{1,2,\cdots,6\}$. In \verb|MeasureTheory|, measures have abstract super-type \verb|AbstractMeasure|. \subsection*{Kolmogorov's axioms} We now introduce \href{https://en.wikipedia.org/wiki/Probability_axioms}{\emph{Kolmogorov's axioms}}, which describe laws that characterize probability distributions, and, with one exception, also measures. Measures and probability distributions are both required to obey the axiom that the (probability) mass of sets obtained as union of disjoint component sets\footnote{Precisely: union of a sequence of disjoint component sets.}, equals the sum of the (probability) masses of the components. So if sets $A$ and $B$ are \emph{not} disjoint, the mass of the union is computed from the mass of the components using \emph{inclusion-exclusion}. For probabilities this is \[ P(A \cup B) = P(A) + P(B) - P(A \cap B)\ . \] Similarly for a measure $\mu$, \[ \mu(A \cup B) = \mu(A) + \mu(B) - \mu(A \cap B)\ . \] In the case where $A$ and $B$ are disjoint, this reduces to \[ P(A \cup B) = P(A) + P(B)\ , \] a property called \emph{additivity}.\footnote{The axioms also require a more general form of this to hold. If $\left\{A_n \mid n\in\NN\right\}$ are \href{https://en.wikipedia.org/wiki/Disjoint_sets}{\emph{pairwise disjoint}} (that is, no two have any common elements), then it must be true that \[ P\left(\bigcup_{n\in\NN} A_n\right) = \sum_{n\in\NN} P\left(A_n\right)\ , \] and similarly for more general measures, replacing $P$ with $\mu$. This extension of additivity to the countably infinite case is called \emph{$\sigma$-additivity}.} The reader has encountered many measures before, whether they were given that name. For example, \href{https://en.wikipedia.org/wiki/Counting_measure}{\emph{counting measure}} gives the number of elements of a set, and the \href{https://en.wikipedia.org/wiki/Lebesgue_measure}{\emph{Lebesgue measure}} gives length, area, volume, etc in Euclidean space (\verb|CountingMeasure| and \verb|LebesgueMeasure| in the package.) So far our characterizations of measures and probability distributions are functionally identical. Indeed, the one distinguishing feature is the \emph{law of unit measure}, which only for distributions requires that \[ P(X) = 1\ , \] and also $\operatorname{Prob}(\Omega) = 1$. Thus $\Omega$ can be considered the event ``that anything at all will happen''. By this axiom, probability mass is a proportion, a quantity between 0 and 1. Only this axiom, which for measures is replaced by weaker axiom $\mu(\varnothing) = 0$, sets the two apart. To reinforce that a distribution is also a measure, we'll sometimes refer to it as a \emph{probability measure}. This close relationship between measures and \emph{probability} measures is illustrated by the Lebesgue measure $\lambda$ on $X=\RR$. The measure of the full space is $\lambda(\RR) = \infty$. But restricting to the unit interval gives $\lambda([0,1])=1$. This \emph{restricted} measure is a probability distribution---the uniform distribution $\uU([0,1])$ describing the law of Julia function \verb|rand()| giving random numbers in the interval $[0,1]$. We have not yet stated \emph{for which} sets Kolmogorov's axioms have to hold for something to be called a measure or a probability: \subsection*{$\sigma$-algebras and how to like them} A (probability) measure on $X$ need not assign a (probability) mass to every possible subset $A\subset X$, but only to each \emph{event} for a probability measure, or \emph{measurable set} more generally. Statements we make about sets should be understood as restricted to this set-of-sets, which can be different from one measure to the next. Now, Kolmogorov's axioms require a given measure to be defined for $X$, and they also require that this set of measurable sets is closed under the operations which the axioms allow (complements and unions of sets or sequences of sets). This imposes an algebraic structure to the measurable sets, called a \emph{$\sigma$-algebra}, which is exactly that: A set of sets $\subset X$ (or $\subset \Omega$ in particular) closed under complementation and countable unions and intersections. This begs the question: Why not just use the \href{https://en.wikipedia.org/wiki/Power_set}{\emph{power set}}, the ``set of all sets'', which is, after thinking about it, such a $\sigma$-algebra? A key observation is that having defined probability mass for a number of relatively simple sets, for example on all intervals, Kolmogorov's axioms give a recipe to compute the probability mass of more complicated sets, and with those, even more in new applications of the axioms, etc. One says the $\sigma$-algebra is \emph{generated} by these sets. Indeed, \verb|Distributions.jl| does not give means to compute probability for arbitrary subsets of floating point numbers, but gives a way of computing probability mass just of intervals of the form $(-\infty, x]$ throught the function \verb|cdf|. In fact, it is possible for small enough spaces to assign meaningful probabilities to all subsets of the space, but impossible for any space containing a continuum such as the real line. Just representing a single arbitrary subset of the \verb|Float64|-range, the computational abstraction of the real line, would require staggering 2\,306 Petabytes of memory. This is not practical. But even the mathematical measure theory needs to stay clear of the set of all subsets of uncountable spaces, because it turns out that not even volume can be properly defined for all subsets of the Euclidean space.\footnote{Another thing to keep in mind is that, for a function $f\colon X \to Y$ to be measurable requires that ``the inverse image of a measurable set must be measurable''. So allowing more sets to $B\subset Y$ to be measurable requires either allowing more measurable $A\subset X$, or restricting the set of measurable functions.} Accordingly, as of this writing, \verb|MeasureTheory| does \emph{not} have first-class $\sigma$-algebras, but rather considers them to be implicit to a given measure. Having said that, $\sigma$-algebras do have a role to play in applied measure theory, but we give only a pointer here. The practical importance of $\sigma$-algebras here lies therein that they also encode available information. Observe that each event $A$ corresponds to a question, with a probabilistic answer. For example, an event $A = \{\bX \in [c, d]\}$ corresponds to the question whether the random variable $\bX$ is in the interval $[c, d]$ and there is a probability $\operatorname{Prob}(A)$ that this will be the case. Assume we know whether some of such questions $A$, $B$ are answered (each with yes or no). Then we also know that the answer to the complement $A^c$ (no or yes), and we always know that $\Omega$ has probability 1 and the corresponding question is answered by `yes'. Likewise, if both $A$ and $B$ can be answered given what we know, we also know the answer to $A \cup B$. That means, these known events form an $\sigma$-algebra, and in particular for each random variable $\bX$ there is a $\sigma$-algebra associated with $\bX$ which encodes what else we know knowing $\bX$ and how we should assign (conditional) probabilities to other events knowing $\bX$. This is a very relevant question for probabilistic programming tasks and causal inference, and with \emph{kernels} \verb|MeasureTheory| does provide tools to reason about it which are computationally appropriate, because they are local. \subsection*{Densities} A measure is often described in terms of its \emph{density}. Before getting to a more technical discussion, we hope a physical analogy can help build some intuition. Imagine a wooden board with some knots in it, where we might be interested in the mass of some two-dimensional cut-out shape. This mass depends not only on the shape but also on its location and orientation, in particular the inclusion of knots. In this way we can start with a measure (here Lebesgue measure) and use a \emph{density} (the physical density of the wood) to construct a new measure (the mass of any given cut-out shape). Of course, we do this all the time with distributions, building a continuous distribution in terms of a \emph{probability density function (pdf)} over Lebesgue measure, or a discrete distribution in terms of a \emph{probability mass function (pmf)}, which is just a density over counting measure. Somewhat more formally, a probability density in Euclidean space is a \emph{local} ratio of probability assigned to an infinitesimally small volume/area $ \mathrm{d} x$ around each point $x$, relative to that volume itself \[ f(x) = \frac{\operatorname{Probability}( \mathrm{d} x)}{\operatorname{Volume}( \mathrm{d} x)} \ . \] ``Volume'' is not a distribution, but is in fact the Lebesgue measure described above. Discrete distributions can be expressed similarly using counting measure. There are certainly more events (sets) than outcomes (elements), so a probability density gives a local and parsimonious description of a distribution. More generally, for measures $\mu$ and $\nu$ (and an \emph{absolute continuity} condition, to be discussed), the density is \[ f(x) = \frac{\mu( \mathrm{d} x)}{\nu( \mathrm{d} x)} = \frac{ \mathrm{d}\mu}{ \mathrm{d}\nu}(x)\ . \] As we see, density only makes sense relative to some \emph{base measure}. Limiting ourselves to distributions makes this awkward to even discuss, but allowing measures as first-class objects means we can make this characterization more explicit, and thus more flexible. What sets \verb|MeasureTheory| apart from most libraries is that we don't sweep this under the rug, but rather address it head-on. In place of Lebesgue or counting measure, any measure we can express can play the role of $ \mathrm{d}\nu$ above. This becomes crucial in high-dimensional spaces, where working with other reference measures such as a product of normal distributions becomes a numerical requirement. (Mathematically, there is no infinite dimensional Lebesgue measure, so numerically, even high-dimensional Lebesgue measures can be problematic. \cite{https://doi.org/10.5281/zenodo.3931118} for example allows to express a target density with respect to product of normal distributions using the Boomerang sampler \cite{pmlr-v119-bierkens20a} for this reason.) \section{Locally dominated measures} One cannot expect to express a measure $\mu$ putting positive mass on a set $S$ relative to a second measure $\nu$ on $S$, if nothing is there to compare, that is if $\mu(S) > 0$ but $\nu(S) = 0$. You can't ``make something from nothing''. Given measures $\mu$ and $\nu$ defined on a common space $X$, we say $\mu$ is \emph{dominated by} $\nu$ if $\nu(S)=0$ implies $\mu(S)=0$ (or equivalently, $\mu(S)>0$ implies $\nu(S)>0$) for every measurable $S$. This is denoted by $\mu \ll \nu$, and is sometimes equivalently read as ``$\mu$ is \emph{absolutely continuous} with respect to $\nu$''. The Radon-Nikodym Theorem states that $\mu \ll \nu$ if equivalently there is a \emph{density} function $f$, often written $\frac{d\mu}{d\nu}:=f$, with the property that for every $S$, \[ \mu(S) = \int_S f\ \mathrm{d}\nu \ . \] The concept of absolute continuity is very useful for formal manipulations. However, the global nature of testing $\mu \ll \nu$ would require every support to be represented in a way that allows efficient computation of this relation. In particular, in applications based on Markov chain Monte Carlo, such global information about the measures at hand is not available. Even with such a capability, this approach would have its problems. It seems likely a user getting an error in response to requesting a density would often respond by restricting measures accordingly until the request can be fulfilled. Because of this, we instead define $\mu$ to be \emph{locally dominated} by $\nu$ near $x$, written $\mu \ll_x \nu$, if there is some neighborhood $N \ni x$ such that $\nu(N)>0$ (so it's not a degenerate case) and $\mu|_N \ll \nu|_N$ (absolute continuity between the restricted measures). A \emph{local density} can be defined similarly. In \verb|MeasureTheory|, the \verb|density| and \verb|logdensity| functions work in exactly these terms. For the remainder of this paper, ``(log-)density'' will always refer to the local (log-)density, and ``local'' will often be taken as understood. Density computations are typically done in log space. For example, if we're interested in $\frac{ \mathrm{d} \mu}{ \mathrm{d} \nu}$, we'll typically instead compute \verb|logdensity(μ, ν, x)|. Here and below, we'll often write the math in terms of densities and the code in terms of log-densities, despite unfortunate inconsistency between the two. There are several benefits to working in log-space. Results are much less likely to overflow or underflow, and the many products and exponents become sums and products, respectively. which are much more efficient to compute and to differentiate. Working locally and in log-space also gives us a convenient \emph{antisymmetry}, \begin{verbatim} logdensity(μ, ν, x) == -logdensity(ν, μ, x) \end{verbatim} In particular, \verb|logdensity(μ, ν, x)| takes special values in some common cases: \newcommand{\mathrel{\centernot{\ll}\!\!_x}}{\mathrel{\centernot{\ll}\!\!_x}} \begin{center} \begin{tabular}{@{}rrr@{}}\toprule & $\nu\ll_x \mu$& \text{(else)} \\\midrule $\mu\ll_x \nu$& (finite) & \verb|-Inf| \\ \text{(else)} & \verb|Inf| & \verb|NaN| \\\bottomrule \end{tabular} \end{center} \section{Base measures and density recursion} To this point, we've described the implementation in terms of the three-argument \verb|logdensity(μ, ν, x)|. But implementing things directly in these terms would require a definition for every pair of possible measures, which is of course intractable. We address this by instead assigning every measure a \emph{base measure}. This is defined locally, with default method \begin{verbatim} basemeasure(μ::AbstractMeasure, x) = basemeasure(μ) \end{verbatim} This allows users to define a base measure specific to a given neighborhood if they prefer, or to define a global base measure when that suffices. The log-density is then fundamentally expressed in term of the two-argument \verb|logdensity(μ, x)|, which gives the log-density with respect to this base measure. Thus we have \begin{verbatim} logdensity(μ, x) == logdensity(μ, basemeasure(μ, x), x) \end{verbatim} This leaves us with the question of how to compute the three-argument \verb|logdensity(μ, ν, x)| for general $\nu$. We implement this recursively, in an approach we refer to as \emph{density recursion}. If $\alpha$ is the base measure of $\mu$ and $\beta$ is the base measure of $\nu$, then \[ \frac{ \mathrm{d} \mu}{ \mathrm{d} \nu} = \frac{ \mathrm{d} \mu}{ \mathrm{d} \alpha} \frac{ \mathrm{d} \alpha}{ \mathrm{d} \beta} \left(\frac{ \mathrm{d} \nu}{ \mathrm{d} \beta}\right)^{-1}\ . \] In the implementation, \verb|logdensity(μ, α, x)| and \verb|logdensity(ν, β, x)| can be computed directly using the two-argument \verb|logdensity|. There may be a specific method for \verb|logdensity(α, β, x)|; if not, it will require a recursion step. In this process, we may reach a measure that serves as its own base measure. Such measures are \emph{primitive}, for example Lebesgue or counting measure. If \verb|logdensity| is called on two primitive measures with no explicit method, an error is thrown. The above serves as a high-level specification of the computational process. The low-level implementation will differ in some ways as we continue to tune it for performance. \section{Parameterized measures} A common challenge in building a library of distributions is the choice of \emph{parameterizations}. For example, in Stan \cite{Stan}, a \emph{negative binomial} distribution is parameterized by $\alpha$ and $\beta$, where \[ \operatorname{NegBinomial}(y \mid \alpha, \beta) =\binom{y+\alpha-1}{\alpha-1}\left(\frac{\beta}{\beta+1}\right)^{\alpha}\left(\frac{1}{\beta+1}\right)^{y}\ . \] In the Julia package \verb|Distributions.jl| \cite{Distributions.jl-2019}, this is instead given by \[ \operatorname{NegBinomial}(y \mid r, p) = \binom{y + r - 1}{r - 1} p^r (1 - p)^y \ . \] These are equivalent (let $r = \alpha$ and $p = \frac{\beta}{\beta + 1}$), and the inconsistency alone gives some evidence that it might be reasonable to prefer one or the other depending on the circumstances. Yet most libraries only allow one or the other (or yet another alternative) as \emph{the} negative binomial distribution. Other parameterizations require entirely different names. In \verb|MeasureTheory|, our approach avoids this problem. A \emph{parameterized measure} is defined by a struct of the appropriate type with a named tuple \verb|par| field. For example, \begin{verbatim} struct NegativeBinomial{N,T} <: ParameterizedMeasure{N} par :: NamedTuple{N,T} end \end{verbatim} We can then write \begin{verbatim} NegativeBinomial(r=10, p=0.75) \end{verbatim} or \begin{verbatim} NegativeBinomial(α=10, β=3) \end{verbatim} Calls to \verb|rand|, \verb|logdensity|, etc then delegate to methods according to the appropriate names. We use \verb|KeywordCalls.jl| \cite{KeywordCalls.jl}, so all names are resolved statically at compile time. \section{Kernels} A \emph{kernel} is a (measurable\footnote{That is, the function $x \mapsto \kappa(x)(A)$ must be measurable for every fixed $A$.}) function $\kappa$ that returns a measure. Equivalently, it represents a family of measures parameterized by its argument. Writing $\cM(Y)$ for ``measures on $Y$'', we can write this as \[ \kappa\colon X \to \mathscr{M}(Y)\ . \] A prominent application is a \href{https://en.wikipedia.org/wiki/Conditional_probability_distribution}{\emph{conditional distribution}}. In this case $\kappa$ is further restricted to be a \href{https://en.wikipedia.org/wiki/Markov_kernel}{\emph{Markov kernel}}, \[ \kappa\colon X \to \mathscr{P}(Y)\ , \] where $\mathscr{P}(Y)$ represents ``probability measures on $Y$''. If $\bX$ and $\bY$ are random variables defined on $X$ and $Y$, the kernel $\kappa$ defines a probability measure assigning every measurable $B\subset Y$ probability \[ P(\bY \in B \mid \bX = x) =: (\kappa(x))(B)\ . \] In \verb|MeasureTheory|, a kernel is represented as either a Julia function or a \verb|Kernel| object. The latter pairs a measure constructor with a mapping into its parameter space, and makes the functional relationship between argument of $\kappa$ and the returned measure transparent. A Markov kernel, in particular, corresponds to the distribution of a \emph{parametrized random variable}, a function with random outcomes (or to ``mechanisms'' in causal inference, for example in \cite{https://doi.org/10.5281/zenodo.1005091}). For example in \verb|MeasureTheory|, the kernel \[ \kappa\colon x \mapsto \cN(x,\sqrt{x}) \] can be expressed as \begin{verbatim} κ = kernel(Normal) do x (μ=x, σ=√x) end \end{verbatim} or equivalently \begin{verbatim} κ = kernel(Normal; μ=identity, σ=sqrt) \end{verbatim} corresponding to the random function \begin{verbatim} f(rng, x) = x + √x * randn(rng) \end{verbatim} In this example, working in terms of a \verb|kernel| allows us to make the linear relationship between the argument \verb|x| and \verb|mean(κ(x))| transparent. This could of course also be expressed as a parameterized measure. The difference is that kernels are lighter weight to build and have all the dynamism of functions, while the static nature of parameterized measures can make it easier to express some optimizations. Finally, kernels are key to expressing \href{https://en.wikipedia.org/wiki/Likelihood_function}{\emph{likelihoods}}, which we can use to formulate Bayesian conjugacy properties. We'll discuss this further in Section~\ref{Likelihoods}. \section{Markov chains} Some kernels $\kappa$ map elements of a state space $X$ to measures on the same space. In this case, repeated application of the kernel ``walks'' through $X$, yielding the law of a \href{https://en.wikipedia.org/wiki/Markov_chain}{\emph{Markov chain}}. We support this in \verb|MeasureTheory| through the \verb|Chain| combinator. This takes a kernel (or function) and a starting measure, and can be used with Julia's convenient \verb|do| notation. For example, we can write a Gaussian random walk as \begin{verbatim} mc = Chain(Normal(μ=0.0)) do x Normal(μ=x) end \end{verbatim} A random sample from a \verb|Chain| is an infinite sequence expressed as a iterator, e.g. \begin{verbatim} julia> r = rand(mc); julia> x = Iterators.take(r, 3) |> collect 3-element Vector{Any}: -0.4931543737034523 -0.5661895116186417 -1.3286977670590228 \end{verbatim} Thus, for example, we can evaluate \verb|mc| on the \verb|x| we just computed: \begin{verbatim} julia> logdensity(mc, x) -0.4149771036439342 \end{verbatim} Crucially, the call to \verb|rand| builds a struct containing a random seed, to ensure that repeated realizations of \verb|r| will be identical. To give us more control over the sampling procedure, \verb|Chain| is implemented using \emph{dynamic iterators} from \verb|DynamicIterators.jl| \cite{DynamicIterators.jl}. The appropriate $\sigma$-algebra for infinite sequences requires some care. A Markov chain on $X$ has $\sigma$-algebra generated by sets of \emph{sequences with finitely many constraints}.\footnote{That is, the smallest $\sigma$-algebra containing all sets of sequences which can be written as $\{x \colon x_i \in A_i \mid i \in I\}$ using collections of measurable sets $\{A_i \mid i\in I\}$ indexed by finite index sets $I$, called \href{https://en.wikipedia.org/wiki/Cylinder_set_measure}{\emph{cylinder sets.}}} \section{Densities and integrals} In working with measures, two computations that come up quite often are (Radon-Nikodym) \emph{differentiation} and (Lebesgue) \emph{integration}. It's often important to be able to do things like \begin{enumerate} \item For measures $\mu$ and $\nu$, obtain $f=\frac{ \mathrm{d}\mu}{ \mathrm{d}\nu}$ \item Given a measure $\nu$ and a function $f$, obtain a measure $\mu$ with $\mu(A)=\int_A f\ \mathrm{d}\nu$ \end{enumerate} Note that (1) is different from our current \verb|density| function, because no $x$ is specified. Computationally, this is called a \href{https://en.wikipedia.org/wiki/Closure_(computer_programming)}{\emph{closure}}. In \verb|MeasureTheory|, we write these as \begin{center} \verb|f = ∂(μ, ν)|\quad and\quad \verb|μ = ∫(f, ν)|\ . \end{center} This allows the Radon-Nikodym theorem to be expressed as \begin{center} \verb|f == ∂(∫(f, ν), ν)|\quad and\quad \verb|μ == ∫(∂(μ, ν), ν)|\ . \end{center} Because we often we want to work instead in log-space, we also include (and tend to prefer) the functions \verb|log∂| and \verb|∫exp|, for which we would write \begin{center} \verb|ℓ = log∂(μ, ν)|\quad and\quad \verb|μ = ∫exp(ℓ, ν)|\ , \end{center} which follow a similar law, \begin{center} \verb|f == log∂(∫exp(f, ν), ν)|\quad and\quad \verb|μ == ∫exp(log∂(μ, ν), ν)| \end{center} Finally, in terms of \verb|density| and \verb|logdensity|, we have \begin{verbatim} ∂(μ, ν)(x) == density(μ, ν, x) log∂(μ, ν)(x) == logdensity(μ, ν, x) \end{verbatim} \section{Pointwise products and likelihoods \label{Likelihoods}} For a parameter $\theta$ and data $x$, suppose we have a \href{https://en.wikipedia.org/wiki/Prior_probability}{\emph{prior}} $p(\theta)$ (momentarily assuming Lebesgue base measure) and \href{https://en.wikipedia.org/wiki/Likelihood_function}{\emph{likelihood}} $p(x | \theta)$. Then Bayes's Law gives the posterior density \[ p(\theta \mid x) = \frac{p(\theta)\ p(x \mid \theta)}{p(x)}\ . \] In practice, we rarely know the normalization factor $p(x)$, so we often work in terms of the unnormalized posterior density, \[ p(\theta)\ p(x \mid \theta)\ . \] Because this does not include the normalization, this does not integrate to one, and so it's not a probability density function. But there are no such problems as a density for a measure; the measure defined in this way has the same base measure as that of the prior. This \href{https://en.wikipedia.org/wiki/Pointwise_product}{\emph{pointwise product}} in probability often describes the fusion of information, in this case the fusion of information from prior and from the observations via the likelihood, but also shows up in related situation, such as \href{https://en.wikipedia.org/wiki/Sensor_fusion}{\emph{sensor fusion}} in signal processing. More generally, this ``prior times likelihood'' can be considered as an operation that takes a measure and a function, and returns a new measure. Given a measure $\mu$ with base measure $\alpha$, and a function $f$ defined on the support of $\mu$, $\mu \odot f$ is a measure with \[ \frac{ \mathrm{d} (\mu \odot f)}{ \mathrm{d} \alpha}(x) = \frac{ \mathrm{d}\mu}{ \mathrm{d}\alpha}(x)\ f(x)\ . \] In the special case where $f$ is a likelihood, it's important to keep track of whether it's represented in log space. For this, we have a \verb|Likelihood| type that ``knows'' about the measure it was derived from and adapts according to whether the user calls \verb|density| or \verb|logdensity|. The general method \begin{verbatim} ⊙(::AbstractMeasure, ::Likelihood) \end{verbatim} defaults to constructing a \verb|PointwiseProductMeasure| to hold the prior and likelihood, but we'll be extending this with more efficient methods for cases with conjugate priors. In the absence of conjugacy, the extra structure of this suspended form is convenient, for example to build approximations to a given measure of interest. The above \verb|Likelihood| type is specified using a kernel and observed data. Though it is not an \verb|AbstractMeasure|, we include a \verb|logdensity| method for computational convenience. The core of the implementation is then \begin{verbatim} struct Likelihood{F,S,X} k::Kernel{F,S} x::X end function logdensity(ℓ::Likelihood, p) return logdensity(ℓ.k(p), ℓ.x) end \end{verbatim} \section{Product and power measures} Given measures $\mu$ on $X$ and $\nu$ on $Y$, the \href{https://en.wikipedia.org/wiki/Product_measure}{\emph{(independent) product measure}} $\mu \otimes \nu$ is a measure on $X\times Y$. Just as Lebesgue measure on $\RR$ is \emph{generated} by defining its value on intervals, the product measure is generated by defining \[ (\mu \otimes \nu)(A\times B) = \mu(A)\ \nu(B)\ , \] for any measurable $A\subset X$ and $B\subset Y$. \verb|MeasureTheory| code uses exactly this notation, \verb|μ ⊗ ν|. This can be extended recursively to products of any finite number of measures. If $\mu$ is defined in terms of a base measure $\alpha$ and likewise $\nu$ over $\beta$, the product measure has base measure $\alpha \otimes \beta$ and density \[ \frac{ \mathrm{d}(\mu \otimes \nu)}{ \mathrm{d}(\alpha \otimes \beta)} = \frac{ \mathrm{d}\mu}{ \mathrm{d}\alpha}\ \frac{ \mathrm{d}\nu}{ \mathrm{d}\beta}\ . \] A special case of this is when $\mu = \nu$. In \verb|MeasureTheory| we refer to this as a \emph{power measure}, written \verb|μ^2| or \verb|μ^n| for higher dimensions. More generally, the second argument can be a \verb|Tuple|, so for example \verb|μ^(2,3)| extends $\mu$ as a product measure over $2\times 3$ matrices. A second special case is when we have a collection of values together with a kernel. For this we use the \verb|For| combinator. So in a regression model, we might express the response as coming from \begin{verbatim} For(1:n) do j Normal(β * x[j], σ) end \end{verbatim} This is exactly the product measure \[ \bigotimes_{j=1}^n \cN(\beta x_j,\ \sigma)\ . \] More generally, suppose we have a measure $\mu$ on a space $X$ and a kernel $\kappa\colon X \to \cM(Y)$. Then we can define a measure on $X \times Y$ as follows. For a given $x \in X$ with $\mu \ll_x \alpha$, let $\nu_x = \kappa(x)$ have base measure $\beta_x$. Then similarly to the independent product, we have \[ \frac{ \mathrm{d}(\mu \otimes \nu_x)}{ \mathrm{d}(\alpha \otimes \beta_x)} = \frac{ \mathrm{d}\mu}{ \mathrm{d}\alpha}\ \frac{ \mathrm{d}\nu_x}{ \mathrm{d}\beta_x}\ . \] Because the types are always available to help us distinguish this from the independent case, it's safe to use the same notation, \verb|μ ⊗ κ|. Note that this defines a function \[ \otimes \colon \cM(X) \times (X \to \cM(Y)) \to \cM(Y)\ . \] In functional programming, this (together with some laws) is called a \href{https://en.wikipedia.org/wiki/Monad_(functional_programming)}{\emph{monadic bind}} \cite{ramsey2002stochastic}. \section{Superposition and mixtures \label{superposition}} A \emph{superposition} is the measure-theoretic analog of a mixture model. For measures $\mu$ and $\nu$ with $f=\frac{ \mathrm{d}\mu}{ \mathrm{d}\alpha}$ and $g=\frac{ \mathrm{d}\nu}{ \mathrm{d}\beta}$, the superposition, written $\mu + \nu$, is a measure with base measure $\alpha + \beta$ and density \[ \begin{aligned}\frac{ \mathrm{d}(\mu+\nu)}{ \mathrm{d}(\alpha+\beta)} & =\frac{f\, \mathrm{d}\alpha+g\, \mathrm{d}\beta}{ \mathrm{d}\alpha+ \mathrm{d}\beta}\\ & =\frac{f\, \mathrm{d}\alpha}{ \mathrm{d}\alpha+ \mathrm{d}\beta}+\frac{g\, \mathrm{d}\beta}{ \mathrm{d}\alpha+ \mathrm{d}\beta}\\ & =\frac{f}{1+\frac{ \mathrm{d}\beta}{ \mathrm{d}\alpha}}+\frac{g}{\frac{ \mathrm{d}\alpha}{ \mathrm{d}\beta}+1}\\ & =\frac{f}{1+\left(\frac{ \mathrm{d}\alpha}{ \mathrm{d}\beta}\right)^{-1}}+\frac{g}{\frac{ \mathrm{d}\alpha}{ \mathrm{d}\beta}+1}\ . \end{aligned} \] Using the inverse in this final line allows $\frac{ \mathrm{d}\alpha}{ \mathrm{d}\beta}$ to computed once and then re-used. Also note that in the special case where $\alpha=\beta$, this reduces to $\frac{f+g}{2}$. An important special case of superposition occurs when $\mu$ and $\nu$ are finite measures on some space $\Omega$, and $\mu(\Omega) + \nu(\Omega) = 1$. This is equivalent to a convex combination of probability densities, called a \href{https://en.wikipedia.org/wiki/Mixture_distribution}{\emph{mixture}}. Conveniently, a product of measures distributes over superposition. That is, if $\alpha$ and $\beta$ are measures on a common space $X$ and $\gamma$ and $\delta$ are measures on $Y$, then \[ \alpha \otimes (\gamma + \delta) = \alpha \otimes \gamma + \alpha \otimes \delta\ , \] and \[ (\alpha + \beta) \otimes \gamma = \alpha \otimes \gamma + \beta \otimes \gamma\ . \] A very common special case of superposition is a \href{https://en.wikipedia.org/wiki/Spike-and-slab_regression}{\emph{spike and slab prior}}, a mixture of a \href{https://en.wikipedia.org/wiki/Dirac_measure}{\emph{Dirac measure}} (a point mass) with a continuous measure. This is useful for sparse Bayesian modeling, as implemented in the \emph{sparse ZigZag sampler}, described in \cite{arxiv2103.08478} and implemented in \cite{https://doi.org/10.5281/zenodo.3931118} using \verb|MeasureTheory|. \section{Density decomposition} Especially for probability measures, it's common for the log-density with respect to Lebesgue or counting measure to have several types of terms. Given an observation $x$ and any relevant parameters, there are typically \begin{itemize} \item[$\bullet\!$] Terms that are \emph{data-dependent}, each involving some nontrivial function of $x$ (and possibly also of the parameters), \item[$\bullet\!$] Terms that are \emph{parameter-dependent}, and \item[$\bullet\!$] Terms that are \emph{constant}. \end{itemize} In addition, it's common to have an ``argument check'' to be sure $x$ is in the support of the distribution. Depending on the application, we can often ignore some of these. For example, we may know $x$ is in the support by construction, or from a previous check. In these cases, any use of resources to check arguments is wasteful. There are many cases where it's important for performance to have constant and parameter-dependent terms separated from data-dependent ones. Suppose $\mu$ is a measure with log-density of the form \[ \log \frac{ \mathrm{d}\mu}{ \mathrm{d}\nu}(x) = \ell(x; \theta) = f(x,\theta) + g(\theta) + C\ . \] If we instead observe an iid product of $N$ observations, the log-density is \[ \begin{aligned} \sum_{j=1}^N\ell(x_j; \theta) &= \sum_{j=1}^N \left[ f(x_j,\theta) + g(\theta) + C\right] \\ &= N [g(\theta) + C] + \sum_{j=1}^N f(x_j,\theta)\ . \end{aligned} \] This final form can be much more efficient, because it reduces $N$ repeated computations of $g(\theta) + C$ to one. In some cases it's important to avoid computing $g(\theta) + C$ at all. For correlation matrices, it's common to use the LKJ prior \cite{LEWANDOWSKI20091989}. Rather than work with correlation matrices directly, it's convenient to work in terms of the Cholesky decomposition. For this purpose, \verb|MeasureTheory| includes an \verb|LKJCholesky| measure. This is typically used as a prior with fixed parameters $k$ and $\eta$, which give the dimensionality and ``concentration'' of the measure. The relative cost of normalization (which is irrelevant for MCMC) can be computed as \begin{verbatim} function relative_normcost(k, η) μ = LKJCholesky(k, η) L = rand(μ).L f_cost = @belapsed logdensity($μ, $L) g_plus_C_cost = @belapsed Dists.lkj_logc0($k, $η) return g_plus_C_cost / (g_plus_C_cost + f_cost) end \end{verbatim} So for example, in 10 dimensions with $\eta=2.0$ this gives \begin{verbatim} julia> relative_normcost(10, 2.0) 0.76428528899935 \end{verbatim} That is, 76\% of the time is spent in normalization. If our application doesn't need it, three-fourths of the computation time is simply wasted. For these reasons, we break the representation of the log-density into several pieces (now additive terms in log-space): \begin{enumerate} \item \emph{Constant} terms, $-\frac{1}{2}\log 2\pi$\ . \item \emph{Parameter-dependent} terms, $-\log \sigma$\ . \item \emph{Data-dependent} terms, $-\frac{1}{2}\left(\frac{x - \mu}{\sigma}\right)^2$\ . \end{enumerate} The two-argument \verb|logdensity| then computes only the data-dependent terms, with the constant and parameter-dependent terms pushed to the base measure. This makes it easy to defer computation of these terms until they are required. \section{Affine transforms} \label{affine} A particularly expressive way to build new measures in terms of existing ones is through a \emph{pushforward}. Given a measure $\mu$ and a function $f$ defined on its support, the \href{https://en.wikipedia.org/wiki/Pushforward_measure}{\emph{pushforward of $\mu$ through $f$}} is a measure $f_*\mu$ defined by \[ f_*\mu(S) = \mu(f^{-1}(S))\ . \] In the following sections, we first discuss in the context of probability measures before the more general case. \subsection*{Forward parameterization} Starting with a $k$-dimensional multivariate random variable $z$, an \href{https://en.wikipedia.org/wiki/Affine_transformation}{\emph{affine transform}} is a ``linear transform with a shift''. We can use this to define a new random variable $x$, as \[ \bX = \sigma \bZ + x_0\ , \] with $\sigma$ and $x_0$ of the appropriate dimensions.\footnote{We would typically use $\mu$ in place of $x_0$, if not for the unfortunate potential confusion with $\mu$ as a name for a measure.} If $\EE[\bZ]=0$, then $x$ has mean \[ \EE[\bX] = \sigma \EE[\bZ] + x_0 = x_0 \] and variance matrix \[ \VV[\bX] = \EE[(\bX-x_0)(\bX-x_0)^t] = \EE[\sigma \bZ \bZ^t \sigma^t] = \sigma \VV[\bZ] \sigma^t\ . \] Note that if $\VV[\bZ]=I_k$, we get $\VV[\bX]=\sigma \sigma^t$, so we can arrive at a given positive semidefinite $\VV[\bX]=\Sigma$ by taking $\sigma$ to be its \href{https://en.wikipedia.org/wiki/Cholesky_decomposition}{\emph{lower Cholesky factor}}. Also, in the special case of a one-dimensional Gaussian, this gives the familiar $\VV[\bX] = \sigma^2$. We call this the \emph{forward parameterization} because it's especially convenient for sampling, sometimes referred to as ``running the model forward''. Unfortunately, the cost of this convenience is a relatively awkward expression for the density. In this case, we start with $x$ and need to solve $z$, finally adjusting according to the determinant of the transformation: \[ p_\bX(x) = \frac{1}{|\sigma|}\ p_\bZ(z) = \frac{1}{|\sigma|}\ p_\bZ\left(\sigma^{-1} (x - x_0)\right)\ , \] where $|\sigma|$ is the \href{https://en.wikipedia.org/wiki/Determinant}{\emph{determinant}} of the square matrix, and the second equality comes from solving for $z$, which gives $z=\sigma^{-1}(x-x_0)$. More generally (when the transform is not expressed as a matrix), this role is played by the determinant of the \href{https://en.wikipedia.org/wiki/Jacobian_matrix_and_determinant}{\emph{Jacobian}}, $\left|\frac{ \mathrm{d} x}{ \mathrm{d} z}\right|$. This requires solving a linear system. Even with $\sigma$ being lower-triangular, this involves division operations and the allocation of a temporary vector for storage of $z$. In many cases, we prefer the density (or log-density, really) to be fast to evaluate. This leads us to a kind of dual approach to the above. \subsection*{Inverse parameterization} An alternative parameterization of a multivariate Gaussian is in terms of its \href{https://en.wikipedia.org/wiki/Precision_(statistics)}{\emph{precision matrix}}, $\Psi = \VV[\bX]^{-1}$. Similarly to above, we'll write $\psi$ for the lower Cholesky factor of $\Psi$, so $\psi \psi^t = \Psi$. The parameterization is then specified by \[ \bZ = \psi(\bX - \mu)\ . \] Solving for $z$ is of course now very simple, and the density becomes \[ p_\bX(x) = |\psi|\ p_\bZ(z) = |\psi|\ p_\bZ(\psi (x - \mu))\ . \] In exchange, forward sampling becomes awkward, \[ \bX = \psi^{-1}\bZ + \mu\ . \] \subsection*{Generalization} Given an injective map $f\colon z \mapsto x$ and measures $\mu \ll_z \alpha$, the pushforward has density \[ \frac{ \mathrm{d}\ f_*\mu}{ \mathrm{d}\ f_*\alpha}(x) = \frac{ \mathrm{d} \mu}{ \mathrm{d} \alpha}\left(f^{-1}(x)\right) = \frac{ \mathrm{d} \mu}{ \mathrm{d} \alpha}(z)\ . \] Note that there's no Jacobian to be found! This is because the measure and base measure are either both transformed, or both not. In fact, the Jacobian $\left|\frac{ \mathrm{d} x}{ \mathrm{d} z}\right|$ only comes into play when we compute ``across the transform'', and even then it's not in every case. Changing our notation slightly, the general case is \[ \frac{f_*\mu( \mathrm{d} x)}{\alpha( \mathrm{d} z)} = \frac{1}{ \left| \frac{ f_*\alpha( \mathrm{d} x) }{ \alpha( \mathrm{d} z) } \right| } \frac{\mu( \mathrm{d} z)}{\alpha( \mathrm{d} z)}\ . \] This decomposes the problem into two subproblems. First we must compute $\left| \frac{ f_*\alpha( \mathrm{d} x) }{ \alpha( \mathrm{d} z) } \right|$. This plays the role of the determinant of the Jacobian, but is specific to the base measure $\alpha$. In particular, $\alpha$ might be a discrete measure, in which case this factor is one. Finally, we compute $\frac{\mu( \mathrm{d} z)}{\alpha( \mathrm{d} z)}$, which is just the (pre-transformation) density, more familiar from previous discussion as $\frac{ \mathrm{d} \mu}{ \mathrm{d} \alpha}(z)$. For the Lebesgue case, if the Jacobian $\left|\frac{ \mathrm{d} x}{ \mathrm{d} z}\right|$ is not square but, say, $n\times k$ for $n>k$, the resulting measure will be \href{https://en.wikipedia.org/wiki/Embedding}{\emph{embedded}} into a $k$-dimensional affine subspace of $\RR^n$. This can be convenient for low-rank modeling, which can be important for high-dimensional data. If $\sigma$ has QR decomposition $\sigma=Q R$, we can use $|R|$ in place of $|\sigma|$ or $\left|\frac{ \mathrm{d} x}{ \mathrm{d} z}\right|$ above, since columns of $Q$ are orthonormal (so it's a change of basis and does not ``stretch'' the space). Our implementation is a variation of this that's equivalent but more efficient to compute. \section{Extensions} Despite it being a very new package, \verb|MeasureTheory.jl| there is already active work to build up on it and to extend it. \verb|PointProcesses.jl|\cite{Dalle_PointProcesses.jl} defines \href{https://en.wikipedia.org/wiki/Point_process}{\emph{point processes}}, in particular requiring the concept of \href{https://en.wikipedia.org/wiki/Random_measure}{\emph{random measure}}. \verb|ManifoldMeasures.jl|\cite{manifoldmeasures} implement measures on a \href{https://en.wikipedia.org/wiki/Manifold}{\emph{manifold}}, using \href{https://en.wikipedia.org/wiki/Hausdorff_measure}{\emph{Hausdorff measure}} as the base measure. \verb|MultivariateMeasures.jl|\cite{multivariatemeasures} gives high-performance implementations of \verb|logdensity| for multivariate measures, using \verb|LoopVectorization.jl|\cite{loopvectorization}. \verb|Soss.jl|\cite{scherrer2020soss} is a \href{https://en.wikipedia.org/wiki/Probabilistic_programming}{\emph{probabilistic programming language}} that has recently adopted \verb|MeasureTheory.jl| as a foundation. In particular, every Soss \verb|Model| is an instance of \verb|AbstractMeasure|, and has another Soss model as its base measure. As mentioned in Section~\ref{superposition}, \verb|ZigZagBoomerang.jl|\cite{https://doi.org/10.5281/zenodo.3931118} allows sampling with a spike and slab prior for sparse Bayesian inference and makes use the freedom to choose appropriate reference measures. These models can be expressed using Soss. \verb|Mitosis.jl|\cite{arxiv2010.03509} uses \verb|MeasureTheory.jl| to represent Bayesian networks via Markov kernels and defines transformations on those. \section{Related work} Narayanan et al \cite{narayanan2016probabilistic} describe \verb|Hakaru|, a system for Bayesian modeling using measures. Here, a measure is a functional \[ \mu[f] = \int f\ \mathrm{d}\mu\ , \] represented as a program. Hakaru's combinators are then expressed as compilers taking programs as the inputs. Radul and Alexeev \cite{Radul2020} describe the \emph{base measure problem} of losing track of a base measure when applying a transformation, and suggest standardizing around Hausdorff measure as a solution. This problem doesn't arise for us, because the base measure is always taken into account. Borgstr\"om et al \cite{Borgstr_m_2013} describes the \verb|Fun| system in F\# in terms of \emph{measure transformer semantics}, but discusses only \emph{finite} measures. In Julia \cite{bezanson2017julia}, the \verb|Distributions.jl| package \cite{Distributions.jl-2019} is very popular for computations on distributions. The drawbacks of \verb|Distributions.jl| are essentially those described in the first few sections of this paper. Current advantages over \verb|MeasureTheory| are the extensive range of distributions it implements and its popularity and familiarity to many Julia users. \verb|MeasureTheory.jl| currently has \verb|Distributions.jl| as a dependency, and uses it as a fall-back for many computations. For convenience, we also re-export the \verb|Distributions| module under the handle \verb|Dists|. \section{Conclusion} We have introduced the concepts and implementation of \verb|MeasureTheory.jl|. This package is very new, so we expect there will be some changes as it matures. For this reason we have limited our discussion to aspects of the implementation we believe are relatively stable. We hope this work can become a common foundation for probabilistic modeling in Julia. In particular, we believe this approach is especially well-suited for use in probabilistic programming, for which Julia has such a robust and active community. We welcome discussion and community involvement with this package, as well as additional extensions to those we have described. \input{bib.tex} \end{document}
\section{Introduction} High-stability microwave sources are ubiquitous in modern technology, underpinning communication, computing, and RADAR and sensing systems. Most of the latter systems rely on room-temperature crystal oscillators as local oscillators and frequency references. These commercially available electronic sources, however, exhibit phase noise that is unlikely to support next-generation systems that will require improved resolution and signal-to-noise ratios for higher density communications, micro-Doppler radar, and quantum sensing. More specifically, in Doppler radar, lower close-to-carrier phase noise would increase sensitivity to slow-moving objects, or to objects with low cross section \cite{Ye2000, Fortier2011, Xie2017}. This technique may also aid in the advancement of near-Earth asteroid mapping for both collision warning systems and for the detection of minerals for use on earth or in space \cite{asteroids2015}. In wireless telecommunications, higher spectral purity would also permit lower error rates for phase-encoded signals, and thus higher throughput \cite{Koenig2013}. Finally, sources with lower timing jitter could increase the resolution in analog-to-digital converters \cite{Valley2007}. Photonically generated microwave signals exploit the high Quality-factors of ultra-stable optical references \cite{Schioppo2016,Young1999} to permit extraction of frequency-divided signals with ultra-low phase noise and high stability. To date, X-band signals near 10 GHz with the highest spectral purity have been achieved via optical frequency division (OFD) using self-referenced optical frequency combs (OFC) \cite{Zhang2010,Haboucha2011,Fortier2013,Xie2017,Kalubovilage2020,Nakamura2020}. Optical frequency combs, based on mode-locked femtosecond lasers, enable a phase-coherent link between the optical and microwave domains. When an OFC is phase stabilized to a ultra-narrow linewidth cavity-stabilized laser, designed to probe a long-lifetime atomic clock transition, it can permit extraction of a 10 GHz microwave signal with phase noise below -100 dBc/Hz at 1 Hz offset from carrier and with a signal-to-noise ratio close to 180 dB in a 1-Hz bandwidth \cite{Fortier2013}. Consequently, when compared to other room-temperature oscillators, OFD allows for greater than 50 dB improvement in close-to-carrier phase noise sidebands. Although OFD via phase-locked OFC (PL-OFD) has demonstrated record performance in the domain of room-temperature microwave generation, it suffers two drawbacks. Firstly, it requires tight phase locking of the OFC to an optical reference. This can result in additive instability, and loss of timing due to cycle slips, if noise on the modelocked laser cannot be adequately suppressed by feedback actuators with limited bandwidth. Secondly, tight phase locking of an OFC generally only permits the derivation of low-noise microwave signals from a single optical reference. Consequently, each optical reference requires a corresponding OFC for division to the microwave regime, which may hinder technological implementation due to the increased power consumption and size. The transfer oscillator (TO) technique \cite{Telle2002} for OFD (TO-OFD) provides solutions to both of the aforementioned limitations. Rather than relying on physical actuators for phase-locking, the transfer oscillator technique employs electronics to add, subtract and divide RF signals in order to remove OFC phase noise from the divided-down optical reference. Due to the absence of physical actuators, the bandwidth of the TO electronics can be several megahertz, decoupling the optical-to-microwave division from the dynamics of the OFC and increasing the robustness of the generated microwave signals. Additionally, the TO technique can simultaneously divide multiple independent optical references with a single OFC and enable the generation of multiple independent low-noise microwave signals. These advantages help support the development of low-noise microwave flywheels derived from optical references, which are needed for realization of optical atomic time for future redefinition of the SI second \cite{Yao2019}. Furthermore, TO-OFD may help to improve multi-frequency radar, which can provide high-resolution images for resource exploration and military ventures \cite{Pfitzenmaier2019}. The TO technique may also help facilitate low-noise microwave generation from chip-scale OFCs that are difficult to stabilize \cite{Lucas2020} or from highly robust polarization-maintaining linear fiber lasers \cite{Baumann2009,Sinclair2014,Feng2015,Cingoz2011} that exhibit higher intrinsic noise. In this work, we employ a free-space Er/Yb:glass optical frequency comb as a transfer oscillator to derive low phase noise 10 GHz microwave signals from optical reference cavities at 1157 nm and 1070 nm that serve as local oscillators for the Yb-lattice \cite{McGrew2018} and single-ion Al \cite{Brewer2019} clocks at NIST. Although the optical clocks were not operational for this work, the free-running optical references provided light with high-spectral purity and low drift ($\ll$ 1 Hz/s). From the latter optical references we extracted two independent 10 GHz signals, using a single OFC, with absolute phase noise below -106 dBc/Hz at 1-Hz offset from carrier, and 1-s fractional frequency instabilities below $2\times10^{-15}$. To the best of our knowledge, the results we obtained represent the lowest close-to-carrier phase noise reported to date using the transfer oscillator technique, providing suppression of OFC noise in excess of 100 dB below a 1 Hz offset. It is also the first demonstration of the synthesis of multiple microwave signals based on independent reference cavities with a single OFC. \begin{figure*} \includegraphics[width=17cm]{Figures/1.pdf} \caption{Transfer oscillator setup with a 500 MHz repetition rate Er/Yb:glass OFC. Optical pulses from the Er/Yb:glass oscillator are fiber-coupled and amplified by an EDFA before being sent through an HNLF for supercontinuum generation. The spectrum is split in two paths, one for carrier-envelope offset frequency detection, and one for detection of heterodyne beat signals between the OFC and light from two cavity-stabilized optical references at 1157 nm and 1070 nm. An optical interleaver multiplies the repetition frequency to 2 GHz, which is detected on an MUTC photodiode whose spectrum near 10 GHz is shown in the bottom-right inset (RBW = 300 kHz). The optical beats, $f_\text{b1}$ and $f_\text{b2}$, and the 10 GHz harmonic of the 2 GHz pulses are sent to two TO circuits along with $f_\text{ceo}$. Each circuit generates a 10 GHz output, $f_\text{TO,i}$, that is derived from one of the two optical references by adding and dividing microwave signals, shown in blue boxes in upper right. Although the two TO electronics boards are identical except for bandpass filters to isolate $f_{bi}$, the top board in the figure is used to represent the transfer oscillator mathematical operations and the bottom board shows the 2-DDS scheme as well as the approximate RF frequencies at each stage. The following integer constants are used: $M = 20$, $N_1 = $ 518,907 and $N_2 = $ 561,211.} \label{fig:setup} \end{figure*} \section{Experimental Setup} Photonics-based microwave generation can be separated into three distinct experimental stages: 1) the optical reference that defines a lower limit to the system stability and phase noise, 2) the phase-coherent division performed by the optical frequency comb that enables faithful transfer of the optical reference stability and phase noise to the microwave domain and, 3) the electronic detection and synthesis, which includes photodetection as a means to demodulate the optical signals, and here, a digital transfer oscillator technique that enables electronic removal of OFC noise from the photodetected X-band microwave signals. In the sections below, we describe the details of constituent components in our low-noise microwave generation setup and their impact on the derived 10 GHz microwave signals. \subsection{Low-noise optical references} In this work, we employed optical references derived from lasers stabilized to state-of-the-art optical Fabry-Perot cavities \cite{Schioppo2016,Young1999}. As mentioned previously, the optical reference sets the ultimate limit to the noise performance in photonic microwave generation via optical frequency division with an OFC. To minimize instabilities resulting from environmental effects, the cavities are housed within several layers of thermal and acoustic shielding and employ both passive and active vibration control to isolate the cavity length from changes due to acceleration. The room-temperature Fabry-Perot cavities ($\sim$ 30 cm long) act as length references, that at the time of the writing of this manuscript, can support fractional length instabilities near 1 part in $10^{16}$. These cavities act as optical frequency filters when a laser is stabilized to one of their longitudinal optical modes, transferring the cavity length stability to frequency stability of the laser light. Currently, the uncertainty in the cavity length, for timescales greater than 1 second, is limited by thermally induced Brownian noise in the mirror coatings and by unidirectional length changes in the cavity due to settling of the ultra-low expansion glass that comprises the spacer. As such, these optical references can support phase noise as low as -120 dBc/Hz at a 1 Hz offset on a 10 GHz carrier and greater than 200 dB of signal-to-noise ratio in a 1 Hz bandwidth. Shorter and smaller cavities, more suitable for portable optical atomic clocks and that can support out-of-lab use, are being actively developed \cite{DavilaRodriguez2017, Kelleher2021}. The negative impact of the shorter cavity lengths on the fractional instability can be balanced by optical techniques to improve the thermal noise and by employing crystalline mirror coatings with higher mechanical stiffness, permitting fractional instabilities near 1 part in 10$^{15}$ for cavity lengths of approximately 25 mm \cite{Cole2013}. It has also been demonstrated that a free-running OFC can serve as its own optical reference cavity while simultaneously performing the optical-to-microwave division \cite{Kalubovilage2020}. By employing a high-stability monolithic modelocked laser, oscillator length fluctuations are minimized while simultaneously generating a coherent spectrum with which to link optical frequencies to microwave frequencies. While less complex, this solution only permits low phase noise at offset frequencies > 10 kHz. Drift in the modelocked laser cavity yields significantly higher noise than is possible when using Fabry-Perot optical reference cavities. \subsection{Optical-to-microwave division: Er/Yb:glass OFC} Optical frequency combs, based on modelocked laser spectra, permit phase coherent transfer of signals between the optical and microwave domains due to the fixed phase relationship between the resonant optical modes. As a result of this phase relationship, the optical spectra of OFCs consist of hundreds of thousands to millions of equidistant frequency modes where each individual mode of the OFC optical spectrum can be described by the following comb equation, \begin{equation} \nu_N = f_\text{ceo} + N f_\text{rep}, \label{eq:one} \end{equation} where $f_\text{ceo}$ (carrier-envelope offset frequency) is a frequency offset common to each optical mode, $N$ is an integer representing the optical mode number and $f_\text{rep}$ (repetition frequency) is the optical mode spacing. We denote optical frequencies with the "$\nu$" symbol and RF frequencies with the "$f$" symbol. Interference of the OFC light with single frequency light from an optical reference yields a heterodyne beat signal, $f_b = \nu_\text{opt} - \nu_N$, between the optical frequency $\nu_\text{opt}$ and a nearby OFC mode $\nu_N$. By rewriting Equation \ref{eq:one} as $(\nu_N-f_\text{ceo})/N = f_\text{rep}$, it is evident that frequency deviations on $f_\text{rep}$ are $N$ times smaller than those of the optical mode, $\nu_N$. As a result, by referencing an OFC to a high-stability and low-noise optical reference, $\nu_\text{opt}$, this frequency relationship between the optical and mode spacing of the OFC can be exploited to derive microwave signals with high spectral purity. Electronic signals derived in this manner also preserve the stability of the optical reference, such that, ideally $\sigma = \frac{\delta \nu}{\nu} =\frac{\delta f}{f}$. Additionally, photonically generated microwave signals permit a reduction in the phase noise of the optical reference by $(N/M)^2$ when photodetecting the $M$th harmonic of the OFC repetition rate, $f_\text{rep}$. When dividing the 1157 nm (259 THz) and 1070 nm (280 THz) optical reference to 10 GHz, this results in a reduction in phase noise by 88.3 dB and 89.0 dB, respectively. The optical frequency comb used in our measurements employs a home-built 1550 nm, 500 MHz repetition rate, free-space modelocked laser based on Er/Yb co-doped phosphate glass \cite{Lesko2020}. Passive mode-locking, with an output power around 70 mW, is achieved in the laser via a semiconductor saturable absorption mirror (SESAM). The laser and its supporting optics are illustrated in Figure \ref{fig:setup}. The 500 MHz optical pulse train generated by the mode-locked laser is fiber-coupled and amplified in an Erbium doped fiber amplifier (EDFA) and then launched into a $\sim 1$ m highly nonlinear fiber (HNLF) to provide nonlinear frequency conversion from the input pulse at 1550 nm (bandwidth $\sim 13$ nm) to an optical octave of bandwidth (1 $\mu$m to 2 $\mu$m). The optical octave is coupled into free space, at which point a part of the spectrum is split off with a dichroic mirror and sent to a periodically-poled lithium niobate (PPLN) waveguide to permit self-referenced detection of $f_\text{ceo}$ via $f$-to-$2f$ conversion \cite{Telle1999, Reichert1999}. The remainder of the light is used to derive optical beat signals against the two high stability optical references at 1070 nm and 1157 nm. The combined light from the OFC and optical references is sent through a two-stage pulse interleaver and focused onto a highly linear Modified Uni-Traveling Carrier (MUTC) photodetector ($\sim 12.5$ GHz bandwidth, 50 $\mu$m active area diameter, -16 V bias) \cite{Li2011,Li2010}. The pulse interleaver effectively multiplies the pulse repetition rate from 500 MHz to 2 GHz \cite{Haboucha2011}, increasing the strength of the recovered 10 GHz microwave tone, which consequently improves the thermally detected noise floor by mitigating photodetector nonlinearities that result at high optical pulse energies. Since the optical beat signals due to interference between the optical references and optical modes of the OFC are detected on the same MUTC photodiode, the RF output is split with a 1-to-4 power splitter and the optical beats and 10 GHz carrier are isolated from one another with narrow electrical bandpass filters. Since TO-OFD permits the extraction of microwave signals via removal of the additive OFC noise, the technique only requires control of the modelocked laser oscillator length such that the optical beat does not drift outside a range bounded by $f_\text{rep}/2$. In this experiment, the narrow-bandpass filters, mentioned above (bandwidth $\approx 5$ MHz), are required to isolate the optical beats from nearby signals. To keep this beat centered on the narrow electronic filter, we employ a loose frequency lock (bandwith < 10 Hz) by monitoring $f_\text{rep}$ and feeding back on the OFC cavity length. This maintains the optical beat close to the center of its bandpass filter. The $f_\text{ceo}$ beat signal is uncontrolled as it drifts by only few MHz over the course of multiple days. \subsection{Microwave generation: detection and transfer oscillator electronics} To generate a 10 GHz signal from the OFC, while simultaneously removing its noise contributions, the TO technique requires the detection of 1) the $M$th harmonic of the OFC repetition frequency, $M f_\text{rep}$, near 10 GHz, 2) the carrier-envelope offset frequency, $f_\text{ceo} < 250$ MHz, and 3) the RF beat between each optical reference (subscript $i$) and the $N_\text{i}$th OFC mode, $f_\text{b,i} = \nu_\text{opt,i} - \nu_{N_\text{i}}$ also coincidentally near 10 GHz. The harmonic $M f_\text{rep}$ is chosen such that it is close to the desired output microwave carrier frequency of 10 GHz. Here, $f_\text{b,i}$ was chosen to be near 10 GHz due to the availability of X-band electronics. The three beat signals above are mixed such that \begin{equation} f_\text{TO,i} = M f_\text{rep} + \frac{M}{N_\text{i}} \left( f_\text{b,i} + f_\text{ceo} \right) = \frac{M}{N_\text{i}}\nu_\text{opt,i}, \label{eq:two} \end{equation} which yields a 10 GHz microwave signal free of OFC noise. The resultant microwave signal is dependent only on the static values of $N_\text{i}$ and $M$ and the optical reference frequency $\nu_\text{opt}$. The electronics to facilitate the above signal processing are displayed pictorially in Figure \ref{fig:setup} and described in detail below. \textbf{1) Signal detection:} In our demonstration, we select the $M=20$ harmonic of $f_\text{rep}$ to generate a microwave carrier signal near 10 GHz. The high-power, high-linearity MUTC photodiode and the optical interleaver help to generate 1 dBm of microwave power at 10 GHz. The OFC mode numbers $N_\text{i}$ with which the two optical references at 1157 nm and 1070 nm interfere are $N_1=518,907$ and $N_2=561,211$, respectively. From this, two optical heterodyne beat signals, $f_\text{b,1}$ and $f_\text{b,2}$, are derived near 10 GHz, with signal strengths varying from -80 dBm to -65 dBm. A separate InGaAs photodetector (EOT 3000A) is used to detect $f_\text{ceo}$. \textbf{2) Removal of \boldsymbol{$f_\text{ceo}$} noise:} Each detected heterodyne optical beat signal is routed to its own TO circuit and sent through a series of high-Q bandpass filters (bandwidth $\approx 5$ MHz) to remove the high-power harmonics of $f_\text{rep}$. The filtered signal is then amplified to 10 dBm. The amplified beat is then used to drive the LO port of an IQ mixer (Marki MMIQ-0520L). The OFC offset frequency and its corresponding noise, ($f_\text{ceo}\approx$ 165 MHz), are removed from $f_\text{b,i}$ using an IQ mixer and hybrid coupler with 30 dB of image rejection. This permits the addition or subtraction of signals without a bandpass filter to suppress the unwanted sideband. The result of this operation is $f_\text{b,i} + f_\text{ceo} = \nu_\text{opt,i} - N_\text{i} f_\text{rep}$ where $f_\text{b,i}$ has been expressed using Equation \ref{eq:one}. The removal of $f_\text{ceo}$ has been previously demonstrated in photonic microwave generation \cite{Millo2009} for the purpose of reducing the number of feedback loops. \textbf{3) Removal of optical noise on \boldsymbol{$f_\text{rep}$}:} The goal of this step is to transform the $N_\text{i} f_\text{rep}$ on the right-hand side in the equation in step 2 above to $M f_\text{rep}$ such that the outcome is $\frac{M}{N_\text{i}}[f_\text{b,i} + f_\text{ceo}] = \frac{M}{N_\text{i}} \nu_\text{opt,i} - Mf_\text{rep}$. With $f_\text{ceo}$ removed, this latter signal is achieved by dividing the optical beat ($\approx 10.165$ GHz) by $N_1/M \sim 25,900$ or $N_2/M \sim 28,000$ to scale the optical OFC noise on the $N_\text{i}$th mode to $M f_\text{rep}$. The $f_\text{ceo}$-free optical beat acts as the clock source for a Direct Digital Synthesizer (DDS, Analog Devices 9914), which divides the input by a factor of $N_\text{i}/M$, while also exhibiting low residual phase noise \cite{Fortier2016}. Because the maximum input clock frequency of the AD9914 is 3.5 GHz, we first digitally divided the 10.165 GHz amplified optical beat by 4. We adjusted for this pre-division by reducing the DDS division by a factor of 4. To reach the final transfer oscillator output, $f_\text{TO,i} = \frac{M}{N_\text{i}} \nu_\text{opt,i}$, the additional $Mf_\text{rep}$ must be removed from the right-hand side such that $\frac{M}{N_\text{i}}[f_\text{b,i} + f_\text{ceo}] + Mf_\text{rep} = \frac{M}{N_\text{i}} \nu_\text{opt,i}$. The DDS-divided optical beat (near 400 kHz) is mixed with $M f_\text{rep}$ directly out of the photodiode, using an IQ mixer, to remove repetition rate noise contributed by the OFC. To drive the LO port of the mixer, the $Mf_\text{rep}$ signal is amplified to 10 dBm with low phase noise amplifiers (Custom MMIC CMD245), which help preserve the ultra-low phase noise of the microwave carrier directly out of the OFC. This last step removes the multiplicative noise of $f_\text{rep}$, permitting the derivation of a microwave signal that only contains the frequency and phase noise of the optical reference. Additional optical references may be divided simultaneously with the OFC, each resulting in a corresponding microwave signal. \textbf{Phase noise spur suppression with two DDSs:} The DDS output frequency $f_\text{DDS} = \frac{M}{N_\text{i}}[f_\text{b,i} + f_\text{ceo}]$ is close to 400 kHz, which, when mixed with $Mf_\text{rep}$, results in spurs that are harmonics of 400 kHz and that pose a challenge to filtering. To minimize these harmonics, two DDSs are employed to perform a dual heterodyne frequency translation \cite{Brochard2018}. DDS 1 synthesizes a frequency $f_\Delta$ and DDS 2 synthesizes $f_\Delta + f_\text{DDS}$. Here, $f_\Delta$ is a frequency large enough to be filtered from the 10 GHz signal. We chose $f_\Delta \approx 40$ MHz, which corresponds to a division factor of $2^6$, i.e., 2500 MHz / $2^6 \approx$ 40 MHz. The DDS 1 signal is subtracted from $M f_\text{rep}$ using an IQ mixer. The resulting signal ($Mf_\text{rep} - f_\Delta$) is then added using a second IQ mixer to the DDS 2 signal. The result, ($Mf_\text{rep} + f_\text{DDS}$), yields the same frequency as the 1-DDS scheme, but spurs due to mixing products are pushed to harmonics of $f_\Delta \approx 40$ MHz and its multiples that are more easily filtered from the 10 GHz tone. The 2-DDS scheme is shown pictorially in Figure \ref{fig:setup}. Imperfect spur suppression is mitigated by using a narrow-band filter (bandwidth $\approx 5$ MHz) between the aforementioned IQ mixers. While filtering reduces the 400 kHz phase noise spurs by nearly 40 dB, the filter introduces a significant group delay to the 10 GHz carrier signal. To ensure the highest bandwidth suppression of OFC noise, a delay line of several meters was added between DDS 2 and the second IQ mixer to compensate for the group delay of the filter. \section{Results} \begin{figure} \includegraphics[width=8.5cm]{Figures/2.pdf} \caption{Comparison between the current TO result (blue trace), the previous lowest phase noise TO result (connected orange dots) \cite{Brochard2018}.} \label{fig:comparison} \end{figure} In this Section we discuss characterization of the phase noise and stability of the 10 GHz output from our TO-OFD scheme. We specifically assess the difference in performance between OFD derived via TO-OFD and tight phase locking (PL-OFD), and characterize the limiting sources of noise in our TO scheme. Lastly, we demonstrate noise suppression for optical linewidths as large as 2 MHz. Figure \ref{fig:comparison} shows how the phase noise spectrum of the current demonstration compares to that of the previous best TO demonstration \cite{Brochard2018}. We show more than 40 dB of phase noise reduction at 1-Hz offset from carrier and a similar performance at high frequencies. \subsection{10 GHz characterization} \begin{figure} \includegraphics[width=8.5cm]{Figures/3.pdf} \caption{a) Transfer oscillator microwave characterization setup. b) Phase noise comparison between $Mf_\text{rep}$ generated by the Er/Yb:glass OFC when unstabilized (blue) and when stabilized to the 1070 nm optical reference (green) and $f_\text{TO,1}$ vs $f_\text{TO,2}$ when the OFC is unstabilized (orange). The absolute 10 GHz limit (red) is set by the relative phase noise between 1157 nm and 1070 nm optical references. c) Phase noise comparison between $f_\text{TO,2}$ derived from the 1070 nm reference (blue) and the total of all calculated noise sources (red). Constituent noise sources are plotted as dashed lines and thin traces.} \label{fig:phase-noise} \end{figure} The 10 GHz microwaves generated by the transfer oscillator technique are compared against a reference 10 GHz signal derived from a Ti:Sapphire OFC \cite{Fortier2006, Fortier2011} (see Figure \ref{fig:phase-noise}a) that is phase-stabilized to the 1157 nm optical frequency reference. A 10 GHz tone, which was detected using an MUTC photodiode, was filtered and sent over approximately 3 meters of microwave cable (Maury Microwave SB-SMAN-MM) to the Er/Yb:glass OFC and TO electronics. The frequency difference ( $\approx$ 1 MHz) between the two 10 GHz signals was measured using a Symmetricom 5125a digital phase noise analyzer. A 10 MHz H-maser signal served as the phase noise reference and contributed flicker phase noise near -120 dBc/f and a white phase noise floor near -160 dBc/Hz. We used this method to characterize the phase noise of each of the two $f_\text{TO,i}$ signals, derived from the 1157 nm and 1070 nm references, separately, and also the phase noise of $Mf_\text{rep}$ generated via PL-OFD when the Er/Yb:glass OFC was phase-locked to one of the optical references. As mentioned previously, TO-OFD allows for independent microwave signals to be derived from multiple optical references using a single OFC. We generated two distinct $f_\text{TO,i} \approx 10$ GHz microwave signals derived from the 1157 nm and 1070 nm cavity-stabilized lasers using two TO channels on the Er/Yb:glass OFC. The phase noise from this comparison is shown as the orange curve in Figure \ref{fig:phase-noise}b. Also seen in Figure \ref{fig:phase-noise}b, is the free running noise on $Mf_\text{rep}$. Using the TO technique, we observed suppression of unstabilized OFC noise of greater than 100 dB close to the 10 GHz carrier. Correspondingly, we observe fractional frequency instability suppression of the unstabilized carrier from more than $10^{-10}$ to less than $10^{-15}$ after 1 second of averaging. The measurements in Figure \ref{fig:phase-noise}b all constitute absolute phase noise comparisons between microwaves generated from the 1157 nm and 1070 nm cavity-stabilized laser references. Microwaves produced via TO-OFD exhibited a 1 Hz phase noise level of approximately -106 dBc/Hz, which we observed to be limited by the relative drift between the two optical references. This can be deduced from the relative optical phase noise of the 1157 nm and 1070 nm references, scaled to 10 GHz by a factor of $-20 ~\log (280 \text{ THz}/10 \text{ GHz}) \approx -89$ dB. This measurement (red curve in Figure \ref{fig:phase-noise}b) represents the lower limit of 10 GHz phase noise that could be derived from these optical references. Additionally, we compared the phase noise of the 10 GHz signal derived via PL-OFD when the Er/Yb:glass OFC was phase-stabilized to the 1070 nm optical reference against the 10 GHz signal generated via PL-OFD of the Ti:Sapphire OFC, phase-stabilized to the 1157 nm optical reference. The resultant phase noise (green trace in Figure \ref{fig:phase-noise}b) demonstrates the contribution of the two OFCs and photodetection. From the comparison between green and orange traces, we observe that the 10 GHz electronic components in the TO technique (mixers, amplifiers, DDSs) limit the phase noise for frequency offsets 20 Hz and above. \subsection{Phase noise contributions} Here we discuss the noise contributions to TO-OFD from its various components detailed in Section II. A summary of these contributions is enumerated and plotted in Figure \ref{fig:phase-noise}c. Also shown is the quadrature sum of the individual noise sources (red trace), assuming that they are uncorrelated. Evident in Figure \ref{fig:phase-noise}c, these sources account for most of the phase noise observed on the $f_\text{TO,i}$ signal (blue trace). For offset frequencies less than 10 kHz, we observe that noise from the IQ mixers, which contribute flicker phase noise near -110 dBc/f, ultimately limit $f_\text{TO,i}$ phase noise. At high frequencies, the phase noise is limited by thermal noise, the dominant contributors of which are the two IQ mixers and three low phase noise amplifiers that combine the $M f_\text{rep}$ and the 40 MHz DDS outputs. The noise figures of the individual components, 10 dB for each mixer and 3 dB for each low phase noise amplifier, act in quadrature on the -7 dBm $M f_\text{rep}$ signal to yield a thermal limited noise floor of -153 dBc/Hz. We estimate that photodetector shot noise on $M f_\text{rep}$, which takes into account photocurrent contributions from the the single frequency 1157 nm and 1070 nm light (1 mA) and the pulsed light from the OFC (7 mA), is less than -163 dBc/Hz \cite{Quinlan2013}. The DDS pairs employed in the TO circuits exhibit flicker (-121 dBc/f) and quantization noise (-162 dBc/Hz) on the $f_\Delta \approx 40$ MHz signal. One drawback of employing DDSs is that they contribute phase truncation spurs, with frequencies that depend on the division factor $M/N_\text{i}$ and the frequency offset $f_\Delta$. These spurs can be minimized by setting the DDS input/output ratio to be an exact multiple of 2, $f_\text{out} = 2^{-n} f_\text{in}$ \cite{Gentile1}, where $n$ is a positive integer. It was not possible to implement this strategy in both DDSs because the DDS outputs are necessarily different. While not employed here, for applications that do not tolerate spurs, "bright" spurs can be traded for a slightly raised white noise floor by dithering the last bit in the DAC \cite{Gentile2}. Finally, despite employing two DDSs to minimize the 400 kHz sidebands that result from $[f_\text{b,i} + f_\text{ceo}] \times M/N_\text{i} \approx 400$ kHz, imperfect mixing and filtering results in a residual spur at 400 kHz. Due to the nonlinear elements in the TO setup (i.e., the photodiode, amplifiers, 10 GHz mixers) it is important to consider the effect of amplitude noise to phase noise conversion. To this end, we characterized the total amplitude to phase noise conversion for our setup, including the total contributions of the 10 GHz photodetector, TO electronic circuit and 10 GHz phase noise comparison electronics. The characterization of the AM-to-PM conversion coefficient is achieved by adding white amplitude noise to the laser by modulating one of the EDFA 980 nm pump diodes and measuring the RIN with a slow photodiode (Thorlabs PDA20CS). With the added RIN we remeasured the $f_\text{TO,i}$ phase noise and discerned a single-sided AM-to-PM conversion of approximately -32 dB. As seen via the orange trace in Figure \ref{fig:phase-noise}c, using this conversion coefficient, we estimate the 10 GHz phase noise converted from RIN on the light incident on the MUTC photodetector (without added noise). Much of the RIN we observed in this measurement originated from the output of the semiconductor optical amplifier used to amplify the 1157 nm reference light. Amplification was not also required for the 1070 nm reference light since the OFC generated sufficient optical power at this wavelength to generate a high-SNR beat. Finally, due to the relatively high flicker contribution from the IQ mixers, the combined phase noise of the optical references is only observed to impact the phase noise spectrum of $f_\text{TO,i}$ at low frequency offsets (less than 1 Hz). This noise is visible as a slope change in the absolute phase noise measurements that compare $f_\text{TO,1}$ and $f_\text{TO,2}$ derived from the 1157 nm and 1070 nm references. This thermal noise limit can be improved by operating the cavities at cryogenic temperatures, or by employing high-quality factor mirrors with crystalline coatings \cite{Cole2013}. \subsection{Frequency noise suppression} \begin{figure} \includegraphics[width=8.5cm]{Figures/4.pdf} \caption{Demonstration of noise suppression. Transfer oscillator microwave phase noise without added OFC frequency noise (blue) and with added OFC frequency noise (orange). Inset: the optical beat between a cavity stabilized laser and the comb, without and with added noise (blue and orange respectively). Without added noise the optical linewidth is 25 kHz and with added noise the optical linewidth is 2 MHz.} \label{fig:noise-suppression} \end{figure} Due to the extremely high bandwidth of the digital and RF electronics, in principle, TO-OFD should permit near perfect cancellation of additive OFC noise for optical linewidths in excess of 1 MHz. As mentioned previously, noise suppression for microwave generation using the TO technique has direct application to field-deployable OFCs. In an attempt to quantify the cancellation, we increased the frequency noise on the OFC such that optical mode linewidths increased from 25 kHz to 2 MHz (near 1157 nm) by modulating an OFC laser mirror bonded to a fast PZT (PI Ceramic PL055.31) with white frequency noise. As seen in Figure \ref{fig:noise-suppression}, we compare $f_\text{TO,i}$ with and without added frequency noise. We observe nearly identical phase noise spectra despite the difference in OFC optical linewidths. The narrow ($\approx 5$ MHz) bandwidth of 10 GHz filters used to isolate the optical beat signals, limit the suppression bandwidth in our TO scheme. Ideally, latency in the TO electronics, including the DDS, will set the noise suppression bandwidth. For the AD9914 DDS used here, the latency of a 2.5 GHz clock is approximately 150 ns. Although TO-OFD demonstrates excellent frequency and phase noise suppression, it is unable to suppress noise resulting from AM-to-PM conversion. This may be dealt with by reducing the amplitude noise of the laser, for example, with active RIN suppression, or by operating the photodiode, amplifiers and mixers under conditions where AM-to-PM conversion is naturally suppressed \cite{Xie2017,Taylor2011,Baynes2015}. \subsection{Long-term behavior} \begin{figure} \includegraphics[width=8.5cm]{Figures/5.pdf} \caption{a) Time record and b) Allan deviation of the optical beat between the 1157 nm and 1070 nm optical references (blue points) and the microwave beat (orange points) between $f_\text{TO,1}$ and $f_\text{TO,2}$ derived from the same optical references. The microwave beat is normalized by 10 GHz and the optical beat is normalized by 280 THz in a). The difference (green points) between the blue and orange points is shown in a) and its Allan deviation is shown in b).} \label{fig:counting} \end{figure} While phase noise is used to evaluate the short term performance of the $f_\text{TO,i}$ microwave output (timescales less than 1 s), we are also interested in assessing the long-term performance of the microwaves generated via TO-OFD (timescales up to 10,000 s). More specifically, we want to determine the fidelity with which the 10 GHz output reproduces the fractional frequency stability and variations of the the optical references. To measure this, we simultaneously tracked the relative frequency drift of the 1157 nm and 1070 nm reference lasers in the optical domain using the Ti:Sapphire OFC, and the relative frequency drift between the two $f_\text{TO,i}$ signals produced using the Er/Yb:glass OFC from the same two optical references. Frequency data was counted using two Agilent 53131a frequency counters, each referenced to a 10 MHz H-maser signal. As seen in Figure \ref{fig:counting}a, we observed a strong correlation between the time records of the fractional frequency deviations in the optical signals and microwave signals. The level of correlation is quantified by the residual deviations in the difference frequency. The Allan deviation evaluates the fractional frequency stability of this data as a function of measurement time. As seen in Figure \ref{fig:counting}b, the upper bound to the residual instability contributed by the Er/Yb:glass OFC and TO electronics is less than $2 \times 10^{-15} \tau^{-1/2}$. \section{Conclusion} We have demonstrated microwave generation via optical frequency division of two high-stability optical references with absolute phase noise at or below -106 dBc/Hz at a 1 Hz offset from a 10 GHz carrier using the transfer oscillator technique. The latter result corresponds to a 1-second frequency instability of less than $2\times10^{-15}$, which indicates that the TO digital and analog electronics contribute minimal additional instability. This result represents the lowest-phase noise achieved, to date, using TO-OFD and is the first demonstration generating multiple independent optically derived microwave signals from a single OFC. In addition to characterizing and identifying the noise contributions to our transfer oscillator scheme, we have also demonstrated that the contribution of the OFC's noise to the TO signal is negligible for optical linewidths as large as 2 MHz, and OFC phase noise is suppressed by more than 100 dB close to carrier. This has direct application to low-noise microwave generation with more compact OFCs that exhibit high intrinsic noise. Additionally, TO-OFD provides the means to produce a reliable and robust optically derived microwave signal suitable for out-of-the lab applications. Finally, the transfer oscillator technique provides significant advantages if used for realization of an optical timescale. Timescales derived from an ensemble of optical references permit a large reduction in frequency noise and a slower accumulation of timing uncertainty \cite{Milner2019} than timescales based on microwave sources and references. The low residual noise and the increase of noise suppression bandwidth provided by TO-OFD will increase operational robustness and reduce the incidence of signal phase slips. Additionally, the ability to derive independent microwave signals from more than one optical reference may facilitate the redundancy necessary for deriving phase-continuous and high-stability electronic timing signals. \section{Acknowledgements} We thank I. Coddington, S. A. Diddams and F. Quinlan for their comments on this manuscript and J. C. Campbell for the MUTC photodiode. \section{Disclaimers} Certain commercial equipment, instruments, or materials (or suppliers, or software, ...) are identified in this paper to foster understanding. Such identification does not imply recommendation or endorsement by the National Institute of Standards and Technology, nor does it imply that the materials or equipment identified are necessarily the best available for the purpose. \section{Data Availability} The data that support the findings of this study are available from the corresponding author upon reasonable request. \section*{References} \section{Introduction} High-stability microwave sources are ubiquitous in modern technology, underpinning communication, computing, and RADAR and sensing systems. Most of the latter systems rely on room-temperature crystal oscillators as local oscillators and frequency references. These commercially available electronic sources, however, exhibit phase noise that is unlikely to support next-generation systems that will require improved resolution and signal-to-noise ratios for higher density communications, micro-Doppler radar, and quantum sensing. More specifically, in Doppler radar, lower close-to-carrier phase noise would increase sensitivity to slow-moving objects, or to objects with low cross section \cite{Ye2000, Fortier2011, Xie2017}. This technique may also aid in the advancement of near-Earth asteroid mapping for both collision warning systems and for the detection of minerals for use on earth or in space \cite{asteroids2015}. In wireless telecommunications, higher spectral purity would also permit lower error rates for phase-encoded signals, and thus higher throughput \cite{Koenig2013}. Finally, sources with lower timing jitter could increase the resolution in analog-to-digital converters \cite{Valley2007}. Photonically generated microwave signals exploit the high Quality-factors of ultra-stable optical references \cite{Schioppo2016,Young1999} to permit extraction of frequency-divided signals with ultra-low phase noise and high stability. To date, X-band signals near 10 GHz with the highest spectral purity have been achieved via optical frequency division (OFD) using self-referenced optical frequency combs (OFC) \cite{Zhang2010,Haboucha2011,Fortier2013,Xie2017,Kalubovilage2020,Nakamura2020}. Optical frequency combs, based on mode-locked femtosecond lasers, enable a phase-coherent link between the optical and microwave domains. When an OFC is phase stabilized to a ultra-narrow linewidth cavity-stabilized laser, designed to probe a long-lifetime atomic clock transition, it can permit extraction of a 10 GHz microwave signal with phase noise below -100 dBc/Hz at 1 Hz offset from carrier and with a signal-to-noise ratio close to 180 dB in a 1-Hz bandwidth \cite{Fortier2013}. Consequently, when compared to other room-temperature oscillators, OFD allows for greater than 50 dB improvement in close-to-carrier phase noise sidebands. Although OFD via phase-locked OFC (PL-OFD) has demonstrated record performance in the domain of room-temperature microwave generation, it suffers two drawbacks. Firstly, it requires tight phase locking of the OFC to an optical reference. This can result in additive instability, and loss of timing due to cycle slips, if noise on the modelocked laser cannot be adequately suppressed by feedback actuators with limited bandwidth. Secondly, tight phase locking of an OFC generally only permits the derivation of low-noise microwave signals from a single optical reference. Consequently, each optical reference requires a corresponding OFC for division to the microwave regime, which may hinder technological implementation due to the increased power consumption and size. The transfer oscillator (TO) technique \cite{Telle2002} for OFD (TO-OFD) provides solutions to both of the aforementioned limitations. Rather than relying on physical actuators for phase-locking, the transfer oscillator technique employs electronics to add, subtract and divide RF signals in order to remove OFC phase noise from the divided-down optical reference. Due to the absence of physical actuators, the bandwidth of the TO electronics can be several megahertz, decoupling the optical-to-microwave division from the dynamics of the OFC and increasing the robustness of the generated microwave signals. Additionally, the TO technique can simultaneously divide multiple independent optical references with a single OFC and enable the generation of multiple independent low-noise microwave signals. These advantages help support the development of low-noise microwave flywheels derived from optical references, which are needed for realization of optical atomic time for future redefinition of the SI second \cite{Yao2019}. Furthermore, TO-OFD may help to improve multi-frequency radar, which can provide high-resolution images for resource exploration and military ventures \cite{Pfitzenmaier2019}. The TO technique may also help facilitate low-noise microwave generation from chip-scale OFCs that are difficult to stabilize \cite{Lucas2020} or from highly robust polarization-maintaining linear fiber lasers \cite{Baumann2009,Sinclair2014,Feng2015,Cingoz2011} that exhibit higher intrinsic noise. In this work, we employ a free-space Er/Yb:glass optical frequency comb as a transfer oscillator to derive low phase noise 10 GHz microwave signals from optical reference cavities at 1157 nm and 1070 nm that serve as local oscillators for the Yb-lattice \cite{McGrew2018} and single-ion Al \cite{Brewer2019} clocks at NIST. Although the optical clocks were not operational for this work, the free-running optical references provided light with high-spectral purity and low drift ($\ll$ 1 Hz/s). From the latter optical references we extracted two independent 10 GHz signals, using a single OFC, with absolute phase noise below -106 dBc/Hz at 1-Hz offset from carrier, and 1-s fractional frequency instabilities below $2\times10^{-15}$. To the best of our knowledge, the results we obtained represent the lowest close-to-carrier phase noise reported to date using the transfer oscillator technique, providing suppression of OFC noise in excess of 100 dB below a 1 Hz offset. It is also the first demonstration of the synthesis of multiple microwave signals based on independent reference cavities with a single OFC. \begin{figure*} \includegraphics[width=17cm]{Figures/1.pdf} \caption{Transfer oscillator setup with a 500 MHz repetition rate Er/Yb:glass OFC. Optical pulses from the Er/Yb:glass oscillator are fiber-coupled and amplified by an EDFA before being sent through an HNLF for supercontinuum generation. The spectrum is split in two paths, one for carrier-envelope offset frequency detection, and one for detection of heterodyne beat signals between the OFC and light from two cavity-stabilized optical references at 1157 nm and 1070 nm. An optical interleaver multiplies the repetition frequency to 2 GHz, which is detected on an MUTC photodiode whose spectrum near 10 GHz is shown in the bottom-right inset (RBW = 300 kHz). The optical beats, $f_\text{b1}$ and $f_\text{b2}$, and the 10 GHz harmonic of the 2 GHz pulses are sent to two TO circuits along with $f_\text{ceo}$. Each circuit generates a 10 GHz output, $f_\text{TO,i}$, that is derived from one of the two optical references by adding and dividing microwave signals, shown in blue boxes in upper right. Although the two TO electronics boards are identical except for bandpass filters to isolate $f_{bi}$, the top board in the figure is used to represent the transfer oscillator mathematical operations and the bottom board shows the 2-DDS scheme as well as the approximate RF frequencies at each stage. The following integer constants are used: $M = 20$, $N_1 = $ 518,907 and $N_2 = $ 561,211.} \label{fig:setup} \end{figure*} \section{Experimental Setup} Photonics-based microwave generation can be separated into three distinct experimental stages: 1) the optical reference that defines a lower limit to the system stability and phase noise, 2) the phase-coherent division performed by the optical frequency comb that enables faithful transfer of the optical reference stability and phase noise to the microwave domain and, 3) the electronic detection and synthesis, which includes photodetection as a means to demodulate the optical signals, and here, a digital transfer oscillator technique that enables electronic removal of OFC noise from the photodetected X-band microwave signals. In the sections below, we describe the details of constituent components in our low-noise microwave generation setup and their impact on the derived 10 GHz microwave signals. \subsection{Low-noise optical references} In this work, we employed optical references derived from lasers stabilized to state-of-the-art optical Fabry-Perot cavities \cite{Schioppo2016,Young1999}. As mentioned previously, the optical reference sets the ultimate limit to the noise performance in photonic microwave generation via optical frequency division with an OFC. To minimize instabilities resulting from environmental effects, the cavities are housed within several layers of thermal and acoustic shielding and employ both passive and active vibration control to isolate the cavity length from changes due to acceleration. The room-temperature Fabry-Perot cavities ($\sim$ 30 cm long) act as length references, that at the time of the writing of this manuscript, can support fractional length instabilities near 1 part in $10^{16}$. These cavities act as optical frequency filters when a laser is stabilized to one of their longitudinal optical modes, transferring the cavity length stability to frequency stability of the laser light. Currently, the uncertainty in the cavity length, for timescales greater than 1 second, is limited by thermally induced Brownian noise in the mirror coatings and by unidirectional length changes in the cavity due to settling of the ultra-low expansion glass that comprises the spacer. As such, these optical references can support phase noise as low as -120 dBc/Hz at a 1 Hz offset on a 10 GHz carrier and greater than 200 dB of signal-to-noise ratio in a 1 Hz bandwidth. Shorter and smaller cavities, more suitable for portable optical atomic clocks and that can support out-of-lab use, are being actively developed \cite{DavilaRodriguez2017, Kelleher2021}. The negative impact of the shorter cavity lengths on the fractional instability can be balanced by optical techniques to improve the thermal noise and by employing crystalline mirror coatings with higher mechanical stiffness, permitting fractional instabilities near 1 part in 10$^{15}$ for cavity lengths of approximately 25 mm \cite{Cole2013}. It has also been demonstrated that a free-running OFC can serve as its own optical reference cavity while simultaneously performing the optical-to-microwave division \cite{Kalubovilage2020}. By employing a high-stability monolithic modelocked laser, oscillator length fluctuations are minimized while simultaneously generating a coherent spectrum with which to link optical frequencies to microwave frequencies. While less complex, this solution only permits low phase noise at offset frequencies > 10 kHz. Drift in the modelocked laser cavity yields significantly higher noise than is possible when using Fabry-Perot optical reference cavities. \subsection{Optical-to-microwave division: Er/Yb:glass OFC} Optical frequency combs, based on modelocked laser spectra, permit phase coherent transfer of signals between the optical and microwave domains due to the fixed phase relationship between the resonant optical modes. As a result of this phase relationship, the optical spectra of OFCs consist of hundreds of thousands to millions of equidistant frequency modes where each individual mode of the OFC optical spectrum can be described by the following comb equation, \begin{equation} \nu_N = f_\text{ceo} + N f_\text{rep}, \label{eq:one} \end{equation} where $f_\text{ceo}$ (carrier-envelope offset frequency) is a frequency offset common to each optical mode, $N$ is an integer representing the optical mode number and $f_\text{rep}$ (repetition frequency) is the optical mode spacing. We denote optical frequencies with the "$\nu$" symbol and RF frequencies with the "$f$" symbol. Interference of the OFC light with single frequency light from an optical reference yields a heterodyne beat signal, $f_b = \nu_\text{opt} - \nu_N$, between the optical frequency $\nu_\text{opt}$ and a nearby OFC mode $\nu_N$. By rewriting Equation \ref{eq:one} as $(\nu_N-f_\text{ceo})/N = f_\text{rep}$, it is evident that frequency deviations on $f_\text{rep}$ are $N$ times smaller than those of the optical mode, $\nu_N$. As a result, by referencing an OFC to a high-stability and low-noise optical reference, $\nu_\text{opt}$, this frequency relationship between the optical and mode spacing of the OFC can be exploited to derive microwave signals with high spectral purity. Electronic signals derived in this manner also preserve the stability of the optical reference, such that, ideally $\sigma = \frac{\delta \nu}{\nu} =\frac{\delta f}{f}$. Additionally, photonically generated microwave signals permit a reduction in the phase noise of the optical reference by $(N/M)^2$ when photodetecting the $M$th harmonic of the OFC repetition rate, $f_\text{rep}$. When dividing the 1157 nm (259 THz) and 1070 nm (280 THz) optical reference to 10 GHz, this results in a reduction in phase noise by 88.3 dB and 89.0 dB, respectively. The optical frequency comb used in our measurements employs a home-built 1550 nm, 500 MHz repetition rate, free-space modelocked laser based on Er/Yb co-doped phosphate glass \cite{Lesko2020}. Passive mode-locking, with an output power around 70 mW, is achieved in the laser via a semiconductor saturable absorption mirror (SESAM). The laser and its supporting optics are illustrated in Figure \ref{fig:setup}. The 500 MHz optical pulse train generated by the mode-locked laser is fiber-coupled and amplified in an Erbium doped fiber amplifier (EDFA) and then launched into a $\sim 1$ m highly nonlinear fiber (HNLF) to provide nonlinear frequency conversion from the input pulse at 1550 nm (bandwidth $\sim 13$ nm) to an optical octave of bandwidth (1 $\mu$m to 2 $\mu$m). The optical octave is coupled into free space, at which point a part of the spectrum is split off with a dichroic mirror and sent to a periodically-poled lithium niobate (PPLN) waveguide to permit self-referenced detection of $f_\text{ceo}$ via $f$-to-$2f$ conversion \cite{Telle1999, Reichert1999}. The remainder of the light is used to derive optical beat signals against the two high stability optical references at 1070 nm and 1157 nm. The combined light from the OFC and optical references is sent through a two-stage pulse interleaver and focused onto a highly linear Modified Uni-Traveling Carrier (MUTC) photodetector ($\sim 12.5$ GHz bandwidth, 50 $\mu$m active area diameter, -16 V bias) \cite{Li2011,Li2010}. The pulse interleaver effectively multiplies the pulse repetition rate from 500 MHz to 2 GHz \cite{Haboucha2011}, increasing the strength of the recovered 10 GHz microwave tone, which consequently improves the thermally detected noise floor by mitigating photodetector nonlinearities that result at high optical pulse energies. Since the optical beat signals due to interference between the optical references and optical modes of the OFC are detected on the same MUTC photodiode, the RF output is split with a 1-to-4 power splitter and the optical beats and 10 GHz carrier are isolated from one another with narrow electrical bandpass filters. Since TO-OFD permits the extraction of microwave signals via removal of the additive OFC noise, the technique only requires control of the modelocked laser oscillator length such that the optical beat does not drift outside a range bounded by $f_\text{rep}/2$. In this experiment, the narrow-bandpass filters, mentioned above (bandwidth $\approx 5$ MHz), are required to isolate the optical beats from nearby signals. To keep this beat centered on the narrow electronic filter, we employ a loose frequency lock (bandwith < 10 Hz) by monitoring $f_\text{rep}$ and feeding back on the OFC cavity length. This maintains the optical beat close to the center of its bandpass filter. The $f_\text{ceo}$ beat signal is uncontrolled as it drifts by only few MHz over the course of multiple days. \subsection{Microwave generation: detection and transfer oscillator electronics} To generate a 10 GHz signal from the OFC, while simultaneously removing its noise contributions, the TO technique requires the detection of 1) the $M$th harmonic of the OFC repetition frequency, $M f_\text{rep}$, near 10 GHz, 2) the carrier-envelope offset frequency, $f_\text{ceo} < 250$ MHz, and 3) the RF beat between each optical reference (subscript $i$) and the $N_\text{i}$th OFC mode, $f_\text{b,i} = \nu_\text{opt,i} - \nu_{N_\text{i}}$ also coincidentally near 10 GHz. The harmonic $M f_\text{rep}$ is chosen such that it is close to the desired output microwave carrier frequency of 10 GHz. Here, $f_\text{b,i}$ was chosen to be near 10 GHz due to the availability of X-band electronics. The three beat signals above are mixed such that \begin{equation} f_\text{TO,i} = M f_\text{rep} + \frac{M}{N_\text{i}} \left( f_\text{b,i} + f_\text{ceo} \right) = \frac{M}{N_\text{i}}\nu_\text{opt,i}, \label{eq:two} \end{equation} which yields a 10 GHz microwave signal free of OFC noise. The resultant microwave signal is dependent only on the static values of $N_\text{i}$ and $M$ and the optical reference frequency $\nu_\text{opt}$. The electronics to facilitate the above signal processing are displayed pictorially in Figure \ref{fig:setup} and described in detail below. \textbf{1) Signal detection:} In our demonstration, we select the $M=20$ harmonic of $f_\text{rep}$ to generate a microwave carrier signal near 10 GHz. The high-power, high-linearity MUTC photodiode and the optical interleaver help to generate 1 dBm of microwave power at 10 GHz. The OFC mode numbers $N_\text{i}$ with which the two optical references at 1157 nm and 1070 nm interfere are $N_1=518,907$ and $N_2=561,211$, respectively. From this, two optical heterodyne beat signals, $f_\text{b,1}$ and $f_\text{b,2}$, are derived near 10 GHz, with signal strengths varying from -80 dBm to -65 dBm. A separate InGaAs photodetector (EOT 3000A) is used to detect $f_\text{ceo}$. \textbf{2) Removal of \boldsymbol{$f_\text{ceo}$} noise:} Each detected heterodyne optical beat signal is routed to its own TO circuit and sent through a series of high-Q bandpass filters (bandwidth $\approx 5$ MHz) to remove the high-power harmonics of $f_\text{rep}$. The filtered signal is then amplified to 10 dBm. The amplified beat is then used to drive the LO port of an IQ mixer (Marki MMIQ-0520L). The OFC offset frequency and its corresponding noise, ($f_\text{ceo}\approx$ 165 MHz), are removed from $f_\text{b,i}$ using an IQ mixer and hybrid coupler with 30 dB of image rejection. This permits the addition or subtraction of signals without a bandpass filter to suppress the unwanted sideband. The result of this operation is $f_\text{b,i} + f_\text{ceo} = \nu_\text{opt,i} - N_\text{i} f_\text{rep}$ where $f_\text{b,i}$ has been expressed using Equation \ref{eq:one}. The removal of $f_\text{ceo}$ has been previously demonstrated in photonic microwave generation \cite{Millo2009} for the purpose of reducing the number of feedback loops. \textbf{3) Removal of optical noise on \boldsymbol{$f_\text{rep}$}:} The goal of this step is to transform the $N_\text{i} f_\text{rep}$ on the right-hand side in the equation in step 2 above to $M f_\text{rep}$ such that the outcome is $\frac{M}{N_\text{i}}[f_\text{b,i} + f_\text{ceo}] = \frac{M}{N_\text{i}} \nu_\text{opt,i} - Mf_\text{rep}$. With $f_\text{ceo}$ removed, this latter signal is achieved by dividing the optical beat ($\approx 10.165$ GHz) by $N_1/M \sim 25,900$ or $N_2/M \sim 28,000$ to scale the optical OFC noise on the $N_\text{i}$th mode to $M f_\text{rep}$. The $f_\text{ceo}$-free optical beat acts as the clock source for a Direct Digital Synthesizer (DDS, Analog Devices 9914), which divides the input by a factor of $N_\text{i}/M$, while also exhibiting low residual phase noise \cite{Fortier2016}. Because the maximum input clock frequency of the AD9914 is 3.5 GHz, we first digitally divided the 10.165 GHz amplified optical beat by 4. We adjusted for this pre-division by reducing the DDS division by a factor of 4. To reach the final transfer oscillator output, $f_\text{TO,i} = \frac{M}{N_\text{i}} \nu_\text{opt,i}$, the additional $Mf_\text{rep}$ must be removed from the right-hand side such that $\frac{M}{N_\text{i}}[f_\text{b,i} + f_\text{ceo}] + Mf_\text{rep} = \frac{M}{N_\text{i}} \nu_\text{opt,i}$. The DDS-divided optical beat (near 400 kHz) is mixed with $M f_\text{rep}$ directly out of the photodiode, using an IQ mixer, to remove repetition rate noise contributed by the OFC. To drive the LO port of the mixer, the $Mf_\text{rep}$ signal is amplified to 10 dBm with low phase noise amplifiers (Custom MMIC CMD245), which help preserve the ultra-low phase noise of the microwave carrier directly out of the OFC. This last step removes the multiplicative noise of $f_\text{rep}$, permitting the derivation of a microwave signal that only contains the frequency and phase noise of the optical reference. Additional optical references may be divided simultaneously with the OFC, each resulting in a corresponding microwave signal. \textbf{Phase noise spur suppression with two DDSs:} The DDS output frequency $f_\text{DDS} = \frac{M}{N_\text{i}}[f_\text{b,i} + f_\text{ceo}]$ is close to 400 kHz, which, when mixed with $Mf_\text{rep}$, results in spurs that are harmonics of 400 kHz and that pose a challenge to filtering. To minimize these harmonics, two DDSs are employed to perform a dual heterodyne frequency translation \cite{Brochard2018}. DDS 1 synthesizes a frequency $f_\Delta$ and DDS 2 synthesizes $f_\Delta + f_\text{DDS}$. Here, $f_\Delta$ is a frequency large enough to be filtered from the 10 GHz signal. We chose $f_\Delta \approx 40$ MHz, which corresponds to a division factor of $2^6$, i.e., 2500 MHz / $2^6 \approx$ 40 MHz. The DDS 1 signal is subtracted from $M f_\text{rep}$ using an IQ mixer. The resulting signal ($Mf_\text{rep} - f_\Delta$) is then added using a second IQ mixer to the DDS 2 signal. The result, ($Mf_\text{rep} + f_\text{DDS}$), yields the same frequency as the 1-DDS scheme, but spurs due to mixing products are pushed to harmonics of $f_\Delta \approx 40$ MHz and its multiples that are more easily filtered from the 10 GHz tone. The 2-DDS scheme is shown pictorially in Figure \ref{fig:setup}. Imperfect spur suppression is mitigated by using a narrow-band filter (bandwidth $\approx 5$ MHz) between the aforementioned IQ mixers. While filtering reduces the 400 kHz phase noise spurs by nearly 40 dB, the filter introduces a significant group delay to the 10 GHz carrier signal. To ensure the highest bandwidth suppression of OFC noise, a delay line of several meters was added between DDS 2 and the second IQ mixer to compensate for the group delay of the filter. \section{Results} \begin{figure} \includegraphics[width=8.5cm]{Figures/2.pdf} \caption{Comparison between the current TO result (blue trace), the previous lowest phase noise TO result (connected orange dots) \cite{Brochard2018}.} \label{fig:comparison} \end{figure} In this Section we discuss characterization of the phase noise and stability of the 10 GHz output from our TO-OFD scheme. We specifically assess the difference in performance between OFD derived via TO-OFD and tight phase locking (PL-OFD), and characterize the limiting sources of noise in our TO scheme. Lastly, we demonstrate noise suppression for optical linewidths as large as 2 MHz. Figure \ref{fig:comparison} shows how the phase noise spectrum of the current demonstration compares to that of the previous best TO demonstration \cite{Brochard2018}. We show more than 40 dB of phase noise reduction at 1-Hz offset from carrier and a similar performance at high frequencies. \subsection{10 GHz characterization} \begin{figure} \includegraphics[width=8.5cm]{Figures/3.pdf} \caption{a) Transfer oscillator microwave characterization setup. b) Phase noise comparison between $Mf_\text{rep}$ generated by the Er/Yb:glass OFC when unstabilized (blue) and when stabilized to the 1070 nm optical reference (green) and $f_\text{TO,1}$ vs $f_\text{TO,2}$ when the OFC is unstabilized (orange). The absolute 10 GHz limit (red) is set by the relative phase noise between 1157 nm and 1070 nm optical references. c) Phase noise comparison between $f_\text{TO,2}$ derived from the 1070 nm reference (blue) and the total of all calculated noise sources (red). Constituent noise sources are plotted as dashed lines and thin traces.} \label{fig:phase-noise} \end{figure} The 10 GHz microwaves generated by the transfer oscillator technique are compared against a reference 10 GHz signal derived from a Ti:Sapphire OFC \cite{Fortier2006, Fortier2011} (see Figure \ref{fig:phase-noise}a) that is phase-stabilized to the 1157 nm optical frequency reference. A 10 GHz tone, which was detected using an MUTC photodiode, was filtered and sent over approximately 3 meters of microwave cable (Maury Microwave SB-SMAN-MM) to the Er/Yb:glass OFC and TO electronics. The frequency difference ( $\approx$ 1 MHz) between the two 10 GHz signals was measured using a Symmetricom 5125a digital phase noise analyzer. A 10 MHz H-maser signal served as the phase noise reference and contributed flicker phase noise near -120 dBc/f and a white phase noise floor near -160 dBc/Hz. We used this method to characterize the phase noise of each of the two $f_\text{TO,i}$ signals, derived from the 1157 nm and 1070 nm references, separately, and also the phase noise of $Mf_\text{rep}$ generated via PL-OFD when the Er/Yb:glass OFC was phase-locked to one of the optical references. As mentioned previously, TO-OFD allows for independent microwave signals to be derived from multiple optical references using a single OFC. We generated two distinct $f_\text{TO,i} \approx 10$ GHz microwave signals derived from the 1157 nm and 1070 nm cavity-stabilized lasers using two TO channels on the Er/Yb:glass OFC. The phase noise from this comparison is shown as the orange curve in Figure \ref{fig:phase-noise}b. Also seen in Figure \ref{fig:phase-noise}b, is the free running noise on $Mf_\text{rep}$. Using the TO technique, we observed suppression of unstabilized OFC noise of greater than 100 dB close to the 10 GHz carrier. Correspondingly, we observe fractional frequency instability suppression of the unstabilized carrier from more than $10^{-10}$ to less than $10^{-15}$ after 1 second of averaging. The measurements in Figure \ref{fig:phase-noise}b all constitute absolute phase noise comparisons between microwaves generated from the 1157 nm and 1070 nm cavity-stabilized laser references. Microwaves produced via TO-OFD exhibited a 1 Hz phase noise level of approximately -106 dBc/Hz, which we observed to be limited by the relative drift between the two optical references. This can be deduced from the relative optical phase noise of the 1157 nm and 1070 nm references, scaled to 10 GHz by a factor of $-20 ~\log (280 \text{ THz}/10 \text{ GHz}) \approx -89$ dB. This measurement (red curve in Figure \ref{fig:phase-noise}b) represents the lower limit of 10 GHz phase noise that could be derived from these optical references. Additionally, we compared the phase noise of the 10 GHz signal derived via PL-OFD when the Er/Yb:glass OFC was phase-stabilized to the 1070 nm optical reference against the 10 GHz signal generated via PL-OFD of the Ti:Sapphire OFC, phase-stabilized to the 1157 nm optical reference. The resultant phase noise (green trace in Figure \ref{fig:phase-noise}b) demonstrates the contribution of the two OFCs and photodetection. From the comparison between green and orange traces, we observe that the 10 GHz electronic components in the TO technique (mixers, amplifiers, DDSs) limit the phase noise for frequency offsets 20 Hz and above. \subsection{Phase noise contributions} Here we discuss the noise contributions to TO-OFD from its various components detailed in Section II. A summary of these contributions is enumerated and plotted in Figure \ref{fig:phase-noise}c. Also shown is the quadrature sum of the individual noise sources (red trace), assuming that they are uncorrelated. Evident in Figure \ref{fig:phase-noise}c, these sources account for most of the phase noise observed on the $f_\text{TO,i}$ signal (blue trace). For offset frequencies less than 10 kHz, we observe that noise from the IQ mixers, which contribute flicker phase noise near -110 dBc/f, ultimately limit $f_\text{TO,i}$ phase noise. At high frequencies, the phase noise is limited by thermal noise, the dominant contributors of which are the two IQ mixers and three low phase noise amplifiers that combine the $M f_\text{rep}$ and the 40 MHz DDS outputs. The noise figures of the individual components, 10 dB for each mixer and 3 dB for each low phase noise amplifier, act in quadrature on the -7 dBm $M f_\text{rep}$ signal to yield a thermal limited noise floor of -153 dBc/Hz. We estimate that photodetector shot noise on $M f_\text{rep}$, which takes into account photocurrent contributions from the the single frequency 1157 nm and 1070 nm light (1 mA) and the pulsed light from the OFC (7 mA), is less than -163 dBc/Hz \cite{Quinlan2013}. The DDS pairs employed in the TO circuits exhibit flicker (-121 dBc/f) and quantization noise (-162 dBc/Hz) on the $f_\Delta \approx 40$ MHz signal. One drawback of employing DDSs is that they contribute phase truncation spurs, with frequencies that depend on the division factor $M/N_\text{i}$ and the frequency offset $f_\Delta$. These spurs can be minimized by setting the DDS input/output ratio to be an exact multiple of 2, $f_\text{out} = 2^{-n} f_\text{in}$ \cite{Gentile1}, where $n$ is a positive integer. It was not possible to implement this strategy in both DDSs because the DDS outputs are necessarily different. While not employed here, for applications that do not tolerate spurs, "bright" spurs can be traded for a slightly raised white noise floor by dithering the last bit in the DAC \cite{Gentile2}. Finally, despite employing two DDSs to minimize the 400 kHz sidebands that result from $[f_\text{b,i} + f_\text{ceo}] \times M/N_\text{i} \approx 400$ kHz, imperfect mixing and filtering results in a residual spur at 400 kHz. Due to the nonlinear elements in the TO setup (i.e., the photodiode, amplifiers, 10 GHz mixers) it is important to consider the effect of amplitude noise to phase noise conversion. To this end, we characterized the total amplitude to phase noise conversion for our setup, including the total contributions of the 10 GHz photodetector, TO electronic circuit and 10 GHz phase noise comparison electronics. The characterization of the AM-to-PM conversion coefficient is achieved by adding white amplitude noise to the laser by modulating one of the EDFA 980 nm pump diodes and measuring the RIN with a slow photodiode (Thorlabs PDA20CS). With the added RIN we remeasured the $f_\text{TO,i}$ phase noise and discerned a single-sided AM-to-PM conversion of approximately -32 dB. As seen via the orange trace in Figure \ref{fig:phase-noise}c, using this conversion coefficient, we estimate the 10 GHz phase noise converted from RIN on the light incident on the MUTC photodetector (without added noise). Much of the RIN we observed in this measurement originated from the output of the semiconductor optical amplifier used to amplify the 1157 nm reference light. Amplification was not also required for the 1070 nm reference light since the OFC generated sufficient optical power at this wavelength to generate a high-SNR beat. Finally, due to the relatively high flicker contribution from the IQ mixers, the combined phase noise of the optical references is only observed to impact the phase noise spectrum of $f_\text{TO,i}$ at low frequency offsets (less than 1 Hz). This noise is visible as a slope change in the absolute phase noise measurements that compare $f_\text{TO,1}$ and $f_\text{TO,2}$ derived from the 1157 nm and 1070 nm references. This thermal noise limit can be improved by operating the cavities at cryogenic temperatures, or by employing high-quality factor mirrors with crystalline coatings \cite{Cole2013}. \subsection{Frequency noise suppression} \begin{figure} \includegraphics[width=8.5cm]{Figures/4.pdf} \caption{Demonstration of noise suppression. Transfer oscillator microwave phase noise without added OFC frequency noise (blue) and with added OFC frequency noise (orange). Inset: the optical beat between a cavity stabilized laser and the comb, without and with added noise (blue and orange respectively). Without added noise the optical linewidth is 25 kHz and with added noise the optical linewidth is 2 MHz.} \label{fig:noise-suppression} \end{figure} Due to the extremely high bandwidth of the digital and RF electronics, in principle, TO-OFD should permit near perfect cancellation of additive OFC noise for optical linewidths in excess of 1 MHz. As mentioned previously, noise suppression for microwave generation using the TO technique has direct application to field-deployable OFCs. In an attempt to quantify the cancellation, we increased the frequency noise on the OFC such that optical mode linewidths increased from 25 kHz to 2 MHz (near 1157 nm) by modulating an OFC laser mirror bonded to a fast PZT (PI Ceramic PL055.31) with white frequency noise. As seen in Figure \ref{fig:noise-suppression}, we compare $f_\text{TO,i}$ with and without added frequency noise. We observe nearly identical phase noise spectra despite the difference in OFC optical linewidths. The narrow ($\approx 5$ MHz) bandwidth of 10 GHz filters used to isolate the optical beat signals, limit the suppression bandwidth in our TO scheme. Ideally, latency in the TO electronics, including the DDS, will set the noise suppression bandwidth. For the AD9914 DDS used here, the latency of a 2.5 GHz clock is approximately 150 ns. Although TO-OFD demonstrates excellent frequency and phase noise suppression, it is unable to suppress noise resulting from AM-to-PM conversion. This may be dealt with by reducing the amplitude noise of the laser, for example, with active RIN suppression, or by operating the photodiode, amplifiers and mixers under conditions where AM-to-PM conversion is naturally suppressed \cite{Xie2017,Taylor2011,Baynes2015}. \subsection{Long-term behavior} \begin{figure} \includegraphics[width=8.5cm]{Figures/5.pdf} \caption{a) Time record and b) Allan deviation of the optical beat between the 1157 nm and 1070 nm optical references (blue points) and the microwave beat (orange points) between $f_\text{TO,1}$ and $f_\text{TO,2}$ derived from the same optical references. The microwave beat is normalized by 10 GHz and the optical beat is normalized by 280 THz in a). The difference (green points) between the blue and orange points is shown in a) and its Allan deviation is shown in b).} \label{fig:counting} \end{figure} While phase noise is used to evaluate the short term performance of the $f_\text{TO,i}$ microwave output (timescales less than 1 s), we are also interested in assessing the long-term performance of the microwaves generated via TO-OFD (timescales up to 10,000 s). More specifically, we want to determine the fidelity with which the 10 GHz output reproduces the fractional frequency stability and variations of the the optical references. To measure this, we simultaneously tracked the relative frequency drift of the 1157 nm and 1070 nm reference lasers in the optical domain using the Ti:Sapphire OFC, and the relative frequency drift between the two $f_\text{TO,i}$ signals produced using the Er/Yb:glass OFC from the same two optical references. Frequency data was counted using two Agilent 53131a frequency counters, each referenced to a 10 MHz H-maser signal. As seen in Figure \ref{fig:counting}a, we observed a strong correlation between the time records of the fractional frequency deviations in the optical signals and microwave signals. The level of correlation is quantified by the residual deviations in the difference frequency. The Allan deviation evaluates the fractional frequency stability of this data as a function of measurement time. As seen in Figure \ref{fig:counting}b, the upper bound to the residual instability contributed by the Er/Yb:glass OFC and TO electronics is less than $2 \times 10^{-15} \tau^{-1/2}$. \section{Conclusion} We have demonstrated microwave generation via optical frequency division of two high-stability optical references with absolute phase noise at or below -106 dBc/Hz at a 1 Hz offset from a 10 GHz carrier using the transfer oscillator technique. The latter result corresponds to a 1-second frequency instability of less than $2\times10^{-15}$, which indicates that the TO digital and analog electronics contribute minimal additional instability. This result represents the lowest-phase noise achieved, to date, using TO-OFD and is the first demonstration generating multiple independent optically derived microwave signals from a single OFC. In addition to characterizing and identifying the noise contributions to our transfer oscillator scheme, we have also demonstrated that the contribution of the OFC's noise to the TO signal is negligible for optical linewidths as large as 2 MHz, and OFC phase noise is suppressed by more than 100 dB close to carrier. This has direct application to low-noise microwave generation with more compact OFCs that exhibit high intrinsic noise. Additionally, TO-OFD provides the means to produce a reliable and robust optically derived microwave signal suitable for out-of-the lab applications. Finally, the transfer oscillator technique provides significant advantages if used for realization of an optical timescale. Timescales derived from an ensemble of optical references permit a large reduction in frequency noise and a slower accumulation of timing uncertainty \cite{Milner2019} than timescales based on microwave sources and references. The low residual noise and the increase of noise suppression bandwidth provided by TO-OFD will increase operational robustness and reduce the incidence of signal phase slips. Additionally, the ability to derive independent microwave signals from more than one optical reference may facilitate the redundancy necessary for deriving phase-continuous and high-stability electronic timing signals. \section{Acknowledgements} We thank I. Coddington, S. A. Diddams and F. Quinlan for their comments on this manuscript and J. C. Campbell for the MUTC photodiode. \section{Disclaimers} Certain commercial equipment, instruments, or materials (or suppliers, or software, ...) are identified in this paper to foster understanding. Such identification does not imply recommendation or endorsement by the National Institute of Standards and Technology, nor does it imply that the materials or equipment identified are necessarily the best available for the purpose. \section{Data Availability} The data that support the findings of this study are available from the corresponding author upon reasonable request. \section*{References}
\section{CONCLUSIONS \& FUTURE WORK} In this work, we targeted the motion planning problem in the presence of uncertainty caused by occlusion. We discussed how in practical RL problems, a policy that maximizes the worst-case reward could better match the desired behavior and leverage the distributional RL to maximize the worst case instead of the average reward. Extensions to SAC and DQN using quantile regression were proposed to find the action that optimizes the worst-case scenario. As a proof of concept, a set of motion planners for the self-driving task in the presence of occlusion were designed and evaluated using SUMO simulation environment. The results show that in problems where the reward is defined to achieve certain behavior, the reward alone cannot provide a useful metric for assessing the RL agents' performance. Furthermore, our proposed motion planners based on CQR-SAC$_\pi$ and CQR-DQN$_\pi$ achieved the desired behavior of avoiding collision with an occluded view without requiring to fine-tune the reward. We plan to apply the proposed approach to more complex and diverse environments in our future works. Such environments include intersections, roundabouts, and the inclusion of moving vehicles in the scenarios. With the inclusion of other moving vehicles, our expectation is that the ego agent can implicitly infer the state of the occluded area from other vehicles' behaviors. \section{EXPERIMENTS} \input{sections/result_table.tex} We test the proposed algorithms on two scenarios involving occlusion, as shown in Figure~\ref{fig_sumo_experiments}. The first task is to drive through a pedestrian crosswalk with an object at the corner of the crossing, blocking the car's view of the pedestrians approaching the crosswalk. Pedestrians are randomly spawned and traverse the road at the crossing. The second task involves a curved road with the side of the road having a large barrier, analogous to real-life examples such as tunnels and off-ramps in urban areas. For half of the episodes, we place a stationary vehicle at a random position on the road, replicating a traffic jam. The various agents were trained and tested on scenarios developed using the SUMO traffic simulation software \cite{SUMO2018}. We used a curriculum approach to gradually increase the task's difficulty from 1 to 5 every 50k steps, with the complexity being 5 from 200k steps onward. As the complexity increases, the occlusion is moved closer to the road. The curriculum helps the agent initially learn to move and adopt a more prudent behavior and slow down as occlusion blocks its view. For each task, we trained and compared the following RL algorithms: SAC, QR-SAC, CQR-SAC$_\pi$, CQR-SAC$_\tau$, DQN, QR-DQN, CQR-DQN$_\pi$, CQR-DQN$_\tau$. Additionally, as baselines, we developed and tested three rule-based planners: \textit{fixed}, \textit{naive}, and \textit{aware}. The \textit{fixed} planner drives at the speed limit and does not consider other objects. The \textit{naive} planner ignores the occlusion and drives at the speed limit unless it sees an object in its driving path. In such cases, it will slow down with a constant deceleration, up to a maximum of -4 [m/s$^2$], with the target of stopping just before the object. The \textit{aware} planner is based on the IADSR algorithm presented in \cite{8793557} and is aware of the occlusion. It assumes that an object is present in the occluded area and drvies at a speed that makes it possible to slow down (with -4 [m/s$^2$] deceleration) to a full stop without collision, if an object emerges from the occluded area. Additionaly, the \textit{aware} planner also maneuvers away from the occlusion to increase its view around the occlusion. \subsection{Training and Evaluation Result} Each agent was trained for a total of 500k training steps with 8 different seeds. Figure~\ref{fig_train} show the training progress of each agent. Note that performance drops at 50k step intervals, up to 200k, as the problem complexity increases. If we just focus on the average episode reward, we might conclude that the CQR-SAC$_\tau$ algorithm had the best performance. However, its higher collision rates show that it was not successful in learning to avoid collisions. When focusing on the collision rate, the CQR-SAC$_\pi$ and CQR-DQN$_\pi$ perform better than the rest and inline with the desired behavior. For the pedestrian crossing scenario, the SAC-based algorithms fared better than DQN-based algorithms. Also, extensions of SAC and DQN with quantile regression did not help significantly, showing that SAC and DQN algorithms were already successful in estimating the expected reward. However, in the curved road scenario, quantile regression significantly improves the collision rate compared to SAC and DQN. We evaluated the final trained agents (all 8 seeds for each agent) for 10k steps in test mode without the random action sampling. Table~\ref{table_evaluation} summarizes the average performance of various agents in addition to the rule-based planners. \begin{figure} \centering \includegraphics[width=0.44\textwidth]{figures/pedxing_behavior_SAC.png} \includegraphics[width=0.44\textwidth]{figures/pedxing_behavior_CQRSAC.png} \caption{The comparison between behavior of two motions planners, SAC and CQR-DQN$_\pi$. The dots show the vehicles' positions across multiple episodes, with the color representing the vehicle's speed.} \label{fig_behavior} \end{figure} The \textit{fixed} agent gives us the baselines for the worst performance. As expected, the \textit{naive} agent fails to prevent collisions when the obstacle is in the occlusion areas. But, when the obstacle is not behind occlusion, it prevents collisions and has lower collisions compared to \textit{fixed} agent. The \textit{aware} agent represents the highest possible performance in terms of safety and avoids all collisions for the curved scenario. For the pedestrian crossing scenario, the collisions happen due to the pedestrians' random behaviors and how SUMO simulates their movement. The RL-based agents repeat their performance from the training plots, though slightly better as actions are deterministic. In the pedestrian crossing scenario, we expected that algorithms that maximize average reward (SAC, QR-SAC, DQN, and QR-DQN) yield higher overall reward; however, the result shows that maximizing the lower bound of the reward can result in an overall higher reward. We conclude that this is mostly due to penalty from excessive deceleration based on the agents' behavior analysis. The agents that approach objects with high speed need to brake more firmly to stop and receive a substantial negative reward. The vehicle's movements along the road for two motion planners, SAC and CQR-SAC$_\pi$, are shown in Figure~\ref{fig_behavior}. The color of the dots shows the speed of the vehicle at that point. We can see that both planners have the same speed after the intersection, but the CQR-SAC$_\pi$ agent approaches the crosswalk with much slower speeds compared to the SAC agent. Furthermore, it is interesting that both RL-based planners have learned that they need to move to the left as they approach the crosswalk to have a better view behind the occlusion. \section{INTRODUCTION} Motion planning is the task of finding a trajectory for an autonomous vehicle to follow to achieve its higher level goals \cite{paden2016survey}. The most critical objective of motion planning is to deliver a safe trajectory, and in the self-driving context, various sources of uncertainty make this objective challenging. In this work, we focus on the uncertainty in sensing and perception, resulted from a limited field of view, occlusions, and sensing range. Conventional approaches tackle this uncertainty by considering hypothetical objects in the occluded regions. Thus, safety can be guaranteed if the trajectory avoids all these hypothetical objects. This approach is reasonably effective when the scope is narrow, and the motion planner needs to cover limited situations. However, developing a motion planner covering every possible situation is a tedious process, if not impractical, particularly in autonomous driving scenarios. Furthermore, as scenarios get more complex, such approaches result in conservative planning and expensive computation. \begin{figure}[t] \centering \includegraphics[width=0.49\columnwidth]{figures/pedxing_combined.png} \includegraphics[width=0.49\columnwidth, trim={0, 0, 0, 0.15cm}, clip]{figures/curve_combined.png} \caption{The impact of occlusion on the visibility of an autonomous vehicle and the resulting uncertainty in two scenarios. Left, occlusion at the corner of a pedestrian crossing. Right, occlusion as a result of the road curve, \textit{e.g.} tunnels or highway off-ramp.} \label{fig_sumo_experiments} \end{figure} Machine learning and data-driven approaches provide a viable alternative to classic approaches to motion planning in crowded and complex environments. However, using machine learning-based approaches without considering the required transparency and safety criteria can be catastrophic in autonomous vehicles. We aim to address the problem of motion planning in the presence of uncertainty using reinforcement learning (RL). Conventional RL formulation aim at maximizing the expected reward, which is not safe and robust to uncertainties. We leverage the recent advances in distributional RL, and propose an algorithm that finds the control policy that maximizes performance for the worst-case scenario. We apply the proposed algorithm to the motion planning problem under occlusion. As a proof of concept, we test the algorithm on two driving scenarios: \romannumeral 1) a vehicle passing a pedestrian crossing in the presence of an occlusion blocking view of approaching pedestrians, and \romannumeral 2) driving on a curved road with the curve blocking the view. The occlusion is provided to the agent as an occupancy grid map~(OGM) generated from a LIDAR sensor's output. To summarize, the main contributions of this paper are: \begin{itemize} \item Adapting the formulation for deep RL problems to take into account uncertainty in the environment and optimizes for the worst-case scenario; \item Developing a motion planning approach that effectively navigates in the presence of occlusion. \end{itemize} In Section~II, we review the related works on motion planning. In Section~III, the proposed RL-based solution for problems with uncertainty is introduced. In Section~IV, the proposed algorithm is utilized to design a motion planning solution. Section~V presents a simulation experiment and elaborates the result of applying the proposed algorithm. Finally, Section~VI summarizes the paper. \section{Motion Planning under Uncertainty} We aim to solve the motion planning problem when occlusions cause uncertainty. Consider the case where a vehicle is approaching a pedestrian crosswalk, and a large vehicle parked on the side of the road is blocking the view where pedestrians might enter the crosswalk. We present this information to the motion planner through an OGM combined with an image of the road network. The OGM provides information about the occluded areas, and the road network image identifies where road users might be present. Furthermore, we expect the motion planner to perceive objects from the OGM without providing any explicit information about the objects on the scene. To solve this motion planning problem, we search for the best trajectory in the Frenet frame. This is analogous to conventional motion planning in Frenet frame (e.g. \cite{werling2010optimal}). In Frenet frame, a trajectory that follows the center of the lane becomes a straight trajectory; therefore, simplifying the search space. We parameterize a trajectory with 4 variables, current speed, $v_0$, current lateral offset, $l_0$, final speed, $v_f$, and final lateral offset, $l_f$. The trajectory is then created so that the vehicle speed and lateral positions gradually change from initial values to the final values in a predefined period of time following a first-order exponential trajectory. While the actual speed is limited to non-negative values, $v_f$ can be negative to help the speed trajectory reach zero faster in emergency situations. Additionally, the lateral movement is limited according to the vehicle's speed. The two variables $v_0$ and $l_0$ are based on the vehicle's current state, provided to the motion planner as inputs, and the motion planner needs to optimize $v_f$ and $l_f$. \subsection{Motion Planning using RL} The two variables that need to be optimized, $v_f$ and $l_f$, are the actions of the RL agent. Inputs to the agent consist of 2 frames of the OGM (current and previous time steps), the current frame of the road network, and the current speed. OGM and road network are 2D images in the vehicle's coordinate frame. The current speed is a scalar value that is expanded to fill a 2D input channel. \begin{figure}[b] \centering \fbox{\includegraphics[width=0.7\columnwidth{}]{figures/traj_vs_policy_evaluation.png}} \caption{Illustration of what path would be evaluated when evaluating a trajectory versus a policy.} \label{fig_traj_vs_policy} \end{figure} We employed a time step of 1 second for transitions between states. The reward is defined such that it addresses safety, comfort, and mobility needs. The mobility reward, $r_m$, is defined to be increasing linearly with the vehicle's speed, $v$ [m/s], up to the speed limit, $v_{lim}$ [m/s], and decreases quadratically for speeds above the speed limit, \begin{equation} r_m= \begin{cases} v,& \text{if } v \leq v_{lim}\\ \max (0, v - (v-v_{lim})^2),& \text{otherwise} \end{cases}. \end{equation} The comfort reward, $r_c=-a^2 - |l|$, discourages excessive acceleration and deviation from the center of the lane. In this equation, $a$ is the vehicle acceleration [m/$\text{s}^2$], and $l$ is the lateral offset with respect to the lane center [m]. To encourage safety, we terminate the episode and set the reward to zero in case of collision. To differentiate between a stationary vehicle (also reward of zero) and a collision, the agent receives a reward of $1$ for every time step. The combined reward of the agent at every step would be: \begin{equation} r= \begin{cases} 0,& \text{if } \text{collision}\\ 1 + r_m + r_c,& \text{otherwise} \end{cases}. \end{equation} \subsection{Evaluating a Trajectory Versus Policy} \begin{figure*} \centering \includegraphics[height=3.3cm, trim={0mm 7mm 0mm 0mm}, clip]{figures/pedxing_train_col.pdf} \includegraphics[height=3.3cm, trim={0mm 7mm 0mm 0mm}, clip]{figures/pedxing_train_speed.pdf} \includegraphics[height=3.3cm, trim={0mm 7mm 0mm 0mm}, clip]{figures/pedxing_train_reward.pdf} \includegraphics[height=3.65cm]{figures/curve_train_col.pdf} \includegraphics[height=3.65cm]{figures/curve_train_speed.pdf} \includegraphics[height=3.65cm]{figures/curve_train_reward.pdf} \caption{The progress of each algorithm during the training process. The value for each point is the average of the last 1000 training steps. The confidence bands show the variation from 8 training runs with different seeds. } \label{fig_train} \end{figure*} In traditional motion planning, a trajectory is evaluated based on the assumption that the vehicle will follow the trajectory entirely. Although the vehicle's trajectory might change in future timesteps, the evaluation will not consider these potential trajectory changes. From an RL perspective, if the agent's action is defined as the trajectory, evaluating a trajectory is equivalent to estimate the Q-value with the assumption that the agent's action in future states will be the same as the one in the current state. The distributional Bellman update rule for such evaluation of a trajectory would be: \begin{equation} Z(s, a) :\stackrel{D}{=} r(s, a) + \gamma Z(s', a), \end{equation} where $s'$ is the next state, and the current action, $a$, is also used to estimate the next state's value. We will denote the algorithms that use this update rule with $\tau$ (CQR-DQN$_\tau$, CQR-SAC$_\tau$). In contrast, in the RL formulation, the action (trajectory) in future states is according to the agent's policy, and evaluation is done knowing that the future actions might differ from the current action. In the case of policy, the Q-value assigned to a state-action pair is the expected reward if the agent's policy is followed. Figure~\ref{fig_traj_vs_policy} illustrates the path that would be evaluated when evaluating a trajectory versus a policy. Following and evaluating a policy will result in more flexibility, and the motion planner can potentially find better solutions. We will denote the algorithms that evaluate the agent's policy with $\pi$ (CQR-DQN$_\pi$, CQR-SAC$_\pi$). \section{RELATED WORKS} The classic approaches to motion planning usually involve defining a cost function that evaluates trajectories and searching for the trajectory that optimizes this cost~\cite{paden2016survey}. Since the trajectories need to satisfy the vehicle's kinematic and dynamic constraints and adhere to social driving norms, the search space can be reduced to search only within a subset of possible trajectories. Classical algorithms model the behavior of various road objects and predict their future position. This information is then employed to check the safety of a candidate trajectory. When dealing with uncertainty due to occlusion, the worst-case possibility (the occluded area being occupied by an object) is considered for safety estimation. In \cite{8793557}, the ego vehicle's surrounding environment is represented using a grid map, and occluded pixels are propagated in certain directions when predicting future drivable areas. Considering this constrained drivable area, a trajectory is planned that can guarantee passive safety. While effective in guaranteeing safety, this assumption leads to excessive computation and conservative planning in complex and crowded environments. In \cite{morimura2010parametric}, the authors propose an approach to estimate the state of occluded regions from other users' behavior instead of making a conservative assumption about the occluded regions. Then the planning is done with the estimated complete state of the environment. Reinforcement learning provides a solution to deal with the computation cost imposed by crowded environments. While in classical approaches, objects need to be explicitly modeled, RL enables estimating the value/cost of a trajectory without modeling individual objects. There are numerous examples of RL being applied to motion planning \cite{aradi2020survey, kiran2021deep}. Recent studies of autonomous driving systems using RL have been divided into two main categories: end-to-end approaches and modular systems. In the end-to-end approaches, sensory inputs are mapped directly to control commands via trained neural networks~\cite{kendall2019learning, xiao2019multimodal, bojarski2016end}. The modular systems breake the self-driving problem into smaller problems with each module being developed independently~\cite{feher2019hybrid, ronecker2019deep}. As such, the motion planner can be developed in isolation. This hierarchical paradigm allows for better explainability and ease of validation and test. In our previous work~\cite{rezaee2019multi}, we presented such hierarchical RL planning framework for cruising on multi-lane roads. The approach introduced an intermediate abstraction to the motion planning sub-problem, where a behavioral planner dictates a high-level decision that is then carried out by one of many specialized motion planers. Conventional RL formulation finds the policy that maximizes the expected sum of future rewards, including the RL methods described previously. In the presence of uncertainty, unsafe trajectories with catastrophic results rarely happen. Therefore, the process of maximizing expected (average) reward does not guarantee the elimination of these unsafe trajectories. RL formulation can be expanded to maximize objectives that explicitly avoid unsafe events. One such objective is conditional value at risk (CVaR). In \cite{morimura2010parametric}, a parametric method is employed to estimate the density of the returns. Estimating the probability density of the reward allows for optimizing other criteria, other than the expected reward, such as value at risk. In \cite{chow2018risk, keramati2020being}, RL formulation is modified to maximize CVaR. These methods are developed based on solid theoretical grounds and provide proof of convergence and efficiency. However, they are limited to application with finite states and actions and are not readily applicable to more complex problems. Quantile networks \cite{dabney2018distributional, pmlr-v80-dabney18a} estimate the reward density with high fidelity without forcing a specific parametric function to the density, which results in a more accurate estimate of the reward density. In \cite{pmlr-v80-dabney18a}, authors experimented with reward density information to perform optimistic or pessimistic exploration while still maximizing average reward. Our proposed approach is built on top of the quantile network proposed in \cite{dabney2018distributional} while maximizing a reward associated with the worst-case scenario. \section{REINFORCEMENT LEARNING TO OPTIMIZE THE WORST CASE} \subsection{Reinforcement Learning} The general RL problem is formulated as a discrete Markov Decision Process where an agent interacts with its environment. At time step $t$, the agent is in state $s_{t}$ and takes an action $a_{t}$. The agent obtains a reward $r_{t}$ and transitions to a new state $s_{t + 1}$. The goal is to find the optimal policy $\pi^{*}$ that maximize the expected future total reward $R$, \begin{equation} R^\pi = \mathop{\mathbb{E}}\left[\sum\limits_{t=t_0}^{\infty}{\gamma^{t} r(s_{t}, a_{t}) }\right], \end{equation} where $\gamma$ is the discount factor. There are two main categories of RL algorithms: value-based and policy-based. In the value-based scheme, commonly an action value function $Q(s, a)$ is used to describe the corresponding state-action pair's value. \begin{equation} Q(s, a) = \mathop{\mathbb{E}_{\pi}}\left[R_{t} | s_{t}=s, a_{t}=a\right] \end{equation} This value function is then used to decide the action yielding the best outcome for a given state (the policy). On the other hand, in policy-based algorithms, a policy $a_t = \pi(s_t)$ that maps from states to actions is learned directly, with the optimal policy, $\pi^*$, maximizing the expected reward. \begin{figure}[b] \centering \includegraphics[width=0.6\columnwidth]{figures/cliff_walk.png} \caption{A slightly modified version of the cliff walk example from \cite{sutton1988reinforcement}. The task is to go from start cell S to goal cell G, while avoiding the cliff area. The reward is -1 for all states, except the cliff area that has a reward of -20 and terminates the episode. Every action is randomly replaced with a down movement with probability $p$.} \label{cliff_walk} \end{figure} \subsection{The Case Against Maximizing Average Reward} In RL problems, commonly, the goal is to maximize the expected future total reward. In problems where the reward is clearly defined (games and toy problems), this approach is ideal as it maximizes the agent performance and provides a level playing field when comparing various algorithms. However, in practical problems, maximizing the reward is rarely the objective. The reward is usually designed to quantify and differentiate various behavior. Positive values are assigned for good behavior, and negative values (penalty) are used for behaviors that need to be avoided. Consider the cliff walk example described in Figure~\ref{cliff_walk}. Considerin the random down action, moving along path 1 might result in agent falling off the cliff. For path 2, the agent will have a chance to recover and get away from the cliff if the random down action happens. For $p=0.1$, the optimal path that maximizes reward would be path 2, as the expected penalty of falling off the cliff outweighs the savings of shorter path 1. However, for $p=0.01$, the expected penalty is small and optimal path that maximizes the average reward would be path 1. While the penalty for falling off the cliff can be modified to achieve the desired behavior, in practical applications, many reward values need to be defined, and the probabilities are not known a priori. This makes it impractical and tedious in real applications to tune the rewards to achieve the desired behavior. A simple solution to this problem is to assign the worst possible outcome as the value of each state instead of its expected return. With this defintion for value of a state, path 2 would be optimal irrespective of $p$. \subsection{Distributional RL to the Rescue} Distributional RL \cite{dabney2018distributional} aims at estimating the distribution of possible outcomes for each state-action pair. The total return associated with taking action $a$ in state $s$ and following a policy $\pi$ would be defined by a random variable, $Z^\pi(s,a) = \sum_{t=0}^{\infty} \gamma^t r_t$. As discussed in the previous section, with access to the distribution of the returns, we can assign the value of a state as the worst case (lower bound) of its possible outcomes: \begin{equation} Q^\pi (s,a) = \inf (Z^\pi(s,a)), \label{equation_lower_bound} \end{equation} where $\inf(Z)$ is the lower bound of the random variable $Z$. One effective approach to estimate the distribution of the random variable $Z$ in the RL context is \textit{Quantile Regression} \cite{dabney2018distributional}. For a distribution defined with $N$ quantiles $q_1$ to $q_N$, $q_1$ is the approximate lower bound of possible returns. This approach can be applied to any RL algorithm that incorporates a value function. For this purpose, the value function needs to be augmented to estimate $N$ quantiles, approximating its distribution. Then the value of a state would be defined as \eqref{equation_lower_bound}. \subsection{Formulation of Conservative Reinforcement Learning} The QR-DQN \cite{dabney2018distributional} algorithm extends the DQN algorithm to use quantiles as outputs of the network and calculates the value of a state-action pair as the mean of the distribution defined by the quantiles, $Q^\pi (s,a) = \sum_{j=1}^N{\frac{1}{N} q_j(s,a)}$, where $q_j(s,a)$ is the value of quantile $j$ for state-action pair $(s,a)$. When using quantile regression for estimating the value of quantiles, the regression process results in values being sorted from lowest to highest. Hence, we can use the first value as the lower bound estimate. We replace the definition of a state-action pair's value in QR-DQN with \begin{equation} Q^\pi (s,a) = q_1(s,a), \label{eqn:qunatile_low_bound} \end{equation} where $q_1$ is the first quantile. This modification is done when calculating the targets for the learning step and when choosing the optimal action. We refer to this algorithm as \textit{Conservative QR-DQN} (CQR-DQN) Another RL algorithm that has attracted attention recently is Soft Actor-Critic (SAC) \cite{haarnoja2018soft} which follows the Actor-Critic framework. A Q-network is trained to estimate the value of following the policy, and the policy is trained to maximize Q-values. While in \cite{duan2021distributional}, the authors proposed a distributional extension to the SAC algorithm, they used a Gaussian distribution to represent the random outcomes. Since we want to estimate the lower bound, a Gaussian distribution is not suitable for this purpose. We propose to extend SAC with quantile regression. Effectively, the Q-network is extended to estimate the quantiles. Then Q-value of a state-action pair is estimated using~\eqref{eqn:qunatile_low_bound}, similar to the case for QR-DQN. Following the distributional Bellman equation in QR-DQN, we can write the distributional SAC Bellman update rule for Critic as: \begin{equation} \label{eqn:dist_bellman} Z^{\pi}(s, a) :\stackrel{D}{=} r(s, a) + \gamma (Z^{\pi}(s', a') - \log \pi(a' | s')) \end{equation} \noindent where the sign $:\stackrel{D}{=}$ represent the two sides having the same distribution. The actor update rule would not change from the original SAC. We refer to this algorithm as Conservative QR-SAC (CQR-SAC), where QR-SAC refers to the SAC algorithm augmented with quantile regression while still maximizing the average return.
\section{Introduction}\label{sec:intro} In September 2015 the Advanced LIGO (aLIGO) detectors \cite{aLIGO2015} made the first direct observation of gravitational waves from a binary black hole merger \cite{GW150914}. This first detection kicked off the exciting new field of gravitational-wave astronomy. Since the first detection, aLIGO, together with the Advanced Virgo observatory \cite{Acernese_2014}, has undergone incremental upgrades to improve the sensitivity to gravitational waves, and subsequently observed over 50 gravitational-wave events \cite{GWTC1,GWTC2} from binary black holes~\cite{GW150914}, binary neutron stars~\cite{GW170817, GW190425}, and neutron-star black-hole binaries~\cite{GWNSBH}. The aLIGO detectors are two dual-recycled Fabry-P\'{e}rot Michelson interferometers located in Hanford, Washington and Livingston, Louisiana. Incoming gravitational waves cause a minuscule displacement of the test masses - 40~kg mirrors which make up the 4km long arms of the Michelson interferometer. The gravitational-wave readout is a measure of the differential arm length of the interferometer. The sensitivity of the current gravitational-wave detectors is broadly limited by quantum noise~\cite{O3comm}. Below 50~Hz, the quantum noise manifests itself as radiation pressure noise, as photons circulating in the arm Fabry-P\'{e}rot cavities impart momentum to the test masses. Above 100~Hz, the sensitivity of the detector is limited by quantum shot noise. The sensitivity of the aLIGO detectors is improved by the injection of squeezed states of light. In the most recent observing run (O3) frequency-independent squeezing was injected into the aLIGO detectors, reducing quantum shot noise by roughly $3~\mathrm{dB}$ compared to when no squeezed light is injected \cite{Tse_2019}. The aLIGO detectors are currently being upgraded. One of the major upgrades for the next observing run (O4) is the implementation frequency-dependent squeezing. Frequency-dependent squeezing is achieved by reflecting squeezed light off a long-baseline filter cavity, with the filter cavity pole at the desired rotation frequency. For O4, a 297~m filter cavity will be installed at each of the LIGO sites. To maximize the squeezing improvement to detector sensitivity, the mode-matching losses between the various optical cavities need to be minimized. The negative effect of mode mismatch on squeezed photons is twofold: mode mismatch causes optical loss and adds phase noise to the squeezed beam. For the next phase of LIGO upgrades after O4, the goal is to achieve 6~dB of frequency-dependent squeezing improvement to the detector sensitivity \cite{Miller2015, Barsotti2018}. The piezo-deformable mirrors developed here have critical applications in active wavefront control for future gravitational-wave detectors, like Cosmic Explorer~\cite{CEHS}, as frequency-dependent squeezing is integral in achieving their design sensitivity. A common architecture of piezo-deformable mirrors utilizes a thin mirror bonded with a piezoelectric substrate, referred to as the unimorph~\cite{roddier_1999, tokovinin2004using, rausch2016unimorph}. The range of deformation is inversely proportional to the flexure rigidity, hence thinner unimorph mirrors yield a larger range of deformation. However, this technology has limited application in aLIGO for three reasons. First, we need high reflectivity mirrors with reflectivities greater than 99.9$\%$. These requirements cannot be met with existing technology for thin mirrors (3~mm thickness or less). Second, the mirrors used in aLIGO and other laser-line optical physics experiments demand a high surface quality finish. The unimoph architecture cannot meet the aLIGO requirements because it is difficult to manufacture a thin mirror with the required surface finish (better than $\lambda$/10). Third, we estimate a 3~mm thick mirror composite with a piezoelectric substrate of any thickness does not offer the minimum desired range of actuation. The thin unimorph mirrors can provide a higher range by using multiple composite piezo films. However, ensuring low higher-order mode scattering becomes increasingly complicated, which is a stringent criterion for adaptive optics in aLIGO, see section~\ref{sec:des_req}. For mirrors with a typical thickness of 5~mm or higher, which satisfy the high-reflectivity and optical finish criteria, the deformation achievable using unimorph designs is too low and fails to meet the design requirements for mode-matching applications for aLIGO. Presented here is the design and implementation of a new deformable mirror for active mode matching in aLIGO. The design uses a piezoelectric transducer (PZT) to apply a distributed bending moment on the mirror barrel via an axisymmetric flexure, thereby controlling the mirror radius of curvature. The flexure-based piezo-deformable mirrors presented here has a large operating range, a high bandwidth, and is compatible with ultra-high vacuum operation. Designed for two-inch diameter optics with 5~mm thickness, the scattering to higher-order modes is below 0.2$\%$ for beam radius less than 2~mm. An alternative thermally actuated design is being implemented in aLIGO concurrently with the piezo-deformable mirrors \cite{Cao20}. The thermal design has an increased operating range in vacuum compared to the piezo-deformable mirrors but offers a much lower bandwidth of 1~mHz. The motivation and design requirements of the piezo-deformable mirrors for application in aLIGO and future upgrades are discussed in section~\ref{sec:des_req}. In section~\ref{sec:design} the design of the flexure-based piezo-deformable mirror is presented. The performance results of the piezo-deformable mirror are summarized in section~\ref{sec:res}. \begin{figure} \begin{center} \includegraphics[width=0.49\textwidth]{o4Layout1.pdf} \caption{Simplified layout of the aLIGO detector with piezo-deformable mirrors in the squeezer path. In the aLIGO layout for O4, there is one piezo-deformable mirror between the squeezer and the filter cavity, and two piezo-deformable mirrors between the squeezer and output Faraday isolator. Only one is shown above for simplicity.} \label{fig:layout} \end{center} \end{figure} \section{Requirements for aLIGO}\label{sec:des_req} The piezo-deformable mirrors will be used for active wavefront control and mode-matching at two locations in the aLIGO beam path, shown in Fig.~\ref{fig:layout}. First, between the squeezed light source and the filter cavity. Second, between the output of the filter cavity and the main interferometer. The required operating range of the piezo-deformable mirror is greater on the filter cavity to interferometer path, as the mode shape of the beam from the interferometer is not as well known. However, for both of these ports, the mode-matching needs to be better than 96$\%$ to achieve the broadband improvements in sensitivity from 6~dB of frequency-dependent squeezing. Based on our simulations of the current and expected mode mismatch, a range of $\pm160$~mD will be sufficient to correct for mode mismatch between the filter cavity and interferometer, and $\pm30$~mD is required on the path between the squeezer and the filter cavity. To assist in characterizing the mode mismatch between the cavities in the aLIGO detector, the radius of curvature of the piezo-deformable mirrors will be dithered at a frequency in the aLIGO detection band~\cite{O3comm}. To achieve this, a high bandwidth of $\sim$20~Hz is needed on the piezo-deformable mirror actuators. The aLIGO detectors have stringent requirements for any new optics added to the system. Any technical noise added to the gravitational-wave readout must be at least a factor of 10 below the design sensitivity. The piezo-deformable mirrors could inject technical noise through spurious changes in the defocus of the beam, higher-order mode content generated by the mirror surface, or displacement of the mirror surface. Any modes other than the fundamental Gaussian mode are considered to be higher-order modes. We require the higher-order modes induced by the piezo-deformable mirrors to be a factor of 10 below the mode-mismatch ($L_{\text{o}}$) requirement of 4$\%$. This demands that the higher-order mode content (or scattering) from the piezo-deformable mirrors be less than 0.4$\%$. The defocus noise $S(f)$ arises from the fluctuations in the radius of curvature of the piezo-deformable mirrors. This induces a fluctuation in the mode-matching losses, which produces a proportional change in relative intensity noise transmitted to the detection port, resulting in an apparent displacement noise ($z(f)$). This apparent displacement noise for a given optic should be at least 10 times less than the displacement noise requirement in the aLIGO detectors so that it is not limiting the gravitational-wave detector sensitivity. The defocus noise is dependent on the beam size ($w$) at the piezo-deformable mirror, and is coupled to the displacement noise by \begin{equation} \frac{z(f)}{\mathcal{C}_{\text{tf}}} \approx \frac{\pi w^2}{\lambda}\sqrt{L_{\text{o}}} S(f), \end{equation} where $\mathcal{C}_{\text{tf}}$ is the transfer function from relative intensity noise to interferometer displacement noise, $\lambda$ is the wavelength of the laser, and $L_{\text{o}}$ is the mode matching requirement described above. Using this estimate $S(f)$ must be below $10^{-5}~\text{D}/\sqrt{\text{Hz}}$ above 100~Hz to meet the displacement noise requirement of the squeezer path. This is a conservative estimate because at the optimally tuned setting of the piezo deformable mirror the linear coupling from defocus noise to displacement noise goes to zero. Lastly, to damp displacement noise, and to soften the scattered light requirements, the piezo-deformable mirrors will be hung from double pendular suspensions, in a similar configuration to other aLIGO auxiliary optics~\cite{strain2012damping}. \section{Design}\label{sec:design} \begin{figure} \begin{center} \includegraphics[height=0.25\textheight]{PSMAS_Hanford_v2.pdf} \includegraphics[height=0.25\textheight]{PSAMS_Final.pdf} \caption{\textit{Left:} An assembled flexure-based piezo-deformable mirror actuator for active mode matching in aLIGO. \textit{Right:} The main components of an assembled piezo-deformable mirror. The mirror is compression fitted inside the flexure~\S\ref{subsec:comp_fit} and attached to the top aligner. This assembly is then attached to the body using 16 screws each torqued to 30~in-lbs. The piezoelectric transducer (PZT) stack, and the bottom aligner are inserted from the back, followed with the attachment of the reaction plate. The spherical washers and the thrust bearing are gently placed on the bottom aligner, and the pre-loader is torqued to at least 25~in-lbs to secure the assembly. } \label{fig:PDM-Design} \end{center} \end{figure} The piezo-deformable mirror is designed to meet the noise requirements described in section \ref{sec:des_req}, while maintaining a fast response time for convenient commissioning. Fig.~\ref{fig:PDM-Design} shows the schematic of the piezo-deformable mirror. The key component is an inverted hat-shape axisymmetric flexure that converts a pushing force from the PZT into a distributed bending moment around the mirror circumference, thereby deforming the mirror for a radius of curvature. When a voltage is applied to the PZT, it elongates along the axial direction. The force associated with this elongation is distributed on the back of the flexure via the top aligner. The flexure is bolted to the body to constrain any motion along the circumference, and the axial force applied to the flexure produces a moment that causes spherical deformation on the mirror. Thus, by driving a voltage to the PZT one can actively change the radius of curvature of the mirror for mode-matching applications in aLIGO. The different components of the piezo-deformable mirror, see Fig.~\ref{fig:PDM-Design}, along with their functions are described below. \begin{itemize} \item The {\it flexure} converts the axial force applied on the back to spherical deformation of the mirror surface. The mirror is held in the flexure due to the compression bias introduced after compression fitting. The process for compression fitting the mirror inside the flexure is discussed in section~\ref{subsec:comp_fit}. \item The flexure with the compression fitted mirror is attached to the {\it body} with screws. To ensure radial symmetry each screw is torqued to 30~in-lbs. \item The PZT (Noliac NAC2125-H50-A02) is held inside the {\it body} with {\it top and bottom aligners}. These aligners ensure that the piezo is flush against the back surface of the flexure. It is important to ensure that there is no angular misalignment of the PZT upon assembly. The PZT has a half-bridge strain gauge bonded to it, which allows the read out of the strain on the piezo, discussed in section~\ref{subsec:strain_gauge}. \item The {\it reaction plate} serves the role of a hard boundary wall. The applied force at the back of the flexure depends linearly on the longitudinal displacement. The reaction plate ensures that the stroke from the PZT preferentially displaces the back surface of the flexure. \item The {\it pre-loader} is a fine threaded screw that goes through the reaction plate. The pre-loader ensures that the piezo is secured stiffly inside the body. We recommend that the pre-loader is torqued to at least 25~in-lbs to ensure the PZT stack is well constrained before the application of any voltage drive. The torque applied to the pre-loader provides static deformation to the radius of curvature of the mirror without any voltage drive to the PZT. The operating point or the optimal radius of curvature can be changed by further torquing the pre-loader. One can torque the pre-loader up to 100~in-lbs without any damage to the piezo or the mirror. In this design, the pre-loader torque cannot be adjusted under vacuum. \end{itemize} The piezo-deformable mirror offers two design variations for the assembly of the mirror and the flexure. First, a stainless steel (440C) flexure with an intermediate aluminum ring (6061) between the flexure and the mirror. The design concept is presented in~\cite{ASPE2020}. This allows greater flexibility in design because the level of mirror compression fit can be adjusted by compensating accordingly the intermediate ring. However, the Young's modulus of stainless steel is higher, which limits the actuation range of the piezo-deformable mirror. Also, the two-stage compression fitting -- flexure and ring, followed by mirror in the flexure -- makes compression fitting more challenging. The second variation of the design uses an aluminum (7075) flexure which is custom made for each mirror. This design, although tuned for each flexure-mirror pair, is easier to assemble. Moreover, the lower Young's modulus of aluminum provides a greater actuation range as it is easier to deform the flexure. We will reserve all discussions to the aluminum flexure-based piezo-deformable mirror in this paper. Compression fitting the mirror into the flexure and installing the flexure assembly on the body induce minimal change to the defocus of the mirror. The defocus is defined as the inverse of the focal length. The net defocus of the piezo-deformable mirror ($D_{\text{PDM}}$) is given by \begin{equation} D_{\text{PDM}} \approx D_{\text{mirror}} + D_{\text{preload}} + D_{\text{actuation}} \end{equation} where $D_{\text{mirror}}$ is the defocus of the mirror, $D_{\text{preload}}$ is the defocus due to the preload, and $D_{\text{actuation}}$ is the defocus due to the PZT actuation. The operating defocus $D_{\text{op}}$ is set such that $D_{\text{mirror}}$ and $D_{\text{preload}}$ cancel out at half the maximum actuation voltage. \begin{equation} D_{\text{op}} \approx D_{\text{actuation}} (V_{\text{max}}/2) \end{equation} The operating defocus for production units to be installed in aLIGO varies depending on the optic placement along the beam. \section{Results}\label{sec:res} Multiple assemblies of the piezo-deformable mirrors were tested using the Zygo interferometer, which is used to characterize the aLIGO core optics~\cite{zygo}. The Zygo interferometer is a Fizeau topology, which uses a reference optic to measure the surface profile of a mirror under test. We use the Zygo interferometer to measure the deformed mirror surface of the piezo-deformable mirror with varying amounts of torque applied to the pre-loader, and when the piezo is driven with an external voltage. The measured deformation of the mirror was used to estimate the range of defocus and the higher-order mode content, which is discussed in sections~\S\ref{subsec:range} and~\S\ref{subsec:HOMS}. The defocus noise of the piezo-deformable mirror has also been measured in a separate Michelson interferometer, and has proven to meet the requirements of aLIGO~\cite{Jia2021}. As part of the Michelson interferometer testing, the resonances of the piezo-deformable mirror assembly have been measured, with the lowest resonance at 386 Hz. This is sufficiently high to allow $\sim 20$ Hz bandwidth operation in the aLIGO detector. \subsection{Defocus range of the piezo-deformable mirror}\label{subsec:range} \begin{figure} \begin{center} \includegraphics[width=0.49\textwidth]{5mm_Al_range_summary.pdf} \caption{The points represent the measured defocus range (mD) as a function of drive voltages through the PZT, with a static pre-loads of 30, 50, 80 and 100 in-lbs (blue, green, pink and red). We note that the minimal 25~in-lbs preload induces an approximately 60~mD of defocus on the mirror. The static preload by adjusting the torque applied to the pre-loader (no voltage drive) offers a defocus range of over 200~mD (from -65~mD to -285~mD for this prototype). The PZT drive over 200~V offers an additional 120$\pm$8~mD of operating range. } \label{fig:5mm-Al-Range} \end{center} \end{figure} The piezo-deformable mirror actively changes the radius of curvature of the mirror when an external voltage is applied. We use the Zygo interferometer to measure the surface profile of the mirror in the assembled piezo-deformable mirror. At different values of the piezo drive (from 0~V to 200~V), we measure the surface profile with a pixel resolution of 192~$\mu$m and with 100 averages. The surface profile was fit to linear and quadratic order over a circular region with a diameter of 25~mm. The quadratic term measures the defocus and the linear term measures the tilt of the mirror surface. The piezo-deformable mirrors offer an active operating range of 90$\pm$6~mD over 150~V of an external voltage. The PZT in the design can be driven up to 200~V offering an operating range of 120$\pm$8~mD. The pre-loader was torqued to different values to change the static defocus of the mirror. We find the change in preload from the minimum of 25~in-lbs to a maximum of 100~in-lbs offers approximately 200~mD of static adjustment range, see Fig.~\ref{fig:5mm-Al-Range}. \subsection{Higher-order mode scattering}\label{subsec:HOMS} \begin{figure} \begin{center} \includegraphics[width=0.49\textwidth]{HOMS_5mmMirror.pdf} \includegraphics[width=0.49\textwidth]{HOMS_power_overlap.pdf} \caption{\textit{Left:} The higher-order mode content of piezo-deformable mirrors with 50 in-lbs of preload at 0, 50, 100, 150, and 200~V of drive to the PZT as a function of beam radius. The Zygo interferometer has a pixel resolution of 0.192~mm, which limits the higher-order mode content projection for smaller beam sizes. However, it is expected to be smaller than the higher-order mode content for 0.25~mm beam radius. We find Gaussian beams up to a radius of 2.5~mm experience less than 0.4$\%$ of higher-order mode content over the entire range of piezo-deformable mirrors operation. \textit{Right:} The higher-order mode content as a function of power overlap between the incident and the reflected field. As the defocus of the mirror increases with the PZT drive, the power overlap decreases. However, we find the piezo-deformable mirrors ensures higher-order mode content less than 0.4$\%$ for Gaussian beams with beam radius up to 2.5~mm over the full actuation range of the PZT. } \label{fig:HOMS} \end{center} \end{figure} The design specification requires the piezo-deformable mirror must induce less than 0.4$\%$ of higher-order mode power for Gaussian beams with a beam radius of less than 2~mm, see section~\ref{sec:des_req}. To estimate the higher-order mode content we define a nominal reflected beam using an ideal Gaussian input beam with a given beam size. The input beam is reflected off a simulated mirror with defocus and tilt as measured by the Zygo (see Fig~\ref{fig:5mm-Al-Range}) but with no additional higher order mode content. We calculate the full reflected beam using the measured surface profile and the same ideal Gaussian input beam. The mode-overlap between the nominal and the full reflected beams provides an estimate of the higher-order mode content of the full reflected beam. The left plot of Fig.~\ref{fig:HOMS} shows the higher-order mode content as a function of input beam radius over the range of the piezo-deformable mirrors. Alternatively, we can quantify the power-overlap between the input beam and the nominal reflected beam, correcting for pointing errors over the operating range. The right plot of Fig.~\ref{fig:HOMS} shows that the piezo-deformable mirror provides low higher-order mode content even when correcting for an overlap mismatch as low as 0.4, demonstrating that the design constraints are met. The compression fitting scheme discussed in section~\S\ref{subsec:comp_fit} is critical to achieving low higher-order mode content. It is crucial to ensure during the process of compression fitting that the mirror has no tilt with respect to the flexure. Any tilt between the mirror and the flexure causes a non-axisymmetric deformation of the mirror after compression fitting. When the mirror is actuated in this configuration, the moment distribution on the mirror circumference generated by the flexure is not axially symmetric, which causes the higher-order mode content to be much higher, typically up to 2-5$\%$. \section{Conclusion}\label{sec:concl} We present a novel ultra-high vacuum compatible, flexure-based active mode-matching deformable mirror. The piezo-deformable mirrors presented here has direct implications for improving the sensitivity of aLIGO detectors by reducing the optical losses from mode-mismatch, and by improving the levels (dB) of squeezing. They offer high bandwidth and a large operating range. While under vacuum, the PZT actuator has an operating range of 120$\pm$8~mD. In air, adjusting the static preload by using the pre-loader provides an additional 200~mD of adjustment range. The quality of the beam is not degraded and the higher-order mode content is below 0.2$\%$ over the full range of actuation. The technology developed here has applications in any optical experiments where mode-matching is critical or active wavefront control is necessary. \section{Acknowledgment}\label{sec:ack} LIGO was constructed by the California Institute of Technology and Massachusetts Institute of Technology with funding from the National Science Foundation, and operates under cooperative agreement PHY-1764464. A+ was built under award PHY-1234382. This paper carries LIGO Document Number LIGO P2100315. Parts of this research were conducted by the Australian Research Council Centre of Excellence for Gravitational Wave Discovery (OzGrav), through project number CE170100004. \bibliographystyle{apsrev4-1}
\section{Introduction} The theory of \emph{symmetry} -- i.e., what is now known as Lie theory -- was developed by Sophus Lie in his attempt to solve (nonlinear) differential equations, generalizing the approach by Evariste Galois for algebraic equations. The Lie approach, and more generally symmetry methods for differential equations, produced a number of results by Lie and his pupils, but afterwards the theory remained at the same level for quite a long time, until it was taken up by Birkhoff in the USA and by Ovsjannikov in USSR in the sixties \gcite{Bir,Ovs}. One of the reason for this ``long sleep'' lies in that the applications of the Lie theory do in general require quite extensive computations; these can nowadays be routinely performed on a computer by algebraic manipulation programs, but were quite prohibitive in earlier times. After the reviving by Birkhoff and Ovsjannikov, the theory developed quickly, and underwent various generalizations; the reader can consult some of the by now standard texts \gcite{AVL,CGbook,KrV,Olver1,Olver2,Stephani,Win} for the basics as well as for the most common extensions and generalizations. Here we are concerned with two of these extensions and generalizations. That is, on the one side with the generalization to \emph{conditional} \gcite{LeWi}, \emph{partial} \gcite{CGpart}, and \emph{asymptotic} \gcite{Gasy} symmetries; and on the other side with the extension of the theory to the framework of \emph{stochastic} differential equations \gcite{GRQ1,GRQ2,Unal,Koz1,Koz2,Koz3,Koz12,GS17,GS17E,GGPR,GGPRE,GL1,GL2,Koz18a,Koz18b,KozB,GLS,GW18} (by this we always mean equations of Ito or Stratonovich type \gcite{Arnold,Evans,Fre,Ikeda,Kampen,Oksendal,Stroock}, see below). Our goal is to put the two together, i.e., to consider \emph{conditional and asymptotic symmetries for stochastic differential equations}. Needless to say, our main interest is not in the abstract definition of these, but in showing that they can be of concrete use in determining (conditional or asymptotic) solutions to the concerned equations. In the first part of the paper we establish some background. In particular, we quickly recall some of the main points of the theory of symmetry for (deterministic) differential equations, mainly to fix notation (Section \ref{sec:symm}), then recall the (well-known) notion of conditional symmetry (Section \ref{sec:cond}) and of (less well-known) asymptotic symmetry (Section \ref{sec:asymp}) together with their use. We will also recall the basics of the theory of \emph{symmetry for stochastic differential equations} (Section \ref{sec:symmsto}), and the \emph{method of invariants} for these (Section \ref{sec:invar}). We then proceed to merge the two, i.e., we develop \emph{conditional and asymptotic symmetries and invariants for stochastic differential equations}; this will be the subject of Sections \ref{sec:cassto} and \ref{sec:caisto}. We also provide, in Section \ref{sec:examples}, a number of concrete examples, chosen to be computationally simple in order to keep the conceptual issues in focus. Our main result can be shortly stated saying that {\it the theory of conditional, partial and asymptotic symmetries can be extended to the framework of stochastic differential equations}. The reader will not find ``big theorems'' in our discussion, rather a number of lemmas; this corresponds to the fact we are not overcoming any special technical difficulty here. We are instead proposing a point of view that has not been considered previously in the literature, i.e., building a method which -- we believe -- is useful in characterizing solutions to stochastic equations via their asymptotic properties, in the same way as the corresponding deterministic approach proved to be precious in analyzing solutions to deterministic equations having certain asymptotic properties. As we will discuss in more detail in the following (see Sections \ref{sec:cond} and \ref{sec:asymp}), the key observation triggering the present approach is that while in several physical cases one has equations which are invariant -- say, for the sake of concreteness, under a rotation or scaling transformation -- and correspondingly for these there is a special set of solutions displaying such symmetry, it is of more general interest the case where either $(i)$ the solutions do have such symmetry only asymptotically in time and/or space (think e.g., to the case where the rotationally invariant solutions are stable, so that solutions which are \emph{not} rotationally invariant at $t=0$ but which are sufficiently near to those will, in the long run, acquire the rotational symmetry); or $(ii)$ the equations do \emph{not} have such a symmetry, but there are solutions which, at least asymptotically in time and/or space, display such a symmetry. The trivial, but not meaningless example, is that of the zero solution, which surely has a very high degree of symmetry, and which can be a valid -- and maybe also stable or even attractive -- solution for equations with no symmetry. A less extreme, more concrete and also physically relevant, example is provided, in the deterministic framework, by the Boussinesq equation of Fluid Dynamics: in this case a number of physically relevant -- and routinely observed in experiments -- solutions do have symmetry properties which are not shared by the equation; and they can be analytically determined though the \emph{conditional symmetries} approach. Similarly, stable solutions to several types of reaction-diffusion equations (including the prototypical Fisher-Kolmogorov equation) can be analytically determined through the method of \emph{asymptotic symmetries}. It must be stressed that in general, in this way one is able to obtain exact analytical expression for these symmetric class of solutions albeit there is no way to obtain a general solution to the equation under study in analytical terms. We will thus extend these approaches, developed in the framework of deterministic equations; and propose a general method to study special classes (characterized indeed by symmetry-like properties) of solutions to \emph{stochastic} differential equations. As already mentioned, we will illustrate the method by a number of concrete examples; these will however be chosen to be computationally simple in order to keep the conceptual issues in focus. Throughout the paper, we will use the Einstein summation convention. We will denote by $t$ the time variable and by $x^i$ the spatial ones, while the $w^k$ will be Wiener processes; we moreover use the shorthand notation $$ \partial_t \ := \ \frac{\partial}{\partial t} \ , \ \ \partial_i \ := \ \frac{\partial}{\partial x^i} \ , \ \ \^\partial_k \ := \ \frac{\partial}{\partial w^k} \ , $$ and denote the time derivative of a function $x (t)$ as either $x_t$ or ${\dot x}$, depending on typographical convenience. \section{Symmetry of differential equations} \label{sec:symm} In this section we recall some basic notions concerning symmetries of deterministic differential equations. In particular we consider first order ODEs, i.e., dynamical systems (DS), as this is the deterministic analogue of Ito or Stratonovich equations to be considered in the following. For a dynamical system \beql{eq:DS} \frac{d x^i}{d t} \ = \ f^i (x,t) \end{equation} with $t \in R$, $ x \in M_0 \subseteq R^n$, we define $M = M_0 \times R$ and consider maps $\Phi : M \to M$. In particular, we consider one-parameter groups of such maps, with generator \beql{eq:X} X \ = \ \theta (x,t) \, \partial_t \ + \ \varphi^i (x,t) \, \partial_i \ . \end{equation} Note that with $\pi_0 : M \to R$ the projection $\pi_0 (m_0,r) = r$, the full phase bundle $M = M_0 \times R$ has a natural structure of fiber bundle over the time real axis, $(M,\pi_0,R)$. Under the action of $X$ -- or more precisely of the maps $\Phi = \exp[ \varepsilon X]$ in the one-parameter group generated by $X$ -- we have, at first order in $\varepsilon$, \begin{equation} t \to \wt{t} \ = \ t \ + \ \varepsilon \, \theta (x,t) \ , \ \ x^i \to \wt{x}^i \ = \ x^i \ + \ \varepsilon \, \varphi^i(x,t) \ . \end{equation} Once we define the transformation of the independent ($t$) and the dependent ($x^i$) variables, we have also implicitly defined the transformation of the derivatives of the latter with respect to the former. We have indeed (always working at first order in $\varepsilon$) $$ x^i_t \ \to \ \wt{x}^i_t \ = \ x^i_t \ + \ \varepsilon \psi^i (x,t,{\dot x}) $$ where $\psi^i$ is given by the \emph{prolongation formula} \gcite{AVL,CGbook,KrV,Olver1,Olver2,Stephani,Win} \beql{eq:psi} \psi^i (x,t,{\dot x}) \ = \ D_t \varphi^i \ - \ x^i_t \ D_t \theta \ , \end{equation} and $D_t$ is the total time derivative (in this case, this is just $D_t = \partial_t + {\dot x}^j \partial_j$). With this, the vector field $X$ on $M$ is extended (prolonged) to a vector field $X^{(1)}$ in $J^1 M$ (in which we consider local coordinates $\{t;x^1,...,x^n;{\dot x}^1,...,{\dot x}^n\}$), \beql{eq:X1} X^{(1)} \ = \ \theta (x,t) \, \frac{\partial}{\partial t} \ + \ \varphi^i (x,t) \, \frac{\partial}{\partial x^i} \ + \ \psi^i (x,t;{\dot x}) \, \frac{\partial}{\partial {\dot x}^i} \ . \end{equation} Here and below $J^1 M$ is the (first) \emph{jet bundle} associated to $M$ \gcite{AVL,CGbook,KrV,Olver1,Olver2,Stephani,Win}. Note this can be seen both as a bundle over $M$ (the fiber corresponding to first derivatives ${\dot x}$) with projection $\wt{\pi}_1$ and as a bundle over $R$ (the fiber corresponding to variables $x$ and first derivatives ${\dot x}$) with projection $\pi_1$, $$ \matrix{ J^1 M & \mapright{\wt{\pi}_1} & M \cr & & \\ & \mapse{\pi_1} & \mapdown{\pi_0} \cr & & M_0 \cr} \ . $$ The projections satisfy $ \pi_1 = \pi_0 \circ \wt{\pi}_1$, i.e. the diagram above is a commutative one. The DS \eqref{eq:DS} defines a submanifold in $J^1 M$, also called the \emph{solution manifold} $\Sigma_f$ for the Eq \eqref{eq:DS}. A function $x = \xi (t)$ is identified with its graph $$ \gamma_\xi \ = \ \{ (x,t) \ : \ x = \xi (t) \} \ \subset \ M \ , $$ i.e., with a section $\gamma_\xi$ of the bundle $(M,\pi_0,R)$; this is naturally extended to a section $\gamma_\xi^{(1)}$ in $J^1 M$. In local coordinates, we have \begin{equation} \gamma^{(1)}_\xi \ = \ \{ t ; \xi^1 (t) , ... , \xi^n (t) ; \dot{\xi}^1 (t) , ... , \dot{\xi}^n (t) \} \ . \end{equation} The function $x = \xi (t)$ is a solution to \eqref{eq:DS} if and only if \begin{equation} \gamma_\xi^{(1)} \ \subset \ \Sigma_f \ . \end{equation} The vector field \eqref{eq:X} is a Lie-point symmetry (generator) for the Eq \eqref{eq:DS} if and only if \beql{eq:Xsymm} X^{(1)} \ : \ \Sigma_f \ \to \ {\rm T} \, \Sigma_f \ ; \end{equation} in this case it also maps (sections of $(M,\pi_0,R)$ representing) solutions to \eqref{eq:DS} into -- generally, but not necessarily, different -- (sections of $(M,\pi_0,R)$ representing) solutions to \eqref{eq:DS} \gcite{AVL,CGbook,KrV,Olver1,Olver2,Stephani,Win}. Note that we will adhere to the usual abuse of notation consisting in calling ``symmetries'' the vector fields which are actually generators for the symmetry group. It may be worth noting that the action of the vector field \eqref{eq:X} on sections is given by \beql{eq:Xsections} X \ : \ f(t) \ \to \wt{f} (t) \ = \ f (t) \ + \ \varepsilon \ \[ \varphi \ - \ \theta \, f' (t) \] \ . \end{equation} To avoid any misunderstanding, we specify that this notation means that the section $\Gamma_f$ given by $\Gamma_f = \{ (t,x=f(t))\}$ is mapped into the section $\Gamma_{\wt{f}}$ given by $\Gamma_{\wt{f}} = \{ (t,x=\wt{f} (t))\}$. Actually this is also an equivalent characterization of symmetries: that is, symmetries can be defined as maps $M \to M$ which transform solutions into (generally, but not necessarily, different) solutions \gcite{AVL,CGbook,KrV,Olver1,Olver2,Stephani,Win}.\footnote{For a very readable discussion of different -- but equivalent -- definitions of symmetries, see e.g., Chapter 3 in ref.\gcite{Stephani} or Section 2.2. in ref.\gcite{Olver1}.} If $x =\xi (t)$ is a solution to \eqref{eq:DS} and if $X$, satisfying \eqref{eq:Xsymm}, leaves $\gamma_\xi$ invariant, we say that $x =\xi (t)$ is an \emph{$X$-invariant solution} to \eqref{eq:DS}. Vector fields that are symmetries for a given equations, such as the evolution Eq \eqref{eq:DS}, or of more general form, -- or for equations, be these ODEs or PDEs, of more general form -- are characterized as solutions to a set of \emph{linear} PDEs for the coefficients of the vector field, known as \emph{determining equations} \gcite{AVL,CGbook,KrV,Olver1,Olver2,Stephani,Win}. For equations of the form \eqref{eq:DS} and vector fields expressed as in \eqref{eq:X} with $\theta = 0$ (these are the simple vector fields to be considered below), these are written as \beql{eq:deteqdet} \frac{\partial \varphi^i}{\partial t} \ + \ f^j \, \frac{\partial \varphi^i}{\partial x^j} \ - \ \varphi^j \, \frac{\partial f^i}{\partial x^j } \ = \ 0 \ . \end{equation} \medskip\noindent {\bf Remark \ref{sec:symm}.1.} It should be mentioned that this sketchy discussion refers to proper Lie-point symmetries. In the case of deterministic Dynamical Systems, it turns out that so-called \emph{orbital symmetries} are also quite useful \gcite{WalOS1,WalOS2,WalOS3}; as far as we know, these have not been investigated in the context of \emph{stochastic} dynamical systems. { } \hfill $\odot$ \medskip \medskip\noindent {\bf Remark \ref{sec:symm}.2.} The prolongation formula for ODEs, Eq \eqref{eq:psi}, is a special occurrence of the general prolongation formula, which -- in the multi-index notation used in most of the literature, and in particular denoting by $x^i$ the independent variables, and by $u^a$ the dependent ones -- reads $$ \psi^a_{J,i} \ = \ D_i \varphi^a_J \ - \ u^a_{J,k} \ D_i \xi^k \ . $$ We refer to \gcite{AVL,CGbook,KrV,Olver1,Olver2,Stephani,Win} for discussion and details. { } \hfill $\odot$ \medskip \subsection{Dynamically invariant submanifolds} The evolution Eq \eqref{eq:DS} defines a dynamics, and a dynamical vector field $Z$, in all of $M$; when $f$ is time-autonomous, we actually also have a vector field $Y$ in $M_0$ and in this case $Z = \partial_t + Y$; symmetries $X$ are then characterized by $[X,Z] = 0$ (so called \emph{orbital symmetries} are characterized by $[X,Z] = \lambda Z$, for their properties and applications see e.g., \gcite{WalOS1,WalOS2,WalOS3}). We are specially interested in this latter case of $f$ time-autonomous, both because the analysis is slightly simpler and due to its relevance in applications. It may happen that there exist submanifolds of $M$ being invariant under $Z$. In particular, for $f$ time autonomous, there may be proper submanifolds $U \subset M_0$ which are invariant under $Y$. The simplest example is that of fixed points for $f$, i.e., points $x_0$ such that $f(x_0,t) = 0$. Other simple but significant examples are provided by periodic or multi-periodic solutions, by heteroclinic or homoclinic orbits, or by the stable and unstable manifolds of hyperbolic fixed points \gcite{GH,Gle,IA,Ver}. One would expect that symmetries are constrained by the need to somehow respect the structure of such invariant sets; this is indeed the case, provided one considers time-independent symmetries \gcite{CGbook,GLPTI}. In particular, it can be shown that Lie-point time independent (LPTI) symmetries maps solutions into solutions whose trajectories in $M_0$ have the same topology. More specifically, we have the following results (these embody several Lemmas given in \gcite{CGbook,GLPTI}; see there for proofs; the Corollary makes use of standard results in Topology, see e.g., \gcite{Milnor}). We will denote by $K(X) \subseteq M$ the subset of $M$ which is point-wise invariant under a vector field $X$ (or $K(\mathcal{A}) \subseteq M$ for the set invariant under an algebra $\mathcal{A}$ of vector fields), by $Z$ the vector field defining the dynamics of the (autonomous) dynamical system under study, and by $\mathcal{G}$ the Lie algebra of symmetries for $Z$. \medskip\noindent {\bf Lemma \ref{sec:symm}.1.} {\it The LPTI symmetry algebra of an autonomous ODE transforms stationary solutions into stationary solutions, periodic solutions into periodic solutions of the same period.} \medskip\noindent {\bf Lemma \ref{sec:symm}.2.} {\it Assume there is a compact set $K (Z) \subset M$ invariant under the flow of $Z$. Then for any subalgebra ${\mathcal G}_0 \subseteq {\mathcal G}$, the submanifold $K^0 ({\mathcal G}_0 ) := \( K({\mathcal G}_0) \cap K (Z) \) \subseteq M$ is either empty or compact and invariant under the flow of $Z$.} \medskip\noindent {\bf Corollary.} {\it If $K^0 ({\mathcal G}_0 )$ has components isomorphic to an even-dimensional sphere $S^{2n}$, then on each of these lie stationary solutions to the dynamical system ${\dot x} = Z (x)$. If $K^0 ({\mathcal G}_0 )$ has components isomorphic to a disk $D^{2n+1}$, then on each of these lie stationary solutions to ${\dot x} = Z (x)$.} \subsection{Asymptotic solutions} In several cases one meets dynamical systems or PDEs which cannot be solved exactly, but whose asymptotic behavior (e.g., for $t \to \infty$ and/or for $|x| \to \infty $ or for $|x|\to 0$) is amenable to exact treatment. We just mention here two very simple examples of use in the following (these can be readily generalized). \medskip\noindent {\bf Example \ref{sec:symm}.1.} For $x \in R$, consider $$ {\dot x} \ = \ f(x) \ = \ - \nabla \Phi (x) $$ with $\Phi (x) = \Phi (-x)$ a convex even function, non-degenerate in $x=0$. Then for any initial datum $x(0) =x_0$ the dynamics is attracted to $x_* = 0$, and in the region near $x_*$ (and thus asymptotically in time) the dynamics is well described by the linear equation $$ {\dot x} \ = \ - \, A \, x \ := \ [(D f)(0)] \, x \ , \ \ \ A = - (Df)(0) > 0 \ ; $$ the solutions to this are of course $$ x(t) \ = \ x(t_0) \ \exp[ - A t] \ . \eqno{\diamondsuit} $$ \medskip\noindent {\bf Example \ref{sec:symm}.2.} In $R^2$ and with polar coordinates $(\rho,\vartheta)$, consider the system \begin{eqnarray*} \dot{\rho} &=& \rho \ \( 1 \ - \ \rho \) \ , \\ \dot{\vartheta} &=& 1 \ + \ \( 1 \ - \ \rho \) \ h (\rho,\vartheta ) \ , \end{eqnarray*} with $h (\rho,\vartheta )$ an arbitrary smooth function. The system can not be solved in general, but we know that the dynamics is attracted to the circle $\rho=1$, and on this attracting manifold we have a trivial dynamics $\dot{\vartheta} = 1$. Thus any solution is asymptotically described by $\rho=1$, $\vartheta (t) = k_0 + t$ for some phase $k_0$. { } \hfill $\diamondsuit$ \medskip \section{Conditional and partial symmetries} \label{sec:cond} As mentioned above, symmetries map (any) solution into a (generally different) solution. It may happen, however, that there are maps such that this property (i.e., mapping solutions into solutions) holds only for a \emph{subset} of solutions. \subsection{Conditional symmetries} The most common case is that of equations admitting solutions which are invariant under maps that are \emph{not} a symmetry of the equation. For instance, any equation of the form \eqref{eq:DS} with $f$ linear in $x$, $f(x,t) = A(t) x$, will admit the origin as a fixed point, and this in turn will be invariant under any linear (possibly time-dependent) map $x \to B(t) x$. But this will be a symmetry of the equation if and only if $$ \frac{d B (t)}{d t} \ = \ \left[ A (t) \, , \, B(t) \right] \ , $$ which is definitely a non-generic property. In this case, and in similar but less trivial ones, one speaks also of \emph{conditional} symmetries \gcite{LeWi}; see also \gcite{BluCol,BluColB,ClaKru,ClaMan,Gclw,PuS1,PuSn,Zhda}. Let us discuss these in some more detail (the reader can see the references given above for a more complete discussion), referring to the case of PDEs for greater generality; we denote by $x^1,..,x^q$ the independent variables, and by $u^1,...,u^p$ the dependent ones. Our goal is to determine $X$-invariant solutions for a differential equation (note that by this we will always mean possibly a vector one, i.e., a system of scalar differential equations) $\Delta = 0$, where $$ X \ = \ \xi^i (x,u) \ \frac{\partial}{\partial x^i} \ + \ \varphi^a (x,u) \ \frac{\partial}{\partial u^a} \ = \ \xi^i \,\partial_i \ + \ \varphi^a \, \partial_a $$ is not necessarily a symmetry of $\Delta$; at the same time, we want to determine the $X$ which admit such solutions. In order to do this, we complement $\Delta$ with an equation $\Delta_X= 0$ expressing the requirement of $X$-invariance of the function $u = u(x)$. This is just, see \eqref{eq:Xsections} above, \beql{eq:Xinv} \varphi^a (x,u) \ - \ \xi^i (x,u) \, u^a_i \ = \ 0 \ . \end{equation} We are thus led to consider the system \beql{eq:Ecs} \mathcal{E}_X \ = \ \cases{ \Delta \ = \ 0 & \cr \Delta_X \ = \ 0 & \cr} \end{equation} It is clear that the solutions of this, \emph{if they exist}, are all and only the solutions to $\Delta=0$ which are also $X$-invariant (i.e., which also solve $\Delta_X= 0$). Thus symmetries for the system $\mathcal{E}_X$, which transform solutions into solutions, will transform $X$-invariant solutions to $\Delta$ into $X$-invariant solutions to $\Delta$. In particular this apply for the vector field $X$ itself, which by construction will leave each of such solutions invariant. We are thus at first sight reduced to a standard problem in symmetry analysis; however we should look at this with some more care. One possibility is that we fix in advance $X$ and look for solutions to $\Delta$ which are $X$-invariant. In this case $\Delta_X$ reduces to an \emph{ansatz} on the functional form of $u(x)$ which can then be inserted into $\Delta$, and indeed nothing new is here. On the other hand, the interesting case is the one where we do not know in advance what $X$ should or could be, and we study the system \eqref{eq:Ecs} in order to determine $X$ and the associated invariant solutions, if any. In this case we get something new: in fact, the usual determining Eq \eqref{eq:deteqdet} -- or more generally their version for PDEs -- are \emph{linear} in the $X$ coefficients $\{ \xi^i (x,u) , \varphi^a (x,u) \}$, while now we will have determining equations which are \emph{nonlinear} (in particular, quadratic) in these. We will not enter into the details of how such a system of nonlinear (determining) equations can be solved thanks to the peculiar structure of the problem, referring the reader to the original paper by Levi and Winternitz for this matter \gcite{LeWi}. We instead stress a most relevant point: symmetries have to map solutions into solutions, but when we apply symmetry analysis to the system \eqref{eq:Ecs}, this applies to the \emph{common} solutions to $\Delta=0$ and to $\Delta_X = 0$, i.e., \emph{only} to invariant solutions. Thus these are symmetries of $\Delta$ \emph{conditional} upon the additional invariance condition $\Delta_X$. \medskip\noindent {\bf Remark \ref{sec:cond}.1.} We should mention that one could also investigate the inverse problem for conditional symmetries: that is, for a given number of dependent and independent variables and a given order of the equation, and given a certain vector field $X$, determine all the differential equations $\Delta$ which admit $X$ as a conditional symmetry. This was considered by Levi, Rodriguez and Thomova in \gcite{LRT}, and more recently by Pucci and Saccomandi \gcite{PS1,PS2}. We are not able to provide stochastic extensions of this analysis at the moment. { } \hfill $\odot$ \medskip \subsection{Partial symmetries} A slightly more general case is also possible, i.e., that we have a subset of solutions which are \emph{not} individually invariant under the map, but which are indeed transformed one into another by the map -- which again is not a symmetry of the original equation $\Delta = 0$. In this case one speaks of \emph{partial symmetries} \gcite{CGpart} (see also \gcite{GaKa}). A specially relevant case in our dynamical systems context is where the solutions in this set are characterized by living on a manifold which is dynamically invariant (i.e., invariant under the dynamics). The situation is characterized in a way which looks quite similar to the characterization provided above for conditional symmetries. That is, we consider a differential equation (again, in general this can be a system of PDEs) $\Delta = \Delta_0$, and a vector field $X$ which is \emph{not} a symmetry for $\Delta_0$, thus such that -- writing $S_0 :=S_{\Delta_0}$ for ease of writing, $$ \[ X^{(n)} \, \Delta_0 \]_{S_0} \not= \ 0 \ . $$ We consider then an auxiliary equation $$ \Delta_1 \ := \ \[ X^{(n)} \, \( \Delta_0 \) \] \ . $$ If we look at solutions to the system $$ \mathcal{E} \ = \ \cases{ \Delta_0 \ = \ 0 & \cr \Delta_1 \ = \ 0 & \cr} $$ which are globally invariant under $X$ (that is, the set of solutions is mapped into itself, albeit the single solutions are possibly not invariant), this set is characterized precisely by the property \beql{eq:part1} \[ X^{(*)} \( \Delta_1 \) \]_{S^{(1)}} \ = \ 0 \ ; \end{equation} here $S^{(1)} = S_0 \cap S_1$, with of course $S_1 =S_{\Delta_1}$, is the set of solutions to the system $\mathcal{E}$; and we wrote $X^{(*)}$ to mean the prolongation of $X$ of appropriate order, i.e., the same order as the equation $\Delta_1$. In this case, i.e., if \eqref{eq:part1} is satisfied, we say that $X^{(*)}$ is a partial symmetry of order one for $\Delta$, as it maps a subset of solutions into solutions (belonging to the same subset). We stress that \eqref{eq:part1} may or may not be satisfied, depending on $\Delta$ and on our choice of the vector field $X$. If it is not satisfied, we can iterate our procedure and consider $$ \Delta_2 \ := \ X^{(*)} \( \Delta_1 \) $$ and look for $S^{(2)} = S_0 \cap S_1 \cap S_2$, enquiring if -- with an obvious notation -- the equation \beql{eq:part2} \[ X^{(*)} \( \Delta_2 \) \]_{S^{(2)}} \ = \ 0 \end{equation} is satisfied. If this is the case, we say that $X$ is a partial symmetry of order two for $\Delta$; otherwise we can still iterate our procedure and so on. We set this in the form of a Proposition, which is quoted from \gcite{CGpart}. \medskip\noindent {\bf Proposition \ref{sec:cond}.1.} {\it Given the general differential problem $\Delta = \Delta_0 = 0$ and a vector field $X$ on $M$, define $\Delta_{r+1} := X^{(*)} (\Delta_r)$. Denote by $S^{(r)}$ the set of simultaneous solutions of the system $$ \Delta_0 \ = \ \Delta_1 \ = \ ... \ = \ \Delta_r \ = \ 0 \ , $$ and assume that this is not empty for $r \le s$. Assume moreover that $$ \[ X^{(*)} \( \Delta_r \) \]_{S^{(r)}} \ \not= \ 0 \ \ \mathrm{for} \ r = 0, 1, ... , n-1 \ , \ \ \ \[ X^{(*)} \( \Delta_n \) \]_{S^{(n)}} \ = \ 0 \ . $$ Then the set $S^{(n)}$ provides a family of solutions to the initial problem $\Delta$ which is mapped into itself by the transformations generated by $X$.} \medskip\noindent {\bf Remark \ref{sec:cond}.2.} When the situation depicted in Proposition \ref{sec:cond}.1 is met, we shall say that $X$ is a \emph{partial symmetry}, or P-symmetry for short, for the problem $\Delta$, and that the globally invariant subset of solutions $S^{(n)}$ obtained in this way is a \emph{$X$-symmetric set}. We also refer to the number $n$ appearing in the statement as the \emph{order} of the P-symmetry. { } \hfill $\odot$ \medskip The discussion can be specialized to the case of dynamical system; here we just recall a result for this case, quoting again from \gcite{CGpart}, to which the reader is referred for further detail. Here $\mathcal{L}_{(\lambda)} (f)$ denotes the linearization of $f$ at $x_{(\lambda)}$ (see below), i.e., $$ \mathcal{L}_{(\lambda)} (f) \ = \ \[ \nabla ( f ) \]_{x_{(\lambda)}} \ . $$ \medskip\noindent {\bf Proposition \ref{sec:cond}.2.} {\it Assume that the dynamical system ${\dot x} = f(x)$ admits a LPTI partial symmetry $X= \varphi^i(x) \partial_i$, and let $x_{(\lambda)} = x_{(\lambda)} (t) $ be an orbit of solutions obtained under the action of the group generated by $X$, with $\lambda$ the group parameter. Then $\Phi := \varphi (x_{(\lambda)} )$ satisfies the equations $$ \frac{d \Phi}{d t} \ = \ \mathcal{L}_{(\lambda)} (f) \cdot \Phi \ ; \ \ \ \Phi \ = \ \frac{d x_{(\lambda)}}{d \lambda} \ . $$} \subsection{Examples} \label{sec:condpartexa} We give here two Examples (examples \ref{sec:cond}.1 and \ref{sec:cond}.2) of conditional symmetries, and three Examples (examples \ref{sec:cond}.3 through \ref{sec:cond}.5) dealing with partial symmetries. These are taken respectively from \gcite{LeWi} and from \gcite{CGpart}. Some Examples deal with PDEs, as the essential of conditional and partial symmetries is better grasped in this context. \medskip\noindent {\bf Example \ref{sec:cond}.1.} The Boussinesq equation \gcite{Whitham} in one spatial dimension, for a function $u =u(x,t)$, reads \beql{eq:Bou} u_{tt} \ + \ u \, u_{xx} \ + \ u_x^2 \ + \ u_{xxxx} \ = \ 0 \ . \end{equation} If we consider the vector field $$ X_1 \ = \ \partial_t \ + \ t \, \partial_x \ - \ 2 \, t \, \partial_u \ , $$ this is not a symmetry for the equation, but it turns out to be a conditional symmetry for it. Under the action of $X_1$ we have a one-parameter flow (group parameter $\lambda$) which acts as $$ \cases{ t \ \to \ \wt{t} \ = \ t + \lambda & \cr x \ \to \ \wt{x} \ = \ x + \lambda t + (1/2) \lambda^2 & \cr u \ \to \ \wt{u} \ = \ u - 2 t \lambda - \lambda^2 & \cr} $$ Assuming that $u=u(x,t)$ is a solution to \eqref{eq:Bou}, we have that $\wt{u} = \wt{u} (\wt{x}, \wt{t})$ is a solution if it satisfies the auxiliary condition (we omit the tildes from now on) \beql{eq:BouLW1} \Delta_1 \ := \ \( u_t \ + \ t \, u_x \)_x \ = \ 0 \ . \end{equation} Now we note that the invariance condition $\Delta_X = 0$, see \eqref{eq:Xinv}, reads in this case (i.e., for the $X$ we are now considering) $$ u_t \ + \ t \, u_x \ + \ 2 \, t \ = \ 0 \ . $$ Thus \eqref{eq:BouLW1} is just a differential consequence of this, $(\Delta_1)_x = 0$. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Example \ref{sec:cond}.2.} Consider again the Boussinesq Eq \eqref{eq:Bou}, and now $$ X_2 \ = \ \partial_t \ - \ (x/t) \, \partial_x \ + \ \[ (2/t) \, u \ + \ (6/t^3) \, x^2 \] \, \partial_u \ ; $$ again this is \emph{not} a symmetry for Eq \eqref{eq:Bou}. Now we get $$ \wt{u} \( \wt{x} , \wt{t} \) \ = \ \[ \frac{t +\lambda}{t} \]^2 \ u(x,t) \ + \ \[ \frac{(t+\lambda)^2}{t^4} \ - \ \frac{t^2}{(t+\lambda)^4} \] \ x^2 \ . $$ On the other hand, the invariance condition \eqref{eq:Xinv} is now \beql{eq:BouLW2} \Delta_2 \ := \ \[ \frac{2}{t} \, u \ + \ \frac{6}{t^3} \, x^2 \] \ - \ u_t \ + \ \frac{x}{t} \, u_x \ = \ 0 \ . \end{equation} If $u(x,t)$ is a solution to \eqref{eq:Bou}, then the condition for $\wt{u} ( \wt{x} , \wt{t} )$ to be also a solution reads $$A_1 (x,t;\lambda) \ F \ + \ A_2 (x,t;\lambda) \ F_t \ + \ A_3 (x,t;\lambda) \ F_x \ = \ 0 \ , $$ where $A_i$ are certain smooth polynomial functions, and $$ F \ := \ u_t \ - \ (x/t) \, u_x \ - \ \[ (2/t) \, u \ + \ 6 \, (x^2/t^3) \] \ . $$ Thus if $u(x,t)$ is a solution to the Boussinesq equation and $F=0$, the transformed function $\wt{u} ( \wt{x} , \wt{t} )$ is also a solution. But looking at \eqref{eq:BouLW2} we see that $F=0$ is just the invariance condition under $X_2$. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Example \ref{sec:cond}.3.} Consider the modified Laplace equation \beql{eq:MLE} \Delta \ := \ \ u_{xx} \ + \ u_{yy} \ + \ g(u) \, u_{xxx} \ = \ 0 \ , \end{equation} with $g(u)$ an arbitrary smooth function. We also consider the rotation vector field \beql{eq:MLEX} X \ = \ y \, \partial_x \ - \ x \, \partial_y \ ; \end{equation} this is a symmetry for $\Delta$ in the case $g(u)=0$, but not in general. We will assume $g(u) \not= 0$. Implementing our procedure, we get \begin{eqnarray*} \Delta_1 & := & \ u_{xxy} \ , \\ \Delta_2 & := & \ 2 \, u_{xxy} \ - \ u_{xxx} \ , \\ \Delta_3 & := & \ 2 \, u_{yyy} \ - \ 7 \, u_{xxy} \ , \\ \Delta_4 & := & \ 3 \, u_{xyy} \ , \\ \Delta_5 & := & \ u_{yyy} \ - \ 2 \, u_{xxy} \ . \end{eqnarray*} The last equation is identically satisfied on common solutions to the previous ones, thus we have a partial symmetry of order five. The set $S^{(5)}$ has the following form, with $k_{1},\dots,k_{6}$ arbitrary constants: $$ S^{(5)} \ = \ \{ u(x,y) \ = \ k_1 \, x^2 \ + \ k_2 \, y^2 \ + \ k_3 \, x y \ + \ k_4 \,x \ + \ k_5 \, y \ + \ k_6 \} \ ; $$ that is, functions which are at most quadratic in the $(x,y)$ variables. Note that for these functions the Eq \eqref{eq:MLE} reduces to the standard Laplace equation, and for this it is obvious that \eqref{eq:MLEX} is a symmetry; thus this seemingly complicated computation yields a rather obvious result. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Example \ref{sec:cond}.4.} We look again at the Boussinesq Eq \eqref{eq:Bou}, which will be our $\Delta_0$, and consider the vector field \begin{equation} X \ = \ \partial_t \ + \ t \,\partial_x \ - \ 2 \, t \, \partial_u \ . \end{equation} Now we have (disregarding some inessential nonzero multiplicative constants) \begin{eqnarray*} \Delta_1 &=& X^{(*)} \, \Delta_0 \ = \ u_{xt} \ + \ t \, u_{xx} \ ,\\ \Delta_2 &=& X^{(*)} \, \Delta_1 \ = \ 0 \ . \end{eqnarray*} We have thus to look for simultaneous solutions to $\Delta_0=0$ and to $\Delta_1=0$. Solving for $\Delta_1=0$ yields \beql{eq:partB1} u(x,t) \ = \ v (x -t^2/2) \ + \ w(t) \ - \ t^2 , \end{equation} with $v$ and $w$ arbitrary functions. Note that the functions \eqref{eq:partB1} are $X$-invariant if and only if $w'(t)=0$ (this is why the term $- t^2$ has not been absorbed into the arbitrary function $w(t)$ in writing \eqref{eq:partB1}); thus we are considering a setting which is really a generalization of the conditional symmetries approach, even in this case. Inserting now \eqref{eq:partB1} into $\Delta_0$, i.e. into the Boussinesq equation \eqref{eq:Bou}, and writing $z = x -t^2/2$, we get that $v$ and $w$ must satisfy \begin{equation} \frac{d}{dz} \( v''' \ + \ v \, v' \ - \ v \ - \ 2 \, z \) \ + \ w \, v'' \ + \ \frac{d^2 w}{d t^2} \ = \ 0 \ . \end{equation} We are specially interested, as mentioned above, in the case $w (t)\not= 0$ (otherwise we recover the Levi-Winternitz family of $X$-invariant solutions). E.g., for $w(t) = K$ a nonzero constant, we get solutions $u(x,t)= K+v(z)-t^2$ with $v$ a solution to $$ v''' \ + \ v \, v' \ - \ v \ + \ K \, v' \ = \ c \ + \ 2 \, z \ . \eqno{\diamondsuit} $$ \medskip\noindent {\bf Example \ref{sec:cond}.5.} We now consider an example involving a Dynamical System in $R^3$ with Cartesian coordinates $(x,y,z)$; we will also write $\rho^2 = x^2 + y^2$. Consider $$ \cases{ \dot{x} \ = \ x \, (1 -\rho^2) \ - \ y \ + \ z \, g_1 (x,y,z) & \cr \dot{y} \ = \ y \, (1 -\rho^2) \ + \ x \ + \ z \, g_2 (x,y,z) & \cr \dot{z} \ = \ z \, g_3 (x,y,z) & \cr} $$ with $g_i$ smooth functions. If we also consider the rotation vector field $$ X \ = \ y \, \partial_x \ - \ x \, \partial_y \ , $$ then the partial symmetry condition reads $$ z \ G_\alpha (x,y,z) \ = \ 0 \ \ \ (\alpha = 1,2,3) $$ with $G_\alpha$ certain functions which are non-zero for generic $g_i$: e.g., $$ G_1 \ = \ g_2 \ - \ y \, (\partial g_1 / \partial x) \ + \ x \, (\partial g_1 / \partial x) \ . $$ Thus the system exhibits -- as rather obvious from its expression -- rotational $(x,y)$ symmetry only if restricted to the plane $z=0$. Moreover, in this plane one can find three different families of solutions (beside the null one, which is rotationally invariant) which are mapped into themselves by the rotations, without being rotationally invariant themselves: the trajectories lying in $\rho < 1$, and respectively in $\rho > 1$, spiralling towards the limit cycle $\rho = 1$; and the solutions running on the single trajectory $\rho =1$ which is left fixed by the partial symmetry (i.e., the limit cycle). { } \hfill $\diamondsuit$ \medskip \section{Asymptotic symmetries} \label{sec:asymp} In many cases, one has equations whose solutions have a complicated behavior, which becomes simple in some asymptotic regime. This may be asymptotic in time (thus for $t \to \pm \infty$, possibly with different behavior in the two limits or with a simple behavior only in one of the limits) or asymptotically in space (i.e., for $|x| \to \infty$, or in the one dimensional case for $x \to \pm \infty$, with the same notes as for $t$); or in a suitable combination of the two. It is remarkable that in such cases one can adopt a renormalization-group (RG) like approach \gcite{GO,BK}; this in turn can be combined with symmetry considerations \gcite{Gasy,GMan1,GMan2}. In particular, we can have \emph{asymptotic symmetries}, i.e., maps which are symmetries (hence in particular map solutions into solutions) only in this asymptotic regime, being otherwise (that is, in the non-asymptotic regime) only approximate symmetries, at most. \subsection{Asymptotic symmetries in the PDE setting} In order to discuss asymptotic symmetry properties (at least in the deterministic case) we consider the general case, i.e., possibly PDEs (of any order $n$); the independent variables live on a manifold $B$, the dependent ones take values in a manifold $U$, and we consider $M = U \times B$. We will follow the discussion given in \gcite{CGbook}, referring to \gcite{Gasy,GMan1,GMan2} for further detail. It is then convenient to use the geometrical representation of functions as cross sections of the bundle $(M,\pi_0,B)$, and of equations as submanifolds in $J^n M$; in the case of evolution equations, these can also be seen as sections of a suitable fiber bundle (with time derivatives in the fiber, i.e., in the vertical space), and on the other hand some care is needed in order to take into account the special role of the time variable in this case. Here and in the following we write $\partial_a^J = (\partial/ \partial u^a_J)$; moreover $\psi^a_0 = \varphi^a$, and $u^{[n]}$ will denote $(u, u^{(1)}, ... , u^{(n)} )$. Recall also that $|J|$ is the order of the multi-index $J$. A vector field \begin{equation} Y \ = \ \xi^i (x,u) \,\partial_i \ + \ \varphi^a (x,u) \, \partial_a \end{equation} in $M$, and its prolongation \begin{equation} Y^{(n)} \ = \ \xi^i (x,u) \,\partial_i \ + \ \psi^a_J (x,u^{[|J|]}) \, \partial_a^J \end{equation} to $J^n M$, will then induce an action on the space of sections in $(M,\pi_0,B)$, hence on functions; and on submanifolds in $J^n M$, hence on equations. In particular, a (vector) function $u^a = f^a (x)$ is then mapped by the infinitesimal action of the vector field (with parameter $\varepsilon$) into \begin{eqnarray} \wt{u}^a (x) &=& \( e^{\varepsilon Y} f \)^a (x) \nonumber \\ &=& u^a (x) \ + \ \varepsilon \ \[ \varphi^a (x,f(x)) \ - \ \xi^i (x,f(x)) \, \partial_i f^a (x) \] \ + \ O (\varepsilon^2 ) \ ; \end{eqnarray} this infinitesimal action defines a flow (with parameter $\lambda$, not necessarily small) $\gamma (\lambda) = \Phi(\lambda,\gamma_0)$ in the set $\Gamma (M)$ of sections in $(M,\pi_0,B)$, where $\lambda$ is the flow parameter and $\gamma_0$ is the initial point for the flow. From this one also computes the transformation rules for derivatives $u^a_J$, i.e., on sections of $(J^n M,\pi_n, B)$, and hence for equations; this also defines a flow $\gamma^{(n)} (\lambda) = \Phi^{(n)} (\lambda,\gamma^{(n)}_0)$ in the set $\Gamma^{(n)} (M)$ of sections in $(J^n M,\pi_n,B)$, where $\lambda$ is the flow parameter and $\gamma^{(n)}_0$ is the initial point for the flow. We will also write these flow as \begin{equation} f_\lambda = \Phi (\lambda,f_0) \ \ , \ \ \ \ \Delta_\lambda = \Phi^{(n)} (\lambda, \Delta_0) \ , \end{equation} for ease of writing. We say that a function $u = f(x)$ is symmetric under $Y$ if and only if the corresponding section $\gamma_f \in \Gamma (M)$ is invariant under (the flow $\Phi$ in $\Gamma$ induced by) $Y$; and similarly that the equation $\Delta$ in $J^n M$ is symmetric under $Y$ if and only if the corresponding submanifold $S_\Delta$ is invariant under (the flow $\Phi^{(n)}$ in $J^n M$ induced by) the prolongation $Y^{(n)}$. We are specially interested in the case where the flow drives functions (or equations) which are \emph{not} invariant to a \emph{fixed point}, i.e., to a limit function (or an equation) which \emph{is} invariant. In particular, consider the case where the limit \begin{equation} \lim_{\lambda \to \infty} \Phi (\lambda , \gamma_f ) \ = \ \gamma_f^\infty \end{equation} exists. Then we say that $Y$ is an $\omega$-asymptotic symmetry for (the section $\gamma_f$ and hence) the function $f:B \to U$. (In the case where the limit $ \lim_{\lambda \to - \infty} \Phi (\lambda , \gamma_f ) \ = \ \gamma_f^{-\infty} $ exists, we say that $Y$ is an $\alpha$-asymptotic symmetry for $f$. This notation recalls the notions of $\omega$-limit and of $\alpha$-limit in use in Dynamical Systems theory \gcite{GH,Gle,IA,Ver}.) Similarly, in the case where the limit \begin{equation} \lim_{\lambda \to \infty} \Phi^{(n)} (\lambda , S_\Delta ) \ = \ S_\Delta^\infty \end{equation} exists, we say that $Y$ is an $\omega$-asymptotic symmetry for (the submanifold $S_\Delta$ and hence) the equation $\Delta = 0$; and similarly considering the limit for $\lambda \to -\infty$. We have the following results, which we quote from \gcite{CGbook} (Lemma IX.1 therein): \medskip\noindent {\bf Lemma \ref{sec:asymp}.1.} {\it Let $u = f_0 (x)$ be a solution to the differential equation $\Delta_0$; and let the limits $f_{\pm \infty}$, $\Delta_{\pm \infty}$ for the flows $$ f_\lambda \ = \ \Phi (\lambda , f_0 ) \ , \ \ \Delta_\lambda \ = \ \Phi^{(n)} (\lambda, \Delta_0 ) $$ exist. Then $f_{\pm \infty}$ is a solution to $\Delta_{\pm \infty}$.} \medskip\noindent {\bf Corollary.} {\it If $\Delta_0 \to \Delta_*$ for $\lambda \to \pm \infty$, then under the flow $\Phi(\lambda,f)$ all solutions $f_0$ to $\Delta_0$ go into solutions (not necessarily invariant) to $\Delta_*$ for $\lambda \to \pm \infty$.} \medskip\noindent {\bf Remark \ref{sec:asymp}.2.} We stress that here ``asymptotic'' refers to the flow parameter $\lambda$, i.e., to the flow $\Phi$ and $\Phi^{(n)}$ associated to $Y$. This may or may not correspond to asymptotic properties in time and/or space depending on the form of the vector field $Y$ we are considering. { } \hfill $\odot$ \medskip \subsection{Examples} \medskip\noindent {\bf Example \ref{sec:asymp}.1.} Consider the DS in ${\bf R}^2$ \begin{equation} \cases{ {\dot x} \ = \ x \ - \ A \, y \ - \ (x^2 + y^2 ) \, x & , \cr {\dot y} \ = \ y \ + \ A \, x \ - \ (x^2 + y^2 ) \, y & ; \cr} \end{equation} this is symmetric under both time translations and spatial rotations. Thus if we consider the two-parameters family of vector fields \begin{equation} X \ = \ \alpha \,\partial_t \ + \ \beta \ \( x \, \partial_y \, - \, y \, \partial_x \) \ , \end{equation} all of these are symmetries for our DS. Note that for $\alpha > 0$ the action of $X$ gives translations \emph{forward} in time, while for $\alpha < 0$ we have translations \emph{backward} in time; similarly, the sign of $\beta$ controls the direction of rotation in the $(x,y)$ plane. We assume $\alpha > 0$ for definiteness and ease of discussion. The action of $X$ on the space $\Gamma = \{ x_\lambda (t) , y_\lambda (t) \}$ of sections of $( R^2 \times R , \pi_0 , R )$ -- which we denote by $\wt{X}$ -- is described by \begin{eqnarray*} \frac{d x_\lambda }{d \lambda} &=& - \, \alpha \ \[ 1 \ - \ (x^2 +y^2) \] \, x_\lambda \ - \ \( \beta \ - \ \alpha \, A \) \, y_\lambda \ , \\ \frac{d y_\lambda }{d \lambda} &=& - \, \alpha \ \[ 1 \ - \ (x^2 +y^2) \] \, y_\lambda \ + \ \( \beta \ - \ \alpha \, A \) \, x_\lambda \ . \end{eqnarray*} Thus there is no fixed point for the action of $\wt{X}$ unless we choose $\beta = \alpha A$, i.e., $$ X \ = \ X_0 \ := \ \alpha \[ \partial_t \ + \ A \ \( x \, \partial_y \, - \, y \, \partial_x \) \] \ . $$ With this choice instead, we get \begin{eqnarray*} \frac{d x_\lambda }{d \lambda} &=& - \, \alpha \ \[ 1 \ - \ (x^2 +y^2) \] \, x_\lambda \ , \\ \frac{d y_\lambda }{d \lambda} &=& - \, \alpha \ \[ 1 \ - \ (x^2 +y^2) \] \, y_\lambda \ ; \end{eqnarray*} thus \emph{all} solutions admit the vector field $X_0$ as an $\alpha$-asymptotic symmetry, and the vector field $X_0^* = -X_0$ as an $\omega$-asymptotic one (their role is reversed for $\alpha < 0$ in the definition of $X_0$). Note that the solutions with $x_0^2 +y_0^2$ equal to either zero or one also admit $X_0$ as a full symmetry. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Example \ref{sec:asymp}.2.} Consider the FKPP (Fisher-Kolmogorov-Petrovskii-Piskunov) equation \gcite{Murray1,Murray2} \beql{eq:FKPP} u_t \ = \ A \ u_{xx} \ + \ \varepsilon \, u \, (1 - u ) \end{equation} for $u = u(x,t)$, with $A$ and $\varepsilon$ positive real constants; in biological applications, it is required that $u(x,t) \ge 0$ for all $x$ and $t$. This obviously has some stationary homogeneous (i.e., $u_x = 0$) states $u(x,t)= 0$ and $u(x,t) = 1$, with the former being unstable and the latter stable against small perturbations. It is known that if the initial datum is suitably concentrated, in particular if it decays exponentially fast for $|x| \to \infty$, then for $t \to \infty$ and $x \to \infty$ the solution is in the form of a \emph{traveling front} $$ u(x,t) \ \simeq \ \exp \[ - \, \frac{x \ - \ v \, t }{\lambda} \] \ ; \ \ \ \lambda = \sqrt{A/\varepsilon} \ , \ \ v \ = \ \sqrt{4 A \varepsilon} \ . $$ It is convenient to rescale coordinates via $$ t \to \wt{t} \ = \ \varepsilon \, t \ , \ \ x \to \wt{x} \ = \ \sqrt{\varepsilon/A} \ x \ . $$ Using these coordinates -- and omitting the tildes for ease of writing -- the equation reads \beql{eq:FKPPstand} u_t \ = \ u_{xx} \ + \ u \ (1 \, - \, u ) \ , \end{equation} and the asymptotic solution is $$ u (x,t) \ \simeq \ f_0 (x,t) \ = \ A \ \exp \[ - \, (x \, - \, 2 \, t ) \] \ . $$ As already mentioned, the asymptotic above describes the behavior of the solution for large $t$ and $x$, which also means for small $u$. But for small $u$ the equation is approximated by its linearization around $u=0$, i.e., simply by \beql{eq:FKPPlin} u_t \ = \ u_{xx} \ + \ u \ ; \end{equation} the \emph{ansatz} $u(x,t) =w(z) = w(x -2 t)$ transforms this into \beql{eq:FKPPquot} w'' \ + \ 2 \, w' \ + \ w \ = \ 0 \ , \end{equation} with solutions $$ w(z) \ = \ c_+ \, e^{-z} \ + \ c_- \, e^z \ . $$ We denote by $\mathcal{W}$ the space of such solutions; the constants $(c_+,c_-)$ provide coordinates in this space. The requirement that $w(z) \to 0$ for $z \to \infty$ (i.e. for $x \to \infty$ at any finite $t$) yields $c_- = 0$ and hence $w(x) = c_+ e^{- z}$, which is just the $f_0 (x,t)$ given above. The symmetry algebra of the linearized Eq \eqref{eq:FKPPlin} is generated by $$ X_0 \ = \ u \, \partial_u \ , \ \ X_1 \ = \ \partial_x \ , \ \ X_2 \ = \ \partial_t \ . $$ We also consider $$ X_\pm \ := \ X_1 \ \mp \ \frac12 \ X_2 \ ; $$ note that $X_+= \partial_z $, $X_- (z)= 0$. Moreover, $[ X_0 , X_\pm]=0$. The quotient (i.e., symmetry-reduced) Eq \eqref{eq:FKPPquot} admits $X_0$ (now written as $X_0 = w \partial_w$) as a scaling symmetry, and is also invariant under $X_+$. It is easily checked that the propagating front solutions correspond to a subspace of $\mathcal{W}$ invariant under the action of the group generated by the vector fields $X_0$ and $X_+$. As for asymptotic symmetries, the situation is less simple; one can show the following, which we quote from \gcite{GMan2}: if we consider a scaling vector field $X$ such that the limit for $\lambda\to \infty$ of $\exp [ \lambda X]$ extracts the behavior for large $x$ and $t$, and $\Delta_0$ is the FKPP equation, we set $\Delta_\lambda:= e^{\lambda X} \Delta_0$. Then $$ \lim_{\lambda\to \infty} \Delta_\lambda \ = \ \Delta_* $$ is the heat equation $u_t = u_{xx}$. In fact, consider the most general scaling vector field, $$ X_s \ = \ a \, x \, \partial_x \ + \ b \, t \, \partial_t \ + \ c \, u \, \partial_u \ ; $$ one of the constants $a,b,c$ can always be set to unity (provided it is nonzero), which amounts to a redefinition of the group parameter. Then choosing $\Delta_0$ the FKPP equation in its standardized form \eqref{eq:FKPPstand} we get for $\Delta_\lambda = \exp[X_s \lambda] \Delta_0$ the expression $$ \Delta_\lambda \ = \ \lambda^{c-b} \ \[ u_t \ - \ \lambda^{b - 2 a} \, u_{xx} \ - \ \lambda^b \, u \ + \ \lambda^{b+c} \, u^2 \] \ . $$ In order to have a meaningful (and nonzero) limit for $\lambda \to \infty$ we set $b = c$, and we will choose $b=c < 0$; in order to have a nontrivial limit for $\lambda \to \infty$ we also set $a = b/2$. Moreover, we can reparametrize the flow setting $|b|=1$, i.e., $b = -1$. This yields $$ \Delta_\lambda \ = \ u_t \ - \ u_{xx} \ - \ (u/\lambda) \ + \ (u^2 / \lambda^2 ) \ , $$ which reduces to the heat equation for $\lambda \to \infty$. { } \hfill $\diamondsuit$ \medskip \section{Symmetry of stochastic differential equations} \label{sec:symmsto} We have so far discussed symmetries of deterministic differential equations. The symmetry approach has also been applied to \emph{stochastic} differential equations \gcite{GRQ1,GRQ2,Unal,Koz1,Koz2,Koz3,Koz12,GS17,GS17E,GGPR,GGPRE,GL1,GL2,Koz18a,Koz18b,KozB,GLS,GW18}. Here we will be specially concerned with equations (as in the case of deterministic equation, here an equation might be of vector type, i.e., a system of scalar equations) of Ito type, i.e., in the form \beql{eq:Ito} d x^i \ = \ f^i (x,t) \, d t \ + \ \sigma^i_{\ k} (x,t) \, d w^k \ , \end{equation} where$f^i$ and $\sigma^i_{\ k}$ are smooth functions. We will also consider Stratonovich type equations \beql{eq:Strat} d x^i \ = \ b^i (x,t) \, d t \ + \ \sigma^i_{\ k} (x,t) \circ d w^k \ . \end{equation} As it is well known, to each Ito equation there is an associated Stratonovich equation (and conversely) which carries the same statistical information (the correspondence between the two presents some subtleties, see e.g., \gcite{Ikeda,Stroock} for a discussion of these), in particular Eqs \eqref{eq:Ito} and \eqref{eq:Strat} are in such a relation if their drifts satisfy \beql{eq:ItoS} f^i (x,t) \ = \ b^i (x,t) \ + \ \frac12 \ \( \partial_k \sigma^{ij} \) \, \sigma^k_{\ j} \ . \end{equation} We will consider in particular the approach which parallels the usual treatment of deterministic equations in the stochastic case (to which we gave several contributions in recent years); for a discussion of other approaches, including earlier attempts, see e.g., the review paper \gcite{GGPR}. See also \gcite{DVMUG,DVMUGb} for an approach relating symmetries to Girsanov theory, and more generally \gcite{DVMU2,DVMU3,DVMU4,DVMU5,DVMTU} for a related concurrent approach. While in the case of deterministic differential equations there exists a well developed \emph{geometric} theory, which allows to set the symmetry theory on firm geometrical basis, this does not hold for stochastic equations. Actually, the main characteristic of Ito differentials is that under diffeomorphisms they do \emph{not} transform by the familiar chain rule, but according to Ito rule. This shows that the lack of a geometrical setting for symmetries of Ito equations is not due to insufficient development of the theory, but to its intrinsic features. The situation is slightly different for Stratonovich equations. In this case the chain rule is preserved, so that a geometrical setting would be possible; but, as it is well known, the Stratonovich formulation presents several delicate points from the point of view of stochastic processes (many of them being actually associated to its more relevant advantage from the point of view of a physicist, i.e., the preservation of the time inversion symmetry), so that a formulation of the basic theory in terms of the Ito theory is preferable. The relation between symmetry theory for Ito and Stratonovich equations is thoroughly discussed e.g., in \gcite{Koz18b}; see also \gcite{Koz12} for earlier results. \subsection{Symmetry of Ito equations} \label{sec:symmIto} Let us consider an Ito Eq \eqref{eq:Ito}; this involves the time variable $t$, the driving Wiener processes $w^k (t)$, and the spatial variables $x^i$, which evolve through a stochastic process depending on the realization of the $w^k (t)$ and described by the Ito equation itself. Thus our problem lives in the space $\mathcal{E}$ of the variables $\{ t ; x ; w \}$ (note that $x$ and $w$ are vector variables); a blind application of the Lie approach would consider general vector fields in this space, i.e., vector fields of the form \begin{equation} X \ = \ \tau (x,t,w) \, \frac{\partial}{\partial t} \ + \ \varphi^i (x,t,w) \, \frac{\partial}{\partial x^i} \ + \ h^k (x,t,w) \, \frac{\partial}{\partial w^k} \ . \end{equation} It is clear that the action of such a vector field mixes all the variables, discarding the difference between driving and driven stochastic processes, and, even more, introducing a stochastic time. This kind of transformation is well known and widely used by probabilists, and also in the study of stochastic differential equations (including e.g., in the study of \emph{normal forms} for SDEs, which has close relations with symmetry considerations \gcite{ArnImk}); but here we are interested in transformations which leave the equation \emph{invariant}. Transformations which even change the nature of the variables are surely not leaving the equation invariant, and hence will not be considered. If we want to leave the equation invariant, a necessary (but by no means sufficient) condition is that the nature of the involved variables is not changed. We should also ask the transformed $w^k$ variables to be still independent Wiener processes. These requirements (see \gcite{GW18} for how the latter one restricts the form of the $h^k$ functions) lead to consider vector fields in $\mathcal{E}$ of the form \beql{eq:Xa} X \ = \ \tau (t) \, \frac{\partial}{\partial t} \ + \ \varphi^i (x,t,w) \, \frac{\partial}{\partial x^i} \ + \ \( R^k_{\ \ell} w^\ell \) \, \frac{\partial}{\partial w^k} \ , \end{equation} with $R$ a matrix in the Lie algebra of the conformal linear group $\mathrm{CL (n)}$. These vector fields are called \emph{admissible} in $\mathcal{E}$, and in the following we only consider such fields. \medskip\noindent {\bf Remark \ref{sec:symmsto}.1.} We recall $\mathrm{CL (n)} \approx {\bf R}_+ \times \mathrm{O(n)}$, where $\mathrm{O(n)}$ is the ($n$-dimensional) orthogonal group, and ${\bf R}_+$ represents here the dilation group. An alternative characterization of matrices $A \in \mathrm{CL (n)}$ is simply that they satisfy $A^+ A = \lambda^2 I$ for some $\lambda \in {\bf R}$. We are interested in matrices $R$ in the Lie algebra of $\mathrm{CL (n)}$; in practice, such an $R$ is the sum of a diagonal matrix which is a multiple of the identity (corresponding to the linear space spanned by the generator of the dilation group), and a skew-symmetric one (these correspond to the linear space spanned by the generators of the orthogonal part of the group). Thus $R$ has $1+n (n-1)/2$ independent elements. { } \hfill $\odot$ \medskip It is then straightforward to consider the change of variables induced by an infinitesimal action of $X$, i.e., $$ t \to t + \varepsilon \tau \ , \ \ x^i \to x^i + \varepsilon \varphi^i \ , \ \ w^k \to w^k + \varepsilon R^k_{\ \ell} w^\ell \ , $$ and hence on the Eq \eqref{eq:Ito}. Our restrictions on the form of the vector field guarantees that the transformed equation is still an Ito one, which can hence be written as (recall the variables $t,x,w$ are now the transformed ones) \beql{eq:Itotransf} d x^i \ = \ \^f^i (x,t) \, d t \ + \ \^\sigma^i_{\ k} (x,t) \, d w^k \ , \end{equation} where the functions $\^f^i$ and $\^\sigma^i_{\ k}$ -- which can be readily computed in explicit terms -- are in general different from the original ones, $f^i$ and $\sigma^i_{\ k}$. Requiring that the equation is left invariant under the action of $X$ means simply requiring that $\^f^i (x,t) = f^i (x,t)$ and that $\^\sigma^i_{\ k} (x,t) = \sigma^i_{\ k} (x,t)$. We have thus $n + n^2$ equations involving the unknown functions $\tau, \varphi^i, \sigma^i_{\ k}$, which determine the vector fields which leave the Eq \eqref{eq:Ito} invariant, i.e., identify its (Lie-point) symmetries; these are thus called the \emph{determining equations}. An important point is that the form \eqref{eq:Xa} for symmetry vector fields is actually still too general: albeit all vector fields of this form are admissible, not all of them are \emph{useful} when it comes to applying symmetry theory. In particular, as in the deterministic case, the main purpose of computing symmetries is to then apply them for reducing -- or even solving -- the stochastic equations. But to this purpose, only so called \emph{simple} symmetries are useful under the present theory \gcite{Koz1,Koz2,Koz3,KozB}. Simple symmetries are those not acting (but generally depending) on the time variable; i.e., those, in the notation of \eqref{eq:Xa}, with $\tau = 0$). Thus admissible simple symmetries have generators of the form \beql{eq:Xas} X \ = \ \varphi^i (x,t,w) \, \frac{\partial}{\partial x^i} \ + \ \( R^k_{\ \ell} w^\ell \) \, \frac{\partial}{\partial w^k} \ , \end{equation} with $R$ as discussed above. We stress that this restriction to simple (admissible) symmetries will be given for granted in the following; it will also simplify a number of matters. Some further nomenclature within simple symmetries may also be useful: when $R=0$ and the $\varphi^i$ do \emph{not} depend on the $w$ variables, we have \emph{deterministic} symmetries; when $R=0$ and (at least some of) the $\varphi^i$ \emph{do} actually depend on the $w$ variables, we have \emph{random} symmetries; and finally when $R\not= 0$ (and hence the $X$ has a component along the $w$ variables) we have \emph{W-symmetries}. \medskip\noindent {\bf Remark \ref{sec:symmsto}.2.} There is a substantial difference in computing the action of a vector field $X$ on a stochastic equation with respect to the case of a standard (i.e., deterministic) ordinary differential equation. In the latter case the ODE defines a vector field $Z$ in a suitable jet bundle $J$, and we compute how the vector field $X$ and its prolongations act on the vector field $Z$; in the case of stochastic Ito equations, we have to compute how $X$ acts on the functions $f^i (x,t)$, $\sigma^i_{\ k} (x,t)$ and on the differentials $d x^i$, $d t$, $d w^k$. Thus, roughly speaking, we are dealing with one-forms rather than with vector fields. This might be compared with recent work by Anco and Wang \gcite{Anco} taking the same point of view for deterministic ODEs. { } \hfill $\odot$ \medskip When we write down the explicit expressions for $\^f^i$ and $\^\sigma^i_{\ k}$, we also obtain the explicit expressions for the determining equations. We set this in the form of a Proposition; this is quoted from \gcite{GW18}, and we refer to there for a proof. Here and below\ the symbol $\Delta$ denotes the \emph{Ito Laplacian}, \beql{eq:ItoLap} \Delta F \ := \ \sum_{k,\ell} \de^{k \ell} \frac{\partial^2 F}{\partial w^k \partial w^\ell} \ + \ \sum_{i,j} ( \sigma \sigma^T )^{ij} \, \frac{\partial^2 F}{\partial x^i \partial x^j} \ + \ 2 \, \sum_{j,k} \sigma^{jk} \, \frac{\partial^2 F}{\partial x^j \partial w^k} \ . \end{equation} \medskip\noindent {\bf Proposition \ref{sec:symmsto}.1.} {\it The determining equations for simple symmetries of the Ito Eq \eqref{eq:Ito} are \begin{eqnarray} \frac{\partial \varphi^i}{\partial t} \ + \ f^j \, \frac{\partial \varphi^i}{\partial x^j} \ - \ \varphi^j \, \frac{\partial f^i}{\partial x^j} \ + \ \frac12 \, \Delta \varphi^i &=& 0 \ , \label{eq:deteqIto1} \\ \frac{\partial \varphi^i}{\partial w^k} \ + \ \sigma^j_{\ k} \, \frac{\partial \varphi^i}{\partial x^j} \ - \ \varphi^j \, \frac{\partial \sigma^i_{\ k}}{\partial x^j} \ - \ \sigma^i_{\ m} \, R^m_{\ k} &=& 0 \ . \label{eq:deteqIto2} \end{eqnarray}} Obviously, several special cases are obtained by considering special forms of the functions $\tau$, $\varphi^i$ and $R$. We will not enter into this discussion, and just refer the reader to \gcite{GGPR,GW18}. We will however stress that solutions with $\tau = 0$ (i.e., such that the time variable is not acted upon by the vector field $X$) are known as \emph{simple} symmetries, and are specially useful in that the symmetry reduction based on these is specially simple. \medskip\noindent {\bf Remark \ref{sec:symmsto}.3.} The determining Eqs \eqref{eq:deteqIto1}, \eqref{eq:deteqIto2} are a set of $n+n^2$ equations for the $n$ functions $\{ \varphi^1 , ... , \varphi^n \}$ and the $n \times n$ matrix $R$, having (as noted above) $n (n-1)/2 +1$ independent elements. In order to concretely use the information about the symmetry, it does not suffice to prove that a solution exists, but we need of course to determine it in an explicit way. { } \hfill $\odot$ \medskip \subsection{Ito versus Stratonovich equations} \label{sec:ItoStrat} As it is well known -- and recalled above -- the Ito Eq \eqref{eq:Ito} is associated with the Stratonovich Eq \eqref{eq:Strat}, the coefficients of the two being related by \eqref{eq:ItoS}. With this condition, \eqref{eq:Strat} carries the same statistical information as \eqref{eq:Ito}; see e.g., \gcite{Stroock} for more detail. From the point of view of symmetry, there is a substantial difference: while the Ito equations transforms, under the action of a diffeomorphism and thus in particular under the flow generated by a vector field, as described by the \emph{Ito rule}, a Stratonovich equation transforms under the usual chain rule and thus has a geometrical meaning. It is quite natural to wonder if symmetries of an Ito equation and of the associated Stratonovich equation are related or coincide. The question was first tackled by Unal \gcite{Unal}, and then fully solved by Kozlov \gcite{Koz18b}, who showed that deterministic and random symmetries of an Ito and of the associated Stratonovich stochastic equations are just the same -- as indeed natural given the equivalence of the two formulations. The situation is slightly different for W-symmetries; the relations of these for an Ito and the associated Stratonovich equation are discussed in \gcite{GW18}, see Section VII (and in particular Section VII.C) therein. One could of course also analyze symmetries of a Stratonovich Eq \eqref{eq:Strat} along the lines of Section \ref{sec:symmIto}, with the same limitation on the form if the admitted vector fields; in this way one would obtain the determining equations for (Lie-point) symmetries of a Stratonovich equation. See again \gcite{GW18} for a proof to the following statement. \medskip\noindent {\bf Proposition \ref{sec:symmsto}.2.} {\it The determining equations for simple symmetries of the Stra\-to\-no\-vich Eq \eqref{eq:Strat} are \begin{eqnarray} \frac{\partial \varphi^i}{\partial t} \ + \ b^j \, \frac{\partial \varphi^i}{\partial x^j} \ - \ \varphi^j \, \frac{\partial b^i}{\partial x^j} &=& 0 \ , \label{eq:deteqStrat1} \\ \frac{\partial \varphi^i}{\partial w^k} \ + \ \sigma^j_{\ k} \, \frac{\partial \varphi^i}{\partial x^j} \ - \ \varphi^j \, \frac{\partial \sigma^i_{\ k}}{\partial x^j} & = & \sigma^i_{\ m} \, R^m_{\ k} \ . \label{eq:deteqStrat2} \end{eqnarray}} Note that \eqref{eq:deteqStrat2} coincides with \eqref{eq:deteqIto2}; as for \eqref{eq:deteqStrat1}, this coincides with \eqref{eq:deteqIto1} when we impose the correspondence \eqref{eq:ItoS}. See also \gcite{GL1,GL2,Koz18a,Koz18b} for further detail. \subsection{Adapted variables and integration of stochastic equations} \label{sec:adapt} In the view of Sophus Lie, the symmetry analysis of differential equations was not a mathematical curiosity, but a concrete method to obtain order/dimensional reduction, and when possible exact solutions, of the differential equations. The same applies for symmetry analysis of stochastic equations: knowledge of their symmetries allows to obtain a reduction, and when we have enough symmetries (e.g., one symmetry for a scalar equation) there is a concrete method to obtain a complete solution of the equation. \medskip\noindent {\bf Remark \ref{sec:symmsto}.4.} It is maybe worth specifying what we mean by this, i.e., by a complete solution of an Ito equation. We mean an explicit correspondence between a concrete realization of the driving ($n$-dimensional) Wiener process and the corresponding realization of the ($n$-dimensional) stochastic process $x(t)$. Example of this correspondence are provided below in this subsection. { } \hfill $\odot$ \medskip As for deterministic equations, the key to integration of a symmetric equation lies in passing to symmetry-adapted variables (an alternative method uses \emph{invariants}, and will be discussed in the next Section). In these, the equation takes a specially simple form and is integrated in an elementary way; that is, the difficulty of integrating the equation is moved to the difficulty of determining the symmetry and the symmetry-adapted variables. In fact, once we have determined (simple) symmetries of a given Ito equation, these can be used pretty much in the same way as in the case of deterministic equations to integrate or reduce the equation at hand. \medskip\noindent {\bf Proposition \ref{sec:symmsto}.3.} {\it Let the Eq \eqref{eq:Ito} for $x \in M \approx {\bf R}^n$ admit a $r$-dimensional solvable algebra $\mathcal{G}$ of simple \emph{deterministic} Lie symmetries. Then, passing to $\mathcal{G}$-adapted variables, the equation can be reduced to a stochastic equation for $y \in M/\mathcal{G} \approx {\bf R}^{n-r}$ plus a set of $r$ reconstruction equations; the latter amount to simple Ito integrations. In the case $r=n$, the equation is explicitly integrated.} \medskip\noindent {\em Proof.} This is given and proved e.g., in \gcite{GL2}; it is however worth sketching the proof. The first step, i.e., the determination of (simple) Lie symmetries, has already been mapped in the previous part of this section to the problem of solving the determining equations. Assume that a symmetry vector field $X$ -- written in the form \eqref{eq:Xas} -- has been found. We want then to pass from $(x,t;w)$ to new variables $(y,\theta;z)$, where the $z^k$ are still independent Wiener processes, such that in the new variables $X$ reads simply as $X =\partial / \partial y^n$. In fact, if this is the case the Ito equation will be written, in the new variables, as \begin{equation} d y^i \ = \ F^i (y,\theta) \, d \theta \ + \ S^i_{\ k} (y,\theta) \, d z^k \end{equation} with both the $F^i$ and the $S^i_{\ k}$ being independent of $y^n$. The equation decouples then into an $(n-1)$-dimensional Ito equation plus a ``reconstruction equation'', which is written in terms of an Ito integral as \begin{equation} y^n (t) \ = \ y^n (0) \ + \ \int_0^t F^n [ y(\theta) , \theta] \, d \theta \ + \ \int_0^t S^n_{\ k} [y (\theta),\theta] \, d z^k \ . \end{equation} In the case of a scalar equation, this gives directly a full solution of the equation. When we have a higher dimensional equations and several symmetries spanning a solvable Lie algebra, we can proceed step by step by reducing the dimension of the system provided we operate according to the structure of the Lie algebra, i.e., according to the derived series for $\mathcal{G}$, as in the case of deterministic equations \gcite{AVL,CGbook,KrV,Olver1,Olver2,Stephani,Win}. { } \hfill $\diamondsuit$ \medskip We stress that for simple Lie-point symmetries, i.e., vector fields of the form \begin{equation} X \ = \ \varphi^i (x,t) \ \partial_i \ , \end{equation} there is a simple way to relate the sought-for change of variables to the symmetry $X$ \gcite{Koz1,Koz2,Koz3}. First of all we note that in this case the time variable can be left unaffected by the change of variables. It suffices then to require that $$ X \ = \ \varphi^i (x,t) \, \frac{\partial}{\partial x^i} \ = \ \varphi^i [ x(y),t] \, \frac{\partial y^\ell}{\partial x^i} \,\frac{\partial}{\partial y^\ell} \ = \ \frac{\partial}{\partial y^n} \ ; $$ this requires to solve the linear equations $$ \cases{\varphi^i (x,t) \, \( \partial y^\ell / \partial x^i \) \ = \ 0 & ($\ell = 1,...,n-1$) \cr \varphi^i (x,t) \, \( \partial y^n / \partial x^i \) \ = \ 1 & , \cr} $$ which are solved by the classical method of characteristics. In particular, for $n=1$ we have to solve only the last equation, and its solution is promptly written as $$ y \ = \ \int \frac{1}{\varphi (x,t)} \ d x \ . $$ \medskip\noindent {\bf Remark \ref{sec:symmsto}.5.} The reader can wonder why this Proposition considers only \emph{deterministic} symmetries. The reason is that in the case of random or $W$-symmetries, one is \emph{not} guaranteed that the transformed equation is still of Ito type (this depends on a certain compatibility condition being satisfied, see \gcite{GL2,GW18}). Note that the problem is specially present when attempting multiple reduction. In fact, the first reduced equation could be not of Ito type, and in this case our theory can not say anything about successive reductions. We also stress that in the scalar case the reduced equation, albeit not of Ito type, could be integrable; in this case its solution provides -- inverting the transformation -- the solution to the original equation. Finally, we note that in \gcite{GW18}, see in particular Sect. V therein, condition ensuring the symmetry reduced equations are still of Ito type are discussed in some detail (in any case, one can perform the reduction and verify if the reduced equation is Ito or otherwise). When all the reduced equations are of Ito type, Proposition 3 extends also to random or W-symmetries. { } \hfill $\odot$ \medskip \subsection{The Lie algebraic structure of symmetries for a stochastic equation} \label{sec:LAS} It is well known that symmetries of a deterministic differential equations form a Lie algebra \gcite{AVL,CGbook,KrV,Olver1,Olver2,Stephani,Win} (for an explicit proof, see e.g., Sect. 2.3 (and Sect. 5.1 for the case of generalized symmetries) in ref.\gcite{Olver1}). The same holds for stochastic equations, at least for deterministic or random symmetries; note this includes the class of symmetries (deterministic ones) which are guaranteed to allow multiple reductions (see Remark \ref{sec:symmsto}.5 above): \medskip\noindent {\bf Proposition \ref{sec:symmsto}.4.} {\it The set of simple deterministic or random symmetries of a given Ito equation has the standard Lie algebra structure, i.e., if $X,Y$ are symmetries of a given equation, their commutator $Z =[X,Y]$ is also a symmetry for the same equation.} \medskip\noindent {\em Proof.} This is Theorem 4.3 in \gcite{Koz18a}; see there for the proof. Alternatively, note that symmetries of an Ito equation correspond to symmetries of the associated Stratonovich equation; for the latter the standard chain rule holds, so it is obvious that symmetries have the standard Lie algebra structure, proceeding just as in the case of deterministic equations. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Remark \ref{sec:symmsto}.6.} It should be noted that \gcite{GS17} contains a statement in contrast with Proposition \ref{sec:symmsto}.4 (see Sect. IX.A therein). That statement concerns transformations of a rather more general form than the one considered here\footnote{In fact, far too general transformations, in particular functions $h(x,t,w)$, are allowed at that point of the discussion in \gcite{GS17}; restricting to $h(x,t,w) = R w$, as we do here, produces the right result.} and it is thus wrong if seen in the present context, while Proposition \ref{sec:symmsto}.4 above is correct. { } \hfill $\odot$ \medskip \medskip\noindent {\bf Remark \ref{sec:symmsto}.7.} Our Proposition \ref{sec:symmsto}.4 does not say anything concerning W-sym\-me\-tri\-es. In fact, the following Examples will show that in some cases these also form a Lie algebra (or possibly even a Lie module), while in other cases this is not the case. In other words, no general statement is possible about the Lie algebraic structure of W-symmetries of a given equation. { } \hfill $\odot$ \medskip \subsection{Stochastic versus diffusion equations} \label{sec:FP} Finally, we recall that for any Ito Eq \eqref{eq:Ito} there is an associated diffusion (Fokker-Planck) equation \beql{eq:FP} u_t \ = \ \ A^{ij} \, u_{ij} \ - \ B^i \, u_i \ - \ C \, u \ , \end{equation} describing the evolution of the density $u (x,t)$ in time; here $u_i := (\partial u / \partial x^i)$ and similarly $u_{ij} := (\partial^2 u / \partial x^i \partial x^j)$, and the coefficients in the Fokker-Planck Eq \eqref{eq:FP} are related to those in the Ito Eq \eqref{eq:Ito} by \begin{equation} A^{ij} \ = \ \frac12 \, (\sigma \, \sigma^T)^{ij} \ , \ \ B^i \ = \ f^i \ - \ \partial_j ( \sigma \sigma^T)^{ij} \ , \ \ C \ = \ (\partial_i f^i) \ - \ \frac12 \, \partial^2_{ij} (\sigma \sigma^T)^{ij} \ . \end{equation} \medskip\noindent {\bf Remark \ref{sec:symmsto}.7.} The Fokker-Planck equation is often also written, more synthetically, as \beql{eq:FPshort} u_t \ = \ \frac12 \, \frac{\partial^2}{\partial x^i \partial x^j} \[ \sigma \sigma^T \ u \] \ - \ \frac{\partial}{\partial x^i} \, \[ f^i \, u \] . \end{equation} Combining this equation with those for the transition from an Ito equation to the associated Stratonovich one, see Eq \eqref{eq:ItoS}, it is immediate to get the Fokker-Planck equation associated to a Stratonovich equation. { } \hfill $\odot$ \medskip \medskip\noindent {\bf Remark \ref{sec:symmsto}.8.} We also recall that, as discussed in \gcite{Koz12,GRQ1,GGPR}, any symmetry of the Ito Eq \eqref{eq:Ito} leads (adding a standard term proportional to $\partial_u$) to a symmetry of the associated Fokker-Planck Eq \eqref{eq:FP}, but the converse is not true. This is rather natural, given that different Ito equations can have the same associated Fokker-Planck equation; in fact, symmetries of a Fokker Planck equation will in general map these different Ito equations one into the other. We refer to \gcite{Koz12,GRQ1,GRQ2,GGPR} for further detail and examples. { } \hfill $\odot$ \medskip \subsection{Examples} We consider here some examples illustrating the results discussed in this Section. We recall that we are considering \emph{simple} admissible symmetries or W-symmetries; that is, vector fields of the form \eqref{eq:Xas} with $R$ a constant matrix of the form discussed in Sect. \ref{sec:symmIto}. \medskip\noindent {\bf Example \ref{sec:symmsto}.1.} Consider the equation $$ d x \ = \ t \ d w \ . $$ The determining equations are then $$ \varphi_t \ + \ \frac12 \, \Delta (\varphi) \ = \ 0 \ , \ \ \varphi_w \ + \ t \, \varphi_x \ - \ R \, t \ = \ 0 \ ; $$ their general solution is $$ \varphi \ = \ R \, x \ + \ k \ , $$ with $k$ a constant. Thus we have two symmetries (a deterministic one and a W-symmetry), i.e., $$ X \ = \ \partial_x \ , \ \ Y \ = \ R \, x \, \partial_x \ + \ R \, w \, \partial_w \ . $$ It is immediate to check that $$ [X,Y] \ = \ R \, \partial_x $$ is still a symmetry: thus in this case the set of (simple) symmetries, involving both ``ordinary'' and W-symmetries, is indeed a Lie algebra. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Example \ref{sec:symmsto}.2.} Consider the scalar Ito equation \beql{eq:GBM} d x \ = \ \alpha \, x \, dt \ + \ \beta \, x \, d w \ , \end{equation} where $\alpha$ and $\beta$ are real constants. This describes the \emph{geometric Brownian motion} in one dimension, and it is well known that this equation can be integrated (see e.g., \gcite{Oksendal}, Chapter 5). Note that if we start with $x(0) > 0$, we are guaranteed to have $x(t) \ge 0$ for all times. The determining equations \eqref{eq:deteqIto1}, \eqref{eq:deteqIto2} for simple symmetries\footnote{Recall this means $\tau = 0$ in terms of \eqref{eq:Xa}, i.e., that $X$ should be of the form \eqref{eq:Xas}.} of \eqref{eq:GBM} are \begin{eqnarray} \varphi_t \ + \ \alpha \, x \, \varphi_x \ - \ \alpha \, \varphi \ + \ \frac12 \, \Delta \varphi &=& 0 \ , \label{eq:GBM1} \\ \varphi_w \ + \ \beta \, x \, \varphi_x \ - \ \beta \, \varphi \ - \ \beta \, x \, R &=& 0 \ . \label{eq:GBM2} \end{eqnarray} Solving \eqref{eq:GBM2} yields $$ \varphi (x,t;w) \ = \ x \ \[ R \, \log (x) \ + \ \psi (z,t) \] \ ; \ \ \ \ z \ := \ w \ - \ \beta^{-1} \ \log(x) \ . $$ Inserting this into \eqref{eq:GBM1}, the latter reads $$ \( \frac{x}{2 \beta} \) \ \[ \beta \, (\beta^2 \ + \ 2 \, \alpha ) \, R \ + \ 2 \, \beta \, \psi_t \ + \ ( \beta^2 \ - \ 2 \, \alpha ) \, \psi_z \] \ = \ 0 \ ; $$ the solution to this equation is $$ \psi (z,t) \ = \ \frac{ \beta \, (2 \alpha \, + \, \beta^2 ) \, R z \ + \ (2 \alpha \, - \, \beta^2 ) \, Q (\zeta )}{(2 \alpha \, - \, \beta^2 ) } \ , $$ having defined $$ \zeta \ = \ \frac{(2 \, \alpha \ - \ \beta^2 ) \, t \ + \ 2 \, \beta \, w \ - \ 2 \, \log (x)}{2 \, \alpha \ - \ \beta^2 } \ . $$ Going back to evaluate $\varphi$, we thus we have symmetries depending on the arbitrary function $Q$ and on the arbitrary constant $R$ \beql{eq:Xexa51} X \ = \ \[ x \ \( \frac{\beta}{2 \alpha - \beta^2} \, \( (2 \alpha + \beta^2 ) \, w \ - \ 2 \, \beta \, \log (x) \) \ R \ + \ Q (\zeta ) \) \] \ \partial_x \ + \ \( R \, w \) \, \partial_w \ . \end{equation} The simplest choice is of course $R=0$, $Q(\zeta) = 1$, which gives $\varphi = x$, i.e. the scaling symmetry $$ X_0 \ = \ x \ \partial_x \ . $$ The associated integrating change of variables is simply $$ y \ = \ \int \frac{1}{\varphi} \ d x \ = \ \int \frac{1}{x} \ d x \ = \ \log (x) \ ; $$ In fact, Ito formula for the change of variables gives immediately (using \eqref{eq:GBM} for the time evolution) $$ d y \ = \ (\alpha \ - \ \beta^2/2 ) \ dt \ + \ \beta \ dw \ , $$ which yields at once (setting for ease of writing $t_0 = 0$ and $w(0)=0$) $$ y(t) \ = \ y_0 \ + \ (\alpha - \beta^2/2 ) \ t \ + \ \beta \, w(t) \ , $$ and hence $$ x(t) \ = \ \exp[y(t)] \ = \ x_0 \ \exp \[ (\alpha - \beta^2/2 ) \ t \ + \ \beta \, w(t) \] \ . $$ We can use this Example also to illustrate the Lie algebraic structure of the set of symmetries. Let us first set $R=0$, i.e., consider random symmetries, and two symmetries of the general form \eqref{eq:Xexa51} with $R=0$, say $$ X \ = \ x \, P (\zeta) \ \partial_x \ , \ \ \ Y \ = \ x \, Q (\zeta ) \ \partial_x \ . $$ An explicit computation shows that $$ Z \ := \ [X,Y] \ = \ x \ H(\zeta) \ \partial_x $$ where the function $H$ is given explicitly by $$ H(\zeta) \ := \ \frac{1}{\alpha - \beta^2/2} \ \[ P' (\zeta) \, Q(\zeta) \ - \ P(\zeta) \, Q' (\zeta) \] \ . $$ This is still of the functional form \eqref{eq:Xexa51} with $R=0$, and hence is immediately known to be still a (random) symmetry for our Eq \eqref{eq:GBM}. On the other hand, let us consider the general case, i.e., let us \emph{not} enforce $R=0$. We set a simplified notation writing $$ \mu (x,w) \ = \ \frac{\beta}{2 \alpha - \beta^2} \( (2 \alpha + \beta^2) w - 2 \beta \log (x) \) \ , $$ and consider vector fields \begin{eqnarray*} X &=& x \ \( \mu (x,w) \, R_1 \ + \ P (\zeta) \) \, \partial_x \ + \ (R_1 w) \, \partial_w \ , \\ Y &=& x \ \( \mu (x,w) \, R_2 \ + \ Q (\zeta) \) \, \partial_x \ + \ (R_2 w) \, \partial_w \ ; \end{eqnarray*} by our discussion above, they are symmetries of \eqref{eq:GBM}; we could actually also take $R_1 = R_2 = R \not= 0$. Then an explicit computation yields $$ Z \ = \ [X,Y] \ = \ x \ h (x,w;\zeta) \ \partial_x $$ where the function $h$ is given by \begin{eqnarray*} h(x,w;\zeta) &:=& \frac{1}{(\alpha - \beta^2/2)^2} \ \[ \beta^2 \ \( \beta w - \log (x) \) \ \( R_2 \, P' (\zeta) \ - \ R_1 \, Q' (\zeta) \) \right. \\ & & \left. \ + \ \( \alpha - \beta^2/2\) \[ (R_1 Q - R_2 P ) \beta^2 \ + \ P' (\zeta) \, Q(\zeta) \ - \ P (\zeta) \, Q' (\zeta ) \] \] \ . \end{eqnarray*} The vector field $Z$ thus defined is \emph{not} of the form \eqref{eq:Xexa51} and hence is \emph{not} a symmetry of the Eq \eqref{eq:GBM}. This shows that W-symmetries of a given equation, contrary to simple deterministic and random symmetries, in general do \emph{not} form a Lie algebra. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Example \ref{sec:symmsto}.3.} Consider the \emph{stochastic logistic equation with environmental noise} \beql{eq:SLE} d x \ = \ \( \alpha \, x \ - \ \beta \, x^2 \) \ d t \ + \ \gamma \, x \, d w \ . \end{equation} Here $\alpha,\beta,\gamma$ are nonzero real constants; in the biological applications they have positive sign, but for our present purposes this is not relevant. We will again look at the case with $R=0$, i.e., search for symmetries of the form $X = \varphi (x,t;w) \partial_x$. In this case the second determining equation \eqref{eq:deteqIto2} reads $$ \varphi_w \ + \ \gamma \ \( x \, \varphi_x \ - \ \varphi \) \ = \ 0 \ , $$ which yields immediately $$ \varphi (x,t,w) \ = \ x \ \psi (z,t) \ ; \ \ \ z \ = \ w \ - \ \gamma^{-1} \ \log (x) \ . $$ Then the first determining Eq \eqref{eq:deteqIto1} splits into two equations (for the coefficients of $x$ and $x^2$ in the resulting expression): \begin{eqnarray*} \psi_t &=& \( \frac{\alpha}{\gamma} \ - \ \frac{\gamma}{2} \) \ \psi_z \\ \psi_z &=& - \, \gamma \ \psi \ . \end{eqnarray*} These are easily solved, and we get in the end $$ \varphi (x,t,w) \ = \ x^2 \ \exp \[ - \, \( A \, t \ + \ \gamma \, w \) \] \ , \ \ \ A \ := \ \alpha \ - \ \gamma^2 /2 \ . $$ Note this yields a random symmetry $$ X \ = \ x^2 \ \exp \[ - \, \( A \, t \ + \ \gamma \, w \) \] \ \partial_x \ . $$ The associated change of variables and its inverse are given by \begin{eqnarray} y &=& \int \frac{1}{\varphi (x,t,w)} \ d x \ = \ - \, \frac{1}{x} \ \exp[ A \, t \ + \ \gamma \, w ] \ ; \label{eq:SLEcvd} \\ x &=& - \, \frac{1}{y} \ \exp [ A \, t \ + \ \gamma \, w ] \ . \label{eq:SLEcvi} \end{eqnarray} When we express the evolution of $y$ using Ito's rule and \eqref{eq:SLE}, we get $$ d y \ = \ - \, \beta \ \exp \[ A \, t \ + \ \gamma \, w \] \ d t \ ; $$ note this is \emph{not} an Ito equation. It can however be directly integrated to give $$ y(t) \ = \ y_0 \ - \ \beta \ \int_0^t \exp \[ A \tau + \gamma w (\tau) \] \ d \tau \ . $$ Transforming back to the original variable $x$ via \eqref{eq:SLEcvi} we obtain the solution to \eqref{eq:SLE} in closed -- albeit involved -- form. The reader can see \gcite{GSLE} for numerical experiments confirming the analytical procedure. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Example \ref{sec:symmsto}.4.} Consider the equation \beql{eq:NE3} d x \ = \ x \, e^{- t} \, d t \ + \ x \ d w \ . \end{equation} (note that $x(0)>0$ entails $x(t) \ge 0$ for all $t \ge 0$.) This admits as symmetry \beql{eq:Xexa53} X \ = \ x \ F (\zeta ) \ \partial_x \ , \end{equation} where $F$ is an arbitrary function of $$ \zeta \ := \ e^{- t } \ + \ \frac{t}{2} \ - \ w \ + \ \log (x) \ . $$ The simplest choice is of course $F (\zeta) = 1$, i.e., $$ X \ = \ x \ \partial_x \ ; $$ note this is a \emph{deterministic} symmetry. The associated change of variables is just $y = \log (x)$, and with this our Eq \eqref{eq:NE3} is mapped into $$ d y \ = \ \( e^{-t} \, - \, 1/2 \) \ dt \ + \ dw \ , $$ which is directly integrated to $$ y(t) \ = \ y (t_0) \ - \ \[ \frac{(t- t_0)}{2} \ + \ \( e^{-t} - e^{- t_0} \) \] \ + \ \( w(t) \, - \, w(t_0 ) \) \ . $$ This yields the solution to our Eq \eqref{eq:NE3} upon inversion of the change of variables, i.e., setting $x = e^y$. Suppose we do not want to make this simplest choice, and go for the next simpler one; this will produce a \emph{random} symmetry. So let us choose $F(\zeta) = \zeta$, and hence $$ X \ = \ x \ \[ e^{- t } \ + \ \frac{t}{2} \ - \ w \ + \ \log (x) \] \ \partial_x \ . $$ Then the associated change of variables is $$ y \ = \ \log \[ e^{-t} \, + \, \frac{t}{2} \, - \, w \, + \, \log (x) \] \ + \ \beta (t,w) \ . $$ the equation for $y$ is then $$ d y \ = \ \( \beta_t \ + \ \frac12 \, \beta_{ww} \) \, d t \ + \ \beta_w \, d w \ . $$ Thus we should choose $\beta (t,w) = b (t) + c w$ in order to get an Ito equation. With this choice, the initial equation is mapped into $$ d y \ = \ \[ b' (t) \] \ d t \ + \ c \ d w \ , $$ which is readily integrated to yield $$ y(t) \ = \ y(t_0) \ + \ \[ b(t) \ - \ b(t_0) \] \ + \ c \[ w(t) \ - \ w(t_0)\] \ . $$ Inverting the change of coordinates -- which is now a more complex operation than in the previous case -- we obtain the solution for $x(t)$. We can again check that the symmetries, i.e., vector fields of the form \eqref{eq:Xexa53} (which are random symmetries), form a Lie algebra. In this case, it is in fact immediate to check that if $$ X \ = \ x \ F(\zeta) \ \partial_x \ , \ \ \ Y \ = \ x \ G(\zeta) \ \partial_x \ , $$ then we have $$ Z \ := \ [X,Y] \ = \ x \ H (\zeta) \ \partial_x $$ where we have defined $$ H(\zeta) \ = \ F' (\zeta) \ G(\zeta ) \ - \ F(\zeta) \ G(\zeta) \ . $$ Thus $Z$ is of the form \eqref{eq:Xexa53}, and hence a symmetry for Eq \eqref{eq:NE3}, as claimed. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Example \ref{sec:symmsto}.5.} Consider the two-dimensional equation (here and elsewhere in concrete examples, we write vector indices as lower ones, to avoid any possible confusion with squares) \begin{eqnarray} d x_1 &=& \[ e^{x_1} \ - \ \frac12 \, e^{- 2 x_1} \] \, d t \ + \ e^{- x_1 } \, d w_1 \nonumber \\ d x_2 &=& \frac12 \, e^{x_2} \, \[ 2 \, e^{x_1} \ + \ e^{x_2} \ + \ e^{2 x_1 + x_2} \] \, d t \ - \ e^{x_1+x_2} \, d w_1 \ - \ e^{x_2} \, d w_2 \ . \label{eq:GL2dim} \end{eqnarray} It is easily checked that this admits the symmetry vector field \begin{equation} X \ = \ - \, e^{x_2} \, \partial_2 \ ; \end{equation} symmetry-adapted variables are \beql{eq:GL2dimcv} y_1 \ = \ \exp [ x_1 ] \ , \ \ y_2 \ = \ \exp [ - x_2 ] \ ; \end{equation} in these variables, the vector field is $$ X \ = \ \partial / \partial y_2 $$ and the eq. \eqref{eq:GL2dim} reads simply \begin{eqnarray} d y_1 &=& y_1^2 \, dt \ + \ d w_1 \nonumber \\ d y_2 &=& - y_1 \, dt \ + \ y_1 \, dw_1 \ + \ dw_2 \ . \end{eqnarray} That is, we have an \emph{autonomous} Ito equation for $y_1$; \emph{if} this is solved, say with $y_1 = \Phi [ t, w_1 (t) ]$, \emph{then} the equation for $y_2$ is immediately integrated to give $$ y_2 (t) \ = \ y_2 (0) \ - \ \int_0^t \Phi [t,w_1 (t)] \, dt \ + \ \int_0^t \Phi [ t , w_1 (t) ] \, d w_1 (t) \ + \ \int_0^t d w_2 (t) \ . $$ The solution to the initial problem \eqref{eq:GL2dim} is then obtained by inverting the change of variables \eqref{eq:GL2dimcv}. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Example \ref{sec:symmsto}.6.} Consider, as in \gcite{GW18}, the two-dimensional isotropic linear stochastic equation \beql{eq:2DISO} d x^i \ = \ \lambda \, x^i \, d t \ + \ \mu \, d w^i \ \ \ \ (i=1,2) \ . \end{equation} This was considered, for what concerns W-symmetries in \gcite{GW18} (this was Example 7 therein), but only W-symmetries were considered in that work; we will thus have to derive the full symmetry algebra. We write, for ease of notation, $R$ in the form $$ R \ = \ \left( \matrix{ r_0 & r_1 \cr - r_1 & r_0 \cr} \right) \ . $$ Solving the $\sigma$-determining equations for $\varphi^i ({\bf x}, t ; {\bf w})$ yields \begin{eqnarray*} \varphi^1 (x_1,x_2,t;w_1,w_2) &=& r_0 \, x_1 \ + \ r_1 \, x_2 \ + \ \psi^1 (z_1,z_2,t) \ , \\ \varphi^2 (x_1,x_2,t;w_1,w_2) &=& - r_1 \, x_1 \ + \ r_0 \, x_2 \ + \ \psi^2 (z_1,z_2,t) \ ; \\ z_i &:=& w_i \ - \ x_i / \mu \ . \end{eqnarray*} With this, the $f$-determining equations read \begin{eqnarray*} \frac{\partial \psi^1}{\partial t} & = & \frac{\lambda}{\mu} \, \( x_1 \, \frac{\partial \psi^1}{\partial z_1} \ + \ x_2 \, \frac{\partial \psi^1}{\partial z_2} \) \ + \ \lambda \, \psi^1 \ , \\ \frac{\partial \psi^2}{\partial t} & = & \frac{\lambda}{\mu} \, \( x_1 \, \frac{\partial \psi^2}{\partial z_1} \ + \ x_2 \, \frac{\partial \psi^2}{\partial z_2} \) \ + \ \lambda \, \psi^2 \ . \end{eqnarray*} Note that the $\psi$ are functions of the $z_i$ variables alone; thus coefficients of the $x_i$ must vanish separately, and we get $$ \psi^i (z_1,z_2,t) \ = \ e^{\lambda t} \ c_i $$ where $c_i$ are arbitrary constants. In conclusion, the symmetry algebra $\mathcal{G}$ for \eqref{eq:2DISO} is spanned by the vector fields \begin{eqnarray*} X_1 &=& x^1 \, \partial_1 \ + \ x^2 \, \partial_2 \ + \ w^1 \, \^\partial_1 \ + \ w^2 \, \^\partial_2 \ , \\ X_2 &=& x^2 \, \partial_1 \ - \ x^1 \, \partial_2 \ + \ w^2 \, \^\partial_1 \ - \ w^1 \, \^\partial_2\ ; \\ Y_1 &=& \exp [\lambda t] \, \partial_1 \ , \\ Y_2 &=& \exp [\lambda t] \, \partial_2 \ . \end{eqnarray*} Note that the $X_i$ are W-symmetries, while the $Y_i$ are deterministic symmetries. A trivial computation shows that the commutation relations are given by \begin{eqnarray*} & & [X_1,X_2] = 0 \ , \ \ [Y_1,Y_2] = 0 \ ; \\ & & [Y_1,X_1] = Y_1 \ , \ \ [Y_1,X_2] = - Y_2 \ , \\ & & [Y_2,X_1] = Y_2 \ , \ \ [Y_2,X_2] = Y_1 \ . \end{eqnarray*} This shows that $\mathcal{G}$ is indeed a Lie algebra; moreover ${\mathcal G}_X = \{ X_1,X_2\}$ and ${\mathcal G}_Y = \{ Y_1 , Y_2 \}$ are abelian subalgebras, and ${\mathcal G}_Y$ an abelian ideal in ${\mathcal G}$. { } \hfill $\diamondsuit$ \medskip \section{The method of invariants} \label{sec:invar} Consider a general function \begin{equation} F \ = \ F (x,t,w) \ ; \end{equation} its Ito differential is $$ d F \ = \ \frac{\partial F}{\partial t} \, d t \ + \ \frac{\partial F}{\partial x^i} \, d x^i \ + \ \frac{\partial F}{\partial w^a} \, d w^a \ + \ \frac12 \, \Delta F \, d t \ . $$ When we evaluate this on the dynamics described by the Ito Eq \eqref{eq:Ito}, we get \beql{eq:dFdyn} d F \ = \ \[ \frac{\partial F}{\partial t} \ + \ f^i (x,t) \, \frac{\partial F}{\partial x^i} \ + \ \frac12 \, \Delta F \] \, d t \ + \ \[ \frac{\partial F}{\partial w^a} \ + \ \sigma^{i}_{\ a} (x,t) \, \frac{\partial F}{\partial x^i} \] \, d w^a \ . \end{equation} It follows immediately that if (and only if) $F$ satisfies the equations \begin{eqnarray} \frac{\partial F}{\partial t} \ + \ f^i (x,t) \, \frac{\partial F}{\partial x^i} \ + \ \frac12 \, \Delta F &=& 0 \ , \label{eq:inveq1} \\ \frac{\partial F}{\partial w^a} \ + \ \sigma^{i}_{\ a} (x,t) \, \frac{\partial F}{\partial x^i} & = & 0 \ \ \ \ (a = 1,...,m) \ , \label{eq:inveq2} \end{eqnarray} then $F$ is an \emph{invariant} for the SDEs \eqref{eq:Ito}. Note that in general the invariants will be arbitrary functions of some ``basic invariants'' functions. \medskip\noindent {\bf Example \ref{sec:invar}.1.} Consider the equation \beql{eq:invex1} d x^i \ = \ f^i (t) \, d t \ + \ \sigma^i_{\ k} (t) \, d w^k \ \ \ \ (i=1,...,n) \ ; \end{equation} then the Eq \eqref{eq:inveq2} yield immediately that $$ F(x,t,w) \ = \ F(z,t) \ ; \ \ \ z^i \ := \ x^i \ - \ \int \sigma^i_{\ k} (t) \, d w^k (t) \ . $$ A straightforward computation shows that in this case $\Delta F = 0$ (note in particular $\Delta z^i = 0$). The Eq~\eqref{eq:inveq1} reads then $$ \frac{\partial F}{\partial t} \ - \ f^i \, \frac{\partial F}{\partial z^i} \ = \ 0 \ , $$ and it follows immediately that $$ F \ = \ F ( \zeta ) \ , $$ having defined \beql{eq:zetainvex1} \zeta^i \ := \ z^i \ - \ \Phi^i (t) \ = \ x^i \ - \ \Phi^i (t) \ - \ \int \sigma^i_{\ k} (t) \, d w^k \ , \end{equation} where $\Phi$ is the primitive of $f$, \beql{eq:Phiexa61} \Phi^i (t) \ = \ \int \ f^i (\tau) \, d \tau \ . \end{equation} Obviously, the $\zeta^i$ are in this case the basic invariants mentioned above. { } \hfill $\diamondsuit$ \medskip The existence of invariants allows to express the solutions to a SDE system in terms of a reduced system of Ito equations; if there are as many independent invariants as degrees of freedom, then the solution can be expressed purely in terms of invariants. In other words, the presence of a sufficient number of invariants guarantees the integrability of the equation, pretty much as in the deterministic case the presence of a sufficient number of conserved quantities guarantees integrability. \medskip\noindent {\bf Example \ref{sec:invar}.2.} In the case of Eq \eqref{eq:invex1}, we have the basic invariants defined in \eqref{eq:zetainvex1}; at the initial time $t=0$ these will satisfy $\zeta^i = \zeta^i (0)$. If $w^i (0) = 0$, and choosing the constant in the primitives of \eqref{eq:Phiexa61} so that $\Phi^i (0)= 0$, at $t=0$ we have $$ \zeta^i (0) \ = \ \zeta^i_0 \ = \ x^i_0 \ = \ x^i (0) \ . $$ Thus we have at all times and for each realization of the Wiener processes $w^k (t)$, and with $\Phi^i$ as in \eqref{eq:Phiexa61} above, $$ x^i (t) \ = \ x^i_0 \ + \ \Phi^i (t) \ + \ \int_0^t \sigma^i_{\ k} (\tau) \ d w^k (\tau) \ . $$ This yields directly the solution to \eqref{eq:invex1}. { } \hfill $\diamondsuit$ \medskip It is natural to wonder if and how invariants are related to symmetries of the stochastic equation. Comparing Eqs \eqref{eq:deteqIto1}, \eqref{eq:deteqIto2} one the one hand, and \eqref{eq:inveq1}, \eqref{eq:inveq2} on the other, we immediately observe a rather trivial (but useful) relation: if both $f^i$ and $\sigma^i_{\ k}$ do not actually depend on the $x$ variables (but possibly depend on $t$) and set $R=0$, the symmetry coefficients $\varphi^i$ are also invariants for the Ito equation. (Note that such relation does not exist for $R \not=0$, i.e., for proper W-symmetries \gcite{GW18}.) We would be interested in knowing if other relations exist. This matter has been studied in recent papers by one of us \gcite{Koz18a,Koz18b,KozB} (to which we refer for details and examples), and we briefly report the relevant results here. \medskip\noindent {\bf Proposition \ref{sec:invar}.1.} {\it The set of invariants for a given Ito equation is a ring over ${\bf R}$, i.e., if $F,G$ are invariants for the given equations and $\alpha,\beta$ are real constants, so are $$ H \ = \ \alpha \, F \ + \ \beta \, G \ , \ \ \ K \ = \ F \cdot G \ . $$} \medskip\noindent {\bf Proposition \ref{sec:invar}.2.} {\it If a given Ito Eq \eqref{eq:Ito} admits the symmetry $X$ and the invariant $F$, then $G = X(F)$ is also an invariant for the same equation.} \medskip\noindent {\bf Proposition \ref{sec:invar}.3.} {\it The set of symmetries for a given Ito equation has, beside the structure of Lie algebra, the structure of a \emph{Lie module} over the ring of invariants; i.e., if $X,Y$ are symmetries for the given equation, and $F,G$ invariants for the same equation, then $$ Z \ = \ F \, X \ + \ G \, Y $$ is still a symmetry for the equation.} \medskip\noindent {\em Proof.} Proposition \ref{sec:invar}.1 is trivial; Propositions \ref{sec:invar}.2 and \ref{sec:invar}.3 are respectively Theorems 4.4 and 4.6 in \gcite{Koz18a}; see there for proofs. { } \hfill $\diamondsuit$ \medskip We stress that, obviously, a generic stochastic equation has no invariants, even in the case it has symmetries. \medskip\noindent {\bf Example \ref{sec:invar}.3.} Consider again the two-dimensional isotropic linear stochastic Eq \eqref{eq:2DISO} considered in Example \ref{sec:symmsto}.6 above (where it was found it has a nontrivial symmetry algebra). Now a direct computation shows that there are no invariants. In fact, invariants should satisfy the equations \begin{eqnarray} & & J_{w_1} \, + \, \mu \, J_{x1} \ = \ 0 \ , \nonumber \\ & & J_{w_2} \, + \, \mu \, J_{x_2} \ = \ 0 \ ; \label{eq:ex53} \\ & & J_t \, + \, \lambda \, \( x_1 \, J_{x_1} \, + \, x_2 \, J_{x_2} \) \ = \ 0 \ . \nonumber \end{eqnarray} Note in the last equation there should also be a term $(1/2) \Delta J$ with $\Delta$ the Ito Laplacian \eqref{eq:ItoLap}, but in this case it results $\Delta J = 0$.) Solving the first two equations yields $$ J (x_1,x_2,t,w_1,w_2) \ = \ H (z_1,z_2,t) \ ; \ \ \ z_i \ := \ w_i \ - \ x_i / \mu \ . $$ Plugging this into the last Eq \eqref{eq:ex53} yields $H = const$, thus showing that only trivial invariants are present. { } \hfill $\diamondsuit$ \medskip \section{Conditional and asymptotic symmetries for stochastic equations} \label{sec:cassto} We now want to argue that -- pretty much in the same way as a great extent of the standard theory of symmetry of deterministic differential equations can be extended to the framework of stochastic differential equations -- the concepts of conditional, partial and asymptotic symmetry also apply for stochastic differential equations. What is more, these are also \emph{useful} to determine solutions to stochastic equations. It will happen that these are intimately related -- much more than in the deterministic setting -- to similar concepts for invariants, i.e., to conditional, partial or asymptotic invariants. These, and the relation with symmetries, will be discussed in the next Sect. \ref{sec:caisto}. We will first discuss the matter in abstract terms -- actually with a more formal writing than in previous Sections, as now we develop new material and results; and then provide, in Sect. \ref{sec:examples} below, a number of concrete Examples. \subsection{Conditional and partial symmetries} \label{sec:CPSsto} Our first observation is that conditional and partial symmetries can be, in principle, defined for stochastic equations exactly as in the case of deterministic ones. The difference -- and the reason to write ``in principle'' in the lines above -- is that while a solution of a deterministic equation is determined by the initial condition, in the case of stochastic equation it is determined by the initial condition \emph{and} by the realization of the driving Wiener processes. But, of course, we do not know a priori what the realization of the Wiener process will be, so we do not want to discuss properties which depend on such realization. (A partial exception to this is that often we are satisfied with properties which hold for \emph{generic} realizations of the Wiener processes, i.e., for a full measure set of the driving Wiener paths.) Thus, in practice, it is quite difficult -- and makes little sense in view of applications -- to study symmetries of a given solution, or of a given set of solutions. The exception is provided by the case where the solutions in the set which is studied are identified by their living on an \emph{invariant manifold} for the equation. By this we mean that the Eq \eqref{eq:Ito} describes a variable $(x,t) \in M$ ($M$ is the phase manifold), and there is a proper submanifold $M_0 \subset M$ such that if $(x(0),t_0) \in M_0$, then \emph{for any realization} of the driving Wiener processes, and for any $t \ge t_0$, $(x(t),t) \in M_0 $. We will actually confine ourselves to the case of \emph{autonomous} equations, i.e., the case where the coefficients $f^i (x,t)$ and $\sigma^i_{\ k} (x,t)$ in \eqref{eq:Ito} are actually independent of $t$. In this case we can work with the reduced phase manifold\footnote{This was denoted as $M_0$ in Sect. \ref{sec:symm}; but here we reserve this notation to the dynamically invariant submanifold. We trust no confusion will arise.}, and in the following $M$ should be interpreted as the reduced phase manifold. Extension of our discussion and results to the non-autonomous is rather simple, and in any case can be obtained -- remaining within the autonomous formalism -- by adding a new variable $x^0$ with evolution governed by $d x^0 = d t$. We will see in the following that the existence of these invariant manifolds is naturally related to ``conditional'' (or ``partial'') invariants for the equation.\footnote{The simplest -- but rather trivial -- case in which there is an invariant manifold is that of a \emph{fixed point}; for example the stochastic Eq~\eqref{eq:Ito} with coefficients satisfying $f^i (0,t)=0$, $\sigma^i_{\ j} (0,t) = 0$, automatically admit ${\bf x} = 0$ as a fixed point, and hence a (highly symmetric) solution $x(t) \equiv 0 $. This is of little interest.} The simplest nontrivial case is that in which the dynamics admits a nontrivial invariant submanifold $M_0 \subset M$ (this is of course more significant if $M_0$ is stable or attracting, as will be discussed later on). In this case we can consider the restriction of our system to $M_0$, and this may have symmetries which are not present for the full system. These in turn may allow for the integration of the restricted equation; solutions obtained in this way are also special solutions for the full system. We start by stating some very simple -- but useful -- facts. \medskip\noindent {\bf Lemma \ref{sec:cassto}.1.} {\it Let the SDE $\Delta$ \eqref{eq:Ito} in the $n$-dimensional manifold $M$ admit an invariant submanifold $M_0 \subset M$ of dimension $m < n$. Consider the restriction $\Delta_0$ of $\Delta$ to $M_0$. Any solution to $\Delta_0$ is also a solution to $\Delta$, and the most general solution to $\Delta$ with $x (0) \in M_0$ is obtained as a solution to $\Delta_0$.} \medskip\noindent {\em Proof.} Obvious. \medskip\noindent {\bf Lemma \ref{sec:cassto}.2.} {\it In the setting of Lemma \ref{sec:cassto}.1, let $\Delta_0$ admit $m$ simple symmetries spanning a solvable algebra. Then it can be integrated, and hence all the solutions to the initial equation $\Delta$ with initial conditions on $M_0$ can be obtained.} \bigskip \medskip\noindent {\em Proof.} Integrability of $\Delta_0$ follows from Proposition \ref{sec:symmsto}.3 above. Once $\Delta_0$ is integrable, the rest of the statement follows immediately from Lemma \ref{sec:cassto}.1. { } \hfill $\diamondsuit$ \medskip This construction is also generalized to the case where the symmetry algebra has smaller dimension, as stated in the following Lemma. \medskip\noindent {\bf Lemma \ref{sec:cassto}.3.} {\it Let the Ito SDE $\Delta$ in the $n$-dimensional manifold $M$ admit an invariant submanifold $M_0 \subset M$ of dimension $m < n$. Let $\Delta_0$ be the restriction of $\Delta$ to $M_0$. Then \par\noindent $(a)$ If $\Delta_0$ admits $s<m$ simple symmetries spanning a solvable algebra ${\mathcal G}$ which generates a local Lie group $G$, then $\Delta_0$ can be reduced to an equation $\^\Delta_0$ on $M_0/G$. \par\noindent $(b)$ Let $\^x (t)$ be any solution to $\^\Delta_0$; then $\^x (t)$ extends to a solution $x(t)$ of $\Delta_0$, and this is turn describes the most general solution to $\Delta$ with $x(0) \in M_0$.} \medskip\noindent {\em Proof.} Point $(a)$ follows by Proposition \ref{sec:symmsto}.3 above. Solutions to $\^\Delta_0$ are extended to solutions to $\Delta_0$ again by means of Proposition \ref{sec:symmsto}.3, i.e., via the reconstruction equations. In view of Lemma \ref{sec:cassto}.1, the exact solutions obtained in this way are also all the solutions to the initial equation $\Delta$ with initial conditions on $M_0$. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Remark \ref{sec:cassto}.1.} The statement in these Lemmas are rather trivial, as shown by their very simple proofs. Actually these Lemma are more the description of a strategy to obtain a set of solutions (identified by living on $M_0$) to $\Delta$. { } \hfill $\odot$ \medskip \medskip\noindent {\bf Remark \ref{sec:cassto}.2.} If the equation admits a standard (global) invariant, then all the level manifolds for this invariant are invariant manifolds of the differential equation; see Example \ref{sec:examples}.1 below. Thus the Lemmas \ref{sec:cassto}.1, \ref{sec:cassto}.2 and \ref{sec:cassto}.3 given above apply in general, in the sense that \emph{any} initial datum lies on such an invariant manifold. But they apply also to the case where no global invariant exists (we will see in a moment a weaker type of invariant is involved here), i.e., when we have \emph{isolated} invariant manifolds. { } \hfill $\odot$ \medskip \medskip\noindent {\bf Remark \ref{sec:cassto}.3.} The presence of an isolated invariant manifold can be described in terms of a \emph{conditional invariant} for the stochastic equation. That is, if $M_0$ is the submanifold described by $F (x) = m_0$ (here $m_0 \in {\bf R}$) and $M_0$ is an invariant manifold while there are no nearby invariant manifolds, then $F (x)$ is a conditional invariant for our equation. Note that this means that on the dynamics we have $$ d F \ = \ [ F(x) - m_0 ] \ \[ \alpha (x,t) \, d t \ + \ \beta_k (x,t) \, d w^k \] \ , $$ with nonzero $\alpha, \beta_k$. In this case \emph{only} the $m_0$ level set is invariant, while the other ones are in general not invariant, as in our Examples \ref{sec:examples}.2 and \ref{sec:examples}.3 below (in both cases the conditional invariant is just $\rho$ and the invariant level set is $\rho = 1$). We will discuss this point in more detail in Sect. \ref{sec:caisto} below. { } \hfill $\odot$ \medskip \medskip\noindent {\bf Remark \ref{sec:cassto}.4.} This situation is similar to the setting considered by Misawa and by Albeverio \& Fei \gcite{AlbFei,Mis1,Mis2,Mis3} in their early study of symmetry of stochastic equations (see the discussion in \gcite{GGPR}). In their case, however, we had a global (proper) invariant, hence a global constant of motion -- which allowed for a dimensional reduction of the stochastic system -- as in Example \ref{sec:examples}.1 below, while in the setting discussed here we only have a conditional one, hence reduction can take place \emph{only} on the specific level set of the conditional constant of motion, viz. the manifold $M_0$. { } \hfill $\odot$ \medskip \medskip\noindent {\bf Remark \ref{sec:cassto}.5.} The situation discussed in this Section is related to \emph{conditional constants of motion} \gcite{SLC,PucRos1,PucRos2,Hall1,Hall2} and \emph{conditional invariants}, so that it would be natural to speak of conditional symmetries. On the other hand, in this case the solutions (to the restricted problem) are \emph{not} invariant under the conditional symmetry: they are actually mapped one into another by the action of the latter. In this sense, the situation is more similar to that encountered when dealing, in the deterministic framework, with \emph{partial} symmetries; from this point of view it might be more appropriate to speak of \emph{partial invariants}; but we will prefer to use the term \emph{conditional invariant} in view of the first mentioned parallel with the deterministic case, and the established use in the latter. { } \hfill $\odot$ \medskip \subsection{Invariant manifolds and (conditional) configurational invariants} \label{sec:IMCCI} In the previous discussion, in particular Lemmas \ref{sec:cassto}.1 through \ref{sec:cassto}.3, we have assumed the existence of an invariant manifold $M_0 \subset M$ for the dynamics described by our Ito Eq \eqref{eq:Ito}. Needless to say, this is a highly non-generic situation. In fact, as anticipated in Remark \ref{sec:cassto}.3, the existence of invariant manifolds is related to the existence of (conditional) invariants for the dynamics. In order to identify invariant manifolds in $M$, or in $M \times {\bf R}$, these invariants should depend only on the $x$, or the $(x,t)$, variables. We have thus the following: \medskip\noindent {\bf Definition \ref{sec:cassto}.1.} {\it When the invariant $J = J(x,t;w)$ for an Ito equation does not depend on the $w$ variables, i.e., $J(x,t;w) = \Psi (x,t)$, we say that $J$ is a \emph{phase invariant}; if moreover $\Psi$ is independent of $t$, we say $J$ is a \emph{configurational invariant}.} \medskip\noindent {\bf Remark \ref{sec:cassto}.6.} We stress that while configurational invariants can identify invariant manifolds, and phase invariant can identify time-varying invariant manifolds, in order to identify solutions in terms of invariants we need invariants which also depend on the $w^i$ variables, and hence on the realization of the Wiener processes. See also Example \ref{sec:examples}.1 in this respect. { } \hfill $\odot$ \medskip We recall that if $J : M \to R$ is a smooth function defined on the phase manifold $M$, or more generally $J : M \times \mathcal{W} \to R$ where $\mathcal{W} \approx {\bf R}^n$ is the space in which the driving Wiener processes $w^i = w^i (t)$ take values, then its evolution on the dynamics described by the Ito equation $\Delta$ -- written as \eqref{eq:Ito} -- is given by \begin{eqnarray} d J &=& \( \frac{\partial J}{\partial t} \) \, dt \ + \ \( \frac{\partial J}{\partial x^i} \) \, d x^i \ + \ \frac12 \ \Delta (J) \, d t \nonumber \\ &=& \[ \( \frac{\partial J}{\partial t} \) \ + \ \( \frac{\partial J}{\partial x^i} \) \ f^i (x,t) \ + \ \frac12 \ \Delta (J) \] \ dt \label{eq:dJfull} \\ & & \ \ + \ \[ \( \frac{\partial J}{\partial w^k} \) \ + \ \( \frac{\partial J}{\partial x^i} \) \, \sigma^i_{\ k} (x,t) \] \ d w^k \ . \nonumber \end{eqnarray} We are specially interested in the case where $J$ is a function of $x$ and $t$ alone, $J(x,t;w) = \Psi (x,t)$; we say then that $J$ is a \emph{phase space function}, and if $\Psi$ does not depend on $t$ we say it is a \emph{configurational function}. In both these cases the Ito Laplacian reduces to \beql{eq:deltaJpsi} \Delta J \ = \ \Delta \Psi \ = \ \sigma^{ik} \sigma^j_{\ k} \ \frac{\partial^2 \Psi}{\partial x^i \partial x^j} \ . \end{equation} \medskip\noindent {\bf Lemma \ref{sec:cassto}.4.} {\it The evolution of a phase space function under the dynamics described by an Ito Eq \eqref{eq:Ito} is itself described by an Ito equation.} \medskip\noindent {\em Proof.} Using \eqref{eq:dJfull} and specializing it to the case $J = \Psi (x,t)$, we have \begin{eqnarray} d J &=& \[ \( \frac{\partial \Psi}{\partial t} \) \ + \ \( \frac{\partial \Psi}{\partial x^i} \) \ f^i (x,t) \ + \ \frac12 \ \Delta (\Psi) \] \ dt \nonumber \\ & & \ + \ \[ \( \frac{\partial \Psi}{\partial x^i} \) \, \sigma^i_{\ k} (x,t) \] \ d w^k \ . \label{eq:dJx} \end{eqnarray} Recalling also \eqref{eq:deltaJpsi}, we note that now all terms within the square brackets depend on $(x,t)$ alone, i.e., we have again an equation of Ito type. { } \hfill $\diamondsuit$ \medskip It is now natural to introduce the following Definition, which leads immediately to the foregoing Lemma \ref{sec:cassto}.5. \medskip\noindent {\bf Definition \ref{sec:cassto}.2.} {\it \emph{(a)} If the function $J$ is such that $d J = 0$ on solutions to the Ito equation \eqref{eq:Ito}, i.e., \eqref{eq:dJfull} is identically zero, we say that it is an \emph{invariant} for the Ito equation (a \emph{phase space invariant} if $J = \Psi (x,t)$, and \eqref{eq:dJx0} is identically satisfied, a \emph{configurational invariant} if $J = \Psi (x)$). \par\noindent \emph{(b)} If this relation is valid only on the level set $J = c$, we say that $J$ is a \emph{conditional invariant} (a \emph{conditional phase space invariant} if $J = \Psi (x,t)$, a \emph{conditional configurational invariant} if $J = \Psi (x)$) for the Ito equation.} \medskip\noindent {\bf Lemma \ref{sec:cassto}.5.} {\it Phase space invariants are identified by the $n+1$ equations \begin{eqnarray} & & \( \frac{\partial \Psi}{\partial t} \) \ + \ \( \frac{\partial \Psi}{\partial x^i} \) \ f^i (x,t) \ + \ \frac12 \ \Delta (\Psi) \ = \ 0 \ , \nonumber \\ & & \( \frac{\partial \Psi}{\partial x^i} \) \, \sigma^i_{\ k} (x,t) \ = \ 0 \ . \label{eq:dJx0} \end{eqnarray}} \medskip\noindent {\em Proof.} This follows at once from \eqref{eq:dJx}. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Remark \ref{sec:cassto}.7.} If the solutions to the \eqref{eq:dJx0} identify one or more level sets of $J=\Psi$ (in practice, if the l.h.s. of the above equations can be factorized with a factor being just a function of $\Psi$), then this or these level sets correspond to invariant manifolds for the dynamics. We will see in concrete Examples that this may happen. { } \hfill $\odot$ \medskip \medskip\noindent {\bf Remark \ref{sec:cassto}.8.} As configurational invariants (and functions) are special cases of phase space invariants (and functions), the Lemmas \ref{sec:cassto}.4 and \ref{sec:cassto}.5 above also apply to them. Note that the Eq \eqref{eq:dJx0} read in this case \begin{eqnarray} & & \( \frac{\partial \Psi}{\partial x^i} \) \ f^i (x) \ + \ \frac12 \ \Delta (\Psi) \ = \ 0 \ , \nonumber \\ & & \( \frac{\partial \Psi}{\partial x^i} \) \, \sigma^i_{\ k} (x) \ = \ 0 \ , \label{eq:dJx00} \end{eqnarray} where we have taken into account the fact that configurational invariants naturally arise in autonomous systems. { } \hfill $\odot$ \medskip \subsection{Asymptotic symmetries} \label{sec:asysymsto} We have so far discussed the case where an invariant submanifold $M_0 \subset M$ exists, and considered dynamics on it. We have not discussed neither what happens nearby the invariant manifold, nor the stability of such manifold. As we are considering stochastic systems, we should consider at least two types of (local or global) stability \gcite{Kushner,Khasminski}. \begin{itemize} \item[(A)] On the one hand, it is possible that for any initial datum $x_0$ in a neighborhood $\mathcal{B}_0 \supset M_0$ and any realization of the Wiener processes $w^i (t)$, the dynamics is attracted towards $M_0$. \item[(B)] On the other hand, it is possible that for any $x_0 \in \mathcal{B}_0$, considering the Fokker-Planck equation with initial condition $u (x,0) = \delta (x - x_0)$ the probability density function $u(x,t)$ remains concentrated around $M_0$. \end{itemize} \medskip\noindent {\bf Definition \ref{sec:cassto}.3.} {\it When the situation described in case (A) above occur, we say that $M_0$ is locally \emph{strongly attractive}; if this holds for any $x_0 \in M$, we say it is \emph{globally strongly attractive}.} \medskip\noindent {\bf Definition \ref{sec:cassto}.4.} {\it When the situation described in case (B) above occur, we say that $M_0$ is locally \emph{weakly attractive}; if this holds for any $x_0 \in M$, we say it is \emph{globally weakly attractive}.} \medskip\noindent {\bf Remark \ref{sec:cassto}.9.} Note that in case (B) above typically there will be a parameter $\sigma_0 \ge 0$ -- related in physical terms to the intensity of the noise described by the Wiener processes -- which controls the spreading of the asymptotic measure around $M_0$, and such that in the limit $\sigma_0 \to 0$ the asymptotic measure $u_* (x) = \lim_{t \to \infty} u(x,t)$ collapses to a measure on $M_0$. { } \hfill $\odot$ \medskip \medskip\noindent {\bf Lemma \ref{sec:cassto}.6.} {\it In the case (A), the most general \emph{asymptotic} solution to $\Delta$ will be described by the most general solution to $\Delta_0$.} \medskip\noindent {\em Proof.} In fact, under these hypotheses any dynamics starting in $\mathcal{B}$ will be attracted to the invariant manifold $M_0$, and on this the dynamics is described by $\Delta_0$. The conclusion follows then by Lemma \ref{sec:cassto}.1 above. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Remark \ref{sec:cassto}.10.} Needless to say, even in the case $\Delta_0$ is fully integrable we will in general not be able to describe which ones of the solutions to $\Delta_0$ will describe the asymptotic behavior for a given solution to $\Delta$, i.e., for given initial datum $x_0 \in \mathcal{B}$ and given realization of the Wiener processes, as we will not be able to integrate the transient dynamics. { } \hfill $\odot$ \medskip \medskip\noindent {\bf Remark \ref{sec:cassto}.11.} The Remark above refers to case (A). In case (B), on the other hand, the dynamics can not be reduced, even asymptotically, \emph{exactly} to the dynamics on $M_0$ and hence to $\Delta_0$. Thus even in the case where $\Delta_0$ is exactly integrable -- and even for $x_0 \in \mathcal{B}_0$ -- this does not give a description of the asymptotic dynamics for $\Delta$. In this case we have a weaker result. { } \hfill $\odot$ \medskip \medskip\noindent {\bf Lemma \ref{sec:cassto}.7.} {\it In the case (B), for small enough $\sigma_0$, the asymptotic dynamics will be described for most of the time, by the \emph{linearization} $\wt{\Delta}_0$ of $\Delta$ around $M_0$.} \medskip\noindent {\em Proof.} Under the hypotheses holding in case (B) and for small enough $\sigma_0$, the measure will be asymptotically concentrated around $M_0$, so that the linearization $\wt{\Delta}_0$ (which, in turn, will be a linearization around $\Delta_0$) will describe ``most'' of the asymptotic solutions; by this we mean that there could be from time to time \emph{large fluctuations} driving the dynamics for a short time outside of the immediate neighborhood of $M_0$, i.e., outside the region where $\Delta$ reduces to $\wt{\Delta}_0$. These large fluctuations will occur with a frequency exponentially small in $\sigma_0$ and will decay rapidly so that the dynamics is quickly driven back to the region around $M_0$. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Remark \ref{sec:cassto}.12.} This Lemma does not give a result of the same strength as the previous one; on the other hand, it says that one will have a reliable description in terms of $\wt{\Delta}_0$, except for rare and short fluctuations. { } \hfill $\odot$ \medskip As far as symmetries are concerned, our discussion suggests naturally the following definitions. \medskip\noindent {\bf Definition \ref{sec:cassto}.5.} {\it Let $M_0 \subset M$ be a strongly attractive submanifold for the equation $\Delta$, and let $\Delta_0$ be the restriction of $\Delta$ to $M_0$; let $X$ be a symmetry for $\Delta_0$, hence a conditional symmetry for $\Delta$. We say that $X$ is also a \emph{strong asymptotic symmetry} for $\Delta$.} \medskip\noindent {\bf Definition \ref{sec:cassto}.6.} {\it Let $M_0 \subset M$ be a weakly attractive submanifold for the equation $\Delta$, let $\Delta_0$ be the restriction of $\Delta$ to $M_0$, and let $\wt{\Delta}_0$ be the linearization of $\Delta$ around $M_0$; let $X$ be a symmetry for $\Delta_0$, hence a conditional symmetry for $\Delta$. \emph{If} $X$ is also a symmetry for $\wt{\Delta}_0$, then we say that $X$ is also a \emph{weak asymptotic symmetry} for $\Delta$.} Both these cases are related to the presence of \emph{asymptotic} conditional invariants, as we are now going to discuss in the next Section \ref{sec:caisto}. We stress that we are again interested in the case of phase space or configurational invariants, i.e., where the would-be invariants depend on $(x,t)$ or on the $x$ variables alone; thus we are in the setting discussed above, and the evolution is described by \eqref{eq:dJx}. \section{Asymptotic invariants and asymptotic symmetries for stochastic equations} \label{sec:caisto} The discussion of Section \ref{sec:IMCCI}, referring to conditional symmetries, can be extended to the case of asymptotic symmetries. The key observation is that the evolution of a phase space function under the dynamics of an Ito Eq \eqref{eq:Ito} is described by \eqref{eq:dJx}, i.e., by an equation of Ito type; this will be denoted, for ease of reference, as $\Delta_J$. So our discussion of (stochastic) stability for submanifolds $M_0$ of $M$ under $\Delta$ can be repeated for the stability under $\Delta_J$. \medskip\noindent {\bf Definition \ref{sec:caisto}.1.} {\it If $J = \Psi (x)$ is a conditional configurational invariant for the Ito equation $\Delta$ on the invariant manifold $M_0$, and $M_0$ is a strongly attractive manifold for $\Delta$, we say that $J$ is a \emph{strong asymptotic invariant} for $\Delta$.} \medskip\noindent {\bf Definition \ref{sec:caisto}.2.} {\it If $J = \Psi (x)$ is a conditional configurational invariant for the Ito equation $\Delta$ on the invariant manifold $M_0$, and $M_0$ is a weakly attractive manifold for $\Delta$, se say that $J$ is a \emph{weak asymptotic invariant} for $\Delta$.} \medskip\noindent {\bf Lemma \ref{sec:caisto}.1.} Let $J$ be a strongly asymptotic configurational invariant for the Ito equation $\Delta$, associated to the invariant manifold $M_0$, and let $\Delta_0$ be the reduction of $\Delta$ to $M_0$. Then the asymptotic solutions to $\Delta$ are described by the solutions to $\Delta_0$. \medskip\noindent {\em Proof.} By definition, under the hypotheses of the Lemma $M_0$ is a strongly attractive invariant manifold for $\Delta$, hence the statement follows immediately from Lemma \ref{sec:cassto}.6, which itself uses Lemma \ref{sec:cassto}.1. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Lemma \ref{sec:caisto}.2.} Let $J$ be a weakly asymptotic configurational invariant for the Ito equation $\Delta$, associated to the invariant manifold $M_0$, and let $\wt{\Delta}_0$ be the linearization of $\Delta$ around $M_0$. Then the asymptotic solutions to $\Delta$ are described by the solutions to $\wt{\Delta}_0$, up to large fluctuations. \medskip\noindent {\em Proof.} By definition, under the hypotheses of the Lemma $M_0$ is a weakly attractive manifold for $\Delta$. Thus, according to Lemma \ref{sec:cassto}.7, the dynamics of $\Delta$ lives, for most of the time and up to rare and short-lived large fluctuations, in a neighborhood of $M_0$; thus it is described by $\wt{\Delta}_0$, and the Lemma is just a restatement of these facts in terms of (asymptotic) invariants. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Remark \ref{sec:caisto}.1.} The approach discussed in this subsection is strongly related to stochastic Lyapounov functions, see e.g., \gcite{Kushner,Khasminski}. Some of our ideas are also related to ideas developed in the context of bifurcation for stochastic systems \gcite{Doan}. { } \hfill $\odot$ \medskip \medskip\noindent {\bf Remark \ref{sec:caisto}.2.} Our discussion used \emph{configurational} invariants to relate invariants to attractive invariant submanifolds. As stressed above, see Remark \ref{sec:cassto}.6, configurational or phase space (asymptotic) invariants can only do this, i.e., they cannot be used to obtain solutions to Ito equations, at difference with general (asymptotic) invariants, i.e., invariants depending also on the $w$ variables. See also the discussion in Sect. \ref{sec:invar} for the case of full invariants. { } \hfill $\odot$ \medskip \section{Examples} \label{sec:examples} We will now consider concrete Examples related to the matters discussed in Sections \ref{sec:cassto} and \ref{sec:caisto} above. These matters are of course strongly interconnected, but we have separated the Examples in different types -- and correspondingly separated the present Section in different subsections -- for ease of reading. In most cases, our Examples are built so that the compact invariant manifold is just a circle (usually the unit one), as we want to focus on conceptual issues rather than on computational difficulties. Thus it is not surprising that things will be simpler in polar or spherical coordinates, and indeed we will mostly work in polar coordinates, albeit in some cases we will also start from Cartesian ones. \subsection{Full symmetry, full invariants} We start by considering an Example due to Misawa \gcite{Mis3}; this is Example 1 in there, where it is considered in the equivalent Stratonovich form, and only up to checking $J$ is an invariant. \medskip\noindent {\bf Example \ref{sec:examples}.1.} Consider the Ito equation \begin{eqnarray} d x_1 &=& \( x_3 \, - \, x_2 \, - \, \frac12 \, ( 2 x_1 - x_2 - x_3 ) \) \, d t \ + \ (x_3 \, - \, x_2 ) \, d w \nonumber \\ d x_2 &=& \( x_1 \, - \, x_3 \, - \, \frac12 \, ( 2 x_2 - x_3 - x_1 )\) \, d t \ + \ (x_1 \, - \, x_3 ) \, d w \label{eq:Misawa} \\ d x_3 &=& \( x_2 \, - \, x_1 \, - \, \frac12 \, ( 2 x_3 - x_1 - x_2 ) \) \, d t \ + \ (x_2 \, - \, x_1 ) \, d w \nonumber \end{eqnarray} (note that only one Wiener process is involved). In this case the function \begin{equation} J \ = \ x_1^2 \, + \, x_2^2 \, + \, x_3^2 \ = \ \rho^2 \end{equation} is an invariant. In fact one has $$ \Delta J \ = \ 4 \ \[ J \ - \ \( x_1 x_2 + x_2 x_3 + x_3 x_1 \) \] \ , $$ and then $d J = 0 $ on the Eq \eqref{eq:Misawa} follows immediately from a direct computation. Thus any sphere of radius $\rho$ is invariant under the evolution described by \eqref{eq:Misawa}. It is also easily checked, by the same procedure or by just looking at \eqref{eq:Misawa}, that \begin{equation} H \ = \ x_1 \ + \ x_2 \ + \ x_3 \end{equation} is another invariant. By considering the Jacobian matrix for the change of coordinates $(x_1,x_2,x_3) \to (J,H,z)$ with $z = x_3$, we observe that its determinant is $2 (x_1 - x_2)$, i.e., this is singular on the plane $x_1 = x_2$; we will thus have to consider two regions. Implementing the change of variables $(x_1,x_2,x_3) \to (J,H,z) $ we have that the inverse change is given (in the two regions $x_1 < x_2$ and $x_1 > x_2$) by \begin{eqnarray*} x_1 &=& \frac12 \ \[ ( H \ - \ z ) \ \mp \ \sqrt{2 (J - z^2 ) \ - \ (H - z )^2} \] \ , \nonumber \\ x_2 &=& \frac12 \ \[ ( H \ - \ z ) \ \pm \ \sqrt{2 (J - z^2 ) \ - \ (H - z )^2} \] \ . \end{eqnarray*} Note that by elementary algebra, and in view of the definitions of $J,H$, and $z$, we have $$ 2 (J - z^2 ) \ - \ (H - z )^2 \ = \ (x_1 \ - \ x_2 )^2 \ ; $$ thus the argument of the square root in the formula above is always positive. We introduce, for ease of writing, the new \emph{real} function $$ \chi (J,H;z) \ = \ \sqrt{2 (J - z^2 ) \ - \ (H - z )^2 } \ , $$ so that the above inverse change of variables reads \begin{eqnarray} x_1 &=& \frac12 \ \[ ( H \ - \ z ) \ \mp \ \chi (J,H;z) \] \ , \nonumber \\ x_2 &=& \frac12 \ \[ ( H \ - \ z ) \ \pm \ \chi (J,H;z) \] \ . \label{eq:MisCV} \end{eqnarray} On the one-dimensional manifolds (corresponding to the $\pm$ sign in the formulas above) identified by given values for $J = \rho^2$ and $H$ we have the reduced equation \begin{equation} dz \ = \ \[ \frac12 \ (H - 3 z) \ \pm \ \chi (J,H;z) \] \ d t \ \pm \ \chi (J,H;z) \ d w \ . \end{equation} Note that here $z \in [-\rho,\rho]$ (recall $J = \rho^2$), and that for $z = \pm \rho$ we have $J = z^2$, $H = z$ and $x_1=x_2 = 0$. We can further look for symmetries of the reduced equation. We disregard W-symmetries, i.e., set $R=0$ in \eqref{eq:deteqIto2}\footnote{The case with $R\not= 0$ can also be analyzed completely, yielding of course more complex formulas.}; with straightforward computations we get $$ \varphi_\pm (z,t;w) \ = \ \chi (J,H;z) \ \psi_\pm ( u_\pm ) \ , $$ where the $\pm$ refers to the two determinations given above for $x_1$ and $x_2$ in terms of $z$, $\psi_\pm$ are arbitrary function of their argument, and $$ u_\pm \ = \ w \ + \ t \ \pm \ \frac{1}{\sqrt{3}} \ \arctan \[ \frac{H - 3 z}{\sqrt{3} \, \chi (J,H;z)} \] \ . $$ The simplest case does of course correspond to $\psi_\pm ( u_\pm ) = c_\pm $, say $$ \psi_\pm ( u_\pm ) = \pm 1 $$ for ease of discussion (note the two $\pm$ signs are independent), i.e., to\footnote{This notation might be confusing: a more precise notation would be $\varphi_\pm = s_\pm \chi$, with $s_\pm$ a sign.} $$ \varphi_\pm (z,t;w) \ = \ \pm \ \chi (J,H;z) \ . $$ With this, the integrating change of variables is given by $$ \xi \ = \ \int \frac{1}{\varphi_\pm (z,t;w)} \ d z \ = \ { \mp } \ \frac{1}{\sqrt{3}} \ \arctan \[ \frac{H - 3 z}{\sqrt{3} \ \chi (J,H;z) } \] \ . $$ With a direct application of Ito rule, the evolution equation for the random variable $\xi$ turns out to be \beql{eq:MisXi} d \xi \ = \ d t \ + \ d w \ . \end{equation} This is immediately integrated, yielding $$ \xi (t) \ = \ \xi (t_0) \ + \ (t - t_0) \ + \ [ w(t) - w(t_0) ] \ . $$ Going back to the $z$ variable we obtain (note that $3 J - H^2 \ge 0$) $$ z \ = \ \frac{H}{3} \ \pm \ \frac{\sqrt{2}}{3} \, \sqrt{3 J - H^2} \ { \sin ( \sqrt{3} \, \xi) } \ . $$ Having obtained $z(t)$, i.e., $x_3 (t)$, now $x_1 (t) $ and $x_2 (t)$ are also obtained via \eqref{eq:MisCV}. { } \hfill $\diamondsuit$ \medskip \subsection{Full or conditional symmetries, conditional invariants} We now consider several examples with conditional invariants; at this stage we will not yet look at asymptotic symmetries or invariants. \medskip\noindent {\bf Example \ref{sec:examples}.2.} Let us work in $R^2$ with polar coordinates $(\rho,\vartheta)$, and consider the Ito equations \begin{eqnarray} d \rho &=& a \, (1 - \rho^2) \, \rho \, d t \ + \ \sigma \, (1 - \rho^2) \, d w_1 \nonumber \\ d \vartheta &=& \[ b \, (1 - \rho^2) \ + \ \omega \, \rho^2 \] \ d t \ + \ \sigma \, d w_2 \label{eq:ex_6_1} \end{eqnarray} with $a,b,\omega,\sigma$ nonzero real constants. It is clear that the unit circle $\rho = 1$ is an invariant manifold for these equations; the dynamics on the unit circle is described by $$ d \vartheta \ = \ \omega \, d t \ + \ \sigma \, d w_2 $$ i.e., by a uniform rotation with a superimposed Wiener process. This yields immediately $$ \vartheta (t) \ = \ \vartheta (0) \ + \ \omega \, t \ + \ \sigma \, [w_2 (t) - w_2 (0) ] \ ; \ \ \ \rho (t) = 1 \ . $$ Thus albeit we have no information about the dynamics for generic initial conditions, we have a full description of the dynamics with initial condition on the unit circle. The discussion is immediately generalized -- in its entirety -- to equations of the form \begin{eqnarray*} d \rho &=& \alpha (\rho,\vartheta) \, d t \ + \ \sigma_1 (\rho,\vartheta) \, d w_1 \\ d \vartheta &=& \beta (\rho,\vartheta) \ d t \ + \ \sigma_1 (\rho,\vartheta) d w_2 \end{eqnarray*} with $\alpha,\beta,\sigma_i$ smooth functions and \begin{eqnarray*} & & \alpha (\rho_0,\vartheta) \ = \ 0 \ = \ \sigma_1 (\rho_0,\vartheta) \ , \\ & & \partial_\vartheta \beta (\rho_0,\vartheta) \ = \ \partial_\vartheta \sigma_1 (\rho_0,\vartheta) \ = \ 0 \end{eqnarray*} for some $\rho_0$. If we drop the last condition, i.e., require only $\alpha (\rho_0,\vartheta) = 0 = \sigma_1 (\rho_0,\vartheta)$, we still have reduction to a one dimensional equation on the circle of radius $\rho_0$, albeit we have no information on the solutions living on this circle. Note that in this case the full equations are rotationally invariant, as immediately seen from \eqref{eq:ex_6_1}; but the associated function $J = \rho$ is a \emph{conditional} invariant. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Example \ref{sec:examples}.3.} Consider $R^3$ with cylindrical coordinates $(\rho,\vartheta,z)$ and the Ito equations \begin{eqnarray} d \rho &=& a (1 - \rho^2) \, d t \ + \ \kappa \, (1 - \rho^2) \, d w_1 \nonumber \\ d \vartheta &=& \[ \omega \, + \, b \, (1 - \rho^2) \, + \, c \, \cos (z) \] \, d t \ + \ \sigma_1 (\rho,\vartheta,z) \, d w_2 \label{eq:ex_cylinder} \\ d z &=& \gamma (r,\vartheta,z) \, d t \ + \ \sigma_2 (\rho,\vartheta,z) \, d w_3 \ , \nonumber \end{eqnarray} with $\{ a,b,c,\kappa, \omega \}$ nonzero real constants and $\{\gamma , \sigma_1 , \sigma_2 \}$ smooth functions. By construction, the cylinder $M_0$ of equation $\rho = 1$ is an invariant submanifold (the function $J_1 = \rho$ is a conditional invariant), and on it the system reduces to \begin{eqnarray*} d \vartheta &=& \[ \omega \, + \, c \, \cos (z) \] \, d t \ + \ \sigma_1 (1,\vartheta,z) \, d w_2 \\ d z &=& \gamma (1,\vartheta,z) \, d t \ + \ \sigma_2 (1,\vartheta,z) \, d w_3 \ , \end{eqnarray*} Suppose now that in general $\{\gamma,\sigma_1,\sigma_2\}$ depend effectively on $\vartheta$, but that $$ \( \partial_\vartheta \gamma (\rho,\vartheta,z) \)_{\rho=1} \ = \ \( \partial_\vartheta \sigma_1 (\rho,\vartheta,z) \)_{\rho=1} \ = \ \( \partial_\vartheta \sigma_2 (\rho,\vartheta,z) \)_{\rho=1} \ = \ 0 \ . $$ Then the restricted system admits rotations in $\vartheta$ as symmetries, and hence the system can be further reduced to an equation in $z$. Albeit we are in general not able to solve this (one-dimensional) equation, we know that given a solution we can reconstruct a solution of the two-dimensional restricted system, and this is a special solution to the full three-dimensional problem. Similarly it is easy to produce examples in which not only the cylinder $\rho = 1$ is invariant, but within this we have the circle $S^1_0 = \{ \rho = 1 \ , \ z=0 \}$ which is also invariant. In this case the equation is fully integrated for initial data on $S^1_0$, partially integrated for initial data on the cylinder $\rho=1$, and in general nothing can be said for general initial data (but Eq. \eqref{eq:ex_cylinder} show that an asymptotic analysis will be possible). { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Example \ref{sec:examples}.4.} In the previous examples, everything was rather obvious by construction, thanks to the use of polar coordinates and the fact the invariant manifold was just a circle of radius one. Things are slightly less evident if we use Cartesian coordinates, and we want to show now that one can indeed work also with a less ``ready to use'' setting. Consider, with $r^2 = x_1^2 + x_2^2$ for short, the equation \begin{eqnarray} dx_1 &=& \[ \( \alpha \, (1 - r^2 ) \, - \, (\sigma^2 / 2) \) \, x_1 \ - \ \( \beta \, (1 - r^2) \, + \, \omega \, r^2 \) \, x_2 \] \ d t \nonumber \\ & & \ + \ \sigma \, (1 - r^2 ) \, x_1 \, d w_1 \ - \ \sigma \, x_2 \, dw_2 \nonumber \\ dx_2 &=& \[ \( \beta ( 1 - r^2 ) \, + \, \omega \, r^2 \) \, x_1 \ + \ \( \alpha \, (1 - r^2 ) \, - \, (\sigma^2 / 2) \) \, x_2 \] \ d t \nonumber \\ & & \ + \ \sigma \, (1 - r^2) \, x_2 \, dw_1 \ + \ \sigma \, x_1 \, dw_2 \ . \label{eq:excart65} \end{eqnarray} We consider now the function $J = r^2$, and look at its variation on the dynamics \eqref{eq:excart65}. This yields \begin{eqnarray} dJ &=& \frac{\partial J}{\partial t} \, dt \ + \ \frac{\partial J}{\partial x_1} \, d x_1 \ + \ \frac{\partial J}{\partial x_2} \, d x_2 \ + \ \frac12 \, \Delta (J) \, d t \nonumber \\ &=& \[ \( 2 \, a \ + \ (1 - J) \, \sigma^2 \) \, J \, (1 - J) \] \ d t \ + \ 2 \, \sigma \, J \, (1 - J) \, d w_1 \ . \end{eqnarray} Thus we obtain that $J$ is \emph{not} an invariant; but it is a \emph{conditional invariant}: on the level sets $J=0$ (corresponding to the origin in the Cartesian plane) and $J=1$ (the unit circle in the Cartesian plane) we have $d J=0$, and hence these are invariant manifolds for the dynamics \eqref{eq:excart65}. Actually, passing to polar coordinates $(\rho, \theta)$ (on $\rho = 0$ the change of coordinates is singular, and $\theta$ ill-defined) the Eq \eqref{eq:excart65} reads simply \begin{eqnarray} d \rho &=& \alpha \, \rho \, (1 - \rho^2 ) \, dt \ + \ \sigma \, \rho \, (1 - \rho^2) \, d w_1 \nonumber \\ d \theta &=& \[ \beta (1 - \rho^2 ) \, + \, \omega \, \rho^2 \] \, dt \ + \ \sigma \, dw_2 \ . \label{eq:excart65polar} \end{eqnarray} It is thus evident that on $J=\rho^2 = 1$ the dynamics reduces to \begin{eqnarray*} d \rho &=& 0 \\ d \theta &=& \omega \, dt \ + \ \sigma \, dw_2 \ . \end{eqnarray*} It should be noted that, as immediately apparent from \eqref{eq:excart65polar}, in this case rotations in the $(x_1,x_2)$ plane are a symmetry of the full equation, and not only of the reduced one. We thus see again that one can have a conditional invariant associated to a full symmetry. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Example \ref{sec:examples}.5.} We generalize the previous Example; we use Cartesian coordinates $(x,y)$ and write again $r = \sqrt{x^2 + y^2}$. Consider the equations \begin{eqnarray} d x_1 &=& \[ \( (1 - r ) x_1 f_1 - x_2 f_2 \) - \frac{(1 - r)^2}{2} \( (s_{21}^2 + s_{22}^2 ) x_1 + 2 (s_{11} s_{21} + s_{12} s_{22} ) x_2 \) \] \ d t \nonumber \\ & & \ + \ (1-r) (s_{11} x_1 - s_{21} x_2 ) \, d w_1 \ + \ (1 - r) (s_{12} x_1 - s_{22} x_2 ) \, d w_2 \nonumber \\ d y &=& \[ \( x_1 f_2 + (1-r) x_2 f_1 \) + \frac{(1-r)^2}{2} \( 2 (s_{11} s_{21} + s_{12} s_{22} ) x_1 - (s_{21}^2 + s_{22}^2 ) x_2 \) \] \ d t \nonumber \\ & & \ + \ (1-r) \( s_{21} x_1 + s_{11} x_2 \) \ d w_1 \ + \ (1-r) \( s_{22} x_1 + s_{12} x_2 \) \ d w_2 \ . \label{eq:cartgen} \end{eqnarray} Here $f_i = f_i (x,y)$ and $s_{ij} = s_{ij} (x,y)$ are arbitrary smooth functions, and of course the system is written in this rather involved way so that it produces a simple result. We consider again the function $J= r^2$; it results that on solutions to \eqref{eq:cartgen} we have \begin{eqnarray*} d J &=& \[ (1 - r) \, J \, \( 2 f_1 (x,y) + s_{11}^2 + s_{12}^2 - r (s_{11}^2 + s_{12}^2) \) \] \, dt \\ & & \ + \ 2 \, (1 - r) \, J \, s_{11} \ d w_1 \ + \ 2 \, (1 - r) \, J \, s_{12} \, dw_2 \ . \end{eqnarray*} It is thus immediately apparent that $J$ is in general \emph{not} an invariant for \eqref{eq:cartgen}, but that it is always a conditional invariant on the circle $r=1$. Thus the latter is an invariant manifold for \emph{all} the equations of the form \eqref{eq:cartgen}. In fact, passing to polar coordinates $(r,\theta)$, and writing $$ F_i (r , \theta ) = f_i [x_1 (r,\theta) , x_2 (r,\theta)] \ , \ \ \ S_{ij} (r , \theta ) = s_{ij} [x_1 (r,\theta) , x_2 (r,\theta)] \ , $$ the Eq \eqref{eq:cartgen} reads simply \begin{eqnarray} d r &=& r \ (1 - r) \ \[ F_1 (r,\theta) \ d t \ + \ S_{11} (r,\theta) \ d w_1 \ + \ S_{12} (r,\theta) \ d w_2 \] \nonumber \\ d \theta &=& F_2 (r,\theta) \ dt \ + \ (1 - r) \ \[ S_{21} (r,\theta) \ d w_1 \ + \ S_{22} (r,\theta) \ d w_2 \] \ . \label{eq:cartgenpol} \end{eqnarray} Now, unless all the functions $F_i$ and $S_{ij}$ are actually independent of $\theta$, rotations are \emph{not} a symmetry of the full Eq \eqref{eq:cartgenpol}, and hence of the original Eq \eqref{eq:cartgen}. On the other hand, the equation reduced to the invariant manifold $r=1$ reads just \begin{equation} dr \ = \ 0 \ , \ \ \ d \theta \ = \ F_2 (1, \theta) \ d t \end{equation} (note this is a deterministic equation), and \emph{if} $F_2 (1,\theta)$ is independent of $\theta$, it has a rotational symmetry. On the other hand, if $F_2 (1,\theta)$ does actually depend on $\theta$, we do not have a rotational conditional symmetry, despite the presence of the conditional invariant $J$ on $r=1$. { } \hfill $\diamondsuit$ \medskip \subsection{Asymptotic symmetries} The reader has surely noted that, albeit we only discussed conditional symmetries and/or invariants in our previous Examples, these are actually tailored so to have asymptotic symmetries and/or invariants. We will look again at them under this point of view, but we will first consider an even simpler one dimensional Example. \medskip\noindent {\bf Example \ref{sec:examples}.6.} Consider the one-dimensional equation \begin{equation} d x \ = \ - \, \left( x \ + \ x^3 \right) \ d t \ + \ \sigma \, x \, d w \ ; \end{equation} in this case the invariant manifold is just the single point $x=0$; this is of course of little interest in itself. This equation does not have continuous symmetries (an obvious reflection symmetry $(x,t,w) \to (- x,t,w)$ is present), but as the dynamics is attracted towards $x=0$ we know that asymptotically the system dynamics will be described by its linearization \begin{equation} d x \ = \ - \, x \ d t \ + \ \sigma \, x \ d w \ . \end{equation} This has a scaling symmetry, \begin{equation} X \ = \ x \ \frac{\partial}{\partial x} \ := \ \varphi (x) \ \frac{\partial}{\partial x}\ ; \end{equation} thus we can just use the prescription discussed in Sect. \ref{sec:symmsto} and pass to the new variable $$ y \ = \ \int \frac{1}{\varphi (x)} \ d x \ = \ \log (x) \ . $$ Note here that we should actually write $y = \log (|x|)$ and distinguish the cases $x>0$ and $x<0$. This is just fine as $x=0$ is a barrier for this dynamics. We will then use $x > 0$ (so that in particular $\partial y / \partial x = 1/x$), and $x = \exp[y]$. A similar discussion would apply for $x < 0$. If we apply this transformation to the full equation, we get \begin{eqnarray*} d y &=& \frac{1}{x} \ d x \ + \ \frac12 \, \Delta (y) \, d t \\ &=& \frac{1}{x} \ \left[ - (x + x^3) \ dt \ + \ \sigma x \, d w \right] \ - \ \frac12 \, \sigma^2 \, dt \\ &=& - \, (1 + x^2 + \sigma^2/2) \, dt \ + \ \sigma \, d w \\ &=& - \, \[ \(1 + \sigma^2/2\) \, + \, e^{2 y} \] \, dt \ + \ \sigma \, d w \ . \end{eqnarray*} Now we should observe that we are interested in the region $x \approx 0$, i.e., $y \approx - \infty$; in this limit the term $e^{2 y}$ can be discarded. Actually, the $y$ dynamics will drive the system towards this limit. Thus in this asymptotic regime the dynamics is just governed by $$ d y \ = \ - \( 1 + \sigma^2/2 \) \, dt \ + \ \sigma \, dw \ ; $$ it is clear that this equation is readily integrated to $$ y(t) \ = \ y(t_0) \ + \ \( 1 + \sigma^2/2 \) \, (t-t_0) \ + \ [ w(t) - w(t_0)] \ , $$ and also that it admits $\partial_y$ as a symmetry. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Example \ref{sec:examples}.7.} Consider again the system of Example \ref{sec:examples}.2, i.e., \eqref{eq:ex_6_1}, which we rewrite here for ease of reference: \begin{eqnarray} d \rho &=& a \, (1 - \rho^2) \, \rho \, d t \ + \ \sigma \, (1 - \rho^2) \, d w_1 \nonumber \\ d \vartheta &=& \[ b \, (1 - \rho^2) \ + \ \omega \, \rho^2 \] \ d t \ + \ \sigma \, d w_2 \ . \label{eq:ex96} \end{eqnarray} The equation for $\rho$ is autonomous, and we readily note that $\rho = 1$ is an invariant manifold, and actually for $a > 0$ a weakly attractive one. It appears from \eqref{eq:ex96} that -- at least for $|\sigma| \ll 1$, i.e. when the drift overcomes the diffusion term -- the dynamics converges to the circle $\rho = 1$. Note this will be a weakly attracting manifold. We will thus linearize \eqref{eq:ex96} around $\rho = 1$; we do this by writing $$ \rho = 1 + \eta $$ and taking only first order terms in $\eta$. This yields \begin{eqnarray} d \eta &=& - 2 \, a \, \eta \, dt \ - \ 2 \, \sigma \, \eta \, dw_1 \nonumber \\ d \vartheta &=& \[ \omega \ + \ 2 \, \eta (\omega \, - \, b ) \] \, dt \ + \ \sigma \, dw_2 \ \label{eq:ex96red}. \end{eqnarray} The dynamics is attracted to $\eta = 0$ (corresponding to $\rho =1$) and on this it is described by $d \vartheta = \omega dt + \sigma dw_2$, while in the region around the attracting manifold it is described by \eqref{eq:ex96red}. The original Eq \eqref{eq:ex96} is rotationally invariant; this symmetry is also present in the reduced Eq \eqref{eq:ex96red}. Note also that the first equation in \eqref{eq:ex96red} admits $X = \eta \partial_\eta$ as a (scaling) symmetry; thus it can be integrated (passing to the variable $y = \log (\rho) = \log (1 + \eta)$), which yields $\eta = \eta (t)$ as an explicit function, depending on the realization of the Wiener process $w_1 (t)$. With this, the second equation in \eqref{eq:ex96red} is also readily integrated. It may be interesting to see what happens if we proceed in a slightly different way. We can perform the change of variables $y = \log (\rho)$ directly on the original equation \eqref{eq:ex96}; this yields in mixed notation (obviously we have a singularity at $\rho = 0$) for the first equation $$ dy \ = \ \[ \( a \, - \, \frac{\sigma^2}{2 \, \rho^2} \, + \, \frac{\sigma^2}{2} \) (1 - \rho^2) \] \ dt \ + \ \sigma \, \frac{1 - \rho^2}{\rho} \ d w_1 $$ Passing now to write $\rho = 1 + \eta$ as above, the full equation reads \begin{eqnarray*} d y &=& - \ \[ \eta \, (2 + \eta ) \, \( a \, - \, \frac{\eta (2 + \eta) \sigma^2}{2 \, (1 + \eta)^2} \) \] \ dt \ - \ \sigma \, \eta \, \frac{2 + \eta}{1 + \eta} \ d w_1 \ ; \end{eqnarray*} expanding in series at first order in $\eta$, we get $y = \log (1 + \eta) \simeq \eta$, hence $dy \simeq d \eta$, and $$ d \eta \ = \ - \, 2 \, a \, \eta \, dt \ - \ 2 \, \sigma \, \, \eta \, d w_1 \ , $$ where $|\sigma | \ll 1$ has been taken into account, exactly as before. { } \hfill $\diamondsuit$ \medskip \medskip\noindent {\bf Example \ref{sec:examples}.8.} Consider the equation \begin{eqnarray} d x_1 &=& \[ (1 - r) \, \( a \, x_1 \ - \ b \, x_2 \) \ - \ \omega \ x_2 \ - \ (\alpha^2 + \beta^2 ) (x_1/2) \] \ d t \nonumber \\ & & \ - \ \alpha \, x_2 \, d w_1 \ - \ \beta \, x_2 \, d w_2 \nonumber \\ d x_2 &=& \[ (1-r) \, \( b \, x_1 \ + \ a \, x_2 \) \ + \ \omega \, x_1 \ - \ (\alpha^2 + \beta^2 ) \, (x_2 / 2) \] \ d t \nonumber \\ & & \ + \ \alpha \, x_1 \, d w_1 \ + \ \beta \, x_1 \, d w_2 \ . \label{eq:exgenasy} \end{eqnarray} Here $a,b$ are real constants, $\alpha,\beta,\omega$ are arbitrary smooth functions of $x_1,x_2$. We assume $a > 0$ for definiteness. In this case the evolution of $J = r^2$ is given by $$ d J \ = \ 2 \, a \ r^2 \, (1 - r) \ d t \ ; $$ note this is a deterministic equation, so that any initial datum with $r \not= 0$ is attracted by the circle $r=1$. In this case, we have an invariant and \emph{strongly} attractive submanifold. Correspondingly, $J$ is a \emph{strongly asymptotic invariant}. Passing to polar coordinates, we have \begin{eqnarray*} d r &=& a \ r \ (1 - r) \ dt \\ d \theta &=& \[ b \, (1-r) \ + \ \omega \] \ d t \ + \ \alpha \ d w_1 \ + \ \beta \ d w_2 \ . \end{eqnarray*} Needless to say, the functions $\alpha,\beta,\omega$ should now be thought as functions of $(r,\theta)$; we will denote by $\^\alpha, \^\beta, \^\omega$ the restrictions of these to the circle $r=1$. On the invariant strongly attractive submanifold $r = 1$ the evolution is described by \begin{equation} d \theta \ = \ \^\omega (\theta) \ d t \ + \ \^\alpha (\theta ) \ dw_1 \ + \ \^\beta (\theta) \ d w_2 \ . \end{equation} It is rather clear that choosing suitably the functions $\alpha, \beta,\omega$ we can have different situations: \begin{itemize} \item If these do not depend on $\theta$, the full Eq \eqref{eq:exgenasy} is rotationally invariant, i.e., $X = - x_2 \partial_1 + x_1 \partial_2$ is a full symmetry of \eqref{eq:exgenasy}; \item If these do depend on $\theta$, but their restrictions $\^\alpha, \^\beta , \^\omega$ do not depend on $\theta$, then \eqref{eq:exgenasy} does not admit $X$ as a full symmetry, but admits it as a conditional symmetry on the invariant (and attractive) manifold $M_0$ identified by $r=1$; \item If (at least one of) the $\^\alpha, \^\beta , \^\omega$ depend on $\theta$, then \eqref{eq:exgenasy} does not even admit $X$ as a conditional symmetry. \end{itemize} It is maybe worth stressing again that in all these cases $J$ is a strongly \emph{asymptotic invariant}. { } \hfill $\diamondsuit$ \medskip \section{Discussion and conclusions} In many physically interesting situations, one observes that equations not enjoying a given symmetry can have special solutions which are symmetric. Even more frequently, the asymptotic behavior of the system under study is characterized in terms of symmetry, independently of the symmetry of initial conditions; typically this involves a simple, i.e., a rotational or a scaling symmetry. A theory of conditional and asymptotic symmetries for \emph{deterministic} equations has been developed in the literature. In the present paper, we have extended this theory to the case of \emph{stochastic} differential equations, considering also the interplay between (asymptotic) symmetry and (asymptotic) integrability for stochastic equations. A special role in this frame is played by (full or conditional or asymptotic) \emph{invariants} for stochastic equations. We have also shown by concrete (simple) examples how the theory developed here can be applied in practice. Our examples show that the interrelation between the presence of (conditional and/or asymptotic) symmetry and invariants is not unique: the presence of conditional of asymptotic configurational invariants is needed to have a conditional or asymptotic symmetries, but the converse is not true. Our discussion shows that the pre-existing theory for deterministic equations can be fully extended to stochastic ones, and the examples show that it can be applied with a well definite algorithm and standard computations; these were specially simple in the considered examples -- which were built precisely in order to show the conceptual issues without blurring them by computational details -- but our discussion shows that even in more involved cases (apart from computational complications) the procedure is rather straightforward. Needless to say, its success depends on the equations under study possessing the required (full, conditional or asymptotic) symmetry properties. Symmetry is a non-generic property; but conditional or even more asymptotic symmetry is more common than full symmetry, so we are confident that our method can be widely applicable, as it already happens in the context of deterministic equations. Our approach was focusing -- again, as in the deterministic case -- on \emph{continuous} (Lie) symmetries. At difference with the deterministic case, we have dealt only with ordinary stochastic differential equations, and not discussed partial stochastic differential equations. The reason for this is that a symmetry theory for these equations is not as well developed as for ordinary ones; we expect that once this (substantial) obstacle is removed, the theory can be extended from full to conditional and asymptotic symmetries as in this work. In view of the relevance of conditional and asymptotic symmetries for the study of deterministic PDEs, we expect this extension to stochastic PDEs to be specially relevant for applications, and we hope it may soon be obtained. Finally, we would like to note that in a way the approach pursued in the literature dealing with conditional or asymptotic symmetries is inverse to that of the well known \emph{symmetry breaking} approach. In that case, attention is focused on the fact that equations possessing a given symmetry $G$ can have solutions which are invariant only under a subgroup $G_0 \subset G$ (possibly with $G_0 = \{ I \}$); here instead one is focusing on the fact that an equation possessing a symmetry $G_0$ (possibly with $G_0 = \{ I \}$) can have solutions with symmetry $G \supset G_0$. Similarly, for an equation with symmetry $G_0$ it may happen that the asymptotic dynamics is described by an effective equation with symmetry $G \supset G_0$, and this is turn may have solutions with symmetry $G$ or even $\wt{G} \supset G \supset G_0$. \addcontentsline{toc}{section}{Acknowledgements} \section*{Acknowledgements} The work of GG is also supported by SMRI, which he was visiting while the first draft of this paper was prepared and again at the time of final writing. The work of FS is supported by ERC SG CONSTAMIS grant. GG and FS are also members of GNFM-INdAM. We thank these Institutions for their support. \addcontentsline{toc}{section}{References}
\section{INTRODUCTION} In heterogeneous catalysis, metal nanoparticles supported on reducible oxide structures provide unique interfacial interactions which lead to the formation of active sites at the three-phase boundaries which control activity and selectivity for oxidation reactions~\cite{peter_nchem2011,yusuke_nchem2011}. Many high-performance heterogeneous catalysts have been developed which exploit the metal/oxide interface properties for reactions such as CO oxidation at room and low temperature~\cite{jian_jacs2019,shaofei_acscatal2019,huiyuan_jacs2015,yarong_acsapplmaterinter2020}. The ability of reducible oxides to donate lattice oxygen during a reaction (the so-called Mars van Krevellen mechanism) was first described nearly 70 years ago and is now an accepted kinetic pathway for many reactions~\cite{mars_ces1954}. The atomic level details of how such a mechanism operates especially in the presence of metallic nanoparticles remains poorly understood. Tauster was one of the first to recognize the unique properties of the metal-support interaction (MSI) with his observation of metal nanoparticles being encapsulated with thin overlayers under strong reducing condition~\cite{tauster_jacs1978,tauster_science1981,tauster_acr1987}. The strong MSI has been realized in redox transition metal oxides~\cite{tauster_jacs1978,tauster_science1981,tauster_acr1987,hailian_sciadv2017} and even a relatively redox-inert alkaline metal oxide MgO~\cite{wang_nature2021}. The MSI is also associated with occurrence of charge transfer at the interface~\cite{gianfranco_csr2018}. Campbell proposed the electronic MSI mechanism, in which charge transfer at the metal/oxide interface modulates chemical activity of the supported catalyst \cite{charles_natchem2012}. The electronic MSI gives rise to a rearrangement of electrons within the interface and enhances the rate of surface oxygen vacancy creation/annihilation leading to an enhanced catalytic activity~\cite{gianfranco_pccp2013}. To manipulate the role of the interfacial interactions on a catalytic reaction, the nanoparticle size can be varied to change the contact area between the metal and support interface~\cite{insoo_acscatal}. For Au/Co$_{3}$O$_{4}$ and Au/Fe$_{2}$O$_{3}$, the gold nanoparticles with a diameter smaller than 5 nm show high reaction activity~\cite{masatake_catatoday1997} and Pt particles of 2-3 nm were found to be more active for CO oxidation~\cite{alexey_applcatab2012}. In the limiting case, the metal nanoparticles may be reduced all the way down to a single atom, giving rise to the so-called single atom catalysts~\cite{liu2017catalysis}. Another approach to manipulate catalytic activity is by tuning the interfacial interaction directly. This has been realized by varying the support type, particles shape and size. The aforementioned nanostructuring creates new metal-support interaction resulting in the metal nanoparticle properties being substantially different from their bulk counterparts~\cite{insoo_acscatal}. Doping oxides by heteroatoms can modify the electronic structure. They enhance surface oxygen reducibility by tuning the interfacial interaction~\cite{antonio_acscatal2017}. The increased oxide reducibility linked to surface oxygen vacancy formation energy is an indispensable element in oxidation reactions based on the Mars-van Krevelen mechanism~\cite{antonio_acscatal2017,yang_jacs2013,huan_ass2014,kuo_acscat2012,daniel_ang2011,hyun_jacs2011}. In combination with the smaller nanoparticles, nano-structured oxide supports further lower the surface oxygen vacancy formation energy and gives rise to a reverse spillover of the surface oxygen on to the Pt nanoparticle~\cite{georgi_nature2011}. These works highlight the importance of undertaking fundamental studies to elucidate the complex interfacial interaction underlying catalytic functionality. There remain a paucity of information about the atomic structure and structural dynamics of an active metal-support interface performing catalysis. Recently, there has been an emerging paradigm that has roots in surface science~\cite{somorjai1991flexible,imbihl1995oscillatory,ertl2008reactions} and chemistry~\cite{cotton1975fluxionality} for understanding catalytically active sites in terms of dynamic, meta-stable, or so-called fluxional species from both computation~\cite{zhang2020ensembles,sun2018metastable,zhai2017fluxionality} and experimental work~\cite{lawrence2021atomic,li2021dynamic,vincent2021fluxional}. This has raised many questions regarding both the fundamental structure of active sites and the atomic scale evolution of the interface, metal particle, and adjacent oxide surface during catalysis. For example, what is the dynamic nature of the metal-support interface? The adhesion between the metal particle and support may weaken significantly since bridging oxygen are responsible for anchoring the metal to the support. How does the metal-support interface change in the presence of reactant adsorbates and reaction intermediates? How do such structural changes impact activation of intermediates and facilitate the bond breaking and formation along the reaction pathways? What happens during the rate limiting step and where is the likely site for CO$_{2}$ formation and desorption. In order to deepen our understanding of the factors affecting catalysis and to develop strategies for improved catalyst design, it is essential to elucidate and describe the structural evolution that occurs at the atomic level during simultaneous catalytic turnover. In this work, we investigated the interfacial interaction of ceria-supported Pt nanoparticles by density functional theory (DFT) simulations. We found that spins are polarized on the CeO$_{2}$-(111) surface through charge transfer from surface oxygen to cerium, which can significantly lower the oxygen vacancy formation energy and alter the interfacial interaction between Pt nanoparticle and ceria support. In turn, the activated surface plays an essential role in lowering the major activation barrier in the proposed reaction pathway of CO oxidation on the ceria-supported Pt nanoparticles. Using the existence of a robust surface spin polarization, we propose a theoretical description of the recently observed controversial room temperature magnetism in ceria nanostructures~\cite{karl_physrep2018}. \section{Computational Methods} We used the slab model with five O-Ce-O layers to simulate the CeO$_{2}$-(111) surface with a 6 $\times$ 6 reconstruction of the primitive unitcell. Experimental lattice constants ($a$=$b$=5.410 $\textrm{\AA}$)~\cite{lc_exp} of ceria with 15 $\textrm{\AA}$ vacuum along the $z$ direction have been used throughout. To make Pt(111) interface with CeO$_{2}$-(111), a hexagonal Pt$_{19}$ single layer (SL) was built. As initial structure for geometry optimization, we have located the center of Pt$_{19}$ SL 2.5 $\textrm{\AA}$ above oxygen on the CeO$_{2}$-(111) surface, while Pt$_{19}$ SL [100] and CeO$_{2}$ [110] are coincided. This model was relaxed at the level of DFT by using the CP2K package~\cite{cp2k}. In CP2K, the wavefunction was expanded in the double $\zeta$ valence plus polarization and plane-wave basis sets with an energy cutoff of 400 Ry. We used Geodecker\text{-}Teter\text{-}Hutter pseudopotentials~\cite{cp2k_potential} based on the GGA~\cite{pbe} functional. The van der Waals interaction was also considered according to the DFT-D3 scheme~\cite{stefan_jcp2010}. For all spin polarized calculations, half spin moments on Pt and Ce atoms were given as the initial guess. To account for the strongly correlated nature of Ce's 4$f$ electrons, we employed the DFT+$U$ method with $U$ = 7 eV, as suggested by the previous studies ~\cite{he2018size,yang_ncomm2014}. To check the effect of $U$, we also repeated some representative calculations using $U$ = 4 eV. The climbing image-nudged elastic band (CI-NEB) method ~\cite{cineb} was used to simulate the activation barriers for the proposed reaction pathway of CO oxidation on the ceria-supported Pt nanoparticles. To find surface spin polarization effect on the lattice dynamic reconfiguration, we performed the \textit{ab-initio} molecular dynamic (AIMD) simulation at 300 K with 1 fs time step using Nose-Hover thermostat. To prevent high computational cost, only three layers of O-Ce-O were considered in the AIMD simulation. In all simulations, the atoms on the lowest O-Ce-O layer were kept fixed. From the aforementioned DFT simulations, we obtained the adsorption energy using the following equation: \begin{equation} E_{\textrm{ads}}=E_\textrm{(slab\_adsorbate)}-E_\textrm{slab}-E_\textrm{adsorbate} \end{equation} where $E_\mathrm{\text{(slab\_adsorbate)}}$ is the energy of optimized slab model with adsorbates, $E_\mathrm{\text{slab}}$ is the energy of pure surface slab, and $E_\mathrm{\text{adsorbate}}$ is the energy of adsorbate, respectively. Oxygen vacancy formation energy is \begin{equation} E_{\textrm{Vo}}^{\textrm{F}}=E_\textrm{(slab\_Vo)}-E_\textrm{slab}+1/2E_{\textrm{O$_{2}$}} \end{equation} where $E_\mathrm{\text{O}_{2}}$ is the total energy of the ground (triplet) state of oxygen molecule in the gas phase. Surface energy of slab is defined by \begin{equation} E_{\textrm{surf}}=(E_\textrm{slab}-nE_\textrm{bulk})/(2S) \end{equation} where $n$ is the number of formula unit in the slab, and $S$ is the surface area. \section{RESULT AND DISCUSSIONS} \begin{figure}[ht] \centering \includegraphics[width=0.46 \textwidth]{Fig_dos.jpg} \caption{\label{Fig_dos} Calculated surface spin polarization and surface oxygen vacancy. (a) Optimized CeO$_2$-(111) surface. Green (blue) vector denotes calculated Mulliken up (down) spin population multiplied by scale factor 2.0 for visualizing the moment (Note that the same scale factor is used for all figures in this work). For clarity, only the spin population larger than 0.20 $\mu_{\textrm{B}}$ is shown here. The lower inset shows the scale of vectors. (b) Calculated surface layer projected density of state. The density of state of upper oxygen and cerium layers marked by grey box in (a) are shown. The blue (red) arrows denote the relative shifts of Ce-$f$ (O-$p$) states between SP and NSP simulations. (c) Optimized surface geometry with oxygen vacancy. (d) Calculated surface layer projected density of state for the oxygen vacancy configuration. The blue (gray) arrows point to defect states obtained from SP (NSP) simulation. In (c) and (d), the zero of energy set to chemical potential of up spin from spin polarized simulation, and relative chemical potentials are marked by solid (dashed) vertical lines for SP (NSP) simulation.} \end{figure} \subsection{Surface spin polarization} We first performed the geometry optimization with initial magnetic moment on all cerium atoms to include surface spin polarization explicitly. Fig. \ref{Fig_dos}a shows the optimized CeO$_{2}$-(111) surface where spins are polarized. The average Mulliken spin moment per atom is 0.60 (-0.35) $\mu_{\textrm{B}}$ on the uppermost cerium (oxygen) layer. This structure contains spin polarization on both top and bottom O-Ce-O surface layers. The spin polarization in the bottom layer (with frozen atoms) is weaker than that in the upper layer (with free atoms), indicating a Jahn-Teller effect ~\cite{guiling_jmmm2018,pentcheva_prl2005,yasemin_jssc2013,zywietz_prb2000}. Fig. \ref{Fig_dos}b shows the projected density of states (DOS) of surface layers. For a comparison, the DOS without spin polarization is also shown here. The spin polarized DOS near the Fermi energy is comprised of appreciable hybridization between Ce-$f$ and O-$p$ orbitals. The occupied (unoccupied) up spin states derived by bonding (antibonding) of Ce-${f}$ and O-${p}$ characters form the narrow bands. The exchange splitting is explained by comprehensive comparison of spin polarized (SP) and non-spin polarized (NSP) DOS. Compared to the NSP system, the Ce-${f}$ states were split into the unoccupied down spin states and occupied up spin state (see the blue arrows in Fig. \ref{Fig_dos}b). In consequence, the net up spin moment is populated on surface cerium atoms. On the other hand, the original O-${p}$ states (from NSP calculation) were pushed up into unoccupied state in up spin and pushed down into lower energy states in down spin (see the red arrows in Fig. \ref{Fig_dos}b), resulting a population of the net down spin moment on surface oxygen atoms. Compared to the NSP calculation, the inclusion of spin polarization lowers the total energy by 7.83 eV. The energy drop is derived by just outermost two O-Ce-O layers (surface layers) where spins are polarized, since there is no sizeable spin polarization on other layers. Accordingly, the energy gain corresponds to 3.92 eV per surface layer or 0.11 eV per O-Ce-O in the surface layer (there are 36 O-Ce-O units in the surface layer). One can confirm that this estimation is appropriate based on constant total energy difference between SP and NSP systems with respect to number of layers, as shown in Table.~\ref{table_layers}. This significant energy difference indicates the existence of a strong spin polarization on CeO$_{2}$-(111) surface. We did not find any antiferromagnetic configuration in this system. Therefore, we conclude that the CeO$_{2}$-(111) surface is ferromagnetic. While the room temperature magnetism in CeO$_{2}$ has been studied extensively, its origin remains unclear~\cite{karl_physrep2018}. Here, we propose a new theoretical description of the room temperature ferromagnetism in undoped ceria nanostructure~\cite{anwar_ml2011,mingjie_apl2009,novica_nano2012,sumalin_eml2015,sundaresan_nanotoday2009,yinglin_jpcm2008,zhang_nano2010} and thin films~\cite{fernandes_essl2011,fernandes_jpcm2010,fernandes_prb2009,gao_lang2008,nicholas_rsc2016}. It was suggested that the ferromagnetism is confined to the ceria nanostructure surface where oxygen vacancy may play an important role~\cite{sundaresan_nanotoday2009,sumalin_eml2015,fernandes_essl2011}. On the contrary, Li \textit{et al.} \cite{mingjie_apl2009} and Liu \textit{et al.} \cite{yinglin_jpcm2008} proposed that the ferromagnetism does not relate to the surface oxygen vacancy but to the surface Ce$^{3+}$/Ce$^{4+}$ pairs. A number of DFT studies have attributed the ferromagnetism to native defects such as oxygen vacancy. The defect formation causes spin polarization of ${f}$ electrons for Ce ions near the vacancy, resulting in a nonzero net magnetic moment on the ceria surface~\cite{fernandes_prb2009,ge_apl2008,hachimi,keating_jpcc2011,ribeiro_prb2017,xiaoping_jpcc2016,xiaoping_prb2009}. Nevertheless, based on our results, the ferromagnetism may emerge in a bare surface without any defect or impurity. In general, it was perceived that ions on the surface with lower coordination numbers can cause an unusual spin population ~\cite{renan_ass2018,ameerul_ass2018,munoz_jem2010}. In our case, vacuum acts as a virtual doping on the surface: hole doping for oxygen layer lowering the chemical potential of surface oxygen and electron doping for cerium layer. Upon significant spin exchange interaction on the surface, the virtual doping leads to a charge transfer from oxygen layer to cerium layer, resulting in Ce$^{4+} \rightarrow$ Ce$^{3+}$ transition and partially filled O-${p}$ on the surface layer (see Figure \ref{Fig_dos}a-b). In consequence, the spin on ions couples ferromagnetically, which gains significant energy comparing to the NSP system. In addition, we emphasize that the charge transfer is fully triggered by the surface effect. As shown in Table~\ref{table_layers}, increasing the number of layers reduces the surface/bulk ratio, resulting in an increased chemical potential which approaches to that of the bulk, while other quantities show no sizeable variation. \begin{table}[ht] \begin{center} \begin{threeparttable} \caption{The slab size effect on surface spin polarization. The O1 (O2) denotes oxygen atoms on the top (bottom) layer within the surface O-Ce-O layer. The calculated quantities by surface spin polarized (SP) and non-spin polarized (NSP) simulations are presented. $E_{\textrm{surf}}$ is the calculated surface energy. $E_{\textrm{F}}^{\textrm{bulk}}$ and $E_{\textrm{F}}^{\textrm{slab}}$ are the Fermi energies for ceria bulk and slab, respectively. $E_{\textrm{SP}}$ and $E_{\textrm{NSP}}$ are total energies of SP and NSP systems, respectively. \{O-Ce-O\}$_{\textrm{surf}}$ denotes O-Ce-O in the surface layer. }\label{table_layers} \begin{tabular}{ccccccc} \toprule \hline\hline \multicolumn{2}{c}{} & \multicolumn {5}{c}{~~~~Number of O-Ce-O layers~~~~} \\\midrule \cline{3-7} \multicolumn{2}{c}{} & 3 & 5 & 7 & 9 & 11\\ \hline \multirow{3}{*}{ \makecell{~~~~Spin population~~~~\\in surface layer\\ ($\mu_{\textrm{B}}$/atom) } } & Ce & 0.55 & 0.60 & 0.58 & 0.56 & 0.56 \\ & O1 & -0.32 & -0.35 & -0.34 & -0.33 & -0.33 \\ & O2 & -0.19 & -0.20 & -0.20 & -0.20 & -0.20 \\ \hline \multirow{2}{*}{$E_{\textrm{surf}}$ (J/$\textrm{m}^{2}$)\footnote{a} } & SP & 0.94 & 0.94 & 0.95 & 0.95 & 0.96 \\ & NSP & 1.07 & 1.08 & 1.08 & 1.08 & 1.08 \\ \hline \multirow{2}{*}{$E_{\textrm{F}}^{\textrm{bulk}}$ - $E_{\textrm{F}}^{\textrm{slab}}$ (eV)} & SP & 8.34 & 6.86 & 5.59 & 4.70 & 4.04 \\ & NSP & 8.44 & 6.93 & 5.64 & 4.77 & 4.12 \\ \hline \multicolumn{2}{c}{ \makecell{$E_{\textrm{SP}}$-$E_{\textrm{NSP}}$ \\ (eV/\{O-Ce-O\}$_{\textrm{surf}}$ )} } & -0.11 & -0.11 & -0.10 & -0.10 & -0.10\\ \hline\hline \end{tabular} \begin{tablenotes} \item[a] Experimental surface energy is 1.2 $\pm$ 0.2 J/$\textrm{m}^{2}$ ~\cite{shmuel_jacs2011}. \end{tablenotes} \end{threeparttable} \end{center} \end{table} \begin{figure* \centering \includegraphics[width=0.99 \textwidth]{Fig_ov_list.jpg} \caption{\label{Fig_ovlist} Low-energy oxygen vacancy structures. In the sub-figures, the left panel shows the calculated Mulliken up (down) spin population ($\mu_{\textrm{B}}$) denoted by Green (blue) vector. The right panel shows wavefunction isosurface ($0.05 e/\textrm{\AA}^{3}$) of the localized defect states. The yellow/cyan (green/blue) correspond to positive/negative wavefunction of spin up (down) defect state. (a) the most stable configuration, one spin up excess electron at three nearest neighbor Ce atoms and the other spin down excess electron at next nearest neighbor Ce atom, (b) one spin down excess electron at nearest neighbor two Ce atoms and the other spin up excess electron at nearest neighbor Ce atom, (c) one spin down excess electron at the nearest neighbor Ce atom and the other spin up excess electron at next nearest neighbor Ce atom, (d) one spin up excess electron at the nearest neighbor Ce atom and the other spin down excess electron at next nearest neighbor Ce atom, (e) two excess electrons at nearest neighbor Ce atoms, (f) two excess electrons at next nearest neighbor Ce atoms, and (g) one spin up excess electron at three nearest neighbor Ce atoms and the other spin down excess electron at Ce atom in the middle layer.} \end{figure*} On account of the robust surface spin coupling, we investigated the impact of surface spin polarization on surface oxygen vacancy formation. Figure \ref{Fig_dos}c-d show the optimized structure, spin population and DOS of surface layer with oxygen vacancy. In the SP simulation, the two excess electrons produced by the oxygen vacancy are populated on neighboring cerium atoms forming localized polaronic states. One electron was captured by three nearest neighboring Ce atoms, with the spin moments of 0.82, 0.68 and 0.70 $\mu_{\textrm{B}}$, respectively. The other electron was localized on the next nearest neighboring Ce atom with 0.98 $\mu_{\textrm{B}}$ down spin moment having antiferromagnetic coupling with the surrounding Ce atoms (see Fig.~\ref{Fig_ovlist}a). The latter is associated with the increased local spin moment by Hund's rule within our singlet simulation. The oxygen vacancy defect states in the SP system are shallow, whereas the same defect states are below conduction band minimum in the NSP system. With this configuration, we found the lowest surface oxygen vacancy formation energy is 0.38 eV in the surface spin polarized system. In contrast, the NSP simulations show higher oxygen vacancy formation energy values: 4.06 eV ($U$ = 7 eV) and 3.04 eV ($U$ = 4 eV), as compared to several previous reports ranged from 2.13 to 3.20 eV \cite{song_surfcesi2013, hui_prb2009, zhang_nano2010, veronica_prl2009}. Note that two electrons are almost equally populated on two nearest neighbor Ce atoms and one next nearest neighbor Ce in our NSP simulation. In the SP system, the less ionized oxygen ions bond weakly with cerium ions, resulting in lower cost of vacancy formation in comparison to NSP system which does not involve charge transfer process. Therefore, our results indicate that surface spin polarization can lower the oxygen vacancy formation energy, and enhance the oxide reduciblility of the CeO$_{2}$-(111) surface. \begin{figure}[ht] \centering \includegraphics[width=0.45 \textwidth]{Fig_SL.jpg} \caption{\label{Fig_SL} Optimized Pt single layer on ceria. (a) Pt$_{19}$ single layer on a non-spin polarized CeO$_2$-(111) surface. (b) Pt$_{19}$[CO]$_{12}$ on a non-spin polarized CeO$_2$-(111) surface. (c) Pt$_{19}$ single layer on a spin polarized CeO$_2$-(111) surface. (d) Pt$_{19}$[CO]$_{12}$ on a spin polarized CeO$_2$-(111) surface. The side view of the structures are shown in the top panel. The calculated bond lengths ($\textrm{\AA}$) between Pt and surface oxygen are shown in the middle panel.} \end{figure} In addition to the most stable oxygen vacancy defect state, we found several other low-energy spin configurations. In Fig.~\ref{Fig_ovlist}c, local spin moments on two Ce atoms are exchanged in comparison to the most stable configuration in Fig.~\ref{Fig_ovlist}a. This vacancy configuration gives rise to down spin flipping on another nearest neighbor Ce atom and cause an increase in formation energy of 0.2 eV from the most stable oxygen vacancy. In the configuration of Fig.~\ref{Fig_ovlist}b, one electron was equally distributed on two nearest neighbor Ce atoms which have down spin moment of 0.75 $\mu_{\textrm{B}}$ opposite to the majority up surface spin. This configuration leads to increased formation energy of 0.18 eV in comparison to the most stable oxygen vacancy. These indicate that surface spins favor ferromagnetic coupling with excess electrons. In Figure~\ref{Fig_ovlist}d-f, we found very localized defect states with a Mulliken population close to 1.0 $\mu_{\textrm{B}}$ on two Ce atoms. However, that localization does not only weaken ferromagnetic coupling by producing opposite spin moments on the surface, but also increases the repulse Coulomb interaction between excess electrons, resulting in a higher formation energy. In particular, the configuration of Fig.~\ref{Fig_ovlist}f, where two excess electrons are localized on next nearest neighbor Ce atoms, was reported as the most stable oxygen vacancy state by other DFT studies~\cite{song_surfcesi2013,hui_prb2009,zhong_prm2018}. However, the configuration is no longer the ground state by considering the spin effect. As shown in Fig.~\ref{Fig_ovlist}g, we also found outstanding oxygen vacancy configuration to be energetically degenerated with the most stable oxygen vacancy configuration. One defect state located on three nearest neighbor Ce atoms increasing spin moment ~0.75 $\mu_{\textrm{B}}$ around oxygen vacancy in the ferromagnetic coupling, whereas the other excess electron is moved to the farthest site from surface, which has no spin coupling. In comparison to total spin population on oxygen layer of the most stable configuration, this configuration further increased total spin moment of 0.58 (0.39) $\mu_{\textrm{B}}$ on the uppermost (middle) two oxygen layers. This ascertains additional charge transfer to localize the excess electrons. These configurations suggest that even in the presence of oxygen vacancies, there is still surface spin polarization, and it can even be enhanced for some vacancy configurations as shown in Fig.~\ref{Fig_ovlist}. \begin{figure*}[!htb] \centering \includegraphics[width=0.98 \textwidth]{Fig_MVK_ver3.jpg} \caption{\label{Fig_MvK} (a) The calculated energy profiles for proposed reaction pathway for CO oxidation on Pt$_{19}$[CO]$_{11}$ with the ceria support. The black solid (blue dotted) lines show the calculated energy profiles by using $U$ = 7.0 (4.0) eV from the spin polarized simulations. The black dashed lines show the calculated energy profiles by using $U$ = 7.0 eV from the non-spin polarized simulations. TS1 and TS2 denote two transition states. CO is absorbed on green colored Pt atom. C (O) atoms involved in the reaction were colored by black (yellow). (b) Calculated surface oxygen vacancy formation energies within SP simulations. Filled circles represent the formation energies at corresponding sites. The surface oxygen which react with CO was marked by the red box. The surface oxygen with exceptional low vacancy formation energy was marked by the green circle. The energy level of oxygen vacancy formation for the most stable configuration on bare ceria surface is marked by red line on the energy color bar.} \end{figure*} \subsection{Pt on the ceria support with CO} To date, surface spin polarization has not been taken into account for nano-structured heterogeneous catalysts. Hence we investigated the influence of surface spin polarization on the interaction between Pt nanoparitcle and ceria. As shown in Fig.~\ref{Fig_SL}a, the optimized Pt$_{19}$ SL on CeO$_{2}$-(111) consisted of platinum and surface oxygen (O$_{\textrm{surf}}$) bonds mostly on perimeter of the SL in NSP simulation. On the other hand, the SP simulation (see Fig.~\ref{Fig_SL}c) generates a configuration with more Pt-O$_{\textrm{surf}}$ bonds. In addition, the averaged bond length is also shorter than that of the NSP configuration. This indicates that the interaction between ceria surface and Pt$_{19}$ SL is significantly enhanced by the surface spin polarization. We attribute the strong Pt-O$_{\textrm{surf}}$ bonds to electron depletion oxygen layer by the charge transfer on the spin polarized surface, where Pt atoms are more prone to oxidation. The enhanced interfacial interaction induces spin moments on Pt and Ce atoms and coupling between them. The surface oxygens were pulled out from ceria surface by this interaction. As a result, the donation of Pt valance electrons to surface oxygens increases the unpaired spin density around the Pt site. The pronounced on-site spin populations on Pt atoms are denoted in Fig. \ref{Fig_SL}c. The interfacial interaction also affects the electronic configuration of Ce atoms on the surface layer. The less oxidized Ce atoms has a large unpaired spin population which couples with the polarized Pt spins through surface oxygen. The majority of magnetic coupling is antiferromagnetic, resulting in a zero net spin moment on the intermediate surface oxygen. Our simulation shows that adsorption energy of CO on the spin polarized CeO$_{2}$-(111) surface is -0.31 eV (see Fig. S1). The result agrees with previous observations that CO on CeO$_{2}$-(111) surface is either unstable or has weak interaction with the surface~\cite{fendy_pccp2012,huang_jpcc2008,michael_jpcc2006} (see Section B in the SI). In terms of CO's adsorption energy on the ceria-supported Pt nanoparticle, our calculation reveals a wide distribution from -3.14 to -1.02 eV, depending on the choice of adsorption sites (see Fig. S2). These results indicate that CO molecules are strongly adsorbed on Pt nanoparicles~\cite{yubing_ccc2020}. In this work, we constructed ceria-supported Pt$_{19}$ SL with 12 CO molecules which were initially located at the bridging sites of the perimeter of Pt$_{19}$. Optimized geometries of Pt$_{19}$[CO]$_{12}$ with/without surface spin polarization are shown in Fig. \ref{Fig_SL}b and d. We again observed that surface spin polarization enhances the interaction between Pt$_{19}$[CO]$_{12}$ and ceria, i.e., more bonds and shorter bond lengths. Fig. \ref{Fig_SL} shows that the CO adsorption on Pt$_{19}$ breaks a few Pt-O$_{\textrm{surf}}$ bonds on the perimeter of Pt$_{19}$ in both NSP and SP calculations. Thus, the adsorption weakens the interfacial interaction. The weakening can be understood from Mulliken spin population analysis in the SP system. The strong CO adsorption on Pt$_{19}$, due to the $\pi$-back bonding between Pt and CO~\cite{suparna_crssms2015}, can reduce the donation of Pt's valence electron to surface oxygen. As a result, the pairing electrons on Pt atoms decreases the net spin moment on the Pt$_{19}$ (see Figure \ref{Fig_SL}c-d). \subsection{Reaction pathway in CO oxidation} \begin{table}[] \caption{The list of activation barriers in energy profiles for proposed reaction pathway. The major activation barriers are hilighted in bold.}\label{table_energy} \begin{tabular}{lcccc} \hline\hline Calculation Type& Parameter & \multicolumn{3}{c}{Reaction Barrier (eV)} \\ & $U$ (eV) & ~~~TS1~~~ & ~~~-CO$_2$~~~ & ~~~TS2~~~ \\\hline Spin Polarization & 7.0 & 0 & \textbf{1.05} & 0.29 \\ Spin Polarization & 4.0 & 0 & \textbf{0.47} & 0.11 \\ Non-spin Polarization & 7.0 & 0.82 & \textbf{2.19} & 0.65 \\ \hline\hline \end{tabular} \end{table} We found that surface spin polarization may play an important role in the catalytic activity. On a spin polarized surface, the electrophilic oxygens in the electron deficient condition are more reactive with other species in comparison to the NSP system. In addition, new species formed by the reaction are easily removable owing to the high reducibility on the spin polarized surface. The impact of spin polarization on surface catalytic activity is illustrated in Fig. \ref{Fig_MvK}a. We started with a CO desorpted Pt$_{19}$[CO]$_{11}$ with ceria support in CO rich conditions. The Pt$_{19}$[CO]$_{11}$ can adsorb one more CO molecule to form Pt$_{19}$[CO]$_{12}$, with a shallow adsorption energy of -0.08 eV. The adsorbed CO reacts with O$_{\textrm{surf}}$ to form CO$_{2}$, gaining an energy of 2.60 eV. While there is no activation barrier for the reaction in the SP system, \textbf{}calculated activation barrier is 0.82 eV in the NSP system. Taking off the CO$_{2}$ molecule from the reaction site leaves a surface oxygen vacancy, costing an penalty energy of 1.05 eV for $U$ = 7 eV (0.47 eV for $U$ = 4 eV). This is the main barrier in the proposed reaction pathway\textbf{.} The Pt SL can subsequently adsorb another incoming CO, while the ceria surface can attract O$_2$ at the oxygen vacancy site. The molecular O$_2$ and CO further react to form a new CO$_{2}$. The calculated activation barrier for the reaction are 0.29 ($U$ = 7 in the SP system), 0.11 ($U$ = 4 in SP system), and 0.65 ($U$ = 7 in the NSP system) eV, respectively. Thereafter, the catalytic cycle is completed by desorption of the CO$_{2}$, which is an exothermic process releasing energy of 1.74 eV to recover to Pt$_{19}$[CO]$_{11}$. This proposed reaction pathway is manifested by MvK mechanism~\cite{mars_ces1954}. The simulated reaction pathway using $U$ = 4 eV has the same trend with $U$ = 7 eV, as shown in Fig.~\ref{Fig_MvK}a. However, the NSP system shows different reaction energy profiles from the SP system. Table.~\ref{table_energy} summarizes the activation barriers for each system. The major activation barriers (0.47-1.05 eV) of the SP system are apparently close to the measured activation energies ranging from 0.37 to 0.77 eV~\cite{yubing_ccc2020,jun_acscata2015,matteo_science2013,rene_angcom2015,vincent2021fluxional}, while the NSP system has a much higher barrier (2.19 eV). The elevated barrier in the NSP system is caused by high formation energy of oxygen vacancy, that hampers the release of CO$_{2}$ from the surface. \begin{figure*}[ht] \centering \includegraphics[width=0.98 \textwidth]{Fig_md.jpg} \caption{\label{Fig_md} (a) The snap shot of NSP AIMD simulation of the ceria-supported Pt$_{19}$ single layer with 12 CO molecules at 0, 9 and 14 ps. (b) The snap shot of SP AIMD simulation of the ceria-supported Pt$_{19}$ single layer with 12 CO molecules at 0, 2 and 3.4 ps. The red box shows that the CO and surface O bind to form CO$_{2}$. (c) Left panel: calculated distance between the average z coordinates of surface Ce atoms and the average z coordinates of Pt atoms, right panel: standard deviation of z coordinates of Pt atoms. (d) Schematic diagram of lattice dynamic in SP and NSP systems. (e) Atomic resolution transmission electron microscope images of fluxional Pt nanoparticle on CeO$_{2}$-(100) surface in a CO atmosphere (7 x 10$^{-4}$ Torr) at room temperature. Pt columns are visible as white dots whereas (100) Miller planes in CeO$_{2}$ appear as white horizonal lines. The two images are from the same nanoparticle with right-hand image recorded ~0.5s after the left-hand image. The Pt nanoparticles undergoes 7.5\textdegree ~clockwise rotation resulting in Pt (111) becoming approximately parallel to (100) CeO$_{2}$ plane (see red dotted guide to eye on right-hand panel). The Pt atomic plane near the CeO$_{2}$ is not straight and curves up on left-hand side and also the atomic columns on the right are slightly blurred suggesting a high degree of instability in their position. Other changes in the Pt surface structure are apparent due to the strong interaction with CO.} \end{figure*} In addition to lowering the activation barrier, the surface spin polarization enables the adsorbed CO on Pt SL to react with O$_{\textrm{surf}}$ to form CO$_{2}$. While this reaction is endothermic in the NSP system, the energy released by the reaction is large in the SP system, owing to high surface oxygen reactivity. Compared to the most stable oxygen vacancy on a bare ceria surface, the surface oxygen (at the reaction site marked by red box in Fig.~\ref{Fig_MvK}b) vacancy formation energy with Pt$_{19}$[CO]$_{12}$ is lowered by 0.15 eV, thus significantly boosting the reaction with surface oxygen. In Fig.~\ref{Fig_MvK}b, we show the calculated vacancy formation energies for all surface oxygen sites. The interaction between Pt$_{19}$[CO]$_{12}$ and CeO$_{2}$ generally lowers the vacancy formation energies for surface oxygen at exterior sites of the contact zone. However, within the contact zone, the majority of surface oxygens strongly bond with Pt ions (see Fig.~\ref{Fig_SL}d). The vacancy formation energies are relatively high for these oxygen, except the oxygen which bonds with Pt-CO (marked by green circle in Fig.~\ref{Fig_md}b). The O$_{\textrm{surf}}$-Pt-CO at the exceptional site may migrate by forming dynamic low-coordinated atoms, which has been proposed as the prime cause of dynamic structure of ceria supported gold nanoparticles upon exposing to CO and oxygen gases~\cite{he2018size}. The impact of surface spin polarization on structural dynamics will be discussed in the following section. \subsection{Structural dynamics} The dynamic lattice reconfiguration of nanoparticles upon exposing to oxidizing and reducing gases (e.g. CO and O$_{2}$) has been intensively studied by Transmission Electron Microscopy (TEM) in the recent years~\cite{poul_science2002,yasutaka_angechem2008,vendelbo_nmat2014,andreas_jcata2015,andreas_angchem2017,he2018size,lawrence2018oxygen,lawrence2021atomic,li2021dynamic,miller2021linking,tao2016atomic,vincent2020atomic,vincent2021fluxional}. These studies imply that the surface and perimeter of nanoparticle strongly interact with CO and O$_{2}$ gases. To explore the potential influence of surface spin polarization on the dynamic lattice reconfiguration, we performed two independent AIMD simulations of ceria-supported Pt nanoparticles for 20 ps with and without the inclusion of spin polarization. Due to the limitation of computational resources, we used only three layers of O-Ce-O. Therefore, the CeO$_2$ support is highly reducible, resulting in a unrealistically fast CO oxidation even at 300 K in our AIMD simulation. Despite the artefact due to the choice of a thin CeO$_2$ slab, our simulations still reveal distinct physical pictures due to the inclusion of spin polarization. In the NSP AIMD simulation (Fig.~\ref{Fig_md}a), the whole system does not show any obvious structural change for 20 ps. On the other hand, we observed rapid CO$_2$ formation at around 3 ps (Fig.~\ref{Fig_md}b) when the spin polarization is turned on. Fig.~\ref{Fig_md}c plots the calculated distance between the averaged $z$ coordinates of surface Ce/Pt atoms, as well as the standard deviation to evaluate dispersion of $z$ coordinates of Pt atoms during the simulation. Clearly, the Pt atoms in the SP system are more distant from surface Ce atoms with a larger fluctuation, in comparison to the NSP system. Accordingly, we identify four different features of the SP system (in schematic Fig.~\ref{Fig_md}d). First, strong bonds between Pt and surface oxygen atoms are found in the SP system. This is shown by more bonds and shorter bond lengths because oxygen has moved towards the Pt layer as seen in Fig.~\ref{Fig_SL}. Second, the large distances between surface Ce and Pt atoms are present consistently in the SP AIMD simulations. Highly reducible surface oxygen in the SP surface bond strongly with Pt atoms, resulting in an elevation of surface oxygen and Pt atoms from CeO$_{2}$ surface. This shifting is also manifested in the optimized structures in Fig.~\ref{Fig_SL}. Third, substantial fluctuations of Pt atoms are displayed in the SP AIMD simulations, indicating that the elevated Pt nanoparticle from CeO$_{2}$ surface are flexible. Fourth, asymmetric CO oxidation was raised by irregular structure of Pt and nonuniform surface O vacancy formation energies as shown in Fig.~\ref{Fig_MvK}b. Recently, experimental evidence has been published that shows significant lattice reconfiguration on Pt nanoparticles supported on CeO$_{2}$ on exposure to CO and other gases~\cite{li2021dynamic,vincent2020atomic,vincent2021fluxional} While the timescales for the computation and experimental datasets are very different, precluding a detailed quantitative structural comparison, there is qualitative agreement in the trends in structural dynamics from both theory and experiment. Fig.~\ref{Fig_md}e is in situ electron microscopy data showing dynamic structural change taking place in a CO atmosphere (for experimental details see reference \cite{vincent2020atomic}). The Pt nanoparticles undergoes complex lattice changes such as clockwise rotation, uneven Pt atomic plane near the CeO$_{2}$, instability its atomic position, and apparent change on the Pt surface. There are also continuing changes in the interface structure due to the constant creation and annihilation of oxygen vacancies at perimeter sites. This occurs due to the weakening of the interfacial bonds in the presence of CO and the experimental observation can be understood in terms of the schematic diagram of Fig.~\ref{Fig_md}d. There are many other fluxional observations such as dynamic changes in cation positions due to breaking and formation of chemical bonds at the perimeter sites which are described in greater detail in the author’s paper~\cite{vincent2021fluxional} . These complex dynamics may be described by concerted effect from aforementioned four features, which are pronounced in our SP AIMD simulation. Thus, we suggest that surface spin polarization may play a deterministic role in promoting the dynamic lattice reconfiguration of ceria-supported Pt nanoparticles. \section{Conclusions} In summary, we report the robust surface spin polarization on the CeO$_{2}$-(111) surface due to charge transfer from surface oxygen to cerium. The surface spin polarization appears to be essential to describe the existing important observations such as ferromagnetism in undoped CeO$_{2}$ nanostructures and thin films, high reducibility of ceria support, and low CO oxidation reaction barrier. In addition, the surface spin polarization enhances the bonding between platinum and surface oxygen. However, the CO adsorption on the perimeter of platinum single layer is inclined to weaken the interfacial interaction. We expect the presence of vigorous surface spin polarization at ambient temperature will be useful to understand the interfacial interaction and guide the design high-performance heterogeneous catalyst. \section*{Acknowledgments} The computing resources are provided by XSEDE (TG-DMR180040). The authors gratefully acknowledge financial support from the National Science Foundation (NSF). BK and QZ are supported by NSF-OAC award 1940272. NSF-CBET Award 1604971 and NSF-OAC Award 1940263 supported JLV and PAC, who acquired and processed the experimental data and participated in extensive discussion of the calculations. The authors thank Arizona State University’s John M. Cowley Center for High Resolution Electron Microscopy for microscope access and use.
\section{Introduction}\label{sec:introduction} Many real-world applications are naturally formulated using hierarchical objectives, which are organized into different nested levels. In the bilevel case, the main goal is placed into an upper optimization level, while the lower optimization level aims to determine the best response to a decision made in the upper level. Bilevel optimization has a rich literature of algorithmic development and theory (see \cite{LNVicente_PHCalamai_1994,BColson_PMarcotte_GSavard_2007,JFBard_2010,ASinha_PMalo_KDeb_2018,SDempe_AZemkoho_2020} for extensive surveys and books on this topic). The main applications are found in game theory, defense industry, and optimal structural design, and one has recently seen a surge of contributions to machine learning (see, e.g., \cite{LFranceschi_etal_2018,HLiu_KSimonyan_YYang_2019}, and the recent review \cite{RLiu_JGao_etal_2021}). In this paper, we consider the following nonlinear bilevel optimization problem (BLP) formulation \begin{equation}\label{prob:bilevel} \tag*{BLP} \begin{split} \min_{x \in \mathbb{R}^n, \, y \in \mathbb{R}^m} ~~ & f_u(x,y) \\ \mbox{s.t.}~~ & x \in X \\ & y \in \argmin_{y \in Y(x)} ~~ f_\ell(x,y).\\ \end{split} \end{equation} The goal of the upper level (UL) problem is to determine the optimal value of the UL function $f_u: \mathbb{R}^n\times\mathbb{R}^m \to \mathbb{R}$, where the UL variables~$x$ are subjected to UL constraints ($x \in X$) and the UL variables~$y$ are subjected to being an optimal solution of the lower level (LL) problem. In the LL problem, the LL function $f_\ell: \mathbb{R}^n\times\mathbb{R}^m \to \mathbb{R}$ is optimized in the LL variables~$y$, subject to the LL constraints $y \in Y(x)$. Since the goal of this paper is to propose and analyze a general optimization methodology for a stochastic BLP, the LL problem is assumed to be well-defined, in the sense of having a unique solution~$y(x)$ for all $x \in X$. Hence, problem~\ref{prob:bilevel} is equivalent to a problem posed solely in the UL variables: \begin{equation} \label{reduced} \min_{x \in \mathbb{R}^n} \; f(x)=f_u(x,y(x)) \quad \mbox{s.t.} \quad x \in X. \end{equation} Also, note that the UL constraints ($x \in X$) are only posed in the UL variables~$x$ as otherwise problem~\ref{prob:bilevel} could become intractable in the sense of having a disconnected feasible region in the $(x,y)$--space. Whenever applying orthogonal projections within stochastic gradient type methods, the sets~$X$ and~$Y(x)$ will be assumed closed and convex. Under appropriate smoothness and non-singularity assumptions, the gradient of~$f$ at $(x,y(x))$, when $Y(x) = \mathbb{R}^m$, is given by the so-called adjoint formula \begin{equation} \label{adjoint} \nabla f \; = \; \nabla_x f_u - \nabla_{xy}^2 f_\ell (\nabla_{yy}^2 f_\ell)^{-1} \nabla_y f_u, \end{equation} where all gradients and Hessians are evaluated at $(x,y(x))$. The adjoint gradient can be computed by first solving the adjoint equation $\nabla_{yy}^2 f_\ell \, \lambda = - \nabla_y f_u$ for the adjoint variables~$\lambda=\lambda(x,y(x))$, and then calculating $\nabla_x f_u + \nabla_{xy}^2 f_\ell \, \lambda$. One arrives at the adjoint formula by applying the chain rule to $f_u(x,y(x))$ and calculating the Jacobian of $y(x)$ through the (sensitivity) equations $\nabla_y f_\ell(x,y(x))=0$. When $Y(x) \neq \mathbb{R}^m$, it is no longer possible to explicitly apply an adjoint principle, but one can compute the steepest descent direction for $f$ through an auxiliary linear-quadratic bilevel problem~\cite{GSavard_JGauvin_1994} grounded on sensitivity principles (see Subsection~\ref{sec:constrained}). \subsection{Bilevel machine learning}\label{sec:BML} A variety of problems arising in machine learning can be formulated in terms of bilevel optimization problems: continual learning, neural architecture search, adversarial training, and hyperparameter tuning are among the most popular examples (see~\cite{RLiu_JGao_etal_2021} for a review on this topic). Continual Learning (CL) aims to train ML models when the static task usually considered in learning problems (classification, regression, etc.)~is replaced by a sequence of tasks that become available one at a time~\cite{DLopezPaz_MARanzato_2017}, and for which training and validation datasets are increasingly larger. For each task, a CL instance is formulated as a bilevel problem, where at the UL problem one minimizes the validation error on a subset of model parameters (which includes all hyperparameters), and at the LL problem the training error is minimized on the remaining parameters. A sequence of bilevel problems is then solved for each consecutive task. In a sense, CL is close to meta-learning~\cite{THospedales_etal_2020}, where the goal is to determine the best learning process. The increasing interest in CL is motivated by the demand for approaches that help neural networks to learn new tasks without forgetting the previous ones, a phenomenon which is referred to as \textit{catastrophic forgetting}~\cite{IJGoodfellow_MMirza_DXiao_ACourville_YBengio_2013,RFrench_1999,MMcCloskey_NJCohen_1989}. Another relevant ML area where bilevel optimization is instrumental is Neural Architecture Search (NAS) for Deep Learning. The goal of this problem is to automate the task of designing Deep Neural Networks (DNNs) such that the network’s prediction error is minimized. In recent years, NAS was proposed in a bilevel optimization formulation~\cite{HLiu_KSimonyan_YYang_2019} that represents a continuous relaxation over the (discrete) architecture search space such that gradient information can be utilized. In this way, the UL problem consists of minimizing the validation error of the network over the architecture space and the LL problem consists of minimizing the training error with respect to the network weights. Designing these structures is a vital component of any ML task that utilizes DNNs and typically requires substantial effort through trial and error on behalf of human experts. As a result, automating this design phase in an efficient and optimal way is a critical issue at the heart of the Deep Learning community. For a thorough discussion on the different approaches that have been proposed for NAS, see the survey~\cite{TElsken_JHendrikMetzen_FHutter_2018}. Finally, two other popular classes of ML problems that can be formulated by using bilevel optimization are adversarial training and hyperparameter tuning. Adversarial training aims to robustly address adversarial examples~\cite{CSzegedy_etal_2013} which cannot be correctly classified by ML models once a small perturbation is applied. The adversarial training problem is handled by solving a min-max problem~\cite{HJiang_etal_2018}, but any such problem can be reformulated as a bilevel one. The max/LL problem is posed on the variables which perturb the data in a worst-case fashion, where the UL/min problem attempts to minimize the training error on the ML model parameters~\cite{IGoodfellow_JShlens_CSzegedy_2015,AMadry_etall_2018}. Hyperparameter tuning aims to find the best value for the hyperparameters used in a ML model in order to increase its {\it generalization capability}~\cite{KPBennett_etall_2008,LFranceschi_etal_2018,SDhar_UKurup_MShah_2020}. In the bilevel formulations proposed in the literature, the UL problem optimizes the validation error over the hyperparameters, while the LL problem has the goal of finding the NN weights that minimize the training error. \subsection{Bilevel stochastic descent}\label{sec:BSD} In bilevel stochastic optimization, $f_u$ and $f_\ell$ can be interpreted as expected values, namely, $f_u = \mathbb{E}[f_u(x,y,w_u)]$ and $f_\ell = \mathbb{E}[f_\ell(x,y,w_\ell)]$, where $w_u$ and $w_\ell$ are random variables defined in a probability space (with probability measure independent from $x$ and $y$) such that i.i.d. samples can be observed or generated. The same applies to the functions possibly defining $Y(x)$. (To keep notation simple, we are using the same $f_u$ and $f_\ell$ for deterministic and random variants.) Having in mind ML applications such as NAS and CL, the methods we are considering are Stochastic Approximation (SA) techniques, of the type of the stochastic gradient (SG) method \cite{HRobbins_SMonro_1951,KLChung_1954,JSacks_1958} for single-objective optimization. In fact, the bilevel stochastic gradient (BSG) can be seen as a SG method applied to~(\ref{reduced}), $x_{k+1}=x_k-\alpha_k g_k^{\BSG}$, where $\alpha_k$ is the stepsize or learning rate, and $g_k^{\BSG}$ is a stochastic gradient of~$f$, obtained by sampling the gradients and Hessians in~(\ref{adjoint}) at $(x_k,\tilde{y}_k)$. The stochastic gradient~$g_k^{\BSG}$ may be inexact when $\tilde{y}_k \neq y(x_k)$. In the bilevel optimization literature, stochastic gradient-based methods are commonly classified according to the approach used to compute the second term in the adjoint formula~\eqref{adjoint}. In particular, a first category is composed of the algorithms that either solve the adjoint equation~\cite{FPedregosa_2016} or use a truncated Neumann series to approximate the inverse of the Hessian $\nabla_{yy}^2 f_\ell$~\cite{JLorraine_PVicol_DDuvenaud_2019}, while a second category includes all the approaches based on automatic differentiation~\cite{LFranceschi_etal_2018}. Note that our BSG-1 method falls into the first class of algorithms, which in the numerical experiments reported in~\cite{RGrazzi_etal_2020} is observed to have better performance. The use of such algorithms for unconstrained bilevel optimization has been promoted in~\cite{NCouellan_WWang_2015,NCouellan_WWang_2016,SGhadimi_MWang_2018,KJi_JYang_YLiang_2020,MHong_etal_2020}; see also~\cite{RLiu_JGao_etal_2021} for a recent review. In~\cite{NCouellan_WWang_2015}, the BSG method has been applied to hyperparameter tuning in SVM using the adjoint formula, which is simplified using the structure of the problem. The authors~\cite{NCouellan_WWang_2016} provided a convergence analysis of the general BSG method but requiring the LL problem to be solved to optimality at each iteration. In~\cite{SGhadimi_MWang_2018}, both deterministic and stochastic algorithms are proposed, and their convergence analysis is developed without requiring an exact solution of the LL problem at each iteration. The gradient of~$f$ was computed using the adjoint formula, approximating the inverse of the Hessian $\nabla_{yy}^2 f_\ell$ by a truncated Neumann series. An algorithm with better complexity bounds than~\cite{SGhadimi_MWang_2018} is presented in~\cite{KJi_JYang_YLiang_2020}, which also shows that computing the adjoint gradient by using automatic differentiation may be less computationally efficient than solving the adjoint equation or using the truncated Neumann series. Finally, in~\cite{MHong_etal_2020} the authors study how the convergence results of their algorithm depend on the relative size of the UL and LL stepsizes, and they adapt their approach for a bilevel problem in reinforcement learning. DARTS~\cite{HLiu_KSimonyan_YYang_2019} is an optimization technique related to the BSG method, which has enjoyed great popularity in NAS. It always considers an inexact solution to the LL problem, and it starts an iteration by making it less inexact by applying one step of SG to the LL problem, $\tilde y_k = y_k - \eta \nabla_y f_\ell(x_k,y_k)$. Then, it displaces the UL variables using $x_{k+1}=x_k - \eta \, g_k^{\DARTS}$, where $\eta$ is a fixed stepsize, and $g_k^{\DARTS}$ is computed by applying the chain rule to $\nabla_x f_u(x,y - \eta \nabla_y f_\ell(x,y))$, leading to \begin{equation} \label{eq:DARTS} g_k^{\DARTS} \; = \; \nabla_x f_u(x_k, \tilde y_k) - \eta \nabla^2_{xy} f_\ell (x_k, y_k) \nabla_{y} f_u (x_k, \tilde y_k). \end{equation} However, $g_k^{\DARTS}$ may not be a descent direction, even in the deterministic case, and a direct comparison with $g_k^{\BSG}$ reveals the lack of LL curvature, meaning the use of $\nabla^2_{yy} f_\ell (x_k, y_k)$. The matrix-vector product in~(\ref{eq:DARTS}) is approximated by finite differences (see Subsection~\ref{sec:stochasticBLP_DARTS}), rendering DARTS free of both second-order derivatives and matrix-vector products. \subsection{Contributions of the paper} \label{sec:cont} A major difficulty in the adjoint formula~\eqref{adjoint} is the use of second-order derivatives of $f_\ell$ and the need to solve the adjoint equation $\nabla_{yy}^2 f_\ell \, \lambda = - \nabla_y f_u$, which prevents its application to large-scale ML problems. A first main contribution of this paper is the idea of approximating the second-order derivatives by using the outer product of the corresponding gradients, i.e., \[ \nabla_{xy}^2 f_\ell \; \simeq \; \nabla_x f_\ell \nabla_y f_\ell^\top \; \text{ and } \; \nabla_{yy}^2 f_\ell \simeq \nabla_y f_\ell \nabla_y f_\ell^\top. \] The above approximations are inspired by Gauss-Newton (GN) methods for nonlinear least-squares problems (see, e.g,.~\cite{JNocedal_SJWright_2006}), where the Hessian matrix of the objective function $\sum_{i=1}^{p} (r_i-a_i)^2$ (in which each $r_i$ is a scalar function and $a_i$ a scalar) is approximated by $\sum_{i=1}^{p} \nabla r_i \nabla r_i^\top$, and also from the fact that the empirical risk of misclassification in ML is often a sum of non-negative terms matching a function to a scalar which can then be considered in a least-squares fashion~\cite{ABotev_2017,MGargiani_etal_2020}. The resulting approximate adjoint equation $(\nabla_y f_\ell \nabla_y f_\ell^\top)\, \lambda = - \nabla_y f_u$ is most likely infeasible, and we suggest solving it in the least-squares sense. One solution is $\lambda = - \nabla_y f_u/(\nabla_y f_\ell^\top \nabla_y f_\ell)$. Plugging this and $\nabla_{xy}^2 f_\ell \simeq \nabla_x f_\ell \nabla_y f_\ell^\top$ in the adjoint formula~(\ref{adjoint}) gives rise to our practical BSG calculation \begin{equation} \label{approx-BSG} \nabla_x f_u - \frac{\nabla_y f_\ell^\top \nabla_y f_u}{\nabla_y f_\ell^\top \nabla_y f_\ell} \nabla_x f_\ell. \end{equation} This approximated BSG allows us to use the adjoint formula without computing Hessians or even Hessian-vector products, which is prohibitively expensive for the large bilevel problems arising in ML. It will be referred to as BSG-1, the ``1'' standing for first-order rank-1 approximations of the Hessian matrices. The numerical experiments reported in this paper show that the BSG-1 method performs significantly better than DARTS. A byproduct contribution of this paper is then precisely a number of ways of potentially improving DARTS by drawing a comparison between the $g_k^{\BSG}$ and $g_k^{\DARTS}$ expressions, and by bringing the new ideas of the BSG-1 gradient approximation~(\ref{approx-BSG}). One can scale the term $\nabla_{y} f_u (x_k, \tilde y_k)$ in $g_k^{\DARTS}$ by $1/\|\nabla_{y} f_\ell (x_k, \tilde y_k)\|^2$, thus including the missing curvature $(\nabla_{yy}^2 f_\ell)^{-1}$ of the LL objective function. One can also consider taking $\eta = 1$ in $g_k^{\DARTS}$ (regardless of the value assigned to $\eta$ when updating the LL variables). If we went a step further and address $\nabla_{xy}^2 f_\ell$ in DARTS as in the BSG-1 method, the two methods would be essentially the same, with a minor difference being whether the evaluations are done at $(x_k,y_k)$ or at $(x_k,\tilde{y}_k)$. There is thus a road-map from one method to the other which can give practitioners different computational tools for solving bilevel ML problems. Another main contribution of this paper is a general convergence theory for BSG that is as much as possible abstracted from the specifics of the adjoint formula~(\ref{adjoint}) for the gradient of~$f$, in particular in what regards the inverse of the Hessian of $f_\ell$ and/or the solution of the adjoint system. Our theory is grounded on sensitivity principles of nonlinear optimization and extends naturally to the constrained LL case ($Y(x) \neq \mathbb{R}^m$), which has not been covered elsewhere, neither algorithmically nor theoretically. \subsection{Organization of this paper} This paper is organized as follows. In Section~\ref{sec:BSGmethod}, we describe the BSG method for both the unconstrained and constrained lower-level cases. The convergence analysis of the method, along with the assumptions required, is reported in Section~\ref{sec:convergence_rate_BSGmethod}. Section~\ref{sec:continual_learning} focuses on continual learning and its formulation as a bilevel optimization problem. Numerical results for this problem and for a synthetic logistic regression instance are analyzed in Section~\ref{sec:numerical_experiments}, which also describes the BSG-1 and DARTS methods used for benchmarking purposes. Finally, in Section~\ref{sec:conclusions} we draw some concluding remarks and we propose ideas for future work. By default, all norms $\| \cdot \|$ used in this paper are the $\ell_2$~ones. \section{The bilevel stochastic gradient method}\label{sec:BSGmethod} In this section, we introduce the bilevel stochastic gradient (BSG) method for solving stochastic BLPs. Let $\{w^u_k\}_{k \ge 0}$ and $\{w^\ell_k\}_{k \ge 0}$ be sequences of random variables for UL and LL function evaluations, respectively. A realization of the random variables $w^u_k$ and $w^\ell_k$ can be interpreted as a single sample or a batch of samples for mini-batch SG use. For compactness of notation, let us set $\xi_k=(w_k^u,w_k^\ell)$ for the combined UL and LL random variables. The schema of the Bilevel Stochastic Gradient (BSG) method is presented in Algorithm~\ref{alg:BSG_DS}. An initial point $(x_0,y_0)$ and a sequence of positive scalars~$\{\alpha_k\}$ are required as input. In Step~1, any arbitrary optimization method can be applied to approximately solve the LL problem, regardless of being unconstrained ($Y(x) = \mathbb{R}^m$) or constrained ($Y(x) \neq \mathbb{R}^m$). In Step~2, one computes an approximated (negative) BSG, which will be denoted by $-d(x_k, \tilde y_k, \xi_k)$ and will be detailed in the next two subsections. Finally, at Step~3, the vector $x$ is updated by using a proper step size taken from the sequence of positive scalars. When $X$ is a closed and convex constrained set different from $\mathbb{R}^n$, we need to compute the orthogonal projection of $x_{k} + \alpha_k \, d(x_k, \tilde y_k, \xi_k)$ onto~$X$ (note that such a projection can be computed by solving a convex optimization problem). \begin{algorithm}[H] \caption{Bilevel Stochastic Gradient (BSG) Method}\label{alg:BSG_DS} \begin{algorithmic}[1] \medskip \item[] {\bf Input:} $(x_0,y_0) \in \mathbb{R}^n \times \mathbb{R}^m$, $\{\alpha_k\}_{k \geq 0} > 0$. \medskip \item[] {\bf For $k = 0, 1, 2, \ldots$ \bf do} \item[] \quad\quad {\bf Step 1.} Obtain an approximation $\tilde{y}_k$ to the LL optimal solution $y(x_k)$. \nonumber \item[] \quad\quad {\bf Step 2.} Obtain an approximation $d(x_k, \tilde y_k, \xi_k)$ to $-g_k^{\BSG}$. \item[] \quad\quad {\bf Step 3.} Compute $x_{k+1} = P_X ( x_{k} + \alpha_k \, d(x_k, \tilde y_k, \xi_k) )$. \item[] {\bf End do} \par\bigskip\noindent \end{algorithmic} \end{algorithm} We point out that as is usual in the literature related to SG methods, a stopping criterion is not considered due to a lack of reasonable criteria and for the need to study the asymptotic convergence properties. \subsection{The unconstrained lower level case} Given $(x_k,\tilde{y}_k)$, we denote by $g^u_x(x_k,\tilde{y}_k,w^u_k)$, $g^u_y(x_k,\tilde{y}_k,w^u_k)$, and $g^\ell_y(x_k,\tilde{y}_k,w^\ell_k)$ the stochastic gradient estimates that approximate $\nabla_x f_u(x_k,\tilde{y}_k)$, $\nabla_y f_u(x_k,\tilde{y}_k)$, and $\nabla_y f_\ell(x_k,\tilde{y}_k)$, respectively. The same notation applies to the stochastic Hessian estimates: $H^\ell_{xy}(x_k,\tilde{y}_k,w^\ell_k)$ and $H^\ell_{yy}(x_k,\tilde{y}_k,w^\ell_k)$ approximate, respectively, $\nabla^2_{xy} f_\ell(x_k,\tilde{y}_k)$ and $\nabla^2_{yy} f_\ell(x_k,\tilde{y}_k)$. In the unconstrained LL case ($Y(x) = \mathbb{R}^m$), an approximated (negative) BSG for use in Step~2 can be computed directly from the adjoint formula~(\ref{adjoint}), as follows: \begin{equation} \label{stochastic-adjoint} -d(x_k, \tilde{y}_k, \xi_k) \; = \; g^u_x(x_k,\tilde{y}_k,w^u_k) - H^{\ell}_{xy}(x_k,\tilde{y}_k,w^\ell_k) (H^{\ell}_{yy}(x_k,\tilde{y}_k,w^\ell_k))^{-1} g^u_y(x_k,\tilde{y}_k,w^u_k). \end{equation} The theory of Section~\ref{sec:convergence_rate_BSGmethod} will cover~(\ref{stochastic-adjoint}). The data in the formula~(\ref{adjoint}) is referred to as $D(x,y)$ or $D(x,y(x))$, depending on the point where the gradients and Hessians are evaluated: \begin{equation} \label{eq:D(x,y)} D(x, y) \; = \; \left( \nabla_x f_u(x,y), \nabla_y f_u(x,y), \nabla_{xy}^2 f_\ell(x,y), \nabla_{yy}^2 f_\ell(x,y) \right). \end{equation} The data in the calculation~(\ref{stochastic-adjoint}) is referred to as $D(x_k,\tilde{y}_k,\xi_k)$: \begin{equation} \label{eq:D(x,y,epsilon)} D(x_k,\tilde{y}_k,\xi_k) \; = \; \left( g^u_x(x_k,\tilde{y}_k,w^u_k), g^u_y(x_k,\tilde{y}_k,w^u_k), H^{\ell}_{xy}(x_k,\tilde{y}_k,w^\ell_k), H^{\ell}_{yy}(x_k,\tilde{y}_k,w^\ell_k) \right). \end{equation} As we have said before, our practical implementation of BSG will use rank-one approximations for $H^{\ell}_{xy}(x_k,\tilde{y}_k,w^\ell_k)$ and $H^{\ell}_{yy}(x_k,\tilde{y}_k,w^\ell_k)$, and then solve $H^{\ell}_{yy}(x_k,\tilde{y}_k,w^\ell_k) \lambda = - g^u_y(x_k,\tilde{y}_k,w^u_k)$ in the least-squares sense. \subsection{The constrained lower level case} \label{sec:constrained} Let us now handle the constrained LL case, in which we consider \[ Y(x) \; = \; \{ f_i(x,y) = 0, \; i \in I, \;\; f_i(x,y) \leq 0, \; i \in J \}, \] where $I$ and $J$ are two finite sets of indices. For the LL problem, assume that at $y(x)$, the gradients of the active constraints are linearly independent (LICQ) and the sufficient second-order optimality conditions are satisfied~\cite{JNocedal_SJWright_2006}. Let $L_\ell(x,y;z) = f_\ell(x,y) + \sum_{I(x) \cup J} z_i f_i(x,y)$ be the Lagrangian function, where~$I(x)$ includes all the active indices and~$z$ are the Lagrange multipliers. The unique multipliers associated with $y(x)$ under LICQ are denoted by~$z(x)$. The steepest descent direction $d(x,y(x)) \in \mathbb{R}^n$ for $f$ at $x$ can be calculated by solving the following linear-quadratic bilevel problem~\cite{GSavard_JGauvin_1994}: \begin{equation}\label{prob:steepest_descent} \tag*{LQ$(x,y(x))$} \begin{split} \min_{d^x \in \mathbb{R}^n, \, d^y \in \mathbb{R}^m} \; & \nabla_{x} f_u(x,y(x))^\top d^x + \nabla_{y} f_u(x,y(x))^\top d^y \ \\ \mbox{s.t.}~~ & \Vert d^x \Vert_\infty \le 1,\\[0.5ex] & d^y \in \argmin_{d^y \in \mathbb{R}^m} \; (d^x,d^y)^\top \nabla^2 L_\ell(x,y(x);z(x)) ({d^x},{d^y}) \\ & \qquad\qquad \mbox{s.t.} \;\; \nabla_{y} f_\ell(x,y(x))^\top d^y = -\nabla_{x} f_\ell(x,y(x))^\top d^x + \nabla_{x} L_\ell(x,y(x);z(x))^\top d^x,\\ & \qquad\qquad\qquad \; \nabla_{y} f_i(x,y(x))^\top d^y \leq -\nabla_{x} f_i(x,y(x))^\top d^x, \quad i \in I(x),\\ & \qquad\qquad\qquad \; \nabla_{y} f_i(x,y(x))^\top d^y = -\nabla_{x} f_i(x,y(x))^\top d^x, \quad i \in J. \\ \end{split} \end{equation} Note that problem LQ$(x,y)$ can be solved for any pair of variables $(x,y)$, where~$y$ is not necessarily an optimal solution~$y(x)$ to the LL problem of~\ref{prob:bilevel}. In such a case, we denote the linear-quadratic problem as~LQ$(x,y)$ and its optimal solution as $d(x,y)$, while the problem data is referred to as $D(x,y)$. It is important to point out that when $y$ is not the LL optimal solution $y(x)$, the direction obtained by solving the problem~LQ$(x,y)$ is not guaranteed to be descent. Also note that the UL problem of this linear-quadratic bilevel problem constrains~$d^x$ in the $\ell_\infty$-norm, and thus $d(x,y(x))$ might not necessarily recover $-\nabla f(x)$, although the two directions are co-linear. One points out that in the case $Y(x) = \mathbb{R}^m$, there are no constrains in the LL problem of LQ$(x,y(x))$, and the Hessian of its objective function involves only the second-order derivatives of $f_\ell$. A simple calculation allows us to conclude that indeed $d(x,y(x))$ recovers a positive multiple of the adjoint gradient in~(\ref{adjoint}) (normalized in the $\ell_\infty$-norm). In the stochastic version of~LQ$(x_k,y(x_k))$, we replace $\nabla_x f_u(x_k,y(x_k))$, $\nabla_y f_u(x_k,y(x_k))$, $\nabla_y f_\ell(x_k,y(x_k))$, and $\nabla^2 L_\ell(x_k,y(x_k);z(x_k))$ by the corresponding stochastic gradient and Hessian estimates at $(x_k,\tilde{y}_k)$, where $\tilde{y}_k$ is not necessarily $y(x_k)$. A solution of the resulting linear-quadratic bilevel problem, LQ($x_k,\tilde{y}_k,\xi_k$), is denoted by $d(x_k,\tilde{y}_k,\xi_k)$. Such a solution is not guaranteed to yield a descent direction when $\tilde{y}_k=y(x_k)$, as opposed to its deterministic counterpart~$d(x_k,y(x_k))$. The data of problem LQ($x_k,\tilde{y}_k,\xi_k$) is referred to as $D(x_k,\tilde{y}_k,\xi_k)$. In practical terms it is important to point out that problem LQ($x_k,\tilde{y}_k,\xi_k$) can be approximately solved by solving an LP relaxation, which consists of replacing its LL problem (a QP) by its first-order necessary conditions (which are linear in $d^x$ and $d^y$ as long as there are no inequality constraints). \section{Convergence rate of the BSG method in the strongly convex case}\label{sec:convergence_rate_BSGmethod} In this section, we extend the convergence theory of the SG method to the bilevel case when the stepsize is assumed to be decaying. The BSG method under analysis considers an inexact solution of the LL problem. The BSG is not required to follow a specific adjunct calculation, and the constrained LL setting is also comprehensively covered. The BLP objective function~$f$ is assumed to be strongly convex (leading to a $1/k$ sublinear convergence rate) or simply convex ($1/\sqrt{k}$ rate). \subsection{General assumptions} Again, let us recall that $f(x) = f_u(x,y(x))$. The true function~$f$ will later be assumed sufficiently smooth (Assumption~\ref{ass:smoothness_f} below). For the moment we need to impose a certain smoothness of the BLP gradients and Hessians involved in the computation of the BSG direction (Assumption~\ref{ass:smoothness} below). \begin{assumption}[Smoothness of gradients and Hessians for the BSG direction]\label{ass:smoothness} All \linebreak gradients and Hessians involved in the computation of the BSG direction are Lipschitz continuous in~$(x,y)$. \end{assumption} In the unconstrained LL case, and when using the adjoint formula~(\ref{adjoint}), Assumption~\ref{ass:smoothness} amounts to assuming that $\nabla_x f_u$, $\nabla_y f_u$, $\nabla_{xy}^2 f_\ell$, and $\nabla^2_{yy} f_\ell$ are Lipschitz continuous in~$y$. In the constrained LL case (LQ subproblem), this is extended to $\nabla_x f_\ell$, $\nabla_y f_\ell$, $\nabla_x f_i$, $\nabla_y f_i$, $\nabla_{xy}^2 f_i$, and $\nabla_{yy}^2 f_i$, for all $i \in I \cup J$. We require the approximate BSG direction~$d(x_k,\tilde{y}_k,\xi_k)$ as well as the true steepest descent direction~$d(x_k,y(x_k))$ to satisfy Assumption~\ref{ass:unbiasedness}. The expected value with respect to $\xi_k=(w^u_k,w^\ell_k)$ is denoted by $\mathbb{E}_{\xi_k}[\cdot]$. \begin{assumption}\label{ass:unbiasedness} The vectors $d(x_k,y(x_k))$ and $d(x_k,\tilde{y}_k,\xi_k)$ satisfy the following conditions \begin{itemize} \item[(i)] There exists a positive scalar $C_d$ such that \begin{equation} \label{dexact} \mathbb{E}_{\xi_k}[\Vert d(x_k, y(x_k)) - (- \nabla f(x_k)) \Vert] \; \le \; C_d \, \alpha_k. \end{equation} \item[(ii)] There exists a positive scalar $G_d$ such that \begin{align} \mathbb{E}_{\xi_k}[\Vert d(x_k,\tilde{y}_k,\xi_k) \Vert^2] \; \leq \; G_d. \label{eq501} \end{align} \end{itemize} \end{assumption} In the unconstrained LL case, $d(x_k, y(x_k)) = - \nabla f(x_k)$ is trivially satisfied. In the constrained LL case we know that $d(x_k, y(x_k))$ is co-linear with $- \nabla f(x_k)$ but their norms may differ, and thus the need for this assumption. Note that instead of assuming~(\ref{eq501}), we could have assumed $\mathbb{V}_{\xi_k}[d(x_k,\tilde{y}_k,\xi_k)] \le G_V$ and $\mathbb{E}_{\xi_k}[d(x_k,\tilde{y}_k,\xi_k)] \le G_E$, for some positive constants $G_V,G_E$. In fact, from the definition of variance, $\mathbb{E}_{\xi_k}[\Vert d(x_k,\tilde{y}_k,\xi_k) \Vert^2] \le G_V + G_E^2 = G_d$. Also, in the constrained LL case, a bound on the second moment of $d(x_k,\tilde{y}_k,\xi_k)$ comes directly from the constraint $\|d^x\|_\infty \le 1$ in problem~LQ$(x_k,\tilde{y}_k,\xi_k)$, which then implies $\mathbb{E}_{\xi_k}[\Vert d(x_k,\tilde{y}_k,\xi_k) \Vert^2] \le n$. \subsection{Sensitivity of the approximated bilevel stochastic gradient direction} To bound the expectation of the error between the true gradient or steepest descent direction~$d(x_k,y(x_k))$ and the approximate BSG direction~$d(x_k,\tilde{y}_k,\xi_k)$, we will need to apply sensitivity analysis arguments from nonlinear optimization. In particular, we need to assume that the calculation process of the BSG direction is Lipschitz continuous with respect to changes in its data. \begin{assumption}[Sensitivity of the BSG direction]\label{ass:lipschitz_continuity} \phantom{\\} The calculation of the BSG direction $d(D)$ is a Lipschitz continuous function of the data, i.e., there exists a $L_{BSG} > 0$ such that, for any $D_1$ and $D_2$, one has \[ \Vert d(D_1) - d(D_2) \Vert \; \le \; L_{BSG} \Vert D_1 - D_2 \Vert. \] \end{assumption} In the unconstrained LL case, when the adjoint formula~(\ref{adjoint}) or (\ref{stochastic-adjoint}) is used, the data~$D$ is either the deterministic one~(\ref{eq:D(x,y)}) or the stochastic one~(\ref{eq:D(x,y,epsilon)}), respectively. Assumption~\ref{ass:lipschitz_continuity} amounts to assuming that all gradient vectors and Hessian matrices involved are bounded and that $\nabla_{yy}^2 f_\ell$ and $H_{yy}^\ell$ are bounded away from singularity. In fact, sum is Lipschitz continuous, multiplication is Lipschitz continuous if the factors are bounded, and symmetric matrix inversion is also Lipschitz continuous if its eigenvalues are bounded from zero. For the adjoint gradient calculation, we have $d(a,b,A,B)=a-A B^{-1}b$, with $D=(a,b,A,B)$, and one can easily prove that \begin{equation} \label{eq:Luis} \|d(D_1) - d(D_2) \| \; \le \; C \left(\|a_1-a_2\| +\|b_1-b_2\| + \|A_1-A_2\|+\|B_1-B_2\|\right), \end{equation} where~$C$ depends on a bound on $b$, $A$, and $B^{-1}$, and the right-hand side is a norm on $(a,b,A,B)$. We now introduce Assumption~\ref{ass:assumption_SGD}, which can be easily enforced in practice by solving the LL problem with the SG method (see Subsection~\ref{sec:bound_SGD}). \begin{assumption}\label{ass:assumption_SGD} There exists a positive scalar $C_y$ such that \begin{equation} \label{eq:conv_y} \mathbb{E}_{\xi_k}[\Vert y(x_k) - \tilde{y}_k\Vert] \; \le \; C_y \, \alpha_k. \end{equation} \end{assumption} Finally, we need Assumption~\ref{ass:assumption_sampling} below to hold which essentially amounts to the sampling error in the data. To enforce this assumption in practice, we refer the reader to the discussion reported in Section~\ref{sec:bound_biasedness}. Recall that $D(x_k,\tilde{y}_k)$ represents the data defining the true quantity~$d(x_k,\tilde{y}_k)$, and $D(x_k,\tilde{y}_k,\xi_k)$ the data of the calculation of~$d(x_k,\tilde{y}_k,\xi_k)$. In the unconstrained LL case, $D(x_k,\tilde{y}_k)$ and $D(x_k,\tilde{y}_k,\xi_k)$ are given by~(\ref{eq:D(x,y)}) and~(\ref{eq:D(x,y,epsilon)}), respectively. \begin{assumption}\label{ass:assumption_sampling} There exists a positive scalar $C_D$ such that \[ \expc_{\xi_k}[ \Vert D(x_k,\tilde{y}_k) - D(x_k,\tilde{y}_k,\xi_k) \Vert] \; \le \; C_D \, \alpha_k. \] \end{assumption} One is ready to establish the desired error bound in terms of $\alpha_k$, for which the constant will depend on the above-introduced constants $L_{BSG}$, $C_y$, and $C_D$. \begin{lemma} Under Assumptions~\ref{ass:smoothness},~\ref{ass:lipschitz_continuity},~\ref{ass:assumption_SGD} and~\ref{ass:assumption_sampling}, \begin{equation} \mathbb{E}_{\xi_k}[\Vert d(x_k,y(x_k)) - d(x_k,\tilde{y}_k,\xi_k) \Vert] \; \le \; B \, \alpha_k, \label{eq:5555} \end{equation} where $B = L_{BSG} (L_{LL} C_y + C_D)$, and $L_{LL} > 0$ is a constant only dependent on the Lipschitz constants of the gradients and Hessians of Assumption~\ref{ass:smoothness}. \end{lemma} \begin{proof} By adding and subtracting the term $d(x_k,\tilde{y}_k)$ and using the triangle inequality, we have \begin{align} \expc_{\xi_k}[\Vert d(x_k,y(x_k)) - d(x_k,\tilde{y}_k,\xi_k) \Vert] & \; \le \; \expc_{\xi_k}[\Vert d(x_k,y(x_k)) - d(x_k,\tilde{y}_k) \Vert] \label{eq:3332}\\ \vspace{1ex} & \quad \; + \expc_{\xi_k}[\Vert d(x_k,\tilde{y}_k) - d(x_k,\tilde{y}_k,\xi_k)\Vert]. \label{eq:3333} \end{align} Now we derive a bound for the right-hand side in~\eqref{eq:3332}. By considering the data $D_1 = D(x_k,y(x_k))$ and $D_2 = D(x_k,\tilde{y}_k)$ in Assumption~\ref{ass:lipschitz_continuity}, we obtain \begin{equation}\label{eq:123456} \Vert d(x_k, y(x_k)) - d(x_k,\tilde{y}_k)\Vert \; \le \; L_{BSG} \Vert D(x_k, y(x_k)) - D(x_k, \tilde{y}_k) \Vert. \end{equation} Taking the expectation on both sides of \eqref{eq:123456}, we have \begin{equation}\label{eq:1_1} \expc_{\xi_k}[\Vert d(x_k,y(x_k)) - d(x_k,\tilde{y}_k) \Vert] \; \le \; L_{BSG} \expc_{\xi_k}[\Vert D(x_k,y(x_k)) - D(x_k,\tilde{y}_k) \Vert]. \end{equation} Note that the right-hand side of~\eqref{eq:1_1} contains exact BLP gradients and Hessians. Therefore, Lipschitz continuity of those mappings (Assumption~\ref{ass:smoothness}) implies the existence of a constant $L_{LL} > 0$ such that \begin{equation} \Vert D(x_k,y(x_k)) - D(x_k,\tilde{y}_k) \Vert \; \le \; L_{LL} \Vert y(x_k) - \tilde{y}_k \Vert. \label{eq:4444} \end{equation} Taking the expectation on both sides of~(\ref{eq:4444}), we can write \begin{equation} \mathbb{E}_{\xi_k}[\Vert D(x_k,y(x_k)) - D(x_k,\tilde{y}_k) \Vert] \; \le \; L_{LL} \, \mathbb{E}_{\xi_k}[\Vert y(x_k) - \tilde{y}_k\Vert]. \label{eq1000} \end{equation} Therefore, from \eqref{eq:1_1}, \eqref{eq1000}, and Assumption~\ref{ass:assumption_SGD}, we obtain \begin{equation} \expc_{\xi_k}[\Vert d(x_k,y(x_k)) - d(x_k,\tilde{y}_k) \Vert] \; \le \; L_{BSG} \, L_{LL} \, C_y \, \alpha_k. \label{eq1001} \end{equation} Now we derive a bound for \eqref{eq:3333}. By considering the data $D_1 = D(x_k,\tilde{y}_k)$ and $D_2 = D(x_k,\tilde{y}_k,\xi_k)$ in Assumption~\ref{ass:lipschitz_continuity}, we have \begin{equation} \label{eq:sensitivity_analysis_inexactness} \Vert d(x_k, \tilde{y}_k) - d(x_k, \tilde{y}_k, \xi_k)\Vert \; \le \; L_{BSG} \Vert D(x_k, \tilde{y}_k) - D(x_k, \tilde{y}_k, \xi_k) \Vert. \end{equation} Taking the expectation on both sides of (\ref{eq:sensitivity_analysis_inexactness}), we obtain \begin{equation}\label{eq:1_2} \expc_{\xi_k}[\Vert d(x_k,\tilde{y}_k) - d(x_k,\tilde{y}_k,\xi_k)\Vert] \; \le \; L_{BSG} \expc_{\xi_k}[\Vert D(x_k,\tilde{y}_k) - D(x_k,\tilde{y}_k,\xi_k)\Vert]. \end{equation} Hence, from \eqref{eq:1_2} and Assumption~\ref{ass:assumption_sampling}, we obtain \begin{equation} \expc_{\xi_k}[\Vert d(x_k,\tilde{y}_k) - d(x_k,\tilde{y}_k,\xi_k) \Vert] \; \le \; L_{BSG} \, C_D \, \alpha_k. \label{eq1001_1} \end{equation} The proof can be concluded from \eqref{eq:3332}--\eqref{eq:3333}, \eqref{eq1001}, and~\eqref{eq1001_1}. \end{proof} \subsection{Rate in the strongly convex case} Both strongly convex and convex cases require an explicit assumption on the smoothness of the true function~$f$. \begin{assumption}[Smoothness of $f$]\label{ass:smoothness_f} The gradient~$\nabla f$ is Lipschitz continuous in $x$ with constant $L_{\nabla {f}} > 0$, i.e., \[ \Vert \nabla f (x) - \nabla f (\bar x)\Vert \; \le \; L_{\nabla {f}} \Vert x - \bar x\Vert \quad \text{ for all } (x,\bar x) \in \mathbb{R}^n \times \mathbb{R}^n. \] \end{assumption} In the unconstrained LL case, $\nabla f$ has the explicit adjoint formula given in~(\ref{adjoint}), and its Lipschitz continuity can be inferred from the Lipschitz continuity of $y(x)$ and of the gradients and Hessians involved and from the boundedness away from singularity of~$\nabla_{yy}^2 f_\ell$. The details can be easily worked out (see, for instance,~\cite[Lemma~2.2]{NCouellan_WWang_2016}) or simply by applying~(\ref{eq:Luis}) followed by the Lipschitz continuity of the gradients and Hessians. In the constrained LL case, this assumption is a supposition on the sensitivity of the auxiliary subproblem~LQ$(x,y(x))$. We also need the iterates to lie in a bounded set, which could be ensured by the boundedness of~$X$ in the BLP formulation. \begin{assumption}[Boundedness of the iterates]\label{ass:boundedness} The sequence of iterates $\{x_k\}_{k \in \mathbb{N}}$ yielded by Algorithm~\ref{alg:BSG_DS} is contained in a bounded set. \end{assumption} Assumption~\ref{ass:boundedness} implies that there exists a positive constant~$\Theta$ such that, for any $(k_1,k_2)$, we have \begin{equation}\label{eq:bounded_constant} \Vert x_{k_1} - x_{k_2} \Vert \; \le \; \Theta \; < \; \infty. \end{equation} Finally, we assume that the true function~$f$ is strongly convex. \begin{assumption}[Strong convexity]\label{ass:strong_convexity} The function $f$ is strongly convex, namely, there exists a constant $c > 0$ such that \begin{equation}\label{eq:strong_convexity} f(\bar x) \; \ge \; f(x) + \nabla f(x)^\top (\bar x - x) + \frac{c}{2}\Vert \bar x - x \Vert^2 \text{ for all } (\bar x, x) \in \mathbb{R}^n \times \mathbb{R}^n. \end{equation} \end{assumption} The next theorem proves that under the assumption of strong convexity and decaying stepsize ($\sum_{k=1}^{\infty} \alpha_k = \infty$ and $\sum_{k=1}^{\infty} \alpha_k^2 < \infty$), the sequence of points yielded by Algorithm~\ref{alg:BSG_DS} generates a sequence of $f$ values that decays sublinearly at the rate of $1/k$. We use $E[\cdot]$ to refer to the {\it total expectation} of $f$, namely, the expected value with respect to the joint distribution of all the random vectors $\xi_k$. \begin{theorem}\label{theorem:conv} Let Assumptions~\ref{ass:smoothness}--\ref{ass:strong_convexity} hold and $x_*$ be the unique minimizer of~$f$. Consider the schema given by Algorithm~\ref{alg:BSG_DS} and assume a decaying step size of the form $\alpha_k = \frac{2}{c(k+1)}$. The sequence of iterates yielded by Algorithm~\ref{alg:BSG_DS} satisfies $$ \min_{s = 1, \ldots, k} \mathbb{E}[f(x_s)] - \mathbb{E}[f(x_*)] \; \le \; \frac{2 G_d + 4 (B + C_d) \Theta}{c(k+1)}.$$ \end{theorem} \begin{proof} For any $k \in \mathbb{N}$, we can write \begin{align} \hspace{-0.3cm} \mathbb{E}_{\xi_k}[\Vert x_{k+1} - x_*\Vert^2] & = \mathbb{E}_{\xi_k}[\Vert P_X (x_k + \alpha_k \, d(x_k,\tilde y_k,\xi_k)) - x_*\Vert^2] \nonumber\\ & \le \mathbb{E}_{\xi_k}[\Vert x_k + \alpha_k \, d(x_k,\tilde y_k,\xi_k) - x_*\Vert^2] \nonumber\\ & = \Vert x_k - x_*\Vert^2 + \alpha_k^2 \mathbb{E}_{\xi_k}[\Vert d(x_k,\tilde y_k,\xi_k) \Vert^2] \nonumber\\ &\quad + 2\alpha_k \mathbb{E}_{\xi_k}[d(x_k,\tilde y_k,\xi_k)]^\top (x_k - x_*). \nonumber \end{align} Adding and subtracting the terms $2\alpha_k (\mathbb{E}[d(x_k,y(x_k))] + \nabla f(x_k))^\top(x_k - x_*)$ and applying the Cauchy-Schwarz inequality, we obtain \begin{align} \hspace{-0.3cm} \mathbb{E}_{\xi_k}[\Vert x_{k+1} - x_*\Vert^2] &\le \Vert x_k - x_*\Vert^2 + \alpha_k^2 \mathbb{E}_{\xi_k}[\Vert d(x_k,\tilde y_k,\xi_k)\Vert^2] - 2\alpha_k (\nabla f(x_k))^\top (x_k - x_*) \nonumber\\ & \quad + 2\alpha_k \mathbb{E}_{\xi_k}[d(x_k,\tilde y_k,\xi_k) - d(x_k,y(x_k))]^\top (x_k - x_*) \nonumber \\ & \quad + 2\alpha_k \mathbb{E}_{\xi_k}[d(x_k, y(x_k)) + \nabla f(x_k)]^\top (x_k - x_*) \nonumber \\ &\le \Vert x_k - x_*\Vert^2 + \alpha_k^2 \mathbb{E}_{\xi_k}[\Vert d(x_k,\tilde y_k,\xi_k)\Vert^2] - 2\alpha_k (\nabla f(x_k))^\top (x_k - x_*) \nonumber\\ & \quad + 2\alpha_k \Vert \mathbb{E}_{\xi_k}[d(x_k,\tilde y_k,\xi_k) - d(x_k, y(x_k))]\Vert \Vert x_k - x_* \Vert \nonumber \\ & \quad + 2\alpha_k \Vert \mathbb{E}_{\xi_k}[d(x_k, y(x_k)) - (- \nabla f(x_k))]\Vert \Vert x_k - x_* \Vert. \nonumber \end{align} By Jensen's inequality, the previous expression can be written as follows \begin{align} \hspace{-0.3cm} \mathbb{E}_{\xi_k}[\Vert x_{k+1} - x_*\Vert^2] &\le \Vert x_k - x_*\Vert^2 + \alpha_k^2 \mathbb{E}_{\xi_k}[\Vert d(x_k,\tilde y_k,\xi_k)\Vert^2] - 2\alpha_k (\nabla f(x_k))^\top (x_k - x_*) \label{eq20}\\ & \quad + 2\alpha_k \mathbb{E}_{\xi_k}[\Vert d(x_k,\tilde y_k,\xi_k) - d(x_k, y(x_k)) \Vert] \Vert x_k - x_* \Vert \label{eq30} \\ & \quad + 2\alpha_k \mathbb{E}_{\xi_k}[\Vert d(x_k, y(x_k)) - (- \nabla f(x_k)) \Vert] \Vert x_k - x_* \Vert. \label{eq40} \end{align} Assumption~\ref{ass:strong_convexity} implies that \begin{equation}\label{eq100} \nabla f(x_k)^\top (x_k - x_*) \; \ge \; f(x_k) - f(x_*) + \frac{c}{2}\Vert x_k - x_* \Vert^2. \end{equation} Then, by using point (i) of Assumption~\ref{ass:unbiasedness}, Assumption~\ref{ass:boundedness}, and inequalities \eqref{eq501}, \eqref{eq:5555}, and \eqref{eq100}, the terms \eqref{eq20}, \eqref{eq30}, and \eqref{eq40} can be bounded as follows \begin{align} \mathbb{E}_{\xi_k}[\Vert x_{k+1} - x_*\Vert^2] &\le \Vert x_k - x_*\Vert^2 + G_d \alpha_k^2 - 2\alpha_k f(x_k) + 2\alpha_k f(x_*) - c \alpha_k \Vert x_k - x_* \Vert^2 \nonumber \\ &\quad + 2 B \Theta \alpha_k^2 + 2 C_d \Theta \alpha_k^2\nonumber \\ &= (1 - c\alpha_k)\Vert x_{k} - x_*\Vert^2 + 2 \alpha_k(f(x_*) - f(x_k)) \nonumber \\&\quad + (G_d + 2 (B + C_d) \Theta) \, \alpha_k^2.\nonumber \end{align} Denoting $M = G_d + 2 (B + C_d) \Theta$, using $\alpha_k = \frac{2}{c(k+1)}$, and rearranging, we obtain \begin{align} \mathbb{E}_{\xi_k}[f(x_k) - f(x_*)] &\le \frac{(1 - c\alpha_k)\Vert x_{k} - x_*\Vert^2 + \alpha_k^2 M - \mathbb{E}_{\xi_k}[\Vert x_{k+1} - x_*\Vert^2]}{2 \alpha_k} \nonumber \\ &= \frac{c(k-1)}{4}\Vert x_{k} - x_*\Vert^2 + \frac{M}{c(k+1)} - \frac{c(k+1)}{4} \mathbb{E}_{\xi_k}[\Vert x_{k+1} - x_*\Vert^2].\nonumber \end{align} If we replace $k$ by $s$, we take the total expectation, we multiply both sides by $s$, and we sum over $s = 1, \ldots, k$, we obtain \begin{align} \sum_{s=1}^{k} \, s \, \mathbb{E}[f(x_s) - f(x_*)] &\le \sum_{s=1}^{k} \bigg(\frac{c s (s-1)}{4}\mathbb{E}[\Vert x_{s} - x_*\Vert^2] - \frac{c s (s+1)}{4} \mathbb{E}[\Vert x_{s+1} - x_*\Vert^2] \bigg) \nonumber \\&\quad + \sum_{s=1}^{k} \bigg(\frac{s \, M}{c(s+1)} \bigg)\nonumber\\ &\le -\frac{c \, k \, (k+1)}{4} \mathbb{E}[\Vert x_{k+1} - x_*\Vert^2] + \sum_{s=1}^{k} \bigg(\frac{s M}{c(s+1)} \bigg)\; \le \; \frac{k}{c} M.\nonumber \end{align} If we divide both sides by $\sum_{s=1}^{k} s$, we obtain \begin{equation} \frac{\sum_{s=1}^{k} \, s \, \mathbb{E}[f(x_s)] - \sum_{s=1}^{k} \, s \, \mathbb{E}[f(x_*)]}{\sum_{s=1}^{k} s} \; \le \; \frac{k \, M}{c \sum_{s=1}^{k} s} \; = \; \frac{2 \, M}{c (k + 1)}.\label{eq:proof_end-1} \end{equation} A lower bound for the left-hand side is given by \begin{equation} \min_{s = 1,\ldots, k} \mathbb{E}[f(x_s)] - \mathbb{E}[f(x_*)] \; \le \; \sum_{s=1}^{k} \, \frac{s}{\sum_{s=1}^{k} s} \, \mathbb{E}[f(x_s)] - \sum_{s=1}^{k} \, \frac{s}{\sum_{s=1}^{k} s} \, \mathbb{E}[f(x_*)].\label{eq:proof_end} \end{equation} By combining \eqref{eq:proof_end-1} and \eqref{eq:proof_end}, we conclude the proof. \end{proof} \subsection{Rate in the convex case} In this subsection, we state the convergence rate of the BSG method assuming that~$f$ is convex and attains a minimizer~$x_*$. \begin{assumption}[Convexity of the UL objective function]\label{ass:convexity} Given $(\bar y,y) \in \mathbb{R}^m \times \mathbb{R}^m$, the (continuously differentiable) function $f$ is convex in $x$, namely, \begin{equation}\label{eq:convexity} f(\bar x) \; \ge \; f(x) + \nabla f(x)^\top (\bar x - x) \text{ for all } (\bar x, x) \in \mathbb{R}^n \times \mathbb{R}^n. \end{equation} Moreover, $f$ attains a minimizer. \end{assumption} The next theorem states that the BSG method exhibits a sublinear convergence rate of $1/\sqrt k$, which implies that the convergence is slower than in the strongly convex case~\cite[Theorem~5.3]{SLiu_LNVicente_2019}. \begin{theorem}\label{theorem:conv} Let Assumptions~\ref{ass:smoothness}--\ref{ass:boundedness} and \ref{ass:convexity} hold. Consider the schema given by Algorithm~\ref{alg:BSG_DS} and assume a decaying step size of the form $\alpha_k = \bar{\alpha}/\sqrt{k}$, with $\bar{\alpha} > 0$. Given a minimizer~$x_*$ of~$f$, the sequence of iterates yielded by Algorithm~\ref{alg:BSG_DS} satisfies \[ \min_{s = 1, \ldots, k} \mathbb{E}[f(x_s)] - \mathbb{E}[f(x_*)] \; \le \; \frac{\frac{\Theta^2}{2 \bar \alpha} + \bar \alpha (G_d + 2 (B + C_d) \Theta)}{\sqrt k}. \] \end{theorem} \subsection{Imposing a bound on the distance from the LL optimal solution}\label{sec:bound_SGD} In this subsection, we want to discuss a way to enforce Assumption~\ref{ass:assumption_SGD} when using the stochastic gradient (SG) method to solve the LL~problem at $x_k$. Given an initial point~$\tilde{y}_k^0$ and a sequence of stepsizes $\{ \beta_i \}$, such a SG method can be described as \begin{equation} \label{eq:SG} \tilde{y}_k^{i+1} \; = \; \tilde{y}_k^{i} - \beta_i g^\ell_y (x_k, \tilde{y}_k^{i}, w^\ell_{k,i}), \quad i=1,\ldots,i_k. \end{equation} We start by introducing the sampling assumptions that are standard in the literature related to the SG method. \begin{assumption}\label{ass:unbiasedness_g} The stochastic gradient $g^\ell_y(x_k,\tilde{y}_k,w_k^\ell)$ is unbiased \begin{equation} \mathbb{E}_{w_k^\ell}[g_y^\ell(x_k,\tilde{y}_k,w^\ell_k)] \; = \; \nabla_y f_\ell(x_k,\tilde{y}_k). \end{equation} Moreover, there exists a positive constant $Q > 0$ such that \[ \mathbb{E}_{w_k^\ell}[\|g^\ell_y(x_k,\tilde{y}_k,w_k^\ell)\|^2] \; \le \; Q^2. \] \end{assumption} Moreover, we assume $f_\ell$ to be strongly convex (Assumption~\ref{ass:strong_convexity_fl} below). \begin{assumption}[Strong convexity of the LL objective function]\label{ass:strong_convexity_fl} Given $x \in \mathbb{R}^n$, the function $f_\ell$ is strongly convex in $y$, namely, there exists a constant $\mu > 0$ such that \begin{equation*} f_\ell(x,\bar y) \; \ge \; f_\ell(x, y) + \nabla f_\ell(x, y)^\top (x, \bar y - y) + \frac{\mu}{2}\Vert x, \bar y - y \Vert^2 \text{ for all } (y,\bar y) \in \mathbb{R}^m \times \mathbb{R}^m. \end{equation*} \end{assumption} Assumption \ref{ass:strong_convexity_fl} implies that $f_\ell(x_k,\cdot)$ has a unique minimizer~$y(x_k)$. Recalling that the convergence rate of the SG method with decaying stepsize is ${\cal O}(1/\sqrt{i})$, and by choosing $i_k$ equal to~$k^2$, one guarantees the existence of a positive constant~$C_y$ such that~(\ref{eq:conv_y}) holds. In fact, by choosing a decaying step size sequence $\{\beta_i\}$ given by $\beta_i = \gamma/i$, where $\gamma \ge 1/(2\mu)$ is a positive constant, and under Assumptions~\ref{ass:unbiasedness_g}--\ref{ass:strong_convexity_fl}, from \cite[Equation~(2.9)]{ANemirovski_etal_2009} it follows that the choice $i_k = k^2$ implies (with $\tilde{y}_k = \tilde{y}_k^{i_k+1}$) \[ \mathbb{E}[\Vert \tilde{y}_k - y(x_k)\Vert^2] \; \le \; \frac{\max\{\gamma^2 Q (2 \mu \gamma - 1)^{-1},\| \tilde{y}_k^0 - y(x_k) \|^2\}}{k^2}. \] We point out that in order for the previous result to hold in the constrained LL case, $Y(x_k)$ is required to be a nonempty bounded closed convex set. \subsection{Imposing a bound on dynamic sampling}\label{sec:bound_biasedness} In this subsection, we want to mention a dynamic sampling strategy to enforce the inequality in Assumption~\ref{ass:assumption_sampling}. For the sake of simplicity, we will omit the subscript~$k$ in this subsection. Such a dynamic sampling strategy allows reducing the level of noise by increasing the size of the batch. Since Assumption~\ref{ass:unbiasedness_g} implies that $D(x, y,\xi)$ (see~(\ref{eq:D(x,y,epsilon)}) for the unconstrained LL case) is an unbiased estimate of the corresponding true gradients and Hessians, let us assume that $D(x, y, \xi)$ is normally distributed with mean $D(x,y)$ (see~(\ref{eq:D(x,y)}) for the unconstrained LL case) and variance $\sigma^2$ (and that the dimension of the covariance matrix is~$q$). To increase the accuracy of $D(x,y,\xi)$ as an estimator of $D(x,y)$, we can choose a larger batch size, which is denoted by $b_D$. Let $\bar D(x,y,\xi) = (1/b_D) \sum_{r=1}^{b_D} D(x,y,\xi^r)$ be the corresponding mini-batch stochastic estimate, where $\{\xi^r\}_{r=1}^{b_D}$ are values sampled from $\xi$. It is known that (for details, see, for instance, \cite[Section~5.3]{SLiu_LNVicente_2019}) \begin{equation*} \mathbb{E}_{\xi_k}[\Vert D(x,y) - \bar D(x,y,\xi) \Vert] \; \le \; \frac{\sigma \sqrt{q}}{\sqrt{b_D}}.\label{eq:iiiii} \end{equation*} To guarantee that Assumption~\ref{ass:assumption_sampling} holds, we need to choose a mini-batch size~$n_D$ and a sample standard deviation~$\sigma$ such that \begin{equation*} \frac{\sigma \sqrt{q}}{\sqrt{b_D}} \; \le \; C_D \, \alpha_k. \end{equation*} Therefore, when $\alpha_k$ decreases, the dynamic sampling strategy would increase $b_D$. \section{Continual learning}\label{sec:continual_learning} We are going to use instances of Continual Learning (CL) as practical stochastic bilevel problems to test the performance of BSG and DARTS. CL was briefly described in Section~\ref{sec:introduction}, and is now introduced in more detail. Let us denote a whole features/labels dataset by ${\cal D} = \{ (z_j, u_j), \, j \in \{ 1, \ldots , N\} \}$, consisting of $N$~pairs of a feature vector $z_j$ and the corresponding true label $u_j$. For any data point~$j$, the classification is deemed correct if the right label is predicted. To evaluate the loss incurred when using the prediction function $\phi (z; \theta)$, which in this section is supposed to be a Deep Neural Network (DNN), we use a loss function $\ell(\phi (z; \theta), u)$. The goal of CL is to minimize the prediction error over a sequence of tasks that become available one at a time. Among the many different formulations proposed for CL, hierarchical objectives have been used in~\cite{QPham_etal_2020,AShaker_etal_2020}. In order to assess the performance of BSG against DARTS on this class of problems, we adapt the formulation in~\cite{QPham_etal_2020} to an incremental setting where each task is available as a subset of samples. Given $t \in \{1, \ldots, T\}$, let ${\cal D}_t$ be the set of samples for a new task $T_t$, which can be split into a training set $D^t_{\tr}$ and a validation set $D^t_{\va}$. Moreover, let us split the parameters $\theta_t$ of the model $\phi (z; \theta_t)$ into two subvectors, $\lambda_t$ and $\delta_t$, whose roles are to give us flexibility in minimizing the classification error on the training and validation data along the sequence of tasks. According to \cite{LFranceschi_etal_2018}, a reasonable strategy is to choose $\lambda_t$ and $\delta_t$ as the vectors of weights in the hidden and output layers, respectively. To solve the overall CL problem, one starts from the first task $T_1$ and, after an arbitrary number of iterations, we include in the problem the second task $T_2$. One reiterates this procedure until all the tasks have been added to the problem. Let us now suppose that one has already added $t$ tasks. At this stage, the goal of the UL and LL problems is to determine the values of $\lambda_t$ and $\delta_t$ that ensure a small classification error on $T_t$ and on all the previous tasks $T_{i}$, with $i < t$. To this end, the UL problem determines $(\lambda_t,\delta_t)$ by minimizing the prediction error on $D^t_{\val} = \cup_{i \le t} D^i_{\va}$, which is composed of the data sampled from the validation sets associated with the current and previous tasks. Similarly, the LL problem determines $\delta_t$ by minimizing the error on $D^t_{\train} = \cup_{i \le t} D^i_{\tr}$. Note that at each stage one solves a different problem since the objective functions of the UL and LL change. The formulation of the problem solved at stage $t$, with $t \in \{1, \ldots, T\}$, can be written as follows \begin{equation}\label{prob:bilevel_continual_learning} \begin{split} \min_{(\lambda_t, \, \delta_t)} ~~ & \frac{1}{|D_{\val}^t|} \sum_{(z, u) \in \, D_{\val}^t} \ell(\phi (z; \lambda_t, \delta_t), u) \\ \mbox{s.t.}~~ & \delta_t \in \argmin_{\delta_t} ~~ \frac{1}{|D_{\train}^t|} \sum_{(z, u) \in \, D_{\train}^t} \ell(\phi (z; \lambda_t,\delta_t), u). \end{split} \end{equation} Moving from one task to a sequence of tasks introduces new challenges relative to the classic empirical risk minimization. In particular, once a new task is included in the problem, the performance on the previous tasks tends to deteriorate, thus resulting in the well-studied phenomenon of \textit{catastrophic forgetting} \cite{IJGoodfellow_MMirza_DXiao_ACourville_YBengio_2013}. Moreover, parameters learned on previous tasks are expected to be close to the parameters required by the new task (this is referred to as a positive transfer of knowledge between tasks), which leads to accelerating the learning process as compared with training from scratch. Solving the sequence of problems given in~\eqref{prob:bilevel_continual_learning} allows the learning process to both overcome the catastrophic forgetting issue and take advantage of the parameters determined on the previous tasks. However, we point out that the large dimension of the datasets usually considered in ML may prevent the use of the whole sets $D^i_{\tr}$ and $D^i_{\va}$ from previous tasks $i$'s, where $i < t$ and $t$ is the current task. In such cases, it may be necessary to resort to subsets $\bar D^i_{\tr} \subset D^i_{\tr}$ and $\bar D^i_{\va} \subset D^i_{\va}$, which we will not do in this paper given that our interest focuses on the solution of stochastic BLPs. \section{Numerical experiments}\label{sec:numerical_experiments} All tests were run using MATLAB R2021a on an Acer Aspire with~8GB of RAM and an Intel Core~i7-8550U processor running at~1.80GHz. In all figures, we plot an accurate approximation for the true function~$f$ of the BLP ($f(x)=f_u(x,y(x))$). \subsection{Our practical BSG method (BSG-1)}\label{sec:stochasticBLP_DARTS} In the numerical experiments for unconstrained LL BLPs ($Y(x) = \mathbb{R}^m$), we are mainly interested in testing the practical version of the BSG method (Algorithm~\ref{alg:BSG_DS}), with the BSG approximation introduced in Section~\ref{sec:cont}. This version is referred to as the BSG-1 method and requires no second-order derivatives (not even finite-difference approximations) and no Hessian-vector products; see Algorithm~\ref{alg:BSG1}. It essentially consists of using first-order rank-1 approximations for the Hessian matrices appearing in the adjoint formula~(\ref{adjoint}). The BSG-1 formula for the deterministic case was already given in~\eqref{approx-BSG}. In the stochastic setting, we have \begin{equation}\label{eq:adjoint_GN_stoch} d(x_k, \tilde y_k, \xi_k) \; = \; - \left( g^u_x(x_k,\tilde{y}_k,w^u_k) - \frac{(g^\ell_y(x_k,\tilde{y}_k,w^\ell_k))^\top g^u_y(x_k,\tilde{y}_k,w^u_k)}{(g^\ell_y(x_k,\tilde{y}_k,w^\ell_k))^\top g^\ell_y(x_k,\tilde{y}_k,w^\ell_k)} g^\ell_x(x_k,\tilde{y}_k,w^\ell_k) \right). \end{equation} \begin{algorithm}[H] \caption{BSG-1 Method (unconstrained UL case)}\label{alg:BSG1} \begin{algorithmic}[1] \medskip \item[] {\bf Input:} $(x_0,y_0) \in \mathbb{R}^n \times \mathbb{R}^m$, $\{\alpha_k\}_{k \geq 0} > 0$. \medskip \item[] {\bf For $k = 0, 1, 2, \ldots$ \bf do} \item[] \quad\quad {\bf Step 1.} Obtain an approximation $\tilde{y}_k$ to the LL optimal solution $y(x_k)$. \nonumber \item[] \quad\quad {\bf Step 2.} Draw the stochastic gradients $g^u_x(x_k,\tilde{y}_k,w^u_k)$, $g^u_y(x_k,\tilde{y}_k,w^u_k)$, $g^\ell_x(x_k,\tilde{y}_k,w^\ell_k)$, and $g^\ell_y(x_k,\tilde{y}_k,w^\ell_k)$. Compute $d(x_k, \tilde y_k, \xi_k)$ using~(\ref{eq:adjoint_GN_stoch}). \item[] \quad\quad {\bf Step 3.} Compute $x_{k+1} = x_{k} + \alpha_k \, d(x_k, \tilde y_k, \xi_k)$. \item[] {\bf End do} \par\bigskip\noindent \end{algorithmic} \end{algorithm} We will also test the BSG method with stochastic Hessians, where the direction is calculated from~(\ref{stochastic-adjoint}). This version is referred to as BSG-H. The adjoint system $H^{\ell}_{yy}(x_k,\tilde{y}_k,w^\ell_k) \lambda= - g^u_y(x_k,\tilde{y}_k,w^u_k)$ is solved by the linear conjugate gradient method until non-positive curvature is detected. In both BSG-1 and BSG-H versions of the BSG method, we will apply the SG method~(\ref{eq:SG}) in Step~1 of Algorithm~\ref{alg:BSG_DS} for a certain budget~$i_{k}$ of iterations, obtaining an approximation~$\tilde y_k$ to the LL optimal solution~$y(x_k)$. We will consider two inexact schemes for the solution of the LL~problem. The first one ({\sf 1 step}) consists of taking a single step of SG ($i_k=1, \forall k$). In the second one ({\sf inc. acc.}), the number of SG steps increases by~1 every time the difference of the UL~objective function between two consecutive iterations is less than a given threshold, thus leading to an increasing accuracy strategy. In any of the two cases, we feed SG with a hotstart $\tilde{y}_k^0=\tilde{y}_{k-1}$ (and set $\tilde{y}_{-1}=y_0$). \subsection{DARTS}\label{sec:stochasticBLP_DARTS} DARTS was proposed in~\cite{HLiu_KSimonyan_YYang_2019} for the solution of stochastic BLPs arising from NAS, and was briefly mentioned in Section~\ref{sec:BSD}. Only the unconstrained LL case ($Y(x) = \mathbb{R}^m$) has been considered. To avoid the computation of the second-order derivatives in~(\ref{eq:DARTS}), DARTS approximates the matrix-vector product $\nabla^2_{xy} f_\ell (x_k, y_k) \nabla_{y} f_u (x_k, \tilde y_k)$ by a finite-difference (FD) scheme~\cite{HLiu_KSimonyan_YYang_2019}: \[ \nabla^2_{x y} f_\ell (x_k, y_k) \nabla_{y} f_u (x_k,\tilde y_k) \; = \; \frac{\nabla_{x} f_\ell(x_k, y^+_k) - \nabla_{x} f_\ell(x_k,y^-_k)}{2 \varepsilon}, \] where \begin{equation} \label{eq:ypm} y^\pm_k \;=\; y_k \pm \varepsilon \nabla_{y} f_u(x_k, \tilde y_k) \quad \mbox{with} \quad \varepsilon \;=\; 0.01/\| \nabla_{y} f_u (x_k,\tilde y_k) \|. \end{equation} Algorithm~\ref{alg:DARTS} reports the schema of DARTS for the stochastic setting. In Step~1, a single step of SG (with fixed stepsize $\eta$) is applied to the LL problem to obtain an approximation $\tilde{y}_k$ to the LL optimal solution. Then, in Step~2, the UL variables are updated by moving along the ``approximated'' descent direction using a fixed stepsize~$\alpha$. \begin{algorithm}[H] \caption{Differentiable Architecture Search (DARTS)}\label{alg:DARTS} \begin{algorithmic}[1] \medskip \item[] {\bf Input:} $(x_0,y_0) \in \mathbb{R}^n \times \mathbb{R}^m$, $\alpha > 0$, $\eta > 0$. \medskip \item[] {\bf For $k = 0, 1, 2, \ldots$ \bf do} \item[] \quad\quad {\bf Step 1.} Compute $\tilde y_k = y_k - \eta \, g_y^\ell(x_k, y_k, w_k^\ell)$. \item[] \quad\quad {\bf Step 2.} Compute $x_{k+1} = x_k - \alpha \left( g_x^u(x_k, \tilde y_k, w_k^u) - \frac{\eta}{2 \varepsilon} (g_x^\ell(x_k, y_k^+, w_k^\ell) - g_x^\ell(x_k, y_k^-, w_k^\ell) ) \right)$, with $y_k^\pm$ and $\varepsilon$ as in~(\ref{eq:ypm}), with~$g_y^u(x_k, \tilde y_k, w_k^u)$ instead of~$\nabla_{y} f_u(x_k, \tilde y_k)$, and set $y_{k+1}=\tilde{y}_{k+1}$. \item[] {\bf End do} \par\bigskip\noindent \end{algorithmic} \end{algorithm} \subsection{Results for synthetic learning instances} We first report results for a ``synthetic'' bilevel supervised ML problem, where one attempts to minimize the prediction error on both levels, but where the LL training set is a subset of the upper one. It is as if we wanted to learn a predictor from a superset (the UL one) but guaranteeing a good performance in a subset (the LL one). For simplicity, we will perform binary classification using a logistic regression loss for misclassification. Let us denote the whole features/labels dataset by ${\cal D} = \{ (z_j, u_j), \, j \in \{ 1, \ldots , N\} \}$. The prediction model consists of a separating hyperplane $c^\top z +b$ that delivers a correct classification if \begin{equation*} \left\{\begin{aligned} c^{\top} z_j + b \geq 0 & \text { when } u_j = +1, \\ c^{\top} z_j + b < 0 & \text { when } u_j = -1. \end{aligned}\right. \end{equation*} To measure misclassification, we use the (smooth and convex) logistic regression loss function $\ell(z, u; c, b) = \log(1 + \exp(- u (c^\top z + b)))$. We split the dataset into two groups of dimension $N_{T_1}$ and $N_{T_2}$, respectively, which are used to train the prediction model at both levels of the BLP, which is formulated as \begin{equation}\label{prob:bilevel_log_reg} \begin{split} \min_{(\bar c, \ \bar b, \ c, \ b)} ~~ & \frac{1}{N_{T_1}} \sum_{j = 1}^{N_{T_1}} \ell(z_j, u_j; \bar c, \bar b) + \frac{1}{N_{T_2}} \sum_{j = 1}^{N_{T_2}} \ell(z_j, u_j; c, b) \\ \mbox{s.t.}~~ & (c, \ b) \in \argmin_{(c, \ b)} ~~ \frac{1}{N_{T_2}} \sum_{j = 1}^{N_{T_2}} \ell(z_j, u_j; c, b) + \frac{\lambda}{2} \Vert (\bar c,\bar b)-(c,b)\Vert^2. \end{split} \end{equation} We refer to the UL objective function as the prediction error. Note that $x =(c,b)$ are the UL variables, while $y=(\bar c,\bar b)$ are the LL variables. The second term in the LL objective function (where $\lambda$ is a positive parameter) requires the $y$'s to be close to the $x$'s, so that the model predicted on the superset does not deviate much from the one predicted on the subset. In the numerical experiments reported, we used the {\it Adult Income} dataset~\cite{RKohavi_1996} (which can be found in the UCI Machine Learning repository~\cite{DDua_CGraff_2019}), after performing the preprocessing described in~\cite[Appendix D]{SLiu_LNVicente_2020}. We randomly chose 37,500 instances (split into $N_{T_1} = 30,000$ and $N_{T_2} = 7,500$). We compared BSG-1 and BSG-H with DARTS using the best decaying stepsize (DS) sequence found for both (i.e., $\{10/k\}_{k \in \mathbb{N}}$ for BSG-1/BSG-H and $\{1/k\}_{k \in \mathbb{N}}$ for DARTS). Three metrics are used for the comparison: the number of iterations, the number of accessed data points, and the CPU time. The number of accessed data points refers to the number of samples that are used in each algorithm to compute the stochastic gradients and, in the BSG-H case, also the Hessians. From Figure~\ref{fig:logRegADULT_miniBatch_512_512}, we can see that all BSG variants perform significantly better than DARTS. The BSG versions equipped with the LL {\sf inc. acc.} (with threshold equal to $10^{-4}$) yield the smallest prediction error in the least number of iterations. However, this requires accessing a large number of samples. The most cost-effective performance in terms of accessed data points is exhibited by the BSG versions equipped with the LL {\sf 1~step}, especially the BSG-1. Considering the stronger performance achieved by BSG-1, we performed additional testing to study possible ways of improving DARTS, as discussed in Subsection~\ref{sec:cont}. In particular, we assessed the performance of DARTS when scaling the term $\nabla_{y} f_u (x_k, \tilde y_k)$ in $g_k^{\DARTS}$ by the factor $1/\|\nabla_{y} f_\ell (x_k, \tilde y_k)\|^2$ (which in the plots is referred to as {\sf $\| \nabla_y f_{\ell} \|^{-2}$}) and when taking $\eta = 1$ in $g_k^{\DARTS}$ regardless of the value assigned to $\eta$ for updating the LL variables (we indicate this modification as {\sf $\eta = 1$}). Figure~\ref{fig:logRegADULT_miniBatch_512_512_DARTS} shows that on the logistic regression instance considered, DARTS significantly improves in both cases, and the improvement is even larger when both modifications are considered together. The red dotted horizontal lines in both figures represent the minimum value of the true function~$f$ (recall that $f(x)=f_u(x,y(x))$), found by the full-batch/deterministic BSG method with line-search. The red dashed horizontal lines in both figures mark the minimum value of the upper level function~$f_u$ (in~$x$ and~$y$) when relaxing the original problem by suppressing the LL problem, found by MATLAB with {\tt fmincon}. \begin{figure} \centering \includegraphics[scale=0.48]{Comparison-512-512-BSGX10-GN-Hess-DARTS-DS_final_trueFunct.png} \quad \includegraphics[scale=0.48]{Comparison-512-512-BSGX10-GN-Hess-DARTS-DS_final-Zoom_trueFunct.png} \caption{Comparison of four different variants of the {\sf BSG} method with the {\sf DARTS} one (the lower plots zoom in for the {\sf BSG} ones). The mini-batch size is 512 for both the UL and LL problems. }\label{fig:logRegADULT_miniBatch_512_512} \end{figure} \begin{figure} \centering \includegraphics[scale=0.48]{logRegDARTSimproved_withBSG-DSX10_trueFunct.png} \caption{Comparison of four different variants of the {\sf DARTS} method with the {\sf BSG-1} one. The mini-batch size is 512 for both the UL and LL problems. }\label{fig:logRegADULT_miniBatch_512_512_DARTS} \end{figure} \subsection{Results for continual learning instances} We now present numerical results comparing BSG-1 and DARTS on the CL problems~(\ref{prob:bilevel_continual_learning}) that were posed in Section~\ref{sec:continual_learning}. In our implementation, we determine $\lambda_t$ on the current problem by starting from the parameter values found from the previous problem. However, since each consecutive task increases the output space of the DNN, we entirely re-initialize $\delta_t$ at the start of each new task so that the model outputs are not biased from previous tasks. In order to test our algorithm on a large-scale ML scenario, we chose the well-studied MNIST dataset that consists of 70,000 black-and-white images (28 $\times$ 28) of hand-written digits. We used 60,000 images for training and the remaining 10,000 images for validation. We solved five problems~(\ref{prob:bilevel_continual_learning}) with an increasing number of tasks from~$1$ to~$5$, where the first task datasets ($D_{\text{val}}^1$ and $D_{\text{train}}^1$) consist of only the images with class labels in $\{0,1\}$, the second task datasets ($D_{\text{val}}^2$ and $D_{\text{train}}^2$) consist of the images with class labels in $\{0,1,2,3\}$, etc., until the final task datasets ($D_{\text{val}}^5$ and $D_{\text{train}}^5$), which are the original training and validation sets and consist of all the class labels $\{0,1,...,9\}$. Further, we implemented a DNN with two convolutional layers and one linear layer as our model. The network consisted of~18,816 and~125,450 weights in the hidden and output layers, respectively. For the UL and LL~problems, we have used batches of sizes equal to~0.5\% and~0.1\% of the ones of the current task's validation and training datasets, respectively. When evaluating the UL and LL~objective functions, such percentages are increased to~5\% and~1\%, respectively, to ensure better accuracy. The results from the numerical experiment can be seen in Figure~\ref{fig:CL_MNIST}, where two variants of~{\sf BSG-1} are compared against~{\sf DARTS} when fixed stepsizes {\sf (FS)} are used. In particular, for~BSG-1, such results were gathered when using in the LL problem either~1~step or an increasing accuracy strategy with threshold equal to $10^{-1}$. By the nature of the CL problem, we expect to see five separate ``jumps'' in the validation error indicating the start of a new task. As the tasks progress, both variants of~BSG-1 converge faster than~DARTS, as they achieve smaller values of the validation error, especially the~BSG variant using the increasing accuracy strategy. DARTS is not able to guarantee a sufficiently small error on the validation data for all tasks, despite some initial improvement obtained. For this problem, we used UL and LL fixed stepsizes of~0.007 for the three algorithmic variants such that the results would be comparable. We emphasize that DARTS cannot make further improvements by taking more steps in the LL problem, whereas BSG-1 will perform better the more accurately the LL problem is solved, leaving room for even further improvement in performance. \begin{figure} \centering \includegraphics[scale=0.48]{CL_BSG_1step_inc_acc_vs_DARTS_TrueFunct_stop500iter.png} \caption{Comparison of two variants of the {\sf BSG-1} method ({\sf 1 step} and {\sf inc. acc.}) with the {\sf DARTS} one when fixed stepsizes {\sf (FS)} (of value equal to~0.007) are used. The comparison is based on the number of iterations. }\label{fig:CL_MNIST} \end{figure} \section{Concluding remarks and future work}\label{sec:conclusions} In this paper, we introduced a practical bilevel stochastic gradient (BSG) method for large-scale bilevel optimization problems, we suggested simple and effective improvements for DARTS, and we provided a general convergence theory for BSG methods that also covers the constrained LL case. Even in the unconstrained LL case, the convergence theory presented in this paper allows for more abstraction from the building blocks of adjoint gradients. In particular, the use of rank-1 Hessian approximations in our BSG-1 method allowed us to both approximate the second-order derivatives in the adjoint formula and avoid explicitly solving the adjoint equation (also dismissing any matrix-vector products). Although DARTS does not incorporate descent or first-order principles, it is commonly applied to solve NAS problems due to its practical satisfactory performance. Our numerical experiments showed that \mbox{BSG-1} performs significantly better than DARTS on the logistic regression and continual learning instances considered. The modifications we suggested for improving DARTS are effective when tested on the logistic regression instances. Further exploration of improvements for BSG-1 and DARTS methods on other large-scale learning problems is left as future work (in particular the use of variance reduction techniques, as already proposed in~\cite{TChen_YSun_WYin_2021,JYang_KJi_YLiang_2021}). Moreover, BSG methods have been so far limited to the unconstrained LL case because the only resource used has been the adjoint formula. It is however possible to calculate a descent direction in the constrained LL case, and we have thus shown how to develop BSG methods for such a case. An approximate BSG direction can be obtained through the solution of an auxiliary LQ bilevel problem; see Subsection~\ref{sec:constrained}. Our convergence theory already indicates that if the error in the norm between such a direction and the negative gradient of~$f$ is of the order of the stepsize, one retains the classical sublinear SG rate. One needs to numerical test the constrained LL approach presented in this paper and make it efficient, robust, and scalable. Finally, the algorithmic framework and the convergence theory have to be further developed to address the non-convex case (at both upper and lower levels) as well as UL constraints in both UL and LL variables. Significant innovation is expected when BSG is applied to the formulations that are proposed to overcome the critical issue of {\it catastrophic forgetting} in continual learning. The formulation introduced in~\cite{DLopezPaz_MARanzato_2017} uses inequality constraints to ensure that, at each stage, the current model outperforms the old model on the previous tasks, thus preventing the deterioration of the classification accuracy when learning new tasks. A similar idea is exploited in the bilevel formulation proposed in~\cite{AShaker_etal_2020}, where the violation of the constraints in~\cite{DLopezPaz_MARanzato_2017} is penalized (and hence such constraints are possibly not satisfied at the optimal solution). One expects a considerable improvement by adapting problem~\eqref{prob:bilevel_continual_learning} to the constrained LL case, and then solving it using the BSG direction described in Subsection~\ref{sec:constrained}. The promising results on the ML instances considered in this proposal suggest that the \mbox{BSG-1} method has the potential to perform well on the unconstrained bilevel formulations of NAS, which in the literature are still tackled by using DARTS when a continuous relaxation of the (discrete) search space is used~\cite{PRen_etal_2021}. We point out that using the rank-1 Hessian approximations is crucial to allow the application of the BSG method to NAS, which would not be possible otherwise due to the extreme dimensions of the resulting bilevel problems. Moreover, the fact that BSG can solve bilevel optimization problems with constrained LL problems paves the way for the solution of new NAS formulations. In particular, one could think of including in the LL problem constraints that help the model avoid overfitting~\cite{SNRavi_TDinh_VSLokhande_VSingh_2019} or constraints that depend on the specific learning instances considered~\cite{SSangalli_etal_2021}.
\section{Idiom Detection} Lexicon construction is done through a two step process. First, we curate the lexicon from the mentioned source. Since many entries in this lexicon are templates like \textit{behind someone's back} which could have multiple realizations (e.g \textit{behind her back}), we use a rule-based procedure to expand such instances to all possible realizations by enumerating over all POS combinations (nominative pronoun, nominative pronoun-verb, verb-accusative pronoun etc as applicable). For this, we use the \textit{pyinflect} library. \section{Additional Discussion on Properties of Figurative Utterances} \label{subsec:propfigcontinued} \noindent \textbf{Dialog Acts:} Since DailyDialog has dialog acts annotated amongst 4 types ( \textit{inform}, \textit{question}, \textit{directive}, \textit{commissive}), we analyze how figurative language distributes over these types. Amongst figurative utterances, \textit{inform} is more dominant than overall (58.7\% vs 43.2\%), while \textit{question} (32.2\% vs 22.0\%) and \textit{directive} (10.7\% vs 17.3\%) are underrepresented. \section{Wiktionary Mitigation - Resource Description} \label{sec:wiktionaryAnalysis} The final postprocessed version of the resource contains 17743 entries - these are distributed as 88.53\% `idioms', 8.08\% euphemisms and 3.39\% similes. The `idioms' here consist of both idioms proper and conventionalized metaphors - it is not easy to provide an exact breakup since Wiktionary does not distinguish between the two. \subsection{Examples} \label{subsec:wiktionaryExamples} In Table \ref{tab:wiktionaryExamples}, we enlist a few examples from the Wiktionary lexicon for each figurative construct type. The complete resource can be found in our submission materials at \textit{Data/MitigationDictionary} \begin{table}[t] \centering \small \begin{tabular}{@{}lll@{}} Type & Phrase & Literalization \\ \toprule Idiom & a bridge too far & a step or action that is \\ & & too ambitious \\ \midrule Idiom & a life of its & an independent existence \\ & own & with some characteristics \\ & & of life \\ \midrule Idiom & a wild goose & most things are inherited \\ & never laid a & and predetermined \\ & tame egg & \\ \midrule Euphemism & aurally & deaf or hard of \\ & challenged & hearing \\ \midrule Euphemism & between jobs & unemployed \\ \midrule Euphemism & bite the dust & die \\ \midrule Simile & as modern as & thoroughly \\ & next week & modern \\ \midrule Simile & avoid like & evade or \\ & the plague & shun \\ \midrule Metaphor & bear the & endure the worst \\ & brunt & part of something \\ \midrule Metaphor & beat a & persist or continue \\ & dead horse & far beyond any \\ & & specific purpose \\ \midrule Metaphor & cede the & withdraw from any \\ & field & confrontational or \\ & & potentially confrontational \\ & & situation \\ \bottomrule \end{tabular} \caption{Examples from the Wiktionary lexicon resource} \label{tab:wiktionaryExamples} \vspace{-3ex} \end{table} \section{Additional Implementation Details} \textbf{Compute Infrastructure:} We used Nvidia RTC 2080 Ti GPU cards to run GPU based models. \\ \noindent \textbf{Run time:} On an average, it took about 5 hours to train GPT2 based models on DD dataset. Typical inference time ranges from 10-20 minutes. \\ \noindent \textbf{Number of parameters:} GPT2 has approx 120M parameters. \\ \noindent \textbf{Hyper-parameter search:} We varied random seed and the learning rate, when training GPT based models. We use validation loss to pick the best configuration. Best configuration uses initial random seed of 123. \section{Additional Data Collection Details} \textbf{Annotation Framework:} A screenshot of the rating annotation collection task is shared in Figure \ref{fig:amt}. \begin{figure*} \centering \includegraphics[width=0.95\textwidth]{Diagrams/amt.png} \caption{Annotation Framework to collect human judgement ratings on appropriateness of generated response with respect to dialog context.} \label{fig:amt} \end{figure*} \noindent \textbf{Quality Control} We restrict to annotators with $>90\%$ HIT acceptance rate. We also perform spot checks and skip the ratings from annotators who seemed not to be adhering to the provided instructions. \section{Qualitative Examples} In this section, we enlist qualitative examples from the various stages of analysis performed in our work. Table \ref{tab:qualExamples} shows how various models respond to example figurative contexts. Table \ref{tab:pullexamples} shows examples where figurative contexts are misinterpreted by models, with the response relying on the unintended literal sense of the construct. Table \ref{tab:mitigationexamples} shows examples where literalization of the figurative context improves quality of the model response. \begin{table}[t] \centering \footnotesize \begin{tabular}{@{}l@{}} \toprule \textsc{Dialog Context:} \\ A: sure do . i \textit{get a kick out of} looking punk . \\ B: this one looks really expensive though . \\ \midrule \textsc{Human Written Response:} \\ A: it 's actually quite reasonably priced . \\ \midrule \textsc{Model Response (GPT2):} \\ A: i'm not one for a kick out. \\ \midrule \midrule \textsc{Dialog Context:} \\ A: not good . my cousin is \textit{driving me up the wall} . \\ B: how so ? \\ \midrule \textsc{Human Written Response:} \\ A: he is always being so loud and annoying . \\ \midrule \textsc{Model Response (GPT2):} \\ A: you know i'm a good \textit{driver}. \\ \midrule \midrule \textsc{Dialog Context:} \\ B: every time when heroes came back from the \\ battlefield we \textit{took our hats off} to them . \\ \midrule \textsc{Human Written Response:} \\ A: i think some people still do that today . \\ \midrule \textsc{Model Response (GPT2):} \\ A: they are just as beautiful as the \textit{red haired cap}. \\ \midrule \midrule \textsc{Dialog Context:} \\ A: that dress is very pretty. why don't you like it ? \\ B: \emph{It's too loud.} \\ \midrule \textsc{Human Written Response:} \\ A: we've been looking around for many hours. \\ \midrule \textsc{Model Response (CVAE):} \\ A: i think it 's too noisy for you. \\ \bottomrule \end{tabular} \caption{ Examples from DailyDialog illustrating how various model responses are affected by figurative constructs. } \label{tab:pullexamples} \end{table} \begin{table*}[ht!] \centering \scriptsize \addtolength{\tabcolsep}{-4pt} \begin{tabular}{|l|l|l| } \hline No & Type & Text \\ \hline \multirow{3}{*}{105-0} & \textsc{Context} & {\color{red} A: How come it is slow as a snail today ?} \\ & \textsc{GPT2} & {\color{teal} B: i think so. \textbf{it is a virus.} } \\ & \textsc{CVAE} & {\color{brown} B: it 's a skill . i have to work out the nerve . } \\ & \textsc{DualEnc} & {\color{violet} B: we are basically going to check your heart , lungs , blood sugar levels , and eyes , ears , and nose . } \\ & \textsc{HRED} & {\color{blue} B: it 's a good idea .} \\ & \textsc{Seq2Seq} & {\color{blue} B: i 'm afraid you have to . } \\ \hline \multirow{3}{*}{1-1} & \textsc{Context} & {\color{red} A: What would the roses cost me ? B: They're only \$ 20 a dozen. A: I like the sound of that } \\ & \textsc{GPT2} & {\color{teal} B: i 'll take one.} \\ & \textsc{CVAE} & {\color{brown} B: you can always get rid of the foods .} \\ & \textsc{DualEnc} & {\color{violet} B: you 'll only have to pay the initial fee . } \\ & \textsc{HRED} & {\color{blue} B: that 's a good idea . } \\ & \textsc{Seq2Seq} & {\color{orange} B: i 'll take it .} \\ \hline \end{tabular} \caption{Response utterances from five different models to some figurative contexts} \label{tab:qualExamples} \vspace{-3ex} \end{table*} \section{Conclusions} In this work, we demonstrate how existing dialog models fall short in handling figurative language use, and propose a light-weight mitigation technique to ameliorate this lacuna. We encourage future research in dialog models to separately analyze and report model performance The mitigation techniques used by us are pretty lightweight, but are not able to capture many occurrences of figurative language. Future work could look into improved techniques for figurative language detection. Our work is limited to a couple of open domain dialog datasets in English language. Similar analyses could be conducted on goal oriented dialog setups and datasets in other languages. \section*{Acknowledgements} We thank anonymous EMNLP reviewers for insightful comments and feedback. \section{Figurative Language In Open Domain Dialog} We experiment with \textbf{DailyDialog (DD)} dataset \cite{li2017dailydialog}, which is an open domain dialog corpus with 13.1K conversations on colloquial topics like Tourism, Health etc, of which 1K dialogs (6.74K utterances) form the test split. To carry out the desired analysis, we need to first identify the utterances in the dataset which have figurative language use. To achieve high precision labeling, we rely on manual annotations instead of using external figurative language detectors/classifiers. The task was performed manually by two graduate students (native English speakers) studying in a university with English as the primary language of instruction. Additionally, we request the annotators to also write down the literal equivalent versions of the utterances containing figurative language. We release the resulting subset of DailyDialog dataset as DailyDialog-Figurative (\textbf{DD-Fig}), consisting of those dialog instances which contain figurative language, along with two manually written literal versions of each utterance. Though figurative constructs are only mildly frequent at an utterance level (2.2\% in DD), their frequency of occurring at least once in a dialog is $\approx$6 times higher (13.1\%). This means that model sensitivity to figurative constructs is \emph{more significant} an issue than \emph{mere utterance-level frequency suggests}, since figurative constructs occurring anywhere in a dialog potentially affect all model responses for that dialog. Additionally, handling figurative constructs is still critical to robust long-tailed performance \cite{bamman2017natural}, which matters for worst-case behaviour and user satisfaction \cite{goel2010anatomy,ilievski2019identity}. Lastly, most the prevalent figurative constructs we observe are metaphors (45.8\%), idioms (47.3\%), rhetorical questions (5.3\%), hyperbole (6.9\%), and personification (3.8\%). Appendix \S B explores further properties of figurative prevalence. \section*{Ethics Statement} Our human preference/appropriateness ratings are collected over source content either directly sourced from, or based on typical, off-the-shelf models trained on already existing, publicly available and widely used dialog datasets - namely, DailyDialog \cite{li2017dailydialog} and Personachat \cite{zhang2018personalizing} as well as the multiple references dataset from \cite{gupta2019investigating}. We do collect human evaluation ratings using crowd-sourcing. However, we neither solicit, record or request any kind of personal or identity information from the annotators. Our work primarily performs experiments on dialog in English \cite{bender2018data}. Dialog models are known to suffer from biases learnable from dialog training data, such as gender bias \cite{dinan2020queens}. However, our work and contribution does not present or release any new models or model checkpoints, and is primarily concerned with more careful evaluation of a particular phenomena (i.e figurative language), and discussion on lightweight mitigation strategy related to the same. \section{Experiments} \begin{table}[t] \centering \small \begin{tabular}{@{}c@{\hskip 0.1in}c@{\hskip 0.1in}c@{\hskip 0.1in}c@{\hskip 0.1in}c@{\hskip 0.1in}c@{}} \textbf{Metric} & \textbf{Model} & \textbf{DD} & \textbf{DD-Fig} & \textbf{\% Drop} & \textbf{Rank-} \\ & & & & & \textbf{change} \\ \toprule Bleu-4 & GPT2 & 0.005 & 0.000 & 100.00 & 1\\ Bleu-4 & CVAE & 0.012 & 0.000 & 100.00 & -2 \\ Bleu-4 & DualEnc & 0.003 & 0.000 & 100.00 & 0 \\ Bleu-4 & HRED & 0.017 & 0.009 & 50.00 & -1 \\ Bleu-4 & Seq2Seq & 0.012 & 0.015 & -23.53 & 2 \\ \midrule Meteor & GPT2 & 0.130 & 0.105 & 18.84 & -2 \\ Meteor & CVAE & 0.135 & 0.114 & 15.54 & -1 \\ Meteor & DualEnc & 0.111 & 0.105 & 5.31 & 1 \\ Meteor & HRED & 0.134 & 0.114 & 15.24 & -1 \\ Meteor & Seq2Seq & 0.121 & 0.115 & 5.61 & 3 \\ \midrule Rouge-L & GPT2 & 0.166 & 0.146 & 11.90 & 0 \\ Rouge-L & CVAE & 0.319 & 0.283 & 11.47 & -1 \\ Rouge-L & DualEnc & 0.233 & 0.214 & 8.48 & 0 \\ Rouge-L & HRED & 0.329 & 0.297 & 9.91 & -1 \\ Rouge-L & Seq2Seq & 0.315 & 0.302 & 4.10 & 2 \\ \midrule Human & GPT2 & 3.278 & 2.712 & 17.27\% & 0 \\ Human & CVAE & 2.302 & 1.771 & 23.06\% & -1 \\ Human & DualEnc & 1.699 & 1.397 & 17.79\% & 0 \\ Human & HRED & 2.353 & 2.115 & 10.10\% & 0 \\ Human & Seq2Seq & 2.146 & 1.870 & 12.85\% & 1 \\ \bottomrule \end{tabular} \caption{\small We compare the model response quality for DD-Fig subset compared to the full DD. Across most of the models, we observe a considerable drop in response quality. Additionally, we note that relative ranks of various models as per automated metrics on Daily Dialog dataset show major changes when evaluating just on the figurative subset -- i.e. the best model overall might not be the best on the figurative subset, highlighting the need to separately report results on the data subset which has figurative language use. } \label{tab:dailydialogsubset} \end{table} \noindent \textbf{Do the dialog models perform worse on the data subset having figurative language use ?} We compare model performances on DD vs DD-Fig. For DailyDialog data, we consider model outputs provided by \citet{gupta2019investigating} from the following methods: CVAE \cite{DBLP:conf/acl/ZhaoZE17}, HRED \cite{Serban2016BuildingED}, Seq2Seq \cite{DBLP:journals/corr/VinyalsL15}, Dual-encoder (DualEnc) \cite{DBLP:conf/sigdial/LowePSP15}, and GPT2-medium \cite{radford2019language} fine-tuned on DD. To report automated metrics, we use the multi-reference annotation set collected by \citet{gupta2019investigating}. However, automated metrics may not be well correlated with output response quality \cite{DBLP:journals/corr/abs-2008-12009,DBLP:conf/acl/GangalJHB21}. Therefore, we also carry out human evaluations, wherein human annotators (on Amazon Mechanical Turk) are asked to judge the appropriateness of a dialog response on a 1-5 Likert scale. We observe that most of the models perform much worse on DD-Fig (Table \ref{tab:dailydialogsubset}), with the drop being close to 99\% in some cases. \vspace{2mm} \noindent \textbf{Relative Performance of Models:} We additionally investigate if the relative ranks of the models change when evaluating only on the subset with figurative language use compared to the entire test split. We note that there are some substantial changes in the relative ranks of the models (Table \ref{tab:dailydialogsubset}). For instance, as per Meteor and human-ratings, Seq2Seq performs better than CVAE on the figurative subset, while doing worse on the complete test dataset. Such changes in relative ranks further highlight the need to separately report results for the proposed data subsets. Interestingly, Seq2Seq improves its relative rankings in general on the DD-Fig subset. We hypothesize this is because it often generates very generic responses with little regard to the the context. \vspace{2mm} \noindent \textbf{Does replacing figurative language with semantically equivalent literal translations lead to better performance?} Above analysis only reports correlation in performance with contexts containing figurative language. However, there could be certain confounding factors involved. Thus, to make a more direct comparison, we compare model generated response when using figurative contexts versus their literal counterparts. To perform this experiment, we utilize the human written literal versions in DD-Fig, and experiment with the GPT2 model (which is the best performing model as per human rating on the overall dataset). We report results under two setups: (1) when figurative language is present in the last utterance of the dialog history, and (2) when figurative language is present anywhere in the dialog history. Human ratings are collected using the same procedure as described for Table \ref{tab:dailydialogsubset}. \begin{table}[t] \centering \small \begin{tabular}{@{}lcccc@{}} \bf Data/Model: & \bf DD-Fig/GPT2 & \bf PC-Fig/GPT \\ \toprule \multicolumn{3}{l}{Figurative in last utterance} \\ Bleu-3/4 & +98\% / +477\% & NA \\ Meteor/Rouge-L & +5.3\% / -3.6\% & NA \\ Human-rating & +12.1\% & +17.2\% \\ \midrule \multicolumn{3}{l}{Figurative anywhere in dialog history} \\ Bleu-3/4 & +13\% / +79\% & NA\\ Meteor/Rouge-L & +3.9\% / -3.0\% & NA \\ Human-rating & +13.7\% & +19.5\% \\ \bottomrule \end{tabular} \caption{\small We compute the \% change in performance when figurative language replaced with manually written literal counterparts in DD-Fig and PC-Fig data subsets. We observe that replacing figurative text in dialog context with literal version leads to improved dialog response quality. } \label{tab:dailydialogparallel} \vspace{-4mm} \end{table} Table \ref{tab:dailydialogparallel} shows the main results. For some metrics such as Bleu-4, models perform more than 5 times better when fed with literal translations instead of figurative language. Between the two setups under consideration, we observe slightly higher impact (as per human evaluation ratings) when one or more figurative language constructs are in use anywhere in the dialog history. \vspace{2mm} \noindent \textbf{Experiments with Personachat (PC):} PersonaChat \cite{zhang2018personalizing} is a persona grounded dialog corpus, with 1K dialogs (7.8K utterances) forming the test split. We use pre-trained GPT model and fine-tune it on the train split of the PC dataset. We follow the same tagging and annotation procedure for the test split of PC as we did on DD, and refer to the resulting dataset as PersonaChat-Figurative dataset (\textbf{PC-Fig}). Results in Table \ref{tab:dailydialogparallel} demonstrate reduction in performance of the dialog model in human evaluations (Automated overlap metrics in the case of PC are considered unreliable since PC contains only one reference per dialog context). We notice that compared to DailyDialog, PersonaChat utterances tend to be shorter, more informal, and highly spoken-language like utterances, with fast topic transitions. On replacing figurative language with its literal counterpart into such contexts, the replaced literal text, which is typically English of a more formal and written variety, ends up being much more out of sync with the context in the lexico-syntactic/stylistic sense than it is for DailyDialog. This has a slight downward effect on metrics, offsetting some of the gains from replacing away the figurative language. \section{Introduction} Human frequently employ figurative language such as metaphors \cite{carbonell1982metaphor} and idioms \cite{jackendoff1995boundaries} for effective and/or stylistic communication. Thus, dialog models interacting with humans should be equipped to handle these forms of communication. However, understanding figurative language might be challenging for machines since figurative constructions often exhibit non-compositional semantics and may rely on shared cultural and common-sense knowledge \cite{carbonell1983metaphor}. For example, a powerful GPT2 model fine-tuned on DailyDialog dataset is unable to handle the metaphor `built on the sand' (Figure \ref{fig:pullexample}), and the response seems to rely on the unintended literal sense of `sand'. \begin{figure}[t] \centering \includegraphics[width=0.45\textwidth]{Diagrams/DialFigLangKeynotev10.png} \caption{\footnotesize An example illustrating how model responses are affected by figurative constructs in dialog context. Here, the model conflates the metaphorical use of \textit{build on the sand} with its literal meaning, leading to an inappropriate, atopical response.} \label{fig:pullexample} \vspace{-3ex} \end{figure} In this work, we investigate the performance of existing dialog models when faced with inputs containing figurative language use. (1) First, we identify the subsets in existing datasets (such as DailyDialog \cite{li2017dailydialog} and PersonaChat \cite{zhang2018personalizing}) which have figurative language use such as metaphors and similes. We observe that the performance of all the dialog models under consideration is lower on such subsets containing figurative language use compared to the dataset as a whole. (2) Second, we gather manually written literal/non-figurative equivalents of the dialog utterances in DailyDialog and PersonaChat which exhibit figurative language use. For example, literal equivalent of `on the sand' can be `unstable' (Figure \ref{fig:pullexample}). We observe that performance of dialog models improves when using literal equivalents in place of figurative language. We release the resulting datasets, and encourage that new dialog models be tested separately on such datasets to understand and measure their ability to handle figurative language. (3) Finally, we propose a simple defense against occurrences of figurative language in dialog context. More specifically, we use existing classifiers to detect presence of certain types of figurative language in dialog contexts, and use dictionary lookups to transform them to their literal counterparts before feeding them to the dialog models. The proposed technique is lightweight, does not require any retraining of the models, and is effective -- though gaps still remain, leaving scope for interesting future explorations. \footnote{Data and code can be found at \url{https://github.com/vgtomahawk/Dialog-Fig-Speech-Robust}.} \section{Mitigation} We propose a lightweight mitigation approach wherein we use existing resources to detect and then construct literal translations for two popular figurative constructs: metaphors and idioms. Thus, the proposed mitigation approach does not require any retraining of dialog models. \vspace{1mm} \noindent{\textbf{Metaphor Detection Through Classifier}:} We train a metaphor detection classifier based on the VUA corpus \cite{steen2010metaphor,gao2018neural}\footnote{https://github.com/gao-g/metaphor-in-context}. To better generalize to external data via recent contextual models, we skip using model by \citet{gao2018neural}, and instead learn a classifier $C^{met}_{bert}$ by finetuning the \textit{bert-base-uncased} \cite{devlin2018bert} checkpoint from \citet{wolf2019huggingface}. On VUA, $C^{met}_{bert}$ gets a test F1 of $0.724$, which is close to \citet{gao2018neural}'s value of $0.726$. Next, we run each test utterance in dilaog dataset through $C^{met}_{bert}$ to get its probability $p^{met}$ of being metaphorical. To retain only more reliable predictions, especially considering domain shift w.r.t VUA, we only choose utterances with $p^{met}>$0.9. The set of metaphorical utterances thus identified is $D^{met}_{auto}$. \vspace{2mm} \noindent{\textbf{Idiom Detection Through Lexicon:}} Idioms are frequently used expressions, which have a fixed, typically non-compositional meaning understood by most native speakers from cultural precedent. We curate a lexicon of $2048$ commonly used idioms (e.g. \textit{filling his shoes}) from an online source\footnote{https://www.englishclub.com/ref/Idioms/} -- see Appendix A for more details). All utterances with at least one lexicon entry as a substring are identified to create the set of automatically detected idiomatic utterances, $D^{idiom}_{auto}$. We unify the sets detected above to form $D^{fig}_{auto}= D^{met}_{auto} \cup D^{idiom}_{auto}$. $|D^{fig}_{auto}|$ constitutes 1520 of 6740 utterances for \textbf{DD} (22.5\%) and 911 of 7801 utterances for \textbf{PC} (11.7\%) respectively. \vspace{2mm} \noindent{\textbf{Dictionary Replacement:}} Wiktionary \cite{zesch2008extracting} - the collaboratively created online dictionary, provides a curation of entries corresponding for phrases with ``idiomatic"\footnote{Overloaded use of the term to refer to several figurative phenomena at once, and not just idioms proper.} usages. These entries encompass conventionalized metaphors \footnote{Commonly used metaphors with a fixed, nearly universally accepted meaning.}, idioms, euphemisms, commonly used similes etc. Each entry lists the surface form of the figurative construct paired with a gloss. Glosses are for the most part literal interpretations of the figurative construct. However, they often bear other details like dialect(``\textit{US}''), etymology(``\textit{archaic}'') etc, which we remove through simple regex-based rules. This allows direct use of the now-cleaned gloss as a literal interpretation in-context. Furthermore, we expand entries whose surface forms contain uninflected verb forms or unrealized pronouns indicated by \textit{someone}, \textit{one's} etc, spawning one new entry per pronoun-inflection combination \footnote{We use \emph{pyinflect} python library} This yields us a dictionary with $17,743$ tuples of the form $\{fig_{i},Lit(fig_{i})\}$ \footnote{See Appendix \S C for further analysis of the dictionary}. Finally, for each detected utterance $u \in |D^{fig}_{auto}|$, each matched occurrence of $fig_{i}$ is replaced by $Lit(fig_{i})$, $\forall 1 \leq i \leq n$. \vspace{2mm} \noindent \textbf{Results:} From Table \ref{tab:mitigationparallel}, we see that mitigation-based literalization leads to higher quality model responses as per most automatic metrics as well as human evaluation. Though the proposed approach offers only small improvements, it is lightweight in terms of time and memory complexity, and provides reasonably fluent and appropriate interpretations for the figurative constructs covered, since these are sourced from the long-term, collaborative editing underlying Wiktionary. Table \ref{tab:mitigationexamples} shows examples where mitigation-based literalization of the figurative context improves model response quality. Additionally, we observe that Rouge fails to correlate with Meteor in Table \ref{tab:dailydialogparallel}, but correlates in Table \ref{tab:mitigationparallel}. One possible reason for such behavior is that Wiktionary uses dictionary-like, conservative literalizations, adding new words only as necessary. On the other hand, human annotators literalize more freely without regard for word choice fidelity. Meteor is more robust to variation in word choice, being enabled to capture synonymy and other forms of limited surface form variation. Rouge, being more sensitive however, is immediately dampened on account of this. \begin{table}[t] \centering \small \begin{tabular}{@{}lcccc@{}} \bf Data/Model: & \bf DD-Fig/GPT2 & \bf PC-Fig/GPT \\ \toprule \multicolumn{3}{l}{Figurative in last utterance} \\ Bleu-3/4 & +46.3\%/+54.1\% & NA \\ Meteor/Rouge-L & +2.0\%/+5.7\% & NA \\ Human-rating & +13.7\% & +0.4\% \\ \midrule \multicolumn{3}{l}{Figurative anywhere in dialog history} \\ Bleu-3/4 & +8.1\%/+0.6\% & NA \\ Meteor/Rouge-L & +1.4\%/+1.4\% & NA \\ Human-rating & +7.7\% & +0.3\% \\ \bottomrule \end{tabular} \caption{\small Mitigation: Contrasting performance of GPT-based models on the (automatically detected) subset $D^{fig}_{auto}$, containing figurative language, against the same subset but with figurative language replaced with \emph{Wiktionary-mitigated} literal counterparts. } \label{tab:mitigationparallel} \vspace{-4mm} \end{table} The proposed approach is based on simple rule based procedures relying on existing resources, and thus there is scope of multiple future extensions. The detection portion of our approach uses an external classifier and a fixed lexicon to detect metaphors \& idioms respectively, leading to $D^{met}_{auto}$. Considering utterances in DD-Fig as gold, we find the recall of this approach, given by $\|\frac{D^{met}_{auto} \cap \textrm{\footnotesize DD{-}Fig}\|}{\|\textrm{\footnotesize DD-Fig}\|} = 0.31$ to be on the lower end. This maybe due to the detection 1) missing out on entirely creative \textit{novel} metaphors, rare idioms as well as other unhandled figures of speech like rhetorical questions. 2) being unable to pick out figures of speech from domain shifted contexts. Extending detection to a wider range of figurative constructs and improved ways to address domain shift are thus important avenues for future work. Furthermore, the proposed mitigation approach is deficient in its ability to literalize all figurative text, since it can't handle: (1) Novel metaphors, which, being creative are unseen/infrequent in extant corpora, as opposed to \emph{conventionalized} metaphors. (2) Complex figurative constructs which lack particular surface forms and are context sensitive or highly creative - e.g sarcasm \& hyperbole. Future work could look into improved methods for figurative language detection, perhaps including use of resources such as commonsense knowledge resources \cite{DBLP:conf/acl/BosselutRSMCC19} which have been separately shown to be useful in dialog domain \cite{DBLP:conf/emnlp/MajumderJBM20} and in generating figurative language \cite{chakrabarty2020generating}. \begin{table}[t] \centering \footnotesize \begin{tabular}{@{}l@{}} \toprule \textsc{Figurative Context (PC)} \\ maybe we can \textit{get together} sometime \\ if you are not scare of a 30 year old cougar ! \\ \midrule \textsc{Model Response:} \\ i'm not scared of any \textit{cats}. i've two dogs \\ \midrule \textsc{Literalized Context} \\ maybe we can start dating sometime \\ if you are not scare of a 30 year old cougar ! \\ \midrule \textsc{Model Response:} \\ that's a very interesting idea. i've never met one. \\ \midrule \midrule \textsc{Figurative Context (DD)} \\ I think it's time for me to meet my admirer and \\make him \textit{face the music} . \\ \midrule \textsc{Model Response} \\ let's \textit{rock and roll}. \\ \midrule \textsc{Literalized Context} \\ I think it's time for me to meet my admirer and \\ make him bear the consequences of his actions . \\ \midrule \textsc{Model Response:} \\ let's meet. \\ \bottomrule \end{tabular} \caption{ Examples from PersonaChat(PC) and DailyDialog (DD) illustrating how figurative contexts on literalization produce better (GPT-2) model responses. See Appendix F for additional examples. } \label{tab:mitigationexamples} \end{table} \section{Related Work} Past work has explored fine-grained analysis and understanding of the performance of dialog models \cite{DBLP:journals/corr/abs-2006-12442}. \newcite{DBLP:journals/corr/abs-2006-08331} analyze open domain dialog systems for skills such as inferring contradictions and determining the topic of conversation inter alia. \newcite{DBLP:conf/acl/SankarSPCB19} analyze the change in perplexity when applying certain perturbations in dialog history. Past work has analyzed dialog models from the point of view of safety from toxic language \cite{DBLP:journals/corr/abs-2010-07079,DBLP:conf/emnlp/DinanHCW19}, and gender biases \cite{dinan2020queens}. \citet{gao2020dialogue} analyze how well dialog models respond to utterances from infrequent sentence function types (e.g \textit{Negative Declarative} utterances like \textit{I feel bad today.}). \citet{DBLP:conf/emnlp/LouisRR20} propose to identify the categorical mapping of an indirect response with respect a polar question in a task oriented dialog setup. Challenges in handling metaphors and idioms has been explored in prior work on machine translation \cite{DBLP:conf/starsem/MohammadST16,DBLP:conf/acl/Kordoni18,DBLP:conf/acl/LinGM18}. \citet{DBLP:conf/acl/LinGM18} propose a method to identify metaphors in English text, and paraphrase them into their literal counterparts before translating to Chinese. Our work on analyzing dialog models against figurative language contexts is along similar direction, though the task setup and scope of figurative language involved are different. Figurative language generation has received reasonable attention such as simile generation \cite{chakrabarty2020generating} and idiom generation \cite{zhou2021solving}. Compared to them, our focus is on analyzing capability of popular contemporary dialog models when faced with figurative language.
\section*{Introduction} Chemical plants are large-scale and complex process systems. These processes are inherently nonlinear and generally associate with a common feature, time-scale multiplicity. It usually arises due to the strong coupling of the physical and chemical phenomena occurring at disparate time-scales \cite{kumar_nonlinear_2002}. Typical examples of the multiple-time-scale processes are a process with large recycle \cite{kumar_nonlinear_2002}, multiple reactions \cite{kumar_singular_1998}, and reactor/separator system \cite{yin_distributed_2017}, where the time-scale multiplicity occurs due to the presence of distinctly different time constants, multiple fast and slow reactions, and significantly different residence times, respectively. A direct application of standard control or estimation methods without considering time-scale multiplicity may lead to ill-conditioning or even the loss of closed-loop stability \cite{kokotovic_singular_1986}. To deal with such systems, singular perturbation theory provides a natural framework for modeling, stability analysis, model reduction, and controller design for nonlinear two-time-scale processes \cite{kokotovic_singular_1986}. The main requirement for the application of this method is that the process should be modeled in the standard singularly perturbed form, where the separation of fast and slow variables is explicit. The design of fully centralized nonlinear controllers on the basis of the entire process system is impractical in terms of computational burden, high complexity of its dynamic models, and sensitivity to modeling errors and measurement noise. These considerations generate vigorous interest in decentralised (composite fast and slow control) \cite{chen_composite_2012} and distributed control \cite{chen_model_2011} strategies using proportional (P) control \cite{kumar_nonlinear_2002,kumar_nonlinear_2003} or Model predictive control (MPC) \cite{chen_composite_2012,chen_model_2011}. However, there is little attention paid to decentralized or distributed state estimation which is equally important and is closely related to distributed control. In \cite{zhang_distributed_2013}, an observer-enhanced distributed moving horizon estimation (DMHE) algorithm was developed for a nonlinear system composed of several subsystems. A common benchmark simulation model, wastewater treatment plant (WWTP) is decomposed into reduced-order subsystems and an iterative DMHE scheme is implemented \cite{yin_subsystem_2018}. It shows iterative DMHE can provide more balanced performance within a much lower computational cost compared to centralized MHE. Recently, two alternative nonlinear observer design approaches, one full-order, and one reduced-order are designed for a two-time-scale system. The full-order observer is designed based on the linearized original model around its stable steady state, whereas, the reduced-order observer is derived based on a lower-dimensional model to reconstruct the slow states which are used to calculate an invariant manifold for the fast state estimation \cite{duan_nonlinear_2020}. Within the singular perturbation framework, a nonlinear system was decomposed into a fast system and several slow subsystems, and DMHE is applied in \cite{yin_distributed_2017}. One directional communication from the slow subsystem MHEs to the fast subsystem MHE is established and also sufficient conditions on the convergence of the estimation error of the DMHE are derived. It is mentioned earlier that the singular perturbation theory is the standard tool for the analysis of systems with the explicit time-scale where the small parameter $\varepsilon$ directly separates the fast and slow variables. On the contrary, there is a wide range of applications where slow and fast dynamics cannot be associated with distinct process variables. This implicit time-scale multiplicity cannot be expressed in the standard singularly perturbed form where the separation of fast and slow modes is explicit. Also, due to a lack of process knowledge of the fast and slow variables, there is no way to model directly such processes into the standard singularly perturbed form \cite{kumar_singular_1998}. In this line of research, coordinate change of the two-time-scale system is widely considered to transform into a standard singular perturbation form. In \cite{georgakis_quasi-modal_1977}, the coordinate change construction for linear two-time-scale systems is addressed using modal analysis. A past work on nonlinear ODEs with a small parameter $\varepsilon$ focused on geometric properties to derive a coordinate-free characterization of the time-scale multiplicity \cite{fenichel_geometric_1979} which was subsequently used to find necessary and sufficient geometric conditions for the existence of an $\varepsilon$-independent change of coordinates that provides a standard singularly perturbed representation \cite{marino_geometric_1988}. In \cite{krishnan_connection_1994}, an $\varepsilon$-dependent coordinate change for a class of nonlinear two-time-scale systems was also proposed. A set of results is developed to obtain a standard singularly perturbed representation from the original two-time-scale process using both $\varepsilon$-independent and $\varepsilon$-dependent coordinate change \cite{kumar_singular_1998}. Further, an input/output linearizing controller was designed on the basis of the slow subsystem. However, for large-scale practical systems, coordinate change is not recommended because it is not unique for any system and also it increases complexities in the modeling. Therefore, a model reduction methodology is considered for deriving nonlinear low-order models of the fast-slow dynamics and a two-tiered controller framework is designed to establish well-coordinated controllers \cite{kumar_nonlinear_2002, kumar_nonlinear_2003, baldea_dynamics_2006}. In \cite{naidu_singular_2001}, a survey of the applications of the theory and techniques of singular perturbations and time-scales is carried out (SPaTS) in guidance and control of aerospace systems. The degenerate problem or unperturbed problem is expanded into reduced (outer) and boundary-layer (inner) models order and systematically solved considering boundary layer correction terms for the standard singular perturbed problem. Clearly, there are still many open issues in the development of the state estimation for the system with the implicit time-scale multiplicity which is a common occurrence in chemical processes. It is also worth mentioning that current results mainly focused on the state estimation algorithms based on the explicit time-scale form. Therefore, it is necessary to propose a way to model and estimate an implicit time-scale multiplicity. We propose a general estimation framework for a type of nonlinear implicit time-scale multiplicity. To the best of our knowledge, there is no systematic approach that can be used simultaneously to model and estimate for such systems. Motivated by the above considerations, in the work, we design a systematic subsystem decomposition approach for distributed state estimation of a class of nonlinear implicit time-scale systems with bounded output measurement noise and process disturbances. We borrow the idea of the method of matched asymptotic expansions that has been successfully used in subsystem configuration for distributed state estimation. The system is first decomposed into a reduced-order fast subsystem and a reduced-order slow subsystem considering different limiting conditions on $\varepsilon$. The approximate solutions of the fast and slow subsystems are combined to calculate the composite solution, the states of the actual system are obtained, which approximates the dynamics of the original nonlinear system. Further, a fast EKF is designed for the fast system and a slow MHE is designed for the slow subsystem. The fast EKF and slow MHE form a distributed scheme. It is found that the slow MHE is entirely decoupled from the fast EKF which is a significant difference from the control of two-time-scale systems. The decoupling ensures that only unidirectional information transmission from the slow MHE to the fast MHE is needed and the fast EKF does not send out any information. Also, we make comparisons between the proposed approach and a decentralized scheme/a centralized MHE scheme. The contributions of this work mainly include: \begin{enumerate} \item A systematic procedure based on the inner and outer solution to decompose the entire process into two subsystems such as fast and slow subsystems for nonlinear implicit two-time-scale systems with large parameters of the form $\frac{1}{\varepsilon}$. \item An introduction of overlap solution from the idea of matching to derive a composite solution. \item A methodology of distributed estimation scheme that is suitable for estimation of the fast and slow subsystem states for the reconstruction of actual states. \end{enumerate} To demonstrate the usefulness of the proposed method, a typical chemical process is considered in the simulations and the simulation results demonstrate the effectiveness of the proposed approach. \section*{Preliminaries} \subsection*{Notation} The operator $L_fh$ represents the Lie derivative of function $h$ with respect to function $f$, calculated following $L_fh(x)=\frac{\partial h}{\partial x}f(x)$. $L_f^rh$ represents the $r^{th}$ order Lie derivative of function $f$, denoted by $L_f^rh(x)=L_fL_f^{r-1}h(x)$. Subscript $f$ and $s$ denote fast and slow subsystems respectively unless mentioned. The subscript $ss$ denotes a variable associated with the steady-state. A matrix is full row rank when each of the rows of the matrix are linearly independent and is full column rank when each of the columns of the matrix are linearly independent. \subsection*{System description} In this work, we consider a class of nonlinear system that can be described in the following singularly perturbed form \cite{baldea_dynamics_2012}: \begin{subequations} \label{eq:generalsin} \begin{align} \dot{x}(t)&=f(x(t))+ g(x(t))u(t)+\frac{1}{\varepsilon}b(x(t))k(x(t))+w(t) \label{eq:1a} \\ y(t)&=h(x(t))+v(t) \label{eq:1b} \hspace{2mm} \end{align} \end{subequations} where $x \in X \subset R^{n_x}$ is the vector of state variables of independent time variable $t$, $u \in R^{n_u}$ is the vector of the manipulated inputs, $y \in R^{n_y}$ is the vector containing all the measured outputs, $w \in R^{n_x}$ denotes system disturbances and $v \in R^{n_y}$ is measurement noise, the initial condition is $x(0)=x_0$ and $\varepsilon$ is a small parameter, such that $0<\varepsilon<<1$. $f(x)$ and $k(x)$ are analytic vector fields of dimensions $n_x$ and $p_x$ $(p_x<n_x)$, $g(x)$ and $b(x)$ are analytic matrices of dimensions $(n_x \times n_u)$, $(n_x \times p_x)$, respectively. In Eq. (\ref{eq:generalsin}), the term $\frac{1}{\varepsilon}b(x(t))k(x(t))$ corresponds to the fast dynamics of the system \cite{baldea_dynamics_2012}. We consider that the matrix $b(x)$ and the Jacobian $\frac {\partial k(x)}{\partial x}$ have full column and row rank, respectively. Though the condition on the rank of $b(x)$ is not restrictive. Further, it is assumed that output $y(t)$ is continuously measured \cite{kumar_singular_1998}. Equation (\ref{eq:generalsin}) describes a class of systems where the separation of fast and slow dynamics is not explicit. There is a wide variety of processes that exhibit time-scale multiplicity. This phenomenon is generally induced by different thermal properties, mass transfer rates, and chemical kinetics of the reaction \cite{baldea_dynamics_2012}. These systems are mainly characterized by the presence of a small parameter $\varepsilon$ in the explicit mathematical models. The reciprocal of such a small parameter gives a very large term that is responsible for the existence of disparate time-scale features. Typical examples of such processes include those with multiple fast and slow reactions or fast heat/mass transfer rates. These processes typically exhibit two distinctly different magnitudes of gains in different input directions and different time constants: a large and dominant time constant and a small-time constant associated with slow and fast dynamics, respectively. The small parameter $\varepsilon$ differentiates the nature of the fast and slow dynamics, and both the dynamics control the speed of the system, as their names suggest. The overall system response is affected by either fast or slow dynamics or both. \cite{kumar_nonlinear_2003}. In the remainder of this section, we will introduce how to derive the fast and slow dynamics of system (\ref{eq:generalsin}) using matched asymptotic expansions method. Further, a composite solution is introduced to retrieve the system's complete dynamics through a correction term. \subsection*{Two-time-scales decomposition} System (\ref{eq:generalsin}) describes a class of two-time-scale systems with implicit time-scale separation where each state can have both fast and slow dynamics. Solving such a system is quite different from solving a system with explicit time-scale separation \cite{yin_distributed_2017}. Matched asymptotic expansions is used to decompose and solve the system. It involves finding different approximate solutions or asymptotic expansions, valid for a particular time-scale, and then combining these different solutions to give a single approximate solution valid for the original system. Due to the brisk nature of the fast dynamics, we need a stretched time-scale to capture the dynamics. Conversely, the slow dynamics are sluggish in nature, so a squeezed time-scale is preferably apt for it. Specially, in asymptotic expansions, the limiting solutions for fast or slow dynamics are obtained. An outer (reduced layer) approximation is obtained for the slow dynamics and inner (boundary-layer) approximation for the fast dynamics is obtained \cite{kokotovic_singular_1986}. While combining the inner and outer approximations for the actual dynamics, a correction term needs to be subtracted to avoid considering their overlap value twice. In the following, we consider the nominal deterministic system to illustrate how to decompose the fast and slow dynamics. \subsubsection*{Decomposition of fast dynamics} In the inner approximation, a fast (stretched) time $\tau$ is defined as $\tau=\frac{t}{\varepsilon}$. Multiplying both sides of Eq. (\ref{eq:1a}) by $\varepsilon$, converting into $\tau$ time-scale, and considering the limiting case $\varepsilon \rightarrow 0$, we obtain the fast dynamics of system (\ref{eq:generalsin}): \begin{equation} \frac{dx(\tau \varepsilon)}{d\tau} =b(x(\tau \varepsilon))k(x(\tau \varepsilon)) \label{eq:4.3} \end{equation} Denoting $x(\tau \varepsilon)$ as $x_f(\tau)$, the above equation transforms into, \begin{equation} \frac{dx_f}{d\tau}=b(x_f)k(x_f):=f_f(x_f) \label{eq:1.4} \end{equation} The above system as shown as (\ref{eq:1.4}) approximates the fast dynamics of the original system (\ref{eq:generalsin}). $f_f(x_f)$ is the analytic vector field of the dimension of $n_{x_f}$. If the steady-state of the fast dynamics is $x_{fss}$, it satisfies the following condition: \begin{align} k(x_{fss})&=0, \hspace{2mm} \label{eq:4.40} \end{align} We consider systems of the form of Eq. (\ref{eq:generalsin}) for which the matrix $b(x)$ and the Jacobian $\frac {\partial k(x)}{\partial x}$ have full column and row rank, respectively. The condition of full column rank of $b(x)$ ensures that it cannot be zero. However, the condition on the rank of Jacobian $\frac {\partial k(x)}{\partial x}$ assures that in the limit $\varepsilon \rightarrow 0$, the differential-algebraic equations (DAE) system that describes the slow dynamics of Eq. (\ref{eq:generalsin}) (in the next section) has a finite index and a well-defined solution, and it is satisfied in typical chemical process applications. We obtain the set of linearly independent constraints (\ref{eq:4.40}) that must be satisfied in the slow time-scale $t$. In the fast time-scale $\tau$, the algebraic constraints Eq. (\ref{eq:4.40}) are not satisfied unless steady-state reaches \cite{baldea_dynamics_2012}. The initial condition $x(0)=x_0$ of the system (\ref{eq:generalsin}) applies in the inner approximation i.e. the initial condition of the fast dynamics $x_f(\tau=0)=x_{f0}=x_0$. \subsubsection*{Decomposition of slow dynamics} In the outer approximation, multiplying system (\ref{eq:generalsin}) by $\varepsilon$ and considering the limiting case $\varepsilon \rightarrow 0$ in the slow time-scale, we obtain the constraint $k(x_s)=0$ which includes $p_x$ linearly independent scalar equations. Note that $x_s$ denotes the vector of slow states. Note also that the constraint $k(x_s)=0$ should be satisfied by the slow dynamics for all time. This also implies that the constraint should be satisfied by the slow dynamics at time $t=0$, which may be used to determine the initial condition for the slow dynamics. Taking the limit $\varepsilon\rightarrow 0$ and defining \begin{equation} z = \lim_{ \varepsilon \rightarrow 0} \frac{k(x_s)}{\varepsilon} \label{eq:4.5} \end{equation} system (\ref{eq:generalsin}) becomes, \begin{equation} \begin{split} \frac{dx_s}{dt}&= f(x_s)+ g(x_s)u+b(x_s)z \\ k(x_s)&=0 \end{split} \label{eq:4.6} \end{equation} Note that in (\ref{eq:4.6}), $z$ is indeterminate. Once the input $u(t)$ is specified (e.g. by a control law), it is possible to differentiate the algebraic constraint in Eq. (\ref{eq:4.6}) to obtain (after differentiating a sufficient number of times depending on the index number) a solution for the algebraic variable $z$. Without the loss of generality, it is assumed in this work that by one differentiation in time of the algebraic constraint, a solution of $z$ can be obtained. Based on this assumption, it is obtained that: \begin{equation} z=-[L_b(k(x_s))]^{-1} [L_{f}(k(x_s))+L_{g(x_s)}(k(x_s))u]\\ \label{eq:1.7} \end{equation} The matrix $L_b(k(x_s))$ denotes the Lie derivative of function $k(x_s)$ along $b(x_s)$ and is nonsingular. By substituting $z$ in Eq. (\ref{eq:4.6}), we obtain an approximation of the slow dynamics of system (\ref{eq:generalsin}): \begin{subequations} \label{eq:4.7} \begin{align} \begin{split} \frac{dx_s}{dt}= &f(x_s)+ g(x_s) u+b(x_s)(-[L_b(k(x_s))]^{-1} [L_{f}(k(x_s))+L_{g}(k(x_s))u]):=f_s(x_s, u) \label{4.7ba} \end{split} \\ k(x_s)=&0 \label{4.7b} \end{align} \end{subequations} with an initial condition $x_{s0}=x_{fss}$. $f_s(x_s, u)$ is the analytic vector field of the dimension of $n_{x_s}$. For more detailed procedures on decomposing fast and slow dynamics, the reader is referred to \cite{baldea_dynamics_2012}. \subsubsection*{Reconstruction of the actual dynamics from fast and slow dynamics} In the preceding discussion, system (\ref{eq:generalsin}) is brought down to a fast subsystem and a slow subsystem. The fast subsystem approximates the fast dynamics in the original system and the slow subsystem approximates the slow dynamics in the original system. We also see these explicit equations for fast and slow subsystems are each valid in their corresponding time-scale $\tau$ and $t$, respectively. An approximation of the actual dynamics of the original system can be constructed based on the fast and slow subsystems. We use the idea of matching to find out the overlap region of fast and slow subsystems. The overlap region is the intermediate area where both fast and slow approximations should agree for identical values. To elaborate, let us consider the fast subsystem; this approximation dominates in a certain region of its domain. Similarly, the slow subsystem dominates in a specific but distinct area of approximation. However, there is a common region where the approximations overlap. The overlap value is $x_{olp}$ which is the outer limit of the fast subsystem, or the inner limit of the slow subsystem. That is, $x_{olp}=\lim_{\tau \to \infty}x_{f}(\tau)=\lim_{t \to 0} x_{s}(t)$ \cite{verhulst_methods_2005, kevorkian_multiple_1996}. To obtain the final matched and composite solution, valid on the whole time domain, the uniform method is one of the popular methods. It adds the inner and outer approximations and subtracts their overlap value, $x_{olp}$, which would otherwise be counted twice. Basically, the overlap value is $x_{fss}$ found from the limits mentioned above $(x_{olp}=x_{fss})$. Therefore, the final composite solution $x_{cp}$ which is applicable in the entire time $t$ domain \cite{verhulst_methods_2005, kevorkian_multiple_1996}. \begin{equation} \begin{split} x_{cp}(t)= x_{f}(\varepsilon \tau)+ x_{s}(t)- x_{fss} \end{split} \label{eq:4.60} \end{equation} When the exact solution $x$ for a singular perturbation problem Eq. (\ref{eq:generalsin}) is not available, $x_{cp}$ is an approximate solution of such system that remains uniformly valid in the independent variable $t$. \section*{Proposed distributed state estimation scheme} In this section, we propose a distributed state estimation scheme to estimate the state of the two-time-scale system (\ref{eq:generalsin}) based on fast and slow dynamics decomposition. A schematic of the proposed distributed state estimation scheme is presented in Fig. \ref{fig:scheme}. A local estimator is designed for each fast subsystem and slow subsystem. Two different estimators are used: extended Kalman filter (EKF) is designed for the fast subsystem, and moving horizon estimation (MHE) is associated with the slow subsystem. The reason to use two different estimators is mainly the existing different time-scales. EKF takes less time to evaluate, which is apt for the fast subsystem, but it cannot take nonlinearity or constraints into account in a systematical way and may give poor performance. The use of EKF for the fast dynamics is a tradeoff between computing speed and performance. On the other hand, MHE is more suitable for complex nonlinear and constrained dynamic systems. But, it requires online solutions of dynamic optimization problems, which results in increased computational cost. The sluggish nature of the slow subsystem and the necessary high accuracy in exchange for an increase in computational cost are reasonable enough for the consideration. The EKF and MHE are designed based on the reduced fast subsystem and the reduced slow subsystem derived in the previous section. Note that f-EKF denotes EKF for the fast subsystem, and s-MHE indicates MHE for the slow subsystem. There is no information exchange between the f-EKF and s-MHE. Since each subsystem evolves at different time-scales, it is desirable to use different sampling periods in the local estimator designs for the fast and slow subsystems. Therefore, the sampling period for f-EKF and s-MHE are defined as $\Delta_f$ and $\Delta_s$ respectively. Without loss of generality, we assume that $\Delta_s$ is integer multiple of $\Delta_f$, i.e., $\Delta_s = n\Delta_f$ where $n$ is a positive integer. In the proposed design, we use $\tau_q := \tau_0 + q \Delta_f$ with $q \geq 0$ and $t_k :=t_0 + k \Delta_s$ with $k \geq 0$ to denote the sampling instants of f-EKF and s-MHE, respectively. While $\hat{x}_f(\tau_q)$ denotes the state estimates of f-EKF at $\tau_q$, $\hat{x}_s(t_k)$ is the state estimates of s-MHE at $t_k$. We denote $y_f(\tau_q)$ and $y_s(t_k)$ as the measurements for f-EKF and s-MHE sampled at $\tau_q$ and $t_k$, respectively. In the end, we find the estimation of the actual state based on composite solution Eq. (\ref{eq:4.60}). In the following discussion, we illustrate the proposed estimator design procedure that accounts rationally for the nonlinear two-time-scale dynamics. \subsection*{Proposed implementation algorithms} We decompose two-time-scale systems described in Eq. (\ref{eq:generalsin}) into two separate reduced subsystems evolving in a fast and a slow time-scales as illustrated in the previous section. The fast subsystem is described by Eq. (\ref{eq:1.4}) and the slow subsystem is described by Eq. (\ref{eq:4.7}). It is important to note that the measurements used in the f-EKF and s-MHE are directly obtained from the actual system measurement $y$ of Eq. (\ref{eq:1b}) but sampled every $\Delta_f$ and $\Delta_s$ respectively. In the proposed scheme, the f-EKF and s-MHE are designed independently based on the above subsystems. The implementation details of the distributed state estimation are specified in the following algorithm: \begin{algorithm} \caption{Proposed estimation algorithm} \begin{algorithmic}[1] \Initialization Initialize the f-EKF and s-MHE with their initial guesses. Find steady state of the reduced fast subsystem model \FOR{$q = 0,1,2,3 \dots $} \State At $\tau_q$, receive measurement $y_f(q)$ \State Evaluate the f-EKF to obtain $\hat x_{f}(\tau_q)$ \IF{$\frac{q}{n} \text{is an integer}$} \STATE Evaluate the s-MHE to obtain $\hat x_{s}(t_k)$ and send $\hat x_s(t_k)$ to the f-EKF \ELSE \STATE Obtain open loop prediction $\hat x_s$ from the reduced slow subsystem model and send $\hat x_s(\tau_q)$ to the f-EKF \ENDIF \STATE Compute $\hat{x}_{cp}(t)$ at time instant $\tau_q$ \ENDFOR \end{algorithmic} \end{algorithm} \subsection*{Design of f-EKF} In this section, we design a EKF estimator based on the reduced fast subsystem model to estimate the state of the fast subsystem. Specifically, in the design of the EKF, we consider the fast subsystem with additive process noise and the system output represented in terms of the fast and slow states based on (\ref{eq:4.60}) as follows: \begin{subequations} \begin{align} \frac{dx_f}{d\tau}&=f_f(x_f)+w_f \label{eq:1.20a}\\ y(\tau)&=h(x_f+x_s-x_{fss})+v \label{eq:1.20b} \end{align} \label{eq:1.20} \end{subequations} \vspace{-3mm} Note that in (\ref{eq:1.20a}), $w_f$ reflects the modeling error of the subsystem model. The modeling error may come from the system disturbance of the original system ($w$ in (\ref{eq:1a})) and the assumption of $\varepsilon=0$ in deriving the fast subsystem. (\ref{eq:1.20b}) implies that in the design of the f-EKF, information of the slow subsystem state $x_s$ and the steady-state information of the fast subsystem $x_{fss}$ is needed. EKF is a common method used for state estimation of nonlinear systems based on successively linearizing the nonlinear system. It can be divided into two steps, which are prediction and update steps \cite{yin_state_2018}. \paragraph{Prediction step.} At a sampling time $\tau_{q-1}$, $q=1,2,\ldots$, in an open-loop manner based on the fast subsystem model and the estimate of the fast subsystem state at $\tau_{q-1}$, the f-EKF first predict the state at the next sampling time. \begin{align} {\hat{x}_f(\tau|\tau_{q-1})}={\hat{x}_f(\tau_{q-1}|\tau_{q-1})}+ \int_{\tau_{q-1}}^{\tau_{q}} f_f(\hat{x}_f\left( \tau|\tau_{q-1}) \right) d\tau \end{align} where ${\hat{x}_f(\tau|\tau_{q-1})}$ represents the prediction of the state at time instant $\tau \in (\tau, \tau_{q-1}]$. The propagation of the process disturbance is as follows: \begin{align} \dot{P}_f(\tau|\tau_{q-1})= F_f(\tau,\tau_{q-1})P_f(\tau_{q-1}|\tau_{q-1})F_f^T(\tau,\tau_{q-1})+\int_{\tau_{q-1}}^{\tau} F_f(\tau,t) Q_f F_f^T(\tau,t) dt \end{align} where $P_f$ and $Q_f$ are the error covariance matrix and the state covariance matrix, respectively, $P(\tau_q|\tau_{q-1})$ is a square matrix containing the a \textit{priori} estimation error covariance information, and $F_f(\tau,\tau_{q-1})$ denotes the state transition matrix of the time-varying linearized system matrix, $A_f(\tau|\tau_{q-1}) :=\frac{\partial{f_f}}{\partial{x_f}} |_{(\hat{x}_f(\tau|\tau_{q-1}))}$ and can be calculated as follows: \begin{align*} \frac{\partial F_f(\tau,\tau_{q-1})}{\partial \tau}&=A_f(\tau|\tau_{q-1}) F_f(\tau,\tau_{q-1})\\ \text{s.t.} \hspace{2mm} F_f(\tau,\tau)&= I \end{align*} for $\tau \in [\tau_{q-1}, \tau_q]$ with $I$ being the identity matrix. \paragraph{Update step.} At each sampling instant $\tau_q$, a state estimate of the actual dynamics of the fast subsystem (denoted as $\hat x_f(\tau_q|\tau_q)$) is obtained by performing the measurement-update step. $K(\tau_q)$ is the correction gain updated at $\tau_q$ which is used to minimize a \textit{posteriori} error covariance based on the measurement innovation (i.e. $y_f(\tau_q)-Ch(\hat{x}_f(\tau_q|\tau_{q-1})+ \hat{x}_s-x_{fss})$). \begin{align} K(\tau_q)=P_f({\tau_q|\tau_{q-1}})H^T(\tau_q)(H(\tau_q)P_{q|q-1}H^T(\tau_q)+R_{f})^{-1} \end{align} where $H(\tau_q) = \frac{\partial{h}}{\partial{x_f}} |_{(\hat{x}_{f}(\tau_q|\tau_{q-1}))}$ is the observation matrix, $R_f$ is the covariance matrix of the measurement noise $v_f$. The updated state estimate is as follows: \begin{align} \hat{x}_f(\tau_q|\tau_q)=\hat{x}_f(\tau_{q-1}|\tau_{q-1})+K(\tau_q) \left ( y_f(\tau_q)-h(\hat{x}_f(\tau_q|\tau_{q-1})+ \hat{x}_s-x_{fss}) \right) \label{eq:14} \end{align} where $\hat{x}_f(\tau_q|\tau_q)$ represents the estimate of $x_f$ at time $\tau_q$ given observations up to time $\tau_q$. The updated state covariance is as follows: \begin{align} P_{f}(\tau_q|\tau_q)= (I-K(\tau_q)H(\tau_q))P_{f}(\tau_q|\tau_{q-1}) \end{align} where $P(\tau_q|\tau_q)$ is the a \textit{posteriori} error covariance matrix with respect to the estimation error at $\tau_q$, and $I$ is the identity matrix with dimension $n_{x_f}$. Note that in the above f-EKF design, $R_f$, $Q_f$, $P_f$ are three tuning parameters. \subsection*{Design of s-MHE} In this section, we design the s-MHE based on the reduced slow subsystem model to estimate the slow states. Similarly, we consider a stochastic version of the reduced slow subsystem model in Eq. (\ref{eq:4.7}) described as in the following form: \begin{subequations} \begin{align} \begin{split} \frac{dx_s}{dt}=&f(x_s)+ g(x_s) u+b(x_s)(-[L_b(k(x_s))]^{-1} [L_{f}(k(x_s))+L_{g}(k(x_s))u])+w_s \label{eq:1.10a} \end{split}\\ \begin{split} k(x_s)=&0 \label{eq:1.10b} \end{split}\\ \begin{split} y(t)=&h(x_s)+v \label{eq:1.10c} \end{split} \end{align} \label{eq:1.10} \end{subequations}\vspace{-9mm} In (\ref{eq:1.10a}), $w_s$ accounts the modeling error of this subsystem model which may originate either from the actual system ($w$ in (\ref{eq:1a})) or the assumption for decomposition of slow subsystem. As states earlier, when deriving the slow subsystem, it is assumed that the fast dynamics have converged to the corresponding steady state values. Based on the assumption and the expression shown in (\ref{eq:4.60}), the output equation (\ref{eq:1.10}) can be obtained for the slow subsystem. MHE is an online optimization based estimation method \cite{rao_constrained_2003}. The proposed s-MHE optimization problem at time $t_k$ is formulated as follows: \begin{subequations} \begin{align} \min\limits_{x_s(k-N), \hat{w}_s(\cdot)} & ||\hat x_s(k-N) - \tilde{x}_s(k-N)||^2_{P_s^{-1}} + \sum\limits_{j=k-N}^{k-1}||\hat{w}_s(j)||^2_{Q_s^{-1}} + \sum\limits_{j=k-N}^{k}||\hat{v}(j)||^2_{R_s^{-1}} \vspace{2mm} \label{17a}\\ {\rm s.t.~} & \hat x_s(j+1) = f_s(\hat x_s(j),u(j))+\hat w_s(j),~~ j \in [k-N, k-1] \vspace{2mm} \label{17b}\\ & \hat{v}(j) = y(j) - h(\hat x_s(j)), ~~ j \in [k-N, k]\vspace{2mm} \label{17c}\\ & \tilde{x}_s(k-N) =\hat x_s(k-N|k-N) \vspace{2mm} \label{17d}\\ & x_s \in \mathbb X_s , \hat{w}_s\in \mathbb W, \hat{v} \in \mathbb V \label{17e} \end{align} \end{subequations} where $\hat x_s$ denotes the estimated value of the slow subsystem state $x_s$, $\hat w_s$ denotes the estimated system disturbance, $\hat v$ denotes the estimated measurement noise, and $\mathbb X_s$, $\mathbb W$, and $\mathbb V$ denote the known constraints on the augmented state, the system disturbance, and the measurement noise, respectively. Equation (\ref{17a}) is the cost function the MHE tries to minimize. The objective of the s-MHE is to find the best estimates of the system states such that the model disturbance and measurement noise are minimized. $P_s^{-1}$, $Q_s^{-1}$ and $R_s^{-1}$ are positive definite weighting matrices which are tuning parameters. The arrival cost, $||\hat x_s- \tilde{x}_s||^2_{P^{-1}_s}$ summarizes the information from the initial state of the model up to the beginning of the estimation window of the MHE. $N$ denotes the length of the estimation window. Equations (\ref{17b}) and (\ref{17c}) are the slow subsystem model with system disturbance and measurement noise considered. In Eq. (\ref{17d}), $\hat x_s(k-N|k-N)$ represents the estimated state $\hat x_s$ at time instant $k - N$, which is estimated at time instant $k - N$. Equation (\ref{17e}) is the known constraints or compact sets that bound the subsystem state, system disturbance, and measurement noise. \section*{Application to a CSTR} \subsection*{Process description} Consider a continuous-stirred tank reactor (CSTR) with heating jacket in Figure \ref{fig:1}. Reactant A is fed to the reactor at a flowrate $F_A$, initial molar concentration $C_{A0}$ and temperature $T_A$. The reactant A is converted into the product B through the irreversible endothermic reaction $A\xrightarrow{}B$, and the product stream is withdrawn at a flowrate $F_0=F_A$. This implies that the reactor holdup volume $V$ is constant. The reaction rate $r_A$, is given by the following Arrhenius expression: \begin{align} r_A=k_0 \exp{ \left( \frac{-E}{RT} \right) } C_A V \end{align} where $k_0$ and $E$ are the reaction rate coefficient and activation energy, respectively, $T$ is the reactor temperature, and $C_A$ is the molar concentration of A in the reactor. Heat is provided to the reactor from the jacket, where a heating fluid is fed at a flowrate $F_h$ and a temperature $T_j$. The modeling equations for the process include the mole balances for the two components in the reactor and the energy balances in the reactor and the jacket. The resulting dynamic model is as follows:\\ \begin{equation} \begin{split} &\dot{C_A} = \frac{F_A}{V}(C_{A0}-C_A)-r_A\\ & \dot{C_B} = -\frac{F_A}{V}C_B+r_A\\ & \dot{T} =\frac{F_A}{V}(T_A-T)-r_A \frac{\Delta H_r}{\rho c_p}+\frac{UA}{\rho c_p} \left (\frac{T_j-T}{V} \right)\\ & \dot{T_j} = \frac{F_h}{V_h}(T_h-T)-\frac{UA}{\rho_h c_{ph}}\left(\frac{T_j-T}{V_h}\right) \end{split} \label{cstr1} \end{equation} where, $c_p$ and $c_{ph}$ are the specific heat capacities of the reaction mixture in the reactor and heating liquid in the jacket, respectively. Similarly, the density of the liquids of the reactor and jacket are $\rho$ and $\rho_h$, respectively. $U$ is the overall conductance or heat transfer coefficient, $A$ is the heat transfer area of the contact surface between ractor and jacket, and $\Delta H_r$ is the heat of reaction which is the enthalpy of the reaction. It is assumed that the density and specific heat capacities of the two liquids are the same, i.e. $c_p=c_{ph}$ and $\rho=\rho_h$ and the liquid holdup in the jacket at a temperature $T_j$ has a constant volume $V_h$. The heat transfer rate by convection thought the contact surface can be expressed as: \begin{align} \dot{Q}=UA(T_A-T) \end{align} Furthermore, we assumed that the heat transfer between the heating jacket and the reactor is fast compared to the reaction occurring in the reactor. The large difference in heat transfer and reaction in the model induces multiple-time-scale behavior in this dynamical systems. Therefore the ratio between the heat transfer to the reaction is defined as: \begin{align} \frac{1}{\varepsilon}=\frac{UA}{\rho c_p} \end{align} where, $\varepsilon$ is a small parameter or singular perturbation parameter which ensures the presence of fast and slow transients in time response of the system. Based on the definition $\varepsilon$, the CSTR model (\ref{cstr1}) can be rewritten as follows:\\ \begin{align} \begin{split} \dot{C_A}&= \frac{F_A}{V}(C_{A0}-C_A)-r_A\\ \dot{C_B}&= -\frac{F_A}{V}C_B+r_A\\ \dot{T}&=\frac{F_A}{V}(T_A-T)-r_A \frac{\Delta H_r}{\rho c_p}+\frac{1}{\varepsilon}\left(\frac{T_j-T}{V}\right)\\ \dot{T_j}&= \frac{F_h}{V_h}(T_h-T)-\frac{1}{\varepsilon} \left( \frac{T_j-T}{V_h}\right) \end{split} \label{eq:19} \end{align} For this process, it is considered that the state vector is $x=[x_1,\hspace{1mm}x_2, \hspace{1mm}x_3,\hspace{1mm} x_4]^T=[C_A, \hspace{1mm} C_B,\hspace{1mm} T,\hspace{1mm} T_j]^T$, the manipulated input vector is $u=[u_1,\hspace{1mm} u_2]^T=[F_A,\hspace{1mm} F_h]^T$, and the controlled output vector is $[y_1, \hspace{1mm} y_2]^T= [x_2, \hspace{1mm} x_4]^T$. The model in (\ref{eq:19}) takes the form of Eq. (\ref{eq:1a}) with the system functions defined as\\ \\ $f(x)=\begin{bmatrix} k_0 \exp{\left (\displaystyle \frac{-E}{Rx_3} \right)} x_1 \\ \\ -k_0 \exp{\left (\displaystyle\frac{-E}{Rx_3}\right)} x_1 \\ \\ -k_0 \exp{\left (\displaystyle\frac{-E}{Rx_3}\right)} x_1 \displaystyle \frac{\Delta H_r}{\rho c_p}\\ \\ 0\\ \end{bmatrix}$ \hspace{2mm} $g(x)=\begin{bmatrix} \displaystyle \frac{C_{A0}- x_1}{V} & 0\\ \\ \displaystyle \frac{-x_2}{V} & 0 \\ \\ \displaystyle \frac{T_A- x_3}{V} & 0\\ \\ 0 & \displaystyle \frac{T_h- x_4}{V_h}\\ \end{bmatrix}$\hspace{2mm} $b(x)=\begin{bmatrix} 0\\ \\ 0 \\ \\ \displaystyle \frac{1}{V}\\ \\ -\displaystyle \frac{1}{V_h}\\ \end{bmatrix}$\hspace{2mm} \\ \\ $k(x)=\begin{bmatrix} x_4-x_3 \end{bmatrix}$ \subsection*{Subsystem decomposition } Following the method described in section 2.3.1, the fast dynamics of the process can be obtained and the fast subsystem is shown below: \begin{align} \begin{split} \frac{dx_{3f}}{d\tau} &=\frac{x_{4f}-x_{3f}}{V}\\ \frac{dx_{4f}}{d\tau} &=-\frac{x_{4f}-x_{3f}}{V_h} \end{split} \label{fasteq} \end{align} According to the developments in Section 2.3.2, we multiply Eq. (\ref{eq:19}) by $\varepsilon$ and consider the limit of an infinitely high heat transfer rate compared to reaction $(\varepsilon \xrightarrow{} 0)$ in the original time-scale $t$. In this limiting case, the heat transfer resistance becomes negligible, and the reactor and jacket approach thermal equilibrium. The heat transfer rate $\dot{Q}$ is driven by the thermal equilibrium condition $ x_{4s} \rightarrow{} x_{3s}$ instead of the explicit heat transfer correlation. We obtain the constraints $k(x_s)$ which is the linearly independent constraints, \begin{align} x_{4s}-x_{3s}=0 \label{eq:24} \end{align} which must be satisfied in the slow time-scale. Also in the limit $(\varepsilon \xrightarrow{} 0)$, the term $\frac{( x_{4s}-x_{3s})}{\varepsilon}$ which corresponds to the differences of large heat transfer present in the energy balance equations become indeterminate. Therefore, $z= \lim_{ \varepsilon \rightarrow 0} \frac{( x_{4s}-x_{3s})}{\varepsilon}$ is defined as the algebraic variable, the vector of the finite, but unknown term. The slow dynamics becomes, \begin{align} \begin{split} \dot{x}_{1s} &= \frac{F_A}{V}(C_{A0}-x_{1s})-k_0 \exp\left ({\frac{-E}{R x_{3s}}}\right) x_{1s} V \\ \dot x_{2s} &= -\frac{F_A}{V}x_{2s}+ k_0 \exp\left ({\frac{-E}{R x_{3s}}}\right) x_{1s} V\\ \dot{x_{3s}} &=\frac{F_A}{V}(T_A-x_{3s})-k_0 \exp\left ({\frac{-E}{Rx_{3s}}}\right) x_{1s} V \frac{\Delta H_r}{\rho c_p}+\frac{z}{V}\\ \dot{x_{4s}} &= \frac{F_h}{V_h}(T_h-x_{4s})-\frac{z}{V_h} \end{split} \end{align} which represents the model of the slow dynamics of the process. Thus, the $z$ variable can be obtained after just one differentiation of the algebraic constraints from Eq. (\ref{eq:24}). The values of the process parameters and variables at the nominal steady state are given in Table \ref{t1}. Corresponding to the parameter values shown in Table \ref{t1}, the process has a steady-state \\$[C_A,\hspace{1mm} C_B, \hspace{1mm}T, \hspace{1mm}T_j]^T=[1.205 \hspace{2mm} \text{mol/l},\hspace{1mm} 1.295 \hspace{1mm} \text{mol/l}, \hspace{1mm} 302.3\hspace{1mm} \text{K}, \hspace{1mm} 302.6\hspace{1mm} \text{K}]^T$ when input of the system is $[F_A, \hspace{1mm}F_h]^T=[2.0 \hspace{1mm} \text{l/s} , \hspace{1mm} 0.1 \hspace{1mm} \text{l/s}]^T$. It was verified that these values correspond to a stable steady state of system (\ref{eq:19}). \subsection*{f-EKF and s-MHE designs} In this section, we take advantage of the configured subsystems equations and implement a distributed state estimation scheme for the CSTR. Within the proposed distributed framework, two local estimators are designed for the two subsystems, an EKF is designed for the fast subsystem, while an estimator is developed based on nonlinear MHE for the slow subsystem. At every sampling instant, each local estimator is evaluated to provide subsystem state estimates and those are used to reconstruct the actual state estimate. In the design of the state estimators, it is assumed that $C_B$ and $T_j$ are the measurements of the system and the objective is to estimate the entire state vector of the system based on the two outputs using the proposed distributed state estimation scheme. In the simulations, the random process disturbance is generated following a normal distribution with zero mean and standard deviation 0.1. Similarly, the random measurement noise is considered to be Gaussian white noise with mean zero and standard deviation 0.001. The weighting matrices are diagonal matrices such as $Q_f=10^{-2}\text{diag}([1, \hspace{2mm} 1])$, $R_f=10^{-6}\text{diag}([1, \hspace{2mm} 1])$ and $P_f=10^{-8}\text{diag}([1, \hspace{2mm} 1])$ for the f-EKF. For the design of s-MHE, the estimation window size is selected to be $3$. The weighting matrices for s-MHE are $Q_s=10^{-2}\text{diag}([1, \hspace{2mm} 1, \hspace{2mm} 1, \hspace{2mm} 1])$, $R_s=10^{-6}\text{diag}([1, \hspace{2mm} 1])$ and $P_s=10^{-8}\text{diag}([1, \hspace{2mm} 1, \hspace{2mm} 1, \hspace{2mm} 1])$. The f-EKF is evaluated at a fast sampling time $\Delta_f = 0.01 \hspace{2mm}\text{s}$ while the s-MHE is evaluated at a slow sampling time $\Delta_s = 0.1 \hspace{2mm}\text{s}$. Next, we implement the proposed distributed scheme to the CSTR process to investigate the performance of f-EKF and s-MHE designs. Also, to compare its performance, we introduce two different state estimation schemes. First, considering the decomposition, we design a decentralised estimator scheme based on each subsystems. The s-MHE does not send any information to the f-EKF. This design follows the same sets of equations derived for f-EKF except Eq. (\ref{eq:14}). It takes only current predicted fast state estimates $\hat{x}_f(\tau_q|\tau_{q-1})$ to update $\hat{x}_f(\tau_q|\tau_{q})$ so there is no information exchange between the estimators. The covariance matrices for f-EKF and s-MHE are kept the same as the distributed scheme. Furthermore, we design a centralized MHE estimator for the actual system. The centralized scheme is established based on Eq. (\ref{cstr1}) before decomposition of the system. The weighting matrices for the centralized MHE are $Q=10^{-2}\text{diag}([1, \hspace{2mm} 1, \hspace{2mm} 1, \hspace{2mm} 1])$ and $R=10^{-6}\text{diag}([1, \hspace{2mm} 1])$ and $P=10^{-8}\text{diag}([1, \hspace{2mm} 1, \hspace{2mm} 1, \hspace{2mm} 1])$. And, the sampling time and estimation window length are considered to be 0.01 s and 3, respectively. For all these schemes, the system disturbance and measurement noise are the same for proper comparison. In the following simulations, a couple of indexes are used to evaluate the performance of the estimators. The average relative standard deviation $\sigma_{x_i}$ is defined as \begin{align} \sigma_{x_i}= \sqrt{\dfrac{1}{N_{sim}}\sum\limits_{j=0}^{N_{sim}-1}\left (\frac{\hat x_i(t_j)-x_i(t_j)}{x_i(t_j)}\right)^2} \end{align} where $N_{sim}$ indicates the total simulation steps, $\hat x_i$ denotes the estimated value, and $x_i$ denotes the actual value of the $i^{th}$ state for $i=1, 2,...4$. Another performance indexes is the average root-mean-square error (RMSE) over the time period \begin{align} \text{RMSE}=\dfrac{1}{N_{sim}} \sum\limits_{j=0}^{N_{sim}} \sqrt{\dfrac{1}{4}\sum\limits_{i=1}^{4}\left( \frac{\hat x_i(t_j)-x_i(t_j)}{x_i(t_j)}\right)^2} \end{align} These performance indexes are expressed in percentage to evaluate the performance of each scheme. \subsection*{Simulation results} In this section, the effectiveness of the proposed two time-scale decomposition is investigated and the proposed distributed estimation scheme is applied to the CSTR and is compared with the mentioned decentralized and centralized estimation schemes. First, the effectiveness of the decomposition is investigated by comparing the composite state trajectories with the actual system state trajectories. Figure \ref{fig:result1} shows one set of the trajectories. The actual system trajectory is solved using an initial condition $[2.5, \hspace{2mm} 0.0,\hspace{2mm} 305,\hspace{2mm} 330]$ for the states $C_A$, $C_B$, $T$, and $T_j$ respectively. For the composite solution, the fast subsystem is integrated with an initial condition $[305,\hspace{2mm} 330]$ for fast states $T$, and $T_j$ respectively and, the corresponding steady-state solution is found to be $[309.167, \hspace{2mm} 309.167]$. Then, the slow subsystem is solved where the initial condition is $[2.5, \hspace{2mm} 0.0,\hspace{2mm} 309.167, \hspace{2mm} 309.167]$ for $C_A$, $C_B$, $T$, and $T_j$ respectively. Due to using different sampling sizes for the fast and the slow subsystems, the slow state variables are interpolated using cubic interpolation to make compatible with the solutions of the fast subsystem. Then, according to Eq.(\ref{eq:4.60}), the composite solution is evaluated. We see that the proposed decomposition method is able to track the actual state trajectories of the chemical process. The state approximations using the composite solution are very close to the true value obtained from actual model equations. We clearly observe that the concentration trajectories are smooth and have a flat slope but the temperature trends have a very steep slope initially, and then flatten gradually. Clearly, the temperatures exhibit two time-scale behaviours existing in different time-scales. The results also show that there is no explicit separation of fast and slow variables in the system. It is observed that the actual system is not able to converge when the sampling time is greater than $0.04$ s. The possible reason is that the actual system is a stiff system for existing both fast and slow dynamics so it lacks numerical stability beyond step size 0.04 s. It is also seen that the composite solution starts deviating from the actual trajectories on the increase of sampling time for fast or slow subsystems. The $\sigma_{x_i}$ percentage of error for each state $C_A$, $C_B$, $T$, and $T_j$ are $0.44$, $4.022$, $1.8\times 10^{-2}$ , and $0.15$ respectively. The aim of using the subsystem decomposition method is to approximate the actual system based on the assumption $\varepsilon \rightarrow 0$ i.e., $\varepsilon$ should be sufficiently small. But in the CSTR $\varepsilon$ is the ratio of two internal properties and is 0.1 in the simulation. The use of such approximation to present the actual system leads to model mismatch. The model mismatch in terms of RMSE is 0.035\% which shows the decomposed subsystems provide very accurate approximations of the actual system. Next, the performance of the proposed distributed state estimation scheme is compared with other state estimation methods. Specifically, we consider three different schemes: (I) the proposed distributed state estimation; (II) f-EKF and s-MHE in a decentralized configuration; (III) a centralized MHE scheme. We compare state estimation scheme I and scheme II presented in Figure \ref{fig:result2}. We observe that the states are able to converge the actual state trajectories in both the scheme. In Table \ref{t3}, the results show that the estimation accuracy given by the distributed MHE scheme I is better than the decentralized scheme II. Also, the maximum error of scheme II is much higher that of scheme I. It is observed that the f-EKF has improved innovation in updating the measurements because of info exchange in scheme I. Although, the simulation times are comparable, in scheme I, the states have faster convergence than scheme II. Therefore, it can be more favorable to take scheme I for state estimation for the decomposition considered. Then, we consider state estimation scheme I and scheme III presented in Figure \ref{fig:result3}. The state estimators are able to track the actual state trajectories in these two schemes. But, there are potential advantages and disadvantages in applying each of the methods. It is seen that the actual system based MHE scheme III gives improved estimation performance than the decomposition based distributed scheme II. Although, Table \ref{t3} shows low $\sigma_{x_i}$ for scheme III, it takes considerably high simulation time compared to other schemes. Therefore, the performance improvement is at the cost of much higher communications and computational burdens. Another downside of the method is the sampling time for estimator should be less than 0.04 s. As the actual system can't handle the sampling time greater than 0.04 s the optimiser of MHE encounters serious numerical instability in estimating the states of the system. Furthermore, we conduct simulations to demonstrate the less dependence of the scheme I on the size of the estimation horizon compared to the counterpart based on regular MHE (Scheme III). We notice that the ability to use different sampling periods in the f-EKF and s-MHE contributes to the applicability (especially the computational efficiency) of the proposed distributed scheme II. We also observe that the proposed scheme gives good performance even with a very small horizon length and its performance is much less sensitive to the horizon size. So it could be much more computationally efficient since a much smaller horizon can be used. If the sampling time decreased for slow subsystem, the number of estimates will increase the accuracy in cost of computational time. \section*{Conclusions} In this paper, we developed a distributed state estimation method based on EKF and MHE for a class of two time-scale nonlinear systems, where some of the state variables inhibit both the fast and slow dynamics. The nonlinear system was decomposed into fast and slow subsystems based on singular perturbed parameter $\varepsilon$. In the proposed design, a one-directional communication strategy was established and the method was applied to a chemical process. A series of simulations were carried out to compare the proposed architecture with centralized and decentralised techniques from computational time and accuracy point of view. Owing to different sampling times, the system is a stiff problem where step size plays important role on numerical stability of the solution instead accuracy requirements. However, our design ensures numerical stability, moderate accuracy and low computational time. \section*{Acknowledgment} Financial support from Natural Sciences and Engineering Research Council of Canada is gratefully acknowledged. \renewcommand\refname{Literature Cited} \section*{Introduction} Chemical plants are large-scale and complex process systems. These processes are inherently nonlinear and generally associate with a common feature, time-scale multiplicity. It usually arises due to the strong coupling of the physical and chemical phenomena occurring at disparate time-scales \cite{kumar_nonlinear_2002}. Typical examples of the multiple-time-scale processes are a process with large recycle \cite{kumar_nonlinear_2002}, multiple reactions \cite{kumar_singular_1998}, and reactor/separator system \cite{yin_distributed_2017}, where the time-scale multiplicity occurs due to the presence of distinctly different time constants, multiple fast and slow reactions, and significantly different residence times, respectively. A direct application of standard control or estimation methods without considering time-scale multiplicity may lead to ill-conditioning or even the loss of closed-loop stability \cite{kokotovic_singular_1986}. To deal with such systems, singular perturbation theory provides a natural framework for modeling, stability analysis, model reduction, and controller design for nonlinear two-time-scale processes \cite{kokotovic_singular_1986}. The main requirement for the application of this method is that the process should be modeled in the standard singularly perturbed form, where the separation of fast and slow variables is explicit. The design of fully centralized nonlinear controllers on the basis of the entire process system is impractical in terms of computational burden, high complexity of its dynamic models, and sensitivity to modeling errors and measurement noise. These considerations generate vigorous interest in decentralised (composite fast and slow control) \cite{chen_composite_2012} and distributed control \cite{chen_model_2011} strategies using proportional (P) control \cite{kumar_nonlinear_2002,kumar_nonlinear_2003} or Model predictive control (MPC) \cite{chen_composite_2012,chen_model_2011}. However, there is little attention paid to decentralized or distributed state estimation which is equally important and is closely related to distributed control. In \cite{zhang_distributed_2013}, an observer-enhanced distributed moving horizon estimation (DMHE) algorithm was developed for a nonlinear system composed of several subsystems. A common benchmark simulation model, wastewater treatment plant (WWTP) is decomposed into reduced-order subsystems and an iterative DMHE scheme is implemented \cite{yin_subsystem_2018}. It shows iterative DMHE can provide more balanced performance within a much lower computational cost compared to centralized MHE. Recently, two alternative nonlinear observer design approaches, one full-order, and one reduced-order are designed for a two-time-scale system. The full-order observer is designed based on the linearized original model around its stable steady state, whereas, the reduced-order observer is derived based on a lower-dimensional model to reconstruct the slow states which are used to calculate an invariant manifold for the fast state estimation \cite{duan_nonlinear_2020}. Within the singular perturbation framework, a nonlinear system was decomposed into a fast system and several slow subsystems, and DMHE is applied in \cite{yin_distributed_2017}. One directional communication from the slow subsystem MHEs to the fast subsystem MHE is established and also sufficient conditions on the convergence of the estimation error of the DMHE are derived. It is mentioned earlier that the singular perturbation theory is the standard tool for the analysis of systems with the explicit time-scale where the small parameter $\varepsilon$ directly separates the fast and slow variables. On the contrary, there is a wide range of applications where slow and fast dynamics cannot be associated with distinct process variables. This implicit time-scale multiplicity cannot be expressed in the standard singularly perturbed form where the separation of fast and slow modes is explicit. Also, due to a lack of process knowledge of the fast and slow variables, there is no way to model directly such processes into the standard singularly perturbed form \cite{kumar_singular_1998}. In this line of research, coordinate change of the two-time-scale system is widely considered to transform into a standard singular perturbation form. In \cite{georgakis_quasi-modal_1977}, the coordinate change construction for linear two-time-scale systems is addressed using modal analysis. A past work on nonlinear ODEs with a small parameter $\varepsilon$ focused on geometric properties to derive a coordinate-free characterization of the time-scale multiplicity \cite{fenichel_geometric_1979} which was subsequently used to find necessary and sufficient geometric conditions for the existence of an $\varepsilon$-independent change of coordinates that provides a standard singularly perturbed representation \cite{marino_geometric_1988}. In \cite{krishnan_connection_1994}, an $\varepsilon$-dependent coordinate change for a class of nonlinear two-time-scale systems was also proposed. A set of results is developed to obtain a standard singularly perturbed representation from the original two-time-scale process using both $\varepsilon$-independent and $\varepsilon$-dependent coordinate change \cite{kumar_singular_1998}. Further, an input/output linearizing controller was designed on the basis of the slow subsystem. However, for large-scale practical systems, coordinate change is not recommended because it is not unique for any system and also it increases complexities in the modeling. Therefore, a model reduction methodology is considered for deriving nonlinear low-order models of the fast-slow dynamics and a two-tiered controller framework is designed to establish well-coordinated controllers \cite{kumar_nonlinear_2002, kumar_nonlinear_2003, baldea_dynamics_2006}. In \cite{naidu_singular_2001}, a survey of the applications of the theory and techniques of singular perturbations and time-scales is carried out (SPaTS) in guidance and control of aerospace systems. The degenerate problem or unperturbed problem is expanded into reduced (outer) and boundary-layer (inner) models order and systematically solved considering boundary layer correction terms for the standard singular perturbed problem. Clearly, there are still many open issues in the development of the state estimation for the system with the implicit time-scale multiplicity which is a common occurrence in chemical processes. It is also worth mentioning that current results mainly focused on the state estimation algorithms based on the explicit time-scale form. Therefore, it is necessary to propose a way to model and estimate an implicit time-scale multiplicity. We propose a general estimation framework for a type of nonlinear implicit time-scale multiplicity. To the best of our knowledge, there is no systematic approach that can be used simultaneously to model and estimate for such systems. Motivated by the above considerations, in the work, we design a systematic subsystem decomposition approach for distributed state estimation of a class of nonlinear implicit time-scale systems with bounded output measurement noise and process disturbances. We borrow the idea of the method of matched asymptotic expansions that has been successfully used in subsystem configuration for distributed state estimation. The system is first decomposed into a reduced-order fast subsystem and a reduced-order slow subsystem considering different limiting conditions on $\varepsilon$. The approximate solutions of the fast and slow subsystems are combined to calculate the composite solution, the states of the actual system are obtained, which approximates the dynamics of the original nonlinear system. Further, a fast EKF is designed for the fast system and a slow MHE is designed for the slow subsystem. The fast EKF and slow MHE form a distributed scheme. It is found that the slow MHE is entirely decoupled from the fast EKF which is a significant difference from the control of two-time-scale systems. The decoupling ensures that only unidirectional information transmission from the slow MHE to the fast MHE is needed and the fast EKF does not send out any information. Also, we make comparisons between the proposed approach and a decentralized scheme/a centralized MHE scheme. The contributions of this work mainly include: \begin{enumerate} \item A systematic procedure based on the inner and outer solution to decompose the entire process into two subsystems such as fast and slow subsystems for nonlinear implicit two-time-scale systems with large parameters of the form $\frac{1}{\varepsilon}$. \item An introduction of overlap solution from the idea of matching to derive a composite solution. \item A methodology of distributed estimation scheme that is suitable for estimation of the fast and slow subsystem states for the reconstruction of actual states. \end{enumerate} To demonstrate the usefulness of the proposed method, a typical chemical process is considered in the simulations and the simulation results demonstrate the effectiveness of the proposed approach. \section*{Preliminaries} \subsection*{Notation} The operator $L_fh$ represents the Lie derivative of function $h$ with respect to function $f$, calculated following $L_fh(x)=\frac{\partial h}{\partial x}f(x)$. $L_f^rh$ represents the $r^{th}$ order Lie derivative of function $f$, denoted by $L_f^rh(x)=L_fL_f^{r-1}h(x)$. Subscript $f$ and $s$ denote fast and slow subsystems respectively unless mentioned. The subscript $ss$ denotes a variable associated with the steady-state. A matrix is full row rank when each of the rows of the matrix are linearly independent and is full column rank when each of the columns of the matrix are linearly independent. \subsection*{System description} In this work, we consider a class of nonlinear system that can be described in the following singularly perturbed form \cite{baldea_dynamics_2012}: \begin{subequations} \label{eq:generalsin} \begin{align} \dot{x}(t)&=f(x(t))+ g(x(t))u(t)+\frac{1}{\varepsilon}b(x(t))k(x(t))+w(t) \label{eq:1a} \\ y(t)&=h(x(t))+v(t) \label{eq:1b} \hspace{2mm} \end{align} \end{subequations} where $x \in X \subset R^{n_x}$ is the vector of state variables of independent time variable $t$, $u \in R^{n_u}$ is the vector of the manipulated inputs, $y \in R^{n_y}$ is the vector containing all the measured outputs, $w \in R^{n_x}$ denotes system disturbances and $v \in R^{n_y}$ is measurement noise, the initial condition is $x(0)=x_0$ and $\varepsilon$ is a small parameter, such that $0<\varepsilon<<1$. $f(x)$ and $k(x)$ are analytic vector fields of dimensions $n_x$ and $p_x$ $(p_x<n_x)$, $g(x)$ and $b(x)$ are analytic matrices of dimensions $(n_x \times n_u)$, $(n_x \times p_x)$, respectively. In Eq. (\ref{eq:generalsin}), the term $\frac{1}{\varepsilon}b(x(t))k(x(t))$ corresponds to the fast dynamics of the system \cite{baldea_dynamics_2012}. We consider that the matrix $b(x)$ and the Jacobian $\frac {\partial k(x)}{\partial x}$ have full column and row rank, respectively. Though the condition on the rank of $b(x)$ is not restrictive. Further, it is assumed that output $y(t)$ is continuously measured \cite{kumar_singular_1998}. Equation (\ref{eq:generalsin}) describes a class of systems where the separation of fast and slow dynamics is not explicit. There is a wide variety of processes that exhibit time-scale multiplicity. This phenomenon is generally induced by different thermal properties, mass transfer rates, and chemical kinetics of the reaction \cite{baldea_dynamics_2012}. These systems are mainly characterized by the presence of a small parameter $\varepsilon$ in the explicit mathematical models. The reciprocal of such a small parameter gives a very large term that is responsible for the existence of disparate time-scale features. Typical examples of such processes include those with multiple fast and slow reactions or fast heat/mass transfer rates. These processes typically exhibit two distinctly different magnitudes of gains in different input directions and different time constants: a large and dominant time constant and a small-time constant associated with slow and fast dynamics, respectively. The small parameter $\varepsilon$ differentiates the nature of the fast and slow dynamics, and both the dynamics control the speed of the system, as their names suggest. The overall system response is affected by either fast or slow dynamics or both. \cite{kumar_nonlinear_2003}. In the remainder of this section, we will introduce how to derive the fast and slow dynamics of system (\ref{eq:generalsin}) using matched asymptotic expansions method. Further, a composite solution is introduced to retrieve the system's complete dynamics through a correction term. \subsection*{Two-time-scales decomposition} System (\ref{eq:generalsin}) describes a class of two-time-scale systems with implicit time-scale separation where each state can have both fast and slow dynamics. Solving such a system is quite different from solving a system with explicit time-scale separation \cite{yin_distributed_2017}. Matched asymptotic expansions is used to decompose and solve the system. It involves finding different approximate solutions or asymptotic expansions, valid for a particular time-scale, and then combining these different solutions to give a single approximate solution valid for the original system. Due to the brisk nature of the fast dynamics, we need a stretched time-scale to capture the dynamics. Conversely, the slow dynamics are sluggish in nature, so a squeezed time-scale is preferably apt for it. Specially, in asymptotic expansions, the limiting solutions for fast or slow dynamics are obtained. An outer (reduced layer) approximation is obtained for the slow dynamics and inner (boundary-layer) approximation for the fast dynamics is obtained \cite{kokotovic_singular_1986}. While combining the inner and outer approximations for the actual dynamics, a correction term needs to be subtracted to avoid considering their overlap value twice. In the following, we consider the nominal deterministic system to illustrate how to decompose the fast and slow dynamics. \subsubsection*{Decomposition of fast dynamics} In the inner approximation, a fast (stretched) time $\tau$ is defined as $\tau=\frac{t}{\varepsilon}$. Multiplying both sides of Eq. (\ref{eq:1a}) by $\varepsilon$, converting into $\tau$ time-scale, and considering the limiting case $\varepsilon \rightarrow 0$, we obtain the fast dynamics of system (\ref{eq:generalsin}): \begin{equation} \frac{dx(\tau \varepsilon)}{d\tau} =b(x(\tau \varepsilon))k(x(\tau \varepsilon)) \label{eq:4.3} \end{equation} Denoting $x(\tau \varepsilon)$ as $x_f(\tau)$, the above equation transforms into, \begin{equation} \frac{dx_f}{d\tau}=b(x_f)k(x_f):=f_f(x_f) \label{eq:1.4} \end{equation} The above system as shown as (\ref{eq:1.4}) approximates the fast dynamics of the original system (\ref{eq:generalsin}). $f_f(x_f)$ is the analytic vector field of the dimension of $n_{x_f}$. If the steady-state of the fast dynamics is $x_{fss}$, it satisfies the following condition: \begin{align} k(x_{fss})&=0, \hspace{2mm} \label{eq:4.40} \end{align} We consider systems of the form of Eq. (\ref{eq:generalsin}) for which the matrix $b(x)$ and the Jacobian $\frac {\partial k(x)}{\partial x}$ have full column and row rank, respectively. The condition of full column rank of $b(x)$ ensures that it cannot be zero. However, the condition on the rank of Jacobian $\frac {\partial k(x)}{\partial x}$ assures that in the limit $\varepsilon \rightarrow 0$, the differential-algebraic equations (DAE) system that describes the slow dynamics of Eq. (\ref{eq:generalsin}) (in the next section) has a finite index and a well-defined solution, and it is satisfied in typical chemical process applications. We obtain the set of linearly independent constraints (\ref{eq:4.40}) that must be satisfied in the slow time-scale $t$. In the fast time-scale $\tau$, the algebraic constraints Eq. (\ref{eq:4.40}) are not satisfied unless steady-state reaches \cite{baldea_dynamics_2012}. The initial condition $x(0)=x_0$ of the system (\ref{eq:generalsin}) applies in the inner approximation i.e. the initial condition of the fast dynamics $x_f(\tau=0)=x_{f0}=x_0$. \subsubsection*{Decomposition of slow dynamics} In the outer approximation, multiplying system (\ref{eq:generalsin}) by $\varepsilon$ and considering the limiting case $\varepsilon \rightarrow 0$ in the slow time-scale, we obtain the constraint $k(x_s)=0$ which includes $p_x$ linearly independent scalar equations. Note that $x_s$ denotes the vector of slow states. Note also that the constraint $k(x_s)=0$ should be satisfied by the slow dynamics for all time. This also implies that the constraint should be satisfied by the slow dynamics at time $t=0$, which may be used to determine the initial condition for the slow dynamics. Taking the limit $\varepsilon\rightarrow 0$ and defining \begin{equation} z = \lim_{ \varepsilon \rightarrow 0} \frac{k(x_s)}{\varepsilon} \label{eq:4.5} \end{equation} system (\ref{eq:generalsin}) becomes, \begin{equation} \begin{split} \frac{dx_s}{dt}&= f(x_s)+ g(x_s)u+b(x_s)z \\ k(x_s)&=0 \end{split} \label{eq:4.6} \end{equation} Note that in (\ref{eq:4.6}), $z$ is indeterminate. Once the input $u(t)$ is specified (e.g. by a control law), it is possible to differentiate the algebraic constraint in Eq. (\ref{eq:4.6}) to obtain (after differentiating a sufficient number of times depending on the index number) a solution for the algebraic variable $z$. Without the loss of generality, it is assumed in this work that by one differentiation in time of the algebraic constraint, a solution of $z$ can be obtained. Based on this assumption, it is obtained that: \begin{equation} z=-[L_b(k(x_s))]^{-1} [L_{f}(k(x_s))+L_{g(x_s)}(k(x_s))u]\\ \label{eq:1.7} \end{equation} The matrix $L_b(k(x_s))$ denotes the Lie derivative of function $k(x_s)$ along $b(x_s)$ and is nonsingular. By substituting $z$ in Eq. (\ref{eq:4.6}), we obtain an approximation of the slow dynamics of system (\ref{eq:generalsin}): \begin{subequations} \label{eq:4.7} \begin{align} \begin{split} \frac{dx_s}{dt}= &f(x_s)+ g(x_s) u+b(x_s)(-[L_b(k(x_s))]^{-1} [L_{f}(k(x_s))+L_{g}(k(x_s))u]):=f_s(x_s, u) \label{4.7ba} \end{split} \\ k(x_s)=&0 \label{4.7b} \end{align} \end{subequations} with an initial condition $x_{s0}=x_{fss}$. $f_s(x_s, u)$ is the analytic vector field of the dimension of $n_{x_s}$. For more detailed procedures on decomposing fast and slow dynamics, the reader is referred to \cite{baldea_dynamics_2012}. \subsubsection*{Reconstruction of the actual dynamics from fast and slow dynamics} In the preceding discussion, system (\ref{eq:generalsin}) is brought down to a fast subsystem and a slow subsystem. The fast subsystem approximates the fast dynamics in the original system and the slow subsystem approximates the slow dynamics in the original system. We also see these explicit equations for fast and slow subsystems are each valid in their corresponding time-scale $\tau$ and $t$, respectively. An approximation of the actual dynamics of the original system can be constructed based on the fast and slow subsystems. We use the idea of matching to find out the overlap region of fast and slow subsystems. The overlap region is the intermediate area where both fast and slow approximations should agree for identical values. To elaborate, let us consider the fast subsystem; this approximation dominates in a certain region of its domain. Similarly, the slow subsystem dominates in a specific but distinct area of approximation. However, there is a common region where the approximations overlap. The overlap value is $x_{olp}$ which is the outer limit of the fast subsystem, or the inner limit of the slow subsystem. That is, $x_{olp}=\lim_{\tau \to \infty}x_{f}(\tau)=\lim_{t \to 0} x_{s}(t)$ \cite{verhulst_methods_2005, kevorkian_multiple_1996}. To obtain the final matched and composite solution, valid on the whole time domain, the uniform method is one of the popular methods. It adds the inner and outer approximations and subtracts their overlap value, $x_{olp}$, which would otherwise be counted twice. Basically, the overlap value is $x_{fss}$ found from the limits mentioned above $(x_{olp}=x_{fss})$. Therefore, the final composite solution $x_{cp}$ which is applicable in the entire time $t$ domain \cite{verhulst_methods_2005, kevorkian_multiple_1996}. \begin{equation} \begin{split} x_{cp}(t)= x_{f}(\varepsilon \tau)+ x_{s}(t)- x_{fss} \end{split} \label{eq:4.60} \end{equation} When the exact solution $x$ for a singular perturbation problem Eq. (\ref{eq:generalsin}) is not available, $x_{cp}$ is an approximate solution of such system that remains uniformly valid in the independent variable $t$. \section*{Proposed distributed state estimation scheme} In this section, we propose a distributed state estimation scheme to estimate the state of the two-time-scale system (\ref{eq:generalsin}) based on fast and slow dynamics decomposition. A schematic of the proposed distributed state estimation scheme is presented in Fig. \ref{fig:scheme}. A local estimator is designed for each fast subsystem and slow subsystem. Two different estimators are used: extended Kalman filter (EKF) is designed for the fast subsystem, and moving horizon estimation (MHE) is associated with the slow subsystem. The reason to use two different estimators is mainly the existing different time-scales. EKF takes less time to evaluate, which is apt for the fast subsystem, but it cannot take nonlinearity or constraints into account in a systematical way and may give poor performance. The use of EKF for the fast dynamics is a tradeoff between computing speed and performance. On the other hand, MHE is more suitable for complex nonlinear and constrained dynamic systems. But, it requires online solutions of dynamic optimization problems, which results in increased computational cost. The sluggish nature of the slow subsystem and the necessary high accuracy in exchange for an increase in computational cost are reasonable enough for the consideration. The EKF and MHE are designed based on the reduced fast subsystem and the reduced slow subsystem derived in the previous section. Note that f-EKF denotes EKF for the fast subsystem, and s-MHE indicates MHE for the slow subsystem. There is no information exchange between the f-EKF and s-MHE. Since each subsystem evolves at different time-scales, it is desirable to use different sampling periods in the local estimator designs for the fast and slow subsystems. Therefore, the sampling period for f-EKF and s-MHE are defined as $\Delta_f$ and $\Delta_s$ respectively. Without loss of generality, we assume that $\Delta_s$ is integer multiple of $\Delta_f$, i.e., $\Delta_s = n\Delta_f$ where $n$ is a positive integer. In the proposed design, we use $\tau_q := \tau_0 + q \Delta_f$ with $q \geq 0$ and $t_k :=t_0 + k \Delta_s$ with $k \geq 0$ to denote the sampling instants of f-EKF and s-MHE, respectively. While $\hat{x}_f(\tau_q)$ denotes the state estimates of f-EKF at $\tau_q$, $\hat{x}_s(t_k)$ is the state estimates of s-MHE at $t_k$. We denote $y_f(\tau_q)$ and $y_s(t_k)$ as the measurements for f-EKF and s-MHE sampled at $\tau_q$ and $t_k$, respectively. In the end, we find the estimation of the actual state based on composite solution Eq. (\ref{eq:4.60}). In the following discussion, we illustrate the proposed estimator design procedure that accounts rationally for the nonlinear two-time-scale dynamics. \subsection*{Proposed implementation algorithms} We decompose two-time-scale systems described in Eq. (\ref{eq:generalsin}) into two separate reduced subsystems evolving in a fast and a slow time-scales as illustrated in the previous section. The fast subsystem is described by Eq. (\ref{eq:1.4}) and the slow subsystem is described by Eq. (\ref{eq:4.7}). It is important to note that the measurements used in the f-EKF and s-MHE are directly obtained from the actual system measurement $y$ of Eq. (\ref{eq:1b}) but sampled every $\Delta_f$ and $\Delta_s$ respectively. In the proposed scheme, the f-EKF and s-MHE are designed independently based on the above subsystems. The implementation details of the distributed state estimation are specified in the following algorithm: \begin{algorithm} \caption{Proposed estimation algorithm} \begin{algorithmic}[1] \Initialization Initialize the f-EKF and s-MHE with their initial guesses. Find steady state of the reduced fast subsystem model \FOR{$q = 0,1,2,3 \dots $} \State At $\tau_q$, receive measurement $y_f(q)$ \State Evaluate the f-EKF to obtain $\hat x_{f}(\tau_q)$ \IF{$\frac{q}{n} \text{is an integer}$} \STATE Evaluate the s-MHE to obtain $\hat x_{s}(t_k)$ and send $\hat x_s(t_k)$ to the f-EKF \ELSE \STATE Obtain open loop prediction $\hat x_s$ from the reduced slow subsystem model and send $\hat x_s(\tau_q)$ to the f-EKF \ENDIF \STATE Compute $\hat{x}_{cp}(t)$ at time instant $\tau_q$ \ENDFOR \end{algorithmic} \end{algorithm} \subsection*{Design of f-EKF} In this section, we design a EKF estimator based on the reduced fast subsystem model to estimate the state of the fast subsystem. Specifically, in the design of the EKF, we consider the fast subsystem with additive process noise and the system output represented in terms of the fast and slow states based on (\ref{eq:4.60}) as follows: \begin{subequations} \begin{align} \frac{dx_f}{d\tau}&=f_f(x_f)+w_f \label{eq:1.20a}\\ y(\tau)&=h(x_f+x_s-x_{fss})+v \label{eq:1.20b} \end{align} \label{eq:1.20} \end{subequations} \vspace{-3mm} Note that in (\ref{eq:1.20a}), $w_f$ reflects the modeling error of the subsystem model. The modeling error may come from the system disturbance of the original system ($w$ in (\ref{eq:1a})) and the assumption of $\varepsilon=0$ in deriving the fast subsystem. (\ref{eq:1.20b}) implies that in the design of the f-EKF, information of the slow subsystem state $x_s$ and the steady-state information of the fast subsystem $x_{fss}$ is needed. EKF is a common method used for state estimation of nonlinear systems based on successively linearizing the nonlinear system. It can be divided into two steps, which are prediction and update steps \cite{yin_state_2018}. \paragraph{Prediction step.} At a sampling time $\tau_{q-1}$, $q=1,2,\ldots$, in an open-loop manner based on the fast subsystem model and the estimate of the fast subsystem state at $\tau_{q-1}$, the f-EKF first predict the state at the next sampling time. \begin{align} {\hat{x}_f(\tau|\tau_{q-1})}={\hat{x}_f(\tau_{q-1}|\tau_{q-1})}+ \int_{\tau_{q-1}}^{\tau_{q}} f_f(\hat{x}_f\left( \tau|\tau_{q-1}) \right) d\tau \end{align} where ${\hat{x}_f(\tau|\tau_{q-1})}$ represents the prediction of the state at time instant $\tau \in (\tau, \tau_{q-1}]$. The propagation of the process disturbance is as follows: \begin{align} \dot{P}_f(\tau|\tau_{q-1})= F_f(\tau,\tau_{q-1})P_f(\tau_{q-1}|\tau_{q-1})F_f^T(\tau,\tau_{q-1})+\int_{\tau_{q-1}}^{\tau} F_f(\tau,t) Q_f F_f^T(\tau,t) dt \end{align} where $P_f$ and $Q_f$ are the error covariance matrix and the state covariance matrix, respectively, $P(\tau_q|\tau_{q-1})$ is a square matrix containing the a \textit{priori} estimation error covariance information, and $F_f(\tau,\tau_{q-1})$ denotes the state transition matrix of the time-varying linearized system matrix, $A_f(\tau|\tau_{q-1}) :=\frac{\partial{f_f}}{\partial{x_f}} |_{(\hat{x}_f(\tau|\tau_{q-1}))}$ and can be calculated as follows: \begin{align*} \frac{\partial F_f(\tau,\tau_{q-1})}{\partial \tau}&=A_f(\tau|\tau_{q-1}) F_f(\tau,\tau_{q-1})\\ \text{s.t.} \hspace{2mm} F_f(\tau,\tau)&= I \end{align*} for $\tau \in [\tau_{q-1}, \tau_q]$ with $I$ being the identity matrix. \paragraph{Update step.} At each sampling instant $\tau_q$, a state estimate of the actual dynamics of the fast subsystem (denoted as $\hat x_f(\tau_q|\tau_q)$) is obtained by performing the measurement-update step. $K(\tau_q)$ is the correction gain updated at $\tau_q$ which is used to minimize a \textit{posteriori} error covariance based on the measurement innovation (i.e. $y_f(\tau_q)-Ch(\hat{x}_f(\tau_q|\tau_{q-1})+ \hat{x}_s-x_{fss})$). \begin{align} K(\tau_q)=P_f({\tau_q|\tau_{q-1}})H^T(\tau_q)(H(\tau_q)P_{q|q-1}H^T(\tau_q)+R_{f})^{-1} \end{align} where $H(\tau_q) = \frac{\partial{h}}{\partial{x_f}} |_{(\hat{x}_{f}(\tau_q|\tau_{q-1}))}$ is the observation matrix, $R_f$ is the covariance matrix of the measurement noise $v_f$. The updated state estimate is as follows: \begin{align} \hat{x}_f(\tau_q|\tau_q)=\hat{x}_f(\tau_{q-1}|\tau_{q-1})+K(\tau_q) \left ( y_f(\tau_q)-h(\hat{x}_f(\tau_q|\tau_{q-1})+ \hat{x}_s-x_{fss}) \right) \label{eq:14} \end{align} where $\hat{x}_f(\tau_q|\tau_q)$ represents the estimate of $x_f$ at time $\tau_q$ given observations up to time $\tau_q$. The updated state covariance is as follows: \begin{align} P_{f}(\tau_q|\tau_q)= (I-K(\tau_q)H(\tau_q))P_{f}(\tau_q|\tau_{q-1}) \end{align} where $P(\tau_q|\tau_q)$ is the a \textit{posteriori} error covariance matrix with respect to the estimation error at $\tau_q$, and $I$ is the identity matrix with dimension $n_{x_f}$. Note that in the above f-EKF design, $R_f$, $Q_f$, $P_f$ are three tuning parameters. \subsection*{Design of s-MHE} In this section, we design the s-MHE based on the reduced slow subsystem model to estimate the slow states. Similarly, we consider a stochastic version of the reduced slow subsystem model in Eq. (\ref{eq:4.7}) described as in the following form: \begin{subequations} \begin{align} \begin{split} \frac{dx_s}{dt}=&f(x_s)+ g(x_s) u+b(x_s)(-[L_b(k(x_s))]^{-1} [L_{f}(k(x_s))+L_{g}(k(x_s))u])+w_s \label{eq:1.10a} \end{split}\\ \begin{split} k(x_s)=&0 \label{eq:1.10b} \end{split}\\ \begin{split} y(t)=&h(x_s)+v \label{eq:1.10c} \end{split} \end{align} \label{eq:1.10} \end{subequations}\vspace{-9mm} In (\ref{eq:1.10a}), $w_s$ accounts the modeling error of this subsystem model which may originate either from the actual system ($w$ in (\ref{eq:1a})) or the assumption for decomposition of slow subsystem. As states earlier, when deriving the slow subsystem, it is assumed that the fast dynamics have converged to the corresponding steady state values. Based on the assumption and the expression shown in (\ref{eq:4.60}), the output equation (\ref{eq:1.10}) can be obtained for the slow subsystem. MHE is an online optimization based estimation method \cite{rao_constrained_2003}. The proposed s-MHE optimization problem at time $t_k$ is formulated as follows: \begin{subequations} \begin{align} \min\limits_{x_s(k-N), \hat{w}_s(\cdot)} & ||\hat x_s(k-N) - \tilde{x}_s(k-N)||^2_{P_s^{-1}} + \sum\limits_{j=k-N}^{k-1}||\hat{w}_s(j)||^2_{Q_s^{-1}} + \sum\limits_{j=k-N}^{k}||\hat{v}(j)||^2_{R_s^{-1}} \vspace{2mm} \label{17a}\\ {\rm s.t.~} & \hat x_s(j+1) = f_s(\hat x_s(j),u(j))+\hat w_s(j),~~ j \in [k-N, k-1] \vspace{2mm} \label{17b}\\ & \hat{v}(j) = y(j) - h(\hat x_s(j)), ~~ j \in [k-N, k]\vspace{2mm} \label{17c}\\ & \tilde{x}_s(k-N) =\hat x_s(k-N|k-N) \vspace{2mm} \label{17d}\\ & x_s \in \mathbb X_s , \hat{w}_s\in \mathbb W, \hat{v} \in \mathbb V \label{17e} \end{align} \end{subequations} where $\hat x_s$ denotes the estimated value of the slow subsystem state $x_s$, $\hat w_s$ denotes the estimated system disturbance, $\hat v$ denotes the estimated measurement noise, and $\mathbb X_s$, $\mathbb W$, and $\mathbb V$ denote the known constraints on the augmented state, the system disturbance, and the measurement noise, respectively. Equation (\ref{17a}) is the cost function the MHE tries to minimize. The objective of the s-MHE is to find the best estimates of the system states such that the model disturbance and measurement noise are minimized. $P_s^{-1}$, $Q_s^{-1}$ and $R_s^{-1}$ are positive definite weighting matrices which are tuning parameters. The arrival cost, $||\hat x_s- \tilde{x}_s||^2_{P^{-1}_s}$ summarizes the information from the initial state of the model up to the beginning of the estimation window of the MHE. $N$ denotes the length of the estimation window. Equations (\ref{17b}) and (\ref{17c}) are the slow subsystem model with system disturbance and measurement noise considered. In Eq. (\ref{17d}), $\hat x_s(k-N|k-N)$ represents the estimated state $\hat x_s$ at time instant $k - N$, which is estimated at time instant $k - N$. Equation (\ref{17e}) is the known constraints or compact sets that bound the subsystem state, system disturbance, and measurement noise. \section*{Application to a CSTR} \subsection*{Process description} Consider a continuous-stirred tank reactor (CSTR) with heating jacket in Figure \ref{fig:1}. Reactant A is fed to the reactor at a flowrate $F_A$, initial molar concentration $C_{A0}$ and temperature $T_A$. The reactant A is converted into the product B through the irreversible endothermic reaction $A\xrightarrow{}B$, and the product stream is withdrawn at a flowrate $F_0=F_A$. This implies that the reactor holdup volume $V$ is constant. The reaction rate $r_A$, is given by the following Arrhenius expression: \begin{align} r_A=k_0 \exp{ \left( \frac{-E}{RT} \right) } C_A V \end{align} where $k_0$ and $E$ are the reaction rate coefficient and activation energy, respectively, $T$ is the reactor temperature, and $C_A$ is the molar concentration of A in the reactor. Heat is provided to the reactor from the jacket, where a heating fluid is fed at a flowrate $F_h$ and a temperature $T_j$. The modeling equations for the process include the mole balances for the two components in the reactor and the energy balances in the reactor and the jacket. The resulting dynamic model is as follows:\\ \begin{equation} \begin{split} &\dot{C_A} = \frac{F_A}{V}(C_{A0}-C_A)-r_A\\ & \dot{C_B} = -\frac{F_A}{V}C_B+r_A\\ & \dot{T} =\frac{F_A}{V}(T_A-T)-r_A \frac{\Delta H_r}{\rho c_p}+\frac{UA}{\rho c_p} \left (\frac{T_j-T}{V} \right)\\ & \dot{T_j} = \frac{F_h}{V_h}(T_h-T)-\frac{UA}{\rho_h c_{ph}}\left(\frac{T_j-T}{V_h}\right) \end{split} \label{cstr1} \end{equation} where, $c_p$ and $c_{ph}$ are the specific heat capacities of the reaction mixture in the reactor and heating liquid in the jacket, respectively. Similarly, the density of the liquids of the reactor and jacket are $\rho$ and $\rho_h$, respectively. $U$ is the overall conductance or heat transfer coefficient, $A$ is the heat transfer area of the contact surface between ractor and jacket, and $\Delta H_r$ is the heat of reaction which is the enthalpy of the reaction. It is assumed that the density and specific heat capacities of the two liquids are the same, i.e. $c_p=c_{ph}$ and $\rho=\rho_h$ and the liquid holdup in the jacket at a temperature $T_j$ has a constant volume $V_h$. The heat transfer rate by convection thought the contact surface can be expressed as: \begin{align} \dot{Q}=UA(T_A-T) \end{align} Furthermore, we assumed that the heat transfer between the heating jacket and the reactor is fast compared to the reaction occurring in the reactor. The large difference in heat transfer and reaction in the model induces multiple-time-scale behavior in this dynamical systems. Therefore the ratio between the heat transfer to the reaction is defined as: \begin{align} \frac{1}{\varepsilon}=\frac{UA}{\rho c_p} \end{align} where, $\varepsilon$ is a small parameter or singular perturbation parameter which ensures the presence of fast and slow transients in time response of the system. Based on the definition $\varepsilon$, the CSTR model (\ref{cstr1}) can be rewritten as follows:\\ \begin{align} \begin{split} \dot{C_A}&= \frac{F_A}{V}(C_{A0}-C_A)-r_A\\ \dot{C_B}&= -\frac{F_A}{V}C_B+r_A\\ \dot{T}&=\frac{F_A}{V}(T_A-T)-r_A \frac{\Delta H_r}{\rho c_p}+\frac{1}{\varepsilon}\left(\frac{T_j-T}{V}\right)\\ \dot{T_j}&= \frac{F_h}{V_h}(T_h-T)-\frac{1}{\varepsilon} \left( \frac{T_j-T}{V_h}\right) \end{split} \label{eq:19} \end{align} For this process, it is considered that the state vector is $x=[x_1,\hspace{1mm}x_2, \hspace{1mm}x_3,\hspace{1mm} x_4]^T=[C_A, \hspace{1mm} C_B,\hspace{1mm} T,\hspace{1mm} T_j]^T$, the manipulated input vector is $u=[u_1,\hspace{1mm} u_2]^T=[F_A,\hspace{1mm} F_h]^T$, and the controlled output vector is $[y_1, \hspace{1mm} y_2]^T= [x_2, \hspace{1mm} x_4]^T$. The model in (\ref{eq:19}) takes the form of Eq. (\ref{eq:1a}) with the system functions defined as\\ \\ $f(x)=\begin{bmatrix} k_0 \exp{\left (\displaystyle \frac{-E}{Rx_3} \right)} x_1 \\ \\ -k_0 \exp{\left (\displaystyle\frac{-E}{Rx_3}\right)} x_1 \\ \\ -k_0 \exp{\left (\displaystyle\frac{-E}{Rx_3}\right)} x_1 \displaystyle \frac{\Delta H_r}{\rho c_p}\\ \\ 0\\ \end{bmatrix}$ \hspace{2mm} $g(x)=\begin{bmatrix} \displaystyle \frac{C_{A0}- x_1}{V} & 0\\ \\ \displaystyle \frac{-x_2}{V} & 0 \\ \\ \displaystyle \frac{T_A- x_3}{V} & 0\\ \\ 0 & \displaystyle \frac{T_h- x_4}{V_h}\\ \end{bmatrix}$\hspace{2mm} $b(x)=\begin{bmatrix} 0\\ \\ 0 \\ \\ \displaystyle \frac{1}{V}\\ \\ -\displaystyle \frac{1}{V_h}\\ \end{bmatrix}$\hspace{2mm} \\ \\ $k(x)=\begin{bmatrix} x_4-x_3 \end{bmatrix}$ \subsection*{Subsystem decomposition } Following the method described in section 2.3.1, the fast dynamics of the process can be obtained and the fast subsystem is shown below: \begin{align} \begin{split} \frac{dx_{3f}}{d\tau} &=\frac{x_{4f}-x_{3f}}{V}\\ \frac{dx_{4f}}{d\tau} &=-\frac{x_{4f}-x_{3f}}{V_h} \end{split} \label{fasteq} \end{align} According to the developments in Section 2.3.2, we multiply Eq. (\ref{eq:19}) by $\varepsilon$ and consider the limit of an infinitely high heat transfer rate compared to reaction $(\varepsilon \xrightarrow{} 0)$ in the original time-scale $t$. In this limiting case, the heat transfer resistance becomes negligible, and the reactor and jacket approach thermal equilibrium. The heat transfer rate $\dot{Q}$ is driven by the thermal equilibrium condition $ x_{4s} \rightarrow{} x_{3s}$ instead of the explicit heat transfer correlation. We obtain the constraints $k(x_s)$ which is the linearly independent constraints, \begin{align} x_{4s}-x_{3s}=0 \label{eq:24} \end{align} which must be satisfied in the slow time-scale. Also in the limit $(\varepsilon \xrightarrow{} 0)$, the term $\frac{( x_{4s}-x_{3s})}{\varepsilon}$ which corresponds to the differences of large heat transfer present in the energy balance equations become indeterminate. Therefore, $z= \lim_{ \varepsilon \rightarrow 0} \frac{( x_{4s}-x_{3s})}{\varepsilon}$ is defined as the algebraic variable, the vector of the finite, but unknown term. The slow dynamics becomes, \begin{align} \begin{split} \dot{x}_{1s} &= \frac{F_A}{V}(C_{A0}-x_{1s})-k_0 \exp\left ({\frac{-E}{R x_{3s}}}\right) x_{1s} V \\ \dot x_{2s} &= -\frac{F_A}{V}x_{2s}+ k_0 \exp\left ({\frac{-E}{R x_{3s}}}\right) x_{1s} V\\ \dot{x_{3s}} &=\frac{F_A}{V}(T_A-x_{3s})-k_0 \exp\left ({\frac{-E}{Rx_{3s}}}\right) x_{1s} V \frac{\Delta H_r}{\rho c_p}+\frac{z}{V}\\ \dot{x_{4s}} &= \frac{F_h}{V_h}(T_h-x_{4s})-\frac{z}{V_h} \end{split} \end{align} which represents the model of the slow dynamics of the process. Thus, the $z$ variable can be obtained after just one differentiation of the algebraic constraints from Eq. (\ref{eq:24}). The values of the process parameters and variables at the nominal steady state are given in Table \ref{t1}. Corresponding to the parameter values shown in Table \ref{t1}, the process has a steady-state \\$[C_A,\hspace{1mm} C_B, \hspace{1mm}T, \hspace{1mm}T_j]^T=[1.205 \hspace{2mm} \text{mol/l},\hspace{1mm} 1.295 \hspace{1mm} \text{mol/l}, \hspace{1mm} 302.3\hspace{1mm} \text{K}, \hspace{1mm} 302.6\hspace{1mm} \text{K}]^T$ when input of the system is $[F_A, \hspace{1mm}F_h]^T=[2.0 \hspace{1mm} \text{l/s} , \hspace{1mm} 0.1 \hspace{1mm} \text{l/s}]^T$. It was verified that these values correspond to a stable steady state of system (\ref{eq:19}). \subsection*{f-EKF and s-MHE designs} In this section, we take advantage of the configured subsystems equations and implement a distributed state estimation scheme for the CSTR. Within the proposed distributed framework, two local estimators are designed for the two subsystems, an EKF is designed for the fast subsystem, while an estimator is developed based on nonlinear MHE for the slow subsystem. At every sampling instant, each local estimator is evaluated to provide subsystem state estimates and those are used to reconstruct the actual state estimate. In the design of the state estimators, it is assumed that $C_B$ and $T_j$ are the measurements of the system and the objective is to estimate the entire state vector of the system based on the two outputs using the proposed distributed state estimation scheme. In the simulations, the random process disturbance is generated following a normal distribution with zero mean and standard deviation 0.1. Similarly, the random measurement noise is considered to be Gaussian white noise with mean zero and standard deviation 0.001. The weighting matrices are diagonal matrices such as $Q_f=10^{-2}\text{diag}([1, \hspace{2mm} 1])$, $R_f=10^{-6}\text{diag}([1, \hspace{2mm} 1])$ and $P_f=10^{-8}\text{diag}([1, \hspace{2mm} 1])$ for the f-EKF. For the design of s-MHE, the estimation window size is selected to be $3$. The weighting matrices for s-MHE are $Q_s=10^{-2}\text{diag}([1, \hspace{2mm} 1, \hspace{2mm} 1, \hspace{2mm} 1])$, $R_s=10^{-6}\text{diag}([1, \hspace{2mm} 1])$ and $P_s=10^{-8}\text{diag}([1, \hspace{2mm} 1, \hspace{2mm} 1, \hspace{2mm} 1])$. The f-EKF is evaluated at a fast sampling time $\Delta_f = 0.01 \hspace{2mm}\text{s}$ while the s-MHE is evaluated at a slow sampling time $\Delta_s = 0.1 \hspace{2mm}\text{s}$. Next, we implement the proposed distributed scheme to the CSTR process to investigate the performance of f-EKF and s-MHE designs. Also, to compare its performance, we introduce two different state estimation schemes. First, considering the decomposition, we design a decentralised estimator scheme based on each subsystems. The s-MHE does not send any information to the f-EKF. This design follows the same sets of equations derived for f-EKF except Eq. (\ref{eq:14}). It takes only current predicted fast state estimates $\hat{x}_f(\tau_q|\tau_{q-1})$ to update $\hat{x}_f(\tau_q|\tau_{q})$ so there is no information exchange between the estimators. The covariance matrices for f-EKF and s-MHE are kept the same as the distributed scheme. Furthermore, we design a centralized MHE estimator for the actual system. The centralized scheme is established based on Eq. (\ref{cstr1}) before decomposition of the system. The weighting matrices for the centralized MHE are $Q=10^{-2}\text{diag}([1, \hspace{2mm} 1, \hspace{2mm} 1, \hspace{2mm} 1])$ and $R=10^{-6}\text{diag}([1, \hspace{2mm} 1])$ and $P=10^{-8}\text{diag}([1, \hspace{2mm} 1, \hspace{2mm} 1, \hspace{2mm} 1])$. And, the sampling time and estimation window length are considered to be 0.01 s and 3, respectively. For all these schemes, the system disturbance and measurement noise are the same for proper comparison. In the following simulations, a couple of indexes are used to evaluate the performance of the estimators. The average relative standard deviation $\sigma_{x_i}$ is defined as \begin{align} \sigma_{x_i}= \sqrt{\dfrac{1}{N_{sim}}\sum\limits_{j=0}^{N_{sim}-1}\left (\frac{\hat x_i(t_j)-x_i(t_j)}{x_i(t_j)}\right)^2} \end{align} where $N_{sim}$ indicates the total simulation steps, $\hat x_i$ denotes the estimated value, and $x_i$ denotes the actual value of the $i^{th}$ state for $i=1, 2,...4$. Another performance indexes is the average root-mean-square error (RMSE) over the time period \begin{align} \text{RMSE}=\dfrac{1}{N_{sim}} \sum\limits_{j=0}^{N_{sim}} \sqrt{\dfrac{1}{4}\sum\limits_{i=1}^{4}\left( \frac{\hat x_i(t_j)-x_i(t_j)}{x_i(t_j)}\right)^2} \end{align} These performance indexes are expressed in percentage to evaluate the performance of each scheme. \subsection*{Simulation results} In this section, the effectiveness of the proposed two time-scale decomposition is investigated and the proposed distributed estimation scheme is applied to the CSTR and is compared with the mentioned decentralized and centralized estimation schemes. First, the effectiveness of the decomposition is investigated by comparing the composite state trajectories with the actual system state trajectories. Figure \ref{fig:result1} shows one set of the trajectories. The actual system trajectory is solved using an initial condition $[2.5, \hspace{2mm} 0.0,\hspace{2mm} 305,\hspace{2mm} 330]$ for the states $C_A$, $C_B$, $T$, and $T_j$ respectively. For the composite solution, the fast subsystem is integrated with an initial condition $[305,\hspace{2mm} 330]$ for fast states $T$, and $T_j$ respectively and, the corresponding steady-state solution is found to be $[309.167, \hspace{2mm} 309.167]$. Then, the slow subsystem is solved where the initial condition is $[2.5, \hspace{2mm} 0.0,\hspace{2mm} 309.167, \hspace{2mm} 309.167]$ for $C_A$, $C_B$, $T$, and $T_j$ respectively. Due to using different sampling sizes for the fast and the slow subsystems, the slow state variables are interpolated using cubic interpolation to make compatible with the solutions of the fast subsystem. Then, according to Eq.(\ref{eq:4.60}), the composite solution is evaluated. We see that the proposed decomposition method is able to track the actual state trajectories of the chemical process. The state approximations using the composite solution are very close to the true value obtained from actual model equations. We clearly observe that the concentration trajectories are smooth and have a flat slope but the temperature trends have a very steep slope initially, and then flatten gradually. Clearly, the temperatures exhibit two time-scale behaviours existing in different time-scales. The results also show that there is no explicit separation of fast and slow variables in the system. It is observed that the actual system is not able to converge when the sampling time is greater than $0.04$ s. The possible reason is that the actual system is a stiff system for existing both fast and slow dynamics so it lacks numerical stability beyond step size 0.04 s. It is also seen that the composite solution starts deviating from the actual trajectories on the increase of sampling time for fast or slow subsystems. The $\sigma_{x_i}$ percentage of error for each state $C_A$, $C_B$, $T$, and $T_j$ are $0.44$, $4.022$, $1.8\times 10^{-2}$ , and $0.15$ respectively. The aim of using the subsystem decomposition method is to approximate the actual system based on the assumption $\varepsilon \rightarrow 0$ i.e., $\varepsilon$ should be sufficiently small. But in the CSTR $\varepsilon$ is the ratio of two internal properties and is 0.1 in the simulation. The use of such approximation to present the actual system leads to model mismatch. The model mismatch in terms of RMSE is 0.035\% which shows the decomposed subsystems provide very accurate approximations of the actual system. Next, the performance of the proposed distributed state estimation scheme is compared with other state estimation methods. Specifically, we consider three different schemes: (I) the proposed distributed state estimation; (II) f-EKF and s-MHE in a decentralized configuration; (III) a centralized MHE scheme. We compare state estimation scheme I and scheme II presented in Figure \ref{fig:result2}. We observe that the states are able to converge the actual state trajectories in both the scheme. In Table \ref{t3}, the results show that the estimation accuracy given by the distributed MHE scheme I is better than the decentralized scheme II. Also, the maximum error of scheme II is much higher that of scheme I. It is observed that the f-EKF has improved innovation in updating the measurements because of info exchange in scheme I. Although, the simulation times are comparable, in scheme I, the states have faster convergence than scheme II. Therefore, it can be more favorable to take scheme I for state estimation for the decomposition considered. Then, we consider state estimation scheme I and scheme III presented in Figure \ref{fig:result3}. The state estimators are able to track the actual state trajectories in these two schemes. But, there are potential advantages and disadvantages in applying each of the methods. It is seen that the actual system based MHE scheme III gives improved estimation performance than the decomposition based distributed scheme II. Although, Table \ref{t3} shows low $\sigma_{x_i}$ for scheme III, it takes considerably high simulation time compared to other schemes. Therefore, the performance improvement is at the cost of much higher communications and computational burdens. Another downside of the method is the sampling time for estimator should be less than 0.04 s. As the actual system can't handle the sampling time greater than 0.04 s the optimiser of MHE encounters serious numerical instability in estimating the states of the system. Furthermore, we conduct simulations to demonstrate the less dependence of the scheme I on the size of the estimation horizon compared to the counterpart based on regular MHE (Scheme III). We notice that the ability to use different sampling periods in the f-EKF and s-MHE contributes to the applicability (especially the computational efficiency) of the proposed distributed scheme II. We also observe that the proposed scheme gives good performance even with a very small horizon length and its performance is much less sensitive to the horizon size. So it could be much more computationally efficient since a much smaller horizon can be used. If the sampling time decreased for slow subsystem, the number of estimates will increase the accuracy in cost of computational time. \section*{Conclusions} In this paper, we developed a distributed state estimation method based on EKF and MHE for a class of two time-scale nonlinear systems, where some of the state variables inhibit both the fast and slow dynamics. The nonlinear system was decomposed into fast and slow subsystems based on singular perturbed parameter $\varepsilon$. In the proposed design, a one-directional communication strategy was established and the method was applied to a chemical process. A series of simulations were carried out to compare the proposed architecture with centralized and decentralised techniques from computational time and accuracy point of view. Owing to different sampling times, the system is a stiff problem where step size plays important role on numerical stability of the solution instead accuracy requirements. However, our design ensures numerical stability, moderate accuracy and low computational time. \section*{Acknowledgment} Financial support from Natural Sciences and Engineering Research Council of Canada is gratefully acknowledged. \renewcommand\refname{Literature Cited}
\section{Introduction} The conventional wisdom that light in relativistic spacetimes propagates on null geodesics can be substantiated in several ways. First: via the observation that light, in the geometrical optics limit, propagates on null geodesics \cite[p.~571]{MTW}. Second: via the recent technical result that small bodies constructed from Maxwell fields in curved spacetimes `track' null geodesics \cite{GW}. Third: via the core finding that solutions to the Maxwellian wave equation in curved spacetimes have an idealised signal speed of exactly $c$ \cite{Friedlander}. A less well-known aspect of our understanding of the propagation of electromagnetic waves in relativistic spacetimes is that this propagation is associated with a `tail', which moves behind the wavefront at a speed less than $c$ \cite{DB, Faraoni}. Insofar as this tail becomes more pronounced with an increase in gravitational field strength \cite{EllisSciama}, tail production can effectively retard the wavefront to a subluminal speed from a metrological point of view: a detector only registers an incoming wave above a certain threshold; if the power transmission linked to the tail becomes significantly more relevant than that of the actual wavefront, the detector will fire later than otherwise expected. The recent works \cite{AH, AH2} seek to further develop our understanding of the propagation of light in curved spacetimes. In \cite{AH2}, it is shown that, before taking the geometrical optics limit, light rays in generic spacetimes do not propagate on null geodesics, in the sense that the dispersion relation $K^\mu K_\mu \neq 0$, where $K^\mu$ is the wave vector. In \cite{AH}, it is argued in addition that at least in the G\"{o}del solution, one cannot consistently take the geometrical optics limit (in which, as already mentioned above, the null propagation of light obtains). These papers certainly constitute advances in our understanding of the propagation of light in curved spacetimes. However, there remains much to be done in analysing their results. This article seeks to clarify comprehensively both the sense in which the claims made in \cite{AH, AH2} are correct, and can be bolstered, as well as the sense in which the claims made in those articles are incorrect, and should be rejected. More specifically, in this paper we achieve the following tasks: (A) Numerically solving the differential equations describing the propagation of light in curved spacetimes presented in \cite{AH, AH2}, in order to secure a better quantitative grasp of how the dispersion relation (and thereby also the phase and group velocity) of such waves can differ from that associated with null propagation (in this sense, we concur with \cite{AH, AH2}, and take our results to corroborate their claims). (B) Understanding how different curvature couplings in matter dynamics can affect the propagation of light, and thereby lead to distinct physics (again, in this sense our results are consistent with, and develop further, \cite{AH, AH2}). (C) Clarifying exactly when one can and cannot take the geometrical optics limit: in this regard, we find the results presented in \cite{AH} to rest on a questionable limit procedure; we instead side with the orthodoxy in concluding that the geometrical optics limit can invariably be taken consistently, and moreover that both group velocity and the causally relevant signalling speed are $c$ in this limit. (D) Assessing the implications of the above work for the possibility of super- or subluminal wavefront velocities, bearing in mind classic work such as \cite{Brillouin}, and associated more recent discussions (this discussion is important, because explicit consideration of such different notions of wave velocities is absent from \cite{AH, AH2}). Overall, then, our purpose is to provide an exhaustive study of the claims made in \cite{AH, AH2} regarding the propagation of light in curved spacetimes. The structure of the paper is as follows. In \S\ref{s3}, we present our numerical results which bolster the aforesaid claims regarding the propagation of light outside of the geometrical optics regime. In \S\ref{s4}, we discuss the correct way to take the geometrical optics limit in curved spacetimes. In \S\ref{s5}, we consider how different notions of wave velocities temper the claims made in \cite{AH, AH2} regarding the possibility of superluminal propagation. Before turning to this work in earnest, however, we must first recall some basic details regarding Maxwell's equations in curved spacetimes. \begin{comment} 1. Numerical results corroborate second Hojman paper (group velocity is generally different from 1 in curved spacetime) 2. Turning z on leads to different light propagation (even in the geometrical optics limit!!) --- meaning that different couplings really do give different physics. 3. Observe that there's no inconsistency in the GO limit in Kerr-Newman (pace our clocks paper). But there is in FLRW. So it can't be about rotation (and in particular not just a result of putatively dubious closed time-like curves). Also, turning z on can lead to the GO limit becoming inconsistent, i.e. waves for non-standard Maxwell equations generally have no well-defined GO limit. 4. Discussion of the third Hojman paper and our paper --- want to find a notion of proper time which is 'optically significant'. It arises the question why Hojman's efforts are necessary as long as it has not been shown that the front velocity is different from 1. (However, our results to the effect that the GO limit does not hold in the physical spacetime of FRW and does not generally hold for the non-standard Maxwell equations in curved spacetime suggest that the front velocity is not well defined in those case.) \end{comment} \section{Curvature-coupled Maxwell equations}\label{s2} The inhomogeneous Maxwell equation for the vector potential in Minkowski spacetime reads \begin{equation}\label{A-mink} -A\indices{^{\alpha,\mu}_{\mu}}+A\indices{^{\mu}^{,\alpha}_{\mu}}=4\pi J^\alpha. \end{equation} On minimal coupling (i.e.,~applying the `comma-to-semicolon' rule), one obtains \begin{equation}\label{A2} -A\indices{^{\alpha;\mu}_{\mu}}+A\indices{^{\mu}^{;\alpha}_{\mu}}=4\pi J^\alpha. \end{equation} As has been well-appreciated since (at least) the elegant discussion of Misner \emph{et al.}~\cite[\S16.2]{MTW}, there arises in the implementation of the minimal coupling procedure the possibility of factor-ordering ambiguities. Note, in particular, that if \eqref{A-mink} is written with its partial derivatives exchanged, then one obtains the following curved-spacetime equation, on minimal coupling: \begin{equation}\label{A3} -A\indices{^{\alpha;\mu}_{\mu}}+A\indices{^{\mu}^{;\alpha}_{\mu}} + R\indices{^{\alpha}_{\mu}}A^\mu=4\pi J^\alpha. \end{equation} Typically, \eqref{A2} is treated as the correct wave equation for $A^\mu$ in curved spacetime; \eqref{A3} is rejected. See, for example, \cite[p.~390]{MTW}, where it is stated that ``Coupling to curvature surely cannot occur without some physical reason.'' In this way, minimal coupling is regarded as a (fallible) heuristic for generating equations of motion for matter fields in a curved spacetime which at a point have the same form as their special relativistic counterparts (and in particular do not feature explicit curvature terms): that is, a fallible heuristic for implementing a form of the `strong equivalence principle' (SEP). As minimal coupling fails to implement unambiguously this SEP with respect to \eqref{A-mink} (it yields both \eqref{A2} and \eqref{A3}), the desired form of the general relativistic equations---namely, \eqref{A2}---has to be selected by fiat. Another (again only) heuristic reason to reject \eqref{A3} is its lack of gauge invariance (there is no \emph{a priori} reason why Maxwell equations in curved spacetime have to be gauge invariant). (Our thanks to Jacob Barandes for discussion on this point.) (An aside: Consider `standard' minimal coupling, in which one obtains \eqref{A2}. Even here, one must take care with claims that these equations are `locally special relativistic', as per the SEP. After all, at least in the gauge $A\indices{^{\mu}_{; \mu}} = 0$, \eqref{A2} is equivalent, via \begin{equation} R\indices{^{\alpha}_{\mu}} A ^{\mu} = A\indices{^{\mu}_{;\mu}^{\alpha}} - A\indices{^{\mu}^{;\alpha}_{\mu}}, \end{equation} to \begin{equation} -A\indices{^{\alpha;\mu}_{\mu}} - R\indices{^{\alpha}_{\mu}} A ^{\mu} =4\pi J^\alpha. \end{equation} The curvature term in this latter presentation of \eqref{A2} will, again, not vanish at a point.) In any case, \eqref{A3} is a distinct equation from \eqref{A2}, and there is no reason to expect \emph{ab initio} that the equations will make the same empirical predictions; moreover, there is no logical bar to the correct general relativistic versions of Maxwell's equations being \eqref{A3}. Ultimately, only experiment can adjudicate between these different possibilities. Thus, it is incumbent on us to appreciate the empirical consequences of each. In this article, we show that the differences between \eqref{A2} and \eqref{A3} manifest themselves in the velocity of the propagation of light, at least outside of the geometrical optics regime; in this sense, we develop further the claims made in \cite{AH} in this regard (see \S\ref{s3}). There is one other point which is worth making here. In addition to the factor-ordering ambiguities associated with minimal coupling, other authors have motivated in other ways consideration of the relations between curvature couplings and wave propagation. For example, Drummond and Hathrell consider one-loop vacuum polarisation contribution to the QED effective action and the additional terms in the resulting equations of motion derived therefrom \cite{DH}. The results which we present in this article are consistent with the motivations of these investigations, insofar as one of our central interests is also the effects that such additional couplings can have upon wave propagation. For recent discussion of such work, see \cite{Shore, Butterfield}. (Note that the putative superluminal signalling in the context of the Drummon-Hathrell action has been called into question for making use of questionable approximations \citep{Shore}. Interestingly, we will express a very similar concern towards the claimed failure of the geometrical optics limit in Gödel spacetime in \cite{AH}.) \section{Solving the Curvature-Coupled Equations}\label{s3} With this background in hand, we turn now to a quantitative discussion of the propagation of Maxwellian waves in curved spacetimes; our intention is to build upon the discussion of \cite{AH, AH2} that this propagation need not invariably be null. The source-free version of \eqref{A2} can be written in terms of partial (rather than covariant) derivatives as \begin{equation}\label{A2'} \partial_\alpha \left[ \sqrt{-g} g^{\alpha\mu} g^{\beta\nu} \left( \partial_\mu A_\nu - \partial_\nu A_\mu\right)\right]=0. \end{equation} By making a plane wave ansatz in the $\nabla_\mu A^\mu =0$ gauge, i.e.~$A_{\mu} = \xi_{\mu} (x^\lambda) e^{i S(x^\lambda)}$ where $\xi_{\mu}$ and $S$ are not necessarily constant and represent, respectively, the amplitude and phase of the wave, it is shown in \cite{AH2} that the wave `vector' $K_\mu := \partial_{\mu} S$ obeys $K^\mu K_\mu = \chi$, where ($\tilde{\xi} := \sqrt{\xi_\mu \xi^\mu}$) \begin{equation}\label{eq6} \chi = \frac{\xi_\beta}{\sqrt{-g}\tilde{\xi}^2} \partial_\alpha \left[ \sqrt{-g} g^{\alpha\mu} g^{\beta\nu}\left(\partial_\mu \xi_\nu - \partial_\nu \xi_\mu \right) \right] . \end{equation} (A general solution to the homogeneous, standard minimally coupled Maxwell wave equation in curved spacetime was given in \cite{DB} in the context of the bitensor formalism.) From this, one might already infer that in generic spacetimes and before taking the geometrical optics limit, light does not propagate on null geodesics: as pointed out in \cite{AH2}, \eqref{eq6} cannot in general be solved consistently using a constant amplitude ansatz; this in turn, however, implies that the dispersion relation for the wave is non-trivial. (That a non-constant amplitude leads to a non-trivial dispersion relation holds even in flat spacetime.) One can generalise these results by writing the source-free version of \eqref{A3} as \begin{equation}\label{A3'} \partial_\alpha \left[ \sqrt{-g} g^{\alpha\mu} g^{\beta\nu} \left( \partial_\mu A_\nu - \partial_\nu A_\mu\right)\right] + z R\indices{^{\beta}_{\mu}}A^{\mu} = 0; \end{equation} here, we have included a scalar parameter $z$, allowing us to `tune' the curvature-coupled term, the possibility of which arises due, for example, to the factor-ordering ambiguities in the minimal coupling scheme, as discussed in \S\ref{s2}. As we will now argue, including such a curvature-coupled term leads to a further change in the dispersion relation. For this, we seek to solve \eqref{A3'} in particular spacetimes. Selecting the FLRW spacetime (as also considered by \cite{AH2} in the case of $z=0$) and using spherical coordinates $(t, r, \phi, \theta)$, the non-trivial components of the metric are \begin{align} g_{tt} &= -1, \\ g_{rr} &= \frac{R^2(t)}{1- k r^2}, \\ g_{\phi \phi} &= R^2(t) r^2 \sin^2(\theta), \\ g_{\theta \theta} &= R^2(t) r^2. \end{align} Then, making the ansatz $A_\mu = A_{\phi} (r, t) \delta_{\mu \phi}$ (which is slightly more restrictive than that used by \cite{AH2} in their treatment of the $z=0$ case), \eqref{A3'} becomes \begin{multline} \partial_0 \left( \sqrt{-g} g^{tt} g^{\phi \phi} \partial_0 A_\phi \right)\\ + \partial_r \left(\sqrt{-g} g^{rr} g^{\phi \phi} \partial_r A_{\phi} \right) + z R^{\phi \phi} A_{\phi} = 0. \end{multline} Recall from \cite[p.~38]{Catalogue} that the $R_{\phi\phi}$ component of the Ricci tensor is given by \begin{equation} R_{\phi \phi} = r^2 \sin^2(\theta) \left(R \ddot{R} + 2 (\dot{R}^2 + k) \right). \end{equation} The square root of the metric determinant is given by \begin{equation} \sqrt{-g} = R^3 (t) r^2 \frac{\sin{\theta}}{\sqrt{1-k r^2}}. \end{equation} For simplicity, we set $R = 1$ from this point on (for instance, the constancy of $R$ is typically assumed for the current cosmological era). Thereby, raising indices using the metric, \begin{equation} R^{\phi \phi} = \frac{R \ddot{R} + 2 (\dot{R}^2 + k)}{R^4 r^2 \sin^{2}(\theta)} = \frac{2 k}{r^2 \sin^2(\theta)}. \end{equation} \noindent Upon further specifying the ansatz to be \begin{equation} A_{\phi} (r, t) = \xi(r) \exp\left(i S(t) + i S(r) \right) \end{equation} with wave vector $K_{\mu}$ such that $K_{t} := \partial_t S(t)$ and $K_{i} := \partial_i S(r)$, one finds that $K_r$, i.e.~the (non-trivial spatial) $r$-component of the wave vector, and $\xi (r)$ are governed by \begin{widetext} \begin{multline}\label{vlong} \partial_t \left(\sqrt{-g} g^{tt} g^{\phi \phi}\right) \left(\partial_t \xi + \xi K_t i\right) + \left(\sqrt{-g} g^{tt} g^{\phi \phi}\right) \left(\partial_t^2 \xi + 2 \left(\partial_t \xi\right) K_t i - \xi K_t^2 + \xi \left(\partial_t K_t\right) i \right) + \\ \partial_r \left(\sqrt{-g} g^{rr} g^{\phi \phi}\right) \left(\partial_r \xi + \xi K_r i\right)+ \left(\sqrt{-g} g^{rr} g^{\phi \phi}\right) \left(\partial_r^2 \xi + 2 \left(\partial_r \xi\right) K_r i - \xi K_r^2 + \xi \left(\partial_r K_r\right) i\right) + z R^{\phi \phi} \xi = 0. \end{multline} \end{widetext} Exploiting that $\partial_t (\sqrt{-g} g^{tt} g^{\phi \phi}) = 0$ for $R=1$, that $K_t$ is constant, and that $\partial_t \xi(r) = 0$, as well as splitting up the real and imaginary parts of \eqref{vlong}, yields two equations. First, the imaginary part: \begin{multline} \partial_r \left(\sqrt{-g} g^{rr} g^{\phi \phi}\right) K_r \xi + \\ \sqrt{-g} g^{rr} g^{\phi \phi} \left( 2 \left(\partial_r \xi\right) K_r + \xi \left(\partial_r K_r\right)\right) = 0 \end{multline} Upon multiplication by $\xi$, one obtains $\partial_r (\sqrt{-g} g^{rr} K_r \xi^2) = 0$; this is solved by \begin{equation} \label{amp} \xi = \frac{a}{{ \left( \sqrt{-g} g^{rr} g^{\phi \phi} K_r \right)}^{1/2}} , \end{equation} where $a$ is a constant. For the real part of \eqref{vlong}, we have \begin{multline} \sqrt{-g} g^{tt} g^{\phi \phi} \left(\partial_t^2 \xi - \xi K_t^2\right) + \partial_r \left(\sqrt{-g} g^{rr} g^{\phi \phi}\right) \partial_r \xi\\ + \sqrt{-g} g^{rr} g^{\phi \phi} \partial_r^2 \xi - \sqrt{-g} g^{rr} g^{\phi \phi} \xi K_r^2 + z R^{\phi \phi} \xi = 0. \end{multline} \noindent Dividing by $\sqrt{-g} g^{\phi \phi} \xi$, one obtains \begin{align} \label{dispersion} K^{\mu} K_{\mu} &= g^{tt} K_t^2 + g^{rr} K_r^2 \notag \\ &= \frac{z R^{\phi \phi}}{\sqrt{-g} g^{\phi \phi}} + g^{rr} \frac{\partial_r^2 \xi}{\xi} + \frac{\partial_r (\sqrt{-g} g^{rr} g^{\phi \phi}) } {\sqrt{-g} g^{\phi \phi} } \frac{\partial_r \xi}{\xi}, \end{align} i.e.~the dispersion relation for the wave. At this stage, note that for the specific constant amplitude ansatz, i.e.~$\xi(r) = \text{const}$, the wave follows null geodesics for $z = 0$ in the sense that the dispersion relation vanishes (in particular, the group velocity becomes unity---this is shown in \cite{AH}), but also that in the case of FLRW spacetimes there is no consistent solution for $K_r$ for $z \neq 0$. (In generic spacetimes, the specific constant amplitude ansatz does not even lead to solutions for $z=0$, as already mentioned above, and as pointed out in \cite{AH2}.) We will, however, use the solution for $\xi = \xi(r) \neq \text{const}$ obtained in terms of $K_r$ as given by \eqref{amp}; plugging into the dispersion relation \eqref{dispersion} gives \begin{widetext} \begin{equation}\label{DispersionFRW} -K_t^2 + \left(1-k r^2\right) K_r^2=\frac{\left(k r^2-1\right) \partial^2_r K_r}{2 K_r}-\frac{3 \left(k r^2-1\right) (\partial_r K_r)^2}{4 K_r^2} - k \frac{2 + r^2}{4 \left(k r^2-1\right)} + z k \frac{8 k^2 r^4 -16 k r^2 +8 }{4 r^2 \left(1- k r^2\right)^{3/2}}, \end{equation} \end{widetext} \begin{comment} \begin{widetext} \begin{equation}\label{DispersionFRW}-K_t^2 + (1-k r^2) {K_r}^2 = z \sqrt{\frac{r^4}{(1- k r^2)}}\cdot \frac{r^{-4} - 2 k r^{-2} + k^2}{r^4 (1-k r^2)} + \frac{3/2 k- 3/4 k^2 r^2}{1 -k r^2} + \frac{3 (1 - k r^2) {K'_r}^2}{4 {K_r}^2} - \frac{(1 - k r^2) K''_r}{2 K}, \end{equation} \end{widetext} \end{comment} where $z = 0$ if the additional curvature coupling term is neglected. Note that even for $z = 0$, the wave exhibits non-trivial dispersion in these coordinates (we discuss further the possibility of coordinate effects below), as long as the amplitude is non-constant. (This is compatible with the finding by \cite{AH2} that in the $z=0$ but \textit{constant} amplitude case the dispersion relation is trivial again.) Restricting to $S(t) = \omega t$ where $\omega$ is a constant, we now solve numerically (using \textsc{Mathematica}) \eqref{DispersionFRW} in the domain $r \in \left[ 0.1, 0.9\right]$ (in order to avoid issues of coordinate singularities) with $k=1$, subject to the initial conditions $K_r\left(0.1\right)=\omega$ and $K^\prime_r\left(0.1\right)=1$. One could equally well choose $K^\prime_r\left(0.1\right) = 0$, even though this seems to suggest that the wave-vector is position-independent and that a trivial dispersion-relation imposed at one point (as secured via $K_r(0.1) = \omega$) will thereby remain trivial everywhere. This impression, however, is misleading insofar as we are still considering at this point the wave in $\left(t,r\right)$ coordinates, rather than in the $\left( \tau, \rho\right)$ coordinates to be discussed below. (Only setting the analogous initial condition in terms of $\rho$ to $0$, i.e.~requiring $\partial K_{\rho} / \partial \rho =0$ would impose position-independence of the dispersion relation in a physical sense.) Then, inputting a fixed $r$ in the above domain, one can extract functional relationships between $K_r$ and $\omega$ at different values of $z$. Choosing, for instance, $r=0.2$, one finds the dependencies presented in figure 1. \begin{figure} \centering \includegraphics[scale=0.55]{graph4.pdf} \label{fig1} \emph{\caption{$\omega = \frac{\partial S(t)}{\partial t} = K_t$ as a function of $K_r$ for a transverse electromagnetic wave in FLRW spacetime ($k = 1$). ($K_r$ is obtained numerically from \eqref{DispersionFRW} with $K_r(0.1)=\omega$, $K_r'(0.1) = 1$, giving rise to the functional relationship between $K_r$ and $\omega$.) Different values of $z$ correspond to the strength of the additional curvature coupling.}} \end{figure} From these results, one finds that although even for $z=0$ it is not the case that the group velocity $\partial\omega/\partial K_r$ is exactly unity (where we normalise $c=1$), dispersion effects increase with $z$. Choosing greater $r$ exacerbates the dispersion effects, as one would expect, given the greater radial distance from the point at which the above initial conditions are imposed. From the above results, one also sees clearly that the phase velocity $\omega/K_r$ of the wave is not constant. Finally: if one repeats the calculations of this sections in other spacetimes, such as G\"{o}del, one finds analogous results. Now, strictly speaking, in order to avoid being misled by coordinate effects when making these judgements on the dispersion relation, one should switch to coordinates that bring the wave equation into a form locally adapted to Minkowski spacetime. Generally, for a spherically symmetric metric given as \cite[p.~4]{AH} \begin{align} g_{tt} &= f(t) q(r), \\ g_{rr} &= h(t) b(r), \\ g_{\theta \theta} &= h(t) r^2, \\ g_{\phi \phi} &= h(t) r^2 \sin^2(\theta), \end{align} the time coordinate $t$ and spatial coordinate $r$ need to be changed, respectively, to \cite[p.~5]{AH} \begin{align} \tau &:= \int dt \sqrt{-\frac{f}{h}} ,\\ \rho &:= \int dr \sqrt{\frac{b}{q}} . \end{align} Thus, for FLRW spacetime with $R(t)=1$ and $k > 0$, \begin{align} \tau &= t , \\ \rho &= \int dr \sqrt{\frac{1}{1-k r^2}} = \frac{1}{\sqrt{k} \sin{(\sqrt{k} r)}} , \label{eq31} \end{align} setting all integration constants to zero. Inverting \eqref{eq31}, one obtains \begin{equation}\label{rrho} r = \frac{1}{\sqrt{k}} \arcsin{\left(\frac{1}{\sqrt{k} \rho}\right)}. \end{equation} This being said, in the above we work in $\left(t,r\right)$ coordinates, for two reasons. First, the form of the coordinate transformation between $r$ and $\rho$, i.e.~\eqref{rrho}, leads to oscillatory functions in the transformed version of \eqref{DispersionFRW}; and unlike the $\left(t,r\right)$ coordinates, the coordinates locally adapted to Minkowski spacetime can only be used to cover FLRW spacetime for relatively small regions as the transformation rule from $r$ to $\rho$ is periodic and thus non-monotonous. Second, given the particular form of \eqref{rrho}, one can be assured that tuning $z$ to different values will lead to different physical effects even in the $\left( \tau, \rho\right)$ coordinates, as the $z$-dependent term of \eqref{DispersionFRW} is non-constant in $\rho$ and not merely in $r$ (this follows from plugging \eqref{rrho} into the $z$-dependent term). Note finally that transforming to $\left( \tau, \rho\right)$ coordinates implies that propagating electromagnetic waves can have dispersion even in familiar cases of e.g.~Schwarzschild spacetimes (and even having set $z=0$; see \cite[\S2]{AH}). Thus, the above results corroborate the claims made in \cite{AH, AH2} that, outside of the geometrical optics regime, light does not invariably propagate on null geodesics in general relativistic universes; they also make clear the tangible physical effects of including extra curvature couplings in Maxwell's equations that potentially arise due to the ambiguities of the minimal coupling scheme (and thus prior to any semi-classical corrections from QED, as for instance accounted for by the Drummond-Hathrell action, or other sorts of matter couplings \cite{Hertzberg}). There are, however, certain other claims made in \cite{AH} which are questionable: these regard the consistency of the geometrical optics limit. It is to these issues that we now turn; ultimately, we will reject these claims---this constitutes the negative part of our discussion of \cite{AH, AH2}. \begin{comment} We now solve numerically equation \eqref{DispersionFRW} (using \textsc{Mathematica}) in the domain $\rho \in \left(1.1, 10,000??\right]$ (corresponding to $r \in \left[0, \pi/2 \right)$) with $k=1$, subject to the initial conditions $K_{\rho}\left(1.1\right)=\omega$ and $\frac{\partial K_{\rho}}{\partial \rho}\left(1.1\right)=100 \neq 0$.\todo{it is slightly weird to change coordinates between r and rho because of the arcsin but I don't think this is an issue overall. Just keep in mind: r covers the whole spacetime and is therefore a nice coordinate system. rho is only physical because it provides the right unit length to the coordinate axes not because it has to cover (it doesn't) the whole spacetime.} The domain has been chosen to avoid issues of coordinate singularities: $r$ is well-defined everywhere apart from at $r=0$, whereas the coordinate $\rho$ is only well-defined for values $\rho >1$. Two remarks are in order with respect to the choice of initial conditions: the exact numerical value for $\frac{\partial K_{\rho}}{\partial \rho}\left(1.1\right)$ is irrelevant as long as it is different from zero; choosing zero would amount to imposing the standard dispersion relation with $K_{\rho} = const$ from the start --- which is incompatible with the assumption of our ansatz above that $\xi$ is non-constant in $r$ and thus also in $\rho$ (cf. \eqref{amp} for FLRW when re-expressed in terms of $K_{\rho}$, i.e. $\xi \propto 1/\sqrt{K_{\rho}}$). Secondly, as \eqref{DispersionFRW} is given in terms of $r$ rather than $\rho$, the posited (locally) Minkowski-adapted initial conditions in terms of $\rho$ have to be transformed as $K_{\rho} = \frac{\partial r} {\partial \rho} K_{r} \rightarrow K_{\rho}/(\frac{\partial r} {\partial \rho}) = K_{r}$, and $\frac{\partial K_{\rho}}{\partial {\rho}} = \frac{\partial r}{\partial \rho} \frac{\partial K_{\rho}}{\partial r} \rightarrow \left( \frac{\partial K_{\rho}}{\partial \rho} - K_{\rho} \frac{\partial^2 r}{\partial {\rho}^2}/ (\frac{\partial r}{\partial \rho})\right)/ (\frac{\partial r}{\partial \rho})^2 = \frac{\partial K_{r}}{\partial r}$ before being fed into the numerical solver for \eqref{DispersionFRW}. Secondly, as \eqref{DispersionFRW} is given in terms of $r$ rather than $\rho$, the posited (locally) Minkowski-adapted initial conditions in terms of $\rho$ have to be transformed as $K_{\rho} = \frac{\partial r} {\partial \rho} K_{r} \rightarrow K_{\rho}/(\frac{\partial r} {\partial \rho}) = K_{r}$, and $\frac{\partial K_{\rho}}{\partial {\rho}} = \frac{\partial r}{\partial \rho} \frac{\partial K_{\rho}}{\partial r} \rightarrow \left( \frac{\partial K_{\rho}}{\partial \rho} - K_{\rho} \frac{\partial^2 r}{\partial {\rho}^2}/ (\frac{\partial r}{\partial \rho})\right)/ (\frac{\partial r}{\partial \rho})^2 = \frac{\partial K_{r}}{\partial r}$ before being fed into the numerical solver for Then, inputting a fixed $\rho$ in the above domain, one can extract functional relationships between $K_{\rho}$ and $\omega$ at different values of $z$. Choosing (for instance) $\rho=1.5$, one finds the dependencies presented in figure 1. \begin{figure} \centering \includegraphics[scale=0.55]{graph3.pdf} \label{fig1} \emph{\caption{$\omega$ as a function of $K_{\rho}$ for a transverse electromagnetic wave in FLRW spacetime ($k = 1$). Different values of $z$ correspond to the strength of the additional curvature coupling.}} \end{figure} From these results, one finds that although even for $z=0$ it is not the case that the group velocity $\partial\omega/\partial K_{\rho}$ is exactly unity (where we normalise $c=1$), deviations from null propagation of the wave increase with $z$. Choosing greater $r$ exacerbates the deviation from null propagation of the wave, as one would expect, given the greater radial distance from the point at which the above initial conditions are imposed. From the above results, one also sees clearly that the phase velocity $\omega/K_{\rho}$ of the wave is not constant. Finally: if one repeats the calculations of this sections in other spacetimes, such as G\"{o}del, one finds analogous results. These results corroborate the claims made in \cite{AH, AH2} that, outside of the geometrical optics regime, light does not invariably propagate on null geodesics in general relativistic universes; it also makes clear the tangible physical effects of including extra curvature couplings in Maxwell's equations that potentially arise due to the ambiguities of the minimal coupling scheme (and thus prior to any semi-classical corrections from QED, as for instance accounted for by the Drummond-Hathrell action, or other sorts of matter couplings \cite{Hertzberg}). There are, however, certain other claims made in \cite{AH} which are questionable: these regard the consistency of the geometrical optics limit. It is to these issues that we now turn; ultimately, we will reject these claims---this constitutes the negative part of our discussion of \cite{AH, AH2}. \end{comment} \begin{comment} It has recently been shown that \eqref{A2}, when solved in rotating spacetimes such as G\"{o}del and Kerr, yields non-null propagation of electromagnetic waves \cite{AH}. Although such non-null propagation of solutions of \eqref{A2} does not arise in non-rotating spacetimes, one is led to wonder whether the curvature couplings in \eqref{A3} might play a role analogous to global rotation in the above examples, and again lead to non-null propagation. If so, this would provide striking vindication of our above claim that \eqref{A2} and \eqref{A3} are inequivalent with respect to their empirical consequences. In this paper, we investigate such matters in the simple, constant-curvature case of de Sitter spacetime; we find that the curvature couplings in \eqref{A3} do indeed lead to non-null propagation of electromagnetic waves. \end{comment} \section{Spacetimes with inconsistent geometrical optics limits?}\label{s4} In \cite{AH}, the authors suggest that certain wave solutions in Gödel spacetime do not have a well-defined geometrical optics limit; that is, no exact wave solutions are consistent with $K^{\mu} K_{\mu} = 0$. They claim that there is therefore no sense in which these electromagnetic waves can be said to move on null geodesics at high frequencies. These claims deserve greater scrutiny. To this end, recall the reasoning of \cite{AH} in more detail. For G\"{o}del spacetime, the dispersion relation following from \eqref{A2'} is \begin{equation}\label{DispersionGoedel} -\omega^2 + K_x^2 = -\frac{\Omega^2}{2} + \frac{3 K^{\prime 2}_x}{4 K_x^2} - \frac{K^{\prime \prime}_x}{2 K_x},\end{equation} where $' \equiv \partial_x$. In \cite{AH}, the geometrical optics limit is referred to as the `high-frequency limit', which one can take to be the limit $\omega \rightarrow \infty$; it is then claimed that the limit is successfully taken only if $K^\mu K_\mu \rightarrow 0$. Note, though, that the R.H.S.~of \eqref{DispersionGoedel} is unequal to zero under $\omega \rightarrow \infty$ and is therefore inconsistent with this requirement. The reason for this is not only due to the presence of the $\Omega \neq 0$ term---as indicated in \cite{AH}---but also due to the presence of the terms in $K'_x$ and $K''_x$, neither of which need vanish when $\omega \rightarrow \infty$. To be fair to \cite{AH}, these latter two terms do vanish when amplitude variations are taken to be negligible (a feature of the geometrical optics limit as discussed at \cite[\S22.5]{MTW} and cited in this context by \cite{AH}), but it is worth recognising that this does not follow from the condition $\omega \rightarrow \infty$ alone. Regardless of whether one takes this into account, however, the point made in \cite{AH}---that terms on the R.H.S.~of \eqref{DispersionGoedel} spoil the consistency of this limit---still stands. This, indeed, is the origin of the claim in \cite{AH} that the geometrical optics limit is inconsistent in such spacetimes. Is it, however, correct to understand the geometrical optics regime in terms of a high frequency (and potentially also constant amplitude) limit? Recall from \cite[p.~571]{MTW} that in the geometrical optics limit (traditionally construed) one \textit{also} requires that wavelength be much less than the characteristic scale of curvature variations (in addition to taking amplitude variations to be negligible---an assumption which we will continue to make in this paragraph). Now, in G\"{o}del spacetime, one has that $G_{\mu\nu}u^\mu u^\nu = \Omega^2$, where $G_{\mu\nu}$ is the Einstein tensor and $u^\mu$ is some normalised four-velocity vector \cite[p.~168]{HE}; thus, we see that $\Omega$ is directly related to curvature effects, and so, in the geometrical optics limit, it makes sense on physical grounds to impose two conditions: $\omega \rightarrow \infty$ and $\Omega \rightarrow 0$; alternatively---but not equivalently---one could take the limit $\Omega / \omega \rightarrow 0$. (Whether these two approaches to the geometrical optics limit are indeed equivalent depends upon the convergent series which one selects in the latter: our thanks to Sam Fletcher for pointing this out to us.) In the remainder of this section, we will for concreteness focus on the limit $\Omega / \omega \rightarrow 0$. Taking this limit, one finds from \eqref{DispersionGoedel} that the geometrical optics limit can be taken consistently, and that light does propagate on null geodesics in this limit. (An aside: taking a limit of this kind, involving a comparison of scales, seems to us a promising way of understanding the content of the equivalence principle as it is used in physical practice---see e.g.~\cite{Will}.) One might take the general point here to be this: a limiting procedure on a physical quantity can be regarded as being physical only if formulated in relation to some other physical quantity. (Compare, for example, the by-now suspect $c \rightarrow \infty$ Newtonian limit in special relativity with the better-accepted $v/c \rightarrow 0$ limit in this theory.) On these grounds, one might claim that the $\omega \rightarrow \infty$ limit deployed in \cite{AH} is not physically justified. While roughly correct, this way of putting things remains a little too quick, for one can now ask: if, when considering some particular limit, there is a sequence of models shown to converge in some well-defined sense, and all of the models are interpreted (i.e., represent some physical possibility), what more could be needed in declaring the limit to be `physical'? Such certainly seems to be the case for the $\omega \rightarrow \infty$ limit taken in \cite{AH}, in which case it is not clear that `physicality' is the most appropriate way in which to couch the issue. Indeed, we do not deny that studying the $\omega \rightarrow\infty$ limit can advance our understanding of the behaviour of light in curved spacetimes: there is nothing \emph{per se} wrong with the study of high frequencies in such spacetimes. Rather, the issue with the limit taken in \cite{AH}, as we see it, is that it does not represent what the authors purport it to represent: in particular, whether `physical' or not, and whether physically illuminating in certain respects or not, it nevertheless does not represent the geometrical optics limit as traditionally understood. (Again, our thanks to Sam Fletcher for discussions on these matters: see \cite{Fletcher2} for related discussions of limiting relations in spacetime theories.) For maximal clarity, one might introduce a parameter tracking the frequency orders, as done in \cite[\S22.5]{MTW}. It will then be clear that only terms in the equations of motion involving at least two derivatives in the vector potential term $A^\mu$ can, upon a wave ansatz, contribute at the relevant order to the dispersion relation; at the frequency order two, we have $K^{\mu} K_{\mu} = 0$. The following observation is also worthy of mention. Consider \eqref{DispersionFRW} in FLRW spacetimes. As long as $k \neq 0$ (as discussed before, non-constant amplitude waves are solutions in flat FLRW---they do not arise only in the geometrical-optical limit approximation), the R.H.S.~is unequal to zero under $\omega \rightarrow \infty$ independently of the chosen curvature coupling (i.e.,~value of $z$) for Maxwell's equations. Therefore, non-flat FLRW spacetime---which, of course, builds the modelling foundation for the standard model of cosmology---would represent another physical example of there being exact wave solutions in spacetimes which (i) do not propagate on null geodesics, and which (ii) do not have a well-defined geometrical optics limit. But again, our same reservations as above apply: if one takes what is arguably the correct geometrical optics limit in this case, which here would effectively involve taking $k \rightarrow 0$ (or $k/\omega\rightarrow 0$), one recovers both the consistency of the limit and the null propagation of light. In \cite{AH}, approximations are invoked in order to derive from \eqref{DispersionGoedel} the following results for the phase and group velocities of light in G\"{o}del spacetime in the case $\Omega x \ll 1$: \begin{align} v_{\text{ph}} &= \frac{\omega}{K_x} \approx 1 + \frac{1}{2}\Omega^2 x^2 , \label{vph} \\ v_{\text{gp}} &= \frac{\partial \omega}{\partial K_x} \approx 1 + \frac{1}{2}\Omega^2 x^2. \label{vgp} \end{align} This seems to corroborate the claim that, in the $\omega\rightarrow \infty$ limit, light still does not propagate on null geodesics. However, there are two points to note here. First: if one also takes $\Omega\rightarrow 0$, then null propagation is retained (the authors of \cite{AH} note this in the context of flat spacetimes, but not in the context of the understanding of the geometrical optics limit discussed above). Second: one might wonder whether \eqref{vph} and \eqref{vgp} are artefacts of truncating a series too early. Continuing the expansion in \eqref{vph} to higher order, one finds that \begin{widetext} \begin{multline}\label{Kexpand} K_x = \omega \left(1 -\frac{x^2 \Omega ^2}{2} +\frac{x^4 \Omega ^4}{6} -\frac{17 x^6 \Omega ^6}{360} + \cdots \right) +\omega^3 \left(\frac{x^4 \Omega ^2}{6} -\frac{13 x^6 \Omega ^4}{90} + \frac{8 x^8 \Omega^6}{105} - \frac{899 x^{10} \Omega^{8}}{28350} + \cdots \right) \\ + \omega^5 \left(-\frac{x^6 \Omega ^2}{45} + \frac{x^8 \Omega ^4}{21} - \frac{1699 x^{10} \Omega ^6}{37800} + \frac{108593 x^{12} \Omega ^8}{3742200} - \cdots \right) + \cdots \end{multline} \end{widetext} Noting the contribution of the additional terms in \eqref{Kexpand}, it is not at all clear that \eqref{vph} and \eqref{vgp} are the final story on the phase and group velocities of light in G\"{o}del spacetime in the case $\Omega x \ll 1$. To summarise: in \S\ref{s3} we fortified the claims made in \cite{AH, AH2} that light, outside of the geometrical optics limit, need not propagate on null geodesics. However, in this section we have called into question the claims made in those articles that this limit is inconsistent in spacetimes such as G\"{o}del. \section{Propagation speed in curved spacetime}\label{s5} If one accepts that light need not propagate along null geodesics when properly modelled by solving Maxwell's equations in curved spacetimes, then one decouples light propagation from null cone structure. In \cite{Hojman}, Hojman accordingly takes the above-discussed results regarding the varying group velocity of light in curved spacetimes as motivation for redefining the proper time interval: the proper time interval is to reflect the actual interaction of light with the gravitational field (as represented by the background metric) instead of just the idealised interaction of light with the gravitational field in the geometrical optics limit (in which light indeed moves on null geodesics). In response to this, however, one might argue that it is not clear that null cone structure is most sensibly tied to light structure to begin with: rather, the proper time interval might better be understood through the major conceptual roles of encoding causal structure, and quantifying distance between path-connectible points alone. More significantly: the causal significance of the proper time interval is not necessarily endangered by the mere finding that there are superluminal group velocities---as for instance observed from the dispersion relations above for Gödel and FLRW spacetimes---since superluminal propagation is not linked straightforwardly to superluminal \emph{signalling}. After all, signal propagation speed (the propagation relevant for causal considerations) is bounded by the front velocity which, for a general set of PDEs \cite[p.~15]{Shore}, is given by \citep{LIM, Shore} \begin{equation} v_{\text{wf}} = \lim_{\omega\rightarrow\infty}\frac{\omega}{|\vec{k}|} = \lim_{\omega\rightarrow\infty}v_{\text{ph}}\left(\omega\right) . \end{equation} \noindent In fact, the front velocity can be shown to be unity in curved spacetime for a wide class of second-order tensorial PDEs, including \eqref{A2} and \eqref{A3} \cite[\S3.2]{Friedlander}, in which case the upper bound to signalling speed indeed seems to be unity, as argued in the classic work of \cite{Brillouin} (see \cite{Milonni} for further discussion). That, of course, does not mean that this bound is always saturated. In fact, it is generally accepted that in normal dispersive media, such as water, causal influences propagate at velocities less than the front velocity (cf.~\cite{CausalLoop}); furthermore, it has been shown in the seminal work \cite{Nature} that in anomalous dispersive media causal influences indeed propagate at speeds slower than unity (despite a faster-than-unity group velocity). Similarly, then, the instantaneous signal speed of an electromagnetic wave in curved spacetime---the curvature of spacetime mimics across different frequencies and curvature scales the effects of both normal and anomalous dispersive media---might be seen generally to deviate downwards from unity. (Such an effect can also be argued for on the basis of the tail problem, as discussed above.) The precise amount of downwards deviation will be a function of the curvature length scale relative to frequency at which the wave is considered. Now, upon taking the idealising geometrical optics limit, the causal structure will still be given by the light cone structure as long as at most corrections to the usual Maxwell equations \eqref{A2} (or, for what it is worth, \eqref{A3}) are added that do \textit{not} involve terms of equal to or higher order in $(\partial A)^2$ or $\partial \partial A$ \cite[\S3.1]{Hertzberg}. When terms of this form are added to the Maxwellian equations of motion (as for instance the case when taking into account semi-classical corrections from QED), the geometrical optical limit generally results in a non-zero dispersion relation (in the case of the QED corrections this is the already-discussed Dummond-Hathrell effect). The impact of the aforementioned terms on the dispersion relation in the geometrical optics limit is easy to understand from the fact that any derivative on $A^\mu$ amounts, upon plugging in the wave ansatz, to pulling down a frequency factor $\omega$. Thus, terms of the described form are of order $\omega^2$ and cannot be neglected upon the geometrical-optical limit: see \cite{Hertzberg} for a discussion. This being said, even in the more general case in which these terms are included, Hertzberg and Sandora \cite[\S4.2]{Hertzberg} have identified a back-reaction mechanism such that in the context of general relativity (albeit not for curved spacetimes in general) superluminal signalling can occur only at scales smaller than a photon's wavelength but is otherwise averaged out; given that superluminal signalling events for a photon only endure at lengths scale smaller than its own wavelength, such signalling might well be regarded as being operationally meaningless. Outside of the regime of the geometrical optics limit, a light clock realised through periodic bouncing of a light signal (so-called `Langevin clocks') will in practice not read out reliably the proper time along its worldline interval. But, to repeat: on taking the idealising geometrical optics limit and setting aside the above-discussed additional coupling terms, contra \cite{clocks}, an idealised light clock construction modelled by Maxwellian theory in curved spacetime will still read out the proper time interval along its worldline (for, upon idealisation, the signal speed is unity, and the assumptions of \cite{Fletcher} obtain). Moreover, even when corrections from QED are taken into account, the aforementioned mechanism \emph{à la} Hertzberg and Sandora guarantees that deviations from the light cone structure are minuscule, or even operationally meaningless, in the context of general relativity. In the context of \cite{AH, AH2}, our point in this section is, ultimately, a simple one: even granting the claims made in those papers, it is not at all clear that superluminal \emph{signalling} is implicated. \section{Discussion} The finding of \cite{AH}---that there are electromagnetic wave solutions in Gödel spacetimes not amenable to the geometrical optics limit---seems to stand in tension with other major results in the literature on electromagnetic wave propagation in curved spacetimes, as were mentioned in the introduction: (i) Friedlander shows that the front velocity of waves in curved spacetime is always 1 (see \cite[Thm.~3.2.1]{Friedlander}); (ii) in \cite{GW}, the authors demonstrate the small bodies constructed from Maxwell fields in curved spacetimes `track' (in a technical sense) null geodesics, and claim that this is a special case of the geometrical optics limit. The present article should ameliorate any such tension, for we have demonstrated that, given a physical understanding of the geometrical optics limit, this limit can invariably be taken consistently, that light invariably propagates along null geodesics in this limit, that in particular the front velocity is unity, and that, nevertheless, the signal velocity may be less than unity outside of the geometrical optics limit. \section*{Acknowledgements} We are grateful to Jacob Barandes, Juliusz Doboszewski, John Dougherty, Sean Gryb, Dennis Lehmkuhl, Tushar Menon, Erhard Scholz, Nic Teh, and Jim Weatherall for valuable discussions, and to Sam Fletcher, Chris Smeenk, and the three anonymous referees for very helpful feedback on previous drafts. N.L. acknowledges financial support from the John Templeton Foundation (grant 61048). \bibliographystyle{plain}
\section{Introduction} The data driven Neural Machine Translation(NMT), which follows the end-to-end framework, has shown its superiority on high-resource languages in recent years ~\citep{sutskever2014sequence, bahdanau2014neural, wu2016google,vaswani2017attention}. Because of the fact that NMT system is highly depended on extensive high-quality parallel data, which can only be acquired for few language pairs, it is still challenging for low-resource and zero-shot NMT ~\citep{koehn2017six}. Existing approaches for zero-shot NMT include multilingual NMT ~\citep{firat2016zero,ha2016toward,johnson2017google}, interactive multimodal framework ~\citep{kiros2014unifying,nakayama2017zero}, pivot-based NMT ~\citep{wu2007pivot,cheng2016neural,leng2019unsupervised} and teacher-student architecture ~\citep{chen2017teacher}. We focus on the multilingual NMT system, which is simple and effective. Recent multilingual NMT with a simple approach named target-forcing, which is trained on a mixture of several parallel data and adds a token to the start of the source sentence to determine the target language, is effective for low-resource languages ~\citep{johnson2017google}. Particularly by using this way, the multilingual NMT system has possibility to perform zero-shot translation through sharing the common model. In order to improve the performance of zero-shot languages, \citet{lakew2017improving} proposed the self-learning algorithm, which generates synthetic parallel data by translating existing target data through the multilingual NMT round and round. The whole process is a self-learning cycle of train-infer-train. However, there still exist some problems about the proposed methods for zero-shot translation. We find that the multilingual NMT system does not accurately translate the source language into the required target language when performing zero-shot translation. In addition, the self-learning algorithm, which uses beam search to choose the highest probability sentence to generate synthetic parallel data, demolishes the diversity of the generated source sentences. Especially in the last few rounds of the iterative process, the model’s effect on zero-shot translation is improved slightly and even declines. We speculate that this is because of the synthetic parallel data that is generated by beam search is almost the same in the last few iteration, which amplifies the effect of harmful noise. In this paper, we improve the multilingual NMT and the self-learning algorithm to address the two problems. We first extend the Google’s multilingual NMT system and add a token to the start of the target language to indicate that the target language is the required one. This ensures that the source language can be translated into the required target language. Then the multilingual NMT system is trained on the available mixed parallel data until convergence called tagged-multilingual NMT. Next, we improve the self-learning algorithm by replacing beam search with random sample ~\citep{pillemer1988prevalence} to generate synthetic parallel data for zero-shot translation, which can not only increase the diversity of source language of the synthetic parallel data but also can increase fluency in the target language generated by decoder. In order to testify the effectiveness of the improved method, we experiment it on a multilingual-NMT scenario including Italian-English and Romanian-English parallel corpora, assuming the zero-shot translation is Italian-Romanian and Romanian-Italian. For the tagged-multilingual NMT, experimental results show that adding a target tag can not only make the model to accurately translate the source language into the required target language, but also can improve the performance of the multilingual NMT system, especially in zero-shot translations. For the improved self-learning method, the method effectively improve the performance of zero-shot translation and even exceed the single NMT model with 20K parallel data in Romanian-Italian translation. In summary, our contribution are as follows: \begin{itemize} \item we add a token to the start of the target language to ensure the tagged-multilingual NMT can accurately generate the required target language. It significantly improve the performance of the zero-shot translation and is simultaneously helpful for the low-resource multilingual NMT. \item We improve the self-learning method via replacing beam search with random sample to increase the diversity of the generated synthetic parallel data, which makes the generated data more relevant to real language situations. \item Experimental result on the multilingual translation shared task published in 2017 International Workshop on Spoken Language Translation(IWSLT) shows the superiorities of our tagged-multilingual NMT model and the improved self-learning method over the previous methods. \end{itemize} The reminder of the article is organized as follows. Section 2 summarizes the related work and highlights the differences of our tagged-multilingual NMT model and the improved self-learning algorithm from previous studies. Section 3 briefly describes the NMT model for the multilingual NMT. Section 4 gives details of our proposed tagged-multilingual NMT model and the improved self-learning algorithm. Section 5 introduces the detail of our data sets, experiment settings and baselines. Section 6 reports the experimental results on IWSLT multilingual translation tasks. Finally, we conclude in section 7 with future work. \section{Related work} In this section, we first introduce the origin and development of multilingual NMT. Some existing methods for zero-shot translation, which extends multilingual NMT or is based on other architectures, are shown in the next part. \subsection{Multilingual NMT} Inspired by the sequence to sequence NMT, \citet{dong2015multi} proposed a one-to-many multi-task NMT to achieve higher translation quality, which has a same source language and different target languages. The same source language can make full use of the source corpora for better representation through a shared encoder. Different target languages use a separate decoder and attention mechanism, which can learn latent similar semantic and structural information across different languages. In a related work, \citet{luong2015multi} used separate encoder and decoder networks for modeling language pairs in a many-to-many setting. Aiming at reducing ambiguity at translation time, \citet{zoph2016multi} proposed a multi-source NMT with multiple encoders and one attention mechanism, which obtains excellent performance through the novel combination method to encode the common semantic of multiple source languages and the multi-source attention. Follow the Dong and Luong et al’s work, \citet{firat2016multi} proposed a multi-way multilingual NMT, which is a many-to-many translation. It shares the attention mechanism and uses different encoders and decoders across different language pairs. Experimental results show the effectiveness of the shared attention mechanism for low-resource languages. But, due to the high complexity of the previously mentioned method, Johnson et al and Ha et al attempted to build a multilingual NMT without modifying the network architecture. \citet{ha2016toward} applied a language-specific coding to words of both source and target languages for better representation. In practice, language-specific coding for words and sub-words significantly increased the length of sentences, which causes trouble for sentence representation and attention mechanism. In order to translate into the specific target language, they use target forcing to add a token to the start and the end of the source sentence. Even more concisely, \citet{johnson2017google} just add an artificial token to the start of source sentence to indicate the required target languages. \subsection{Zero-shot translation} Researchers have done fantastic work for zero-shot NMT. An intuitive way is to select a medium as a pivot. \citet{cheng2016neural} proposed a pivot-based method, which use a third language as pivot, for zero-resource NMT. It translate the source language to a pivot language, which is then translated to target language. Similarly, \citet{nakayama2017zero} had shown that multimodal information is also effective as a pivot to zero-resource NMT. However, the pivot method suffers from expensive computational resource and error propagation ~\citep{zhu2013improving}. Base on the exiting problems, \citet{chen2017teacher} proposed a teacher-student architecture for zero-resource NMT by assuming that parallel sentences have close probabilities of generating a sentence in a third language. In ~\citep{chen2018zero}, chen et al proposed a multimodal framework to make full use of monolingual multimodal content to achieve direct modeling of zero-resource source-to-target NMT, which includes captioner and translator two agents. The captioner, which is CNN-RNN architecture, translated image into source sentence. The translator, which is the training target, translated source sentence into the target sentence. The another benefit of multilingual NMT is to have possibility for zero-shot translation. By extending the approach in ~\citep{firat2016multi}, \citet{firat2016zero} extends the one-to-one pivoted based strategy for zero-shot NMT, where the second stage is replaced by the many-to-one strategy. Moreover, the attention mechanism of the many-to-one strategy is fine-tuned by the generated pseudo parallel corpus. Following google’s multilingual NMT, \citet{lakew2017improving} proposed the self-learning algorithm for zero-shot NMT, which is a process of constantly iterating through a train-infer-train mechanism to generate synthetic parallel data for zero-shot translation. By using this way, the quality of the generated parallel data is significantly improved. Despite the success of the proposed method for zero-shot translation, we extend the method proposed by Lakew et al and found the inadequacies of the multilingual NMT and the self-learning algorithm. Therefore, we improve the multilingual NMT by adding a target token to the start of the target language to indicate the required target language and improve the self-learning method via sampling to increase the diversity of generated parallel data. \section{Neural machine translation} Without loss of generality, the multilingual NMT and self-learning method can be applied to any NMT models. We use the transformer model for the multilingual NMT proposed by \citet{vaswani2017attention}, which is by far the most effective end-to-end NMT model. Therefore, in this section, we briefly introduce the overall architecture of the model. The encoder, which encodes the source sentence $\chi = \left ( \chi _{1},\chi _{2},\cdots ,\chi _{n} \right )$ into a series of context vector $ C = \left ( h _{1},h _{2},\cdots ,h _{n} \right )$, consists of six identical layers. Each layer includes two sub-layers. The first layer is a multi-head attention mechanism, which learns the association between words in a sentence by weighting the sum of all words in the sentence to express a word. The attention mechanism is computed as follows: \begin{equation} Attention\left ( Q,K,V \right )= softmax\left ( \frac{QK^{T}}{\sqrt{d_{k}}} \right )V \end{equation} Where $Q$, $K$, $V$ are query, key and value matrix. $QK^{T}$ is used to compute the weights between words. These weights are multiplied by corresponding word embedding and then added to obtain a new representation of the query word in $Q$. Finally, the encoder obtains the context vector $C$ that better presents the source sentence. Compared with RNN and LSTM, self-attention mechanism can better learn long sentence dependencies. The second layer is a full-connected feed forward network. Because of the multi-head attention mechanism map the sentence to different semantic spaces, the six-layer encoder learns the deep semantic relationship of the sentence. Similarly, the decoder also consists of six identical layers. The difference is that each layer includes a mask multi-head attention mechanism, attention mechanism and feed forward network. Where the attention mechanism uses the weighted sum of the context vector to represent the target words, which works like word alignment to match the source words with the target words. In the inference process, the target word is generated by maxing \begin{equation} p(y_{t}|y_{<t},C)=softmax(f(y_{<t},C)) \end{equation} where $y_{<t}$ are the generated words, $f$ represents a series of function operations inside the decoder. Specially, residual connection is applied between the sub-layers to avoid gradient vanishing in both encoder and decoder. At the end of each sub-layer, layer norm is applied to speed up training. \section{Tagged-multilingual NMT and the improved self-learning algorithm} In this section, we describe the tagged-multilingual NMT and the improved self-learning algorithm for zero-shot translation. We extend the Google’s multilingual NMT and add a token to the start of the target language to indicate the required language. For example, the tagged Roman-English parallel data are as follows: \begin{flushleft} Source~(Romanian):\\ $<2en>$ Am zburat cu Air Force Two timp de opt ani.\\ Target~(English):\\ $<en>$ I flew on Air Force Two for eight years. \end{flushleft} We add tokens to the source sentences and corresponding target sentences like the example for all parallel data. After this, we train a multilingual NMT model called tagged-multilingual NMT as shown in Figure 1. The decoder starts with a start-tag and then generates the required target tag with the help of attention mechanism when decoding, it ensure that subsequent words are the correct target language, which is more effective for zero-shot translation. \begin{figure}[htb] \centering \includegraphics[width=8.8cm,height=8cm]{./Figure1.jpg} \caption{The tagged-multilingual NMT model and the improved self-learning algorithm.} \label{fig1} \end{figure} Furthermore, considering the self-learning method with beam search, which choose the sentence with the highest probability, decreases the diversity of the generated synthetic parallel data and amplify the negative effect of noise in the process of continuous iteration, thus we improved the self-learning method via replacing the beam search method with random sample. The improved self-learning method is shown in Algorithm 1. \begin{algorithm}[ht] \caption{Zero-shot translation L1$\leftrightarrow$L2 } \label{algorithm1} \begin{algorithmic}[1] \Require mixed parallel data D, source language l1, target language l2 \State Tagged-Multilingual NMT $\leftarrow$ Train ($\theta$, D) \State Monolingual L1 $\leftarrow$ Extract form (D, l2) \State Monolingual L2 $\leftarrow$ Extract form (D, l2) \For{i=1,N} \State L1* L2* $\leftarrow$ using Tagged-Multilingual NMT to translate L1, L2 to generate the source langue via sampling for zero-shot translation \State New mixed parallel data D*=(l1+L1*+L2*, l2+L1+L2) \State Update Tagged-Multilingual NTM $\leftarrow$ train($\theta_{1}$, D*) for 3 epoch \EndFor \Ensure Return updated Tagged-Multilingual NMT \end{algorithmic} \end{algorithm} The improved self-learning methods can be divided into three part. For the first step, we train a tagged-multilingual NMT on the mixed parallel data in line 1. Next, the synthetic parallel data for zero-shot translation is generated by translating the target language into source language through the tagged-multilingual NMT model in line 5, which uses sample to increase the diversity of the synthetic data instead of beam search. The sample during decoding is calculated as follows: \begin{equation} \widetilde{y}_{t}=Sample(f(y_{t}|y_{<t},C)) \end{equation} The decoder starts with start tag and then generates the next word based on the probability distribution of the word. By using random sample, some low-probability words are generated to create a fluent sentence, which is more fitted to the distribution of real data. Finally, we add the synthetic parallel data to the mixed data to update the tagged-multilingual NMT to get better performance round and round. The iteration is performed a total five times in line 6-7, where the tagged-multilingual NMT is trained on new mixed parallel data for 3 epoch at each time. \section{Experiment} In this section, we first introduce the data sets and hyper-parameters for the tagged-multilingual NMT. Next we briefly introduce the baselines that has been mentioned in the prat of related work. \subsection{Data set and preprocessing} We consider the scenario that there are Romanian~(Ro) $\leftrightarrow$ English~(En), Italian~(It) $\leftrightarrow$ English~(En) parallel data for the multilingual NMT, assuming that Italian(It) $\leftrightarrow$ Romanian(Ro) are zero-shot translations. The details of the datasets are shown in Table 1. All the parallel data are from the 2017 IWSLT multilingual TED talks machine translation task ~\citep{cettolo2012wit3}. The dev set and test sets are from IWSLT 2010, 2017 evaluation campaigns for development and evaluating the models. Specially, we combine the dev sets of exiting parallel data into a mixed dev set for multilingual NMT. \begin{table}[htp] \centering \scriptsize \caption{All data sets for the tagged-multilingual NMT.} \begin{tabular}{lcccc} \hline \vspace{1mm}\\[-3mm] Language pair & Train & Dev 2010 & Test 2010 & Test2017 \\ \vspace{1mm}\\[-3mm] \hline \vspace{1mm}\\[-3mm] It-En & 231619 & 929 & 1566 & 1147\\ Ro-En & 220538 & 914 & 1678 & 1129\\ It-Ro & 217551 & 914 & 1643 & 1127\\ \hline \end{tabular} \label{table1} \end{table} In data preprocessing process, we first use Moses’s word segmentation tool to segment parallel data\footnote{http://www.statmt.org/moses/?n=Moses.Baseline}. Then we segment words into sub-words via Bite Pair Encoding ~\citep{sennrich2016neural} to effectively decrease the number of words that is out-of-vocabulary(OOV). \subsection{Experiment settings} All the experiments are trained based on the transformer models ~\citep{vaswani2017attention}, which is implemented by the Mxnet-based(version 1.4.1) NMT framework sockeye(version 1.18.99) ~\citep{hieber2017sockeye}. We do a lot of works to find suitable hyper-parameters for low-resource languages and the tagged-multilingual NMT model as shown in Table 2 and Table 3. From Table 2, we find that setting BPE merge number to 8000 and drop out to 0.3 gets the best result for It-En translation. However, from Table 3, we can see that embedding dropout is valid for the tagged-multilingual NMT. Especially, it works best on the validation set when embedding dropout is 0.3, and is close to the results when embedding dropout is 0.2. Unfortunately, compared with the embedding dropout of 0.2,it increases the training time by 30$\%$. So, we finally choose embedding dropout is 0.2 and BPE merge number is 12000 for the tagged-multilingual NMT. \begin{table*}[htp] \centering \scriptsize \caption{The hyper-parameters for It-En translation.} \begin{tabular}{cccccccccccc} \hline \vspace{1mm}\\[-3.5mm] \multicolumn{12}{c}{It-En}\\ \vspace{1mm}\\[-3.5mm] \hline \vspace{1mm}\\[-3mm] BPE merge number & 36000 & 15000 & 10000 & 9000 & 8000 & 8000 & 8000 & 8000 & 7000 & 6000 & 4000\\ Drop out & 0.3 & 0.3 & 0.3 & 0.3 & 0.3 & 0.5 & 0.4 & 0.2 & 0.3 & 0.3 & 0.3\\ Dev set & 25.3 & 27.2 & 28.31 & 27.96 & 28.59 & 26.15 & 28.21 & 27.12 & 28.07 & 28.36 & 27.63\\ \hline \end{tabular} \label{table2} \end{table*} \begin{table*}[t] \centering \scriptsize \caption{The experimental results of the bilingual NMT, the multilingual NMT, the tagged-multilingual NMT and their adjusted model on test 2010 and test 2017.} \begin{tabular}{cccccccc} \hline Direction&\tabincell{c}{Bilingual\\Baseline1} & \tabincell{c}{Multilingual\\Baseline2} & Tagged-multilingual & \tabincell{c}{Adjusted\\ tagged-multilingual} & \tabincell{c}{Adjusted\\ bilingual} & \tabincell{c}{Adjusted\\ multilingual} & \tabincell{c}{Improved\\self-learning\\ algorithm}\\ \hline \vspace{1mm}\\[-3mm] \multicolumn{8}{c}{Test2010}\\ \vspace{1mm}\\[-3.5mm] \hline \vspace{1mm}\\[-3mm] It-En& 29.23& 29.71& 30.16(+0.45)& 30.86(+1.15)& 30.51& 30.75 & -\\ En-It& 26.34& 26.23& 26.41(+0.18)& 27.23(+1.00)& 27.00& 26.63 & -\\ Ro-En& 31.53& 31.57& 31.74(+0.17)& 32.94(+1.37)& 32.31& 32.85& -\\ En-Ro& 23.40& 24.03& 24.51(+0.48)& 25.1(+1.07)& 24.01& 24.79&-\\ Ro-It& 19.27& 6.82& \textbf{10.66(+3.84)}& \textbf{16.23(+9.41)}& 19.69& 13.71 &19.86\\ It-Ro& 17.60& 6.09& \textbf{8.78(+2.69)}& \textbf{15.17(+9.08)}& 18.17& 14.35& 17.96\\ \hline \vspace{1mm}\\[-3mm] \multicolumn{8}{c}{Test2017}\\ \vspace{1mm}\\[-3.5mm] \hline \vspace{1mm}\\[-3mm] It-En& 32.20& 32.34& 32.55(+0.21)& 33.31(+0.99)& 33.17& 33.69&-\\ En-It& 28.84& 29.19& 29.16(-0.03)& 30.11(+0.92)& 29.25& 30.03&-\\ Ro-En& 26.11& 27.18& 27.35(+0.17)& 28.15(+0.97)& 27.43& 27.96&-\\ En-Ro& 20.61& 20.88& 21.51(+0.69)& 21.71(0.89)& 20.14& 21.03&-\\ Ro-It& 18.77& 6.82& \textbf{9.57(+2.75)}& \textbf{14.67(+7.85)}& 19.51& 12.49& 19.34\\ It-Ro& 17.41& 5.65& \textbf{7.65(+2)}& \textbf{13.64(+7.99)}& 17.59& 12.25&16.96\\ \hline \end{tabular} \label{table4} \end{table*} \begin{table}[htp] \centering \scriptsize \caption{The hyper-parameters the tagged-multilingual NMT.} \begin{tabular}{ccccc} \hline \vspace{1mm}\\[-3mm] \multicolumn{5}{c}{Tagged-multilingual NMT}\\ \vspace{1mm}\\[-3mm] \hline \vspace{1mm}\\[-3mm] BPE merge number & 8000 & 12000 & 12000 & 12000\\ Embedding dropout & 0 & 0 & 0.2 & 0.3\\ Dev set & 19.56 & 20.02 & 20.15 & 20.23\\ \hline \end{tabular} \label{table3} \end{table} The other hyper-parameters of the transformer are as follows. Considering the high data sparsity of low-resource languages and to prevent over-fitting ~\citep{srivastava2014dropout} of the model, we set the label smoothing ~\citep{szegedy2016rethinking} to 0.1 and set the dropout of 0.3 for multi-head attention, feed-forward network and preprocessing block according to the sennrich et al’s work for low-resource NMT ~\citep{sennrich2019revisiting}. In addition, We use the Adam ~\citep{kingma2014adam} as the optimizer and set the initial learning rate to 0.0003. Particularly, at the beginning of the training, The warmup$-{}$traing$-{}$steps is set to 16000 to warm up the learning rate, which prevents model oscillation caused by random initialization of parameters, batch size is 4096. In the training process, we use early stop as the stop condition of the training model. If the model’s effect on the dev set is no longer improved for 10 times, we contend that the model is optimal. For decoding, a beam search size 10 is applied for the NMT model. Finally, the BLEU score, which is proven evaluation metrics, is applied to verify the effectiveness of the model ~\citep{papineni2002bleu}. \subsubsection{Baselines} We refer to our model as the tagged-multilingual NMT and compared it against the following baselines. \begin{itemize} \item Baseline 1 is a bilingual NMT based on transformer. \item Baseline 2 is google’s multilingual NMT with self-learning algorithm for zero-shot translation. \end{itemize} The multilingual NMT uses a token at the start of the source language to indicate the required target language. Furthermore, the self-learning algorithm generates synthetic parallel data for zero-shot translation by translating the target language. \section{Results and analysis} In this section, we conduct experiment to evaluate the effectiveness of the tagged-multilingual NMT and the improved self-learning method on IWSLT multilingual translation task. We describe the experimental results and analysis them. \begin{figure*}[t] \centering \begin{minipage}{6.5cm} \includegraphics[width=6.5cm]{./Figure2.jpg} \end{minipage} \begin{minipage}{6.5cm} \includegraphics[width=6.5cm]{./Figure3.jpg} \end{minipage} \caption{The improved self-learning algorithm for It-Ro zero-shot translation on Test2010 and Test2017.} \label{figure2} \end{figure*} \begin{figure*}[t] \centering \begin{minipage}{6.5cm} \includegraphics[width=6.5cm]{./Figure4.jpg} \end{minipage} \begin{minipage}{6.5cm} \includegraphics[width=6.5cm]{./Figure5.jpg} \end{minipage} \caption{The improved self-learning algorithm for Ro-It zero-shot translation on Test2010 and Test2017} \label{figure3} \end{figure*} \subsection{Tagged-multilingual NMT} We train the tagged-multilingual NMT on the mixed parallel data until the performance on the dev set are no longer improved for consecutive ten times. The experimental results of the adjusted tagged-multilingual NMT, the tagged-multilingual NMT, the adjusted multilingual NMT, the multilingual NMT, the adjusted bilingual NMT and the bilingual NMT on test 2010 and 2017are shown in table 4. From table 4, we can see that the tagged-multilingual NMT achieve the same or better results than the multilingual model. More obviously, the tagged-multilingual NMT improves \textbf{3.84} and \textbf{2.69} BLEU scores respectively for Ro-It and It-Ro zero-shot translations. After tuning the hyperparameters, the tagged-multilingual NMT improves \textbf{9.41} and \textbf{9.08} BLEU scores respectively. Similarly, the results on test 2017 are in same, which improve \textbf{2.75} and \textbf{2} BLEU scores for Ro-It and It-Ro zero-shot translations. Specially the adjusted tagged-multilingual NMT improves \textbf{7.85} and \textbf{7.99} BLEU scores respectively for zero-shot translations. We also find that, for translations with parallel data such as It-En and so on, the multilingual model can translate the source language into required target language. Unfortunately, it works poorly for zero-shot translation, which translates lots of the source language into the target language that has parallel data with the source language. The reasons are that the attention mechanism of the multilingual NMT, which works like word alignment, learns the correspondences between the source language and the target language with corresponding parallel data. More importantly, the source token that can be seen a word of source language dose not have a corresponding target word, which causes the target words and the source token to have low weights in the attention mechanism. Therefore, due to the lack of parallel data, the attention mechanism works poorly for the zero-shot translation. However, the tagged-multilingual model adds corresponding target tokens to the target languages, which corresponds to the source token and associates the start tag with the required target language. In the training process, the self-attention mechanism can learn the relationship between the target token and the target language. The attention mechanism linking source and target languages learns the alignment between the source token and the target token. Therefore, when decoding, the decoder start with the start tag and then generate the target token of the required target language with the help of the attention mechanism. Next, the start tag and the generated target token are presented by self-attention mechanism. Then the required target words will be generated by classifier with the help of attention mechanism. Because the target words are generated by maxing the conditional probability of $p(y|start-tag,target- token, context-vector)$, which bases on the previous words and context vectors, therefore the target token can specify the required target language accurately at the beginning of decoding. Experimental results show that the adding a target token effectively solve the problem of specifying the target language for zero-shot translations. \subsection{Improved self-learning algorithm} In order to further improve the performance of zero-shot translation, we improve the self-learning method via replacing the beam search with random sample for the multilingual NMT. We test beam search, sample and a combination of the two methods, where beam search size is 10, sample size is 5. All results on test2010 and test2017 for It-Ro zero-shot translation are shown in Figure 2. Similarly, for Ro-It zero-shot translation, all results of different self-learning algorithms are shown in Figure 3. Besides, the detailed experimental data is shown in appendix. From these Figures, we can see that the effect of the self-learning algorithm with beam search on all test sets increases slowly and even declines since the third round. For this phenomenon, we try to improve it with random sample and the combination of the tow methods. Experimental results as shown in Table 5 and Table 6 in appendix show that both methods are helpful, and the sample is more effective. More obviously, the adjusted self-learning algorithm significantly improves \textbf{1.31} and \textbf{0.66} BLEU scores on test2010 and 2017 It-Ro zero-shot translation, and improves \textbf{1.21} and \textbf{0.87} BLEU scores on test2010 and 2017 Ro-It zero-shot translation. Moreover, compared to adjusted single It-Ro and Ro-It translation with 20K parallel data as shown in table 4, the improved self-learning algorithm for zero-shot translations has very close results with bilingual NMT model and even excess the single model on test2010 Ro-It translation. We contend that beam search chooses the highest probability sentences, which will result in generating same sentences during the iteration. That will demolish the diversity of the generated sentences and amplify the impact of the same noise. However, the synthetic parallel data generated by random sample have sentences that select low probability words with corresponding probability, which is helpful for increasing the diversity of the source language and properly covering the true data distribution. \section{Conclusion an future work} This paper has presented the tagged-multilingual NMT and the improved self-learning algorithm. Unlike the multilingual NMT and the self-learning algorithm, our tagged-multilingual NMT model can correctly translate the source language into the required target language by learning the relationship between the target language and the target token, which is especially obvious in zero-shot translations. The improved self-learning algorithm generates synthetic parallel data closer to the true data distribution through random sample, which increase the diversity of the source language of the synthetic parallel data. Experimental results on IWSLT multilingual NMT tasks and It-Ro bidirectional zero-shot translations show that the tagged-multilingual NMT and the self-learning algorithm achieve significant improvement over a variety of baselines. In the future work, we are going to explore better approaches to improve the self-learning mechanism to generate high-quality synthetic parallel data.
\section{Introduction} \label{sec:intro} The current generation of supercomputers is composed of highly multicore processors. The ever-increasing core counts are likely to continue in the present and post-Exascale ($10^{18}$ flops/sec) era. The Top500 list for November 2020 shows 50\% of supercomputers have 20-24 cores per socket, and the fastest supercomputer, Fugaku, has 48 cores~\cite{top500}. Limiting power consumption is one of the significant challenges today. For an exascale system to be delivered within a power budget of 20–30 MW~\cite{exascale}, the hardware and software components need to be highly energy-efficient. Cache-coherent shared memory processors that dominate modern high-performance computing (HPC) systems contain multiple levels of caches in each socket. Most processor architectures are a combination of \emph{core} and \emph{uncore} elements. The uncore includes all chip components outside the CPU core~\cite{ufs}, such as shared caches, memory controllers, and interconnects (QPI on Intel platforms). The processor power consumption can be regulated using multiple knobs for such as Dynamic Voltage and Frequency Scaling (DVFS)~\cite{kim2008system} and Dynamic Duty-Cycle Modulation (DDCM)~\cite{ddcm} for CPU cores, and Uncore Frequency Scaling (UFS)~\cite{ufs} for the uncore. DVFS allows scaling down the core's voltage and frequency, thereby reducing power consumption as lowering the voltage has a squared effect on active power consumption. The static losses have become significant with transistor shrinkage, undermining the previously achievable power savings with DVFS~\cite{esmaeilzadeh2011dark}. Nevertheless, DVFS is still the most effective and widely used power control. Most energy-efficient HPC research has revolved around reducing the processor/core frequency by using DVFS or DDCM with minimum performance impact (see Section~\ref{sec:related}). These implementations adapt the core frequencies as follows: a) based on trace data collected from the application's offline profiling, b) whenever parallel programs encounter slack time due to unbalanced computation or inter-node communication delays, c) gathering workload characteristics by profiling iterative and loop-based applications, and d) programming model and runtime-dependent application profiling. A standard limitation of these studies is that they are specific to a particular application or programming model. Recently, UFS has been explored for achieving energy efficiency based on machine learning models on offline generated application data~\cite{BSAB2019} and by dynamically profiling the DRAM power consumption~\cite{GNMF2019}. However, these studies lack an integrated approach for core and uncore frequency scaling. This paper explores a one-stop solution for achieving energy efficiency on multicore processors called {Cuttlefish}\xspace that dynamically adapts both the core and uncore frequencies on Intel processors without requiring training runs. {Cuttlefish}\xspace is oblivious to the parallel programming model and the concurrency decomposition techniques used in an application. In their application, programmers only need to use two API \rebuttal{functions}, \textjava{cuttlefish::start()}\xspace and \textjava{cuttlefish::stop()}\xspace, to define the scope requiring an energy-efficient execution. At runtime, {Cuttlefish}\xspace then creates a daemon thread that periodically profiles the application's Memory Access Pattern (MAP) by reading the Model-Specific Registers (MSR) available on all Intel platforms. Each MAP is uniquely identified as the ratio of uncore event \textjava{TOR_INSERT}\xspace~\cite{torinsert} and instructions retired. {Cuttlefish}\xspace daemon then uses DVFS to determine the core frequency that would provide maximum energy savings with minimal impact on execution time. After finding and setting this optimal core frequency, {Cuttlefish}\xspace daemon then uses the same exploration-based technique to determine the optimal uncore frequency. To reduce the loss in performance, it uses several runtime optimizations to complete the frequency explorations quickly. Once both optimal core and uncore frequencies are found for a given MAP, the rest of the program would execute at these frequencies. {Cuttlefish}\xspace would repeat this frequency exploration for core and uncore every time a new MAP is discovered. We chose a set of ten widely-used {OpenMP}\xspace benchmarks, consisting of several irregular-tasking and work-sharing pragmas to evaluate {Cuttlefish}\xspace on a 20-core Intel processor. We show that {Cuttlefish}\xspace significantly improves the energy-efficiency with a negligible impact on performance. We also evaluated {Cuttlefish}\xspace by implementing a subset of these benchmarks using \async--\finish\xspace task parallelism~\cite{KVZY2014} to demonstrate that {Cuttlefish}\xspace is oblivious to the parallel programming model. In summary, this paper makes the following contributions: \begin{itemize} \item {Cuttlefish}\xspace, a parallel programming model oblivious C/C++ library for achieving energy efficiency in multicore parallel programs running on Intel processors. \item A novel light-weight runtime for {Cuttlefish}\xspace that periodically monitors the memory access pattern of a running application and then dynamically adapts the core and uncore frequencies using DVFS and UFS, respectively. \item Evaluation of {Cuttlefish}\xspace on a 20-core Intel Xeon Haswell E5-2650 processor by using multiple HPC benchmarks and mini-applications implemented in {OpenMP}\xspace and \async--\finish\xspace programming model. Our evaluation shows that {Cuttlefish}\xspace can significantly improve energy efficiency with negligible impact on the execution time for several irregular-tasking and work-sharing pragmas. \end{itemize} \section{Experimental Methodology} \label{sec:methodology} \begin{table*}[] \centering \resizebox{0.95\textwidth}{!}{% \begin{tabular}{|c|c|c|c|c|c|c|c|} \hline \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}Benchmark\\ Name\end{tabular}} & \multirow{2}{*}{Brief Description} & \multirow{2}{*}{Configuration} & \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}Parallelism\\ Style\end{tabular}} & \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}OpenMP\\ Time (sec)\end{tabular}} & \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}TIPI \\ Range\end{tabular}} & \multicolumn{2}{l|}{Total TIPI Slabs} \\ \cline{7-8} & & & & & & Distinct & Frequent \\ \hline \textjava{UTS}\xspace & Unbalanced Tree Search~\cite{OSHJ2006} & TIXXL & Irregular Tasks & 69.9 & 0-0.004 & 1 & 1 \\ \hline \textjava{SOR-irt}\xspace & Successive Over-Relaxation (SOR)~\cite{bull2000benchmark} & 32Kx32K (200) & Irregular Tasks & 69.1 & 0.024-0.028 & 1 & 1 \\ \hline \textjava{SOR-rt}\xspace & \rebuttal{\ditto} & \rebuttal{\ditto} & Regular Tasks & 69.4 & 0.024-0.028 & 1 & 1 \\ \hline \textjava{SOR-ws}\xspace & \rebuttal{\ditto} & \rebuttal{\ditto} & Work-sharing & 68.7 & 0.012-0.028 & 3 & 1 \\ \hline \textjava{Heat-irt}\xspace & Heat diffusion (Jacobi-type iteration)~\cite{mitcilkversion} & 32Kx32K (200) & Irregular Tasks & 76.6 & 0.056-0.076 & 4 & 1 \\ \hline \textjava{Heat-rt}\xspace & \rebuttal{\ditto} & \rebuttal{\ditto} & Regular Tasks & 75.5 & 0.056-0.072 & 3 & 2 \\ \hline \textjava{Heat-ws}\xspace & \rebuttal{\ditto} & \rebuttal{\ditto} & Work-sharing & 70.9 & 0.012-0.068 & 11 & 1 \\ \hline \textjava{MiniFE}\xspace & Finite Element Mini-Application~\cite{mantevo,heroux2009improving} & 256x512x512 (200) & Work-sharing & 78.5 & 0.068-0.152 & 16 & 1 \\ \hline \textjava{HPCCG}\xspace & \begin{tabular}[c]{@{}c@{}}High Performance Computing \\ Conjugate Gradients~\cite{mantevo,heroux2009improving}\end{tabular} & 256x256x1024 (149) & Work-sharing & 60 & 0.060-0.148 & 17 & 1 \\ \hline \textjava{AMG}\xspace & Algebraic Multigrid solver~\cite{amg} & 256x256x1024 (22) & Work-sharing & 63.7 & 0.060-0.332 & 60 & 2 \\ \hline \end{tabular} } \caption{Description of the benchmarks used in this paper for the evaluation of {Cuttlefish}\xspace} \label{tab:bench} \end{table*} \begin{figure}[h] \centering \includegraphics[width=\linewidth]{graphs/dag.png} \captionof{figure}{\rebuttal{\textjava{Heat-irt}\xspace and \textjava{SOR-irt}\xspace use the irregular execution DAG, whereas \textjava{Heat-rt}\xspace and \textjava{SOR-rt}\xspace use the regular execution DAG. Non-root and non-leaf grey and black nodes have degrees three and five, respectively. Each node is parallel task}} \label{fig:dag} \end{figure} Before presenting the motivating analysis for {Cuttlefish}\xspace, we first describe our experimental methodology. To cover a broad spectrum of parallel applications, we have chosen benchmarks based on the following attributes: a) memory access patterns, b) micro-kernels and real-world mini-applications, c) execution DAG, and d) concurrency decomposition techniques. We target six widely-used benchmarks for our experimental evaluation. These benchmarks mainly use {OpenMP}\xspace pragmas, but a few were ported to \async--\finish\xspace programming model supported by the {HClib}\xspace work-stealing library~\cite{KVZY2014,GMKV2017} to evaluate {Cuttlefish}\xspace using two different parallel programming models. We created three variants (both for {OpenMP}\xspace and {HClib}\xspace) that differ in execution DAG and concurrency decomposition technique for two of these benchmarks, Heat and SOR. Two of these variants use dynamic task parallelism and vary in terms of irregular (\emph{irt}) and regular (\emph{rt}) execution DAGs. The third variant is a non-recursive implementation that uses work-sharing (\emph{ws}) based static loop partitioning. The technique described in Chen et al. ~\cite{Chen2014} was used for converting the loop-level parallelism in Heat and SOR into regular and irregular execution DAG, as shown in Figure~\ref{fig:dag}. In total, we have ten benchmarks/mini-applications. Table~\ref{tab:bench} describes them and their respective configurations. We ran all experiments on an Intel Xeon Haswell E5-2650 v3 20-core processor with a total of 94GB of RAM. The operating system (OS) was Ubuntu 16.04.7 LTS. This processor supports core and uncore frequencies between 1.2GHz--2.3GHz and 1.2GHz--3.0GHz, respectively, both in steps 0.1GHz. We used \textjava{MSR-SAFE}~\cite{msrsafe} for saving and restoring Model-Specific-Register (MSR) values. The turboboost feature on the processor was disabled, and each benchmark used interleaved memory allocation policies supported by the \textjava{numactl} library. The {HClib}\xspace implementation from the official Github repository with the commit id \textjava{ab310a0} is used. Both {OpenMP}\xspace and {HClib}\xspace versions of the benchmarks used the Clang compiler version 3.8.0 with the -O3 flag. All 20 threads used in the experiments were bound to their respective physical CPUs. \rebuttal{ Although we use an Intel Haswell processor in our evaluation, more recent Intel processors can use {Cuttlefish}\xspace by updating the MSRs specific to them. While the latest AMD processors do support per-core DVFS similar to Intel, based on public documentation available, it is not clear if support for UFS or TIPI measurement exists.} We evaluated three variants of {Cuttlefish}\xspace: a) {Cuttlefish-Core}\xspace that only adapts the CPU frequency, b) {Cuttlefish-Uncore}\xspace that only adapts the Uncore frequency, and c) {Cuttlefish}\xspace that adapts both the CPU and Uncore frequencies. We compared these implementations against each benchmark's \textjava{Default}\xspace execution by setting the Intel power governor to \textjava{performance} policy. The performance power governor fixes the CPU frequency to the maximum. We chose \textjava{performance} power governor for \textjava{Default}\xspace execution as this same setting is used by several supercomputers in production~\cite{hartuser,cook2017performance}. \rebuttal{For Cuttlefish-based executions, the power governor is set to userspace to allow changes to the CPU frequency through the library.} \rebuttal{We changed the uncore frequency scaling option to \emph{Auto} in the BIOS, allowing the Intel firmware to modulate the uncore frequency during the \textjava{Default}\xspace execution. The algorithm used by Intel is highly sensitive to memory requests. During {Cuttlefish}\xspace executions, the runtime controls the uncore frequency dynamically inside the library by writing the desired frequency value in the UFS MSR (\textjava{0x620}).} We executed each implementation ten times and reported the mean value along with a 95\% confidence interval. \section{Motivating Analysis} \label{sec:motivate} \begin{figure*}[h] \centering \subfigure[Variation in JPI during the course of execution]{\label{graph:timelineJPI}\includegraphics[width=0.49\textwidth]{graphs/actual_jpi.png}} \subfigure[Variation in TIPI during the course of execution]{\label{graph:timelineTIPI}\includegraphics[width=0.49\textwidth]{graphs/actual_tipi.png}} \caption{Relation between TIPI and JPI. For each benchmark, JPI increases with the increase in TIPI} \label{graph:motivate1} \end{figure*} An application's memory access pattern (MAP) can be primarily classified as memory-bound or compute-bound. Memory-bound applications have a high number of memory accesses as compared to compute-bound applications. This section presents two analyses to support that MAP of an application can be accurately identified using MSRs (Section~\ref{sec:tipi}), and changing the core and uncore frequencies based on MAP can lead to energy savings (Section~\ref{sec:tipitrend}). \subsection{TOR Inserts per Instruction (TIPI)} \label{sec:tipi} To accurately identify the MAP of an application, we propose the metric TOR Inserts per Instruction (\emph{TIPI}), which is calculated as the ratio of total TOR Inserts (\textjava{TOR_INSERT.MISS_LOCAL + TOR_INSERT.MISS_REMOTE}) and total instructions retired (\textjava{INST_RETIRED.ANY}). Any requests coming to the LLC from the processor cores are place in TOR (Table of Request). \textjava{TOR_INSERT}\xspace MSR~\cite{torinsert} is available on all Intel processors from Haswell generation and onwards. This MSR counts the number of memory requests that come to the socket-specific Last-Level Cache (LLC) from each core. It supports various Unit Masks (umask) to select the type of memory requests to be counted. \textjava{MISS_LOCAL} counts the misses to the local caches and memory, and \textjava{MISS_REMOTE} counts the misses to the remote caches and memory as per the Intel documentation~\cite{torinsert}. We consider both these umasks as our experimental machine is a two-socket NUMA machine (Section~\ref{sec:methodology}). The other metric used is Joules per Instructions (\emph{JPI}). JPI is calculated as the ratio of the total energy spent by the processor and the total instructions retired. The package energy is measured using the Intel RAPL MSRs. We found that compute-bound and memory-bound applications have low and high TIPI values, respectively. It is also observed that TIPI has a strong correlation with JPI as an increase in TIPI also increases the JPI. These observations are reported in Figure~\ref{graph:motivate1}. The core and uncore frequencies are initially set to the maximum, and periodically the TIPI and JPI for an application is recorded at every {T\textsubscript{inv}}\xspace intervals. The {T\textsubscript{inv}}\xspace is fixed at 20 milliseconds and is empirically derived for all experiments reported in this paper. The x-axis in Figure~\ref{graph:motivate1} represents the execution timeline of each benchmark in seconds. The y-axis in Figure~\ref{graph:timelineTIPI} and Figure~\ref{graph:timelineJPI} shows the TIPI and JPI, respectively, during the benchmark's execution. The result of only \textjava{Heat-irt}\xspace and \textjava{SOR-irt}\xspace are reported as their variants have similar behaviours. As JPI is highly sensitive to TIPI, JPI is used to measure energy efficiency for a given TIPI. In Figure~\ref{graph:timelineJPI}, \textjava{SOR-irt}\xspace has a higher JPI than \textjava{Heat-irt}\xspace, although \textjava{SOR-irt}\xspace's TIPI is less than that of \textjava{Heat-irt}\xspace (Figure~\ref{graph:timelineTIPI}). For \textjava{MiniFE}\xspace, \textjava{HPCCG}\xspace, and \textjava{AMG}\xspace, it is observed that TIPI varies throughout the execution. However, an increase in TIPI shows an increase in JPI. This implies that the TIPI v/s JPI trend holds only within an application, and the same TIPI value could have different JPIs for different applications. \vspace{-1ex} \subsection{Analysis of DVFS and UFS with TIPI} \label{sec:tipitrend} \begin{figure*} \centering \subfigure[Effect of fixing Uncore and changing Core frequency]{\label{graph:mapcore}\includegraphics[width=\textwidth]{graphs/map-core.png}} \subfigure[Effect of fixing Core and changing Uncore frequency]{\label{graph:mapuncore}\includegraphics[width=\textwidth]{graphs/map-uncore.png}} \caption{Motivational analysis to understand the effect of core and uncore frequencies on the JPI at each TIPI} \label{graph:motivate2} \end{figure*} {Cuttlefish}\xspace has an online profiler that explores optimal core and uncore frequencies for every unique TIPIs discovered during a benchmark execution. To limit the search space, we divide each unique TIPIs in fixed slabs of 0.004 (derived empirically), i.e., TIPI values 0.004, 0.005, and 0.007 would be reported under the TIPI range 0.004-0.008. Hereafter, a TIPI value is reported in terms of its range instead of the actual value. Figure~\ref{graph:motivate2} shows the relation between TIPI and JPI for benchmarks at different core and uncore frequencies. In Figure~\ref{graph:mapcore}, the Uncore Frequency (UF) is set to max (3.0 GHz) and each benchmark is executed with three different Core Frequencies (CF) -- min (1.2 GHz), mid (1.8 GHz) and max (2.3 GHz). In Figure~\ref{graph:mapuncore}, the CF is set to max (2.3 GHz) and each benchmark is executed with three different UFs -- min (1.2 GHz), mid (2.1 GHz) and max (3.0 GHz). In each execution of a benchmark, we record the TIPI and JPI at every {T\textsubscript{inv}}\xspace and then calculate the average JPI for the frequently occurring TIPIs. TIPIs found in more than 10\% of total {T\textsubscript{inv}}\xspace samplings are mentioned as frequently occurring TIPIs during an execution. \rebuttal{We can observe that \textjava{UTS}\xspace and \textjava{SOR-irt}\xspace have a low TIPI range and are compute-bound as their JPI decreases with increasing CF and JPI increases with increasing UF. \textjava{Heat-irt}\xspace, \textjava{MiniFE}\xspace, \textjava{HPCCG}\xspace, and \textjava{AMG}\xspace have a high TIPI range and are memory-bound applications as they behave precisely opposite to \textjava{UTS}\xspace and \textjava{SOR-irt}\xspace. JPI of these four benchmarks increases with increasing the CF, and their JPI decreases with increasing the UF. } Although \textjava{Heat-irt}\xspace, \textjava{MiniFE}\xspace, \textjava{HPCCG}\xspace, and \textjava{AMG}\xspace are memory-bound, max uncore frequency is not apt for their TIPI range. This analysis implies that when TIPI is low, CPU cores should run at a higher frequency, and uncore should run at a lower frequency. In contrast, when TIPI is high, uncore should run at a higher frequency, and CPU cores should run at a lower frequency as the latter would frequently halt due to the memory access latency. \section{Design and Implementation} \label{sec:impl} The previous section highlighted that TIPI could be used to distinguish the MAP of an application and for estimating its optimal core and uncore frequencies. Hence, to achieve energy efficiency in an application with minimal loss in performance, it is vital to use a low-overhead online profiler to discover the TIPI ranges dynamically and appropriately set the core and uncore frequencies. We approach the problem using a lightweight daemon thread, {Cuttlefish}\xspace, that runs in tandem with the application to monitor the TIPI and JPI by activating itself after every {T\textsubscript{inv}}\xspace durations to minimize the time-sharing of the CPU with the application. In their application, programmers only need to use two API \rebuttal{functions}, \textjava{cuttlefish::start()}\xspace and \textjava{cuttlefish::stop()}\xspace, to define the scope requiring an energy-efficient execution. Whenever {Cuttlefish}\xspace discovers a new TIPI range, it uses DVFS to explore the optimal core frequency, followed by UFS to explore the optimal uncore frequency for this TIPI range. An optimal frequency is the one that has the lowest JPI. {Cuttlefish}\xspace start its execution without any prior information on TIPI ranges and optimal frequencies. The insight is to minimize the application slowdown due to frequency exploration by compacting the exploration range on the fly based on the optimal core and uncore frequencies of other TIPI range discovered since the start of this application. \subsection{{Cuttlefish}\xspace daemon loop} \label{sec:cfinit} \begin{algorithm} \begin{algocolor} \DontPrintSemicolon \SetAlgoLined \cfa{prev} $\gets$ \cfa{max}$; $ \ufa{prev} $\gets$ \ufa{max}\; set\_freq(\cfa{prev}, \ufa{prev})\; \label{loop:ref1} sleep(warmup duration)\; \label{loop:ref7} \cfa{next} $\gets$ \ufa{next} $\gets$ -1 \; N{\textsubscript{curr}} $\gets$ N{\textsubscript{prev}} $\gets$ NULL \tcp*{TIPI LinkedList nodes} \While{ shutdown not initiated from \textjava{stop} API}{ Read TIPI and JPI values from MSR\; \label{loop:ref3} \uIf{TIPI NOT found in LinkedList}{ \label{loop:ref4} N{\textsubscript{curr}} $\gets$ insert\_in\_sortedLinkedList(TIPI)\; \cfa{LB} $\gets$ \cfa{min}$; $ \cfa{UB} $\gets$ \cfa{max} \tcp*{for N{\textsubscript{curr}}} \label{loop:ref8} \ufa{LB} $\gets$ \ufa{min}$; $ \ufa{UB} $\gets$ \ufa{max} \tcp*{for N{\textsubscript{curr}}} \label{loop:ref9} \tcp{Section~\ref{sec:multitipi1}} Reduce \cfa{LB}$/$\cfa{RB} if LinkedList\textsubscript{size}>1\; \label{loop:ref18} \cfa{next} $\gets$ find(CF, JPI, \cfa{prev}, N{\textsubscript{prev}}, N{\textsubscript{curr}})\; \ufa{next} $\gets$ \ufa{max}\; } \Else{ N{\textsubscript{curr}} $\gets$ fetch\_from\_sortedLinkedList(TIPI)\; \uIf{N{\textsubscript{curr}}.\cfa{opt}$\And$N{\textsubscript{curr}}.\ufa{opt} = -1 }{ \cfa{next} $\gets$ find(CF, JPI, \cfa{prev}, N{\textsubscript{prev}}, N{\textsubscript{curr}})\; \ufa{next} $\gets$ \ufa{max}\; \If{N{\textsubscript{curr}}.\cfa{next} = N{\textsubscript{curr}}.\cfa{opt}}{ \label{loop:ref14} Estimate \ufa{LB}$\And$\ufa{RB} (Algorithm~\ref{algo:guess})\; \label{loop:ref15} \tcp{Section~\ref{sec:multitipi1}} Reduce \ufa{LB}$/$\ufa{RB} if LinkedList\textsubscript{size}>1\; \label{loop:ref19} \ufa{next} $\gets$ N{\textsubscript{curr}}.\ufa{RB}\; } } \uElseIf{N{\textsubscript{curr}}.\ufa{opt} = -1 }{ \cfa{next} $\gets$ N{\textsubscript{curr}}.\cfa{opt}\; \ufa{next}$\gets$find(UF, JPI, \ufa{prev}, N{\textsubscript{prev}}, N{\textsubscript{curr}})\; } \Else{ \cfa{next} $\gets$ N{\textsubscript{curr}}.\cfa{opt}\; \ufa{next} $\gets$ N{\textsubscript{curr}}.\ufa{opt}\; } } set\_freq(\cfa{next} , \ufa{next} )\; \label{loop:ref5} N{\textsubscript{prev}} $\gets$ N{\textsubscript{curr}}\; \cfa{prev} $\gets$ \cfa{next}$;$ \ufa{prev} $\gets$ \ufa{next}$;$\; sleep ( {T\textsubscript{inv}}\xspace )\; \label{loop:ref6} } \caption{\rebuttal{Cuttlefish daemon thread method}} \label{algo:policy} \end{algocolor} \end{algorithm} {Cuttlefish}\xspace daemon thread is spawned by the API \textjava{cuttlefish::start()}\xspace and is pinned to a fixed core. \rebuttal{Algorithm~\ref{algo:policy} lists the pseudocode implementation of this daemon thread}. It sets the core and uncore frequencies to the maximum (\rebuttal{Line~\ref{loop:ref1}}). It runs in a loop where it first calculates the TIPI and JPI for the \rebuttal{whole processor (Line~\ref{loop:ref3}}), followed by execution of the {Cuttlefish}\xspace runtime policy (\rebuttal{Line~\ref{loop:ref4}--Line~\ref{loop:ref5}}), and finally goes back to sleep for {T\textsubscript{inv}}\xspace duration (\rebuttal{Line~\ref{loop:ref6}}). The implementation for measuring the TIPI and JPI in {Cuttlefish}\xspace is inspired by the RCRtool~\cite{porterfield2010RCR}. It continues the execution of this loop until \textjava{cuttlefish::stop()}\xspace is called inside the user application. From Figure~\ref{graph:timelineTIPI} and Figure~\ref{graph:timelineJPI}, we can observe that TIPI and JPI fluctuate heavily at the beginning of the execution timeline. This fluctuation is prominent across all three variants of Heat and SOR and \textjava{AMG}\xspace (seven out of ten benchmarks), whereas it's minuscule in the remaining three benchmarks. This instability is due to cold caches at the start of execution, but it becomes stable after a while. Hence, to avoid recording unstable values of TIPI and JPI, the {Cuttlefish}\xspace daemon loop activates only after a warmup duration of two seconds (\rebuttal{Line~\ref{loop:ref7}}). \subsection{{Cuttlefish}\xspace runtime policy} \label{sec:cfpolicy} After every {T\textsubscript{inv}}\xspace, the {Cuttlefish}\xspace policy (\rebuttal{Line~\ref{loop:ref4}--Line~\ref{loop:ref5}}) is invoked where it uses DVFS and UFS to determine Optimal Core Frequency ({CF\textsubscript{opt}}\xspace) and Optimal Uncore Frequency ({UF\textsubscript{opt}}\xspace) for a given TIPI range. {Cuttlefish}\xspace maintains a sorted doubly linked list of unique TIPI ranges discovered during an execution. This list is empty at the beginning (\rebuttal{Line~\ref{loop:ref4}}). Each node in this linked list has the following fields: TIPI range, arrays to store JPI for each core and uncore frequencies, latest exploration range for core and uncore frequencies, {CF\textsubscript{opt}}\xspace, and {UF\textsubscript{opt}}\xspace. Figure~\ref{fig:explore}(a) shows one such node in this list for a hypothetical processor having seven frequency levels, \textjava{A-G}, for both core and uncore. \textjava{A} and \textjava{G} are the lowest and highest frequencies, respectively, in this processor. To explain the {Cuttlefish}\xspace runtime policy's working, we use this same hypothetical processor in all our discussions hereafter. The \rebuttal{pseudocode implementation of core and uncore frequency exploration is shown in Algorithm~\ref{algo:find}.} \begin{algorithm \begin{algocolor} \DontPrintSemicolon \SetAlgoLined \KwIn{type, \jpi{curr}, \fl{curr}, N{\textsubscript{prev}}, N{\textsubscript{curr}} \KwOut{\fl{next}} ptr = N{\textsubscript{curr}}.FQ\_table$[$type$]$ \tcp{type is CF/UF} \If{ptr.\fl{LB} $\And$ ptr.\fl{RB} are adjacent} { \label{find:ref16} Choose \fl{opt} from \fl{LB} $\And$ \fl{RB} \tcp{Figure~\ref{fig:impl2}} \textbf{return} ptr.\fl{opt}\; } \label{find:ref17} \tcp{Discard JPI in TIPI transition phase} \If{N{\textsubscript{prev}} = N{\textsubscript{curr}}}{ \label{find:ref20} N{\textsubscript{curr}}.JPI\_table$[$type$][$\fl{curr}$]$ $\gets$ average(\jpi{curr})\; \label{find:ref10} } \label{find:ref21} \tcc{\jpi{avg} at any FQ is average of 10 readings. Hence, Line~\ref{exp:if3} / Line~\ref{exp:elif1} equates to true during TIPI transition due to incomplete \jpi{avg}} \uIf{\jpi{avg} NOT exists for ptr.\fl{RB}}{ \label{exp:if3} \textbf{return} ptr.\fl{RB}\; } \ElseIf{\jpi{avg} NOT exists for ptr.\fl{RB-2}}{ \label{exp:elif1} \textbf{return} ptr.\fl{RB-2}\; } \uIf{\jpi{avg} at ptr.\fl{RB-2} is less than ptr.\fl{RB}}{ \label{find:ref11} ptr.\fl{RB} $\gets$ ptr.\fl{RB-2}\; \fl{next} = (ptr.\fl{RB} - ptr.\fl{LB} > 2) ? ptr.\fl{RB-2} : ptr.\fl{LB}\; \label{find:ref12} } \Else{ \fl{next} $\gets$ ptr.\fl{LB} $\gets$ ptr.\fl{RB-1}\; } \If{ptr.\fl{LB} $\And$ ptr.\fl{RB} are same}{ \fl{next} $\gets$ ptr.\fl{opt} $\gets$ ptr.\fl{RB}\; \label{find:ref13} } \tcp{Section~\ref{sec:multitipi2}} Update \fl{LB} or \fl{RB} of other TIPIs if LinkedList\textsubscript{size}>1\; \label{find:ref22} \textbf{return} \fl{next}\; \caption{\rebuttal{Method \textjava{find} for CF / UF exploration}} \label{algo:find} \end{algocolor} \end{algorithm} \subsection{Frequency exploration in single TIPI-range} \label{sec:singletipi} \begin{figure}[h] \centering \includegraphics[width=\linewidth]{graphs/tipi-fig-1.png} \captionof{figure}{Frequency exploration for a single TIPI} \label{fig:explore} \end{figure} Here, we explain the steps followed by the {Cuttlefish}\xspace in exploring the {CF\textsubscript{opt}}\xspace and {UF\textsubscript{opt}}\xspace for benchmarks having a single TIPI range (Table~\ref{tab:bench} lists the total number of distinct TIPI slabs in each benchmark). \rebuttal{{Cuttlefish}\xspace starts the exploration first for the {CF\textsubscript{opt}}\xspace within the default exploration range with the left bound core and uncore frequencies ({CF\textsubscript{LB}}\xspace and {UF\textsubscript{LB}}\xspace, respectively) set to minimum, and the right bound core and uncore frequencies ({CF\textsubscript{RB}}\xspace and {UF\textsubscript{RB}}\xspace, respectively) set to maximum (Algorithm~\ref{algo:policy}, Line~\ref{loop:ref8}--Line~\ref{loop:ref9}).} For the hypothetical processor, this exploration is shown in Figure~\ref{fig:explore}, where {CF\textsubscript{LB}}\xspace=\cfl{A} and {CF\textsubscript{RB}}\xspace=\cfl{G}. As execution starts with the frequencies set to \cfl{G} and \ufl{G}, after the first {T\textsubscript{inv}}\xspace, the JPI value for \cfl{G} is recorded. To ensure stability in the JPI value, {Cuttlefish}\xspace computes the average JPI at \cfl{G} across ten {T\textsubscript{inv}}\xspace. Henceforth, the JPI value reported for any \textjava{CF} and \textjava{UF} in {Cuttlefish}\xspace is an average of ten readings \rebuttal{(Algorithm~\ref{algo:find}, Line~\ref{find:ref10}). Frequency exploration cannot continue until an average of ten readings of JPI is available at a given frequency.} Once the JPI is finalized for \cfl{G} (Figure~\ref{fig:explore}(a)), {Cuttlefish}\xspace will use DVFS to set the core frequency at \cfl{E} without changing the uncore \rebuttal{(Algorithm~\ref{algo:policy}, Line~\ref{loop:ref5})}. Frequencies are always explored at steps of two to minimize the exploration steps. {Cuttlefish}\xspace will then compare the JPIs at \cfl{G} and \cfl{E} (Figure~\ref{fig:explore}(b)). \rebuttal{This comparison is performed at Line~\ref{find:ref11}--Line~\ref{find:ref12} in Algorithm~\ref{algo:find}.} As \cfl{E} has lower JPI than \cfl{G}, {Cuttlefish}\xspace will update {CF\textsubscript{RB}}\xspace=\cfl{E} and then set the frequency at \cfl{C}. As it turns out that \cfl{C} has lower JPI than \cfl{E}, now {CF\textsubscript{RB}}\xspace=\cfl{C} (Figure~\ref{fig:explore}(c)), and the frequency would be set to \cfl{A}. As even \cfl{A} has lower JPI than \cfl{C}, {CF\textsubscript{LB}}\xspace={CF\textsubscript{RB}}\xspace=\cfl{A} \rebuttal{(Algorithm~\ref{algo:find}, Line~\ref{find:ref13})}, thereby making it as {CF\textsubscript{opt}}\xspace for this TIPI (Figure~\ref{fig:explore}(d)). \rebuttal{ {Cuttlefish}\xspace explores both core and uncore frequencies linearly at the steps of two instead of using binary search for reducing the total number of explorations and performance degradation. Except when the optimal frequency lies at the boundary of the exploration range, {Cuttlefish}\xspace cannot use the naive binary search algorithm. When the optimal frequency lies between the exploration range, JPI will increase when moving left/right from the optimal frequency. For example, assume that JPI\textsubscript{A}<JPI\textsubscript{G} and \textjava{E} is the optimal frequency for some TIPI (Figure~\ref{fig:explore}). Applying a binary search to find \textjava{E} would require measuring JPIs at \textjava{mid}, \textjava{mid+1}, and \textjava{mid-1} at each split. This would require more explorations as compared to the linear search (steps of two). For the worst-case scenario (optimal at default minimum), the total number of explorations for {CF\textsubscript{opt}}\xspace on our Intel Haswell processor using linear search would be six (\textjava{total_frequencies/2}) compared to eight by using the modified binary search. Also, as the JPI at each frequency is an average of ten values, exploring \textjava{mid}, \textjava{mid+1}, and \textjava{mid-1} frequencies in binary search exploration would cause more performance degradation than linear search (highest to lowest). } After exploring {CF\textsubscript{opt}}\xspace=\cfl{A}, {Cuttlefish}\xspace will start the exploration for {UF\textsubscript{opt}}\xspace by fixing the core frequency to \cfl{A} \rebuttal{(Algorithm~\ref{algo:policy}, Line~\ref{loop:ref14})}. However, for {UF\textsubscript{opt}}\xspace, {Cuttlefish}\xspace would \emph{not} explore the default exploration range of {UF\textsubscript{LB}}\xspace=\ufl{A} to {UF\textsubscript{RB}}\xspace=\ufl{G}. Instead, it uses Algorithm~\ref{algo:guess} to estimate the uncore exploration range \rebuttal{(Algorithm~\ref{algo:policy}, Line~\ref{loop:ref15})}. Algorithm~\ref{algo:guess} is based on our observation in Section~\ref{sec:tipitrend} that a \emph{high} core frequency as optimal implies a \emph{low} uncore frequency as optimal, and vice-versa. Hence, {CF\textsubscript{opt}}\xspace=\cfl{max} implies that {UF\textsubscript{opt}}\xspace=\ufl{min}, and {CF\textsubscript{opt}}\xspace=\cfl{min} implies {UF\textsubscript{opt}}\xspace=\ufl{max}. Now, for estimating the optimal uncore ({UF\textsubscript{opt\_est}}\xspace) based on the {CF\textsubscript{opt}}\xspace, we use the curve-fitting technique, where we map the coordinates (\cfl{max}, \ufl{min}) and (\cfl{min}, \ufl{max}) on a straight line. It is shown in Lines 2-3 of Algorithm~\ref{algo:guess}. We also saw the latest Intel processor's trend that the number of uncore frequencies and core frequencies is roughly similar. Hence, to prepare a short exploration range for \textjava{UF}, we calculate the ratio of the number of uncore frequencies and core frequencies. To get a modest exploration space, we are multiplying the ratio by a constant of 4. This ratio calculation is shown in Line~\ref{ufest:ref1} of Algorithm~\ref{algo:guess}. Line~\ref{ufest:ref2}--Line~\ref{ufest:ref3} of Algorithm~\ref{algo:guess} shows the {UF\textsubscript{LB}}\xspace and {UF\textsubscript{RB}}\xspace calculation that uses the range and ratio described above. By using this Algorithm, {Cuttlefish}\xspace uses the exploration range of {UF\textsubscript{LB}}\xspace=\ufl{C} and {UF\textsubscript{RB}}\xspace=\ufl{G}, and continues the {UF\textsubscript{opt}}\xspace exploration similar to the {CF\textsubscript{opt}}\xspace exploration (Figure~\ref{fig:explore}(e) and Figure~\ref{fig:explore}(f)). \begin{algorithm \DontPrintSemicolon \SetAlgoLined \KwIn{\cfa{opt}} \KwOut{\ufa{LB}, \ufa{RB}} {NUM\textsubscript{range}}\xspace $\gets$ 4 * (\ufa{max} - \ufa{min} + 1)/(\cfa{max} - \cfa{min} + 1)\; \label{ufest:ref1} ${Ratio\textsubscript{NUF\_NCF}}\xspace$ $\gets$ (\ufa{max} - \ufa{min})/(\cfa{max} - \cfa{min})\; \ufa{opt\_est} $\gets$ \ufa{max} - (${Ratio\textsubscript{NUF\_NCF}}\xspace$ * (\cfa{opt} - \cfa{min}))\; \ufa{LB} $\gets$ max(\ufa{min} , \ufa{opt\_est} - {NUM\textsubscript{range}}\xspace/2)\; \label{ufest:ref2} \ufa{RB} $\gets$ min(\ufa{max} , \ufa{opt\_est} + {NUM\textsubscript{range}}\xspace/2)\; \If{\ufa{max} - \ufa{opt\_est} $\leq$ {NUM\textsubscript{range}}\xspace/2} { \ufa{LB} $\gets$ \ufa{LB} - (\ufa{opt\_est} + {NUM\textsubscript{range}}\xspace/2 - \ufa{max})\; } \If{\ufa{opt\_est} - \ufa{min} $\leq$ {NUM\textsubscript{range}}\xspace/2} { \ufa{RB} $\gets$ \ufa{RB} + (\ufa{min} - (\ufa{opt\_est} - {NUM\textsubscript{range}}\xspace/2))\; } \label{ufest:ref3} \caption{Algorithm to find \textjava{UF} exploration range} \label{algo:guess} \end{algorithm} \begin{figure}[h] \centering \includegraphics[width=\linewidth]{graphs/tipi-fig-2.png} \captionof{figure}{Determining {CF\textsubscript{opt}}\xspace when {CF\textsubscript{RB}}\xspace-{CF\textsubscript{LB}}\xspace=1} \label{fig:impl2} \end{figure} Figure~\ref{fig:explore} depicted the situation where reducing the frequency was reducing the JPI. However, there will be scenarios where reducing the frequency increases the JPI. These situations are depicted in Figure~\ref{fig:impl2} when low bound and high bound frequencies are adjacents \rebuttal{(Algorithm~\ref{algo:find}, Line~\ref{find:ref16}--Line~\ref{find:ref17})}. In Figure~\ref{fig:impl2}(a), JPI at \cfl{E} was higher than that at \cfl{G}. In this case, {CF\textsubscript{LB}}\xspace=\cfl{F}. However, as the {CF\textsubscript{LB}}\xspace and {CF\textsubscript{RB}}\xspace (\cfl{G}) are consecutive frequencies, {CF\textsubscript{opt}}\xspace will be set to \cfl{G} to minimize the loss in performance as high \textjava{CF} indicates a compute-bound MAP. Figure~\ref{fig:impl2}(b) depicts a situation where JPI at \cfl{A} was higher than that at \cfl{C}. In this case, {CF\textsubscript{LB}}\xspace=\cfl{B}. Again, left bound {CF\textsubscript{LB}}\xspace and {CF\textsubscript{RB}}\xspace (\cfl{C}) are consecutive frequencies, but this time {CF\textsubscript{opt}}\xspace will be set to \cfl{B} to maximize the energy efficiency as low \textjava{CF} indicates a memory-bound MAP. These two scenarios depicted for \textjava{CF} can also occur for \textjava{UF}. \subsection{Frequency exploration for subsequent TIPIs} \label{sec:multitipi1} \begin{figure}[h] \centering \includegraphics[width=\linewidth]{graphs/tipi-fig-3.png} \captionof{figure}{Insertion of a node for a newly found TIPI in the doubly linked list, and determining the \textjava{CF} exploration range for this new TIPI} \label{fig:impl3} \end{figure} An application could have a variety of MAP, e.g., in \textjava{AMG}\xspace, we found 60 distinct MAPs (Table~\ref{tab:bench}). Using the default \textjava{CF} exploration range {CF\textsubscript{LB}}\xspace=\cfl{A} and {CF\textsubscript{RB}}\xspace=\cfl{G} for every newly discovered TIPIs can easily degrade the application performance, especially on a processor supporting a wide range of frequencies. Hence, {Cuttlefish}\xspace uses the default {CF\textsubscript{LB}}\xspace and {CF\textsubscript{RB}}\xspace only for the first TIPI \rebuttal{(Algorithm~\ref{algo:policy}, Line~\ref{loop:ref8}--Line~\ref{loop:ref9})}. For subsequent TIPIs, it sets {CF\textsubscript{LB}}\xspace, and {CF\textsubscript{RB}}\xspace based on the {CF\textsubscript{opt}}\xspace and the latest values of {CF\textsubscript{LB}}\xspace and {CF\textsubscript{RB}}\xspace in previously discovered TIPI ranges. Here, the insight is to use a sorted doubly linked list of TIPI ranges, where moving from left to right in the linked list signifies a shift from compute-bound MAP to memory-bound MAP. Hence, when a new TIPI node is inserted in the linked list, {Cuttlefish}\xspace can look up the {CF\textsubscript{opt}}\xspace, {CF\textsubscript{LB}}\xspace and {CF\textsubscript{RB}}\xspace of its adjacent nodes (left and right) to dynamically decide the {CF\textsubscript{LB}}\xspace and {CF\textsubscript{RB}}\xspace for this new TIPI node. Compared to \textjava{CF}, the exploration range of \textjava{UF} is already smaller (Algorithm~\ref{algo:guess}). Still, {Cuttlefish}\xspace attempts to reduce this exploration range even further for subsequent TIPIs by following the same insight mentioned above for \textjava{CF}. This optimization is shown in Figure~\ref{fig:impl3} for \textjava{CF} exploration \rebuttal{(Algorithm~\ref{algo:policy}, Line~\ref{loop:ref18})} and in Figure~\ref{fig:impl5} for \textjava{UF} exploration \rebuttal{(Algorithm~\ref{algo:policy}, Line~\ref{loop:ref19})}. Figure~\ref{fig:impl3}(a) shows an execution phase \textjava{N} (time elapsed since {Cuttlefish}\xspace started is \textjava{N}$\times${T\textsubscript{inv}}\xspace), at which MAP was pointing to TIPI-3, but a new TIPI range, TIPI-1, was discovered by the {Cuttlefish}\xspace. Comparing TIPI-1 with other TIPIs in the linked list, it is found that TIPI-1 should be added in the front. The position of the TIPI-1 signifies that it is compute-bound \emph{relative} to the TIPI-3, i.e., {CF\textsubscript{opt}}\xspace for TIPI-1 will be the same or greater than the {CF\textsubscript{opt}}\xspace for TIPI-3. Hence, {CF\textsubscript{LB}}\xspace=\cfl{B} and {CF\textsubscript{RB}}\xspace=\cfl{G} for TIPI-1. As there was a TIPI transition in the last {T\textsubscript{inv}}\xspace phase, JPI calculated for \cfl{B} is not recorded in the \textjava{CF} table for TIPI-1 \rebuttal{(Algorithm~\ref{algo:find}, Line~\ref{find:ref20}--Line~\ref{find:ref21})}. It will be recorded after the next {T\textsubscript{inv}}\xspace phase. After a few execution duration with the MAP still pointing to TIPI-1, another new TIPI, TIPI-2, was discovered by the {Cuttlefish}\xspace. This is shown in Figure~\ref{fig:impl3}(b). At this time, {Cuttlefish}\xspace calculated the JPI for \cfl{C} to compare it with the JPI at \cfl{E} in TIPI-1. However, it won't be able to do so because the new TIPI-2 was discovered in the last {T\textsubscript{inv}}\xspace. By comparing TIPI-2 with other TIPIs, it found that the TIPI-2 node should be inserted between the TIPI-1 and TIPI-3 nodes in the linked list. This signifies that TIPI-2 is memory-bound relative to the TIPI-1 but compute-bound relative to the TIPI-3. Hence, going by the same algorithm as in TIPI-1, TIPI-2's {CF\textsubscript{LB}}\xspace and {CF\textsubscript{RB}}\xspace should be the {CF\textsubscript{opt}}\xspace for TIPI-3 and TIPI-1, respectively. However, as the {CF\textsubscript{opt}}\xspace for TIPI-1 is still not found, TIPI-2's {CF\textsubscript{RB}}\xspace will be set to {CF\textsubscript{RB}}\xspace of TIPI-1 (\cfl{E}). Due to the TIPI transition in the last phase, the JPI (\cfl{C}) of the last {T\textsubscript{inv}}\xspace will not be recorded in TIPI-2. \begin{figure}[h] \centering \includegraphics[width=\linewidth]{graphs/tipi-fig-5.png} \captionof{figure}{Determining the \textjava{UF} exploration range based the {UF\textsubscript{opt}}\xspace of adjacent TIPI nodes in doubly linked list} \label{fig:impl5} \end{figure} Figure~\ref{fig:impl5} demonstrates the same optimization discussed above, but only for uncore exploration. Figure~\ref{fig:impl5}(a) shows an execution phase when {Cuttlefish}\xspace has found the {CF\textsubscript{opt}}\xspace for TIPI-1, and now it has to start the exploration of {UF\textsubscript{opt}}\xspace for TIPI-1. By using Algorithm~\ref{algo:guess}, {UF\textsubscript{LB}}\xspace=\ufl{A} and {UF\textsubscript{RB}}\xspace=\ufl{E} for TIPI-1. As TIPI-1 is compute-bound relative to the TIPI-3, its {UF\textsubscript{opt}}\xspace will be the same or lower than the {UF\textsubscript{opt}}\xspace (\ufl{C}) for TIPI-3. Hence, {UF\textsubscript{RB}}\xspace=\ufl{C} for TIPI-1. This is precisely opposite to what was done in the case of \textjava{CF}. Figure~\ref{fig:impl5}(b) shows an execution phase when {Cuttlefish}\xspace has found the {CF\textsubscript{opt}}\xspace for TIPI-2, and now it has to start exploring {UF\textsubscript{opt}}\xspace for TIPI-2. It sets the {UF\textsubscript{opt}}\xspace of TIPI-3 as {UF\textsubscript{RB}}\xspace for TIPI-2 and {UF\textsubscript{opt}}\xspace of TIPI-1 as {UF\textsubscript{LB}}\xspace of TIPI-2. TIPI-2 is memory-bound relative to TIPI-1. Hence its {UF\textsubscript{opt}}\xspace will be the same or higher than the {UF\textsubscript{opt}}\xspace of TIPI-1. \subsection{Revalidating frequency exploration range} \label{sec:multitipi2} Previous sections described the optimizations carried out in {Cuttlefish}\xspace to reduce the frequency exploration range when the exploration is about to start. This section describes the third and final optimization in {Cuttlefish}\xspace to shrink the exploration range even further after the exploration has begun \rebuttal{(Algorithm~\ref{algo:find}, Line~\ref{find:ref22})}. \begin{figure}[h] \centering \includegraphics[width=\linewidth]{graphs/tipi-fig-4.png} \captionof{figure}{Revalidation of \textjava{CF} exploration range} \label{fig:impl4} \end{figure} Figure~\ref{fig:impl4}(a) shows a phase change from left to right after some {T\textsubscript{inv}}\xspace. There are two TIPIs, TIPI-1 and TIPI-2, in the linked list, where TIPI-1 is compute-bound relative to TIPI-2. Before the phase change, MAP was set to TIPI-2 with its {CF\textsubscript{LB}}\xspace=\cfl{B} and {CF\textsubscript{RB}}\xspace=\cfl{E}. JPI for \cfl{E} has been evaluated for TIPI-2. Now {Cuttlefish}\xspace has to calculate the JPI for \cfl{C} for TIPI-2. TIPI-1's {CF\textsubscript{LB}}\xspace=\cfl{B} and {CF\textsubscript{RB}}\xspace=\cfl{G}. After some {T\textsubscript{inv}}\xspace, {Cuttlefish}\xspace evaluates the JPI for \cfl{C} and found it more than the JPI for \cfl{E}. Hence, for TIPI-2 (Figure~\ref{fig:impl4}(a)), it would update the {CF\textsubscript{LB}}\xspace=\cfl{D} and set {CF\textsubscript{opt}}\xspace=\cfl{E} as {CF\textsubscript{LB}}\xspace and {CF\textsubscript{RB}}\xspace are consecutive frequencies (Section~\ref{sec:singletipi}). However, as TIPI-1 is compute-bound relative to TIPI-2, {Cuttlefish}\xspace will also update the {CF\textsubscript{LB}}\xspace=\cfl{E} ({CF\textsubscript{opt}}\xspace for TIPI-2). In Figure~\ref{fig:impl4}(b), after the phase change, {Cuttlefish}\xspace calculates that JPI at \cfl{E} is better than that at \cfl{G} for TIPI-3. Hence, it updates the {CF\textsubscript{RB}}\xspace=\cfl{E} for TIPI-3. However, as TIPI-4 is memory-bound relative to the TIPI-3, {Cuttlefish}\xspace will also update the {CF\textsubscript{RB}}\xspace of TIPI-4 to that of TIPI-3. \begin{figure}[h] \centering \includegraphics[width=\linewidth]{graphs/tipi-fig-6.png} \captionof{figure}{Revalidation of \textjava{UF} exploration range} \label{fig:impl6} \end{figure} Figure~\ref{fig:impl6} demonstrates the same optimization discussed above, but only for revalidating the uncore exploration range. In Figure~\ref{fig:impl6}(a), before phase change from left to right, MAP was set to TIPI-5 with the JPI available for {UF\textsubscript{RB}}\xspace=\ufl{G}. Uncore was then set to \ufl{E}, and after some {T\textsubscript{inv}}\xspace, JPI at \ufl{E} was found to be less than that at \ufl{G} for TIPI-5. This changed the {UF\textsubscript{RB}}\xspace from \ufl{G} to \ufl{E} at TIPI-5. However, as TIPI-4 is compute-bound relative to the TIPI-5, its {UF\textsubscript{RB}}\xspace will also shift from \ufl{G} to \ufl{E}. In Figure~\ref{fig:impl6}(b), before phase change from left to right, MAP was set to TIPI-4 with the JPI available for {UF\textsubscript{RB}}\xspace=\ufl{E}. Uncore was then set to \ufl{C}, and after some {T\textsubscript{inv}}\xspace, JPI at \ufl{C} was found to be more than that at \ufl{E} for TIPI-4. This changes the {UF\textsubscript{LB}}\xspace from \ufl{C} to \ufl{D} at TIPI-4. Now, as the {UF\textsubscript{LB}}\xspace and {UF\textsubscript{RB}}\xspace at TIPI-4 are consecutive frequencies, {UF\textsubscript{opt}}\xspace for TIPI-4 will be set to \ufl{E}. As TIPI-5 is memory-bound relative to the TIPI-4, its {UF\textsubscript{LB}}\xspace will also shift from \ufl{C} to \ufl{E} (TIPI-4's {UF\textsubscript{opt}}\xspace). However, now as both {UF\textsubscript{LB}}\xspace and {UF\textsubscript{RB}}\xspace in TIPI-5 points to \ufl{E}, its {UF\textsubscript{opt}}\xspace will also be set to \ufl{E}. \subsection{{Cuttlefish}\xspace in distributed computing} {Cuttlefish}\xspace is currently suitable for profiling a single multicore parallel program. Hence, one can also use it in MPI+X style distributed computing programs, where a single process is executed at each node for inter-node communications (MPI, UPC++, etc.), and a multithreaded library (e.g., OpenMP) is used for parallelizing intra-node computations. However, {Cuttlefish}\xspace cannot regulate the processor frequencies to mitigate the workload imbalance between the process~\cite{bhalachandra2017adaptive}. Thereby, its scope is limited to the node level parallel regions (e.g., OpenMP) in regular MPI+X parallel programs that do not exhibit any load-imbalance due to overlapping computation and communication. We aim to extend {Cuttlefish}\xspace for achieving energy efficiency in MPI+X style hybrid parallel programs as future work. \section{Experimental Evaluation} \label{sec:results} \begin{figure*} \centering \subfigure[Energy savings relative to \textjava{Default}\xspace]{\label{graph:ompenergy}\includegraphics[width=\textwidth]{graphs/omp-energy.png} } \subfigure[Execution time relative to \textjava{Default}\xspace]{\label{graph:omptime}\includegraphics[width=\textwidth]{graphs/omp-time.png} } \subfigure[\rebuttal{EDP relative to \textjava{Default}\xspace}]{\label{graph:ompedp}\includegraphics[width=\textwidth]{graphs/omp-edp.png} } \caption{Experimental evaluation using {OpenMP}\xspace} \label{graph:omp} \end{figure*} We provide build-time flags for the three different policies, {Cuttlefish}\xspace, {Cuttlefish-Core}\xspace, and {Cuttlefish-Uncore}\xspace, in the {Cuttlefish}\xspace library. Section~\ref{sec:impl} described the design and implementation of {Cuttlefish}\xspace that dynamically changes both the core and uncore frequencies. {Cuttlefish-Core}\xspace and {Cuttlefish-Uncore}\xspace are the subsets of the {Cuttlefish}\xspace implementation. {Cuttlefish-Core}\xspace only adapts the core frequencies by fixing the uncore frequency at its maximum (3.0GHz). {Cuttlefish-Uncore}\xspace only adjusts the uncore frequencies by setting the cores frequency at its maximum (2.3GHz). For the first TIPI-range, both {Cuttlefish-Core}\xspace and {Cuttlefish-Uncore}\xspace start the frequency exploration described in Section~\ref{sec:singletipi} in their respective default exploration ranges (1.2GHz-2.3GHz for core and 1.2GHz-3.0GHz for uncore). For subsequent TIPI ranges, they use all the runtime optimizations described in Section~\ref{sec:multitipi1} and Section~\ref{sec:multitipi2} but restrict these optimizations to core-only in {Cuttlefish-Core}\xspace and uncore-only in {Cuttlefish-Uncore}\xspace. We begin our evaluation of {Cuttlefish}\xspace policies by measuring energy savings and slowdown for both {OpenMP}\xspace and {HClib}\xspace benchmarks. We then compare the {CF\textsubscript{opt}}\xspace and {UF\textsubscript{opt}}\xspace calculated by the {Cuttlefish}\xspace to \textjava{Default}\xspace for all frequent TIPI ranges. \subsection{Evaluation of {OpenMP}\xspace benchmarks} \label{res:omp} Figures~\ref{graph:ompenergy},~\ref{graph:omptime}, \rebuttal{and~\ref{graph:ompedp} compare the energy savings, execution time, and EDP, respectively,} of the {OpenMP}\xspace benchmarks while using {Cuttlefish}\xspace's policies to that of the \textjava{Default}\xspace. Recall from Section~\ref{sec:methodology}, \textjava{Default}\xspace was executed by setting the \textjava{performance} power governor \rebuttal{that runs each core at the highest frequency (2.3GHz). During the \textjava{Default}\xspace execution, uncore frequency is controlled by the processor based on the memory access pattern}. Geomean energy-savings with {Cuttlefish}\xspace, {Cuttlefish-Core}\xspace, and {Cuttlefish-Uncore}\xspace are 19.6\%, 3.1\%, and 9.9\%, respectively. Geomean loss in performance with {Cuttlefish}\xspace, {Cuttlefish-Core}\xspace, and {Cuttlefish-Uncore}\xspace are 3.6\%, 2.5\%, and 3\%, respectively. Compared to the \textjava{Default}\xspace, {Cuttlefish-Core}\xspace required more energy in \textjava{UTS}\xspace, \textjava{SOR-irt}\xspace, \textjava{SOR-rt}\xspace, and \textjava{SOR-ws}\xspace. As these benchmarks are purely compute-bound (see TIPI-range in Table~\ref{tab:bench}), {Cuttlefish-Core}\xspace would fix the {CF\textsubscript{opt}}\xspace for these benchmarks at the highest frequency (2.3GHz). However, unlike {Cuttlefish-Core}\xspace, the \textjava{Default}\xspace optimizes the uncore frequency, thereby requiring \rebuttal{less} energy than {Cuttlefish-Core}\xspace. \rebuttal{Geomean EDP savings by {Cuttlefish}\xspace, {Cuttlefish-Core}\xspace, and {Cuttlefish-Uncore}\xspace are 16.5\%, 0.7\%, and 7.2\%, respectively, over the \textjava{Default}\xspace.} For memory-bound benchmarks (Heat variants, \textjava{MiniFE}\xspace, \textjava{HPCCG}\xspace, and \textjava{AMG}\xspace), energy-savings from {Cuttlefish-Core}\xspace and {Cuttlefish-Uncore}\xspace are almost similar (the difference is less than 5\%). Although there is some degradation in time, the max is 6.3\% (\textjava{Heat-ws}\xspace). This demonstrates that using {Cuttlefish}\xspace even in core-only or uncore-only mode is also quite effective for memory-bound benchmarks. As {Cuttlefish}\xspace adapts both core and uncore frequencies, it has the potential to save energy in both compute and memory-bound benchmarks. Energy savings are higher in the memory-bound benchmarks because {Cuttlefish}\xspace can adapt both the uncore and core frequencies. However, as it has to explore both these cases, the performance degradation is slightly higher (max 8.1\% in \textjava{MiniFE}\xspace) than the compute-bound benchmarks (max 1.6\% in \textjava{UTS}\xspace). \subsection{Evaluation of {HClib}\xspace benchmarks} \label{res:hclib} \begin{figure*} \centering \subfigure[Energy savings relative to \textjava{Default}\xspace]{\label{graph:hclibenergy}\includegraphics[width=\textwidth]{graphs/hclib-energy.png} } \subfigure[Execution time relative to \textjava{Default}\xspace]{\label{graph:hclibtime}\includegraphics[width=\textwidth]{graphs/hclib-time.png} } \subfigure[\rebuttal{EDP relative to \textjava{Default}\xspace}]{\label{graph:hclibedp}\includegraphics[width=\textwidth]{graphs/hclib-edp.png} } \caption{Experimental evaluation using {HClib}\xspace} \label{graph:hclib} \end{figure*} To support our hypothesis that {Cuttlefish}\xspace is a programming model oblivious, we now present the evaluation of {Cuttlefish}\xspace policies using {HClib}\xspace implementations of SOR and Heat variants. We omit \textjava{MiniFE}\xspace, \textjava{HPCCG}\xspace, and \textjava{AMG}\xspace due to porting challenges. We also discarded \textjava{UTS}\xspace as this benchmark has an inbuilt work-stealing implementation, and modifying it to use {HClib}\xspace would alter its algorithm. {HClib}\xspace supports \async--\finish\xspace task parallelism and internally uses a work-stealing runtime for dynamic load-balancing these asynchronous tasks. The results of this experiment are shown in Figure~\ref{graph:hclib}. Figure~\ref{graph:hclibenergy}, Figure~\ref{graph:hclibtime}, \rebuttal{and Figure~\ref{graph:hclibedp}} compare the energy savings, time degradation\rebuttal{, and EDP, respectively,} for {Cuttlefish}\xspace policies to that of the \textjava{Default}\xspace. Comparing these results with Figure~\ref{graph:omp} shows that {Cuttlefish}\xspace delivers similar results in {HClib}\xspace and {OpenMP}\xspace benchmarks. \subsection{Frequency settings using {Cuttlefish}\xspace} \label{res:opt} \begin{table}[] \resizebox{\columnwidth}{!}{% \begin{tabular}{|c|c|c|c|c|c|c|c|} \hline \multirow{2}{*}{Benchmark} & \multicolumn{2}{l|}{\begin{tabular}[c]{@{}c@{}}TIPI ranges (\%) \\ having\\ {CF\textsubscript{opt}}\xspace and {UF\textsubscript{opt}}\xspace\end{tabular}} & \multirow{2}{*}{Frequent TIPI Ranges} & \multicolumn{2}{c|}{Cuttlefish} & \multicolumn{2}{c|}{Default} \\ \cline{2-3} \cline{5-8} & \multicolumn{1}{c|}{{CF\textsubscript{opt}}\xspace} & \multicolumn{1}{c|}{{UF\textsubscript{opt}}\xspace} & & {CF\textsubscript{opt}}\xspace & {UF\textsubscript{opt}}\xspace & CF & {UF\textsubscript{opt}}\xspace \\ \hline UTS & 100\% & 100\% & 0.000- 0.004 (100\%) & 2.3 ($\pm0\%$) & 1.3 ($\pm9\%$) & 2.3 & 2.2 \\ \hline SOR-irt & 100\% & 100\% & 0.024 -0.028 (100\%) & 2.3 ($\pm0\%$) & 1.2 ($\pm0\%$) & 2.3 & 2.2 \\ \hline SOR-rt & 100\% & 100\% & 0.024 -0.028 (100\%) & 2.3 ($\pm0\%$) & 1.2 ($\pm5\%$) & 2.3 & 2.2 \\ \hline SOR-ws & 100\% & 100\% & 0.024 -0.028 (93\%) & 2.3 ($\pm0\%$) & 1.2 ($\pm0\%$) & 2.3 & 2.2 \\ \hline Heat-irt & 50\% & 25\% & 0.064-0.068 (88\%) & 1.2 ($\pm0\%$) & 2.2 ($\pm0\%$) & 2.3 & 3.0 \\ \hline \multirow{2}{*}{Heat-rt} & \multirow{2}{*}{33\%} & \multirow{2}{*}{33\%} & 0.060-0.064 (15\%) & - & - & 2.3 & 3.0 \\ \cline{4-8} & & & 0.064-0.068 (84\%) & 1.2 ($\pm0\%$) & 2.2 ($\pm0\%$) & 2.3 & 3.0 \\ \hline Heat-ws & 18\% & 9\% & 0.056-0.060 (88\%) & 1.3 ($\pm9\%$) & 2.2 ($\pm1\%$) & 2.3 & 3.0 \\ \hline MiniFE & 44\% & 6\% & 0.112-0.116 (76\%) & 1.3 ($\pm9\%$) & 2.2 ($\pm1\%$) & 2.3 & 3.0 \\ \hline HPCCG & 35\% & 6\% & 0.120-0.124 (76\%) & 1.3 ($\pm9\%$) & 2.2 ($\pm1\%$) & 2.3 & 3.0 \\ \hline \multirow{2}{*}{AMG} & \multirow{2}{*}{68\%} & \multirow{2}{*}{3\%} & 0.144-0.148 (56\%) & 1.3 ($\pm11\%$) & 2.2 ($\pm1\%$) & 2.3 & 3.0 \\ \cline{4-8} & & & 0.148-0.152 (25\%) & 1.2 ($\pm0\%$) & 2.2 ($\pm0\%$) & 2.3 & 3.0 \\ \hline \end{tabular} } \caption{{CF\textsubscript{opt}}\xspace and {UF\textsubscript{opt}}\xspace set by {Cuttlefish}\xspace in {OpenMP}\xspace benchmarks and its comparison with the \textjava{Default}\xspace settings} \label{tab:optimal} \end{table} Table~\ref{tab:optimal} shows the percentage of distinct TIPI ranges (see Table~\ref{tab:bench}) for which {Cuttlefish}\xspace was able to find the {CF\textsubscript{opt}}\xspace and {UF\textsubscript{opt}}\xspace in {OpenMP}\xspace benchmarks. This table also lists the {CF\textsubscript{opt}}\xspace and {UF\textsubscript{opt}}\xspace set by the {Cuttlefish}\xspace for frequently found TIPI ranges and then compare them with the \textjava{Default}\xspace settings. \textjava{AMG}\xspace was having the highest number of distinct TIPI ranges (total 60), due to which it experiences a wide variation in MAP during the execution timeline (Figure~\ref{graph:timelineTIPI}). {Cuttlefish}\xspace discovered {CF\textsubscript{opt}}\xspace and {UF\textsubscript{opt}}\xspace in 68\% and 3\% of the distinct TIPIs, respectively, even for such an unstable execution. We found that the major exploration was carried out only for the frequently found TIPI ranges (total two). Still, optimal frequencies for the rest were mostly set using the runtime optimizations described in Section~\ref{sec:multitipi1} and Section~\ref{sec:multitipi2}. As 58 of the 60 distinct TIPI ranges appear in less than 10\% of the total {T\textsubscript{inv}}\xspace durations, {Cuttlefish}\xspace doesn't get too many opportunities to explore {UF\textsubscript{opt}}\xspace in \textjava{AMG}\xspace for these infrequent TIPI ranges ({CF\textsubscript{opt}}\xspace is explored before {UF\textsubscript{opt}}\xspace). For the frequently found TIPI ranges in each benchmark, {Cuttlefish}\xspace accurately set both the {CF\textsubscript{opt}}\xspace and {UF\textsubscript{opt}}\xspace. These frequencies match the trend observed during motivational analysis in Section~\ref{sec:tipitrend}. \textjava{Heat-rt}\xspace has only two distinct TIPI ranges. Although TIPI 0.060-0.064 appears during 15\% of {T\textsubscript{inv}}\xspace durations in \textjava{Heat-rt}\xspace, their occurrences are widespread across the execution timeline. Hence, in \textjava{Heat-rt}\xspace, {Cuttlefish}\xspace could not set {CF\textsubscript{opt}}\xspace and {UF\textsubscript{opt}}\xspace for the TIPI range 0.060-0.064. Due to the performance power governor in \textjava{Default}\xspace, the \textjava{CF} was set to 2.3GHz (\cfl{max}). The processor's uncore settings in \textjava{Default}\xspace were 2.2GHz and 3.0GHz (\ufl{max}) for compute-bound and memory-bound benchmarks, respectively. \subsection{Sensitivity to {T\textsubscript{inv}}\xspace} \begin{table} \begin{algocolor} \resizebox{0.6\columnwidth}{!}{% \begin{tabular}{|c|c|c|} \hline T\_inv & Energy Savings~ & Slowdown \\ \hline 10ms & 19.5\% & 4.1\% \\ \hline \textbf{20ms} & \textbf{19.4\%} & \textbf{3.6\%} \\ \hline 40ms & 18.8\% & 2.9\% \\ \hline 60ms & 17.8\% & 2.9\% \\ \hline \end{tabular} } \caption{\rebuttal{Geomean energy savings and slowdown in {OpenMP}\xspace benchmarks using different values of {T\textsubscript{inv}}\xspace in {Cuttlefish}\xspace}} \label{tab:tinv} \end{algocolor} \end{table} \rebuttal{ This section discusses the impact of {T\textsubscript{inv}}\xspace on the overall energy savings and slowdown from using {Cuttlefish}\xspace. Table~\ref{tab:tinv} compares the geomean energy savings and slowdown of {OpenMP}\xspace benchmarks relative to \textjava{Default}\xspace by using {Cuttlefish}\xspace at different values of {T\textsubscript{inv}}\xspace. RAPL MSRs are updated every 1 ms on Intel Haswell~\cite{ddcm}. Hence, we chose {T\textsubscript{inv}}\xspace as 10$\times$, 20$\times$, 40$\times$, and 60$\times$ of this processor default. We can observe there is a marginal decrease in energy savings and slowdown with increasing {T\textsubscript{inv}}\xspace. Recall from Section~\ref{res:omp}, {Cuttlefish}\xspace saved more energy in memory-bound benchmarks (22\%--29\%) than compute-bound (8\%--10.1\%), but with some performance degradation (3.6\%--8.1\%). This is because optimal frequencies were lower for both core (1.2GHz/1.3GHz) and uncore (2.2GHz) in memory-bound benchmarks (Table~\ref{tab:optimal}). As {Cuttlefish}\xspace performs frequency exploration linearly, starting from the highest to lowest frequencies, higher {T\textsubscript{inv}}\xspace increases the exploration time, thereby allowing benchmarks to run longer at higher frequencies, causing a slight reduction in energy savings and slowdown. We chose {T\textsubscript{inv}}\xspace=20ms as the default configuration of {Cuttlefish}\xspace, as it achieved similar energy savings as with {T\textsubscript{inv}}\xspace=10ms, but with lesser slowdown. } \subsection{Summary} \rebuttal{ The encouraging results for {Cuttlefish}\xspace demonstrate its efficacy for achieving energy efficiency using a combination of DVFS and UFS on modern multicore processors in a wide range of applications with minimal impact on execution time. {Cuttlefish}\xspace, therefore, promises a one-stop solution as it uses both these dynamically available fine-grain power controls on Intel processors to regulate power. Its two variants, {Cuttlefish-Core}\xspace and {Cuttlefish-Uncore}\xspace, provide alternatives to using both DVFS and UFS together. Overall, {Cuttlefish-Uncore}\xspace achieved better EDP than {Cuttlefish-Core}\xspace. While {Cuttlefish-Uncore}\xspace is suitable for both compute and memory-bound applications, {Cuttlefish-Core}\xspace is not ideal for compute-bound applications as it sets the uncore to the maximum frequency that is otherwise adaptable in the default settings. However, on memory-bound applications, {Cuttlefish-Core}\xspace was able to deliver EDP close to that of {Cuttlefish-Uncore}\xspace. } \section{Related Work} \label{sec:related} Most energy-efficient HPC research in software has focused on making efficient use of micro-architectural power control support available. DVFS is supported by both AMD and Intel processors. It has been the primary choice to control processor frequency in several studies~\cite{kappiah2005just, hsu2005power, dblp:conf/sc/gefc05, dblp:conf/ppopp/freehl05, dblp:conf/cluster/kimurashbt06, dblp:conf/ics/rountreelssfb09, tiwari12,bhalachandra2017adaptive, bhalachandra2017improving, basireddy2018workload}. In the past, processors provided only chip-level DVFS where a frequency change affected all the cores. Most modern processors today support core-specific implementations of DVFS, allowing each core to operate at different frequencies. Intel has provided core-specific support for DVFS from its Haswell generation processors. DDCM has also been used to control processor frequency at a core level in several studies~\cite{sundriyal2014automatic, wang2015evaluating, bhalachandra2015using}. The target programming model of prior work has dictated much of their design and implementation decisions. The approaches that target the Message Passing Interface (MPI) applications mainly involve mitigation of workload imbalance between the process (slack)~\cite{dblp:conf/ppopp/freehl05, dblp:conf/cluster/kimurashbt06, dblp:conf/ics/rountreelssfb09, bhalachandra2017adaptive}. Other MPI-centric solutions address cases where the processor cores wait on the memory or network~\cite{kandalla2010designing, vishnu2010designing, sundriyal2011per, hoefler2014energy, venkatesh2015case, bhalachandra2017improving}. Concurrency throttling has been widely used by adapting the thread count in OpenMP programs that are memory-constrained to reduce power consumption~\cite{curtis2006online, curtis2008prediction, li2010hybrid, porterfield2013openmp}. Methods~\cite{wang2015using} that involve assigning optimal frequencies to OpenMP loops based on their memory access patterns have been proposed. Static analysis of loop-based parallel programs has been used to compute each loop chunk's workload and then tune the chip frequency dynamically by calculating the remaining workload~\cite{SRNV2017}. Iterative parallel programs provide an opportunity to dynamically tune the frequencies of the cores according to the workload information of the tasks collected with the online profiling of the first few iterations~\cite{6969445}. The impact of power capping on compiler transformations has been studied by utilizing the memory access density information of OpenMP loops~\cite{wang2016performance}. Fine-tuning the core frequencies based on online profiling of thief-victim relationships and the size of deques in a work-stealing runtime is another approach for programming model-specific solution~\cite{RHLY2014}. \rebuttal{ There have been attempts to standardize the interfaces controlling power at different levels of the HPC system hierarchy. GEOPM~\cite{geopm} is one such implementation that leverages feedback from the application to identify which nodes are on the critical path and then adjusts processor power cap settings to accelerate the critical path and improve the application's time-to-solution. The current effort may easily fit as a part of the third-party software components that GEOPM and such standardized interfaces support. } UFS is a recent research topic for achieving energy efficiency, although it has been available to the user since the Intel Haswell processor generation~\cite{ufs}. The high efficacy of UFS has been demonstrated in terms of its energy-saving potential~\cite{sundriyal2018comparisons}. UFS has been used to dynamically adapt the uncore frequency based on the DRAM power usage~\cite{GNMF2019}. A machine learning-based UFS model has been proposed to gather performance metrics from offline executions and predict the optimal uncore frequency~\cite{BSAB2019}. The work described in~\cite{sundriyal2016joint} aims to achieve energy efficiency by using both DVFS and \rebuttal{DRAM scaling}. However, unlike {Cuttlefish}\xspace, this implementation needs prior data to learn some machine-dependent parameters using regression analysis. These parameters are used at runtime to calculate the optimal core and uncore frequency. \section{Conclusion} \label{sec:conclusion} In this paper, a programming model oblivious C/C++ library is proposed for achieving energy efficiency that is not limited by language constraints and semantics. The model can detect the changes in the memory access patterns even for the same application across multiple language implementations to assign optimal frequencies. Using both DVFS and UFS allows additional energy savings than solutions that utilize a single power control. The effectiveness of the current approach is demonstrated for irregular-tasking as well as work-sharing pragmas. The use of both micro-kernels and real-world HPC mini-applications for evaluation helps better understand the library's efficacy for production use. In the future, we would like to extend this framework to support hybrid MPI+X applications. With the emergence of scientific workflows in HPC systems, we want to explore the possibility of using {Cuttlefish}\xspace to control the power of co-running components of a workflow on a node. Graphics processing units (GPUs) are ever more prevalent in HPC today. The energy-efficiency potential in the context of GPU-offload support offered by many high-level languages is another area worth exploring. \balance \section*{Acknowledgments} The authors are grateful to the anonymous reviewers for their suggestions on improving the presentation of the paper. Results presented in this paper were obtained using the Chameleon testbed supported by the National Science Foundation. This research used resources of the National Energy Research Scientific Computing Center, a DOE Office of Science User Facility supported by the Office of Science of the U.S. Department of Energy under Contract No. DE-AC02-05CH11231.
\section{Introduction} Nearest neighbor search is a fundamental problem in domains such as large-scale image search and information retrieval \cite{DBLP:conf/cikm/LvCL04, DBLP:journals/pvldb/LuWWK20}, recommendation\cite{DBLP:conf/www/DasDGR07}, entity resolution\cite{DBLP:conf/cikm/HoffartSNTW12}, and sequence matching\cite{berlin2015assembling}. Constrained by the curse of dimensionality, exact nearest neighbor search becomes unaffordable for the rapidly increasing amount of unstructured data (images, documents and video clips etc)\cite{DBLP:conf/vldb/WeberSB98}. As a workaround, approximate nearest neighbor (ANN) search is widely used to provide an appropriate tradeoff between accuracy and latency. Currently, the quantization-based and graph-based approaches are two mainstream ANN search paradigms~\cite{DBLP:journals/pvldb/Qin0X020}. Vector quantization shrinks database vectors into compact codes based on various quantization methods, and reduces computation latency and memory requirements by nearly an order of magnitude~\cite{jegou2010product}. Graph-based approaches~\cite{malkov2018efficient} first builds a graph to capture proximity among data points and then performs ANN search by traversing graphs in a greedy or heuristic fashion. A number of empirical studies show that graph-based approaches own most appealing tradeoff between accuracy and search cost~\cite{DBLP:journals/corr/abs-2101-12631}. Both quantization-based and graph-based approaches use fixed configurations that impose the same termination condition (e.g., the number of candidates to examine) for all queries, which penalizes ``easy'' queries and incurs higher-than-necessary running time. To address this issue, Li et al.~proposed \texttt{AdaptNN} that predicts and then applies termination condition for each individual query~\cite{DBLP:conf/sigmod/LiZAH20}. Figure~\ref{fig:pipeline-of-tao}(a) illustrates the workflow of \texttt{AdpatNN}. After receiving a query, \texttt{AdpatNN} first invokes a specific ANN algorithm to execute the query for a while, then collects a number of runtime features and predicts the termination condition based on them. Taking the estimated termination condition as the additional input, the ANN algorithm continues to run until the condition is met, and outputs the query results finally. \begin{comment} \begin{figure*} \centering \vspace{-1.2em} \captionsetup[subfigure]{justification=centering} \begin{subfigure}[t]{8in} \centering \vspace{0.2em} \includegraphics[scale=0.35]{png/flow2} \vspace{-0.7em} \caption{Different $m$} \end{subfigure} \hspace{-6ex} \qquad \begin{subfigure}[t]{8in} \centering \vspace{0.2em} \includegraphics[scale=0.4]{png/flow1} \vspace{-0.7em} \caption{Different $t_0$} \end{subfigure} \hspace{-6ex} \caption{The impact of different parameters} \label{Fig:parameter} \end{figure*} \end{comment} \begin{figure*}[htbp] \centering \subcaptionbox{Workflow of \texttt{AdaptNN}} { \includegraphics[scale=0.20]{png/flow2} \label{fig:pipeline-of-tao:a} } \subcaptionbox{Workflow of \texttt{Tao}} { \includegraphics[scale=0.20]{png/flow1} \label{fig:pipeline-of-tao:b} } \caption{Illustrations of \texttt{Tao} and \texttt{AdaptNN}} \label{fig:pipeline-of-tao} \end{figure*} However, \texttt{AdaptNN} has several limitations despite its efficiency: \begin{itemize} \item Firstly, the runtime features require heavy manual engineering, that is, these hand-crafted features need to be designed for each algorithms individually and no systematic design strategy is available. For example, it uses six input features for the HNSW index whereas adopts 14 runtime statistics for the IMI index. Hence, it is not easy to adapt \texttt{AdaptNN} to other indexing approaches that are not discussed in~\cite{DBLP:conf/sigmod/LiZAH20}. \item Secondly, the end-to-end latency is sensitive to the time interval between when \texttt{AdaptNN} makes the prediction (dubbed as \textbf{prediciton time}) and when the query processing starts. \cite{DBLP:conf/sigmod/LiZAH20} provides no principled method to set the prediction time. As will be discussed in detail in Section~\ref{sec:limitations-of-adaptNN}, the optimal prediction times depend on specific algorithms and datasets, and the tuning procedure is very tedious. In view of this, \texttt{AdaptNN} simply sets it to some fixed default value, leading to undesirable performance degradation. \end{itemize} Both of the above-mentioned limitations are rooted in the belief that only the runtime features provide sufficient prediction power to the termination condition. In this paper, we challenge this belief and propose a simple and principled \emph{static} feature to perform the prediction accurately. Specifically, we propose \texttt{Tao}, a general learning framework for \underline{T}erminating ANN queries \underline{A}daptively using \underline{O}nly static features. % Figure~\ref{fig:pipeline-of-tao}(b) illustrates the workflow of \texttt{Tao}. Upon the arrival of a query, \texttt{Tao} first maps the query to a \emph{local intrinsic dimension} (LID) number, and then predicts termination condition using LID only \emph{before} query execution. The specific ANN search algorithm takes termination conditions as inputs and answers the query until the condition is met. As such, \texttt{Tao} has some advantages worth mentioning: \begin{itemize} \item \texttt{Tao} decouples the prediction procedure from query execution and eliminates the requirement for tuning the prediction time, making it simple to use in practice. \item \texttt{Tao} employs query vectors and the associated LID, instead of a set of hand-crafted runtime features, as model inputs to accomplish the goal of adaptive query processing, making it general enough to accommodate new ANN search algorithms \item \texttt{Tao} improves the explainability of the prediction model by revealing the correlation between LID and search cost and formulating guidelines to use \texttt{Tao}, which is a highly desirable feature in AI-powered applications nowadays. \end{itemize} To demonstrate the aforementioned advantages, we instantiated two instances of our framework based on two state-of-the-art indexing approaches (HNSW~\cite{malkov2018efficient} and IMI~\cite{babenko2014inverted}). Similar with~\cite{DBLP:conf/sigmod/LiZAH20}, we implement them over the Faiss similarity search library~\cite{JDH17}. Comprehensive experiments are conducted to evaluate the end-to-end performance on a collection of real datasets, including two billion-scale datasets Deep1B~\cite{babenko2016efficient} and Sift1B~\cite{jegou2011searching}. Empirical results demonstrate that, in addition to its simplicity and generality, \texttt{Tao} offers up to 2.69x speedup compared with the runtime prediction strategy. The contributions of the paper are summarized as follows: \begin{inparaenum}[(1)] \item We identify the limitations of the existing approach. \item We propose and develop a general learning framework for adaptive ANN search using only static features. \item We conduct extensive experiments on various datasets to verify the effectiveness and efficiency of our framework. \end{inparaenum} \textbf{Roadmap.} Section 2 presents the necessary preliminaries. Section 3 gives a brief review of \texttt{AdaptNN} and discusses its limitations. Section 4 demonstrates the feasibility of predicting with static features. Section 5 sketches the workflow of \texttt{Tao}. Section 6 describes the experimental methodology and reports the results. Section 7 reviews the related work, and Section 8 concludes the paper. \section{Preliminaries} In this section, we present necessary preliminaries for ANN search and relevant indexing algorithms used in this paper. \subsection{ANN Search Problem} Nearest neighbor (NN) search in high dimensional spaces is a challenging problem that has been studied extensively in the past two decades. Formally, let $\mathcal{D} = \{o_1, \cdots, o_n\} \subset \mathbb{R}^d$ be a finite set of $n$ vectors. Given query $q \in \mathbb{R}^d$, $k$NN search returns $k$ results $o_{i}$ $(1 \le i \le k)$, where $o_{i}$ is the $i$-th nearest neighbor of $q$. In this paper we use the Euclidean distance as the distance function to measure (dis)similarity between vectors. As database sizes reach millions or billions of entries, and the vector dimension grows into the hundreds, any indexing method is shown to be reduced to a linear scan of the whole dataset, which is prohibitively expensive in practice~\cite{jegou2011searching}. Therefore, practitioners often resort to approximate nearest neighbor search. Instead of identifying exact NNs of a query surely, ANN search sometimes may return neighbors that are only close enough to the query. By trading precision for efficiency, ANN search provides better latency than the exact version. There is a large amount of significant literature on algorithms for approximate nearest neighbor search, which are roughly divided into four categories: tree-structure based approaches, hashing-based approaches, quantization-based approaches and graph-based approaches. In this paper, we focus on quantization-based and graph-based methods due to their appealing performance and popularity in real-life large scale applications~\cite{DBLP:conf/sigmod/WangYGJXLWGLXYY21}. \subsection{Product Quantization and Inverted Multi-Index} Product quantization (PQ) algorithm is a lossy compression quantization algorithm that is developed on the basis of vector quantization~\cite{jegou2010product}. By quantizing the vectors of the dataset, it can effectively reduce the storage needed to store the original vectors of the dataset. To the best of our knowledge, quantization-based method is the only one that can support billion-scale datasets on a commodity computer. However, the search is exhaustive for the original PQ -- all database vectors must be evaluated. To avoid exhaustive search, IVFADC~\cite{jegou2010product} uses two quantization levels to organize large datasets. Particularly, IVFADC groups database vectors into different clusters. When building the index, a list of cluster centroids is trained by $K$-means clustering, and each database vector is assigned to the cluster with the closest centroid. During searching, the index first computes the distances between the query and all cluster centroids, then evaluates database vectors belonging to the first \emph{nprobe} nearest clusters, where \emph{nprobe} is the hyperparameter that should be determined \emph{apriori}. A number of variants of IVFADC are proposed, among which Inverted Multi-Index (IMI)~\cite{babenko2014inverted} offers the state-of-the-art performance thanks to its efficient space-partitioning strategy. To be specific, IMI decomposes the vectors into several subspaces and trains separate a list of centroids in each subspace, which leads to a fine-grained space partition. For example, Figure~\ref{fig:diagram-imi} illustrates how IMI generates two product codebooks ${C_1}$ and ${C_2}$ for different halves of the vector at the first level. Each codebook contains $5$ sub-codewords, leading to $5^2$ clusters in total. By subtracting a vector to the corresponding cluster centroids, one obtains the residuals for the second quantization level. Similar to IVFADC, IMI searches the same fixed number of \emph{nprobe} nearest clusters for all queries. \begin{figure}[htbp] \centering \includegraphics[scale=0.5]{png/IMI} \caption{Illustration of IMI (black and red dots represent the training vectors and centroids respectively).} \label{fig:diagram-imi} \end{figure} \subsection{Graph-based Methods} Graph-based methods such as hierarchical navigable small worlds (HNSW) are currently one of the most efficient ANN search paradigms \cite{malkov2018efficient}. HNSW employs hierarchical network structures to organized vectors, and such networks are essentially approximate $k$NN-graphs~\cite{DBLP:journals/corr/abs-2012-11083}. To process a query, the graph is traversed starting from the entry point using beam search, and the parameter \emph{efSearch} is used to control the hops of graph traversal. Greater \emph{efSearch} is, more accurate answers will be. For almost all graph-based methods, the ANN search procedure is based on the same principle as illustrated in Figure~\ref{fig:diagram-hnsw}. For a query $q$, start at an initial vertex chosen arbitrarily or using some sophisticated selection rule, say $p$. Moves along an edge to the adjacent vertex with minimum distance to $q$. Repeat this step until the current element $v$ is closer to $q$ than all its neighbors, and then report $v$ as the NN of $q$. \begin{figure}[htbp] \centering \includegraphics[scale=0.40]{png/HNSW} \caption{The search procedure of graph-based algorithms.} \label{fig:diagram-hnsw} \end{figure} \section{Motivations} \subsection{Brief Review of \texttt{AdaptNN}} Most existing ANN approaches use fixed configurations that apply the same termination condition to all queries. Li et al.~conducted an empirical study over three datasets (Deep/Sift/Gist)\footnote{The detailed description of these datasets are given in Section~\ref{sect:datasets}} using IMI and HNSW implementations in the Faiss library \cite{DBLP:conf/sigmod/LiZAH20}. They observed that, due to the index structures and the vector distributions, the number of database vectors that must be searched to find the ground-truth nearest neighbor varies significantly among queries. Take HNSW as an example, 80\% of queries (dubbed ``easy queries'') only need to perform at most 547/481/1260 distance evaluations for Deep10M/Sift10M/Gist, respectively, while the other 20\% queries (dubbed ``hard queries'') require up to 88696/16618/118277 distance evaluations, respectively. Fixed configurations lead to high average latency because easy queries are forced to conduct a lengthy search as the amount required to deliver reasonable performance for hard queries. To address this issue, Li et al.~propose to predict different termination condition for each individual query, making easy queries do less computation than hard ones, thus reducing the end-to-end average latency dramatically. One central proposition in \texttt{AdaptNN} is that static features alone (e.g., the query vectors themselves) cannot offer good prediction power. To realize highly accurate predictions, it elaborately identifies a set of \emph{runtime} features of the intermediate search results, and it adopts gradient boosting decision trees to predict the minimum amount of search to perform. As an example, \texttt{AdaptNN} uses the distances between the query and its 1\emph{st} and 10\emph{th} neighbors as two runtime features for HNSW. Figure~\ref{fig:pipeline-of-tao}(a) depicts the workflow of \texttt{AdaptNN}. When receiving a query, \texttt{AdaptNN} first invokes the ANN search algorithm and performs \emph{a fixed amount of search} to obtain the intermediate search results. Thereafter, \texttt{AdaptNN} computes the runtime features, coalesces them with static features, and predicts the termination condition using gradient boosting decision trees. The termination condition is passed down to the ANN search algorithm, which continues to run until the condition is met. Experimental results show that adaptive query processing based on runtime prediction consistently reduces the average end-to-end latency. \begin{table*}[htbp] \caption{Prediction time vs. Search cost (prediction times are measured in terms of the recall already obtained and the optimal search costs are marked in bold)} \begin{center} \begin{tabular}{c|c|c|c|c|c|c|c} \hline \multicolumn{1}{l|}{} & \multicolumn{7}{c}{\textbf{Search Cost}} \\ \hline \textbf{Prediction Time} & \textbf{Deep10M} & \textbf{Sift10M} & \textbf{Gist} & \textbf{ImageNet} & \textbf{Msong} & \textbf{Trevi} & \textbf{Glove} \\ \hline \hline 0.5 & 18,483 & 11,017 & 37,334 & \textbf{71,897} & 5,337 & 30,621 & \textbf{60,190} \\ \hline 0.6 & 22,821 & \textbf{9,453} & \textbf{34,072} & 86,030 & \textbf{4,521} & 38,213 & 67,465 \\ \hline 0.7 & 18,882 & 10,481 & 34,508 & 87,176 & 8,818 & 22,895 & 66,905 \\ \hline 0.8 & 17,594 & 16,787 & 44,390 & 78,641 & 7,182 & \textbf{22,891} & 66,406 \\ \hline 0.9 & \textbf{17,033} & 10,616 & 47,442 & 122,697 & 7,090 & 28,573 & 108,983 \\ \hline \end{tabular} \end{center} \label{tab:different_predict_timing} \end{table*} \subsection{Limitations} \label{sec:limitations-of-adaptNN} \texttt{AdaptNN}, however, faces a number of limitations. Firstly, the input features are chosen in an ad-hoc fashion and one has to try different hand-crafted features for different algorithms. For example, HNSW uses six input features whereas IMI adopts 14 runtime statistics to predict the minimum amount of search, respectively. While the importance of different features are evaluated using the per-feature gain stats from gradient boosting decision tree models (the importance of a feature is proportional to the total error reduction contributed by the feature), % this only alleviate the feature engineering efforts and does not address issues such as correlation among features. % Hand-crafted feature engineering impedes the application of \texttt{AdaptNN} to other ANN search algorithms not addressed in~\cite{DBLP:conf/sigmod/LiZAH20}. Secondly, as noted in~\cite{DBLP:conf/sigmod/LiZAH20}, if \texttt{AdaptNN} searches less before the feature generation, the intermediate result features may provide less information gain, reducing the prediction accuracy. If we search more before the feature generation, all queries must search more, increasing the end-to-end average latency. As will be discussed shortly, our preliminary experiments show that the end-to-end latency is quite sensitive to the prediction time. Unfortunately, again, \texttt{AdaptNN} provides no principled method or guideline to determine when to predict in runtime. The pragmatic (currently practiced) way to choose the prediction time adopted by \texttt{AdaptNN} is as follows. Given a dataset, manually choose a set of accuracy targets, say $0.5-0.9$ with a step of $0.1$, and then perform binary search to obtain the corresponding search costs (\emph{nprobe} or \emph{efSearch}) for all accuracy targets. To determine the optimal one, one has to run \texttt{AdaptNN} using different prediction times over training datasets and pick the one with the least average latency. Since the tuning process is tedious, time-consuming and lossy in nature, \texttt{AdaptNN} simply uses a fixed prediction time, i.e., the time instant in which 0.8 recall is reached for all datasets by default in practice~\cite{DBLP:conf/sigmod/LiZAH20}. Unsurprisingly, we found that the best prediction time is obviously data-dependent. Table~\ref{tab:different_predict_timing} lists the total number of points examined (search cost) under different prediction times (recall already obtained) for a collection of datasets\footnote{The detailed description of these datasets are given in Section~\ref{sect:datasets}} using \texttt{AdaptNN} with the HNSW method. As one can see 1) the optimal prediction time vary across different datasets and, 2) choosing inappropriate prediction time will cause significant performance degradation. For example, the maximum search cost is twice as much as the minimum for Msong. The limitations of \texttt{AdaptNN} motivate us to look for a radically different way to perform adaptive ANN query processing. It is claimed in~\cite{DBLP:conf/sigmod/LiZAH20} that ``\emph{static features such as the query vector itself are not sufficient to predict this termination condition}''. Counter-intuitively, however, we observe that query vectors themselves, with the help of an intermediate feature \emph{local intrinsic dimension}, are sufficient to fulfill this goal. Next, we will present the core ideas and workflow of \texttt{Tao}. \section{Prediction with Static Features Made Possible} \label{sec:offline-made-possible} In this section, we introduce the core notion of our method, i.e., local intrinsic dimension first, and then explore the feasibility of predicting LID using a regression model. The correlation between LID and search cost is examined based on two representative indexing schemes, i.e., IMI and HNSW. \subsection{Local Intrinsic Dimension} Many learning tasks involve data represented as vectors of dimension $d$. For example, an image representation is an embedding function that transforms the raw pixel representation of the image to a point in a high-dimensional vector space. While data are embedded in the space $\mathbb{R}^d$, this does not necessarily mean that its intrinsic dimension (ID) is $d$. The intrinsic dimensionality of a representation refers to the minimum number of parameters (or degrees of freedom) necessary to capture the entire information present in the representation \cite{DBLP:journals/isci/CamastraS16}. Equivalently, it refers to the dimensionality of the $m$-dimensional manifold $\mathcal{M}$ embedded within the $d$-dimensional ambient (representation) space where $m \le d$. ID has wide applications in many machine learning and data mining contexts. For example, most dimension reduction techniques require that a target dimension be provided by the user. Ideally, the supplied dimension should depend on the intrinsic dimensionality of the data. This has served to motivate the development of models of ID, as well as accurate estimators. Over the past few decades, many practical models of the intrinsic dimensionality of datasets have been proposed. Examples include the Principal Component Analysis and its variants \cite{DBLP:journals/prl/BouveyronCG11}, as well as several manifold learning techniques \cite{DBLP:journals/nn/KarhunenJ94}. Topological approaches to ID estimate the basis dimension of the tangent space of the data manifold from local samples. Fractal methods such as the Correlation Dimension estimate an intrinsic dimension from the space-filling capacity of the data \cite{DBLP:journals/pami/CamastraV02}. Graph-based methods use the $k$-nearest neighbors graph along with density in order to estimate ID \cite{DBLP:conf/isit/CostaH04}. The aforementioned intrinsic dimensionality measures can be described as `global', in that they consider the dimensionality of a given set as a whole, without any individual object being given a special role. In other words, all vectors share the same intrinsic dimension. In contrast, `local' ID measures are defined as those that involve only the $k$-nearest neighbor distances of a specific location in the space. Several local intrinsic dimensionality models have been proposed recently, such as the expansion dimension \cite{DBLP:conf/stoc/KargerR02}, the generalized expansion dimension \cite{DBLP:conf/icdm/HouleKN12}, the minimum neighbor distance \cite{DBLP:journals/ml/RozzaLCCC12}, and local continuous intrinsic dimension (LID)\cite{DBLP:conf/icdm/Houle13}. In this paper we focus on LID, which is defined formally as follows: \begin{myDef} \label{def1} (~\cite{DBLP:conf/icdm/Houle13}.) Given an absolutely continuous random distance variable $X$, for any distance threshold $x$ such that the cumulative density function $F_X(x) > 0$, the local continuous intrinsic dimension of $X$ at distance $x$ is given by $$ LID_X\left( x \right) \overset{\bigtriangleup}{=}\lim _{\epsilon \rightarrow 0^+}\frac{\ln F_X\left( \left( 1+\epsilon \right) x-\ln F_X\left( x \right) \right)}{\ln \left( 1+\epsilon \right)} $$ wherever the limit exists. \end{myDef} LID quantifies intrinsic dimension in terms of the rate at which the number of encountered objects grows as the considered range of distances expands from a reference location. Estimates of local ID constitute a measure of the complexity of data and LID could give researchers and practitioners more insight into the nature of their data, and therefore help them improve the efficiency and efficacy of their applications \cite{DBLP:journals/tods/ShaftR06}. Amsaleg et al. studied several estimators of LID using maximum likelihood estimation (MLE), the method of moment, probability weighted moment and regularly varying functions~\cite{DBLP:conf/kdd/AmsalegCFGHKN15}. Experimental results show that the performance of different estimators to be largely in agreement with one another, and faster initial convergence favors the choice of MLE for applications where the number of available query-to-neighbor distances is limited, or where time complexity is an issue. Assume that we are given a sequence $x_1$ ,..., $x_n$ of observations of a random distance variable $X$ with support [0,$w$) in ascending order, that is, $x_1$ $\le$ $x_2$ $\le$ ··· $\le$ $x_n$. Then, the MLE estimator of LID can be calculated as \begin{equation} \label{equ:lid-MLE-estimation} \begin{aligned} \widehat{LID}_X \overset{\bigtriangleup}{=} \left( \frac{1}{k}\sum_{i=1}^k{\ln \left( \frac{w}{x_i} \right)} \right) ^{-1} \end{aligned} \end{equation} \begin{figure}[htbp] \centering \subcaptionbox{Deep10M} { \includegraphics[width = .46\linewidth]{png/rlid2plid-deep} \label{fig:real-and-predicted-lid-sift:a} } \subcaptionbox{Sift10M} { \includegraphics[width = .46\linewidth]{png/plid2plid-sift} \label{fig:real-and-predicted-lid-sift:b} } \caption{Real vs. Predicted LID on Deep10M and Sift10M.} \label{fig:real-and-predicted-lid-sift} \end{figure} \begin{table}[htbp] \caption{MAE, RMSE and R2Score for different datasets.} \begin{center} \begin{tabular}{c|c|c|c} \hline & \textbf{MAE} & \textbf{RMSE} & \textbf{R2Score} \\ \hline \hline Deep10M & 1.15 & 1.88 & 0.68 \\ \hline Sift10M & 0.65 & 0.89 & 0.89 \\ \hline Gist & 1.24 & 1.72 & 0.89 \\ \hline ImageNet & 0.77 & 1.07 & 0.91 \\ \hline Glove & 1.80 & 2.48 & 0.88 \\ \hline MSong & 0.67 & 1.22 & 0.80 \\ \hline Trevi & 3.17 & 4.41 & 0.82 \\ \hline \end{tabular} \label{tab:mae} \end{center} \end{table} \subsection{Vector to LID Mapping} By definition, the LID number of a vector $q$ is closed related to the distribution of its near neighbors, which suggests that LID might be a promising indicator for the difficulty in finding $k$NN of $q$. Unfortunately, for an unsee query, there is no way to calculate the LID value without knowing its $k$NN. To circumvent this dilemma, we explore the possibility of predicting LID for unseen vectors using neural networks, considering they are extremely good at capturing complex relationships in high dimensional spaces~\cite{DBLP:conf/sigmod/KraskaBCDP18}. Suppose dataset $\mathcal{D}$ is a sample drawn from a population that follows some unknown probability distribution $\mathcal{X}$. For any point $o \sim \mathcal{X}$, we can calculate the LID estimate of $o$ using Equation~\eqref{equ:lid-MLE-estimation}, where $x_i$ is the distance between $o$ and its $i$-th NN in $\mathcal{D}$. For unseen vectors, assume there exists a function $f(\cdot)$ that relates any sample vector drawn from $\mathcal{X}$ to a single LID value. The \emph{universal approximation theorem} tells us that a neural network can approximate $f(\cdot)$, given that $f(\cdot)$ is continuous on a compact set and the neural network has sufficiently many hidden neurons with activation functions \cite{DBLP:journals/mcss/Cybenko89, DBLP:journals/nn/Hornik91}. Verifying the continuity of $f(\cdot)$ analytically is impossible because we do not even have an closed-form expression for $f(\cdot)$. To this end, we demonstrate the feasibility by empirically evaluating the approximation errors on several real datasets. Particularly, we trained an MLP network with two hidden fully-connected layers, using 200 neurons per layer (i.e., 200 width) and ReLU activation functions. The inputs to the neural network are exclusively the original vectors and the outputs are the predicted LID values. We use the training vectors listed in Table~\ref{tab:dataset} to generate training data and the query vectors to generate testing data. Table~\ref{tab:mae} summarizes the statistics of common evaluation metrics for regression models. For mean absolute error (MAE) and RMSE, lower is better. For R2 scores, higher is better. As we can see from the table, we can reliably estimate the LID of query vectors using our regression model. E.g., the MAE of the prediction is less than 1.24 in 6 out of the 8 datasets. We formulate this observation as Property 1: \begin{property} \label{pro:vectors-to-lid} Given a dataset $\mathcal{D}$, the LID values of high-dimensional vectors in $\mathcal{D}$ can be estimated using a practical regression model with small approximation error. \end{property} We further illustrate the real and the predicted LID values in Figure~\ref{fig:real-and-predicted-lid-sift} over Deep10M and Sift10M. The $x$-axis represents the LID numbers of vectors calculated using Equation~\eqref{equ:lid-MLE-estimation}, which are partitioned into bins of size 2. The average of predicted LID values in each bin are marked on the top of bars. As we can see, the estimates match rather well with the real values for small LID ($0-14$ for Deep10M and $2-16$ for Sift10M). For large LID, the regression model somewhat underestimates the target values, mainly due to the sparsity of training vectors with large LID numbers. Please note that similar trends are observed for other datasets and we do not report them here due to space limitation. We also adopt gradient boosting decision tree models (using the LightGBM library~\cite{DBLP:conf/nips/KeMFWCMYL17}) to perform the vector to LID mapping, which achieves similar results with MLP. This suggests that there exists inherent correlation between vectors and LID for all real datasets that we have experimented with, and such correlation may be model independent to some extent. We conjecture that the reason might be these datasets, while represented in high-dimensional spaces, inherently resides on some low-dimensional manifolds \cite{2008Neural, DBLP:journals/tnn/Andras14}. As a result, the relation between vectors and LID can be easily captured using a reasonable regression model. We believe that more in-depth analysis of this correlation deserves further study on its own right, and is thus out of the scope of this paper. \begin{figure}[htbp] \centering \subcaptionbox{Deep10M} { \includegraphics[width = .46\linewidth]{png/rlid2mas-deep1b} \label{fig:real_lid_and_term_cond} } \subcaptionbox{Sift10M} { \includegraphics[width = .46\linewidth]{png/rlid2mas-sift1m-hnsw} \label{fig:real_lid_and_term_cond_sift} } \caption{Search cost vs. LID for HNSW.} \label{fig:real_lid_and_term_cond_all} \end{figure} \begin{figure}[htbp] \centering \subcaptionbox{Deep1B} { \includegraphics[width = .46\linewidth]{png/rlid2mas-deep1b-imi} \label{fig:real_lid_and_term_cond_imi} } \subcaptionbox{Sift1B} { \includegraphics[width = .46\linewidth]{png/rlid2mas-sift1m-imi} \label{fig:real_lid_and_term_cond_imi_sift} } \caption{Search cost vs. LID for IMI.} \label{fig:real-and-predicted-lid-sift-all} \end{figure} \subsection{Correlation between LID and Search Cost} LID is aimed to quantify the local intrinsic dimensionality of a feature space exclusively in terms of the distance distribution of neighbors of a specific location. It is well known that the dimensionality of the space that the point resides in has a significant impact on the difficulty of NN search~\cite{DBLP:conf/vldb/GionisIM99}. Intuitively, the overhead of NN search is probably correlated with the LID of query vectors. The way to measure search cost varies over different indexing methods. For IMI, the amount of search is represented by the number of nearest clusters that need to be examined (\emph{nprobe}). For HNSW, we use the number of distance evaluations to represent the amount of search. This is because 1) The distance evaluation between query and database vector is a time-consuming task; 2) The number of distance evaluations fluctuates greatly even with the same number of hops in the graph (\emph{efsearch}). Figure~\ref{fig:real_lid_and_term_cond_all} illustrates the mean minimum search cost to find the ground truth nearest neighbor for query vectors with different LID using HNSW. The bin size is 2 and the search cost is averaged over each bin. A base 2 logarithmic scale is used for $y$-axis. As one can see, for both Deep10M and Sift10M, the search cost increases roughly exponentially as LID grows, suggesting that LID is a promising static feature to predict the termination condition. Figure~\ref{fig:real-and-predicted-lid-sift-all} shows the histogram of the mean minimum number of centroids examined to find the ground truth nearest neighbor using IMI. The LID bin size is set to 2 and the search cost is averaged over each bin. As with HNSW, there exists a strong correlation between LID and the number of centroids examined. It is worth mentioning that IMI and HNSW exhibit similar trends for the remaining datasets that have been experimented with, which are not reported here due to space limitation. We highlight such correlations as Property 2: \begin{property} \label{pro:lid-to-search-cost} Given an ANN search algorithm $\mathcal{A}$ and a dataset $\mathcal{D}$, the LID values of query vectors are positively correlated with the minimum amount of search to identify the true nearest neighbors in $\mathcal{D}$ by $\mathcal{A}$. \end{property} \subsection{Remarks} As discussed above, Property 1 is data dependent and Property 2 depends on both data and algorithms. Given an ANN search algorithm and a dataset, it is possible to accomplish the goal of adaptive query processing as long as these two properties hold. Such simple guidelines turn the learning black box transparent to users to some extent, eliminate the hand-crafted feature selection process and ease the applications of $\texttt{Tao}$ to other ANN algorithms and datasets. \section{Adaptive ANN Search with \texttt{Tao}} In this section, we describe the prediction pipeline of the proposed learning framework and how ANN search algorithms, exemplified by IMI and HNSW, are integrated into \texttt{Tao}. \textbf{The general workflow.} Our prediction pipeline consists of two phases as illustrated in Figure~\ref{fig:pipeline-of-tao}. In Phase 1, the regression model takes query vectors as inputs and outputs predicted LID numbers. In Phase 2, the other regression model accepts a LID value and reports a numerical indicator, suggesting how much search should be done for the query. \textbf{The inputs.} Instead of combining a number of hand-crafted static and runtime features as inputs, \texttt{Tao} needs only a single independent variable, that is, the query vector itself. \textbf{The output.} For each query, we expect to predict the minimum amount of search to obtain the ground truth nearest neighbor. Different indexing approaches may have different metrics to quantify the search cost, but what we need is often a numerical value which is proportional to the search latency. \textbf{Model Selection and Training.} According to the two properties we formulated, \texttt{Tao} is actually model independent, meaning that any reasonable regression model can be used to fulfill the vector$\rightarrow$LID$\rightarrow$termination-condition prediction framework. In this paper, we choose two popular models, i.e., MLP and gradient boosting decision trees, to show the effectiveness of \texttt{Tao}. For MLP, we employ two distinct neural networks to fulfill the predictive tasks in different phases, where the standard feed forward structure with two fully-connected hidden layers is adopted and the ReLU activation function is used across all layers. The parameters of these two neural networks will be discussed in detail in Section~\ref{sec:benchmark-methods}. For the second one, we build and train two distinct gradient boosting decision tree models using the LightGBM library~\cite{DBLP:conf/nips/KeMFWCMYL17} to accomplish the predictive tasks needed by \texttt{Tao}. Since the prediction performance of LightGBM is similar to that of MLP, we only report the experimental results using MLP in this paper due to space limitation. We use the training vectors in Table~\ref{tab:dataset} to generate training/validation data and use the query vectors to generate testing data. Each vector generates one row of data which includes both the output target value and the true LID value. To obtain output target values, we need to first perform an exhaustive search to find the ground truth nearest neighbor(s), and then find the minimum amount of search to reach (one of) it. To calculate LID, we identify the top-1000 neighbors of each vector in the training set and compute LID values using Equation~\eqref{equ:lid-MLE-estimation}. We trained the two neural networks independently, i.e., no joint learning techniques are used. For the first one, we choose a fixed number of training epochs (200) and batch sizes varying from 200 to 1000, depending on the sizes of training sets. For the second one, a smaller number of training epochs is used (20) and batch sizes are the same as the first one. \textbf{Integration with IMI and HNSW.} The integration of \texttt{Tao} with the existing indexing algorithms such as IMI and HNSW is noninvasive, in that very few modifications have to be done with them. Particularly, since \texttt{Tao} decouples the prediction models from query execution, we only need to change the termination conditions in the code bases, involving less than 5 lines of the core codes for IMI and HNSW. For IMI, the number of nearest clusters to search equals \emph{Max}(\emph{thresh}, \emph{multiplier}*\emph{$2^{TC}$}), where the \emph{thresh} equals the maximum target value in the training data and $TC$ is the predicted search cost. For HNSW, the number of distance evaluations equals \emph{Max}(\emph{thresh}, \emph{multiplier}*\emph{$2^{TC}$}). Similar to~\cite{DBLP:conf/sigmod/LiZAH20}, \emph{multiplier} is the scale factor needs to be tuned in order to achieve given accuracy target. Algorithm 1 sketches how \texttt{Tao} is integrated with HNSW. \begin{algorithm} \caption{\texttt{Tao} with HNSW} \label{alg:HNSW} \begin{algorithmic} \renewcommand{\algorithmicrequire}{\textbf{Input:}} \renewcommand{\algorithmicensure}{\textbf{Output:}} \REQUIRE Query vector: $q$,\\ Entry point: $ep$,\\ Number of nearest neighbors to return: $k$,\\ Candidate queue: $cq$, \\ Maxheap list: $w$ \ENSURE $k$ nearest neighbors to q \STATE $tc$ $\gets$ predict with \texttt{Tao} \STATE $ndis \gets 0$ //number of distance comparisons\\ \STATE {$cq.push\_back(ep)$} \WHILE {$|cq| > 0$} \STATE {$v = cq.top()$} \STATE {$cq.pop()$} \FOR { $v.neighbors$} \STATE calcultate distances and update $cq,w$ \STATE {$ndis++$} \ENDFOR \IF {$ndis > tc$} \STATE {\textbf{break}} \ENDIF \ENDWHILE \RETURN $k$ nearest neighbors to $q$ in $w$ \end{algorithmic} \end{algorithm} \section{Evaluation} In this section, we evaluate the performance of \texttt{Tao} by implementing it in the Faiss ANN search library (CPU version) \cite{DBLP:conf/sigmod/LiZAH20} similar to \texttt{AdaptNN}, which makes the comparison fair and reasonable. All experiments are carried out on a server with E5-2620 [email protected] CPU and 256GB memory. \subsection{Datasets} \label{sect:datasets} We used seven publicly available real datasets, which are of different data dimensions, cardinalities and types. Table~\ref{tab:dataset} lists the statistics of datasets we have experimented with. The sizes of these datasets range from millions to one billion. \begin{table}[htbp] \caption{Dataset Summary} \begin{center} \begin{tabular}{c|c|c|c|c|c} \hline \textbf{Dataset} & \textbf{Dim.} & \textbf{Base} & \textbf{Training} & \textbf{Query} & \textbf{Type} \\ \hline \hline Deep & 96 & 10M,1B & 1M & 10,000 & Image \\ \hline Sift & 128 & 10M,1B & 1M & 10,000 & Image \\ \hline Gist & 960 & 1M & 0.5M & 1,000 & Image \\ \hline ImageNet & 150 & 2.34M & 200,000 & 10,000 & Image \\ \hline Msong & 420 & 9.22M & 100,000 & 10,000 & Audio \\ \hline Trevi & 4096 & 1M & 20,000 & 1,000 & Image \\ \hline Glove & 100 & 1.19M & 100,000 & 10,000 & Text \\ \hline \end{tabular} \label{tab:dataset} \end{center} \end{table} \begin{itemize} \item \textbf{Deep1B}\footnote{https://github.com/facebookresearch/faiss/tree/master/} consist of 1 billion contains deep neural codes of natural images obtained from the activations of a convolutional neural network. \item \textbf{Deep10M}\footnote{https://github.com/facebookresearch/faiss/tree/master/} is a subset of Deep1B. \item \textbf{Sift1B}\footnote{http://corpus-texmex.irisa.fr/} consist of 1 billion 128-dim SIFT vectors. \item \textbf{Sift10M}\footnote{https://archive.ics.uci.edu/ml/datasets/SIFT10M} consists of 10 million 128-dim SIFT vectors. \item \textbf{Gist}\footnote{http://corpus-texmex.irisa.fr/} is an image dataset which contains about 1 million data points. \item \textbf{ImageNet}\footnote{ http://cloudcv.org/objdetect/} contains about 2.4 million data points with 150 dimensions dense SIFT features. \item \textbf{Msong}\footnote{http://www.ifs.tuwien.ac.at/mir/msd/download.html} is a collection of audio features and metadata for millions of contemporary popular music tracks. \item \textbf{Trevi}\footnote{ http://phototour.cs.washington.edu/patches/default.htm} consists of around 1,000,000 4096-$d$ vectors. \item \textbf{Glove}\footnote{ http://nlp.stanford.edu/projects/glove/} contains 1.2 million 100-$d$ word feature vectors extracted from Tweets. \end{itemize} For ImageNet/Msong/Trevi/Glove datasets, due to these datasets do not have a training set or the query set is small, so we split a subset of the database as the training set or query set. Taking ImageNet as an example, we split the first 200,000 of the database into a training set, then we split 200,001 to 210,000 of the database into a query set, and the rest as the new ImageNet base set. \subsection{Benchmark Methods} \label{sec:benchmark-methods} \begin{itemize} \item \textbf{Fixed Configuration.} The implementations of IMI and HNSW in the Faiss ANN search library (CPU version) \cite{DBLP:conf/sigmod/LiZAH20} is used. Parameters to control the answer quality, that is, \emph{efSearch} (HNSW) and \emph{nprobe} (IMI), are tuned to achieve the given target accuracy, and fixed for all queries. \item \textbf{\texttt{AdaptNN}.} We use the training and parameter tuning methods described in \cite{DBLP:conf/sigmod/LiZAH20} to obtain the \emph{optimal} prediction time, which is both algorithm and dataset dependent. In other words, we report the \emph{best} end-to-end search performance that \texttt{AdaptNN} can deliver for any given algorithm and dataset. \item \textbf{\texttt{Tao}.} \texttt{Tao} employs two neural networks as the regression models. Both neural networks employ two fully connected layers with ReLU activation functions. For the first one, 200 neurons are used for each fully connected layer. The second neural network uses 10 neurons for each fully connected layer. \item \textbf{Vector Only (VO).} VO combines the two neural networks of \texttt{Tao} into one single MLP with five hidden layers. To make fair comparison, the structure of VO is the same as those of \texttt{Tao}, i.e., five hidden layers are fully connected and the number of neurons in each layer are set to 200, 200, 1, 10, 10 respectively. The only difference between VO and \texttt{Tao} is the training process -- LID is not used explicitly in VO and the input and output of the neural network of VO are query vectors and the amount of search to find the true NN, respectively. \end{itemize} \subsection{Performance Metrics} The end-to-end latency and accuracy are two important metrics for evaluating ANN algorithms. To compare the performance of the baselines and proposed approach, we perform controlled experiments to keep the accuracy achieved by all approaches at the same level, and then to compare the average latency. Given an accuracy target, we perform binary search to find the minimum average latency for the fixed configuration baseline. For \texttt{AdaptNN} and \texttt{Tao}, we multiply the predicted search cost with a coefficient (tuning knob) to reach this desired accuracy. Then we compare their performance at each accuracy target, where the prediction overhead is included in the end-to-end latency. For the accuracy target, we use recall$@$1 (the fraction of queries where the top-1 nearest neighbor returned from search is (one of) the ground truth nearest neighbor) for HNSW. For IMI, we use recall$@$100 (the fraction of queries where the top-100 nearest neighbors returned from search include (one of) the ground truth nearest neighbor) as the accuracy target since it’s challenging for quantization-based approaches to reach high recall$@$1. We measure the average latency in the single-threaded setting as in previous work~\cite{DBLP:conf/sigmod/LiZAH20}. \subsection{Prediction Overhead} Since the parameters of neural networks are fixed for all datasets, the model size is a constant (560KB) in our experiment setting as well, which is similar to those of \texttt{AdaptNN} (274 KB to 310 KB). When making prediction, it takes around 65us using the Keras framework for \texttt{Tao} (7us to 47us for \texttt{AdaptNN}). While the prediction overhead is very small already, a significant reduction to a few nano seconds is possible if one uses a plain C++ implementation~\cite{DBLP:conf/sigmod/KraskaBCDP18}. We leave this as future work since it is not a dominant factor in the end-to-end latency. \begin{comment} \begin{table}[htbp] \caption{IMI method. Average accessed points at the highest recall rate that can be reached} \begin{center} \begin{tabular}{|c|c|c|c|c|c|c|} \hline & \textbf{fixed TC} & \textbf{runtime TC} & \textbf{real lid} & \textbf{pred lid} & \textbf{upto1} & \textbf{upto2} \\ \hline DEEP1B & 3148068 & 3004890 & 778892 & 1019363 & 0.67 & 0.66 \\ \hline SIFT1B & 706210 & 238598 & 181525 & 193848 & 0.72 & 0.18 \\ \hline \end{tabular} \label{tab:imi} \end{center} \end{table} \begin{table}[htbp] \caption{HNSW method. Average accessed points at the highest recall rate that can be reached} \begin{center} \begin{tabular}{|c|c|c|c|c|c|c|} \hline & \textbf{fixed TC} & \textbf{runtime TC} & \textbf{real lid} & \textbf{pred lid} & \textbf{upto1} & \textbf{upto2} \\ \hline DEEP10M & 21495 & 17594 & 9002 & 13045 & 0.39 & 0.25 \\ \hline SIFT10M & 23991 & 16787 & 7066 & 7848 & 0.67 & 0.53 \\ \hline GIST1M & 39552 & 44390 & 35850 & 37713 & 0.04 & 0.15 \\ \hline IMAGENET & 87640 & 78641 & 51213 & 53681 & 0.38 & 0.31 \\ \hline MSONG & 6316 & 7182 & 4843 & 5250 & 0.16 & 0.26 \\ \hline TREVI & 25501 & 22891 & 18128 & 33999 & 0.17 & 0.08 \\ \hline GLOVE & 99100 & 66406 & 60190 & 68815 & 0.30 & 0.05 \\ \hline \end{tabular} \label{tab:hnsw} \end{center} \end{table} \end{comment} \begin{figure} \centering \includegraphics[scale=0.22]{png/dataset2latencyimi} \caption{Latency for plain IMI, \texttt{AdaptNN} and \texttt{Tao}.} \label{fig:latency_imi} \end{figure} \begin{table*}[htbp] \caption{Latency for IMI, \texttt{AdpatNN} and \texttt{Tao}.} \begin{center} \begin{tabular}{c|c|c|c|c|c|c} \hline \textbf{Dataset} &\textbf{Recall} & \textbf{IMI} & \texttt{AdpatNN} & \texttt{Tao} & \textbf{Reduction over IMI} & \textbf{Reduction over} \texttt{AdpatNN} \\ \cline{1-7} \multirow{6}{*}{Deep1B} & 0.95 & 39.84 ms & 33.69 ms & 16.18 ms & 59\% & 52\% \\ \cline{2-7} & 0.96 & 51.21 ms & 36.65 ms & 17.77 ms & 65\% & 52\% \\ \cline{2-7} & 0.97 & 69.22 ms & 44.85 ms & 21.08 ms & 70\% & 53\% \\ \cline{2-7} & 0.98 & 95.90 ms & 69.09 ms & 26.68 ms & 72\% & 61\% \\ \cline{2-7} & 0.99 & 195.45 ms & 117.94 ms & 39.61 ms & 80\% & 66\% \\ \cline{2-7} & 0.995 & 275.20 ms & 127.40 ms & 47.39 ms & 83\% & 63\% \\ \hline \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} \\ \cline{1-7} \multirow{6}{*}{Sift1B} & 0.95 & 38.69 ms & 35.53 ms & 30.93 ms & 20\% & 13\% \\ \cline{2-7} & 0.96 & 46.28 ms & 39.98 ms & 32.27 ms & 30\% & 19\% \\ \cline{2-7} & 0.97 & 57.59 ms & 46.63 ms & 39.13 ms & 32\% & 16\% \\ \cline{2-7} & 0.98 & 70.78 ms & 62.79 ms & 50.71 ms & 28\% & 19\% \\ \cline{2-7} & 0.99 & 117.68 ms & 98.30 ms & 69.49 ms & 41\% & 29\% \\ \cline{2-7} & 0.995 & 181.21 ms & 100.73 ms & 86.71 ms & 52\% & 14\% \\ \hline \end{tabular} \label{tab:imi} \end{center} \end{table*} \subsection{Empirical evaluation with IMI} Figure~\ref{fig:latency_imi} compares the average end-to-end latency for plain IMI, \texttt{AdaptNN} and \texttt{Tao}. We choose IMI index with OPQ compression as the baseline, which is one of the state-of-the-art approaches for billion-scale ANN search. We build IMI index with $(2^{14})^2$ = 268,435,456 clusters. All three methods achieve the highest accuracy, i.e., 0.995 for both Deep1B and Sift1B. We stop at these recall targets because it takes too long to reach 1.0 recall for billion-scale database. Overall, our approach provides up to 1.16x and 2.69x speedup on Sift1B and Deep1B, respectively. To see the big picture, Table~\ref{tab:imi} lists the latencies for three methods at recall$@$100 targets between 0.95 and 0.995. As the target accuracy increases, the gain of \texttt{Tao} over \texttt{AdaptNN} becomes more and more significant and seems to saturate at the highest recall. The reasons may be two-folds: 1) LID is more informative than features collected by \texttt{AdaptNN}; 2) \texttt{Tao} use only the training data obtained with 1.0 recall whereas \texttt{AdaptNN} is trained at a number of accuracy targets ranging from 0.95 from 0.995. It is worth noting that \texttt{Tao} does not take advantage of any runtime feature as \texttt{AdaptNN} does, and still outperforms its counterpart with the optimal configuration. \begin{figure} \centering \includegraphics[scale=0.23]{png/dataset2latencyhnsw} \caption{Latency for plain HNSW, \texttt{AdaptNN} and \texttt{Tao}.} \label{fig:latency_hnsw} \end{figure} \begin{figure} \centering \includegraphics[scale=0.22]{png/AverageMinumumSearchCost} \caption{Comparison of search cost for Deep10M.} \label{fig:AverageMinumumSearchCost} \end{figure} \begin{table}[htbp] \caption{Ablation study over Sift10M.} \begin{center} \begin{tabular}{c|c|c|c} \hline \textbf{Recall} & \textbf{HNSW} & \texttt{Tao} & \textbf{Real LID} \\ \hline \hline 0.95 & 0.82 ms & 0.79 ms & 0.69 ms \\ \hline 0.96 & 1.01 ms & 0.95 ms & 0.75 ms \\ \hline 0.97 & 1.08 ms & 1.02 ms & 0.83 ms \\ \hline 0.98 & 1.12 ms & 1.05 ms & 0.95 ms \\ \hline 0.99 & 1.36 ms & 1.28 ms & 1.24 ms \\ \hline 1.0 & 17.48 ms & 4.28 ms & 3.81 ms \\ \hline \end{tabular} \label{tab:sift_real_lid} \end{center} \end{table} \subsection{Empirical evaluation with HNSW} Figure~\ref{fig:latency_hnsw} plots the average end-to-end latencies by comparing plain HNSW, \texttt{AdaptNN} and \texttt{Tao} for highest recalls we have reached. Because of the graph connectivity issue, it is unable to find the nearest neighbor for a few queries in the reasonable time budget. Hence, for different datasets we stop at different recall targets. Overall, \texttt{Tao} provides consistent speedup over \texttt{AdaptNN} from 1.05x to 1.2x for recall$@$1 measure. Table~\ref{tab:deep} presents the detailed numbers for different accuracy targets. As one can see, the performance gaps among three methods are less significant for a relatively low recall, say 0.9 for Glove and 0.95 for the other datasets. With the increase of target recall, both \texttt{AdaptNN} and \texttt{Tao} perform better than the original algorithms thanks to their ability to distinguish `easy' queries from `hard' ones. Table~\ref{tab:sift_real_lid} lists the results of ablation study over Sift10M -- the performance of \texttt{Tao} after removing the first regression model. We manually calculate LIDs using Equation~\eqref{equ:lid-MLE-estimation} for all queries, and pass them to the second neural network. As one can see, the results are only slightly inferior to those using the predicted LID, which demonstrates the efficacy of the vectors-to-LID mapping. Figure~\ref{fig:AverageMinumumSearchCost} depicts the average minimum search cost (obtained by the Oracle), the overhead incurred by \texttt{Tao} and fixed configurations in a semi-log plot over Deep10M. By partitioning 10,000 queries, sorted in ascending order of the minimum search cost, into 10 bins evenly, we compute the average of minimum search cost in each bin. As we can see, there exists significant variation in the optimal search cost. As discussed before, HNSW with fixed configuration cannot utilize this fact, thus lead to the largest latency. \texttt{Tao}, instead, is equipped with the power to assign smaller search steps for `easy' queries, by which better performance is obtained. Note that the room for optimization is still giant since what \texttt{Tao} predict is still far away from the Oracle, calling for more efficient features and/or prediction models to shrink this gap. \subsection{Comparison between \texttt{Tao} and Vector Only Method} \begin{figure} \centering \includegraphics[scale=0.23]{png/vector_only_imi} \caption{Latency for plain IMI, Vector Only and \texttt{Tao}.} \label{fig:vector_only_f_imi} \end{figure} \begin{figure} \centering \includegraphics[scale=0.20]{png/vector_only_hnsw} \caption{Latency for plain HNSW, Vector only and \texttt{Tao}.} \label{fig:vector_only_f_hnsw} \end{figure} \begin{table*}[] \caption{Latency for plain IMI, Vector Only and \texttt{Tao}.} \begin{center} \begin{tabular}{c|c|c|c|c|c} \hline \textbf{Dataset} & \textbf{Recall} & \textbf{IMI} & \texttt{AdaptNN} & \textbf{Vector Only} & \texttt{Tao} \\ \hline \hline Deep1B & 0.995 & 275.20 ms & 127.40 ms & 260.29 ms & \textbf{47.39 ms} \\ \hline Sift1B & 0.995 & 181.21 ms & 100.73 ms & 108.58 ms & \textbf{86.71 ms} \\ \hline \end{tabular} \end{center} \label{tab:vecotr_only_t_imi} \end{table*} \begin{table*}[] \caption{Latency for plain HNSW, Vector Only and \texttt{Tao}.} \begin{center} \begin{tabular}{c|c|c|c|c|c} \hline \textbf{Dataset} & \textbf{Recall} & \textbf{HNSW} & \texttt{AdaptNN} & \textbf{Vector Only} & \texttt{Tao} \\ \hline \hline Deep10M & 0.999 & 19.47 ms & 5.88 ms & 48.21 ms & \textbf{4.87 ms} \\ \hline Sift10M & 1.0 & 17.48 ms & 5.41 ms & 40.11 ms & \textbf{4.28 ms} \\ \hline Gist & 0.999 & 264.12 ms & 40.93 ms & 314.35 ms & \textbf{34.32 ms} \\ \hline ImageNet & 0.998 & 303.34 ms & 36.46 ms & \textbf{24.52} ms & 26.56 ms \\ \hline Glove & 0.9668 & 1486.82 ms & 65.24 ms & 76.07 ms & \textbf{61.46 ms} \\ \hline MSong & 1.0 & 5.48 ms & 4.26 ms & 4.67 ms & \textbf{4.04 ms} \\ \hline Trevi & 0.997 & 45.85 ms & 19.41 ms & 67.51 ms & \textbf{18.54 ms} \\ \hline \end{tabular} \end{center} \label{tab:vecotr_only_t_hnsw} \end{table*} Figure~\ref{fig:vector_only_f_imi} compares the latency of IMI, \texttt{Tao} and VO at the highest recall we achieved, and Table~\ref{tab:vecotr_only_t_imi} lists the detailed numbers including the results of \texttt{AdaptNN}. As we can see: 1) by leveraging the information drawn from query vectors, VO performs better than the plain IMI; 2) without using any runtime features, VO is inferior to \texttt{AdaptNN}, validating the claim made in~\cite{DBLP:conf/sigmod/LiZAH20}; 3) LID does matter and helps to obtain the best latency among all approaches. The experimental results of HNSW are in agreement with IMI as shown in Figure~\ref{fig:vector_only_f_hnsw} and Table~\ref{tab:vecotr_only_t_hnsw}. One interesting observation made is that, in some cases, the latency of VO is even worse than the original HNSW, which is caused by incorrect prediction. This set of experimental results indicates that 1) the neural network of VO cannot learn the correlation between query vectors and the amount of NN search without the help of LID; 2) the explicit use of LID not only delivers better performance and makes \texttt{Tao} easy to use in practice, it also makes the black box (learning process) more explainable for users compared with \texttt{AdaptNN} and Vector Only method. This advantage is highly desirable nowadays since explainability is key for users to understand conclusions and recommendations of the prediction model. \section{Related Work} A large number of ANN search algorithms are available in literature, making this section cannot be exhaustive due to space limitation. The latest benchmarks~\cite{DBLP:journals/tkde/LiZSWLZL20} show that no algorithm dominates the others in all scenarios and each index comes with different tradeoffs in performance, accuracy and space overhead. \subsection{Hashing-based approaches} For high-dimensional approximate search, the well-known indexing method is locality sensitive hashing (LSH) \cite{DBLP:conf/vldb/GionisIM99}. The main idea is to use a family of locality-sensitive hash functions to hash nearby data points into the same bucket. After the query point goes through the same hash functions, it will get the corresponding bucket number, and only compare the distance between the point in the bucket and the query point. In the end, the $k$ approximate nearest neighbor results that are closest to the query point will be returned. In recent two decades, many LSH-based variants have been proposed, such as E2LSH \cite{DBLP:conf/compgeom/DatarIIM04}, QALSH \cite{DBLP:journals/pvldb/HuangFZFN15}, Multi-Probe LSH \cite{DBLP:conf/vldb/LvJWCL07}, BayesLSH \cite{DBLP:journals/pvldb/SatuluriP12}. E2LSH, the classical LSH implementations for $\ell_2$ norm, cannot solve $c$-ANN search problem directly. In practice, one has to either assume there exists a ``magical' radius $r$, which can lead to arbitrarily bad outputs, or uses multiple hashing tables tailored for different radii, which may lead to prohibitively large space consumption in indexing. To reduce the storage cost, LSB-Forest~\cite{DBLP:journals/tods/TaoYSK10} and C2LSH~\cite{DBLP:conf/sigmod/GanFFN12} use the so-called virtual rehashing technique, implicitly or explicitly, to avoid building physical hash tables for each search radius. Based on the idea of query-aware hashing, the two state-of-the-art algorithms QALSH~\cite{DBLP:journals/pvldb/HuangFZFN15} and SRS~\cite{DBLP:journals/pvldb/SunWQZL14} further improve the efficiency over C2LSH by using different index structures and search methods, respectively. SRS reduces the ANN search problem in a $d$-dimensional space into the range query in an $m$-dimensional projection space (typically $m = 6$), and uses $R$-tree to fulfill this purpose. Recently, Lv et al. proposed VHP, which achieves better efficiency by ingeniously restricting the search space to be the intersection of those of QALSH and SRS. All of the aforementioned LSH algorithms provide probability guarantees on the result quality (recall and/or precision). Other LSH extensions such as Multi-probe LSH~\cite{DBLP:conf/vldb/LvJWCL07}, SK-LSH~\cite{DBLP:journals/pvldb/LiuCHLS14}, LSH-forest~\cite{DBLP:conf/www/BawaCG05} and Selective hashing~\cite{DBLP:conf/kdd/GaoJOW15} use heuristics to access more plausible buckets or re-organize datasets, and do not ensure any LSH-like theoretical guarantee. A recent paper discussed how to select better hash functions using a deep learning approach~\cite{DBLP:conf/icde/TangWCGCP21}. \subsection{Quantization-based approaches} \label{Sec:brief-review-of-quantization-method} The most influential vector quantization for ANN search is Product Quantization (PQ)~ \cite{jegou2010product}. It seeks to perform a similar dimension reduction to hashing algorithms, but in a way that better retains information about the relative distances between points in the original vector space. Formally, a quantizer is a function $q$ mapping a $d$-dimensional vector $x\in \mathbb{R}^{d}$ to a vector $q(x)\in C = \{c_i; i \in \mathcal{I}\}$, where the index set $\mathcal{I}$ is assumed to be finite: $\mathcal{I}=0 \ldots k-1$. The reproduction values $c_i$ are called centroids. The set $\mathcal{V}_{i}$ of vectors mapped to given index $i$ is referred to as a cell, and defined as \begin{displaymath} \mathcal{V}_{i} \triangleq\left\{x \in \mathbb{R}^{D}: q(x)=c_{i}\right\} \end{displaymath} The $k$ cells of a quantizer form a partition of $\mathbb{R}^{d}$. So all the vectors lying in the same cell $\mathcal{V}_{i}$ are reconstructed by the same centroid $c_i$. Due to the huge number of samples required and the complexity of learning the quantizer, PQ uses $m$ distinct quantizers to quantize the subvectors separately. An input vector will be divided into $m$ distinct subvectors $u_j$, $1 \leq j \leq m$. The dimension of each subvector is $d^{*} = d/m$. An input vector $x$ is mapped as follows: \small \begin{equation*} \underbrace{x_{1}, \ldots, x_{d^{*}}}_{u_{1}(x)}, \cdots, \underbrace{x_{d-d^{*}+1}, \ldots, x_{d}}_{u_{m}(x)} \rightarrow q_{1}\left(u_{1}(x)\right), \ldots, q_{m}\left(u_{m}(x)\right) \end{equation*} \normalsize where $q_j$ is a low-complexity quantizer associated with the $j^{th}$ subvector. And the codebook is defined as the Cartesian product, \begin{displaymath} \mathcal{C}=\mathcal{C}_{1} \times \ldots \times \mathcal{C}_{m} \end{displaymath} and a centroid of this set is the concatenation of centroids of the m subquantizers. All subquantizers have the same finite number $k^{*}$ of reproduction values, the total number of centroids is $k=\left(k^{*}\right)^{m}$. PQ offers three attractive properties: (1) PQ compresses an input vector into a short code (e.g., 64-bits), which enables it to handle typically one billion data points in memory; (2) the approximate distance between a raw vector and a compressed PQ code is computed efficiently (the so-called asymmetric distance computation (ADC) and the symmetric distance computation (SDC)), which is a good estimation of the original Euclidean distance; and (3) the data structure and coding algorithm are simple, which allow it to hybridize with other indexing structures. Original PQ requires examining all vectors during ANN search. To handle billion-scale datasets, advanced indexing structures such as IMI and IVF are developed \cite{babenko2014inverted, jegou2010product}. \begin{table*}[htbp] \caption{Latency for HNSW, \texttt{AdpatNN} and \texttt{Tao}.} \begin{center} \begin{tabular}{c|c|c|c|c|c|c} \hline \textbf{Dataset} &\textbf{Recall} & \textbf{HNSW} & \texttt{AdaptNN} & \texttt{Tao} & \textbf{Reduction over HNSW} & \textbf{Reduction over} \texttt{AdpatNN} \\ \cline{1-7} \multirow{6}{*}{Deep10M} & 0.95 & 0.77 ms & 0.69 ms & 0.76 ms & 1\% & / \\ \cline{2-7} & 0.96 & 0.82 ms & 0.77 ms & 0.79 ms & 4\% & / \\ \cline{2-7} & 0.97 & 1.01 ms & 0.91 ms & 0.95 ms & 6\% & / \\ \cline{2-7} & 0.98 & 1.27 ms & 1.15 ms & 1.21 ms & 6\% & / \\ \cline{2-7} & 0.99 & 1.77 ms & 1.45 ms & 1.53 ms & 14\% & / \\ \cline{2-7} & 0.999 & 19.47 ms & 5.88 ms & 4.87 ms & 75\% & 17\% \\ \hline \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} \\ \cline{1-7} \multirow{6}{*}{Sift10M} & 0.95 & 0.82 ms & 0.73 ms & 0.79 ms & 4\% & / \\ \cline{2-7} & 0.96 & 1.01 ms & 0.89 ms & 0.95 ms & 5\% & / \\ \cline{2-7} & 0.97 & 1.08 ms & 0.96 ms & 1.02 ms & 6\% & / \\ \cline{2-7} & 0.98 & 1.12 ms & 1.03 ms & 1.05 ms & 6\% & / \\ \cline{2-7} & 0.99 & 1.36 ms & 1.24 ms & 1.28 ms & 6\% & / \\ \cline{2-7} & 1.0 & 17.48 ms & 5.41 ms & 4.28 ms & 76\% & 21\% \\ \hline \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} \\ \cline{1-7} \multirow{6}{*}{Gist} & 0.95 & 3.90 ms & 3.57 ms & 3.69 ms & 5\% & / \\ \cline{2-7} & 0.96 & 4.86 ms & 4.23 ms & 4.56 ms & 6\% & / \\ \cline{2-7} & 0.97 & 6.17 ms & 5.41 ms & 5.71 ms & 7\% & / \\ \cline{2-7} & 0.98 & 7.66 ms & 7.06 ms & 7.13 ms & 7\% & / \\ \cline{2-7} & 0.99 & 14.40 ms & 10.92 ms & 10.23 ms & 29\% & 6\% \\ \cline{2-7} & 0.999 & 264.12 ms & 40.93 ms & 34.32 ms & 87\% & 16\% \\ \hline \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} \\ \cline{1-7} \multirow{6}{*}{ImageNet} & 0.95 & 1.23 ms & 0.66 ms & 0.86 ms & 30\% & / \\ \cline{2-7} & 0.96 & 1.45 ms & 0.76 ms & 0.93 ms & 36\% & / \\ \cline{2-7} & 0.97 & 1.79 ms & 0.91 ms & 1.14 ms & 36\% & / \\ \cline{2-7} & 0.98 & 2.72 ms & 1.28 ms & 1.46 ms & 46\% & / \\ \cline{2-7} & 0.99 & 3.82 ms & 2.70 ms & 2.36 ms & 38\% & 13\% \\ \cline{2-7} & 0.998 & 303.34 ms & 36.46 ms & 26.56 ms & 91\% & 27\% \\ \hline \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} \\ \cline{1-7} \multirow{4}{*}{Glove} & 0.9 & 5.08 ms & 3.79 ms & 4.49 ms & 12\% & / \\ \cline{2-7} & 0.95 & 94.93 ms & 13.10 ms & 16.09 ms & 83\% & / \\ \cline{2-7} & 0.96 & 335.25 ms & 23.01 ms & 22.12 ms & 93\% & 4\% \\ \cline{2-7} & 0.9668 & 1486.82 ms & 65.24 ms & 61.46 ms & 96\% & 6\% \\ \hline \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} \\ \cline{1-7} \multirow{6}{*}{Msong} & 0.95 & 0.60 ms & 0.53 ms & 0.58 ms & 3\% & / \\ \cline{2-7} & 0.96 & 0.78 ms & 0.67 ms & 0.74 ms & 5\% & / \\ \cline{2-7} & 0.97 & 0.89 ms & 0.73 ms & 0.76 ms & 15\% & / \\ \cline{2-7} & 0.98 & 1.01 ms & 0.65 ms & 0.83 ms & 17\% & / \\ \cline{2-7} & 0.99 & 1.56 ms & 0.82 ms & 1.06 ms & 32\% & / \\ \cline{2-7} & 1.0 & 5.48 ms & 4.26 ms & 4.04 ms & 26\% & 5\% \\ \hline \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} \\ \cline{1-7} \multirow{6}{*}{Trevi} & 0.95 & 2.20 ms & 2.03 ms & 1.77 ms & 20\% & / \\ \cline{2-7} & 0.96 & 2.66 ms & 2.01 ms & 2.09 ms & 21\% & / \\ \cline{2-7} & 0.97 & 3.81 ms & 2.64 ms & 2.88 ms & 24\% & / \\ \cline{2-7} & 0.98 & 6.07 ms & 3.76 ms & 4.18 ms & 31\% & / \\ \cline{2-7} & 0.99 & 8.99 ms & 5.33 ms & 6.23 ms & 31\% & / \\ \cline{2-7} & 0.997 & 45.85 ms & 19.41 ms & 18.54 ms & 60\% & 4\% \\ \hline \end{tabular} \label{tab:deep} \end{center} \end{table*} \subsection{Graph-based approaches} \label{sec:review-of-graph-based-methods} The vast majority of graph-based indexing schemes are designed based on three types of theoretical graph models, that is, Delaunay Graphs \cite{DBLP:journals/ijpp/LeeS80}, Relative Neighbor Graphs \cite{DBLP:journals/pr/Toussaint80} and $K$-Nearest Neighbor Graphs \cite{DBLP:conf/wea/ParedesCFN06, DBLP:conf/www/DongCL11}. In practice, however, most search graphs are essentially approximate $K$-nearest neighbor graphs, which mainly distinguish oneself from the other in the edge selection policies. Inspired by HNSW, several follow-up projects aim to improve the proximity graph-based approach. Douze et al. propose to combine HNSW with quantization \cite{douze2018link}. Navigating Spreading-out Graph (NSG) aims to reduce the graph edge density while keeping the search accuracy \cite{fu2019fast}. SPTAG combines the IVF index and proximity graph for distributed ANN search\cite{ChenW18}. As with HNSW, all of these proximity graph variants employ fixed configurations to perform a fixed amount of graph traversal for all queries. Interested readers are referred to a recent survey for more detailed discussion~\cite{DBLP:journals/corr/abs-2101-12631}, where useful recommendations and guidelines are given for users to choose appropriate graph-based algorithms. In this subsection, we would like to highlight a few studies focusing on external memory graph-based indices, which may be of great interests to database researchers. This line of research is imperative since the sizes of datasets can easily exceeds capacity of available main memory in a commodity server as more and more vectors are produced with the ubiquity of machine learning techniques. \begin{comment} Because the construction of graphs greatly affects search performance, many researchers focus on constructing index graphs. The fundamental issue is how to choose the neighbors of nodes on the graph. We will introduce two state-of-the-art graph neighbor selection strategies: Relative Neighborhood Graphs (RNG) \cite{jaromczyk1992relative} and Monotonic Relative Neighborhood Graphs (MRNG) \cite{fu2017fast}. Formally, given two points p and q in $\mathbb{R}^{D}$ space, $B(p, \delta(p, q))$ represents an open sphere where the center is q, and $\delta(p, q)$ is the radius. The ${lune}_{p q}$ is defined as: \begin{displaymath} {lune}_{p q}=B(p, \delta(p, q)) \cap B(q, \delta(p, q)) \end{displaymath} FANNG \cite{harwood2016fanng} and HNSW \cite{malkov2018efficient} adopt the RNG's edge selection strategy to construct the index. RNG is an edge selection strategy based on undirected graph, and it selects edges by checking whether there is a point in the intersection of two open spheres. In figure 2(a), node p has prepared a set of neighbor candidates for selection. If there is no node in $lune_{pr}$, then p and r are linked. Otherwise, there is no edge between p and r. Because $r \in {lune}_{p s}$, $s \in {lune}_{p t}$, $t \in {lune}_{p u}$, and $u \in {lune}_{p q}$, there are no edges between p and $s,t,u,q$. Although RNG can reduce its out-degree to a constant $C_{d}+o(1)$, it does not have sufficient edges to be a MSNET. NSG adopts the MRNG's edge selection strategy to construct the index, which is a directed graph. In figure 2(b), p and r are linked to each other because there is no node in $lune_{pr}$. p and s are not linked because p and r are linked and $r \in {lune}_{p s}$. However, p and t are linked because p and s are not linked and $s \in {lune}_{p t}$. The graph constructed by MRNG is an MSNET. The common purpose of these two graph construction methods is to reduce the average out-degree of the graph so as to make the graph sparse and reduce the search complexity. These interesting selection strategies have achieved attractive results. \end{comment} To the best of our knowledge, Bin Wang et al. first presented ideas to explore slow storage to achieve billion-scale ANNS in a single machine \cite{DBLP:conf/IEEEpact/WangWLSYJV13}. HM-ANN maps the hierrchical design of the graph-based ANNS with memory heterogeneity in HM, thus most accesses will happen in upper layer stored in fast memory to avoid expensive accesses in slow memory without sacrificing accuracy~\cite{DBLP:conf/nips/0015ZL20}. Vamana fully analyzes the construction details of HNSW and NSG, based on which Vamana uses the random neighbor selection strategy of HNSW to increase the flexibility of edge selection. As a result, it is able to construct a high recall SSD index on a single server of 64G \cite{DBLP:conf/nips/SubramanyaDSKK19}. Minjia Zhang et al. presented an ANN solution ZOOM that uses SSD to employ a multi-view approach. Through the efficient routing and optimized distance computation, ZOOM greatly enhance the effectiveness and efficiency while attaining equal or higher accuracy \cite{DBLP:journals/corr/abs-1809-04067}. \section{Conclusion and Future Work} In this paper, we propose \texttt{Tao}, a general learning framework for adaptive ANN search in high dimensional spaces. Using LID as an intermediate feature, \texttt{Tao} decouples the prediction phase from query processing, and eliminates the laborious parameter tuning work involved in \texttt{AdaptNN}. Experimental results show that \texttt{Tao} achieves comparable or even better performance compared to \texttt{AdaptNN}. A few interesting problems are worth further investigation. \texttt{Tao} unveil the hidden correlation between query vectors and their LID values, which might deserve further study on its own right. Given a specific ANN search algorithm, how LID affects the difficulty of ANN search in high-dimensional spaces is also an open problem of both theoretical practical importance. \section*{Acknowledgment} This work is supported partially by the Fundamental Research Funds for the Central Universities under grant number (No:2232021A-08), NSF of Xinjiang Key Laboratory under grant number (No:2019D04024), Tianjin ``Project + Team" Key Training Project under grant number (No:XC202022). Wei Wang were supported by ARC DPs 170103710 and 180103411, and D2DCRC DC25002 and DC25003. \newpage \small \bibliographystyle{plain}
\section{CONCLUSIONS \& FUTURE WORK} We proposed an RL-based hierarchical framework for autonomous multi-lane cruising. We introduced a key intermediate abstraction within the MoP to discretize the state-action space according to high level behavioral decisions. Furthermore, we showed that the hierarchical design for an autonomous vehicle system can effectively learn the behavior and motion planner tasks. The proposed framework allows for principled modular extension of motion planning, which is not the case in rule-based or monolithic behavior cloning-based approaches. Moreover, we experimentally showed that our state-action space abstraction allows transferring of the trained models from a simulated environment with virtually no dynamics to the one with significantly more realistic dynamics without a need for retraining. Although training BP and MoP individually could sufficiently address the cruising in multi-lane problem, as our future work, we aim to train the BP and MoP agents jointly (in an end-to-end fashion) to acquire higher level of performance. Training BP and MoP in an end-to-end fashion helps both higher and lower levels to adapt to each other and potentially improves the overall performance. Future works also include extending behavioral and motion planning capabilities (training more sub-tasks) to handle more driving situations, such as all-way stop signs and uncontrolled left turns. \section{EXPERIMENTS} In this section we present a set of experiments to evaluate the performance of our method to learn a policy for automated highway cruising. We chose a popular Q-learning-based technique, namely DQN, to test our framework. Additionally, a set of rule-based BP and MoP were developed to provide a baseline for comparison. The rule-based algorithms were developed so that they achieve similar goals as the reward defined for the RL-based BP and MoP. While the rule-based algorithms are by no means optimal, every effort was made to have the best performing algorithms. \subsection{Gym-SUMO} We trained the MoP and BP agents for $1$ million and $400$ thousand steps, respectively, using the gym-SUMO simulator. We first trained the MoP agent with a BP agent that requests a lane change every $100$ steps. Figure~\ref{fig_mop_train} show the training evolution of the MoP agent. The darker line shows the trend of values for the learning agent with moving average. The horizontal line shows the performance of the rule-based approach averaged over $40000$ steps. The agent is clearly learning as the average reward is increasing and number of collisions is decreasing. However, they do not show the whole picture on their own as high average reward can be due to high speed and higher tendency to collide with other vehicles. The overall performance of the agent can be captured by the episode total reward as shown in Figure~\ref{fig_mop_train}(right). An episode terminates either with a collision or after $1000$ steps. \begin{table*}[h] \caption{Comparison results between hierarchical RL and rule-based agents for BP task.} \label{table_bp_perf} \begin{center} \begin{tabular}{@{}lcccc@{}} \toprule & Avg. BP reward & Avg. num. of collisions & Avg. num. of lane changes & Avg. speed [kph] \\ \midrule Hierarchical RL & 699 & 2.125 & 25.0 & 43.21 \\ Rule-based BP and MoP & 627 & 3.525 & 73.0 & 44.24 \\ Rule-based BP with DQN MoP & 531 & 3.350 & 79.2 & 41.29 \\ SUMO controlling the ego & 511 & 1.625 & 88.3 & 41.78 \\ \bottomrule \end{tabular} \end{center} \end{table*} \begin{figure} \centering \includegraphics[width=1.0\columnwidth,trim={0cm 0.5cm 0cm 0.4cm}, clip]{figures/bp_reward.jpg} \caption{Training evolution of the BP agent.} \label{fig_bp_train} \end{figure} The training evolution of the BP agent is shown in Figure~\ref{fig_bp_train}. Since the BP agent is trained with a previously trained MoP agent, its performance is relatively high from the start. For the rule-based BP, we included both rule-based MoP and DQN-based MoP. While the rule-based BP does not achieve good performance with DQN-based MoP, the DQN-based BP can adapt to MoP behavior and achieves much higher performance. Note that the gym-SUMO simulation platform employed is fairly stochastic. Therefore, there is significant variation in the rewards over time. The variation present in the training evolution figures are due to this stochasticity rather than changes in behavior of the BP or MoP agents. Table~\ref{table_bp_perf} summerizes the evaluation results for the trained agents together with those of baseline agents for 40000 steps. The result reported in the table are sums over 1000 steps to be comparable with the figures. We also incorporated the built-in SUMO model for further comparison. As can be seen, the RL agent achieves higher average reward with lower average collisions compared to rule-based algorithms. While the rule-based algorithms are designed to avoid collisions, collisions can also happen due to behavior of other SUMO vehicles. This is evident from the average number of collision even when the ego is controlled by SUMO. Observing the average speed, we can see that the RL agent achieves a comparable result with much lower lane changes, \textit{equivalent to higher comfort}. \subsection{Webots} Webots provides a more realistic evaluation environment with relatively accurate vehicle dynamics and kinematics. The traffic network used in Webots is identical to the one employed in gym-SUMO. In Webots evaluations, we employed a timestep of $0.2$ sec to have smoother control. Figure~\ref{fig_webots_bypass} shows screenshots of the ego motion while bypassing a vehicle partially blocking the lane in the webots environment. \begin{figure}[] \centering \setlength{\unitlength}{0.1\columnwidth} \begin{picture}(9.75,4.25) \put(0,0){\includegraphics[width=0.19\columnwidth, trim={9cm 9cm 16cm 6cm}, clip]{figures/webots_bypass_02.png}} \put(2,0){\includegraphics[width=0.19\columnwidth, trim={9cm 9cm 16cm 6cm}, clip]{figures/webots_bypass_03.png}} \put(4,0){\includegraphics[width=0.19\columnwidth, trim={9cm 9cm 16cm 6cm}, clip]{figures/webots_bypass_04.png}} \put(6,0){\includegraphics[width=0.19\columnwidth, trim={9cm 9cm 16cm 6cm}, clip]{figures/webots_bypass_05.png}} \put(8,0){\includegraphics[width=0.19\columnwidth, trim={9cm 9cm 16cm 6cm}, clip]{figures/webots_bypass_06.png}} \color{white} \put(0.2,0.2){$t_0$ (s)} \put(2.2,0.2){$t_0 + 2$ (s)} \put(4.2,0.2){$t_0 + 4$ (s)} \put(6.2,0.2){$t_0 + 6$ (s)} \put(8.2,0.2){$t_0 + 8$ (s)} \end{picture} \caption{Screenshots of Webots environment showing the ego vehicle bypassing a vehicle that is partially blocked the lane} \label{fig_webots_bypass} \end{figure} \begin{figure} \centering \includegraphics[width=1.0\columnwidth, clip]{figures/webots_lane_change.jpg} \caption{Ego vehicle making a lane change maneuver in Webots. The vehicle speed is $13.9~m/s$ during the lane change.} \label{webots_lane_change} \end{figure} \begin{figure} \centering \setlength{\unitlength}{0.1\columnwidth} \begin{picture}(10,5) \put(0.5,0){\includegraphics[width=0.9\columnwidth, trim={0.85cm 0cm 0.8cm 1.1cm}, clip]{figures/webots_follow.jpg}} \put(0,2){\begin{turn}{90}Speed~($m/s$)\end{turn}} \put(9.75,4.5){\begin{turn}{-90}Front gap~($m$)\end{turn}} \end{picture} \caption{Ego vehicle behavior while following a slower vehicle in Webots.} \label{webots_follow} \end{figure} Figure~\ref{webots_lane_change} shows the lane change maneuver of the trained agent in Webots. Note how MoP attempts to move back to original lane after BP temporarily cancels the lane change command. The vehicle speed is $13.9~m/s$ ($50~kph$) during the lane change and in the absence of temporary cancellation lane change would have been completed in around $8$ sec. Figure~\ref{webots_follow} shows the behavior of the trained agent while following a slower vehicle. As can be seen at around $885~s$, the MoP anticipates the front vehicle getting too close and slows down to maintain safe distance. The agent also smoothly speeds up as the vehicle in the front increase its speed. \section{INTRODUCTION} Developing autonomous cars that reliably assist humans in everyday transportation is a grand research and engineering challenge. While autonomous cars are on the way to revolutionize the transportation system by increasing safety and improving efficiency~\cite{schoettle2014survey}, many aspects of driving remain beyond the reach of current solutions. Mundane as it may seem, cruising on a multi-lane highway effectively and safely while taking full advantage of available driving space has proved challenging for existing autonomous cars. What makes multi-lane cruising significantly more challenging than the single-lane adaptive cruise control (ACC) is the fact that the multi-vehicle interaction happens both laterally (i.e. perpendicular to the lanes) and longitudinally (i.e. parallel to the lanes) and requires coordination between lateral and speed control. In particular, multi-lane cruising involves changing lanes, bypassing in-lane small objects, speed control, and maintaining safe distance from vehicles ahead. The current research focuses on the use of hierarchical reinforcement learning for multi-lane cruising as a special case of driving on structured roads. Driving on structured roads is heavily regulated by signs, signals, and rules that come to apply at various points in time and space. In multi-lane cruising, lane markings dictate that driving takes place mostly within the boundaries of a single lane. Lane change is a short-lived, transitional event in continuous motion space that links two distinct states~\textemdash~driving in one lane vs. driving in an adjacent lane. Similarly, traffic rules\footnote{Traffic lights, lane markings, speed limit signs, fire truck sirens, etc.} are \textit{symbolically punctuated} states that can be viewed as a hierarchical planning system, through which higher level decisions on discrete state transitions are coordinated with lower level motion planning and control in continuous state space. In this context, the hierarchical planning system is divided into three sub-systems: a) behavioral planner (BP), b) motion planner (MoP), and c) motion controller. The BP is responsible for high level decision making (e.g. \textit{switch to the left lane}) over discrete states. The MoP generates a continuous trajectory given behavioral commands. The motion control module controls the vehicle to follow the planned trajectory. Classical methods for implementing the BP are largely rule-based with finite state machines being a common choice~\cite{paden2016survey}. Classical MoP methods typically require optimization according to explicitly defined cost functions with the behavior decision expressed as constraint terms in the cost function~\cite{werling2010optimal,hu2018dynamic}. Rule-based BP is extremely hard to maintain and does not scale well in complex dynamic scenarios. Likewise, explicit cost functions for MoP are hardly general enough and very difficult to tune for complex dynamic interactions. These limitations could explain the conservative behavior of current autonomous cars in multi-lane driving. In response to these limitations, many recent studies attempted learning-based approaches. Bojarski~\textit{et al.}~\cite{bojarski2016end} proposed an end-to-end supervised learning scheme that directly maps images to steering commands. Sun~\textit{et al.}~\cite{sun2017fast} in contrast use a mapping from state features to trajectories and then use an execution layer to further guarantee short term feasibility and safety. These approaches leverage expert experience for training. However, by directly cloning the expert's driving strategy, they are limited to the expert's performance and experience, failing to adequately explore the parts of the state-action space that may be less critical for safety and performance. In addition, planning and control are largely implemented as one monolithic network, which makes debugging, failure analysis, and incorporation of domain knowledge all very difficult. In contrast to end-to-end solutions, we tackle the problem through a hierarchical and modular scheme by breaking the multi-lane cruising problem into multiple distinct sub-tasks and providing separate modules to address each sub-task. In our design, the MoP is separated into multiple motion planning submodules specialized for a driving sub-task (\textit{lane keeping, lane switching}). The BP determines which motion planning submodule is required to be triggered at each time step. Such design allows for a) reducing the complexity in generating inclusive scenarios by focusing on task-specific scenarios; b) achieving more efficient training by considering task-specific state-action representation and reward design; and c) enabling ease of transfer through hierarchical and modular design. Moreover, the motion controller in our design is realized through classical and none-learning based approaches to enable further transferability from simulation to real-world vehicles. To summarize, the main contributions of this paper are: \begin{itemize} \item proposing a modularized skill-based planning framework with two layers of hierarchy (behavioral and motion planner) for cruising in multi-lane roads; \item proposing a higher level of abstraction in the state-action space of driving in multi-lane roads. \end{itemize} In Section~II, we review the related methods in autonomous driving. In Section~III, we present the details of our planning framework. Section~IV describes the simulation environment used for training and validation. In Section~V we evaluate our approach comprehensively and conclude our work in Section~VI. \section{RELATED WORKS} Recent studies have utilized reinforcement learning (RL) for high-level decision making~\cite{mukadam2017tactical, mirchevskareinforcement}. Mukadam~\textit{et al.}~\cite{mukadam2017tactical} proposed a Q-learning based approach to address the lane switching problem in autonomous driving. A Q-network was considered to issue discrete high level commands, \textit{e.g.} switch left/right. Mirchevska~\textit{et al.}~\cite{mirchevskareinforcement} proposed an RL-based approach for autonomous driving in highway scenarios using the fitted Q-iteration with extremely randomized trees as a function approximator. Both of these approaches have utilized RL for high level decision making (\textit{i.e.} BP) and adopted classical and rule-based approaches for motion planning~\cite{mukadam2017tactical, mirchevskareinforcement} and collision avoidance~\cite{mukadam2017tactical}. Wulfmeier~\textit{et al.}~\cite{wulfmeier2016watch} utilized inverse reinforcement learning to deduce human driver's underlying reward mapping from sensory input by applying Maximum Entropy to a large-scale human driving dataset. The deduced reward mapping was then used as a cost-function for motion planning. The approach however focuses on static environment, and it is not directly applicable to environments involving dynamic obstacles (\textit{e.g.} multi-lane urban roads and highway). A planning by prediction paradigm was proposed in~\cite{shalev2016long} to tackle adaptive cruise control and roundabout merging problems. The navigation problem was decomposed into two prediction and planning phases. In the prediction phase, supervised learning was utilized to predict the near future states based on the current states. Then, RL was used in the planning phase to model the vehicle's acceleration given the prediction results. A hierarchical reinforcement learning scheme was incorporated in~\cite{paxton2017combining} to deal with the self-driving problem in challenging environments. The proposed scheme was formulated by decomposing the problem into a set of high level temporal-constrained options and low-level control policies, and using Monte Carlo Tree Search over the available options to find the best sequence of options to execute. The main difficulty with realizing temporal-based methods stems from ambiguity on setting the termination condition. The typical solution is to assign a fixed expiration time to each option and penalize the agent if execution time is expired. Specifying such deadlines are a challenging and conflicting task that adds to the complexity of the overall training process. For example, if the goal is to learn switch lane option, the operator requires to specify a deadline for completing the lane change. If the selected deadline is too short, the agent may prioritize a sharp and unsafe lane change over an accident-free and smooth maneuver. Similarly, extending the deadline may result in conservative or undesired behaviors. Furthermore, most existing approaches rely on learning-based low-level control policies. In practice, low-level policies may result in oscillatory or undesirable behaviors when deployed on real-world vehicles due to imperfect sensory inputs or unmodeled kinematic and dynamic effects. Given well-established controllers such as PID and MPC, we believe that learning-based methods are more effective in the high and mid level decision making (\textit{e.g.} BP and MoP) rather than low-level controllers. \section{SIMULATOR} For training of the BP and MoP RL agents, we employed the SUMO traffic simulation software \cite{SUMO2018}. A wrapper, called \textit{gym-SUMO} was developed in Python to make an OpenAI Gym compatible environment for training. While the ego vehicle is not limited to the center of the lane and can freely move using gym-SUMO, the default behavior for other vehicles in SUMO is confined to the center of lanes. To make the traffic more realistic with richer corridor information, we trained the agents with the \textit{sublane} model activated in SUMO. Sublane model in SUMO provides more natural and gradual lane change behavior. Given that SUMO has built-in speed and lateral controls and does not have sophisticated kinematic and dynamic models, the action inputs were defined as the desired speed and the target corridor. The output from gym-SUMO includes state variables required by the MoP and BP agents, the BP agent reward, and a termination signal for accidents. The reward of MoP agent is calculated internally from the environment state. To evaluate the full architecture with a more realistic environment we employed Webots \cite{Webots} in conjunction with SUMO. The ego vehicle is controlled through Webots providing a realistic dynamic and kinematic model, while SUMO controls the rest of traffic movement providing an intelligent and realistic environment. The road network used for training and evaluation consisted of three lanes in a straight line. Figure~\ref{fig_sumo_webots} depicts a snapshot of the gym-SUMO and Webots environments employed for evaluation. \begin{figure}[!htb] \centering \includegraphics[height=8cm, clip]{figures/gym-sumo.png} \includegraphics[height=8cm, clip]{figures/webots_screenshot.png} \caption{screenshots of gym-SUMO (left) and Webots (right) simulation environments. Screenshots are not from the same timestep.} \label{fig_sumo_webots} \end{figure} \section{TECHNICAL APPROACH} \subsection{The Planning Hierarchy} Driving is a symbolically punctuated behavior. Different from regular robotic problems, driving is heavily punctuated by signs and rules on top of what is largely a continuous control task. To name some, the symbols here include lane markings, traffic lights, speed limit signs, fire truck sirens, and the turning signals of other vehicles. As an example, lane markings dictates that most driving happen within a single lane. Thus, lane changes are short-lived and transitional events that link forward driving in one lane to forward driving in an adjacent lane -- two discrete states at a higher level of abstraction in the state space of driving. Because driving is symbolically punctuated, it is naturally hierarchical: higher level decisions on discrete state transitions with lower level execution in continuous state space, which suggests a hierarchical structure in the design of planning systems for autonomous driving. Figure~\ref{fig_architecture} illustrates our proposed hierarchical decision making architecture for cruise in multi-lane roads. The proposed decision making framework includes \textit{BP} that makes high level decisions about transitions between discrete states, and \textit{MoP} that generates a target spatio-temporal trajectory with a target speed according to the decisions made by BP. The target trajectory is then fed to the controller to follow the trajectory by controlling the steering wheel, throttle, and brake in continuous state space. The hierarchical structure of our planning framework facilitates analysis of the decisions that are made during driving. In addition, the structure allows for convenient modularization of different \textit{skills}, \textit{e.g.} adaptive cruise control, lane switching, pullover, and merging. Each modularized skill acts as an independent entity and forms a comprehensive maneuver function considering its own constraints and safety internally. This also enables modifying and replacing sub-modules according to new requirements and conditions. Moreover, these modules can be shared among two or more driving sub-tasks to facilitate faster learning and generalization. \subsection{Behavior Planner} The behavior decision is about transitioning between states that are discrete only at a higher level of abstraction. BP is responsible to drive the car to the destination safely and as fast as possible. In our current setting, BP makes high level decisions including \textit{keep lane}, \textit{switch to the left lane}, and \textit{switch to the right lane} subject to the following conditions: \begin{itemize} \item navigating the ego-car to less busy lanes so the car can drive to the maximum speed limit (\textit{drive as fast as possible}) \item avoiding collisions (\textit{drive safely}). \end{itemize} BP takes the full set of states as input which includes: ego lane, ego speed, distance and relative speed of the nearest vehicles in the front and back for current and neighboring lanes. We design a \textit{coarse-grained} reward function and avoid any \textit{fine-grained} rules in our reward feedback. This way, we give the RL agent a chance to explore the state space and to come up with solutions that possibly outperform classical rule-based planners. The BP module receives a reward of $1$ if speed is above a threshold. The threshold is higher for left lanes and lower for right lanes to motivate the agent to keep right. A penalty of $-5$ is given for each left lane change. Therefore, rewarding the agent for staying in a lane where it can drive fast, and discouraging excessive lane changes. Otherwise, the BP agent's reward is $0$. The BP reward can be summarized as: \begin{equation} r_{BP}= \begin{cases} -5, & lane(t) > lane(t-1) \\ 1, & speed(t) > threshold(lane(t)) \\ 0, & \text{otherwise} \end{cases} \end{equation} where $lane(t)$ being the lane number, starting from the rightmost lane, and increasing as we move towards left. As mentioned above, the $threshold(lane(t))$ is higher for left lanes. \subsection{Motion Planner} Motion Planner's main task is to provide a safe and collision-free path towards its destination, while taking into account road boundaries, the vehicle kinodynamic constraints, or other constraints dictated by BP. In our design, the MoP generates a target trajectory defined as a set of 2D points (\textit{i.e.} path) coupled with a target \textit{speed} value. We propose a new level of road abstraction, through which each lane consists of $N_c$ corridors, as depicted in Figure~\ref{fig_simulator}. Corridors are defined in the Fren{\'e}t coordinate frame parallel to the desired trajectory. This trajectory is constructed based on road centers (waypoints) or path planning algorithms for unstructured environments. As corridors are defined in the Fren{\'e}t coordinate frame, tracking performance remains invariant to transformation \cite{werling2010optimal}. \begin{figure}[] \centering \includegraphics[width=0.35\textwidth]{figures/hrl_architecture_0.pdf} \caption{Overview of our hierarchical planning framework: Behavioral planner (BP) and Motion planners (MoP).} \label{fig_architecture} \end{figure} \begin{figure}[] \centering \includegraphics[width=0.45\textwidth] {figures/sim.png} \caption{Corridor abstraction for structured roads. Here the \textit{Blue line} shows the corridor selected by MoP, and the \textit{Yellow line} is a generated trajectory corresponding to the selected corridor. The ego-car is shown with red color.} \label{fig_simulator} \end{figure} An MoP agent in our framework selects two sets of actions: 1) A \textit{lateral action} identifying the target corridor; and 2) A \textit{speed action} which selects the target speed. Corridor selection is equivalent to selecting a path among a set of predefined paths (clothoids or splines). The expected behavior of the MoP module differs with respect to the BP action: \begin{itemize} \item For \textit{keep-lane}, MoP should select a corridor within the current lane while avoiding collision. This enables MoP to maneuver around small objects in the lane without switching lane. \item For \textit{switch-left/right}, MoP should select a corridor towards the direction of lane change. The MoP agent is also allowed to select corridors within the current lane to avoid collision when the target lane is occupied. \end{itemize} Speed set-point is selected according to BP actions and physical boundaries (\textit{e.g.} heading cars, or any interfering objects on the road) while ensuring safety and smoothness. Simultaneously adjusting the speed set-point and lateral position allows to handle various tasks such as in-lane cruising, emergency stop, and vehicle following. This also includes any other speed-dependent BP actions. Figure~\ref{fig_arch_implementation} shows an overview of the hierarchical framework applied to the highway cruising problem. The keep-lane and switch-lane tasks are achieved using a shared MoP agent. Given BP action, the corresponding pre-processing module is triggered. Each pre-processor passes a relevant subset of states to the shared agent. The selected target corridor and speed set-point by the MoP agent are relative quantities. The absolute corridor and speed values are calculated in the \textit{Action post-processing} module, and fed into the \textit{Trajectory generator} module. Trajectory generator is a non-learning-based module implemented using a simple curve fitting from point $A$ to point $B$ (Yellow line in Figure~\ref{fig_simulator}). The generated trajectory is extended along the target corridor as the vehicle moves and is guaranteed to be smooth and feasible for the controller node. \begin{figure}[] \centering \includegraphics[width=0.4\textwidth]{figures/hrl_architecture_2.pdf} \caption{Diagram showing the highway cruising problem implemented in the hierarchical RL framework.} \label{fig_arch_implementation} \end{figure} The input states to the shared MoP agent include current speed, speed set-point, BP target speed, and the current corridor. In addition, the front and back gaps along with their rate of change are also used for a number of corridors equivalent to one lane. The shared agent outputs a new corridor relative to current corridor and change in speed set-point. The MoP agent receives a reward of $1$ if it is moving close to the BP's target speed or following another vehicle with a safe distance $d$. The distance $d$ is defined as $d=v\times\tau+d_0$, where $v$ is the ego speed, $\tau$ is desired headway in seconds, and $d_0$ is the distance when stopped. The reward for safe following is only awarded if all the corridors are blocked, i.e. the ego vehicle cannot bypass the obstacle with an in-lane maneuver. Additionally, to promote driving in the center of the lane, the agent is only awarded if the ego vehicle is in the middle corridor. In summary, the following conditions need to be met for the MoP agent to receive a reward of $1$: \begin{itemize} \item being in the middle corridor, AND \item EITHER the speed of the ego vehicle is within a threshold of the BP target speed, \item OR the minimum front gap is within a threshold of the safe distance $d$. \end{itemize} Otherwise, the reward that MoP agent receives is $0$. While not necessary, it is helpful to add a penalty term for high acceleration to direct the MoP agent to opt for less aggressive actions when possible; thereby, resulting in more comfortable driving experience. For the keep-lane task, the MoP states are limited to corridors associated with the current lane. The corridors on the sides that result in ego vehicle intruding other lanes are set to be blocked, by setting their gaps to $0$. This results in a collision effect if the ego vehicle enters those corridors. For switch-lane tasks, the corridors are chosen such that the ego vehicle is off from the middle corridor by one corridor, with the corridor offset being opposite the direction of lane change. Since the MoP agent only receives a reward in the middle corridor, this choice for corridors will direct the MoP agent to move toward the desired lane. It is worth noting that the MoP agent is not forced to make the corridor change, \textit{e.g.} it can choose to remain off the middle corridor when the target corridor is occupied. During a switch-lane task, as soon as the corridor of the ego vehicle changes, the state processing shifts the corridors again. It is expected from BP to change the action to keep-lane when the ego vehicle arrives at the target lane. If the BP action changes from switch-lane to keep-lane before the ego vehicle arrives at the new lane (canceling a lane change) the MoP also cancels the lane change process and return to the middle of the current lane. \subsection{Training} In the proposed hierarchical RL framework, BP issues a high level command which is executed by the corresponding MoP. As opposed to the other hierarchical frameworks (\textit{e.g.} \cite{kulkarni2016hierarchical}), BP does not wait until its command gets executed. Considering any fixed lifetime for BP commands is dangerous for autonomous driving. In fact, BP should be able to update its earlier decisions (at every time step) according to the new states. MoP is designed to prioritize safety over BP decisions. Our framework is flexible when it comes to choosing RL algorithms to be applied for BP and MoPs. We tested our framework with \textit{DQN} \cite{mnih2015human}. The training was carried out by training MoP agents to achieve certain performance and reliability in executing the sub-tasks, with a random BP module changing the target lane every few hundred steps. Then, BP agent was trained using the trained MoP agent. This allows for the BP agent to learn the weakness and strength of the MoP agents, and potentially improving the overall performance of the planning system.
\section*{Background} In the past decade, RNA sequencing (RNA-seq) has gradually become an essential tool for analyzing differential gene expression at the full transcriptome level of mRNA splicing \cite{Svensson2018,Krzak2019}. Then, with the development of next-generation sequencing (NGS) technology, RNA-seq has been widely used \cite{Stark2019}. It has been used in many studies at the RNA level, such as single-cell gene expression, RNA translatome, and RNA structurome \cite{Slatko2018,Hu2016}. In 2013, Nature Methods named scRNA-seq as the technology of the year 2013 \cite{Editorial2014}. Then an extensive amount of scRNA-seq data was generated based on this technology. The standard analytical steps for analyzing single-cell data involve identifying the cell population in the data sets. ScRNA-seq data analysis plays a vital role in understanding the intrinsic and extrinsic cellular processes in biological and biomedical research \cite{Wang2019}. ScRNA-seq provides us with an opportunity to identify the cellular composition of complex tissues \cite{Svensson2018,Cheng2020}, which is valuable to detect new populations of cells, define different cell types, and discover rare cells that represent minor cell types. Since unsupervised methods often require manual annotation, which is time-consuming and cumbersome, the process of detecting new populations of cells is very tedious and inefficient \cite{Qi2020}. Supervised machine learning methods \cite{ Pliner2019} were applied to solve cell-type annotation using scRNA-seq data. ScRNA-seq classification methods predict each cell identity by learning the identities of cells from annotated training data \cite{Abdelaal2019}. Besides the method discussed above, many other supervised machine learning algorithms can be applied to classify cell phenotypes. However, there is no specific way to claim that when algorithm (A) performs better than an algorithm (B) in one specific type of problem, this superiority also should occur in other kinds of issues. Therefore, the major challenge is determining which classification algorithms have the best performance of cell-type classification using scRNA-seq data with different sample sizes. We conducted a benchmark study to benchmark popular supervised learning algorithms to classify scRNA-seq data in various types of data with different sizes to address the mentioned challenges. In this study, we considered eight individual algorithms including: i) ElasticNet \cite{Zou2005}, ii) ElasticNet with interactions, iii) Linear Discriminant Analysis (LDA) \cite{Xanthopoulos2013}, iv) NaiveBayes (NB) \cite{John2013}, v) Support Vector Machines (SVM) \cite{Steinwart2008}, vi) K-Nearest Neighbors (KNN) \cite{Kramer2013}, vii) Tree \cite{Gupta2012}, and viii) XGBoost (XGB) \cite{Friedman2003}. we constructed five ensemble algorithms based on the weights or votes of eight individual algorithms discussed above and evaluated their performance against individual ones. Ensemble learning algorithms usually work better than a specific individual algorithm \cite{Dietterich2002}. Hence, they were to apply in scRNA-seq data \cite{Abdelaal2019}. The benchmark study contained two main parts. The first part was based on classification methods. In this part, we benchmarked these method computing speed, and their performance of cell phenotype classification on three different sizes of data sets, 27 small data sets from Conquer \cite{Soneson2018}, 4 medium data sets, and 12 large ones \cite{Packer2019}. The second part was an investigation of the performance of 4 algorithms comprising i) ElasticNet, ii) NB, iii) Tree, and iv) XGB, which was used for gene selection based on the simulated data sets presented by Soneson et al. \cite{Soneson2018}. The comparisons were carried out from several aspects. First, we compared classical machine learning algorithms (ElasticNet with and without interaction items, LDA, NB, SVM, KNN, Tree, and XGB) with the ensemble learning algorithms (the five ensemble algorithms). Second, we investigated whether adding interaction items can optimize the results in ElasticNet. Third, we studied the performance of the algorithms in different sizes of data sets. The performance of algorithms was evaluated based on the AUC, F1-score, FPR, Precision, and Recall in processing classification. Also, we benchmarked the performance of different algorithms in gene selection by using simulated data sets. The comparison was made regarding the computation time of each algorithm. The results showed a variation in computation time and their cell phenotype classification performance among different classification algorithms. We found that the ensemble performances in different data sets were not significantly better than the classical machine learning algorithms. ElasticNet with interactions performed well in small and medium data sets, and it spent a shorter time on classification. The results also revealed that adding interactions to the model improved the performance of ElasticNet. Moreover, collinearity existed among genes in the data of scRNA-seq, and some genes had little significance for cell-type annotations. To make gene selection and to shrink adjustment of variable coefficients, the ElasticNet algorithm added a penalty. The penalty led to better performance among different data sets. The performance of algorithms used for gene selection in scRNA-seq data processing proved that ElasticNet was excellent in gene selection. However, when the data set sample size was large, ElasticNet needed a long time to compute. After adjusting the parameters, the results were not stable enough on some large data sets. Also, the performance of LDA and XGB were highly more effective. Overall, the results highlighted that ensemble algorithms were not superior to classical machine learning methods in speed and cell phenotype classification performance. We found ElasticNet with interactions can be more appropriate for small and medium data sets. In contrast, XGB was better for large data sets. \section*{Methods} This section describes data sets, algorithm design, evaluation criteria, classification methods, and gene selection. \subsection*{Data Sets} The data sets from Conquer \cite{Soneson2018} and GSE126954 \cite{Packer2019} were employed to evaluate all classification methods for scRNA-seq data, 27 data sets from Conquer were applied as small data sets, 4 data sets from GSE126954 were used as medium data sets, and 12 data sets from GSE126954 were considered as large ones (see Table S1, Table S2, Table S3 in Additional file 2, Additional file 3 and Additional file ). Finally, as the third type of data sets, the simulated data sets provided by Soneson et al. \cite{Soneson2018} were used to evaluate gene selection performance. See the details about the simulated data sets in Additional file 5 Table S4 \subsubsection*{The 27 Data Sets from Conquer} The conquer repository \cite{Soneson2018} was developed by Charlotte Soneson and Mark D Robinson at the University of Zurich, Switzerland. The data sets used in this research were downloaded from \url{http://imlspenticton.uzh.ch:3838/conquer}. Although Conquer contains 40 scRNA-seq data sets, we selected 27 data sets of them with two types of cells in a specific phenotype, and the number of cells in each type was at least 15. We selected 27 data sets in which there were two types of cells in a specific phenotype, and the number of cells in each type was at least 15 (Please refer to Table S1 in Additional file ). The predictors were carefully chosen from the top 1000 genes with the strongest correlation. We named such data sets ``small data sets”. \subsubsection*{GSE126954 Data Sets} The GSE126954 data sets were presented by Packer et al. \cite{Packer2019}. The data sets can be downloaded from \url{https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE126954}. Those involved 86,024 single cells that were scRNA-seq of C.elegans embryos \cite{Packer2019}. We divided them into two parts. The first part contained 4 data sets that were larger than the small data sets from Conquer. We selected four pairs of different cells to form 4 ``medium data sets". The number of cells in our selected data sets ranged from 112 to 911 (Please refer to Table S2 in Additional file for more details). The second part contained 12 data sets named ``large data sets". Besides, this paper used 2 data sets based on different cell types and 10 data sets according to a pair-wise comparison of scRNA-seq profiles of cells from C.elegans embryos at varying developmental stages. The number of each type of cell ranged from 1732 to 25875, as described in Table S3 (see Additional file 4) . These two parts of the data sets were used to choose 1000 genes with the strongest correlation as predictors. Also, the algorithm parameter setting was like the setting of small data sets. \subsubsection*{Simulated Conquer Data Sets} To evaluate feature selection, we should know what the real gene is. In this study, we used three simulated data sets provided by Soneson et al.\cite{Soneson2018,simulated-web}. The simulation was done using the package \emph{powsimR} \cite{powsim2017}. The simulation input parameters were learned from the three real data sets: GSE45719, GSE74596, and GSE60749-GPL13112. We used information about each cell real class members received from real data sets. The simulated data sets and the real data sets can be downloaded from the website \cite{simulated-web}. Table \ref{Table5} presents more information about simulated data sets. \subsection*{Classification Methods} We compared the results of ElasticNet, ElasticNet with interactions, LDA, NB, SVM, KNN, Tree, XGB, and five ensemble algorithms. The first eight methods repeated 100 rounds of tenfold cross-validation. The grouping of each round of cross-validation was random. The five ensemble algorithms classification results were achieved from seven traditional algorithms, ElasticNet, LDA, NB, SVM, KNN, Tree, and XGB. We calculated the AUC, F1-score, FPR, Precision, and Recall of each algorithm performance evaluation. Also, we compared the computation time of each algorithm. Please see the results section for details. \subsubsection*{ElasticNet} As a combination of Ridge Regression and Lasso Regression, Elastic Network Regression can not only reduce the prediction variance but also achieve the purpose of coefficient shrinkage, and variable selection \cite{Soomro2016,Lu2021}. This algorithm involved two parameters: \begin{small} \begin{equation} \lambda \sum_{j=1}^{p}\left(\alpha \beta_{j}^{2}+(1-\alpha)\left|\beta_{j}\right|\right) \end{equation} \end{small} To evaluate $\alpha$, we selected 6 values, $\left\{0, 0.2, 0.4, 0.6, 0.8, 1\right\}$, from 0 to 1 evenly and for evaluation of $\lambda$, we chose 100 values from $\log10^{-8}$ to $ \log10^5$. Note that the parameter of $\alpha$ and $\lambda$ in 12 large data sets were changed and set on the full data to avoid consuming a long time. The ElasticNet model was also applied on the complete data set to select the best $\alpha$ and $\lambda$ from 12 data sets and then directly used these parameters in the tenfold cross-validation experiments. In small and medium data sets, we also considered the ElasticNet with 200 interactions. We combined 1000 genes in pairs to form interactions and then applied the logistic regression to find the 200 interactions with the strongest correlation and the response variable. \subsubsection*{LDA} Linear Discriminant Analysis (LDA) identifies a linear combination of predictors that maximize the between-class scatter and minimize the within-class scatter \cite{Park2008}. LDA uses the label information to learn a discriminant projection that can enlarge the between-class distance and reduce the within-class distance to improve the classification performance. Various extensions of LDA have also been developed to enhance the performance and efficiency \cite{Tharwat2017}. In this benchmark study, we used the LDA function in the MASS package with parameters set to be their default values. \subsubsection*{NB} Naive Bayes classifier defines the probability of the document belonging to a particular class. It bases on Bayes' theorem with the assumption that features are independent. However, the Naive assumption may cause a problem because real-world features are dependent \cite{Malik2018}. We used the NaiveBayes function in the package of e1071, and the value of Laplace was set to 1. \subsubsection*{SVM} In SVM, which are formulated for two-class single label problems \cite{Hasan2013}. Selecting an appropriate kernel and its parameters for a specific classification problem can influence the SVM performance \cite{Hasan2017}. We adopted the ten-fold cross-validation to select the optimal parameters for $\gamma$, a parameter that comes with the function after selecting the RBF function as the kernel. It implicitly determines the distribution of the data mapped to the new feature space. The larger the $\gamma$, the fewer the support vectors, and the smaller $\gamma$ value, means the more support vectors. Moreover, the number of support vectors affects the speed of training and prediction, and also cost, it is the penalty coefficient, which is the tolerance for errors. The higher the cost, the less error can be tolerated, and it is easy to overfit. The smaller the cost, is easier for to underfit. When cost is too high or too small, the generalization ability becomes poor. The range of $\gamma$ is $\{\frac{\left(\frac{1}{n}\right)}{10}, \left(\frac{1}{n}\right),\left(\frac{1}{n}\right) \times 10\}$, where $n$ represents the number of genes. In addition, the range of cost is $\left\{0.01, 0.1, 1, 10, 100\right\}$. Then the prediction was made with the help of the optimal model. \subsubsection*{KNN} This algorithm's principle is that if most of the k most similar samples to a query point q$_i$ in the feature space belong to a particular category, then a verdict can be made that the query point q$_i$ falls in this category. The distance in the feature space can measure similarity, so this algorithm is called the K-Nearest Neighbor algorithm. A train data set with accurate classification labels should be known at the beginning of the algorithm. Then for a query data q$_i$, whose label is not known and presented by a vector in the feature space, calculate the distances between it and every point in the train data set. After sorting the results of distance calculation, the class label of the test point q$_i$ can be made according to the label of the k nearest points in the train data set \cite{QKuang2009}. When the size of the train data set and test data set are both considerable, the execution time may be the bottleneck of the application \cite{QKuang2009}. \subsubsection*{Tree} The Tree algorithm is a hierarchical structure that Internal Tree nodes represent splits applied to decompose the domain into regions, and terminal nodes assign class labels or class probabilities to regions believed to be sufficiently small or sufficiently uniform \cite{Kozdrowski2021}. Pruning was done by using tenfold cross-validation. Meanwhile, to avoid the situation, only one branch left after pruning would be an unpredictable classification result. The pruning was not allowed if the leaf size after pruning had been less than two. \subsubsection*{XGB} XGBoost is a regression Tree that has the same decision rules as a decision Tree. It supports both regression and classification. This algorithm is an efficient and scalable variant of the gradient boosting machine (GBM) \cite{Ma2020}. XGBoost method can handle sparse data, implement distributed and parallel computing flexibly \cite{Chang2018,Wang2017}. \subsubsection*{Five ensemble algorithms} Ensembles are achieved by generating different algorithms and combining the results into a single consensus solution\cite{Chiu2018}. This study used five ensemble algorithms constructed by the basic prediction of algorithms results applied for classification. We had two ensemble algorithms that used soft decision rule, and the other three used hard decision rule. We denoted $p_{n,i}$ as the predicted probability of the $n$-th sample from the $i$-th algorithm, where $i$ was the index of algorithms from \{ElasticNet, LDA, NB, SVM, KNN, Tree, XGB\}. The soft ensemble rules made a decision based on the weighted average of predicted probabilities from all methods. We named the two ensemble algorithms ensemble-weighted.AUC and ensemble-weighted.F1. \begin{small} \begin{equation} \tilde{p}_{n}=\frac{\sum_{i} \text {p}_{n,i} \times w_i} {\sum_{i} w_i} \end{equation} \end{small} Where the $w_i$ represented the classification performance of each method. This paper used two criteria: F1-Median and AUC-Median as $w_i$ to construct two ensemble approaches. The ensemble method classified the $n$-th sample by the weighted probability $\tilde{p}_{n}$. On the other hand, we denoted $O_{n,i}$ as the predicted class ($0$ or $1$) of the $n$-th sample from the $i$-th algorithm. In the hard ensemble rules, a decision was made based on the weighted votes from all methods. \begin{equation} \tilde{O}_{n} =\left\{\begin{array}{l} 0; \quad \mbox{if} \quad\sum_{\{i:\text {O}_{n,i}=0\}} w_i \geq\sum_{\{i:\text {O}_{n,i}=1\}} w_i\\ 1; \quad \mbox{if} \quad\sum_{\{i:\text {O}_{n,i}=0\}} w_i <\sum_{\{i:\text {O}_{n,i}=1\}} w_i \end{array}\right. \end{equation} Where we chose $w_i$ as constant $1$ or AUC-Median or F1-Median, indeed, $ w_i$ was used to construct three hard ensemble rules. We named these three ensemble algorithms: ensemble-vote, ensemble-addition.AUC and ensemble-addition.F1. \subsection*{Design of evaluation experiments} \subsubsection*{Cross validation} To evaluate classification performance using supervised algorithms, we carried out tenfold cross-validation in 100 rounds after filtering genes, phenotypes, and cells. The whole samples, labeled in 0 and 1, were divided into ten groups in each round. In each of the 100 rounds of cross-validation, we applied a confusion matrix for either cell phenotype classification or gene selection. From the confusion matrixes, we calculated the following criteria to compare the performance of the methods, defined by AUC, F1-score, FPR, Precision, and Recall. \subsubsection*{Evaluation of classification} For each data set, one sample result in 100 rounds of experiments was predicted to be 0 or 1 (with a threshold of 0.5 by dividing the predicted results into 0 and 1). According to the prediction results and actual values of each algorithm, the confusion matrices were constructed. The numbers of samples were achieved with both real and predicted values of 0 $(a)$, actual values of 0 and predicted values of 1 $(b)$, actual values of 1 and predicted values of 0 $(c)$, and both actual and predicted values of 1 $(d)$. Recall measured the correct ratio in samples with an actual value of category 1, and the calculation formula was $d/(c+d)$ \cite{Hand2009}. The precision measured the ratio of samples with an actual value of 1 in samples, which should be 1, and the formula was $d/(b+d)$. The calculation formula of F1-score was $(2\times Recall \times Precision)/(Recall+ Precision)$. Also, the FPR measured the proportion of a sample with a prediction of 0, which was exactly 1, and finally, its calculation formula was $b/(a+b)$. AUC measured the area under the ROC curve. \subsubsection*{Evaluation for Computation Time} To benchmark each algorithm computation time on each data set, we recorded the computation time of each algorithm for 100 rounds and reported their average computation time in each round. \subsubsection*{Evaluation of Gene Selection} The applied algorithms were NB, Tree, XGB, and ElasticNet. We selected 5000 genes from the three simulated data sets provided by Soneson et al.\cite{Soneson2018,simulated-web}, which had the strongest correlation with the response variable. The system randomly selected 70$\%$ of the training sets from three simulated data sets and repeated this random selection 100 times. Then selected genes happened on 100 subsets with 5000 genes. The comparison was carried out between the selected genes and the real genes in real data sets. We will use a two-column matrix to help the calculation of each indicator. The first column is the selected genes, and the second column is the real genes. Finally, the five criteria, AUC, F1-score, FPR, Precision, and Recall, were considered to evaluate the performance of algorithms in gene selection. Considering the Tree algorithm, we carried out cross-validation to prune the Tree with minimum deviance. Also, we applied the $Recursive Feature Elimination$\cite{Chen2020} to implement gene selection with NB. The parameter settings of the other algorithms were the same as the classification part. \section*{Results} In this section, we describe the detailed method comparison results using each benchmark criteria. We summarize the classification performance and the computation time of all data sets with various sample sizes. Then we summarize the performance of gene selection using simulated data sets. \subsection*{Classification performance} This article studied the classification performance of different classification algorithms on 3 sample size data sets. The results show each classification criteria to compare the performance of the methods in the rest of the subsections. This part provided three figures of the results on small data sets, medium data sets, and large data sets. Fig.\ref{fig1}\textbf{a}, Fig.\ref{fig2}\textbf{a} and Fig.\ref{fig3}\textbf{a} display one method performance, from left to right, the AUC values, F1-score values, and FPR values of the classification outcomes, as three criteria for investigating the performance of algorithms. The three criteria, AUC, F1-score and FPR values were shown in Fig.\ref{fig1}, Fig.\ref{fig2}, and Fig.\ref{fig3}. Fig.\ref{fig1}\textbf{b}, Fig.\ref{fig2}\textbf{b} and Fig.\ref{fig3}\textbf{b} represent the difference between the other algorithms and the best single algorithm. From left to right, the results display the p-value under AUC, F1-score, and FPR. The red line shows the zero value of differences among performances of algorithms. To deeply study the differences in performance of algorithms, in each figure, the discrepancies between the performance of algorithms and the best single methods were investigated using an adjusted p-value cutoff of 0.05. The p-value was considered with three decimal places. We made the values below 0.05 bold, which approved significant differences among the performance of methods. We also proposed the values of IQR (interquartile range) and median values (the median value calculated from the results of 100 experiments for each data sets) for the five criteria in additional figures (Figure S1, Figure S2, and Figure S3 in Additional file 1). The first column shows the performance of algorithms according to five criteria, AUC, F1-score, FPR, Recall, and Precision. The second column represents the AUC-Median, F1-Median, FPR-Median, Recall-Median, and Precision-Median. The third column represents the AUC-IQR, F1-IQR, FPR-IQR, Recall-IQR, and Precision-IQR, from up to down. IQR values were used to represent the stability of the corresponding algorithm. Figure S1 illustrates the performance of 27 small data sets, Figure S2 shows the result of 4 medium data sets, and Figure S3 represents 12 large data sets (see Additional file 1). \subsubsection*{Benchmarks for Each Classifier in Small Data Sets} In the first part, the performance of 13 supervised algorithms was analyzed in 27 real data sets with relatively small sample sizes from Conquer study \cite{Soneson2018} used for intra-data set evaluation. The studied data sets involved relatively typical-sized scRNA-seq data sets with 24 balanced data sets and 3 unbalanced data sets (see Table S1 in Additional file ). The performance of 13 algorithms (ElasticNet with and without interactions, LDA, NB, SVM, KNN, Tree, XGB, and five ensemble algorithms) considering AUC, F1-score, and FPR were shown in Fig.\ref{fig1}. In Fig.\ref{fig1}\textbf{a}, each box contains 2700 scores, one score represents one value of each experiment per data set. Overall, the Fig.\ref{fig1} shows the better performance of ElasticNet with interactions as linear algorithms compared to other algorithms regarding the AUC, F1-score, and FPR. Considering the Figure S1 (see Additional file 1), the Recall of ElasticNet also was considerably better than other non-ensemble algorithms. However, the five ensemble algorithms had a higher precision than non-ensemble algorithms (see Figure S1 in Additional file 1). As shown in Fig.\ref{fig1}\textbf{a}, the median AUC values of linear algorithms for ElasticNet with or without interactions, LDA, NB, and SVM, were over 0.987. In approximately all 27 small data sets, the median AUC values of Tree algorithms, as non-linear algorithms, were 0.967 for the Tree and 0.979 for the XGB, a higher than the KNN algorithm, with 0.966. Thus, in small data sets, the linear algorithms performed better than non-linear ones, mainly when AUC was considered the criterion. We also used each criterion's IQR values to represent the stability of algorithms. Details were shown in Figure S1 (see Additional file 1 ). The performance of XGB was better than Tree in both performance and stability. Among the five ensemble algorithms, the two ensemble methods weighted by AUC and F1-score played a specific role in improving the results. The median AUC values for the ensemble algorithms were approximately the same, over 0.990. According to the outcomes, in small data sets, ElasticNet with interactions by the highest AUC and lower AUC-IQR was selected as the best single method. Also, this algorithm had the best performance considering F1-score and FPR. Fig.\ref{fig1}\textbf{b} shows the pair-wise comparison between the classification algorithms of each algorithm and the best selected single method (ElasticNet with interactions) under each criterion. There were significant differences among the performances of other algorithms and ElasticeNet with interactions as the best method that approved the preferences of ElasticNet. Moreover, considering AUC and F1-score criterion, interactions significantly improved the performance of ElasticNet without interactions. According to single methods, LDA, NB, SVM, Tree, and XGB algorithms performed significantly worse than ElasticNet with interactions. To sum up, the investigation of the performance of 13 algorithms revealed that ElasticNet with interactions is the most practical method in small data sets. Moreover, ensemble-weighted.AUC and ensemble-weighted.F1 can be considered as the following useful methods, but not as good as ElasticNet with interactions. In comparing linear and non-linear algorithms, the linear algorithms, including ElasticNet without interactions, ElasticNet with interactions, LDA, NB, and SVM, perform better than the non-linear algorithms, and ensemble algorithms weighted by F1-score and AUC have approximately better performance among all ensemble algorithms. \subsubsection*{Benchmarks for Each Classifier in Medium data sets} In the second part of the classification benchmarks, we studied the 4 medium data sets from Packer et al. comprised less than 1000 samples per label (Additional file 3: Table S ). The results helped to assess how well the supervised algorithms perform in the medium data sets. Overall, the Fig.\ref{fig2} confirmed the better performance for linear algorithms, ElasticNet with interactions and NB, rather than the non-linear algorithms and the ensemble algorithms. As shown in Fig.\ref{fig2}\textbf{a}, the performance of ElasticNet with interactions was still better than ElasticNet without interactions considering AUC. In order to the Additional file 1: Figure S2, we also detected that the stability of ElasticNet with interactions was higher than others. But under F1-score and FPR criteria, the NB was the best single method with median values of 0.994 and 0.010, respectively. The Recall of ElasticNet and NB were also considerably better than others. Therefore, in Fig.\ref{fig2}\textbf{b}, we have marked the algorithm names under the F1-score and FPR standards in the brackets of the coordinate axis. According to the performance of ensemble algorithms, ensemble-weighted.AUC and ensemble-addition.F1, under AUC, F1-score, precision, and recall criteria had better performance than the other three ensemble algorithms. The results approved that, the performances of the two ensemble algorithms, ensemble-weighted.AUC and ensemble-addition.F1, had no significant preference than the best non-ensemble methods under AUC and F1-score. Thus, Fig.\ref{fig2}\textbf{a} reveals that ElasticNet with interactions performed the best under the AUC criterion, and NB had the best performance under FPR and F1-score. Moreover, ensemble-weighted.AUC and ensemble-addition.F1 were the following useful methods. As shown in Fig.\ref{fig2}\textbf{b}, under the AUC criteria, the p-value of ensemble-weighted.F1 was 0.278, ensemble-weighted.AUC was 0.283, and ElasticNet without interactions was 0.095, which presented no significant differences between these algorithms and the AUC of ElaticNet. When F1-score and FPR were considered, NB performed slightly better. The performance of NB was significantly better than all other methods, with a p-value of almost zero. The same results were achieved under the F1-score criterion for ensemble-weighted.F1 and ensemble-weighted.AUC that approved those ensemble methods had approximately the same performances in medium data sets. To sum up, in medium data sets, ElasticNet with interactions seems to be more practical than others under AUC criteria. NB is the best algorithm under F1-score and FPR. The ensemble-weighted.F1 and ensemble-weighted.AUC methods can also be applied as the following suitable methods. \subsubsection*{Benchmarks for Each Classifier in large data sets} In the third part of the classification benchmarks, 12 filtered data sets applied using Packer et al.’s data sets, different from the sample size of the medium data sets, generated the number of each type of cell over 1000 samples per label, ranged from 1732 to 25875, as described in Table S3 (see Additional file 1) Fig.\ref{fig3} shows the outcomes of performance for 10 algorithms (ElasticNet, LDA, NB, Tree, XGB, and five ensemble algorithms) in large data sets, three algorithms (KNN, SVM, and ElasticNet with interactions) set aside because of long computation time. The results exposed XGB had the best performance than other single methods. Ensemble-weighted.F1 performed the best among the five ensemble algorithms under AUC, F1-score, FPR, and Recall. In terms of stability (see Additional file 1: Figure S3), the XGB, under AUC and FPR criteria, was stable but ensemble-weighted.F1 had the best stability under F1-score. Considering the Figure S3 (see Additional file 1), the Recall of XGB was also better than others. However, XGB and ensemble-weighted.F1 had the same median value of precision. In more details, as shown in Fig.\ref{fig3}\textbf{a}, the results show that the median value of AUC for XGB was 0.999, which was higher than LDA. If the parameters of ElasticNet were set the same as medium and small data sets, it would cause the computation time to take too long, so we adjusted the parameters of ElasticNet in the large data sets. Overall, in Fig.\ref{fig3}\textbf{a}, by considering AUC, F1-score, and FPR criteria, the XGB had the best performance, while in small data sets, XGB was not a practical method. Also, the results for ElasticNet comparing to small and medium data sets dropped from 1.000 and 0.997 to 0.993 under AUC criteria, and the AUC for ElasticNet in the large data sets was at least 0.425. This situation caught our attention that described further in the section discussion. This outcome led to select XGB, in large data sets, as the best single method for comparison with the ensemble and non-ensemble methods as displayed in Fig.\ref{fig3}\textbf{b}. Considering Fig.\ref{fig3}\textbf{b}, under the AUC and F1-score criteria, there were significant differences between the five ensemble algorithms and the best single method (XGB), the p-value was approximately zero, but, under FPR criteria, there was no significant difference among them. Thus, the other algorithms were significantly worse than the best single one (XGB), under AUC and F1 criteria, with p-values less than 0.05. ElasticNet, LDA, NB, and Tree algorithms were worse in single methods than XGB with p-values of less than 0.05. To sum up, the investigation of the performance of 10 algorithms revealed that XGB is the most practical method for large data sets. Also, in large data sets, ensemble-weighted.F1 can also be used as an appropriate method. \subsubsection*{Computation Time} We organized the computation time of each algorithm on three different data sets. For details, please refer to Table \ref{Table5}. Each column represents a different algorithm, and the rows represent different data sets. The value refers to the computation time of an algorithm on a specific data set. We annotated the sample size of the data sets in Table \ref{Table5}. Underline illustrated the maximum speed. In 27 small data sets, as shown in Table \ref{Table5}, it confirmed that SVM needed a longer time. Table \ref{Table5} displays when the sample size of the data increased to the medium-sized data sets, ElasticNet, KNN, and SVM performance slowed down. The values of computation time for the three algorithms were approximately 3.5 times, 24 times, and 10.6 times longer than the computation time of small data sets. By adding cross-validation to the medium data sets, SVM took a longer computation time, the average computation time was 6617.672 seconds. This result was similar to the small data sets, as shown in Table \ref{Table5}. Also, LDA and NB required short computation times, the average computation time of which were 11.570 and 21.369 seconds, respectively. When the amount of data increased to large data sets, the computation time of Tree grew little compared to KNN. Considering each algorithm computation time, KNN occupied too much memory in the computation time of large data sets. Therefore, we could not commonly compare these time-consuming and labor-intensive algorithms, ElasticNet, KNN, and SVM. Hence, we adjusted the parameters of ElasticNet for large data sets. In the large data set, we calculated the computation time of 5 algorithms: the adjusted ElasticNet, LDA, NB, Tree, and XGB (see Table \ref{Table5}). The average computation time of XGB, as the best single method in large data sets, was 2803.485 seconds. \subsection*{Gene Selection} The dimensions of gene variables in the scRNA-seq data sets were large. When we implemented the classification prediction, some algorithms automatically made gene selection for data sets. Hence, we studied whether there was a particular relationship between gene selection performance and classification prediction performance. Therefore, we used four algorithms, NB, Tree, XGB, and ElasticNet, suitable for gene selection, using the three simulated data sets provided by Soneson et al. \cite{Soneson2018} (Please see section methods for more details). We set different seeds in each round for each data set and performed gene selections 100 times on 100 subsets with 70$\%$ of cells. Then, the results were compared with the genes in the real data sets, GSE45719, GSE74596, and GSE60749-GPL13112 (Additional file 5: Table S ), and the final evaluation results were obtained. Fig.\ref{fig4} displays the AUC values of the four algorithms, NB, Tree, XGB, and ElasticNet, for gene selection in all experiments of three data sets. We marked the name of the data sets above Fig.\ref{fig4}. In each box of Fig.\ref{fig4}, 100 points show the 100 subsets. Considering the AUC criteria, as shown in Fig.\ref{fig4}, the median value of AUC for the four algorithms on the simulated data set of GSE60749-GPL13112 was approximately 0.500. In the other two data sets, the median value of the AUC for ElasticNet was about 0.711 and 0.637, which revealed better gene selection than those three algorithms. \section*{Discussion} This study evaluated and compared the classification performance in various data sets of different sizes and each algorithm's computation time. 27 Conquer real data sets proposed by Soneson et al. \cite{Soneson2018} were used for classification as small data sets, as shown in Table S1 (see Additional file 2 , and 4 data sets presented by Packer et al. \cite{Packer2019}, as shown in Table S2 (see Additional file 3 which were considered medium data sets. The 12 large data sets presented by Packer et al. \cite{Packer2019} were also applied for classification, as shown in Table S3 (see Additional file 4 . We also investigated gene selection. Three simulated data sets presented by Soneson et al. \cite{Soneson2018} were used for gene selection, as shown in Table S4 (see Additional file 5) In this paper, we conducted some cross-validation experiments and gene selection, provided detailed information on data sets, compared the performance of various algorithms in many aspects such as performance, stability, computation time, and gene selection, and finally summarized each algorithm's performance on different sizes of data sets. According to outcomes, ElasticNet with interactions was more suitable for processing small and medium scRNA-seq data. However, considering the AUC criterion, interactions improved ElasticNet in small and medium data sets. There were significant differences between ElasticNet with and without interactions in small data sets. When ElasticNet was used in large data sets with and without interactions, they acted slightly inappropriate because of the non-convergence issue. Hence, we adjusted the parameters, but they had a long computation time. Therefore, we only studied ElasticNet and ignored ElasticNet with interactions. Moreover, NB can also be selected as the practical algorithm in medium data sets if F1-score and FPR be considered. The results in large data sets approved that if the computation time is ignored, then XGB can be regarded as the best algorithm. Moreover, the study illustrated that the ensemble algorithms were not always better than the classic linear ones. We also found that the integrated methods did not significantly improve the performance of the single algorithms. \subsection*{Classification on small data sets} In small data sets, the performance of 13 algorithms was evaluated and compared using five criteria, AUC, F1-score, FPR, Precision, and Recall. Considering AUC as the standard (see Fig.\ref{fig1}). We observed that ElasticNet, ElasticNet with interactions, SVM, and LDA performed well, but LDA was unstable. The computation time of the SVM was too long. ElasticNet with interactions was a little more suitable for classification than ElasticNet without interactions in terms of performance and stability. The results showed a higher median value of AUC and a lower value of AUC-IQR for ElasticNet with interactions. Thus, ElasticNet with interactions can be considered as the best linear algorithm for small data sets. XGB performance was better than Tree,considering to the value of AUC and AUC-IQR. The ensemble algorithms can also improve the overall generalization ability when each base learner's performance was more significant than 0.5. Therefore, it is understandable that some kinds of ensemble strategies perform better than others. Although, we found no significant better performance for ensemble methods compared to single methods. SVM performed poorly when F1-score and FPR were considered as the standard. It seems that this was because of calculating both performance and stability in those criteria. Also, SVM performed very slowly. It may cause that the algorithm involves the selection of several optimal parameters, so this result is logical. Both LDA and NB were simple linear classifiers with fast computation time, and their classification performances were good. ElasticNet and ElasticNet with interactions took longer than LDA, and the median value of computation time was even seven times more than NB but eleven times less than SVM. Like SVM, ElasticNet and ElasticNet with interactions were also needed to select the optimal parameters to decrease the computation time. But such computation time can be accommodated on small data sets. Therefore, we suggest applying ElasticNet with interactions with high prediction performance and stability for small data sets. \subsection*{Classification on medium data sets} On medium data sets, we compared the performance of 13 algorithms. According to AUC as the standard, ElasticNet with interactions performed well with higher performance and stability, similar to the small data sets. LDA and SVM did not perform well on these four data sets. The reason can be to focus on only 4 data sets, which may happen by chance. XGB was also better than Tree in both performance and stability. Also, two ensemble algorithms, ensemble-weighted.AUC and ensemble-weighted.F1, performed better. However, the two ensemble algorithms were not significantly different from the single algorithm (ElasticNet with interactions) under AUC. Considering the median value of AUC, KNN still performed poorly than others. We found KNN is not suitable for processing scRNA-seq data because of taking up more memory. As the number of samples increased, the amount of calculation of KNN also rose. Hence, insufficient memory during the calculation process happened. Under the F1-score and FPR standard, the performance of NB was more prominent, better than other algorithms. The performances of other algorithms were similar as under the AUC criterion. Overall, according to each criterion, the linear algorithms continued to overcome the non-linear algorithms in medium data sets. Therefore, we suggest that ElasticNet with interactions and NB are better to apply in medium data sets because of better performance and stability under each criterion and accommodate consumption time. \subsection*{Classification on large data sets} In large data sets, the performance of 10 algorithms was compared (see Fig.\ref{fig3}). Using AUC as the standard, the performance and computation time of ElasticNet, LDA, and SVM took longer than others. Thus, SVM was removed, and the parameters in ElasticNet were modified. We found XGB is the best single algorithm in large data sets. ElasticNet with interactions was not considered in the final results because of its long computation time. However, we found the performance was not suitable due to some non-convergence issues. It is worth noting that ElasticNet still performed well in the convergence experiments. Therefore, ElasticNet may also be the right choice after solving the non-convergence problem. Two ensemble algorithms performed the best as they did in small data sets. The core idea of the KNN algorithm is that if most of the K-Nearest samples in the feature space of a sample belong to a particular category, the sample also belongs to that category and has the samples' characteristics. Hence, when the size of data sets increases, more computation is needed \cite{Salvador-Meneses2019}. In this paper, KNN was not considered due to out-of-memory issues. Overall, according to three criteria, AUC, F1-score, and FPR, the performance of XGB was almost prominent, even more than other algorithms. Thus, we suggest XGB for large data sets because of better performance and stability. From a computation time point of view, KNN and SVM took a long computation time. Therefore, they were not under our consideration. The computation time problem of ElasticNet has been improved compared to when the parameters were not adjusted, but it was still long (please check Table \ref{Table5}). Hence, the results illustrated that the non-convergence issue leads to more extended computation. Moreover, the computation time of XGB is higher than linear classifiers (LDA and NB) because there is a complicated calculation in XGB. This article investigated whether there is a correlation between ``perfect separation" and ``model non-convergence." In this case, we collected statistics on convergence and perfect separation in each round of 1,000 experiments on 12 large data sets. The result revealed that over 69$\%$ of the experiments showed ``non-convergence and perfect separation" or ``convergence without perfect separation." Therefore, we claim that there is a relationship between ``perfect separation" and ``model non-convergence." Moreover, combined with the computation time and performance, we claim LDA and XGB are more suitable for large data sets because of faster computation time and better performance. Finally, we discovered that the linear algorithms were better than the non-linear ones to classify different-sized data sets. Among all, ElasticNet with interactions performed well on small and medium data sets. However, NB also was practical in medium data sets, and XGB worked better in large data sets. Also, there was no preference in the performance of ensemble and single methods. \subsection*{Gene selection on simulated data sets} In this study, the 100 subsets in three simulated data sets, provided by Soneson et al.\cite{Soneson2018}, were used to avoid a certain level of randomness. Those 100 random subsets were received by 100 times of experiments. The selected genes were compared with the real genes of real data sets. The results revealed ElasticNet performed the best (please see Fig.\ref{fig4}). ElasticNet achieves feature selection by regulating non-relevant predictors' coefficients to zero \cite{Xuekui2020} and enhanced the gene selections on scRNA-seq data. Thus, it was reasonable that it performed the best. \section*{Conclusions} In this paper, a comprehensive evaluation of supervised algorithms for the classification of scRNA-seq data was presented to assess the performance of those algorithms in different sizes of data sets. Several algorithms were used, including i) ElasticNet, ii) ElasticNet with interactions, iii) LDA, iv) NB, v) SVM, vi) KNN, vii) Tree, viii) XGB and x) five ensemble algorithms based on the weights and votes given to the seven algorithms, ElasticNet, LDA, NB, SVM, KNN, Tree, and XGB. Enormous differences were determined in the performance of algorithms in response to changing the input features. The computation times of algorithms were considerably varied based on the number of cells, features, and the type of algorithms. According to the outcomes, ElasticNet with interactions had better performance for small and medium data sets, while XGB was suitable for large data sets. The gene selection performance of ElasticNet was perfect when comparing the genes selected by the four algorithms on the three simulated data sets with the genes in the actual data sets. The outcomes revealed that ensemble algorithms were not always superior to classical machine learning methods in performance and computation time. Also, the results approved that there were significant differences between ElasticNet with interactions than without interactions. We recommend ElasticNet with supervised learning classification interactions in small and medium data sets because it performs better than the other classifiers. Interactions improved the performance of ElasticNet significantly in small data sets. NB can be considered as a proper classifier for medium data sets as well. However, when the sample size of the data sets was large, XGB was more suitable. Although the computation time of XGB was slightly longer, the performance was relatively higher than other methods. There was no reason to encourage using ensemble algorithms while there was no application priority other than single methods. \begin{backmatter} \section*{Acknowledgements} This research was enabled in part by support provided by WestGrid (www.westgrid.ca) and Compute Canada (www.computecanada.ca). \section*{Funding This work was supported by the Natural Sciences and Engineering Research Council Discovery Grants (RGPIN‐2017‐04722 PI:XZ), the Canada Research Chair (950‐231363, PI:XZ). \section*{Abbreviations Not applicable \section*{Availability of data and materials 27 small data sets used in this article can be obtained from \url{https://github.com/markrobinsonuzh/conquer}, and the medium and large data sets from GSE126954 can be obtained from \url{https://www.ncbi.nlm.nih .gov/geo/query/acc.cgi?acc=GSE126954}, the simulation data sets based on GSE45719, GSE74596, and GSE60749-GPL13112 can be obtained from \url{http://imlspenticton.uzh.ch/robinson_lab/conquer_de_comparison/} \section*{Ethics approval and consent to participate Not applicable. \section*{Competing interests} The authors declare that they have no competing interests. \section*{Consent for publication Not applicable. \section*{Author's contributions} Li Xing and Xuekui Zhang contributed to the study concept and design. Xiaowen Cao contributed to data processing, data analysis, and preparation of the first draft. All authors have developed drafts of the manuscript, approved the final draft of the manuscript. Xuekui Zhang supervised this project. \bibliographystyle{bmc-mathphys}
\section{Introduction} \label{s:intro} A dynamic treatment regime (DTR) is a sequential design that seeks to account for patient heterogeneity based on their response to treatments and their covariate history evolving over time \citep{chakraborty2013statistical, kosorok2015adaptive}. A DTR is a set of decision rules that maps individual characteristics to a treatment option at each decision point. In this paper, we consider estimating the mean outcome under a prespecified DTR in the presence of partial compliance. The estimation of the mean outcome under a DTR has been studied extensively, leading to a wide range of estimators. These estimators include: inverse probability treatment weighted based methods \citep{robins1997causal, robins2000marginal, murphy2001marginal,van2007causal, bembom2008analyzing, toh2008causal}; double robust estimators \citep{robins1994estimation, orellana2010dynamic,ertefaie2016identifying}; G-computational formula for dynamic regime \citep{robins1986new}; and targeted maximum likelihood estimators \citep{rosenblum2010targeted,luedtke2016statistical}. The proceeding methods perform intention-to-treat analyses that ignore the individuals compliance pattern to the assigned treatments. However, in the presence of partial compliance, such analyses only estimate the effect of randomization to a treatment sequence and not the actual treatment effect that is of main interest. In fact, intention-to-treat analyses are often biased toward the null effect and more importantly not reproducible due to the potential differential compliance behavior in real-world settings \citep{lin2008longitudinal}. To go beyond the intention-to-treat analyses, instrumental variable based methods have been proposed for constructing an optimal regime and estimating the corresponding mean outcomes \citep{cui2020semiparametric, qiu2020optimal,qi2021proximal} . However, these approaches apply only to all-or-none compliance values (i.e., binary) and are not applicable to settings with two (or more) active treatment options at each decision point, which is often the case in pharmacoepidemiologic studies and multi-stage randomized trials \citep{cheng2006bounds, swanson2015selecting, ertefaie2016sensitivity, ertefaie2016selection}. Adjusting for partial compliance using standard techniques is subject to post-treatment stratification bias and lack of causal interpretibility of the results. Principal stratification has been widely used to avoid such problems by classifying individuals into latent classes according to the joint potential compliance values instead of adjusting only for the observed ones \citep{frangakis2002principal}. \cite{sjolander2009sensitivity} proposed to estimate a principal casual effect by dichotomizing the partial compliance values. This approach, however, can lead to loss of important information due to the dichotomization, and can suffer from the dependence on the threshold of dichotomization. \cite{bartolucci2011modeling} proposed a semi-parametric approach; a parametric model for the outcome and a non-parametric copula based model for the intermediate variables. Although, the latter approach does not require dichotomizing the partial compliance values, the assumption of a parametric family may not be flexible enough for possibly complex distributions that involves high variability, outliers or skewness \citep{robins2008estimation}. Moreover, the copula method cannot be trivially extended to accommodate inclusion of covariates. To overcome these issues, \cite{schwartz2011bayesian} proposed a Bayesian semiparametric approach that involves a flexible non-parametric estimation of the joint distribution of the potential compliances using a Dirichlet process mixture (DPM). \cite{kim2019bayesian} built on their work, and proposed a similar non-parametric Bayesian approach to accommodate multiple post treatment variables (i.e., mediators) that are measured contemporaneously. The existing principal stratification based methods are only applicable in single time point treatment settings (e.g., standard randomized clinical trials). The key challenge in time-varying treatment settings (e.g., multi-stage trials) is that the potential compliance values will also be time-varying. Recently, \cite{artman2020adjusting} generalized the semiparametric approach in \cite{schwartz2011bayesian} to a multi-stage randomized trials setting. However, their method is somewhat restrictive. First, the latter assumes a finite dimensional model for conditional expectation of the potential outcome given the potential compliances and the baseline covariates, which may not be flexible enough to capture the true outcome model. Second, their proposed method relies on Gausian error distribution. Third, they imposed some modeling constraints to make the outcome regression coefficients identifiable. We propose a non-parametric Bayesian method that extends the existing literature in principal stratification to time-varying treatments and potential compliance settings. A Bayesian approach allows us to treat the missing potential compliances as unknown parameters, and impute them using samples from their posterior distributions. A non-parametric approach lends itself to weak assumptions on the identifiability and form of the conditional outcome models, thus avoiding the most challenging and cumbersome issues in \citet{artman2020adjusting}. Briefly, our approach for a two-stage setup is summarized as follows. First, we model the marginal distributions of the Stage-1 observed compliances using a DPM, and then use a Gaussian copula to link the marginals to a joint distribution of the Stage-1 potential compliances. Secondly, we use a DPM to model the Stage-2 potential compliances conditionally on the Stage-1 potential compliances, baseline covariates, Stage-1 treatment, and covariates measured just before Stage-2. Then we specify a flexible DPM model for the joint distribution of the potential outcome, potential compliances and the baseline covariates. Because the complete set of potential compliances are never observed together, we use a data-augmentation approach to impute the unobserved potential compliances based on the joint distribution of the potential compliances. The proposed flexible modeling strategy of the conditional distribution of the potential outcome leads to a robust estimator that does not impose any functional form or distributional assumption on the potential outcome model. The rest of the paper is organized as follows. Section \ref{s:engage} describes the motivating dataset this work is based on. Section \ref{s:notation} introduces the basic setup and notations to be used in the paper, and Section \ref{S:modeling} describes the modeling framework. In Section \ref{s: posterior}, we discuss the major steps of the Markov Chain Monte Carlo (MCMC) algorithm used to perform the posterior inference. In Section \ref{s:simulation}, we perform an extensive simulation study to demonstrate the efficacy of our method, and discuss the results. In Section \ref{s:real}, we apply our method on the real data and determine the set of best design embedded dynamic treatment regimes for various compliance values. We close the paper with a brief discussion about the findings of our paper in Section 8. \section{ENGAGE study} \label{s:engage} This work is motivated by the Adaptive Treatment for Alcohol and Cocaine Dependence (ENGAGE) study \citep{mckay2015effect}. The purpose of this study is to assess the effect of allowing patients who failed to engage in or dropped out of intensive outpatient programs (IOP) to choose their subsequent treatment options. In ENGAGE trial, all patients were first enrolled in the IOP, which required them to attend 3 sessions per week. After two weeks, patients who failed to attend their session at Week 2 were considered non-engaged and they were randomized to one of two motivational interviewing (MI) interventions. Patients in the first group were recommended to engage in IOP (MI-IOP), and the second group was offered a choice for treatment (referred as patient choice or MI-PC). After 8 weeks, the non-engagers (defining as not engaging in any IOP sessions in Weeks 7 and 8) in the first group were re-randomized to either MI+PC or no further care (NFC), while the engagers in the second group received NFC. In this study, compliance is defined as the fraction of sessions attended. Thus, there are four potential compliances corresponding to MI-IOP Stage-1, MI-PC Stage-1, MI-PC Stage-2 for MI-IOP Stage-1, and MI-PC Stage-2 for MI-IOP Stage-1, respectively. There are four design embedded DTRs (EDTRs), and they are defined below: \begin{enumerate} \item Start with MI-IOP. For engagers, offer NFC at the 8-week point, and for non-engagers, offer MI+PC. \item Start with MI-IOP. For both engagers and non-engagers at the 8-week point offer NFC. \end{enumerate} The other two are similar, with the MI-IOP in the first stage replaced by MI-PC. The aim is to determine the optimal EDTR, which would help the physicians know whether permitting the patients to choose their treatment option is better than leaving it up to the physicians. \section{Notations, Formulation and Assumptions} \label{s:notation} We focus on a two-stage study where binary treatment decisions are made at each time point. Suppose we observe $n$ independent, identically distributed trajectories of $$ (\bm{X}_0,A_1,D_{A_1}^{\text{obs}},S,\bm{X}_1,A_2,D_{A_2}^{\text{obs}},Y) \sim P_0.$$ The vector $\bm{X}_0 \in \mathcal{X}_0 \subset \mathbbmss{R}^{m_1}$ consists of all available baseline covariates measured before treatment at the first decision point $A_1\in \{-1,1\}$. Let $S\in \{0,1\}$ be the response indicator to the first stage treatment where $S=1$ for responders. The vector $\bm{X}_1 \in \mathcal{X}_1 \subset \mathbbmss{R}^{m_2}$ consists of all available intermediate covariates measured before treatment at the second decision point $A_2\in \{-1,1\}$. We assume that responder individuals (i.e., $S=1$) do not get the second stage treatment (i.e., continue with the first stage treatment). Also, $D_{A_1}^{\text{obs}}\in [0,1]$ and $D_{A_2}^{\text{obs}}\in [0,1]$ represent the level of observed compliance to the first and the second stage treatments. The observed outcome $Y \in \mathbbmss{R}$ (measured after $A_2$) is assumed continuous. Let $D_1$ and $D_2$ denote the potential compliance values under $A_1=1$ and $A_1=-1$, respectively. Similarly, $D_3$ and $D_4$ denote the potential compliance values under $A_2=1$ for $A_1=1$, and $A_2=1$ for $A_1=-1$, respectively. Hence, $D_{A_1}^{\text{obs}} = 0.5(A_1+1) D_1 + 0.5(1-A_1)D_2$, and $D_{A_2}^{\text{obs}} = 0.5(A_1+1) D_3 + 0.5(1-A_1)D_4$. In the context of ENGAGE trial, $D_{1}$ and $D_{2}$ denote the potential compliances to MI-IOP Stage-1 $(A_{1}=+1)$ and MI-PC Stage-1 $(A_{1}=-1)$, respectively. The potential compliances to MI-PC Stage-2 $(A_{2}=+1)$ for individuals assigned to MI-IOP Stage-1 $(A_1=+1)$, and MI-PC Stage-1 $(A_1=-1)$ are denoted as $D_{3}$ and $D_{4}$, respectively. We do not consider any potential compliance value for those assigned to NFC at Stage 2 because individuals who are assigned to this treatment option do not have access to the other Stage-2 treatment option. We also define two types of potential outcomes. Specifically, let $Y_k$ denote the potential outcome of the $k$th treatment sequence, for $k=1,\dots,K$, and $Y^{(l)}$ denote the potential outcome corresponding to the $l$th embedded DTR, for $l=1,\dots,L$. In ENGAGE trial, there are four embedded DTRs (i.e., $L=4$) and six treatment sequences (i.e., $K=6$), which are described in Table \ref{tab1}. \begin{table}[h] \centering \small \caption{Observed and latent potential compliances for 6 treatment sequences in ENGAGE study} \begin{tabular}{cccc} $k$ & Treat seq & observed compliance & latent compliance\\ \hline 1 & $A_1=+1, S=1$ & $D_1$ & $D_2$\\ \hline 2 & $A_1=+1, S=0, A_2=+1$ & $D_1,D_3$ & $D_2$\\ \hline 3 & $A_1=+1,S=0, A_2=-1$ & $D_1$ & $D_2,D_3$\\ \hline 4 & $A_1=-1,S=1$ & $D_2$ & $D_1$\\ \hline 5 & $A_1=-1, S=0, A_2=+1$ & $D_2, D_4$ & $D_1$\\ \hline 6 & $A_1=-1, S=0, A_2=-1$ & $D_2$ & $D_1, D_4$ \end{tabular} \label{tab1} \end{table} Our target parameter is the \textit{principal causal effect}, defined as $\text{PCE}^{(l)}(\bm{D},\bm{X}_0)=E(Y^{(l)}\vert \bm{D},\bm{X}_0)$ where $\bm{D}=(D_1,D_2,D_j)$, $j=3,4$. Using Robins' G-computation formula \citep{robins1986new}, for $l=1,\dots,L$, the principal causal effects can be represented as \begin{align}\label{eq1} \begin{split} \text{PCE}^{(l)}(\bm{D},\bm{X}_0)=&E(Y\vert A_1=a_{1l}, S=1, D_1,D_2,\bm{X}_0)P(S=1\vert A_1=a_{1l},D_1,D_2,\bm{X}_0)\\ &+E(Y\vert A_1=a_{1l},A_2=a_{2l}, S=0, \bm{D},\bm{X}_0)P(S=0\vert A_1=a_{1l},D_1,D_2,\bm{X}_0), \end{split} \end{align} where $a_{1l}$ and $a_{2l}$ are the Stage-1 and Stage-2 treatment options that are consistent with the $l$th embedded DTR. The conditional models in (\ref{eq1}) cannot be fit because, for each subject, one or more potential compliances are latent. We impute the missing potential compliances using the Bayesian non-parametric model described below. To identify the principal causal effects, we need to impose the following assumptions. \begin{assumption}(Stable unit treatment values assumption). The potential outcome for any unit is not affected by the treatment assignment of other units. \end{assumption} \begin{assumption}(Ignorable treatment assignment). Given the baseline covariates $\bm{X}_0$, the potential outcome and the compliances are independent of the treatment assignments, i.e. $Y^k\perp (A_1,A_2)\vert \bm{X}_0$, $\{D_1,D_2\} \perp A_1 \vert \bm{X}_0$, $\{D_3,D_4\} \perp A_2 \vert \{\bm{X}_0, A_1, D_{A_1}^{obs},\bm{X}_1$\}. \end{assumption} \begin{assumption}(Correctly specified copula model). The joint distribution of the potential compliances conditional on the covariates is a Gaussian copula. \end{assumption} Assumption 1 is the no interference assumption which implies that, for a given individual, the potential outcomes and compliance values depend only on the treatment values for that specific individual. Assumption 2 allows us to model the potential outcomes and compliance values using the observed data. Assumption 3 is required to construct the joint distribution of potential compliance values using the observed marginal distributions. \section{Modeling} \label{S:modeling} \subsection{Model for the potential compliances} We begin by specifying models for the Stage-1 marginal compliances. Because the compliances are between $0$ and $1$, we use a DPM of truncated Gaussian regressions. For marginals of $D_1$ and $D_2$, the DPM is specified in the following way: \begin{align*} D_{ji}\vert \bm{X}_{0i}=\bm{x}_{0i}\sim & \int \mathrm{N}(\beta_{0j}+\bm{x}_{0i}^T\bm{\beta}_{j},\sigma_j^2)_{[0,1]}\mathrm{d}G_j(\beta_{0j},\sigma_j^2),\ i=1,\dots,n_j,\ j=1,2,\\ G_j\sim & \mathrm{DP}(\zeta_j,\mathcal{G}_j), \end{align*} where $n_j$ is the number of observations for which $D_j$ is observed, and $\mathrm{N}(\mu,\sigma^2)_{[a.b]}$ denotes the normal distribution with mean $\mu$ and variance $\sigma^2$ truncated in $[a,b]$. Note that the mean of the kernel has the form of a linear regression on the baseline covariates $\bm{X}_0$. For simplicity, the mixing is done only over the intercept and variance parameters, and we put a Gaussian prior $\mathrm{N}_P(\bm{\mu}_{\bm{\beta}_j},\Sigma_{\bm{\beta}_j})$ on the regression coefficient parameters $\bm{\beta}_{j}$. The base measure $\mathcal{G}_j$ has been taken as the product of a normal and an inverse gamma distribution, which we can write as $\mathrm{N}(\bm{\mu}_j,S_j)\mathrm{IG}(a_j,b_j)$. Next, we model the second stage observed compliances $D_3$ and $D_4$ conditionally on $D_1$, $D_2$, baseline covariates $\bm{X}_0$, and covariates $\bm{X}_1$ measured just before the second stage (i.e., time-varying covariates). We specify the following DPM models for $D_3$ and $D_4$, \begin{align*} D_{3i}\vert D_{1i}=d_{1i}, \bm{X}_{0i}=\bm{x}_{0i},\bm{X}_{1i}=\bm{x}_{1i}\sim \int\mathrm{N}(\beta_{03}+\gamma_3d_{1i}+\bm{x}_{0i}^T\bm{\beta}_3+\bm{x}_{1i}^T\bm{\beta}_3^\prime, \sigma_3^2)_{[0,1]}\mathrm{d}G_3(\beta_{03},\sigma_3^2),\\ D_{4i}\vert D_{2i}=d_{2i}, \bm{X}_{0i}=\bm{x}_{0i},\bm{X}_{1i}=\bm{x}_{1i}\sim \int\mathrm{N}(\beta_{04}+\gamma_4d_{2i}+\bm{x}_{0i}^T\bm{\beta}_4+\bm{x}_{1i}^T\bm{\beta}_4^\prime,\sigma_4^2)_{[0,1]}\mathrm{d}G_4(\beta_{04},\sigma_4^2), \end{align*} with $G_j\sim \mathrm{DP}(\zeta_j,\mathcal{G}_j)$, $j=3,4$. The treatment sequences for which $D_3$ is observed, also have $D_1$ observed, but $D_2$ latent. Therefore, we only include $D_1$ as a covariate for the marginal model of $D_3$. Similarly, we only include $D_2$, but not $D_1$ for the marginal model of $D_4$. We consider a normal prior for the regression coefficients $\gamma_3,\gamma_4,\bm{\beta}_3,\bm{\beta}_4,\bm{\beta}_3^\prime$, and $\bm{\beta}_4^\prime$. Finally, the joint distribution of $D_1$, $D_2$, $D_3$ and $D_4$ is modeled by linking the marginals together using a Gaussian copula of the form \begin{align*} F_{ D_1,D_2,D_3,D_4}(d_1,d_2,d_3,d_4)=\Phi_{4}[\Phi_1^{-1}\{F_{D_1}(d_1)\},\Phi_1^{-1}\{F_{D_2}(d_2)\},\Phi_1^{-1}\{F_{D_3}(d_3)\},\Phi_1^{-1}\{F_{D_4}(d_4)\}], \end{align*} where $F_D$ denotes the distribution function of $D$, and $\Phi_4$ is a 4-dimensional normal distribution with correlation matrix $R$. The joint distribution of the potential compliances cannot be fully identified, because $D_1$ and $D_2$ are never observed together, and neither are $D_3$ and $D_4$. Thus, no amount of data can uniquely estimate the correlation between $(D_1,D_2)$ and $(D_3,D_4)$. The information about the correlation between potential compliances is implicitly embedded in the $Y$ model where the potential compliances appear. This is evident in the compliance augmentation step in Section \ref{s: posterior}, where the distribution of the missing compliances are retrieved from the distribution of $Y$. The association information of $(D_1,D_2,D_3,D_4)$ and the $Y$ model can be complex, which highlights the importance of the proposed flexible Bayesian non-parametric model for potential compliances via the DPM models. Moreover, inference on $R$ needs careful attention because $R$ has to be positive definite. To provide an inference for the elements of $R$, we put a $\mathrm{U}(-1,1)$ prior on each of the off-diagonal elements in $R$. For posterior inference on $R$, we use a Metropolis-Hastings algorithm, and we choose a proposal distribution that respects this restriction. Details are described in Section \ref{s: posterior}. \subsection{Model for the potential outcome} To model the potential outcomes given the potential compliances and the baseline covariates for each of the six treatment sequences, we use a locally weighted mixture of Gaussian regression models by specifying a DPM model for the joint distribution of the potential outcome, potential compliances and the baseline covariates. The potential outcomes corresponding to sequences 2 and 3 may depend on $(D_1,D_2,D_3)$, and the potential outcomes corresponding to sequences 5 and 6 may depend on $(D_1,D_2,D_4)$. It is natural to assume that the potential outcomes among responders (sequences 1 and 4) to not depend on the second stage compliances $D_3$ and $D_4$. For responders, the conditional distribution of the potential outcome $Y_i$ is specified as \begin{align*} f_Y(y_i^k\vert D_{1i}=d_{1i},D_{2i}=d_{2i},\bm{X}_{0i}=\bm{x}_{0i})= \sum_{b=1}^\infty \psi_b^k\mathrm{N}(y_i,h_{1i},h_{2i},\bm{x}_{0i} \vert \mu_b^k,\Sigma_b^k), \end{align*} where $h_{ji}=\Phi_1^{-1}\{F_{D_j}(d_{ji})\}$, and $\psi_b^k=\xi_b^k/\sum_{l=1}^\infty \xi_l^k \mathrm{N}(H_{1i}=h_{1i},H_{2i}=h_{2i},\bm{X}_{0i}=\bm{x}_{0i}\vert \mu_{l,-1}^k,\\ \Sigma_{l,-1,-1}^k)$, for $k=1,4$. Here $\mu_{l,-1}^k$ denotes all elements of the mean vector $\mu_l^k$ except for $Y_i$ and $\Sigma_{l,-1,-1}^k$ denotes the submatrix of the joint covariance matrix $\Sigma_l^k$ formed by deleting the first row and first column. Moreover, $\xi_b^k={\xi_b^\prime}^k\prod_{h<b}(1-{\xi_h^\prime}^k)$ are the stick-breaking weights constructed from ${\xi_b^\prime}^k \sim \mathrm{Beta}(1,\alpha)$, for some $\alpha>0$. The definition of $\bm{H}=(H_1,H_2)$ justifies the use of a mixture of multivariate Gaussians for the joint distribution of $(Y,\bm{H},\bm{X}_0)$. For sequences 1 and 4, $D_2$ and $D_1$ have to be imputed, respectively. For $k=2,3$, i.e., for non-responders who were assigned to MI-IOP in Stage-1, the conditional distribution of the potential outcomes is modeled as \begin{align*} f_Y(y_i^k\vert D_{1i}=d_{1i},D_{2i}=d_{2i},D_{3i}=d_{3i},\bm{X}_{0i}=\bm{x}_{0i})=\sum_{b=1}^\infty \psi_b^k\mathrm{N}(y_i,h_{1i},h_{2i},h_{3i},\bm{x}_{0i}\vert \mu_b^k,\Sigma_b^k), \end{align*} with the notations carrying the same meaning. For the remaining sequences, i.e., $k=5,6$, we model the potential outcomes in a similar fashion, \begin{align*} f_Y(y_i^k\vert D_{1i}=d_{1i},D_{2i}=d_{2i},D_{4i}=d_{4i},\bm{X}_{0i}=\bm{x}_{0i})=\sum_{b=1}^\infty \psi_b^k\mathrm{N}(y_i,h_{1i},h_{2i},h_{4i},x_{0i}\vert \mu_b^k,\Sigma_b^k). \end{align*} Notice that, we do not include the time-varying covariates $\bm{X}_1$ in neither of the outcome models. The reason behind this is that in the definition of PCE in \eqref{eq1}, we are only interested in the conditional expectation of the causal effect given a principal stratum, not in the causal effect of the stratum itself. Thus, we should not adjust for the time-varying covariates in the outcome models. We use a Markov Chain Monte Carlo (MCMC) algorithm for the posterior inference. Imputation of the missing potential compliances and estimation of the potential compliances are connected together in each MCMC iteration (described in detail in Section \ref{s: posterior}). \subsection{Stage-1 response indicator model} We model $P(S=1\vert A_1,D_1,D_2,\bm{X}_0)$, i.e., the response probabilities to Stage-1 treatments, using a Bayesian non-parametric approach; i.e., a Dirichlet process mixture of logistic kernels. For $A_1=1$,we specify the following DPM model, \begin{align*} P(S_i=1\vert A_{1i}=1,D_{1i}=d_{1i},D_{2i}=d_{2i},\bm{X}_{0i}=\bm{x}_{0i})=\sum_{j=1}^\infty\omega^{(1)}_j\delta_{\lambda_{ij}^{(1)}}, \end{align*} where $\lambda^{(1)}_{ij} \sim \mathrm{Bernoulli}(p^{(1)}_{ij})$, with $\text{logit}(p^{(1)}_{ij})=\alpha^{(1)}_{j}+\beta^{(1)}_{1j}d_{1i}+\beta^{(1)}_{2j}d_{2i}+\bm{x}_{0i}^T\bm{\gamma}_{j}^{(1)}$, $i=1,\dots,N_1$ and $\omega^{(1)}_{j}=\omega_{jl}^\prime\prod_{m=1}^{j-1}(1-\omega_{ml}^\prime)$ are the stick-breaking weights constructed from $\omega_{ml}^\prime\overset{iid}{\sim}\mathrm{Beta}(1,\alpha)$. Here, $N_1$ denotes the number of observations with $A_1=1$. Also, $\alpha_1^{(1)},\alpha_2^{(1)},\dots, \overset{iid}{\sim}\mathrm{N}(1,1)$, $\beta^{(1)}_{11},\beta^{(1)}_{12},\dots\overset{iid}{\sim}\mathrm{N}(1,1)$, $\beta^{(2)}_{11},\beta^{(2)}_{12},\dots\overset{iid}{\sim} \mathrm{N}(1,1)$, and $\bm{\gamma}_1^{(1)},\bm{\gamma}_2^{(1)},\dots\overset{iid}{\sim} \mathrm{N}_{m_1}(\mathbf{1}_{m_1},\mathbf{I}_{m_1})$, where $\mathbf{c}_k$ denotes the vector of length $k$, and $\mathbf{I}_{k\times k}$ denotes the identity matrix of order $k\times k$. Similarly, for $A_1=-1$, we model the response probability as \begin{align*} P(S_i=1\vert A_{1i}=-1,D_{1i}=d_{1i},D_{2i}=d_{2i},\bm{X}_{0i}=\bm{x}_{0i})=\sum_{j=1}^\infty\omega^{(-1)}_j\delta_{\lambda_{ij}^{(-1)}}, \end{align*} with $\lambda_{ij}^{(-1)}\sim \mathrm{Bernoulli}(p_{ij}^{(-1)})$, and $\text{logit}(p^{(-1)}_{ij})=\alpha^{(-1)}_{j}+\beta^{(-1)}_{1j}d_{1i}+\beta^{(-1)}_{2j}d_{2i}+\bm{x}_{0i}^T\gamma_{j}^{(-1)}$, $i=1,\dots,N_2$, where $N_2$ is the number of observations for which $A_1=-1$. The stick-breaking weights $\omega_j^{(-1)}$ are constructed in a similar fashion as before, and $\alpha_j^{(-1)},\beta_{1j}^{(-1)},\beta^{(-1)}_{2j}$ and $\gamma_j^{(-1)}$ for $j=1,2,\dots$ are drawn from Gaussian distributions as before. The posterior inference for the response indicator model is done separately from the potential outcome estimation, and then are plugged in \eqref{eq1} for estimation of the EDTR. Note that, for $A_1=+1$, $D_2$'s are unobserved, and for $A_1=-1$, $D_1$'s are unobserved. We've already imputed the missing potential compliances in course of the estimation of potential compliances, and we use those values for estimation of the response probabilities as well. \section{Posterior inference} \label{s: posterior} The posterior inference consists of five major steps. The posterior inference for the DPM models using the truncation approximation \citep{ishwaran2001gibbs}, i.e., we truncate the stick-breaking weights at a large number $N$. One can choose the truncation level according to Theorem 2 in \cite{ishwaran2001gibbs}, which says that, for a $\mathrm{DP}(MG)$ process, $$ \Vert \mu_N-\mu_\infty\Vert_\infty\sim 4n\ \mathrm{exp}(-(N-1)/M), $$ where $\mu_N$ denotes the marginal density under the truncation $N$, and $\mu_\infty$ denotes its limit, with $n$ being the sample size. We follow \citep{kim2019bayesian} for hyperprior specifications. \begin{enumerate} \item[Step (1)] {\it Sampling parameters for the marginals of the Stage-1 observed compliances (i.e., $D_1$ and $D_2$).} We make use of the stick-breaking representation of the DPM models. The cluster weights and the latent cluster variables are updated using the standard Block Gibbs sampler for DPM models \citep{ishwaran2001gibbs}. The truncated normal kernel makes it difficult to sample the cluster-specific parameters $(\beta_{0j},\sigma_j^2),\ j=1,2$ using the standard Gibbs sampler, hence we use block Metropolis steps instead. For the marginal distributions of the Stage-1 observed compliances, we sample the necessary parameters and update $H_{1i}=\Phi_1^{-1}\{F_{D_1}(d_{1i};\bm{\theta}_1,\bm{x}_{0i})\}$, $H_{2i}=\Phi_1^{-1}\{F_{D_2}(d_{2i};\bm{\theta}_2,\bm{x}_{0i})\}$, $i=1,\dots,n_j$, where $\theta_j$ denotes the vector of parameters corresponding to the $j$th marginal, for $j=1,2$. The likelihood of $\bm{\theta}=(\bm{\theta}_1,\bm{\theta}_2,\bm{\theta}_3,\bm{\theta}_4)$ and $R$ in the copula model has the form \begin{align*} f(\bm{\theta}, R)=\prod_{i=1}^n\bigg[\vert & R\vert^{-1/2}\exp\bigg\{-\frac{1}{2}{\bm{d}}^T_{i}(1-R^{-1})\bm{d}_{i}\bigg\}\times f_{D_1}(d_{1i}\vert \bm{\theta}_1,\bm{x}_{0i})f_{D_2}(d_{2i}\vert \bm{\theta}_2,\bm{x}_{0i})\\ &\times f_{D_3}(d_{3i}\vert \bm{\theta}_3,\bm{x}_{0i},d_{1i},\bm{x}_{1i})f_{D_4}(d_{4i}\vert \bm{\theta}_4,\bm{x}_{0i},d_{2i},\bm{x}_{1i})\bigg], \end{align*} where $\bm{d}_i=(d_{1i},d_{2i},d_{3i},d_{4i})$. Basically, Step 1 consists of sampling from $f(\bm{\theta}_j\vert \bm{\theta}_{-j},d_j,\\ \bm{x}_0,R)$ for $j=1,2$. We obtain the conditional likelihood as \begin{equation}\label{eqs1} \begin{split} \log f(\bm{\theta}_j\vert d_j,\bm{\theta}_{-j},\bm{x}_0,R)=&\text{const}+\frac{1}{2}(1-R_{jj}^{-1})\sum_{i=1}^n h_{ji}^2-\sum_{i=1}^n\sum_{k\neq j}(R^{-1})_{jk}h_{ji}h_{ki}\\ &+\sum_{i=1}^n\log f_{D_j}(d_{ji}\vert \bm{x}_{0i},\bm{\theta}_j)+\log f(\bm{\theta}_j), \end{split} \end{equation} with $h_{ji}=\Phi^{-1}\{F_{d_j}(d_{ji},\bm{\theta}_j,\bm{x}_{0i})\}$. In Step 1, we update $\bm{\theta}_1$ and $\bm{\theta}_2$ from $f(\bm{\theta}_1\vert d_1, \bm{\theta}_{2},\bm{x}_0,\\ R)$ and $f(\bm{\theta}_2\vert d_2, \bm{\theta}_{1},\bm{x}_0,R)$ respectively. The marginal models for $D_1$ and $D_2$ have the following truncated stick-breaking representation \begin{align*} f_{D_j}(d_{ji}\vert \bm{\theta}_j)=\sum_{b=1}^B \omega_{j(b)} \mathrm{N}(d_{ji};\beta_{j0(b)}+\bm{x}_{0i}^T\bm{\beta}_{j},\sigma_{j(b)}^2)_{[0,1]}, \end{align*} where $\omega_{j(b)}=\omega_{j(b)}^\prime\prod_{h<b}(1-\omega_{j(b)}^\prime)$, are the stick-breaking weights constructed from $\omega_{j(b)}^\prime \sim \mathrm{Be}(1,\lambda_j)$, $j=1,2$, and $B$ is the number of clusters. Also, $(\beta_{0j(b)},\sigma_{j(b)}^2)\overset{iid}{\sim}\mathrm{N}(\mu_j,S_j)\mathrm{IG}(a_j,b_j)$, $b=1,\dots,B$. Following the prior specifications in \cite{kim2019bayesian}, the hyperpriors are specified as follows: $\lambda_j\sim \mathrm{G}(1,1)$, $\mu_j\sim\mathrm{N}(\mu_j^\star,S_j^\star)$, $S_j\sim\mathrm{G}(a_j^\star,b_j^\star)$, with $a^\star_j\sim\mathrm{Unif}(1,5)$, and $b_j^\star=100a_j^\star$. The truncation level $B$ has been chosen to be 8. We choose $\mu_j^\star=\bar{D}_j$, and $S_j^\star=1$, and also $a_j=b_j=1$. The sub-steps are described below: \begin{itemize} \item Denote the latent cluster variable for the subject $i$ as $Z_i$, which takes value in $\{1,2,\dots,B\}$. At the $t$th iteration, denote the values of $\beta_{j0(b)},\sigma_{j(b)}^2$, and $\omega_{j(b)}$ as $\beta_{j0(b)}(t),\sigma_{j(b)}^2(t)$, and $\omega_{j(b)}(t)$ respectively, for $b\in\{1,\dots,B\}$. Draw $Z_i$ from $Z_i\sim \text{Categorical}(p_1,\dots,p_B)$, where $p_b=\mathrm{N}\{D_{ji};\beta_{j0(b)}(t-1),\sigma_{j(b)}^2(t-1)\}\times \omega_{j(b)}(t-1)$. Draw $\omega_{j(b)}^\prime\sim\mathrm{Be}(1+m_b,\lambda_j+\sum_{q=1}^{B-1}m_q)$, where $m_b$ is the number of subjects having $Z_i=b$. Next, we update $\omega_{j(b)}$ via $\omega_{j(b)}=\omega_{j(b)}^\prime\prod_{h<b}(1-\omega_{h(b)}^\prime)$. Finally, we update $\lambda_j\sim \mathrm{Ga}(B,1-\sum_{b=1}^B\log(1-\omega_{j(b)}))$. \item Update $a_j^\star,\mu_j,S_j$: Denote the values at $t$th iteration as $a_j^\star(t),\mu_j(t),S_j(t)$. The proposal distributions are as follows: $a^2_{j(\text{prop})}\sim \mathrm{Unif}(1,5)$, $\mu_{j(\text{prop)}}\sim\mathrm{N}(\mu_j(t-1),1)$, $S_{j(prop)}\sim \mathrm{Unif}(S_{j(prop)}(t-1)-0.1,S_{j(prop)}(t-1)+0.1)$ and denote the joint distribution as $q\{\Psi_{prop};\Psi(t-1)\}$. Then the acceptance probability of the proposed values is given by \begin{align*} AR_1=\mathrm{min}\Big\{1,\frac{f(\bm{\theta}_{j(prop)}\vert d_j,h_{-j},\bm{x}_0,R)q\{\Psi_{prop};\Psi(t-1)\}}{f(\bm{\theta}_{j}(t-1)\vert d_j,h_{-j},\bm{x}_0,R)q\{\Psi(t-1);\Psi_{prop}\}}\Big\}, \end{align*} where $f(\bm{\theta}_{j\text(prop)}\vert d_j,h_{-j},\bm{x}_0,R)$ denotes the conditional distribution in Equation \eqref{eqs1} before the log transformation. \item Update $\beta_{j0(b)}$, $b=1,\dots,B$: propose values from $\beta_{j0(b)(prop)}\sim N\{\beta_{j0(b)}(t-1),0.1\}$ and use the same metropolis step as in the previous step. \item Update $\sigma^2_{j(b)},b=1,\dots,B$: propose values from $1/\sigma^2_{j(b)}\sim G\{0.1/\sigma^2_{j(b)}(t-1)\times c,c\}$ for $b=1,\dots,B$ where $c$ is a large constant to concentrate the probability around $1/\sigma^2_{j(b)}(t-1)$. Here we choose $c=15$. \item Update $\bm{\beta}_j=(\beta_{j1},\dots,\beta_{jm_1})$: Following \cite{kim2019bayesian}, we propose values according to $\bm{\beta}_{j(\text{prop})}\sim \mathrm{N}_{m_1}\{\bm{\beta}_j(t-1),\Sigma^\prime_{\bm{\beta}_j}\}$, with $\Sigma^\prime_{\bm{\beta}_j}=\hat{\Sigma}_{\bm{\beta}_j}+\bm{I}_{m_1}$, where $\hat{\Sigma}_{\bm{\beta}_j}$ is the covariance matrix of the regression coefficients of $D_j$ on $\bm{X}_0$, and $\bm{I}_N$ denotes the identity matrix of order $N\times N$. We use the same metropolis sub-step used for the update of $\beta_{j0(b)},$ $b=1,\dots,B$. \end{itemize} \item[Step (2)] {\it Updating the parameters for marginals of $D_3$ and $D_4$, the second stage observed compliances.} Similar to Step 1, with the only difference being that we have more covariates for the marginal regression models, namely, the first stage observed compliances and the covariates measured just before the second stage of treatment assignment. We update the parameters for the marginal distributions of $D_3$ and $D_4$, and update $H_{3i}=\Phi_1^{-1}\{F_{D_3}(d_{3i};\bm{\theta}_3,\bm{x}_{0i},d_{1i},\bm{x}_{1i})\}$ and $H_{4i}=\Phi_1^{-1}\{F_{D_4}(d_{4i};\bm{\theta}_4,\bm{x}_{0i},d_{2i},\\\bm{x}_{1i})\}$. the conditional likelihood for $\bm{\theta}_j,\ j=3,4$ can be written as \begin{equation}\label{eq2} \begin{split} \log f(&\bm{\theta}_3 \vert d_3,d_1,\bm{\theta}_{-3},\bm{x}_0,\bm{x}_1,R)=\text{const}+\frac{1}{2}(1-R_{33}^{-1})\sum_{i=1}^n h_{3i}^2-\\ &\sum_{i=1}^n\sum_{k\neq 3}(R^{-1})_{3k}h_{3i}h_{ki}+\sum_{i=1}^n\log f_{D_3}(d_{3i}\vert \bm{x}_{0i},d_{1i},\bm{x}_{1i},\bm{\theta}_3)+\log f(\bm{\theta}_3), \end{split} \end{equation} and \begin{equation}\label{eq3} \begin{split} \log f(&\bm{\theta}_4 \vert d_4,d_2,\bm{\theta}_{-4},\bm{x}_0,\bm{x}_1,R)=\text{const}+\frac{1}{2}(1-R_{44}^{-1})\sum_{i=1}^n h_{4i}^2-\\ &\sum_{i=1}^n\sum_{k\neq 4}(R^{-1})_{4k}h_{4i}h_{ki}+\sum_{i=1}^n\log f_{D_4}(d_{4i}\vert \bm{x}_{0i},d_{2i},\bm{x}_{1i},\bm{\theta}_4)+\log f(\bm{\theta}_4). \end{split} \end{equation} The marginals of $D_3$ and $D_4$ have a similar stick-breaking representation: \begin{align*} f_{D_3}(d_{3i}\vert \theta_3)=&\sum_{b=1}^B \omega_{3(b)} \mathrm{N}(d_{3i};\beta_{30(b)}+\bm{x}_{0i}^T\bm{\beta}_{3}+\gamma_3d_{1i}+\bm{x}_{1i}^T\bm{\beta}^\prime_3,\sigma_{3(b)}^2)_{[0,1]},\\ f_{D_4}(d_{4i}\vert \theta_4)=&\sum_{b=1}^B \omega_{4(b)} \mathrm{N}(d_{4i};\beta_{40(b)}+\bm{x}_{0i}^T\bm{\beta}_{4}+\gamma_4d_{2i}+\bm{x}_{1i}^T\bm{\beta}^\prime_4,\sigma_{4(b)}^2)_{[0,1]}. \end{align*} We update $w_{j(b)},\beta_{j(b)},\sigma_{j(b)}^2,\bm{\beta}_j$, $b=1,\dots,B$, $j=3,4$, in the same way we did before, so we omit the details. The only extra sub-steps are updating the regression coefficients corresponding to the time-varying covariates $\bm{X_1}$ and Stage-1 observed compliances $D_1$ and $D_2$, which we describe below. \begin{itemize} \item Update $(\bm{\beta}_j,\bm{\beta}^\prime_j,\gamma_j)$, $j=3,4$: We propose values according to $(\bm{\beta}_{j(\text{prop})},\ \bm{\beta}^\prime_{j(\text{prop})},\\ \gamma_{j(\text{prop})})\sim \mathrm{N}_{m_1+m_2+1}(\{\bm{\beta}_j(t-1),\bm{\beta}^\prime_j(t-1),\gamma_j(t-1)\},\Sigma^\prime_{\bm{\beta}_j,\bm{\beta}^\prime_j,\gamma_j})$, with $\Sigma^\prime_{\bm{\beta}_j,\bm{\beta}^\prime_j,\gamma_j}=\hat{\Sigma}_{\bm{\beta}_j,\bm{\beta}^\prime_j,\gamma_j}+\bm{I}_{m_1+m_2+1}$, where $\hat{\Sigma}_{\bm{\beta}_j,\bm{\beta}^\prime_j,\gamma_j}$ is the empirical covariance matrix of the regression coefficients of $D_j$ on $\bm{X}_{0},D_{1},\bm{X}_{1}$ for $j=3$, and $\bm{X}_{0},D_{2},\bm{X}_{1}$ for $j=4$. We use the same metropolis sub-step used for the update of $\beta_{j0(b)},$ $b=1,\dots,B$ in Step 1. \end{itemize} \item[Step (3)] {\it Updating the copula correlation matrix $R$.} As already mentioned, we perform the inference using a uniform prior on the off-diagonal elements. The posterior sampling is done using Metropolis steps. propose each association parameter $r_{(prop)}\sim \mathrm{Unif}(r_{L},r_{U})$ where $r_{L}$ and $r_{U}$ are determined to give the positive definite matrix $R$. The acceptance probability of the proposed values is then given by \begin{align*} AR_2=\min\bigg\{1,\frac{f(R_{r(prop)}\vert \bm{d},\bm{x}_0,\bm{x}_1,\theta)q\{r(t-1)\}}{f(R_{r}(t-1)\vert \bm{d},\bm{x}_0,\bm{x}_1,\theta)q(r_{(prop)})}\bigg\}, \end{align*} where $R_{r(prop)}$ denotes the correlation matrix with the $r$th element set to the proposed value, and all the other entries set to their current values. Similarly, $R_{r}(t-1)$ denotes the correlation matrix with the $r$th element set to the value at the $(t-1)$th iteration, and all the other entries set to their current values. Next, we briefly describe how to choose $r_L$ and $r_U$. Suppose, we start with a positive definite matrix $R$, and we define $R(r)$ to be the matrix obtained by changing the $(i,j)$th element to $r$. As pointed out in \cite{barnard2000modeling}, $R(r)$ is positive definite if and only if $f(r)=\vert R(r)\vert>0$, and $f(r)$ is a quadratic function in $r$. Hence, we can find the interval for $r$ that leads to $R$ being positive definite by solving the quadratic equation $f(r)=0$. \item[Step (4)] {\it Augmenting the missing compliances.} We use standard Metropolis steps, with the proposal distribution being a truncated normal with its mean set at the current value. Draw $D_{j(prop)}\sim \mathrm{N}(D_j(t-1),s_{D_j})_{[0,1]}$ and calculate acceptance probability as follows: \begin{align*} AR_3=\min\bigg\{1,\frac{f(d^{ \text{mis}}_{j(\text{prop})},d_j^{\text{obs}},d_{- j},\bm{x}_0,\bm{x}_1\vert \bm{\theta},R)q\{d_j(t-1)\}}{f(d^{\text{mis}}_{j}(t-1),d_j^{\text{obs}},d_{-j},\bm{x}_0,\bm{x}_1\vert \bm{\theta},R)q(d_{j(prop)})}\bigg\}, \end{align*} where $s_D$ is the empirical standard deviation of $D$. \item[Step (5)] {\it Estimating the potential outcome using the DPM model.} Once we have the missing potential compliances, we use the locally weighted DPM model to get the posterior estimate of the potential outcomes. For $k=1,4$, we obtain posterior samples from the conditional distribution of $Y^k$ given $\bm{X}_0$, $D_1$ and $D_2$. For $k=2,3$, we draw samples from the posterior conditional distribution of $Y^k$ given $\bm{X}_0,D_1$, $D_2$, and $D_3$. Similarly, for $k=5,6$, we obtain samples from the conditional distribution of $Y^k$ given $\bm{X}_0,D_1,D_2$, and $D_4$. We use the truncation approximation and the block Gibbs sampler for DPM models to estimate the conditional density. The steps are straightforward, and hence omitted. \end{enumerate} We draw 10000 samples from the posterior, with a thinning of 5, which gives us 2000 many posterior samples. The trace plots of the MCMC chains show evidence of convergence. The R codes used to obtain the results are available at the Github repository \url{https://github.com/indrabati646/Partial-compliance}. \section{Simulation studies} \label{s:simulation} \subsection{Data generative models} We assess the practical performance of our proposed principal causal effect estimator in various settings including linear and non-linear outcome models with Gaussian errors, and linear outcome models with non-Gaussian errors. In scenarios 1 and 2, $A_1 \sim \text{Bernoulli}(0.5)$, $A_2 \sim \text{Bernoulli}(0.5)$, baseline covariates $X_{01}\sim N(-0.5,0.3^2)$, $X_{02}\sim N(0,0.1^2)$, $X_{03}\sim\mathrm{N}(0.5,0.3^2)$, the Stage-1 response indicators are generated as $S_i \mid D_1, X_{0},A_1=+1\sim \mathrm{Bern}\Big\{\frac{\mathrm{exp(D_{1}-1.5+0.2X_{02})}}{1+\mathrm{exp(D_{1}-1.5+0.2X_{02})}}\Big\}$, and $S_i \mid D_1, X_{0},A_1=-1 \sim \mathrm{Bern}\Big\{\frac{\mathrm{exp(D_{1}-1.5+0.3X_{03})}}{1+\mathrm{exp(D_{1}-1.5+0.3X_{03})}}\Big\}$. For scenario 3, we have two baseline covariates $X_{01}\sim N(-0.5,0.3^2)$, $X_{02}\sim N(0,0.1^2)$, and a time-varying covariate $X_{11}\sim N(0.5+0.3X_{01}+0.7X_{02}+0.1A_1,0.1^2)$ . Also, in scenarios 1 and 2, the first stage treatment does not have an effect on the second stage potential compliances, thereby, $D_3=D_4$. In scenario 3, we relax this restriction. In each setting, we sample $n \in \{250,500,1000 \}$ independent and identically distributed observations, applying the proposed estimator and the one in \cite{artman2020adjusting} to the resultant data. This was repeated $200$ times. \noindent \textbf{Scenario 1 (Linear models with Gaussian errors).} We generate the marginal observed compliances, $D_1$, $D_2$ and $D_3$ from a truncated normal with means $0.5X_{01}+0.5X_{02}$, $0.5X_{02}$, and $0.5X_{03}-0.5X_{01}$ respectively, and variance 0.25. The joint distribution of $D_1,D_2,D_3$ is specified by a Gaussian copula with the correlation matrix \begin{equation*} R^\star=\begin{pmatrix} 1 & 0.2 & 0.2\\ 0.2 & 1 & 0.2\\ 0.2 & 0.2 & 1 \end{pmatrix}. \end{equation*} The generative model results in $K=6$ treatment sequences. We generate the outcomes corresponding to each sequence using the following models \citep{artman2020adjusting}: \begin{align*} Y_{1i}=& 0.7+0.6D_{1i}+0.8X_{01i}-0.2X_{02i}+\epsilon_{1i},\\ Y_{2i}=& 0.2+0.7D_{1i}+0.9D_{3i}+0.4D_{1i}D_{3i}-0.9X_{01i}+0.6X_{03i}+\epsilon_{2i},\\ Y_{3i}=& 0.2+ 0.6D_{1i}+0.9D_{3i}+0.4D_{1i}D_{3i}-0.9X_{01i}+0.6X_{03i}+\epsilon_{3i},\\ Y_{4i}=& 0.7+0.6D_{1i}+0.6D_{2i}+0.8X_{01i}-0.2X_{02i}+\epsilon_{4i},\\ Y_{5i}=& 0.3+0.6D_{2i}+0.7D_{3i}+0.7D_{2i}D_{3i}-0.5X_{02i}+\epsilon_{5i},\\ Y_{6i}=& 0.3+0.8D_{2i}+0.7D_{3i}+0.7D_{2i}D_{3i}-0.5X_{02i}+\epsilon_{6i}, \end{align*} with $\epsilon_{ki}\sim N(0,0.1^2)$, $k=1,\dots,6$. \noindent \textbf{Scenario 2 (Linear models with non-Gaussian errors).} In this scenario, we study the performance of our proposed method under a true error distribution that is more complex (i.e., bimodal) than Gaussian. Specifically, we generate the outcomes using the same models considered in scenario 1 but replace the Gaussian error with $\epsilon_{ki}-0.5\sim \mathrm{beta}(0.5,0.5)$, $k=1,\dots,6$. \noindent \textbf{Scenario 3 (Non-linear models with Gaussian errors).} This scenario contains the most general case where the time-varying potential compliances are allowed to depend on time-varying covariates (i.e., $X_{11}$) and the outcome model is considered to be non-linear. The marginals of $D_1$, $D_2$, $D_3$ and $D_4$ are truncated normal with means $0.5X_{01}+0.5X_{02}$, $0.5X_{02}$, $1.5X_{11}-0.5X_{01}$, $1.5X_{11}-0.5X_{02}$ respectively and variance 0.25. For joint distribution of the potential compliances, we use a Gaussian copula with a 4-dimensional correlation matrix \begin{align*} R^\star= \begin{pmatrix} 1 & 0.2 & 0.2 & 0.2\\ 0.2 & 1 & 0.2 & 0.2\\ 0.2 & 0.2 & 1 & 0.2\\ 0.2 & 0.2 & 0.2 & 1 \end{pmatrix} . \end{align*} The potential outcomes are generated as below: \begin{align*} Y_{1i}=& 0.7+0.6\exp{(1+D_{1i})}+0.8X_{01i}-0.2X_{02i}+\epsilon_{1i},\\ Y_{2i}=& 0.2+0.7D_{1i}+0.7D_{2i}+0.9D_{3i}-0.9X_{01i}+0.3X_{02i}+0.7X_{11i}+\epsilon_{2i},\\ Y_{3i}=& 0.2+ 0.6D_{1i}+0.7D_{2i}+0.8D_{3i}+0.9X_{01i}+0.2X_{2i}+0.6X_{11i}+\epsilon_{3i},\\ Y_{4i}=& 0.7+0.6D_{1i}+0.6D_{2i}+0.8X_{01i}-0.2X_{02i}+\epsilon_{4i},\\ Y_{5i}=& 0.3+0.5D_{1i}+0.6D_{2i}+0.7\log(1+D_{4i})-0.5X_{02i}+X_{11i}+\epsilon_{5i},\\ Y_{6i}=& 0.3+0.8D_{1i}+0.7D_{2i}+0.3D_{4i}-0.5X_{02i}+0.9X_{11i}+\epsilon_{6i}, \end{align*} with $\epsilon_{ki}\sim \mathrm{N}(0,0.1^2)$, $k=1,\dots,6$. \subsection{Results} We compare the performance of our proposed non-parametric Bayes approach with the semiparametric Bayes method of \cite{artman2020adjusting}. Tables \ref{tabs1}-\ref{tab7} summarize the results corresponding to scenarios 1-3, respectively. Note that the results in these tables are multiplied by 10. In scenario 1 (Table \ref{tabs1}), as expected, the semiparametric approach performs well when the outcome models are correctly specified. However, the proposed approach still shows smaller bias and standard errors across all the sample sizes considered. Specifically, the proposed approach results in estimators with up to 10 and 5 times smaller bias and standard errors, respectively. As the sample size increases the gap in bias values shrinks while the standard errors of the semiparametric estimators remain roughly two times higher than the proposed estimator. In scenario 2 (Table \ref{tab6}), while the functional form of outcome model is correctly specified in the semiparametric approach, the deviation from the Gaussian error distribution has resulted in considerable bias and inflated standard errors in the semiparametric estimators. The proposed approach remains unbiased with low standard errors. In scenario 3 (Table \ref{tab7}), we fit a linear outcome model in the semiparametric approach which results in a misspecified model. The misspecification induced bias in some of the treatment sequences. For example, in sequences 3 and 4, the bias terms are 0.418 and 0.889 when $n=250$. The latter biases do not seem to converge to zero as the sample size increases. The proposed method, however, captures the non-linear functional forms, thereby producing unbiased estimators with smaller standard errors relative to the semiparametric approach. Along with the treatment sequences, we also study the embedded DTRs for the three scenarios. We use the multiple comparisons with the best (MCB) \citep{hsu1981simultaneous,ertefaie2016identifying} method to identify the EDTRs that are the best, insignificantly different from the best, and significantly different from the best. The set of the best EDTRs can be defined as $\mathcal{B}=\{\text{EDTR}_l\vert \text{EDTR}_l\ \text{is not inferior to the best}\}$. To construct such a set, we form simultaneous credible intervals $Y^{(l)}-\max_{l^\prime}Y^{(l^\prime)}$. If the interval contains zero, then it is statistically indistinguishable from the best \citep{artman2020adjusting}. The advantage of using MCB over the pairwise comparisons is that we only have to do $L-1$ comparisons, with $L$ being the number of EDTRs. We study four specific compliance levels, namely 100\%, 75\%, 50\% and 25\%. For each level, we compute the average bias and standard errors for the embedded DTRs for the three scenarios (Table \ref{tabss1}). We also demonstrate the mean outcome for each embedded DTR and the percentage of times they are included in the set of the best EDTRs in Table \ref{tabs2}. For Scenarios 1 and 2, EDTRs 1, 3 and 4 are best for all 200 datasets. For Scenario 3, while EDTRs 1 and 2 are in the set of best EDTRs all the time, EDTRs 3 and 4 are also included a few times. \begin{table}[h] \centering \small \caption{Scenario 1. Bias and standard errors (multiplied by 10) for the conditional mean of outcomes for each treatment sequence.} \begin{tabular}{ |c|c|c|c|c|c|c| } \hline & \multicolumn{6}{c|}{Non-parametric Bayes}\\ \hline $n$ & Seq 1 & Seq 2 & Seq 3 & Sec 4 & Seq 5 & Seq 6 \\ \hline 250 & -0.05(0.83) & 0.04(0.79) & 0.02(0.97) & 0.01(0.86) & 0.01(0.91) & 0.02(0.98)\\ \hline 500 & 0.01(0.63) & -0.02(0.47) & 0.02(0.55) & 0.00(0.54) & 0.01(0.48) & 0.01(0.49)\\ \hline 1000 & 0.00(0.28) & 0.00(0.32) & 0.00(0.35) & 0.00(0.29) & 0.00(0.25) & 0.00(0.32)\\ \hline & \multicolumn{6}{c|}{Semiparametric Bayes}\\ \hline 250 & 0.28(3.48) & 0.01(4.23) & 0.84(4.33) & 0.11(3.07) & -0.11(1.24) & 0.21(1.64)\\ \hline 500 & -0.10(0.98) & 0.04(1.05) & 0.06(0.97) & 0.12(0.46) & 0.10(1.19) & -0.20(1.10)\\ \hline 1000 & 0.10(0.63) & -0.01(0.65) & 0.03(0.63) & 0.10(0.70) & 0.10(0.54) & 0.02(0.55)\\ \hline \end{tabular} \label{tabs1} \end{table} \begin{table}[h] \centering \small \caption{Scenario 2. Bias and standard errors (multiplied by 10) for the conditional mean of outcomes for each treatment sequence.} \begin{tabular}{ |c|c|c|c|c|c|c| } \hline & \multicolumn{6}{c|}{Non-parametric Bayes}\\ \hline $n$ & Seq 1 & Seq 2 & Seq 3 & Sec 4 & Sec 5 & Seq 6 \\ \hline 250 & 0.05(1.31) & 0.04(0.96) & -0.02(0.90) & 0.01(1.10) & 0.01(0.98) & 0.02(0.82)\\ \hline 500 & 0.01(0.64) & 0.02(0.63) & 0.02(0.67) & 0.00(0.59) & -0.01(0.64) & 0.01(0.64)\\ \hline 1000 & 0.01(0.37) & 0.01(0.36) & 0.00(0.40) & 0.01(0.40) & 0.01(0.39) & -0.00(0.38)\\ \hline & \multicolumn{6}{c|}{Semiparametric Bayes}\\ \hline 250 & -1.34(2.92) & 0.12(5.62) & 1.34(5.80) & 0.53(3.03) & 0.78(5.97) & 0.24(6.23)\\ \hline 500 & -0.57(2.54) & 0.29(3.55) & 0.35(3.51) & 0.28(2.60) & 0.07(3.11) & 0.54(3.15)\\ \hline 1000 & -0.38(1.42) & 0.44(1.98) & 0.23(2.01) & 0.11(1.51) & 0.01(2.13) & -0.05(2.22)\\ \hline \end{tabular} \label{tab6} \end{table} \begin{table}[h] \centering \small \caption{Scenario 3. Bias and standard errors (multiplied by 10) for the conditional mean of outcomes for each treatment sequence.} \begin{tabular}{ |c|c|c|c|c|c|c| } \hline & \multicolumn{6}{c|}{Non-parametric Bayes}\\ \hline $n$ & Seq 1 & Seq 2 & Seq 3 & Sec 4 & Sec 5 & Seq 6 \\ \hline 250 & 0.04(1.61) & 0.20(0.89) & 0.01(1.03) & 0.00(2.01) & 0.02(0.58) & 0.04(0.65)\\ \hline 500 & 0.03(0.86) & 0.01(0.49) & 0.01(0.53) & 0.00(0.58) & 0.02(0.41) & 0.00(0.49)\\ \hline 1000 & -0.02(0.55) & 0.00(0.29) & 0.00(0.32) & 0.07(0.38) & 0.01(0.25) & -0.01(0.27)\\ \hline & \multicolumn{6}{c|}{Semiparametric Bayes}\\ \hline 250 & 0.31(1.26) & 0.31(3.16) & 4.18(3.04) & 8.89(4.88) & 0.08(1.80) & 0.20(1.95)\\ \hline 500 & 0.13(0.72) & -0.05(1.88) & 4.03(1.92) & 3.98(1.82) & 0.07(1.29) & 0.03(1.39)\\ \hline 1000 & 0.10(0.45) & 0.07(1.15) & 3.99(1.20) & 4.11(1.79) & 0.12(0.82) & 0.19(0.88)\\ \hline \end{tabular} \label{tab7} \end{table} \subsection{Sensitivity analysis for Assumption 3} We examine the sensitivity of our proposed estimator to the violation of Assumption 3. Specifically, in scenario 3, we generate the marginals of the compliances from truncated normal Gaussians as before, but link them together using a $t$-copula with the correlation matrix $R^\star$ instead of a Gaussian copula. All the other aspects of the generative model remains the same. Table \ref{tabs3} shows that the resulting estimators remain unbiased with a slight inflation in the corresponding standard errors compared with the results in Table \ref{tab7}. \begin{table}[h] \centering \small \caption{Simulation studies. Bias and standard errors for the four embedded dynamic treatment regimes for the three scenarios discussed in Section 6 of the main paper.} \begin{tabular}{ |c|c|c|c|c|c| } \hline \multicolumn{6}{c|}{Scenario 1}\\ \hline $n$ & Compliance level & EDTR 1 & EDTR 2 & EDTR 3 & EDTR 4 \\ \hline \multirow{ 4}{*}{250} & 100\% & -0.07 (0.09) & -0.11 (0.04) & 0.13 (0.06) & 0.10 (0.08)\\ & 75\% & 0.05 (0.07) & 0.08 (0.05) & -0.08 (0.05) & 0.08 (0.06)\\ & 50\% & 0.06 (0.05) & 0.07 (0.05) & 0.06 (0.03) & 0.04 (0.04) \\ & 25\% & 0.06 (0.05) & 0.07 (0.05) & 0.05 (0.06) & 0.03 (0.05)\\ \hline \multirow{ 4}{*}{500} & 100\% & 0.07 (0.04) & -0.09 (0.04) & 0.11 (0.06) & 0.09 (0.07)\\ & 75\% & 0.05 (0.06) & 0.06 (0.04) & -0.07 (0.04) & 0.07 (0.05)\\ & 50\% & 0.05 (0.07) & 0.06 (0.05) & 0.06 (0.04) & 0.05 (0.04)\\ & 25\% & 0.05 (0.06) & 0.04 (0.05) & 0.04 (0.03) & -0.02 (0.04)\\ \hline \multirow{ 4}{*}{1000} & 100\% & 0.05 (0.04) & -0.07 (0.02) & 0.06 (0.03) & 0.05 (0.05)\\ & 75\% & 0.04 (0.03) & 0.05 (0.03) & -0.04 (0.03) & 0.04 (0.02)\\ & 50\% & 0.04 (0.03) & 0.04 (0.05) & 0.03 (0.03) & 0.04 (0.04)\\ & 25\% & 0.05 (0.03) & 0.03 (0.03) & 0.03 (0.02) & -0.02 (0.03)\\ \hline \multicolumn{6}{c|}{Scenario 2}\\ \hline $n$ & Compliance level & EDTR 1 & EDTR 2 & EDTR 3 & EDTR 4\\ \hline \multirow{ 4}{*}{250} & 100\% & 0.08 (0.10) & -0.10 (0.06) & 0.11 (0.08) & 0.09 (0.08)\\ & 75\% & 0.09 (0.08) & 0.09 (0.07) & 0.08 (0.06) & 0.06 (0.07)\\ & 50\% & 0.06 (0.06) & 0.06 (0.05) & 0.07 (0.05) & 0.05 (0.07)\\ & 25\% & 0.08 (0.06) & 0.08 (0.07) & 0.07 (0.06) & 0.06 (0.05)\\ \hline \multirow{ 4}{*}{500} & 100\% & -0.05 (0.04) & -0.10 (0.05) & 0.09 (0.07) & 0.08 (0.05)\\ & 75\% & 0.07 (0.06) & 0.06 (0.07) & 0.07 (0.04) & 0.05 (0.05)\\ & 50\% & 0.05 (0.04) & 0.08 (0.04) & 0.04 (0.06) & 0.03 (0.04)\\ & 25\% & 0.07 (0.05) & 0.05 (0.06) & 0.04 (0.05) & 0.04 (0.05)\\ \hline \multirow{ 4}{*}{1000} & 100\% & -0.04 (0.05) & -0.08 (0.04) & 0.07 (0.06) & 0.06 (0.04)\\ & 75\% & 0.05 (0.06) & 0.04 (0.05) & 0.06 (0.04) & 0.03 (0.05)\\ & 50\% & 0.03 (0.04) & 0.05 (0.06) & 0.03 (0.02) & 0.02 (0.04)\\ & 25\% & 0.04 (0.04) & 0.04 (0.05) & 0.03 (0.05) & 0.04 (0.04)\\ \hline \multicolumn{6}{c|}{Scenario 3}\\ \hline $n$ & Compliance level & EDTR 1 & EDTR 2 & EDTR 3 & EDTR 4 \\ \hline \multirow{4}{*}{250} & 100\% & 0.09(0.10) & 0.12(0.13) & 0.08(0.03) & 0.10(0.06) \\ & 75\% & 0.08(0.08) & 0.10(0.08) & 0.08(0.07) & 0.08(0.03) \\ & 50\% & 0.09(0.07) & 0.09(0.09) & 0.09(0.03) & 0.05(0.04) \\ & 25\% & 0.10 (0.08) & 0.11 (0.05) & 0.10 (0.04) & 0.06 (0.05)\\ \hline \multirow{4}{*}{500} & 100\% & 0.09(0.09) & 0.10(0.11) & 0.07(0.04) & 0.11(0.06) \\ & 75\% & 0.07(0.04) & 0.08(0.08) & 0.07(0.05) & 0.07(0.03) \\ & 50\% & 0.08(0.04) & 0.08(0.07) & 0.08(0.04) & 0.04(0.04) \\ & 25\% & 0.09 (0.05) & 0.07 (0.06) & 0.09 (0.04) & 0.06 (0.03)\\ \hline \multirow{4}{*}{1000} & 100\% & 0.07(0.04) & 0.07(0.07) & 0.05(0.03) & 0.09(0.03) \\ & 75\% & 0.06(0.04) & 0.06(0.05) & 0.05(0.04) & 0.06(0.03) \\ & 50\% & 0.05 (0.03) & 0.06(0.05) & 0.08(0.02) & 0.04(0.03) \\ & 25\% & 0.08 (0.02) & 0.07 (0.02) & 0.05 (0.02) & 0.05 (0.02)\\ \hline \end{tabular} \label{tabss1} \end{table} \begin{table}[h] \centering \small \caption{Simulation studies. Mean outcomes for the four embedded dynamic treatment regimes for the three scenarios discussed in Section 6 of the main paper, with the percentage of times they are included in the set of best EDTRs based on 200 datasets (in parentheses).} \begin{tabular}{ |c|c|c|c|c|c| } \hline \multicolumn{6}{c|}{Scenario 1}\\ \hline $n$ & Compliance level & EDTR 1 & EDTR 2 & EDTR 3 & EDTR 4 \\ \hline \multirow{4}{*}{250} & 100\% & 1.09 (100) & 0.79 (0) & 1.47 (100) & 1.72 (100)\\ & 75\% & 0.99 (100) & 0.66 (0) & 1.14 (100) & 1.51 (100)\\ & 50\% & 0.86 (100) & 0.43 (0) & 1.01 (100) & 1.09 (100)\\ & 25\% & 0.69 (100) & 0.31 (0) & 0.77 (100) & 0.81 (100)\\ \hline \multirow{4}{*}{500} & 100\% & 1.13 (100) & 0.68 (0) & 1.45 (100) & 1.75 (100)\\ & 75\% & 1.00 (100) & 0.64 (0) & 1.19 (100) & 1.49 (100)\\ & 50\% & 0.82 (100) & 0.44 (0) & 1.02 (100) & 1.11 (100)\\ & 25\% & 0.65 (100) & 0.30 (0) & 0.79 (100) & 0.80 (100)\\ \hline \multirow{4}{*}{1000} & 100\% & 1.12 (100) & 0.71 (0) & 1.46 (100) & 1.80 (100)\\ & 75\% & 0.98 (100) & 0.61 (0) & 1.21 (100) & 1.47 (100)\\ & 50\% & 0.80 (100) & 0.44 (0) & 0.99 (100) & 1.11 (100)\\ & 25\% & 0.64 (100) & 0.32 (0) & 0.80 (100) & 0.83 (100)\\ \hline \multicolumn{6}{c|}{Scenario 2}\\ \hline $n$ & Compliance level & EDTR 1 & EDTR 2 & EDTR 3 & EDTR 4\\ \hline \multirow{4}{*}{250} & 100\% & 1.13 (100) & 0.76 (0) & 1.50 (100) & 1.74 (100)\\ & 75\% & 1.05 (100) & 0.63 (0) & 1.20 (100) & 1.47 (100)\\ & 50\% & 0.89 (100) & 0.57 (0) & 1.03 (100) & 1.14 (100)\\ & 25\% & 0.67 (100) & 0.33 (0) & 0.81 (100) & 0.82 (100)\\ \hline \multirow{4}{*}{500} & 100\% & 1.14 (100) & 0.74 (0) & 1.49 (100) & 1.76 (100)\\ & 75\% & 1.01 (100) & 0.61 (0) & 1.23 (100) & 1.45 (100)\\ & 50\% & 0.85 (100) & 0.47 (0) & 1.00 (100) & 1.12 (100) \\ & 25\% & 0.62 (100) & 0.29 (0) & 1.04 (100) & 0.79 (100)\\ \hline \multirow{4}{*}{1000} & 100\% & 1.11 (100) & 0.80 (0) & 1.46 (100) & 1.78 (100)\\ & 75\% & 0.99 (100) & 0.64 (0) & 1.17 (100) & 1.46 (100)\\ & 50\% & 0.82 (100) & 0.49 (0) & 1.05 (100) & 1.15 (100)\\ & 25\% & 0.65 (100) & 0.34 (0) & 0.75 (100) & 0.82 (100)\\ \hline \multicolumn{6}{c|}{Scenario 3}\\ \hline $n$ & Compliance level & EDTR 1 & EDTR 2 & EDTR 3 & EDTR 4 \\ \hline \multirow{4}{*}{250} & 100\% & 3.93 (100) & 3.39 (100) & 1.85 (5) & 1.80 (0) \\ & 75\% & 3.19 (100) & 2.74 (100) & 1.57 (9) & 1.55 (8.5) \\ & 50\% & 2.47 (100) & 1.99 (100) & 1.19 (9.5) & 1.20 (10.5) \\ & 25\% & 2.21 (100) & 1.67 (100) & 0.84 (7) & 0.81 (6)\\ \hline \multirow{4}{*}{500} & 100\% & 3.93 (100) & 3.41 (100) & 1.83 (3) & 1.82 (0.5) \\ & 75\% & 3.21 (100) & 2.74 (100) & 1.55 (7) & 1.55 (8) \\ & 50\% & 2.47 (100) & 2.01 (100) & 1.17 (9) & 1.19 (9.5) \\ & 25\% & 2.22 (100) & 1.65 (100) & 0.86 (7) & 0.81 (7)\\ \hline \multirow{4}{*}{1000} & 100\% & 3.99 (100) & 3.42 (100) & 1.86 (3.5) & 1.82 (0.5) \\ & 75\% & 3.23 (100) & 2.77 (100) & 1.52 (5) & 1.54 (7) \\ & 50\% & 2.50 (100) & 2.01 (100) & 1.20 (5) & 1.21 (4.5) \\ & 25\% & 2.24 (100) & 1.64 (100) & 0.89 (7) & 0.84 (6)\\ \hline \end{tabular} \label{tabs2} \end{table} \begin{table}[h] \centering \small \caption{Sensitivity analysis of Assumption 3. Bias and standard errors (multiplied by 10) for the conditional mean of outcomes for each treatment sequence with the Gaussian copula replaced by a $t$-copula.} \begin{tabular}{ |c|c|c|c|c|c|c| } \hline $n$ & Seq 1 & Seq 2 & Seq 3 & Sec 4 & Sec 5 & Seq 6 \\ \hline 250 & 0.25(1.71) & -0.20(1.64) & -0.11(1.05) & -0.05(2.22) & -0.03(1.33) & -0.10(2.10)\\ \hline 500 & 0.05(1.04) & -0.08(1.11) & -0.05(0.88) & -0.03(1.86) & -0.02(0.98) & 0.10(1.25)\\ \hline 1000 & -0.01(0.57) & -0.00(0.95) & -0.01(0.74) & -0.02(1.01) & -0.01(0.79) & -0.08(0.86)\\ \hline \end{tabular} \label{tabs3} \end{table} \section{Real data application: ENGAGE study} \label{s:real} In this section, we apply our proposed method to the ENGAGE study, and determine which EDTRs are best for certain compliance levels. The data provides longitudinal measurements on patients' ongoing performance given time-varying covariates. We define the outcome as the log of the sum of days from weeks 2 to 24 in which the patient consumed alcohol and the sum of days the patient consumed cocaine plus a small positive constant (0.5), which indicates that smaller values correspond to better outcomes. The sample size is $n=148$, and the covariates include gender (male and female), race (African-American, and non-African-American), and education level. In Figure \ref{fig1}, we plot the histogram of the observed outcomes, and it exhibits a bimodal shape. Hence the parametric assumption of a normal family may be too restrictive which highlights the importance of modeling the potential outcomes using a non-parametric Bayesian approach. \begin{figure}[t] \centering \scalebox{0.8}{\includegraphics{complianceplot.pdf}} \caption{ENGAGE study. Histogram of log of sum of days of drinking and sum of days of consuming cocaine} \label{fig1} \end{figure} \iffalse \begin{table}[h] \centering \small \caption{ENGAGE study. Point estimates of average potential outcomes along with the standard errors for four embedded dynamic treatment regimes} \begin{tabular}{ c|c|c|c|c|} \hline &EDTR 1 & EDTR 2 & EDTR 3 & EDTR 4\\ \hline Estimate & 1.67 & 1.62 & 2.36 & 2.35\\ \hline Standard Error & 0.25 & 0.21 & 0.36 & 0.28\\\hline \end{tabular} \label{tr1} \end{table} \fi The effect of interventions for substance use varies across gender and race \citep{verissimo2017influence}. We perform our analyses on the following three subgroups: African-American men, non-African-American men, and African-American women. The subgroup non-African-American women is omitted due to the small sample size. We study four specific compliance values: $100\%$, $75\%$, $50\%$ and $25\%$. For each stratum, we set the education level to the median as well. \iffalse \begin{table}[h] \centering \small \caption{ENGAGE study. Point estimates of average potential outcomes along with the standard errors for four embedded dynamic treatment regimes given different compliance levels } \begin{tabular}{cccccc} \multicolumn{5}{c}{Mean EDTR outcomes for Afro-American Men}\\ \hline\\ Compliance class & EDTR 1 & EDTR 2 & EDTR 3 & EDTR 4 & best EDTR \\ \hline 100\% & 1.69 (0.21) & 1.63 (0.19) & 2.86 (0.20) & 2.22 (0.20) & 1,2\\ \hline 75\%-100\% & 1.74 (0.25) & 1.67 (0.22) & 2.91 (0.19) & 2.33 (0.22) & 1,2\\ \hline 50\%-75\% & 1.79 (0.26) & 1.69 (0.22) & 2.94 (0.19) & 2.41 (0.21) & 1,2\\ \hline 25\%-50\% & 1.83 (0.25) & 1.72 (0.23) & 2.95 (0.19) & 2.44 (0.21) & 1,2\\ \hline 0\%-25\% & 1.83 (0.24) & 1.74 (0.21) & 2.99 (0.19) & 2.52 (0.22) & 1,2\\ \hline \multicolumn{5}{c}{Mean EDTR outcomes for non Afro-American men}\\ \hline\\ Compliance class & EDTR 1 & EDTR 2 & EDTR 3 & EDTR 4 \\ \hline 100\% & 1.44 (0.21) & 1.39 (0.19) & 2.55 (0.19) & 1.98 (0.20) & 1,2\\ \hline 75\%-100\% & 1.48 (0.25) & 1.44 (0.22) & 2.59 (0.19) & 2.03 (0.22) & 1,2\\ \hline 50\%-75\% & 1.49 (0.25) & 1.45 (0.23) & 2.61 (0.20) & 2.04 (0.22) & 1,2\\ \hline 25\%-50\% & 1.59 (0.26) & 1.51 (0.22) & 2.65 (0.20) & 2.12 (0.21) & 1,2\\ \hline 0\%-25\% & 1.64 (0.25) & 1.62 (0.22) & 2.72 (0.21) & 2.21 (0.22) & 1,2\\ \hline \multicolumn{5}{c}{Mean EDTR outcomes for Afro-American women}\\ \hline\\ Compliance level & EDTR 1 & EDTR 2 & EDTR 3 & EDTR 4 \\ \hline 100\% & 1.58 (0.21) & 1.46 (0.19) & 2.62 (0.20) & 2.17 (0.20) & 1,2\\ \hline 75\%-100\% & 1.67 (0.21) & 1.52 (0.19) & 2.63 (0.19) & 2.18 (0.20) & 1,2\\ \hline 50\%-75\% & 1.65 (0.21) & 1.51 (0.19) & 2.64 (0.19) & 2.19 (0.21) & 1,2\\ \hline 25\%-50\% & 1.70 (0.21) & 1.54 (0.19) & 2.64 (0.19) & 2.20 (0.21) & 1,2\\ \hline 0\%-25\% & 1.85 (0.25) & 1.78 (0.23) & 2.85 (0.18) & 2.39 (0.21) & 1,2\\ \hline \end{tabular} \label{tabdtr1} \end{table} \fi \begin{table}[h] \centering \small \caption{ENGAGE study. Point estimates of average potential outcomes along with the standard errors for four embedded dynamic treatment regimes given different compliance levels (i.e., PCEs)} \begin{tabular}{cccccc} \multicolumn{5}{c}{Mean EDTR outcomes for Afro-American Men}\\ \hline\\ Compliance level & EDTR 1 & EDTR 2 & EDTR 3 & EDTR 4 & best EDTR \\ \hline 100\% & 1.31 (0.22) & 1.28 (0.19) & 2.01 (0.21) & 1.98 (0.21) & 1,2\\ \hline 75\% & 1.39 (0.22) & 1.34 (0.21) & 2.69 (0.21) & 2.21 (0.21) & 1,2\\ \hline 50\% & 1.65 (0.25) & 1.61 (0.22) & 2.89 (0.18) & 2.29 (0.22) & 1,2\\ \hline 25\% & 1.83 (0.30) & 1.99 (0.25) & 3.14 (0.20) & 2.30 (0.24) & 1,2,4\\ \hline \multicolumn{5}{c}{Mean EDTR outcomes for non Afro-American men}\\ \hline\\ Compliance level & EDTR 1 & EDTR 2 & EDTR 3 & EDTR 4 & best EDTR \\ \hline 100\% & 1.07 (0.21) & 1.09 (0.20) & 2.26 (0.21) & 1.88 (0.21) & 1,2\\ \hline 75\% & 1.20 (0.23) & 1.29 (0.19) & 2.35 (0.21) & 1.87 (0.22) & 1,2\\ \hline 50\% & 1.88 (0.27) & 1.84 (0.26) & 2.70 (0.19) & 2.05 (0.24) & 1,2\\ \hline 25\% & 2.15 (0.32) & 2.13 (0.28) & 3.05 (0.23) & 2.17 (0.27) & 1,2,4\\ \hline \multicolumn{5}{c}{Mean EDTR outcomes for Afro-American women}\\ \hline\\ Compliance level & EDTR 1 & EDTR 2 & EDTR 3 & EDTR 4 & best EDTR \\ \hline 100\% & 1.36 (0.21) & 1.21 (0.21) & 2.24 (0.22) & 1.97 (0.23) & 1,2\\ \hline 75\% & 1.38 (0.23) & 1.31 (0.22) & 2.55 (0.18) & 2.06 (0.16) & 1,2\\ \hline 50\% & 1.82 (0.21) & 1.68 (0.19) & 2.64 (0.19) & 2.19 (0.21) & 1,2\\ \hline 25\% & 2.21 (0.29) & 2.08 (0.25) & 3.01 (0.19) & 2.44 (0.24) & 1,2,4\\ \hline \multicolumn{5}{c}{Mean EDTR outcomes for the overall population}\\ \hline\\ Compliance level & EDTR 1 & EDTR 2 & EDTR 3 & EDTR 4 & best EDTR \\ \hline 100\% & 1.21 (0.21) & 1.12 (0.21) & 2.13 (0.22) & 1.91 (0.21) & 1,2\\ \hline 75\% & 1.25 (0.22) & 1.30 (0.21) & 2.41 (0.19) & 2.01 (0.19) & 1,2\\ \hline 50\% & 1.72 (0.24) & 1.77 (0.22) & 2.71 (0.19) & 1.98 (0.21) & 1,2\\ \hline 25\% & 1.98 (0.29) & 2.06 (0.26) & 3.06 (0.20) & 2.21 (0.25) & 1,2,4\\ \hline \end{tabular} \label{tabdtr1} \end{table} In Table \ref{tabdtr1}, we summarize the mean EDTR outcomes along with the standard errors for the overall population, as well as the different subgroups. We use the multiple comparisons with the best (MCB) \citep{hsu1981simultaneous,ertefaie2016identifying} method to identify the EDTRs that are the best, insignificantly different from the best, and significantly different from the best. We again use the MCB method to obtain a credible interval for the difference between each level mean and the best of the remaining level means. This will allow the clinician to select an optimal EDTR while taking into account the cost etc. Table \ref{tabdtr1} shows that EDTRs 1 and 2 are very close and perform better than EDTRs 3 and 4 across all the compliance levels, except for 25\%. The set of best EDTRs includes EDTR 1 and 2 for the upper level compliances, i.e., 100\%, 75\% and 50\%. For 25\% compliance, the set of best EDTRs consists of EDTRs 1, 2 and 4. That is, patients who exhibit a relatively higher level of compliance benefit from starting with a more stringent intervention MI+IOP. For patients with a lower level of compliance, starting with MI-IOP is not distinguishable from Starting with MI-PC and receiving no further care after. Also, among the subgroups considered, non-African American men have the lowest number of days with alcohol or cocaine use (in log scale) across different EDTRs and compliance levels. As expected, as the compliance levels decrease, the mean outcomes under EDTRs increases suggesting that the intervention effect diminishes by lowering the compliance levels. \section{Discussion} \label{s:discussion} Accounting for compliance is challenging in clinical trials, since they are post-treatment variables. The notion of potential compliance is useful in this context, as we can determine the embedded DTRs as functions of potential compliances. However, for each treatment sequence, some of the potential compliances are latent, and need to be imputed. Using the proposed Bayesian approach, we treat the missing compliances as unknown parameters. Imputation of the missing compliances and estimation of the potential compliances are tied together, and are done sequentially through the MCMC steps. We use Metropolis-Hastings steps embedded inside a Block Gibbs sampler. A nonparametric approach for modeling the potential compliances as well as the potential outcomes allows us to handle complex underlying distributions, without imposing any parametric assumptions. By adapting this flexible nonparametric approach, we are able to achieve small bias and standard errors across different types of generative models and error distributions. An interesting extension of our proposed method will be to use a nonparametric copula instead of a Gaussian copula, although it might make the posterior computations a little more complex. Another important extension will be to investigate the theoretical properties of the proposed model. Establishing the large sample properties (for example, posterior consistency) for the conditional expectations $E(Y\vert \bm{D},X_0)$ is challenging due to the randomness of the imputed $\bm{D}$'s. However, since Dirichlet process mixtures have attractive theoretical properties, one can expect to have at least posterior consistency, but the details merit further research. \bibliographystyle{apalike}
\section{Introduction} \label{intro} The correlation between successive radiations emitted by de-exciting nuclei has been theoretically predicted from the 1940's, when Hamilton~\cite{Hamilton1940_PhysRev.58.122} and Goertzel~\cite{Goertzel_1946_PhysRev.70.897} predicted that there should be an anisotropy between two successive quanta emitted from a single radiative system. The first experimental evidence was published by Brandy and Deutsch~\cite{Brandy_PhysRev.78.558}, by observing the angular correlations of successive gamma rays in six even-even nuclei. Their results have been found to be in agreement with the theoretical predictions. In general, the anisotropy of a radiation emitted from a state with spin $J$ arises from the unequal population of the $2J+1$ magnetic $m$-substates. Biedenharn, Rose and Brink~\cite{Biedenharn_Rose_RevModPhys.25.729, Rose_Brink_Revmodphys_1967} have developed the formal theory of angular correlations, by defining the statistical tensors $\rho_q^\lambda(J)$ for a nuclear state of spin $J$, using the density matrix formalism~\cite{Fano_1957_RevModPhys.29.74}. These statistical tensors are expansions of the density matrix in the angular momentum space, and provide a very convenient means of describing the information of the unequal $m$ populations in nuclear levels. More details for the statistical tensor formalism can be found in~\cite{Hamilton1975_electromagnetic}. The evaluation of the statistical tensors for a cascade of two or more radiations, leads to the determination of the angular correlation function which describes the anisotropy between the emitted radiations. For a cascade of two subsequent $\gamma$-rays, the angular correlation function, i.e. the probability of detecting these two $\gamma$-rays within a relative angle $\theta_{rel}$ is determined as~\cite{Hamilton1975_electromagnetic,DEGROOT1952_1201,Kraus_1953}: \begin{equation}\label{eq: angular correlation function} W(\theta_{rel})= A_0 \left[1 + \sum_{\substack{\lambda>0 \\ \lambda = even}} a_\lambda P_\lambda( \cos \theta_{rel}) \right]. \end{equation} where $A_0$ is a normalization factor, $a_\lambda$ are coefficients that depend on the spins and multipolarities of the transitions~\cite{TAYLOR19711} and $P_\lambda$ are the ordinary Legendre polynomials. If polarization is not observed, only even values of $\lambda$ are kept in the sum. The summation is running up to twice the minimum of the spins and the multipolarities involved in the cascade ~\cite{Hamilton1975_electromagnetic,STUCHBERY200369}. The coefficients $a_\lambda$ contain the information about spins and the possible mixing ratios between the two or more types of radiation. \begin{comment} Experimentally, the determination of the spin of a state is performed by measuring the experimental angular distribution $W_{exp}(\theta_{rel}^i)$ for a number of relative angles $\theta^i_{rel}$. These angles are usually defined by the experimental setup and the relative positions of the detectors used. Then, by correcting for the efficiency and the detectors finite size dimensions, a $\chi^2$-test is performed by forming the statistic: \begin{equation}\label{eq:S_squared} S^2 = \sum_i \left[ \frac{W_{exp}(\theta_{rel}^i)-W_{th}(\delta,\theta^i_{rel}) }{\sigma_{W_i}} \right]^2 \end{equation} for all possible spins and mixing ratios of the cascade. The values of spin and mixing ratios which best describe the experimental data are then adopted as the real values. There are other variations in the statistical treatment of this technique, and it is thoroughly discussed in~\cite{ROBINSON1990386}. It is important to note, that the correct application of this technique require the determination of the correction factors $Q_\lambda$, to account for the finite size dimensions of the detectors. Beyond the measurement of two successive gamma radiations, it is often useful and sometimes more accurate to measure three gammas in coincidence (triple gamma correlations)~\cite{Krane_1988_PhysRevC.37.747}. In~\cite{KRANE1983321}, it is argued that the use of triple angular correlations can provide more accurate results for the mixing ratio, as the sensitivity of the angular correlation coefficients as a function of the mixing ratio is higher. However this technique is not used as often as the double-gamma correlation technique, probably because of its complexity and the larger experimental time needed to obtain the same statistics on the data. \end{comment} In the present work, a method for simulating the full effect of angular correlations is explained in detail. The particular method can be coupled to powerful codes such as FIFRELIN~\cite{Litaize_2010_PhysRevC.82.054616,LITAIZE201251,Litaize2015,REGNIER201619} and DICEBOX~\cite{BECVAR1998434}. The FIFRELIN code has been developed for the evaluation of fission data providing accurate description on the neutron and gamma properties of the fission process. FIFRELIN employs a Monte Carlo Hauser-Feshbach framework based on Bečvár’s algorithm devoted to gamma emission~\cite{BECVAR1998434} and extended to coupled neutron/gamma emission~\cite{Litaize_2010_PhysRevC.82.054616}. A sample of nuclear level schemes is generated taking into account the uncertainties from nuclear structure. FIFRELIN samples the lower energy part of the level scheme from the RIPL-3 database~\cite{CAPOTE20093107}. For the higher energy part, a combination between known levels and theoretical nuclear models (level densities, gamma strength functions, spin/parity distributions) is used, to account for the unknown part of the true level scheme of the nucleus of interest. The FIFRELIN code is also used for the simulations which are performed for the STEREO experiment~\cite{Allemandou_2018}. Recent simulations performed for the particular experiment~\cite{Almazan2019}, which heavily rely on accurate description of the de-excitation of the Gd isotopes, have also demonstrated a better agreement of FIFRELIN with the data in comparison with GEANT4~\cite{Geant4_ALLISON2016186}. In addition, we discuss a novel approach for the determination of the observables that can be obtained from angular correlation or, in general, angular distribution measurements. This approach takes advantage of the Monte Carlo technique, in order to simulate the desired cascade of gammas (or other particles), according to the respective probability distributions that the formal theory provides. The extraction of a simulated angular correlation function $W_{sim}$, combined with detector simulations can be then directly compared to the experimental data. The important asset of this process is that triple or higher order angular correlations~\cite{Hamilton1975_electromagnetic, Singh_PhysRevC.4.1510,Krane_1988_PhysRevC.37.747,KRANE1983321,KRANE_steffen_wheeler_1973351} can be directly compared, without the derivation and use of complicated formulae. A triple $\gamma$ cascade angular correlation simulation is demonstrated in this work for the first time. Furthermore, a potential combination with the detector simulation eliminates the need for corrections due to the finite-size dimensions of the detectors~\cite{KRANE1972_solid_angle_205, Krane1973SolidangleCF, CAMP1969192, Moura_2019_doi:10.1119/1.5099891}. Although these corrections are usually small and often not used, they can play an important role for the accurate determination of the mixing ratio. In the following, the method to generate the full effect of directional $\gamma$-ray angular correlations in a cascade of transitions with an arbirtrary number of $\gamma$-rays is described in detail. The well known cascade $1384\rightarrow 885 \rightarrow 658$ from the decay of \textsuperscript{110m}Ag~\cite{Singh_PhysRevC.4.1510,Krane_1988_PhysRevC.37.747} is simulated and compared to the theoretical distributions. The potential coupling of the present work with simulations performed with FIFRELIN is also discussed, and the method is applied to FIFRELIN output for the isotope \textsuperscript{156}Gd. Applications of such coupled schemes for more complicated simulations such as the STEREO experiment simulation, are also discussed. \begin{figure*}[t] \centering \includegraphics[width=0.6\textwidth]{./figures/illustration_v3.pdf} \centering \caption{[Color online] Schematic illustration of the de-excitation scheme in a cascade of $\gamma$-rays. Each state is characterized by a spin $J$ and the statistical tensor $\rho^\lambda_q(J)$, which depends on the spins of the initial and final states, as well as the multipolarities and angles of emission of the previously emitted $\gamma$-ray. Transitions marked with red illustrate that the $\gamma$ ray is observed by a detector. See text for details.} \label{fig:illustration} \end{figure*} \section{Monte carlo simulation of the angular correlations} \label{sec:monte_carlo} \subsection{Theoretical description} A general method of simulating angular distributions and correlations from decaying particles with spin using the density matrix formalism~\cite{Fano_1957_RevModPhys.29.74}, has been presented in~\cite{AMSLER198321}. The event generator DECAY4~\cite{Ponkratenko2000} can simulate the effect of directional angular correlations, but the theoretical description in the article is not detailed. GEANT4~\cite{Geant4_ALLISON2016186,geant_4_sim_2017} has also the capability of simulating $\gamma$ directional correlations, by employing also the density matrix formalism, but there is no detailed documentation or step-by-step mathematical description. Furthermore, its use is restricted to radioactive sources~\cite{Turner_2020}. In addition, simulations of angular correlations have been previously made as extensions to GEANT4~{\cite{SMITH201947}}. For this work, the formal theory of angular distributions of radiation will be used, employing the density matrix formalism, and specifically its multipole expansions which are called statistical tensors~\cite{Rose_Brink_Revmodphys_1967,Hamilton1975_electromagnetic}. Their calculation is essential for the determination of the probability distribution functions which describe the directions of $\gamma$-rays in the cascade. For a cascade of $\gamma$-rays starting from an initial state $J_0$ and ending to a state $J_n$: \begin{equation}\label{eq:cascade1} J_0 \xrightarrow[]{\gamma_0} J_1 \xrightarrow[]{\gamma_1} ... \xrightarrow[]{\gamma_{n-1}} J_n \end{equation} a set of statistical tensors can be calculated, depending on the orientation of the initial state $J_0$. The set of transitions $\gamma_0$, $\gamma_1...\gamma_{n-1}$ can be either all observed or partly unobserved by a detector, as illustrated in Fig.~\ref{fig:illustration}. If the initial state is randomly oriented, as in the case of $\beta$-decay where the $\beta$-particle is not observed or an ($n,\gamma$) reaction with thermal neutrons~\cite{Snelling_1983}, then the statistical tensor takes the simple form~\cite{Hamilton1975_electromagnetic,STUCHBERY200369}: \begin{equation}\label{eq: initial statistical tensor} \rho^{\lambda}_q (J_0)= \delta_{\lambda 0} \delta_{q 0} \end{equation} where $\delta_{ij}$ is the Kronecker delta, $\lambda$ is the rank of the statistical tensor and q takes integer values between $-\lambda$ and $\lambda$. If the initial state $J_0$ is oriented, i.e. after a nuclear reaction, the initial statistical tensor must be computed in the framework of the particular reaction or be measured experimentally. By knowing the initial-state statistical tensor, all the statistical tensors can then be calculated from the recursive master equation~\cite{Hamilton1975_electromagnetic,STUCHBERY200369}: \begin{align}\label{eq: statistical tensor next simplified} \rho^{\lambda_f}_{q_f} (J_f) &= \sum_{\lambda_i, \lambda, q, q_i} (-1)^{\lambda_i+q_i} \sqrt{2 \lambda +1}\; \rho^{\lambda_i}_{q_i} (J_i) \tj{\lambda_f}{\lambda}{\lambda_i}{-q_f}{q}{q_i} A^{\lambda_i \lambda_f}_\lambda(J_f,J_i,L,L') \mathcal{D}^{\lambda *}_{ q 0}(\phi_i,\theta_i,0) \end{align} where $\tj{\lambda_f}{\lambda}{\lambda_i}{-q_f}{q}{q_i}$ is the Wigner $3j$ symbol~\cite{abramovitz_handbook_1964,Wigner1993}, $A^{\lambda_i \lambda_f}_\lambda$ is the generalized angular distribution coefficient and $\mathcal{D}^{\lambda *}_{ q 0}(\phi_i,\theta_i,0)$ is a Wigner D-matrix~\cite{Wigner1993}. For the summation indices, if polarization is not observed, $\lambda_{i,f} = 0, 2, 4, . . ., 2I_{i,f}$ for integer values of $I_{i,f}$, while $\lambda_{i,f} = 0, 2, 4,. . . , 2I_{i,f} − 1$ for half-integer values of $I_{i,f}$. Also, $\lambda= 0, 2, 4 .., 2L_{max}$, where $L_{max}$ is the maximum of two lowest multipolarities $L, L'$ of the radiation. The index $q$ takes integer values within the interval $[-\lambda,+\lambda]$. The same applies to $q_i$ and $q_f$, with respect to $\lambda_i$ and $\lambda_f$. The generalized angular distribution coefficients are given by the relation: \begin{align}\label{eq: generalized ang_distro coeff} A^{\lambda_i \lambda_f}_\lambda(J_f,J_i,L,L') &= \frac{1}{1+\delta^2} [ F^{\lambda_i \lambda_f}_\lambda(L,L,J_f, J_i) + 2\delta F^{\lambda_i \lambda_f}_\lambda(L,L'J_f, J_i) + \delta^2 F^{\lambda_i \lambda_f}_\lambda(L',L',J_f, J_i) ] \end{align} where $\delta$ is the multipolarity mixing ratio of the two lowest multipolarities $L,L'$ of the $\gamma$-transition~\cite{KRANE1975_mixing_ratio_383}. The generalized $F$-coefficients, $F^{\lambda_i \lambda_f}_\lambda$, are functions of Wigner $3j$ and $9j$ symbols~\cite{abramovitz_handbook_1964, Wigner1993} and have been extensively tabulated in literature \cite{Hamilton1975_electromagnetic,KRANE_steffen_wheeler_1973351}. They can be calculated using the relationship: \begin{align}\label{eq: generalized F coeff} F^{\lambda_i \lambda_f}_\lambda(L,L',J_i,J_f) &= (-1)^{L'+\lambda_i+\lambda_f+\lambda} \sqrt{(2J_i+1)(2J_f+1)(2L+1)(2L'+1)} \nonumber \\ &\times \sqrt{(2\lambda_i+1)(2\lambda_f+1)(2\lambda+1)} \tj{L}{L'}{\lambda}{1}{-1}{0} \nj{J_f}{L}{J_i}{J_f}{L'}{J_i}{\lambda_f}{\lambda}{\lambda_i} \end{align} The Wigner D-Matrix is related to the spherical harmonics and the associated Legendre polynomials as~\cite{STUCHBERY200369,KRANE_steffen_wheeler_1973351}: \begin{equation} \mathcal{D}^{\lambda *}_{ q 0}(\phi,\theta,0) = (-1)^q \sqrt{ \frac{4 \pi}{2 \lambda+1}}\; Y^{\lambda}_{-q} (\theta, \phi) = (-1)^{(q+|q|)/2} \sqrt{ \frac{(\lambda-|q|)!}{(\lambda+|q|)!}}\; P_\lambda^{|q|}(\cos \theta)\; e^{-iq \phi}. \end{equation} The description of the populations of the $m-$substates with the use of statistical tensors provides the advantage that all the populations of the subsequent states can be calculated using the master equation (Eq.~\ref{eq: statistical tensor next simplified}) and the direction $(\theta_i,\phi_i)$ of the emitted $\gamma$-ray. The directions are defined with respect to the frame of reference of the initial statistical tensor $ \rho^{\lambda}_q (J_0)$. \subsection{Generation of the events} After evaluating the statistical tensor for a state in the cascade, the two-dimensional angular distribution function can be evaluated by summing over the quantum numbers of the next state~\cite{Hamilton1975_electromagnetic, STUCHBERY200369}, which at this part of the simulation process is considered unobserved (i.e. the $\gamma$-ray coming from the final state has not being emitted yet in the simulation). For the case of directional correlations, the angular distribution function is given by the relation: \begin{align}\label{eq: distribution function} W(\theta_i,\phi_i) &= \sum_{\lambda_f, q_f} (-1)^{\lambda+q_f} \sqrt{2 \lambda_f +1} \rho^{\lambda_f}_{q_f} (J_f) A_{\lambda_f}(L,L',J_i,J_f,\delta) \mathcal{D}^{\lambda_f *}_{ q_f 0}(\phi_i,\theta_i,0) \end{align} where the coefficient $A_{\lambda_f}(L,L',J_i,J_f,\delta)$ is called \textit{angular distribution coefficient} and is given by the relationship~\cite{Hamilton1975_electromagnetic}: \begin{align}\label{eq: angular distribution coefficients} A_\lambda(L,L',J_i,J_f,\delta) &= \dfrac{1}{1+\delta^2} \left[ F_\lambda(L,L,J_i,J_f) + 2 \delta F_\lambda(L,L',J_i,J_f)+ \delta^2 F_\lambda(L',L',J_i,J_f) \right] \end{align} In the above equations, the $F$-coefficients are given by the formula~\cite{Hamilton_1985,Ferentz_F_coeff}: \begin{equation}\label{eq: F-coefficient} F_\lambda(L,L',J_i,J_f) = (-1)^{J_i+J_f-1} \sqrt{ (2\lambda+1)(2L+1)(2 L'+1)(2 J_i+1) } \tj{L}{L'}{\lambda}{1}{-1}{0} \sj{L}{L'}{\lambda}{J_i}{J_i}{J_f}; \end{equation} where $\sj{L}{L'}{\lambda}{J_i}{J_i}{J_f}$ is the Wigner $6j$ symbol \cite{abramovitz_handbook_1964,Wigner1993}. Thus, the simulation of the angular correlations or distributions can be performed by generating a set of directions from each of the calculated distribution functions, while moving down the cascade. The statistical tensors have to be calculated each time, after the generation of each event since they depend on the angles of emission of $\gamma$-ray that feeds the current state, as shown in Eq.~\ref{eq: statistical tensor next simplified}. The result of Eq.~\ref{eq: distribution function} should be always real for directional correlations, as it constitutes an observable quantity of the decaying nucleus. \begin{comment} The distribution function in Eq.~\ref{eq: distribution function} is determined for each state and the events can be generated using the acceptance-rejection algorithm~\cite{vonNeumann1951} for a two-dimensional function. The rejection method can be faster in this case, because the parameters of the distribution function depend on the angle of the previously emitted $\gamma$-ray. Thus, other methods which have to calculate the integral of the function for every generation can be significantly slower. \end{comment} \section{Results} \label{sec:application} \subsection{Double \texorpdfstring{$\gamma$}--cascades} \begin{figure*}[t!] \centering \begin{subfigure}[c]{0.50\textwidth} \includegraphics[width=\textwidth]{./figures/420.pdf} \centering \caption{} \label{fig: 420} \end{subfigure}% \begin{subfigure}[c]{0.50\textwidth} \includegraphics[width=\textwidth]{./figures/542_mix.pdf} \centering \caption{} \label{fig: 542} \end{subfigure} \begin{subfigure}[c]{0.50\textwidth} \includegraphics[width=\textwidth]{./figures/540_un.pdf} \centering \caption{} \label{fig: 540_un} \end{subfigure}% \begin{subfigure}[c]{0.50\textwidth} \includegraphics[width=\textwidth]{./figures/5420triple.pdf} \centering \caption{} \label{fig: 5420triple} \end{subfigure} \caption{[Color online] Monte-Carlo simulation of the $\gamma$ directional correlations for the cascade $5^- \rightarrow 4^+ \rightarrow 2^+ \rightarrow 0^+$. In (a), the distribution of relative angles for the cascade $4^+ \rightarrow 2^+ \rightarrow 0$ is shown. In (b), the distribution of relative angles for the transitions $5^- \xrightarrow[]{\delta = -0.42} 4^+ \rightarrow 2^+$ is shown. In (c), the angular correlation between the first and third transition of the same cascade is shown. The intermediate transition is treated as unobserved. In (d), the triple $\gamma$ correlation for the same cascade for the $N1$ geometry is shown (see text for details). All theoretical curves are also shown. The red arrows indicate which transitions are considered as observed.} \label{fig: cascade} \end{figure*} A simulation of a cascade of three $\gamma$-rays was performed using the present framework. The $5^- \rightarrow 4^+ \rightarrow 2^+ \rightarrow 0^+$ cascade in $^{110}$Cd, with a mixing ratio of $\delta_0 = -0.42$ for the first transition ($5^- \rightarrow 4^+$), has been extensively studied in~\cite{Krane_1988_PhysRevC.37.747}. The results of the simulation are shown in Fig~\ref{fig: cascade}. The simulation generates a pair of coordinates $(\theta_i, \phi_i)$ for each transition $i$. In order to check that the simulation gives the results expected from theory, a direct comparison can be made, by distributing the relative angles of two transitions. The scalar product between the two directions of the two consecutive $\gamma$ rays can be calculated and distributed to a histogram as shown in Fig.~\ref{fig: cascade}. In Fig~\ref{fig: 420}, the distribution of relative angles of the last two $\gamma$ rays is shown. This is a common $4^+ \rightarrow 2^+ \rightarrow 0^+$ cascade, where the two $\gamma$-rays are of pure $E2$ character. The distribution of relative angles is given by the angular distribution function (Eq.~\ref{eq: angular correlation function}), where the coefficients $a_\lambda$ can be calculated using the relationship: \begin{equation}\label{eq: a2a4coefficients} a_\lambda = B_\lambda(L,L',J_f,J_i,\delta_0) A_\lambda(L,L',J_i,J_f,\delta_1) \end{equation} where the functions $B_\lambda(L,L',J_f,J_i)$ are called \textit{orientation parameters} and can be calculated using the formula~\cite{Hamilton1975_electromagnetic, Blin-Stoyle1957}: \begin{align}\label{eq: orientation parameters} B_\lambda(L,L',J_f,J_i,\delta_0) &= \dfrac{1}{1+\delta_0^2} \left[ F_\lambda(L,L,J_f,J_i) + (-1)^{L+L'} 2 \delta_0 F_\lambda(L,L',J_f,J_i) + \delta_0^2 F_\lambda(L',L',J_f,J_i)\right] \end{align} while the coefficients $A_\lambda(L,L',J_i,J_f,\delta_1)$ are the angular distributions coefficients and can be calculated from Eq.~\ref{eq: angular distribution coefficients}. Note that the right-hand side of the expressions in Eq. \ref{eq: angular distribution coefficients} and Eq. \ref{eq: orientation parameters} are not entirely identical, but they differ by a phase factor $(-1)^{L+L'}$. For the specific case of the $4^+ \rightarrow 2^+ \rightarrow 0^+$ cascade, where the transitions are of pure $E2$ character and thus $\delta_0,\delta_1 = 0$, the results for $a_2$ yield: \begin{align}\label{eq: a2_420} a_2 &= B_2(2,3,2,4,0) A_2(2,2,2,0,0) = (-0.171) \times (-0.598) = 0.102 \end{align} while for $a_4$: \begin{align}\label{eq: a4_420} a_4 &= B_4(2,3,2,4,0) A_4(2,2,2,0,0) = 0.009 \end{align} The above calculations agree with the tabulated results~\cite{TAYLOR19711} as well as with the very reliable on-line angular correlation calculator developed by the Griffin collaboration~\cite{ang_corr_calc}. The theoretical curve given by Eq.~\ref{eq: angular correlation function} is shown in Fig.~\ref{fig: 420}, along with the simulation results. In order to check the agreement, a $\chi^2$-test has been performed between the theoretical and simulated values. The value of the reduced $\chi^2$ yields $\chi^2/NDF = 1.30$. The value is close to 1, which indicates a very good agreement between the theory and the simulation. The same is shown for the upper part of the cascade ($5^- \xrightarrow{-0.42} 4^+ \rightarrow 2^+ $) in Fig.~\ref{fig: 542}. The simulation is in complete agreement with the theoretical values. The value of the reduced $\chi^2/NDF = 0.86$, indicating again a very good agreement. \subsection{Simulation of a double \texorpdfstring{$\gamma$}--cascade with intermediate unobserved radiations} The present simulation is able to reproduce the angular correlation between two $\gamma$-radiations, with one or more intermediate $\gamma$-rays that are not observed by a detector. This can be checked by histogramming the scalar product of two $\gamma$-rays of interest in cascade of more than two transitions. The same cascade as before is tested, but now the distribution of relative angle between the first and the third $\gamma$-rays is studied. As in the case of two consecutive $\gamma$-rays, the angular correlation function~(Eq.~\ref{eq: angular correlation function}) is used to describe the angular correlation between $\gamma$-rays with intermediate unobserved radiations. The difference here is that the evaluation of the theoretical coefficients $a_\lambda$ requires the inclusion of a $U(L,L',J_i,J_f,\delta)$ factor called \textit{de-orientation coefficient}~\cite{Hamilton1975_electromagnetic}, to account for any intermediate unobserved transitions. Thus, for the specific case of the transitions $5^- \rightarrow 4^+$ and $ 2^+ \rightarrow 0^+ $, where the intermediate transition ($4^+ \rightarrow 2^+$) is treated as unobserved, the coefficients $a_2, a_4$ are computed as follows: \begin{align}\label{eq: a2a4coefficients_deorientation} a_\lambda &= B_\lambda(1,2,5,5,-0.42) U_\lambda(2,3,4,2,0) A_\lambda(2,2,2,0,0) \end{align} which yield $a_2 = -0.322$ and $a_4 = -0.009$. The theoretical angular correlation function, along with the results of the simulation is plotted in Fig~\ref{fig: 540_un}. A $\chi^2$-test between the theoretical curve and simulated value, yields $\chi^2/NDF = 1.25$, demonstrating the very good agreement between simulation and theory. It is important to note, that this approach works for any number of intermediate unobserved transitions. The number of de-orientation coefficients used in determining the angular correlation coefficients is the same as the number of unobserved intermediate transitions. \subsection{Triple--\texorpdfstring{$\gamma$}~~correlations} The case of three observed $\gamma$-rays in a cascade is also reproduced within the present framework. The determination of the parameters that describe a $\gamma \gamma \gamma$ correlation are extensively described in~\cite{KRANE_steffen_wheeler_1973351}. In general, the three $\gamma$ rays can be detected in specific geometries, such as the N1 or N2 geometries described in~\cite{KRANE_steffen_wheeler_1973351} and in~\cite{Krane_1988_PhysRevC.37.747}. To demonstrate the ability of simulating triple cascades, the same cascade will be now simulated, but only the events that satisfy the N1 geometry, as described in~\cite{Krane_1988_PhysRevC.37.747} will be taken into consideration. More specifically, if we consider a cartesian coordinate frame $xyz$, the N1 geometry requires the first $\gamma$ to be emitted along the $z$-axis and the second $\gamma$ in the $x$ axis. Then, the distribution of the polar angle of the third $\gamma$-ray along the $y$ axis can be determined from the distribution function~\cite{KRANE_steffen_wheeler_1973351,Hamilton1975_electromagnetic}: \begin{equation}\label{eq: triple angular correlation function} W(\theta)= \Gamma_0 \left[1 + \sum_{\substack{\lambda>0 \\ \lambda = even}} \Gamma_\lambda P_\lambda( \cos \theta) \right].. \end{equation} where $\Gamma_0$ is a normalization factor, and $\Gamma_\lambda$ are coefficients that depend on spins and mixing ratios involved in the triple cascade. It is important to note, that the coefficients $\Gamma_\lambda$ are defined differently from the coefficients $a_\lambda$ for double cascades, which appear in Eq.~\ref{eq: angular correlation function}. The coefficients $\Gamma_\lambda$ for the previously simulated triple cascade $5^- \xrightarrow{-0.42} 4^+ \rightarrow 2^+ \rightarrow 0+$ have been calculated theoretically in~\cite{Krane_1988_PhysRevC.37.747}, yielding $\Gamma_2 = -0.307$ and $\Gamma_4 = -0.013$. The simulated triple correlation along with the theoretical result is shown in Fig.~\ref{fig: 5420triple}. As illustrated, there is a very good agreement between the theory and the simulation. It has to be noted that the comparison involved a simulation with a large number of events emitted in all space ($\sim 800$ million). The comparison was made by selecting the events which are close to the particular geometry . In detail, the distribution of polar angle $\theta_2$ was accepted as a simulation event if and only if the directions of the three $\gamma$ rays $\gamma_0,\gamma_1,\gamma_2$ fall into these limits: $\theta_0 < 0.1$, $1.47 < \theta_1< 1.67$, $\phi_1<0.1$ and $\phi_1>6.18$, and $1.47< \phi_2<1.67$, where the angle intervals are in radians. The value of $\chi^2/NDF$ yields 1.09. Furthermore, the theoretical calculations performed in~\cite{Krane_1988_PhysRevC.37.747} involved also the solid angle correction factors, but their effect is expected to be small, concerning the distances mentioned in the same work. Correlations of higher order than the triple $\gamma$-cascade have not been explored in literature. However, the results until now demonstrate the ability of simulating the complete effect of the correlation of $\gamma$-rays, including correlations that are still unexplored. \subsection{Coupling with FIFRELIN: The case of \texorpdfstring{\textsuperscript{156}}~Gd} The present method has been coupled with the output of FIFRELIN code for the case of \textsuperscript{156}Gd. The accurate description of the de-excitation of the specific isotope of Gd is important for the accurate simulation of the STEREO experiment. For this case, 10 million cascades of the particular isotope were generated by FIFRELIN. The present framework was then applied on the output and the results for four cases of double correlations are presented in Fig.~\ref{fig: 156Gd cascades}. The cascade $6^+ \rightarrow 4^+ \rightarrow 2^+$ of the rotational ground-state band of \textsuperscript{156}Gd is shown in the upper part of the figure along with the respective theoretical calculation. The particular cascade consists of two stretched $E2$ transitions and a typical theoretical calculation yields for the correlation coefficients $a_2 = 0.102$ and $a_4 = 0.009$. In the upper right part, the cascade $2^+_4 \rightarrow 4^+_1 \rightarrow 2^+_1$ is shown, which consists of two pure $E2$ transitions. The theoretical calculation for this spin sequence yields $a_2 = 0.200$ and $a_4 = 0.093$. In the bottom left part, the cascade $3^- \rightarrow 4^+ \rightarrow 2^+$ is shown, consisting of an $E1$ and an $E2$ transition. In this case the theoretical results are $a_2 = -0.14$ and $a_4 = 0$. Lastly, in the bottom right part of the figure, the $2^-_2 \rightarrow 2^+_3 \rightarrow 0^+_{g.s.}$ cascade is illustrated, where theoretical calculations result in $a_2=0.25$ and $a_4=0$. In all cases, the simulation results are in full agreement with the theoretical calculations. \begin{figure*}[t] \centering \begin{subfigure}[c]{0.5\textwidth} \includegraphics[width=\textwidth]{./figures/642Gd.pdf} \centering \caption{} \label{fig: 642Gd} \end{subfigure}% \begin{subfigure}[c]{0.5\textwidth} \includegraphics[width=\textwidth]{./figures/242Gd.pdf} \centering \caption{} \label{fig: 420Gd} \end{subfigure} \begin{subfigure}[c]{0.5\textwidth} \includegraphics[width=\textwidth]{./figures/342Gd.pdf} \centering \caption{} \label{fig: 020Gd} \end{subfigure}% \begin{subfigure}[c]{0.5\textwidth} \includegraphics[width=\textwidth]{./figures/220Gd.pdf} \centering \caption{} \label{fig: 220Gd} \end{subfigure} \caption{[Color Online] (a) The angular correlation of the ground-state band cascade $6^+_1 \rightarrow 4^+_1 \rightarrow 2^+_1$ of \textsuperscript{156}Gd, along with its theoretical distribution. (b) The same for the cascade $2^+_4 \rightarrow 4^+_1 \rightarrow 2^+_1$, (c) the cascade $3^-_1 \rightarrow 4^+_1 \rightarrow 2^+_1$ and (d) the cascade $2^-_2 \rightarrow 2^+_3 \rightarrow 0^+_{g.s.}$.} \label{fig: 156Gd cascades} \end{figure*} \section{Discussion} \label{sec:discussion} \subsection{Discussion of the method} Within the framework of the present work, the full effect of $\gamma$-ray directional correlations is reproduced for a nuclear cascade with an arbitrary number of $\gamma$-transitions. The results presented for this study show the power of the formal theory of angular correlations to reproduce the complete effect, by producing a set of directions $(\theta_i, \phi_i)$ for each $i$-th $\gamma$-ray. The present simulation is able to describe all the double $\gamma$-correlations in the cascade. Double $\gamma$-correlations are the most widely used, as their dependance on spins and mixing ratios is relatively simple, enabling them to be used for the experimental determination of spins and mixing ratios on nuclei with limited spectroscopic information. The effect is demonstrated in Fig.~\ref{fig: cascade} and can be generalized for any cascade. Of course, the simulation works even for odd-mass nuclei, whose spins are half-integer. Occasionaly, it is more convinient to measure a double $\gamma$-angular correlation with one or more intermediate unobserved radiations. Mathematically, this procedure includes an integration over positions of the intermediate $\gamma$, as the position is treated as an unobserved property of the system. The main reason for the study of such cascades aims to avoid problems in the data analysis. For example, the coincident counts of two consecutive transitions may overlap with background, making impossible the determination of an angular correlation between two consecutive $\gamma$-rays. In Fig.~\ref{fig: 540_un}, the effect is nicely demonstrated and in complete agreement with the theoretical distributions. The present method works for an arbitrary number of intermediate transitions. Higher order angular correlations can be also reproduced. A triple $\gamma$ angular correlation is shown in Fig.~\ref{fig: 5420triple}, with the first and second transition observed in fixed direction, while the direction of the third transition is variable, according to the N1 geometry, as defined in~\cite{KRANE_steffen_wheeler_1973351}. The potential of triple $\gamma$-ray directional correlations is explored in~\cite{KRANE1983321}, where has is been demonstrated that the coincidental observation of three $\gamma$-rays instead of two can lead to a more accurate determination of multipolarity mixing ratios. The main reason for this is that the sensitivity of the angular correlation coefficients $\Gamma_\lambda$, which are used in triple correlations, is higher than that of the coefficients $a_\lambda$ used in the double cascades. Correlations that involve four or higher observed transitions have not been explored, mainly because as the order of the type of correlation increases, the theoretical description becomes highly complex. The present method does not include attenuation/perturbation effects of the angular correlations due to relatively long half-lives (over 1 ns) of intermediate states~\cite{Hamilton_PhysRevC.5.899}. If, however, such an attenuation factor is measured for a particular cascade, it can be included in Eq.~\ref{eq: statistical tensor next simplified}, in order to correctly reproduce the attenuated angular correlation. \subsection{Coupling with FIFRELIN code} The present method can be coupled with powerful nuclear de-excitation codes such as FIFRELIN. FIFRELIN is a fission modelling code, which can simulate the de-excitation of every nucleus (not only a fission fragment) by neutron/gamma/conversion electron emission within the framework of nuclear realizations~\cite{BECVAR1998434}. The FIFRELIN code is used in various applications such the characterization of fission fragments~\cite{LITAIZE201251} as well in high energy physics simulations for the STEREO experiment~\cite{Allemandou_2018}. The full effect of directional $\gamma$ correlations can be a useful inclusion to simulations performed for such applications. As shown in Fig.~\ref{fig: 156Gd cascades}, the coupling of the present work with FIFRELIN is able to reproduce all angular correlations in the cascade. The present description can be applied to every isotope, both even and odd in mass number. For the moment, it is only restricted for $\gamma$-rays, but an implementation of other particle correlations, such as between internal conversion electrons, neutrons and gammas can be included in the future. \subsection{Potential for use in the experimental determination of spins and mixing ratios} Experimentally, the determination of the spin of a state is performed by measuring the experimental angular distribution $W_{exp}(\theta_{rel}^i)$ for a number of relative angles $\theta^i_{rel}$. These angles are usually defined by the experimental setup and the relative positions of the detectors used. Then, by correcting for the efficiency and the detectors finite size dimensions, a $\chi^2$-test is performed by forming the statistic: \begin{equation}\label{eq:S_squared} S^2 = \sum_i \left[ \frac{W_{exp}(\theta_{rel}^i)-W_{th}(\delta,\theta^i_{rel}) }{\sigma_{W_i}} \right]^2 \end{equation} for all possible spins and mixing ratios of the cascade. The values of spin and mixing ratios which best describe the experimental data are then adopted as the real values. There are other variations in the statistical treatment of this technique, and it is thoroughly discussed in~\cite{ROBINSON1990386}. It is important to note, that the correct application of this technique requires the determination of the correction factors $Q_\lambda$~\cite{KRANE1972_solid_angle_205,BARRETTE19711_solid_angle}, to account for the finite size dimensions of the detectors. These factors can be computed for simple co-axial geometries, but for complex geometries such those of clover detectors~\cite{Mutti_fipps_2018}, a simulation or additional measurements with known radioactive sources is necessary for their estimation. Within the present approach, the simulation of the $\gamma$ cascades removes some important difficulties during the ``traditional" analysis of the data in such measurements. Hence, by simulating the angular correlations in a cascade of many $\gamma$-rays and using it as input for the simulation of the detector setup using GEANT4, a direct comparison can be then made between the simulation and the experimental data. In this case, there is no necessity to calculate or measure the geometrical correction factors for the detectors, as the simulation will directly produce the geometrical attenuation effect. The efficiency correction can also be excluded, unless there is significant deviation between the simulated efficiency and the measured one. In that case, the measured efficiency should be used as a parameter in the simulation. The $\chi^2$ minimization in Eq.~\ref{eq:S_squared} can be modified as: \begin{equation}\label{eq:S_squared} S^2 = \sum_i \left[ \frac{W_{exp}(\theta_{rel}^i)-W_{sim}(\delta,\theta^i_{rel}) }{\sigma_{W_i}} \right]^2 \end{equation} where now the simulated value $W_{sim}(\delta,\theta^i_{rel})$ has replaced the theoretical one. The present approach also opens a new way for determining observables using triple or higher order angular correlations. As discussed in~\cite{Krane_1988_PhysRevC.37.747,KRANE1983321}, the sensitivity of the coefficients $\Gamma_k$ are more sensitive to the mixing ratio in some cases. Thus, triple correlations can sometimes offer an improved means of measurements. The direct comparison between simulation and measurements can make the analysis more time-efficient and avoids the use of complicated formulae, which are used for the triple angular correlations. Furthermore, the measurement of triple correlations is usually performed in standard detector geometries, where the theoretical description is simplified. This can pose difficulties in large detector arrays with fixed geometries. This restrictions are raised within the present framework, as a direct comparison between the simulated and experimental angular correlation can be made for triple angular correlations. The present method is not restricted in angular correlations of a cascade of gammas which originates from an initial unoriented state. It can be also used in the case of oriented states produced for example, from nuclear reactions, provided that one knows the initial set of statistical tensors $\rho^\lambda_q(J_0)$. The initial condition of the statistical tensor must then be calculated in the framework of the reaction for each different case, or can be measured experimentally. \section*{Acknowledgments} We acknowledge the financial support of the Cross-Disciplinary Program on Numerical Simulation of CEA, the French Alternative Energies and Atomic Energy Commission. \section{Introduction} \label{intro} The correlation between successive radiations emitted by de-exciting nuclei has been theoretically predicted from the 1940's, when Hamilton~\cite{Hamilton1940_PhysRev.58.122} and Goertzel~\cite{Goertzel_1946_PhysRev.70.897} predicted that there should be an anisotropy between two successive quanta emitted from a single radiative system. The first experimental evidence was published by Brandy and Deutsch~\cite{Brandy_PhysRev.78.558}, by observing the angular correlations of successive gamma rays in six even-even nuclei. Their results have been found to be in agreement with the theoretical predictions. In general, the anisotropy of a radiation emitted from a state with spin $J$ arises from the unequal population of the $2J+1$ magnetic $m$-substates. Biedenharn, Rose and Brink~\cite{Biedenharn_Rose_RevModPhys.25.729, Rose_Brink_Revmodphys_1967} have developed the formal theory of angular correlations, by defining the statistical tensors $\rho_q^\lambda(J)$ for a nuclear state of spin $J$, using the density matrix formalism~\cite{Fano_1957_RevModPhys.29.74}. These statistical tensors are expansions of the density matrix in the angular momentum space, and provide a very convenient means of describing the information of the unequal $m$ populations in nuclear levels. More details for the statistical tensor formalism can be found in~\cite{Hamilton1975_electromagnetic}. The evaluation of the statistical tensors for a cascade of two or more radiations, leads to the determination of the angular correlation function which describes the anisotropy between the emitted radiations. For a cascade of two subsequent $\gamma$-rays, the angular correlation function, i.e. the probability of detecting these two $\gamma$-rays within a relative angle $\theta_{rel}$ is determined as~\cite{Hamilton1975_electromagnetic,DEGROOT1952_1201,Kraus_1953}: \begin{equation}\label{eq: angular correlation function} W(\theta_{rel})= A_0 \left[1 + \sum_{\substack{\lambda>0 \\ \lambda = even}} a_\lambda P_\lambda( \cos \theta_{rel}) \right]. \end{equation} where $A_0$ is a normalization factor, $a_\lambda$ are coefficients that depend on the spins and multipolarities of the transitions~\cite{TAYLOR19711} and $P_\lambda$ are the ordinary Legendre polynomials. If polarization is not observed, only even values of $\lambda$ are kept in the sum. The summation is running up to twice the minimum of the spins and the multipolarities involved in the cascade ~\cite{Hamilton1975_electromagnetic,STUCHBERY200369}. The coefficients $a_\lambda$ contain the information about spins and the possible mixing ratios between the two or more types of radiation. \begin{comment} Experimentally, the determination of the spin of a state is performed by measuring the experimental angular distribution $W_{exp}(\theta_{rel}^i)$ for a number of relative angles $\theta^i_{rel}$. These angles are usually defined by the experimental setup and the relative positions of the detectors used. Then, by correcting for the efficiency and the detectors finite size dimensions, a $\chi^2$-test is performed by forming the statistic: \begin{equation}\label{eq:S_squared} S^2 = \sum_i \left[ \frac{W_{exp}(\theta_{rel}^i)-W_{th}(\delta,\theta^i_{rel}) }{\sigma_{W_i}} \right]^2 \end{equation} for all possible spins and mixing ratios of the cascade. The values of spin and mixing ratios which best describe the experimental data are then adopted as the real values. There are other variations in the statistical treatment of this technique, and it is thoroughly discussed in~\cite{ROBINSON1990386}. It is important to note, that the correct application of this technique require the determination of the correction factors $Q_\lambda$, to account for the finite size dimensions of the detectors. Beyond the measurement of two successive gamma radiations, it is often useful and sometimes more accurate to measure three gammas in coincidence (triple gamma correlations)~\cite{Krane_1988_PhysRevC.37.747}. In~\cite{KRANE1983321}, it is argued that the use of triple angular correlations can provide more accurate results for the mixing ratio, as the sensitivity of the angular correlation coefficients as a function of the mixing ratio is higher. However this technique is not used as often as the double-gamma correlation technique, probably because of its complexity and the larger experimental time needed to obtain the same statistics on the data. \end{comment} In the present work, a method for simulating the full effect of angular correlations is explained in detail. The particular method can be coupled to powerful codes such as FIFRELIN~\cite{Litaize_2010_PhysRevC.82.054616,LITAIZE201251,Litaize2015,REGNIER201619} and DICEBOX~\cite{BECVAR1998434}. The FIFRELIN code has been developed for the evaluation of fission data providing accurate description on the neutron and gamma properties of the fission process. FIFRELIN employs a Monte Carlo Hauser-Feshbach framework based on Bečvár’s algorithm devoted to gamma emission~\cite{BECVAR1998434} and extended to coupled neutron/gamma emission~\cite{Litaize_2010_PhysRevC.82.054616}. A sample of nuclear level schemes is generated taking into account the uncertainties from nuclear structure. FIFRELIN samples the lower energy part of the level scheme from the RIPL-3 database~\cite{CAPOTE20093107}. For the higher energy part, a combination between known levels and theoretical nuclear models (level densities, gamma strength functions, spin/parity distributions) is used, to account for the unknown part of the true level scheme of the nucleus of interest. The FIFRELIN code is also used for the simulations which are performed for the STEREO experiment~\cite{Allemandou_2018}. Recent simulations performed for the particular experiment~\cite{Almazan2019}, which heavily rely on accurate description of the de-excitation of the Gd isotopes, have also demonstrated a better agreement of FIFRELIN with the data in comparison with GEANT4~\cite{Geant4_ALLISON2016186}. In addition, we discuss a novel approach for the determination of the observables that can be obtained from angular correlation or, in general, angular distribution measurements. This approach takes advantage of the Monte Carlo technique, in order to simulate the desired cascade of gammas (or other particles), according to the respective probability distributions that the formal theory provides. The extraction of a simulated angular correlation function $W_{sim}$, combined with detector simulations can be then directly compared to the experimental data. The important asset of this process is that triple or higher order angular correlations~\cite{Hamilton1975_electromagnetic, Singh_PhysRevC.4.1510,Krane_1988_PhysRevC.37.747,KRANE1983321,KRANE_steffen_wheeler_1973351} can be directly compared, without the derivation and use of complicated formulae. A triple $\gamma$ cascade angular correlation simulation is demonstrated in this work for the first time. Furthermore, a potential combination with the detector simulation eliminates the need for corrections due to the finite-size dimensions of the detectors~\cite{KRANE1972_solid_angle_205, Krane1973SolidangleCF, CAMP1969192, Moura_2019_doi:10.1119/1.5099891}. Although these corrections are usually small and often not used, they can play an important role for the accurate determination of the mixing ratio. In the following, the method to generate the full effect of directional $\gamma$-ray angular correlations in a cascade of transitions with an arbirtrary number of $\gamma$-rays is described in detail. The well known cascade $1384\rightarrow 885 \rightarrow 658$ from the decay of \textsuperscript{110m}Ag~\cite{Singh_PhysRevC.4.1510,Krane_1988_PhysRevC.37.747} is simulated and compared to the theoretical distributions. The potential coupling of the present work with simulations performed with FIFRELIN is also discussed, and the method is applied to FIFRELIN output for the isotope \textsuperscript{156}Gd. Applications of such coupled schemes for more complicated simulations such as the STEREO experiment simulation, are also discussed. \begin{figure*}[t] \centering \includegraphics[width=0.6\textwidth]{./figures/illustration_v3.pdf} \centering \caption{[Color online] Schematic illustration of the de-excitation scheme in a cascade of $\gamma$-rays. Each state is characterized by a spin $J$ and the statistical tensor $\rho^\lambda_q(J)$, which depends on the spins of the initial and final states, as well as the multipolarities and angles of emission of the previously emitted $\gamma$-ray. Transitions marked with red illustrate that the $\gamma$ ray is observed by a detector. See text for details.} \label{fig:illustration} \end{figure*} \section{Monte carlo simulation of the angular correlations} \label{sec:monte_carlo} \subsection{Theoretical description} A general method of simulating angular distributions and correlations from decaying particles with spin using the density matrix formalism~\cite{Fano_1957_RevModPhys.29.74}, has been presented in~\cite{AMSLER198321}. The event generator DECAY4~\cite{Ponkratenko2000} can simulate the effect of directional angular correlations, but the theoretical description in the article is not detailed. GEANT4~\cite{Geant4_ALLISON2016186,geant_4_sim_2017} has also the capability of simulating $\gamma$ directional correlations, by employing also the density matrix formalism, but there is no detailed documentation or step-by-step mathematical description. Furthermore, its use is restricted to radioactive sources~\cite{Turner_2020}. In addition, simulations of angular correlations have been previously made as extensions to GEANT4~{\cite{SMITH201947}}. For this work, the formal theory of angular distributions of radiation will be used, employing the density matrix formalism, and specifically its multipole expansions which are called statistical tensors~\cite{Rose_Brink_Revmodphys_1967,Hamilton1975_electromagnetic}. Their calculation is essential for the determination of the probability distribution functions which describe the directions of $\gamma$-rays in the cascade. For a cascade of $\gamma$-rays starting from an initial state $J_0$ and ending to a state $J_n$: \begin{equation}\label{eq:cascade1} J_0 \xrightarrow[]{\gamma_0} J_1 \xrightarrow[]{\gamma_1} ... \xrightarrow[]{\gamma_{n-1}} J_n \end{equation} a set of statistical tensors can be calculated, depending on the orientation of the initial state $J_0$. The set of transitions $\gamma_0$, $\gamma_1...\gamma_{n-1}$ can be either all observed or partly unobserved by a detector, as illustrated in Fig.~\ref{fig:illustration}. If the initial state is randomly oriented, as in the case of $\beta$-decay where the $\beta$-particle is not observed or an ($n,\gamma$) reaction with thermal neutrons~\cite{Snelling_1983}, then the statistical tensor takes the simple form~\cite{Hamilton1975_electromagnetic,STUCHBERY200369}: \begin{equation}\label{eq: initial statistical tensor} \rho^{\lambda}_q (J_0)= \delta_{\lambda 0} \delta_{q 0} \end{equation} where $\delta_{ij}$ is the Kronecker delta, $\lambda$ is the rank of the statistical tensor and q takes integer values between $-\lambda$ and $\lambda$. If the initial state $J_0$ is oriented, i.e. after a nuclear reaction, the initial statistical tensor must be computed in the framework of the particular reaction or be measured experimentally. By knowing the initial-state statistical tensor, all the statistical tensors can then be calculated from the recursive master equation~\cite{Hamilton1975_electromagnetic,STUCHBERY200369}: \begin{align}\label{eq: statistical tensor next simplified} \rho^{\lambda_f}_{q_f} (J_f) &= \sum_{\lambda_i, \lambda, q, q_i} (-1)^{\lambda_i+q_i} \sqrt{2 \lambda +1}\; \rho^{\lambda_i}_{q_i} (J_i) \tj{\lambda_f}{\lambda}{\lambda_i}{-q_f}{q}{q_i} A^{\lambda_i \lambda_f}_\lambda(J_f,J_i,L,L') \mathcal{D}^{\lambda *}_{ q 0}(\phi_i,\theta_i,0) \end{align} where $\tj{\lambda_f}{\lambda}{\lambda_i}{-q_f}{q}{q_i}$ is the Wigner $3j$ symbol~\cite{abramovitz_handbook_1964,Wigner1993}, $A^{\lambda_i \lambda_f}_\lambda$ is the generalized angular distribution coefficient and $\mathcal{D}^{\lambda *}_{ q 0}(\phi_i,\theta_i,0)$ is a Wigner D-matrix~\cite{Wigner1993}. For the summation indices, if polarization is not observed, $\lambda_{i,f} = 0, 2, 4, . . ., 2I_{i,f}$ for integer values of $I_{i,f}$, while $\lambda_{i,f} = 0, 2, 4,. . . , 2I_{i,f} − 1$ for half-integer values of $I_{i,f}$. Also, $\lambda= 0, 2, 4 .., 2L_{max}$, where $L_{max}$ is the maximum of two lowest multipolarities $L, L'$ of the radiation. The index $q$ takes integer values within the interval $[-\lambda,+\lambda]$. The same applies to $q_i$ and $q_f$, with respect to $\lambda_i$ and $\lambda_f$. The generalized angular distribution coefficients are given by the relation: \begin{align}\label{eq: generalized ang_distro coeff} A^{\lambda_i \lambda_f}_\lambda(J_f,J_i,L,L') &= \frac{1}{1+\delta^2} [ F^{\lambda_i \lambda_f}_\lambda(L,L,J_f, J_i) + 2\delta F^{\lambda_i \lambda_f}_\lambda(L,L'J_f, J_i) + \delta^2 F^{\lambda_i \lambda_f}_\lambda(L',L',J_f, J_i) ] \end{align} where $\delta$ is the multipolarity mixing ratio of the two lowest multipolarities $L,L'$ of the $\gamma$-transition~\cite{KRANE1975_mixing_ratio_383}. The generalized $F$-coefficients, $F^{\lambda_i \lambda_f}_\lambda$, are functions of Wigner $3j$ and $9j$ symbols~\cite{abramovitz_handbook_1964, Wigner1993} and have been extensively tabulated in literature \cite{Hamilton1975_electromagnetic,KRANE_steffen_wheeler_1973351}. They can be calculated using the relationship: \begin{align}\label{eq: generalized F coeff} F^{\lambda_i \lambda_f}_\lambda(L,L',J_i,J_f) &= (-1)^{L'+\lambda_i+\lambda_f+\lambda} \sqrt{(2J_i+1)(2J_f+1)(2L+1)(2L'+1)} \nonumber \\ &\times \sqrt{(2\lambda_i+1)(2\lambda_f+1)(2\lambda+1)} \tj{L}{L'}{\lambda}{1}{-1}{0} \nj{J_f}{L}{J_i}{J_f}{L'}{J_i}{\lambda_f}{\lambda}{\lambda_i} \end{align} The Wigner D-Matrix is related to the spherical harmonics and the associated Legendre polynomials as~\cite{STUCHBERY200369,KRANE_steffen_wheeler_1973351}: \begin{equation} \mathcal{D}^{\lambda *}_{ q 0}(\phi,\theta,0) = (-1)^q \sqrt{ \frac{4 \pi}{2 \lambda+1}}\; Y^{\lambda}_{-q} (\theta, \phi) = (-1)^{(q+|q|)/2} \sqrt{ \frac{(\lambda-|q|)!}{(\lambda+|q|)!}}\; P_\lambda^{|q|}(\cos \theta)\; e^{-iq \phi}. \end{equation} The description of the populations of the $m-$substates with the use of statistical tensors provides the advantage that all the populations of the subsequent states can be calculated using the master equation (Eq.~\ref{eq: statistical tensor next simplified}) and the direction $(\theta_i,\phi_i)$ of the emitted $\gamma$-ray. The directions are defined with respect to the frame of reference of the initial statistical tensor $ \rho^{\lambda}_q (J_0)$. \subsection{Generation of the events} After evaluating the statistical tensor for a state in the cascade, the two-dimensional angular distribution function can be evaluated by summing over the quantum numbers of the next state~\cite{Hamilton1975_electromagnetic, STUCHBERY200369}, which at this part of the simulation process is considered unobserved (i.e. the $\gamma$-ray coming from the final state has not being emitted yet in the simulation). For the case of directional correlations, the angular distribution function is given by the relation: \begin{align}\label{eq: distribution function} W(\theta_i,\phi_i) &= \sum_{\lambda_f, q_f} (-1)^{\lambda+q_f} \sqrt{2 \lambda_f +1} \rho^{\lambda_f}_{q_f} (J_f) A_{\lambda_f}(L,L',J_i,J_f,\delta) \mathcal{D}^{\lambda_f *}_{ q_f 0}(\phi_i,\theta_i,0) \end{align} where the coefficient $A_{\lambda_f}(L,L',J_i,J_f,\delta)$ is called \textit{angular distribution coefficient} and is given by the relationship~\cite{Hamilton1975_electromagnetic}: \begin{align}\label{eq: angular distribution coefficients} A_\lambda(L,L',J_i,J_f,\delta) &= \dfrac{1}{1+\delta^2} \left[ F_\lambda(L,L,J_i,J_f) + 2 \delta F_\lambda(L,L',J_i,J_f)+ \delta^2 F_\lambda(L',L',J_i,J_f) \right] \end{align} In the above equations, the $F$-coefficients are given by the formula~\cite{Hamilton_1985,Ferentz_F_coeff}: \begin{equation}\label{eq: F-coefficient} F_\lambda(L,L',J_i,J_f) = (-1)^{J_i+J_f-1} \sqrt{ (2\lambda+1)(2L+1)(2 L'+1)(2 J_i+1) } \tj{L}{L'}{\lambda}{1}{-1}{0} \sj{L}{L'}{\lambda}{J_i}{J_i}{J_f}; \end{equation} where $\sj{L}{L'}{\lambda}{J_i}{J_i}{J_f}$ is the Wigner $6j$ symbol \cite{abramovitz_handbook_1964,Wigner1993}. Thus, the simulation of the angular correlations or distributions can be performed by generating a set of directions from each of the calculated distribution functions, while moving down the cascade. The statistical tensors have to be calculated each time, after the generation of each event since they depend on the angles of emission of $\gamma$-ray that feeds the current state, as shown in Eq.~\ref{eq: statistical tensor next simplified}. The result of Eq.~\ref{eq: distribution function} should be always real for directional correlations, as it constitutes an observable quantity of the decaying nucleus. \begin{comment} The distribution function in Eq.~\ref{eq: distribution function} is determined for each state and the events can be generated using the acceptance-rejection algorithm~\cite{vonNeumann1951} for a two-dimensional function. The rejection method can be faster in this case, because the parameters of the distribution function depend on the angle of the previously emitted $\gamma$-ray. Thus, other methods which have to calculate the integral of the function for every generation can be significantly slower. \end{comment} \section{Results} \label{sec:application} \subsection{Double \texorpdfstring{$\gamma$}--cascades} \begin{figure*}[t!] \centering \begin{subfigure}[c]{0.50\textwidth} \includegraphics[width=\textwidth]{./figures/420.pdf} \centering \caption{} \label{fig: 420} \end{subfigure}% \begin{subfigure}[c]{0.50\textwidth} \includegraphics[width=\textwidth]{./figures/542_mix.pdf} \centering \caption{} \label{fig: 542} \end{subfigure} \begin{subfigure}[c]{0.50\textwidth} \includegraphics[width=\textwidth]{./figures/540_un.pdf} \centering \caption{} \label{fig: 540_un} \end{subfigure}% \begin{subfigure}[c]{0.50\textwidth} \includegraphics[width=\textwidth]{./figures/5420triple.pdf} \centering \caption{} \label{fig: 5420triple} \end{subfigure} \caption{[Color online] Monte-Carlo simulation of the $\gamma$ directional correlations for the cascade $5^- \rightarrow 4^+ \rightarrow 2^+ \rightarrow 0^+$. In (a), the distribution of relative angles for the cascade $4^+ \rightarrow 2^+ \rightarrow 0$ is shown. In (b), the distribution of relative angles for the transitions $5^- \xrightarrow[]{\delta = -0.42} 4^+ \rightarrow 2^+$ is shown. In (c), the angular correlation between the first and third transition of the same cascade is shown. The intermediate transition is treated as unobserved. In (d), the triple $\gamma$ correlation for the same cascade for the $N1$ geometry is shown (see text for details). All theoretical curves are also shown. The red arrows indicate which transitions are considered as observed.} \label{fig: cascade} \end{figure*} A simulation of a cascade of three $\gamma$-rays was performed using the present framework. The $5^- \rightarrow 4^+ \rightarrow 2^+ \rightarrow 0^+$ cascade in $^{110}$Cd, with a mixing ratio of $\delta_0 = -0.42$ for the first transition ($5^- \rightarrow 4^+$), has been extensively studied in~\cite{Krane_1988_PhysRevC.37.747}. The results of the simulation are shown in Fig~\ref{fig: cascade}. The simulation generates a pair of coordinates $(\theta_i, \phi_i)$ for each transition $i$. In order to check that the simulation gives the results expected from theory, a direct comparison can be made, by distributing the relative angles of two transitions. The scalar product between the two directions of the two consecutive $\gamma$ rays can be calculated and distributed to a histogram as shown in Fig.~\ref{fig: cascade}. In Fig~\ref{fig: 420}, the distribution of relative angles of the last two $\gamma$ rays is shown. This is a common $4^+ \rightarrow 2^+ \rightarrow 0^+$ cascade, where the two $\gamma$-rays are of pure $E2$ character. The distribution of relative angles is given by the angular distribution function (Eq.~\ref{eq: angular correlation function}), where the coefficients $a_\lambda$ can be calculated using the relationship: \begin{equation}\label{eq: a2a4coefficients} a_\lambda = B_\lambda(L,L',J_f,J_i,\delta_0) A_\lambda(L,L',J_i,J_f,\delta_1) \end{equation} where the functions $B_\lambda(L,L',J_f,J_i)$ are called \textit{orientation parameters} and can be calculated using the formula~\cite{Hamilton1975_electromagnetic, Blin-Stoyle1957}: \begin{align}\label{eq: orientation parameters} B_\lambda(L,L',J_f,J_i,\delta_0) &= \dfrac{1}{1+\delta_0^2} \left[ F_\lambda(L,L,J_f,J_i) + (-1)^{L+L'} 2 \delta_0 F_\lambda(L,L',J_f,J_i) + \delta_0^2 F_\lambda(L',L',J_f,J_i)\right] \end{align} while the coefficients $A_\lambda(L,L',J_i,J_f,\delta_1)$ are the angular distributions coefficients and can be calculated from Eq.~\ref{eq: angular distribution coefficients}. Note that the right-hand side of the expressions in Eq. \ref{eq: angular distribution coefficients} and Eq. \ref{eq: orientation parameters} are not entirely identical, but they differ by a phase factor $(-1)^{L+L'}$. For the specific case of the $4^+ \rightarrow 2^+ \rightarrow 0^+$ cascade, where the transitions are of pure $E2$ character and thus $\delta_0,\delta_1 = 0$, the results for $a_2$ yield: \begin{align}\label{eq: a2_420} a_2 &= B_2(2,3,2,4,0) A_2(2,2,2,0,0) = (-0.171) \times (-0.598) = 0.102 \end{align} while for $a_4$: \begin{align}\label{eq: a4_420} a_4 &= B_4(2,3,2,4,0) A_4(2,2,2,0,0) = 0.009 \end{align} The above calculations agree with the tabulated results~\cite{TAYLOR19711} as well as with the very reliable on-line angular correlation calculator developed by the Griffin collaboration~\cite{ang_corr_calc}. The theoretical curve given by Eq.~\ref{eq: angular correlation function} is shown in Fig.~\ref{fig: 420}, along with the simulation results. In order to check the agreement, a $\chi^2$-test has been performed between the theoretical and simulated values. The value of the reduced $\chi^2$ yields $\chi^2/NDF = 1.30$. The value is close to 1, which indicates a very good agreement between the theory and the simulation. The same is shown for the upper part of the cascade ($5^- \xrightarrow{-0.42} 4^+ \rightarrow 2^+ $) in Fig.~\ref{fig: 542}. The simulation is in complete agreement with the theoretical values. The value of the reduced $\chi^2/NDF = 0.86$, indicating again a very good agreement. \subsection{Simulation of a double \texorpdfstring{$\gamma$}--cascade with intermediate unobserved radiations} The present simulation is able to reproduce the angular correlation between two $\gamma$-radiations, with one or more intermediate $\gamma$-rays that are not observed by a detector. This can be checked by histogramming the scalar product of two $\gamma$-rays of interest in cascade of more than two transitions. The same cascade as before is tested, but now the distribution of relative angle between the first and the third $\gamma$-rays is studied. As in the case of two consecutive $\gamma$-rays, the angular correlation function~(Eq.~\ref{eq: angular correlation function}) is used to describe the angular correlation between $\gamma$-rays with intermediate unobserved radiations. The difference here is that the evaluation of the theoretical coefficients $a_\lambda$ requires the inclusion of a $U(L,L',J_i,J_f,\delta)$ factor called \textit{de-orientation coefficient}~\cite{Hamilton1975_electromagnetic}, to account for any intermediate unobserved transitions. Thus, for the specific case of the transitions $5^- \rightarrow 4^+$ and $ 2^+ \rightarrow 0^+ $, where the intermediate transition ($4^+ \rightarrow 2^+$) is treated as unobserved, the coefficients $a_2, a_4$ are computed as follows: \begin{align}\label{eq: a2a4coefficients_deorientation} a_\lambda &= B_\lambda(1,2,5,5,-0.42) U_\lambda(2,3,4,2,0) A_\lambda(2,2,2,0,0) \end{align} which yield $a_2 = -0.322$ and $a_4 = -0.009$. The theoretical angular correlation function, along with the results of the simulation is plotted in Fig~\ref{fig: 540_un}. A $\chi^2$-test between the theoretical curve and simulated value, yields $\chi^2/NDF = 1.25$, demonstrating the very good agreement between simulation and theory. It is important to note, that this approach works for any number of intermediate unobserved transitions. The number of de-orientation coefficients used in determining the angular correlation coefficients is the same as the number of unobserved intermediate transitions. \subsection{Triple--\texorpdfstring{$\gamma$}~~correlations} The case of three observed $\gamma$-rays in a cascade is also reproduced within the present framework. The determination of the parameters that describe a $\gamma \gamma \gamma$ correlation are extensively described in~\cite{KRANE_steffen_wheeler_1973351}. In general, the three $\gamma$ rays can be detected in specific geometries, such as the N1 or N2 geometries described in~\cite{KRANE_steffen_wheeler_1973351} and in~\cite{Krane_1988_PhysRevC.37.747}. To demonstrate the ability of simulating triple cascades, the same cascade will be now simulated, but only the events that satisfy the N1 geometry, as described in~\cite{Krane_1988_PhysRevC.37.747} will be taken into consideration. More specifically, if we consider a cartesian coordinate frame $xyz$, the N1 geometry requires the first $\gamma$ to be emitted along the $z$-axis and the second $\gamma$ in the $x$ axis. Then, the distribution of the polar angle of the third $\gamma$-ray along the $y$ axis can be determined from the distribution function~\cite{KRANE_steffen_wheeler_1973351,Hamilton1975_electromagnetic}: \begin{equation}\label{eq: triple angular correlation function} W(\theta)= \Gamma_0 \left[1 + \sum_{\substack{\lambda>0 \\ \lambda = even}} \Gamma_\lambda P_\lambda( \cos \theta) \right].. \end{equation} where $\Gamma_0$ is a normalization factor, and $\Gamma_\lambda$ are coefficients that depend on spins and mixing ratios involved in the triple cascade. It is important to note, that the coefficients $\Gamma_\lambda$ are defined differently from the coefficients $a_\lambda$ for double cascades, which appear in Eq.~\ref{eq: angular correlation function}. The coefficients $\Gamma_\lambda$ for the previously simulated triple cascade $5^- \xrightarrow{-0.42} 4^+ \rightarrow 2^+ \rightarrow 0+$ have been calculated theoretically in~\cite{Krane_1988_PhysRevC.37.747}, yielding $\Gamma_2 = -0.307$ and $\Gamma_4 = -0.013$. The simulated triple correlation along with the theoretical result is shown in Fig.~\ref{fig: 5420triple}. As illustrated, there is a very good agreement between the theory and the simulation. It has to be noted that the comparison involved a simulation with a large number of events emitted in all space ($\sim 800$ million). The comparison was made by selecting the events which are close to the particular geometry . In detail, the distribution of polar angle $\theta_2$ was accepted as a simulation event if and only if the directions of the three $\gamma$ rays $\gamma_0,\gamma_1,\gamma_2$ fall into these limits: $\theta_0 < 0.1$, $1.47 < \theta_1< 1.67$, $\phi_1<0.1$ and $\phi_1>6.18$, and $1.47< \phi_2<1.67$, where the angle intervals are in radians. The value of $\chi^2/NDF$ yields 1.09. Furthermore, the theoretical calculations performed in~\cite{Krane_1988_PhysRevC.37.747} involved also the solid angle correction factors, but their effect is expected to be small, concerning the distances mentioned in the same work. Correlations of higher order than the triple $\gamma$-cascade have not been explored in literature. However, the results until now demonstrate the ability of simulating the complete effect of the correlation of $\gamma$-rays, including correlations that are still unexplored. \subsection{Coupling with FIFRELIN: The case of \texorpdfstring{\textsuperscript{156}}~Gd} The present method has been coupled with the output of FIFRELIN code for the case of \textsuperscript{156}Gd. The accurate description of the de-excitation of the specific isotope of Gd is important for the accurate simulation of the STEREO experiment. For this case, 10 million cascades of the particular isotope were generated by FIFRELIN. The present framework was then applied on the output and the results for four cases of double correlations are presented in Fig.~\ref{fig: 156Gd cascades}. The cascade $6^+ \rightarrow 4^+ \rightarrow 2^+$ of the rotational ground-state band of \textsuperscript{156}Gd is shown in the upper part of the figure along with the respective theoretical calculation. The particular cascade consists of two stretched $E2$ transitions and a typical theoretical calculation yields for the correlation coefficients $a_2 = 0.102$ and $a_4 = 0.009$. In the upper right part, the cascade $2^+_4 \rightarrow 4^+_1 \rightarrow 2^+_1$ is shown, which consists of two pure $E2$ transitions. The theoretical calculation for this spin sequence yields $a_2 = 0.200$ and $a_4 = 0.093$. In the bottom left part, the cascade $3^- \rightarrow 4^+ \rightarrow 2^+$ is shown, consisting of an $E1$ and an $E2$ transition. In this case the theoretical results are $a_2 = -0.14$ and $a_4 = 0$. Lastly, in the bottom right part of the figure, the $2^-_2 \rightarrow 2^+_3 \rightarrow 0^+_{g.s.}$ cascade is illustrated, where theoretical calculations result in $a_2=0.25$ and $a_4=0$. In all cases, the simulation results are in full agreement with the theoretical calculations. \begin{figure*}[t] \centering \begin{subfigure}[c]{0.5\textwidth} \includegraphics[width=\textwidth]{./figures/642Gd.pdf} \centering \caption{} \label{fig: 642Gd} \end{subfigure}% \begin{subfigure}[c]{0.5\textwidth} \includegraphics[width=\textwidth]{./figures/242Gd.pdf} \centering \caption{} \label{fig: 420Gd} \end{subfigure} \begin{subfigure}[c]{0.5\textwidth} \includegraphics[width=\textwidth]{./figures/342Gd.pdf} \centering \caption{} \label{fig: 020Gd} \end{subfigure}% \begin{subfigure}[c]{0.5\textwidth} \includegraphics[width=\textwidth]{./figures/220Gd.pdf} \centering \caption{} \label{fig: 220Gd} \end{subfigure} \caption{[Color Online] (a) The angular correlation of the ground-state band cascade $6^+_1 \rightarrow 4^+_1 \rightarrow 2^+_1$ of \textsuperscript{156}Gd, along with its theoretical distribution. (b) The same for the cascade $2^+_4 \rightarrow 4^+_1 \rightarrow 2^+_1$, (c) the cascade $3^-_1 \rightarrow 4^+_1 \rightarrow 2^+_1$ and (d) the cascade $2^-_2 \rightarrow 2^+_3 \rightarrow 0^+_{g.s.}$.} \label{fig: 156Gd cascades} \end{figure*} \section{Discussion} \label{sec:discussion} \subsection{Discussion of the method} Within the framework of the present work, the full effect of $\gamma$-ray directional correlations is reproduced for a nuclear cascade with an arbitrary number of $\gamma$-transitions. The results presented for this study show the power of the formal theory of angular correlations to reproduce the complete effect, by producing a set of directions $(\theta_i, \phi_i)$ for each $i$-th $\gamma$-ray. The present simulation is able to describe all the double $\gamma$-correlations in the cascade. Double $\gamma$-correlations are the most widely used, as their dependance on spins and mixing ratios is relatively simple, enabling them to be used for the experimental determination of spins and mixing ratios on nuclei with limited spectroscopic information. The effect is demonstrated in Fig.~\ref{fig: cascade} and can be generalized for any cascade. Of course, the simulation works even for odd-mass nuclei, whose spins are half-integer. Occasionaly, it is more convinient to measure a double $\gamma$-angular correlation with one or more intermediate unobserved radiations. Mathematically, this procedure includes an integration over positions of the intermediate $\gamma$, as the position is treated as an unobserved property of the system. The main reason for the study of such cascades aims to avoid problems in the data analysis. For example, the coincident counts of two consecutive transitions may overlap with background, making impossible the determination of an angular correlation between two consecutive $\gamma$-rays. In Fig.~\ref{fig: 540_un}, the effect is nicely demonstrated and in complete agreement with the theoretical distributions. The present method works for an arbitrary number of intermediate transitions. Higher order angular correlations can be also reproduced. A triple $\gamma$ angular correlation is shown in Fig.~\ref{fig: 5420triple}, with the first and second transition observed in fixed direction, while the direction of the third transition is variable, according to the N1 geometry, as defined in~\cite{KRANE_steffen_wheeler_1973351}. The potential of triple $\gamma$-ray directional correlations is explored in~\cite{KRANE1983321}, where has is been demonstrated that the coincidental observation of three $\gamma$-rays instead of two can lead to a more accurate determination of multipolarity mixing ratios. The main reason for this is that the sensitivity of the angular correlation coefficients $\Gamma_\lambda$, which are used in triple correlations, is higher than that of the coefficients $a_\lambda$ used in the double cascades. Correlations that involve four or higher observed transitions have not been explored, mainly because as the order of the type of correlation increases, the theoretical description becomes highly complex. The present method does not include attenuation/perturbation effects of the angular correlations due to relatively long half-lives (over 1 ns) of intermediate states~\cite{Hamilton_PhysRevC.5.899}. If, however, such an attenuation factor is measured for a particular cascade, it can be included in Eq.~\ref{eq: statistical tensor next simplified}, in order to correctly reproduce the attenuated angular correlation. \subsection{Coupling with FIFRELIN code} The present method can be coupled with powerful nuclear de-excitation codes such as FIFRELIN. FIFRELIN is a fission modelling code, which can simulate the de-excitation of every nucleus (not only a fission fragment) by neutron/gamma/conversion electron emission within the framework of nuclear realizations~\cite{BECVAR1998434}. The FIFRELIN code is used in various applications such the characterization of fission fragments~\cite{LITAIZE201251} as well in high energy physics simulations for the STEREO experiment~\cite{Allemandou_2018}. The full effect of directional $\gamma$ correlations can be a useful inclusion to simulations performed for such applications. As shown in Fig.~\ref{fig: 156Gd cascades}, the coupling of the present work with FIFRELIN is able to reproduce all angular correlations in the cascade. The present description can be applied to every isotope, both even and odd in mass number. For the moment, it is only restricted for $\gamma$-rays, but an implementation of other particle correlations, such as between internal conversion electrons, neutrons and gammas can be included in the future. \subsection{Potential for use in the experimental determination of spins and mixing ratios} Experimentally, the determination of the spin of a state is performed by measuring the experimental angular distribution $W_{exp}(\theta_{rel}^i)$ for a number of relative angles $\theta^i_{rel}$. These angles are usually defined by the experimental setup and the relative positions of the detectors used. Then, by correcting for the efficiency and the detectors finite size dimensions, a $\chi^2$-test is performed by forming the statistic: \begin{equation}\label{eq:S_squared} S^2 = \sum_i \left[ \frac{W_{exp}(\theta_{rel}^i)-W_{th}(\delta,\theta^i_{rel}) }{\sigma_{W_i}} \right]^2 \end{equation} for all possible spins and mixing ratios of the cascade. The values of spin and mixing ratios which best describe the experimental data are then adopted as the real values. There are other variations in the statistical treatment of this technique, and it is thoroughly discussed in~\cite{ROBINSON1990386}. It is important to note, that the correct application of this technique requires the determination of the correction factors $Q_\lambda$~\cite{KRANE1972_solid_angle_205,BARRETTE19711_solid_angle}, to account for the finite size dimensions of the detectors. These factors can be computed for simple co-axial geometries, but for complex geometries such those of clover detectors~\cite{Mutti_fipps_2018}, a simulation or additional measurements with known radioactive sources is necessary for their estimation. Within the present approach, the simulation of the $\gamma$ cascades removes some important difficulties during the ``traditional" analysis of the data in such measurements. Hence, by simulating the angular correlations in a cascade of many $\gamma$-rays and using it as input for the simulation of the detector setup using GEANT4, a direct comparison can be then made between the simulation and the experimental data. In this case, there is no necessity to calculate or measure the geometrical correction factors for the detectors, as the simulation will directly produce the geometrical attenuation effect. The efficiency correction can also be excluded, unless there is significant deviation between the simulated efficiency and the measured one. In that case, the measured efficiency should be used as a parameter in the simulation. The $\chi^2$ minimization in Eq.~\ref{eq:S_squared} can be modified as: \begin{equation}\label{eq:S_squared} S^2 = \sum_i \left[ \frac{W_{exp}(\theta_{rel}^i)-W_{sim}(\delta,\theta^i_{rel}) }{\sigma_{W_i}} \right]^2 \end{equation} where now the simulated value $W_{sim}(\delta,\theta^i_{rel})$ has replaced the theoretical one. The present approach also opens a new way for determining observables using triple or higher order angular correlations. As discussed in~\cite{Krane_1988_PhysRevC.37.747,KRANE1983321}, the sensitivity of the coefficients $\Gamma_k$ are more sensitive to the mixing ratio in some cases. Thus, triple correlations can sometimes offer an improved means of measurements. The direct comparison between simulation and measurements can make the analysis more time-efficient and avoids the use of complicated formulae, which are used for the triple angular correlations. Furthermore, the measurement of triple correlations is usually performed in standard detector geometries, where the theoretical description is simplified. This can pose difficulties in large detector arrays with fixed geometries. This restrictions are raised within the present framework, as a direct comparison between the simulated and experimental angular correlation can be made for triple angular correlations. The present method is not restricted in angular correlations of a cascade of gammas which originates from an initial unoriented state. It can be also used in the case of oriented states produced for example, from nuclear reactions, provided that one knows the initial set of statistical tensors $\rho^\lambda_q(J_0)$. The initial condition of the statistical tensor must then be calculated in the framework of the reaction for each different case, or can be measured experimentally. \section*{Acknowledgments} We acknowledge the financial support of the Cross-Disciplinary Program on Numerical Simulation of CEA, the French Alternative Energies and Atomic Energy Commission.
\section{Introduction} Let $S$ be a del Pezzo surface over an algebraically closed field $k$. Let $\overline{M}_{0,0}(S)$ be the Kontsevich moduli space of stable maps of genus $0$ and let $\overline{\mathrm{Rat}}(S)$ denote the union of the irreducible components of $\overline{M}_{0,0}(S)$ which generically parametrize stable maps from irreducible domains. (Here we endow each component with its reduced structure.) We are interested in the ``discrete'' invariants of $\overline{\mathrm{Rat}}(S)$: the number of irreducible components of a given degree, the dimension of the components, and so on. In characteristic $0$, the behavior of these invariants is predicted by Geometric Manin's Conjecture as formulated in \cite{LTCompos}. \cite{Testathesis} and \cite{Testa09} classified the components of $\overline{\mathrm{Rat}}(S)$ for ``most'' del Pezzo surfaces; in particular, Testa's work verifies Geometric Manin's Conjecture for such surfaces. (As a secondary result, in this paper we extend Testa's classification to all del Pezzo surfaces in characteristic $0$.) Our main focus is del Pezzo surfaces in characteristic $p$. In particular, we would like to analyze whether the framework of Geometric Manin's Conjecture can be extended to cover such surfaces. We classify the components of $\overline{\mathrm{Rat}}(S)$ for ``most'' del Pezzo surfaces in characteristic $p$ and verify that the principles of Geometric Manin's Conjecture hold in these examples. \subsection{Summary of main results} Our first statement addresses the components of $\overline{\mathrm{Rat}}(S)$ which have larger than the expected dimension. We show that most weak del Pezzo surfaces do not carry any dominant families of this type. \begin{theo} \label{theo:maintheorem1} Let $S$ be a weak del Pezzo surface over an algebraically closed field such that a general member of $|-K_{S}|$ is smooth. Then the only components of $\overline{\mathrm{Rat}}(S)$ which have greater than the expected dimension will parametrize multiple covers of rational curves $C$ satisfying $-K_{S} \cdot C \leq 1$. In particular, there are no dominant families of rational curves with larger than the expected dimension. \end{theo} The weak del Pezzo surfaces $S$ for which Theorem \ref{theo:maintheorem1} does not apply -- that is, the surfaces $S$ such that every member of $|-K_{S}|$ is singular -- are classified by \cite{KN20}. There are 3 infinite families and 11 sporadic examples; these examples only occur in characteristic $2$ or $3$ and when $S$ has degree at most $2$. Note that for such a surface $S$ the curves in $|-K_{S}|$ are all rational and thus Theorem \ref{theo:maintheorem1} must fail. We will discuss these examples in more depth in Section \ref{subsec:examples} and Section \ref{sect:increaseainv}. Under more restrictive conditions, we show the stronger result that there are no dominant irreducible components of $\overline{\mathrm{Rat}}(S)$ yielding an inseparable family of rational curves. \begin{theo} \label{theo:maintheorem2} Let $S$ be a smooth del Pezzo surface of degree $d$ over an algebraically closed field $k$ of characteristic $p$. Assume that either $d \geq 2$ or $d = 1$ and $p \geq 11$. When $d = 3$, we assume furthermore that $S$ is not the following exception: \begin{enumerate} \item $\mathrm{char}(k)=2$ and $S$ is the Fermat cubic surface $x^{3}+y^{3}+z^{3} + w^3=0$. \end{enumerate} When $d = 2$, we assume furthermore that $S$ is not one of the following list of exceptions: \begin{enumerate} \setcounter{enumi}{1} \item $\mathrm{char}(k)=3$ and $S$ is the double cover of $\mathbb{P}^{2}$ ramified along the Klein quartic curve, i.e., the curve defined by $zx^{3} + xy^{3} + yz^{3}=0$. \item $\mathrm{char}(k)=2$ and $S$ is a double cover of $\mathbb{P}^{2}$ defined by the equation $w^{2} + wy^2 + g_{4}$ where $g_4$ is a homogeneous polynomial in $x, y, z$. \end{enumerate} Then every dominant component of $\overline{\mathrm{Rat}}(S)$ is separable and generically parametrizes free rational curves. \end{theo} \begin{rema} The surfaces described in the exceptions above do actually contain a dominant inseparable family of rational curves. \end{rema} \begin{rema} It is interesting to note that the exceptional cases in Theorem \ref{theo:maintheorem2} are exactly the del Pezzo surfaces of degree $\geq 2$ that are not Frobenius split. \cite[Example 5.5]{Hara98} shows that the Fermat cubic surface in characteristic $2$ is the unique smooth cubic surface that is not F-split. \cite[Theorem 0.3]{Saito17} shows that the smooth degree 2 del Pezzos that are not F-split are the double cover of $\mathbb{P}^{2}$ branched over the Fermat quartic in characteristic $3$ and the double covers of $\mathbb{P}^{2}$ branched over the double line in characteristic $2$. (The Fermat quartic in $\mathbb{P}^{2}$ in characteristic $3$ is projectively equivalent to the equation given above by \cite[Proposition 3.7]{Pardini86}. See also \cite[Formula (1.11)]{Elkies}.) \end{rema} If we impose some further restrictions on the characteristic then we can completely classify components of $\overline{\mathrm{Rat}}(S)$. Let $\delta(d)$ be the function defined by \begin{equation} \label{delta} \delta(d) = \begin{cases} 2 & \text{ if $d \geq 4$}\\ 3 & \text{ if $d = 2, 3$}\\ 11 & \text{ if $d = 1$}. \end{cases} \end{equation} The following statement extends results of \cite{Testathesis} and \cite{Testa09} to positive characteristic: \begin{theo} \label{theo:maintheorem3} Let $S$ be a smooth del Pezzo surface of degree $d$ over an algebraically closed field $k$ of characteristic $p$. Assume that $p \geq \delta(d)$. Furthermore when $d = 2$, we furthermore assume that $S$ is not isomorphic to the surface listed in Theorem~\ref{theo:maintheorem2}.(2). Let $\beta$ be a nef class on $S$ satisfying $-K_S \cdot \beta \geq 3$. Then: \begin{itemize} \item If $\beta$ is not a multiple of a $-K_{S}$-conic, then there is a unique component $M$ of $\overline{M}_{0,0}(S,\beta)$ generically parametrizing stable maps with irreducible domains. The general map parametrized by $M$ is a birational map onto a free curve. \item If $\beta$ is a multiple of a smooth rational conic, then there is a unique component $M$ of $\overline{M}_{0,0}(S,\beta)$ generically parametrizing stable maps with irreducible domains. The general map parametrized by $M$ is a finite cover of a smooth conic. \item If $d=2$ and $\beta$ is a multiple of $-K_{S}$, or $d = 1$ and there is a contraction of a $(-1)$-curve $\phi: S \to S'$ such that $\beta$ is a multiple of the pullback of $-K_{S'}$, then there are exactly two components of $\overline{M}_{0,0}(S,\beta)$ parametrizing stable maps with irreducible domains. One component generically parametrizes birational maps onto free curves, the other generically parametrizes multiple covers of $-K_S$-conics. \item If $d=1$ and $\beta$ is a multiple of $-2K_{S}$, then there are at least two components of $\overline{M}_{0,0}(S,\beta)$ parametrizing stable maps with irreducible domains. There is a unique component that generically parametrizes birational maps onto free curves, and the other components generically parametrize multiple covers of $-K_S$-conics. \end{itemize} \end{theo} Finally, we extend the results of \cite{Testathesis} to finish the classification of components of $\overline{\mathrm{Rat}}(S)$ of anticanonical degree $\geq 3$ on arbitrary del Pezzo surfaces $S$ of degree $1$ in characteristic $0$. Theorem \ref{theo:dp1char0classification} finishes the proof of the analogue of Theorem \ref{theo:maintheorem3} in characteristic $0$; in particular: \begin{theo} \label{theo:degree1char0} Let $S$ be a smooth del Pezzo surface of degree $1$ over an algebraically closed field of characteristic $0$. Let $\alpha$ be a nef curve class on $S$ satisfying $-K_{S} \cdot \alpha \geq 3$ which is not a multiple of a smooth rational conic. Then $\overline{\mathrm{Rat}}(S)$ contains a unique component generically parametrizing birational maps onto free curves of numerical class $\alpha$. \end{theo} \subsection{Geometric Manin's Conjecture} In his unpublished notes \cite{Bat88}, Batyrev developed a heuristic for Manin's conjecture for Fano varieties over finite fields. (This heuristic inspired Batyrev-Manin's conjecture over number fields as formulated in the series of papers \cite{BM}, \cite{Peyre}, \cite{BT98}, \cite{LST18}.) Batyrev's heurstic relies on several geometric assumptions about the structure of the moduli space of curves on a Fano variety. When working over an algebraically closed field of characteristic $0$, these assumptions were further revised and were systematized as Geometric Manin's Conjecture in \cite{LTCompos}. Our main motivation for this paper is to test whether the principles of Geometric Manin's Conjecture hold for surfaces in characteristic $p$. In brief, Geometric Manin's Conjecture predicts that the discrete invariants of $\overline{\mathrm{Rat}}(S)$ -- the number of components and their dimensions -- are controlled by a geometric quantity known as the Fujita invariant. \begin{defi} Suppose that $X$ is a smooth projective variety over an algebraically closed field equipped with a nef divisor $L$. The Fujita invariant $a(X,L)$ is defined as follows. If $L$ is not big, we set $a(X,L) = \infty$. Otherwise, we define $$ a(X, L) := \min \{ t\in {\mathbb R} \mid K_{X} + tL \textrm{ is pseudo-effective} \}. $$ \end{defi} \begin{defi} Let $X$ be a smooth weak Fano variety over an algebraically closed field. We say that a generically finite morphism $f: Y \to X$ from a smooth projective variety $Y$ is a breaking map if $a(Y,-f^{*}K_{X}) > a(X,-K_{X})$. \end{defi} Suppose that $X$ is a weak Fano variety over an algebraically closed field of characteristic $0$. \cite[Theorem 1.1]{LTCompos} proves that for any component $M$ of $\overline{\mathrm{Rat}}(X)$ with larger than the expected dimension, there is a breaking map $f: Y \to X$ and a component $N$ of $\overline{\mathrm{Rat}}(Y)$ such that pushforward under $f$ maps $N$ birationally onto $M$. The techniques used to prove \cite[Theorem 1.1]{LTCompos} do not work in characteristic $p$. The main new obstruction is the existence of inseparable maps. On the one hand, inseparable maps provide new ``unexpected'' examples of dominant breaking maps. On the other hand, inseparable maps provide new ``unexpected'' families of rational curves. The key question is whether such phenomena match up to preserve the relationship between the two. The following theorem verifies this correspondence for surfaces in characteristic $p$. \begin{theo} \label{theo:breakingandhigherdim} Let $S$ be a weak del Pezzo surface over an algebraically closed field of characteristic $p$. Then the following are equivalent: \begin{enumerate} \item $S$ admits a dominant family of rational curves with larger than the expected dimension. \item There is a dominant breaking map $f: Y \to S$. \end{enumerate} \end{theo} \begin{rema} Note that Theorem \ref{theo:breakingandhigherdim} is slightly weaker than \cite[Theorem 1.1]{LTCompos} because it does not address whether each family of rational curves with larger than expected dimension factors through a breaking map. We expect this to be the case. \end{rema} \begin{rema} The example of Shioda hypersurfaces suggests that in higher dimensions the correct interpretation of Geometric Manin's Conjecture may be more subtle. We plan to return to this question in future work. \end{rema} In fact, for a weak del Pezzo surface $S$ we can completely classify all breaking maps $f: Y \to S$. The existence of such maps is closely related to the geometry of the linear series $|-K_{S}|$ and $|-2K_{S}|$. \begin{theo} \label{theo:intro_dominantaclassificationsurfaces} Let $S$ be a weak del Pezzo surface of degree $d$ and suppose that $f: Y \to S$ is a dominant generically finite morphism such that $a(Y,-f^{*}K_{S}) > a(S,-K_{S})$. Then we are in one of the following situations: \begin{enumerate} \item $\mathrm{char}(k) = 2$ or $3$, $d =1$, and $f$ is birationally equivalent to the base change of a quasi-elliptic fibration by a non-separable map to the target curve. In this case $a(Y,-f^{*}K_{S}) = 2$ and the linear series $|-K_{S}|$ defines the quasi-elliptic fibration (after blowing-up the base point). \item $\mathrm{char}(k)=2$, $d=2$, and $f$ is birationally equivalent to a purely inseparable morphism of degree $2$ from $\mathbb{P}^{2}$ to the anticanonical model of $S$. In this case, we have $a(Y, -f^*K_S) = 3/2$ and $|-K_S|$ defines a purely inseparable degree $2$ cover. \item $\mathrm{char}(k)=2$, $d = 1$, and $f$ is birationally equivalent to a purely inseparable morphism of degree $2$ from the quadric cone $Q$ to the anticanonical model of $S$. In this case, we have $a(Y, -f^*K_S) = 2$ and $|-2K_S|$ defines a purely inseparable degree $2$ cover. \item $\mathrm{char}(k)=2$, $d = 1$, and $f$ is birationally equivalent to a non-separable morphism of degree $4$ from $\mathbb{P}^{2}$ to the anticanonical model of $S$. In this case, we have $a(Y, -f^*K_S) = 3/2$ and $|-2K_S|$ defines a purely inseparable degree $2$ cover. \end{enumerate} When $S$ is a del Pezzo surface then none of (1)-(4) can occur. \end{theo} As shown by Theorem \ref{theo:breakingandhigherdim}, the possible weak del Pezzo surfaces $S$ in Theorem \ref{theo:intro_dominantaclassificationsurfaces} are the same as the weak del Pezzo surfaces classified by \cite[Theorem 1.4]{KN20}. These examples are quite interesting; they show that over a function field there can be a Zariski dense set of rational points which outpaces the exponential term in the rate predicted by Manin's Conjecture. (Conjecturally there is no Zariski dense set with the analogous property over a number field. From the perspective of the Fujita invariant, this discrepancy is predicted by the fact that \cite[Theorem 1.1]{HJ16} fails in positive characteristic even in dimension $2$. This is in contrast to positive results for surfaces obtained in \cite{LTT14} and \cite{LT16}.) \begin{exam}[{\cite[Table 2]{KN20b}}] \label{exam:intro_halpen} Let the ground field $k$ be $\mathbb F_3$. Let $S'$ be the surface in the weighted projective space $\mathbb P(1, 1, 2, 3)_{(x:y:z:w)}$ defined by \[ w^2 + z^3 - x^2y^2(x+y)^2 = 0. \] Then this is a du Val del Pezzo surface with four $A_2$ singularities. (\cite[Table 2]{KN20b}) We denote its minimal resolution by $S$ so that $S$ is a weak del Pezzo surface of degree $1$. Let $\beta : \widetilde{S} \to S$ be the blow up of the base point for $|-K_S|$. Then $|-K_{\widetilde{S}}|$ defines a quasi-elliptic fibration, i.e., a fibration $\pi : \widetilde{S} \to B = \mathbb P^1$ such that a general fiber is a cuspidal rational curve. To construct the component of $\overline{M}_{0,0}(S)$ parametrizing fibers of $\pi$, one needs to take a purely inseparable base change by the Frobenius map $F : B' = \mathbb P^1 \to B = \mathbb P^1$. Set $Y = \widetilde{S} \times_B B'$ and let $\widetilde{Y} \to Y$ be the normalization map. We denote by $\rho: \widetilde{Y} \to B'$ the induced generically smooth fibration and by $f: \widetilde{Y} \to S$ the induced inseparable generically finite map. Now we take the base change to the field $K = \mathbb F_3(t)$. We are interested in the asymptotic growth of the number of $K$-rational points of $S_{K}$ of bounded height. We claim that the images of the points on $\widetilde{Y}_{K}$ under $f_{K}$ yield a Zariski dense set which grows faster than the expected growth rate (even in the exponential term). Let $C_K$ be a geometrically integral fiber of $\rho_K: \widetilde{Y}_K \to B'_{K}$ defined over $K$ so that $C_{K} \cong \mathbb{P}^{1}_{K}$. Note that we have $a(C_K, -f_{K}^{*}K_{S_K}) = 2 > a(S_K, -K_{S_K}) = 1$. Thus the points on each such fiber $C_{K}$ grow at faster than the expected rate: there will be $\sim q^{2d}$ points on $C_{K}$ of anticanonical height $\leq d$ compared to the ``expected'' number $\sim q^{d} d^{\rho(S_{K})-1}$ for $S_{K}$. Since $B'_K \cong \mathbb{P}^{1}_K$ there will be a Zariski dense set of deformations of $C_K$ defined over the ground field. Also note that $C_K(K)$ is Zariski dense as $C_K$ is isomorphic to $\mathbb P^1_K$. Thus we need to remove a Zariski dense set of rational points on $S_K$ in order to obtain the desired growth rate for rational points. (Although the set we must remove is Zariski dense, it is a thin set since it comes from $f_K : Y_K \to S_K$.) \end{exam} \begin{exam} \label{exam:CasciniTanaka} We work over $\mathbb{F}_2$. We will recall an example of a surface considered in \cite[end of Section 9]{KM99} and in \cite{CT18} due to the failure of the Kawamata-Viehweg vanishing theorem. Suppose we blow-up $\mathbb{P}^{2}$ at all seven $\mathbb{F}_{2}$-points. We will obtain a weak del Pezzo surface $S$ of degree $2$. \cite[Proposition 5.3]{CT18} shows that the $(-2)$-curves on $S$ will be precisely the strict transforms of the seven $\mathbb{F}_{2}$-lines on $\mathbb{P}^{2}$. \cite[Theorem 4.1]{CT18} shows that $|-K_{S}|$ defines a purely inseparable degree $2$ map to $\mathbb{P}^{2}$. This map factors through the anticanonical model $S'$ of $S$ which has seven $A_{1}$-singularities. Let $w^2 = f_4(x, y, z)$ be the defining equation of $S'$ in the weighted projective space $\mathbb P(1,1, 1, 2)$ where $f_4$ is a homogenous polynomial of degree $4$. By construction $f_4$ has coefficients in $\mathbb F_2$. We define the morphism \[ f : \mathbb P^2 \to S': (s:t:u) \mapsto (x : y : z: w) = (s^2: t^2: u^2 : f_4(s, t, u)). \] Then the Frobenius map $F : \mathbb P^2 \to \mathbb P^2$ factors through $f$. Since $-K_{S}$ is the pullback of $\mathcal{O}(1)$ under the map $S \to \mathbb{P}^{2}$, we see that $-f^{*}K_{S} = \mathcal{O}(2)$. Thus $a(Y,-f^{*}K_{S}) = \frac{3}{2}$ while $a(S,-K_{S}) = 1$. Again working over $K = \mathbb F_2(t)$, the exceptional set for $S_K$ must contain a Zariski dense subset of rational points $f_{K}(\mathbb P_{K}^2(K))$ which have an asymptotic growth rate of $q^{\frac{3}{2}d}$. \end{exam} \subsection{Our methods} To prove Theorem~\ref{theo:maintheorem1}, first we check that components parametrizing stable maps of anticanonical degree $\leq 2$ have expected dimension by classifying these low degree rational curves. (Lemma~\ref{lemm:(-2)-curve}, Lemma~\ref{lemm:lines}, Lemma~\ref{lemm:degree2curves}) Then by employing Bend and Break argument (Lemma~\ref{lemm:weakmbbfordpsurfaces}), we prove that every dominant component of $\overline{\mathrm{Rat}}(S)$ has expected dimension by using an inductive proof on the degree of rational curves. (Proposition~\ref{prop:expecteddim}). A proof of Theorem~\ref{theo:maintheorem2} is similar. We first analyze separability of families of $-K_S$-conics and cubics in Section~\ref{sect:lowdegree} then we use Bend and Break argument (Lemma~\ref{lemm:weakmbbfordpsurfaces}) to prove that every dominant component of $\overline{\mathrm{Rat}}(S)$ parametrizes a free rational curve. (Proposition~\ref{prop: free}). To achieve Theorem~\ref{theo:maintheorem3}, we first prove that under the assumption on $\mathrm{char}(k)$ every dominant family of rational curves of anticanonical degree $\leq 3$ contains a free rational curve using some deformation theory of rational curves in positive characteristic proved in \cite{IIL20}. (Theorem~\ref{theo:separabilitylargechar}) To this end, one needs to bound the arithmetic genus of rational curves of low degree on a del Pezzo surface $S$ and this is the main reason why our assumption on the characteristic of the ground field depends on the degree of $S$. Then we look at 1-dimensional loci of stable maps of anticanonical degree $e$ passing through $e-2$ general points, and prove that these loci are contained in the smooth locus of $\overline{M}_{0,0}(S)$ using an inductive argument whose base case is settled by Theorem~\ref{theo:separabilitylargechar}. (Lemma~\ref{curve-general_p}) Finally we lift everything to characteristic $0$ and use a specialization argument combined with \cite{Testa09} to conclude our main theorem. Theorem~\ref{theo:degree1char0} is also obtained using a similar idea: the irreducibility is known for general del Pezzo surfaces of degree $1$ by \cite{Testathesis} and we use a specialization argument to obtain the main theorem. We believe that this specialization argument is new, and it has potential to be applicable to problems on the space of rational curves on other Fano varieties. Finally to obtain Theorem~\ref{theo:intro_dominantaclassificationsurfaces}, we use the 2 dimensional Minimal Model Program and classify smooth projective polarized surfaces with higher $a$-invariants (Theorem~\ref{theo:largeainvsurfaces}). Then we use this result to deduce Theorem~\ref{theo:intro_dominantaclassificationsurfaces}. Finally we found examples of weak del Pezzo surfaces satisfying Theorem~\ref{theo:intro_dominantaclassificationsurfaces} in \cite{KN20} and \cite{KN20b} which classified pathological examples of Du Val del Pezzo surfaces. Theorem~\ref{theo:breakingandhigherdim} follows from Theorem~\ref{theo:intro_dominantaclassificationsurfaces} and the analysis of low degree rational curves in Section~\ref{sect:expdimlowdegree}. \subsection{Previous works} There is a vast literature studying the space of rational curves on various Fano varieties in characteristic $0$. The most relevant results to this paper are \cite{Testathesis} and \cite{Testa09} which classified components of $\overline{\mathrm{Rat}}(S)$ for most del Pezzo surfaces $S$ in characteristic $0$. \cite{LT21} addressed this problem for curves of genus $\geq 1$ on del Pezzo surfaces. Readers interested in other classification results should consult \cite{BLRT20} and references therein. Let us focus on results in positive characteristic. First of all, there are many papers which study the separable rational connectedness of smooth Fano varieties in characteristic $p$ (for example \cite{Shen10}, \cite{Zhu11}, \cite{CZ14}, \cite{GLPSTZ15}, \cite{Tian15}, \cite{CR19}, \cite{ST19}, and \cite{CS21}). J\'anos Koll\'ar asked whether any smooth Fano variety is separably rationally connected, but this question is wide open at this moment. On the other hand there are only a few results on the classification of irreducible components of moduli spaces of rational curves on Fano varieties in characteristic $p$. \cite{BS18} discussed the irreducibility of moduli spaces of rational curves on low degree hypersurfaces in positive characteristic using a function field version of the circle method. Moduli spaces of rational curves on toric varieties are classified by Bourqui in \cite{Bourqui} using the Cox ring method. Examples of (weak) Fano varieties such that the exceptional set for Manin's conjecture is Zariski dense are well-documented over number fields. The first example was found by Batyrev and Tschinkel in \cite{BT96}, and recently more examples have been found and proved in \cite{LRud} and \cite{BHB20}. \cite{LST18} proposed a geometric description of these exceptional sets over number fields and proved that they are thin sets using the Minimal Model Program. The analogue of \cite{LRud} in positive characteristic has been studied in \cite{Man19}. \ \noindent {\bf Notation:} We will work throughout over a field denoted by $k$; usually $k$ will be algebraically closed. A variety over $k$ is an integral separated scheme of finite type over $k$. For a smooth projective variety $X$ over $k$, $N^1(X)_{{\mathbb Z}}$ denotes the space of divisors up to numerical equivalence and $N_1(X)_{\mathbb Z}$ denotes the space of integral $1$-cycles up to numerical equivalence. For a projective morphism $f : X \to Y$ of schemes, $N^1(X/Y)_{{\mathbb Z}}$ denotes the relative numerical N\'eron-Severi group of $X$ over $Y$. For a scheme $X$, a component of $X$ means an irreducible component of $X$ endowed with its reduced structure. Let $X$ be a smooth projective variety over $k$ and $L$ be an ample line bundle on $X$. An $L$-line ($L$-conic, or $L$-cubic) is a birational stable map $f : \mathbb P^1 \to X$ such that $\deg f^*L = 1$ (resp. $= 2$, or $3$). \ \noindent {\bf Acknowledgements:} The authors would like to thank Jason Starr for explaining the deformation theory of stable maps in characteristic $p$. The authors would also like to thank Damiano Testa for discussing his results \cite{Testathesis} and \cite{Testa09}. The authors would like to thank Yusuke Nakamura for answering our questions regarding del Pezzo surfaces in positive characteristic and Tim Browning for letting us know about the results in \cite{BS18} on rational curves on low degree smooth hypersurfaces in characteristic $p$. The authors would like to thank Damiano Testa for comments on an early draft of this paper. This project was started at the SQuaRE workshop ``Geometric Manin's Conjecture in characteristic $p$'' at the American Institute of Mathematics. The authors would like to thank AIM for the generous support. Brian Lehmann was supported by NSF grant 1600875. Eric Riedl was supported by NSF CAREER grant DMS-1945944. Sho Tanimoto was partially supported by Inamori Foundation, by JSPS KAKENHI Early-Career Scientists Grant number 19K14512, by JSPS Bilateral Joint Research Projects Grant number JPJSBP120219935, and by MEXT Japan, Leading Initiative for Excellent Young Researchers (LEADER). \section{Preliminaries} We restrict our attention to dimension $\leq 3$. In these dimensions we have resolutions of singularities over any perfect field of characteristic $p$ by \cite{Abh56}, \cite{CP08}, and \cite{CP09}. We also can run the Minimal Model Program freely in dimension $2$ by \cite{Mumford}, \cite{BM77}, and \cite{BM76}, and in dimension $3$ if $p > 5$ by \cite{HX15}, \cite{CTX15}, \cite{Bir16}, and \cite{BW17}. \subsection{Deformation theory of stable maps} Fix an algebraically closed field $k$ and let $X$ be a smooth projective variety defined over $k$. We denote the Kontsevich moduli space of stable maps of genus $0$ by $\overline{M}_{0,0}(X)$. (See \cite{BF97}, \cite{B97}, and \cite{BM96} for the foundational theory of this coarse moduli space.) Much of the theory of normal bundles to maps in characteristic $0$ goes through in characteristic $p$. We highlight here some useful previous results. Suppose that $C$ is a nodal arithmetic genus $0$ curve mapping to $X$ via a birational morphism $f$ which is a local immersion at each node of $C$. Under these hypotheses, the normal sheaf is defined as an extension \[ 0 \rightarrow \mathcal Hom_{\mathcal O_C}(K, \mathcal O_C) \to N_{f/X} \to \mathcal Ext_{\mathcal O_C}^1(Q, \mathcal O_C) \to 0, \] where $K$ and $Q$ are the kernel and cokernel of $f^*\Omega_X^1 \to \Omega^1_C$. When $C$ is irreducible, the normal sheaf $N_{f/X}$ is simply the cokernel of $T_C \to f^*T_X$. The space $H^0(C, N_{f/X})$ is the tangent space to the moduli space $\overline{M}_{0,0}(X)$ at the point corresponding to $f$ and $H^1(C, N_{f/X})$ is the obstruction space for the moduli space at $[f]$ (\cite{BF97}, \cite{B97}, and \cite{BM96}). It is natural to study $N_{f/X}$ by comparing it to the normal sheaves of the restriction of $f$ to the components of $C$. We have the following theorem which we use frequently: \begin{theo}[\cite{GHS03} Lemma 2.6] \label{thm-normalBundleNodalCurve} Let $C$ be a nodal curve of arithmetic genus $0$ mapping to $X$ via a birational morphism $f$ that is a local immersion at every node. Let $g$ be the restriction of $f$ to a component $C_i$. Then sections of the normal sheaf $N_{f/X}$ restricted to a component $C_i$ are sections of $N_{g/X}$ with simple poles allowed at each node point in the direction of the other component. In particular, if $N_{g/X}$ is rank $1$ (i.e.~if $X$ is a surface) then $N_{f/X}|_{C_i}$ will simply be $N_{g/X}$ with the degree of the free part increased by the number of components meeting $C_i$. \end{theo} \begin{proof} The problem is local so we may assume that $C$ is an embedded LCI curve. Then the assertion follows from the discussion of \cite[the bottom of Page 1265]{HT08}. \end{proof} \begin{prop} \label{prop-vanH1NodalCurve} Let $E$ be a sheaf on a nodal curve $C$ of arithmetic genus $0$ satisfying the following two conditions: \begin{itemize} \item For each component $C_i$ in $C$, $H^1(C_{i}, E|_{C_i}) = 0$. \item Every component $C_i$, except possibly one component $C_0$, satisfies that $E|_{C_i}$ is globally generated. \end{itemize} Then $H^1(C, E) = 0$. \end{prop} \begin{proof} Recall the exact sequence \[ 0 \to E \to \oplus_{i} E|_{C_i} \to \oplus_{j} E|_{p_j} \to 0. \] The hypothesis that every component except $C_0$ satisfies that $E|_{C_i}$ is globally generated shows that the map $H^0(\sum_i E|_{C_i}) \to H^0(\sum_j E|_{p_j})$ is surjective. Thus, we see that $H^1(C,E)$ is isomorphic to $\oplus_i H^1(C_{i},E|_{C_i})$, which vanishes by hypothesis. \end{proof} \subsection{Classes of singularities} \label{subsec:node_cusp} Let $p$ be a closed point of a reduced (possibly reducible) curve $C$ over an algebraically closed field $k$. We say that $p$ is a node if we have a formal-local equivalence \begin{equation*} \widehat{\mathcal{O}_{C,p}} \cong k[[x,y]]/(xy) \end{equation*} If $f: Z \to X$ is a stable map which is birational onto its image and the image is a nodal curve then the normal sheaf $N_{f/Z}$ is locally free. We say that $p$ is a cusp if $C$ is unibranch at $p$ and we have a formal-local equivalence \begin{equation*} \widehat{\mathcal{O}_{C,p}} \cong k[[x,y]]/(y^{2} + g_{3}(x,y)) \end{equation*} for some homogeneous cubic $g_{3}$. If the characteristic is not $2$, then every cusp is formally-locally equivalent to the cusp defined by $y^{2} = x^{3}$. If the characteristic is equal to $2$, then the family of cusps has moduli. Suppose that $f: Z \to X$ is a birational map from an irreducible smooth curve $Z$ and $p \in Z$ maps to a cusp in $f(Z)$. If the characteristic is not $2$, then the normal sheaf $N_{f/X}$ has a torsion subsheaf of length $1$ at $p$. If the characteristic is equal to $2$, then the normal sheaf $N_{f/X}$ has a torsion subsheaf of length $2$ at $p$. Indeed, the curve defined by the equation $y^{2} + ax^{3} + bx^{2}y + cxy^{2} + dy^{3}$ has rational parametrization \begin{equation*} x = \frac{t^{2}}{a + bt + ct^{2} + dt^{3}} \qquad \qquad y = \frac{t^{3}}{a + bt + ct^{2} + dt^{3}} \end{equation*} and thus $dx$ is either $0$ or divisible by $t^{2}$ and $dy$ is divisible by $t^{2}$. \begin{rema} Note that an irreducible arithmetic genus $1$ curve $C$ in a smooth surface can only have nodes and cusps as singularities. Indeed, a cohomological argument shows that the normalization of $C$ must have genus $0$, $C$ can have at most one singular point $p$, and the preimage of $p$ under the normalization map must have length $2$. Letting $\nu: \mathbb{P}^{1} \to C$ denote the normalization map, there is a three-dimensional subspace of $|\mathcal{O}(3)|$ which is constant on $\nu^{-1}(p)$. This subspace defines a map $\mathbb{P}^{1} \to \mathbb{P}^{2}$ whose image is a cubic isomorphic to $C$. \end{rema} \section{Low degree curves with higher than the expected dimension} \label{sect:expdimlowdegree} Let $S$ be a weak del Pezzo surface. Our first goal is to analyze when a family of rational curves of anticanonical degree $\leq 2$ has larger than the expected dimension. This analysis will form the base case of an inductive argument which addresses curves of arbitrary anticanonical degree. \begin{theo} \label{theo:expectdimlowdegree} Let $S$ be a weak del Pezzo surface of degree $d$ over an algebraically closed field $k$. When $d = 2$, we assume furthermore that $S$ is not the following exception: \begin{enumerate} \item $\mathrm{char}(k)=2$ and $|-K_{S}|$ defines a purely inseparable generically finite morphism $f: S \to \mathbb{P}^{2}$. \end{enumerate} When $d = 1$, we assume furthermore that $S$ is not one of the following exceptions: \begin{enumerate} \setcounter{enumi}{1} \item $\mathrm{char}(k) = 2$ or $3$ and a general member of $|-K_S|$ is singular, or; \item $\mathrm{char}(k) = 2$ and $|-2K_S|$ defines a purely inseparable generically finite morphism $f : S \to Q$ where $Q$ is a quadric cone, or; \item $\mathrm{char}(k) = 2$ and $S$ admits a birational morphism to a surface as in (1) above. \end{enumerate} Let $M$ be a component of $\overline{M}_{0,0}(S)$ generically parametrizing a family of birational maps to curves $C$ with $-K_{S} \cdot C \leq 2$. Then $M$ has the expected dimension unless $C$ is a $(-2)$-curve. \end{theo} We will prove Theorem \ref{theo:expectdimlowdegree} by analyzing each anticanonical degree $\leq 2$ separately. \begin{lemm} \label{lemm:(-2)-curve} Let $S$ be a weak del Pezzo surface. Every rational curve $C$ satisfying $-K_{S} \cdot C = 0$ is a smooth $(-2)$-curve on $S$. \end{lemm} \begin{proof} By the Hodge Index Theorem we see that $C^{2} \leq 0$. The arithmetic genus formula tells us that $C^{2} = 2p_a(C)-2$, so that $C^{2}$ is even and is at least $-2$. If $C^{2}=0$ then by the Hodge Index Theorem $C$ must be proportional to $-K_{S}$, an impossibility. Thus $C^{2}=-2$. We deduce that $C$ has arithmetic genus $0$ and thus is smooth. \end{proof} \begin{lemm} \label{lemm:lines} Let $S$ be a weak del Pezzo surface of degree $d$. Suppose that $M$ is a component of $\overline{M}_{0,0}(S)$ that parametrizes rational curves $C$ with $-K_{S} \cdot C = 1$. Then either: \begin{enumerate} \item $C$ is a $(-1)$-curve. \item $d=1$, $\dim(M) = 0$, and $C$ is a rational curve in $|-K_{S}|$. \item $d=1$, $\dim(M) = 1$, and the curves parametrized by $M$ yield a quasielliptic fibration on the blow-up of $S$ along the basepoint of $|-K_{S}|$. Furthermore in this case $S$ cannot be a del Pezzo surface. \end{enumerate} \end{lemm} \begin{proof} The Hodge Index Theorem tells us that $dC^{2} - 1 \leq 0$. The arithmetic genus formula tells us that $C^{2}-1 = 2p_a(C)-2$, so that $C^{2}$ is odd and is at least $-1$. We deduce that the only options are: \begin{itemize} \item $C^{2} = -1$, $d$ arbitrary: in this case the arithmetic genus of $C$ is $0$, so $C$ is a $(-1)$-curve. \item $C^{2} = 1$, $d=1$: in this case $C \in |-K_{S}|$ by the Hodge Index Theorem and $C$ has arithmetic genus $1$. One possibility is that the general element of $|-K_{S}|$ is a smooth elliptic curve, in which case we are in (2). The other option is that every element of $|-K_{S}|$ is a singular rational curve. In this case we can resolve the base locus of the linear series by blowing up a single point and the resulting fibration must be a quasi-elliptic fibration so that we are in (3). \end{itemize} Finally, we note that families as in (3) do not exist on a del Pezzo surface of degree $1$. It suffices to note that any quasi-elliptic pencil in the anticanonical system must contain a non-integral curve. Indeed, by pushing these curves forward to $\mathbb{P}^{2}$ we obtain a family of rational curves through $9$ fixed points and Bend-and-Break guarantees that this family on $\mathbb{P}^{2}$ parametrizes a non-integral curve. \end{proof} \begin{lemm} \label{lemm:degree2curves} Let $S$ be a weak del Pezzo surface of degree $d$. Suppose that $M$ is a component of $\overline{M}_{0,0}(S)$ that parametrizes rational curves $C$ with $-K_{S} \cdot C = 2$. Then either: \begin{enumerate} \item the component $M$ parametrizes the fibers of a conic fibration. In this case $M$ has the expected dimension. \item $d = 2$ and $M$ parametrizes curves in $|-K_{S}|$. If $M$ has larger than the expected dimension then $|-K_{S}|$ does not define a separable map. \item $d = 1$ and there is a birational map $\phi: S \to \widetilde{S}$ where $\widetilde{S}$ is a weak del Pezzo surface of degree $2$ such that $M$ parametrizes rational curves in $|-\phi^{*}K_{\widetilde{S}}|$. If $M$ has larger than expected dimension then $|-\phi^{*}K_{\widetilde{S}}|$ does not define a separable map. \item $d=1$ and $M$ parametrizes curves in $|-2K_{S}|$. If $M$ has larger than expected dimension then either $|-K_{S}|$ defines a quasielliptic fibration or $|-2K_{S}|$ does not define a separable map. \end{enumerate} \end{lemm} \begin{proof} The Hodge Index Theorem tells us that $dC^{2} - 4 \leq 0$. The arithmetic genus formula shows that $C^{2}-2 = 2g-2$, so that $C^{2}$ is even and is at least $0$. We deduce that the only options are $C^{2} = 0,2,4$. \textbf{Case 1:} $C^{2} = 0$, $d$ arbitrary: in this case the arithmetic genus of $C$ is $0$ and $H^{0}(S,\mathcal O(C)) = 2$. Thus curves of this type are the fibers of a conic fibration. \textbf{Case 2:} $C^{2} = 2$, $d=1,2$: in this case the arithmetic genus of $C$ is $1$ and $\deg(N_{f/S}) = 0$. Suppose that $d=2$. By the Hodge Index Theorem, $C$ is a member of $|-K_S|$. If $\Phi_{|-K_S|}$ is separable, then \cite[Proposition 4.4]{KN20} shows that a general element of $|-K_{S}|$ is smooth and we conclude that $M$ has the expected dimension. Next suppose that $d=1$. In this case, we claim that $C$ is the pullback of a curve under a birational map to a degree $2$ weak del Pezzo surface. To see this, it suffices to find a $(-1)$-curve which has vanishing intersection with $C$. We claim that $K_{S}+C$ will be linearly equivalent to such a curve. Indeed, we have \begin{equation*} (K_{S} + C) \cdot C = 0 \qquad (K_{S}+C) \cdot K_{S} = -1 \qquad (K_{S} + C)^{2} = -1 \end{equation*} Since $H^{2}(S,K_{S}+C)$ vanishes by Serre duality, Riemann-Roch shows that $H^{0}(S,K_{S}+C)$ is non-zero. This means that $K_S + C$ is linearly equivalent to an effective divisor and it follows from the above intersection numbers that it has the form of $E + D$ where $E$ is a $(-1)$-curve and $D$ is a non-negative linear combination of $(-2)$-curves. Then since $C$ is nef, we have $C \cdot D = E \cdot D + D^2 = 0$. We also have $-1 = (E+D)^2= -1 + 2E \cdot D + D^2$. Thus we conclude that $D^2 = 0$ proving that $D = 0$ by the Hodge Index Theorem. Finally note that the deformations of $C$ on this degree $2$ weak del Pezzo yield a family satisfying (2). Thus on our original surface we are in situation (3). \textbf{Case 3:} $C^{2}=4$, $d = 1$: in this case the arithmetic genus of $C$ is $2$ and $C \in |-2K_{S}|$. We will let $g: S \to Q$ denote the morphism to the quadric cone defined by $|-2K_{S}|$. We let $S'$ denote the anticanonical model of $S$ and $g': S' \to Q$ the corresponding finite degree $2$ morphism. To show that (4) holds, we must show that $M$ has the expected dimension if $|-K_{S}|$ does not define a quasielliptic fibration and $|-2K_{S}|$ defines a separable map. From now on we assume both these conditions. Let $B \subset Q$ denote the branch locus of $g: S \to Q$. If $\mathrm{char}(k) \geq 3$ then $B$ is the disjoint union of the cone vertex with a curve $B_1$ of degree $6$. (If $B_{1}$ contained the cone vertex then one can show that $S'$ would have worse than canonical singularities, a contradiction.) If $\mathrm{char}(k)=2$ then the cone vertex is contained in a dimension $1$ component of $B$ whose reduced part is a degree $3$ curve $B_{1}$. Every irreducible rational curve $C \in |-2K_{S}|$ will be singular, and thus the restriction $g|_{C}$ cannot realize $C$ as a simply branched cover of a smooth curve. We conclude that $C$ must satisfy one of the following conditions: \begin{enumerate} \item $g(C)$ goes through a singular point of $B_{1}$. \item $g(C)$ is a hyperplane section of $Q$ which is tangent to the divisor $B_{1}$ at a smooth point of $B_{1}$. \end{enumerate} We first show that there cannot be a $2$-dimensional family of rational curves as in (1) above. In fact, we claim that there is not a $2$-dimensional sublocus of $M$ parametrizing rational curves through a fixed point $p \in S$. Indeed, if there were such a family, then by applying Bend-and-Break we would obtain a $1$-dimensional family of rational curves with class $|-K_{S}|$. But Lemma \ref{lemm:lines} would then contradict our assumption on $|-K_{S}|$. We next rule out a $2$-dimensional family of rational curves as in (2) above. If $C$ is a nodal rational curve then its normal sheaf is locally free and thus the deformations of $C$ have the expected dimension. We conclude that if we have a $2$-dimensional family of deformations of $C$ then a general deformation must have a cusp. The rest of the argument depends on the characteristic. \textbf{Case 3a:} First suppose that $\mathrm{char}(k) \geq 3$. If $C$ is a cuspidal rational curve in $|-2K_{S}|$ then its $g$-image is a hyperplane section of $Q \subset \mathbb{P}^{3}$ which has a point of tangency of order $\geq 3$ with $B_{1}$. In other words, if $M$ fails to have the expected dimension then there is a two-dimensional family of planes meeting the curve $B_1$ to order at least three at some point. Since there is only a two-dimensional space of planes containing a tangent line of $B_1$, it follows that every tangent line to $B_1$ must be a flex. Thus the tangent lines to $B_1$ meet $Q$ to order at least 3 at a given point, and in particular are all contained in $Q$. In other words, the tangent lines to $B_{1}$ are the lines of the ruling on $Q$. These lines all pass through a fixed point, so it follows that $B_1$ is a strange curve in the sense of Hartshorne \cite{hartshorne}, which is impossible by \cite[Chapter IV, Theorem 3.9]{hartshorne}. Thus, we see that when $\mathrm{char}(k) \geq 3$ the space of rational curves in $|-2K_S|$ is at most 1-dimensional. \textbf{Case 3b:} Next suppose that $\mathrm{char}(k) = 2$. Since by assumption $g$ is separable, the anticanonical model $S'$ of $S$ is defined by an equation of the form $w^{2} + wf_{3} + f_{6}$ where $f_{3},f_{6}$ are homogeneous functions on $\mathbb{P}(1,1,2)$. We will use coordinates $x_{0},x_{1},y$ on the weighted projective space. First suppose that $f_{3}$ is irreducible and reduced. Then by applying the automorphism group of $\mathbb{P}(1,1,2)$ we may suppose that \begin{equation*} f_{3} = x_{0}y - x_{1}^{3}. \end{equation*} Just as before, we rule out the possibility that every hyperplane section of the quadric cone that is tangent to the curve defined by $f_{3}=0$ has a cuspidal curve as a preimage. The hyperplane sections of the quadric cone have equations of the form $a_{20}x_{0}^{2} + a_{11}x_{0}x_{1} + a_{02}x_{1}^{2} + cy$. Since we are interested in the general tangent plane, without loss of generality we may suppose that $c=1$. Eliminating $y$ and computing the discriminant, we see that a plane will be tangent to $f_{3}=0$ precisely when $a_{20} = a_{11}a_{02}$. When this condition is met, the tangency point is $(x_0 : x_1 : y) = (1:a_{11}^{1/2}:a_{11}^{3/2})$. From now on we will work on the affine patch $x_{0} \neq 0$ isomorphic to $\mathbb{A}^{2}$. Locally near the point $p = (a_{11}^{1/2},a_{11}^{3/2})$ the curve admits the rational parametrization \begin{equation*} t \mapsto \left( t + a_{11}^{1/2} , a_{02}t^{2} + a_{11}t + a_{11}^{3/2} \right) \end{equation*} sending $0 \mapsto p$. Pulling back the defining equation for the double cover to this rational curve, we see that the preimage is defined by the equation \begin{equation*} w^{2} + w(t^{3} + (a_{11}^{1/2} + a_{02})t^{2}) + \widetilde{f_{6}}(t) \end{equation*} where the constant term of $\widetilde{f_{6}}$ is \begin{align*} b_{600} + a_{11}^{1/2}b_{510} + a_{11}b_{420} + a_{11}^{3/2}(b_{330} + b_{401}) + a_{11}^{2}(b_{240} + b_{311}) + a_{11}^{5/2}(b_{150} + b_{221}) + \\ a_{11}^{3}(b_{060} + b_{131} + b_{202}) + a_{11}^{7/2}(b_{041} + b_{112}) + a_{11}^{4}b_{022} + a_{11}^{9/2}b_{003} \end{align*} and the linear coefficient is \begin{align*} b_{510} + a_{11}(b_{330} + b_{401}) + a_{11}^{2}(b_{150} + b_{221}) + a_{11}^{3}(b_{112} + b_{041}) + a_{11}^{4}b_{003}. \end{align*} Note that this double cover of $\mathbb{P}^{1}$ defines a cuspidal curve if and only if the constant and linear coefficients vanish. If a general hyperplane section (i.e.~a general choice of $a_{11},a_{02}$) defines a cuspidal curve, we must have \begin{align*} b_{600} = b_{510} = \, & \, b_{420} = b_{022} = b_{003} = 0 \\ b_{330} = b_{401} \qquad b_{150} = b_{221} & \qquad b_{112} = b_{041} \qquad b_{240} = b_{311} \\ b_{060} + b_{131} & + b_{202} = 0 \end{align*} Equivalently, we have $f_{6} = (x_{0}y - x_{1}^{3}) g_{3}$ for some cubic equation $g_{3}$. Thus the defining equation has the form \[ w^2 + (x_0y - x_1^3)w + (x_0y - x_1^3)g. \] Then replacing $w$ by $w + g$, the equation becomes \[ w^2 + (x_0y - x_1^3)w + g^2. \] Replacing $w$ by $w + c(x_0y - x_1^3)$, we may assume that $g$ is a homogeneous polynomial in $x_0, x_1$. Then $(x_0:x_1:y:w) = (0:0:1:0)$ is a singular point of the surface. On the patch where $y = 1$, locally analytically the equation looks like \[ w^2 + (x_0 - x_1^3)w + g(x_0, x_1)^2 \] in $\mathbb A^3/\mu_2$. Now we will prove that the singularity at $(0,0,0)$ is worse than canonical. First we claim that $\mathbb A^3/\mu_2$ has a terminal singularity. Indeed, $\mathbb A^3/\mu_2$ is isomorphic to $$\mathrm{Spec} (k[x_0^2, x_1^2, w^2, x_0x_1, x_0w, x_1w]).$$ Let $\beta : W \to \mathbb A^3/\mu_2$ be the blow up of the origin and $E$ be the exceptional divisor. Then the discrepancy of $E$ is $1/2$. Let $\widetilde{S} \subset W$ be the strict transform of $S' \subset \mathbb A^3/\mu_2$. Since the equation for $S'$ has no constant term and no odd degree monomial term, we can conclude that $S'$ is Cartier in $\mathbb A^3/\mu_2$ so that $\beta^*S' = \widetilde{S} + nE$ with a positive integer $n$. Then the discrepancy of $E\cap \widetilde{S}$ in $\widetilde{S}$ over $S'$ is $\frac{1}{2} - n$ which is negative, proving the claim. But the anticanonical model $S'$ must have only canonical singularities, and we conclude that any $S'$ of this type cannot admit a $2$-dimensional family of rational $-K_{X}$-conics. \textbf{Case 3b':} The other possibility is that $\mathrm{char}(k) = 2$ and that $f_{3}$ is reducible or non-reduced. Then by applying the automorphism group of $\mathbb{P}(1,1,2)$ we may suppose that either \begin{equation*} f_{3} = x_{0}y \qquad \qquad \textrm{or} \qquad \qquad f_{3} = g(x_{0},x_{1}) \end{equation*} for some cubic $g$. First suppose $f_{3} = x_{0}y$. Writing as before $a_{20}x_{0}^{2} + a_{11}x_{0}x_{1} + a_{02}x_{1}^{2} + cy$ for the equation of a general hyperplane section, we see that the sections tangent to $f_{3} = 0$ will satisfy either $a_{02} = 0$, $c=0$, or $a_{11} = 0$. The tangent point for every hyperplane section satisfying $a_{02} = 0$ is the point $(0:1:0)$; since we have already ruled out the case where each curve goes through the same point, we cannot get a $2$-dimensional family in the first case. In the second case the hyperplane section is not integral, thus we do not need to consider this case. It only remains to consider the case $a_{11}=0$. Assuming that $a_{11} = 0$, then arguing as before we see that if every tangent to $f_{3}=0$ yields a cuspidal curve then $f_{6}$ is divisible by $y$. We next need to check whether every member of this $2$-dimensional family of cuspidal curves on $S$ is rational. Since $c \neq 0$, by rescaling we may suppose without loss of generality that $c=1$ so that $y = (\alpha x_{0} + \beta x_{1})^{2}$ where $\alpha = a_{20}^{1/2}$ and $\beta = a_{02}^{1/2}$. We then eliminate the variable $y$ so that the equation of our singular curve in $\mathbb{P}_{x_{0},x_{1},w}(1,1,3)$ is given by \begin{equation*} w^{2} + x_{0}(\alpha x_{0} + \beta x_{1})^{2} w + (\alpha x_{0} + \beta x_{1})^{2} g_{4}(x_{0},x_{1}) \end{equation*} for some degree $4$ equation $g$. Since these curves have arithmetic genus $2$, if they are rational then they must have at least one other singularity besides the cusp. (It is not possible for the equation above to define a worse-than-cuspidal singularity.) The only option is that we have a singularity at $x_{0} = 0$, in which case $g_4$ must be divisible by $x_0^2$ for any $\alpha, \beta$. This implies that \[ b_{003} = b_{022} = b_{041} = b_{060} = b_{112} = b_{131} = b_{150} = 0. \] Hence we conclude that $f_6$ is divisible by $x_0^2y$. Thus the point $(0:0:1:0)$ in $\mathbb{P}(1,1,2,3)$ is contained in $S$ and this is a singularity worse than canonical by the argument above. Suppose that $f_3$ is reduced but $f_{3}$ is a union of three lines. Then the only hyperplane sections which are tangent to $f_{3} = 0$ will go through one of the singular points. But we have already ruled out the case where each curve goes through the same point, so this situation cannot give a $2$-dimensional family of rational curves. When $f_3$ is non-reduced, we may assume that $f_3 = x_0^2x_1$ or $x_0^3$. When $f_3 = x_0^2x_1$, a hyperplane section tangent to $f_3$ is given by \[ a_{20}x_0^2 + a_{11}x_0x_1 + a_{02}x_1^2 = y \] such that the tangent point is given by $(0:1:a_{02})$. If we can find a $2$-dimensional family of rational curves such that $a_{02}$ is fixed, then we can conclude a contradiction as before. So we may assume that $a_{02}$ is generic. Then a rational parametrization of the above section is given by \[ (x_0:x_1:y) = (t:s:a_{20}t^2 + a_{11}ts + a_{02}s^2). \] For the resulting rational curve \[ w^2 + t^2sw +f_6(t, s, a_{20}t^2 + a_{11}ts + a_{02}s^2) \] to have a cusp, by arguing as above we see that $f_6$ is divisible by $x_0^2$. Thus the point $(0:0:1:0)$ is contained in $S$ and this is a singularity worse than canonical by the argument above. Finally assume that $f_3 = x_0^3$. In this case by arguing as the case of $f_3 = x_0^2x_1$, we may conclude that $f_6$ is divisible by $x_0^2$. Thus one can deduce a contradiction as before. \end{proof} Altogether Lemma \ref{lemm:(-2)-curve}, Lemma \ref{lemm:lines}, and Lemma \ref{lemm:degree2curves} immediately imply Theorem \ref{theo:expectdimlowdegree}. \subsection{Pathological weak del Pezzo surfaces} \label{subsec:examples} We next classify the weak del Pezzo surfaces $S$ which admit a dominant family of rational curves of low degree which has larger than the expected dimension. In view of later applications, we will split these surfaces into $3$ different types. We emphasize that these three types are not mutually exclusive. Our description will be based upon \cite{KN20} and \cite{KN20b} which classify the weak del Pezzo surfaces in characteristics $2$ and $3$ such that the anticanonical model has Picard rank $1$. \cite[Table 1]{KN20b} gives a complete list of such surfaces based on the type of singularities of the anticanonical model; we will refer to this table in our discussion. \subsubsection{Type 1} The first type of pathological weak del Pezzo surface will satisfy the following equivalent conditions: \begin{clai} \label{clai:type1} Let $S$ be a weak del Pezzo surface. Then the following are equivalent: \begin{enumerate} \item $S$ admits a dominant family of rational curves of anticanonical degree $1$. \item $S$ is a weak del Pezzo surface of degree $1$ such that every element of $|-K_{S}|$ is singular. \item $S$ is a weak del Pezzo surface of degree $1$ and if we blow-up the basepoint of $|-K_{S}|$ we obtain a quasi-elliptic fibration. \end{enumerate} In particular such surfaces can only occur in characteristic $2$ or $3$. \end{clai} \begin{proof} The equivalence of (1) and (2) is an immediate consequence of Lemma \ref{lemm:lines}. To prove the equivalence of (2) and (3), we just need to note that if every element of $|-K_{S}|$ is singular then it is not possible for all the singularities to coincide (since the intersection number of two curves in the family should be $1$). \end{proof} Over an algebraically closed field of characteristic $2$ or $3$, such surfaces have been classified by \cite[Theorem 1.4]{KN20}. In characteristic $2$ there are $3$ infinite families and $4$ other surfaces whose singularity types are: \begin{equation*} E_{8}, D_{8}, A_{1}+E_{7}, 2A_{1}+D_{6}, 2D_{4}, 4A_{1}+D_{4}, 8A_{1} \end{equation*} In characteristic $3$ there are three surfaces whose singularity types are: \begin{equation*} E_{8}, A_{2}+E_{6}, 4A_{2} \end{equation*} \subsubsection{Type 2} The second type of pathological weak del Pezzo surface will satisfy the following equivalent conditions: \begin{clai} \label{clai:type2} Let $S$ be a weak del Pezzo surface. Then the following are equivalent: \begin{enumerate} \item $S$ has degree $2$ and admits a family of rational curves of anticanonical degree $2$ with larger than the expected dimension. \item $S$ has degree $2$ and every element of $|-K_{S}|$ is singular. \item $|-K_{S}|$ defines a purely inseparable morphism $g: S \to \mathbb{P}^{2}$. \item The anticanonical model $S'$ of $S$ admits a purely inseparable map $f: \mathbb{P}^{2} \to S'$ of degree $2$ such that $f^{*}(-K_{S}') \cong \mathcal{O}(2)$. \end{enumerate} In particular such surfaces can only occur in characteristic $2$. \end{clai} \begin{proof} Lemma \ref{lemm:degree2curves} shows that the only possible family of conics with larger than expected dimension on a weak del Pezzo surface of degree $2$ must lie in $|-K_{S}|$. Since this linear series has dimension $2$, we see that (1) implies (2). Lemma \ref{lemm:degree2curves} shows that (2) implies (3). We next show that (3) implies (4). Let $S'$ denote the anticanonical model of $S$. (3) asserts that $|-K_{S}|$ defines a purely inseparable morphism $g: S \to \mathbb{P}^{2}$. This necessarily implies that $S$ has degree $2$ and that $g$ has degree $2$. The Stein factorization of $g$ will be the anticanonical model $S'$ of $S$; in other words, $S'$ will be the normalization of $\mathbb{P}^{2}$ inside the function field of $S$. Since $K(S)$ is obtained by adjoining a single square root to $K(\mathbb{P}^{2})$, we see that the Frobenius morphism $\mathbb{P}^{2} \to \mathbb{P}^{2}$ factors through $g$. In this way we obtain a purely inseparable degree $2$ map $f: \mathbb{P}^{2} \to S'$. Furthermore we have \begin{equation*} f^{*}(-K_{S'}) = f^{*}g^{*}\mathcal{O}(1) = \mathcal{O}(2). \end{equation*} Finally, we show that (4) implies (1). By taking intersection numbers it is clear that $S$ has degree $2$. The lines on $\mathbb{P}^{2}$ will map to a two-dimensional family of curves on $S'$ of anticanonical degree $\leq 2$ with no basepoints. Since there is no such family on $S'$ of anticanonical degree $1$ by Lemma \ref{lemm:lines}, we see that the restriction of $f$ to each line is birational. Thus $S$ admits a two-dimensional family of rational curves of anticanonical degree $2$. \end{proof} Over an algebraically closed field of characteristic $2$, the surfaces satisfying (2) have been classified by \cite[Theorem 1.4]{KN20}. There are exactly $4$ such surfaces, whose singularity types are: \begin{equation*} E_{7}, A_{1}+D_{6}, 3A_{1} + D_{4}, 7A_{1} \end{equation*} \subsubsection{Type 3} The third type of pathological weak del Pezzo surface will satisfy the following equivalent conditions: \begin{clai} \label{clai:type3} Let $S$ be a weak del Pezzo surface. Then the following are equivalent: \begin{enumerate} \item $S$ has degree $1$ and every element of $|-2K_{S}|$ is a singular rational curve. \item $S$ has degree $1$ and the morphism to the quadric cone $g: S \to Q$ defined by $|-2K_{S}|$ is purely inseparable. \item The anticanonical model $S'$ of $S$ admits a purely inseparable map $f: Q \to S'$ of degree $2$ from the quadric cone $Q$ such that $f^{*}(-K_{S}') \cong \mathcal{O}(1)$. \end{enumerate} In particular such surfaces can only occur in characteristic $2$. \end{clai} \begin{proof} We first show that (1) implies (2). Suppose for a contradiction that the morphism $g: S \to Q$ is separable. Note that $g$ is finite on the complement of the $(-2)$-curves in $S$. Let $U \subset S$ be the open set which is the complement of the $(-2)$-curves and the preimage of the singular locus of the branch divisor. Then $U$ admits a decomposition into locally closed subsets $L_{1},L_{2}$ where $L_{1}$ is the ramification divisor and $L_{2}$ is its complement. By construction $L_{1},L_{2}$ are smooth and the restriction of $g$ to both $L_{1}$ and $L_{2}$ is a smooth morphism. By \cite[Corollary 4.6]{Spreafico} we conclude that the pullback of a general hyperplane in $Q$ to $U$ will be smooth. Since we only removed the $(-2)$-curves and a codimension $2$ set, the general pullback of a hyperplane in $U$ is also projective. Altogether we see that a general element in $|-2K_{S}|$ is smooth, contradicting (1). The proof that (2) implies (3) follows from a Frobenius factoring argument as in Claim \ref{clai:type2}. Finally, to see that (3) implies (1) we note that $Q$ admits a $3$-dimensional family of rational curves of degree $2$. These map to a $3$-dimensional family of rational curves on $S'$ of anticanonical degree $\leq 2$ with no basepoints. Since by Lemma \ref{lemm:lines} there is no such family on $S'$ of anticanonical degree $1$, we see that the restriction of $f$ to each rational curve is birational. Lemma \ref{lemm:degree2curves} shows that a three-dimensional family of rational curves of anticanonical degree $2$ must lie in $|-2K_{S}|$ and we conclude that all the curves parametrized by $|-2K_{S}|$ are singular. \end{proof} It turns out that Type 3 surfaces are exactly the same as the Type 1 surfaces which have characteristic $2$. We will demonstrate this in Proposition \ref{prop:type3istype1} after developing the theory of $a$-covers. For now, it will suffice to show that every Type 3 surface also has Type 1. Suppose that $Y$ is a Type 3 surface so that its anticanonical model $S'$ admits a purely inseparable degree $2$ map $f: Q \to S'$ from the quadric cone. Each line on $Q$ maps birationally onto a $-K_{S}$-line in $S'$. In particular by pulling back to $S$ we see there must be a one-dimensional family of $-K_{S}$-lines. Thus Type 3 surfaces are a subclass of Type 1 surfaces. Combining this classification with Theorem \ref{theo:expectdimlowdegree}, we obtain: \begin{coro} \label{coro:lowdegreeexpectdimanticanonical} Let $S$ be a weak del Pezzo surface. If $S$ carries a dominant family of rational curves of anticanonical degree $\leq 2$ with larger than the expected dimension then $S$ has Type 1, Type 2, or Type 3. In particular every curve parametrized by $|-K_{S}|$ is singular. \end{coro} \begin{proof} Let us start with the first claim. According to Lemma \ref{lemm:lines} and Lemma \ref{lemm:degree2curves} the only case which needs consideration is when $S$ is a weak del Pezzo surface with degree $1$ that admits a birational map $\phi: S \to T$ to a surface of Type 2 that contracts a $(-1)$-curve. In this case every integral member of $|-K_{T}|$ is a rational curve. Thus $S$ also has this same property, and in particular must have Type $1$. Note that both Type 1 and Type 2 surfaces have the property that every element of $|-K_{S}|$ is singular. Furthermore, every Type 3 surface also has Type 1 and thus has the same property. This proves the second claim. \end{proof} \section{Low degree curves and inseparable families} \label{sect:lowdegree} In this section first we focus our attention on del Pezzo surfaces $S$ of degree $\geq 2$. Our goal is to classify the inseparable families of rational curves $C$ on $S$ which satisfy $-K_{S} \cdot C \leq 3$. \begin{theo} \label{theo:separablefamlowdegree} Let $S$ be a del Pezzo surface of degree $\geq 2$. Let $M$ be a component of $\overline{M}_{0,0}(S)$ generically parametrizing a dominant family of curves $C$ with $-K_{S} \cdot C \leq 3$. When $d = 3$, we assume furthermore that $S$ is not the following exception: \begin{enumerate} \item $\mathrm{char}(k)=2$ and $S$ is the Fermat cubic surface $w^{3}+x^{3}+y^{3}+z^{3}=0$. \end{enumerate} When $d = 2$, we assume furthermore that $S$ is not one of the following list of exceptions: \begin{enumerate} \setcounter{enumi}{1} \item $\mathrm{char}(k)=3$ and $S$ is the double cover of $\mathbb{P}^{2}$ ramified along the curve $zx^{3} + xy^{3} + yz^{3}$. \item $\mathrm{char}(k)=2$ and $S$ is a double cover of $\mathbb{P}^{2}$ defined by the equation $w^{2} + wy^2 + g_{4}$ where $g_4$ is a homogeneous polynomial in $x, y, z$. \end{enumerate} Then $M$ parametrizes a separable family of curves \end{theo} To prove Theorem \ref{theo:separablefamlowdegree}, first note that by Lemma \ref{lemm:(-2)-curve} and Lemma \ref{lemm:lines} we only need to consider dominant families of rational curves of anticanonical degrees $2$ and $3$. We will analyze each case separately. \begin{lemm} \label{lemm:degree2curvessep} Let $S$ be a del Pezzo surface of degree $d \geq 2$. Suppose that $M$ is a component of $\overline{M}_{0,0}(S)$ that parametrizes rational curves $C$ with $-K_{S} \cdot C = 2$. Then either: \begin{enumerate} \item the component $M$ parametrizes the fibers of a conic fibration. \item $d = 2$, $\dim(M) = 1$, and either \begin{enumerate} \item $M$ parametrizes a separable family of rational curves in $|-K_{S}|$, or \item $\mathrm{char}(k)=3$, $S$ is the double cover of $\mathbb{P}^{2}$ ramified along the curve $zx^{3} + xy^{3} + yz^{3}$, and $M$ is the dual curve of this quartic parametrizing an inseparable family of rational curves in $|-K_S|$, or \item $\mathrm{char}(k)=2$, $S$ is a double cover of $\mathbb{P}^{2}$ defined by the equation $w^{2} + wg_{2} + g_{4}$ where $g_{2} = \ell^{2}$ is a double line, and $M$ parametrizes the preimages of a $1$-dimensional family of lines in $\mathbb{P}^{2}$ where for any point $p \in V(\ell)$ the slope of the line through $p$ is determined by the derivatives of $g_{4}$ at $p$. This family is inseparable. \end{enumerate} \end{enumerate} \end{lemm} \begin{proof} As in Lemma \ref{lemm:degree2curves} the Hodge Index Theorem implies that $C^{2} = 0,2,4$. Furthermore, as explained in Lemma \ref{lemm:degree2curves} in the $C^{2}=0$ case the curves are fibers of a conic fibration. Since a general fiber is smooth, the normal sheaf is locally free which implies that such a rational curve is free. The $C^{2} = 4$ case can only occur when $d=1$ and thus is not a concern for us. The only remaining case to consider is when $C^{2} = 2$ and $d=2$. In this case the curve $C$ lies in $|-K_{S}|$; the arithmetic genus of $C$ is $1$ and $\deg(N_{f/S}) = 0$. We will argue separately the cases when $\mathrm{char}(k)>2$ and when $\mathrm{char}(k)=2$. \textbf{Case 1:} First suppose that the ground field $k$ has characteristic $p \geq 3$. The anticanonical linear series defines a double cover $f: S \to \mathbb{P}^{2}$ that is ramified along a smooth quartic curve $B$. The $f$-images of the curves parametrized by $M$ will be the lines in $\mathbb{P}^{2}$ which are tangent to $B$ and thus $M$ will be the dual curve to $B$. This family of lines will define a non-separable cover if and only if the general curve has normal bundle $\mathcal{O}(-1) \oplus k(p)$, and hence is a cuspidal curve. This occurs precisely when the line is flex to the branch curve $B$. By \cite[(4.5)]{Hefez89}, this is equivalent to the curve being non-reflexive (which means that the Gauss map to the curve $B$ is purely inseparable). \cite{Pardini86} analyzes the smooth plane curves $B$ in characteristic $p \geq 3$ which are non-reflexive. \cite[Corollary 2.2]{Pardini86} shows that if $B$ is smooth and non-reflexive of degree $4$ then $\mathrm{char}(k) = 3$. \cite[Proposition 3.7]{Pardini86} shows that every smooth reflexive curve of degree $4$ is projectively equivalent to $zx^{3} + xy^{3} + yz^{3}$. \textbf{Case 2:} Next suppose that the ground field $k$ has characteristic $2$. In this case it is still true that the anticanonical linear series defines a separable double cover $f: S \to \mathbb{P}^{2}$ whose branch divisor $B$ is a double conic. (However, it is possible for this conic to be singular.) The equation for $S$ has the form $w^{2} + wg_{2} + g_{4}$ where $g_{2},g_{4}$ are homogeneous functions of degree $2,4$ respectively and $B$ is defined by $g_{2}^2$. Suppose we take a line $\ell \subset \mathbb{P}^{2}$ not contained in $B$ and set $C = f^{-1}\ell$. We wish to know when $C$ is cuspidal. Since the map $C \to {\ell}$ is generically \'etale, $C$ can only be singular along $\ell \cap B$. We claim that $C$ can only have a cusp when it is tangent to the conic defined by $g_{2} = 0$. Indeed, suppose that $p \in B \cap \ell$ and change coordinates via $w \mapsto w-\alpha$ so that $w$ vanishes at $p$. (Note that this coordinate transformation might change $g_4$ but will not change $g_2$.) Let $x$ be a local coordinate for $p$ on $\ell$. If $g_2|_{\ell}$ is not $x^2$, then locally $g_2$ can be taken to be proportional to $x$, but then the curve $w^2+wx+g_4$ will have at worst a nodal singularity. Thus if the preimage of $\ell$ is cuspidal then $\ell$ must be tangent to the conic defined by $g_{2} = 0$ along the image of the cusp. We now separate into three further subcases: \textbf{Case 2a:} $g_{2}$ defines a smooth conic. After a coordinate change we may suppose that the equation for $S$ has the form $w^{2} + w(yz - x^{2}) + g_{4}$. We will write $g_{4} = \sum_{i+j+k=4} a_{ijk} x^{i}y^{j}z^{k}$. The family of tangent lines to $yz - x^{2}=0$ have equations of the form $b_{1}y+b_{2}z=0$. Since we are interested in what happens to a general line in this $1$-parameter family, we may for simplicity assume that the equation of the line is $z=by$. Then the restriction of the equation defining $S$ to the line $\ell$ can be written as \begin{align*} w^{2} & + w(by^{2} - x^{2}) + a_{400} x^{4} + (a_{310} + a_{301}b) x^{3}y + (a_{220} + a_{211}b + a_{202}b^{2}) x^{2}y^{2} \\ & + (a_{130} + a_{121}b + a_{112}b^{2} + a_{103}b^{3})xy^{3} + (a_{040}+a_{031}b + a_{022}b^{2} + a_{013} b^{3} + a_{004}b^{4})y^{4} \end{align*} The tangency point $p$ has coordinates $(\sqrt{b}:1)$ on the line and over this point \begin{align*} w^{2} = & \, a_{004} b^{4} + a_{103} b^{3} \sqrt{b} + (a_{202} + a_{013}) b^{3} + (a_{301}+a_{112}) b^{2}\sqrt{b} + (a_{400}+a_{211} + a_{022}) b^{2} \\ & + (a_{310} + a_{121}) b \sqrt{b} + (a_{220} + a_{031}) b + a_{130}\sqrt{b} + a_{040}. \end{align*} Rewriting the equation around the point $(\sqrt{b}:1)$ and substituting $w' = w - \alpha$ where $\alpha$ is the square root of the righthand side of the previous equation, we obtain \begin{align*} w'^{2} & + w'(x-\sqrt{b})^{2} + a_{400} (x-\sqrt{b})^{4} + (a_{310} + a_{301}b) (x-\sqrt{b})^{3} \\ & + (a_{220} + a_{310}\sqrt{b} + a_{211}b + a_{301}b\sqrt{b} + a_{202}b^{2}) (x-\sqrt{b})^{2} + \alpha(x-\sqrt{b})^{2} \\ & + (a_{130} + (a_{121}+a_{310}) b+ (a_{112}+a_{301})b^{2} + a_{103}b^{3})(x-\sqrt{b}) \end{align*} For this equation to define a cusp, the coefficients of $(x-\sqrt{b})$ must vanish. Furthermore, we can only have a purely inseparable family when each of these lines yields a cusp regardless of the value of $b$. This forces the coefficients to be identically zero: \begin{align*} a_{130} = a_{103} = 0 \qquad a_{121} = a_{310} \qquad a_{112} = a_{301} \end{align*} However, any surface $S$ defined by an equation whose coefficients satisfy these conditions will be singular. Indeed, consider the chart where $z=1$. On this chart we have \begin{align*} d/dw & = y-x^{2} \\ d/dx & = a_{310}y(x^{2}-y) + a_{301}(x^{2}-y) \\ d/dy & = w + a_{310}x^{3} + a_{211}x^{2} + a_{031}y^{2} + a_{112}x + a_{013} \end{align*} and we are looking for points on $S$ where all three equations simultaneously vanish. Note that the vanishing of $d/dw$ implies the vanishing of $d/dx$. Thus $S$ will always have a singular point; indeed, isolating $y$ in the equation for $d/dw$ and $w$ in the equation for $d/dy$ and substituting into the equation for $S$ we obtain a polynomial in $x$ whose roots will correspond to singular points of $S$. \textbf{Case 2b:} $g_{2}$ defines a reducible conic. After a coordinate change we may suppose that the equation for $S$ has the form $w^{2} + w(yz) + g_{4}$. We will write $g_{4} = \sum_{i+j+k=4} a_{ijk} x^{i}y^{j}z^{k}$. The family of tangent lines to $yz=0$ have equations of the form $by+cz=0$. Since we are interested in what happens to a general line in this $1$-parameter family, we may for simplicity assume that the equation of the line is $by = z$. Then the restriction of the equation defining $S$ to the line $\ell$ can be written as \begin{align*} w^{2} & + w(by^{2}) + a_{400} x^{4} + (a_{310} + a_{301}b) x^{3}y + (a_{220} + a_{211}b + a_{202}b^{2}) x^{2}y^{2} \\ & + (a_{130} + a_{121}b + a_{112}b^{2} + a_{103}b^{3})xy^{3} + (a_{040}+a_{031}b + a_{022}b^{2} + a_{013} b^{3} + a_{004}b^{4})y^{4} \end{align*} We are interested in the behavior over the point $(1:0)$ so that $w = \sqrt{a_{400}}$. Rewriting the equation so that it is centered around this point, we see that every line will yield a cusp precisely when $a_{310} = a_{301} = 0$. However, these conditions force $S$ to be singular over the point $(1:0:0)$. \textbf{Case 2c:} $g_{2}$ defines a non-reduced conic. After a coordinate change we may suppose that the equation for $S$ has the form $w^{2} + wy^{2} + g_{4}$. We will write $g_{4} = \sum_{i+j+k=4} a_{ijk} x^{i}y^{j}z^{k}$. Note that every line is tangent to the curve $y^{2}=0$. We would like to understand the situation when there is a $1$-parameter family of lines whose preimages are cuspidal. Since the equation of $S$ is symmetric in $x$ and $z$, without loss of generality we may assume that the general line in our family has an equation of the form $z = bx + cy$. Then the restriction of the equation defining $S$ to the line $\ell$ can be written as \begin{align*} w^{2} & + wy^{2} + (a_{400}+a_{301}b + a_{202}b^{2} + a_{103}b^{3} + a_{004}b^{4}) x^{4} \\ & + (a_{310} + a_{301}c + a_{211}b + a_{112}b^{2} + a_{013}b^{3} + a_{103}b^{2}c ) x^{3}y \\ & + (a_{220} + a_{211}c + a_{121}b + a_{202}c^{2} + a_{022}b^{2} + a_{103}bc^{2} + a_{013}b^{2}c) x^{2}y^{2} \\ & + (a_{130} + a_{121}c + a_{031}b + a_{112}c^{2} + a_{103}c^{3} + a_{013}bc^{2})xy^{3} \\ & + (a_{040}+a_{031}c + a_{022}c^{2} + a_{013}c^{3} + a_{004}c^{4})y^{4} \end{align*} Arguing as in the other cases, this equation will define a cusp precisely when the coefficient of $x^{3}y$ vanishes. Furthermore, we want to ensure that there is a $1$-dimensional family of lines for which these coefficients vanish. This gives the condition \begin{equation*} c(a_{301} + a_{103}b^{2}) = a_{310} + a_{211}b + a_{112}b^{2} + a_{013}b^{3} \end{equation*} for our $1$-dimensional family. Note that the intersection of the line $z = bx + cy$ with the line $y=0$ is given by the point $p = (1:0:b)$. Then it is easy to check that \begin{equation*} c = \frac{dg_{4}/dy(p)}{dg_{4}/dx(p)}. \end{equation*} \end{proof} Next we turn to rational curves of anticanonical degree $3$. \begin{lemm} \label{lemm:wdphighchar} Let $S$ be a del Pezzo surface of degree $d \geq 2$. Suppose that $M$ is a component of $\overline{M}_{0,0}(S)$ that parametrizes rational curves $C$ with $-K_{S} \cdot C = 3$. Then either: \begin{enumerate} \item the component $M$ defines a separable family of stable maps which are generically birational maps to smooth free curves. \item $d = 3$, $\dim(M) = 2$, and either \begin{enumerate} \item $M$ parametrizes a separable family of rational curves in $|-K_{S}|$, or \item $\mathrm{char}(k)=2$, $S$ is the Fermat cubic surface in $\mathbb{P}^{3}$, and $M$ is the dual variety parametrizing hyperplanes tangent to $S$. In this case, the family is inseparable. \end{enumerate} \item $d=2$, $\dim(M)=2$ and either \begin{enumerate} \item $M$ parametrizes a separable family of rational curves, or \item $\mathrm{char}(k)=2$, $S$ is the blow-up of the Fermat cubic surface $S'$ in $\mathbb{P}^{3}$, and $M$ is birational to the dual variety of $S'$ and parametrizes the pullbacks of rational members of $|-K_{S'}|$. In this case, the family is inseparable. \end{enumerate} \end{enumerate} \end{lemm} \begin{proof} The Hodge Index Theorem tells us that $dC^{2} - 9 \leq 0$. The arithmetic genus formula tells us that $C^{2}-3 = 2g-2$, so that $C^{2}$ is odd and is at least $1$. Since by assumption $d \geq 2$, we also have that $C^{2} \leq 3$. We deduce that the only options are: \textbf{Case 1:} $C^{2} = 1$, $d$ arbitrary: in this case the arithmetic genus of $C$ is $0$, so $C$ is free. In fact, $C$ must be the strict transform of a general line under a birational map to $\mathbb{P}^{2}$. Such families are separable and have the expected dimension. \textbf{Case 2:} $C^{2} = 3$, $d=2,3$: In this case the arithmetic genus of $C$ is $1$ and $\deg(N_{f/S}) = 1$. Since $C$ is a deformation of an elliptic curve, this implies that either $N_{f/S} = \mathcal{O}(1)$, $N_{f/S} = \mathcal{O} \oplus k(p)$, or (in characteristic $2$ only) $N_{f/S} = \mathcal{O}(-1) \oplus k[t]/(t^2)$ where the torsion part is supported on $p$. If $k$ has characteristic $> 2$ then the normal sheaf of a general stable map is globally generated and thus $M$ is a separable family. We also need to address separability when $\mathrm{char}(k)=2$, $d=2$ or $3$, and $S$ is a del Pezzo surface. First suppose that $d=3$. In this case $S$ is a smooth cubic hypersurface defined by an equation $f = \sum y_{ijkl} x_{0}^{i}x_{1}^{j}x_{2}^{k}x_{3}^{l}$. By Section~\ref{subsec:node_cusp} the family of rational curves obtained by singular hyperplane sections of $S$ will be inseparable if and only if the general such curve is cuspidal. Suppose $P$ is the plane defined by the equation $\sum_{i=0}^{3} z_{i}x_{i} = 0$. Using standard facts about elliptic curves (see for example \cite{Tate74}), we see that intersection $P \cap S$ will be singular if and only if the discriminant $\Delta$ of $f|_{P}$ vanishes and in this case it will be cuspidal if and only if $c_{4}$ vanishes. A computation shows that \begin{equation*} c_{4} = y_{0111}^{4}z_{0}^{4} + y_{1011}^{4}z_{1}^{4} + y_{1101}^{4}z_{2}^{4} + y_{1110}^{4}z_{3}^{4} = ( y_{0111}z_{0} + y_{1011}z_{1} + y_{1101}z_{2} + y_{1110}z_{3} )^{4}. \end{equation*} If every singular hyperplane section of $S$ is cuspidal, then the dual variety must contain the plane defined by $c_{4}=0$ or $c_{4}$ must be identically zero. However, the first option is impossible due to the classification of ``strange hypersurfaces'' in \cite[Theorem 7]{KP91}. Thus the cubic surfaces $S$ for which every singular hyperplane section is cuspidal are exactly those which satisfy \begin{equation*} y_{0111} = y_{1011} = y_{1101} = y_{1110} = 0. \end{equation*} We then claim that every smooth cubic satisfying this condition is projectively equivalent to the Fermat cubic surface. Note that the locus of cubic surfaces satisfying this condition is invariant under the action of $PGL_{4}(k)$. For any cubic surface $S$, $\mathrm{Aut}(S)$ injects into the group of automorphisms of configurations of $(-1)$-curves on $S$, so $\mathrm{Aut}(S)$ is a finite group. (See \cite{DD19} for this claim.) Therefore the orbit of $S$ under $PGL_{4}(k)$ will be $15$-dimensional. Since the projective space of cubic surfaces satisfying the above condition is also $15$-dimensional, the claim follows. Next suppose that $d=2$. We claim that in this case $C$ is the pullback of a curve under a birational map to a degree $3$ del Pezzo surface. To see this, it suffices to find a $(-1)$-curve which has vanishing intersection with $C$. We claim that $K_{S}+C$ will be linearly equivalent to such a curve. Indeed, we have \begin{equation*} (K_{S} + C) \cdot C = 0 \qquad (K_{S}+C) \cdot K_{S} = -1 \qquad (K_{S} + C)^{2} = -1 \end{equation*} Since $H^{2}(S,K_{S}+C)$ vanishes by Serre duality, Riemann-Roch shows that $H^{0}(S,K_{S}+C)$ is non-zero, finishing the argument. We conclude that the family of rational curves containing $C$ is separable unless $S$ is the blow-up of the Fermat cubic surface. \end{proof} \begin{proof}[Proof of Theorem \ref{theo:separablefamlowdegree}:] Combining Lemma \ref{lemm:degree2curvessep} and Lemma \ref{lemm:wdphighchar}, we only need to show that if $S$ is a degree $2$ del Pezzo surface in characteristic $2$ obtained by blowing-up the Fermat cubic surface then the ramification locus of the map $S \to \mathbb{P}^{2}$ defined by $|-K_{S}|$ is a double line. Note that every smooth hyperplane section of the Fermat cubic surface is a supersingular elliptic curve (see \cite[Theorem 1.1]{Homma97}). Thus every smooth curve in $|-K_{S}|$ also has the same property. Then \cite[Theorem 0.3]{Saito17} proves the desired property of the anticanonical linear series of $S$. \end{proof} We next show that there are no issues with separability when the characteristic is sufficiently large. Recall from (\ref{delta}) that the function $\delta(d)$ is defined by: \begin{equation*} \delta(d) = \begin{cases} 2 & \text{ if $d \geq 4$}\\ 3 & \text{ if $d = 2, 3$}\\ 11 & \text{ if $d = 1$}. \end{cases} \end{equation*} \begin{theo} \label{theo:separabilitylargechar} Let $k$ be an algebraically closed field of characteristic $p$. Let $S$ be a del Pezzo surface of degree $d$ over $k$. Assume that $p \geq \delta(d)$. When $d = 2$ and $p = 3$, we further assume that $S$ is not isomorphic to the del Pezzo surface listed in Theorem~\ref{theo:separablefamlowdegree}.(2). Then any dominant family of rational curves on $S$ of anticanonical degree $\leq 3$ contains a free rational curve. In particular, any dominant component parametrizing rational curves of anticanonical degree $\leq 3$ is separable so that it has expected dimension. \end{theo} \begin{proof} When $d\geq 3$, every $-K_S$-conic is smooth and every $-K_S$-cubic has at most $1$ cusp. Thus it follows from a normal bundle calculation that such curves are free. When $d = 2$ and $p = 3$, $-K_S$-conics are handled by Lemma~\ref{lemm:degree2curvessep} and every $-K_S$-cubic has at most one cusp and thus is free. So we only need to consider when $d = 1$ and $p \geq 11$ or $d = 2$ and $p \geq 5$. Let us discuss the case of $d = 1$ as the other case is similar. Let $M$ be any component of $\overline{M}_{0,0}(S)$ which parametrizes a dominant family of stable maps of anticanonical degree $\leq 3$ such that the general map has irreducible domain and is birational onto its image in $S$. Let $T$ be the normalization of a curve in $M$ which parametrizes a dominant family of irreducible curves. It suffices to show that the restriction of the tangent bundle of $S$ to a general curve parametrized by $T$ is globally generated. Let $\mathcal{C}$ denote the normalization of the one-pointed family over $T$ equipped with the evaluation map $ev: \mathcal{C} \to S$. By \cite[Lemma 6.1]{IIL20} we have a diagram \begin{equation*} \xymatrix{ \mathcal{C} \ar[d]_{s} \ar[r]^{g} & \mathcal{C}' \ar[d]_{s'} \ar[r]^{ev'} & S \\ T \ar[r]^{h} & T' & } \end{equation*} that satisfies the following properties: \begin{enumerate} \item $\mathcal{C}'$ and $T'$ are normal. \item $k(T')$ is algebraically closed in $k(\mathcal{C}')$. \item $s'$ is a proper flat morphism such that the reduced subscheme underlying the fiber over a general closed point is a (possibly singular) irreducible rational curve. \item $g$ and $h$ are finite morphisms. \item $ev = ev' \circ g$ and $ev'$ is a separable map. \end{enumerate} We claim that every fiber of $s'$ over a general closed point of $T'$ is smooth. First, \cite[Lemma 7.2]{Badescu01} shows that condition (2) above implies that $k(\mathcal{C}')$ is a separable extension of $k(T')$. In particular this implies that a general fiber $C'$ of $s'$ is reduced. Next, by \cite[Proposition 5.2]{IIL20} the sum of the $\delta$-invariants at the closed points of a general fiber $C'$ is the same as the arithmetic genus. Thus by \cite[Theorem 5.7]{IIL20} it suffices to show that the arithmetic genus of $C'$ is strictly less than $(p-1)/2$. Since the map $ev$ takes a general fiber of $s$ birationally onto its image, the same is true of $ev'$. This implies that the arithmetic genus of a fiber of $s'$ is at most the arithmetic genus of its image in $S$. By the Hodge Index Theorem, a curve of anticanonical degree $\leq 3$ on a weak del Pezzo surface satisfies $dC^{2} \leq (-K_{S} \cdot C)^{2}$ and thus has arithmetic genus $< \frac{11-1}{2} = 5$. Since by assumption $p \geq 11$ we conclude that the general fiber of $s'$ is smooth. Since $ev'$ is a dominant separable morphism and the general fiber of $s'$ is smooth, we deduce that the restriction of the tangent bundle of $S$ to a general fiber of $s'$ is globally generated. Since $g$ takes a general fiber of $s$ birationally onto the corresponding fiber of $s'$, the same property holds for the general fiber of $s$. \end{proof} As a corollary, we have the following statement: \begin{coro} \label{coro:separabilitylargechar} Let $k$ be an algebraically closed field of characteristic $p$. Let $S$ be a del Pezzo surface of degree $d$ over $k$. Assume that $p \geq \delta(d)$. When $d = 2$ and $p = 3$, we further assume that $S$ is not isomorphic to the surface listed in Theorem~\ref{theo:separablefamlowdegree}.(2). Then any rational curve of anticanonical degree $\leq 3$ containing a general point is a free rational curve. \end{coro} Let us add the following lemma for a later application: \begin{lemm} \label{lemm: line_conic} Let $S$ be a del Pezzo surface of degree $1$ over an algebraically closed field $k$ of characteristic $p$. Assume that $p \geq 11$. Then a general member of a dominant family of $-K_S$-conics meets with any $-K_S$-line transversally. \end{lemm} \begin{proof} First of all, note that by Theorem~\ref{theo:separabilitylargechar} all components of $\overline{M}_{0,0}(S)$ parametrizing $-K_S$-lines and conics have the expected dimension and all dominant components of $\overline{M}_{0,0}(S)$ parametrizing $-K_S$-conics are separable. Let $C_1$ be a $-K_S$-conic and $C_2$ be a $-K_S$-line. Then note that $C_1^2 = 0$, $2$, or $4$. We also have $C_2^2 = -1$ or $1$. By the Hodge Index Theorem the determinant of the intersection matrix of $-K_S, C_1, C_2$ is non-negative (regardless of the rank of this matrix). Combining this fact with the above consideration, we conclude that $C_1 \cdot C_2 < 11$. Let $p : \mathcal C \to N$ be a component of $\overline{M}_{0,0}(S)$ parameterizing $C_1$ with the evaluation map $f : \mathcal C \to S$. A general curve parametrized by $N$ is free and so after shrinking $N$ we may assume that the separable morphism $f$ is unramified. Thus we conclude that $f^{-1}(C_2)$ is reduced. Since $C_1 \cdot C_2 < 11$, our assumption on the characteristic implies that every dominant component of $f^{-1}(C_2)$ maps separably to $N$, so the intersection of $f^{-1}(C_2)$ and a general fiber of $p$ is reduced. This implies that a general $C_1$ meets with $C_2$ transversally. \end{proof} The statement of Lemma \ref{lemm: line_conic} fails in characteristic $2$: \begin{exam} It is possible on a del Pezzo surface $S$ that there is a fixed $-K_{S}$-line which is tangent to every $-K_S$-conic in a given $1$-dimensional family. For example, let $k$ be an algebraically closed field of characteristic $2$. Consider the curve $C \subset \mathbb P^1_x \times \mathbb P^1_y$ defined by \[ x_0^2y_1 = x_1^2y_0. \] This is an integral smooth rational curve. Consider the morphism $\pi : \mathbb P^1 \times \mathbb P^1 \to \mathbb P^1$ mapping $(x, y)\mapsto y$. Then every fiber of $\pi|_C : C \to \mathbb P^1$ is non-reduced. We blow up $5$ general points on $C$ and obtain a smooth cubic surface $\beta : S \to \mathbb P^1 \times \mathbb P^1$. Then the strict transform of $C$ is a $(-1)$-curve and every irreducible fiber of $\pi\circ\beta$ is a $-K_{S}$-conic which is tangent to $C$. \end{exam} Finally one can prove the following lemma using an argument similar to the proof of Lemma~\ref{lemm: line_conic}: \begin{lemm} \label{lemm: conic_conic} Let $S$ be a del Pezzo surface of degree $1$ over an algebraically closed field $k$ of characteristic $p$. Assume that $p \geq 11$. Then a general member of a dominant family of $-K_S$-conics meets with any $-K_S$-conic transversally. \end{lemm} \begin{proof} Let $C_1, C_2$ be two $-K_S$-conics. Then one can prove that $C_1.C_2 < 11$. Arguing as in Lemma \ref{lemm: line_conic}, this proves the claim. \end{proof} \section{Inductive arguments using Bend and Break} \label{sect:inductionstep} Let $k$ be an algebraically closed field (of arbitrary characteristic). We would like to classify all dominant families of rational curves on a weak del Pezzo surface $S$ which either have larger than the expected dimension, or (more generally) fail to be separable. Using Bend-and-Break we will reduce the classification problem to smaller degrees, eventually working downward to the base cases discussed in Section \ref{sect:expdimlowdegree} and Section \ref{sect:lowdegree}. The following lemma is the key tool. \begin{lemm} \label{lemm:weakmbbfordpsurfaces} Let $S$ be a weak del Pezzo surface over $k$. Fix a positive integer $d \geq 4$. Assume that every irreducible component of $\overline{M}_{0,0}(S)$ that generically parametrizes a dominant family of birational maps onto irreducible curves with anticanonical degree $< d$ has the expected dimension. Suppose that $M \subset \overline{M}_{0,0}(S)$ is an irreducible component that generically parametrizes a dominant family of birational maps onto irreducible curves of anticanonical degree $d$. Fix $\dim(M)-1$ general points of $S$. Then $M$ parametrizes a stable map $f: Z \to X$ where $Z$ has two different irreducible components $Z_{1},Z_{2} \subset Z$ such that $f(Z_{1}) \cup f(Z_{2})$ contains all $\dim(M)-1$ distinguished points and $f|_{Z_{1}}$, $f|_{Z_{2}}$ are general members of dominant families of birational stable maps in lower anticanonical degree. If furthermore $S$ is a del Pezzo surface, then we can ensure that $Z_{1},Z_{2}$ are the only components of $Z$. \end{lemm} The proof is modeled on \cite[Lemma 1.14]{Testa09}. \begin{proof} Set $r = \dim(M)$. If we fix $r-1$ general points of $S$ then by Bend-and-Break $M$ parametrizes a stable map $f$ with reducible domain whose image contains these $r-1$ points. Furthermore, by \cite[Lemma 4.1]{LT19} (which works in arbitrary characteristic) we may find such a stable map $f$ such that there are at least two components of the domain of $f$ whose images contain one of our fixed points. Let $Z_{1},\ldots,Z_{s}$ be the irreducible components of the domain of $f$ whose images deform in a dominant family and let $C_{1},\ldots,C_{s}$ be their images in $S$. The previous paragraph shows that $s \geq 2$. By assumption every family of birational stable maps with irreducible domains of lower degree has the expected dimension. In particular, if we define $d_{i} := -K_{S} \cdot C_{i}$ then $C_{i}$ can contain at most $d_{i}-1$ general points of $S$. On the other hand, we know that all $r-1$ general points must be contained in the image of $f$. Since $r \geq d - 1 \geq (\sum d_{i}) - 1$, we see that there can be at most two such components $C_{i}$. We conclude that $s=2$. Furthermore, since each $C_{i}$ is going through the maximal possible number of general points in $S$, by choosing our points general we may ensure that $C_{1}$ and $C_{2}$ are general in their respective families. Since $d = d_{1} + d_{2}$ by the argument above, we must have that $f|_{Z_{i}}$ is birational for $i=1,2$. Suppose furthermore that $S$ is a del Pezzo surface. Since the argument above shows that $d = d_{1} + d_{2}$ we see that there can be no other curves in the image of $f$. \end{proof} We can now address the existence of families of rational curves with larger-than-expected dimension. \begin{prop} \label{prop:expecteddim} Let $S$ be a weak del Pezzo surface over $k$. Assume that every dominant component of $\overline{M}_{0,0}(S)$ generically parametrizing birational maps to rational curves of anticanonical degree $\leq 2$ has the expected dimension. Let $M \subset \overline{M}_{0,0}(S)$ be any component that generically parametrizes a dominant family of birational maps onto irreducible curves $C$. Then $M$ has the expected dimension. \end{prop} \begin{proof} We prove the statement by induction on the anticanonical degree. The base case when $-K_{S} \cdot C \leq 2$ is true by assumption. Suppose that $-K_{S} \cdot C = 3$. If the deformations of $C$ had larger than the expected dimension, then by applying Bend-and-Break as in the proof of Lemma \ref{lemm:weakmbbfordpsurfaces} we see that $S$ must also carry a dominant family of rational curves of degree $\leq 2$ which has higher than the expected dimension. This gives a contradiction. Suppose that $-K_{S} \cdot C \geq 4$. Set $r = \dim(M)$. By Bend-and-Break we find a stable map parametrized by $M$ with reducible domain through $r-1$ general points of $S$. By Lemma \ref{lemm:weakmbbfordpsurfaces} there are two curves $C_{1},C_{2}$ in the image of $f$ which deform in a dominant family and contain all $r-1$ general points. Letting $d_{1},d_{2}$ denote the anticanonical degrees of the curves, we have \begin{equation*} r-1 \leq (d_{1}-1) + (d_{2}-1) \leq -K_{S} \cdot C - 2 \leq r-1 \end{equation*} and thus $r = -K_{S} \cdot C - 1$. \end{proof} \begin{proof}[Proof of Theorem \ref{theo:maintheorem1}:] Combine Corollary \ref{coro:lowdegreeexpectdimanticanonical} and Proposition \ref{prop:expecteddim}. \end{proof} Next we consider whether or not families of high degree rational curves are separable. \begin{prop} \label{prop: free} Let $S$ be a del Pezzo surface over $k$. Assume that every dominant component of $\overline{M}_{0,0}(S)$ generically parametrizing birational maps to rational curves of anticanonical degree $\leq 3$ is separable. Let $M \subset \overline{M}_{0,0}(S)$ be any component that generically parametrizes a dominant family of birational maps onto irreducible curves $C$. Then $M$ generically parametrizes a free curve. \end{prop} \begin{proof} Let $C$ be a general member of $M$ and let $-K_S \cdot C = d$. We prove our statement by induction on $d$. By assumption the desired statement holds when $d \leq 3$. When $d \geq 4$, we apply Bend-and-Break and Lemma \ref{lemm:weakmbbfordpsurfaces} to find a stable map $f:Z \to S$ parametrized by $M$ whose domain has exactly two irreducible components. Furthermore Lemma \ref{lemm:weakmbbfordpsurfaces} guarantees that the images $C_{1},C_{2}$ are general in their respective families, hence free. Let $\mathcal{L}$ denote the line bundle on $Z$ with degree $-1$ against one component and degree $0$ against the other. Then we have $H^{1}(Z,f^{*}T_{S} \otimes \mathcal{L}) = 0$. By upper semicontinuity of cohomology groups we deduce that the general map parametrized by $M$ is free. \end{proof} \begin{proof}[Proof of Theorem \ref{theo:maintheorem2}:] Combine Theorem \ref{theo:separablefamlowdegree} and Proposition \ref{prop: free}. \end{proof} \section{Del Pezzo surfaces of degree 1 in characteristic 0} \label{sect:dpchar0} In this section we work over a fixed algebraically closed field $k$ of characteristic $0$. Let $S$ be a del Pezzo surface over $k$ and $\beta$ a class in $N_1(S)_{\mathbb Z}$. Denote by $\overline{M}^{bir}(S,\beta)$ the closure of the locus in the Kontsevich space $\overline{M}_{0,0}(S,\beta)$ parametrizing generically injective maps with irreducible domains. Our goal in this section is to prove the irreducibility of $\overline{M}^{bir}(S,\beta)$. \cite{Testathesis} proved this result when $S$ has degree $\geq 2$ or when $S$ is general of degree $1$: \begin{theo}[\cite{Testathesis} Section 2.2 and Theorem 4.5] Let $S$ be a del Pezzo surface of degree $d$ over an algebraically closed field of characteristic $0$. Suppose that either $d \geq 2$ or $d=1$ and $S$ is general in moduli. Then for every numerical class $\beta$ on $S$ the scheme $\overline{M}^{bir}(S,\beta)$ is either irreducible or empty. \end{theo} We focus on the last case of arbitrary del Pezzo surfaces of degree $1$. We will use the following result: \begin{prop}[\cite{Testathesis} Proposition 4.6] Let $S$ be a del Pezzo surface over an algebraically closed field of characteristic $0$. Suppose that $\beta$ is a nef numerical class on $S$. If $\beta$ is not the multiple of a $-K_{S}$-conic, then $\overline{M}^{bir}(S,\beta)$ is non-empty. \end{prop} We will prove the irreducibility of $\overline{M}^{bir}(S,\beta)$ by deforming to a general del Pezzo surface of degree $1$. The key construction is the following: \begin{lemm}\label{curve-general} Suppose that $S$ is a smooth del Pezzo surface over an algebraically closed field of characteristic $0$ and $\beta \in N_1(S)_{\mathbb Z}$ is such that $e:=-K_S \cdot \beta \geq 3$ and $\overline{M}^{bir}(S,\beta)$ is non-empty. Let $q_1, \dots, q_{e-2}$ be general points in $S$ and let $B$ be the locus in $\overline{M}^{bir}(S,\beta)$ parametrizing morphisms whose images pass through $q_1, \dots, q_{e-2}$. Then $B$ is of dimension 1 and lies in the smooth locus of $\overline{M}_{0,0}(S,\beta)$. There are finitely many maps parametrized by $B$ with reducible domains. \end{lemm} \begin{proof} Let $f: Z \to S$ be a stable map parametrized by $B$. If $Z$ is irreducible, then $f$ is free and so $(Z,f)$ a smooth point of the moduli space. Suppose $Z$ is reducible. Let $Z_1, \dots, Z_m$, $m \geq 2$ be the irreducible components of $Z$ not contracted by $f$ and let $e_i = \deg f|_{Z_i}$ and $f_i=f|_{Z_i}$. Suppose $f_1, \dots, f_k$ are free maps and $f_{k+1}, \dots, f_m$ are non-free. Then the image of $Z_i$, $1 \leq i \leq k$, can pass through at most $e_{i}-1$ general points. So $e-2 \leq e_1 + \dots +e_k -k$. On the other hand $\sum_{i=1}^m e_i =e$, so there are two possibilities: either 1) $m=k=2$ or 2) $k=1, m=2, e_1= e-1, e_2=1$. And in either case there cannot be a contracted component. In the first case, the image of $Z_i$, $i=1,2$, has to pass through $e_i-1$ of the points, and so there are finitely many choices for each $f_i$. Since the images of $f_1$ and $f_2$ pass through general points, they are free and so $f$ is a smooth point of the moduli space. In the second case, the image of $Z_2$ is a $-K_S$-line, and the image of $Z_1$ passes through $q_1, \dots, q_{e-2}$, so $f_1$ is general in its moduli and $N_{f_1}=\mathcal O(e-3)$. Since there are finitely many lines on $S$, \cite[Proposition 2.8]{BLRT20} shows that the images of $Z_1$ and $Z_2$ meet transversally. Thus $f$ is a local immersion in an open neighborhood of the node of $Z$. If the image of $Z_2$ is a $(-1)$-curve or a nodal curve, then $N_{f_1}=\mathcal O(e-3)$ and $N_{f_2}= \mathcal O(-1)$, so $N_f|_{Z_1} = \mathcal O(e-2)$, and $N_f|_{Z_2}=\mathcal O$. If the image of $Z_2$ has a cusp, then $N_{f_1} = \mathcal O(e-3)$ and $N_{f_2}= \mathcal O(-2) \oplus k(p)$ where $p$ is the point at which $f$ is ramified. Therefore, $N_f|_{Z_1}=\mathcal O(e-2)$, and $N_f|_{Z_2} = \mathcal O(-1) \oplus k(p)$. In both cases $(Z,f)$ is a smooth point of the moduli space. \end{proof} \begin{prop}\label{connected-curve} Suppose $S$ is a del Pezzo surface over an algebraically closed field of characteristic $0$ of degree $9-d \geq 1$. Fix $\beta \in N_1(S)_{\mathbb Z}$ such that $e:=-K_S \cdot \beta \geq 3$. Then for general points $q_1, \dots, q_{e-2}$ on $S$, the locus $B$ in $\overline{M}^{bir}(S, \beta)$ parametrizing morphisms whose images pass through $q_1, \dots, q_{e-2}$ is either empty or a connected curve. \end{prop} \begin{proof} Fix a blow-down map $\pi: S \to \mathbb{P}^2$. Write $\beta = mH - k_1E_1-\dots-k_{d}E_d$ where $H$ is the pull-back of the hyperplane class via $\pi$, the $E_i$ are $\pi$-exceptional divisors, and $k_i \geq 0$. First suppose $S$ is general. By \cite{Testathesis} $\overline{M}^{bir}(S, \beta)$ is irreducible. Let $U$ be the open subset of $\overline{M}^{bir}(S, \beta)$ parametrizing generically injective morphisms from $\mathbb{P}^1$ to $S$. By composing with the blow-down $\pi: S \to \mathbb{P}^2$ we get an embedding from $U$ to the Hilbert scheme of curves of degree $m$ in $\mathbb{P}^2$. We let $\mathbb{P}^N$ denote the projective space of curves of degree $m$ in $\mathbb{P}^2$, so we get a morphism $U \to \mathbb{P}^N$ and thus a rational map $\alpha: \overline{M}^{bir}(S, \beta) \dashrightarrow \mathbb{P}^N$. Resolving the indeterminacy locus of $\alpha$, we get morphisms $\widetilde{\alpha}: \widetilde M \to \mathbb{P}^N$ and $p: \widetilde{M} \to \overline{M}^{bir}(S, \beta)$ such that $\widetilde{\alpha}= \alpha \circ p$. The image of $\alpha$ is $(e-1)$-dimensional and the images of $q_1, \dots, q_{e-2}$ in $\mathbb{P}^2$ give a linear subvariety $\Lambda$ of codimension $ \leq e-2$ in $\mathbb{P}^N$ parametrizing curves of degree $m$ passing through them. By \cite[Theorem 2.1]{FL81}, $\widetilde{\alpha}^{-1}(\Lambda)$ is connected. By the above lemma, a general point in every irreducible component of $B$ has an irreducible domain and is therefore in the domain of $\alpha$. Since $B= p(\widetilde{\alpha}^{-1}(\Lambda))$, we conclude that $B$ is connected as well. Now suppose that $S$ is an arbitrary del Pezzo surface of degree $9-d$. Let $V_d$ be the open subvariety of $\mathrm{Hilb}^{d} (\mathbb{P}^2)$ parametrizing $d$ points in general position in $\mathbb{P}^2$ (in the usual sense for del Pezzo surfaces), $Z$ the universal Hilbert scheme over $V_d$ and $\mathcal S$ the blow-up of $\mathbb{P}^2 \times V_d$ with center $Z$. Then there is a point $u \in V_d$ such that $S= \mathcal S_u$. Denote by $q'_1, \dots, q'_{e-2}$ the images of $q_1, \dots, q_{e-2}$ in $\mathbb{P}^2$. For any map $f: \mathbb{P}^1 \to \mathcal S_u$ whose image passes through $q_1, \dots, q_{e-2}$ we have $H^1(N_f(-e+2))=0$, so the deformations of $f$ yield a family of stable maps from $\mathbb{P}^1$ to the fibers of $\mathcal{S} \to V_{d}$ passing through the pre-images of $q'_1, \dots, q'_{e-2}$ which has the expected dimension. Let $\mathcal M$ be the family of stable maps to fibers of $\mathcal S \to V_d$ passing through the preimages of $q'_1, \dots, q'_{e-1}$. We claim that every irreducible component of $\mathcal{M}$ dominates $V_{d}$. This follows from a dimension calculation: we know that each fiber of $\mathcal{M} \to V_{d}$ is at most $1$-dimensional. A normal bundle calculation shows that each component of $\mathcal{M}$ has dimension at least $\dim(V_{d}) + 1$. Together these observations prove the claim. Consider the map from $\mathcal M$ to $V_{d}$. Since the general fiber of this map is connected and every component of $\mathcal{M}$ dominates $V_{d}$, we see that $\mathcal{M}$ is also connected. Since $V_d$ is smooth and the fiber over a general point of $V_d$ is connected, the Stein factorization of the proper map $\mathcal{M} \to V_{d}$ is trivial and thus the fiber over every closed point $u$ is connected. \end{proof} \begin{theo}\label{c-irreducible} If $S$ is a smooth del Pezzo surface of degree $1$ over an algebraically closed field of characteristic $0$, then for every $\beta \in N_1(S)_{\mathbb Z}$ with $-K_S \cdot \beta \geq 3$, $\overline{M}^{bir}(S, \beta)$ is either irreducible or empty. \end{theo} \begin{proof} Suppose that $\overline{M}^{bir}(S, \beta)$ is non-empty. Let $e = -K_S \cdot \beta$, and pick $e-2$ general points $q_1, \dots, q_{e-2}$ in $S$. Lemma \ref{curve-general} shows that in every component of $\overline{M}^{bir}(S, \beta)$ there is a $1$-parameter family of curves parametrizing curves through $q_1, \dots, q_{e-2}$. The union $B$ of all such $1$-parameter families is connected by Proposition \ref{connected-curve}. If $\overline{M}^{bir}(S, \beta)$ is reducible then there should be a point of $B$ which is a singular point of $\overline{M}_{0,0}(S, \beta)$. This is not possible by Lemma \ref{curve-general}. \end{proof} If $\beta$ is a multiple of a $-K_{S}$-conic, then it is easy to see that $\overline{M}_{0,0}(\beta)$ will admit a component that generically parametrizes multiple covers of the corresponding conic fibration. Altogether we have: \begin{theo} \label{theo:dp1char0classification} Let $S$ be a smooth del Pezzo surface of degree $1$ over an algebraically closed field of characteristic $0$. Let $\beta$ be a nef class on $S$ satisfying $-K_S \cdot \beta \geq 3$. Then: \begin{enumerate} \item If $\beta$ is not a multiple of a $-K_{S}$-conic, then there is a unique component $M$ of $\overline{M}_{0,0}(S,\beta)$ generically parametrizing stable maps with irreducible domains. The general map parametrized by $M$ is a birational map onto a free curve. \item If $\beta$ is a multiple of a smooth rational conic, then there is a unique component of $\overline{M}_{0,0}(S,\beta)$ generically parametrizing stable maps with irreducible domains. The general map parametrized by $M$ is a finite cover of a smooth conic. \item If there is a contraction of a $(-1)$-curve $\phi: S \to S'$ such that $\beta$ is the pullback of $-K_{S'}$, then there are exactly two components of $\overline{M}_{0,0}(S,\beta)$ parametrizing stable maps with irreducible domains. One component generically parametrizes birational maps onto free curves, the other generically parametrizes multiple covers of conics. \item If $\beta$ is a multiple of $-2K_{S}$ then there are at least two components of $\overline{M}_{0,0}(S,\beta)$ parametrizing stable maps with irreducible domains. There is a unique component generically parametrizes birational maps onto free curves, and the others generically parametrize multiple covers of conics. \end{enumerate} \end{theo} \begin{proof} By \cite[Proposition 4.6]{Testathesis} there exists a free curve of class $\beta$, and thus a component $M \subset \overline{M}_{0,0}(S,\beta)$ generically parametrizing free curves. Suppose that the general curve parametrized by $M$ is not birational onto its image. If we let $m$ denote the anticanonical degree of the (reduced) image and $b$ the degree of the general map parametrized by $M$, then \begin{equation*} \dim(M) = (m-1) + (2b-2). \end{equation*} Since we also know that $M$ has at least the expected dimension $mb-1$, we deduce that $m=2$. Thus if $M$ generically parametrizes non-birational maps, the images of these maps must be conics. Conversely, since every nef class $\alpha$ satisfying $-K_{S} \cdot \alpha = 2$ is represented by a free conic, multiple covers of conics will always yield a component of $\overline{M}_{0,,0}(S,m\alpha)$. Note that if $\alpha$ is the class of a smooth rational conic, then the moduli space of conics of class $\alpha$ is irreducible. Similarly, if $\alpha$ is the pullback of the anticanonical divisor on a degree $2$ del Pezzo under a birational map, then the moduli space of conics of class $\alpha$ is the dual curve of the branch divisor for the induced map to $\mathbb{P}^{2}$ and thus must be irreducible. It only remains to analyze the case when $M$ generically parametrizes birational maps. By Theorem \ref{c-irreducible} we know that $\overline{M}^{bir}(S,\beta)$ is either irreducible or empty. We also know that $\beta$ is represented by a stable map with an irreducible domain by \cite[Proposition 4.6]{Testathesis}. Thus we obtain the desired property if $\beta$ is not a multiple of a conic. Since a smooth rational conic is a fiber of a morphism to $\mathbb{P}^{1}$, it is clear that a multiple of a smooth rational conic is not represented by any irreducible rational curves. If $\beta$ is pulled back from a degree $2$ del Pezzo surface $S'$, then by choosing gluing free curves representing $|-K_{S'}|$, smoothing, and taking a strict transform we find an irreducible rational curve of class $\beta$. If $\beta$ is a multiple of $|-2K_{S}|$, then by gluing free curves in $|-2K_{S}|$ and smoothing we see that $\beta$ is represented by an irreducible rational curve. \end{proof} \section{Irreducibility of moduli spaces in characteristic $p$} \label{sect:irrcharp} Let $S$ be a del Pezzo surface defined over an algebraically closed field $k$ of characteristic $p$. Denote by $\overline{M}^{bir}(S,\beta)$ the closure of the locus in the Kontsevich space $\overline{M}_{0,0}(S,\beta)$ parametrizing generically birational maps with irreducible domains. As in the previous section, our goal is to show that $\overline{M}^{bir}(S,\beta)$ is irreducible under suitable hypotheses. Our strategy is to deform to characteristic $0$. \subsection{Existence of stable maps with irreducible domains} We first need to show the existence of stable maps with irreducible domains which map birationally onto their image. We will mimic the approach of \cite{Testathesis}. The first step is: \begin{lemm}[\cite{Testathesis} Corollary 2.5] \label{lemm:nefdecomposition} Let $S$ be a del Pezzo surface of degree $d \leq 8$ over an algebraically closed field. Let $D$ be a nef Cartier divisor on $X$. Then there is a sequence of contractions of $(-1)$-curves \begin{equation*} S = Y_{d} \to Y_{d+1} \to \ldots \to Y_{8}, \end{equation*} non-negative integers $n_{d},n_{d+1},\ldots,n_{7}$, and a nef divisor $D'$ on $Y_{8}$ such that \begin{equation*} D = n_{d}(-K_{Y_{d}}) + n_{d+1}\phi_{d+1}^{*}(-K_{Y_{d+1}}) + \ldots + n_{7} \phi_{7}^{*}(-K_{Y_{7}}) + \phi_{8}^{*}D' \end{equation*} where $\phi_{d+i}: Y_{d} \to Y_{d+i}$ is the composition of the birational maps in the above sequence. \end{lemm} \begin{proof} Recall that the description of del Pezzo surfaces as blow-ups of $\mathbb{P}^{2}$ is exactly the same in characteristic $p$ and characteristic $0$. Since the proof of \cite[Corollary 2.5]{Testathesis} only uses the combinatorics of these blow-ups, the proof works equally well in any characteristic. \end{proof} \begin{prop}[\cite{Testathesis} Proposition 4.6] \label{prop:existfreecurve} Let $S$ be a del Pezzo surface over an algebraically closed field. When the degree of $S$ is $1$ we assume that the characteristic of the ground field is not equal to $2$. We further assume that every dominant component of $\overline{M}_{0,0}(S)$ that generically parametrizes birational maps to rational curves of anticanonical degree $\leq 3$ is separable. Then every nef class $\alpha$ is represented by a stable map $f: \mathbb{P}^{1} \to S$ which is a free curve. \end{prop} \begin{proof} First we must address the nef classes $\alpha$ satisfying $-K_{S} \cdot \alpha = 1$. By the Hodge Index Theorem this can only occur when $S$ has degree $1$ and $\alpha = -K_{S}$. Note that $\mathbb{P}^{2}$ contains a cubic rational curve through any 8 points. Since $-K_{S}$ is primitive, by taking a strict transform we see that $\alpha$ is represented by an irreducible rational curve. The more interesting case is when $-K_{S} \cdot \alpha \geq 4$. As in Lemma \ref{lemm:nefdecomposition} we can write \begin{equation*} D = n_{d}(-K_{Y_{d}}) + n_{d+1}\phi_{d+1}^{*}(-K_{Y_{d+1}}) + \ldots + n_{7} \phi_{7}^{*}(-K_{Y_{7}}) + \phi_{8}^{*}D' \end{equation*} where each $Y_{i}$ is a del Pezzo surface of degree $i$. We claim that if $i \geq 4$ then $|-K_{Y_{i}}|$ is represented by a free rational curve. The existence of an irreducible rational curve in the anticanonical linear system follows from the fact that these are the strict transforms of plane cubics passing through the points we blow up. A general member is free by Proposition~\ref{prop: free}. Note that by assumption $|-K_{Y_{2}}|$ and $|-K_{Y_{3}}|$ are also represented by free rational curves (if $d \leq 3$). We now construct a chain of rational curves representing $D$. If $d \geq 2$, we construct the chain by taking $n_{d}$ general free curves in $|-K_{Y_{d}}|$, then connecting it to a chain of $n_{d+1}$ general free curves in $\phi_{d+1}^{*}|-K_{Y_{d+1}}|$, and so on until we reach $Y_{7}$. Since a del Pezzo surface of degree $8$ is either $\mathbb{P}^{1} \times \mathbb{P}^{1}$ or the blow-up of $\mathbb{P}^{2}$ at a point, it is also clear that $D'$ is represented by a free rational curve. Altogether, if $d \geq 2$ then $D$ is represented by a stable map which maps birationally onto a chain of free rational curves. By smoothing we obtain a stable map with irreducible domain mapping to a free curve. When $d=1$ and $n_1 = 0$ the argument is similar. If $n_{1} \geq 2$, then we can write $n_{1} = 2m_{1} + 3m_{2}$ for some non-negative integers $m_{1},m_{2}$. By assumption $|-2K_{S}|$ and $|-3K_{S}|$ are both represented by free rational curves, and we conclude by a similar argument as before. Finally, if $n_{1} = 1$, $C \in |-K_{Y_1}|$ has the normal sheaf $\mathcal O(-1)$ or $\mathcal O(-2)\oplus k(p)$. (Recall that we are assuming that the characteristic $\neq 2$ so that $\mathcal{O}(-3) \oplus k[t]/(t^2)$ is not possible.) Note that each $-\phi_{i}^{*}K_{Y_{i}}$ for $i > 1$ and $\phi_{8}^{*}D'$ can be expressed as a positive sum of at least two $(-1)$-curves. Thus we may represent the class $D$ as a comb whose handle is $C$ and whose teeth are a collection of $(-1)$-curves $E_j$. Since $E_j \cdot C = 1$, the $(-1)$-curves meet $C$ transversally. Since there are at least two $(-1)$-curves, Theorem~\ref{thm-normalBundleNodalCurve} shows that the resulting comb is a smooth point of the moduli space. We can smooth it so that we obtain an irreducible free curve, proving the claim. \end{proof} \subsection{Deforming to characteristic $0$} \begin{lemm}\label{curve-general_p} Suppose that $S$ is a smooth del Pezzo surface of degree $d$ defined over an algebraically closed field $k$ of characteristic $p$. Assume that $p \geq \delta(d)$. When $d = 2$ and $p = 3$, we further assume that $S$ is not isomorphic to the surface listed in Theorem~\ref{theo:separablefamlowdegree}.(2). Let $\beta \in N_1(S)_{\mathbb Z}$ be a nef class such that $e:=-K_S \cdot \beta \geq 3$ and $\overline{M}^{bir}(S,\beta)$ is non-empty. Let $q_1, \dots, q_{e-2}$ be general points in $S$ and let $B$ be the locus in $\overline{M}^{bir}(S,\beta)$ parametrizing stable maps whose images pass through $q_1, \dots, q_{e-2}$. Then $B$ is of dimension 1 and lies in the smooth locus of $\overline{M}_{0,0}(S,\beta)$. Furthermore only finitely many maps parametrized by $B$ have reducible domains. \end{lemm} \begin{proof} We prove the statement by induction on $e$. When $e = 3$, let $f: Z \to X$ be a stable map of degree $3$ passing through a general point. If $Z$ is irreducible, then $(Z,f)$ is a smooth point of the moduli space by Corollary~\ref{coro:separabilitylargechar}. Assume that $Z$ is reducible. Then $Z$ consists of a $-K_S$-conic $Z_1$ and a $-K_S$-line $Z_2$ with $f_i = f|_{Z_i}$. Assume that $d \geq 2$. Then the image of $Z_2$ is a $(-1)$-curve, so it is smooth. It follows from Proposition~\ref{prop-vanH1NodalCurve} that $(Z,f)$ is a smooth point of the moduli space. If $d = 1$, then it follows from Lemma~\ref{lemm: line_conic} that the images of $Z_1$ and $Z_2$ meet transversally. Thus we conclude that $f$ is a local immersion in an open neighborhood of the node of $Z$. If the image of $Z_2$ is a $(-1)$-curve or a nodal curve, then $N_{f_1}=\mathcal O$ and $N_{f_2}= \mathcal O(-1)$, so $N_f|_{Z_1} = \mathcal O(1)$, and $N_f|_{Z_2}=\mathcal O$. If the image of $Z_2$ has a cusp, then $N_{f_1} = \mathcal O$ and $N_{f_2}= \mathcal O(-2) \oplus k(p)$ where $p$ is the point at which $f$ is ramified. Therefore, $N_f|_{Z_1}=\mathcal O(1)$, and $N_f|_{Z_2} = \mathcal O(-1) \oplus k(p)$. In both cases $(Z,f)$ is a smooth point of the moduli space. We now prove the induction step. Choose $e \geq 4$ and assume our assertion is true for stable maps of anticanonical degree $< e$. Let $(Z, f)$ be a stable map parametrized by $B$. If $Z$ is irreducible, then we claim that $(Z,f)$ is a smooth point of the moduli space. Suppose otherwise. This means that there is a component $V$ of the singular locus of $\overline{M}_{0,0}(S)$ which has codimension $1$ in $\overline{M}_{0,0}(S)$ and generically parametrizes birational stable maps with irreducible domains. Pick general points $q_1', \cdots, q_{e-3}'$ and consider a $1$-dimensional locus of $V$ generically parametrizing irreducible curves passing through $q_1', \cdots, q_{e-3}'$. Arguing as in Lemma~\ref{lemm:weakmbbfordpsurfaces}, $f$ breaks into a stable map with reducible domain, and there are the following possible types of breaking curves $(Z', g)$, where the $Z'_{i}$ denote the irreducible components of $Z'$: \begin{enumerate} \item $Z' = Z'_1 \cup Z'_2$ with $-K_S \cdot Z'_1 = d_1>2$, $-K_S \cdot Z'_2 = d_2 > 1$ such that $Z'_1$ contains $d_1-2$ general points and $Z'_2$ contains $d_2 -1$ general points or; \item $Z' = Z'_1 \cup Z'_2 \cup Z'_3$ with $-K_S \cdot Z'_1 = d_1>1$, $-K_S \cdot Z'_2 = d_2 > 1$, and $-K_S \cdot Z'_3 = d_3 > 1$ such that each $Z'_i$ contains $d_i-1$ general points, or; \item $Z' = Z'_1 \cup Z'_2 \cup Z'_3$ with $-K_S \cdot Z'_1 = d_1>1$, $-K_S \cdot Z'_2 = d_2 > 1$, and $-K_S \cdot Z'_3 = 1$ such that $Z'_1$ contains $d_1-1$ general points and $Z'_2$ contains $d_2 -1$ general points. \end{enumerate} In the first case, the induction hypothesis shows that $Z'_1$ and $Z'_2$ are smooth points of the moduli space. This implies that $h^1(Z'_i, g^*T_S|_{Z'_i}) = 0$. Furthermore, $Z'_2$ is general in its moduli so it must be free. Thus we conclude that $h^1(Z', g^*T_S) = 0$. Then $(Z', g)$ is a smooth point of $\overline{M}_{0,0}(S)$, a contradiction. In the second case, the $Z_i$'s are general in moduli so they are free. Thus $(Z', g)$ is a smooth point of moduli space, a contradiction. In the third case, $Z'_1$ and $Z'_2$ must be free. When $d \geq 2$, $Z'_3$ is a smooth curve. Hence it follows from Proposition~\ref{prop-vanH1NodalCurve} that $(Z', g)$ is a smooth point of the moduli space. Assume that $d = 1$. We claim that the images of $Z'_1, Z'_2, Z'_3$ meet transversally with each other. When the degree of $Z'_1$ is greater than $2$, then $Z'_1$ is very free by the induction hypothesis. Thus transversality of $Z'_1$ with $Z'_2$ and $Z'_3$ is clear. Similarly for $Z'_2$, so without loss of generality we may assume that $Z'_1$ and $Z'_2$ are $-K_S$-conics. Then transversality follows from Lemma~\ref{lemm: line_conic} and \ref{lemm: conic_conic}. Arguing as above, we conclude that $(Z', g)$ is a smooth point of the moduli space, a contradiction. Altogether, for a general choice of $q_1, \cdots, q_{e-2}$ points of the form $(Z, f)$ in $B$ with $Z$ irreducible are smooth points of the moduli space. Now suppose $Z$ is reducible. Let $Z_1, \dots, Z_m$, $m \geq 2$ be the non-contracted irreducible components of $Z$, and let $e_i = \deg f|_{Z_i}$ and $f_i=f|_{Z_i}.$ Suppose $f_1, \dots, f_k$ are the maps containing at least one of the general points and $f_{k+1}, \dots, f_m$ are the maps containing none of the general points. Then for $1 \leq i \leq k$ the image of $Z_i$ can pass through at most $e_{i}-1$ general points. So $e-2 \leq e_1 + \dots +e_k -k$. On the other hand $\sum_{i=1}^m e_i =e$, so there are two possibilities: either 1) $m=k=2$ or 2) $k=1, m=2, e_1= e-1, e_2=1$. And in either case there cannot be a contracted component. In the first case, the image of $Z_i$, $i=1,2$, has to pass through $e_i-1$ of the points, and so there are finitely many choices for each $f_i$. Since the images of $f_1$ and $f_2$ pass through the maximum number of general points, they are free and so $(Z,f)$ is a smooth point of the moduli space. In the second case, the image of $Z_2$ is a $-K_S$-line, and the image of $Z_1$ passes through $q_1, \dots, q_{e-2}$, so $f_1$ is general in its moduli and $N_{f_1}=\mathcal O(e-3)$. If $d \geq 2$, then $(Z, f)$ is a smooth point of the moduli space as above. Suppose that $d = 1$. Since there are finitely many lines on $S$ the images of $Z_1$ and $Z_2$ meet transversally. Indeed, assume to the contrary that $Z_1$ is tangent to $Z_2$. Since $Z_1$ is general in its moduli, this is only possible when $Z_1$ is a $-K_S$-conic. However this contradicts with our assumption on $\mathrm{char}(k)$ and Lemma~\ref{lemm: line_conic}. Thus we conclude that $f$ is a local immersion in an open neighborhood of the node of $Z$. If the image of $Z_2$ is a $(-1)$-curve or a nodal curve, then $N_{f_1}=\mathcal O(e-3)$ and $N_{f_2}= \mathcal O(-1)$, so $N_f|_{Z_1} = \mathcal O(e-2)$, and $N_f|_{Z_2}=\mathcal O$. If the image of $Z_2$ has a cusp, then $N_{f_1} = \mathcal O(e-3)$ and $N_{f_2}= \mathcal O(-2) \oplus k(p)$ where $p$ is the point at which $f$ is ramified. Therefore, $N_f|_{Z_1}=\mathcal O(e-2)$, and $N_f|_{Z_2} = \mathcal O(-1) \oplus k(p)$. In both cases $(Z,f)$ is a smooth point of the moduli space. \end{proof} \begin{theo} \label{theo:charpbirorempty} Let $S$ be a smooth del Pezzo surface of degree $d$ over an algebraically closed field $k$ of characteristic $p$, and let $\beta$ be a nef curve class of anti-canonical degree $e \geq 3$. We assume that $p \geq \delta(d)$. When $d = 2$ and $p = 3$, we further assume that $S$ is not isomorphic to the surface listed in Theorem~\ref{theo:separablefamlowdegree}.(2). Then $\overline{M}^{bir}(S,\beta)$ is irreducible or empty. \end{theo} \begin{proof} Suppose $\overline{M}^{bir}(S,\beta)$ is non-empty. We may assume that $S$ is defined over a subfield $k' \subset k$ such that $k'$ is finitely generated over the prime field $\mathbb F_p$ and $N^1(S)_{\mathbb Z} = N^1(S\otimes k)_{\mathbb Z}$. After replacing $k'$ by a finite extension inside $k$ we may assume that $S$ is $k'$-rational and in particular that $S(k')$ is Zariski dense in $S$. After taking another finite extension of $k'$ inside $k$ if necessary, there is a normal complete local ring $R$ which is of finite type over $\mathbb Z_p$ with residue field $k'$ and generic point $\eta$ and a smooth surface $\mathcal S$ over $\mathrm{Spec} \, R$ such that $\mathcal S \otimes_R k' = S$. Let $F_1 \subset S^{e-2}$ be a proper closed subset containing all sets of $e-2$ closed points which fail to be general in the sense of Lemma~\ref{curve-general_p} when applied to $S_{\overline{k'}}$. Next let $F_2 \subset (\mathcal S\otimes_R K(\eta))^{e-2}$ be a proper closed subset containing all sets of $e-2$ closed points which fail to be general in the sense of Lemma~\ref{curve-general_p} when applied to $\mathcal{S} \otimes_{R} \overline{K(\eta)}$. We take the Zariski closure $\mathcal F_2 \subset \mathcal S \times_R \cdots \times_R \mathcal S$ of $F_2$. We define $\mathcal U$ as the Zariski open subset of $\mathcal S \times_R \cdots \times_R \mathcal S$ which is the complement of $F_1 \cup \mathcal F_2$. Choose points $q_1, \dots, q_{e-2}$ defined over $k'$ in $S$ whose product lies in $\mathcal{U}$. Since $S$ is smooth, we may apply Hensel's lemma to find sections $\tilde q_1, \dots, \tilde q_{e-2}$ of $\mathcal S \to \mathrm{Spec} \, R$ such that $\tilde{q}_i \otimes_R k' = q_i$. By construction the product of the $e-2$ points $\tilde{q}_i\otimes_R K(\eta)$'s in $\mathcal S\otimes_R K(\eta)$ is contained in $\mathcal U$. We will write $\beta_{\mathcal{S}} \in N_1(\mathcal S/\mathrm{Spec} \, R)_{{\mathbb Z}}$ for the image of $\beta$ under the pushforward $N_1(S)_{\mathbb Z} \to N_1(\mathcal S/\mathrm{Spec} \, R)_{\mathbb Z}$. Let $\widetilde M$ be the locus in $\overline{M}_{0,0}(\mathcal S/\mathrm{Spec} \, R,\beta_{S})$ parametrizing stable maps $f$ whose images meet with the images of $\tilde q_1, \dots, \tilde q_{e-2}$. Then by \cite[II.1.7 Theorem]{Kollar} the dimension of $\widetilde M$ is greater than or equal to \begin{equation*} 1 + \dim \, R. \end{equation*} Indeed, \cite[II.1.7 Theorem]{Kollar} implies that a component $N$ of $\overline{M}_{0,0}(\mathcal S/\mathrm{Spec} \, R,\beta_{\mathcal{S}})$ which contains a component of $\widetilde{M}$ has dimension greater than or equal to $e -1 + \dim \, R$. We consider a component $N^{(e-1)} \subset \overline{M}_{0,e-1}(\mathcal S/\mathrm{Spec} \, R,\beta_{\mathcal{S}})$ above $N$ and the evaluation map $\mathrm{ev}_{e-1}: N^{(e-1)} \to \mathcal{S}^{e-1}$. Then $\widetilde{M}$ is the preimage of the product of the images of $\tilde{q}_1, \cdots, \tilde{q}_{e-2}$. We conclude that $\widetilde{M}$ has dimension greater than or equal to $1 + \dim \, R$. On the other hand every fiber of $\widetilde M \to \mathrm{Spec} \, R$ has at most dimension $1$ because of Lemma~\ref{curve-general_p}. Altogether, we have shown that every component of $\widetilde{M}$ dominantly maps to $\mathrm{Spec} \, R$. By Proposition \ref{connected-curve}, the geometric generic fiber of $\widetilde M \to \mathrm{Spec} \, R$, i.e., $\widetilde M \otimes_R \overline{K(\eta)}$, is connected. Since $\mathrm{Spec} \, R$ is normal, the Stein factorization of $\widetilde M \to \mathrm{Spec} \, R$ is trivial so that all the geometric fibers are connected. In particular the geometric fiber of $\widetilde{M}$ over the closed point of $R$ is connected. Lemma~\ref{curve-general_p} shows that every point of this fiber is contained in the smooth locus of $\overline{M}_{0,0}(\mathcal{S}_{\overline{k'}})$. Then the same argument as in Theorem \ref{c-irreducible} shows that $\overline{M}^{bir}(\mathcal{S}_{\overline{k'}},\beta)$ is irreducible. Since $\mathcal{S}_{\overline{k'}}$ is constructed from $S$ by a base change of the ground field, our assertion follows. \end{proof} \begin{theo} Let $S$ be a smooth del Pezzo surface of degree $d$ over an algebraically closed field of characteristic $p$. Assume that $p \geq \delta(d)$. When $d = 2$ and $p = 3$, we further assume that $S$ is not isomorphic to the surface listed in Theorem~\ref{theo:separablefamlowdegree}.(2). Let $\beta$ be a nef class on $S$ satisfying $-K_S \cdot \beta \geq 3$. Then: \begin{enumerate} \item If $\beta$ is not a multiple of a $-K_{S}$-conic, then there is a unique component $M$ of $\overline{M}_{0,0}(S,\beta)$ generically parametrizing stable maps with irreducible domains. The general map parametrized by $M$ is a birational map onto a free curve. \item If $\beta$ is a multiple of a smooth rational conic, then there is a unique component $M$ of $\overline{M}_{0,0}(S,\beta)$ generically parametrizing stable maps with irreducible domains. The general map parametrized by $M$ is a finite cover of a smooth conic. \item If $d=2$ and $\beta$ is a multiple of $-K_{S}$, or if $d = 1$ and there is a contraction of a $(-1)$-curve $\phi: S \to S'$ such that $\beta$ is a multiple of the pullback of $-K_{S'}$, then there are exactly two components of $\overline{M}_{0,0}(S,\beta)$ parametrizing stable maps with irreducible domains. One component generically parametrizes birational maps onto free curves, the other generically parametrizes multiple covers of $-K_S$-conics. \item If $d=1$ and $\beta$ is a multiple of $-2K_{S}$ then there are at least two components of $\overline{M}_{0,0}(S,\beta)$ parametrizing stable maps with irreducible domains. There is a unique component generically parametrizes birational maps onto free curves, and the others generically parametrize multiple covers of $-K_S$-conics. \end{enumerate} \end{theo} The proof is essentially the same as the proof of Theorem \ref{theo:dp1char0classification}. \begin{proof} By Proposition \ref{prop:existfreecurve} we know that $\overline{M}_{0,0}(S,\beta)$ is represented by a stable map with irreducible domain. Let $M$ be a component generically parametrizing stable maps with irreducible domains. When the general map parametrized by $M$ is not birational, we argue just as in the proof of Theorem \ref{theo:dp1char0classification}. In particular this proves that such maps can only exist when $\beta$ is the multiple of a $-K_{S}$-conic. It only remains to classify the irreducible components of $\overline{M}^{bir}(S,\beta)$. By Theorem \ref{theo:charpbirorempty} $\overline{M}^{bir}(S,\beta)$ is either irreducible or empty. If $\beta$ is not a multiple of the class of a conic, then Proposition \ref{prop:existfreecurve} shows that $\beta$ is represented by a stable map with irreducible domain and the previous paragraph shows that this map must be birational. Thus $\overline{M}^{bir}(S,\beta)$ is non-empty, hence irreducible. The case when $\beta$ is a multiple of a smooth rational conic is the same as in the proof of Theorem \ref{theo:dp1char0classification}. If $d = 2$ and $\beta$ is a multiple of $-K_{S}$, recall that $|-K_{S}|$ is represented by a free curve by Theorem \ref{theo:separabilitylargechar}. By gluing and smoothing a chain of such curves we find an irreducible rational curve of class $\beta$. If $d=1$ and $\beta$ is a pullback under a map $\phi$ then we can find an irreducible rational curve of class $\beta$ by appealing to the degree $2$ case. If $d = 1$ and $\beta$ is a multiple of $-2K_{S}$, then $|-2K_{S}|$ is represented by a free rational curve by Theorem \ref{theo:separabilitylargechar}. \end{proof} \section{The Fujita invariant for surfaces in characteristic $p$} \label{sec: fujita} In this section we study the Fujita invariant (which we will also call the $a$-invariant) for surfaces in characteristic $p$. Our goal is to prove a classification theorem and to control the behavior of the Fujita invariant under finite covers. Throughout we work over an algebraically closed field $k$ of characteristic $p$. \begin{defi}\cite[Definition 2.2]{HTT15} \label{defi: Fujita invariant} Let $X$ be a smooth projective variety and let $L$ be a big and nef $\mathbb{Q}$-divisor on $X$. The {\it Fujita invariant} (which we will also call the $a$-invariant) is $$ a(X, L) := \min \{ t\in {\mathbb R} \mid t[L] + [K_X] \in \overline{\mathrm{Eff}}^{1}(X) \}. $$ If $L$ is nef but not big, we set $a(X,L) = \infty$. \end{defi} By \cite[Proposition 2.7]{HTT15}, $a(X, L)$ does not change when pulling back $L$ by a birational map between smooth varieties. Thus, when $X$ is a singular projective variety which admits a resolution of singularities, we define the Fujita invariant for $X$ by pulling back to a smooth birational model $\phi : \widetilde{X} \rightarrow X$: $$ a(X, L):= a(\widetilde{X}, \phi^*L). $$ This definition does not depend on the choice of $\phi$. \begin{rema} Suppose that $X$ is a smooth projective variety and $L$ is a big and nef divisor on $X$. Then $a(X,L) > 0$ if and only if $X$ admits a dominant family of rational curves satisfying $K_{X} \cdot C < 0$. This follows from the following theorem of \cite{Das}. \end{rema} \begin{theo}[\cite{Das} Theorem 1.6] \label{theo:Das} Let $X$ be a smooth projective variety over an algebraically closed field. Then $K_{X}$ is not pseudo-effective if and only if $X$ admits a dominant family of rational curves satisfying $K_{X} \cdot C < 0$. \end{theo} The rationality of the Fujita invariant is proved in characteristic $0$ for threefolds by Batyrev in \cite{Bat92} and for higher dimensional varieties in \cite{BCHM}. For varieties of low dimension in characteristic $p$, it follows from the work of \cite{Das}. \begin{theo}[\cite{Das}] \label{theo:rationality} Let $X$ be a smooth projective variety of dimension $\leq 3$ and $L$ be a big and nef $\mathbb Q$-divisor on $X$. We also assume that the characteristic $p$ of the ground field $k$ is $> 5$ when the dimension of $X$ is $3$. Then $a(X, L)$ is rational. \end{theo} To derive this statement from \cite{Das}, we will need a well-known lemma: \begin{lemm} \label{lemm:terminalpair} Let $X$ be a smooth projective variety of dimension $\leq 3$ and $L$ be a big and nef $\mathbb Q$-divisor on $X$. Let $a$ be any positive real number. Then there exists an effective $\mathbb Q$-divisor $0 \leq L' \sim_{\mathbb Q} L$ such that $(X, aL')$ is a terminal pair. \end{lemm} \begin{proof} It follows from \cite[Proposition 2.61]{KM98} that there exists an effective divisor $E$ such that for any rational number $0 < \epsilon \ll 1$, $A_\epsilon = L-\epsilon E$ is ample. Let $\beta : \widetilde{X} \to X$ be a log resolution for $(X, E)$ whose existence is guaranteed by \cite{CP09} and \cite{Cut09} in dimension $3$. Let $F$ be an effective exceptional divisor such that $-F$ is $\beta$-ample. Then we have $$\beta^*L = \beta^*A_\epsilon + \epsilon\beta^*E = \beta^*A_\epsilon - \epsilon F + \epsilon(\beta^*E + F).$$ For $0 < \epsilon \ll 1$, $(\widetilde{X}, a\epsilon(\beta^*E + F))$ is a terminal pair and $\beta^*A_\epsilon - \epsilon F$ is ample. Thus one can find a general ample $\mathbb Q$-divisor $A'_\epsilon \sim_{\mathbb Q} \beta^*A_\epsilon - \epsilon F$ such that the support of $A_\epsilon' + \epsilon(\beta^*E + F)$ is a snc divisor and every coefficient of $aA'_\epsilon$ is strictly less than $1$. Let $L' = \beta_*A_\epsilon' + \epsilon E$. By the negativity lemma, we have $\beta^*L' = A_\epsilon' + \epsilon(\beta^*E + F)$. Thus when $\epsilon$ is sufficiently small, $(X, aL')$ is a terminal pair by \cite[Corollary 2.32]{KM98}. \end{proof} \begin{proof}[Proof of Theorem~\ref{theo:rationality}] We only prove the case of dimension $3$. After rescaling of $L$ we may assume that $a(X, L) > 1$. We pick $L' = A'+ \epsilon E$ as in the proof of Lemma~\ref{lemm:terminalpair} with $a = a(X, L)$. Let $V$ be the subspace of the space of $\mathbb R$-divisors which is generated by $A', E$. Using the arguments in Lemma~\ref{lemm:terminalpair} one can find an ample $\mathbb Q$-divisor $A$ such that $A$ does not share any component with $A'$ and $E$, $A\sim_{\mathbb Q} A'$, and $K_X + A + (a-1)A' + a\epsilon E$ is terminal. Then it follows from \cite[Theorem 1.2]{Das} that the pseudo-effective polytope $\mathcal E_{A}(V)$ in $V$ is a rational polytope. Since $A + (a-1)A' + a\epsilon E + K_X$ is on the boundary of this polytope, we conclude that $a$ is rational. \end{proof} The following notion plays a central role in the study of Fujita invariants: \begin{defi} Let $X$ be a smooth projective variety of dimension $\leq 3$ such that $K_X$ is not pseudo-effective. Let $L$ be a big and nef $\mathbb Q$-Cartier divisor on $X$. We say $(X, L)$ is adjoint rigid if $a(X, L)L + K_X$ has Iitaka dimension $0$. When $X$ is singular and admits a resolution of singularities $\beta: \widetilde{X} \to X$, we say $(X, L)$ is adjoint rigid if $(\widetilde{X}, \beta^*L)$ is adjoint rigid. This definition does not depend on the choice of $\beta$. \end{defi} \begin{lemm} \label{lemm:ainvseparablecover} Let $f: Y \to X$ be a dominant separable generically finite morphism of smooth varieties and let $L$ be a big and nef $\mathbb{Q}$-divisor on $X$. Then $a(Y,f^{*}L) \leq a(X,L)$. \end{lemm} \begin{proof} By the Riemann-Hurwitz formula there is an effective ramification divisor $R$ such that $K_{Y} = f^{*}K_{X} + R$. Thus \begin{equation*} K_{Y} + a(X,L)f^{*}L = f^{*}(K_{X} + a(X,L)L) + R \end{equation*} is pseudo-effective, proving the desired inequality. \end{proof} Note that the result of Lemma \ref{lemm:ainvseparablecover} may fail for inseparable maps. A well-known example is given by a unirational parametrization of a K3 surface: a smooth rational surface has positive $a$-invariant with respect to any polarization but a K3 surface has $a$-invariant $0$. \subsection{Surfaces with large $a$-invariant} We next classify the pairs of a smooth projective surface $S$ and a divisor $L$ such that $a(S,L) > 1$. Since the minimal model program works just as in characteristic $0$, there are essentially no differences in the characteristic $p$ situation. For completeness we will include a quick proof of every assertion. \begin{prop}[\cite{LTT14} Proposition 5.9] \label{prop:surfaceconstants} Let $S$ be a smooth uniruled projective surface over $k$ and let $L$ be a big and nef $\mathbb{Q}$-divisor on $S$. \begin{enumerate} \item Suppose that $\kappa(K_{S} + a(S,L)L) = 1$. Let $F$ be a general fiber of the canonical map for $(S,a(S,L)L)$. Then \begin{equation*} a(S,L) = a(F,L) = \frac{2}{L \cdot F}. \end{equation*} \item Suppose that $\kappa(K_{S} + a(S,L)L) = 0$. Then there is a birational morphism $\phi: S \to S'$ where $S'$ is a smooth weak del Pezzo surface such that $-K_{S'} \sim_{\mathbb{Q}} a(S,L)\phi_{*}L$. \end{enumerate} \end{prop} \begin{proof} We run the miminal model program for $(S,a(S,L)L)$ to obtain a birational morphism $\phi: S \to S'$. Since $L$ is a big and nef divisor each birational step of the MMP is a contraction of a $(-1)$-curve and the end result $S'$ is smooth. We know that $K_{S'} + a(S,L)\phi_{*}L$ is semiample but not big so that its Iitaka dimension must be $0$ or $1$. When the Iitaka dimension is $0$, we obtain the desired statement. When the Iitaka dimension is $1$ then by the classification of surfaces we know that the corresponding map must have general fiber isomorphic to $\mathbb{P}^{1}$. Indeed, let $\pi : S' \to B$ be the semiample fibration of $K_{S'} + a(S,L)\phi_{*}L$. Pick a sufficiently small $\epsilon > 0$ and perform a relative $(K_{S'} + (a(S,L)-\epsilon)\phi_{*}L)$-MMP over $B$. Then the outcome is a Mori fiber space so one may appeal to the classification of Mori fiber spaces in dimension $2$. In particular, in this situation $K_{S'} + a(S,L)\phi_{*}L$ vanishes when restricted to a general fiber $F$, yielding the desired description of the $a$-invariant. \end{proof} \begin{coro} Let $S$ be a smooth uniruled projective surface and let $L$ denote a big and nef divisor on $S$. Then \begin{equation*} a(S,L) \in \left\{ \left. \frac{2}{n} \right| n \in \mathbb{N} \right\} \cup \left\{ \left. \frac{3}{n} \right| n \in \mathbb{N} \right\} \end{equation*} \end{coro} \begin{proof} In Case (1) of Proposition \ref{prop:surfaceconstants} we see directly that $a(S,L)$ has the form $2/n$. In Case (2) of Proposition \ref{prop:surfaceconstants}, $S'$ will admit a curve of anticanonical degree $2$ unless $S' \cong \mathbb{P}^{2}$, in which case $S'$ will admit a curve of anticanonical degree $3$. For such a curve $C$ we have \begin{equation*} a(S,L) = \frac{-K_{S'} \cdot C}{\phi_{*}L \cdot C} \end{equation*} and we deduce the desired expression. \end{proof} As a consequence we can easily classify the pairs $(S,L)$ with large $a$-invariant. \begin{theo} \label{theo:largeainvsurfaces} Let $S$ be a smooth uniruled projective surface and let $L$ denote a big and nef divisor on $S$. If $a(S,L) > 1$ then \begin{equation*} a(S,L) \in \left\{3,2, \frac{3}{2} \right\} \end{equation*} Furthermore \begin{enumerate} \item If $a(S,L) = 3$ then there is a birational morphism $\phi: S \to \mathbb{P}^{2}$ such that $L = \phi^{*}\mathcal{O}(1)$. \item If $a(S,L) = 2$ and $(S,L)$ is adjoint rigid then there is a birational morphism $\phi: S \to Q$ such that $Q$ is either a smooth quadric or a quadric cone in $\mathbb{P}^{3}$ and $L = \phi^{*}\mathcal{O}_{\mathbb{P}^{3}}(1)$. \item If $a(S,L) = 2$ and $(S,L)$ is not adjoint rigid then there is a birational morphism $\phi: S \to S'$ where $S'$ is a ruled surface and $L$ is the pullback of a big and nef divisor with degree $1$ along the fibers of the ruling of $S'$. \item If $a(S,L) = 3/2$ then there is a birational morphism $\phi: S \to \mathbb{P}^{2}$ such that $L = \phi^{*}\mathcal{O}(2)$. \end{enumerate} \end{theo} \begin{proof} Just as in Proposition \ref{prop:surfaceconstants} we run the MMP for $(S,a(S,L)L)$ and repeatedly contract $(-1)$-curves to obtain $\phi: S \to S'$. Suppose that $E$ is the $(-1)$-curve contracted by the first step of the MMP. Since $a(S,L) > 1$ and $(K_{S} + a(S,L)L) \cdot E < 0$, we see that $L \cdot E = 0$. Thus $L$ is pulled back from the target of the first step of the MMP. Repeating this logic inductively, we see there is some big and nef divisor $L'$ on $S'$ such that $L = \phi^{*}L'$. Using the classification of weak del Pezzo surfaces we obtain the description of the theorem. \end{proof} \subsection{Covers which increase the $a$-invariant} \label{sect:increaseainv} Suppose that $S$ is a weak del Pezzo surface. As discussed in the introduction, we expect that the ``pathological'' dominant families of rational curves on $X$ are controlled by generically finite maps $f: Y \to S$ such that $a(Y,-f^{*}K_{S}) > a(S,-K_{S}) = 1$. Our goal in this section is to classify the situations in which the $a$-invariant of $Y$ is strictly larger than that of $S$. \begin{theo} \label{theo:dominantaclassificationsurfaces} Let $S$ be a weak del Pezzo surface and suppose that $f: Y \to S$ is a dominant generically finite morphism such that $a(Y,-f^{*}K_{S}) > a(S,-K_{S})$. Then we are in one of the following situations: \begin{enumerate} \item $(Y,-f^{*}K_{S})$ is not adjoint rigid, $a(Y,-f^{*}K_{S}) = 2$, and the image of a general fiber of the Iitaka fibration for $a(Y,-f^{*}K_{S})(-f^*K_S) + K_Y$ is a curve $C$ on $S$ satisfying $-K_{S} \cdot C = 1$. In this case $f$ is birationally equivalent to the base-change of a quasi-elliptic fibration by a non-separable map to the base curve. \item $\mathrm{char}(k)=2$, $S$ is a weak del Pezzo surface of degree $2$, and $f$ is birationally equivalent to a purely inseparable morphism of degree $2$ from $\mathbb{P}^{2}$ to the anticanonical model of $S$. We have $a(Y, -f^*K_S) = 3/2$ in this case. \item $\mathrm{char}(k)=2$, $S$ is a weak del Pezzo surface of degree $1$, and $f$ is birationally equivalent to a purely inseparable morphism of degree $2$ from the quadric cone $Q$ to the anticanonical model of $S$. We have $a(Y, -f^*K_S) = 2$ in this case. \item $\mathrm{char}(k)=2$, $S$ is a weak del Pezzo surface of degree $1$, and $f$ is birationally equivalent to a non-separable morphism of degree $4$ from $\mathbb{P}^{2}$ to the anticanonical model of $S$. We have $a(Y, -f^*K_S) = 3/2$ in this case. \end{enumerate} \end{theo} \begin{proof} First note that if $f: Y \to S$ is separable then $K_{Y} - f^{*}K_{S}$ is an effective divisor so that $a(Y,-f^{*}K_{S}) \leq a(S,-K_{S})$. Since we are interested in situations where this inequality fails the map $f$ must be non-separable. Theorem \ref{theo:largeainvsurfaces} classifies the situations where $a(Y,-f^{*}K_{S}) > 1$. When $Y$ is not adjoint rigid, the rest of the properties in the first sentence of (1) are immediate from Theorem \ref{theo:largeainvsurfaces}. Since $S$ carries a $1$-dimensional family of $-K_{S}$-lines, Lemma \ref{lemm:lines} shows that $S$ must have degree $1$ and that the curves $C$ on $S$ are singular members of $|-K_{S}|$. Resolving this linear series, we see that the fibers of the Iitaka fibration on $Y$ map birationally to the fibers of a quasi-elliptic fibration on the blow-up of $S$. Furthermore $f$ must be non-separable by Lemma \ref{lemm:ainvseparablecover}. Altogether this proves the second sentence. Next we consider the case when $Y$ is adjoint rigid. Let $\phi: Y \to Y'$ be the map to a weak del Pezzo surface constructed by Theorem \ref{theo:largeainvsurfaces} by running the $(K_{Y} -a(Y, -f^*K_S) f^{*}K_{S})$-MMP. Since each $(-1)$-curve we contract while running the MMP will have vanishing intersection against the pushforward of $-f^{*}K_{S}$, we see that $-f^{*}K_{S} = \phi^{*}L'$ for some divisor $L'$ on $Y'$. This implies that any $\phi$-exceptional curve on $Y$ is either contracted by $f$ or is mapped to a $(-2)$-curve on $S$. If we let $\psi: S \to S'$ denote the contraction of all the $(-2)$-curves on $S$, then there is a generically finite morphism $f': Y' \to S'$ forming a commuting diagram \begin{equation*} \xymatrix{ Y \ar[d]^{\phi} \ar[r]^{f} & S \ar[d]^{\psi} \\ Y' \ar[r]^{f'} & S' } \end{equation*} From the equation \begin{equation*} K_{Y'} \sim_{\mathbb{Q}} a(Y,-f^{*}K_{S})\phi_{*}f^{*}K_{S} \sim_{\mathbb{Q}} a(Y,-f^{*}K_{S})\phi_{*}f^{*}\psi^{*}K_{S'} \end{equation*} we see that $K_{Y'} \sim_{\mathbb{Q}} a(Y,-f^{*}K_{S})f'^{*}K_{S'}$. Theorem \ref{theo:largeainvsurfaces} shows that there are three types of adjoint rigid surfaces with $a$-invariant larger than $1$. We argue separately for each case: \begin{itemize} \item Case 1: $a(Y,-f^{*}K_{S}) = 3$. Theorem \ref{theo:largeainvsurfaces} shows that there is a birational morphism $g: Y' \to \mathbb{P}^{2}$ such that $-f'^{*}K_{S'} \sim g^{*}H$ where $H$ is the hyperplane class on $\mathbb{P}^{2}$. As explained above this divisor is also proportional to $K_{Y'}$. Thus the only possibility is that $g$ is an isomorphism, $Y' \cong \mathbb{P}^{2}$, and $-f'^{*}K_{S'} \sim H$. Then $\deg(f') \cdot (-K_{S'})^{2} = (-f'^{*}K_{S'})^{2} = 1$ so that $f'$ is birational, a contradiction. \item Case 2: $a(Y,-f^{*}K_{S}) = 2$. Theorem \ref{theo:largeainvsurfaces} shows that there is a birational morphism $g: Y' \to T$ where $T \cong \mathbb{P}^{1} \times \mathbb{P}^{1}$ or the quadric cone $Q$ such that $-f'^{*}K_{S'} \sim g^{*}H$ where $H$ is the restriction of the hyperplane class on $\mathbb{P}^{3}$. As explained above this divisor is also proportional to $K_{Y'}$. Thus we must have either $Y' \cong \mathbb{P}^{1} \times \mathbb{P}^{1}$ or $\mathbb{F}_{2}$ and $-2f'^{*}K_{S'} \sim K_{Y'}$. When $Y'$ is $\mathbb F_2$, we replace $Y'$ by the quadric cone $Q$. We see that $\deg(f') \cdot (-K_{S'})^{2} = (-f'^{*}K_{S'})^{2} = 2$. The only possibility is that $f'$ has degree $2$ and that $S'$ is a singular degree $1$ weak del Pezzo. In particular, our ground field must have characteristic $2$. Suppose for a contradiction that $Y = \mathbb{P}^{1} \times \mathbb{P}^{1}$. Then the calculation above shows that each family of lines on $Y$ maps to a one-dimensional family of rational curves on $S'$ of anticanonical degree $1$. Furthermore these two families cannot coincide (since their numerical classes on $S'$ are different). But by Lemma \ref{lemm:lines} it is only possible for $S$ to carry one such family, showing that such a map cannot exist. \item Case 3: $a(Y,-f^{*}K_{S}) = \frac{3}{2}$. Theorem \ref{theo:largeainvsurfaces} shows that there is a birational morphism $g: Y' \to \mathbb{P}^{2}$ such that $-f'^{*}K_{S'} \sim g^{*}2H$ where $H$ is the hyperplane class on $\mathbb{P}^{2}$. As explained above this divisor is also proportional to $K_{Y'}$. Thus the only possibility is that $g$ is an isomorphism, $Y' \cong \mathbb{P}^{2}$ and $-f'^{*}K_{S'} \sim 2H$. Then $\deg(f') \cdot (-K_{S'})^{2} = (-f'^{*}K_{S'})^{2} = 4$. Thus we see that $S'$ must be a singular weak del Pezzo surface of degree $2$ or $1$ with Picard rank $1$ and that $f'$ must be non-separable and must have degree $2$ or $4$ respectively. In particular, our ground field must have characteristic $2$. \end{itemize} \end{proof} Using our earlier classification of pathological del Pezzo surfaces, we can give an even more precise description of the possible dominant morphisms which increase the $a$-invariant. \begin{coro} \label{coro:typesandcases} Let $S$ be a weak del Pezzo surface and suppose that $f: Y \to S$ is a dominant generically finite morphism such that $a(Y,-f^{*}K_{S}) > a(S,-K_{S})$. \begin{enumerate} \item If we are in the setting of Theorem \ref{theo:dominantaclassificationsurfaces}.(1), then $S$ has Type 1. \item If we are in the setting of Theorem \ref{theo:dominantaclassificationsurfaces}.(2), then $S$ has Type 2. \item If we are in the setting of Theorem \ref{theo:dominantaclassificationsurfaces}.(3), then $S$ has Type 3. \item If we are in the setting of Theorem \ref{theo:dominantaclassificationsurfaces}.(4), then $S$ has Type 1 or Type 3. \end{enumerate} \end{coro} \begin{proof} Theorem \ref{theo:dominantaclassificationsurfaces} gives 4 possible situations. In Case 1 (respectively Case 2, Case 3) it follows from Claim \ref{clai:type1} (resp.~Claim \ref{clai:type2}, Claim \ref{clai:type3}) that $S$ has Type 1 (resp.~Type 2, Type 3). It only remains to consider Case 4. Let $S'$ denote the anticanonical model of $S$ and suppose there is a non-separable degree $4$ morphism $f: \mathbb{P}^{2} \to S'$ such that $f^{*}(-K_{S}) \cong \mathcal{O}(2)$. Then the image in $S'$ of the lines on $\mathbb{P}^{2}$ yields a $2$-dimensional family of $-K_{S}$-conics. We then conclude by Corollary \ref{coro:lowdegreeexpectdimanticanonical}. \end{proof} To finish off the classification, we make one final remark: \begin{prop} \label{prop:type3istype1} The Type 3 surfaces are exactly the same as the Type 1 surfaces in characteristic $2$. \end{prop} \begin{proof} As discussed earlier, a Type 3 surface has Type 1. Indeed, by definition a Type 3 surface $S$ has an anticanonical model $S'$ which admits a purely inseparable degree $2$ map $f: Q \to S'$ from the quadric cone. The images of the lines on $Q$ are $-K_{S}$-lines on $S'$, and we conclude that $S$ has Type 1 by Lemma \ref{lemm:lines}. Conversely, we show that every Type 1 surface in characteristic $2$ has Type 3. Let $S$ be a Type 1 surface in characteristic $2$, let $\phi: \widetilde{S} \to S$ be the blow-up of the basepoint of $|-K_{S}|$ with exceptional divisor $E$, and let $\pi: \widetilde{S} \to \mathbb{P}^{1}$ be the resolution of the rational map defined by $|-K_{S}|$. Consider the diagram \begin{equation*} \xymatrix{ Y \ar[d]_{p} \ar[r]^{g} & \widetilde{S} \ar[d]_{\pi} \\ \mathbb{P}^{1} \ar[r]^{F} & \mathbb{P}^{1} } \end{equation*} where $F$ denotes the Frobenius map and $Y$ is the normalization of $\widetilde{S} \times_{\mathbb{P}^{1}} \mathbb{P}^{1}$. Then $g$ is a purely inseparable degree $2$ morphism, $Y$ is smooth, and the general fiber of $p$ is isomorphic to $\mathbb{P}^{1}$. Set $D = g^{*}E$. Since $E$ is a section of $\pi$, $D$ is a section of $p$. Note that $D^{2} = g^{*}E^{2} = -2$ so that $D$ is a $(-2)$-curve on $Y$. Since the fibers of $p$ have intersection $-1$ against $f^{*}K_{S}$, we see that $a(Y,-f^{*}K_{S}) \geq 2$ where $f: Y \to S$ denote the composition of $g$ and the birational map to $S$. Theorem \ref{theo:dominantaclassificationsurfaces} then shows that the equality must be attained. Furthermore, note that $(K_{Y} - 2f^{*}K_{S}) \cdot D = 0$. We conclude that $K_{Y} - 2f^{*}K_{S}$ is adjoint rigid. Thus we must be in Case (3) of Theorem \ref{theo:dominantaclassificationsurfaces}. Corollary \ref{coro:typesandcases} shows that $S$ has Type $3$. \end{proof} \subsubsection{Breaking maps and rational curves} Finally let us remark that the existence of breaking maps implies the existence of families of rational curves with larger than the expected dimension. In other words, the compatibility we have found between dominant covers with larger $a$-invariant and the presence of families with too large dimension is not just a coincidence. \begin{prop} \label{prop:higherthanexpected} Let $X$ be a smooth weak Fano variety defined over $k$ and let $f : Y \to X$ be a breaking map from a smooth projective variety $Y$. Suppose that there is a component $M$ of $\overline{M}_{0,0}(Y)$ generically parameterizing a dominant family of rational curves $g : \mathbb{P}^{1} \to Y$ such that $\deg(g^*(K_{Y} - a(Y, -f^*K_X)f^*K_X)) = 0$. Then the family of rational curves on $X$ obtained by applying $f$ to the stable maps in $M$ has higher than expected dimension. \end{prop} \begin{proof} Since any component of $\overline{M}_{0,0}(Y)$ has at least the expected dimension, we have \[ \dim \, M \geq \deg(-g^*K_Y) + \dim \, Y -3. \] On the other hand since we have $$\deg(-g^{*} K_Y) = a(Y, -f^*K_X)\deg(-g^{*}f^*K_X)$$ and $a(Y, -f^*K_X) > 1$, we conclude that \[ \dim \, M > \deg(-g^*f^*K_X) + \dim \, X -3. \] \end{proof} Since for every breaking map $f: Y \to S$ in Theorem~\ref{theo:dominantaclassificationsurfaces} the surface $Y$ admits infinitely many families of free curves satisfying the assumption of Proposition~\ref{prop:higherthanexpected}, we see that each surface $S$ in the theorem admits infinitely many families of rational curves with higher than the expected dimension. \bibliographystyle{alpha}
\section{Introduction} The convex hull of a set of points in the plane is one of the most well studied objects in computational geometry. As the number points on the convex hull can be linear, for example when the points are in convex position, it is natural to seek the best simplification using only $k$ input points. To measure the quality of the subset we use one of the most common measures, namely the Hausdorff distance. Specifically, given a set $P$ of $n$ points in the plane, here we seek the subset of $Q\subseteq P$ of $k$ points which minimizes the Hausdorff distance between $\CH(Q)$ and $\CH(P)$, where $\CH(X)$ denotes the convex hull of $X$. This is equivalent to finding the subset $Q\subseteq P$ of $k$ points which minimizes $\eps=\max_{p\in P} ||p-\CH(Q)||$. We refer to this as the \emph{min-$\eps$} problem. We also consider the dual \emph{min-$k$} problem, where given a distance $\eps\geq 0$, we seek the minimum cardinality subset $Q\subseteq P$ such that $\max_{p\in P} ||p-\CH(Q)||\leq \eps$. We emphasize that our goal is to find the optimal subset $Q$ exactly. As discussed below, this is a far more demanding problem than allowing approximation in terms of $k$ or $\eps$. A number of related problems have been considered before, though they all differ in key ways. The three main differences concern the error measure of $Q$, whether $Q$ is restricted to be a subset from $P$, and whether a starting point is given. Varying any one of these aspects can significantly change the hardness of the problem. \myparagraph{Coresets.} In this paper, we require our chosen points to be a subset of $P$, which from a representation perspective is desirable as the chosen representatives are actual input data points. Such subset problems have thus been extensively studied, and are referred to as coresets (see \cite{handbook3}). Given a point set $P$, a coreset is subset of $P$ which approximately preserves some geometric property of the input. Thus here we seek a coreset for the Hausdorff distance. Among coreset problems, $\eps$-kernels for directional width are one of the most well studied. Define the directional width for a direction $u$ as $w(u,P) = \max_{p\in P} \langle u,p\rangle - \min_{p\in P} \langle u,p\rangle$. Then $Q\subseteq P$ is an $\eps$-kernel if for all $u$, $(1-\eps)w(u,P)\leq w(u,Q)$. It is known that for any point set $P\subset \Re^d$ there is an $\eps$-kernel of size $O(1/\eps^{(d-1)/2})$ \cite{ahv-aemp-04}. For worst case point sets $\Omega(1/\eps^{(d-1)/2})$ size is necessary, however, for certain inputs, significantly smaller coresets may be possible. (As an extreme example, if the points lie on a line, then the $k=2$ extreme points achieves $\eps=0$ error.) Thus \cite{bhr-sagps-19} considered computing coresets whose size is measured relative to the optimum for a given input point set. Specifically, if there exists an $\eps$-coreset for Hausdorff distance with $k$ points, then in polynomial time they give an $\eps$-coreset with $O(d k\log k)$ size, or alternatively an $(8\eps^{1/3}+\eps)$-coreset with $O(k/\eps^{2/3})$ size. Note that the standard strategy to compute $\eps$-kernels applies a linear transformation to make the point set fat, and then roughly speaking approximates the Hausdorff problem. Thus $\eps$-coresets for Hausdorff distance yield $O(\eps)$-kernels (where the constant relates to the John ellipsoid theorem). However, $\eps$-kernels do not directly give such coresets for Hausdorff distance, as it depends on the fatness of the point set, i.e.\ Hausdorff is arguably the harder problem. Most prior work on coresets gave approximate solutions. However, our focus is on exact solutions. Along these lines, a very recent PODS paper \cite{wmlt-mcmrmd-21} considered what they called the \emph{minimum $\eps$-corset} problem, where the goal is to exactly find the minimum sized $\eps$-coreset for a new error measure they introduced. Specifically, $Q\subseteq P$ is an $\eps$-coreset for maxima representation if for all directions $u$, $(1-\eps)\omega(u,P)\leq \omega(u,Q)$, where $\omega(u,X) = \max_{x\in X} \langle u,x\rangle $. While related to our Hausdorff measure, again like directional width, it differs in subtle ways. For example, observe their measure is not translation invariant. Moreover, they assume the input is $\alpha$-fat for some constant $\alpha$, while we do not. For their measure they give a cubic time algorithm in the plane, whereas our focus is on significantly subcubic time algorithms. In the current paper, we select $Q$ so as to minimize the maximum distance of a point in $P$ to $\CH(Q)$. \cite{krv-schc-20} instead considered the problem of selecting $Q$ so as to minimize the sum of the distances of points in $P$ to $\CH(Q)$. They provided near cubic (or higher) running time algorithms for certain generalized versions of this summed coreset variant. \myparagraph{Other related problems.} If one relaxes the problem to no longer require $Q$ to be a subset of $P$, then related problems have been studied before. Given two convex polygons $X$ and $Y$, where $X$ lies inside $Y$, \cite{abosy-fmcnp-89} provided a near linear time algorithm for the problem of finding the convex polygon $Z$ with the fewest number of vertices such that $X\subseteq Z\subseteq Y$. The problem of finding the best approximation under Hausdorff distance has also been considered before. Specifically, if $Q$ can be any subset from $\CH(P)$ (i.e.\ it is not a coreset), then \cite{ar-hacp-05} gave a near linear time algorithm for approximating the convex hull under Hausdorff distance, but under the key assumption that they are given a starting vertex which must be in $Q$. We emphasize that assuming a starting point is given makes a significant difference, and intuitively relates to the difference in hardness between single source shortest paths and all pairs shortest paths. A number of papers have considered simplifying polygonal chains. Computing the best global Hausdorff simplification is NP-hard \cite{klw-opshf-20,kklmw-gcs-19}. Most prior work instead considered local simplification, where points from the original chain are assigned to the edge of the simplification whose end points they lie between. In general such algorithms take at least quadratic time, with subquadratic algorithms known for certain special or approximate cases. For example, \cite{av-eaapc-00} gave an $O(n^{4/3+\delta})$ time algorithm, for any $\delta>0$, under the $L_1$ metric. Our problem relates to these works in that we must approximate the chain representing the convex hull. On the one hand, convexity gives us additional structure. However, unlike polygonal chain simplification, we do not have a well defined starting point (i.e.\ the convex hull is a closed chain), which as remarked above makes a significant difference in hardness. Our problem also relates to polygon approximation, for which prior work often instead considered approximation in relation to area. For example, given a convex polygon $P$, \cite{hklmu-matcpr-20} gave a near linear time algorithm for finding the three vertices of $P$ whose triangle has the maximum area. To illustrate one the many ways that area approximations differ, observe that the area of the triangle of the three given points of $P$ can be determined in constant time, whereas the computing the furthest point from $P$ to the triangle takes linear time. \myparagraph{Our results.} We give fast and exact algorithms for both the min-$k$ and min-$\eps$ problems for summarizing the convex hull in the plane. While a number of related problems have been considered before as discussed above, to the best of our knowledge we are the first to consider exact algorithms for this specific version of the problem. Our main results show that when the input set $P$ is in convex position then the min-$k$ problem can be solved exactly in $O(n\log^2 n)$ deterministic time, and the min-$\eps$ problem can be solved exactly in $O(n \log^3 n)$ time with high probability. Note that this version of the problem is equivalent to allowing the points in $P$ to be in arbitrary position, but requiring that the chosen subset $Q$ consist of vertices of the convex hull. (Which follows as the furthest point to $\CH(Q)$ is always a vertex of $\CH(P)$.) Thus this restriction is quite natural, as we are then using vertices of the convex hull to approximate the convex hull, i.e.\ furthering the coreset motivation. For the general case when $P$ is arbitrary and $Q$ is any subset of $P$, we show that in near quadratic time these problems can be reduced to computing all pairs shortest paths in an unweighted directed graph. This yields an $O(n^{2.5302})$ time algorithm for the min-$k$ problem and an $O(\min\{n^{2.5302}, kn^{2.376}\})$ time algorithm for the min-$\eps$ problem, by utilizing previous results for APSP in unweighted directed graphs. Moreover, while exact algorithms are our focus, we show that our near linear time algorithms for points in convex position immediately yield 2-approximations for the general case with the same near linear running times. Also, appropriately using single source shortest paths rather than APSP in our graph based algorithms, gives $O(n^2\log n)$ time solutions which use at most one additional point. \section{Preliminaries} Given a point set $X$ in $\Re^2$, let $\CH(X)$ denote its convex hull. For two points $x,y \in \Re^2$, let $\overline{xy}$ denote their line segment, that is $\overline{xy}=\CH(\{x,y\})$. Throughout, given points $x,y\in \Re^2$, $||x-y||$ denotes their Euclidean distance. Given two compact sets $X,Y\subset \Re^2$, $\distX{X}{Y} = \min_{x\in X, y\in Y} ||x-y||$ denotes their distance. For a single point $x$ we write $\distX{x}{Y} = \distX{\{x\}}{Y}$. For any two finite point set $Q,P\subset \Re^2$ we define \[ cost(Q,P) = \max_{p \in P} ||p-\CH(Q)|| \] Note that for $Q\subseteq P$, we have that $\CH(Q)\subseteq \CH(P)$, and moreover the furthest point in $\CH(P)$ from $\CH(Q)$ is always a point in $P$. Thus the $cost(Q,P)$ is equivalent to the Hausdorff distance between $\CH(Q)$ and $\CH(P)$. In this paper we consider the following two related problems, where for simplicity, we assume that $P$ is in general position. \begin{problem}[min-$k$]\problab{mink} Given a set $P \subset \Re^2$ of $n$ points, and a value $\eps>0$, find the smallest integer $k$ such that there exists a subset $Q\subseteq P$ where $|Q|\leq k$ and $cost(Q,P)\leq \eps$. \end{problem} \begin{problem}[min-$\eps$]\problab{mineps} Given a set $P \subset \Re^2$ of $n$ points, and an integer $k$, find the smallest value $\eps$ such that there exists subset $Q\subseteq P$ where $|Q|\leq k$ and $cost(Q,P)\leq \eps$. \end{problem} For simplicity the above problems are phrased in terms of finding the value of either $k$ or $\eps$, though we remark that our algorithms for these problems also immediately imply the set $Q$ realizing the value can be determined in the same time. Thus in the following when we refer to a solution to these problems, we interchangeably mean either the value or the set realizing the value. In the following section we restrict the point set $P$ to lie in convex position, thus for simplicity we define the following convex versions of the above problems. \begin{problem}[cx-min-$k$]\problab{cxmink} Given a set $P \subset \Re^2$ of $n$ points in convex position, and a value $\eps>0$, find the smallest integer $k$ such that there exists a subset $Q\subseteq P$ where $|Q|\leq k$ and $cost(Q,P)\leq \eps$. \end{problem} \begin{problem}[cx-min-$\eps$]\problab{cxmineps} Given a set $P \subset \Re^2$ of $n$ points in convex position, and an integer $k$, find the smallest value $\eps$ such that there exists subset $Q\subseteq P$ where $|Q|\leq k$ and $cost(Q,P)\leq \eps$. \end{problem} \section{Convex Position}\seclab{convexpos} In this section we give near linear time algorithms for the case when $P$ is in convex position, that is for \probref{cxmink} and \probref{cxmineps}. First, we need several structural lemmas and definitions. \subsection{Structural Properties and Definitions} \begin{figure}[t] \centering \includegraphics[scale=.55]{figs/hull2} \caption{An example of the defined objects from \lemref{helper}.} \figlab{segments} \end{figure} \begin{lemma}\lemlab{helper} Let $P$ be a set of $n$ points in convex position. Consider any subset $Q \subset P$, and let $a,b$ be consecutive in the clockwise ordering of $Q$. Then for any point $x\in P$ which falls between $a$ and $b$ in the clockwise ordering of $P$, we have $||x-\CH(Q)|| = ||x-\overline{ab}||$. \end{lemma} \begin{proof} Let $x$ be any point between $a$ and $b$ in the clockwise ordering of $P$, and let $l$ denote the line through $a$ and $b$. Since $a$ and $b$ are consecutive in the clockwise order of $Q$, $\CH(Q)$ lies entirely in the closed halfspace defined by $\ell$ and on the opposite side of $\ell$ as $x$. So if $z$ denotes the closest point to $x$ in $\CH(Q)$, then the segment $\overline{xz}$ must intersect $\ell$. Consider the lines $l_a$ and $l_b$ which are perpendicular to $l$ and go through $a$ and $b$ respectively. If $x$ lies between $l_a$ and $l_b$, then its projection onto $\ell$ lies on the segment $\overline{ab}$, and hence this is in fact its projection onto $\CH(Q)$, and the claim holds. Otherwise, suppose that $x$ and $a$ are in opposite halfplanes defined by the line $l_b$, see \figref{segments}. (A similar argument will hold when $x$ and $b$ are in opposite halfplanes defined by the line $l_a$.) Observe, that the closest point in $\ell_b\cap \CH(Q)$ to $x$ is the point $b$, since $x$ is in the opposite halfspace defined by $\ell$ as $\CH(Q)$, and $\ell_b$ is orthogonal to $\ell$. Thus if the shortest path to $z$ intersects $\ell_b$, then it would imply $z=b$, and so again the claim holds. So suppose $z$ and $x$ are on the same side of $\ell_b$. Since $\overline{xz}$ intersects $\ell$, $z$ must lie on the opposite side of $\ell$ as $x$. Since $z\in \CH(Q)$, this implies there is a point $y\in Q$ which like $z$ is on the same side of $\ell_b$ as $x$ but on the opposite side of $\ell$ as $x$ (since there is no point of $Q$ on the same side of $\ell$ as $x$). Thus similarly, the segment $\overline{xy}$ intersects $\ell$, and let $y'$ denote this intersection point. Since $x$ and $y$ are on the same side of $\ell_b$, which is opposite the side of $a$, this implies $b$ lies on the segment $\overline{ay'}$. As $y'$ lies on the segment $\overline{xy}$, this in turn implies that $b$ lies in the triangle $\Delta(ayx)$. This is a contradiction, since $a,y,x,b\in P$, and so $b$ lying in $\Delta(azx)$ implies $P$ is not in convex position. \end{proof} Assume that the points in $P=\{p_1,\ldots, p_n\}$ are indexed in clockwise order. We now wish to prove a lemma about the optimal cost solution when restricted to points between some index pair $i,j$. As we wish our definition to work regardless of whether $i\leq j$ or $j\leq i$, we define the following notation. For a triple of indices $i,x,j$, we write $i\preceq x \preceq j$ to denote that $p_x$ falls between $p_i$ and $p_j$ in the clockwise ordering. More precisely, if $i\leq j$ then this means $i\leq x\leq j$, and if $j\leq i$ then this means that $j\leq x \leq n$ or $1\leq x\leq i$. \begin{definition}\deflab{costg} For any integer $0\leq k\leq n-2$ we define \[ cost_k(i,j) = \min_{i\preceq l_1\preceq \ldots \preceq l_k \preceq j} ~~\max_{i \preceq v \preceq j} ||p_v-\CH(p_i, p_{l_1}, \ldots, p_{l_k}, p_j)||. \] \end{definition} That is, $cost_k(i,j)$ is the minimum cost solution when restricted to including $p_i$, $p_j$, and $k$ other vertices in clockwise order between $p_i$ and $p_j$, and where we only evaluate the cost with respect to points in clockwise order between $p_i$ and $p_j$. According to the above definition, we have that $cost_0(i,j)=\max_{i \preceq v \preceq j} ||p_v-\CH(p_i, p_j)|| = \max_{i \preceq v \preceq j} ||p_v-\overline{p_ip_j}||$. Observe that the following is implied by \lemref{helper}. \begin{corollary}\corlab{decompose} Let $Q=\{p_{l_1},\ldots,p_{l_k}\}\subseteq P$ be indexed in clockwise order, and let $l_{k+1}=l_1$. Then, \[ cost(Q,P) = \max_{p \in P} ||p-\CH(Q)|| =\max_{1\leq i\leq k}~~ \max_{l_i\preceq j\preceq l_{i+1}} ||p_j-\overline{p_{l_i}p_{l_{i+1}}}|| =\max_{1\leq i\leq k} cost_0(l_i,l_{i+1}). \] \end{corollary} For more general values of $k$, the following lemma will be used to argue we can use a greedy algorithm. \begin{lemma}\lemlab{ranges} For any indices $i'\preceq i\preceq j \preceq j'$, it holds that $cost_k(i,j) \leq cost_k(i', j')$. \end{lemma} \begin{proof} Let $p_{i'}, p_{l_1}, \ldots p_{l_k}, p_{j'}$ be the clockwise chain of vertices that realizes $cost_k(i', j')$. That is, $cost_k(i', j')=max_{i' \preceq v \preceq j'} ||p_v-\CH(p_{i'}, p_{l_1}, \ldots p_{l_k}, p_{j'})||$. Observe that if we add points to this chain then we can only decrease the cost. Specifically, we consider adding the points $p_i$ and $p_j$. So let $p_{l_x},\ldots, p_{l_y}$ be the subchain of $p_{l_1}, \ldots p_{l_k}$ consisting of all $i\preceq l_i\preceq j$. Then we have, \begin{align*} cost_k(i', j') &=max_{i' \preceq v \preceq j'} ||p_v-\CH(p_{i'}, p_{l_1}, \ldots, p_{l_k}, p_{j'})||\\ &\geq max_{i' \preceq v \preceq j'} ||p_v-\CH(p_{i'}, p_{l_1},\ldots, p_i, p_x, \ldots, p_y, p_j, \ldots, p_{l_k}, p_{j'})||\\ &\geq max_{i \preceq v \preceq j} ||p_v-\CH(p_{i'}, p_{l_1},\ldots, p_i, p_x, \ldots, p_y, p_j, \ldots, p_{l_k}, p_{j'})||\\ &\geq max_{i \preceq v \preceq j} ||p_v-\CH(p_i, p_x, \ldots, p_y, p_j)|| \geq cost_k(i,j). \end{align*} The second to last inequality holds by \lemref{helper}. The last inequality holds as the chain $p_x, \ldots, p_y$ has at most $k$ points (since it was a subchain of $p_{l_1},\ldots, p_{l_k}$) and $cost_k(i,j)$ is defined by the minimum cost such chain between $i$ and $j$. \end{proof} We now define the notions of friends and greedy sequences, which we use in the next section to design our greedy algorithm. \begin{definition}\deflab{friends} For an index $i$ and value $\eps\geq 0$, define the $\eps$-friend of $i$, denoted $f_\eps(i)$, as the index $j$ of the vertex furthest from $p_i$ in the clockwise ordering of $P$, such that $cost_0(i,j)\leq \eps$. \end{definition} Note that $f_\eps(i)$ is always well defined. In particular, $cost_0(i,i+1)=0$ for any $i$. Moreover, if the ball of radius $\eps$ centered at $p_i$ contains $P$ then $f_\eps(i)=i$, and the point $p_i$ by itself is an optimal solution to \probref{cxmink}. Note that we can easily determine if such a point exists in $O(n\log n)$ time by computing the farthest Voronoi diagram of $P$ \footnote{ The farthest Voronoi diagram of $P$ partitions the plane into regions sharing the same farthest point in $P$. It allows one to find the farthest point in $P$ from a query in logarithmic time. See for example \cite{grt-hdcg-04}. } and then querying all points in $P$. For simplicity we will assume $f_\eps(i)\neq i$, which can thus be assured by such a preprocessing step. \begin{definition}\deflab{greedyseq} Let $Q=\{p_{l_1},p_{l_2},\ldots,p_{l_k}\}$ be any subset of $P$, which we assume has been indexed such that $l_1<l_2<\ldots<l_k$. We call $Q$ a \emph{greedy sequence} if for all $1\leq i< k$, we have $f_\eps(l_i)=l_{i+1}$, and $f_\eps(l_k)<l_k$. We call a greedy sequence \emph{valid} if $f_\eps(l_k)\geq l_1$. \end{definition} Note that in the above definition, the condition that $f_\eps(l_k)<l_k$ ensures that the $\eps$-friend of $p_{l_k}$ goes past the vertex $p_n$, i.e.\ this ensure that the sequence is a maximal sequence without wrapping around. Note also there always exists a valid greedy sequence. Specifically, we trivially have that for any greedy sequence $f_\eps(l_k)\geq 1$. Thus the greedy sequence starting at $p_1$ is valid as in that case $l_1 = 1$. \begin{observation}\obslab{greedyvalid} Let $Q=\{p_{l_1},p_{l_2},\ldots,p_{l_k}\}$ be a valid greedy sequence. Then since $Q$ is a greedy sequence $cost_0(l_i,l_{i+1})\leq \eps$ for all $1\leq i< k$. Furthermore, $cost_0(l_k,l_{1})\leq cost_0(l_k,f_\eps(l_k))\leq \eps$ by \lemref{ranges} and since $Q$ is valid. Thus by \corref{decompose}, $cost(Q,P)\leq \eps$. \end{observation} \begin{lemma}\lemlab{greedyopt} Let $P,\eps$ be an instance \probref{cxmink}. Any valid greedy sequence of minimum possible cardinality is an optimal solution to the given instance. \end{lemma} \begin{proof} Let $Q=\{p_{l_1},p_{l_2},\ldots,p_{l_{k}}\}$ be an optimal solution to \probref{cxmink}, indexed such that $1 \leq l_1 < l_2 < \ldots < l_{k}$. Thus $cost(Q,P)\leq \eps$ and so by \corref{decompose}, $\max_{1\leq i\leq k} cost_0(l_i,l_{i+1}) \allowbreak \leq \eps$, where $l_{k+1}=l_1$. Thus if $Q$ is a greedy sequence then it is a valid greedy sequence, and the claim holds. So suppose $Q$ is not a greedy sequence. Now we show that $Q$ can be converted to a valid greedy sequence with the same cardinality. Let $j>1$ be the first index such that $l_j \neq f_\eps(l_{j-1})$. Let $w_j= f_\eps(l_{j-1})$ and let $\{w_{j+1}, w_{j+2}, \ldots, w_{k}\}$ be the indices which realize $cost_{k-j}(w_j, l_1)$ according to \defref{costg}. Then we modify $Q$ by replacing the suffix $\{p_{l_j},p_{l_{j+1}}, \ldots, p_{l_{k}}\}$ with $\{p_{w_j},p_{w_{j+1}}, \ldots, p_{w_{k}}\}$. Notice that the cost of $Q$ after this modification is still $\leq \eps$ because $cost_0(l_{j-1}, w_j) \leq \eps$ as $w_j= f_\eps(l_{j-1})$, and by \lemref{ranges} we have $cost_{k-j}(w_j,l_1) \leq cost_{k-j}(l_j,l_1)$. Now repeat this procedure until $h = f_\eps(l_{j-1})$ goes beyond index $n$. Let the resulting new optimal solution be denoted $Q'$. If $h \geq l_1$, then $Q'$ is a valid greedy sequence by our construction, and we are done. So if the sequence failed to be a valid greedy sequence, then $1 \leq h < l_1$. Thus we can repeat the whole procedure, relabeling vertices of $Q'$ such that $l_1=h$. This means that each time we repeat this procedure we either produce a valid greedy sequence or we decrease $l_1$. At some point $l_1=1$, at which time the procedure must produce a valid greedy sequence as in this case $h\geq 1=l_1$. The above argues that some valid greedy sequence of minimum cardinality is optimal. Note this implies all valid greedy sequences of minimum cardinality are optimal, since they all have the same size, and by \obsref{greedyvalid} their cost is $\leq \eps$. \end{proof} \subsection{The min-$k$ Algorithm} In this section we give an efficient algorithm for \probref{cxmink}. The idea is to use the $f_\eps(i)$ values to define a graph. Specifically, the \emph{friend graph} $G_f$ is the directed graph with vertex set $P$ where there is an edge from $p_i$ to $p_j$ if and only if $f_\eps(i)=j$ and $i<j$. Thus every vertex in $G_f$ has outdegree at most $1$. Moreover, $G_f$ is acyclic since we only created edges from lower index vertices to higher index ones. These two properties together imply that $G_f$ is a forest, where each sink vertex defines the root of a tree. Thus every vertex in $G_f$ has a well defined depth, where sink vertices have depth one. Let $Q=\{p_{l_1},p_{l_2},\ldots,p_{l_k}\}$ be a greedy sequence, as defined in \defref{greedyseq}. Then observe that for all $1\leq i<k$, $p_{l_i}p_{l_{i+1}}$ is an edge of $G_f$, and hence $Q$ corresponds to a path in $G_f$. Moreover, the condition that $f_\eps(l_k)<l_k$ in \defref{greedyseq} implies that $p_{l_k}$ is a sink vertex in $G_f$, and hence $Q$ corresponds to a path in $G_f$ from the vertex $p_{l_1}$ to the root of its corresponding tree. Conversely, for the same reasons if we are given a path $p_{l_1},p_{l_2},\ldots,p_{l_k}$ in $G_f$ where $p_{l_k}$ is a sink, then this path is a greedy sequence. That is, the set of paths ending in sinks in $G_f$ and the set of greedy sequences are in one-to-one correspondence. Thus given all the $f_\eps(i)$ values have been precomputed, this suggests a simple linear time algorithm to compute a valid greedy sequence $Q$ with the fewest number of points, which by \lemref{greedyopt} is an optimal solution to the given instance of \probref{cxmink}. Specifically, find all pairs $(p_i,p_r)$ where $p_i\in P$ and $p_r$ is the root of the tree in $G_f$ which contains $p_i$. By the above discussion, each such pair $(p_i,p_r)$ corresponds to a greedy sequence, and all greedy sequences are represented by some pair. We now restrict to pairs that are valid according to \defref{greedyseq}, that is pairs where $f_\eps(r)\geq i$. For each such pair, the length of the corresponding sequence is simply the depth of $p_i$ in the tree rooted at $p_r$. Thus we return as our solution the depth of $p_i$ from the valid pair $(p_i,p_r)$ where $p_i$ has minimum depth. All the $(p_i,p_r)$ pairs and the depths can be determined in $O(n)$ time by topologically sorting since $G_f$ is a forest. Determining the valid pairs, and the minimum depth valid pair can then be done with a simple linear scan. We thus have the following. \begin{lemma}\lemlab{lineartime} Assume that $f_\eps(i)$ for all $1\leq i\leq n$ has been precomputed. Then \probref{cxmink} can be solved in $O(n)$ time. \end{lemma} The question now then is how quickly can we compute all of the $f_\eps(i)$ values. To that end, we first argue that with some precomputation the $cost_0(i,j)$ values can be queried efficiently. To do so, we make use a result from \cite{dmsw-fpqgcc-06} which builds a datastructure for a geometric query they call Farthest Vertex in a Halfplane, which we rephrase below using our notation. \begin{lemma}[\cite{dmsw-fpqgcc-06}]\lemlab{cited} Let $P\subset \Re^2$ be a point set in convex position. $P$ can be preprocessed in $O(n\log n)$ time such that given a query $(q,l_q)$, where $q$ is a point and $l_q$ is a directed line through $q$, in $O(\log^2 n)$ time one can return the farthest point from $q$ among the points in $P$ to the left of $l_q$. \end{lemma} \begin{lemma}\lemlab{precompConv} Let $P=\{p_1,\ldots, p_n\} \subset \mathbb{R}^2$ be a point set in convex position, labeled in clockwise order. With $O(n \log n)$ precomputation time, for any query index pair $(i,j)$, $cost_0(i,j)$ can be computed in $O(\log^2 n)$ time. \end{lemma} \begin{proof} Let $\ell=\ell(p_i,p_j)$ be the line through $p_i$ and $p_j$, which we view as being oriented in the direction from $p_i$ towards $p_j$. Also, let $r_i$ and $r_j$ denote the rays originating at $p_i$ and $p_j$ respectively, pointing in the direction orthogonal to $\ell$ and on the left side side of $\ell$. Finally, let $P_{i,j} = \{p_k\in P \mid i\prec k\prec j\}$, and thus $cost_0(i,j) = \max_{x\in {P_{i,j}}} ||x-\overline{p_i,p_j}||$. Observe that the projection of any point $x\in P_{i,j}$ onto $\ell$ either lies on the portion of $\ell$ before $p_i$, on the line segment $\overline{p_ip_j}$, or on the portion of $\ell$ after $p_j$. Thus we have a natural partition of $P_{i,j}$ into three sets, the subset in the right angle cone $C_i$ bounded by $\ell$ and $r_i$, those in the slab $Slab(i,j)$ bounded by $\ell$, $r_i$, and $r_j$, and those in the right angle cone $C_j$ bounded by $\ell$ and $r_j$. Observe that for any point $x$ in $C_i$ or $C_j$, its closest point on $\overline{p_ip_j}$ is $p_i$ or $p_j$, respectively, and moreover $||x-\ell||\leq ||x-\overline{p_ip_j}||$. Thus we have that, \begin{align*} cost_0(i,j) &= \max_{x\in {P_{i,j}}} ||x-\overline{p_i,p_j}||\\ &= \max\{\max_{x\in C_i\cap P_{i,j}} ||x-p_i||, \max_{x\in C_j\cap P_{i,j}} ||x-p_j||, \max_{x\in Slab(i,j)\cap P_{i,j}} ||x-\overline{p_ip_j}||\}\\ &= \max\{\max_{x\in C_i\cap P_{i,j}} ||x-p_i||, \max_{x\in C_j\cap P_{i,j}} ||x-p_j||, \max_{x\in P_{i,j}} ||x-\ell||\}. \end{align*} Therefore, it suffices to describe how to compute each of the three terms in the stated time. Computing $\max_{x\in P_{i,j}} ||x-\ell||$ is straightforward as the points in $P_{i,j}$ are in convex position and in particular if we consider them in their clockwise order, then their distance to $\ell$ is a concave function. So assume that $P$ is given in an array sorted in clockwise order. (If not, we can compute such an array with $O(n\log n)$ preprocessing time by computing the convex hull.) Then given a query pair $(i,j)$, in $O(\log n)$ time we can binary search over $P_{i,j}$ to find $\max_{x\in P_{i,j}} ||x-\ell||$, since $P_{i,j}$ is a subarray of $P$. (Note if $j<i$ then technically $P_{i,j}$ is two subarrays.) Now consider the subset in the right angle cone $C_i$ (a similar argument will hold for $C_j$). Let $C_i'$ be the cone $C_i$ but reflected over the line $\ell$. Suppose that both $C_i$ and $C_i'$ contained points from $P$, call them $p$ and $p'$, respectively. Then observe that the triangle $\Delta(p,p',p_j)$ would contain the point $p_i$, which is a contradiction as $P$ was in convex position. Thus either $C_i\cap P =\emptyset$ or $C_i'\cap P=\emptyset$. So let $L$ be the line orthogonal to $\ell$, passing through $p_i$, and oriented so that $C_i$ and $C_i'$ lie to the left (i.e.\ $L$ is the line supporting the ray $r_i$ from above). By \lemref{cited}, we can preprocess $P$ in $O(n\log n)$ time, such that in $O(\log^2 n)$ time we can compute the point in $P$ furthest from $p_i$ and to the left of $L$. If the returned point lies in $C_i'$ then we know $C_i\cap P=\emptyset$ and so $\max_{x\in C_i\cap P_{i,j}} ||x-p_i||=0$. If the returned point lies in $C_i$ then it realizes $\max_{x\in C_i\cap P_{i,j}} ||x-p_i||$. \end{proof} \begin{theorem}\thmlab{minkfinal} \probref{cxmink} can be solved in $O(n\log^2 n)$ time. \end{theorem} \begin{proof} By \lemref{lineartime}, given the $f_\eps$ values have been computed, \probref{cxmink} can be solved in $O(n)$ time. Thus to prove the theorem it suffices to compute $f_\eps(i)$ for all $i$ in $O(n\log^2 n)$ time. Recall that $f_\eps(i)$ is the index $z$ of the vertex furthest from $p_i$ in the clockwise ordering of $P$, such that $cost_0(i,z)\leq \eps$. First observe that as we increase $i$, $f_\eps(i)$ moves clockwise. More precisely, by \lemref{ranges}, $\eps \geq cost_0(i,f_\eps(i)) \geq cost_0(i+1,f_\eps(i)) \geq cost_0(i+1,j)$, for any $i+1 \leq j \leq f_\eps(i)$, and thus $i\preceq f_{\eps}(i) \preceq f_\eps(i+1)$. Moreover, again by \lemref{ranges}, the indices $j$ such that $cost_0(i,j)\leq \eps$ are consecutive in the clockwise ordering of $P$. This suggests a simple strategy to compute the $f_\eps(i)$ values. Namely, to find $f_\eps(1)$, we compute all values $cost(1,j)$, starting with $j=3$ and increasing $j$ until we find a value $j'$ such that $cost_0(1,j')>\eps$. This implies $f_\eps(1)=j'-1$, since as mentioned above the values such that $cost_0(1,j)\leq \eps$ are consecutive. More generally, to compute $f_\eps(i+1)$, we compute all values $cost_0(i+1,j)$, starting with $j=f_\eps(i)+1$ and increasing $j$ until we find a value $j'$ such that $cost_0(i+1,j')>\eps$, which again by the above implies $f_\eps(i+1)=j'-1$. The total time is clearly bounded by the time it takes to compute all the queried $cost_0$ values. Observe that when the algorithm queries a value $cost_0(i,j)$ then the previous $cost_0$ query was either to $cost_0(i-1,j)$ or $cost_0(i,j-1)$, implying that in total we compute $O(n)$ $cost_0$ values. By \lemref{precompConv}, with $O(n\log n)$ precomputation, any $cost_0$ value can be computed in $O(\log^2 n)$ time. Thus the total time is $O(n\log^2 n)$. \end{proof} \subsection{The min-$\eps$ Algorithm} In this section we design an efficient algorithm for \probref{cxmineps}, where $k$ is given and our goal is to minimize $\eps$. To do so, we will use our algorithm from the previous section for \probref{cxmink}, where $\eps$ was fixed and we were minimizing $k$. Specifically, throughout this section, given an instance $P,k$ of \probref{cxmineps}, we use $Decider(\eps)$ to denote the procedure which runs the algorithm of \thmref{minkfinal} on the instance $P,\eps$ of \probref{cxmink} and returns True if the solution found uses $\leq k$ points, and returns False otherwise. Let $\mathcal{E}=\{cost_0(i,j)\mid 1\leq i,j\leq n\}$. We call $\mathcal{E}$ the set of \emph{critical values}, where observe that by \corref{decompose}, the optimal solution to the given instance of \probref{cxmineps} is a critical value in the set $\mathcal{E}$. Thus a natural approach would be to explicitly compute, sort, and then binary search over $\mathcal{E}$ using $Decider(\eps)$. However, such an approach would require at least quadratic time as $|\mathcal{E}|=\Theta(n^2)$. We now argue that by using random sampling we can achieve near linear running time with high probability. Similar sampling strategies have been used before, and in particular we employ a strategy which was used in \cite{hr-fdre-14} for computing the Frechet distance. We first observe that one can efficiently sample values from $\mathcal{E}$. \begin{lemma}\lemlab{sample} With $O(n\log n)$ precomputation time, one can sample a value uniformly at random from $\mathcal{E}$ in $O(\log^2 n)$ time. \end{lemma} \begin{proof} To sample a pair from $1\leq i,j\leq n$ uniformly at random, we first sample an integer uniformly at random from $[1,n]$ for $i$, and then sample an integer uniformly at random from $[1,n-1]$ for $j$ (where $j$ is indexed from the set with $i$ removed). This takes $O(1)$ time given the standard assumption that sampling a random integer in a given range takes $O(1)$ time. (Even if it took $O(\log n)$ time it would not affect the overall time.) Now to sample a value uniformly at random from $\mathcal{E}$ we just need to compute $cost_0(i,j)$. From \lemref{precompConv} this can be done in $O(\log^2 n)$ time with $O(n \log n)$ precomputation time. \end{proof} Before presenting our algorithm, we require the following subroutine. \begin{lemma}\lemlab{extract} Given an interval $[\alpha,\beta]$, then the set $X=[\alpha,\beta]\cap \mathcal{E}$ can be computed in $O((n\log n+|X|)\log^2 n)$ time. Let $Extract(\alpha,\beta)$ denote this procedure. \end{lemma} \begin{proof} Fix an index $i$. By \lemref{ranges} we know that $cost_0(i,j)$ increases monotonically as we move $p_j$ clockwise. Thus $S_i=\{j\mid cost_0(i,j)\in [\alpha,\beta]\}$ is a contiguous set of indices, and moreover, we can binary search for the smallest index in this set (i.e.\ the first index $j$ in clockwise order from $i$ such that $cost_0(i,j)\geq \alpha$). After finding this smallest such index, to output the rest of $S_i$ we just simply increment $j$ until $cost_0(i,j)>\beta$. Note that $X=\cup_i S_i$, and thus to find $X$ we then repeat this procedure for all $i$. Note that in each step of the algorithm we compute a $cost_0$ value, and thus the total time is bounded by the time is takes to compute all the queried $cost_0$ values. For all $n$ values of $i$ we perform a binary search, thus requiring $O(n\log n)$ $cost_0$ queries for all binary searches. For a given $i$, after the binary searching, we then perform $|S_i|$ $cost_0$ queries to determine the rest of the set $S_i$, and thus over all $i$ we perform $|X|=\sum_i |S_i|$ queries. By \lemref{precompConv} each $cost_0$ query takes $O(\log^2 n)$ time, with $O(n\log n)$ preprocessing, and so the total time is thus $O((n\log n+|X|)\log^2 n)$. \end{proof} We remark that it should be possible to improve the running time of the above algorithm to $O((n+|X|)\log^2 n)$ using the same approach as in the proof of \thmref{minkfinal}. However, ultimately this will not change the asymptotic running time of our overall algorithm. \begin{algorithm2e} \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} \Input{An instance $P,k$ of \probref{cxmineps}.} \Output{The value $\eps$ of the optimal solution.} \DontPrintSemicolon Perform the precomputation step from \lemref{precompConv}.\;\label{line:precomp} Sample a set $S$ of $4n$ values from $\mathcal{E}$.\;\label{line:sample} Sort $S$ and binary search using $Decider$. Let $[\alpha,\beta]$ be the resulting interval found where $Decider(\alpha)=False$ and $Decider(\beta)=True$.\;\label{line:interval} Let $X=Extract(\alpha,\beta)$.\;\label{line:extracted} Sort $X$ and binary search using $Decider$.\;\label{line:finalsearch} Return the smallest value $\eps\in X$ such that $Decider$ was $True$.\; \caption{Algorithm for solving \probref{cxmineps}.} \algolab{randomalg} \end{algorithm2e} Our algorithm for solving \probref{cxmineps} is shown in \algoref{randomalg}. The correctness of this algorithm is straightforward. By the discussion above the optimal value $\eps$ is in $\mathcal{E}$, and the correctness of $Decider$ follows from the previous section. Thus when we binary search over $S$ using $Decider$, we know that $\eps\in [\alpha,\beta]$. Thus, by \lemref{extract}, we know that $X=Extract(\alpha,\beta)$ contains $\eps$. Thus our final binary search over $X$ using $Decider$ is guaranteed to find $\eps$. The more challenging question is what is the running time of \algoref{randomalg}, for which we have the following helper lemma. \begin{lemma}\lemlab{whp} Let $X=Extract(\alpha,\beta)$ be the set computed on line \ref{line:extracted} in \algoref{randomalg}. Then for any $c\geq 1$, we have that $Pr[|X|> c n\ln n]<1/n^c$. \end{lemma} \begin{proof} Let $\eps$ be the optimal value to the given instance of \probref{cxmineps}. We first argue that with high probability there are at most $(c/2) n\ln n$ values from $\mathcal{E}$ that are contained in $[\alpha,\beta]$ (i.e.\ in the set $X$) that are also larger than $\eps$. Let $Z$ be the $(c/2) n\ln n$ values in $\mathcal{E}$ closest to $\eps$ but also greater than $\eps$. (Note that if there are less than $(c/2) n\ln n$ values greater than $\eps$, then the claim trivially holds.) Observe that if our random sample $S$ on line \ref{line:sample} contains even a single value from $Z$ then the claim holds as this value then upper bounds $\beta$, and so there are at most $|Z|=(c/2) n\ln n$ values from $\mathcal{E}$ in $(\eps,\beta]$. The probability that the $4n$ sized random sample of values from $\mathcal{E}$ does not contain any element from $Z$ is at most \[ (1-|Z|/|\mathcal{E}|)^{4n} \leq (1-((c/2) n\ln n) / n^2)^{4n} = (1-(c\ln n)/2n)^{4n} \leq e^{-2c\ln n} = 1/n^{2c}< 1/2n^c, \] where we used the standard inequality $1+x\leq e^x$ for any value $x$. Note that a symmetric argument yields the same probability bound for the event that there are more than $(c/2)n\log n$ values from $\mathcal{E}$ contained in $[\alpha,\beta]$ that are smaller than $\eps$. Thus by the union bound, the probability that $|X|$ has more than $cn\ln n$ values is less than $1/n^c$. \end{proof} \begin{theorem}\thmlab{minepsfinal} \algoref{randomalg} solves \probref{cxmineps} in $O(cn\log^3 n)$ time with probability $\geq 1-1/n^c$, for any $c\geq 1$. \end{theorem} \begin{proof} The straightforward correctness of the algorithm has already been discussed above. As for the running time, the precomputation on line \ref{line:precomp} takes $O(n\log n)$ time by \lemref{precompConv}. By \lemref{sample}, it then takes $O(n\log^2 n)$ time to sample the $4n$ values in the set $S$. Sorting $S$ takes $O(n\log n)$ time, and binary searching using $Decider$ takes $O((\log n)\cdot n\log^2 n) = O(n\log^3 n)$ time by \thmref{minkfinal}. By \lemref{extract}, running $Extract(\alpha,\beta)$ on line \ref{line:extracted} to compute $X$ takes $O((n\log n+|X|)\log^2 n)$ time. Finally, sorting and binary searching over $X$ using Decider on line \ref{line:finalsearch} takes $O((n\log^2 n)(\log |X|)+|X|\log |X|)= O((n\log n+|X|)\log^2 n)$, again by \thmref{minkfinal}. Thus in total the time is $O((n\log n+|X|)\log^2 n + n\log^3 n)$. By \lemref{whp}, with probability at least $1-1/n^c$ we have $|X|\leq c n\ln n$, and thus with probability at least $1-1/n^c$ the total running time is $O(c n\log^3 n)$. \end{proof} \begin{remark} Even in the extremely unlikely event that the algorithm exceeds the $O(n\log^3 n)$ time bound, the worst case running time is only $O(n^2\log^2 n)$. \end{remark} \section{The General Case}\seclab{gencase} In this section, we remove the restriction that $P$ lies in convex position, showing that \probref{mink} and \probref{mineps} can be solved efficiently by converting them into a corresponding graph problem. For any pair of points $a,b\in \Re^2$, define $h_l(a,b)$ to be the closed halfspace bounded by the line going through points $a$ and $b$, picking the halfspace that is to the left of the directed edge $(a,b)$. Throughout we use $P_{a,b} = P \cap h_l(a,b)$ to denote the subset of $P$ falling in $h_l(a,b)$. We construct a weighted and fully connected directed graph $G_P=(V,E)$ where $V=P$. For an ordered pair of points $(a,b)$ in $P$, the weight of its corresponding directed edge is defined as $w(a,b) = cost(\{a,b\},P_{a,b})$, i.e.\ the distance of the furthest point in $P_{a,b}$ from the segment $\overline{ab}$. (Relating to the previous section, when $P$ is in convex position $w(a,b)=cost_0(a,b)$.) For a cycle of vertices $C=\{p_1,\ldots,p_k\}$, let $w(C)$ denote the maximum of the weights of the directed edges around the cycle. Throughout, we only consider non-trivial cycles, that is cycles must have at least two vertices. The following lemma shows how to compute edge weights. We remark that the first half of its proof is nearly identical to that for \lemref{precompConv}, however, the second half differs. \begin{lemma}\lemlab{precompgeneral} Let $P$ be a set of $n$ points in $\Re^2$. Then one can compute $w(a,b)$ for all pairs $a,b\in P$ simultaneously in $O(n^2\log n)$ time. \end{lemma} \begin{proof} Let $\ell$ denote the line through $a$ and $b$, which we view as being oriented in the direction from $a$ towards $b$. Also, let $r_a$ and $r_b$ denote the rays originating at $a$ and $b$ respectively, pointing in the direction orthogonal to $\ell$ and on the side of $\ell$ containing $P_{a,b}$. Observe that the projection of any point $x\in P_{a,b}$ onto $\ell$ either lies on the portion of $\ell$ before $a$, on the line segment $\overline{ab}$, or on the portion of $\ell$ after $b$. Thus we have a natural partition of $P_{a,b}$ into three sets, the subset in the right angle cone $C_a$ bounded by $\ell$ and $r_a$, those in the slab $Slab(a,b)$ bounded by $\ell$, $r_a$, and $r_b$, and those in the right angle cone $C_b$ bounded by $\ell$ and $r_b$. Observe that for any point $x$ in $C_a$ or $C_b$, its closest point on $\overline{ab}$ is $a$ or $b$, respectively, and moreover $||x-\ell||\leq ||x-\overline{ab}||$. Thus we have that, \begin{align*} w(a,b) &= \max\{\max_{x\in C_a\cap P_{a,b}} ||x-a||, \max_{x\in C_b\cap P_{a,b}} ||x-b||, \max_{x\in Slab(a,b)\cap P_{a,b}} ||x-\overline{ab}||\}\\ &= \max\{\max_{x\in C_a\cap P_{a,b}} ||x-a||, \max_{x\in C_b\cap P_{a,b}} ||x-b||, \max_{x\in P_{a,b}} ||x-\ell||\}. \end{align*} Therefore, it suffices to describe how to compute each of the three terms in the stated time. To compute $\max_{x\in P_{a,b}} ||x-\ell||$ we use the standard fact that for any point set $P$ and line $\ell$, the furthest point in $P$ from $\ell$, on either side of $\ell$, is a vertex of $\CH(P)$. Thus the furthest point in $P_{a,b}$ from $\ell$ is a point of $\CH(P)$. So precompute $\CH(P)$, using any standard $O(n\log n)$ time algorithm, after which we can assume the vertices of $\CH(P)$ are stored in an array sorted in clockwise order. Observe that the subset of the vertices of $\CH(P)$ which are in $P_{a,b}$ is a subarray (or technically two subarrays if it wraps around). So we can determine the ends of this subarray by binary searching. The distances of the points in this subarray to $\ell$ is a concave function, and so we can binary search to find $\max_{x\in P_{a,b}} ||x-\ell||$. These two binary searches take $O(\log n)$ time per pair $a,b$, and thus $O(n^2 \log n)$ time in total. To compute the $\max_{x\in C_a\cap P_{a,b}} ||x-a||$ values, we do the following (the $b$ values are computed identically). Consider a right angle cone whose origin is at $a$. We conceptually rotate this cone around $a$ while maintaining the furthest point of $P$ from $a$ in this cone. The furthest point only changes when a point enters or leaves the cone, and these events can thus easily be obtained by simply angularly sorting the points in $P$ around $a$. (Note each point corresponds to two events, an entering one, and a leaving one at the entering angle minus $\pi/2$.) To efficiently update the furthest point, we maintain a binary max heap on the distances of the points in the current cone to $a$. Building the initial max heap and sorting takes $O(n\log n)$ time. Thus all possible right angle cone values at $a$ can be computed in $O(n\log n)$ time, as there are a linear number of events and each event takes $O(\log n)$ time. Moreover, if we store these canonical right angle cone values in sorted angular order, then given a query right angle cone determined by a pair $a,b\in P$ (with cone origin $a$), the nearest canonical cone can be determined by binary searching. Thus in total computing all $\max_{x\in C_a\cap P_{a,b}} ||x-a||$ values for all pairs $a$ and $b$ takes $O(n^2 \log n)$ time. Namely, the precomputation of the canonical cones at each point takes $O(n\log n)$ time per point and thus $O(n^2\log n)$ time for all points. Then for the $O(n^2)$ pairs $a,b$ it takes $O(\log n)$ time to search for its canonical cone. \end{proof} For a set of points $Q$, let $\CH_L(Q)$ denote the clockwise list of vertices on the boundary of $\CH(Q)$. Observe that any subset $Q\subseteq P$ corresponds to the cycle $\CH_L(Q)$ in $G_P$. Moreover, any cycle $C$ corresponds to the convex hull $\CH(C)$. The following lemma is adapted from \cite{krv-schc-20}, where \probref{mink} was considered but where the $cost$ function was determined by a sum of the distances rather than the maximum distance. \begin{lemma}\lemlab{bounded} Consider an instance $P,\eps$ of \probref{mink}. The following holds: \begin{enumerate}[1)] \item For any cycle $C$ in $G_P$, $w(C)\geq cost(C,P) $, \item There exists some optimal solution $Q$ such that $w(\CH_L(Q))=cost(Q,P)$. \end{enumerate} \end{lemma} \begin{proof} Recall that $cost(C,P)=\max_{p \in P} \distX{p}{\CH(C)}$. Similarly decomposing $w(C)$ gives, \begin{align*} w(C) = \max_{(a,b)\in C} cost(\{a,b\},P_{a,b}) = \max_{p\in P}\max_{\substack{(a,b)\in C\\ \text{s.t. } p\in P_{a,b}}}\!\!\!\! \distX{p}{\overline{ab}}. \end{align*} To prove the first part of the lemma, we argue that for any point $p\in P$, its contribution to $w(C)$ is at least as large as its contribution to $cost(C,P)$. Assume $p\notin \CH(C)$, since otherwise it does not contribute to $cost(C,P)$. It suffices to argue there exists an edge $(a,b) \in C$, such that $p \in P_{a,b}$, since $||p-\overline{ab}|| \geq ||p-\CH(C)||$. So assume otherwise that there is some point $p \in P$ such that $p$ lies strictly to the right of all edges in $C$. Create a line $\ell$ that passes through $p$ and any interior point of any edge $(a,b) \in C$, but does not pass through any other point in $P$. The line $\ell$ splits the plane into two halfspaces. Observe that since $C$ is a cycle, there must be some edge $(c,d)$ of $C$ which also crosses $\ell$, where $c$ is in the same halfspace as $b$ and $d$ in the same halfspace as $a$ (i.e.\ they have opposite orientations with respect to $\ell$). Thus if $(c,d)$ crosses $\ell$ on the same side of $p$ along $\ell$ as the edge $(a,b)$ then $p$ would lie to the left of $(c,d)$, as it lies to the right of $(a,b)$. On the other hand, if the intersection of $(c,d)$ with $\ell$ lied on the opposite side of $p$ along $\ell$ as the intersection point of $(a,b)$ with $\ell$, then $p\in \CH(\{a,b,c,d\})\subseteq \CH(C)$. Thus either way we have a contradiction. To prove the second part of the lemma, let $Q$ be some optimal solution. For any $p\in P$, if $p\in \CH(Q)$ then it lies to the right of all edges in $\CH_L(Q)$, and so it does not affect $w(\CH_L(Q))$ or $cost(Q,P)$. So consider a point $p \notin \CH(Q)$. Let $\overline{ab}$ be the closest edge of $\CH(Q)$ (where $b$ follows $a$ in clockwise order). Note that $||p-\CH(Q)|| = ||p-\overline{ab}||$ and $p\in P_{a,b}$, so if $p$ lies to right of all other edges in $\CH_L(Q)$, then its contribution to $w(\CH_L(Q))$ is $||p-\overline{ab}||$. So suppose $p$ lies to the left of some other edge $\overline{cd}$ (note it may be that $b=c$). If this happens, then $p$ is in the intersection of the halfspace to the left of the line from $a$ through $b$ and to the left of the line from $c$ through $d$. This implies that $b,c\in \CH(\{a,d,p\})$. So let $Q'=Q\cup\{p\}\setminus\{b,c\}$. Observe that $\CH(Q)\subset \CH(Q')$ and $|Q'| \leq |Q|$, and hence $Q'$ is an optimal solution as $Q$ was an optimal solution. Now we repeat this procedure while there remains such a point $p$ to the left of two edges. We repeat this procedure only finitely many times as in each iteration the convex hull becomes larger (i.e.\ $\CH(Q)$ is a strict subset of $\CH(Q')$). If $Q$ denotes the hull after the final iteration, then by the above we have $w(\CH_L(Q))=cost(Q,P)$. \end{proof} \begin{corollary}\corlab{minkgraph} Let $P,\eps$ be an instance of \probref{mink}, and let $C^*$ be the cycle with minimum cardinalty among cycles in $G_P$ with $w(C) \leq \eps$. Then $C^*$ is an optimal solution to the given instance of \probref{mink}. \end{corollary} \begin{proof} Using part 1) of \lemref{bounded} we know that $cost(C^*,P) \leq w(C^*) \leq \eps$, so $C^*$ is a solution. Suppose that $C^*$ is not an optimal solution (i.e.\ it is not of minimum cardinality). Then by part 2) of \lemref{bounded}, there exists some optimal solution $Q$ with $|Q| < |C^*|$ such that $w(\CH_L(Q))=cost(Q,P) \leq \eps$. So, there exists a cycle $\CH_L(Q)$ with cost $\leq \eps$ and size less than $|C^*|$, which is a contradiction as $C^*$ had minimal cardinality among such cycles. \end{proof} In the following we will reduce our problem to the all pairs shortest path problem on directed unweighted graphs, which we denote as APSP. Let $A(n)$ be the time required to solve APSP. In \cite{z-apspbsrmm-02} it is shown that $A(n)=\tilde{O}(n^{2+\mu})$,% \footnote{We use the standard convention that $\tilde{O}(f(n))$ denotes $O(f(n)\log^c n)$ for some $c>0$.} where $\mu$ satisfies the equation $\omega(1,\mu,1)=1+2\mu$, and where $\omega(1,\mu,1)$ is the exponent of multiplication of a matrix of size $n \times n^\mu$ by a matrix of size $n^\mu \times n$. \cite{l-farmm-12} shows that $\mu<0.5302$ and thus $A(n)=O(n^{2.5302})$. \begin{theorem}\thmlab{minkgen} Any instance $P,\eps$ of \probref{mink} can be solved in time \[O(A(n)+n^2 \log n) = O(n^{2.5302}).\] \end{theorem} \begin{proof} By \corref{minkgraph}, in order to solve \probref{mink}, we just need to find a minimum length cycle with weight at most $\eps$ in the graph $G_P$ defined above. By definition a cycle has weight $\leq \eps$ if and only if all of its edge weights are $\leq \eps$. So let $G_P^\eps$ be the unweighted and directed graph obtained from $G_P$ by removing all edges with weight $>\eps$. Thus the solution to our problem corresponds to the minimum length cycle in this unweighted graph $G_P^\eps$. This can be solved by computing APSP in $G_P^\eps$. Specifically, the solution is determined by the ordered pair $(a,b)$ with the shortest path subject to the directed edge $(b,a)$ existing in $G_P^\eps$ (i.e.\ it is the shortest path that can be completed into a cycle). Computing all of the edge weights in $G_P$ can be done in $O(n^2 \log n)$ time by \lemref{precompgeneral}. Converting $G_P$ into $G_P^\eps$ then takes $O(n^2)$ time. Given the APSP distances, finding the minimum length cycle takes $O(n^2)$ time by scanning all pairs to check for an edge. APSP on directed unweighted graphs can be solved in $A(n)=O(n^{2.5032})$ time as described above. So, the total time is $O(A(n)+n^2 \log n) = O(n^{2.5302})$. \end{proof} Let $A_k(n)$ denote the time it takes to solve APSP on directed unweighted graphs where path lengths are bounded by $k$ (i.e.\ the path length is infinite if there is no $k$ length path). \cite{agm-eapsp-97} showed that $A_k(n) = O(n^{\omega}k \log^2 k)$, where $\omega$ is the exponent of (square) matrix multiplication. \cite{cw-mmap-90} showed that $\omega < 2.376$. \begin{theorem}\thmlab{minepsgen} Any instance $P,k$ of \probref{mineps} can be solved in time \[O(\min\{A(n),A_k(n)\}(\log n) +n^2 \log n) = O(\min\{n^{2.5302}, kn^{2.376}\}).\] \end{theorem} \begin{proof} The idea is to binary search using \thmref{minkgen}. Namely, the optimal solution to the instance $P,k$ of \probref{mineps} has cost $\leq \eps$ if and only the optimal solution to the instance $P,\eps$ of \probref{mink} uses $\leq k$ points. Moreover, the weight of any cycle in $G_P$ is determined by the weight of some edge, and thus by the above discussion the optimal solution to the given instance of \probref{mineps} will be the weight of some edge. There are $O(n^2)$ edge weights, which we can enumerate, sort, and binary search over using \thmref{minkgen}. Computing all of the edge weights in $G_P$ and sorting them can be done in $O(n^2 \log n)$ time by \lemref{precompgeneral}. Thus by \thmref{minkgen}, the total time is $O(A(n)(\log n) +n^2 \log n) = O(n^{2.5302})$ (Note we only compute all edge weights a single time, so each step of the binary search then costs $O(A(n))$ time.) Alternatively, since we know the value of $k$, we can get a potentially faster time for when $k$ is small, by only considering length at most $k$ paths. Specifically, in each call to our decision procedure (i.e.\ \thmref{minkgen}) instead of computing APSP, compute the APSP restricted to length $k$ paths. Then, by the discussion before the theorem, the running time becomes $O(A_k(n)(\log n) +n^2 \log n) = O((n^{\omega}k \log^2 k)(\log n) +n^2 \log n)) = O(kn^{2.376})$. \end{proof} \subsection{Faster Approximations} While our focus in the paper is on exact algorithms, in this section we show how the results above imply faster approximate solutions for the general case. First, we show that the results from \secref{convexpos} for points in convex position immediately yield near linear time $2$-approximations for the general case. More precisely, we have the following, where $V(\CH(P))$ denotes the vertices of the convex hull of $P$ (and recall $V(\CH(P))\subseteq P$). \begin{lemma} Let $P$ be a point set in the plane. Suppose there exists some subset $Q\subseteq P$ such that $cost(Q,P)\leq \eps$ and $|Q|\leq k$. Then there exists a subset $Q'\subseteq V(\CH(P))$ such that $cost(Q',P)\leq \eps$ and $|Q'|\leq 2k$. \end{lemma} \begin{proof} Let $Q=\{q_1,\ldots,q_k\}$, where the points are labeled in clockwise order. First, we convert $Q$ into a subset of points on the boundary of $\CH(P)$. Specifically, consider the segment $\overline{q_{i-1}q_{i}}$. Consider the ray with base point $q_{i-1}$, and passing through $q_{i}$, and let $z$ be the point of intersection of this ray with the boundary of $\CH(P)$. Let $Q_z=\{q_1,\ldots,q_{i-1}, z, q_{i+1},\ldots,q_k\}$, and observe that $\CH(Q)\subseteq \CH(Q_z)$ as $q_{i}$ lies on the segment $\overline{q_{i-1}z}$. Let $\overline{xy}$ be the edge of $\CH(P)$ which contains $z$, and let $Q_z'=\{q_1,\ldots,q_{i-1}, x,y, q_{i+1},\ldots,q_k\}$. (Note if $z\in V(\CH(P))$ then we set $Q_z'=Q_z$.) Since $z\in \overline{xy}$, we have that $\CH(Q)\subseteq \CH(Q_z)\subseteq \CH(Q_z')$. Thus $cost(Q_z',P)\leq \eps$ and $|Q_z'|\leq k+1$. So if we repeat this procedure for all $i$ then we will end up with a set $Q'$ such that $cost(Q',P)\leq \eps$, $|Q'|\leq 2k$, and $Q'\subseteq V(\CH(P))$. \end{proof} Given an instance $P,\eps$ of \probref{mink}, where the optimal solution $Q$ has size $k$, the above implies there is set $Q'\subseteq V(\CH(P))$ such that $cost(Q',P)\leq \eps$ and $|Q'|\leq 2k$. Such a set can be found using the algorithm of \thmref{minkfinal} for the instance $V(\CH(P)),\eps$ of \probref{cxmink}, as $Q'$ is a candidate solution for this instance. Also, recall for $X\subseteq P$, the furthest point in $P$ from $\CH(X)$ is always in $V(\CH(P))$, and so if $cost(X,V(\CH(P)))\leq \eps$ then $cost(X,P)\leq \eps$. Similarly, given an instance $P,k$ of \probref{mineps}, where the optimal solution $Q$ has cost $\eps$, the above implies there is set $Q'\subseteq V(\CH(P))$ such that $cost(Q',P)\leq \eps$ and $|Q'|\leq 2k$. Such a set can be found using the algorithm of \thmref{minepsfinal} for the instance $V(\CH(P)),2k$ of \probref{cxmineps}, again as $Q'$ is a candidate solution. Thus we have the following. \begin{theorem} Let $P,\eps$ be an instance of \probref{mink}, where the optimal solution $Q$ has size $k$. Then in $O(n\log^2 n)$ time one can compute a set $Q'\subseteq V(\CH(P))$ such that $cost(Q',P)\leq \eps$ and $|Q'|\leq 2k$. Similarly, let $P,k$ be an instance of \probref{mineps}, where the optimal solution $Q$ has cost $\eps$. Then with probability $\geq 1-1/n^c$, for any constant $c$, in $O(n\log^3 n)$ time one can compute a set $Q'\subseteq V(\CH(P))$ such that $cost(Q',P)\leq \eps$ and $|Q'|\leq 2k$. \end{theorem} Finally, we remark that if one allows approximating the best $k$ point solution with $k+1$ points (i.e.\ a $(1+1/k)$-approximation), then our graph algorithms from the previous subsection imply near quadratic time approximations (i.e.\ compared to the theorem above, we are trading near linear running time for approximation quality). The idea is, rather than solving APSP, if we chose an appropriate starting point, we can instead solve for single source shortest paths. Similar observations have been made before for related problems \cite{abosy-fmcnp-89,ar-hacp-05}. For a given instance $P,\eps$ of \probref{mink}, let $Q$ be an optimal solution where $|Q|=k$. Let $p$ be an arbitrary point in $V(\CH(P))$. Let $Q'=Q\cup\{p\}$. Observe that $cost(Q',P)\leq cost(Q,P)\leq \eps$ and $|Q'|\leq k+1$. Thus the optimal solution to this instance of \probref{mink}, but where we require it include $p$, is a valid solution to the instance without this requirement, and uses at most one more point. Now we sketch how the results from \secref{gencase} directly extend to the case where we want the optimal solution restricted to including $p$. Specifically, for the analogue of \corref{minkgraph}, let $C^*$ be the minimum cardinality cycle in $G_P$ with weight at most $\eps$ such that the cycle includes $p$. To argue that $C^*$ is an optimal solution to the given instance of \probref{mink} among those which must include the point $p$, we need to extend \lemref{bounded} to require including $p$. Part 1) of the lemma immediately extends. The proof of Part 2) starts with some optimal solution $Q$. It then performs a transformation of $Q$ into a set $Q'$ so that points are not to the left of two edges, which one can argue implies $w(\CH_L(Q'))=cost(Q',P)$. This transformation has the properties that $|Q'|\leq |Q|$ and $\CH(Q)\subseteq \CH(Q')$, and hence $cost(Q',P)\leq cost(Q,P)$, and so since $Q$ was optimal so is $Q'$. If instead we perform this same transformation on an optimal solution restricted to containing $p$, call it $X$, then the same argument implies we produce a set $X'$ such that $w(\CH_L(X'))=cost(X',P)$, $|X'|\leq |X|$, and $\CH(X)\subseteq \CH(X')$. Moreover, because $\CH(X)\subseteq \CH(X')$ and $p\in V(\CH(P))$, crucially we have $p\in \CH_L(X')$. Thus the modified \lemref{bounded} and hence \corref{minkgraph}, where $p$ is included, both hold. To find the optimal solution to \probref{mink} containing $p$, we now use the same approach as in \thmref{minkgen}. The difference now however, is that we only need to compute single source shortest paths in $G_P^\eps$ rather than APSP, since we can use $p$ as our starting point. Let $S(n)$ be the time to compute single source shortest paths. In an unweighted graph using BFS gives $S(n)=O(|E|+|V|) = O(n^2)$. Thus replacing $A(n)$ with $S(n)$ in the running time statement of \thmref{minkgen} gives $O(S(n)+n^2\log n) = O(n^2 \log n)$. Similarly, replacing $A(n)$ with $S(n)$ for \thmref{minepsgen} gives $O(S(n)\log n +n^2\log n) = O(n^2 \log n)$. Thus we have the following. \begin{theorem}\thmlab{kapprox} Let $P,\eps$ be an instance of \probref{mink}, with optimal solution $Q$. Then in $O(n^2\log n)$ time one can compute a set $Q'\subseteq P$ such that $cost(Q',P)\leq \eps$ and $|Q'|\leq |Q|+1$. Similarly, let $P,k$ be an instance of \probref{mineps}, where the optimal solution $Q$ has cost $\eps$. Then in $O(n^2\log n)$ time one can compute a set $Q'\subseteq P$ such that $cost(Q',P)\leq \eps$ and $|Q'|\leq |Q|+1$. \end{theorem} \bibliographystyle{plainurl}
\section{Introduction}\label{s:intro} This paper introduces an iterative scheme for solving a problem of image reconstruction, motivated by the classical behavior of primary visual cortex (V1), in the setting of group wavelet analysis. The mathematical formulation of the problem is that of the reconstruction of a function on the plane which, once represented as a function on the group $SE(2) = \R^2 \rtimes \Sone$ of rotations and translations of the Euclidean plane via the group wavelet transform, is known only on a certain two dimensional subset of this three dimensional group. This problem is equivalent to that of filling in missing information related to a large subset of the $SE(2)$ group, and ultimately inquires about the completenss of the image representation provided by feature maps observed in V1. One of the main motivations for the present study comes indeed from neuroscience, and the modeling of classical receptive fields of simple cells in terms of group actions, restricted to feature maps such as the orientation preference maps. The attempts of modeling mathematically the measured behavior of brain's primary visual cortex (V1) have led to the introduction of the linear-nonlinear-Poisson (LNP) model \cite{Carandini05}, which define what is sometimes called the classical behavior. It describes the activity of a neuron in response to a visual stimulus as a Poisson spiking process driven by a linear operation on the visual stimulus, modeled by the receptive field of the neuron, passed under a sigmoidal nonlinearity. A series of thorough studies of single cell behavior could find a rather accurate description of the receptive fields of a large amount of V1 cells, called simple cells, within the LNP model, in terms of integrals against Gabor functions located in a given position of the visual field \cite{Marcelja80, Ringach02}. This description formally reduces the variability in the classical behavior of these cells to a few parameters, regulating the position on the visual field, the size, the shape and the local orientation of a two dimensional modulated Gaussian. A slightly simplified description of a receptive field activity $F$ in response to a visual stimulus defined by a real function $f$ on the plane, representing light intensity, is the following: denoting by $x = \binom{x_1}{x_2}, y = \binom{y_1}{y_2} \in \R^2$, \begin{equation}\label{eq:receptive} F = s \sqrt{2 \pi} \int_{\R^2} f(y) e^{-2 \pi i p \big( (x_1 - y_1) \cos \theta + (x_2 - y_2) \sin\theta \big)} e^{-2\pi^2 s^2 |x - y|^2} dy \end{equation} where the parameters $s, p \in \R^+$ define the local scale and spatial frequency, the angle $\theta \in [0,2\pi)$ defines the local direction and $x \in \R^2$ define the local position of the receptive field in the visual field, while the complex formulation can be formally justified by the prevalence of so-called even and odd cells \cite{Ringach02}. We will focus on on the sole parameters $x,\theta$. This can be considered restrictive \cite{HubelWiesel62, SCP08, Barbieri15}, but it is nevertheless interesting since angles represent a relevant local feature detected by V1 \cite{HubelWiesel62} whose identification has given rise to effective geometrical models of perception \cite{PT99, CS06, CS15}. In this case one can model the linear part of the classical behavior of simple cells in terms of a well-known object in harmonic analysis: by rephrasing \eqref{eq:receptive} as $$ F = F(x,\theta) $$ for fixed values of $p,s$ we obtain a $SE(2)$ group wavelet transform of $f$ (see \S \ref{s:continuous}). On the other hand, classical experiments with optical imaging have shown that not all parameters $\theta \in \Sone$ are available for these cortical operations \cite{BonhofferGrinvald91, Welicky96, BoskingFitzpatrick97, White07}: in many mammals, a pinwheel-shaped function $\Theta : \R^2 \to \Sone$ determines the available angles. This feature map can be introduced in the model \eqref{eq:receptive} by saying that the receptive fields in V1 record the data \begin{equation}\label{eq:data} \{F(x,\Theta(x)) : x \in \R^2\}. \end{equation} Within this setting, a natural question is thus whether this data actually contains all the sufficient information to reconstruct the original image $f$, and how can we reobtain $f$ from these data. This is the main problem we aim to address. Before proceding, we recall that a severe limitation of the purely spatial model \eqref{eq:receptive} is that of disregarding temporal behaviors \cite{DeAngelis95, Cocci12}. Moreover, the classical behavior described by the LNP model is well-known to be effective only up to a limited extent: several other mechanisms are present that describe a substantial amount of the neural activity in V1, such as Carandini-Heeger normalization \cite{CarandiniHeeger12}, the so-called non-classical behaviors \cite{Fitzpatrick00, Carandini05}, as well as the neural connectivity \cite{Angelucci02}. However, spatial receptive fields and the LNP provide relevant insights on the functioning of V1 \cite{Ringach02}. Moreover, the ideas behind the LNP model have been a main source of inspiration in other disciplines, notably for the design of relevant mathematical and computational theories, such as wavelets and convolutional neural networks \cite{Marr, LeCun10}. We also point out that the use of groups and invariances to describe the variability of the neural activity has proved to be a solid idea to build effective models \cite{PetitotBook, CS06, PA14}, whose influence on the design of artificial learning architectures is still very strong \cite{AERP19, MBCSx, Anselmi20, Duits21}, Another motivation for studying the completeness of the data collected with \eqref{eq:data} comes from the relationship of this problem with that of sampling in reproducing kernel Hilbert spaces (RKHS). The RKHS structure in this case is that of the range the group wavelet transform, and will be discussed in detail, together with the basics on the $SE(2)$ wavelet transform, in \S \ref{s:continuous}. Reducing the number of parameters in a wavelet transform is a common operation, that one performs e.g. for discretization purposes \cite{Daubechies}, or because it is useful to achieve square-integrability \cite{AAG91}. The main issue is that these operations are typically constrained nontrivially in order to retain the sufficient information that allows one to distinguish all interesting signals. For example, when discretizing the short-time Fourier transform to obtain a discrete Gabor Transform, the well-known density theorem \cite{Heil07} imposes a minimum density of points in phase space where the values of the continuous transform must be known in order to retain injectivity for signals of finite energy. Much is known on this class of problems in the context of sampling, from classical Shannon's theorem and uncertainty-related signal recovery results \cite{DonohoStark89}, to general sampling results in RKHS \cite{FGHKR17, GRS18}. However, the kind of restriction implemented by feature maps does not seem to fit into these settings, even if some similarities may be found between the pinwheel-shaped orientation preference maps \cite{BonhofferGrinvald91} and Meyer's quasicrystals, which have been recently used for extending compressed sensing results \cite{CandesTao06, MateiMeyer2010, AACM19}. The plan of the paper is the following. In \S \ref{s:continuous}, after a brief overview of the $SE(2)$ transform and its RKHS structure, we will formalize in a precise way the problem of functional reconstruction after the restriction \eqref{eq:data} has been performed. In \S \ref{s:algorithm} we will introduce a technique to tackle with this problem, given by an iterative kernel method based on projecting the restricted $SE(2)$ wavelet transform onto the RKHS defined by the group representation. Moreover, we will consider a discretization of the problem and, in the setting of finite dimensional vector spaces, we will give a proof that the proposed iteration converges to the desired solution. Finally, in \S \ref{s:numerics} we will show and discuss numerical results on real images. \newpage \section{Overview of the $SE(2)$ transform}\label{s:continuous} The purpose of this section is to review the fundamental notions of harmonic analysis needed to provide a formal statement of the problem. We will focus on the group wavelet transform defined by the action on $L^2(\R^2)$ of the group of rotations and translation of the Euclidean plane, expressed as a convolutional integral transform. We will denote the Fourier transform of $f \in L^1(\R^2) \cap L^2(\R^2)$ by $$ \wh{f}(\xi) = \int_{\R^2} e^{-2\pi i x.\xi} f(x) dx $$ and, as customary, we will use the same notation for its extension by density to the whole $L^2(\R^2)$. We will also denote by $\ast$ the convolution on $\R^2$: $$ f \ast g (x) = \int_{\R^2} f(y) g(x - y) dy. $$ Let $\Sone$ be the abelian group of angles of the unit circle, which is isomorphic either to the one dimensional torus $\mathbb{T} = [0,2\pi)$ or to the group $SO(2)$ of rotations of the plane $\R^2$. The group $SE(2) = \R^2 \rtimes \Sone$ is the semidirect product group with elements $(x,\theta) \in \R^2 \times \Sone$ and composition law $$ (x,\theta) \cdot (x',\theta') = (x + r_\theta x', \theta + \theta'). $$ Its Haar measure, that is the (Radon) measure on the group that is invariant under group operations, is the Lebesgue measure on $\R^2 \rtimes \Sone$. A standard way to perform a wavelet analysis with respect to the $SE(2)$ group on two dimensional signals is given by the operator defined as follows. \begin{defi}\label{def:se2trans} Let us denote by $R : \Sone \to \U(L^2(\R^2))$ the unitary action by rotations of $\Sone$ on $L^2(\R^2)$: $$ R(\theta)f(x) = f(r_\theta^{-1}x) \, , \ f \in L^2(\R^2) \, , \ \theta \in \Sone \, , \ \textnormal{ where } r_\theta = \left(\begin{array}{cc} \cos\theta & -\sin\theta\\ \sin\theta & \cos\theta \end{array}\right). $$ Let $\psi \in L^2(\R^2)$, and denote by $\psi_\theta = R(\theta)\psi$. The $SE(2)$ wavelet transform on $L^2(\R^2)$ with mother wavelet $\psi$ is \begin{equation}\label{eq:W} W_\psi f (x,\theta) = f \ast \psi_\theta (x) \, , \ f \in L^2(\R^2). \end{equation} \end{defi} In terms of this definition, we can then see that if we choose $s, p \in \R^+$, and let $\psi_{s,p} \in L^2(\R^2)$ be \begin{equation}\label{eq:psi} \psi_{s,p}(x) = s \sqrt{2 \pi} e^{-2 \pi i p x_1} e^{-2\pi^2 s^2 |x|^2}, \end{equation} we can write \eqref{eq:receptive} as $F = W_{\psi_{s,p}} f (x, \theta)$. Moreover, by making use of the quasiregular representation of the $SE(2)$ group \begin{equation}\label{eq:quasiregular} \Pi(x,\theta) f(y) = f(r_\theta^{-1}(y - x)) \, , \ f \in L^2(\R^2) \end{equation} and denoting by $\psi^\dagger(x) = \ol{\psi(-x)}$, we can rewrite \eqref{eq:W} as follows: $$ W_\psi f(x,\theta) = \langle f, \Pi(x,\theta)\psi^\dagger \rangle_{L^2(\R^2)} $$ which is a standard form to write the so-called group wavelet transform (see e.g. \cite{Fuhr, DeitmarEchterhoff}). Note that, in the interesting case \eqref{eq:psi}, we have $\psi_{s,p}^\dagger = \psi_{s,p}$. The $SE(2)$ transform \eqref{eq:W}, together with the notion of group wavelet transform, has been studied in multiple contexts (see e.g. \cite{Weiss01, Antoine2D, Fuhr, Duits07, DeitmarEchterhoff, DDGL} and references therein), and several of its properties are well-known. In particular, if $W_\psi f$ is a bounded operator from $L^2(\R^2)$ to $L^2(\R^2 \times \Sone)$, which happens e.g. for $\psi \in L^1(\R^2) \cap L^2(\R^2)$ by Young's convolution inequality and the compactness of $\Sone$, it is easy to see that its adjoint reads \begin{equation}\label{eq:adjoint} W_\psi^* F (x) = \int_\Sone F(\cdot,\theta) \ast \psi_\theta^\dagger\, (x) \,d\theta. \end{equation} It is also well-known \cite{Weiss01} that $W_\psi f$ can not be injective on the whole $L^2(\R^2)$, that is, we can not retrieve an arbitrary element of $L^2(\R^2)$ by knowing its $SE(2)$ transform. However, as shown in \cite{Duits04, Duits07}, and applied successfully in a large subsequent series of works (e.g. \cite{Duits10, Duits16, Duits21}), it is possible to obtain a bounded invertible transform by extending the notion of $SE(2)$ transform to mother wavelets $\psi$ that do not belong to $L^2(\R^2)$, or by simplifying the problem and reduce the wavelet analysis to the space of bandlimited functions, that are those functions whose Fourier transform is supported on a bounded set, whenever a Calder\'on's admissibility condition holds. Since our main point in this paper is not the reconstruction of the whole $L^2(\R^2)$, we will consider the $SE(2)$ transform with this second, simplified, approach. In this case, the image of the $SE(2)$ transform is a reproducing kernel Hilbert subspace of $L^2(\R^2 \times \Sone)$ whose kernel will play an important role in the next section. For convenience, we formalize these statements with the next two theorems, and provide a sketch of the proof, even if they can be considered standard material. \begin{theo}\label{th:SE2inv} For $R > 0$, let $B_R = \{\xi \in \R^2 : |\xi| < R\}$ and let \begin{equation}\label{eq:PaleyWiener} \Hil_{R} = \{f \in L^2(\R^2) : \textnormal{supp} \wh{f} \subset B_R\}. \end{equation} The $SE(2)$ wavelet transform \eqref{eq:W} for a mother wavelet $\psi \in L^2(\R^2)$ is a bounded injective operator from $\Hil_{R}$ to $L^2(\R^2 \times \Sone)$ if and only if there exist two constants $0 < A \leq B < \infty$ such that \begin{equation}\label{eq:CalderonSE2} A \leq \int_{\Sone} |\wh{\psi}(r_\theta^{-1}\xi)|^2 d\theta \leq B \end{equation} holds for almost every $\xi \in B_R$. \end{theo} \begin{proof}[Sketch of the proof] By Fourier convolution theorem and the definition of $\Hil_R$, we have $$ \int_\Sone \int_{\R^2} |W_\Psi f(x,\theta)|^2 dx d\theta = \int_\Theta \int_{\R^2} |\wh{\psi_\theta}(\xi)|^2 |\wh{f}(\xi)|^2 d\xi d\theta = \int_{B_R} \left(\int_\Sone |\wh{\psi_\theta}(\xi)|^2 d\theta \right) |\wh{f}(\xi)|^2 d\xi. $$ Thus, by Plancherel's theorem, \eqref{eq:CalderonSE2} is equivalent to the so-called frame condition \begin{equation}\label{eq:frames} A \|f\|^2_{L^2(\R^2)} \leq \|W_\psi f\|^2_{L^2(\R^2 \times \Sone)} \leq B \|f\|^2_{L^2(\R^2)} \end{equation} for all $f \in \Hil_R$, which is equivalent (see e.g. \cite{AAG93}) to $W_\Psi$ being bounded and invertible on $\Hil_R$. \end{proof} \vspace{-2ex} Before stating the next result we repeat an observation of \cite{Weiss01} and show, using this theorem, that the $SE(2)$ transform can not be a bounded injective operator on the whole $L^2(\R^2)$. Indeed, using that $$ \wh{\psi_\theta}(\xi) = \int_{\R^2} e^{-2\pi i x.\xi} \psi(r_{\theta}^{-1}x) dx = \int_{\R^2} e^{-2\pi i x.(r_{\theta}^{-1}\xi)} \psi(x) dx = \wh{\psi}(r_{\theta}^{-1}\xi). $$ we can see that the Calder\'on's function in condition \eqref{eq:CalderonSE2} is actually a radial function \begin{equation}\label{eq:polarCalderonfunction} C_\psi(\xi) = \int_{\Sone} |\wh{\psi}(r_\theta^{-1}\xi)|^2 d\theta = \int_\Sone |\wh{\psi}(|\xi|\cos\varphi,|\xi|\sin\varphi)|^2 d\varphi = C_\psi(|\xi|) \end{equation} which, by Plancherel's theorem, satisfies $ \int_0^\infty C_\psi(\rho) \rho d\rho = \|\psi\|_{L^2(\R^2)}^2. $ Hence, the lower bound in condition \eqref{eq:CalderonSE2} can not be satisfied on the whole $\R^2$ by any $\psi \in L^2(\R^2)$. On the other hand, for the mother wavelet \eqref{eq:psi}, since $\displaystyle \wh{\psi}(\xi) = \frac{1}{s \sqrt{2 \pi}} e^{-|\xi + \binom{p}{0}|^2/2 s^2}$, we have $$ C_\psi(\xi) = \int_\Sone |\wh{\psi_\theta}(r_\theta^{-1}\xi)|^2 d\theta = \frac{1}{2 \pi s^2} \int_\Sone e^{-|\xi + \binom{p\cos\theta}{p\sin\theta}|^2/s^2} d\theta = \frac{e^{-\frac{|\xi|^2 + p^2}{s^2}}}{2 \pi s^2} \int_\Sone e^{-\frac{|\xi| p}{s^2}\cos\alpha} d\alpha. $$ From here we can see that $C_\psi(\xi) > 0$ for all $\xi \in \R^2$, so, even if $C_\psi(\xi) \to 0$ as $|\xi| \to \infty$, we have that the lower bound in \eqref{eq:CalderonSE2} is larger than zero for any finite $R$. The next theorem shows how to construct the inverse of the $SE(2)$ wavelet transform on bandlimited functions, and what is the structure of the closed subspace defined by its image. \begin{theo}\label{th:SE2proj} Let $\psi \in L^2(\R^2)$ and $R > 0$ be such that \eqref{eq:CalderonSE2} holds. Let also $\gamma \in L^2(\R^2)$ be defined by \begin{equation}\label{eq:gamma} \wh{\gamma}(\xi) = \frac{\chi_{B_R}(\xi)}{C_\psi(\xi)} \, \wh{\psi}(\xi) \end{equation} where $\displaystyle \chi_{B_R}(\xi) = \left\{\begin{array}{cl}1 & \xi \in B_R\\ 0 & \textnormal{otherwise} \end{array}\right.$, and let $\Hil_R$ be as in \eqref{eq:PaleyWiener}. Then \begin{itemize} \item[(i)] For all $f \in \Hil_R$ it holds $W_\gamma^* W_\psi f = f$. \item[(ii)] The space $W_\psi(\Hil_R)$ is a reproducing kernel Hilbert subspace of continuous functions of $L^2(\R^2 \times \Sone)$, and the orthogonal projection $\Proj$ of $L^2(\R^2 \times \Sone)$ onto $W_\psi(\Hil_R)$ is \begin{equation}\label{eq:RKHSproj} \Proj F (x,\theta) = W_\psi W_\gamma^* F (x,\theta) = \int_\Sone F(\cdot,\theta') \ast \psi_\theta \ast \gamma_{\theta'}^\dagger (x) \, d\theta' \ , \quad F \in L^2(\R^2 \times \Sone). \end{equation} \end{itemize} \end{theo} \begin{proof}[Sketch of the proof] Observe first that $\displaystyle \wh{\gamma_\theta^\dagger} = \ol{\wh{\gamma_\theta}} = \frac{\chi_{B_R}(\xi)}{C_\psi(\xi)} \ol{\wh{\psi_\theta}(\xi)}. $ Thus, recalling \eqref{eq:adjoint} and using Fourier convolution Theorem, we can compute $$ \wh{W_\gamma^*W_\psi f}(\xi) = \int_\Sone \wh{f}(\xi) \frac{\chi_{B_R}(\xi)}{C_\psi(\xi)} |\wh{\psi_\theta}(\xi)|^2 d\theta = \wh{W_\psi^*W_\gamma f}(\xi) = \wh{f}(\xi)\chi_{B_R}(\xi) $$ which proves (i). To prove (ii), one needs to show that the elements of $W_\psi(\Hil_R)$ are continuous functions, that $W_\psi(\Hil_R)$ $W_\psi W_\gamma^*$ is selfadjoint and idempotent, and that \eqref{eq:RKHSproj}. The continuity can be obtained as a consequence of the continuity of the unitary representation \eqref{eq:quasiregular} and, by the same arguments used to prove (i) we can easily see that $W_\gamma W_\psi^* = W_\psi W_\gamma^*$. On the other hand, (i) implies that $W_\psi W_\gamma^* W_\psi f = W_\psi f$ for all $f \in \Hil_R$, hence $W_\psi W_\gamma^* F = F$ for all $F \in W_\psi(\Hil_R)$. Equation \eqref{eq:RKHSproj} can be obtained directly by \eqref{eq:adjoint} and the definition of $W_\psi$. \end{proof} Since $W_\psi(\Hil_R)$ is a Hilbert space of continuous functions, it makes sense to consider its values on the zero measure set provided by the graph of a function $\Theta : \R^2 \to \Sone$, as in \eqref{eq:data}. We can then provide a formal statement of the problem discussed in \S \ref{s:intro}: \begin{equation}\label{eq:problem} \textnormal{for } f \in \Hil_R \textnormal{ and } \Theta : \R^2 \to \Sone \textnormal{, reconstruct } f \textnormal{ using only the values } W_\psi f (x,\Theta(x)). \end{equation} In order for this problem to be solvable, the graph $\mathscr{G}_\Theta = \{(x,\theta) \in \R^2 \times \Sone : \theta = \Theta(x)\}$ must be a set of uniqueness for $W_\psi(\Hil_R)$. That is, the following condition must hold: \begin{equation}\label{eq:uniqueness} \textnormal{if } F \in W_\psi(\Hil_R) \textnormal{ and } F|_{\mathscr{G}_\Theta} = 0 \textnormal{ , then } F = 0. \end{equation} Indeed, if this was not the case, for any nonzero $F \in W_\psi(\Hil_R)$ that vanishes on $\mathscr{G}_\Theta$, the function $f_F = W_\gamma^* (W_\psi f + F) \in \Hil_R$ would be different from $f$ but $W_\psi f_F$ would coincide with $W_\psi f$ on $\mathscr{G}_\Theta$. That is, we could not solve problem \eqref{eq:problem}. Condition \eqref{eq:uniqueness} is in general hard to be checked, and the formal characterization of the interplay between $\psi$ and $\Theta$ that make it hold true is out of the scopes of this paper. However, in the next section we will provide a technique for addressing \eqref{eq:problem} in a discrete setting, which will allow us to explore in \S \ref{s:numerics} the behavior of this problem for various functions $\Theta$ inspired by the feature maps measured in V1. \section{A reconstruction algorithm}\label{s:algorithm} In this section we describe the discretization of the problem \eqref{eq:problem} which is used in the next section. Then, we introduce a kernel based iterative algorithm, and prove its convergence to the solution whenever the solvability condition \eqref{eq:uniqueness} holds. \vspace{2ex} \subsection{Discretization of the problem} The setting described in \S \ref{s:continuous} can be discretized in a standard fashion by replacing $L^2(\R^2)$ with $\C^{N \times N}$, endowed with the usual Euclidean scalar product, circular convolution and discrete Fourier transform (FFT), which amounts to replacing $\R$ with $\Z_N$, the integers modulo $N$. Explicitly, given $f, \psi \in \C^{N \times N}$, $x = \binom{x_1}{x_2}, y = \binom{y_1}{y_2}, \xi = \binom{y_1}{\xi_2} \in \Z_N \times \Z_N$, we have $$ f \ast \psi (x) = \sum_{y_1 = 0}^{N-1} \sum_{y_2 = 0}^{N-1} f(y) g\big( (x - y) \!\!\!\!\!\mod N\big) \, , \textnormal{ and } \wh{f}(\xi) = \sum_{x_1 = 0}^{N-1} \sum_{x_2 = 0}^{N-1} e^{-2\pi i \frac{x_1\xi_1 + x_2\xi_2}{N}} f(x). $$ With a uniform discretization of angles, by replacing $\Sone$ with $\frac{2\pi}{M}\Z_M = \{0, \frac{2\pi}{M}, \frac{4\pi}{M}, \dots, 2\pi\frac{M-1}{M}\}$ we obtain the following discretization of the $SE(2)$ transform with the mother wavelet \eqref{eq:psi}: $$ W_\psi f(x,j) = f \ast \psi_{\theta_j} (x) \, , \textnormal{ where } \wh{\psi_{\theta_j}}(\xi) = e^{-\big|\xi + \binom{p\cos\theta_j}{p\sin\theta_j}\big|^2/2 s^2} $$ for $x, \xi \in \Z_N \times \Z_N$ and $\theta_j = \frac{2\pi}{M} j$, $j = 0,\dots,M$. Thus, in particular, $W_\psi f \in \C^{N \times N \times M}$. Note that here, for simplicity, we have removed the normalization used in \eqref{eq:psi}. This allows us to to process $N \times N$ digital images while retaining the results of Theorems \ref{th:SE2inv} and \ref{th:SE2proj} as statements on finite frames (see e.g. \cite{CasazzaKutyniok}) since Plancherel's theorem and Fourier convolution theorem still hold. In particular, when computing numerically the inverse of $W_\psi$ using (i), Theorem \ref{th:SE2proj}, one has to choose an $R > 0$ so that Calder\'on's condition \eqref{eq:CalderonSE2} for \begin{equation}\label{eq:CalderonDiscrete} C_\psi(\xi) = \sum_{j = 0}^{M - 1} e^{-\big|\xi + \binom{p\cos\theta_j}{p\sin\theta_j}\big|^2/2 s^2} \end{equation} holds with some $0 < A \leq B < \infty$ for all $\xi \in B_R = \{\xi \in \Z_N \times \Z_N : \xi_1^2 + \xi_2^2 < R^2 \}$. This is the injectivity condition on $\Hil_{R} = \{f \in \C^{N \times N} : \wh{f}(\xi) = 0 \, \forall \, \xi \notin B_R\}$ and, due to the finiteness of the space, now it can be achieved for all $R$, i.e. without bandlimiting. However, since this is equivalent to the frame inequalities \eqref{eq:frames}, the quantity $\sqrt{\frac{B}{A}}$ defines actually the condition number of $W_\psi $. Thus, in order to keep stability for the inversion, the ratio $\frac{B}{A}$ can not be arbitrarily large (see e.g. \cite{CasazzaKutyniok, Duits07}). Once the parameters $s,p,R$ are chosen in such a way that this ratio provides an acceptable numerical accuracy, one can then compute the projection $\Proj$ given by (ii), Theorem \ref{th:SE2proj}, on $F \in \C^{N \times N \times M}$, by making use of Fourier convolution theorem: \begin{equation}\label{eq:RKdiscrete} \wh{\Proj F} (\xi,j) = \frac{\chi_{B_R}(\xi)}{C_\psi(\xi)}\wh{\psi_{\theta_j}}(\xi) \sum_{\ell = 0}^{M - 1} \wh{F}(\xi,\ell) \ol{\wh{\psi_{\theta_\ell}}(\xi)}. \end{equation} We note at this point that this standard discretization, in general (for $M$ different from $2$ or $4$), retains all of the approach of \S \ref{s:continuous} but the overall semidirect group structure of $\R^2 \rtimes \Sone$. Let us now consider the discretization of the problem \eqref{eq:problem} and denote the graph of $\Theta : \Z_N \times \Z_N \to \Z_M$ by $\mathscr{G}_\Theta = \{(x,j) \in \Z_N \times \Z_N \times \Z_M : j = \Theta(x)\}$. If we denote by $\Opr$ the selection operator that sets to zero all the components of an $F \in \C^{N \times N \times M}$ that do not belong to $\mathscr{G}_\Theta$, that is $$ \Opr F(x,j) = \left\{ \begin{array}{cl} F(x,j) & (x,j) \in \mathscr{G}_\Theta\\ 0 & (x,j) \notin \mathscr{G}_\Theta \end{array} \right. $$ we can see that this is now an orthogonal projection of $\C^{N \times N \times M}$. Hence, problem \eqref{eq:problem} can be rewritten in the present discrete setting as follows: given $f \in \Hil_R$, find $F \in \C^{N \times N \times M}$ that solves the linear problem \begin{equation}\label{eq:SE2system} \left\{ \begin{array}{rl} \Proj F & = F\\ \Opr F & = \Opr W_\psi f. \end{array} \right. \end{equation} The meaning of \eqref{eq:SE2system} is indeed to recover $W_\psi f$ knowing only the values $W_\psi f (x,\Theta(x))$. We propose to look for such a solution using the following iteration in $\C^{N \times N \times M}$: for $F_0 = \Opr W_\psi f$, compute \begin{equation}\label{eq:iteration} F_n = \Proj F_{n - 1} - \Opr \Proj F_{n - 1} + F_0 \ , \quad n = 1, 2, \dots \end{equation} The idea behind this iteration is elementary: we start with the values of $W_\psi f$ selected by $\Theta$, we project them on the RKHS defined by the image of $W_\psi$, and we replace the values on $\mathscr{G}_\Theta$ of the result with the known values of $W_\psi f$. The convergence of this iteration is discussed in the next section. Before that, we observe that \eqref{eq:iteration} can be seen as a linearized version of the Wilson, Cowan and Ermentrout equation \cite{WC72, EC80} since, denoting by $K = (\mathbf{1} - \Opr)\Proj$, it is a discretization of $$ \frac{d}{dt} F_t = - F_t + K F_t + F_0. $$ Apart from the absence of a sigmoid, this is indeed a classical model of population dynamics. Here, the ``kernel'' $K$ is not just the reproducing kernel $\Proj$, but it also contains the projection on a feature map $\Opr$. Returning to the model of V1, here the forcing term $F_0$ is the data collected by simple cells, while the stationary solution $F$, if it exists, is the full group representation of the visual stimulus defined as solution to the Volterra-type equation $F = K F + F_0$.\vspace{2ex} \subsection{The project and replace iteration} We show here that, whenever the problem \eqref{eq:SE2system} is solvable, the iteration \eqref{eq:iteration} converges to its solution. Since the argument is general, we will consider in this subsection the setting of an arbitrary finite dimensional vector space $V$ endowed with a scalar product and the induced norm, and two arbitrary orthogonal projections $P, Q$. For an orthogonal projection $P$ we will denote by $P^\bot = \mathbf{1} - P$ the complementary orthogonal projection. We start with a basic observation, which is just a restatement of the solvability condition \eqref{eq:uniqueness} as that of a linear system defined by an orthogonal projection, in this case $Q$, on a subspace, in this case characterized as $\textnormal{Ran}(P)$. The simple proof is included for convenience. \begin{lem} Let $P, Q$ be orthogonal projections of a finite dimensional vector space $V$. The system \begin{equation}\label{eq:system} \left\{ \begin{array}{rl} P F & = F\\ Q F & = Q \wt{F} \end{array} \right. \end{equation} has a unique solution in $V$ for any $\wt{F} \in \textnormal{Ran}(P)$ if and only if \begin{equation}\label{eq:condition} \textnormal{Ker}(Q) \cap \textnormal{Ran}(P) = \{0\} . \end{equation} \end{lem} \begin{proof} The system \eqref{eq:system} is of course solved by $F = \wt{F}$, so we only need to prove that, for all $\wt{F} \in \textnormal{Ran}(P)$, this solution is unique if and only if \eqref{eq:condition} holds. In order to see this, let $S \in V$ be a solution to \eqref{eq:system}, and denote by $E = \wt{F} - S$. Then $E \in \textnormal{Ran}(P) \cap \textnormal{Ker}(Q)$. Hence, \eqref{eq:condition} holds if and only if $E = 0$, that is, the only solution to \eqref{eq:system} is $F = \wt{F}$. \end{proof} The problem posed by the system \eqref{eq:system} is a problem of linear algebra: if we know that a vector $F$ belongs to a given subspace $\textnormal{Ran}(P) \subset V$, and we know the projection of $F$ on a different subspace $\textnormal{Ran}(O) \subset V$, can we recover $F$? The next theorem shows that, if the system \eqref{eq:system} has a unique solution, such a solution can be obtained by the project and replace iteration \eqref{eq:iteration}. \begin{theo}\label{th:main} Let $V$ be finite dimensional vector space, and let $P, Q$ be orthogonal projections of $V$. Given $\wt{F} \in \textnormal{Ran}(P)$, set $F_0 = Q\wt{F}$, and let $\{F_n\}_{n \in \N}, \{H_n\}_{n \in \N} \subset V$ be the sequences defined by the project and replace iteration \begin{equation}\label{eq:PRiteration} \left\{ \begin{array}{rl} H_n & = P F_{n - 1}\vspace{4pt}\\ F_n & = Q^\bot H_n + F_0 \end{array} \right. \ , \quad n = 1, 2, \dots \end{equation} If condition \eqref{eq:condition} holds, then $$ \lim_{n \to \infty} H_n = \lim_{n \to \infty} F_n = \wt{F} $$ and the errors $\|\wt{F} - H_n\|$, $\|\wt{F} - F_n\|$ decay exponentially with the number of iterations $n$. \end{theo} \begin{proof} Denoting by $H_1 = P F_0$, we can rewrite the iteration \eqref{eq:PRiteration} as two separate iterations, generating the two sequences $\{F_n\}_{n \in \N}, \{H_n\}_{n \in \N}$ as follows: \begin{equation}\label{eq:series} \left\{ \begin{array}{ccccccl} H_{n+1} & = & P Q^\bot H_n + H_1 & = & \ldots & = & \displaystyle \sum_{k = 0}^n (P Q^\bot)^k H_1\vspace{4pt}\\ F_n & = & Q^\bot P F_{n - 1} + F_0 & = & \ldots & = & \displaystyle \sum_{k = 0}^n (Q^\bot P)^k F_0 . \end{array} \right. \end{equation} If \eqref{eq:condition} holds then $\|P Q^\bot\| < 1$ and $\|Q^\bot P\| < 1$, because $\textnormal{Ran}(\Proj) \cap \textnormal{Ran}(\Opr^\bot) = \textnormal{Ran}(\Proj) \cap \textnormal{Ker}(\Opr) = \{0\}$. Hence, the existence of the limits $H = \lim_{n \to \infty} H_n$ and $F = \lim_{n \to \infty} F_n$ is due to the convergence of the Neumann series (see e.g. \cite{RieszNagy}). Thus, getting rid of the notations $F_0 = Q \wt{F}$ and $H_1 = P F_0$, we have that the limits $H$ and $F$ are the solutions to the equations $$ \left\{ \begin{array}{rcl} (\mathbf{1} - P Q^\bot) H & = & P Q \wt{F} \vspace{4pt}\\ (\mathbf{1} - Q^\bot P) F & = & Q \wt{F}. \end{array} \right. $$ We can now see that $F = \wt{F}$, because this equation reads $$ (\mathbf{1} - Q^\bot P)^{-1} Q \wt{F} = \wt{F} $$ and, using that $\wt{F} \in \textnormal{Ran}(P)$, we can rewrite it as $$ Q \wt{F} = (\mathbf{1} - Q^\bot P) \wt{F} = \wt{F} - Q^\bot \wt{F} $$ which is true by definition of $Q^\bot = \mathbf{1} - Q$. Moreover, by taking the limit in the first equation of \eqref{eq:PRiteration}, and using again that $\wt{F} \in \textnormal{Ran}(P)$, we obtain $$ H = P F = P \wt{F} = \wt{F}. $$ Finally, the convergence of \eqref{eq:iteration} is exponential because, using the series expression \eqref{eq:series} for $\wt{F} = F$, \begin{align*} \|\wt{F} - F_n\| & = \| \sum_{k = 0}^\infty (Q^\bot P)^k F_0 - \sum_{k = 0}^n (Q^\bot P)^k F_0 \| = \| \sum_{k = n+1}^\infty (Q^\bot P)^k F_0\|\\ & = \| (Q^\bot P)^{n+1} \sum_{k = 0}^\infty (Q^\bot P)^k F_0\| = \| (Q^\bot P)^{n+1} F \| \leq \|Q^\bot P\|^{n+1} \|F\| \end{align*} and a similar argument applies to $\|\wt{F} - H_n\|$. \end{proof} \section{Numerical results}\label{s:numerics} We present here the reconstruction results of the project and replace iteration on the restriction to feature maps of the $SE(2)$ transform of real images. We have chosen eight $512 \times 512$ pixels, 8-bit grayscale digital images $\{f_i\}_{i = 1}^8 \subset \{0,\dots,255\}^{512 \times 512}$, which are shown in Figure \ref{fig:dataset} together with their Fourier spectra. Note that, for processing, they have been bandlimited in order to formally mantain the structure described in \S \ref{s:continuous}. However, this bandlimiting has minimal effects, not visible to the eye, since the spectra have a strong decay: for this reason, the bandlimited images are not shown. For the discrete $SE(2)$ transform we have chosen a discretization of $\Sone$ with 12 angles, so that, with respect to the notation of the previous section, we have $N = 512$ and $M = 12$. We have also chosen the parameter values $s = 51, p = 170, R = 252$. The mother wavelet $\psi$ and dual wavelet $\gamma$ produced by these parameters are shown in Figure \ref{fig:SE2}, top and center, on a crop of the full $512 \times 512$ space for better visualization. We stress that the stability of the transform and the numerical accuracy of the projection \eqref{eq:RKdiscrete} depend only on the behavior of the Calder\'on's function, while the accuracy of image representation under bandlimiting with radius $R$ depends on the decay of the spectra of the images. The Calder\'on's function $C_\psi$, computed as in \eqref{eq:CalderonDiscrete}, is shown in Figure \ref{fig:SE2}, bottom left: the chosen parameters define a ratio $B/A \approx 6 \cdot 10^3$, corresponding to a condition number for $W_\psi$ of less than $10^2$. In Figure \ref{fig:SE2}, bottom right, we have shown in $\log_{10}$ scale the multiplier $\chi_{B_R}/C_\psi$ that defines the dual wavelet $\gamma$ as in \eqref{eq:gamma}, and in particular we can see the bandlimiting radius, to be compared with the spectra of Figure \ref{fig:dataset}. For visualization purposes, in Figure \ref{fig:RK} we have shown in spatial coordinates the integral kernel defining the projection \eqref{eq:RKdiscrete}, which is the reproducing kernel for the discrete $SE(2)$ transform. Its real and imaginary parts are shown on the same crop used to display the wavelet of Figure \ref{fig:SE2}. We have implemented the iteration \eqref{eq:iteration} for the restriction of this discrete $SE(2)$ transform to different types of feature maps $\Theta$, shown in Figure \ref{fig:pins}. We will comment below each one of these cases. We have chosen to illustrate the effect of that iteration as follows. We have computed the sequence $\{H_n\}_{n = 1}^{\nu}$ as in \eqref{eq:PRiteration}, for a number $\nu$ of iterations, and applied the inverse $SE(2)$ transform $W_\gamma^*$ to each $H_n$. This allows us to obtain real images that are directly comparable with the original ones. We then have shown $W_\gamma^* H_1$, representing the first image that can be directly retrieved from the feature parameters, and $W_\gamma^* H_\nu$, that is the image obtained when we stopped the iteration. Moreover, as a measure of reconstruction error, we have considered the following rescaling of the Euclidean norm, at each step $n \in \{1,\dots,\nu\}$: \begin{equation}\label{eq:DELTA} \Delta_n = 100*\left(\frac{1}{N^2}\sum_{x \in \Z_N \times \Z_N}|f_i(x) - W_\gamma^* H_n[f_i](x)|^2\right)^\frac12/255 = 100*\frac{\|f_i - W_\gamma^* H_n[f_i]\|}{255*N}. \end{equation} This adimensional quantity measures a \% error obtained as the average square difference by pixel of an image $f_i$ in the dataset from its $n$-steps reconstruction $W_\gamma^* H_n[f_i]$, divided by the size of the admissible pixel range for 8 bit images, which is $\{0,\dots,255\}$.\vspace{1ex} \paragraph*{First feature map: purely random selection of angles.} The first map that we have considered is a $\Theta : \Z_N \times \Z_N \to \Z_M$ that, for each $x \in \Z_N \times \Z_N$, simply choses one value in $\Z_M$ as a uniformly distributed random variable. This map is shown in the first line of Figure \ref{fig:pins}, left, and in the first line of Figure \ref{fig:pins}, right, we have shown an enlargement to the same crop at which the wavelets in Figure \ref{fig:SE2} and the reproducing kernel in Figure \ref{fig:RK} are shown. In Figure \ref{fig:S1} we have shown the images resulting from $W_\gamma^* H_1$ and $W_\gamma^* H_{1000}$, and the evolution of the error \eqref{eq:DELTA} in $\log_{10}$ scale, respectively in the left, center and right column, for the first four images of Figure \ref{fig:dataset}. In this case we can see that the error $\Delta_n$ goes beyond $1$\%, indicated by $0$ on the $y$ axis, in just about 500 iterations. As a remark, this kind of feature maps are commonly encountered in rodents (see e.g. \cite{HoAngelucci21} and references therein). \vspace{1ex} \paragraph*{Pinwheel-shaped feature maps.} Next, we present the results for three selection maps $\Theta$ that are pinwheel-shaped, as it is commonly observed for orientation and direction preference maps of V1 in primates and other mammals. These maps can be constructed as follows \cite{PetitotBook}: for $\rho \in \R^+$, let $\phi_\rho : \Z_N \times \Z_N \to \C$ be given by $$ \phi_\rho(x) = \int_0^{2\pi} e^{i \big(\rho (x_1 \cos(\alpha) + x_2 \sin(\alpha)) + \Gamma(\alpha) \big)} d\alpha $$ where $\Gamma$ is a purely random process with values in $[0,2\pi)$. The maps $\Theta_\rho : \Z_N \times \Z_N \to \Z_M$ that we have considered are obtained by \begin{equation}\label{eq:generatepinwheels} \Theta_\rho(x) = \left\lfloor \frac{M}{2\pi}\textnormal{angle}(\phi_\rho(x))\right\rfloor \end{equation} where angle$(z)$ is the phase of a complex number $z \in \C$, and $\lfloor t \rfloor$ is the integer part of a real number $t$. The resulting maps are quasiperiodic, with a characteristic correlation length which corresponds to the fact that the spectrum of $\phi_\rho$ is concentrated on a ring of radius $\frac{\rho}{2\pi}$. The main feature of those maps $\Theta_\rho$ is that they possess points, called pinwheel points, around which all angles are mapped, and these points are spaced, on average, by a distance of $2\pi/\rho$ (see e.g. \cite{PetitotBook} and references therein). In the second, third and fourth line of Figure \ref{fig:pins}, left, we have shown the resulting maps $\Theta_\rho$ with $\rho$ respectively given by $\rho = 0.8$, $\rho = 0.4$ and $\rho = 0.06$. On the right column we have shown an enlargement to the same crop used before. The results of the iteration are presented, as described above, in Figures \ref{fig:S2}, \ref{fig:S3}, \ref{fig:S4}, whose structure is the same as in Figure \ref{fig:S1} with the exception of the number of iteration, that is now larger. In order to discuss these results, we first recall that the correlation length of orientation preference maps has been often related to the \emph{size} of receptive fields, as a ``coverage'' constraint to obtain a faithful representation of the visual stimulus (see \cite{Bosking02, Keil11, BCS14} and references therein). However, no mathematical proof of this principle in terms of image reconstruction has been given so far, nor has the word \emph{size} received a more quantitative meaning within the models of type \eqref{eq:receptive}, and we have not tried to give any more specific meaning either. However, for the three cases that we present, by comparing the crops of the maps $\Theta_\rho$ in Figure \ref{fig:pins} with the wavelet $\psi$ in Figure \ref{fig:SE2}, we can see that for $\rho = 0.8$ the correlation length of the map $\Theta_\rho$ is approximately similar to what we could call effective support of the receptive field, while for $\rho = 0.4$ we have that the area of influence of the receptive field does not include two different pinwheel points, and for $\rho = 0.06$ the two scales are very different. Heuristically, one could then be led to think that the reconstruction properties in the three cases may present qualitative differences. For example, that condition \eqref{eq:uniqueness}, or its discrete counterpart \eqref{eq:condition}, may hold in the first case and may not hold in the third case. What we can see by the numerical results of the proposed algorithm are that, actually, there is a difference in the behavior of the decay. For larger values of the parameter $\rho$, when the map $\Theta_\rho$ is more similar to the purely random selection described above, the decay of the error is faster, while for smaller values of $\rho$ the decay is slower, but nevertheless the error appears to be monotonically decreasing. In the presented cases, for $\rho = 0.8$, we can see in the right column of Figure \ref{fig:S2} that in about 2000 iterations the error decay appears to enter an exponential regime, which is rectilinear in the $\log_{10}$ scale. We see in Figure \ref{fig:S3} that it takes roughly twice as many iterations for $\rho = 0.4$ to enter the same regime. On the other hand, for $\rho = 0.06$ we can see in Figure \ref{fig:S4} that after a relatively small number of iterations the decay becomes very small, and does not seem to become exponential even after 10000 iterations. However, visual inspection of the results (which ``measures'' the error in a different way than the Euclidean norm) in this last case, show that the starting image appears to be qualitatively highly corrupted, while the image obtained after the iteration was stopped is remarkably true to the original one and does not display evident artifacts away from the boundaries. \vspace{1ex} \paragraph*{Selection of a single orientation: deconvolution.} The surprisingly good performance in the reconstruction problem for the las map $\Theta_{0.06}$ has motivated a performance test for an additional feature selection map, given by a function $\Theta$ that is independent of $x$, hence selecting just one angle in the $SE(2)$ transform. In the same fashion as seeing the purely random distribution as a limiting case for large $\rho$ of the pinwheel-shaped maps, this can be considered as a limiting case for small $\rho$. However, keeping only the values of $W_\psi f$ for a single angle $\theta$ concretely corresponds to performing a convolution with one function $\psi_\theta$, and aiming to reconstruct $f$ is actually a deconvolution problem. In this case, the frequency behavior of the convolution filter is that of a Gaussian centered away from the origin, and its shape can be observed in the Calder\'on's function of Figure \ref{fig:SE2}, which clearly shows the sum of 12 such Gaussians. We have shown the reconstruction results for this problem, using now 15000 iterations, in Figure \ref{fig:S5}. The error decay seems to share, qualitatively, much of the same properties of the case $\rho = 0.06$. \section{Conclusions} In this paper we have proposed an elementary iterative technique to address a problem inspired by visual perception and related to the reconstruction of images from a fixed reduced set of values of its $SE(2)$ group wavelet transform. A possible interpretation of this iteration with a kernel defined by the $SE(2)$ group as a neural computation in V1 comes from the modeling of the neural connectivity as a kernel operation \cite{WC72, EC80, CS15, MCSx}, especially if considered in the framework of a neural system that aims to learn group invariant representations of visual stimuli \cite{PA14, Anselmi20}. A direct comparison of the proposed technique with kernel techniques recently introduced with radically different purposes in \cite{MBCSx, MCSx} shows however two main differences at the level of the kernel that is used: here we need the dual wavelet to build the projection kernel, and the iteration kernel effectively contains the feature maps. On the other hand, a possible application is the inclusion of a solvability condition such as \eqref{eq:uniqueness} as iterative steps within learning frameworks such as those of \cite{AERP19, Anselmi20}. We would like to observe also that, since the proof of convergence of this technique is general, it could be applied to other problems with a similar structure. The computational cost essentially relies on the availability of efficient methods to implement the two projections that define the problem in the discrete setting, as it happens to be the case for the setting studied in this paper. In particular, similar arguments could be applied to other wavelet transforms based on semidirect product groups $\R^d \rtimes G$, with $G$ a subgroup of $GL_d(\R)$ that defines what in this paper are sometimes called local features, and to sampling projections obtained for example, but not only, from other types of feature maps $\Theta : \R^d \to G$. From the dimensional point of view, in the discrete setting the selection of local features with a feature map can be seen as a downsampling that allows one to mantain in the transformed space the same dimension of the input vector. This is often a desirable property and it is already commonly realized e.g. by the MRA decomposition algorith of classical wavelets or by the pooling operation in neural networks. Moreover, its apparent stability of convergence seem to suggest that this operation can be performed a priori, without the need of a previous study of solvability of the problem. Several questions remain open after this study. Probably the most fundamental one is the characterization of those maps $\Theta$ that, for a given mother wavelet $\psi$, satisfy the solvability condition \eqref{eq:uniqueness}. In terms of the study of the convergence of the project and replace iteration, moreover, it is plausible that one could obtain convergence under weaker conditions than \eqref{eq:condition}, even if maybe to a different solution, as it appears to happen in some of the numerical simulations presented. \newpage \section*{Figures} \begin{figure}[H] \begin{center} \includegraphics[width=.24\textwidth]{IM01.jpeg} \includegraphics[width=.24\textwidth]{IM02.jpeg} \includegraphics[width=.24\textwidth]{IM03.jpeg} \includegraphics[width=.24\textwidth]{IM04.jpeg}\vspace{4pt}\\ \includegraphics[width=.24\textwidth]{IM05.jpeg} \includegraphics[width=.24\textwidth]{IM06.jpeg} \includegraphics[width=.24\textwidth]{IM07.jpeg} \includegraphics[width=.24\textwidth]{IM08.jpeg}\vspace{2ex}\\ \includegraphics[width=.24\textwidth]{IM01_FFT2.png} \includegraphics[width=.24\textwidth]{IM02_FFT2.png} \includegraphics[width=.24\textwidth]{IM03_FFT2.png} \includegraphics[width=.24\textwidth]{IM04_FFT2.png}\vspace{4pt}\\ \includegraphics[width=.24\textwidth]{IM05_FFT2.png} \includegraphics[width=.24\textwidth]{IM06_FFT2.png} \includegraphics[width=.24\textwidth]{IM07_FFT2.png} \includegraphics[width=.24\textwidth]{IM08_FFT2.png} \end{center} \caption{Original test images (top) and their Fourier spectra in $\log_{10}$ scale (bottom).}\label{fig:dataset} \end{figure} \newpage \begin{figure}[H] \begin{center} \includegraphics[height=.9\textheight]{SE2.png} \end{center} \caption{Top: mother wavelet $\psi$. Center: dual wavelet $\gamma$. Bottom, left: Calder\'on's function. Bottom, right: inverse of the Calder\'on's function in $\log_{10}$ scale, bandlimited with $R = 252$.}\label{fig:SE2} \end{figure} \newpage \begin{figure}[H] \begin{center} \includegraphics[width=.98\textwidth]{RK.png} \end{center} \caption{Reproducing kernel for the wavelet of Figure \ref{fig:SE2}. Top: real part for the 12 angles. Bottom: imaginary part for the 12 angles.}\label{fig:RK} \end{figure} \newpage \begin{figure}[H] \begin{center} \includegraphics[height=.9\textheight]{Theta.png} \end{center} \caption{Left column: maps $\Theta$ for the simulations in Figures \ref{fig:S1}, \ref{fig:S2}, \ref{fig:S3}, \ref{fig:S4}. Right column: enlargements of the same maps. First line: purely random $\Theta$. Second, third and fourth line: maps $\Theta_\rho$ generated according to \eqref{eq:generatepinwheels} with $\rho$ respectively given by $\rho = 0.8$, $\rho = 0.4$ and $\rho = 0.06$.}\label{fig:pins} \end{figure} \begin{figure}[H] \begin{center} \includegraphics[width=.325\textwidth]{IM01_L=255_s=51_p=170_rhopin=0_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM01_L=255_s=51_p=170_rhopin=0_nAngle=12_iter1000.jpeg} \includegraphics[width=.33\textwidth]{IM01_L=255_s=51_p=170_rhopin=0_nAngle=12_ErrorDecay.png}\vspace{4pt}\\ \includegraphics[width=.325\textwidth]{IM02_L=255_s=51_p=170_rhopin=0_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM02_L=255_s=51_p=170_rhopin=0_nAngle=12_iter1000.jpeg} \includegraphics[width=.33\textwidth]{IM02_L=255_s=51_p=170_rhopin=0_nAngle=12_ErrorDecay.png}\vspace{4pt}\\ \includegraphics[width=.325\textwidth]{IM03_L=255_s=51_p=170_rhopin=0_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM03_L=255_s=51_p=170_rhopin=0_nAngle=12_iter1000.jpeg} \includegraphics[width=.33\textwidth]{IM03_L=255_s=51_p=170_rhopin=0_nAngle=12_ErrorDecay.png}\vspace{4pt}\\ \includegraphics[width=.325\textwidth]{IM04_L=255_s=51_p=170_rhopin=0_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM04_L=255_s=51_p=170_rhopin=0_nAngle=12_iter1000.jpeg} \includegraphics[width=.33\textwidth]{IM04_L=255_s=51_p=170_rhopin=0_nAngle=12_ErrorDecay.png} \end{center} \caption{Iteration on the images 1 to 4 of Figure \ref{fig:dataset} for the purely random $\Theta$ shown in the first line of Figure \ref{fig:pins}. Left: first step of the iteration. Center: after 1000 iterations. Right: $\log_{10}(\Delta_n)$, for the error \eqref{eq:DELTA}.}\label{fig:S1} \end{figure} \newpage \begin{figure}[H] \begin{center} \includegraphics[width=.325\textwidth]{IM05_L=255_s=51_p=170_rhopin=0.82353_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM05_L=255_s=51_p=170_rhopin=0.82353_nAngle=12_iter5000.jpeg} \includegraphics[width=.33\textwidth]{IM05_L=255_s=51_p=170_rhopin=0.82353_nAngle=12_ErrorDecay.png}\vspace{4pt}\\ \includegraphics[width=.325\textwidth]{IM06_L=255_s=51_p=170_rhopin=0.82353_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM06_L=255_s=51_p=170_rhopin=0.82353_nAngle=12_iter5000.jpeg} \includegraphics[width=.33\textwidth]{IM06_L=255_s=51_p=170_rhopin=0.82353_nAngle=12_ErrorDecay.png}\vspace{4pt}\\ \includegraphics[width=.325\textwidth]{IM07_L=255_s=51_p=170_rhopin=0.82353_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM07_L=255_s=51_p=170_rhopin=0.82353_nAngle=12_iter5000.jpeg} \includegraphics[width=.33\textwidth]{IM07_L=255_s=51_p=170_rhopin=0.82353_nAngle=12_ErrorDecay.png}\vspace{4pt}\\ \includegraphics[width=.325\textwidth]{IM08_L=255_s=51_p=170_rhopin=0.82353_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM08_L=255_s=51_p=170_rhopin=0.82353_nAngle=12_iter5000.jpeg} \includegraphics[width=.33\textwidth]{IM08_L=255_s=51_p=170_rhopin=0.82353_nAngle=12_ErrorDecay.png} \end{center} \caption{Iteration on the images 5 to 8 of Figure \ref{fig:dataset} for $\Theta_{0.8}$ shown in the second line of Figure \ref{fig:pins}. Left: first step of the iteration. Center: after 5000 iterations. Right: $\log_{10}(\Delta_n)$, for the error \eqref{eq:DELTA}.}\label{fig:S2} \end{figure} \newpage \begin{figure}[H] \begin{center} \includegraphics[width=.325\textwidth]{IM01_L=255_s=51_p=170_rhopin=0.39216_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM01_L=255_s=51_p=170_rhopin=0.39216_nAngle=12_iter10000.jpeg} \includegraphics[width=.33\textwidth]{IM01_L=255_s=51_p=170_rhopin=0.39216_nAngle=12_ErrorDecay.png}\vspace{4pt}\\ \includegraphics[width=.325\textwidth]{IM02_L=255_s=51_p=170_rhopin=0.39216_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM02_L=255_s=51_p=170_rhopin=0.39216_nAngle=12_iter10000.jpeg} \includegraphics[width=.33\textwidth]{IM02_L=255_s=51_p=170_rhopin=0.39216_nAngle=12_ErrorDecay.png}\vspace{4pt}\\ \includegraphics[width=.325\textwidth]{IM03_L=255_s=51_p=170_rhopin=0.39216_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM03_L=255_s=51_p=170_rhopin=0.39216_nAngle=12_iter10000.jpeg} \includegraphics[width=.33\textwidth]{IM03_L=255_s=51_p=170_rhopin=0.39216_nAngle=12_ErrorDecay.png}\vspace{4pt}\\ \includegraphics[width=.325\textwidth]{IM04_L=255_s=51_p=170_rhopin=0.39216_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM04_L=255_s=51_p=170_rhopin=0.39216_nAngle=12_iter10000.jpeg} \includegraphics[width=.33\textwidth]{IM04_L=255_s=51_p=170_rhopin=0.39216_nAngle=12_ErrorDecay.png} \end{center} \caption{Iteration on the images 1 to 4 of Figure \ref{fig:dataset} for $\Theta_{0.4}$ shown in the third line of Figure \ref{fig:pins}. Left: first step of the iteration. Center: after 10000 iterations. Right: $\log_{10}(\Delta_n)$, for the error \eqref{eq:DELTA}.}\label{fig:S3} \end{figure} \newpage \begin{figure}[H] \begin{center} \includegraphics[width=.325\textwidth]{IM05_L=255_s=51_p=170_rhopin=0.058824_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM05_L=255_s=51_p=170_rhopin=0.058824_nAngle=12_iter10000.jpeg} \includegraphics[width=.33\textwidth]{IM05_L=255_s=51_p=170_rhopin=0.058824_nAngle=12_ErrorDecay.png}\vspace{4pt}\\ \includegraphics[width=.325\textwidth]{IM06_L=255_s=51_p=170_rhopin=0.058824_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM06_L=255_s=51_p=170_rhopin=0.058824_nAngle=12_iter10000.jpeg} \includegraphics[width=.33\textwidth]{IM06_L=255_s=51_p=170_rhopin=0.058824_nAngle=12_ErrorDecay.png}\vspace{4pt}\\ \includegraphics[width=.325\textwidth]{IM07_L=255_s=51_p=170_rhopin=0.058824_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM07_L=255_s=51_p=170_rhopin=0.058824_nAngle=12_iter10000.jpeg} \includegraphics[width=.33\textwidth]{IM07_L=255_s=51_p=170_rhopin=0.058824_nAngle=12_ErrorDecay.png}\vspace{4pt}\\ \includegraphics[width=.325\textwidth]{IM08_L=255_s=51_p=170_rhopin=0.058824_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM08_L=255_s=51_p=170_rhopin=0.058824_nAngle=12_iter10000.jpeg} \includegraphics[width=.33\textwidth]{IM08_L=255_s=51_p=170_rhopin=0.058824_nAngle=12_ErrorDecay.png} \end{center} \caption{Iteration on the images 5 to 8 of Figure \ref{fig:dataset} for $\Theta_{0.06}$, shown in the fourth line of Figure \ref{fig:pins}. Left: first step of the iteration. Center: after 10000 iterations. Right: $\log_{10}(\Delta_n)$, for the error \eqref{eq:DELTA}.}\label{fig:S4} \end{figure} \newpage \begin{figure}[H] \begin{center} \includegraphics[width=.325\textwidth]{IM02_L=255_s=51_p=170_rhopin=-1_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM02_L=255_s=51_p=170_rhopin=-1_nAngle=12_iter15000.jpeg} \includegraphics[width=.33\textwidth]{IM02_L=255_s=51_p=170_rhopin=-1_nAngle=12_ErrorDecay.png}\vspace{4pt}\\ \includegraphics[width=.325\textwidth]{IM04_L=255_s=51_p=170_rhopin=-1_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM04_L=255_s=51_p=170_rhopin=-1_nAngle=12_iter15000.jpeg} \includegraphics[width=.33\textwidth]{IM04_L=255_s=51_p=170_rhopin=-1_nAngle=12_ErrorDecay.png}\vspace{4pt}\\ \includegraphics[width=.325\textwidth]{IM05_L=255_s=51_p=170_rhopin=-1_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM05_L=255_s=51_p=170_rhopin=-1_nAngle=12_iter15000.jpeg} \includegraphics[width=.33\textwidth]{IM05_L=255_s=51_p=170_rhopin=-1_nAngle=12_ErrorDecay.png}\vspace{4pt}\\ \includegraphics[width=.325\textwidth]{IM08_L=255_s=51_p=170_rhopin=-1_nAngle=12_iter1-STRETCH.jpeg} \includegraphics[width=.325\textwidth]{IM08_L=255_s=51_p=170_rhopin=-1_nAngle=12_iter15000.jpeg} \includegraphics[width=.33\textwidth]{IM08_L=255_s=51_p=170_rhopin=-1_nAngle=12_ErrorDecay.png} \end{center} \caption{Iteration for the $SE(2)$ deconvolution by $\psi$ on images of Figure \ref{fig:dataset}. Left: first step of the iteration. Center: after 15000 iterations. Right: $\log_{10}(\Delta_n)$, for the error \eqref{eq:DELTA}.}\label{fig:S5} \end{figure} \newpage \bibliographystyle{plain}
\section{\label{sec:intro} Introduction} The importance of efficient computational modeling in chemistry and materials science cannot be understated, and for many applications, Kohn--Sham density functional theory presents the most appealing compromise between accuracy and efficiency. The favorable position of this compromise has been enabled by the steady progression of ever more accurate density functionals produced over the last 60 years. These functionals are commonly characterized by the Perdew--Schmidt hierarchy \cite{Perdew2001}, a progression of increasing non-locality where successive levels can be expected to give greater accuracy at the cost of increased computational complexity. The meta-generalized gradient approximations (meta-GGAs) stand as an appealing level at which the highest accuracy can be expected from semi-local ingredients, including the electron density, its gradient, and the kinetic energy density. While hybrid functionals incorporating admixtures of non-local exact exchange have become most prominent for molecular applications, the prohibitive cost scaling of exact-exchange with number of electrons has limited their utility for extended systems. A meta-GGA is commonly designed by either enforcing constraints on the exchange-correlation (XC) functional, or by fitting to reference data sets. Those that take the latter route, called empirical functionals, can be inaccurate for systems outside their respective fitting set, or can suffer from difficulties due to over-fitting. General purpose functionals that are accurate for diverse systems have tended to be of the former, so-called non-empirical, variety in which transferable accuracy is promoted by adherence to physical constraints that are necessarily true for all systems of electrons. The first generation of meta-GGAs were non-empirical, and predate most GGAs. Becke and Roussel \cite{Becke1983,Becke1989} derived generalized Taylor series of the exact-exchange hole by enforcing sum rule and non-negativity constraints on a hole model. Perdew \cite{Perdew1985} derived a Laplacian-level meta-GGA for the exchange energy by enforcing the same set of constraints. At the meta-GGA level, the strongly-constrained and appropriately-normed (SCAN) functional has incorporated all 17 known constraints on the exact XC energy appropriate to the semi-local level \cite{Sun2015}. (These constraints are listed together in the Supplementary Material of Ref. \cite{Sun2015}, and the references for them are presented in the main text of Ref. \cite{Sun2015}.) From this foundation, further works have proposed modifications to the SCAN energy densities to improve its accuracy in certain domains. revSCAN is a simple modification to the slowly-varying limit of SCAN's correlation energy that modifies the fourth-order term in its density-gradient expansion \cite{Mezei2018}. The TASK functional is a complete revision of SCAN, retaining only its fulfillment of exact constraints for the exchange energy \cite{Aschebrock2019}. TASK is designed to accurately predict band gaps, and has recently been itself extended for accuracy in 2D systems, in a modification termed ``mTASK'' \cite{Neupane2021}. Note TASK and mTASK use a correlation density functional at the local density approximation. The SCAN functional has proved broadly transferable and has shown good accuracy for many systems normally challenging for DFT methods \cite{Kitchaev2016, Sun2016, Peng2017, Zhang2017, Chen2017, Furness2018, Lane2018, SaiGautam2018, Zhang2019, Zhang2020b, Pulkkinen2020, Zhang2020a, Ning2021}, though its numerical difficulties have hindered some applications such as pseudo-potential generation \cite{Bartok2019, Furness2019}. To address this, Bart\'ok and Yates proposed a regularized SCAN, termed ``rSCAN'', that aims to control numerical challenges while remaining as close to the original SCAN functional as possible. While the regularizations are effective in improving numerical performance, removing the grid sensitivity of SCAN that is problematic in some electronic structure codes, they break five of the exact conditions SCAN was designed to obey. Recent work by Mej\'ia-Rodr\'iguez and Trickey shows that some transferablity is lost in rSCAN, with atomization energies particularly degraded \cite{Mejia-Rodriguez2019, Bartok2019a}. We have recently proposed a restored-regularized-SCAN, called r\tss{2}SCAN\xspace, which maintains the regularizations of rSCAN while restoring exact constraint adherence \cite{Furness2020c}. Compared to SCAN, the resulting r\tss{2}SCAN\xspace functional has shown pronounced improvements in numerical efficiency, alongside small systematic improvements in accuracy \cite{Furness2020c, Mejia-Rodriguez2020f, Mejia-Rodriguez2020g, Ehlert2021b, Grimme2021,Ning2021}. On the extensive GMTKN55 test set \cite{Goerigk2017} for main-group chemistry, the overall error measure WTMAD-2 was \cite{Ehlert2021b} 8.6 kcal/mol for SCAN+D4 and 7.5 kcal/mol for r\tss{2}SCAN\xspace+D4, where D4 is a dispersion correction. Note that SCAN and r\tss{2}SCAN\xspace are not fitted to any bonded system, but are genuinely predictive for bonded systems. Applying SCAN+D4 to the unrestricted Hartree-Fock density \cite{Santra2021} instead of its own self-consistent density leads to a remarkably small WTMAD-2 of 5.079 kcal/mol, better than nearly all the (necessarily empirical) hybrid functionals tested thus far. This ``density correction'' \cite{Song2021} to SCAN also leads to a nearly-perfect many-body expansion and molecular dynamics for water \cite{Dasgupta2021}. The present publication completes Ref \cite{Furness2020c}, providing the necessary detail of how each exact constraint was restored in r\tss{2}SCAN\xspace. We show how these restorations affect the numerical performance of the functional and how smoothness can be maintained for all constraints except the fourth order term of the slowly-varying density gradient expansion for exchange, which is less easy to enforce following the present interpolation-based model. This work also provides context for the exact constraints enforced by SCAN, and demonstrates how a meta-GGA can be constructed to enforce those constraints. This work builds upon Ref. \cite{Furness2020c} by expanding it to a progression of functionals (rSCAN, r++SCAN\xspace, r\tss{2}SCAN\xspace, and r\tss{4}SCAN\xspace) that ultimately restore all the exact constraints obeyed by SCAN to a regularized form. Thus our presentation expands upon and completes the letter version of Ref. \cite{Furness2020c}, by filling in the details in the constructions of the last three functionals, and by presenting numerical results for r++SCAN\xspace and r\tss{4}SCAN\xspace. We also present individual errors of these functionals on their appropriate norms (used to determine their parameters) in Table \ref{tab:norms}, and on the lattice constants of solids in Table \ref{tab:LC20_table}. Figures \ref{fig:fx_osc}, \ref{fig:setting_r4_params}, \ref{fig:Xe_derivatives}, and \ref{fig:G3_progression} will be familiar to readers of Ref \cite{Furness2020c}, but are expanded to incorporate results for the new meta-GGAs. We also include a more detailed analysis of the construction of r\tss{2}SCAN\xspace than was presented in Ref. \cite{Furness2020c}: in addition to a derivation of the r\tss{2}SCAN\xspace gradient expansion in supplemental material A, Fig. \ref{fig:d2_Set} shows how the damping factor $d_{p2}$ of r\tss{2}SCAN\xspace was determined. Variations of Figs. \ref{fig:alpha_comp} and \ref{fig:iefcomp} were presented in Ref. \cite{Furness2020c}; they are included here for completeness. The Tables in Appendices C--F report results for the same test sets considered in Ref. \cite{Furness2020c}, but including the novel meta-GGAs. \section{\label{sec:theory} Constraint restoration} \subsection{Coordinate scaling and uniform density limit \label{sec:theory_scaling}} The SCAN functional is comprised of independent exchange and correlation functionals each constructed as an interpolation and extrapolation of two semi-local energy densities: one for single-orbital densities $\epsilon_\mr{x/c}^0$, and one for slowly-varying densities $\epsilon_\mr{x/c}^1$, where ``x/c'' is either exchange or correlation, respectively. Here, we will use $\epsilon$ to refer to the energy density, and $\varepsilon=\epsilon/n$ to refer to the energy per electron. The single-orbital and slowly-varying energy densities are joined by way of an interpolation function, \begin{equation} \epsilon_\mr{x/c}^{\mr{SCAN}}(\v{r}) = \epsilon_\mr{x/c}^1(\v{r}) + f_\mr{x/c}(\alpha(\v{r}))\left[\epsilon_\mr{x/c}^0(\v{r}) - \epsilon_\mr{x/c}^1(\v{r})\right], \label{eq:scan_framework} \end{equation} which is controlled by the iso-orbital indicator variable, \begin{equation} \alpha = \frac{\tau - \tau_W}{\tau_U}. \label{eq:alpha} \end{equation} $\alpha$ is built from three kinetic energy densities: the positive-definite conventional $\tau = 1/2\sum_i^{\mr{occ.}}|\nabla \phi_i|^2$ defined with the occupied Kohn-Sham orbitals \{$\phi_i$\}, von Weizs\"acker $\tau_W = |\nabla n|^2/(8n)$ that is the single-orbital limit of $\tau$ as a function of the electron density $n=\sum_i^{\mr{occ.}}|\phi_i|^2$, and $\tau_U = \frac{3}{10}k_{\mr{F}}^2\, n\, d_s(\zeta)$ the uniform electron gas limit of $\tau$. Here, the Fermi wavevector $k_{\mr{F}}=[3\pi^2 n]^{1/3}$, and $d_s(\zeta) = [(1 + \zeta)^{5/3} + (1 - \zeta)^{5/3}]/2$ is a function of the spin polarization $\zeta = (n_\uparrow - n_\downarrow)/(n_\uparrow + n_\downarrow)$. We refer to Refs. \cite{Becke1990, Ruzsinszky2012, Sun2012, Sun2013a, Sun2015, Furness2019, Furness2020a} for a detailed discussion of the properties of $\alpha$ and related quantities. The first change made in rSCAN \cite{Bartok2019} is to regularize the iso-orbital indicator $\alpha$ to prevent divergence of the XC potential in the asymptotic regions of single orbital systems \cite{Furness2019}. In this region, the derivative $\partial\alpha/\partial\tau$ diverges faster than the decay of $\epsilon_{\mr{x}}^{\mr{LDA}}=-3k_{\mr{F}} n/(4\pi)$ (the local density approximation for exchange), resulting in a diverging exchange-correlation potential when $\partial\epsilon_\mr{xc}/\partial\alpha \neq 0$ \cite{Furness2019}, as is the case for SCAN. This diverging potential is problematic for pseudo-potential generation \cite{Bartok2019, Furness2019} and is avoided in rSCAN using a regularized $\alpha^\prime$, \begin{align} \tilde\tau_U &= \left (\frac{3}{10}(3\pi^2)^{2/3}n^{5/3} + \tau_r \right)d_s(\zeta), \label{eq:regUEG}\\ \tilde\alpha &= \frac{\tau - \tau_W}{\tilde\tau_U}, \label{eq:tildealpha}\\ \alpha^\prime &= \frac{\tilde\alpha^3}{\tilde\alpha^2 + \alpha_r}. \end{align} The regularizing constants are $\tau_r = 10^{-4}$ and $\alpha_r = 10^{-3}$. Whilst successful in preventing the rSCAN potential from diverging, the $\alpha^\prime$ regularization breaks two exact constraints: the 1) uniform density limit, and 2) the uniform coordinate scaling of the exchange energy \cite{Levy1985}. The exact uniform density limit is recovered in SCAN by recognizing, \begin{equation} \lim_{|\nabla n|\to0} \tau = \lim_{|\nabla n|\to0}\tau_U, \end{equation} and, \begin{equation} \lim_{|\nabla n|\to0} \tau_W = 0, \label{eq:tauwlim} \end{equation} hence, \begin{equation} \lim_{|\nabla n|\to0} \alpha = 1. \end{equation} Then by construction, \begin{equation} \lim_{|\nabla n|\to0} f_{\mr{x/c}}^{\mr{SCAN}}(\alpha) = 0, \end{equation} and Eq. \ref{eq:scan_framework} exclusively selects $\epsilon_{\mr{x}}^1$ and $\epsilon_{\mr{c}}^1$ in the uniform density limit. These energy densities satisfy the uniform density limit by design. The uniform density limit is broken by the regularization parameters in $\alpha^\prime$ as, \begin{align} &\lim_{|\nabla n|\to0}\tilde\tau_U \neq \lim_{|\nabla n|\to0} \tau , \\ &\lim_{|\nabla n|\to0} \tilde\alpha = \frac{\lim_{|\nabla n|\to0}\tau_U}{\lim_{|\nabla n|\to0}\tilde\tau_U} \neq 1, \\ &\lim_{|\nabla n|\to0} \alpha^\prime \neq 1, \end{align} hence, \begin{equation} \lim_{|\nabla n|\to0} f_{\mr{x/c}}^{\mr{rSCAN}}(\alpha^\prime) \neq 0. \end{equation} The final inequality results in a slight scaling of $\epsilon_{\mr{x/c}}^1$ and a small inclusion of $\epsilon_\mr{x/c}^0$, which does not recover the uniform density limit. Hence the constraint is broken. The uniform density limit is important for metallic elements. For a uniform electron gas of density parameter $r_{\mathrm{s}}=4$ (roughly characteristic of the valence electron density in solid sodium) $\alpha'\approx 0.719$, for example. The regularized uniform electron gas kinetic energy density, $\tilde\tau_U$, also causes the exchange energy density to scale incorrectly under the uniform coordinate scaling transformations. To see this, we define a uniform coordinate scaling of the density $n$ and Kohn-Sham orbital $\phi_i$ as \begin{align} n_\lambda(\bm{r}) &= \lambda^3 n(\lambda \bm{r}), \\ \phi_{i,\lambda}(\bm{r}) &= \lambda^{3/2}\phi_i(\lambda \bm{r}), \end{align} with $\lambda \geq 0$, such that the standard meta-GGA variables scale as, \begin{align} \tau_\lambda (\bm{r}) &= \lambda^5 \frac{1}{2} \sum_i^{\mr{occ.}}\left| \frac{\partial \phi_i(\lambda \bm{r})}{\partial (\lambda \bm{r})} \right|^2 = \lambda^5 \tau (\lambda \bm{r}) \\ \tau_{W,\lambda}(\bm{r}) &= \lambda^5 \tau_W(\lambda \bm{r}) \\ \tau_{U,\lambda}(x,y,z) &= \lambda^{5}\tau_U(\lambda \bm{r}). \end{align} Thus, while $\alpha(\bm{r}) \to \alpha(\lambda \bm{r})$ under uniform coordinate scaling, $\tilde \alpha$ does not have this correct behavior except in the limit $\lambda \to \infty$, because the regularization $\tau_r$ in $\tilde\tau_U$ doesn't vary with the coordinate scaling parameter $\lambda$. This clearly violates the uniform coordinate scaling behavior of the exchange energy \cite{Levy1985} \begin{equation} E_\mr{x}[n_{\lambda}] = \lambda E_\mr{x}[n], \end{equation} as $\tilde \alpha$ does not scale correctly, and the exchange and correlation models here are highly nonlinear in $\tilde \alpha$. The exact correlation energy evaluated on a uniformly scaled density tends to distinct limits \cite{Levy1991,Levy1993} \begin{align} \lim_{\lambda \to \infty} E_\mr{c}[n_\lambda] &= \text{constant} \leq 0 \\ \lim_{\lambda \to 0} E_\mr{c}[n_\lambda] &= \lambda D_\mr{c}[n], \end{align} where the constant and functional $D_\mr{c}$ are unknown. It can be seen that SCAN, and the functionals presented here satisfy both limits, but rSCAN satisfies only the $\lambda \to \infty$ limit. It should be noted that under nonuniform coordinate scaling, rSCAN does not violate known exact constraints \cite{Levy1991,Gorling1992,Pollack2000} because of the robustness of the underlying SCAN model. It does, however, tend to distinct limits from SCAN, likely impacting performance for real systems. To see this, we define a non-uniform coordinate scaling of the density $n$ and Kohn--Sham orbital $\phi_i$ in one dimension as, \begin{align} n_\lambda^{x}(x, y, z) &= \lambda n(\lambda x, y, z), \label{eq:nus_dens} \\ \phi_{i,\lambda}^x(x, y, z) &= \lambda^{1/2}\phi_i(\lambda x, y, z), \label{eq:nus_ks_orb} \end{align} again with $\lambda \geq 0$. Under this coordinate transformation, the exact exchange energy satisfies \cite{Levy1991,Gorling1992} \begin{align} \lim_{\lambda \to 0}\frac{1}{N} E_\mr{x}[n_\lambda^x] &> -\infty\\ \lim_{\lambda \to \infty} \frac{1}{N} E_\mr{x}[n_\lambda^x] &> -\infty, \label{eq:nus_ex_inf} \end{align} with $N$ the number of electrons. Identical inequalities hold for the exact correlation energy \cite{Gorling1992,Pollack2000}. It should be emphasized that these constraints imply that the exact exchange and correlation energies per electron tend to finite constants under either limit of non-uniform coordinate scaling. The constant limit for Eq. \ref{eq:nus_ex_inf} is a non-zero negative constant \cite{Pollack2000}, the exchange energy per electron for a two-dimensional system. To recover these constraints on an approximate exchange energy functional, the exchange enhancement factor $F_\mr{x} = \epsilon_\mr{x}/\epsilon_\mr{x}^\text{LDA}$ must satisfy \cite{Chiodo2012,Perdew2014} \begin{equation} \lim_{p\to \infty} F_\mr{x} \propto p^{-1/4}. \end{equation} $p = [|\nabla n|/(2k_\mr{F} n)]^2$ is the square of a dimensionless gradient of the density on the appropriate length scale for the exchange energy. We will discuss $p$ further in the ensuing section on gradient expansions, but it suffices here to note that $p$ scales as $\lambda^{-2/3}$ as $\lambda \to 0$, and as $\lambda^{4/3}$ as $\lambda \to \infty$, as shown in supplemental material B. Therefore, $p$ is always divergent under the extreme limits of non-uniform coordinate scaling. In SCAN, rSCAN, and the functionals developed here, the set of coordinate scaling constraints for exchange are imposed through a function $g_\mr{x}(p)$ \begin{align} F_\mr{x}(n,|\nabla n|,\tau) &= \left\{h_{\mr{1x}} + f_\mr{x}(\alpha)\left[h_{0\mr{x}} - h_{\mr{1x}}\right ]\right\} g_\mr{x}(p) \\ g_\mr{x}(p) &= 1 - \exp[-a_1p^{-1/4}]. \end{align} Referring to Eq. (\ref{eq:scan_framework}), it can be seen that $h_\mr{jx}=\epsilon_\mr{x}^j/[\epsilon_\mr{x}^\text{LDA}g_\mr{x}]$, with $j=0,1$. In the limit $p\to \infty$, \begin{align} \lim_{p\to \infty} g_\mr{x}(p) &= a_1 p^{-1/4} + \mathcal{O}(p^{-1/2}) \\ \lim_{p\to \infty} h_\mr{xj} &= \text{constant} > 0, \quad j = 0,1. \end{align} Thus $F_\mr{x}\sim p^{-1/4}$. In SCAN, rSCAN, and this work, $h_\mr{x0}=1.174$ identically, and $h_\mr{x1}(p\to\infty)=1.065$. The LDA, most GGAs, and most meta-GGAs do not recover the right asymptotic behavior for exchange. Recovering the analogous set of non-uniform coordinate scaling constraints for correlation is more straightforward, and requires that, for $j=0,1$, \begin{align} \lim_{p \to \infty} \epsilon_\mr{c}^j &= \text{constant} \leq 0 \\ \lim_{r_{\mathrm{s}} \to 0} \epsilon_\mr{c}^j &= \text{constant} \leq 0, \end{align} where $r_{\mathrm{s}} = [3/(4\pi n)]^{1/3}$ is the Wigner-Seitz radius. In SCAN, rSCAN, and the functionals developed here, both constants are chosen to be zero. Many non-empirical GGAs and meta-GGAs for correlation satisfy the non-uniform coordinate scaling constraints. LDA, which has a logarithmic divergence as $r_{\mathrm{s}} \to 0$, does not. We can now consider the iso-orbital indicators used in SCAN, rSCAN, and r\tss{2}SCAN\xspace. Under the non-uniform coordinate scaling defined in Eqs. \ref{eq:nus_dens} and \ref{eq:nus_ks_orb}, the standard meta-GGA variables scale as \begin{align} \tau_\lambda^x (x, y, z) &= \frac{\lambda}{2} \sum_i^{\mr{occ.}}\left|\hat{\bm{x}}\lambda \frac{\partial \phi_i(\lambda x, y, z)}{\partial(\lambda x)} + \nabla_\perp \phi_i(\lambda x, y, z)\right|^2 \label{eq:nus_tau} \\ \tau_{W,\lambda}^x(x,y,z) &= \lambda \frac{\left|\hat{\bm{x}}\lambda\frac{\partial n(\lambda x, y, z)}{\partial(\lambda x)} + \nabla_\perp n(\lambda x, y, z)\right|^2}{8n(\lambda x, y, z)} \\ \tau_{U,\lambda}^{x}(x,y,z) &= \lambda^{5/3}\tau_U(\lambda x, y, z), \label{eq:nus_tauu} \end{align} with \[ \nabla_\perp = \hat{\bm{y}} \frac{\partial}{\partial y} + \hat{\bm{z}} \frac{\partial}{\partial z}. \] From these equations, we see that, when $\lambda \to 0$, $\tau$ and $\tau_W$ scale as $\lambda$, but $\tau_U$ scales as $\lambda^{5/3}$. Thus, $\alpha$ scales with a leading order of $\lambda^{-2/3}$ in this limit. When $\lambda \to \infty$, $\alpha$ can either scale as $\lambda^{4/3}$ or $\lambda^{-2/3}$. Examples and analysis of both scaling limits are given in supplemental material B Due to the $\tau_r$ constant in the denominator of $\tilde\alpha$ (Eq. \ref{eq:tildealpha}), the leading order behavior of the regularized $\tilde \alpha$ under non-uniform scaling, with $\lambda \to 0$, is $\lambda$. Then, whereas $\alpha$ tends to infinity in the $\lambda \to 0$ limit, $\tilde \alpha$ tends to zero. $\tilde \alpha$ has the correct leading-order behavior in the limit $\lambda \to \infty$, which can be a single-orbital limit where exact constraints, including the finite exchange and correlation energies under the nonuniform coordinate scaling, were built for SCAN. In Ref. \cite{Furness2021a}, we proposed an alternative regularization of $\alpha$ to restore these constraints, \begin{equation} \bar{\alpha} = \frac{\tau - \tau_W}{\tau_U + \eta\tau_W} = \frac{\alpha}{1 + \eta \frac{5}{3}p}, \label{eq:alphabar} \\ \end{equation} where $\eta$ is a regularization parameter to be determined later. Clearly, $\bar\alpha$ has the correct behavior, $\bar\alpha(\bm{r})\to \bar\alpha(\lambda\bm{r})$ under uniform coordinate scaling. This regularization eliminates the asymptotic region ($|\bm{r}|\to\infty$) divergence and, by Eq. (\ref{eq:tauwlim}), does not change the uniform density limit, \begin{equation} \lim_{|\nabla n|\to 0} \bar\alpha = 1. \end{equation} The nonuniform coordinate scaling of $\bar\alpha$ is also maintained as $\lambda^{-2/3}$ to leading order in the $\lambda \to 0$ limit. But, for $\lambda \to \infty$, the leading-order term of $\bar\alpha$ is independent of $\lambda$, for non-homogeneous densities. This is demonstrated in supplemental material B Figure \ref{fig:alpha_comp} shows a comparison of $\alpha$, $\alpha^\prime$, and $\bar{\alpha}$ for the krypton atom. The divergence of the conventional $\alpha$ is apparent in the asymptotic region, while $\alpha^\prime$ and $\bar{\alpha}$ decay to 0. Close to the nucleus, the $\alpha_r$ regularization constant causes $\alpha^\prime$ to behave differently to $\alpha$ and $\bar{\alpha}$, but otherwise all three indicators behave similarly. \begin{figure}[t] \centering \includegraphics[width=0.45\textwidth]{Comparing_alpha.pdf} \caption{\label{fig:alpha_comp} Comparison between the conventional $\alpha$ (e.g. from SCAN), $\alpha^\prime$ (from rSCAN), and the new $\bar{\alpha}$ as a function of distance from the Kr nucleus (in Bohr radii) computed from accurate spherical Hartree--Fock Slater type orbitals \cite{Clementi1974, Furness2021a}. Regularization parameters are $\tau_r = 10^{-4}$ and $\alpha_r = 10^{-3}$ in $\alpha^\prime$, and $\eta = 10^{-3}$ in $\bar{\alpha}$.} \end{figure} Substituting $\bar\alpha$ for $\alpha^\prime$ in rSCAN is sufficient to restore the uniform density limit and coordinate scaling behaviors, and we refer to rSCAN with this replacement as ``r++SCAN'' throughout. \subsection{Gradient expansions\label{sec:gradexp}} The interpolative design of SCAN allows construction of the single-orbital ($\epsilon^0$) and slowly-varying ($\epsilon^1$) energy densities that consider only the exact constraints relevant to their respective limits. In SCAN, the interpolation function is a piece-wise combination of two exponential terms, \begin{equation} f_\mr{x/c}(\alpha) = \begin{cases} \exp[\frac{-c_{1\mr{x/c}}\alpha}{1 - \alpha}] & \alpha \leq 1 \\ -d_\mr{x/c}\exp[\frac{c_{2\mr{x/c}}}{1 - \alpha}] & \alpha > 1, \end{cases} \label{eq:scanf} \end{equation} where $\{d_{\mr{x/c}}, c_\mr{1x/c}, c_\mr{2x/c}\}$ are separate parameters for exchange and correlation determined by fitting to appropriate norms \cite{Sun2015}. This function was chosen such that: 1) $f(\alpha = 0) = 1$ exclusively selects $\epsilon^0$ for single-orbital densities, 2) $f(\alpha = 1) = 0$ exclusively selects $\epsilon^1$ in slowly-varying densities, and 3) \begin{equation} \left.\frac{df(\alpha)}{d\alpha}\right |_{\alpha \to 1} = \left.\frac{d^2f(\alpha)}{d\alpha^2}\right |_{\alpha \to 1} = 0,\label{eq:interp_const} \end{equation} which prevents $\epsilon^0$ contributing to the slowly-varying density gradient expansions to the 4th order in $|\nabla n|$. Note $\left.\frac{d^mf(\alpha)}{d\alpha^m}\right |_{\alpha \to 1} = 0$ with $m$ to be any integer in Eq. \ref{eq:scanf} by design. While theoretically convenient, Eq. \ref{eq:scanf} introduces a twist into the function around $\alpha = 1$, see Figure \ref{fig:iefcomp}. This twist destroys the overall smoothness of the functional, introduces oscillations into the XC potential \cite{Yang2016, Bartok2019}, and harms its performance on numerical integration grids. The rSCAN functional uses a smooth polynomial interpolation function in place of the SCAN piece-wise exponential for the range $0 \leq \alpha^{\prime} < 2.5$, \begin{equation} f(\alpha^\prime) = \begin{cases} \sum_{i=0}^7c_{i}\alpha^{\prime \, i} & 0 \le \alpha^\prime \leq 2.5 \\ -d_\mr{x/c}\exp[\frac{c_{2\mr{x/c}}}{1 - \alpha^\prime}] & \alpha^\prime > 2.5 \end{cases},\label{eq:rscan_f} \end{equation} where $\{c_i\}$ are polynomial coefficients determined to smoothly join $f^\mr{SCAN}(\alpha^\prime)$ at $\alpha^\prime = 0$ and $2.5$, see Ref. \citenum{Bartok2019}. A comparison of the two interpolation functions is shown in Figure \ref{fig:iefcomp}. While this replacement smooths the XC energy density and potential, it breaks the third constraint on the interpolation function, and hence $\epsilon^0$ makes spurious contributions to the slowly-varying gradient density expansion of $\epsilon^1$. Here, we restore the correct expansions by directly subtracting the extra terms that result from breaking the third condition (Eq. (\ref{eq:interp_const})) around $p \to 0$ and $\alpha \to 1$ where the expansion is relevant. \begin{figure} \centering \includegraphics[width=0.45\textwidth]{Interpolation_Comparison.pdf} \caption{The exchange (solid) and correlation (dashed) interpolation functions for the SCAN (blue, Eq. \ref{eq:scanf}) and rSCAN (orange, Eq. \ref{eq:rscan_f}) functionals.} \label{fig:iefcomp} \end{figure} The exact gradient expansion for exchange around the slowly-varying density limit to the 2nd order (GE2X) and to the 4th order (GE4X) was derived in terms of the exchange enhancement factor $F_\mr{x}$ in Refs. \cite{Kirzhnits1957, Svendsen1996} as, \begin{equation} \lim_{|\nabla n|\to 0} F_{\mr{x}}^{\mr{GE}} = 1 + \mu p + \frac{146}{2025}\tilde q^2 - \frac{73}{405}p\tilde q + \mo{6}, \label{eq:GE_x} \end{equation} where $\mu = 10/81$ and $\tilde q = (9/20)(\bar\alpha - 1) + (\eta 3/4 + 2/3)p$ recovers the reduced density Laplacian at $|\nabla n| \to 0$. The gradient expansion for correlation was derived to the 2nd order (GE2C) in Ref. \cite{Ma1968,Wang1991,Perdew1996,Sun2015} as, \begin{equation} \varepsilon_{\mr{c}} = \varepsilon_{\mr{c}}^{\mr{LSDA}} + \beta(r_{\mathrm{s}})\phi(\zeta)^3 t(r_{\mathrm{s}}, \zeta, p)^2 + \mo{4}, \end{equation} where $\phi(\zeta) = [(1 + \zeta)^{2/3} + (1 - \zeta)^{2/3}]/2$ and $t(r_{\mathrm{s}}, \zeta, p) = (3\pi^2/16)^{1/3} \sqrt{p/r_{\mathrm{s}}}/\phi(\zeta)$. We will restore each expansion to r++SCAN in turn. \subsubsection{Exchange} The SCAN exchange enhancement factor for a spin-unpolarized system is, \begin{align} F_\mr{x}^{\mr{SCAN}}&(p,\alpha) \\ &= \left\{h_{\mr{1x}}(p, \alpha) + f_\mr{x}(\alpha)\left[h_{0\mr{x}} - h_{\mr{1x}}(p,\alpha)\right ]\right\} g_\mr{x}(p),\nonumber \\ g_\mr{x}(p) &= 1 - \exp[-a_1p^{-1/4}], \\ h_{\mr{0x}} &= 1 + \kappa_0 = 1.174, \\ h_\mathrm{1x}(p,\alpha) &= 1 + \kappa_1 - \frac{\kappa_1}{1 + \frac{x(p,\alpha)}{\kappa_1}},\\ x(p, \alpha) &= \mu p\left[1 + \left(\frac{b_4p}{\mu}\right)\exp\left(\frac{-|b_4|p}{\mu}\right)\right] \nonumber\\ &+ \left\{b_1 p + b_2(1 - \alpha)\exp\left[-b_3(1 - \alpha)^2\right]\right\}^2, \label{eq:scan_x(pa)} \end{align} where $\mu = 10/81$ and $\{b_1, b_2, b_3, b_4\}$ are chosen such that SCAN yields GE2X and GE4X, noting that the expansion of $g_\mr{x}(p)$ around $p=0$ has only zero-order contributions (see supplemental material A 3) In rSCAN, the interpolation function derivatives are non-zero at $\bar\alpha = 1$, so $h_\mr{0x}$ also contributes to the gradient expansion. This changes the functional's gradient expansion, spoiling the correct gradient expansion of the $x(p,\alpha)$ inherited from SCAN. Thus both rSCAN and r++SCAN fail to recover GE2X and GE4X. We restore GE2X to give the r\tss{2}SCAN\xspace exchange functional by redesigning $x(p,\alpha)$ as, \begin{equation} x(p) = \left(C_\eta C_{2\mr{x}} \exp[-p^2/d_{p2}^4] + \mu\right)p, \label{eq:x_change} \end{equation} where $C_\eta$ and $C_{2\mr{x}}$ are constants set to cancel spurious contributions from $h_{\mr{0x}}$ to the 2nd order in $\nabla n$. The restoring constants are multiplied by the damping function $\exp[-p^2/d_{p2}^4]$ to prevent them dominating as $p$ becomes large. The damping parameter $d_{p2}$ derives from scaling the reduced density gradient as $s \to s/d_{p2}$ with $d_{p2}$ fit to recover the appropriate norms in Section \ref{sec:settingParams}. To find $C_\eta$ and $C_{2\mr{x}}$ we take the Taylor expansion of the rSCAN interpolation function (Eq. \ref{eq:rscan_f}) around $\bar\alpha = 1$, noting that $1-\bar\alpha$ is $\mo{2}$, \begin{align} \lim_{|\nabla n|\to0} &f^{\mr{rSCAN}}(\bar\alpha)\label{eq:lim_f} \\ &= -(1 - \bar{\alpha})\Delta f_2 + \frac{(1 - \bar{\alpha})^2}{2}\Delta f_4 + \mo{6}, \nonumber \end{align} where, \begin{align} \Delta f_\mathrm{2} &= \sum_{i=1}^7 ic_{i}, \label{eq:del_f2} \\ \Delta f_\mathrm{4} &= \sum_{i=2}^7i(i - 1)c_{i}, \end{align} are determined by the first and second derivatives of the interpolation function with respect to $\bar{\alpha}$ respectively. The $(1 - \bar\alpha)$ term of Eq. \ref{eq:lim_f} indicates a fixed slope for the $\bar\alpha$ dependence of the enhancement factor across the slowly-varying limit that is found to be numerically problematic, analyzed further in Section \ref{sec:numerics}. This can be avoided to second order by expressing $(1 - \bar\alpha)$ in terms of $p$ through an integration by parts on the exchange energy density \cite{Sun2015a}, \begin{equation} \lim_{|\nabla n|\to 0}(1 - \bar\alpha) = \left(\frac{20}{27} + \eta\frac{5}{3}\right)p + \mo{4}. \label{eq:oma_to_p} \end{equation} This substitution, derived and discussed in supplemental material A 2, is used in r$^2$SCAN and identifies, \begin{equation} C_\eta = \left(20/27 + \eta5/3\right). \label{eq:c_eta_expr} \end{equation} To second order the slowly-varying gradient expansion of r$^2$SCAN is then, \begin{equation} \lim_{|\nabla n|\to0} F_\mr{x}^{\mr{r^2SCAN}} = \lim_{|\nabla n|\to0} h_\mr{1x} - C_\eta p \Delta f_2\left (h_\mr{0x} - \lim_{|\nabla n|\to0}h_\mr{1x}\right). \end{equation} Finding, \begin{equation} \lim_{|\nabla n|\to0}h_\mr{1x} = 1 + \left(\mu + C_\eta C_{2\mr{x}}\right)p + \mo{4}, \end{equation} and collecting terms gives, \begin{align} \lim_{|\nabla n|\to0} &F_\mr{x}^{\mr{r^2SCAN}}\\ &= 1 + \mu p + C_\eta \left[ C_{2\mr{x}} - \Delta f_2 h_{\mr{0x}} + \Delta f_2 \right]p + \mo{4}, \nonumber \end{align} equating this to GE2X (second order and below terms of Eq. \ref{eq:GE_x}) and solving for $C_{2\mr{x}}$ gives, \begin{equation} C_{2\mr{x}} = -\Delta f_2(1 - h_\mr{0x}) \approx -0.162742, \label{eq:c_2x_expr} \end{equation} as shown in supplemental material A1 GE4X can be restored to give the ``r$^4$SCAN'' functional by including a further correcting term in the exchange enhancement factor outside the interpolation. This introduces three more constants, derived in supplemental material A 3, for all terms in Eq. \ref{eq:GE_x}: \begin{align} F_\mr{x}^\mr{r^4SCAN}(p, \bar{\alpha}) &= \left\{h_\mr{1x}(p) + f_\mr{x}(\bar{\alpha})\left [h_\mr{0x} - h_\mr{1x}(p)\right ] \right. \nonumber \\ & \left. +\Delta F_4(p,\bar{\alpha}) \right\} g_\mr{x}(p) \label{eq:full_delfx} \\ \Delta F_4(p,\bar{\alpha}) &= \left\{C_{2\mr{x}}\left[(1-\bar{\alpha}) - C_\eta p\right] + C_{\bar{\alpha}\ba}(1-\bar{\alpha})^2 \right. \nonumber \\ & \left. +C_{p\bar{\alpha}}p(1-\bar{\alpha}) + C_{pp}p^2 \right\}\Delta F_4^{\mr{damp}}(p,\bar{\alpha}) \\ \Delta F_4^{\mr{damp}}(p,\bar{\alpha}) &= \frac{2\bar{\alpha}^2}{1+\bar{\alpha}^4} \exp\left[-\frac{(1-\bar{\alpha})^2 }{d_{\bar{\alpha} 4}^2} - \frac{p^2}{d_{p4}^4}\right] \label{eq:delf4}\\ C_{\bar{\alpha}\ba} &= \frac{73}{5000} - \frac{\Delta f_4}{2}[h_\mr{0x}-1] \approx -0.0593531 \label{eq:c_ba_ba}\\ C_{p\bar{\alpha}} &= \frac{511}{13500} - \frac{73}{1500}\eta - \Delta f_2[C_\eta C_{2\mr{x}} + \mu] \nonumber \\ & \approx 0.0402684 \label{eq:c_p_ba}\\ C_{pp} &= \frac{146}{2025}\left\{\eta\frac{3}{4} + \frac{2}{3}\right\}^2 - \frac{73}{405}\left\{\eta\frac{3}{4} + \frac{2}{3}\right\} \nonumber \\ & + \frac{\left(C_\eta C_{2\mr{x}} + \mu\right)^2}{k_1} \approx -0.0880769. \label{eq:c_p_p} \end{align} Further damping functions, $\Delta F_4^{\mr{damp}}$, are included to prevent the correction terms dominating as $(1 - \bar\alpha)$ and $p$ become large, introducing $d_{\bar\alpha 4}$ and $d_{p4}$ as additional parameters. These are again set to recover the appropriate norms in Section \ref{sec:settingParams}. For the fourth order expansion, the integration by parts substitution of Eq. \ref{eq:oma_to_p} cannot be applied, and hence $(1 - \bar\alpha)$ cannot be removed. \subsubsection{Correlation} The SCAN model of the correlation energy per electron $\varepsilon_{\mr{c}} = \epsilon_{\mr{c}}/n$ is \begin{equation} \varepsilon_\mr{c}^{\mr{SCAN}} = \varepsilon_\mr{c}^1 + f_\mr{c}^{\mr{SCAN}}(\alpha)\left[\varepsilon_\mr{c}^0 - \varepsilon_\mr{c}^1\right], \end{equation} with the $\alpha=0$ correlation energy per electron given by \begin{align} \varepsilon_\mr{c}^0 &= \left(\varepsilon_\mr{c}^\mr{LDA0} + H_\mr{c}^0\right)g_\mr{c}(\zeta), \\ \varepsilon_\mr{c}^\mr{LDA0} &= -\frac{b_{1\mr{c}}}{1 + b_{2\mr{c}}\sqrt{r_{\mathrm{s}}} + b_{3\mr{c}}r_{\mathrm{s}}}, \\ H_\mr{c}^0 &= b_{1\mr{c}}\ln\{1 + w_0[ 1 - g_\infty(p)]\}, \\ w_0 &= \exp[-\varepsilon_\mr{c}^{\mr{LDA0}}/b_{1\mr{c}}] - 1, \\ g_\infty(p) &= (1 + 4\chi_\infty p)^{-1/4},\\ g_\mr{c}(\zeta) &= \{ 1 - 2.3631[d_\mr{x}(\zeta) - 1]\}(1 - \zeta^{12}), \end{align} with $d_\mr{x}(\zeta) = [(1 + \zeta)^{4/3} + (1 - \zeta)^{4/3}]/2$. Similarly, the $\alpha=1$ limit is given by \begin{align} \varepsilon_\mr{c}^{1} &= \varepsilon_\mr{c}^{\mr{LSDA}} + H_1, \\ H_\mr{c}^1 &= \gamma\phi^3\ln\{ 1 + w_1[1 - g(y)]\}, \\ w_1 &= \exp\left[-\frac{\varepsilon_\mr{c}^{\mr{LSDA}}}{\gamma\phi^3}\right] - 1, \\ g(y) &= (1 + 4y)^{-1/4}, \\ y &= \frac{\beta(r_{\mathrm{s}})}{\gamma w_1}t^2, \\ \beta(r_{\mathrm{s}}) &= \beta_\mr{MB}\frac{1 + A r_{\mathrm{s}}}{1 + B r_{\mathrm{s}}}, \end{align} where $b_\mr{1c} = 0.0285764$, $b_\mr{2c} = 0.0889$, $b_\mr{3c} = 0.125541$, $\chi_\infty = 0.128026$ $\gamma = 0.0310907$, $\beta_{\mr{MB}} = 0.066725$, $A = 0.1$, and $B = 0.1778$. $\varepsilon_\mr{c}^\mr{LSDA}$ is the local spin-density approximation for correlation from Ref. \cite{Perdew1992a}. As r++SCAN takes the same correlation model, the violation of Eq. \ref{eq:interp_const} by the rSCAN interpolation function breaks GE2C. The GE2C correction terms are restored to r++SCAN by replacing $g(y)$ in $\epsilon_{\mr{c}}^1$ with, \begin{align} g(y, \Delta y) =& \left [1 + 4(y - \Delta y)\right ]^{-1/4}, \label{eq:g(y_dy)}\\ \Delta y =& \frac{C_{2\mr{c}}}{27 \gamma d_s(\zeta) \phi^3 w_1} \left\{20r_{\mathrm{s}}\left[g_\mr{c}(\zeta)\frac{\partial \varepsilon_c^{\text{LDA0}}}{\partial r_{\mathrm{s}}} - \frac{\partial \varepsilon_c^{\text{LSDA}}}{\partial r_{\mathrm{s}}} \right] \right. \nonumber \\ & \left. - 45\eta\left[\varepsilon_c^{\text{LDA0}}g_\mr{c}(\zeta) - \varepsilon_c^{\text{LSDA}}\right] \vphantom{\frac{\partial \varepsilon_c^{\text{LSDA}}}{\partial r_{\mathrm{s}}}} \right\} p \exp[-p^2/d_{p2}^4] \label{eq:del_y} \end{align} where the damping function $\exp[-p^2/d_{p2}^4]$ is the same as in Eq. \ref{eq:x_change}. Similarly to exchange, we restore the second order slowly-varying density gradient expansion when, \begin{equation} C_{2\mr{c}} = \Delta f_2 \approx -0.711402. \end{equation} The derivation of this expression is shown in supplemental material A 4 Making these replacements to r++SCAN gives the ``r$^{2}$SCAN'' functional which only breaks GE4X. Including the full correction of Eq. \ref{eq:full_delfx} gives the ``r$^4$SCAN'' functional, which obeys all the exact constraints SCAN does. For convenience, a collected definition of the working equations for all new functionals is given in supplemental material C \subsubsection{Summary of Changes} Here, we summarize the changes made from SCAN for each of the functionals. \begin{enumerate} \item{rSCAN replaces $\alpha$ with $\alpha^\prime$, which contains two regularization parameters, $\tau_r=10^{-4}$ and $\alpha_r = 10^{-3}$. It also replaces the SCAN interpolation function with a polynomial between $0 \leq \alpha^\prime \leq 2.5$.} \item{r++SCAN evolves from rSCAN, by replacing $\alpha^\prime$ with $\bar\alpha$ that uses only a single regularization parameter, $\eta = 0.001$.} \item{r$^2$SCAN inherits all the changes of r++SCAN. Additionally, for exchange, it replaces $x(p, \alpha)$ in $h_{1\mr{x}}$ with Eq. \ref{eq:x_change}. For correlation, it replaces $g(y)$ with Eqs. \ref{eq:g(y_dy)} and \ref{eq:del_y} in $\epsilon_\mr{c}^1$.} \item{r$^4$SCAN inherits all the changes from r$^2$SCAN. Additionally, for exchange, it replaces $F_\mr{x}$ with Eq. \ref{eq:full_delfx}, which introduces $\Delta F_4$ of Eq. \ref{eq:delf4}.} \end{enumerate} \section{\label{sec:numerics}Numerical Challenges} The corrections to restore the slowly-varying density gradient expansions for exchange and correlation contain terms linear in $(1 - \bar\alpha)$. These terms are necessary to restore the 2nd or 4th order gradient expansion, for example, of Eq. \ref{eq:GE_x} for exchange, if the integration in parts is not used as we did for r\tss{2}SCAN\xspace in Eq. \ref{eq:oma_to_p}. These corrections inevitably twist the slope of the interpolation function $f(\bar\alpha)$ to that of $F_{\mr{x}}^{GE}$ with respect to $\bar\alpha$ around $\bar\alpha \to 1$ as $|\nabla n|\to 0$, illustrated in Fig. \ref{fig:fx_osc}. This introduces oscillations into the derivatives of the enhancement factor with respect to $\bar\alpha$, and hence into the overall exchange-correlation potential. Such oscillations are undesirable and reintroduce the numerical problems rSCAN regularizes away. As the gradient expansion constraint requires \begin{equation} \left.\frac{\partial F_{\mr{x}}}{\partial \bar\alpha}\right|_{\bar\alpha = 1, p = 0} \propto \left.\frac{df(\bar\alpha)}{d\bar\alpha}\right|_{\bar\alpha = 1}, \end{equation} this oscillation in derivatives must be present, at least in the interpolation scheme discussed here, and cannot be removed by damping. Figure \ref{fig:fx_osc}, compares uncorrected exchange enhancement, $d_{\bar\alpha 4} \to 0$, the exchange enhancement with no damping on the correction terms, $d_{\bar\alpha 4} \to \infty$, and the $d_{\bar\alpha 4} = 0.178$ determined in Section \ref{sec:settingParams}, showing this effect. \begin{figure} \centering \includegraphics[width=0.45\textwidth]{fx_kink_annotated.pdf} \caption{a) Exchange enhancement factor for r$^4$SCAN as a function of $\bar\alpha$ at $p = 0$. The uncorrected enhancement with $d_{\bar\alpha 4} \to 0$ (red) is contrasted against the un-damped corrections with $d_{\bar\alpha 4} \to \infty$ (black), the proposed r$^4$SCAN damping of $d_{\bar\alpha 4} = 0.178$ (dashed, dark red). b) Derivative of the exchange enhancement with respect to $\bar\alpha$ at $p = 0$ for the same conditions.} \label{fig:fx_osc} \end{figure} These numerical problems are not present in r$^2$SCAN, as the corrections do not depend upon $(1-\bar{\alpha})$. Thus, the corresponding oscillation in derivative is avoided, allowing r$^2$SCAN to recover GE2X and GE2C whilst maintaining a smooth potential. As the integration by parts is not possible to fourth order, r$^4$SCAN necessarily suffers an oscillatory XC potential in order to recover GE4X. \section{\label{sec:settingParams} Determining parameters} The regularization of the $\bar\alpha$ indicator in r++SCAN, r$^2$SCAN, and r$^4$SCAN is controlled by the parameter $\eta$, with larger values increasing regularization strength. We find performance is largely insensitive to $\eta$ within the range of $0 \le \eta \le 0.001$ and take the upper value of $\eta = 0.001$. We introduce a single damping parameter, $d_{p2}$, in r$^2$SCAN through Eqs. \ref{eq:x_change} and \ref{eq:del_y}, and set it using the appropriate norms philosophy of the SCAN functional. The parameter was chosen to minimize the sum of the mean absolute percentage errors in XC energy for four rare gas atoms: Ne, Ar, Kr, and Xe (evaluated for spherical Hartree--Fock orbitals \cite{Clementi1974} relative to \cite{Becke1988, Chakravorty1993, McCarthy2011} reference energies), and four jellium surface formation energies with $r_{\mathrm{s}} =$ 2, 3, 4, and 6 bohr (relative to reference energies from Ref. \cite{Wood2007}). As the parameters are not fit to any bound systems, we regard the resulting functionals as non-empirical. Objective error as a function of damping parameter, $d_{p2}$, is shown in Figure \ref{fig:d2_Set}. Setting the damping parameter too high degrades accuracy for the rare gas atoms (while mildly improving the jellium surface formation energies) as the gradient expansion terms dominate too far from $|\nabla n| \to 0$. Conversely, setting $d_{p2}$ too small degrades accuracy for the jellium surfaces, as the second order gradient expansion is not sufficiently corrected. As a sharper damping function causes sharper features in XC potential, we take the largest value for $d_{p2}$ which meets the accuracy threshold defined by SCAN: a mean absolute percentage error (MAPE) of $0.1\%$ for rare gas XC energies and $5\%$ for jellium surfaces. The optimizing value is found as $d_{p2} = 0.361$. \begin{figure} \centering \includegraphics[width=0.45\textwidth]{d2_paper_plot_fix.pdf} \caption{The mean absolute percentage error for (left axis, blue) the exchange-correlation energies of Ne, Ar, Kr, Xe \cite{Becke1988, Chakravorty1993, McCarthy2011}, and (right axis, red) the exchange-correlation jellium surface energy for $r_{\mathrm{s}} = \{2,3,4,6\}$ \cite{Wood2007} as a function of second order gradient expansion damping parameter $d_{p2}$ for r\tss{2}SCAN\xspace. The optimal value is chosen as the largest for which the rare gas error is $< 0.1\%$ and the jellium error is $< 5\%$.} \label{fig:d2_Set} \end{figure} \begin{figure}[h!] \centering \includegraphics[width=0.36\textwidth]{fourth_order_fitting.pdf} \caption{Mean absolute percentage error in rare gas XC energy (upper) and jellium surface exchange-correlation energy (lower) as a function of damping parameters $d_{\bar\alpha 4}$ and $d_{p4}$. Optimal parameters are identified by the white circled cross at $d_{p4} = 0.802, d_{\bar\alpha 4} = 0.178$.} \label{fig:setting_r4_params} \end{figure} Two additional parameters are introduced in r$^4$SCAN that control damping of the fourth-order gradient expansion terms. These were determined similarly as those which minimize a normalized sum of the rare gas and jellium surface mean absolute percentage errors. The minimizing parameters were found as $d_{\bar\alpha 4} = 0.178$ and $d_{p4} = 0.802$, as shown in Figure \ref{fig:setting_r4_params}. \section{\label{sec:results} Results} \subsection{Enhancement Factors and Derivatives\label{sec:Xe_osc}} An important principle in functional design is to take an ``Occam's razor'' approach and determine a functional that is free of twists and kinks. In this way the functional avoids over-fitting to data and ensures smooth functional derivatives that are easy to render on numerical grids. Figure \ref{fig:Xe_derivatives} compares the XC enhancement factors of SCAN, r$^2$SCAN, and r$^4$SCAN for the Xenon atom. The SCAN enhancement factor shows sharp plateau like regions from the twists in its interpolation function around $\alpha = 1$. The smooth polynomial interpolation function removes these plateaus from r$^2$SCAN, though some twists are re-introduced in r$^4$SCAN by the $(1 - \bar\alpha)$ terms in the GE4X restoration. The effect of twists in $F_\mr{xc}$ can be seen in the semi-local and non-local XC potential components of the XC potential, shown in Figure \ref{fig:Xe_derivatives}. The SCAN functional shows sharp oscillations around $\alpha = 1$ points and sharp drops in its non-local component. In contrast, the r\tss{2}SCAN\xspace functional is a smooth function of its ingredients, and hence has smooth semi-local and non-local components to its XC potential. While the potential components of r\tss{2}SCAN\xspace and r$^4$SCAN coincide for much of space they differ significantly around $\bar{\alpha} = 1$ points. Here the $(1-\bar\alpha)$ correction terms in r$^4$SCAN required for GE4X cause sharp oscillations that return the oscillatory behavior we aim to remove. As these terms cannot be removed by partial integration to the 4th order in $\nabla n$, we therefore conclude that GE4X is incompatible with functional smoothness under the present SCAN interpolation-based model: one must either twist the interpolation function to enforce Eq. \ref{eq:interp_const}, or include correcting terms that re-introduces oscillatory factors. \begin{figure}[h] \centering \includegraphics[width=0.45\textwidth]{Paper_potentials_Xe.pdf} \caption{The XC enhancement factor (top), the multiplicative component of the XC potential (middle), and the non-local component, i.e., the derivative of the XC energy density with respect to the orbital dependent kinetic energy density, $\tau$ (bottom) in the Xe atom. Shown for the SCAN, r\tss{2}SCAN\xspace, and r$^4$SCAN functionals, calculated from reference Hartree--Fock Slater orbitals \cite{Clementi1974, Furness2021a}. Points where $\alpha = 1$ are shown by black vertical lines.} \label{fig:Xe_derivatives} \end{figure} \subsection{Appropriate Norms} An appropriate norm is defined in Ref. \cite{Sun2015} as ``systems for which semilocal functionals can be exact or extremely accurate''. Here, like SCAN, we take these as the exchange and correlation energies of four rare gas atoms (Ne, Ar, Kr, and Xe), the exchange and correlation surface energies of four jellium slabs ($\overline{r_{\mathrm{s}}}=$ 2, 3, 4, and 6), and the interaction energy of Ar\mol{2} at repulsive inter-atomic distances ($R_{\mr{Ar-Ar}} =$ 1.6, 1.8, and 2.0 \AA). Table \ref{tab:norms} compares the accuracy of SCAN, rSCAN, r++SCAN, r$^2$SCAN, and r$^4$SCAN for the appropriate norms. Care must be taken when computing the jellium surface energy for rSCAN as the uniform bulk density energy is changed by the $\alpha^\prime$ regularization. To evaluate the exchange-correlation contribution to the jellium surface formation energy, we compute \cite{Lang1970} \begin{equation} \sigma_\mr{xc}(\overline{r_{\mathrm{s}}}) = \int_{-\infty}^{\infty} [\varepsilon_\mr{xc}(n,\nabla n, \tau) - \varepsilon_\mr{xc}(\overline{n},0,\overline{\tau_U}) ]n(x) dx, \end{equation} where $\overline{r_{\mathrm{s}}} = (4\pi \overline{n}/3)^{-1/3}$ is the density parameter of the corresponding bulk jellium, and $\overline{\tau_U} = 3(3\pi^2)^{2/3}\overline{n}^{5/3}/10$ is its kinetic energy density. Here, we have assumed that the surface lies along the $x$ direction. This ensures that the uniform density limit of a given functional is used, regardless of whether that uniform limit is the LSDA. Building upon our previous example of the valence density in solid sodium: when $r_{\mathrm{s}}=4$, the rSCAN exchange uniform density limit is \[ \epsilon_\mr{x}^\mr{rSCAN}(\overline{n},0,\overline{\tau_U})\bigg|_{\overline{r_{\mathrm{s}}}=4} \approx 1.051 \epsilon_\mr{x}^\mr{LDA}(\overline{r_{\mathrm{s}}}), \] making a substantial error over LDA exchange. For $\overline{r_{\mathrm{s}}}=6$, this error is increased to roughly 14\%. The importance of recovering the second order gradient expansion is seen in the relative accuracy of the functionals for the rare gas atoms. The two functionals which do not recover the gradient expansions (rSCAN and r++SCAN) have MAPEs of $\approx 0.25\%$ whereas the functionals that do have MAPEs of $\approx 0.1\%$. Restoring the fourth order gradient expansion for exchange improves accuracy further, though r$^2$SCAN already has similar accuracy to SCAN for all the appropriate norms suggesting GEX4 is less important for these systems. Outside of these differences, all functionals performed similarly for the appropriate norm systems. \begin{table*} \centering \caption{Accuracy for appropriate norms. Rare gas and jellium surface exchange-correlation energies given in Hartrees ($E_h$), Ar\mol{2} interaction energies in kcal/mol. Benchmark data for rare gas atom exchange-correlation, jellium surface exchange-correlation, and Ar\mol{2} interaction energy are from Refs. \cite{Becke1988, Chakravorty1993, McCarthy2011}, \cite{Wood2007}, and \cite{Patkowski2005} respectively. Error summaries are given as mean absolute percentage errors (MAPE). Full calculation details in main text.\label{tab:norms}} \input{./norms_table} \end{table*} \subsection{Atomization Energies} The work of Ref. \cite{Mejia-Rodriguez2019} shows the performance of rSCAN is relatively poor for atomization energy prediction, as measured by its increased error for the G3 test set of molecules \cite{Curtiss2000}. Table \ref{tab:G3_stats} compares the errors for this test set for all the functionals derived above. Consistent with Ref. \cite{Mejia-Rodriguez2019} we find a large error from rSCAN, with this error only slightly corrected in r++SCAN. As in Ref. \citenum{Furness2020c}, restoration of GE2X and GE2C in r$^2$SCAN restores the good accuracy of SCAN, showing the importance of these constraints for atomization energies. The good accuracy of r$^2$SCAN suggests that recovering GE4X is not essential for accurately predicting atomization energies. \begin{table} \centering \caption{Summary of atomization energy errors (in kcal/mol) for the G3 test set \cite{Curtiss2000} using the most dense numerical integration grid (\textsc{Turbomole} level 7).} \begin{tabular}{l|rrrrr} & SCAN & rSCAN & r++SCAN & r$^2$SCAN & r$^4$SCAN \\ \hline ME & -5.036 & -14.010 & -12.912 & -5.042 & -6.939 \\ MAE & 6.121 & 14.258 & 13.239 & 5.866 & 7.716 \end{tabular} \label{tab:G3_stats} \end{table} The improved numerical performance of the functionals is illustrated by examining the convergence of atomization energy predictions as a function of numerical grid density, as shown in Figure \ref{fig:G3_progression}. The original SCAN functional shows wild variation with changing grid density, with a range of over 6 kcal/mol in mean absolute error! While there is some indication that a convergence is approached for the most dense grids, the results from more computationally efficient grids are problematic and clearly untrustworthy. All four regularized functionals show very fast grid convergence, with all sparse grids giving close agreement to the dense grids. Given the sharp oscillations in Figure \ref{fig:Xe_derivatives} and analysis of Section \ref{sec:numerics}, it is somewhat unexpected that r$^4$SCAN shows good convergence with grid density. We attribute the improved performance over SCAN to the reduction in plateau like behavior of $F_\mr{xc}$ but caution that grid convergence behavior will likely be more system dependent for r$^4$SCAN than r++SCAN and r$^2$SCAN as a result of the oscillations. It is similarly unexpected to find that the accuracy of r\tss{2}SCAN\xspace is degraded by the inclusion of the GE4X in r$^4$SCAN. This supports our previous conclusion that GE4X is not important for the properties tested here and elsewhere\cite{Ehlert2021b, Grimme2021}. We take the mild degradation of G3 accuracy from extending to r$^4$SCAN as further evidence that this method of including GE4X into interpolation based meta-GGA functionals is problematic. The inclusion of two additional fitting parameters beyond those in r\tss{2}SCAN\xspace may also contribute. \begin{figure} \centering \includegraphics[width=0.45\textwidth]{G3_Updated.pdf} \caption{Mean absolute percentage error of atomization energies (kcal/mol) for the G3 set of 226 molecules \cite{Curtiss2000} as a function of increasing numerical integration grid density expressed relative to the smallest grid. The grids chosen were defined by the default \textsc{Turbomole} grid levels. The mean number of grid points per atom over the G3 set is about 1,326 for the smallest (gridsize=1) and 53,590 for the largest (gridsize=7) grid shown here. } \label{fig:G3_progression} \end{figure} \subsection{Further Testing} Beyond atomization energies, we have tested the accuracy of the progression of SCAN-like functionals for the interaction energies of closed shell complexes (S22)\cite{Jurecka2006} and reaction barrier heights (BH76)\cite{Zhao2005}, summarized in Table \ref{tab:S22_BH76}. Additionally, Table \ref{tab:LC20_table} summarizes accuracy for the LC20 set of lattice constants for solids \cite{Sun2011}, obtained by fitting the stabilized jellium equation of state \cite{Staroverov2004} to single point energy calculations at a range of lattice volumes. All five functionals gave comparable good accuracy across all three test sets, showing that SCAN's good performance is not significantly changed by the regularizations or exact constraint restoration for these properties. \begin{table} \caption{Mean error (ME) and Mean absolute error (MAE) of SCAN\cite{Sun2015}, rSCAN\cite{Bartok2019}, r++SCAN, r\tss{2}SCAN\xspace\cite{Furness2020c}, and r$^4$SCAN for the S22 set of 22 interaction energies between closed shell complexes\cite{Jurecka2006}, and the BH76 set of 76 chemical barrier heights\cite{Zhao2005}. Full data is presented in supplemental material Tables VI and VII. All calculations use the most dense integration grid (\textsc{Turbomole} level 7).} \label{tab:S22_BH76} \centering \begin{tabular}{cc|rrrrr} & & SCAN & rSCAN & r++SCAN & r$^2$SCAN & r$^4$SCAN \\ \hline \multirow{2}{*}{S22} & ME & -0.524 & -1.153 & -0.554 & -0.937 & -0.874 \\ & MAE & 0.786 & 1.273 & 0.846 & 1.057 & 1.015 \\ \hline \multirow{2}{*}{BH76} & ME & -7.653 & -7.365 & -7.488 & -7.125 & -7.463 \\ & MAE & 7.724 & 7.434 & 7.556 & 7.182 & 7.527 \\ \end{tabular} \end{table} \begin{table} \caption{Error in lattice constant prediction for the LC20 lattice constant test set \cite{Sun2011}. Errors are in $\text{\AA}$ relative to zero-point anharmonic expansion corrected experimental data from Ref. \cite{Hao2012}. Lattice constants were obtained by fitting the stabilized jellium equation of state \cite{Staroverov2004} to single point energy calculations at a range of lattice volumes.} \label{tab:LC20_table} \centering \begin{tabular}{c|rrrrr} \hline \hline & SCAN & rSCAN & r++SCAN & r$^2$SCAN & r$^4$SCAN \\ \hline Ag & 0.012 & 0.028 & 0.026 & 0.034 & 0.017 \\ Al & -0.012 & -0.027 & -0.031 & -0.032 & -0.014 \\ Ba & 0.049 & 0.100 & 0.046 & 0.076 & 0.062 \\ C & -0.004 & -0.001 & -0.001 & 0.005 & 0.002 \\ Ca & -0.009 & 0.017 & -0.011 & 0.018 & 0.016 \\ Cu & -0.030 & -0.023 & -0.025 & -0.020 & -0.027 \\ GaAs & 0.020 & 0.031 & 0.026 & 0.029 & 0.017 \\ Ge & 0.029 & 0.043 & 0.038 & 0.039 & 0.028 \\ Li & 0.011 & 0.021 & 0.006 & 0.016 & 0.010 \\ LiCl & 0.016 & 0.021 & 0.017 & 0.034 & 0.032 \\ LiF & 0.004 & 0.008 & 0.008 & 0.021 & 0.020 \\ MgO & 0.018 & 0.019 & 0.018 & 0.027 & 0.024 \\ NaCl & 0.010 & 0.025 & 0.015 & 0.036 & 0.036 \\ NaF & 0.006 & 0.015 & 0.012 & 0.028 & 0.028 \\ Na & -0.007 & 0.024 & -0.012 & 0.004 & 0.031 \\ Pd & 0.016 & 0.026 & 0.026 & 0.032 & 0.019 \\ Rh & -0.005 & 0.006 & 0.005 & 0.008 & -0.005 \\ Si & 0.005 & 0.012 & 0.009 & 0.018 & 0.016 \\ SiC & 0.002 & -0.001 & -0.002 & 0.006 & 0.007 \\ Sr & 0.039 & 0.064 & 0.019 & 0.056 & 0.095 \\ \hline ME & 0.009 & 0.020 & 0.009 & 0.022 & 0.021 \\ MAE & 0.015 & 0.025 & 0.017 & 0.027 & 0.025 \\ \hline \hline \end{tabular} \end{table} \section{\label{sec:conclusions} Conclusions} To summarize, we have shown how exact constraints obeyed by SCAN are broken by the regularizations in rSCAN. Through this analysis we have shown how the exact constraint adherence can be restored and how this can be achieved without sacrificing the good numerical performance of rSCAN. This results in three new functionals with increasing exact constraint adherence: r++SCAN, r$^2$SCAN, and r$^4$SCAN. Additional parameters introduced to the new functionals are set without reference to any real bonded systems, thus we can still regard the resulting functionals as non-empirical and expect them to be applicable to a wide range of systems. Figure \ref{fig:G3_progression} suggests that restoring GEX4 in r$^4$SCAN gives similar accuracy to SCAN with some improvement in grid efficiency. We therefore expect the new r$^2$SCAN functional to remain the preferred choice for situations where the accuracy of SCAN is desired but its use is prohibited by poor numerical performance \cite{Kingsbury2021,Ning2021}. Further improvement over r\tss{2}SCAN\xspace might be achieved by a smoother and fuller incorporation of the fourth-order density-gradient terms for the exchange energy in a SCAN-like functional. Work on this is underway. Figure \ref{fig:G3_progression} shows that rSCAN and r++SCAN, which lose the correct second-order gradient expansions for densities that vary slowly over space, also lose accuracy for atomization energies of molecules, and that the restoration of this limit in SCAN, r\tss{2}SCAN\xspace, and r\tss{4}SCAN\xspace also restores accurate atomization energies. This result is in line with arguments made in Ref. \cite{Kaplan2020}. Experience with SCAN and r\tss{2}SCAN\xspace (and with atomic densities \cite{Medvedev2017}) suggests that smoothness at fixed electron number could be elevated to the status of an 18$^{\text{th}}$ exact constraint that a meta-GGA can satisfy, or at least to the status of a construction principle: By Occam's Razor, the simplest assumption, consistent with what is known, should be preferred. \begin{acknowledgments} J.F., J.N., and J.S. acknowledge the support of the U.S. DOE, Office of Science, Basic Energy Sciences Grant No. DE-SC0019350. J.S. also acknowledges the support of the US National Science Foundation under Grant No. DMR-2042618. A.D.K. acknowledges the support of the U.S. Department of Energy, Office of Science, Basic Energy Sciences, through Grant No. DE-SC0012575 to the Energy Frontier Research Center: Center for Complex Materials from First Principles, and also support from Temple University. JPP acknowledges the support of the US National Science Foundation under Grant No. DMR-1939528. We thank Albert Bart\'ok-Partay and Daniel Mej\'ia-Rodr\'iguez for their invaluable discussions around the ideas presented here. J.P.P. and J.S. thank Natalie Holzwarth for pointing out that the SCAN exchange-correlation potential for an atom diverges in the tail of the density, making pseudo-potential construction difficult. \end{acknowledgments} \section*{Materials availability} r\tss{2}SCAN\xspace and r\tss{4}SCAN\xspace subroutines are made freely available at \url{https://gitlab.com/dhamil/r2scan-subroutines}. The data that support the findings of this study are available from the corresponding author upon reasonable request. \input{Restoring_rSCAN_bib} \input{SupMat} \end{document} \section*{Supplemental Material: Construction of meta-GGA functionals through restoration of exact constraint adherence to regularized SCAN functionals.} \end{widetext} \section{The slowly-varying limit of r\tss{2}SCAN\xspace and r\tss{4}SCAN\xspace \label{AP:exc_deriv}} This Appendix sketches the derivation of r\tss{2}SCAN\xspace and r\tss{4}SCAN\xspace. We will presume that both functionals have the structure of Eq. 1, where the interpolation functions $f_\mr{x/c}(\v{r})$, are taken from rSCAN. As discussed in the main text, this functional is termed r++SCAN\xspace. From the starting point of r++SCAN\xspace, we will derive the corrections needed to restore the second order gradient expansions for exchange and correlation (r\tss{2}SCAN\xspace), and those for the fourth-order gradient expansion for exchange (r\tss{4}SCAN\xspace). Thus r\tss{4}SCAN\xspace can be viewed as a correction to r\tss{2}SCAN\xspace exchange, and we begin with r\tss{2}SCAN\xspace. \subsection{The gradient expansion of $\bar{\alpha}$} The gradient expansion of $\tau[n]$, the one-body, spin-unpolarized kinetic energy density, was derived in Ref. \cite{Brack1976} \begin{equation} \tau[n] = \tau_U(n) + \frac{1}{6} \nabla^2 n + \frac{1}{72}\frac{|\nabla n|^2}{n} + \mo{4} \end{equation} (in Hartree atomic units). Here, $\mo{4}$ indicates that the next term in the series of higher order is of the form $|\nabla n|^4$, $\nabla^2 n\, |\nabla n|^2$, $(\nabla^2 n)^2$, etc. The gradient expansion is more useful in terms of dimensionless (length-scale invariant) variables \begin{align} p(n) &= \left[ \frac{|\nabla n|}{2 k_{\mr{F}}n}\right]^2 = \frac{3}{40}\frac{|\nabla n|^2}{\tau_U(n)n} \\ q(n) &= \frac{\nabla^2 n}{4 k^2_{\mr{F}}n} = \frac{3}{40}\frac{\nabla^2 n}{\tau_U(n)}, \end{align} where we have used \begin{align} \tau_U(n) &= \frac{3}{10}k_{\mr{F}}^2 n \\ k_{\mr{F}} &= (3 \pi^2 n)^{1/3}. \end{align} Then the gradient expansion of $\tau_{\sigma}$ can be cast as \begin{equation} \tau[n] = \tau_U(n)\left[1 + \frac{20}{9}q(n) + \frac{5}{27}p(n) \right] + \mo{4}. \end{equation} The integrated kinetic energy scales with the spin-densities in the same manner as the exchange energy \cite{Oliver1979} \begin{equation} T[n_{\uparrow},n_{\downarrow}] = \frac{1}{2}\{ T[2n_{\uparrow}]+T[2n_{\downarrow}]\}. \end{equation} This implies a local spin-scaling relation \begin{equation} \tau[n_{\uparrow},n_{\downarrow}] = \frac{1}{2}\{ \tau[2n_{\uparrow}]+\tau[2n_{\downarrow}] \}. \end{equation} We will seek a gradient expansion in terms of $n$ and $\zeta$, where \begin{equation} \zeta = \frac{n_{\uparrow} - n_{\downarrow}}{n_{\uparrow} + n_{\downarrow}}, \end{equation} rather than the individual spin-densities. After simplification, one finds that \begin{align} \tau(n_{\uparrow},n_{\downarrow}) &= \tau_U(n)d_s(\zeta) \left[ 1 + \frac{20}{9d_s(\zeta)}q + \frac{5}{27d_s(\zeta)} p \right. \nonumber \\ & \left. + \frac{5}{27} \frac{\xi^2}{d_s(\zeta)(1-\zeta^2)} \right] + \mo{4}, \label{eq:tau_spin_res} \end{align} where \begin{equation} d_s(\zeta) = [(1 + \zeta)^{5/3} + (1 - \zeta)^{5/3} ]/2 \end{equation} describes the spin-scaling of the uniform electron gas kinetic energy density, and \begin{equation} \xi = \frac{|\nabla \zeta|}{2 k_{\mr{F}}}, \end{equation} which also appeared in TPSS \cite{Tao2003}. The spin resolved $\bar{\alpha}$ tends to \begin{align} \bar{\alpha}(n_{\uparrow},n_{\downarrow}) &= \frac{\tau(n_{\uparrow},n_{\downarrow}) - \tau_W}{\tau_U(n)d_s(\zeta) + \eta \tau_W} \\ & = \left[\frac{\tau}{\tau_U(n)d_s(\zeta)} - \frac{5}{3d_s(\zeta)}p \right]\left[1 + \frac{5\eta}{3d_s(\zeta)}p \right]^{-1}. \end{align} After performing a Taylor expansion in $p$, and inserting Eq. \ref{eq:tau_spin_res} for $\tau(n_{\uparrow},n_{\downarrow})$, we find \begin{align} \bar{\alpha}(n_{\uparrow},n_{\downarrow}) &= 1 + \frac{20}{9d_s(\zeta)}q - \frac{5(8 +9 \eta )}{27 d_s(\zeta)}p \nonumber \\ & + \frac{5}{27d_s(\zeta)(1-\zeta^2)}\xi^2 + \mo{4}. \label{eq:ba_ge_pol} \end{align} In the special case where $\zeta=0$ (needed for the exchange energy), \begin{equation} \bar{\alpha}(n) = 1 + \frac{20}{9}q - \frac{5(8 +9 \eta )}{27 }p + \mo{4}. \label{eq:ba_ge_unp} \end{equation} \subsection{Exchange, second order gradient expansion \label{AP:r2_x_deriv}} For any spin-unpolarized exchange energy density $\epsilon_{\mr{x}}(n)$, the spin-scaled exchange energy density is \cite{Oliver1979} \begin{equation} \epsilon_{\mr{x}}(n_{\uparrow},n_{\downarrow}) = \frac{1}{2}[\epsilon_{\mr{x}}(2n_{\uparrow}) + \epsilon_{\mr{x}}(2n_{\downarrow})]. \end{equation} Therefore we need only consider the spin-unpolarized exchange energy density, and apply the spin-scaling relationship as needed. We start with an explicit expression for the r\tss{2}SCAN\xspace exchange enhancement factor \begin{equation} F^{\text{r\tss{2}SCAN\xspace}}_{\mr{x}}(p,\bar{\alpha}) = \{h_{\mr{x}}^1(p) + f_{\mr{x}}(\bar{\alpha})[h_{\mr{x}}^0 - h_{\mr{x}}^1(p)] \}g_{\mr{x}}(p), \end{equation} with $h_{\mr{x}}^0=1.174$. The function \begin{equation} g_{\mr{x}}(p) = 1-\exp(-a_{\mr{x}}/p^{1/4}) = 1 + \mo{\infty} \label{eq:gx_taylor} \end{equation} in the slowly-varying limit (its derivatives of all order vanish in the limit $p\to 0$). In r\tss{2}SCAN\xspace, we take \begin{equation} h_{\mr{x}}^1(p) = 1 + k_1 - k_1\{1 + [D_{\mr{x}} \exp(-p^2/d_{p2}^4) + \muak \}]p/k_1 \}^{-1}, \end{equation} which has the following Taylor series: \begin{equation} h_{\mr{x}}^1(p) = 1 + (D_{\mr{x}} + \muak) p - \frac{(D_{\mr{x}} + \muak)^2}{k_1}p^2 + \mo{6}. \label{eq:hx_taylor} \end{equation} The r\tss{2}SCAN\xspace interpolation function is taken from rSCAN, and has the structure \begin{equation} f_{\mr{x}}(\bar{\alpha}) = \left\{ \begin{array}{ll} \sum_{i=0}^7c_{\mr{x},i}\bar{\alpha}^i, & \bar{\alpha} <= 2.5 \\ -c_{\mr{dx}}^{\mr{SCAN}}\exp\left[\frac{c_{\mr{2x}}^{\mr{SCAN}}}{1-\bar{\alpha}}\right], & \bar{\alpha} > 2.5 \end{array} \right., \end{equation} with Taylor series \begin{align} f_{\mr{x}}(\bar{\alpha}) &= (\bar{\alpha} -1)\sum_{i=1}^7 i c_{\mr{x},i} + \frac{1}{2}(\bar{\alpha} - 1)^2\sum_{i=2}^7 i (i-1) c_{\mr{x},i} \nonumber \\ & + \mathcal{O}[(\bar{\alpha}-1)^3] \label{eq:fx_taylor} \end{align} in the slowly-varying limit. It's important here to note that $\bar{\alpha}$ has a gradient expansion to much higher order than $\mo{2}$, as we derived in Eqs. \ref{eq:ba_ge_pol} and \ref{eq:ba_ge_unp}. Therefore, the term of lowest order in $(1-\bar{\alpha})$ is $\mo{2}$, and the term of lowest order in $(1-\bar{\alpha})^2$ is $\mo{4}$. Inserting the Taylor series of Eqs. \ref{eq:gx_taylor}, \ref{eq:hx_taylor}, and \ref{eq:fx_taylor} into $F_{\mr{x}}^{\text{r\tss{2}SCAN\xspace}}$, we find, to $\mo{4}$, \begin{align} & F_{\mr{x}}^{\text{r\tss{2}SCAN\xspace}}(p,\bar{\alpha}) = 1 + (D_{\mr{x}} + \muak) p \nonumber \\ &+ \left[(h_{\mr{x}}^0-1)\sum_{i=1}^7 i c_{\mr{x},i}\right](\bar{\alpha} -1) - \frac{(D_{\mr{x}} + \muak)^2}{k_1}p^2 \nonumber \\ & -\left[(D_{\mr{x}} + \muak) \sum_{i=1}^7 i c_{\mr{x},i}\right](\bar{\alpha} -1)p \nonumber \\ & +\left[\frac{h_{\mr{x}}^0-1}{2}\sum_{i=2}^7 i(i-1) c_{\mr{x},i}\right](\bar{\alpha} -1)^2 + \mo{6}, \label{eq:fx_rr_taylor} \end{align} with the terms written in (generally) increasing order. For r\tss{2}SCAN\xspace, we demand that the exchange enhancement factor recover the exchange gradient expansion \cite{Kirzhnits1957, Svendsen1996} \begin{equation} F^{\text{GE}}_{\mr{x}}(p,q) = 1 + \muak p + \frac{146}{2025}q^2 - \frac{73}{405}pq + \mo{6} \label{eq:ge4x_pq} \end{equation} only to second order, i.e. $ 1 + \muak p$. Therefore, we can ignore all terms of order higher than $\mo{2}$ that are written explicitly in Eq. \ref{eq:fx_rr_taylor}, but also those that are included implicitly in $(\bar{\alpha}-1)$, \begin{widetext} \begin{equation} F_{\mr{x}}^{\text{r\tss{2}SCAN\xspace}}(p,\bar{\alpha}) = 1 + \left[D_{\mr{x}} - \frac{5(8 +9 \eta )}{27 }(h_{\mr{x}}^0-1)\sum_{i=1}^7 i c_{\mr{x},i} +\muak\right] p + \frac{20(h_{\mr{x}}^0-1)}{9}\left(\sum_{i=1}^7 i c_{\mr{x},i}\right)q + \mo{4}, \end{equation} where we have evaluated $(\bar{\alpha}-1)$ using Eq. \ref{eq:ba_ge_unp}. To eliminate the term linear in $q$, we perform an integration by parts. The ``gauge variance'' of the exchange energy density implies that two exchange enhancement factors can yield the same integrated exchange energy, but different exchange energy densities, \begin{equation} \int_{\Omega} F_{\mr{x}} \epsilon_{\mr{x}}^{\text{LSDA}}d^3 r = \int_{\Omega} [\widetilde{F}_{\mr{x}} \epsilon_{\mr{x}}^{\text{LSDA}} + n^{-4/3}\nabla \cdot \bm{G}_{\mr{x}}]d^3 r = \int_{\Omega}\widetilde{F}_{\mr{x}} d^3r -\frac{3}{4\pi}(3\pi^2)^{1/3} \int_{\text{bdy}\,\Omega} \bm{G}\cdot d\bm{S}. \end{equation} The second equality is a straightforward application of the divergence theorem. Provided that the gauge function $\bm{G}_{\mr{x}}$ vanishes sufficiently rapidly over the bounding surface $\text{bdy}\,\Omega$ of the integration volume $\Omega$, the surface integral vanishes. Note also that the LSDA exchange energy density is \begin{equation} \epsilon_{\mr{x}}^{\text{LSDA}} = -\frac{3}{4\pi}(3\pi^2)^{1/3} n^{4/3}. \end{equation} Consider then \begin{equation} q \,\epsilon_{\mr{x}}^{\text{LSDA}} = \left\{ \frac{p}{3} + n^{-4/3}\nabla \cdot \left[ \frac{\nabla n}{4(3\pi^2)^{2/3}n^{1/3} } \right] \right\}\epsilon_{\mr{x}}^{\text{LSDA}}, \end{equation} thus \begin{equation} F_{\mr{x}}^{\text{r\tss{2}SCAN\xspace}}(p,\bar{\alpha}) = 1 + \left[D_{\mr{x}} - \frac{5(4 +9 \eta )}{27 }(h_{\mr{x}}^0-1)\sum_{i=1}^7 i c_{\mr{x},i} +\muak\right] p + n^{-4/3}\nabla \cdot \left\{ \left[ \frac{5(h_{\mr{x}}^0-1)}{9(3\pi^2)^{2/3}} \left(\sum_{i=1}^7 i c_{\mr{x},i}\right) \right]\frac{\nabla n}{n^{1/3}}\right\} + \mo{4}. \end{equation} \end{widetext} The rightmost term in curly braces is the gauge function $\bm{G}_{\mr{x}}$. Except in certain situations, like the density tail of an atom (generally, outside the Kohn-Sham turning surface if one exists), where the gradient expansion does not apply, $n^{-1/3} \nabla n $ vanishes sufficiently rapidly at infinity. Moreover, we generalize $F_{\mr{x}}^{\text{r\tss{2}SCAN\xspace}}$ by cutting off the divergent gradient expansion terms and keeping only the integrated-by-parts expression \begin{align} & \widetilde{F}_{\mr{x}}^{\text{r\tss{2}SCAN\xspace}}(p,\bar{\alpha}) = 1 + \left[D_{\mr{x}} - \frac{5(4 +9 \eta )}{27 }(h_{\mr{x}}^0-1)\sum_{i=1}^7 i c_{\mr{x},i} \right. \nonumber \\ & +\muak \bigg] p + \mo{4}, \end{align} allowing for validity even outside the Kohn-Sham turning surface. Thus, we recover the correct second-order gradient expansion for exchange by demanding \begin{equation} D_{\mr{x}} = \frac{5(4 +9 \eta )}{27 } (h_{\mr{x}}^0-1)\sum_{i=1}^7 i c_{\mr{x},i} \end{equation} which is the product of $C_{\eta}$ and $C_{2\mr{x}}$ defined in Eqs. 53 and 57, respectively, \begin{align} C_{\eta} &= \frac{5(4 +9 \eta )}{27 } \nonumber \\ C_{2\mr{x}} &= (h_{\mr{x}}^0-1)\sum_{i=1}^7 i c_{\mr{x},i}. \nonumber \end{align} \subsection{Exchange, fourth-order gradient expansion \label{AP:r4_x_deriv}} r\tss{4}SCAN\xspace prescribes an explicit correction to the r\tss{2}SCAN\xspace enhancement factor, \begin{equation} F_{\mr{x}}^{\text{r\tss{4}SCAN\xspace}} = F_{\mr{x}}^{\text{r\tss{2}SCAN\xspace}} + \Delta F_4(p,\bar{\alpha})g_{\mr{x}}(p) \end{equation} where $g_{\mr{x}}(p)$ is unchanged from r\tss{2}SCAN\xspace, and \begin{align} \Delta F_4(p,\bar{\alpha}) &= \left\{ -C_{2\mr{x}}[ (\bar{\alpha}-1) + C_{\eta}p ] + C_{\bar{\alpha} \bar{\alpha}}(1-\bar{\alpha})^2 \right. \nonumber \\ & \left. + C_{p \bar{\alpha}}p(1-\bar{\alpha}) + C_{pp} p^2 \right\}\frac{2\bar{\alpha}^2}{1+\bar{\alpha}^4}\nonumber \\ & \times \exp\left[-\frac{(1-\bar{\alpha})^2}{d_{\ba4}^2} - \frac{p^2}{d_{p4}^4} \right]. \end{align} Despite the complexity of $\Delta F_4$, the damping function used to modulate these corrections, it has a simple Taylor series \begin{align} \Delta F_4(p,\bar{\alpha}) &= -C_{2\mr{x}}[ (\bar{\alpha}-1) + C_{\eta}p ] + C_{\bar{\alpha} \bar{\alpha}}(1-\bar{\alpha})^2 \nonumber \\ & + C_{p \bar{\alpha}}p(1-\bar{\alpha}) + C_{pp} p^2 + \mo{6}. \end{align} We will now take $D_{\mr{x}} = C_{\eta}C_{2\mr{x}}$ in the r\tss{2}SCAN\xspace exchange enhancement factor. Returning to Eq. \ref{eq:fx_rr_taylor} for the r\tss{2}SCAN\xspace exchange enhancement factor, and adding in the r\tss{4}SCAN\xspace corrections, \begin{align} & F_{\mr{x}}^{\text{r\tss{4}SCAN\xspace}}(p,\bar{\alpha}) = 1 + \muak p +\left[C_{pp} - \frac{(C_{\eta}C_{2\mr{x}} + \muak)^2}{k_1} \right]p^2 \nonumber \\ & + \left[ C_{p \bar{\alpha}} + (C_{\eta}C_{2\mr{x}} + \muak) \sum_{i=1}^7 i c_{\mr{x},i}\right] (1 - \bar{\alpha})p \nonumber \\ & +\left[C_{\bar{\alpha} \bar{\alpha}} + \frac{h_{\mr{x}}^0-1}{2}\sum_{i=2}^7 i(i-1) c_{\mr{x},i}\right](\bar{\alpha} -1)^2 + \mo{6}. \label{eq:fx_rf_taylor} \end{align} Now, again using Eq. \ref{eq:ba_ge_unp} for the gradient expansion of $\bar{\alpha}$ to second-order, \begin{align} (1 - \bar{\alpha})p &= -\frac{20}{9}p q + \frac{5(8 +9 \eta )}{27 }p^2 + \mo{6} \label{eq:p_ba_ge}\\ (1 - \bar{\alpha})^2 &= \frac{400}{81}q^2 + \left[\frac{5(8 +9 \eta )}{27 } \right]^2 p^2 \nonumber \\ & - \frac{200(8 +9 \eta )}{243}p q + \mo{6}. \label{eq:ba_ba_ge} \end{align} The second-order gradient expansion of $\bar{\alpha}$ is valid here, because any higher order terms in $1-\bar{\alpha}$ will yield, to lowest order, sixth-order terms in these products. Using Eqs. \ref{eq:p_ba_ge} and \ref{eq:p_ba_ge}, one can show that \begin{align} & \frac{73}{5000}(\bar{\alpha}-1)^2 + \left[\frac{511}{13500} -\frac{73}{1500}\eta \right] (1 - \bar{\alpha} )p \nonumber \\ & + \left[\frac{146}{2025} \left(\frac{2}{3} + \frac{3\eta}{4} \right)^2 - \frac{73}{405}\left(\frac{2}{3} + \frac{3\eta}{4} \right) \right] p^2 \nonumber \\ & = \frac{146}{2025} q^2 - \frac{73}{405} p q + \mo{6}, \label{eq:ge4_p_ba} \end{align} the same fourth-order terms as in Eq. \ref{eq:ge4x_pq}. Then to recover the fourth-order gradient expansion for exchange in r\tss{4}SCAN\xspace, we equate \ref{eq:fx_rf_taylor} and \ref{eq:ge4_p_ba}, and find \begin{align} C_{pp} &= \frac{(C_{\eta}C_{2\mr{x}} + \muak)^2}{k_1} + \frac{146}{2025} \left(\frac{2}{3} + \frac{3\eta}{4} \right)^2 \nonumber \\ & - \frac{73}{405}\left(\frac{2}{3} + \frac{3\eta}{4} \right) \\ C_{p \bar{\alpha}} &= \frac{511}{13500} -\frac{73}{1500}\eta - (C_{\eta}C_{2\mr{x}} + \muak) \sum_{i=1}^7 i c_{\mr{x},i} \\ C_{\bar{\alpha} \bar{\alpha}} &= \frac{73}{5000} - \frac{h_{\mr{x}}^0-1}{2}\sum_{i=2}^7 i(i-1) c_{\mr{x},i}, \end{align} as presented in Eqs. 61--63. \subsection{Correlation, second-order gradient expansion \label{AP:r2_c_deriv}} The gradient expansion for the correlation energy per electron is known only to second order \cite{Ma1968,Wang1991,Perdew1996,Sun2015} \begin{equation} \varepsilon_{\mr{c}}(r_{\mathrm{s}},\zeta,t) = \varepsilon_{\mr{c}}^{\text{LSDA}}(r_{\mathrm{s}},\zeta) + \beta(r_{\mathrm{s}})\phi^3(\zeta) t^2. \end{equation} The density-dependent function $\beta(r_{\mathrm{s}})$ is known only for small values of $r_{\mathrm{s}}$, and we take the parameterization used in Ref. \cite{Sun2015}, \begin{equation} \beta(r_{\mathrm{s}}) = \beta_{\mr{MB}}\frac{1 + 0.1 r_{\mathrm{s}}}{1 + 0.1778 r_{\mathrm{s}}}, \end{equation} constructed to cancel with the second-order gradient expansion term for exchange in the limit $r_{\mathrm{s}} \to \infty$. Two other quantities enter this expansion: the spin-scaling function \begin{equation} \phi(\zeta) = [(1 + \zeta)^{2/3} + (1 - \zeta)^{2/3}]/2, \end{equation} and dimensionless density gradient on the length scale of the Thomas-Fermi wavevector \begin{equation} t^2 = \left( \frac{3\pi^2}{16} \right)^{2/3}\frac{p}{\phi^2(\zeta)r_{\mathrm{s}}}. \end{equation} In both r\tss{2}SCAN\xspace and r\tss{4}SCAN\xspace, we propose that the correlation energy per electron is \begin{align} \varepsilon^{\text{r\tss{2}SCAN\xspace}}_{\mr{c}}(r_{\mathrm{s}},\zeta,p,\bar{\alpha}) &= \varepsilon_{\mr{c}}^1(r_{\mathrm{s}},\zeta,p) + f_{\mr{c}}(\bar{\alpha})[ \varepsilon_{\mr{c}}^0(r_{\mathrm{s}},\zeta,p) \nonumber \\ & - \varepsilon_{\mr{c}}^1(r_{\mathrm{s}},\zeta,p)] \end{align} with $f_{\mr{c}}(\bar{\alpha})$ taken from rSCAN. It has a Taylor series about $\bar{\alpha} = 1$ that is identical in structure (but not value) to the Taylor series for $f_{\mr{x}}(\bar{\alpha})$. The individual energies per electron are \begin{align} \varepsilon_{\mr{c}}^0(r_{\mathrm{s}},\zeta,p) &= [\varepsilon_{\mr{c}}^{\text{LDA0}}(r_{\mathrm{s}},\zeta) + H_0(r_{\mathrm{s}},\zeta,p)]g_{\mr{c}}(\zeta) \\ \varepsilon_{\mr{c}}^1(r_{\mathrm{s}},\zeta,p) &= \varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta) + H_1(r_{\mathrm{s}},\zeta,p), \end{align} with $\varepsilon_{\mr{c}}^0$ unchanged from SCAN (see also Eqs. \ref{eq:ec0_scan}--\ref{eq:gc_zeta}). In r\tss{2}SCAN\xspace, we posit that \begin{align} H_1(r_{\mathrm{s}},\zeta,p) &= \gamma \phi^3(\zeta)\ln \left\{ 1 + w_1\left[ 1 - g(y,\Delta y)\right]\right\} \\ y &= \frac{\beta(r_{\mathrm{s}})}{\gamma w_1} t^2 \\ g(y,\Delta y)&= [1 + 4(y - \Delta y)]^{-1/4} \\ \Delta y &= D_{\mr{c}} p\exp[-p^2/d_{p2}^4], \end{align} with $d_{p2}$ unchanged from the exchange component of r\tss{2}SCAN\xspace. It can readily be seen that these have the following Taylor series: \begin{align} \varepsilon_{\mr{c}}^0(r_{\mathrm{s}},\zeta,p) &= \varepsilon_{\mr{c}}^{\text{LDA0}}(r_{\mathrm{s}},\zeta)g_{\mr{c}}(\zeta) + \chi_{\infty}g_{\mr{c}}(\zeta) p + \mo{4} \\ \varepsilon_{\mr{c}}^1(r_{\mathrm{s}},\zeta,p) &= \varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta) + \beta(r_{\mathrm{s}})\phi^3(\zeta)t^2 \nonumber \\ & - \gamma \phi^3(\zeta)w_1 D_{\mr{c}} p + \mo{4}. \end{align} Then the full gradient expansion of the r\tss{2}SCAN\xspace correlation energy per electron is, after simplification, \begin{align} & \varepsilon^{\text{r\tss{2}SCAN\xspace}}_{\mr{c}}(r_{\mathrm{s}},\zeta,p,\bar{\alpha}) = \varepsilon_{\mr{c}}^{\text{LSDA1}} + \beta(r_{\mathrm{s}})\phi^3(\zeta)t^2 \nonumber \\ & - \gamma \phi^3(\zeta)w_1 D_{\mr{c}} p + \left(\sum_{i=1}^7 i c_{\mr{c},i}\right)(\bar{\alpha} - 1) + \mo{4}, \end{align} where $\varepsilon_{\mr{c}}^{\text{LSDA0}} = \varepsilon_{\mr{c}}^{\text{LDA0}}g_{\mr{c}}(\zeta)$. Let \begin{equation} \Delta f_{\mr{c}2} \equiv \sum_{i=1}^7 i c_{\mr{c},i}. \end{equation} We can now use Eq. \ref{eq:ba_ge_pol} for the gradient expansion of $\bar{\alpha}$ at arbitrary spin polarization to find that \begin{widetext} \begin{align} &\varepsilon^{\text{r\tss{2}SCAN\xspace}}_{\mr{c}}(r_{\mathrm{s}},\zeta,p,\bar{\alpha}) = \varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta) + \beta(r_{\mathrm{s}})\phi^3(\zeta)t^2 + \frac{20\Delta f_{\mr{c}2}}{9d_s(\zeta)}[\varepsilon_{\mr{c}}^{\text{LSDA0}}(r_{\mathrm{s}},\zeta)-\varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta)]q \nonumber \\ & - \left\{\gamma \phi^3(\zeta)w_1 D_{\mr{c}} + \frac{5(8 +9 \eta )\Delta f_{\mr{c}2}}{27 d_s(\zeta)}[\varepsilon_{\mr{c}}^{\text{LSDA0}}(r_{\mathrm{s}},\zeta)-\varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta)] \right\} p \nonumber \\ & + \frac{5\Delta f_{\mr{c}2}}{27d_s(\zeta)(1-\zeta^2)}[\varepsilon_{\mr{c}}^{\text{LSDA0}}(r_{\mathrm{s}},\zeta)-\varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta)]\xi^2 + \mo{4}. \end{align} We can eliminate the term linear in $q$ using a similar gauge variance principle for the correlation energy: \begin{equation} \int_{\Omega} \varepsilon_{\mr{c}} n \, d^3 r = \int_{\Omega} [\widetilde{\varepsilon}_{\mr{c}} + n^{-1} \nabla \cdot \bm{G}_{\mr{c}} ]n \, d^3 r = \int_{\Omega} \widetilde{\varepsilon}_{\mr{c}} n \, d^3 r + \int_{\text{bdy}\,\Omega}\bm{G}_{\mr{c}} \cdot d\bm{S}. \end{equation} Again, provided that the gauge function $\bm{G}_{\mr{c}}$ vanishes sufficiently rapidly at the bounding surface $\text{bdy}\,\Omega$, we may replace the r\tss{2}SCAN\xspace correlation energy per electron with the integrated-by-parts expression $\widetilde{\varepsilon}_{\mr{c}}$. To do this, consider that for a general function $f(r_{\mathrm{s}},\zeta)$, \begin{equation} \nabla f(r_{\mathrm{s}},\zeta) = -\frac{r_{\mathrm{s}}}{3n}\frac{\partial f}{\partial r_{\mathrm{s}}}\nabla n + \frac{\partial f}{\partial \zeta} \nabla \zeta, \end{equation} where we have used $r_{\mathrm{s}}=[4\pi n/3]^{-3}$. Then \begin{align} &\frac{\varepsilon_{\mr{c}}^{\text{LSDA0}}(r_{\mathrm{s}},\zeta)-\varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta)}{d_s(\zeta)}q \, n = \left\{ \frac{2}{3} \frac{\varepsilon_{\mr{c}}^{\text{LSDA0}}(r_{\mathrm{s}},\zeta)-\varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta)}{d_s(\zeta)} + \frac{r_{\mathrm{s}}}{3d_s(\zeta)} \left[ \frac{\partial\varepsilon_{\mr{c}}^{\text{LSDA0}}}{\partial r_{\mathrm{s}}}- \frac{\partial\varepsilon_{\mr{c}}^{\text{LSDA1}}}{\partial r_{\mathrm{s}}} \right] \right\} p \, n \nonumber \\ & - \frac{\nabla n \cdot \nabla \zeta}{4(3\pi^2)n^{5/3}}\frac{\partial}{\partial \zeta}\left[\frac{\varepsilon_{\mr{c}}^{\text{LSDA0}}(r_{\mathrm{s}},\zeta)-\varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta)}{d_s(\zeta)} \right] n + n^{-1} \nabla \cdot \left[\frac{\varepsilon_{\mr{c}}^{\text{LSDA0}}(r_{\mathrm{s}},\zeta)-\varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta)}{d_s(\zeta)} \frac{\nabla n}{4(3\pi^2n)^{2/3}} \right]. \end{align} The rightmost term in square brackets is the gauge function $\bm{G}_{\mr{c}}$. Then the integrated-by-parts r\tss{2}SCAN\xspace correlation energy per electron is \begin{align} &\widetilde{\varepsilon}^{\text{r\tss{2}SCAN\xspace}}_{\mr{c}}(r_{\mathrm{s}},\zeta,p,\bar{\alpha}) = \varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta) + \beta(r_{\mathrm{s}})\phi^3(\zeta)t^2 \nonumber \\ & - \left\{\gamma \phi^3(\zeta)w_1 D_{\mr{c}} + \frac{45\Delta f_{\mr{c}2} \eta}{27 d_s(\zeta)}[\varepsilon_{\mr{c}}^{\text{LSDA0}}(r_{\mathrm{s}},\zeta)-\varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta)] - \frac{20\Delta f_{\mr{c}2}r_{\mathrm{s}}}{27d_s(\zeta)} \left[ \frac{\partial\varepsilon_{\mr{c}}^{\text{LSDA0}}}{\partial r_{\mathrm{s}}} - \frac{\partial\varepsilon_{\mr{c}}^{\text{LSDA1}}}{\partial r_{\mathrm{s}}} \right] \right\} p \nonumber \\ & - \frac{5\nabla n \cdot \nabla \zeta}{9(3\pi^2)n^{5/3}}\frac{\partial}{\partial \zeta}\left[\frac{\varepsilon_{\mr{c}}^{\text{LSDA0}}(r_{\mathrm{s}},\zeta)-\varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta)}{d_s(\zeta)} \right] + \frac{5\Delta f_{\mr{c}2}}{27d_s(\zeta)(1-\zeta^2)}[\varepsilon_{\mr{c}}^{\text{LSDA0}}(r_{\mathrm{s}},\zeta)-\varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta)]\xi^2 + \mo{4}. \end{align} In r\tss{2}SCAN\xspace, we make the simplification that $\nabla \zeta\approx 0$. Thus $\xi\approx 0$, and \begin{align} &\widetilde{\varepsilon}^{\text{r\tss{2}SCAN\xspace}}_{\mr{c}}(r_{\mathrm{s}},\zeta,p,\bar{\alpha}) = \varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta) + \beta(r_{\mathrm{s}})\phi^3(\zeta)t^2 \nonumber \\ & - \left\{\gamma \phi^3(\zeta)w_1 D_{\mr{c}} + \frac{45\Delta f_{\mr{c}2} \eta}{27 d_s(\zeta)}[\varepsilon_{\mr{c}}^{\text{LSDA0}}(r_{\mathrm{s}},\zeta)-\varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta)] - \frac{20\Delta f_{\mr{c}2}r_{\mathrm{s}}}{27d_s(\zeta)}\left[ \frac{\partial\varepsilon_{\mr{c}}^{\text{LSDA0}}}{\partial r_{\mathrm{s}}} - \frac{\partial\varepsilon_{\mr{c}}^{\text{LSDA1}}}{\partial r_{\mathrm{s}}} \right] \right\} p + \mo{4}. \end{align} To recover the second order gradient expansion for correlation, we take \begin{equation} D_{\mr{c}} = \frac{\Delta f_{\mr{c}2}}{27 \gamma \phi^3(\zeta)d_s(\zeta) w_1(r_{\mathrm{s}},\zeta)}\left\{20r_{\mathrm{s}} \left[ \frac{\partial\varepsilon_{\mr{c}}^{\text{LSDA0}}}{\partial r_{\mathrm{s}}} - \frac{\partial\varepsilon_{\mr{c}}^{\text{LSDA1}}}{\partial r_{\mathrm{s}}} \right] - 45\eta [\varepsilon_{\mr{c}}^{\text{LSDA0}}(r_{\mathrm{s}},\zeta)-\varepsilon_{\mr{c}}^{\text{LSDA1}}(r_{\mathrm{s}},\zeta)]\right\}, \end{equation} which is the factor appearing Eq. 78 \end{widetext}
\section{Introduction} Bootstrap percolation is a class of deterministic growth models in random environments. The basic premise is that we have a discrete universe of \emph{sites}, typically arranged on a regular lattice such as $\mathbb{Z}^d$, a random subset of which are initially \emph{infected}. A deterministic rule, typically uniform in space and time, allows the infection to spread into healthy sites that have enough infected neighbors. The main quantities of interest are then the probability of every site being eventually infected (called \emph{percolation}), and the distribution of the time of infection, as a function of the initial distribution of infected sites. Bootstrap percolation was introduced by Chalupa, Leath and Reich in~\cite{ChLeRe79} as a model of impurities in magnetic materials. See~\cite{DeLaDa16} for an overview of subsequent literature. Bootstrap percolation processes can be formalized as cellular automata (CA for short) on the binary state set $\{0,1\}$ that are \emph{monotone} ($x \leq y$ implies $f(x) \leq f(y)$) and \emph{freezing} ($x \leq f(x)$ always holds) with respect to the cellwise partial order. The automaton is initialized on a random configuration $x \in \{0,1\}^{\mathbb{Z}^d}$, and the freezing property guarantees that the iterates $f^n(x)$ converge to a limit configuration. Percolation corresponds to this limit being the all-1 configuration. We say that $f$ trivializes the initial probability measure, if percolation happens almost surely. Dropping the monotonicity requirement results in a richer set of possible asymptotic behaviors. Such automata may still be understood as models of physical or sociological phenomena. For example, if the cells of a graph represent agents with political leanings, then non-monotone rules can model individuals becoming suspicious of a sudden influx of opposing views among their peers. Examples of freezing non-monotone CA have been considered in the literature, like the ``rule one'' of S. Ulam~\cite{ulam} as an attempt to study models of crystal growth, or ``life without death''~\cite{GriMoo96} which is a freezing version of Conway's Life. The dynamics of freezing cellular automata have been studied explicitly in e.g.~\cite{GoOlTh15,GoMaMoOl17,BeMaOlTh18}. We note that in the literature it is common to require freezing CA to be decreasing rather than increasing, but here we choose to follow the opposite convention of percolation theory. In this article we study the variety of asymptotic behaviors exhibited by monotone and non-monotone freezing CA when initialized on Bernoulli random configurations. In the monotone case, we provide a characterization of those automata under which almost all initial configurations percolate with respect to at least one nontrivial Bernoulli measure. We state the characterization in terms of two criticality classifications of bootstrap percolation models. In~\cite{GrGr96} Gravner and Griffeath study \emph{threshold growth dynamics}, which are a class of binary freezing monotone CA rules defined by a fixed neighborhood $N \subset \mathbb{Z}^2$ and a threshold $\theta \geq 0$, where the local rule turns a $0$ into a $1$ precisely when the number of $1$-states in the neighborhood is at least $\theta$. They call such a CA \emph{subcritical} if it has a fixed point with a nonzero but finite number of $0$-states, \emph{supercritical} if there is a configuration $x \in \{0,1\}^{\mathbb{Z}^2}$ with a finite number of $1$-states and $\lim_n f^n(x)$ contains infinitely many $1$-states, and \emph{critical} if neither condition holds. Bollob\'as, Smith and Uzzell provide in~\cite{BoSmUz15} an a priori different classification for the dynamics of arbitrary binary freezing monotone $\mathbb{Z}^2$-CA in terms of \emph{stable directions}. Their definition of supercriticality agrees with that of Gravner and Griffeath, but their version of subcriticality is strictly weaker. By~\cite{BoSmUz15,BaBoPrSm16}, a binary freezing monotone $\mathbb{Z}^2$-CA trivializes every nontrivial Bernoulli measure if and only if it is critical or supercritical and the sense of~\cite{BoSmUz15}, and the property is decidable. Our results in Section~\ref{sec:monotone} concern the dual problem: given a binary freezing monotone CA, does there exist a nontrivial Bernoulli measure it trivializes? We show that this is equivalent to the stronger version of subcriticality defined by Gravner and Griffeath. In particular, the property is also decidable. As part of our proof, we give a characterization of subcriticality using stable directions, which was stated in~\cite{BoSmUz15} without proof. In Section~\ref{sec:non-monotone} we study the larger class of binary freezing CA that may not be monotone. Our results in this context have a different flavor, as they highlight the increase in complexity of the asymptotic dynamics that results from discarding the monotonicity constraint. First, we show that while the property of not trivializing any nontrivial Bernoulli measure is still equivalent to subcriticality, it is no longer decidable. Second, we show that the measure trivialization property may be non-monotone, in the sense that there exists a freezing CA that trivializes the Bernoulli measure of weight $p$ but not the one of weight $q$, for some $0 < p < q < 1$. This can be interpreted as the system having at least two phase transitions. Several open problems arise naturally from our investigation. First, in the context of cellular automata it is natural to ask whether the results extend to arbitrary finite state sets. We prove some of our auxiliary results in this context, but our main results concern the binary case. Do monotone freezing CA with three or more states have significantly more complex dynamics than binary CA? In particular, are the analogous trivialization properties decidable? Second, our example of a freezing CA with two phase transitions can likely be generalized to realize a wide range of exotic trivialization phenomena. \section{Definitions} For a finite alphabet $A$ and $d \geq 1$ (we will mostly be dealing with the case $d = 2$), the $d$-dimensional \emph{full shift} if the set $A^{\mathbb{Z}^d}$ equipped with the prodiscrete topology. Elements of $A^{\mathbb{Z}^d}$ are called \emph{configurations}. For $a \in A$, the \emph{$m$-uniform configuration} $x = \unifd{a} \in A^{\mathbb{Z}^d}$ is defined by $x_{\vec v} = a$ for all $\vec v \in \mathbb{Z}^d$. We have an action $\sigma : \mathbb{Z}^d \curvearrowright A^{\mathbb{Z}^d}$ of the additive group $\mathbb{Z}^d$ by homeomorphisms, called the \emph{shift action}, given by $\sigma_{\vec v}(x)_{\vec n} = x_{\vec n + \vec v}$. If $A$ is a poset (partially ordered set), then we see $A^{\mathbb{Z}^d}$ as a poset with the cellwise order: $x \leq y$ means $x_{\vec v} \leq y_{\vec v}$ for all $\vec v \in \mathbb{Z}^d$. A $d$-dimensional \emph{pattern} is a function $w \in A^D$ with $D \subset \mathbb{Z}^d$ finite. The topology of $A^{\mathbb{Z}^d}$ is generated by \emph{cylinder sets} of the form $[w]_{\vec v} = \{ x \in A^{\mathbb{Z}^d} \;|\; \sigma_{\vec v}(x)|_D = w \}$ for a pattern $w \in A^D$. If $\vec v$ is omitted, it is assumed to be $\vec 0$. In a slight abose of notation, each symbol $a \in A$ stands for the pattern $\vec 0 \mapsto a$ with domain $D = \{\vec 0\}$, so that $[a]_{\vec v} = \{ x \in A^{\mathbb{Z}^d} \;|\; x_{\vec v} = a \}$. A \emph{cellular automaton} (CA for short) is a function $f : A^{\mathbb{Z}^d} \to A^{Z^d}$ defined by a finite \emph{neighborhood} $N \subset \mathbb{Z}^d$ and a \emph{local rule} $F : A^N \to A$ with $f(x)_{\vec v} = F(\sigma_{-\vec v}(x)|_N)$. If $\|\vec v\|_\infty \leq r$ holds for all $\vec v \in N$, we say $r$ is a \emph{radius} for $f$. By the Curtis-Hedlund-Lyndon theorem, CA are exactly the continuous functions from $A^{\mathbb{Z}^d}$ to itself that commute with the shift action. Denote by $\mathcal{M}(A^{\mathbb{Z}^d})$ the set of Borel probability measures on $A^{\mathbb{Z}^d}$, and by $\mathcal{M}_\sigma(A^{\mathbb{Z}^d})$ the $\sigma$-invariant ones (which satisfy $\mu(\sigma_{\vec v}(X)) = \mu(X)$ for all Borel sets $X$). We equip $\mathcal{M}(A^{\mathbb{Z}^d})$ with the weak-${*}$ topology, or convergence on cylinder sets. The \emph{support} $\supp(\mu)$ of $\mu \in \mathcal{M}(A^{\mathbb{Z}^d})$ is the unique smallest closed set $K \subset A^{\mathbb{Z}^d}$ with $\mu(K) = 1$. We can apply a CA $f$ to a measure $\mu \in \mathcal{M}(A^{\mathbb{Z}^d})$ by $f(\mu)(X) = \mu(f^{-1} X)$. For a probability vector $\pi : A \to [0,1]$ (that satisfies $\sum_{a \in A} \pi(a) = 1$), the \emph{Bernoulli} or \emph{product measure} $\mu_\pi \in \mathcal{M}_\sigma(A^{\mathbb{Z}^d})$ is the unique Borel measure with $\mu([P]) = \prod_{\vec v \in D} \pi(P_{\vec v})$ for all patterns $P \in A^D$. If $A = \{0,1\}$ and $0 \leq p \leq 1$, then $\mu_p = \mu_\pi$ is the Bernoulli measure with $\pi(1) = p$. For $x \in A^{\mathbb{Z}^d}$, denote by $\delta_x$ the unique measure with $\delta_x(\{x\}) = 1$. The convex hull of a set $K \subset \mathbb{R}^d$ is denoted $\chull(K)$. The notation $\forall^\infty x \in X$ means ``for all but finitely many $x \in X$'', and $\exists^\infty x \in X$ means ``exists infinitely many $x \in X$''. \section{Freezing, monotonicity and measures} \begin{definition} Let $P$ be a finite poset. A cellular automaton $f$ on $P^{\mathbb{Z}^d}$ is \emph{freezing}, if $x \leq f(x)$ for all $x \in P^{\mathbb{Z}^d}$. It is \emph{monotone}, if $f(x) \leq f(y)$ for all $x \leq y \in P^{\mathbb{Z}^d}$. \end{definition} In this paper, when considering freezing cellular automata on ${\{0,1\}^{\mathbb{Z}^d}}$, we always implicitly refer to the poset with elements $0$ and $1$ such that ${\{0 < 1\}}$. \begin{lemma} \label{lem:freezingsets} A cellular automaton $f$ on $\{0,1\}^{\mathbb{Z}^2}$ is freezing and monotone if and only if there exists a finite family $E$ of finite subsets of $\mathbb{Z}^2 \setminus \{\vec 0\}$ with the following property. For all $x \in \{0,1\}^{\mathbb{Z}^2}$, we have $f(x)_{\vec 0} = 1$ if and only if $x_{\vec 0} = 1$ or there exists $N \in E$ with $x|_N = 1^N$. \end{lemma} \begin{proof} Given a freezing and monotone $f$, choose $E$ as the family of minimal subsets of $\mathbb{Z}^2 \setminus \{\vec 0\}$ such that $x_N = 1^N$ implies $f(x)_{\vec 0} = 1$. The other direction is clear. \end{proof} \begin{definition} For a freezing monotone cellular automaton $f$ on $\{0,1\}^{\mathbb{Z}^2}$, we write $E(f)$ for the set $E$ given by Lemma~\ref{lem:freezingsets}. We also denote \[ F(f) = \{ N \in E(f) \;|\; \vec 0 \notin \chull(N) \}, \] and $G(f) = E(f) \setminus F(f)$. For a finite family $E$ of incomparable subsets of $\mathbb{Z}^2 \setminus \{\vec 0\}$, we denote by $f_E$ the cellular automaton defined by $E(f_E) = E$. If $E = \{N\}$ is a singleton, we may also abuse notation and write $f_N$ for $f_E$. \end{definition} \begin{definition} Let $\mu \in \mathcal{M}(S^{\mathbb{Z}^2})$ be a measure. The \emph{$\mu$-limit set} of a cellular automaton $f$ on $S^{\mathbb{Z}^2}$ is \[ \Omega_f^\mu = \overline{\bigcup_{\nu \in \mathcal{F}} \supp(\nu)}, \] where $\mathcal{F}$ is the set of limit points of the sequence $(f^n(\mu))_{n \in \mathbb{N}}$. \end{definition} If $\mu \in \mathcal{M}_\sigma(S^{\mathbb{Z}^2})$ is shift-invariant, then $\Omega_f^\mu$ is the set of configurations $x$ such that no pattern $w$ occurring in $x$ satisfies $\lim_n \mu(f^{-n}([w]_{\vec 0})) = 0$. $\mu$-limit sets were first defined in~\cite{KuMa00} in the shift-invariant case using this characterization. The measures that occur in our results are shift-invariant, but in some proofs we work with intermediate measures that are not. \begin{definition} Let $\mu \in \mathcal{M}(S^{\mathbb{Z}^2})$ and let $f$ be a cellular automaton on $S^{\mathbb{Z}^2}$. We say $f$ \emph{trivializes} $\mu$, if $|\Omega_f^\mu| = 1$. \end{definition} In cellular automata literature, a CA $f$ is called \emph{$\mu$-nilpotent} if $\Omega_f^\mu = \{x\}$ for some unary configuration $x \in S^{\mathbb{Z}^2}$. If $P$ is a poset with a maximal element $m$, and $f$ is a freezing CA on $P^{\mathbb{Z}^2}$ that trivializes a full-support Bernoulli measure, then the limit measure must of course be concentrated on the $m$-uniform point. \begin{lemma} \label{lem:percolationasmunilpotency} Let $P$ be a finite poset, $\mu \in \mathcal{M}_\sigma(P^{\mathbb{Z}^2})$ of full support and $f$ a freezing cellular automaton on $P^{\mathbb{Z}^2}$. The following conditions are equivalent: \begin{itemize} \item $f$ trivializes $\mu$ \item $\lim_{n} f^n(\mu) = \delta_x$ for some (unary) $x \in P^{\mathbb{Z}^2}$ \item for some $p \in P$ and $\mu$-almost every $x$, we have $f^n(x)_{\vec z} = p$ for all $\vec z \in \mathbb{Z}^2$ and all large enough $n \in \mathbb{N}$ (depending on $\vec z$). \end{itemize} \end{lemma} \begin{proof} Suppose that $f$ trivializes $\mu$, so that $\Omega_f^\mu = \{x\}$ for some $x \in P^{\mathbb{Z}^2}$. Since $\mu$ is shift-invariant, for each $\vec v \in \mathbb{Z}^2$ we have \[ \{\sigma_{\vec v}(x)\} = \Omega_f^{\sigma_{\vec v} \mu} = \Omega_f^\mu = \{x\} \] and hence there exists $p \in P$ such that $x = \unif{p}$ is unary. Thus, for each finite pattern $w$ containing an occurrence of some $q \in P \setminus \{p\}$ we have $\lim_n f^n \mu([w]) = 0$, and for each all-$p$ pattern $w'$ we have $\lim_n f^n \mu([w']) = 1$. This implies $\lim_n f^n \mu = \delta_x$, the second item. The converse is clear, so the first two items are equivalent. Denote by $m$ a maximal element of $P$. Since $f$ is freezing, \begin{equation} \label{eq:freeze} [m]_{\vec z} \subseteq f^{-n}([m]_{\vec z}) \end{equation} for all $n \in \mathbb{N}$ and $\vec z \in \mathbb{Z}^2$. From~\eqref{eq:freeze} and the full support of $\mu$ it follows that no other state than $m$ can be chosen as $p$ in the third item. Let \[ B = \{ x \in P^{\mathbb{Z}^2} \;|\; \forall \vec v \in \mathbb{Z}^2 \ \forall^\infty n \in \mathbb{N} : f^n(x)_{\vec v} = m \} \] be the set of configurations that satisfy the condition of the third item. Consider ${E_{\vec z,n} = f^{-n}(P^{\mathbb{Z}^2} \setminus [m]_{\vec z})}$. From~\eqref{eq:freeze} we have ${E_{\vec z,n+1}\subseteq E_{\vec z,n}}$ for all $\vec z$ and $n$, and $B = P^{\mathbb{Z}^2} \setminus \bigcup_{\vec z \in \mathbb{Z}^2} \bigcap_{n \in \mathbb{N}} E_{\vec z,n}$. Suppose that $f$ does not trivialize $\mu$. Then there must be $\epsilon>0$ such that ${\mu(E_{\vec 0,n})\geq\epsilon}$ for all $n\geq 0$ (otherwise we would have ${\lim_n\mu(f^{-n}([m]))=1}$ since sets $E_{\vec 0,n}$ are decreasing, a contradiction). By continuity of $\mu$ from above, we deduce ${\mu(\bigcap_{n \in \mathbb{N}} E_{\vec 0,n})\geq\epsilon}$, so $\mu(B)\leq 1-\epsilon<1$. Therefore the third item does not hold. Suppose then that the third item does not hold, so that $\mu(B) < 1$. Since ${P^{\mathbb{Z}^2} \setminus B = \bigcup_{\vec z \in \mathbb{Z}^2} \bigcap_{n \in \mathbb{N}} E_{\vec z,n}}$ has positive measure, $\epsilon := \mu(\bigcap_{n \in \mathbb{N}} E_{\vec z,n}) > 0$ for some $\vec z$. For each $n$, we then have $\sum_{p \neq m} \mu(f^{-n}([p]_{\vec z})) = \mu(E_{\vec z,n}) \geq \epsilon$, and in particular $\mu(f^{-n}([p]_{\vec z})) \geq \epsilon/|P|$ for some $p \in P \setminus \{m\}$. For some $p$ this holds for infinitely many $n$, so some limit point $\nu$ of $(f^n \mu)_{n \in \mathbb{N}}$ satisfies $\nu(f^{-n}([p]_{\vec z}) \geq \epsilon/|P|$. Thus $f$ does not trivialize $\mu$. We have shown that the third item is equivalent to the first. \end{proof} We note that the first two items of Lemma~\ref{lem:percolationasmunilpotency} are equivalent even without the freezing hypothesis, and for the third item we only need the condition that some state $m \in P$ is \emph{persistent}, that is, $x_{\vec v} = m$ implies $f(x)_{\vec v} = m$. \begin{example} \label{ex:simpleca} Let $h = f_{\{(0,1), (1,1)\}}$, and let $x \in \{0,1\}^{\mathbb{Z}^2}$. Then $h^n(x)_{\vec 0} = 0$ for all $n \in \mathbb{N}$ if and only if there exists a path $(\vec z_i)_{i \in \mathbb{N}}$ in $\mathbb{Z}^2$ such that $\vec z_0 = \vec 0$, $\vec z_{i+1} \in \{\vec z_i + (0,1), \vec z_i + (1,1)\}$ and $x_{\vec z_i} = 0$ for all $i \geq 0$. Indeed, if such a path exists, then every cell in it will always have the state $0$, including the origin. On the other hand, if an infinite path does not exist, by K\H{o}nig's lemma there is a bound for the length of the paths. If the maximal length of a path starting from the origin in $x$ is $k$, then that in $h(x)$ is $k-1$. Inductively, we see that $h^k(x)_{\vec 0} = 1$. Take the product measure $\mu_p \in \mathcal{M}(\{0,1\}^{\mathbb{Z}^2})$ for ${0<p<1}$, and consider the probability $\theta(p)$ that in a $\mu_p$-random configuration $x \in \{0,1\}^{\mathbb{Z}^2}$ there exists an infinite path $(\vec z_i)_{i \in \mathbb{N}}$ of 0-states as above. This probability is clearly nonincreasing with respect to $p$, and the infimum of those $p$ for which it equals 0 is $1 - p_c$, where $p_c$ is the critical probability of nearest-neighbor oriented site percolation on $\mathbb{N}^2$; see~\cite[Section~12.8]{Gr13} for discussion on the analogous bond percolation model. If $p > 1 - p_c$, then $h$ trivializes $\mu_p$, and if $p < 1 - p_c$, then it does not. \end{example} \section{Freezing monotone CA} \label{sec:monotone} We begin our study of freezing monotone cellular automata on the binary alphabet by recalling the definitions of sub- and supercriticality from~\cite{GrGr96,BoSmUz15}. Since the definitions are not equivalent, we rename them for consistency's sake. \begin{definition} Let $f$ be a freezing and monotone CA on $\{0,1\}^{\mathbb{Z}^2}$. For a unit vector $\vec v \in S^1$, write $x^{\vec v} \in \{0,1\}^{\mathbb{Z}^2}$ for the configuration defined by \[ x^{\vec v}_{\vec z} = \begin{cases} 1, & \text{if $\vec v \cdot \vec z < 0$,} \\ 0, & \text{otherwise.} \end{cases} \] A direction $\vec v \in S^1$ is \emph{stable} for $f$, if $f(x^{\vec v}) = x^{\vec v}$, and \emph{strongly stable} if it is contained in an open interval of stable directions. We say $f$ is \begin{itemize} \item \emph{strongly subcritical}, if every direction is stable, \item \emph{subcritical}, if every open semicircle contains a strongly stable direction, \item \emph{weakly subcritical}, if it subcritical but not strongly subcritical, \item \emph{supercritical}, if some open semicircle contains no stable directions, and \item \emph{critical}, if none of the above hold. \end{itemize} \end{definition} \begin{lemma} \label{lem:subcrit-condition} Let $f$ be a freezing and monotone CA on $\{0,1\}^{\mathbb{Z}^2}$. Then the following are equivalent. \begin{itemize} \item $f$ is strongly subcritical. \item $F(f) = \emptyset$. \item There exists $x \in \{0,1\}^{\mathbb{Z}^2}$ such that $f(x) = x$ and ${C = \{ \vec z \in \mathbb{Z}^2 \;|\; x_{\vec z} = 0 \}}$ is nonempty and finite. \end{itemize} \end{lemma} The equivalence of the first two items was claimed in~\cite{BoSmUz15}. We include a proof for completeness, but postpone it until after a few auxiliary results. The first one allows us to separate convex compact sets with a rational line. \begin{lemma} \label{lem:halfplane} For any disjoint convex compact sets $A, B \subset \mathbb{R}^2$, there exists a closed rational half-plane $H$ such that $A \subset H$ and $B \cap H = \emptyset$. \end{lemma} \begin{proof} By a standard hyperplane separation theorem, such as~\cite[Theorem~4.4(i)]{Gr07}, there exist $\vec v \in \mathbb{R}^2$ and $a < b$ such that the two half-planes $G = \{ \vec z \in \mathbb{R}^2 \;|\; \vec z \cdot \vec v \leq a \}$ and $G' = \{ \vec z \in \mathbb{R}^2 \;|\; \vec z \cdot \vec v \leq b \}$ satisfy $A \subset G$ and $B \cap G' = \emptyset$. We approximate $\vec v$ by a rational vector $\vec q \in \mathbb{Q}^2$. By continuity of the dot product, if the approximation is accurate enough, the half-plane $H = \{ \vec z \in \mathbb{R}^2 \;|\; \vec z \cdot \vec q \leq (a+b)/2 \}$ satisfies the claim. \end{proof} \begin{lemma} \label{lem:nicepolygon} Let $A, B \subset \mathbb{R}^2$ be intersecting convex polygons such that for every face of $A$, there exist strictly longer faces of $B$ parallel and antiparallel to it. Then the intersection $A \cap B$ contains a vertex of $A$. \end{lemma} \begin{proof} First, $B$ cannot be contained in $A$: to every face of $A$ with a positive x-component corresponds a face of $B$ with a larger positive x-component, and hence the sum of these x-components is larger than the width of $A$. If $A \subset B$, then we are done. Otherwise some faces $F$ of $A$ and $G$ of $B$ intersect. If they are parallel, then one endpoint of $F$ lies in $G$. Otherwise, let $F_p$ and $F_a$ be the faces of $B$ parallel and antiparallel to $F$. Since $G$ is a face of $B$, the intersection point of $F$ and $G$ is not in the interior of the trapezoid $T = \chull(F_p \cup F_a) \subset B$. Both $F_p$ and $F_a$ are strictly longer than $F$, so one endpoint of $F$ lies in the interior of $\chull(T \cup G) \subset B$. \end{proof} \begin{lemma} \label{lem:existspolygon} Let $V$ be a finite set of directions, and let $r > 0$. Then there exists a polygon $B \subset \mathbb{R}^2$ such that \begin{itemize} \item every face of $B$ is strictly longer than $r$, and \item for each direction in $V$, there exists faces of $B$ parallel and antiparallel to it. \end{itemize} \end{lemma} \begin{proof} Let $W = V \cup (-V)$. For each $w \in W$, let $p_w = e^{2 \pi \alpha_w} \in S^1 \subset \mathbb{C}$, where $\alpha_w \in [0,1)$, be a point of the complex unit circle such that the tangent of $S^1$ at $p_w$, taken in the clockwise direction, is parallel to $w$. Let \[ \epsilon = \min_{v \neq w \in W, b \in \{0,1\}} |\alpha_v - \alpha_w - b| > 0. \] Order the $\alpha_w$ increasingly as $\alpha_0, \ldots, \alpha_{k-1}$, and define $q_{2i} = e^{2 \pi (\alpha - \epsilon/3)}$ and $q_{2i+1} = e^{2 \pi (\alpha + \epsilon/3)}$ for all $i \in [0, k-1]$. Now $\chull(\{s \cdot q_j \;|\; j \in [0, 2k-1]\})$ satisfies the required conditions for large enough $s > 0$. \end{proof} \begin{proof}[Proof of Lemma~\ref{lem:subcrit-condition}] Suppose first that $f$ is strongly subcritical. If there exists $N \in F(f)$, then by Lemma~\ref{lem:halfplane} there is a closed rational half-plane $H$ with $\vec 0 \in H$ and $N \cap H = \emptyset$. Translating $H$ so that $\vec 0$ lies on its border, we have ${N \subset \{\vec z \in \mathbb{Z}^2 \;|\; \vec z \cdot \vec v < 0 \}}$ for some $\vec v \in S^1$. This implies $f(x^{\vec v})_{\vec 0} = 1$, contradicting the stability of $\vec v$. Hence $F(f) = \emptyset$. Suppose then that $F(f) = \emptyset$. For all $A \subset \mathbb{Z}^2$, define $K(A) \in \{0,1\}^{\mathbb{Z}^2}$ by $K(A)_{\vec n} = 0 \Longleftrightarrow \vec n \in A$. For all $N \in G = G(f)$, define $A_N = \chull(N) \subset \mathbb{R}^2$. Let $V_N$ be the set of directions of the faces of the polygon $A_N$, and $r_N = \mathrm{diam}(A_N)$. Let $B \subset \mathbb{R}^2$ be given by Lemma~\ref{lem:existspolygon} for the parameters $V = \bigcup_{N \in G} V_N$ and $r = \max_{N \in G} r_N$. Let $C = B \cap \mathbb{Z}^2$. By Lemma~\ref{lem:nicepolygon}, we have $f_{\{N\}}(K(C)) = K(C)$ for all $N \in G$, and it follows that $f(K(C)) = K(C)$. Thus we can choose $x = K(C)$. Suppose that the third condition holds, and let $\vec v \in S^1$. Let $\vec w \in C$ be such that $\vec w \cdot \vec v$ is minimal. For each $\vec z \in \mathbb{Z}^2$ with $x^{\vec v}_{\vec z} = 0$ we then have $x^{\vec v} \leq \sigma_{\vec w - \vec z}(x)$ (because ${\vec z\cdot \vec v\geq 0}$ and by choice of $w$). By monotonicity $f(x^{\vec v}) \leq f(\sigma_{\vec w - \vec z}(x)) = \sigma_{\vec w - \vec z}(x)$, and in particular $f(x^{\vec v})_{\vec z} \leq \sigma_{\vec w -\vec z}(x)_{\vec z} = x_{\vec w} = 0$. Since $\vec z$ was arbitrary under condition ${ x^{\vec v}_{\vec z}=0}$ and since $f$ is freezing, $f(x^{\vec v}) = x^{\vec v}$ and $\vec v$ is stable for $f$. \end{proof} Next, we study infinite paths in $\phi$-images of Bernoulli random configurations, where $\phi$ is a local transformation of $\{0,1\}^{\mathbb{Z}^2}$. \begin{definition} For a map ${\phi:\{0,1\}^{\mathbb{Z}^2}\rightarrow \{0,1\}^{\mathbb{Z}^2}}$, the \emph{dependence neighborhood} ${N_\phi(\vec z)}$ at position ${\vec z\in\mathbb{Z}^2}$ is the minimal set ${N\subseteq \mathbb{Z}^2}$ such that ${\phi(x)_{\vec z}}$ is determined by $x_N$, i.e. ${x_N=y_N}$ implies ${\phi(x)_{\vec z}=\phi(y)_{\vec z}}$. We say $\phi$ is \emph{$k$-dependent} (${k\in\mathbb{N}}$) if for any $\vec z, \vec z'$ with ${\|\vec z-\vec z'\|_\infty>k}$ it holds ${N_\phi(\vec z)\cap N_\phi(\vec z')=\emptyset}$. \end{definition} \begin{definition} \label{def:pathsets} For $b \in \{0,1\}$ and $\vec z \in \mathbb{Z}^2$, denote by $P^+_b(\vec z)$ the set of configurations $x \in \{0,1\}^{\mathbb{Z}^2}$ such that there is an infinite path $(a_i)_{i \in \mathbb{N}}$ in $\mathbb{Z}^2$ such that $a_0 = \vec z$, $a_{i+1} - a_i \in \{(0,1), (1,1)\}$ and $x_{a_i} = b$ for all $i \geq 0$. Denote its complement by $P^-_b(\vec z)$. We may abbreviate $P^+_b(\vec z) = P^+_b$ and $P^-_b(\vec z) = P^-_b$ when $\vec z$ is clear from the context. \end{definition} \begin{lemma} \label{lem:lowerbernoulli} For any ${k\in\mathbb{N}}$, there is ${0<p_k<1}$ such that for any ${0<p\leq 1}$ and for any $k$-dependent map ${\phi:\{0,1\}^{\mathbb{Z}^2}\rightarrow \{0,1\}^{\mathbb{Z}^2}}$ verifying ${\mu_p(\phi^{-1}([1]_{\vec z}))>p_k}$ for all ${\vec z\in\mathbb{Z}^2}$ it holds: \begin{itemize} \item ${\mu_p(\phi^{-1}(P_0^-(\vec z)))=1}$ \item ${\mu_p(\phi^{-1}(P_1^+(\vec z)))>0}$ \end{itemize} \end{lemma} \begin{proof} Let us first consider the case where $\phi$ is the identity map. Let $p_c = \sup\{p : \mu_p(P_1^+)=0\}$, which is the critical probability of directed percolation on the square lattice. It is a classical result from percolation theory that $0 < p_c < 1$. By symmetry between states $0$ and $1$, for ${p>\max(p_c,1-p_c)}$ both ${\mu_p(P_0^-)=1}$ and ${\mu_p(P_1^+)>0}$ hold. The general case follows from the results of~\cite{LiScSt97}. Simplifying the setting a bit to match our needs, we say a measure $\mu \in \mathcal{M}(\{0,1\}^{\mathbb{Z}^2})$ is $k$-dependent if for any ${A,B\subseteq\mathbb{Z}^2}$ with ${\min \{ \|\vec z_A-\vec z_B\|_\infty \;|\; \vec z_A \in A, \vec z_B \in B \} > k}$, the random variables $x|_A$ and $x|_B$ are independent when $x \in \{0,1\}^{\mathbb{Z}^2}$ is drawn from $\mu$. On the other hand, we say $\mu$ dominates another measure $\mu' \in \mathcal{M}(\{0,1\}^{\mathbb{Z}^2})$ if for any upper-closed measurable set $E$ (\textit{i.e.} ${x\in E}$ and ${x_{\vec z}\leq y_{\vec z}}$ for all $\vec z\in\mathbb{Z}^2$ implies $y\in E$) we have ${\mu(E)\geq\mu'(E)}$. Then~\cite[Theorem 0.0]{LiScSt97} implies that for any $k \geq 0$ and ${0<p<1}$, if $\mu \in \mathcal{M}(\{0,1\}^{\mathbb{Z}^2})$ is a $k$-dependent measure and $\min \{ \mu([1]_{\vec z}) \;|\; \vec z \in \mathbb{Z}^2 \}<1$ is large enough, then $\mu$ dominates the product measure $\mu_p$. Note that $\mu$ need not be shift-invariant. For any $k$-dependent map $\phi$ and any product measure $\mu_p$ it is the case that $\mu_p\circ\phi^{-1}$ is $k$-dependent. The domination result above allows to conclude since both $P_0^-$ and $P_1^ +$ are upper-closed sets. \end{proof} We need one more geometric lemma before proving the main result of this section. \begin{lemma} \label{lem:nicevector} Let $B \subset \mathbb{R}^2 \setminus \{\vec 0\}$ be a convex compact set. Then there exists $\vec v = (a,b) \in \mathbb{Z}^2$ such that $\gcd(a,b) = 1$ and for any $\vec w \in \mathbb{R}^2$ with $\vec v \nparallel \vec w$, we have either $B \subset \mathbb{R} \vec v + \mathbb{R}_{>0} \vec w$ or $B \subset \mathbb{R} \vec v + \mathbb{R}_{<0} \vec w$. \end{lemma} \begin{proof} Let $H = \{ \vec z \in \mathbb{R}^2 \;|\; \vec z \cdot \vec q \leq c \}$ be the rational half-plane given by Lemma~\ref{lem:halfplane} for $A = \{\vec 0\}$ and $B$. By rescaling, we may assume $\vec q = (i,j) \in \mathbb{Z}^2$ with $\gcd(i,j) = 1$. Choose $\vec v = (-j,i)$, so that $\vec v \cdot \vec q = 0$. Then any $\vec w \nparallel \vec v$ forms a basis of $\mathbb{R}^2$ with $\vec v$ and satisfies $\vec w \cdot \vec q \neq 0$, and we have either $H = \mathbb{R} \vec v + \mathbb{R}_{\geq 0} \vec w$ or $H = \mathbb{R} \vec v + \mathbb{R}_{<0} \vec w$. \end{proof} \begin{theorem} \label{thm:trivializes} Let $f$ be a freezing monotone cellular automaton on $\{0,1\}^{\mathbb{Z}^2}$. Then $f$ trivializes some nontrivial Bernoulli measure if and only if it is not strongly subcritical. \end{theorem} \begin{proof} Suppose first that $f$ is subcritical. By Lemma~\ref{lem:subcrit-condition} and monotonicity, there exists a nonempty finite set $C \subset \mathbb{Z}^2$ such that $x|_C = 0^C$ implies $f^n(x)|_C = 0^C$ for all $x \in \{0,1\}^{\mathbb{Z}^2}$ and $n \geq 0$. Under any nontrivial Bernoulli measure $\mu$, the event $x|_C = 0^C$ has a nonzero probability, so $f$ does not trivialize $\mu$. Suppose then that $f$ is not strongly subcritical. Let $N \in F(f)$, and define $g = f_N$. We will show that $g$ trivializes a nontrivial Bernoulli measure $\mu \in \mathcal{M}(\{0,1\}^{\mathbb{Z}^2})$, and then so does $f$. First, let $\vec v = (x_1, y_1) \in \mathbb{Z}^2$ be the vector given by Lemma~\ref{lem:nicevector} for the set $\chull(N) \subset \mathbb{R}^2$. Since $\gcd(x_1, y_1) = 1$, Bezout's identity gives another vector $\vec w = (x_2, y_2) \in \mathbb{Z}^2$ such that $x_1 y_2 - x_2 y_1 = \pm 1$. Let $T = \left( \begin{smallmatrix} x_1 & x_2 \\ y_1 & y_2 \end{smallmatrix} \right)$, which now has determinant $\pm 1$. By the assumption on $\vec v$, we have either $T^{-1}(N) \subset \mathbb{Z} \times \mathbb{Z}_{>0}$ or $T^{-1}(N) \subset \mathbb{Z} \times \mathbb{Z}_{<0}$, and we may choose the former case by negating $\vec w$ if necessary. We replace $g$ by the automaton $T^{-1} \circ g \circ T$, which clearly trivializes a given Bernoulli measure if and only if $g$ does. We apply another automorphism of $\mathbb{Z}^2$, a shear transformation $\left( \begin{smallmatrix} 1 & t \\ 0 & 1 \end{smallmatrix} \right)$ for some large $t \in \mathbb{N}$, to guarantee $N \subset \mathbb{Z}_{\geq 0} \times \mathbb{Z}_{>0}$. Now there exist $a, b \in \mathbb{N}$, computable from $N$, such that if $x_{\vec n} = 1$ for all $\vec n \in [0, 2b-1] \times [a, 2a-1]$, then $g^a(x)_{\vec m} = 1$ for all $\vec m \in [0, b-1] \times [0, a-1]$. Define the map ${\phi:\{0,1\}^{\mathbb{Z}^2}\rightarrow \{0,1\}^{\mathbb{Z}^2}}$ by \[\phi(x)_{(i,j)} = \begin{cases} 1 & \text{ if $x_{(bi,aj)+\vec m}=1$ for all $\vec m \in [0, b-1] \times [0, a-1]$},\\ 0 & \text{ otherwise.} \end{cases} \] As in Example~\ref{ex:simpleca}, it follows from K\H{o}nig's Lemma that if ${x\in P_0^-(\vec 0)}$ then there is $t$ such that ${g^t(x)_{\vec 0}=1}$. Note that $\phi$ is $0$-dependent. Note also that ${\mu_p(\phi^{-1}([1]_{\vec z}))}$ can be arbitrarily close to $1$ for all $\vec z$ when $p$ is chosen large enough. We deduce from the first item of Lemma~\ref{lem:lowerbernoulli} that $g$ trivializes some Bernoulli measure $\mu_p$ with ${0<p<1}$. \end{proof} \begin{corollary} Given a freezing and monotone cellular automaton $f$ on $\{0,1\}^{\mathbb{Z}^2}$, it is decidable whether $f$ trivializes a nontrivial Bernoulli measure. \end{corollary} \begin{theorem} Let $f$ be a freezing monotone cellular automaton on $\{0,1\}^{\mathbb{Z}^2}$. If $G(f)$ is empty and there exist two linearly independent coordinates $\vec n, \vec m \in \mathbb{Z}^2$ such that every $N \in F(f)$ contains either $\vec n$ and $\vec m$, or $- \vec n$ and $- \vec m$, then $f$ does not trivialize every nontrivial Bernoulli measure. \end{theorem} \begin{proof} The proof is the same as in the second direction of Theorem~\ref{thm:trivializes}, but switching the roles of $1$ and $0$ in the reduction. \end{proof} \section{Freezing non-monotone CA} \label{sec:non-monotone} The goal of this section is to study the same classical question of bootstrap percolation (equivalently $\mu$-nilpotency by Lemma~\ref{lem:percolationasmunilpotency}) but dropping the monotone assumption in the CA considered. We show that it gives rise to much more complexity through two results: an undecidability result and a construction of an example with two phase transitions. \begin{theorem} The problem of whether a given binary freezing CA trivializes some nontrivial Bernoulli measure is undecidable. \end{theorem} \begin{proof} We first give a reduction from the halting problem of Turing machines to the above problem for freezing CA with arbitrary number of states. Then we show how to recode the construction with only two states. Let $T$ be any Turing machine and let $Q_T$ be a set of Wang tiles that simulates its valid space-time diagrams in the classical sense (see for example~\cite[§4]{Ro71}) with ${q_0\in Q_T}$ and ${q_h\in Q_T}$ representing the initial and halting states respectively. Without loss of generality concerning undecidability of the halting problem, we consider Turing machines that only use a right semi-infinite tape and that always go to the rightmost non-blank position before entering halting state. We construct a freezing CA $F_T$ with a single maximum state $M$ satisfying the following implications: \begin{enumerate} \item if $T$ halts starting from the empty tape, then there exists a finite ``obstacle'' pattern of states of $F_T$ which is not $M$-uniform and that stays unchanged under the dynamics of $F_T$ whatever the context; \item if $T$ does not halt, then, for any configuration $x$ such that the maximal rectangle containing the origin and without occurence of state $M$ inside is finite, $F_T^n(x)_{\vec 0}=M$ for some finite $n$. \end{enumerate} In the first case, $F_T$ does not trivialize any Bernoulli measure, because a cell has a positive probability to be in state $M$ in the initial configuration (and then will never change) and also has a positive probability to be in a state different from $M$ inside the finite ``obstacle'' pattern (and will never change either). In the second case, $\mu_p$-almost all configurations $x$ have the described property for any nontrivial Bernoulli measure $\mu_p$, because there are almost surely occurrences of $M$ on each axis, both for positive and negative coordinates. Hence $F_T$ trivializes all nontrivial Bernoulli measures in this case. We now describe the CA $F_T$. Its dynamics is basically to check that the configuration belongs to some SFT of ``valid'' configurations, to turn any cell into $M$ when a local error is detected and to propagate the state $M$ to neighboring cells according to certain conditions. Denote $D = \{N, NE, E, SE, S, SW, W, NW\}$. We interpret is as a set of cardinal and diagonal directions (north, north-east, east, etc). The state set of $F_T$ is ${Q_F = Q_T\cup \{M\}\cup D}$. We call a \emph{frame} any rectangular pattern whose perimeter is made with states from $D$ in the following way: the north, east, south, west sides are respectively in state $N$, $E$, $S$, $W$, and the north-east, south-east, south-west, north-west corners are respectively in states $NE$, $SE$, $SW$, $NW$. We say that a frame contains a valid halting computation if (see Figure~\ref{fig:frame}): \begin{itemize} \item the bottom-left cell of the interior is $q_0$ and the bottom line of the interior represents an empty tape; \item the upper-right position of the interior is $q_h$; \item any other position of the interior is in $Q_T$ and they respect the tiling conditions of $Q_T$, and the constraint that the head must not escape the frame. \end{itemize} Note in particular that our assumption on Turing machines ensures that a halting computation always fits inside a rectangular space-time diagram with initial state at the lower-left corner and halting state at the upper-right one. Then, valid configurations are those made of frames containing a valid halting computation, and with only state $M$ outside frames. All these conditions can be defined by a set a valid ${2\times 2}$ patterns (intuitively, the ${2\times 2}$ patterns appearing in Figure~\ref{fig:frame}). \begin{figure}[htp] \centering \begin{tikzpicture}[scale=0.8] \stR{0}{0}{$M$}; \stR{1}{1}{$M$}; \stR{1}{9}{$M$}; \stR{0}{10}{$M$}; \stR{9}{10}{$M$}; \stR{8}{9}{$M$}; \stR{8}{1}{$M$}; \stR{9}{0}{$M$}; \draw[dotted] (.5,1)--(.5,10); \draw[dotted] (1.5,2)--(1.5,9); \draw[dotted] (9.5,1)--(9.5,10); \draw[dotted] (8.5,2)--(8.5,9); \draw[dotted] (1,.5)--(9,.5); \draw[dotted] (2,1.5)--(8,1.5); \draw[dotted] (1,10.5)--(9,10.5); \draw[dotted] (2,9.5)--(8,9.5); \stR{2}{2}{$SW$}; \stR{3}{2}{$S$}; \stR{6}{2}{$S$}; \stR{7}{2}{$SE$}; \stR{2}{3}{$W$}; \stR{7}{3}{$E$}; \stR{2}{7}{$W$}; \stR{7}{7}{$E$}; \stR{2}{8}{$NW$}; \stR{3}{8}{$N$}; \stR{6}{8}{$N$}; \stR{7}{8}{$NE$}; \draw[dotted] (2.5,4)--(2.5,7); \draw[dotted] (7.5,4)--(7.5,7); \draw[dotted] (4,2.5)--(6,2.5); \draw[dotted] (4,8.5)--(6,8.5); \draw[very thick] (2,2)--(2,9)--(8,9)--(8,2)--cycle; \draw[very thick] (3,3)--(3,8)--(7,8)--(7,3)--cycle; \stR{3}{3}{$q_0$}; \stR{6}{7}{$q_h$}; \draw[->,very thick] (3.5,4)--(3.5,5)--(6.5,6) node[midway,sloped,above] {Turing head}--(6.5,7); \end{tikzpicture} \caption{A frame encoding a valid halting computation} \label{fig:frame} \end{figure} Depending of its state, we define the \emph{active neighbors} of a cell: \begin{itemize} \item a cell in a state from $Q_F\setminus D$ has four active neighbors, one in each cardinal direction; \item a cell in a state $d \in D$ has as active neighbors in the cardinal directions which do not appear in $d$: \emph{e.g.} a cell in state $NE$ has active neighbours to the south and west. \end{itemize} The dynamics of $F_T$ is precisely the following: \begin{enumerate} \item if a cell belongs to some invalid $2\times 2$ pattern, then it becomes $M$; \item if a cell has an occurrence of $M$ among its active neighbors, then it becomes $M$; \item otherwise the state doesn't change. \end{enumerate} The CA $F_T$ has neighborhood $\{-1,0,1\}^2$ and its local rule can be algorithmically determined from $T$. From this definition, it is clear that when $T$ halts starting from the empty tape, then $F_T$ admits a finite obstacle pattern: a frame encoding a valid computation and surrounded by state $M$ like in Figure~\ref{fig:frame}. Now suppose that $T$ does not halt and consider any configuration $x$ with an occurrence of $M$ on each semi-axis, both for positive and negative coordinates. We want to show that $F_T^n(x)_{\vec 0} = M$ for some $n \geq 0$. Suppose that $x_{\vec 0} = M$ and consider the (finite) maximal rectangle $R\subseteq\mathbb{Z}^2$ whose interior contains the origin but no occurrence of state $M$ in $x$. We proceed by induction on the size of $R$. If $R$ is $1 \times 1$, then the origin is surrounded by $M$-cells and becomes $M$ in one step. Suppose then that the claim holds for all strictly smaller rectangles. Each side of $R$ has a neighbor outside of $R$ in state $M$ (if not $R$ would not be maximal). Hence, if $R$ is not a valid finite frame encoding a halting configuration then in one step at least one cell in the interior of $R$ becomes $M$ (either because the SFT condition is locally violated somewhere or because some cell has an active neighbor in state $M$). Since $T$ does not halt, this means that some $M$ appears in the interior $R$, and in $F_T(x)$ we either have the cell at the origin in state $M$, or a smaller maximal rectangle of non-$M$ states so we can conclude by induction. So far we have proved the undecidability result for freezing CA with an arbitrary number of states. We now adapt the construction to binary freezing CA. Precisely, for any $T$ we recursively construct a freezing CA $G_T$ with only two states satisfying the following: \begin{enumerate} \item if $T$ halts starting from the empty tape, then there exists a finite ``obstacle'' pattern of states of $F_T$ which is not $1$-uniform and that stays unchanged under the dynamics of $G_T$ whatever the context; \item if $T$ does not halt, then there exist a constant $N$ such that for any configuration $x$ such that the maximal rectangle containing the origin and without occurence of an ${N\times N}$ block of $1$s inside is bounded, we have $G_T^n(x)_{\vec 0}=1$ for some $n$. \end{enumerate} For the same reasons as before, a construction with the above properties proves the undecidability result claimed in the statement of the theorem. The CA $G_T$ is constructed from $F_T$ by a standard block encoding. Let $N$ be large enough to recode any state of $F_T$ as a ${N\times N}$ block of $0$s and $1$s in the following way: \begin{itemize} \item $M$ is coded by a ${N\times N}$ block of $1$s; \item any state in ${Q_F\setminus\{M\}}$ is coded by an ${N\times N}$ block made of an outer ${N\times N}$ annulus of $1$s, an inner ${(N-2)\times(N-2)}$ annulus of $0$s, and inside them a uniquely defined ${(N-4)\times(N-4)}$ pattern of $0$s and $1$s. \end{itemize} A given ${N\times N}$ block over alphabet ${\{0,1\}}$ is called valid if it is one of the coding blocks above, and invalid otherwise. The dynamics of $G_T$ is the following: \begin{itemize} \item if a cell is not inside the central block of some $3N \times 3N$ pattern of nine valid blocks, then it turns into $1$; \item otherwise, if the local rule of $F_T$ applied to the pattern $w \in Q_T^{3 \times 3}$ encoded by the blocks yields $M$, then it turns into $1$; \item otherwise the cell retains its state. \end{itemize} Note that by choice of the coding (frame of $0$s inside a frame of $1$s) there is always at most one way to find a valid block around a cell which is in state $0$, hence the second case of the dynamics above is well-defined. Moreover, if a cell in state $0$ inside a valid block turns into $1$, then the entire block turns into $1^{N \times N}$. Finally, by construction, on properly encoded configurations, $G_T$ exactly simulates $F_T$. Therefore, if $T$ halts, then the block encoding of a valid frame of $F_T$ (containing a halting computation) surrounded by ${N\times N}$ blocks of $1$s clearly forms a finite obstacle pattern under the dynamics of $G_T$. Now suppose that $T$ does not halt and consider a configuration $x$ with a finite maximal rectangle $R$ around the origin not containing any ${N\times N}$ block of $1$s. Like for $F_T$ we proceed by induction on the size of $R$. If $R$ doesn't contain any valid block then every cell it contains turns into $1$ in one step and we are done. If $R$ contains a valid block with an invalid neighborhood, it turns into a ${N\times N}$ block of $1$s in one step and we can apply the induction hypothesis. If $R$ is entirely made of valid blocks with valid neighborhoods of blocks, we can apply the analysis of $F_T$ and show that $G_T(x)$ has a smaller maximal rectangle. In any case, we show that after some time the central cell turns into $1$. \end{proof} The second result of this section is the following. \begin{theorem} \label{thm:weird-nilpotent} There exists a freezing CA $f$ and two Bernoulli measures $\mu_{\epsilon_1}$ and $\mu_{\epsilon_2}$ on $\{0,1\}^{\mathbb{Z}^2}$ such that $0<\epsilon_1 < \epsilon_2<1$, and $f$ trivializes $\mu_{\epsilon_1}$ but not $\mu_{\epsilon_2}$. \end{theorem} The CA of the above theorem can only turn 0s into 1s, and starting from a $\mu_{\epsilon_1}$-random configuration it will converge towards the all-$1$ configuration, but starting from a $\mu_{\epsilon_2}$-random configuration, which has a strictly higher density of 1s, it will leave some cells in state 0 forever. To understand the fundamental use of non-monotony in the construction and resolve this apparent paradox, the basic idea is the following: If a freezing CA has a large enough neighborhood, it can locally ``see'' a good enough approximation of the density of 1s in the initial configuration. Then, if this local estimate of density is close to $\epsilon_1$ it can produce a lot of 1s locally, while if it is close to $\epsilon_2$ it doesn't. This density jump when starting from $\epsilon_1$ is chosen so that it passes the critical probability of some percolation process (a modification of Example~\ref{ex:simpleca}), while the system stays below this critical probability when starting close enough to $\epsilon_2$. There are thus two processes going on: a density modification and a percolation process. Our main trick is to use a block encoding to avoid interactions between the two. A block of 1s encodes a single cell in state $1$ of the percolation process of Example~\ref{ex:simpleca}, and, when such a block appears in the neighborhood, the density modification is inhibited. Thanks to this trick, the CA behaves as if the density modification was only applied once at the initial step, and then successive steps just reproduce the percolation process on a modified initial configuration. Recall Hoeffding's inequality~\cite{Ho63}, which will be used to quantify the local estimated density of 1s: if $\mathbb{P}(n,p,\epsilon)$ is the probability that the average of $n$ binary Bernoulli trials, where the probability of $1$ is $p$, does not lie in $[p-\epsilon, p+\epsilon]$, then \begin{equation} \label{eq:technicalbernoulli} \mathbb{P}(n,p,\epsilon) \leq 2 \exp \left( -2 \epsilon^2 n \right ) \end{equation} for all $\epsilon > 0$. \begin{proof}[Proof of Theorem~\ref{thm:weird-nilpotent}] We first define the automaton $f$ using some undefined parameters, and then show that it is correct for some choice of said parameters. The parameters are $N \in \mathbb{N}$ and $\epsilon_1, \epsilon_2, \delta \in \mathbb{R}$ subject to $0 < \delta < \epsilon_1 < \epsilon_2 - \delta$ and $\epsilon_2 < 1$, so that $f = f_{N, \epsilon_1, \epsilon_2, \delta}$. We will define it in two phases, such that $f = h \circ g$ for some other CA $g$ and $h$. In the remainder of this proof, $x_D \equiv 1$ for a configuration $x$ and finite $D \subset \mathbb{Z}^2$ means that $x_{\vec z} = 1$ for all $\vec z \in D$. We first define an auxiliary CA $g'$ by \[ g'(x)_{\vec 0} = \begin{cases} 1, & \text{if $x_{\vec z + [0,N-1]^2} \not\equiv 1$ for all $\vec z \in [-4N,3N]^2$} \\ & \text{and $|x_{[-N,N]^2}|_1 / (2N+1)^2 \in (\epsilon_1 - \delta, \epsilon_1 + \delta)$,} \\ 0, & \text{otherwise.} \end{cases} \] The role of $g'$ is to indicate regions in which the density modification process should take place. The CA $g$, which implements said process, is then defined by \[ g(x)_{\vec 0} = \begin{cases} 1, & \text{if $x_{\vec 0} = 1$ or $g'(x)_{\vec z + [0,N-1]^2} \equiv 1$} \\ & \text{for some $\vec z \in [-N+1,0]^2$,} \\ 0, & \text{otherwise.} \end{cases} \] The CA $h$, which implements the percolation process, is defined by \[ h(x)_{\vec 0} = \begin{cases} 1, & \text{if $x_{\vec 0} = 1$ or $x_{\vec z + [0,2N-1] \times [N,2N-1]} \equiv 1$} \\ & \text{for some $\vec z \in [-N+1,0]^2$,} \\ 0, & \text{otherwise.} \end{cases} \] \begin{claim} \label{cl:idemp-g} For all $n \geq 0$ we have $g \circ h^n \circ g = h^n \circ g$. \end{claim} In particular, $f^n = h^n \circ g$ for any integer ${n\geq 1}$. \begin{proof} Say that a configuration $x \in \{0,1\}^{\mathbb{Z}^2}$ is \emph{nice} if for all $\vec z \in \mathbb{Z}^2$ such that $x_{\vec z} = 0$, we have $g'(x)_{\vec v + [0,N-1]^2} \not\equiv 1$ for all $\vec v \in \vec z - [0,N-1]^2$. It is now enough to prove for all $x \in \{0,1\}^{\mathbb{Z}^2}$ that \begin{enumerate} \item $g(x)$ is nice, \item if $x$ is nice, then $x = g(x)$, and \item if $x$ is nice, then $h(x)$ is nice. \end{enumerate} The second item is clear by the definition of $g$. We prove the first and third items using the fact that $g$ and $h$ only change cells by creating large batches of $1$s, which suppress the density modification process. For the first item, suppose for a contradiction that $g(x)$ is not nice: for some $\vec z \in \mathbb{Z}^2$ and $\vec z_1 \in \vec z - [0, N-1]^2$ we have $g(x)_{\vec z} = 0$ and $g'(g(x))_{\vec z_1 + [0,N-1]^2} \equiv 1$. By the definition of $g$, we in particular have $g'(x)_{\vec z_1 + [0,N-1]^2} \not\equiv 1$, so there is some $\vec z_2 \in \vec z_1 + [0, N-1]^2$ with $g'(x)_{\vec z_2} = 0$ and $g'(g(x))_{\vec z_2} = 1$. The latter equation implies \begin{equation} \label{eq:no-blobs} g(x)_{\vec v + [0,N-1]^2} \not\equiv 1 \end{equation} for all $\vec v \in \vec z_2 + [-4N, 3N]^2$, and since $g$ is freezing, the same holds for $x$ in place of $g(x)$. Thus the density of 1s in $g(x)_{\vec z_2 + [-N,N]}$ lies in $(\epsilon_1-\delta, \epsilon_1+\delta)$, but that of $x_{\vec z_2 + [-N,N]}$ does not. Hence $g(x)_{\vec z_3} \neq x_{\vec z_3}$ for some $\vec z_3 \in \vec z_2 + [-N, N]$. This, in turn, implies that there is some ${\vec z_4 \in \vec z_3+[-N+1,0]^2}$ such that ${g'(x)_{\vec z_4+[0,N-1]^2} \equiv 1}$. Now we in fact have ${g(x)_{\vec z_4 + [0, N-1]^2} \equiv 1}$. This contradicts~\eqref{eq:no-blobs} since $\vec z_4 \in \vec z_2 + [-2N+1, N]^2$. For the third item, suppose for a contradiction that $x$ is nice but $h(x)$ is not: for some $\vec z \in \mathbb{Z}^2$ and $\vec z_1 \in \vec z - [0, N-1]^2$ we have $h(x)_{\vec z} = 0$ and $g'(h(x))_{\vec z_1 + [0,N-1]^2} \equiv 1$. Then $x_{\vec z} = 0$, and by niceness ${g'(x)_{\vec z_1+[0,N-1]^2} \not\equiv 1}$. Take $\vec z_2 \in \vec z_1+[0,N-1]^2$ with $g'(x)_{\vec z_2} = 0$. As in the previous paragraph, we have \begin{equation} \label{eq:no-blobs2} h(x)_{\vec v + [0,N-1]^2} \not\equiv 1 \end{equation} for all $\vec v \in \vec z_2 + [-4N, 3N]^2$ and similarly for $x$, and $h(x)_{\vec z_3} \neq x_{\vec z_3}$ for some $\vec z_3 \in \vec z_2 + [-N, N]$. By the definition of $h$, there now exists ${z_4 \in \vec z_3+[-N+1,0]^2}$ with ${x_{\vec z_4 + [0,2N-1]\times [N,2N-1]} \equiv 1}$. But $\vec z_4 + (0,N) \in \vec z_2 + [-2N+1, 2N]^2$, contradicting \eqref{eq:no-blobs2}. \end{proof} Define two functions $A$ and $B$ from $\{0,1\}^{\mathbb{Z}^2}$ to itself by \begin{align*} A(x)_{(a,b)} & = \begin{cases} 1, & \text{if $g(x)_{(aN, bN)} = 0$,} \\ 0, & \text{otherwise,} \end{cases} \\ B(x)_{(a,b)} & = \begin{cases} 1, & \text{if $g(x)_{(aN, bN) + [0,N-1]^2} \equiv 1$,} \\ 0, & \text{otherwise.} \end{cases} \end{align*} Since the radius of $g$ is at most $5N$, the two functions $A$ and $B$, when seen as random variables over a Bernoulli measure on $\{0,1\}^{\mathbb{Z}^2}$, are $5$-dependent as defined in Lemma~\ref{lem:lowerbernoulli}. Following the notations of Definition~\ref{def:pathsets} we make the following claim. \begin{claim} \label{cl:paths} Let $x \in \{0,1\}^{\mathbb{Z}^2}$. \begin{itemize} \item If ${A(x) \in P_1^+(\vec 0)}$ then ${f^t(x)_{\vec 0}=0}$ for all $t$. \item If ${B(x) \in P_0^-(\vec 0)}$ then ${f^t(x)_{\vec 0}=1}$ for some $t$. \end{itemize} \end{claim} \begin{proof} If ${A(x) \in P_1^+}$ then there is an infinite path ${(\vec z_i)_{i\in\mathbb{N}}}$ as in Definition~\ref{def:pathsets} with ${A(x)_{z_i}=1}$ for all ${i\in\mathbb{N}}$ and $\vec z_0 = \vec 0$. Let us show by induction on $t$ that ${h^t(g(x))_{N\vec z_i}=0}$ for all ${i\in\mathbb{N}}$. The first item follows from this by Claim~\ref{cl:idemp-g}. By hypothesis and by definition of $A$ it is true for ${t=0}$. Suppose now that it holds for some $t \geq 0$. For any ${i\in\mathbb{N}}$ we have ${N\vec z_{i+1}\in N\vec z_i + \{(0,N),(N,N)\}}$. By hypothesis ${h^t(g(x))_{N\vec z_i}=h^t(g(x))_{N\vec z_{i+1}}=0}$, so we deduce ${h^{t+1}(g(x))_{N\vec z_i}=0}$ by the definition of $h$. Suppose that ${B(x) \in P_0^-}$ and consider finite paths $(\vec z_i)_{0 \leq i \leq m}$ with $\vec z_0 = \vec 0$ and $\vec z_{i+1} - \vec z_i \in \{(0,1), (1,1)\}$ for each $0 \leq i < m$. By K\H{o}nig's lemma there is a bound $\beta(x)$ on the length of those paths with ${B(x)_{\vec z_i}=0}$ for all ${0\leq i\leq m}$. By definition of $B$ and $h$, we have $h(g(x)) \in P_0^-$ and $\beta(h(g(x))) \leq \beta(x)-1$ (recall that $g(h(g(x))) = h(g(x))$ by Claim~\ref{cl:idemp-g}). By immediate induction we have ${f^{\beta(x)}(x)_{\vec 0}=h^{\beta(x)}(g(x))_{\vec 0}=1}$ and the second item of the claim follows. \end{proof} In order to apply Lemma~\ref{lem:lowerbernoulli} simultaneously to $A$ and $B$, we need to choose the parameters of our construction so that the marginals of both ${\mu_{\epsilon_2} A^{-1}([1])}$ and ${\mu_{\epsilon_1} B^{-1}([1])}$ are close enough to $1$. We claim that it is possible. \begin{claim} \label{cl:params} For any $0<\epsilon<1$ there are parameters $N$, $\epsilon_1$, $\epsilon_2$ and $\delta$ such that we have simultaneously ${\mu_{\epsilon_2} A^{-1}([1]_{\vec z}) > 1-\epsilon}$ and ${\mu_{\epsilon_1} B^{-1}([1]_{\vec z})>1-\epsilon}$ for all ${\vec z\in\mathbb{Z}^2}$. \end{claim} \begin{proof} It is sufficient to prove the inequalities for ${\vec z=\vec 0}$ since Bernoulli measures are translation invariant and translations are turned into translations through $A^{-1}$ and $B^{-1}$. We first show that $\epsilon_1$, $\epsilon_2$ and $\delta$ can be chosen so that for all $N$ large enough we have ${\mu_{\epsilon_2} A^{-1}([1]_{\vec 0}) > 1-\epsilon}$. By definition $A(x)_{\vec 0}=1$ iff $g(x)_{\vec 0}=0$. So ${\mu_{\epsilon_2} A^{-1}([1]_{\vec 0}) \geq 1 - \mu_{\epsilon_2} g^{-1}([1]_{\vec 0})}$. Moreover, by the definition of $g$ and $g'$ we have $g^{-1}([1]_{\vec 0}) \subseteq [1]_{\vec 0} \cup D_{\vec 0}$, where $D_{\vec z}$ is the set of configurations $x \in \{0,1\}^{\mathbb{Z}^2}$ such that the finite pattern $x_{\vec z+[-N,N]^2}$ has a density of $1$-symbols strictly between $\epsilon_1-\delta$ and $\epsilon_1+\delta$. We deduce that \[ \mu_{\epsilon_2} A^{-1}([1]_{\vec 0})\geq 1 - \epsilon_2 - \mu_{\epsilon_2}(D_{\vec 0}). \] Let us fix $\epsilon_2 = \epsilon/2$ and any values of $\epsilon_1$ and $\delta$ such that $0 < \delta < \epsilon_1 < \epsilon_2 - \delta$. From~\eqref{eq:technicalbernoulli} we know that ${\mu_{\epsilon_2}(D_{\vec 0})} \longrightarrow 0$ as $N$ grows. We deduce that for large enough $N$, we have ${\mu_{\epsilon_2} A^{-1}([1]_{\vec 0}) > 1-\epsilon}$. Let us now prove that for the parameters $\epsilon_1$, $\epsilon_2$ and $\delta$ fixed above and for large enough $N$, we also have ${\mu_B([1]_0)>1-\epsilon}$. We compute \begin{align*} \mu_{\epsilon_1} B^{-1}([1]_{\vec 0}) \geq {} & \mu_{\epsilon_1} (\{x: g'(x)_{[0,N-1]^2} \equiv 1\})\\ {} \geq {} & 1 - \sum_{\vec z \in [-4N, 4N-1]^2} \mu_{\epsilon_1} (\{x : x_{\vec z+[0,N-1]^2} \equiv 1\})\\ & - \sum_{\vec z \in [0, N-1]} \mu_{\epsilon_1} (\{0,1\}^{\mathbb{Z}^2} \setminus D_{\vec z})\\ {} \geq {} & 1 - 81 \cdot N^2 \cdot \epsilon_1^{N^2} - N^2 (1-\mu_{\epsilon_1} (D_{\vec 0})). \end{align*} The last expression goes to $1$ as $N$ goes to infinity because by~\eqref{eq:technicalbernoulli}, $\mu_{\epsilon_1} (D_{\vec 0}) \longrightarrow 1$ exponentially fast as $N$ grows. \end{proof} From Claim~\ref{cl:paths}, Claim~\ref{cl:params} and Lemma~\ref{lem:lowerbernoulli} we deduce that $f$ trivializes $\mu_{\epsilon_1}$ but not $\mu_{\epsilon_2}$. \end{proof} \section{Future directions} \label{sec:future} In our study of trivialization properties of freezing monotone CA, we have concentrated on the binary alphabet. It remains open whether the characterization of Lemma~\ref{lem:subcrit-condition} can be generalized to arbitrary poset alphabets, and whether the trivialization properties are dedidable. \begin{question} Given a finite poset $P$ and a freezing monotone CA $f$ on $P^{\mathbb{Z}^2}$, is it decidable whether \begin{enumerate} \item $f$ trivializes all full-support Bernoulli measures? \item $f$ trivializes some full-support Bernoulli measure? \end{enumerate} \end{question} Theorem~\ref{thm:weird-nilpotent} shows that the property of trivializing a Bernoulli measure need not be monotone with respect to the measure for a fixed binary freezing CA. We believe our construction only scratches the surface of the measure trivialization property, and that much more intricate constructions are possible. More explicitly, for a CA $f$ on $\{0,1\}^{\mathbb{Z}^2}$, let ${T(f) = \{ 0 \leq p \leq 1 \;|\; \text{$f$ trivializes $\mu_p$} \}}$. If $f$ is freezing, then $1 \in T(f)$, and Theorem~\ref{thm:weird-nilpotent} shows that in this case $T(f) \setminus \{0\}$ need not be an interval. Apart from these facts, it is not clear to us how intricate the structure of $T(f)$ can be. \begin{question} What is the class of sets $T(f)$ for freezing CA $f$ on $\{0,1\}^{\mathbb{Z}^2}$? \end{question} \bibliographystyle{plain}
\section{Introduction} Accurate state estimation and mapping in large, perceptually-challenging environments has become a critical capability for autonomous mobile robots. Whereas typical visual SLAM approaches often perform poorly in dust, fog, or low-light conditions, LiDAR-based methods can provide more reliable localization due to the superior range and accuracy of direct depth measurements. However, recent work on LiDAR odometry (LO) has revealed the challenges of processing the large number of depth returns generated by commercial LiDAR sensors in real-time for high-rate state estimation \cite{shan2018lego, ebadi2020lamp}. This work will present several algorithmic innovations that make real-time localization with dense LiDAR scans feasible while also demonstrating the superiority of our method in terms of accuracy and computational complexity when compared to the state-of-the-art. Current LO algorithms estimate a robot's egomotion in two stages: first, by performing a ``scan-to-scan" alignment between adjacent LiDAR frames to recover an immediate motion guess, followed by a ``scan-to-map" registration between the current scan and past environmental knowledge to increase global pose consistency. Unfortunately, the large number of data points per scan from modern LiDARs can quickly overwhelm computationally-limited processors and bottleneck performance during alignment, which can ultimately induce frame drops and cause poor pose estimation. More specifically, ``scan-to-scan" alignment requires a registration of corresponding points between two clouds, but this process often involves a nearest-neighbor search which grows exponentially with the number of points per scan. Feature-based methods \cite{shan2018lego, lvisam2021shan, ye2019tightly, shan2020lio} attempt to mitigate this by using only the most salient points, but these methods require an often computationally-intensive feature extraction step and may accidentally discard data which could otherwise help anchor the downstream registration. Moreover, in ``scan-to-map" alignment, keyed environmental history (which consists of all or a subset of past points) can grow rapidly in size as new scans are acquired and stored in memory by the system, significantly expanding the nearest-neighbor search space for typical submap extraction methods. Although tree-based data structures have been shown to decrease this nearest-neighbor search cost significantly \cite{palieri2020locus}, the extraction of a local submap can still involve on the order of hundreds of thousands of points after just a few keyframes and prevent consistent performance for long-term navigation. \begin{figure}[!t] \centering \includegraphics[width=0.9\columnwidth]{figures/pdf/header.pdf} \vspace{-2mm} \caption{\textbf{Fast and light-weight LiDAR odometry.} Two of Team CoSTAR's robotic platforms which are limited in computational resources partially due to weight limitations. (A) Our custom quadrotor platform which features an Ouster OS1 LiDAR sensor on top. (B) Boston Dynamics' Spot robot with a mounted custom payload and a Velodyne VLP-16 with protective guards. (C) Top-down view of a mapped limestone mine using our lighweight odometry method on these robots during testing and integration for the DARPA Subterranean Challenge.} \label{fig:header} \vspace{-2mm} \end{figure} \begin{figure*}[!t] \centering \vspace{4mm} \includegraphics[width=0.85\textwidth]{figures/pdf/architecture.pdf} \vspace{-2mm} \caption{\textbf{LiDAR odometry architecture.} Our system first retrieves a relative transform between two temporally-adjacent scans of times $k$ and $k-1$ through ``scan-to-scan" (S2S) matching with RANSAC outlier rejection and an optional rotational prior from IMU. This initial estimate is then propagated into the world frame and used as the initialization point for our secondary GICP module for ``scan-to-map" optimization (S2M), which scan-matches the current point cloud $\mathcal{P}_k$ with a derived submap $\mathcal{S}_k$ consisting of scans from nearby and boundary keyframes. The output of this is our globally-consistent pose estimate which is subsequently checked against several metrics to determine if the current pose should be stored as a new keyframe or not.} \label{fig:architecture} \vspace{-6mm} \end{figure*} In this letter, we will present the Direct LiDAR Odometry (DLO) algorithm -- a high-speed and computationally-efficient frontend localization solution which permits the direct use of raw point cloud scans without significant preprocessing. A key insight of our work is the link between algorithmic speed and accuracy. Our contributions are as follows. First, a custom ``speed-first" pipeline that can accurately resolve robot egomotion in real-time using minimally-preprocessed LiDAR scans and an optional IMU on consumer-grade processors. Second, a novel keyframing system which adapts to environmental signals and permits fast and permissive submap generation via convex optimization. Third, several important algorithmic insights developed from real-world implementation to further reduce computational overhead, which resulted in NanoGICP, our custom iterative closest point solver for light-weight point cloud scan-matching with cross-object data sharing, And finally, extensive evaluation of our methods in several challenging environments on computationally-limited robotic platforms as part of Team CoSTAR's research and development efforts for the DARPA Subterranean Challenge. \subsection*{Related Work} LiDAR-based odometry is typically cast as a non-linear optimization problem to calculate a best-fit homogeneous transform which minimizes the error across corresponding, i.e., matching, points and/or planes between two point clouds. Since correspondences are not known \textit{a priori}, algorithms such as the iterative closest point (ICP) algorithm \cite{chen1992object} or other variants like Generalized ICP (GICP) \cite{segal2009generalized} have become the standard aligning two point clouds. However, searching over all data points can be computationally costly. \textit{Feature}-based methods attempt to extract and use only the most salient points before scan-matching to reduce computation. Such features are found either via hand-tuned methods \cite{zhang2014loam} or through learned networks \cite{yew20183dfeat} and include planes \cite{ye2019tightly}, edges and lines \cite{shan2020lio, lvisam2021shan}, or ground points \cite{shan2018lego}, and these works aim to translate insights gained from visual odometry (VO) techniques into the 3D domain. However, adding this step increases computational overhead and risks discarding data points which could help with better correspondence matching for odometry accuracy. Alternatively, \textit{direct} methods attempt to align dense point clouds but current approaches either heavily down-sample \cite{palieri2020locus} or use a filtering-based framework \cite{fastlio2} to achieve real-time performance. Nevertheless, a second stage immediately following scan alignment between adjacent clouds has been shown to help with global pose estimation consistency across a history of past scans \cite{palieri2020locus, ebadi2020lamp}. In ``scan-to-map," the transformation is further refined by aligning the current scan with an existing in-memory map. In practice, aligning with a submap (rather than the full history of scans) helps with computational efficiency, and this submap is typically derived by retrieving nearby map points within some radius of the robot's current position. This search in ``point-space," however, can quickly explode in computational expense due to the sheer number of data points per scan, and while there are techniques to mitigate this such as only incrementally storing map data via keyframe clouds \cite{palieri2020locus, shan2020lio}, this search can still involve thousands of operations and can quickly bottleneck system performance as time goes on. To address these issues, DLO only minimally preprocesses point clouds to provide accurate pose estimates even for robots with limited computational resources. The key contribution of our work lies in how we efficiently derive our submap for global refinement in scan-to-map matching. That is, rather than extracting points within a local vicinity of a robot's current position as most works do, DLO instead searches in keyframe-space by associating a scan's set of points with its corresponding keyframe position. The submap is subsequently constructed by concatenating the clouds from a subset of historic keyframes derived from nearby keyframes and those which make up the convex hull; this provides the current scan with both nearby and distant points in the submap to anchor to. In addition, a custom GICP solver enables extensive reuse of data structures across multiple solver instantiations to reduce redundant operations across the two-stage process. Our system also optionally accepts a relative prior from IMU in a loosely-coupled fashion to further improve accuracy in the optimization process, which can help especially during aggresive rotational motions. The reliability of our approach is demonstrated through extensive tests on multiple computationally-limited robotic platforms in several environments as part of Team CoSTAR's research and development efforts for the DARPA Subterranean Challenge in support of NASA JPL's Networked Belief-aware Perceptual Autonomy (NeBula) framework \cite{agha2021nebula}, in which DLO was the primary state estimation component on our fleet of autonomous aerial vehicles (Fig.~\ref{fig:header}A). \section{Methods} \subsection{Notation} A point cloud, $\mathcal{P}$, is composed of a set of points $p \in \mathcal{P}$ with Cartesian coordinates $p_{i} \in \mathbb{R}^3$. We denote \{$\mathcal{L}$\} as the LiDAR's coordinate system, \{$\mathcal{B}$\} as the robot's coordinate system located at the base link, and \{$\mathcal{W}$\} as the world coordinate system which coincides with \{$\mathcal{B}$\} at the initial position. Note that in this work we assume \{$\mathcal{L}$\} and \{$\mathcal{B}$\} reference frames coincide. Additionally, for optional optimization priors via proprioceptive sensors as described in Section~\ref{sec:optimization_priors}, we also assume that these frames coincide with \{$\mathcal{L}$\}, and subsequently \{$\mathcal{B}$\}, for convenience. We adopt standard convention such that $x$ points forward, $y$ points left, and $z$ points upward, and our work attempts to address the following problem: given adjacent point clouds scans $\mathcal{P}_k$ and $\mathcal{P}_{k-1}$ at time $k$, estimate the robot's current pose $\hat{\textbf{X}}_k \in \mathbb{SE}(3)$, trajectory $\hat{\textbf{X}}_{1:k}$, and map $\mathcal{M}_k$, all in \{$\mathcal{W}$\}. \subsection{Preprocessing} Our system assumes an input of 3D point cloud data gathered by a 360$^\circ$ LiDAR such as an Ouster OS1 or Velodyne VLP-16 (although our methods are not limited to these two). To minimize information loss from the raw sensor data, only two filters are used during preprocessing: first, we remove all point returns that may be from the robot itself through a box filter of size $1$m$^3$ around the origin. This is especially important if the LiDAR's field of view is within range of an aerial robot's propellers (Fig.~\ref{fig:header}A) or is surrounded by protective guards (Fig.~\ref{fig:header}B). The resulting cloud is then sent through a 3D voxel grid filter with a resolution of $0.25$m to lightly downsample the data for downstream tasks while maintaining dominate structures within the surrounding environment; the output of this is then used for subsequent tasks in the pipeline. Note that we do not correct for motion distortion in the point cloud as we assume that any distortion from robot movement is negligible due to high frame rate, and we directly use the dense point cloud rather than extracting features. On average, each cloud contains ${\sim}10{,}000$ points after preprocessing. \vspace{1mm} \begin{algorithm}[!t] \small \setstretch{0.9} \SetAlgoLined \textbf{input:} $\mathcal{P}_k$, $\hat{\textbf{X}}^{\mathcal{W}}_{k-1}$ ; \textbf{initialize:} $\hat{\textbf{X}}^{\mathcal{W}}_{k-1}$ = $\textbf{I}$ or gravityAlign() \\ \textbf{output:} $\hat{\textbf{X}}^{\mathcal{W}}_{k}$, $\mathcal{M}_k$\\ \While{$\mathcal{P}_k$} { \small {\tcp{preprocessing}} $\mathcal{\bar{P}}_k$ $\leftarrow$ preprocessPoints($\mathcal{P}_k$) ; \\ computeAdaptiveParameters($\mathcal{\bar{P}}_k$) ; \\ \small {\tcp{initialization}} \If {$k = 0$} { $\mathcal{T}^{\text{t}_1}_k$, $\mathcal{C}^{\text{t}_1}_k$ $\leftarrow$ NanoGICP$_1$.buildTargetTree($\mathcal{\bar{P}}_k$) ; \\ $\mathcal{K}_k$ $\leftarrow$ updateKeyframeDatabase($\hat{\textbf{X}}^{\mathcal{W}}_{k-1}$, $\mathcal{\bar{P}}_k$) ; \\ \textbf{continue}; \\ } \small {\tcp{prior}} \leIf {IMU} { $\tilde{\textbf{X}}^{\mathcal{L}}_k$ $\leftarrow$ integrateGyro() } { $\tilde{\textbf{X}}^{\mathcal{L}}_k$ $\leftarrow$ $\textbf{I}$ } \small {\tcp{scan-to-scan}} $\mathcal{T}^{\text{s}_1}_k$, $\mathcal{C}^{\text{s}_1}_k$ $\leftarrow$ NanoGICP$_1$.buildSourceTree($\mathcal{\bar{P}}_k$) ; \\ $\hat{\textbf{X}}^{\mathcal{L}}_k$ $\leftarrow$ NanoGICP$_1$.align($\mathcal{T}^{\text{s}_1}_k$, $\mathcal{T}^{\text{t}_1}_k$, $\mathcal{C}^{\text{s}_1}_k$, $\mathcal{C}^{\text{t}_1}_k$, $\tilde{\textbf{X}}^{\mathcal{L}}_k$) ; \\ $\tilde{\textbf{X}}^{\mathcal{W}}_k$ $\leftarrow$ $\hat{\textbf{X}}^{\mathcal{W}}_{k-1}$ $\hat{\textbf{X}}^{\mathcal{L}}_k$ ; \\ \small {\tcp{scan-to-map}} $\mathcal{T}^{\text{s}_2}_k$ $\leftarrow$ $\mathcal{T}^{\text{s}_1}_k$; $\mathcal{C}^{\text{s}_2}_k$ $\leftarrow$ $\mathcal{C}^{\text{s}_1}_k$ ; \\ $\mathcal{Q}_k$ $\leftarrow$ getKeyframeNeighbors($\hat{\textbf{X}}^{\mathcal{W}}_{k-1}$, $\mathcal{K}_k$) ; \\ $\mathcal{H}_k$ $\leftarrow$ getKeyframeHulls($\hat{\textbf{X}}^{\mathcal{W}}_{k-1}$, $\mathcal{K}_k$) ; \\ $\mathcal{S}_k$ $\leftarrow$ $\mathcal{Q}_k \oplus \mathcal{H}_k$ ; \\ $\mathcal{T}^{\text{t}_2}_k$, $\mathcal{C}^{\text{t}_2}_k$ $\leftarrow$ NanoGICP$_2$.buildTargetTree($\mathcal{S}_k$) ; \\ $\hat{\textbf{X}}^{\mathcal{W}}_k$ $\leftarrow$ NanoGICP$_2$.align($\mathcal{T}^{\text{s}_2}_k$, $\mathcal{T}^{\text{t}_2}_k$, $\mathcal{C}^{\text{s}_2}_k$, $\mathcal{C}^{\text{t}_2}_k$, $\tilde{\textbf{X}}^{\mathcal{W}}_k$) ; \\ \small {\tcp{ update keyframe database and map}} $\mathcal{K}_k$ $\leftarrow$ updateKeyframeDatabase($\hat{\textbf{X}}^{\mathcal{W}}_{k}$, $\mathcal{\bar{P}}_k$) ; \\ $\mathcal{M}_k$ $\leftarrow$ $\mathcal{M}_{k-1}$ $\oplus$ $\left\{ \mathcal{K}_k \setminus \mathcal{K}_{k-1} \right\}$; \\ \small {\tcp{reuse structs for next iteration}} $\mathcal{T}^{\text{t}_1}_k$ $\leftarrow$ $\mathcal{T}^{\text{s}_1}_k$; $\mathcal{C}^{\text{t}_1}_k$ $\leftarrow$ $\mathcal{C}^{\text{s}_1}_k$ ; \\ \Return $\hat{\textbf{X}}^{\mathcal{W}}_{k}$, $\mathcal{M}_k$ \\ } \caption{Direct LiDAR Odometry} \label{alg:dlo} \end{algorithm} \subsection{Scan Matching via Generalized-ICP} LiDAR-based odometry can viewed as the process of resolving a robot's egomotion by means of comparing successive point clouds and point clouds in-memory to recover an $\mathbb{SE}(3)$ transformation, which translates to the robot's 6-DOF motion between consecutive LiDAR acquisitions. This process is typically performed in two stages, first to provide a best instantaneous guess, which is subsequently refined to be more globally consistent. \subsubsection{Scan-to-Scan} In the first stage, the scan-to-scan matching objective is to compute an optimal relative transform $\hat{\textbf{X}}^{\mathcal{L}}_k$ between a source $\mathcal{P}_{k}^{\text{s}}$ and a target $\mathcal{P}_{k}^{\text{t}}$ (where $\mathcal{P}_{k}^{\text{t}}$ = $\mathcal{P}_{k-1}^{\text{s}}$) captured in $\mathcal{L}$ such that: \begin{equation} \hat{\textbf{X}}^{\mathcal{L}}_k = \argmin_{\textbf{X}^{\mathcal{L}}_k} \, \mathcal{E} \left( \textbf{X}^{\mathcal{L}}_k \mathcal{P}_{k}^{\text{s}}, \mathcal{P}_{k}^{\text{t}} \right) \,. \\ \label{eq:s2s_1} \end{equation} \noindent The residual error $\mathcal{E}$ from GICP is defined as: \begin{equation} \mathcal{E} \left( \textbf{X}^{\mathcal{L}}_k \mathcal{P}_{k}^{\text{s}}, \mathcal{P}_{k}^{\text{t}} \right) = \sum_i^N d_i^\text{T} \left( \mathcal{C}_{k,i}^{\text{t}} \, + \, \textbf{X}^{\mathcal{L}}_k \mathcal{C}_{k,i}^{\text{s}} \textbf{X}^{\mathcal{L}^\text{T}}_k \right)^{-1} d_i\\ \label{eq:s2s_2} \end{equation} \noindent such that the overall objective for this stage is: \begin{equation} \hat{\textbf{X}}^{\mathcal{L}}_k = \argmin_{\textbf{X}^{\mathcal{L}}_k} \, \sum_i^N d_i^\text{T} \left( \mathcal{C}_{k,i}^{\text{t}} \, + \, \textbf{X}^{\mathcal{L}}_k \mathcal{C}_{k,i}^{\text{s}} \textbf{X}^{\mathcal{L}^\text{T}}_k \right)^{-1} d_i \\ \label{eq:s2s_3} \end{equation} \noindent for $N$ number of corresponding points between point clouds $\mathcal{P}_{k}^{\text{s}}$ and $\mathcal{P}_{k}^{\text{t}}$, where $d_i = p_i^{\text{t}} - \textbf{X}^{\mathcal{L}}_k p_i^{\text{s}}$, $p_i^{\text{s}} \in \mathcal{P}_{k}^{\text{s}}, p_i^{\text{t}} \in \mathcal{P}_{k}^{\text{t}}, \forall i$, and $\mathcal{C}_{k,i}^{\text{s}}$ and $\mathcal{C}_{k,i}^{\text{t}}$ are the corresponding estimated covariance matrices associated with each point $i$ of the source or target cloud, respectively, using ten nearest neighbors. As will be further discussed in Section~\ref{sec:optimization_priors}, we can initialize the above objective function with a prior supplied by external sensors or odometry in an attempt to converge towards a global minimum. That is, for Eq.~(\ref{eq:s2s_3}), if a prior $\tilde{\textbf{X}}^{\mathcal{L}}_k$ is available by means of IMU preintegration, we can set the initial guess $\textbf{X}^{\mathcal{L}}_k$ = $\tilde{\textbf{X}}^{\mathcal{L}}_k$ to create a loosely-coupled system. If a prior is not available however, the system reverts to pure LiDAR odometry in which $\textbf{X}^{\mathcal{L}}_k$ = $\textbf{I}$ and relies solely on point cloud correspondence matching for this step. \subsubsection{Scan-to-Map} After recovering an initial robot motion estimate, a secondary stage of scan-to-map matching is performed and follows a similar procedure to that of scan-to-scan. However, rather than computing a relative transform between two instantaneous point clouds, the objective here is to further refine the motion estimate from the previous step to be more globally-consistent by means of matching with a local submap. In other words, the task here is to compute an optimal transform $\hat{\textbf{X}}_k^{\mathcal{W}}$ between the current source cloud $\mathcal{P}_k^\text{s}$ and some derived submap $\mathcal{S}_k$ such that: \begin{equation} \hat{\textbf{X}}^{\mathcal{W}}_k = \argmin_{\textbf{X}^{\mathcal{W}}_k} \, \mathcal{E} \left( \textbf{X}^{\mathcal{W}}_k \mathcal{P}_{k}^{\text{s}}, \mathcal{S}_{k} \right) \,. \\ \label{eq:s2m_1} \end{equation} \noindent After similarly defining the residual error $\mathcal{E}$ from GICP as in Eq.~(\ref{eq:s2s_2}), the overall objective function for scan-to-map is: \begin{equation} \hat{\textbf{X}}^{\mathcal{W}}_k = \argmin_{\textbf{X}^{\mathcal{W}}_k} \, \sum_j^M d_j^\text{T} \left( \mathcal{C}_{k,j}^{\mathcal{S}} \, + \, \textbf{X}^{\mathcal{W}}_k \mathcal{C}_{k,j}^{\text{s}} \textbf{X}^{\mathcal{W}^\text{T}}_k \right)^{-1} d_j \\ \label{eq:s2m_2} \end{equation} \noindent for $M$ number of corresponding points between point cloud $\mathcal{P}_{k}^{\text{s}}$ and submap $\mathcal{S}_{k}$, where $\mathcal{C}_{k,j}^{\mathcal{S}}$ is the corresponding scan-stitched covariance matrix for point $j$ in the submap as defined later in Section~\ref{sec:algorithmic_impl}. Optimization Eq.~(\ref{eq:s2m_2}) is initialized using the propagated result from scan-to-scan in the previous section from $\mathcal{L}$ to $\mathcal{W}$, i.e. $\tilde{\textbf{X}}^{\mathcal{W}}_k$ = $\hat{\textbf{X}}^{\mathcal{W}}_{k-1}$ $\hat{\textbf{X}}^{\mathcal{L}}_k$, so that this prior motion can be compared against historical map data for global consistency. The output of this stage $\hat{\textbf{X}}^{\mathcal{W}}_k$ is the final estimated robot pose. We note here that a key innovation of this work is how we derive and manage our submap for this stage: whereas previous works create a submap by checking the locality of each point individually in a stored map, we associate scans to keyframes and search rather in keyframe-space to stitch point clouds together and create $\mathcal{S}_{k}$. The implications of this include a far faster and more consistent submap creation process each iteration, which is additionally more permissive as compared to a radius-based search and will be further discussed in Section~\ref{sec:submapping}. \subsection{Optimization Prior} \label{sec:optimization_priors} Eq.~(\ref{eq:s2s_3}) describes the scan-to-scan non-linear optimization problem and can be initialized with a prior to reduce the chances of converging into a sub-optimal local minima. This prior represents an initial guess of the relative motion between two LiDAR frames and can come from integrating angular velocity measurements an inertial measurement unit (IMU). More specifically, angular velocity measurements $\hat{\boldsymbol{\omega}}_k$ from an inertial measurement unit can be defined as $\hat{\boldsymbol{\omega}}_k = \boldsymbol{\omega}_k + \textbf{b}_k^{\boldsymbol{\omega}} + \textbf{n}_k^{\boldsymbol{\omega}}$ as is assumed to be measured in $\mathcal{L}$ with static bias $\textbf{b}_k^{\boldsymbol{\omega}}$ and zero white noise $\textbf{n}_k^{\boldsymbol{\omega}}$ for convenience. After calibrating for the bias and subtracting it off from subsequent raw measurements to provide $\hat{\boldsymbol{\omega}}_k$, a relative rotational motion of the robot's body between two LiDAR frames can be computed via gyroscopic propagation of the quaternion kinematics $\textbf{q}_{k+1} = \textbf{q}_k + (\tfrac{1}{2} \textbf{q}_k \otimes \boldsymbol{\omega}_k )\Delta t$, where $\textbf{q}_k$ is initialized to identity prior to integration, $\Delta t$ is the difference in time between IMU measurements in seconds, and only gyroscopic measurements found between the current LiDAR scan and the previous one are used. Note that we are only concerned with a rotational prior during IMU preintegration and leave the retrieval of a translational prior for future work. The resultant quaternion of this propagation is converted to an $\mathbb{SE}(3)$ matrix with zero translational component to be used as $\tilde{\textbf{X}}^{\mathcal{L}}_k$, the scan-to-scan prior. \subsection{Fast Keyframe-Based Submapping} \label{sec:submapping} \begin{figure}[!t] \centering \vspace{3mm} \includegraphics[width=0.85\columnwidth]{figures/pdf/keyframe_comparison.pdf} \vspace{-2mm} \caption{\textbf{Keyframe-based submapping.} A comparison between the different submapping approaches, visualizing the current scan (white), the derived submap (red), and the full map (blue). (A) A common radius-based submapping approach of $r$ = $20$m retrieved in point cloud-space. (B) Our keyframe-based submapping approach, which concatenates a subset of keyed scans and helps anchor even the most distant points in the current scan (green box) during the scan-to-map stage.} \label{fig:keyframe_comparison} \vspace{-2mm} \end{figure} A key innovation of this work lies in how our system manages map information and derives the local submap in scan-to-submap matching for global egomotion refinement. Rather than working directly with point clouds and storing points into a typical octree data structure, we instead create a secondary point cloud of \textit{keyframes} to search within, in which each keyframe is linked to its corresponding point cloud scan in a key-value dictionary. The resulting submap used for scan-to-submap matching is then created by concatenating the corresponding point clouds from a subset of the keyframes, rather than directly retrieving local points within some radius of the robot's current position. The implications of this are twofold: first, by searching in ``keyframe-space" rather than ``point cloud-space," a much more computationally-tractable problem is presented to the system when constructing a submap. Radius-based searches within a cumulative point cloud map can require distance calculations against hundreds of thousands of points, and even with an incremental octree data structure this process can quickly become infeasible and rapidly increase the computational expense over time as the number of points increases. Searching against keyframes however typically involves only a few hundred points even after long traversals and provides much more consistent computational performance, reducing the chance of a frame drop due to slow processing. Additionally, a keyframe-based approach can construct a much more permissive submap as compared to range-based methods. That is, since the size of a submap derived from keyframe point clouds relies solely on the LiDAR sensor's range rather than a predetermined distance, the derived submap can have a larger overlap with the current scan; this is illustrated in Fig.~\ref{fig:keyframe_comparison}. In this example, a submap of fixed radius $r$ = $20$m insufficiently overlaps with the current scan and can introduce drift over time due to containing only spatially-nearby points; however, a keyframe-based approach covers most of the current scan which can help with better global consistency. Expanding the radius size may help increase this overlap for radius-based methods, but doing so can significantly slowdown downstream tasks such as the point normal calculations for GICP. \subsubsection{Keyframe Selection via kNN and Convex Hull} \begin{figure}[!t] \centering \vspace{2mm} \includegraphics[width=0.9\columnwidth]{figures/pdf/convex_adaptive.pdf} \vspace{-2mm} \caption{\textbf{Keyframe selection and adaptive thresholds.} (A) Our method's submap (red) is generated by concatenating the scans from a subset of keyframes (green spheres), which consists of $K$ nearest neighbor keyframes and those that construct the convex hull of keyframe set. (B) An illustration of adaptive thresholding. In this scenario, the threshold decreases when traversing down a narrow ramp to better capture small-scale details.} \label{fig:convex_adaptive} \vspace{-2mm} \end{figure} To construct the submap $\mathcal{S}_k$, we concatenate the corresponding point clouds from a selected subset of environmental keyframes. Let $\mathcal{K}_k$ be the set of all keyframe point clouds such that $\mathcal{S}_k \subseteq \mathcal{K}_k$. We define submap $\mathcal{S}_k$ as the concatenation of $K$ nearest neighbor keyframe scans $\mathcal{Q}_k$ and $L$ nearest neighbor convex hull scans $\mathcal{H}_k$ such that $\mathcal{S}_k = \mathcal{Q}_k \oplus \mathcal{H}_k$, where the indices which specify the convex hull are defined by the set of keyframes which make up the intersection of all convex sets containing the keyframes which compose $\mathcal{K}_k$. The result of this is illustrated in Fig.~\ref{fig:convex_adaptive}A, in which the keyframes highlighted in green are those that compose the extracted submap, indicated in red. Intuitively, extracting nearest neighbor keyframes aims to help with overlap of nearby points in the current scan, while those from the convex hull --- which contain boundary map points --- increase the overlap with more distant points in the scan. This combination aims to reduce overall trajectory drift by providing the system with multiple scales of environmental features to align with. Note that keyframes which are classified as both a nearest neighbor and a convex hull index are only used once to reduce redundancy in the submap. \subsubsection{Adaptive Keyframing} The location of environmental keyframes affects the derived submap and can subsequently influence accuracy and robustness of the odometry. Keyframe nodes are commonly dropped using fixed thresholds (e.g., every $1$m or $10^\circ$ of translational or rotational change) \cite{palieri2020locus, shan2020lio, lvisam2021shan}, but the optimal position can be highly dependent on a surrounding environment's structure. More specifically, in large-scale settings, features captured by the point cloud scan are much more prominent and can be depended on for longer periods of time; however, for narrower, smaller-scale environments, a smaller threshold is necessary to continually capture the small-scale features (i.e., tight corners) in the submap for better localization. Thus, we choose to scale the translational threshold for new keyframes according to some notion of ``spaciousness" in the instantaneous point cloud scan, defined as $m_k = \alpha m_{k-1} + \beta M_k$, where $M_k$ is the median Euclidean point distance from the origin to each point in the preprocessed point cloud, $\alpha$ = $0.95$, and $\beta$ = $0.05$ chosen empirically, and $m$ is the smoothed signal used to scale keyframe distance threshold $th$ such that: $th_k$ = $10$m if $m_k\!>\!20$m; $th_k$ = $5$m if $m_k\!>\!10$m$\,\,\&\,\,m_k\!\leq\!20$m; $th_k$ = $1$m if $m_k\!>\!5$m$\,\,\&\,\,m_k\!\leq\!10$m; and $th_k$ = $0.5$m if $m_k\!\leq\!5$m, with rotational threshold held fixed at $30^\circ$. Fig.~\ref{fig:convex_adaptive}B illustrates the effects of this adaptive thresholding. \subsection{Algorithmic Implementation} \label{sec:algorithmic_impl} \begin{table}[!t] \renewcommand{\arraystretch}{1.2} \vspace{2mm} \caption{Summary of Data Structure Recycling} \vspace{-5mm} \label{table:structs} \begin{center} \begin{tabular}{c||cc} Element & Scan-to-Scan & Scan-to-Map \\ \hline $\mathcal{T}_k^{\text{source}}$ & \small build & $\xrightarrow{\text{reuse from S2S}}$ \\ $\mathcal{T}_k^{\text{target}}$ & $\mathcal{T}_{k-1}^{\text{source}}$ & \small build when $\mathcal{S}_{k} \neq \mathcal{S}_{k-1}$ \\ $\mathcal{C}_k^{\text{source}}$ & \small compute & $\xrightarrow{\text{reuse from S2S}}$ \\ $\mathcal{C}_k^{\text{target}}$ & $\mathcal{C}_{k-1}^{\text{source}}$ & $\sum_n^N \mathcal{C}^{\mathcal{S}}_{k,n}$ \\ \end{tabular} \end{center} \vspace{-2mm} \end{table} \subsubsection{Scan-Stitched Submap Normals} Generalized-ICP involves minimizing the plane-to-plane distance between two clouds, in which these planes are modeled by a computed covariance for each point in the scan. Rather than computing the normals for each point in the submap on every iteration (which can be infeasible for real-time operation), we assume that the set of submap covariances $\mathcal{C}^{\mathcal{S}}_k$ can be approximated by concatenating the normals $\mathcal{C}^{\mathcal{S}}_{k,n}$ from $N$ keyframes which populate the submap such that $\mathcal{C}^{\mathcal{S}}_k \approx \sum_n^N \mathcal{C}^{\mathcal{S}}_{k,n}$. As a consequence, each submap's set of normals need not be explicitly computed, but rather just reconstructed by stitching together those calculated previously. \subsubsection{Data Structure Recycling} Expanding on the above idea, we've in fact identified several redundant instances in our pipeline which can be benefit from data structure sharing between modules; this helps to reduce overall system overhead by removing unnecessary computations in the loop. Summarized in Table~\ref{table:structs}, the system requires eight total elements to successfully perform scan-to-scan and scan-to-map matching: a kdtree $\mathcal{T}_k$ used to search for point correspondences, and the set of point covariances $\mathcal{C}_k$, for both source and target clouds in each scan-matching process. Out of the four required kdtrees data structures, only two need to be built explicitly. That is, the tree for the source (input) cloud $\mathcal{T}_k^{\text{source}}$ can be built just once per scan acquisition and shared between both modules (as the same scan is used for both sources). For the scan-to-scan target tree $\mathcal{T}_k^{\text{target}}$, this is simply just the previous iteration's scan-to-scan source tree $\mathcal{T}_{k-1}^{\text{source}}$ and thus can be propagated. The scan-to-map target tree needs to be built explicitly, but since the submap is derived from a set of keyframes, this build only needs to be performed when the set of keyframes that create the submap changes, such that $\mathcal{S}_{k} \neq \mathcal{S}_{k-1}$. Otherwise, the data structure can just be reused again for additional computational savings. Point covariances $\mathcal{C}_k$ needed for GICP, on the other hand, only need to be computed once per scan aquisition, and its data can be shared directly in the other three instances. \begin{figure}[!t] \centering \vspace{2mm} \includegraphics[width=0.85\columnwidth]{figures/pdf/alpha.pdf} \vspace{-2mm} \caption{\textbf{Alpha course map.} Different views and angles of the dense 3D point cloud map generated using our DLO algorithm on the Urban Alpha dataset. Estimated positions at each timestamp were used to transform the provided scan into a world frame; this was performed for all scans across the dataset and concatenated / voxel filtered to generated the above images.} \label{fig:alpha} \vspace{-3mm} \end{figure} \begin{figure}[!t] \centering \vspace{2mm} \includegraphics[width=0.8\columnwidth]{figures/pdf/ape.pdf} \vspace{-2mm} \caption{\textbf{Error comparison.} The absolute pose error plotted across a $1200$s window of movement, showing the difference between radius and keyframe submapping schemes. Keyframe-based approaches do not have the range restriction that radius-based approaches inherently contain, which directly translates to a lower error in odometry due to more perceptive submapping.} \label{fig:ape} \vspace{-2mm} \end{figure} \subsubsection{Dual NanoGICP} To facilitate the cross-talking between scan-matching modules, we assembled NanoGICP, a custom iterative closest point solver which combines the FastGICP\cite{koide2020voxelized} and NanoFLANN\cite{blanco2014nanoflann} open-source packages with additional modifications for data structure sharing as described above. In particular, NanoGICP uses NanoFLANN to efficiently build kdtree data structures, which are subsequently used for point cloud correspondence matching by FastGICP. In practice, data structure sharing is performed between two separate NanoGICP instantiations --- one to target each scan-matching problem --- and done procedurally as detailed in Algorithm~\ref{alg:dlo}. \section{Results} \begin{figure}[!t] \centering \vspace{2mm} \includegraphics[width=0.8\columnwidth]{figures/pdf/gicp.pdf} \vspace{-2mm} \caption{\textbf{Average convergence time.} A comparison of average convergence times across $100$ benchmark alignments for each algorithm, including our NanoGICP solver and two other open-source GICP packages.} \label{fig:gicp} \vspace{-2mm} \end{figure} \begin{figure}[!t] \centering \includegraphics[width=0.85\columnwidth]{figures/pdf/data_recycling.pdf} \vspace{-2mm} \caption{\textbf{Ablation study of data recycling schemes.} Box plots of the processing time and CPU usage for four different recycling variants, ranging from no data structure reuse to partial reuse and full reuse.} \label{fig:data_recycling} \vspace{-2mm} \end{figure} \begin{table}[!t] \renewcommand{\arraystretch}{1.5} \small \begin{center} \caption{Dropped LiDAR Scans per Recycling Scheme} \label{table:dropped_scans} \begin{tabular}{c||cccc} & None & KDTrees & Covariances & Both \\ \hline \% Scans & $9.37\%$ & $4.51\%$ & $0.00\%$ & $0.00\%$ \end{tabular} \end{center} \vspace{-4mm} \end{table} \begin{table*}[!t] \vspace{2mm} \caption{Comparison on Benchmark Datasets} \vspace{-2mm} \label{table:comparison} \centering \setlength{\tabcolsep}{8 pt} \renewcommand{\arraystretch}{1.} \begin{tabular}{|l|c|c|c|c|c|c|c|c|c|c|} \hline \multicolumn{1}{|c|}{\multirow{3}{*}{Method}} & \multicolumn{4}{c|}{Alpha Course} & \multicolumn{4}{c|}{Beta Course} & \multicolumn{2}{c|}{CPU Usage} \\ \cline{2-11} \multicolumn{1}{|c|}{} & \multicolumn{3}{c|}{APE {[}m{]}} & ME {[}m{]} & \multicolumn{3}{c|}{APE {[}m{]}} & ME {[}m{]} & \multicolumn{2}{c|}{No. of Cores} \\ \cline{2-11} \multicolumn{1}{|c|}{} & max & mean & std & rmse & max & mean & std & rmse & max & mean \\ \hline BLAM\cite{nelson} & 3.44 & 1.01 & 0.94 & 0.43 & 3.89 & 2.27 & 0.89 & 1.27 & 1.14 & 0.93 \\ \hline Cartographer\cite{hess2016real} & 5.84 & 2.91 & 1.60 & 1.05 & 2.64 & 1.37 & 0.67 & 0.31 & 1.75 & 0.88 \\ \hline LIO-Mapping\cite{ye2019tightly} & 2.12 & 0.99 & 0.51 & 0.45 & 1.60 & 1.18 & 0.22 & 0.61 & 1.80 & 1.53 \\ \hline LOAM\cite{zhang2014loam} & 4.33 & 1.38 & 1.19 & 0.60 & 2.58 & 2.11 & 0.44 & 0.99 & 1.65 & 1.41 \\ \hline LOCUS\cite{palieri2020locus} & 0.63 & 0.26 & 0.18 & 0.28 & 1.20 & 0.58 & 0.39 & 0.48 & 3.39 & 2.72 \\ \hline DLO & \textbf{0.40} & \textbf{0.18} & \textbf{0.06} & \textbf{0.19} & \textbf{0.50} & \textbf{0.16} & \textbf{0.09} & \textbf{0.19} & \textbf{0.92} & \textbf{0.62} \\ \hline \end{tabular} \vspace{-5mm} \end{table*} \subsection{Component Evaluation} To investigate the impact of our system's components, including keyframe-based submapping, submap normal approximation, and the reuse of data structures, we compare each component with its counterpart using the Alpha Course dataset from the Urban circuit of the DARPA Subterranean Challenge. This dataset contains LiDAR scans from a Velodyne VLP-16 sensor, in addition to IMU measurements from a VN-100, collected across 60 minutes in an abandoned powerplant located in Elma, WA which contains multiple perceptual challenges such as large or self-similar scenes (Fig.~\ref{fig:alpha}). For these component-wise evaluations, data was processed using a 4-core Intel i7 1.30GHz CPU. \subsubsection{Keyframe-Based Submapping} We compared the absolute pose error (APE), processing time, and CPU load across three submapping schemes, including: radius-based ($r$ = $10$m), keyframe-based with a $1$m static threshold, and keyframe-based with adaptive thresholding. For keyframe-based variants, we used 10 nearest-neighbor and 10 convex hull keyframes for submap derivation. From Fig.~\ref{fig:ape}, the influence of our approach is clear: submapping in keyframe-space can significantly reduce positional error by considering more distant points that would otherwise be outside the scope of a radius-based approach. These additional points influence the outcome of the GICP optimization process as they are considered during error minimization for the optimal transform; this is especially important in purely frontend-based odometry, since any additional error in pose can quickly propagate over time due to drift. Processing time and CPU load showed similar trends: radius-based processed each scan notably slower at $74.2$ms per scan with an average of $37.5\%$ CPU load as compared to $21.6$ms / $10.2\%$ and $19.1$ms / $9.1\%$ for static and adaptive schemes, respectively. \begin{figure}[!t] \centering \includegraphics[width=0.85\columnwidth]{figures/pdf/extreme.pdf} \vspace{-2mm} \caption{\textbf{Extreme environments.} \textit{Top:} Part of an underground mine in Lexington, KY mapped autonomously using our custom drone while running DLO. This environment contains challenging conditions such as: (A) low illuminance, (B) object obstructions, and (C) wet and muddy terrain. \textit{Bottom:} Top-down (D) and side view (E) of the three levels of an abandoned subway located in Downtown Los Angeles, mapped via DLO using a Velodyne VLP-16. In this run, we manually tele-operated the legged robot to walk up, down, and around each floor for a total of $856$m.} \label{fig:extreme} \vspace{-2mm} \end{figure} \subsubsection{Data Structure Recycling} To evaluate the effectiveness of data reusage, we measured and compared the processing time and CPU usage between different recycling schemes via a box plot (Fig.~\ref{fig:data_recycling}) and percentage of dropped scans over the dataset (Table~\ref{table:dropped_scans}). In a naive system which explicitly calculates each kdtree and cloud covariance, computation time exceeded LiDAR rate (10Hz for Velodyne) with a high average of $69.8$ms per scan and nearly $10\%$ of scans dropped due to high processing time. Recycling kdtrees but not covariances provides a slight improvement in processing time and CPU percentage, while recycling covariances but not kdtrees provides a more prominent performance boost; this is reasonable since our covariance recycling scheme is more aggressive than kdtree reusage. Finally, using the full scheme as detailed in Table~\ref{table:structs} significantly decreases both metrics, with an average processing time of $21.9$ms and $9.5\%$ CPU load, which prevents any LiDAR frames from dropping. \subsubsection{NanoGICP} To compare NanoGICP with the state-of-the-art, we use FastGICP's \cite{koide2020voxelized} benchmark alignment code found in the authors' open-source repository. This benchmark measures the average convergence time to align two LiDAR scans across $100$ runs, and we compare against PCL's \cite{Rusu_ICRA2011_PCL} GICP implementation as well as FastGICP's multithreaded implementation. Note that we do not compare against the voxelized FastGICP variant, since this method approximates planes with groups of planes and decreases overall accuracy. As shown in Fig.~\ref{fig:gicp}, we observed that NanoGICP converged faster on average ($42.53$ms) when compared to FastGICP ($72.88$ms) and PCL GICP ($178.24$ms). \subsection{Benchmark Results} To examine how our algorithm compares against the state-of-the-art, we use the Alpha and Beta courses from the Urban dataset of the Subterranean Challenge and evaluate accuracy and CPU load against several other LiDAR-based odometry packages, including BLAM\cite{nelson}, Cartographer\cite{hess2016real}, LIO-Mapping\cite{ye2019tightly}, LOAM\cite{zhang2014loam}, and LOCUS\cite{palieri2020locus}. Table~\ref{table:comparison} provides an overview of these comparison (numbers retrieved from \cite{palieri2020locus}). We note that LIO-SAM \cite{shan2020lio}, a current state-of-the-art tightly-coupled approach, and LVI-SAM \cite{lvisam2021shan}, which combines LIO-SAM \cite{shan2020lio} with VIO, could not tested at the time of this work due to their sensitive calibration procedure and strict requirements input data. We observed that our method's CPU load was measured to be far lower than any other algorithm, using less than one core both on average and at its peak. This is likely a result how our system derives its submap, in addition its extensive reuse of internal data structures. This observation can also explain DLO's far lower absolute pose error (APE) and root-mean-square error (RMSE). With this faster processing time, our method outperformed all other methods in both Alpha and Beta courses, having more than twice the accuracy in the Beta course for max, mean and standard deviation. In addition to our more permissive submapping approach, we are less likely to drop frames than other methods and hence more up-to-date information for the system, ultimately resulting in a lower trajectory error. \subsection{Field Experiments} We additionally tested and implemented our solution on several custom robotic platforms for real-world field operation. Specifically, we integrated DLO onto an aerial vehicle (Fig.~\ref{fig:header}A) with an Ouster OS1, VN-100 IMU, and an Intel NUC Board NUC7i7DNBE 1.90 GHz CPU , and a Boston Dynamics Spot (Fig.~\ref{fig:header}B) with a Velodyne VLP-16, VN-100 IMU, and an Intel NUC7i7DN 1.9 GHz CPU. For these real-world runs, we conducted both manual and autonomous traversals across two perceptually-degraded environments: in an underground limestone cave in Lexington, KY and at an abandoned subway in Downtown Los Angeles (Fig.~\ref{fig:extreme}). Both environments contained environmental properties which often challenge perceptual systems, including poor lighting conditions, featureless corridors, and the presence of particulates such as dust or fog; these, however, did not pose a significant issue to our system. Despite traversing over $850$m across three different levels in the abandoned subway, our system reported only a $10$cm end-to-end drift. Our tests in the underground mine showed similar promise: while the environment completely lacked any external lighting deep within the cave, DLO could still stably track our aerial vehicle across $348$m of flight for autonomous traversal and exploration. The results from these field operations demonstrate the real-world reliability of our method. \begin{figure}[!t] \centering \vspace{2mm} \includegraphics[width=0.9\columnwidth]{figures/pdf/mega_cavern.pdf} \vspace{-2mm} \caption{\textbf{Mega Cavern.} Different views of the Mega Cavern in Louisville, KY mapped by our DLO algorithm. Data is courtesy of Team Explorer.} \label{fig:mega_cavern} \vspace{-2mm} \end{figure} \section{Discussion} This work presents Direct LiDAR Odometry (DLO), a light-weight and accurate frontend localization solution with minimal computational overhead for long-term traversals in extreme environments. A key innovation which distinguishes our work from others is how we efficiently derive a local submap for global pose refinement using a database of keyframe-point cloud pairs. This in turn permits a substantial number of solver data structures to be shared and reused between system modules, all of which is facilitated using our custom NanoGICP cloud registration package. We demonstrate the reliability of our approach through benchmarks and extensive field experiments on multiple platforms operating in large-scale perceptually-degraded environments. DLO was developed for and used on NASA JPL's Team CoSTAR's fleet of quadrotors in the DARPA Subterranean Challenge (Fig.~\ref{fig:mega_cavern}), and in the future we are interested in tighter IMU integration through a backend component as well as adding loop closures to further reduce long-term drift. \noindent \textbf{Acknowledgements:} The authors would like to thank Team CoSTAR teammates and colleagues, including Amanda Bouman, Luca Carlone, Micah Corah, Kamak Ebadi, Seyed Fakoorian, David Fan, Sung Kim, Benjamin Morrell, Joshua Ott, Andrzej Reinke, Toni Rosinol, and Patrick Spieler, for their valuable insight and productive discussions. \bibliographystyle{IEEEtran}
\section{Motivation and Main Results} Randomized block Krylov methods have emerged as a powerful tool for spectral computation and matrix approximation~\cite{RST09:Randomized-Algorithm,HMT11:Finding-Structure,MRT11:Randomized-Algorithm,HMST11:Algorithm-Principal, MM15:Randomized-Block,WZZ15:Improved-Analyses,DIKM18:Structural-Convergence,DI19:Low-Rank-Matrix,YGL18:Superlinear-Convergence,MT20:Randomized-Numerical}. At present, our understanding of these methods is more rudimentary than our understanding of simple Krylov subspace methods in either the deterministic or random setting. % Our aim is to develop \textit{a priori} bounds that better explain the remarkable performance of randomized block Krylov methods. This paper focuses on the most basic questions. How well can we estimate the maximum (or minimum) eigenvalue of a symmetric matrix using a randomized block Krylov method? How well can we estimate the maximum (or minimum) singular value of a general matrix? We present the first detailed analysis that addresses these questions. The argument streamlines and extends the influential work~\cite{KW92:Estimating-Largest} of Kuczi{\'n}ski \& Wo{\'z}niakowski on the simple Krylov method with one randomized starting vector. We discover that increasing the block size offers some clear advantages over the simple method. Randomized block Krylov methods have also been promoted as a tool for low-rank matrix approximation. Theoretical analysis of these algorithms appears in several recent papers~\cite{MM15:Randomized-Block,DIKM18:Structural-Convergence,DI19:Low-Rank-Matrix,YGL18:Superlinear-Convergence}. In an unpublished companion paper~\cite{Tro18:Analysis-Randomized-TR}, we complement these works with a more detailed analysis that offers several new insights. The mathematical approach is different from the case of extreme eigenvalues, and it involves additional ideas from the analysis of the randomized SVD algorithm~\cite{HMT11:Finding-Structure}. In collaboration with Robert J.~Webber, we are currently preparing a review article~\cite{TW21:Randomized-Block} with a definitive treatment of randomized block Krylov methods for low-rank matrix approximation. \subsection{Block Krylov Methods for Computing the Maximum Eigenvalue} Let us begin with a mathematical description of a block Krylov method for estimating the maximum eigenvalue of a symmetric matrix. See Section~\ref{sec:implementation} for a brief discussion about implementations. \subsubsection{Block Krylov Subspaces} Suppose that we are given a symmetric matrix $\mtx{A} \in \mathbbm{R}^{n \times n}$. Choose a \emph{test matrix} $\mtx{B} \in \mathbbm{R}^{n \times \ell}$, where the number $\ell$ is called the \emph{block size}. Select a parameter $q \in \mathbbm{N}$ that controls the \emph{depth} of the Krylov subspace. In concept, the block Krylov method constructs the matrix \begin{equation} \label{eqn:krylov-matrix} \mtx{S}_q(\mtx{A}; \mtx{B}) := \begin{bmatrix} \mtx{B} & \mtx{AB} & \mtx{A}^2 \mtx{B} & \dots & \mtx{A}^q \mtx{B} \end{bmatrix} \in \mathbbm{R}^{n \times (q+1)\ell}. \end{equation} The range $K_q$ of the matrix $\mtx{S}_q$ is called a \emph{block Krylov subspace}: \begin{equation} \label{eqn:krylov-subspace} K_q(\mtx{A}; \mtx{B}) := \operatorname{range}(\mtx{S}_q) \subset \mathbbm{R}^{n}. \end{equation} The block Krylov subspace admits an alternative representation in terms of polynomials: \begin{equation} \label{eqn:krylov-poly} K_q(\mtx{A}; \mtx{B}) = \operatorname{span}\big\{ \operatorname{range}\big( \phi(\mtx{A}) \mtx{B} \big) : \phi \in \mathcal{P}_q \big\}, \end{equation} where $\mathcal{P}_q$ is the linear space of real polynomials with degree at most $q$. \begin{mywarning}[Notation] Be aware that our notation differs slightly from the traditional usage. In $\mtx{S}_q(\mtx{A}; \mtx{B})$ and in $K_q(\mtx{A}; \mtx{B})$, the highest matrix power is $\mtx{A}^q$, rather than the usual $\mtx{A}^{q - 1}$. \end{mywarning} \subsubsection{Invariance Properties of Krylov Subspaces} \label{sec:krylov-invar} Krylov subspaces have remarkable invariance properties that help explain their computational value. \begin{itemize} \item The block Krylov subspace only depends on the range of the test matrix: $$ K_q(\mtx{A}; \mtx{BT}) = K_q(\mtx{A}; \mtx{B}) \quad\text{for all nonsingular $\mtx{T} \in \mathbbm{R}^{\ell \times \ell}$.} $$ \item The block Krylov subspace co-varies with the orientation of the matrices: $$ K_q(\mtx{UAU}^*; \mtx{UB}) = \mtx{U} K_q(\mtx{A}; \mtx{B}) \quad\text{for all orthogonal $\mtx{U} \in \mathbbm{R}^{n \times n}$.} $$ \item The block Krylov subspace is invariant under ``affine'' transformations of the input matrix: $$ K_q(\alpha \mtx{A} + \beta \mathbf{I}; \mtx{B}) = K_q(\mtx{A}; \mtx{B}) \quad\text{for all $\alpha, \beta \in \mathbbm{R}$.} $$ \end{itemize} \noindent These facts follow directly from the definition~\eqref{eqn:krylov-matrix}--\eqref{eqn:krylov-subspace} of the Krylov subspace and the representation~\eqref{eqn:krylov-poly} using polynomials. For example, see~\cite[Sec.~12.2.2]{Par98:Symmetric-Eigenvalue} for the simple case $\ell = 1$. \subsubsection{Computing Maximum Eigenvalues} Block Krylov subspaces support a wide range of matrix computations. The core idea is to compress the input matrix to the Krylov subspace and to perform calculations on the (small) compressed matrix. In other words, Krylov methods belong to the class of Ritz--Galerkin methods; see~\cite{Lan50:Iteration-Method,Pai71:Computation-Eigenvalues,Saa80:Rates-Convergence,Par98:Symmetric-Eigenvalue,Saa11:Numerical-Methods}. In particular, we can obtain an estimate $\xi_{\max}(\mtx{A}; \mtx{B}; q)$ for the maximum eigenvalue $\lambda_{\max}(\mtx{A})$ of the input matrix by maximizing the Rayleigh quotient of $\mtx{A}$ over the block Krylov subspace $K_q(\mtx{A}; \mtx{B})$: \begin{equation} \label{eqn:eigenvalue-estimate} \xi_{\max}(\mtx{A}; \mtx{B}; q) := \max_{\vct{v} \in K_q(\mtx{A}; \mtx{B})} \frac{\vct{v}^* \mtx{A} \vct{v}}{\vct{v}^*\vct{v}}. \end{equation} The symbol ${}^*$ denotes the transpose of a matrix or vector, and we instate the convention that $0/0 = 0$. We may suppress the dependence of $\xi_{\max}$ on $\mtx{A}$, $\mtx{B}$, or $q$ when they are clear from context. The Rayleigh--Ritz theorem~\cite[Cor.~III.2.1]{Bha97:Matrix-Analysis} implies that the maximum eigenvalue estimate~\eqref{eqn:eigenvalue-estimate} always satisfies \begin{equation} \label{eqn:underestimate} \lambda_{\min}(\mtx{A}) \leq \xi_{\max}(\mtx{A}; \mtx{B}; q) \leq \lambda_{\max}(\mtx{A}). \end{equation} The goal of our analysis is to understand how well $\xi_{\max}(\mtx{A}; \mtx{B}; q)$ \emph{approximates} the maximum eigenvalue $\lambda_{\max}(\mtx{A})$ as a function of the block size $\ell$ and the depth $q$ of the Krylov space. Provided that $\xi_{\max} \approx \lambda_{\max}$, any vector $\vct{v}_{\max}$ that maximizes the Rayleigh quotient in~\eqref{eqn:eigenvalue-estimate} has a component in the invariant subspace of $\mtx{A}$ spanned by the large eigenvalues. More precisely, $$ \left( \frac{\norm{ \mtx{P}_{> \lambda} \vct{v}_{\max} }}{\norm{\vct{v}_{\max}}} \right)^2 \geq \frac{\xi_{\max} - \lambda}{ \lambda_{\max} - \lambda} \quad\text{for all $\lambda < \xi_{\max}$.} $$ We have written $\norm{\cdot}$ for the $\ell_2$ norm and $\mtx{P}_{> \lambda}$ for the spectral projector onto the invariant subspace of $\mtx{A}$ associated with the eigenvalues that strictly exceed $\lambda$. \subsubsection{Invariance Properties of the Eigenvalue Estimate} The eigenvalue estimate $\xi_{\max}(\mtx{A}; \mtx{B}; q)$ inherits some invariance properties from the block Krylov subspace. These facts can help us develop effective implementations of the algorithm and to analyze their performance. \begin{itemize} \item For fixed depth $q$, the estimate only depends on the range of the test matrix $\mtx{B}$: \begin{equation} \label{eqn:range-invar} \xi_{\max}(\mtx{A}; \mtx{BT}) = \xi_{\max}(\mtx{A}; \mtx{B}) \quad\text{for all nonsingular $\mtx{T} \in \mathbbm{R}^{\ell \times \ell}$.} \end{equation} \item For fixed depth $q$, the estimate does not depend on the orientation of $\mtx{A}$ and $\mtx{B}$ in the sense that \begin{equation} \label{eqn:rotation-invar} \xi_{\max}(\mtx{UAU}^*; \mtx{UB}) = \xi_{\max}(\mtx{A}; \mtx{B}) \quad\text{for all orthogonal $\mtx{U} \in \mathbbm{R}^{n \times n}$.} \end{equation} \item For fixed depth $q$, the estimate covaries with \emph{increasing} ``affine'' transformations of $\mtx{A}$: \begin{equation} \label{eqn:affine-invar} \xi_{\max}(\alpha \mtx{A} + \beta \mathbf{I}; \mtx{B}) = \alpha \xi_{\max}(\mtx{A}; \mtx{B}) + \beta \quad\text{for all $\alpha \geq 0$ and $\beta \in \mathbbm{R}$.} \end{equation} \end{itemize} \noindent These results all follow immediately from the invariance properties of the Krylov subspace (Section~\ref{sec:krylov-invar}) and the definition~\eqref{eqn:eigenvalue-estimate} of the eigenvalue estimate. See~\cite{KW92:Estimating-Largest} for the simple case $\ell = 1$. \subsubsection{A Random Test Matrix} To ensure that we can estimate the maximum eigenvalue of an \emph{arbitrary} symmetric input matrix $\mtx{A}$, we draw the test matrix $\mtx{B}$ that generates the Krylov subspace \emph{at random}. How should we select the distribution? Observe that the eigenvalue estimate $\xi_{\max}(\mtx{A}; \mtx{B}; q)$ only depends on the range of the test matrix $\mtx{B}$ because of the property~\eqref{eqn:range-invar}. Furthermore, the property~\eqref{eqn:rotation-invar} shows that the eigenvalue estimate is invariant under rotations. Therefore, we can choose any random test matrix whose range has a rotationally invariant distribution. This idea is extracted from~\cite{KW92:Estimating-Largest}; see Section~\ref{app:rot-invar} for the justification. We will consider a standard normal test matrix $\mtx{\Omega} \in \mathbbm{R}^{n \times \ell}$. That is, the entries of $\mtx{\Omega}$ are statistically independent Gaussian random variables, each with mean zero and variance one. It is well known that the range of this random matrix has a rotationally invariant distribution. The goal of this paper is to study the behavior of the random eigenvalue estimate $\xi_{\max}(\mtx{A}; \mtx{\Omega}; q)$. \begin{remark}[Other Test Matrices] Our analysis and detailed results depend heavily on the choice of a standard normal test matrix $\mtx{\Omega}$. In practice, we can achieve similar empirical behavior from test matrices with ``structured'' distributions that require less storage or that have fast matrix--vector multiplies. For randomized Krylov subspace methods, the computational benefit of using a structured test matrix is limited because we need to perform repeated multiplications with the input matrix $\mtx{A}$ to generate the Krylov matrix; cf.~\eqref{eqn:krylov-matrix}. See~\cite[Secs.~4.6 and 7.4]{HMT11:Finding-Structure} or~\cite[Secs.~9 and~11.5]{MT20:Randomized-Numerical} for some discussion about other random test matrices. \end{remark} \subsubsection{Implementation} \label{sec:implementation} For completeness, we describe the simplest stable implementation of a block Krylov method for computing the largest eigenvalue of a symmetric matrix. See Algorithm~\ref{alg:maxeig} for pseudocode; % this approach is adapted from~\cite{RST09:Randomized-Algorithm,HMST11:Algorithm-Principal}. Here is a summary of the costs: % \begin{itemize} \item A total of $q$ matrix--matrix multiplies between $\mtx{A}$ and an $n \times \ell$ matrix, plus another multiplication between $\mtx{A}$ and an $n \times (q+1)\ell$ matrix. The arithmetic cost depends on whether the matrix $\mtx{A}$ supports a fast multiplication operation. For example, the algorithm is more efficient when $\mtx{A}$ is sparse. \item Repeated orthogonalization of $(q+1) \ell$ vectors of length $n$ with total cost $\mathcal{O}(q^2 \ell^2 n)$ operations. \item Solution of a (block-tridiagonal) maximum eigenvalue problem at a cost of $\mathcal{O}(q^2 \ell^2)$ operations. \item Maintenance of the matrix $\mtx{S}_q$, which requires $\mathcal{O}(q\ell n)$ units of storage. \end{itemize} \noindent More refined algorithms can reduce the resource usage markedly; see~\cite[Sec.~11.7]{MT20:Randomized-Numerical} or~\cite{TW21:Randomized-Block} for discussion. As noted, Krylov subspace methods are particularly valuable when we have an efficient procedure for computing matrix--vector products with $\mtx{A}$. On many contemporary computer architectures, the cost of performing a product with several vectors is similar to the cost of a product with a single vector. In this setting, we can take advantage of the improved behavior of a block method almost for free. We refer to the books~\cite{Par98:Symmetric-Eigenvalue,BDD+00:Templates-Solution, Saa11:Numerical-Methods,GVL13:Matrix-Computations} and the paper~\cite{HMST11:Algorithm-Principal} for more discussion and references. \begin{algorithm}[tb] \caption{A block Krylov method for computing the largest eigenvalue of a symmetric matrix} \label{alg:maxeig} \begin{algorithmic}[1] \Require{Symmetric $n \times n$ matrix $\mtx{A}$; block size $\ell$; depth $q$} \Ensure{Estimate $\xi$ of largest eigenvalue} \vspace{0.5pc} \Function{BlockKrylovMaxEig}{$\mtx{A}$, $\ell$, $q$} % \State $[\mtx{B}_0,\sim] \gets \texttt{qr\_econ}( \texttt{randn}(\texttt{size}(\mtx{A}, 1), \ell) )$ \Comment{Draw $n \times \ell$ random orthonormal matrix} \State $\mtx{S}_0 = \mtx{B}_0$ \Comment{Orthonormal basis for Krylov subspace} \For{$t \gets 1, 2, 3, \dots, q$} \State $\mtx{B}_t \gets \mtx{A} \mtx{B}_{t-1}$ \Comment{Form next block of Krylov matrix by multiplication} \State $\mtx{B}_t \gets \mtx{B}_t - \mtx{S}_{t-1} (\mtx{S}_{t-1}^* \mtx{B}_t)$ \Comment{Orthogonalize against subspace by double GS} \State $\mtx{B}_t \gets \mtx{B}_t - \mtx{S}_{t-1} (\mtx{S}_{t-1}^* \mtx{B}_t)$ \Comment{\textit{Sic!}} \State $[\mtx{B}_t, \sim] \gets \texttt{qr\_econ}(\mtx{B}_t)$ \Comment{Orthogonalize what's left} \State $\mtx{S}_t \gets [\mtx{S}_{t-1}, \mtx{B}_t]$ \Comment{Extend basis with new block} \EndFor \State $\mtx{H} \gets \mtx{S}_q^* (\mtx{A} \mtx{S}_q)$ \Comment{Form block-tridiagonal Rayleigh quotient matrix} \State $[\xi, \vct{v}] \gets \texttt{maxeig}(\mtx{H})$ \Comment{Find maximum eigenpair} \EndFunction \vspace{0.25pc} \end{algorithmic} \end{algorithm} \subsection{The Role of the Spectrum} Owing to invariance, the theoretical behavior of the eigenvalue estimate $\xi_{\max}(\mtx{A}; \mtx{\Omega}; q)$ depends only on the spectrum of the input matrix $\mtx{A}$. In this section, we develop this idea further and introduce some spectral features that affect the performance of the eigenvalue estimate. \begin{mywarning}[Numerical Behavior] The numerical performance of a (block) Krylov method can be very complicated; for example, see~\cite[Chap.~13]{Par98:Symmetric-Eigenvalue} or~\cite{Meu06:Lanczos-Conjugate}. The current paper does not address numerics. % \end{mywarning} \subsubsection{Invariance Properties of the Random Eigenvalue Estimate} The random estimate $\xi_{\max}(\mtx{A}; \mtx{\Omega}; q)$ of the maximum eigenvalue has several invariance properties that allow us to simplify the analysis. First, the rotation invariance~\eqref{eqn:rotation-invar} of the eigenvalue estimate and the rotational invariance of the range of $\mtx{\Omega}$ imply that \begin{equation} \label{eqn:input-diag} \xi_{\max}(\mtx{A}; \mtx{\Omega}) \sim \xi_{\max}(\mtx{\Lambda}; \mtx{\Omega}) \quad\text{where $\mtx{A} = \mtx{U\Lambda U}^*$ is an eigenvalue factorization.} \end{equation} The symbol $\sim$ signifies equality of distribution for two random variables. In other words, the maximum eigenvalue estimate depends only on the eigenvalues of the input matrix---but not the eigenvectors. Second, owing to the affine covariance property~\eqref{eqn:affine-invar}, the eigenvalue estimate $\xi_{\max}(\mtx{A}; \mtx{\Omega}; q)$ only depends on the ``shape'' of the spectrum of $\mtx{A}$, but not its location or scale. As a consequence, we must assess the behavior of the eigenvalue estimate in terms of spectral features that are affine invariant. \subsubsection{Spectral Features of the Input Matrix} To express the results of our analysis, we introduce terminology for some spectral features of the symmetric matrix $\mtx{A} \in \mathbbm{R}^{n \times n}$. First, let us instate compact notation for the eigenvalues of $\mtx{A}$: $$ a_i := \lambda_i(\mtx{A}) \quad\text{for $i = 1, \dots, n$,} \quad\text{and}\quad a_{\max} := a_1 \geq a_2 \geq \dots \geq a_n =: a_{\min}. $$ The map $\lambda_i(\cdot)$ returns the $i$th largest eigenvalue of a symmetric matrix. Next, we define some functions of the eigenvalue spectrum: \begin{itemize} \item The \emph{spectral range} $\rho$ of the input matrix is the distance between the extreme eigenvalues. That is, $\rho := a_{\max} - a_{\min}$. % \item The \emph{spectral gap} $\gamma$ is the relative difference between the maximum eigenvalue and the next distinct eigenvalue: \begin{equation} \label{eqn:spectral-gap} \gamma := \frac{a_{\max} - a_{m+1}}{a_{\max} - a_{\min}} \quad\text{where}\quad a_{\max} = a_{m} > a_{m+1}. \end{equation} If $\mtx{A}$ is a multiple of the identity, then $\gamma = 0$. Note that $\gamma \in [0, 1]$. \item Let $\nu$ be a nonnegative number. The \emph{$\nu$-stable rank} is a continuous measure of the ``dimension'' of the range of $\mtx{A} - a_{\min} \mathbf{I}$ that reflects how quickly the spectrum decays. It is defined as \begin{equation} \label{eqn:srank} \operatorname{srk}(\nu) := \sum\limits_{i=1}^n \left( \frac{a_i - a_{\min}}{a_{\max} - a_{\min}} \right)^{2\nu}. \end{equation} If $\mtx{A}$ is a multiple of the identity, we define $\operatorname{srk}(\nu) = 0$. Otherwise, $1 \leq \operatorname{srk}(\nu) \leq \operatorname{rank}(\mtx{A} - a_{\min} \mathbf{I}) \leq n - 1$. When the eigenvalues of $\mtx{A}$ decay at a polynomial rate, the stable rank can be much smaller than the rank for an appropriate choice of $\nu$. See Section~\ref{sec:numerics-setup} for some illustrations. \item Let $\xi$ be any estimate for the largest eigenvalue $a_{\max}$ of the input matrix $\mtx{A}$. We measure the error in the estimate relative to the spectral range: \begin{equation} \label{eqn:error-def} \mathrm{err}(\xi) := \frac{a_{\max} - \xi}{a_{\max} - a_{\min}}. \end{equation} The relative error in the Krylov estimate $\xi = \xi_{\max}(\mtx{A}; \mtx{B}; q)$ falls in the interval $[0, 1]$ because of~\eqref{eqn:underestimate}. \end{itemize} \noindent The spectral gap, the stable rank, and the error measure are all invariant under increasing affine transformations of the spectrum of $\mtx{A}$. We suppress the dependence of these quantities on the input matrix $\mtx{A}$, unless emphasis is required. \begin{remark}[History] Concepts related to the $\nu$-stable rank originally appeared in the analysis literature~\cite{BT87:Invertibility-Large,BT91:Problem-Kadison}, and they now play an important role in randomized linear algebra~\cite[Sec.~2.6]{MT20:Randomized-Numerical}. \end{remark} \subsubsection{An Example} \label{sec:laplacian} Let us illustrate these concepts with a canonical example. A common task in computational physics is to compute the \textit{minimum} eigenvalue of (the discretization of) an elliptic operator. Consider the standard $n$-point second-order finite-difference discretization $\mtx{L} \in \mathbbm{R}^{n \times n}$ of the one-dimensional Laplacian on $[0, 1]$ with homogeneous boundary conditions. Writing $h = 1/(n+1)$, the eigenvalues of the matrix $\mtx{L}$ are $$ \lambda_{j}(\mtx{L}) = \frac{2}{h^2} \left[ 1 + \cos( \pi j h ) \right] \quad\text{for $j = 1, \dots, n$.} $$ The spectral gap between the smallest and second smallest eigenvalue is proportional to $h^2$. % The spectrum has essentially no decay, which is visible in the fact that $\operatorname{srk}(-\mtx{L}; 1)$ is proportional to $1/h$. The tiny spectral gap and large stable rank suggest that the maximum eigenvalue problem for $-\mtx{L}$ will be challenging. A natural remedy is to attempt to compute the maximum eigenvalue of the inverse $\mtx{L}^{-1}$. Independent of $n$, the spectral gap between the largest and second largest eigenvalue satisfies $\gamma( \mtx{L}^{-1} ) \approx 0.75$. The stable rank $\operatorname{srk}(\mtx{L}^{-1}; 1) \approx 1.1$. The large spectral gap and small stable rank suggest that the maximum eigenvalue problem for $\mtx{L}^{-1}$ will be quite easy, regardless of the dimension. \subsection{Matrices with Few Distinct Eigenvalues} Before continuing, we must address an important special case. When the input matrix has few distinct eigenvalues, the block Krylov method computes the maximum eigenvalue of the matrix perfectly. \begin{proposition}[Randomized Block Krylov: Matrices with Few Eigenvalues] \label{prop:few-eigs} Let $\mtx{A} \in \mathbbm{R}^{n \times n}$ be a symmetric matrix. Fix the block size $\ell \geq 1$ and the depth $q \geq 0$ of the block Krylov subspace. % Draw a standard normal matrix $\mtx{\Omega} \in \mathbbm{R}^{n \times \ell}$. If $\mtx{A}$ has $q + 1$ or fewer distinct eigenvalues, then $\mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega};q)) = 0$ with probability one. \end{proposition} \noindent This type of result is well known (e.g., see~\cite{KW92:Estimating-Largest}), but we include a short proof in Section~\ref{sec:error-formula}. \subsection{Matrices without a Spectral Gap} \label{sec:gapfree} Our first result gives probabilistic bounds for the maximum eigenvalue estimate $\xi_{\max}(\mtx{A}; \mtx{\Omega}; q)$ without any additional assumptions. In particular, it does not require a lower bound on the spectral gap $\gamma$. \begin{theorem}[Randomized Block Krylov: Maximum Eigenvalue Estimate] \label{thm:gapfree} Instate the following hypotheses. \begin{itemize} \item Let $\mtx{A} \in \mathbbm{R}^{n \times n}$ be a symmetric input matrix. \item Draw a standard normal test matrix $\mtx{\Omega} \in \mathbbm{R}^{n \times \ell}$ with block size $\ell$. \item Fix the depth parameter $q \geq 0$, and let $q = q_1 + q_2$ be an arbitrary nonnegative integer partition. \end{itemize} \noindent We have the following probability bounds for the estimate $\xi_{\max}(\mtx{A}; \mtx{\Omega}; q)$, defined in~\eqref{eqn:eigenvalue-estimate}, of the maximum eigenvalue of the input matrix. \begin{enumerate} \item The relative error~\eqref{eqn:error-def} in the eigenvalue estimate satisfies the probability bound \begin{equation} \label{eqn:intro-prob-gapfree} \Prob{ \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega};q)) \geq \varepsilon } \leq 1 \wedge \sqrt{2} \left[ 8 \operatorname{srk}(q_1) \cdot \mathrm{e}^{-2(2q_2+1) \sqrt{\varepsilon}} \right]^{\ell/2} \quad\text{for $\varepsilon \in [0, 1]$.} \end{equation} \item The expectation of the relative error satisfies \begin{equation} \label{eqn:intro-expect-gapfree} \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega}; q)) \leq 1 \wedge \left[ \frac{2.70 \ell^{-1} + \log(8 \operatorname{srk}(q_1))}{2(2q_2+1)} \right]^2. \end{equation} \end{enumerate} The symbol $\wedge$ denotes the minimum, and the stable rank, $\operatorname{srk}(\cdot)$, is defined in~\eqref{eqn:srank}. All logarithms are natural. \end{theorem} \noindent The proof of~\eqref{eqn:intro-prob-gapfree} appears in Section~\ref{sec:prob-bounds}, and the proof of~\eqref{eqn:intro-expect-gapfree} appears in Section~\ref{sec:expect-bound-gapfree}. The experiments in Section~\ref{sec:numerics} support the analysis. Let us take a moment to explain the content of this result. We begin with a discussion about the role of the second depth parameter $q_2$, and then we explain the role of the first depth parameter $q_1$. We emphasize that the user does not choose a partition $q = q_1 + q_2$; the bounds are valid for all partitions. For now, fix $q_1$. The key message of Theorem~\ref{thm:gapfree} is that the relative error satisfies % $$ \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega};q_1 + q_2)) \leq \varepsilon $$ once the depth parameter $q_2$ exceeds $$ q_{2}(\varepsilon) := - \frac{1}{2} + \frac{2.70 \ell^{-1} + \log( 8 \operatorname{srk}(q_1) )}{4\sqrt{\varepsilon}}. $$ Once the depth $q_2$ attains this level, the probability of error drops off exponentially fast: $$ q_2 = q_{2}(\varepsilon) + k \varepsilon^{-1/2} \quad\text{implies}\quad \Prob{\mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega}; q_1 + q_2)) \geq \varepsilon} \leq \mathrm{e}^{-2k\ell}. $$ In fact, we need $q_2 \geq q_2(1)$ just to ensure that the probability bound is nontrivial. The most important aspect of this result is that the depth $q_{2}(\varepsilon)$ scales with $\varepsilon^{-1/2}$, so it is possible to achieve moderate relative error using a block Krylov space with limited depth. In contrast, the randomized power method~\cite{KW92:Estimating-Largest} requires the depth $q$ to be proportional to $\varepsilon^{-1}$ to achieve a relative error of $\varepsilon$. The second thing to notice is that the depth $q_{2}(\varepsilon)$ scales with $\log(\operatorname{srk}(q_1))$. The stable rank is never larger than the ambient dimension $n$, but it can be significantly smaller---even constant---when the spectrum of the matrix has polynomial decay. Here is another way to look at these facts. As we increase the depth parameter $q$, the block Krylov method exhibits a burn-in period whose length $q_1 + q_2(1)$ depends on $\operatorname{srk}(q_1)$. % While the depth $q_2 \leq q_2(1)$, the algorithm does not make much progress in estimating the maximum eigenvalue. Once the depth satisfies $q_2 \geq q_2(1)$, the expected relative error decreases in proportion to $q_2^{-2}$. In contrast, the power method~\cite{KW92:Estimating-Largest} reduces the expected relative error in proportion to $q_2^{-1}$. We can now appreciate the role of the first depth parameter $q_1$. When the spectrum of the input matrix exhibits polynomial decay, $\operatorname{srk}(q_1)$ is \emph{constant} for an appropriate value of $q_1$ that depends on the decay rate. In this case, the analysis shows that the total burn-in period $q_1 + q_2(1)$ is just $\mathcal{O}(1)$ steps. For example, when the $j$th eigenvalue decays like $1/j$, this situation occurs. % The block size $\ell$ may not play a significant role in determining the average error. But changing the block size has a large effect on the probability of failure (i.e., the event that the relative error exceeds $\varepsilon$). For example, suppose that we increase the block size $\ell$ from one to three. For each increment of $\varepsilon^{-1/2}$ in the depth $q_2$, the failure probability with block size $\ell = 3$ is a factor of $54\times$ smaller than the failure probability with block size $\ell = 1$! \begin{remark}[Prior Work] \label{rem:prior-gapfree} The simple case $\ell = 1$ in Theorem~\ref{thm:gapfree} has been studied in the paper~\cite{KW92:Estimating-Largest}. Our work introduces two major innovations. First, we obtain bounds in terms of the stable rank, which allows us to mitigate the dimensional dependence that appears in~\cite{KW92:Estimating-Largest}. Second, we have obtained precise results for larger block sizes $\ell$, which indicate potential benefits of using block Krylov methods. Our proof strategy is motivated by the work in~\cite{KW92:Estimating-Largest}, but we have been able to streamline and extend their arguments by using a more transparent random model for the test matrix. \end{remark} \subsection{Matrices with a Spectral Gap} \label{sec:gap} Our second result gives probabilistic bounds for the maximum eigenvalue estimate $\xi_{\max}(\mtx{A}; \mtx{\Omega};q)$ when we have a lower bound for the spectral gap $\gamma$ of the input matrix. \begin{theorem}[Randomized Block Krylov: Maximum Eigenvalue Estimate with Spectral Gap] \label{thm:gap} Instate the following hypotheses. \begin{itemize} \item Let $\mtx{A} \in \mathbbm{R}^{n \times n}$ be a symmetric input matrix with spectral gap $\gamma$, defined in~\eqref{eqn:spectral-gap}. \item Draw a standard normal test matrix $\mtx{\Omega} \in \mathbbm{R}^{n \times \ell}$ with block size $\ell$. \item Fix the depth parameter $q \geq 0$, and let $q = q_1 + q_2$ be an arbitrary nonnegative integer partition. \end{itemize} \noindent We have the following probability bounds for the estimate $\xi_{\max}(\mtx{A}; \mtx{\Omega}; q)$, defined in~\eqref{eqn:eigenvalue-estimate}, of the maximum eigenvalue of the input matrix. \begin{enumerate} \item The relative error~\eqref{eqn:error-def} in the eigenvalue estimate satisfies the probability bound \begin{equation} \label{eqn:intro-prob-gap} \Prob{ \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega}; q)) \geq \varepsilon } \leq 1 \wedge \sqrt{2} \left[ \frac{8\operatorname{srk}(q_1)}{\varepsilon} \cdot \mathrm{e}^{-4q_2 \sqrt{\gamma}} \right]^{\ell/2} \quad\text{for $\varepsilon \in (0,1]$.} % \end{equation} \item Abbreviate $F := 4 \operatorname{srk}(q_1) \mathrm{e}^{-4q_2 \sqrt{\gamma}}$. The expectation of the relative error satisfies % \begin{align} % \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega})) &\leq \frac{F}{(\ell - 2) + F} % && (\ell \geq 3); \label{eqn:gap-l>3} \\ \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega})) &\leq (F/2) \log(1 + 2/F) % && (\ell = 2); \label{eqn:gap-l=2} \\ \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega})) &\leq 1 \wedge \sqrt{2 \pi F} % && (\ell = 1). \label{eqn:gap-l=1} \end{align} \end{enumerate} The symbol $\wedge$ denotes the minimum, and the stable rank is defined in~\eqref{eqn:srank}. \end{theorem} \noindent The proof of~\eqref{eqn:intro-prob-gap} appears in Sections~\ref{sec:prob-bounds}; the proof of~\eqref{eqn:gap-l>3}, \eqref{eqn:gap-l=2}, and \eqref{eqn:gap-l=1} appears in Section~\ref{sec:expect-bound-gap}. The experiments in Section~\ref{sec:numerics} bear out these predictions. Let us give a verbal summary of what this result means. First of all, we anticipate that Theorem~\ref{thm:gap} will give better bounds than Theorem~\ref{thm:gapfree} when the spectral gap $\gamma$ exceeds the target level $\varepsilon$ for the error. But both results are valid for all choices of $\gamma$ and $\varepsilon$. Now, fix the first depth parameter $q_1$. One implication of the spectral gap result is that the relative error satisfies $$ \Prob{ \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega};q)) \leq \varepsilon } \approx 1 $$ when the second depth parameter $q_2$ exceeds $$ q_{2}(\varepsilon; \gamma) := \frac{ 0.70 \ell^{-1} + \log(8 \varepsilon^{-1} \operatorname{srk}(q_1)) }{ 4 \sqrt{\gamma} }. $$ In this case, the depth $q_2$ only scales with $\log(1/\varepsilon)$, so the block Krylov method can achieve very small relative error for a matrix with a spectral gap. As before, the depth $q_2$ also scales with $\log(\operatorname{srk}(q_1))$, so the dimensional dependence is weak---or even nonexistent if the spectrum has polynomial decay and $q_1$ is sufficiently large. When the depth $q_2 \geq q_{2}(\varepsilon; \gamma)$, the error probability drops off quickly: $$ q_2 = q_2(\varepsilon; \gamma) + k \gamma^{-1/2} \quad\text{implies}\quad \Prob{ \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega})) \geq \varepsilon } \leq \mathrm{e}^{-2k \ell}. $$ This bound indicates that $\gamma^{-1/2}$ is the scale on which the depth $q_2$ needs to increase to reduce the failure probability by a constant multiple (which depends on the block size). We discover a new phenomenon when we examine the expectation of the error. On average, to achieve a relative error of $\varepsilon$, it is sufficient that the depth $q_2 \geq q_2'(\varepsilon; \gamma)$, where $$ \begin{aligned} \ell \geq 3 &: \quad q_2'(\varepsilon;\gamma) := \frac{\log(4 \operatorname{srk}(q_1)) + \log(1/\varepsilon) - \log(\ell - 2)}{4 \sqrt{\gamma}}; \\ \ell = 2 &: \quad q_2'(\varepsilon;\gamma) := \frac{\log(4 \operatorname{srk}(q_1)) + \log(1/\varepsilon) + \log\log(1/\varepsilon)}{4 \sqrt{\gamma}} & \text{for all $\varepsilon \leq \mathrm{const}$;} \\ \ell = 1 &: \quad q_2'(\varepsilon;\gamma) := \frac{\log(4 \operatorname{srk}(q_1)) + 2 \log(1/\varepsilon) + \log(2\pi)}{4 \sqrt{\gamma}}. \end{aligned} $$ In other words, the depth $q_2$ of the block Krylov space needs to be about $\log(4 \operatorname{srk}(q_1)) / (4 \sqrt{\gamma})$ before we obtain an average relative error less than one; we can reduce this requirement slightly by increasing the block size $\ell$. But once the depth $q_2$ reaches this level, Theorem~\ref{thm:gap} suggests that the block Krylov method with $\ell \geq 2$ reduces the average error \emph{twice as fast} as the block Krylov method with $\ell = 1$. \begin{remark}[Prior Work] The simple case $\ell = 1$ in Theorem~\ref{thm:gap} has been studied in the paper~\cite{KW92:Estimating-Largest}. See Remark~\ref{rem:prior-gapfree} for a discussion of the improvements we have achieved. \end{remark} \subsection{Estimating Minimum Eigenvalues} We can also use Krylov subspace methods to obtain an estimate $\xi_{\min}(\mtx{A}; \mtx{B}; q)$ for the \emph{minimum} eigenvalue of a symmetric matrix $\mtx{A}$. Conceptually, the simplest way to accomplish this task is to apply the Krylov subspace method to the negation $- \mtx{A}$. The minimum eigenvalue estimate takes the form $$ \xi_{\min}(\mtx{A}; \mtx{B}; q) := - \xi_{\max}(-\mtx{A}; \mtx{B}; q). $$ Owing to~\eqref{eqn:underestimate}, this estimate is never smaller than $\lambda_{\min}(\mtx{A})$. It is straightforward to adapt Theorems~\ref{thm:gapfree} to obtain bounds for the minimum eigenvalue estimate with a random test matrix $\mtx{\Omega}$. In particular, we always have the bound $$ \operatorname{\mathbb{E}} \left[ \frac{\xi_{\min}(\mtx{A}; \mtx{\Omega}; q) - a_{\min}}{a_{\max} - a_{\min}} \right] \leq \left[ \frac{2.70 \ell^{-1} + \log(8 \operatorname{srk}(-\mtx{A}; q_1))}{2(2q_2+1)} \right]^2. % $$ In this context, the stable rank takes the form $$ \operatorname{srk}(-\mtx{A}; \nu) = \sum\limits_{i = 1}^n \left(\frac{a_{\max} - a_i}{a_{\max} - a_{\min}} \right)^{2\nu}. $$ See Section~\ref{sec:gapfree} for discussion of this type of bound. We can also use Theorem~\ref{thm:gap} to obtain results in terms of the spectral gap. The spectral gap $\gamma(-\mtx{A})$ is the magnitude of the difference between the smallest two eigenvalues of $\mtx{A}$, relative to the spectral range. For example, when the block size $\ell = 3$, we have the bound $$ \ell = 3 : \quad\quad \operatorname{\mathbb{E}} \left[ \frac{\xi_{\min}(\mtx{A}; \mtx{\Omega};q) - a_{\min}}{a_{\max} - a_{\min}} \right] \leq 4 \operatorname{srk}(-\mtx{A}; q_1) \cdot \mathrm{e}^{-4 q_2 \sqrt{\gamma(-\mtx{A})}}. % $$ See Section~\ref{sec:gap} for discussion of this type of bound. \begin{remark}[Inverse Iterations] Suppose that we have a routine for applying the \emph{inverse} of a positive-semidefinite matrix $\mtx{A}$ to a vector. In this case, we can apply the Krylov method to the inverted matrix $\mtx{A}^{-1}$ to estimate the minimum eigenvalue. This approach is often more powerful than applying the Krylov method to $-\mtx{A}$. For example, inverse iteration is commonly used for discretized elliptic operators; the discussion in Section~\ref{sec:laplacian} supports this approach. \end{remark} \subsection{Estimating Singular Values} We now arrive at the problem of estimating the spectral norm of a general matrix $\mtx{C} \in \mathbbm{R}^{n \times m}$ using Krylov subspace methods. Assuming that $n \leq m$, we can apply the block Krylov method to the square $\mtx{CC}^*$. This yields an estimate $\xi_{\max}(\mtx{CC}^*; \mtx{B}; q)$ for the \emph{square} of the spectral norm of $\mtx{C}$. If $n > m$, we can just as well work with the other square $\mtx{C}^* \mtx{C}$. Theorems~\ref{thm:gapfree} and~\ref{thm:gap} immediately yield error bounds for the random test matrix $\mtx{\Omega}$. In particular, we always have the bound $$ \operatorname{\mathbb{E}} \left[ \frac{\norm{\mtx{C}}^2 - \xi_{\max}(\mtx{CC}^*; \mtx{\Omega};q)}{\norm{\mtx{C}}^2} \right] \leq \left[ \frac{2.70 \ell^{-1} + \log(8 \operatorname{srk}(\mtx{CC}^*;q_1))}{2(2q_2+1)} \right]^2. % $$ We also have a bound in terms of the spectral gap $\gamma(\mtx{CC}^*)$, which is the difference between the squares of the largest two distinct singular values, relative to the spectral range. For block size $\ell = 3$, we have $$ \operatorname{\mathbb{E}} \left[ \frac{\norm{\mtx{C}}^2 - \xi_{\max}(\mtx{CC}^*; \mtx{\Omega})}{\norm{\mtx{C}}^2} \right] \leq 4 \operatorname{srk}(\mtx{CC}^*;q_1) \cdot \mathrm{e}^{-4 q_2 \sqrt{\gamma(\mtx{CC}^*)}}. $$ In this case, it is natural to bound the stable rank as $$ \operatorname{srk}(\mtx{CC}^*; 0) = m \wedge n \quad\text{and}\quad \operatorname{srk}(\mtx{CC}^*; \nu) \leq \left(\frac{\norm{\mtx{C}}_{4\nu}}{\norm{\mtx{C}}}\right)^{4\nu} \quad\text{for $\nu \geq 1$.} $$ We have written $\norm{\cdot}$ for the spectral norm and $\norm{\cdot}_{p}$ for the Schatten $p$-norm for $p \geq 1$. \begin{remark}[Other Approaches] It is also possible to work with ``odd'' Krylov subspaces $K_q(\mtx{CC}^*; \mtx{CB})$ or $K_q(\mtx{C}^*\mtx{C}; \mtx{C}^* \mtx{B})$, but the analysis requires some modifications. \end{remark} \begin{remark}[Minimum Singular Values] The quantity $\xi_{\min}(\mtx{CC}^*; \mtx{B})$ gives an estimate for the $m$th largest squared singular value of $\mtx{C}$. When $m \leq n$, this is the smallest singular value, which may be zero. It is straightforward to derive results for the estimate using the principles outlined above. We omit the details. \end{remark} \subsection{Extensions} With minor modifications, the analysis in this paper can be extended to cover some related situations. First, when the maximum eigenvalue has multiplicity greater than one, the (block) Krylov method converges more quickly. Second, we can extend the algorithm and the analysis to the problem of estimating the largest eigenvalue of an Hermitian matrix (using a complex standard normal test matrix). Third, we can analyze the behavior of the randomized (block) power method. For brevity, we omit the details. \section{Numerical Experiments} \label{sec:numerics} Krylov subspace methods exhibit complicated behavior because they are implicitly solving a polynomial optimization problem. Therefore, we do not expect a reductive theoretical analysis to capture all the nuances of their behavior. Nevertheless, by carefully choosing input matrices, we can witness the phenomena that the theoretical analysis predicts. \subsection{Experimental Setup} \label{sec:numerics-setup} We implemented the randomized block Krylov method in \textsc{Matlab} 2019a. The code uses full orthogonalization, as described in Algorithm~\ref{alg:maxeig}, and the maximum eigenvalue of the Rayleigh matrix is computed with the command \texttt{eig}. We consider several types of input matrices for which accurate maximum eigenvalue estimates are particularly difficult. The randomized block Krylov method is rotationally invariant and affine invariant, so there is no (theoretical) loss in working with a diagonal matrix. Of course, the Krylov method does not exploit the fact that the input matrix is diagonal. Recall that an $n \times n$ matrix $\mtx{W} \in \mathbbm{R}^{n \times n}$ from the Gaussian Orthogonal Ensemble (GOE) is obtained by extracting the symmetric part of a Gaussian matrix: $$ \mtx{W} = \tfrac{1}{2} (\mtx{G} + \mtx{G}^*) \in \mathbbm{R}^{n \times n} \quad\text{where $\mtx{G} \in \mathbbm{R}^{n \times n}$ has independent standard normal entries.} $$ The large eigenvalues of a GOE matrix cluster together, and the spectral gap becomes increasingly small as the dimension increases. The spectrum has essentially no decay. \begin{itemize} \item To study the behavior of the Krylov method \textit{without} a spectral gap, we draw a realization of a GOE matrix, diagonalize it using \texttt{eig}, and make an affine transformation so that its extreme eigenvalues are $0$ and $1$. Abusing terminology, we also refer to this diagonal input matrix as a GOE matrix. \item To study the behavior of the Krylov method \textit{with} a spectral gap $\gamma$, we take the diagonalized GOE matrix and increase the largest eigenvalue until the gap is $\gamma$. We refer to this model as a \textit{gapped GOE matrix}. \item To understand how tail decay affects the convergence of the Krylov method, we consider \textit{gapped power law} matrices. For a dimension $n$, power $p > 0$, and gap $\gamma \in [0, 1)$, the matrix is diagonal with entries $$ a_1 = 1 + \frac{\gamma}{1-\gamma} \quad\text{and}\quad a_i = (i-1)^{-1/p} \quad\text{for $i = 2, \dots, n$.} $$ \end{itemize} See Figure~\ref{fig:srank} for a depiction of the stable rank function for these types of input matrices. For the random matrix models, we draw a single realization of the input matrix and then fix it once and for all. The variability in the experiments derives from the random draw of the test matrix. \begin{figure} \begin{subfigure}{0.49\textwidth} \includegraphics[width=\columnwidth]{fig/GapGOE_srk.png} \caption{Gapped GOE matrices} \label{fig:goe-srk} \end{subfigure} \begin{subfigure}{0.49\textwidth} \includegraphics[width=\columnwidth]{fig/GapPow_srk.png} \caption{Gapped power law matrices ($n = 8192$)} \label{fig:pow-srk} \end{subfigure} \hspace{3pc} \caption{\textbf{Logarithm of stable rank.} These graphs display the natural logarithm of the stable rank function, $\operatorname{srk}(\nu)$, for two types of matrices. For gapped GOE matrices, the data series illustrate the effect of increasing the dimension ($n$). For gapped power law matrices, the series illustrate the effect of decreasing the rate of tail decay ($p$). } \label{fig:srank} \end{figure} \subsection{Sample Paths: The Role of Block Size} \label{sec:numerics-paths} First, we explore the empirical probability that the randomized block Krylov method can achieve a sufficiently small error. The first set of experiments focuses on the behavior of the block Krylov method for a matrix with a substantial spectral gap. For a fixed $1000 \times 1000$ gapped GOE matrix with $\gamma = 0.1$, Figure~\ref{fig:numerics-gap} illustrates sample paths of the relative error in estimating the maximum eigenvalue as a function of the total depth $q$ of the Krylov space. We compare the performance as the block size $\ell$ varies. Here is a summary of our observations: \begin{figure} \begin{center} \begin{subfigure}{0.5\textwidth} \includegraphics[width=\columnwidth]{fig/avgerr_GapGOE_n1000.png} \caption{Average error across block size} \end{subfigure} \\ \vspace{1pc} \begin{subfigure}{0.45\textwidth} \includegraphics[width=\columnwidth]{fig/samplepaths_GapGOE_n1000_l1.png} \caption{Block size $\ell = 1$} \end{subfigure} \begin{subfigure}{0.45\textwidth} \includegraphics[width=\columnwidth]{fig/samplepaths_GapGOE_n1000_l2.png} \caption{Block size $\ell = 2$} \end{subfigure} \\ \vspace{1pc} \begin{subfigure}{0.45\textwidth} \includegraphics[width=\columnwidth]{fig/samplepaths_GapGOE_n1000_l3.png} \caption{Block size $\ell = 3$} \end{subfigure} \begin{subfigure}{0.45\textwidth} \includegraphics[width=\columnwidth]{fig/samplepaths_GapGOE_n1000_l4.png} \caption{Block size $\ell = 4$} \end{subfigure} \caption{\textbf{Sample paths, with spectral gap.} The input matrix is a fixed $1000 \times 1000$ GOE matrix with an artificial spectral gap $\gamma = 0.1$ (dashed blue line). The bottom four panels show the trajectory of the relative error (translucent hairlines) in estimating the maximum eigenvalue via randomized block Krylov for 1000 random test matrices with block size $\ell$ as a function of the depth $q$. The average error (\textbf{not} average log-error) is marked with a heavy orange line. The top panel compares the average error across block size. See Section~\ref{sec:numerics-paths}.} \label{fig:numerics-gap} \end{center} \end{figure} \begin{itemize} \item After a burn in period of about five steps, the error begins to decay exponentially, as described in Theorem~\ref{thm:gap}. For $\ell = 4$, we can graphically estimate that the decay rate is about $\mathrm{e}^{- 1.38 \, q }$, while the theory predicts a decay rate at least $\mathrm{e}^{-1.26 \, q}$. \item For block size $\ell = 1$, the average error decays at roughly \emph{half} the rate achieved for block size $\ell \geq 2$. For $\ell = 2$, the average error has a distinctive profile; for $\ell = 3, 4$, the error is qualitatively similar. These phenomena match the bounds in Theorem~\ref{thm:gap}(2). \item The sample paths give a clear picture of how the errors typically evolve. Independent of the block size, most of the sample paths decay at the same rate. As the block size increases, there is a slight reduction in the error (seen as a shift to the left), but this improvement is both small and diminishing. \item The impact of the block size becomes evident when we look at the spread of the sample paths. As the block size increases, the error varies much less, and this effect is sharpened by increasing the block size. The apparent reason is that the Krylov method can \textit{misconverge}: it % locks onto the \textit{second largest} eigenvalue (dashed blue line), and it may not % find a component of the maximum eigenvector for a significant number of iterations. For block size $\ell = 1$, this tendency is strong enough to destroy the rate of average convergence. For larger block sizes, the likelihood and duration of misconvergence both decrease. \end{itemize} \begin{figure} \begin{center} \begin{subfigure}{0.5\textwidth} \includegraphics[width=\columnwidth]{fig/avgerr_GOE_n1000.png} \caption{Average error across block size} \end{subfigure} \\ \vspace{1pc} \begin{subfigure}{0.45\textwidth} \includegraphics[width=\columnwidth]{fig/samplepaths_GOE_n1000_l1.png} \caption{Block size $\ell = 1$} \end{subfigure} \begin{subfigure}{0.45\textwidth} \includegraphics[width=\columnwidth]{fig/samplepaths_GOE_n1000_l2.png} \caption{Block size $\ell = 2$} \end{subfigure} \\ \vspace{1pc} \begin{subfigure}{0.45\textwidth} \includegraphics[width=\columnwidth]{fig/samplepaths_GOE_n1000_l3.png} \caption{Block size $\ell = 3$} \end{subfigure} \begin{subfigure}{0.45\textwidth} \includegraphics[width=\columnwidth]{fig/samplepaths_GOE_n1000_l4.png} \caption{Block size $\ell = 4$} \end{subfigure} \caption{\textbf{Sample paths, no spectral gap.} The input matrix is a fixed $1000 \times 1000$ GOE matrix with spectral gap $\gamma \approx 0.0073$ (dashed blue line). The bottom four panels illustrate the trajectory of the relative error (translucent hairlines) in estimating the maximum eigenvalue via the randomized block Krylov method for 1000 random test matrices with block size $\ell$ as a function of the depth $q$. The average error (\textbf{not} average log-error) is marked with a heavy orange line. The top panel compares the average error across block size. See Section~\ref{sec:numerics-paths}.} \label{fig:numerics-gapfree} \end{center} \end{figure} The second set of experiments addresses the performance of the block Krylov method for a matrix with a small spectral gap. For a fixed $1000 \times 1000$ GOE matrix (with $\gamma \approx 0.0073$), Figure~\ref{fig:numerics-gapfree} shows sample paths of the relative error in estimating the maximum eigenvalue as a function of the total depth $q$ of the Krylov space and the block size $\ell$. Let us highlight a few observations. \begin{itemize} \item Initially, the average error decays roughly as $q^{-2}$, as predicted by Theorem~\ref{thm:gapfree}. Once the error is sufficiently small (around $10^{-3}$), the decay becomes (super)exponential as indicated by Theorem~\ref{thm:gap}. \item In the polynomial decay regime $(q \lessapprox 20)$, the block size affects the average error weakly, as suggested by Theorem~\ref{thm:gapfree}. In the exponential decay regime, the block size plays a much more visible role, but the theory does not fully capture this effect. \item Regardless of the block size, the bulk of the sample paths decay more quickly than the average error. The block size has less of an effect on the typical error than on the average error. Nevertheless, for larger block size, we quickly achieve more digits of accuracy. \item As in the first experiment, the block size has a major impact on the variability of the error. As we increase the block size, the sample paths start to cluster sharply, so the typical error and the average error align with each other. Misconvergence is also visible here, and it can be mitigated by increasing the block size. \end{itemize} \subsection{Burn-in: The Role of Tail Content} Next, we examine how the tail content affects the burn-in period for the randomized block Krylov method. Let us consider how the burn-in increases with the dimension of a matrix with limited spectral decay. For $n \times n$ gapped GOE matrices with $\gamma = 0.1$, Figure~\ref{fig:burn-dimen} shows how the average error evolves as a function of the depth $q$ of the Krylov space with block size $\ell = 2$. The main point is that the error initially stagnates before starting to decay exponentially. The stagnation period increases in proportion to the logarithm of the dimension $n$. As we saw in Figure~\ref{fig:goe-srk}, this same behavior is visible in the size of $\log \operatorname{srk}(\nu)$ for small values of $\nu$. Now, we look at how the burn-in depends on the rate of decay of the eigenvalues of a matrix. For an $8192 \times 8192$ gapped power law matrix with $\gamma = 0.1$, Figure~\ref{fig:burn-decay} charts how the average error decays as a function of the depth $q$ for block size $\ell = 2$. We observe that the error initially decays exponentially at a slow rate. After a burn-in period, the error begins to decline at a faster exponential rate. The length of the initial trajectory increases in proportion with the logarithm of the order $p$ of the power law. From Figure~\ref{fig:pow-srk}, we detect that this speciation reflects the spread of $\log \operatorname{srk}(\nu)$ for small values of $\nu$. \begin{figure} \begin{subfigure}{0.49\textwidth} \includegraphics[width=\columnwidth]{fig/burn_GapGOE_l2.png} \caption{Role of dimension} \label{fig:burn-dimen} \end{subfigure} \begin{subfigure}{0.49\textwidth} \includegraphics[width=\columnwidth]{fig/burn_power_l2.png} \caption{Role of tail decay} \label{fig:burn-decay} \end{subfigure} \caption{\textbf{Burn-in as a function of tail content.} These plots show the average error in estimating the maximum eigenvalue as a function of depth $q$ with block size $\ell = 2$. In the left panel, we consider gapped GOE matrices of increasing dimension $n$. In the right panel, we consider gapped power law matrices with decreasing rate $p$ of tail decay.} \end{figure} \subsection{Conclusions} The numerical experiments presented in this section confirm many of our theoretical predictions about the behavior of randomized block Krylov methods for estimating the maximum eigenvalue of a symmetric matrix. Increasing the block size results in a dramatic reduction in the probability of committing a large error in the estimate. The underlying mechanism is that simple Krylov method ($\ell = 1$) is much more likely to misconverge than a block method (even with $\ell = 2, 3$). The effect is so significant that block Krylov methods can converge, on average, at twice the rate of a simple Krylov method. These benefits counterbalance the increased computational cost of a block method. These facts have implications for design and implementation of practical algorithms. If the arithmetic cost is the driving concern, then the simple randomized Krylov method typically uses matrix--vector multiplications more efficiently than the block methods. But we have also seen that block methods can achieve a specific target for the error (averaged over test matrices) using a similar number of matrix--vector multiplies as the simple method. In fact, in modern computing environments, the actual cost (time, communication, energy) of multiplying a matrix by several vectors may be equivalent to a single matrix--vector multiplication, in which case the block methods are the obvious choice. Finally, when it is critical to limit the probability of failure, then the block methods are clearly superior. \section{History, Related Work, and Contributions} Krylov subspace methods are a wide class of algorithms that use matrix--vector products (``Krylov information'') to compute eigenvalues and eigenvectors and to solve linear systems. These methods are especially appropriate in situations where we can only interact with a matrix through its action on vectors. In this treatment, we only discuss Krylov methods for spectral computations. Some of the basic algorithms in this area are the power method, the inverse power method, subspace iteration, the Lanczos method, the block Lanczos method, and the band Lanczos method. See the books~\cite{Par98:Symmetric-Eigenvalue,BDD+00:Templates-Solution,Saa11:Numerical-Methods,GVL13:Matrix-Computations} for more background and details. \subsection{Simple Krylov Methods} Simple Krylov methods are algorithms based on a Krylov subspace $K_q(\mtx{A}; \vct{b})$ constructed from a single starting vector $\vct{b}$. That is, the block size $\ell = 1$. The power method, which dates to the 19th century, is probably the earliest algorithm that relies on Krylov information to compute eigenvalues and eigenvectors of a symmetric matrix. The power method is degenerate in the sense that it only keeps the highest-order term in the Krylov subspace. In the late 1940s, Lanczos~\cite{Lan50:Iteration-Method} developed a sophisticated Krylov subspace method for solving the symmetric eigenvalue problem. (More precisely, the Lanczos method uses a three-term recurrence to compute a basis for the Krylov subspace so that the compression of the input matrix to the Krylov subspace is tridiagonal.) In exact arithmetic, the Lanczos estimate of the maximum eigenvalue of a symmetric matrix coincides with $\xi_{\max}(\mtx{A}; \vct{b}; q)$ for a fixed vector $\vct{b}$. On the other hand, the Lanczos method has complicated behavior in finite-precision arithmetic; for example, see Meurant's book~\cite{Meu06:Lanczos-Conjugate}. The first analysis of the Lanczos method with a deterministic starting vector $\vct{b}$ dates to the work of Lanczos~\cite{Lan50:Iteration-Method}. Kaniel, Paige, and Saad also made major theoretical contributions in the 1970s and 1980s; see~\cite{Par98:Symmetric-Eigenvalue,Saa11:Numerical-Methods} for details and references. In the 1980s, Nemirovsky, Yudin, and Chou showed that Krylov subspace methods are the optimal deterministic algorithms for solving the symmetric eigenvalue problem, assuming we only have access to the matrix via matrix--vector multiplication; see~\cite{NY83:Problem-Complexity,Cho87:Optimality-Krylov,Nem91:Optimality-Krylovs}. The burn-in period for Krylov methods has been observed in many previous works, including~\cite{VV86:Rate-Convergence,LS05:GMRES-Convergence,BES05:Convergence-Polynomial}. The length of the burn-in period depends on the proportion of the energy in the test vector that is captured by the true invariant subspace. The main contribution of the paper~\cite{VV86:Rate-Convergence} is the observation that Krylov methods may exhibit superlinear convergence. The explanation for this phenomenon is that the optimal polynomial can create an artificial spectral gap by annihilating undesirable eigenvalues. This kind of behavior is visible in Figure~\ref{fig:numerics-gapfree}. \subsection{Random Starting Vectors} Practitioners have often suggested using randomized variants of Krylov subspace methods. That is, the starting vector $\vct{b}$ is chosen at random. Historically, randomness was just used to avoid the situation where the starting vector $\vct{b}$ is orthogonal to the leading invariant subspace of the matrix. Later, deeper justifications for random starting vectors appeared. The first substantive theoretical analysis of a randomized Krylov method appears in Dixon's paper~\cite{Dix83:Estimating-Extremal} on the power method with a random starting vector. We believe that this is the first paper to recognize that Krylov methods can be successful without the presence of a spectral gap. In 1992, Kuczy{\'n}ski \& Wo{\'z}niakowski published an analysis~\cite{KW92:Estimating-Largest} of the Lanczos method with a random starting vector. Their work highlighted the benefits of randomization, and it provided a clear explanation of the advantages of using full Krylov information instead of the power method. See the papers~\cite{KW94:Probabilistic-Bounds,DM97:Randomized-Error,LW98:Estimating-Largest} for further work in this direction. The recent papers~\cite{SER17:Gap-Strict-Saddles,SER18:Tight-Query} contain lower bounds on the performance of randomized algorithms for the symmetric eigenvalue problem that use Krylov information. \subsection{Block Krylov Methods} Block Krylov subspace methods use multiple starting vectors to generate the Krylov subspace, instead of just one. In other words, the algorithms form a Krylov subspace $K_q(\mtx{A}; \mtx{B})$, where $\mtx{B}$ is a matrix. These methods were developed in the late 1960s and 1970s in an effort to resolve multiple eigenvalues more reliably. The block analog of the power method is called subspace iteration; see the books~\cite{Par98:Symmetric-Eigenvalue,Saa11:Numerical-Methods} for discussion. There are also block versions of the Lanczos method, which were developed by Cullum \& Donath~\cite{CD74:Block-Generalization} and Golub \& Underwood~\cite{GU77:Block-Lanczos}. (More precisely, the block Lanczos method uses a recurrence to compute a basis for the block Krylov subspace so that the compression of the input matrix to the block Krylov subspace is block tridiagonal.) In exact arithmetic, the block Lanczos estimate of the maximum eigenvalue of a symmetric matrix coincides with $\xi_{\max}(\mtx{A}; \mtx{B}; q)$ for a fixed matrix $\mtx{B}$. Most of the early work on block Krylov subspace methods focuses on the case where the block size $\ell$ is small, while the depth $q$ of the Krylov space is moderately large. This can lead to significant problems with numerical stability, especially in the case where we use a recurrence to perform orthogonalization. As a consequence, full orthogonalization is usually recommended. Furthermore, most of the existing analysis of block Krylov methods is deterministic; for example, see~\cite{Saa80:Rates-Convergence,LZ15:Convergence-Block}. \subsection{Randomized Block Krylov Methods} Over the last decade, randomized block Krylov subspace methods have emerged as a powerful tool for spectral computations on large matrices. These algorithms use a Krylov subspace $K_q(\mtx{A}; \mtx{B})$ generated by a \emph{random} test matrix $\mtx{B}$. In contrast with earlier block Krylov algorithms, contemporary methods use a much larger block size $\ell$ and a much smaller depth $q$. Furthermore, the randomness plays a central role in supporting performance guarantees for the algorithms. Most of the recent literature concerns the problem of computing a low-rank approximation to a large matrix, rather than estimating eigenvalues or invariant subspaces. Some of the initial work on randomized algorithms for matrix approximation appears in~\cite{PRTV98:Latent-Semantic, FKV98:Fast-Monte-Carlo,DKM06:Fast-Monte-Carlo-II,MRT11:Randomized-Algorithm}. Randomized subspace iteration was proposed in~\cite{RST09:Randomized-Algorithm} and further developed in~\cite{HMT11:Finding-Structure}. Randomized block Krylov methods that use the full block Krylov subspace were proposed in the papers~\cite{RST09:Randomized-Algorithm,HMST11:Algorithm-Principal}; see also~\cite{DIKM18:Structural-Convergence}. See~\cite{HMT11:Finding-Structure} for more background and history. There is some theoretical and empirical evidence~\cite{HMST11:Algorithm-Principal,MM15:Randomized-Block} that randomized block Krylov methods can produce low-rank matrix approximations with higher accuracy and with less computation than randomized subspace iteration. \subsection{Analysis of Randomized Block Krylov Methods} There is a growing body of literature that develops theoretical performance guarantees for randomized block Krylov methods. The papers~\cite{RST09:Randomized-Algorithm,HMT11:Finding-Structure, Gu15:Subspace-Iteration,MM15:Randomized-Block} contain theoretical analyses of randomized subspace iteration. The papers~\cite{MM15:Randomized-Block,WZZ15:Improved-Analyses,DIKM18:Structural-Convergence} contain theoretical analysis of randomized methods that use the full block Krylov space. These works all focus on low-rank matrix approximation. \subsection{Contemporary Work} After the initial draft of this paper and its companion~\cite{Tro18:Analysis-Randomized-TR} was completed, several other research groups released new work on randomized (block) Krylov methods. % The paper~\cite{DI19:Low-Rank-Matrix} shows that randomized block Lanczos can produce excellent low-rank matrix approximations, even without the presence of a spectral gap. The paper~\cite{YGL18:Superlinear-Convergence} demonstrates that randomized block Lanczos gives excellent estimates for the singular values of a general matrix with spectral decay. \subsection{Contributions} We set out to develop highly refined bounds for the behavior of randomized block Krylov methods that use the full Krylov subspace. Our aim is to present useful and informative results in the spirit of Saad~\cite{Saa80:Rates-Convergence}, Kuczi{\'n}ski \& Wo{\'z}niakowski~\cite{KW92:Estimating-Largest}, and Halko et al.~\cite{HMT11:Finding-Structure}. Our research has a number of specific benefits over prior work. \begin{itemize} \item We have shown that randomized block Krylov methods have exceptional performance for matrices with spectral decay. In fact, for matrices with polynomial spectral decay, we can often obtain accurate estimates even when the block Krylov subspace has \emph{constant} depth. \item We have obtained detailed information about the role of the block size $\ell$. In particular, increasing the block size drives down failure probabilities exponentially fast. \item The companion paper~\cite{Tro18:Analysis-Randomized-TR} gives the first results on the performance of randomized block Krylov methods for the symmetric eigenvalue problem. \item Our bounds have explicit and modest constants, which gives the bounds some predictive power. \end{itemize} \noindent We hope that these results help clarify the benefits of randomized block Krylov methods. We also hope that our work encourages researchers to develop new implementations of these algorithms that fully exploit contemporary computer architectures. \section{Preliminaries} Before we begin the proofs of the main results, Theorems~\ref{thm:gapfree} and~\ref{thm:gap}, we present some background information. In Section~\ref{app:rot-invar}, we justify the claim that the test matrix should have a uniformly random range. In Section~\ref{app:chebyshev}, we introduce the Chebyshev polynomials of the first and second type, and we develop the properties that we need to support our arguments. Expert readers may wish to skip to Section~\ref{sec:error-formula} for proofs of the main results. \subsection{Rotationally Invariant Distributions} \label{app:rot-invar} We wish to estimate spectral properties of a matrix using randomized block Krylov information. In particular, we aim to establish probabilistic upper bounds on the error in these spectral estimates for any input matrix. This section contains a general argument that clarifies why we ought to use a random test matrix with a rotationally invariant range in these applications. \begin{proposition}[Uniformly Random Range] \label{prop:random-range} Consider any bivariate function $f : \mathbbm{R}^{n \times n} \times \mathbbm{R}^{n \times \ell} \to \mathbbm{R}$ that is orthogonally invariant: $$ f( \mtx{A}; \mtx{B}) = f( \mtx{U A U}^*; \mtx{U B} ) \quad\text{for each orthogonal $\mtx{U} \in \mathbbm{R}^{n \times n}$.} $$ Fix a symmetric $n \times n$ matrix $\mtx{\Lambda}$, and consider the orthogonal orbit $$ \mathcal{A} := \mathcal{A}(\mtx{\Lambda}) := \big\{ \mtx{U\Lambda U}^* : \text{$\mtx{U} \in \mathbbm{R}^{n \times n}$ orthogonal} \big\}. $$ Let $\mtx{B} \in \mathbbm{R}^{n \times \ell}$ be a random matrix. Let $\mtx{V} \in \mathbbm{R}^{n \times n}$ be a uniformly random orthogonal matrix, drawn independently from $\mtx{B}$. Then $$ \begin{aligned} \max_{\mtx{A} \in \mathcal{A}} {} \operatorname{\mathbb{E}}_{\mtx{V}, \mtx{B}} f(\mtx{A}; \mtx{VB}) &\leq \max_{\mtx{A} \in \mathcal{A}} {} \operatorname{\mathbb{E}}_{\mtx{B}} f(\mtx{A}; \mtx{B}). % \end{aligned} $$ \end{proposition} \begin{proof} By orthogonal invariance of $f$, $$ \begin{aligned} \max_{\mtx{A} \in \mathcal{A}} {} \operatorname{\mathbb{E}}_{\mtx{V}, \mtx{B}} f(\mtx{A}; \mtx{VB}) &= \max_{\mtx{A} \in \mathcal{A}} {} \operatorname{\mathbb{E}}_{\mtx{V}, \mtx{B}} f(\mtx{V}^* \mtx{A} \mtx{V}; \mtx{B}) \\ &\leq \operatorname{\mathbb{E}}_{\mtx{V}} \max_{\mtx{A} \in \mathcal{A}} {} \operatorname{\mathbb{E}}_{\mtx{B}} f(\mtx{V}^* \mtx{A} \mtx{V}; \mtx{B}) = \max_{\mtx{A} \in \mathcal{A}} {} \operatorname{\mathbb{E}}_{\mtx{B}} f(\mtx{A}; \mtx{B}). \end{aligned} $$ The inequality is Jensen's, and the last identity follows from the definition of the class $\mathcal{A}$. \end{proof} Now, consider the problem of estimating the maximum eigenvalue of the worst matrix with eigenvalue spectrum $\mtx{\Lambda}$ using a block Krylov method. Define the orthogonally invariant% \footnote{The relative error~\eqref{eqn:error-def} is orthogonally invariant because the eigenvalues of $\mtx{A}$ are orthogonally invariant and~\eqref{eqn:rotation-invar} states that the eigenvalue estimate~\eqref{eqn:eigenvalue-estimate} is also orthogonally invariant.} function $f(\mtx{A}; \mtx{B}) = \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{B}; q))$. For any distribution on $\mtx{B}$ and for a uniformly random orthogonal matrix $\mtx{V}$, Proposition~\ref{prop:random-range} states that $$ \max_{\mtx{A} \in \mathcal{A}} {} \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{VB}; q)) \leq \max_{\mtx{A} \in \mathcal{A}} {} \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{B}; q)). $$ That is, the random test matrix $\mtx{VB}$ % is better than the test matrix $\mtx{B}$ if we want to minimize the worst-case expectation of the error; the same kind of bound holds for tail probabilities. We surmise that the test matrix $\mtx{B}$ should have a uniformly random range. Moreover, because of the co-range invariance~\eqref{eqn:range-invar}, we can select \emph{any} distribution with uniformly random range, such as the standard normal matrix $\mtx{\Omega}$. \subsection{Chebyshev Polynomials} \label{app:chebyshev} In view of~\eqref{eqn:krylov-poly}, we can interpret Krylov subspace methods as algorithms that compute best polynomial approximations. The analysis of Krylov methods often involves a careful choice of a specific polynomial that witnesses the behavior of the algorithm. Chebyshev polynomials arise naturally in this connection because they are the solutions to minimax approximation problems. This section contains the definitions of the Chebyshev polynomials of the first and second type, and it derives some key properties of these polynomials. We also construct the specific polynomials that arise in our analysis. Some of this material is drawn from the paper~\cite{KW92:Estimating-Largest} by Kuczy{\'n}ski \& Wo{\'z}niakowski. For general information about Chebyshev polynomials, we refer the reader to \cite{AS64:Handbook-Mathematical,NIST10:Handbook-Mathematical}. \subsubsection{Chebyshev Polynomials of the First Kind} We can define the Chebyshev polynomials of the first kind via the formula \begin{equation} \label{eqn:Tp} T_p(s) := \frac{1}{2} \left[ \left(s + \sqrt{s^2 - 1}\right)^p + \left(s - \sqrt{s^2 - 1}\right)^p \right] \quad\text{for $s \in \mathbbm{R}$ and $p \in \mathbbm{Z}_+$.} \end{equation} Using the binomial theorem, it is easy to check that this expression coincides with a polynomial of degree $p$ with real coefficients. We require two properties of the Chebyshev polynomial $T_p$. First, it satisfies a uniform bound on the unit interval: \begin{equation} \label{eqn:Tp-minmax} \abs{ T_p(s) } \leq 1 \quad\text{for $\abs{s} \leq 1$.} \end{equation} Indeed, it is well-known that $2^{-p} T_p$ is the unique monic polynomial of degree $p$ with the least maximum value on the interval $[-1,+1]$. The simpler result~\eqref{eqn:Tp-minmax} is an immediate consequence of the representation $$ T_p(s) = \cos\big( p \cos^{-1} (s) \big) \quad\text{for $\abs{s} \leq 1$.} $$ The latter formula follows from~\eqref{eqn:Tp} after we apply de Moivre's theorem for complex exponentiation. Second, the Chebyshev polynomial grows quickly outside of the unit interval: \begin{equation} \label{eqn:Tp-growth} T_p\left( \frac{1+s}{1-s} \right) \geq \frac{1}{2} \left( \frac{1 + \sqrt{s}}{1 - \sqrt{s}} \right)^p \quad\text{for $0 \leq s < 1$.} \end{equation} This estimate is a direct consequence of the definition~\eqref{eqn:Tp}. \subsubsection{The Attenuation Factor} Let $\beta \in [0, 1]$ be a parameter, and define the quantity \begin{equation} \label{eqn:delta} \delta := \delta(\beta) = \frac{1 - \sqrt{1 - \beta}}{1 + \sqrt{1 - \beta}}. \end{equation} This definition is closely connected with the growth properties of $T_p$. We can bound the attenuation factor in two ways: \begin{equation} \label{eqn:delta-bd} \delta \leq \mathrm{e}^{- 2 \sqrt{1 - \beta}} \quad\text{and}\quad \delta \leq \beta \cdot 2^{-2\sqrt{1 - \beta}}. \end{equation} These numerical inequalities can be justified using basic calculus. The first is very accurate for $\beta \approx 1$, while the second is better across the full range $\beta \in [0, 1]$. \subsubsection{First Polynomial Construction} \label{app:first-poly} Choose a nonnegative integer partition $q = q_1 + q_2$. Consider the polynomial \begin{equation} \label{eqn:phi-def} \phi_{\beta, q_1,q_2}(s) := \frac{s^{q_1} T_{q_2}((2/\beta) s - 1)}{T_{q_2}((2/\beta) - 1)} \quad\text{for $s \in \mathbbm{R}$.} \end{equation} The polynomial $\phi_{\beta, q_1,q_2}$ has degree $q$, and it is normalized so that it takes the value one at $s = 1$. It holds that \begin{equation} \label{eqn:phi-bound} \phi_{\beta, q_1,q_2}^2(s) \leq \frac{s^{2q_1}}{T_{q_2}^2((2/\beta) - 1)} \leq 4 s^{2q_1} \left( \frac{1 - \sqrt{1-\beta}}{1 + \sqrt{1-\beta}} \right)^{2q_2} = 4 s^{2q_1} \delta^{2q_2} \quad\text{for $0 \leq s \leq \beta$.} \end{equation} The first inequality follows from~\eqref{eqn:Tp-minmax}, and the second follows from~\eqref{eqn:Tp-growth}. Last, we instate the definition~\eqref{eqn:delta}. \begin{remark}[The Monomial] In contrast to~\cite{KW92:Estimating-Largest} and other prior work, we use products of Chebyshev polynomials with low-degree monomials. This seemingly minor change leads to results phrased in terms of the stable rank, rather than the ambient dimension. This is equivalent to a bound on $q_1$ iterations of the subspace iteration method, followed by $q_2$ iterations of the block Krylov method. \end{remark} \subsubsection{Chebyshev Polynomials of the Second Kind} We can define the Chebyshev polynomials of the second kind via the formula \begin{equation} \label{eqn:Up} U_p(s) := \frac{1}{2\sqrt{s^2 - 1}} \left[ \left(s + \sqrt{s^2 - 1}\right)^{p+1} - \left(s - \sqrt{s^2 - 1}\right)^{p+1} \right] \quad\text{for $s \in \mathbbm{R}$ and $p \in \mathbbm{Z}_+$.} \end{equation} Using the binomial theorem, it is easy to check that this expression coincides with a polynomial of degree $p$ with real coefficients. Moreover, when $p$ is an even number, the polynomial $U_p$ is an even function. We require two properties of the Chebyshev polynomial $U_p$. First, it satisfies a weighted uniform bound on the unit interval: \begin{equation} \label{eqn:Up-minmax} \abs{ \sqrt{1 - s^2} \, U_p(s) } \leq 1 \quad\text{for $\abs{s} \leq 1$.} \end{equation} In fact, $2^{-p} U_p$ is the unique monic polynomial that minimizes the maximum value of the left-hand side of~\eqref{eqn:Up-minmax} over the interval $[-1,+1]$; see~\cite[Eqn.~(23) et seq.]{KW92:Estimating-Largest}. The simpler result~\eqref{eqn:Up-minmax} is an immediate consequence of the representation $$ U_p(s) = \frac{ \sin\big( (p+1) \cos^{-1} (s) \big) }{ \sqrt{1 - s^2} } \quad\text{for $\abs{s} \leq 1$.} $$ The latter formula follows from~\eqref{eqn:Up} after we apply de Moivre's theorem for complex exponentiation. Second, we can evaluate the polynomial $U_{2p}$ at a specific point: \begin{equation} \label{eqn:Up-value} U_{2p}^2\big( \sqrt{1/\smash{\beta}} \big) = \frac{\beta \big(1-\delta^{2p+1} \big)^2}{4(1-\beta) \delta^{2p+1}} \quad\text{where $0 < \beta \leq 1$.} \end{equation} We defined $\delta = \delta(\beta)$ above in~\eqref{eqn:delta}. The formula~\eqref{eqn:Up-value} is a direct---but unpleasant---consequence of the definition~\eqref{eqn:Up}. \subsubsection{Second Polynomial Construction} \label{app:second-poly} As before, introduce a parameter $\beta \in [0, 1]$. Choose a nonnegative integer partition $q = q_1 + q_2$. Consider the polynomial \begin{equation} \label{eqn:psi-def} \psi_{\beta,q_1,q_2}(s) := \frac{s^{q_1} U_{2q_2}\big(\sqrt{s/\beta} \big)}{U_{2q_2}\big(\sqrt{1/\beta} \big)} \quad\text{for $s \in \mathbbm{R}$.} \end{equation} Since $U_{2q_2}$ is an even polynomial, this expression defines a polynomial $\psi_{\beta,q_1,q_2}$ with degree $q$ and normalized to take the value one at $s = 1$. We have the bound \begin{equation} \label{eqn:psi-bound} (\beta - s) \, \psi_{\beta,q_1,q_2}^2(s) \leq \frac{s^{2q_1} \beta}{U_{2q_2}^2(\sqrt{1/\beta})} = \frac{4 (1 - \beta) s^{2q_1} \delta^{2q_2+1}}{\big(1 - \delta^{2q_2+1}\big)^2} \quad\text{for $0 \leq s \leq \beta$.} \end{equation} The inequality~\eqref{eqn:psi-bound} follows from~\eqref{eqn:Up-minmax}, and the equality follows from~\eqref{eqn:Up-value}. Last, we instate the definition~\eqref{eqn:delta}. For $s > \beta$, the polynomial grows very rapidly. \section{The Error in the Block Krylov Subspace Method} \label{sec:error-formula} In this section, we initiate the proof of Theorems~\ref{thm:gapfree} and~\ref{thm:gap}. Along the way, we establish Proposition~\ref{prop:few-eigs}. First, we show how to replace the block Krylov subspace by a simple Krylov subspace (with block size one). Afterward, we develop an explicit representation for the error in the eigenvalue estimate derived from the simple Krylov subspace. Finally, we explain how to construct the simple Krylov subspace so that we preserve the benefits of computing a block Krylov subspace. The ideas in this section are drawn from several sources. The strategy of reducing a block Krylov subspace to a simple Krylov subspace already appears in~\cite{Saa80:Rates-Convergence}, but we use a different technique that is adapted from~\cite{HMT11:Finding-Structure}. The kind of analysis we perform for the simple Krylov method is standard; we have closely followed the presentation in~\cite{KW92:Estimating-Largest}. \subsection{Simplifications} Suppose that the input matrix $\mtx{A}$ is a multiple of the identity matrix. From the definitions~\eqref{eqn:krylov-matrix},~\eqref{eqn:krylov-subspace}, and \eqref{eqn:eigenvalue-estimate}, it is straightforward to check that the eigenvalue estimate $\xi_{\max}(\mtx{A}; \mtx{\Omega}; q) = \lambda_{\max}(\mtx{A})$ with probability one for each $q \geq 0$. Therefore, we may as well assume that $\mtx{A}$ is not a multiple of the identity. In view of~\eqref{eqn:input-diag}, we may also assume that the input matrix is diagonal with weakly decreasing entries: \begin{equation} \label{eqn:A-diag} \mtx{A} = \operatorname{diag}( a_1, a_2, \dots, a_n ) \quad\text{where}\quad a_1 \geq a_2 \geq \dots \geq a_n. \end{equation} Since $\mtx{A}$ has at least two distinct eigenvalues, we may normalize the extreme eigenvalues of $\mtx{A}$: \begin{equation} \label{eqn:normalization} a_1 = 1 \quad\text{and}\quad a_n = 0. \end{equation} The main results are all stated in terms of affine invariant quantities, so we have not lost any generality. These choices help to streamline the proof. \subsection{Block Krylov Subspaces and Simple Krylov Subspaces} The first key step in the argument is to reduce the block Krylov subspace to a Krylov subspace with block size one. This idea allows us to avoid any computations involving matrices. To that end, recall that the block Krylov subspace takes the form $$ K_q(\mtx{A}; \mtx{\Omega}) = \operatorname{range} \begin{bmatrix} \mtx{\Omega} & \mtx{A\Omega} & \mtx{A}^2 \mtx{\Omega} & \dots & \mtx{A}^q \mtx{\Omega} \end{bmatrix}. $$ In particular, for any vector $\vct{x} \in \operatorname{range}(\mtx{\Omega})$, $$ K_q(\mtx{A}; \vct{x}) = \operatorname{range} \begin{bmatrix} \vct{x} & \mtx{A}\vct{x} & \mtx{A}^2 \vct{x} & \dots & \mtx{A}^q \vct{x} \end{bmatrix} \subset K_q(\mtx{A}; \mtx{\Omega}). $$ Later, we will make a careful choice of the vector $\vct{x}$ so that we do not abandon the benefits of computing the block Krylov subspace. \subsection{Representation of the Error Using Polynomials} The next step in the argument is to exploit the close relationship between Krylov subspaces and polynomial filtering to obtain an explicit representation of the error in the eigenvalue estimate. Using~\eqref{eqn:krylov-poly}, we may rewrite the last display in the form $$ K_q(\mtx{A}; \vct{x}) = \lspan{} \big\{ \phi(\mtx{A}) \vct{x} : \phi \in \mathcal{P}_q \big\} \subset K_q(\mtx{A}; \mtx{\Omega}). $$ As a consequence of this containment, $$ \begin{aligned} \xi_{\max}( \mtx{A}; \mtx{\Omega};q ) = \max_{\vct{v} \in K_q(\mtx{A}; \mtx{\Omega})} \frac{\vct{v}^* \mtx{A} \vct{v}}{\vct{v}^* \vct{v}} \geq \max_{\vct{v} \in K_q(\mtx{A}; \vct{x})} \frac{\vct{v}^* \mtx{A} \vct{v}}{\vct{v}^* \vct{v}} = \max_{\phi \in \mathcal{P}_q} \frac{(\phi(\mtx{A}) \vct{x})^* \mtx{A} (\phi(\mtx{A}) \vct{x})} {(\phi(\mtx{A}) \vct{x})^*(\phi(\mtx{A}) \vct{x})}. \end{aligned} $$ Owing to the normalization~\eqref{eqn:normalization}, the relative error~\eqref{eqn:error-def} in the eigenvalue estimate satisfies $$ \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega}; q)) = 1 - \xi_{\max}(\mtx{A}; \mtx{\Omega}; q) \leq \min_{\phi \in \mathcal{P}_q} \frac{(\phi(\mtx{A}) \vct{x})^* (\mathbf{I} - \mtx{A}) (\phi(\mtx{A}) \vct{x})} {(\phi(\mtx{A}) \vct{x})^*(\phi(\mtx{A}) \vct{x})}. $$ The fraction is continuous on the set of polynomials $\{ \phi \in \coll{P}_q : \phi(\mtx{A}) \vct{x} \neq \vct{0} \}$, and it is invariant under scaling of the polynomial $\phi$. Thus, assuming that the first coordinate of $\vct{x}$ is nonzero, we may assume that $\phi(1) \neq 0$ and then rescale so that $\phi(1) = 1$. With the definition $\mathcal{P}_q(1) := \{ \phi \in \mathcal{P}_q : \phi(1) = 1 \}$, we arrive at $$ \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega}; q)) \leq \inf_{\phi \in \mathcal{P}_q(1)} \frac{(\phi(\mtx{A}) \vct{x})^* (\mathbf{I} - \mtx{A}) (\phi(\mtx{A}) \vct{x})} {(\phi(\mtx{A}) \vct{x})^*(\phi(\mtx{A}) \vct{x})}. $$ We remark that this inequality becomes an equality in the case where the block size $\ell = 1$. Invoke~\eqref{eqn:A-diag} to rewrite this bound in terms of the eigenvalues of $\mtx{A}$: \begin{equation} \label{eqn:err-poly} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega}; q)) \leq \inf_{\phi \in \mathcal{P}_q(1)} \frac{\sum_{i=1}^n X_i^2 \phi^2(a_i)(1 - a_i)} {\sum_{i=1}^n X_i^2 \phi^2(a_i)} = \inf_{\phi \in \mathcal{P}_q(1)} \frac{\sum_{i>1} X_i^2 \phi^2(a_i)(1 - a_i)} {X_1^2 + \sum_{i>1} X_i^2 \phi^2(a_i)}. \end{equation} We have introduced the coordinates of the vector $\vct{x} = (X_1, \dots, X_n)$, and we have used normalization~\eqref{eqn:normalization} to simplify the expression. \begin{remark}[Multiplicity] When the maximum eigenvalue has multiplicity $m$ greater than one, we can group the copies of the eigenvalue together in the denominator to obtain the larger term $X_1^2 + \dots + X_m^2$. Pursuing this argument, we see that the algorithm converges faster when $m > 1$. \end{remark} \subsection{When the Matrix has Few Distinct Eigenvalues} Suppose that the distinct eigenvalues of the input matrix $\mtx{A}$ are $\mu_1 = 1$ and $\mu_2, \dots, \mu_r$ where $r \leq q + 1$. Consider the polynomial $$ \phi_0(s) = \prod\limits_{i = 2}^r \frac{s - \mu_i}{1 - \mu_i} \in \mathcal{P}_{r-1}(1) \subset \mathcal{P}_q(1). $$ This polynomial annihilates each point in the spectrum, except for $\mu_1$. Setting $\phi = \phi_0$ in~\eqref{eqn:err-poly}, we discover that $\mathrm{err}(\xi_{\max}(\mtx{A};\mtx{\Omega}; q)) = 0$ with probability one. This fact appears as Proposition~\ref{prop:few-eigs}. \subsection{Choosing the Simple Krylov Space} The next step in the argument is to select a particular vector $\vct{x} \in \operatorname{range}(\mtx{\Omega})$. Let $\vct{\omega}_1^* \in \mathbbm{R}^{\ell}$ denote the first row of the matrix $\mtx{\Omega}$. Set $$ \vct{x} = \frac{\mtx{\Omega} \vct{\omega}_1}{\norm{\vct{\omega}_1}} \in \operatorname{range}(\mtx{\Omega}). $$ The rows of $\mtx{\Omega}$ are statistically independent standard normal vectors, which are rotationally invariant. It follows that the entries of $\vct{x} = (X_1, \dots, X_n)$ are also statistically independent. Moreover, \begin{equation} \label{eqn:x-distrib} X_1 \sim \textsc{chi}(\ell) \quad\text{and}\quad X_i \sim \textsc{normal}(0, 1) \quad\text{for $i > 1$.} \end{equation} We write $\textsc{chi}(\ell)$ for the chi distribution with $\ell$ degrees of freedom. This choice of $\vct{x}$ ensures that $X_1^2$ is large relative to the other $X_i^2$. In particular, $X_1 \neq 0$ with probability one. In a concrete sense, we see that the block Krylov method is an artifice for increasing the apparent multiplicity of the maximum eigenvalue. The argument here is inspired by the analysis in Halko et al.~\cite[Secs.~9, 10]{HMT11:Finding-Structure}. \begin{remark}[Complex Setting] When the input matrix is Hermitian and the test matrix follows the complex standard normal distribution, we obtain the same formulas with $X_1 \sim \textsc{chi}(2\ell)$ and $X_i \sim \textsc{normal}_{\mathbbm{C}}(0, 1)$. In effect, the multiplicity of every eigenvalue is doubled. \end{remark} \section{Probabilistic Bounds for the Error} \label{sec:prob-bounds} This section contains the proof of the probability bounds that appear in Theorem~\ref{thm:gapfree} and~\ref{thm:gap}. The argument is based on the bound~\eqref{eqn:err-poly} for the error and the distributional properties~\eqref{eqn:x-distrib} of the random vector $\vct{x}$. The proof is inspired by the argument in Kuczy{\'n}ski \& Wo{\'z}niakowski~\cite{KW92:Estimating-Largest}, but our approach is technically easier. Indeed, they work with a random vector that is uniformly distributed on the Euclidean unit sphere, which leads to a difficult multivariate integration. In contrast, our random vector $\vct{x}$ has independent entries, which means that we only have to compute one-dimensional integrals. \subsection{A Bound for the Probability} Let $\varepsilon \in (0, 1)$ be an error tolerance. Our goal is to control the probability $P_{\varepsilon}$ that the relative error in the eigenvalue estimate~\eqref{eqn:eigenvalue-estimate} is at least $\varepsilon$. In other words, we wish to bound $$ P_{\varepsilon} := \Prob{ \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega}; q)) \geq \varepsilon }. $$ In view of the upper bound~\eqref{eqn:err-poly} for the relative error, we obtain the estimate $$ P_{\varepsilon} \leq \Prob{ \inf_{\phi \in \mathcal{P}_q(1)} \frac{\sum_{i > 1} X_i^2 \phi^2(a_i) (1 - a_i)}{X_1^2 + \sum_{i > 1} X_i^2 \phi^2(a_i)} \geq \varepsilon }. $$ Fix a polynomial $\phi \in \mathcal{P}_q(1)$, to be determined later. Then rearrange the inequality in the event: \begin{equation} \label{eqn:Peps-bd1} \begin{aligned} P_{\varepsilon} &\leq \Prob{ \sum_{i > 1} X_i^2 \phi^2(a_i)(1 - a_i) \geq \varepsilon X_1^2 + \varepsilon \sum_{i > 1} X_i^2 \phi^2(a_i) } \\ &= \Prob{ - \varepsilon X_1^2 + \sum_{i > 1} X_i^2 \phi^2(a_i)(1 - \varepsilon - a_i) \geq 0 } \\ &\leq \Prob{ - \varepsilon X_1^2 + \sum_{a_i < 1 - \varepsilon} X_i^2 \phi^2(a_i)(1 - \varepsilon - a_i) \geq 0 } \\ &=: \Prob{ - \varepsilon X_1^2 + \sum_{i \in I} c_i X_i^2 \geq 0 }. \end{aligned} \end{equation} To reach the third line, we have dropped the nonpositive terms in the sum. Then we introduced the compact notation $$ I := \{ i : a_i < 1 - \varepsilon \} \quad\text{and}\quad c_i := \phi^2(a_i)(1 - \varepsilon - a_i) > 0. $$ To continue the argument, we apply some elementary notions from the theory of concentration of measure. \subsection{The Laplace Transform Argument} We invoke the Laplace transform method to convert the probability bound into an expectation bound. Introduce a parameter $\theta > 0$, to be chosen later. Continuing from~\eqref{eqn:Peps-bd1}, we write the probability as the expectation of a 0--1 indicator function: $$ \begin{aligned} P_{\varepsilon} &\leq \operatorname{\mathbb{E}} \mathbb{1} \left\{ - \varepsilon X_1^2 + \sum_{i \in I} c_i X_i^2 \geq 0 \right\} \\ &\leq \operatorname{\mathbb{E}} \exp\left( - \theta \varepsilon X_1^2 + \sum_{i \in I} \theta c_i X_i^2 \right). \end{aligned} $$ To reach the second line, we bound the indicator $\mathbb{1}\{ s \geq 0 \}$ above by the function $s \mapsto \mathrm{e}^{\theta s}$. Write the exponential as a product, and invoke the independence of the family $\{ X_i \}$ to obtain $$ P_{\varepsilon} \leq \operatorname{\mathbb{E}} \left[ \mathrm{e}^{- \theta \varepsilon X_1^2} \prod_{i \in I} \mathrm{e}^{\theta c_i X_i^2} \right] = \left( \operatorname{\mathbb{E}} \mathrm{e}^{- \theta \varepsilon X_1^2} \right) \left( \prod_{i \in I} \operatorname{\mathbb{E}} \mathrm{e}^{\theta c_i X_i^2} \right) . $$ The distributional property~\eqref{eqn:x-distrib} implies that $X_1^2$ is a chi-squared variable with $\ell$ degrees of freedom, while $X_i^2$ is a chi-squared variable with one degree of freedom. Computing the remaining expectations is a standard exercise, which results in the bound $$ P_{\varepsilon} \leq \left( 1 + 2 \theta \varepsilon \right)^{-\ell/2}\left( \prod_{i \in I} (1 - 2 \theta c_i) \right)^{-1/2} \quad\text{when $\theta < (2c_i)^{-1}$ for each $i \in I$.} $$ We make a coarse estimate to arrive at $$ P_{\varepsilon} \leq \left( 1 + 2 \theta \varepsilon \right)^{-\ell/2} \left( 1 - 2 \theta \sum_{i \in I} c_i \right)^{-1/2} \quad\text{when $\theta < \big(2 \sum_{i \in I} c_i \big)^{-1}$.} $$ The last bound follows from repeated application of the numerical inequality $(1 - s)(1 - t) \geq 1 - (s + t)$, which is valid when $st \geq 0$. Next, we must identify a suitable value for $\theta$. It is possible to minimize the probability bound with respect to $\theta$, but it is more expedient to select $\theta^{-1} = 4 \sum_{i \in I} c_i$. This choice yields \begin{equation} \label{eqn:Peps-penult} P_{\varepsilon} \leq \sqrt{2} \left( 1 + \frac{\varepsilon/2}{\sum_{i \in I} c_i} \right)^{-\ell / 2} = \sqrt{2} \left[ 1 + \frac{\varepsilon/2}{\sum_{a_i < 1 - \varepsilon} \phi^2(a_i) (1 - \varepsilon - a_i)} \right]^{-\ell / 2}. \end{equation} It remains to choose a good polynomial $\phi$. Fortunately, we have already done the work in Section~\ref{app:chebyshev}. \subsection{Probability Bound without a Spectral Gap} In this section, we use~\eqref{eqn:Peps-penult} to derive the probability bound that appears in Theorem~\ref{thm:gapfree}. Set the parameter $\beta = 1 - \varepsilon$. Obviously, $$ \sum_{a_i < 1 - \varepsilon} \phi_1^2(a_i) (1 - \varepsilon - a_i) = \sum_{a_i < \beta} \phi_1^2(a_i) (\beta - a_i). $$ To control the terms in this sum, we need second-kind Chebyshev polynomials because they satisfy the weighted uniform bound~\eqref{eqn:Up-minmax}. For a partition $q = q_1 + q_2$, consider the polynomial $$ \phi_1(s) := \frac{s^{q_1} U_{2q_2}\big( \sqrt{s/\beta} \big)}{U_{2q_2}\big(\sqrt{1/\beta}\big)} \in \mathcal{P}_q(1). $$ According to~\eqref{eqn:psi-bound} and~\eqref{eqn:delta-bd}, this polynomial satisfies \begin{equation} \label{eqn:my-phi1-bd} \phi^2_1(s) (\beta - s) \leq \frac{4 \varepsilon s^{2q_1} \delta^{2q_2+1}}{(1 - \delta^{2q_2+1})^2} \quad\text{for $0 \leq s \leq \beta$} \quad\text{where}\quad \delta \leq \mathrm{e}^{-2\sqrt{\varepsilon}}. \end{equation} See Section~\ref{app:second-poly} for further discussion. Using these facts, we may estimate that \begin{equation*} % \begin{aligned} \sum_{a_i < 1 - \varepsilon} \phi_1^2(a_i) (1 - \varepsilon - a_i) &\leq 4 \varepsilon \left( \sum_{a_i < \beta} a_i^{2q_1} \right) \delta^{2q_2+1} \big(1 - \delta^{2q_2+1}\big)^{-2} \\ &\leq 4 \varepsilon \operatorname{srk}(q_1) \, \delta^{2q_2+1} \big(1 - \delta^{2q_2+1}\big)^{-2}. \end{aligned} \end{equation*} In the last step, we bound the sum in terms of the stable rank~\eqref{eqn:srank}. We rely on the normalization~\eqref{eqn:normalization} to recognize the stable rank. Select $\phi = \phi_1$ in our probability bound~\eqref{eqn:Peps-penult}. Using the last display, we arrive at $$ P_{\varepsilon} \leq \sqrt{2} \left[ 1 + \frac{ \big( 1 - \delta^{2q_2+1} \big)^2 }{8 \operatorname{srk}(q_1) \delta^{2q_2+1}} \right]^{-\ell/2}. $$ We can develop a lower bound on the bracket as follows. $$ 1 + \frac{ \big( 1 - \delta^{2q_2+1} \big)^2 }{8 \operatorname{srk}(q_1) \delta^{2q_2+1}} \geq 1 + \frac{1 - 2\delta^{2q_2+1}}{8 \operatorname{srk}(q_1)\, \delta^{2q_2+1}} \geq \frac{1}{8 \operatorname{srk}(q_1)\,\delta^{2q_2+1}}. $$ The last inequality follows from the fact that $\operatorname{srk}(q_1) \geq 1$ because $\mtx{A}$ is not a multiple of the identity. Combining the last two displays, we obtain \begin{equation} \label{eqn:prob-gapfree} P_{\varepsilon} \leq \sqrt{2} \left[ 8 \operatorname{srk}(q_1) \, \delta^{2q_2+1} \right]^{\ell / 2} \leq \sqrt{2} \left[ 8 \operatorname{srk}(q_1) \cdot \mathrm{e}^{-2(2q_2+1) \sqrt{\varepsilon}} \right]^{\ell/2}. \end{equation} The final relation is a consequence of the bound for $\delta$ in~\eqref{eqn:my-phi1-bd}. This is the required statement. \subsection{Probability Bound with a Spectral Gap} Now, we use~\eqref{eqn:Peps-penult} to establish the probability bound that appears in Theorem~\ref{thm:gap}. Recall that the spectral gap $\gamma$ is defined in~\eqref{eqn:spectral-gap}. This time, set $\beta = 1 - \gamma$. Since $1 - \gamma$ is the first eigenvalue smaller than one and $\varepsilon > 0$, $$ \sum_{a_i \leq 1 - \varepsilon} \phi_{2}^2(a_i) (1- \varepsilon - a_i) \leq \sum_{a_i \leq 1 - \gamma} \phi_{2}^2(a_i). $$ To control the sum, we need first-kind Chebyshev polynomials because they satisfy the uniform bound~\eqref{eqn:Tp-minmax}. For a partition $q = q_1 + q_2$, construct the polynomial \begin{equation} \label{eqn:my-phi2} \phi_2(s) := \frac{s^{q_1} T_{q_2}((2/\beta)s - 1)}{T_{q_2}((2/\beta) - 1)} \in \mathcal{P}_q(1). \end{equation} According to~\eqref{eqn:delta-bd} and~\eqref{eqn:phi-bound}, this polynomial satisfies \begin{equation} \label{eqn:my-phi2-bd} \phi_{2}^2(s) \leq 4 s^{2q_1} \mathrm{e}^{-4q_2\sqrt{\gamma}} \quad\text{for $0 \leq s \leq \beta$.} \end{equation} See Section~\ref{app:first-poly} for more details. Using these facts, we calculate that $$ \begin{aligned} \sum_{a_i \leq 1 - \varepsilon} \phi_{2}^2(a_i) (1- \varepsilon - a_i) &\leq 4 \left( \sum_{a_i \leq 1 - \gamma} a_i^{2q_1} \right) \mathrm{e}^{-4q_2\sqrt{\gamma}} \leq 4 \operatorname{srk}(q_1) \cdot \mathrm{e}^{-4q_2\sqrt{\gamma}}. \end{aligned} $$ We have invoked~\eqref{eqn:normalization} to identify the stable rank~\eqref{eqn:srank}. Instantiate the probability estimate~\eqref{eqn:Peps-penult} with $\phi = \phi_{2}$, and substitute in the last display to obtain \begin{equation} \label{eqn:prob-gap} P_{\varepsilon} \leq \sqrt{2} \left[ 1 + \frac{\varepsilon}{8 \operatorname{srk}(q_1) \cdot \mathrm{e}^{-4q_2 \sqrt{\gamma}}} \right]^{-\ell/2} \leq \sqrt{2} \left[ \frac{8 \operatorname{srk}(q_1)}{\varepsilon} \cdot \mathrm{e}^{-4q_2 \sqrt{\gamma}} \right]^{\ell/2}. \end{equation} We have used the numerical inequality $(1 + 1/s)^{-1} \leq s$, valid for $s > 0$. This is the advertised result. \section{A Bound for the Expected Error without a Spectral Gap} \label{sec:expect-bound-gapfree} In this section, we establish the expectation bound that appears in Theorem~\ref{thm:gapfree}. To obtain this result, we simply integrate the probability bound~\eqref{eqn:prob-gapfree}. Surprisingly, this approach appears to be more effective than a direct computation of the expected error. This insight yields a better expected error bound than the one obtained in~\cite{KW92:Estimating-Largest}. \subsection{Computing the Expectation} We may express the expectation of the relative error as an integral: $$ E := \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega};q)) = \int_0^1 \Prob{ \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega};q)) \geq \varepsilon} \idiff{\varepsilon} = \int_0^1 P_{\varepsilon} \idiff{\varepsilon}. $$ The limits of the integral follow from the fact that the relative error falls in the interval $[0, 1]$. We split the integral at a value $c > 0$, to be determined later. Then make the estimates $$ E \leq c + \int_c^1 P_{\varepsilon} \idiff{\varepsilon} \leq c + \sqrt{2}\, (8 \operatorname{srk}(q_1))^{\ell/2} \int_c^\infty \mathrm{e}^{-(2q_2+1) \ell \sqrt{\varepsilon}} \idiff{\varepsilon}. $$ To obtain the first inequality, we use the trivial bound $P_{\varepsilon} \leq 1$. The second inequality is a consequence of~\eqref{eqn:prob-gapfree}. The remaining integral can be calculated by changing the variable and integrating by parts. Indeed, $$ \int_c^\infty \mathrm{e}^{-p \sqrt{\varepsilon}} \idiff{\varepsilon} = 2 \left( \frac{\sqrt{c}}{p} + \frac{1}{p^2} \right) \mathrm{e}^{-p \sqrt{c}} \quad\text{for $p > 0$.} $$ Together, the last two displays yield $$ E \leq c + 2 \sqrt{2} (8 \operatorname{srk}(q_1))^{\ell/2} \left( \frac{\sqrt{c}}{(2q_2+1)\ell} + \frac{1}{(2q_2+1)^2 \ell^2} \right) \mathrm{e}^{- (2q_2+1)\ell \sqrt{c}}. $$ Now, select the (optimal) value $$ c = \left( \frac{\ell^{-1} \log 2 + \log(8 \operatorname{srk}(q_1))}{2(2q_2+1)} \right)^2. $$ Combine the last two displays to reach $$ E \leq \left( \frac{\ell^{-1}(2 + \log 2) + \log(8 \operatorname{srk}(q_1))}{2(2q_2+1)} \right)^{2} $$ Bound the numerical constant by 2.70 to complete the proof. \section{A Bound for the Expected Error with a Spectral Gap} \label{sec:expect-bound-gap} Last, we establish the expectation bounds for the relative error that appear in Theorem~\ref{thm:gap}. In this case, we achieve better results by a direct computation, rather than by integrating the probability bound~\eqref{eqn:prob-gap}. These arguments are inspired by the approach in~\cite{KW92:Estimating-Largest}, but our computations are technically easier because the random vector $\vct{x}$ has independent entries. \subsection{Form of the Expected Error} Fix a polynomial $\phi \in \mathcal{P}_q(1)$. Take the expectation of the error bound~\eqref{eqn:err-poly}: \begin{equation*} % \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega}; q)) \leq \operatorname{\mathbb{E}}\left[ \frac{\sum_{i > 1} X_i^2 \phi^2(a_i)(1-a_i)}{X_1^2 + \sum_{i > 1} X_i^2 \phi^2(a_i)} \right]. \end{equation*} Set the parameter $\beta = 1 - \gamma$. By the definition~\eqref{eqn:spectral-gap} of the spectral gap, each eigenvalue of $\mtx{A}$ that exceeds $\beta$ equals the maximum eigenvalue $a_1 = 1$. Therefore, \begin{equation} \label{eqn:unexpected} \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega}; q)) \leq \operatorname{\mathbb{E}}\left[ \frac{\sum_{a_i \leq \beta} X_i^2 \phi^2(a_i)}{X_1^2 + \sum_{a_i \leq \beta} X_i^2 \phi^2(a_i)} \right]. \end{equation} By independence, we may compute the expectation with respect to $X_1$, holding $X_i$ fixed for each $i$ where $a_i \leq \beta$. The computation of this integral depends on the block size $\ell$. \subsection{Error Bound for Block Size $\ell \geq 3$} We begin with the case $\ell \geq 3$. % Use the fact that $X_1 \sim \textsc{chi}(\ell)$ to compute that $$ \operatorname{\mathbb{E}} \left[ \frac{1}{X_1^2 + c} \right] = \frac{1}{2} \mathrm{e}^{c/2} \int_1^\infty s^{-\ell/2} \mathrm{e}^{-cs/2} \idiff{s} \leq \frac{1}{(\ell - 2) + c} \quad\text{for $\ell \geq 3$ and $c \geq 0$.} $$ The first relation depends on a standard identity for the partial gamma function~\cite[Sec.~8.6.4]{NIST10:Handbook-Mathematical}. The second relation is a classic bound for the exponential integral due to Hopf~\cite[p.~26]{Hop34:Mathematical-Problems}; see~\cite{Gau59:Exponential-Integral} or~\cite[Sec.~5.1.19]{AS64:Handbook-Mathematical}. With $c = \sum_{a_i \leq \beta} X_i^2 \phi^2(a_i)$, the last two displays imply that \begin{equation*} \label{eqn:unsplit-l3} \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega};q)) \leq \operatorname{\mathbb{E}} \left[ \frac{\sum_{a_i\leq\beta} X_i^2 \phi^2(a_i)}{(\ell - 2) + \sum_{a_i\leq \beta} X_i^2 \phi^2(a_i)} \right]. \end{equation*} The function $t \mapsto t / (s + t)$ is concave, so Jensen's inequality allows us to draw the expectation inside the function to reach \begin{equation*} \label{eqn:unsplit-l4} \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega};q)) \leq \frac{\sum_{a_i\leq\beta} \phi^2(a_i)}{(\ell - 2) + \sum_{a_i\leq \beta} \phi^2(a_i)}. \end{equation*} Indeed, $\operatorname{\mathbb{E}} X_i^2 = 1$ because $X_i$ is standard normal for each $i > 1$. Introduce the polynomial $\phi = \phi_2$ from~\eqref{eqn:my-phi2} into the last display. Using the upper bound~\eqref{eqn:my-phi2-bd} and the fact that $t \mapsto t/(s+t)$ is increasing, we arrive at $$ \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega})) \leq \frac{4 \operatorname{srk}(q_1) \cdot \mathrm{e}^{-4q_2 \sqrt{\gamma}}}{(\ell - 2) + 4 \operatorname{srk}(q_1) \cdot \mathrm{e}^{-4q_2 \sqrt{\gamma}}}. $$ This is the advertised result for $\ell = 3$ in Theorem~\ref{thm:gap}. \subsection{Error Bound for Block Size $\ell = 2$} Now, assume that the block size $\ell = 2$. In this case, $X_1 \sim \textsc{chi}(2)$. Therefore, it holds that $$ \operatorname{\mathbb{E}} \left[ \frac{1}{X_1^2 + c} \right] = \frac{1}{2} \mathrm{e}^{c/2} \int_1^\infty s^{-1} \mathrm{e}^{-cs/2} \idiff{s} \leq \frac{1}{2} \log\left(1 + \frac{2}{c}\right) \quad\text{for $c > 0$.} $$ The first relation is an immediate consequence of the definition of the chi-square density and a change of variables. The second relation is a classic bound for the exponential integral~\cite[Sec.~5.1.20]{AS64:Handbook-Mathematical}. The rest of the argument follows the same path as in the case $\ell \geq 3$. With $c = \sum_{a_i \leq \beta} X_i^2 \phi^2(a_i)$, we combine~\eqref{eqn:unexpected} with the last display to obtain \begin{equation*} \label{eqn:unsplit-l2} \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega})) \leq \operatorname{\mathbb{E}} \left[ \frac{ \sum_{a_i \leq \beta} X_i^2 \phi^2(a_i) }{2} \cdot \log\left(1 + \frac{2}{\sum_{a_i \leq \beta} X_i^2 \phi^2(a_i)} \right) \right]. \end{equation*} The function $t \mapsto t \log(1 + 1/t)$ is concave and increasing, so Jensen's inequality yields $$ \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega})) \leq \frac{\sum_{a_i \leq \beta} \phi^2(a_i)}{2} \cdot \log\left(1 + \frac{2}{\sum_{a_i \leq \beta} \phi^2(a_i)} \right). $$ Select the polynomial $\phi = \phi_2$ from~\eqref{eqn:my-phi2}, and invoke the bound~\eqref{eqn:my-phi2-bd} to arrive at $$ \begin{aligned} \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega})) &\leq \frac{1}{2} \cdot 4 \operatorname{srk}(q_1) \mathrm{e}^{-4 q_2 \sqrt{\gamma}} \cdot \log\left(1 + \frac{2}{4\operatorname{srk}(q_1) \mathrm{e}^{-4 q_2 \sqrt{\gamma}}} \right). % \end{aligned} $$ This is the desired outcome for block size $\ell = 2$ in Theorem~\ref{thm:gap}. \subsection{Error Bound for Block Size $\ell = 1$} Finally, we complete the analysis for the case where the block size $\ell = 1$. Use the fact that $X_1 \sim \textsc{chi}(1)$ to see that $$ \operatorname{\mathbb{E}} \left[ \frac{1}{X_1^2 + c} \right] = \frac{1}{\sqrt{c}} \mathrm{e}^{c/2} \int_{\sqrt{c}}^\infty \mathrm{e}^{-s^2/2} \idiff{s} \leq \sqrt{\frac{2\pi}{c}}. % $$ The first relation follows from~\cite[Sec.~8.6.4]{NIST10:Handbook-Mathematical} after a change of variable. The second relation is a well-known tail bound for a standard normal random variable. Continuing as we have done before, $$ \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega})) \leq \sqrt{2\pi} \operatorname{\mathbb{E}} \left[ \sum_{a_i \leq \beta} X_i^2 \phi^2(a_i) \right]^{1/2} \leq \sqrt{2\pi} \left[ \sum_{a_i \leq \beta} \phi^2(a_i) \right]^{1/2}. $$ Insert the bound~\eqref{eqn:my-phi2-bd} for the polynomial $\phi = \phi_2$ to arrive at $$ \operatorname{\mathbb{E}} \mathrm{err}(\xi_{\max}(\mtx{A}; \mtx{\Omega})) \leq \sqrt{8 \pi \operatorname{srk}(q_1) } \cdot \mathrm{e}^{-2 q_2 \sqrt{\gamma}}. $$ Of course, the relative error is always bounded above by one. This is the result stated in Theorem~\ref{thm:gap}. \section*{Acknowledgments} This paper was produced under a subcontract to ONR Award 00014-16-C-2009. The author thanks Shaunak Bopardikar, Petros Drineas, Ilse Ipsen, Youssef Saad, Fadil Santosa, and Rob Webber for helpful discussions and feedback. Mark Embree provided very detailed, thoughtful comments that greatly improved the quality of the paper. \bibliographystyle{myalpha} \newcommand{\etalchar}[1]{$^{#1}$}
\section{Introduction} Artificial intelligence has abundant applications in a wide spectrum of disciplines including health care, medicine, finance, autonomous driving and engineering of smart devices to name a few~\cite{jordan_machine_2015}. In the physical sciences, machine learning (ML) techniques have been used to extract useful information from massive datasets generated by particle physics experiments or observations in astronomy~\cite{mehta_high-bias_2019}. In condensed matter physics, ML methods have been adapted to study thermodynamic phase transitions in several classical systems such as the Ising Model \cite{Carrasquilla2017}, the $XY$ Model~\cite{Beach2018, Zhang2019} and the Hubbard model \cite{ChNg2018}, as well as to explore quantum phase transitions~\cite{Arsenault2014,Venderley2018,Che2020,Lidiak2020}. On regular lattices, for instance, unsupervised learning models are used to discriminate between ferromagnetic and paramagnetic spin configurations at different temperatures, with unlabeled samples above and below the percolation threshold. Examples of such methods include principle component analysis (PCA)~\cite{Wang2016}, $t-$distributed stochastic neighboring ensemble ($t-$SNE)~\cite{Zhang2019}, $k-$means clustering ~\cite{Canabarro2019}, auto-encoders~\cite{Wetzel2017} and the recently introduced confusion scheme~\cite{VanNieuwenburg2017}. When labels with ordered-disordered states of configurations are introduced, supervised learning methods such as Artificial (ANN)~\cite{Carleo2017,morningstar} and Convolution Neural Networks (CNN)~\cite{Huembeli2018}, are employed to infer the transition temperature, which has been found to be in exact agreement with theoretical predictions \cite{KochJanusz2018,Chng2017} \par In complex networks an important example of critical phenomena is percolation, a measure of structural resilience and a benchmark model for other dynamical processes such as epidemic spreading, vital node identification and community detection~\cite{Newman2002, derenyi_clique_2005, lu_vital_2016}. One example is bond-percolation, where in a network of $N$ nodes, $E$ edges are added randomly to an empty network (or conversely removed at random from a connected network), until at a critical fraction of edges $\phi_c$, a giant connected component (GCC) of size $O(N)$ emerges in a continuous second-order phase transition. While the critical bond-occupation probability $\phi_c$ can be computed using numerical~\cite{Newman2000} and analytical methods~\cite{Newman_2001, Newman_2008, Ghoshal_2009, Zlatic_2009}, for networks of smaller size and in real-world networks with incomplete data, these are less predictive compared to the true percolation threshold~\cite{Radicchi2015}. Indeed, data on empirical networks is commonly noisy and restricted to sub-samples~\cite{Otsuka2019}. Furthermore, uncertainty in measurements alters network topology and impacts structural measures such as centrality as well as the percolation threshold, which in turn affect network dynamics~\cite{Ghoshal_2011, martin_niemeyer_2019,NIU2015124, Mimar_2019, Mimar_2021}. In particular, nodes in the network-core are more sensitive to incomplete observations and missing links \cite{Platig2013,Shang2021}. Examples include Call data records (CDR's) from mobile-phones that miss connections due to missing phone numbers, as well as online social networks that may indicate existing virtual ties among people who are unacquainted~\cite{Onnela7332}. In the context of epidemics, super-spreading events have been identified as a significant source and driver of major outbreaks~\cite{Stein2011}. However, contact-tracing the network of spread is biased by limitations in data collection and public health capacity, potentially leading to over- or under-estimation of the extent of super-spreading \cite{Susswein2020}. Recently, ML techniques have been proposed to study the epidemic cluster in the susceptible-infectious-susceptible (SIS) compartmental model of epidemic spreading on networks \cite{Ni2019_2}. The proposed approach converts high dimensional network data into image-like structures and exploits CNNs to learn and precisely identify the outbreak threshold of epidemic dynamics. Similar techniques were used for the case of sparse time-series data of a handful of nodes produced by networks of coupled Kuramoto oscillators~\cite{Panday2021} to accurately classify underlying network structure. In~\cite{Ni2019} a deep learning framework is introduced, combining both unsupervised and supervised learning methods to predict phase transitions associated with spreading dynamics. This approach makes accurate estimates of the critical transition point in uniform random networks, as well as proposes hub$-$and$-$neighbors and max$-k-$core sampling to overcome predictive inaccuracies associated with networks that have heavy-tailed distributions of links. Indeed, the rich structural features of heterogeneous networks render the simultaneous prediction of the critical transition point and the clustering of dynamical phases by adopting unsupervised learning approaches like PCA, challenging. Indeed, in complex hierarchical networks, separating percolating and non-percolating regimes in dynamical processes remains unsolved. To uncover the precise role of network structure in the learning process, in this manuscript, we focus on bond-percolation and investigate the effect of topology on ML methods that seek to estimate the percolation clusters and to infer the critical bond occupation probability $\phi_c$. Our approach extends previously proposed macro-level sampling procedures by using onion decomposition (OD) ~\cite{Hebert-Dufresne2016} as a tool to determine the position of nodes in the core-periphery structure. This network statistic---a refined version of the $k-$core decomposition~\cite{Allard2019}---decomposes the network into hierarchically ordered layers and reveals much more structural information at meso and micro scales. We investigate the limiting cases of uniform-- and heavy-tailed--distribution and demonstrate significant differences between networks of opposite topologies, with the former having a homogeneous population of nodes across layers, while the latter containing dense layers interspersed by sparse regions. We use a hybrid unsupervised learning method, combining $t-$SNE and $k-$means clustering, and train it on subsets of nodes sampled from both the sparse and dense layers to distinguish dynamical states above and below $\phi_c$. We show that sampling from the dense layers with nodes containing similar dynamical information in the percolation process, provides significantly higher accuracy than compared to sampling from the sparse layers or sampling nodes randomly, independent of whether nodes lie in the core or the periphery. \par Having determined the optimal sampling strategy, we next use the confusion scheme to identify the critical occupation probability $\phi_c$, and once again demonstrate high accuracy as compared to the ground-truth estimates of the threshold values. Perhaps, most surprisingly, we show that optimal samples are not limited to the core of the underlying network, but there exists multiple subset of nodes in the entire range of layers in the onion spectrum. This finding bears particular significance for using such methods in empirical networks, the majority of which have heavy-tailed distributions of links, and whose measurements are noisy. Finally, we apply our formalism to two examples of real-world examples: We determine the exact critical integration time of the US air transportation network , as well as identify the epidemic cluster for COVID-19 in three major states in the US. We end with a discussion of the implications of our findings. \section{Percolation on different network topologies} \begin{figure}[t] \centering \includegraphics[width=1.\linewidth]{fig_1_v1.pdf}\\ \caption{{\bf Effect of topology on percolation dynamics} Onion decomposition of \textbf{(a)} a Square Lattice of size $N = 1024~(32\times32)$ and \textbf{(b)} a power-law network with $N=1000$ and $\gamma = 3.1$. Nodes are ordered from the inner- to the outer-most layers which are labeled in descending order. The onion spectrum is shown as inset, indicating that the square-lattice consists of a single shell, whereas the power-law network contains three distinct shells. Layers are populated uniformly in the square-lattice, and in a punctuated fashion in the power-law network. In \textbf{(c)} and \textbf{(d)}, the percolation process in the range $0 \leq \phi \leq 1$ for the square-lattice and power-law network. The critical bond-occupation probabilities $\phi_c^{SL} = 0.524$ and $\phi_c^{PL} = 0.248$ are marked as the red dashed line. Nodes part of the GCC are colored black, those outside are colored white. Nodes are ordered the same as in the upper-panel.} \label{fig:data_onion} \end{figure} Consider a network $G$ where $\mathcal{V}=\left\{v_{1}, \cdots, v_{N}\right\}$ is the node set that undergoes bond-percolation, and let time $t$ denote the dynamical state of a certain configuration of occupied bonds. The data $\textbf{X}$ generated during the process is contained in a $M \times N$ matrix, where $N$ is the number of nodes and $M$ is the total number of dynamical states at different values of the occupation probability $\phi$. The entries of $\textbf{X}$ are binary; \begin{equation} x_{(v, t)}=\left\{\begin{array}{ll} 1, & v \in GCC \\ 0, &v \notin GCC. \end{array}\right. \label{eq:input} \end{equation} Each value is characterized by the tuple $(v, t)$ and equals $1$ if $v$ is part of the giant connected component (GCC) of the network and $0$ if the node is disconnected from GCC at time $t$ where $1\leq t \leq M$. We pick two graphs at the opposite ends of the structural spectrum of networks: first, we construct a square lattice with open boundaries such that all nodes, except those at the periphery, have degree $k=4$, leading to a uniform, tightly-peaked degree distribution. On the other end of the spectrum, we consider a power-law network with degree distribution $p_k \sim k^{-\gamma}$ generated using the configuration model~\cite{molloy_critical_1995}. We choose an exponent $\gamma = 3.1$, such that both networks have finite second moments $\langle k^2 \rangle$ in their degree-distributions and exhibit phase transitions at non-zero probabilities $\phi_c = \left[\langle k^2 \rangle/\langle k \rangle -1\right]^{-1}$ in the thermodynamic limit~\cite{Newman_2001}. \par Next, we use the onion decomposition method to uncover the core-periphery structure of the two different types of networks. In addition to the \textit{coreness} metric produced by $k$-core decomposition that identifies nested maximal subnetworks with nodes having at least $k$ connections, the onion decomposition improves the \textit{coreness} information by assigning a layer to each node, to further indicate its position within the core and make its internal organization apparent~\cite{Hebert-Dufresne2016}. In Fig.~\ref{fig:data_onion}, panels $\textbf{a}$ and $\textbf{b}$ we show the onion spectra of the square lattice and the power-law network. Nodes are sorted with respect to their layer value in descending order, from the inner- to the outer-most layer. The square lattice has a uniform spectrum where nodes populate each layer equally in the network, however the power-law network shows a spectrum with sparse-filling in some of the inner and middle layers, punctuated by dense intermediate and peripheral layers. The fraction of nodes in each layer (shown as inset in both panels) indicates that the square-lattice contains all nodes in a single-shell, whereas the power-law network contains at least three distinct shells. The effect of this difference in structure is shown in panels {\bf c} and {\bf d}, where we show the evolution of the percolation process in the range $0 \leq \phi \leq 1$. The critical bond occupation probabilities $\phi_c^{SL}$ and $\phi_c^{PL}$, below which there is no GCC, are marked by the red horizontal dashed lines. The horizontal axis corresponds to the nodes sorted in the same order as in the upper panel. Nodes that are part of the GCC are colored black, whereas those outside the GCC are colored white. (Note that the few sets of nodes colored black below $\phi_c$ belong to the largest connected component (LCC) which is technically not the GCC.) \par The figure indicates that in the case of the square lattice, groups of nodes across layers show common dynamics for a wide-range of $\phi$. Nodes attach and detach from the GCC (as $\phi$ changes) in a similar fashion independent of what layer they belong to. In contrast, in the power-law network there is wide variation across layers; for a given value of $\phi$ large swathes of nodes in the inner- and outer-most layers are not part of the GCC. Further, whether a node is part of the GCC as $\phi$ is increased, varies from layer-to-layer. Finally, we note the presence of high-fidelity samples in the core-, intermediate- and peripheral-layers. For any classification algorithm, such class-imbalanced datasets pose a challenge as learning methods fail to capture the distributive characteristics of the data and produces unsatisfactory accuracies~\cite{HaiboHe2009}. The performance of such algorithms is poor on subsets with under and over-represented classes as it tends to partition phases into relatively uniform sizes. The pre-processing of the data using the onion decomposition method, instead allows for the identification of of node subsets with similar dynamical information in the percolation process. That is, layers where nodes disconnect from the GCC at comparable values of the control parameter, hence yielding a balanced training data in the subsequent learning phase. \section{Effect of sampling on clustering} \label{sec:clustering} Next, we focus on the classification scheme for clustering nodes as part of- or excluded from- the GCC. We construct a hybrid unsupervised learning model with $t-$SNE \cite{JMLR:v15:vandermaaten14a} a non-linear dimensionality reduction technique, and $k-$means clustering~\cite{kriegel_densitybased_2011} used for identifying pre-determined number of clusters from an unlabeled dataset. We add Gaussian noise, $\mathcal{N}(0,\,0.01)$, to the input data $\textbf{X}$ (Eqn.~\ref{eq:input}) to help spread the data points and sample subsets of nodes in bins of size $20$ (corresponding to $\approx 50$ samples), ranging from the innermost layer to the peripheral layer. We project the subset of 20 nodes into a two-dimensional plane with $t-$SNE, and then use $k-$means with $k = 2$ to assign labels as in Eq.~\eqref{eq:input}. To assess the performance of the algorithm we compare the labels assigned by the unsupervised learning method $\hat y$ to the ground-truth label $y$ and define the accuracy $\alpha_{\hat y, y}$ as \begin{equation} \alpha_{\hat y, y}=\frac{1}{n_{\text {samples }}} \sum_{i=1}^{n_{\text {samples }}} \delta_{\hat y, y}, \label{eq:accuracy} \end{equation} where the summand is the Kronecker delta-function. \par In Fig.~\ref{fig:unsup_lat} we plot the results of our analysis for the square-lattice. Panel \textbf{a} shows $\alpha_{\hat y, y}$ as a function of the sampled subset of nodes, ordered the same as in Fig.~\ref{fig:data_onion}. The horizontal black dashed line indicates the accuracy for random samples of 20 nodes ($\alpha_{\hat y, y} = 0.80$), and the gray dashed line represents the accuracy for a model-independent random guess of the state-labels ($\alpha_{\hat y, y} =0.5$). As the figure indicates, depending on the sampled layer, the accuracy fluctuates around the performance of the random sampling method, with some layers providing almost perfect accuracy, whereas others no better than a random guess of labels. The high-and low-accuracy samples are not limited to the core, but periodically found across all layers in the onion spectrum. Example outputs of the unsupervised learning scheme are shown in panel {\bf a} (inner-layer, $\alpha_{\hat y, y} =0.56$), {\bf b} (random sample, $\alpha_{\hat y, y} =0.80$) and {\bf c} (outer-layer, $\alpha_{\hat y, y} =0.99$). For the poor-accuracy inner-layer sample, the model is confused by the fact that nodes in the training-set exhibit different dynamical evolution in the percolation process. They connect to the GCC at different values of $\phi$, hence the unsupervised learning model cannot cluster the configurations into two separate clusters. Conversely, for the high-accuracy outer-layer sample, the subset of nodes belong to a high-fidelity layer in the onion spectrum, such that the majority of nodes in the set, connect to the GCC at similar values of $\phi$. Such layers, as indicated in Fig.~\ref{fig:data_onion}{\bf c} are distributed equally across the onion spectrum. Finally, the random sampling strategy provides reasonable accuracy, given the homogenous structure of the square lattice (all nodes in a single-shell), as random samples and tailored subsets have similar properties. \begin{figure}[t!] \centering \includegraphics[width=1.\linewidth]{fig_2_v1.pdf}\\ \caption{{\bf Effect of sampling on the unsupervised learning scheme for the square lattice.} \textbf {(d)} The accuracy of label prediction $\alpha_{\hat y, y}$ with $t-$SNE and $k-$ means clustering as a function of sampling layers, binned in sets of 20 nodes, and ordered the same as Fig.~\ref{fig:data_onion}. The accuracy for random samples of 20 nodes ($\alpha_{\hat y, y} = 0.8$) is shown as a black dashed line, and the grey dashed line corresponds to model-independent random guessing of state labels ($\alpha_{\hat y, y} = 0.5$). Examples of clustering \textbf {(a)} for low-accuracy samples from the inner-layer \textbf{(b)} random samples and \textbf{(c)} high-accuracy samples from the outer-layer. } \label{fig:unsup_lat} \end{figure} \begin{figure}[t!] \centering \includegraphics[width=1.\linewidth]{fig_3_v1.pdf}\\ \caption{{\bf Effect of sampling on the unsupervised learning scheme for the power-law network} \textbf {(d)} The accuracy of label prediction $\alpha_{\hat y, y}$ with $t-$SNE and $k-$ means clustering as a function of sampling layers, binned in sets of 20 nodes, and ordered the same as Fig.~\ref{fig:data_onion}. The accuracy for random samples of 20 nodes ($\alpha_{\hat y, y} = 0.64$) is shown as a black dashed line, and the grey dashed line corresponds to model-independent random guessing of state labels ($\alpha_{\hat y, y} = 0.5$). Examples of clustering \textbf {(a)} for low-accuracy samples from the inner-layer \textbf{(b)} random samples and \textbf{(c)} high-accuracy samples from the outer-layer. } \label{fig:unsup_sf} \end{figure} In Fig.~\ref{fig:unsup_sf} we plot the corresponding results for the power-law network indicating rather different behavior. As seen in panel {\bf b}, the random sampling strategy performs considerably poorer with $\alpha_{\hat y, y} = 0 .64$, only marginally better than randomly guessing labels. Furthermore, the peaks and troughs in the accuracy curve are much more irregular, as compared to the square-lattice, reflecting the richer structure of the power-law network. Wide ranges in the intermediate-layer provide poor accuracy (panel {\bf a}), and surprisingly, there exists a range in the outer-most layers that yields accuracy as high as 0.99 (panel {\bf d}). The results indicate the importance of adopting a considered sampling strategy for training-sets in power-law topologies, given that unlike in networks with uniform topologies, random sampling is sub-optimal. Indeed, very few real-world networks have uniform topologies, instead exhibiting heavy-tailed distributions, implying that for any realistic application, identifying high-quality samples \emph{a priori} is of paramount importance. Given issues of data sparsity, it is of note, that such samples exist in multiple layers of the power-law network, including the core-, intermediate- and peripheral layers. \par \begin{figure*}[t] \centering \includegraphics[width=1.\linewidth]{fig_4_v1.pdf}\\ \caption{{\bf Identification of $\phi_c$ as a function of network topology:} \textbf{a} Square lattice and \textbf{b} power-law network with random samples of 20 nodes (brown curve) and a high-accuracy sample from the peripheral layers identified using the unsupervised learning method (black curve). The vertical dashed line represents the critical bond occupation probabilities in each network, $\phi_c^{SL} = 0.524$ and $\phi_c^{PL} = 0.248$. The random sample in the square lattice has a clear \textbf{W} shape, but the middle peak is noisy and is flat around $\phi_c^{SL}$. For the power-law network the random sampling strategy fails to provide any information on the transition probability. In both cases, the sampling-guided strategy yields high accuracy on $\phi_c^{SL,PL}$, with the middle peaks in the black curves occurring at 0.520 and 0.240.} \label{confusion_sf_lat} \end{figure*} \section{Identifying Critical Transition Points} The procedure described thus far, while effective in identifying configurations below and above the percolation phase, in itself, cannot identify the critical bond occupation probability $\phi_c$. To do so, we make use of the confusion scheme, first introduced to study phase transitions in Kitaev chains, the classical Ising model and in disordered quantum spin chains~\cite{VanNieuwenburg2017}. Recently it has been extended to uncover the critical transition probability in dynamical phase transitions in complex networks~\cite{Ni2019}. Next, we show that our sampling-guided strategy adopted to the confusion scheme is quite effective in terms of identifying the value of $\phi_c$. The method does not take as input labels of the dynamical states, instead a synthetic label space $\textbf{y}$ is associated with an input matrix $\textbf{I}$, with entires 0 and 1, corresponding to the before and after states in the percolation process. At $\phi = 1$ the label vector $\textbf{y} = \textbf{0}$ i.e. all configurations are in the before state, and for $\phi = 0$, the vector $\textbf{y} = \textbf{1}$, each snapshot is labeled as after state. The boundary between 0 and 1 (corresponding to the critical threshold) in this artificial label-set is varied in the entire range of the control parameter $\phi \in [0,1]$ with increments of $\Delta = 0.005$ (yielding $200$ steps in total) and associated with a optimal subsample $\textbf{I} \subset \textbf{X}$ selected using the method described in Sec.~\ref{sec:clustering}. For both the square-lattice and the power-law network we select samples from the periphery that yield high accuracy. A feed-forward neural network (FFNN) is trained with this data consisting of pairs $\{\textbf{I} : \textbf{y} \}$ in the form of supervised learning problem using the PyTorch library~\cite{NEURIPS2019_9015}. The input layer contains neurons at the same number of the chosen subsample size, followed by a hidden layer of 128 neurons. Both layers have rectified linear unit (ReLu) as activation functions. The output layer contains a single neuron with sigmoid activation function, that predicts the probability of a configuration belonging to one of the states. A binary cross-entropy loss-function is minimized in training, which is well suited for binary classification problems. For stochastic optimization we us the Adam method \cite{Kingma2015} with learning rate $10^{-3}$. To prevent over-fitting we use Dropout regularization with probability $10^{-1}$. In each step, the dataset is split into a training set that is fed into the FFNN and prediction accuracy is evaluated on the test set. Highest accuracies are achieved at endpoints of the threshold range due to the constant nature of the label space. As one spans the range between $[0,1]$, initially lower accuracy values are observed as some configurations are associated with incorrect labels. At the transition probability, the artificial label space matches the ground truth, leading to a high classification accuracy. In this process, the accuracy curve follows a \textbf{W}-shape as a function of $\phi$, where the middle peak corresponds to the estimated transition probability~\cite{Ni2019} . \par In Fig.~\ref{confusion_sf_lat}, we show the output of the confusion scheme on the square lattice \textbf{(a)} and the power-law network \textbf{(b)}. In both panels, the brown curve corresponds to a random sample of 20 nodes and the black curve to the high-accuracy subset from the peripheral layers, identified using the unsupervised learning method. The vertical dashed lines mark the value for the ground-truth value of $\phi_c$ in each network. The random sampling strategy in the square lattice is reasonably effective, generating a ${\bf W}$-shape, although the peak near $\phi_c$ is not well-defined. In the power-law network the random sampling accuracy curve is noisy and flat yielding little-to-no information on the transition probabilities. However, in both cases the black curve yields a clear ${\bf W}$-shape and the middle-peaks line up well with the ground-truth values of $\phi_c$. Thus unlike existing methods, the sampling-guided scheme outlined here simultaneously identifies nodes in the GCC as well as provides accurate estimates for the bond-occupation probability. \section{Transitions in time-varying real-world networks} \begin{figure}[t] \centering \includegraphics[width=1.\linewidth]{fig_5.pdf}\\ \caption{{ \bf Predicting integration time of the Unites States air-transportation network.} Clustering of pre- and post-transition states in the temporal integration process from a sample taken from the inner-layer (Sample 1) \textbf{a} and one from the peripheral layer (Sample 2) \textbf{b}. In both cases the accuracy $\alpha_{\hat y, y} = 0.99$. In \textbf{c}, the output of the confusion scheme in predicting the critical integration time ($T_c = 91$ mins, marked as vertical dashed line) at which a connected cluster of airports linked by flights is formed. Training the network on Sample 1 yields a peak of the \textbf{W}-shaped curve (black-circles) at $T = 93$ mins and with Sample 2 (red squares), at $T = 94$ mins. Training on a random sample (green triangles) yields a noisy curve, and an accurate identification of $T_c$ is not possible. (Behavior of all three curves near $T_c$ shown as zoomed inset.)} \label{air_res} \end{figure} Next, we validate our methodology in two real-world examples. The availability of large time-resolved datasets enables for the representation of a wide range of dynamical phenomena in the form of time-varying networks. Such processes often exhibit phase transitions, and thus can be analyzed via percolation in static networks. Some applications include wireless communication networks with unreliable links \cite{Karschau2018}, spreading of infectious diseases in modular time varying networks \cite{Nadini2018} or percolation in ground-transportation networks to identify critical bottleneck roads in local flows \cite{Li2015, Kirkley_2018}. Recently, the integration process of air traffic into a temporally connected network was modeled as as a time-varying percolation process~\cite{LIU2020_1}. The critical integration time $T_c$, at which the network forms a temporal spanning cluster, is proposed as a measure of global reliability of air-traffic. \par We test our scheme on the air-transportation network, to identify both $T_c$ as well as label nodes that belong to the time-varying GCC. We construct the temporal air-transportation network \cite{air-data} starting from $t_0 = 7:30 AM$ on September 5, 2019 and spanning a 18-hour period until the integration process is completed. The resulting network consists of 288 airports as nodes and 1903 edges, where a link corresponds to at least one flight between two airports. We generate states with a time window of $ \left[t_{0}, t_{0}+T\right]$ where $T$ is incremented in intervals of $1$-minute generating $\sim$1100 instances as the training and test set. \par The task of the unsupervised learning method is to discriminate between states before and after the integration process. Unlike in the synthetic networks studied thus far, the transition happens at an early stage ($T_c = 91$ mins), and therefore the dataset is unbalanced. After running the onion-decomposition scheme to identify the layers, we pick two samples with 10 airports: Sample 1 from the core of the air transportation network \emph{(Atlanta, Austin, Nashville, Boston, Charlotte, Denver, Detroit, Fort Lauderdale-Hollywood, Las Vegas, Los Angeles, Chicago O'Hare)} and Sample 2 from the periphery \emph{(Norfolk, Worcester, Southwest Oregon, Barkley, Palm Beach, Hilton Head, Punta Gorda, Pitt-Greenville, Newport News/Williamsburg, Ithaca Tompkins)}. We then use the $t-$SNE method to cluster the states. The results are shown in Fig.~\ref{air_res} panels \textbf{a} and \textbf{b}, indicating that the method performs well; the labels are assigned by $k-$means with an accuracy of $\alpha_{\hat y,y} = 0.99$ in both samples of nodes. We then use these two samples as a training set on the confusion scheme, and plot the resulting accuracy curve as a function of the time $t$ in Fig.~\ref{air_res}\textbf{c}. The curve corresponding to the core-sample is shown as black circles, while the that for the peripheral sample is shown as red-squares. As a reference we show the case for a random sample of 10 airports \emph{(Reno-Tahoe, Albany, Rapid City Regional, Hector, Miami, Waterloo, Kansas City, Corpus Christi, Columbia Metropolitan, Baltimore/Washington)} as green triangles, whereas $T_c$ is shown as the vertical dashed line. For both samples, the accuracy curve $\alpha_{\hat y, y}$ shows a clear ${\bf W}$-shape with peaks at $T= 93$ mins and $T= 94$ mins. The random sample yields a noisy curve with no clear peak (behavior near peak for all three curves shown as inset). The results illustrate the versatility of the sampling-scheme with near-perfect identification of airports in the temporally connected cluster and the ability to identify the critical integration time to within $3-4\%$, and the flexibility in sampling from the core or the periphery of the network. \begin{figure}[t] \centering \includegraphics[width=1.\linewidth]{fig_6_v1.pdf}\\ \caption{{\bf Emergence of the epidemic cluster of Covid-19 in 3 major US states.} The network corresponds to population flows between locations in-state at the resolution of counties. Nodes are labeled as infected if the number of cases per-capita exceeds $10^{-4}$. Panel \textbf{a} indicates that a epidemic cluster emerges around day 60 in all three states. The top three rows show the output of the clustering method that splits counties into those belonging to the epidemic cluster and those outside. Training occurs from day 0 in cumulative intervals of 20. The identification of counties belonging to the epidemic cluster becomes increasingly accurate past the phase-transition and peaks around day 80 as seen in panel \textbf{b}.} \label{covid_fig} \end{figure} \par Next, we consider a different dynamical process of particular relevance; the spread of COVID-19 in the United States~\cite{aguilar2020impact}. We investigate the possibility of employing our clustering method to use as a diagnostic tool that signals at a relatively early stage, whether an epidemic outbreak is about to occur based on real-time data. We pick three major states; Texas, Georgia and New York with 3.0 , 1.1 and 1.9 ($\times 10^7$) inhabitants respectively. We consider a spatial resolution at the level of counties leading to 254 nodes for Texas, 159 for Georgia and 62 for New York. We construct mobility networks from the United States census bureau's LODES \cite{mobility-data} commuting data, where the edges represent population-flows between counties corresponding to 20262 (Texas), 11042 (Georgia) and 1883 (New York) undirected links. We then follow the temporal evolution of the number of detected cases in each county from January \nth{21} to May \nth{18} 2020 \cite{covid-data}. Counties are labeled ``infected" when the number of cases per-capita is above a threshold of $10^{-4}$. In Fig.~\ref{covid_fig}\textbf{a}, we plot the empirical temporal evolution of the number of infected counties finding an emergence of an epidemic cluster around day 60 for all three states. In the top-row of Fig.~\ref{covid_fig}, we train our unsupervised learning model with samples of size 10 selected from the high-fidelity layers of of the mobility networks in cumulative intervals of 20 days starting from day 0. In Fig.~\ref{covid_fig}{\bf b} we plot the accompanying accuracy curve $\alpha_{\hat y, y}$ in function of time. Before day 60, there is no epidemic cluster, and therefor $\alpha_{\hat y, y} = 0.5$ equivalent to model-independent simple guessing of labels. After day 60, however, once an epidemic cluster emerges, the model is able to reliably split counties into infected and disease-free clusters and make more accurate predictions. The increase in the accuracy curve tracks the increase in the epidemic cluster and reaches perfect accuracy at around day 80. We note that from a point of real-time forecasting the model reaches accuracies of $\approx 70\%$ when the size of the epidemic cluster is $\approx 0.4$. \section{Discussion} Taken together, our work sheds light on the role of the micro- and mesoscopic structure of networks in machine learning the phases in bond percolation. Our sampling guided approach reveals the importance of choosing particular subset of nodes from layers of the onion spectrum of the network that enables unsupervised learning methods to distinguish between percolating and non-percolating states. Labels assigned by $k-$means matches the ground truth labels with near-perfect accuracy. We show that this is facilitated by sampling nodes chosen from both core and peripheral layers, identified using onion decomposition, that identifies subsets of nodes in a spectrum of layers, that follow similar paths in the percolation process, i.e. they detach and attach to the percolating cluster at comparable values of $\phi$. The sampling-guided strategy carries over to other learning tasks, such as identifying the critical occupation probability $\phi_c$ using the confusion scheme. This gain in performance is particularly pronounced for networks with heavy-tailed degree distributions, where the method significantly outperforms random sampling. Indeed, to the best of our knowledge, the framework presented here is the first to simultaneously enable the clustering of nodes into different dynamical states, as well as identify $\phi_c$ in networks with heterogenous topologies. This bears significance, given that many empirical networks exhibit right-skewed distributions of links. \par To validate our results, we demonstrate two possible applications of our findings on real-world time-varying networks that exhibit a percolation transition; the exact integration time of the US domestic air transportation network, as well as the emergence of the COVID-19 epidemic cluster in three large US states. In both cases the framework yields excellent performance. The application to pandemic settings is of particular interest, as a possible diagnostic tool to assess the current state of disease-spread with real-time data. The ability to accurately classify (with reasonable accuracy) regions into infected and disease-free states (close to when the epidemic cluster first emerges) could prove useful in terms of mitigation strategies. Indeed, techniques have been proposed to study immunization strategies in networks where only a small subset of nodes are observed at a time, to slow-down epidemic spread~\cite{Shang2021_1,Rosenblatt2020}. Given the limited knowledge of network structure, immunizing a small sample of nodes provides significant improvement in the global level immunization of the network \cite{Liu2020}. Similar considerations apply in the diffusion of rumors or ``fake news" in social media and online platforms~\cite{Lazer_2018}. The approach proposed here, can in principle be easily extended such types of dynamical processes on networks. \bibliographystyle{naturemag}
\section{Analysis of the DAM Gate Function Dynamics During Training} In this section, we theoretically analyze the dynamics of the DAM mask $\bm{g_i}$ at the $i$-th layer as the training process unfolds. This can be characterized by the movement of the gate function (or gate) during the training process, which is solely dominated by changes in the learnable offset parameter $\beta_i$. \subsection{Gradients of DAM Learning Objective w.r.t. $\beta_i$} Building on the notations introduced in Section 3 of the main paper, let us denote the mask value $g_{ij}$ at the $j$-th neuron at $i$-th layer as a function of $\beta_i$, i.e., $\xi_j: \beta_i \to g_{ij}$, where \begin{align} g_{ij} = \xi_j(\beta_i) & = \max\left[\tanh\left(\alpha_i \left(kj/n_i + \beta_i\right)\right),0\right] \label{eq:xi} \end{align} Let $f$ denote the continuous function expressed by our neural network with learnable parameters $\Theta$. The loss function for training the neural network for the target task can then be denoted as $L = {\mathcal{L}(f(x, \Theta, \beta_i))} $ (e.g., cross-entropy loss for supervised structured pruning problems and reconstruction error for representation learning problems), where $x$ denotes the input features to the neural network. Using gradient descent methods with a learning rate of $\eta$, the expected update formula of $\beta_i$ in DAM is given by: \begin{align} \Delta \beta_i & = - \eta \, \mathbb{E}_{x \sim \mathcal{D}_{tr} } \left[ \nabla_{\beta_i} {\mathcal{L}(f(x, \Theta, \beta_i))} + \lambda \nabla_{\beta_i} {\beta_i/({l-1})} \right]\\ & = - \eta \, \mathbb{E}_{x \sim \mathcal{D}_{tr} } \left[ \nabla_{\beta_i} {\mathcal{L}(f(x, \Theta, \beta_i))} \right] - \eta \lambda/({l-1}) \label{eq:delta_beta} \end{align} Let $\bm{h_i}$ be the layer output before applying the DAM mask, and the masked output be represented as $\bm{o_i} = \bm{h_i} \circ \bm{g_i}$ after applying the gate. The gradient of the loss w.r.t. $\beta_i$ can be obtained by applying the chain rule of differentiation as follows: \begin{align} \nabla_{\beta_i} {\mathcal{L}(f(x, \Theta, \beta_i))} = \frac{\partial {\mathcal{L}(f(x, \Theta, \beta_i))}}{\partial \bm{o_i}} \frac{\partial \bm{o_i}}{\partial \bm{g_i}} \frac{\partial \bm{g_i}}{\partial \beta_i} = \sum_{j=1}^{n_i} \frac{\partial {\mathcal{L}(f(x, \Theta, \beta_i))}}{\partial {o_{ij}}} \frac{\partial {o_{ij}}}{\partial {g_{ij}}} \frac{\partial {g_{ij}}}{\partial \beta_i} \label{eq:chain_rule} \end{align} Let us analyze this gradient by observing the last term of this equation, $\partial {g_{ij}} / \partial \beta_i$. For the $j$-th neuron, $\partial g_{ij} /\partial \beta_i = 0$ if and only if $\partial \xi_j(\beta_i) /\partial \beta_i = 0$. Since $tanh(z)$ has non-zero gradients for $z > 0$, the gradient of $\xi_j(\beta_i)$ is 0 only when $kj/n_i + \beta_i \leq 0$, i.e., the mask value of the neuron is 0 (or in other words, it is \textit{deactivated} or dead). Let us denote the set of all neuron indices with non-zero mask values (also referred to as \textit{active} neurons) as $\mathcal{J}$. Equation \ref{eq:chain_rule} can then be simplified as: \begin{align} \nabla_{\beta_i} {\mathcal{L}(f(x, \Theta,\beta_i))} & = \alpha_i \sum_{j \in \mathcal{J}} \underbrace{\frac{\partial {\mathcal{L}(f(x, \Theta, \beta_i))}}{\partial o_{ij}} h_{ij} \left( 1 - g_{ij}^2 \right)}_{q_{ij}}, \label{eq:derivative_beta_obj} \\ & = \alpha_i \sum_{j \in \mathcal{J}} {q_{ij}}, \label{eq:derivative_beta_obj_simplified} \end{align} where $q_{ij}$ represents the contribution of the $j$-th neuron to the gradient of the loss term with respect to $beta_i$. We can make the following two observations: (i) only those neurons that are active (i.e., have non-zero mask values) have a contribution towards updating $\beta_i$ and moving the gate function. (ii) If the mask value of a neuron is 1 (i.e., $g_{ij} = 1$), then their contribution to the gradient of the loss w.r.t. $\beta_i$ is again 0. It shows that the neurons that play an important role in the dynamics of the gates are the ones with non-zero activation $h_{ij}$ and mask values that have not saturated to 1 (i.e., $g_{ij} < 1$). We name these neurons as \textit{support} neurons and their position in the ordering of neurons as the \textit{transitioning zone} of the gate function. Similarly, neurons with zero mask values are termed as \textit{deactivated} neurons and the neurons with mask values close to 1 as \textit{privileged} neurons (since they are never turned off). \subsection{Equilibrium of DAM Gate Function upon Convergence} We next study the properties of the equilibrium solution of $\beta_i$ that we arrive upon convergence of the DAM training process. Suppose that we have converged to $\beta_i^*$ for the offset parameter for the $i$-th layer. This would mean that the gradient of the DAM learning objective w.r.t. $\beta_i^*$ would be equal to 0 as follows: \begin{align} \nabla_{\beta_i^*} {\mathcal{L}(f(x, \Theta, \beta_i^*))} + \lambda/(l-1) = 0 \end{align} Substituting the value of $\nabla_{\beta_i} {\mathcal{L}(f(x, \Theta, \beta_i))}$ from Equation (\ref{eq:derivative_beta_obj_simplified}) and rearranging terms, we get \begin{align} \sum_{j \in \mathcal{J}} q_{ij} = - \lambda / (\alpha_i(l-1)). \label{eq:equilibrium} \end{align} Since $\lambda, \alpha_i > 0$, the equilibrium exists only when the sum of $q_{ij}$ is negative. This happens when decreasing the masked outputs $o_{ij}$ of the support neurons in the transitioning zone leads to an increase in the loss function, signifying that any further pruning can lead to loss of accuracy. In other words, the training dynamics of the gate function stops when the features learned at the support neurons are useful enough that their pruning is detrimental to the generalization performance of the network. \subsection{Additional Remarks on the Effects of $\alpha_i$ and $\lambda$ On DAM Convergence} Equation \ref{eq:equilibrium} also implies that a large value of $\alpha_i$ or a low value of $\lambda$ may make the equilibrium easy to reach, thus leading to \textit{premature convergence} to a pruned network that has not been fully trained to capture refined features at its support neurons. This is supported by our empirical observations that large values of $\alpha_i$ tends to prevent DAM layers to reach higher sparsity. We thus set $\alpha_i = 1$ in all our experiments. On the other hand, the choice of $\lambda$ also plays a big role as we observed in our experiments (e.g., as is shown in Section C via hyperparameter sensitivity analysis). Further note that the masking dynamics of DAM involve a smooth transition from an unpruned network to a pruned network where at every training epoch, some of the neurons (or channels) gradually die out while the rest remain unaffected. The neurons at the edge of being dropped out are gradually assigned low gate values such that the other neurons can slowly re-adapt themselves to pick up or recover the features that are being dropped out. However, steep gate function choices (that have narrow transitioning zones) may cause this transition to be too fast such that the network suffers a drop in accuracy as neurons on the edge are dropped while the other neurons do not have sufficient time to recover the dropped features. In our formulation, choosing a very large value of $\alpha_i$ can make the gate function too steep for effective pruning (we thus choose $\alpha_i = 1$). For other alternate choices of gate function, $\xi_j(\beta_i)$, than what we used in our current implementation, similar considerations need to be observed to avoid the gate function from becoming too steep. \subsection{Alternative Choices of Gate Function} In our experiments, we also tried using the sigmoid as the gate function in DAM. We found that sigmoid cannot be used as a valid choice for the gate function as it does not have the ``hard-thresholding'' property, i.e., the gate function value of sigmoid does not remain exactly 0 before a certain threshold value of input is reached. This property is important to enforce strict $L_0$ sparsity, otherwise the neurons would still remain active with small non-zero gate values across a large range of inputs. In general, there are three properties that we desire in an ideal gate function: (a) it should be exactly 0 before reaching a certain threshold value of input, (b) it should be monotonically increasing, and (c) it should have a parameter to control the steepness of the gate function. While we found ReLU-tanh to exhibit stable training dynamics across different datasets in our experiments, other choices of gate functions can also be explored (e.g., hard-sigmoid). \section{Theoretical Results And Technical Proofs For Section 4} We empirically observed in Section 4 of the main paper that for the linear dimensionality reduction case, we always converged to the same solution for a constant setting of hyper-parameters regardless of the random initialization of the neural network. To theoretically understand if DAM is capable of converging to the optimal solution (where the pruned bottleneck dimension is exactly same as the rank of the input data matrix), we provide further theoretical analysis for the ability of DAM to perform linear dimensionality reduction (DR) in the following. \textbf{Problem Statment}: Let $G = \textup{diag}(\bm{g})$, where $\bm{g} \in \mathbb{R}^n$ is the vector of mask values at the bottleneck layer given by \begin{equation} \bm{g} = \max\left[ \tanh(\bm{\mu} + \beta \bm{1}), 0 \right] \end{equation} and the $j$-th element in $\bm{\mu}$ is given by $\mu_j = kj/n$, while $\beta \in \mathbb{R}$ is a scalar learnable parameter. Let the real matrices $A_1, A_2$ define two linear transformations $A_1: \mathbb{R}^n \longrightarrow \mathbb{R}^d$ and $A_2: \mathbb{R}^d \longrightarrow \mathbb{R}^n$. Let us consider a bounded input data matrix, $X \in \mathbb{R}^{d \times N}$, that is rank-deficient (with rank $m$), where $N$ is the number of data samples and $d$ is the number of features, $N \gg d > m$. Then, the input $X$ and its reconstruction $\hat{X}$ are related by the following equation: \begin{equation} \hat{X} = A_1 G A_2 X. \label{eq:linear_dam} \end{equation} Let $\Theta = \{A_1, A_2, \beta\}$ be the set of learnable parameters. For a given $X$, let us define the multi-objective minimization problem as \begin{align} \min_{\Theta}\left( \norm{\hat{X} - X}_F^2 , \beta \right), \label{eq:linear_dam_objective} \end{align} where $\norm{.}_F^2$ denotes the Frobenius norm of a matrix. We are interested in reaching a Pareto optimal solution with a predefined trade-off hyper-parameter between the two objectives using the gradient descent algorithm. \textbf{Optimization Scheme}: Let $L = \norm{\hat{X} - X}_F^2 + \lambda \beta$ and initial values for the learnable parameters be $A_1^{(0)}, A_2^{(0)}, \beta^{(0)}$, where $\lambda > 0$ is the trade-off hyper-parameter. Using gradient descent (GD), for every parameter $\theta \in \Theta$, the updating rule for the $t$-th iteration can be written as \begin{align} \theta^{(t+1)} = \theta^{(t)} - \eta(\grad_{\theta} L)^{(t)} \label{algo: gd_linear} \end{align} where $\eta \in \mathbb{R}^+$ is the step size. We assume that we allow the network to perform sufficient number of iterations of gradient updates before it reaches convergence. \begin{theorem} (Existence of Optimal Solution) Assuming all the $m$ singular values of $X$ are non-trivial (i.e., they are all greater than some positive value $\epsilon$), there exists $\lambda > 0$ such that at the minima solution of $\mathcal{L}$, $\hat{X} = X$ and the number of non-zero entries of $\bm{g}$ equals $m$. \label{thm: accuracy} \end{theorem} \textit{Proof:}\ \ Let $\Tilde{A_2} = G A_2$. Then, we can rewrite $\hat{X}$ as a function of $\Tilde{A_2}$ as follows \begin{equation} \hat{X} = A_1 \Tilde{A_2} X. \end{equation} Using this value of $\hat{X}$ as a function of $\Tilde{A_2}$, we can decouple the combined learning objective into the following two optimization problems: \begin{align} \left( \min_{\{ A_1, \Tilde{A_2} \}}\norm{A_1 \Tilde{A_2} X - X}^2_F, ~~ \min_{\beta} {\lambda \beta}\right), \label{eq:reparam_objective} \end{align} where the first term only depends on the variables $A_1, \Tilde{A_2}$, while the second term only depends on $\beta$. Optimizing the second term is trivial since it is a linear function of $\beta$. On the other hand, the first term has its minimum value at \begin{align} A_1 \Tilde{A_2} X &= X \notag \\ A_1 &= \Tilde{A_2}^+ \label{eq:optimal_A} \end{align} where $\Tilde{A_2}^+$ is the \textit{Moorse-Penrose Inverse} of $\Tilde{A_2}$. Moreover, whenever $A_1 = \Tilde{A_2}^+$, the following relationship would also hold \begin{equation} \rank(\Tilde{A_2}) \geq \rank(A_1 \Tilde{A_2} X) = \rank(X) = m. \end{equation} and $\rank(\Tilde{A_2}) = \rank(G A_2) \leq \rank(G)$. Thus, $\rank(G) \geq m$. Assuming the diagonal matrix $G$ has $m'$ nonzero entries, then $m' = \rank(G) \geq m$. This means that the lowest value that $m'$ can take is $m$, and we want to study if there exists some setting of $A_1, \Tilde{A_2}$, and $\beta$ that leads to $m' = m$. We specifically explore the setting where the rank of $G$ (the number of non-zero values of $\bm{g}$) is equal to $m$. Note that in our DAM formulation, the number of non-zero entries of the mask vector $\bm{g}$ is directly related to $\beta$ as follows (see Section 3 of main paper for more details): \begin{equation} m' = \norm{G}_0 = \ceil{n(1 + \beta /k)} = m, \end{equation} \begin{figure}[t] \centering \includegraphics[width=0.35\textwidth]{figures/supplementary/thm1.pdf} \caption{Schematic plot showing variations in the learning objective value $L$ as a function of $\beta$ near the minima of $L$ (shown as red $\beta^*$).} \label{fig:thm1} \end{figure} which means that if we remove the ceiling operator, the following inequality holds: \begin{align} m &\geq n(1 + \beta /k)> m - 1\\ k \left( \frac{m}{n} - 1 \right) &\geq \beta > k \left( \frac{m - 1}{n} - 1 \right) \end{align} As illustrated in Figure 1, we seek to show that a critical point of $L$ in terms of $\beta$ exists such that $m'= m$. Let $\beta_A = k \left( \frac{m - 1}{n} - 1 \right), \beta_B = k \left( \frac{m}{n} - 1 \right)$ and denote their corresponding values of $L$ as $L_A$ and $L_B$ respectively. As we showed in previous discussions, with $m' \geq m$, as long as $A_1 = \Tilde{A_2}^+$, then the first term of $L$ is 0. Thus, there exists a $\beta' < \beta_B$ such that $m' = m$ ($\beta' > \beta_A$), and its corresponding value of $L$ is smaller than $L_B$ (because of a smaller second term). On the other hand, we want to discuss whether the optimization over Eq. (\ref{eq:reparam_objective}) will lead to a smaller $\beta$ such that $G$ has more nonzero entries (consequently making the second term of Eq. (\ref{eq:reparam_objective}) smaller). In particular, when $m' < m$, then \begin{equation} \rank(\hat{X}) = \rank(A_1\Tilde{A_2}X) \leq \rank(\Tilde{A_2}) \leq \rank(G) \leq m' < m. \end{equation} Since $X$ has no trivial singular values, when $\rank(\hat{X}) < m$, then $\norm{\hat{X} - X}_F^2$ would also take non-trivial values, i.e., $\norm{\hat{X} - X}_F^2 > c\epsilon$, where $c$ is some positive constant. Thus, assuming $\lambda$ is reasonably small, there exists a $\beta' > \beta_A$ such that $m' = m$ ($\beta' \leq \beta_B$), and its corresponding value of $L$ is smaller than $\beta_B$'s corresponding value of $L_A$ (because of a smaller first term). Thus, there exists a critical point of $L$ (denoted as $\beta^*$) between $\beta_A$ and $\beta_B$, which is the minima of $L$. For $\beta^*$, we have $m' = m$. Therefore we have proven the existence of an optimal solution of DAM. In summary, the optimal set is \begin{align} \begin{split} \Theta^* = \bigg \{A_1, A_2, \beta | &\forall A_1 \in \mathbb{R}^{d \times n}, \forall A_2 \in \mathbb{R}^{n \times d}, \forall \beta \in \mathbb{R}, \textup{s.t.}\\ &A_1 = (G A_2)^+ ,k \left( \frac{m}{n} - 1 \right) \geq \beta > k \left( \frac{m - 1}{n} - 1 \right) \Bigg\} \end{split} \end{align} \begin{figure}[ht] \begin{subfigure}{0.9\textwidth} \centering \includegraphics[width=\linewidth]{figures/dimReduction/linear_btl_dim.pdf} \caption{Bottleneck Dimension.} \label{fig:btl-lin} \end{subfigure} \begin{subfigure}{0.9\textwidth} \centering \includegraphics[width=\linewidth]{figures/dimReduction/linear_rec_loss.pdf} \caption{Reconstruction Loss.} \label{fig:rec-lin} \end{subfigure} \caption{ Hyper-parameter sensitivity of DAM for dimensionality reduction (Section 4, Linear). } \label{fig:sensitivity-linear} \end{figure} \begin{figure}[ht] \begin{subfigure}{0.9\textwidth} \centering \includegraphics[width=\linewidth]{figures/dimReduction/quad_btl_dim.pdf} \caption{Bottleneck Dimension.} \label{fig:btl-quad} \end{subfigure} \begin{subfigure}{0.9\textwidth} \centering \includegraphics[width=\linewidth]{figures/dimReduction/quad_rec_loss.pdf} \caption{Reconstruction Loss.} \label{fig:rec-quad} \end{subfigure} \caption{ Hyper-parameter sensitivity of DAM for dimensionality reduction (Section 4, Polynomial). } \label{fig:sensitivity-quad} \end{figure} \begin{figure}[ht] \begin{subfigure}{0.9\textwidth} \centering \includegraphics[width=\linewidth]{figures/dimReduction/nonlinear_btl_dim.pdf} \caption{Bottleneck Dimension.} \label{fig:btl-nn} \end{subfigure} \begin{subfigure}{0.9\textwidth} \centering \includegraphics[width=\linewidth]{figures/dimReduction/nonlinear_rec_loss.pdf} \caption{Reconstruction Loss.} \label{fig:rec-nn} \end{subfigure} \caption{ Hyper-parameter sensitivity of DAM for dimensionality reduction (Section 4, Neural Network). } \label{fig:sensitivity-nn} \end{figure} \section{Hyperparameter Sensitivity} We have demonstrated that DAM performs very well in the representation learning experiments for dimensionality reduction. Here, we study how stable DAM is with respect to variations in hyperparameter settings. We specifically examine three hyperparameters: learning rate, trade-off parameter, $\lambda$, and the initial value of $\beta$, $\beta_0$. The results of this experiemnt are shown in the form of heatmaps of bottleneck dimension and reconstruction loss upon convergence in Figures \ref{fig:sensitivity-linear}, \ref{fig:sensitivity-quad} and \ref{fig:sensitivity-nn}. We can observe that as we vary the learning rate from 0.0001 to 0.1 (which represents a range covering three orders of magnitude), the results for all three cases show variations, where the best results are obtained in the medium range of values (from 0.001 to 0.01), which are common choices of learning rates used in conventional deep learning frameworks. This variation of our results with learning rate is common to any other algorithm based on gradient descent methods. However, for a fixed learning rate, we can see that the results of DAM are quite stable to the choice of $\lambda$ and $\beta_0$. For example, we can see that the results of DAM are consistent across different choices of cold-start ($\beta^{(0)}$) for all choices of learning rates in the three cases. The sensitivity in terms of $\lambda$ is also low but increases as the feature correlations gets more and more complicated, i.e., as we transition from linear to quadratic to neural network cases. In fact, we observe that small $\lambda$ values result in slower or premature convergence, while too large $\lambda$ can break the model by pruning out all of the parameters. In summary, we can say that by using common choices of learning rate (e.g., 0.01 or 0.001), DAM is able to produce consistent results with reasonable choice of $\lambda$ (e.g., $\lambda = 0.01$). \section{Experimental Setups} \subsection{Representation Learning (Section 4)} \textbf{Datasets:} For dimensionality reduction experiments, we created three synthetic datasets for each of the mapping functions. To generate each dataset, we used two matrices, one as as an encoder and another one as a decoder. For the linear case, the the two matrices were initialized with values sampled from a normal distribution. For the quadratic case, we used a three-layer MLP as the encoder and one QRes layer \cite{jie2021qres} as the decoder for the quadratic mapping function. For the neural network case, we used a three-layer MLP as the encoder and two-layer MLP as the decoder. We varied the underlying factor ($r$) from 5 to 20 to generate these datasets. For the recommendation system experiments, we used three benchmark datasets Flixter \cite{jamali2010matrix}, Douban \cite{ma2011recommender}, and Yahoo-Music \cite{dror2012yahoo}. For graph representation learning, we used three popular citation networks: Cora, CiteSeer, and PubMed \cite{yang2016revisiting}. We further used the MNIST \cite{lecun1998mnist} dataset to compare between DAM and $L_{1}$-norm based auto-encoders. \begin{table}[t] \begin{center} \caption{Experiment Setups And Implementation Details For Representation Learning (Section 4).} \begin{small} \vspace{2ex} \begin{tabular}{lllllcc} \thickhline Source & Dataset & Model & Learning Rate & Epochs & $\lambda$ & Cold-Start\\ \hline Fig. 3a & Synthetic & Linear & 0.01, \:$L_2$ = $10^{-6}$ & 2,000 & 0.01 & $\beta^{(0)} = 1$, 0 epochs \\ Fig. 3b & Synthetic & Quadratic & 0.01, \:$L_2$ = $10^{-6}$ & 5,000 & 0.01 & $\beta^{(0)} = 5$, 0 epochs \\ Fig. 3c & Synthetic & NN & 0.001, $L_2$ = $0$ & 10,000 & 0.1 & $\beta^{(0)} = 1$, 0 epochs \\ \hline Tab. 2 & Flixter & IGMC & 0.001, $L_2$ = $0$ & 100 & - & - \\ Tab. 2 & Flixter & IGMC-DAM & 0.001, $L_2$ = $0$ & 100 & 0.1 & $\beta^{(0)} = 1$, 0 epochs \\ Tab. 2 & Douban & IGMC & 0.001, $L_2$ = $0$ & 100 & - & - \\ Tab. 2 & Douban & IGMC-DAM & 0.001, $L_2$ = $0$ & 100 & 0.1 & $\beta^{(0)} = 1$, 0 epochs \\ Tab. 2 & Yahoo-Music & IGMC & 0.001, $L_2$ = $0$ & 100 & - & - \\ Tab. 2 & Yahoo-Music & IGMC-DAM & 0.001, $L_2$ = $0$ & 100 & 50.0 & $\beta^{(0)} = 1$, 0 epochs \\ \hline Fig. 4a & Cora & GAE-DAM & 0.01, \:$L_2$ = $0$ & 1,000 & variable & $\beta^{(0)} = 1$, 0 epochs \\ Fig. 4a & CiteSeer & GAE-DAM & 0.01, \:$L_2$ = $0$ & 1,000 & variable & $\beta^{(0)} = 1$, 0 epochs \\ Fig. 4a & PubMed & GAE-DAM & 0.01, \:$L_2$ = $0$ & 1,000 & variable & $\beta^{(0)} = 1$, 0 epochs \\ \hline Fig. 5 & MNIST & $L_{1}$-norm & 0.001, \:$L_2$ = $0$ & 100 & variable & - \\ Fig. 5 & MNIST & DAM & 0.001, \:$L_2$ = $0$ & 100 & variable & $\beta^{(0)} = 1$, 0 epochs \\ \hline \thickhline \end{tabular} \label{tab:specifications_CRL} \end{small} \end{center} \end{table} \textbf{DAM Implementation Specifications:} \begin{itemize} \item Table 1 provides full details of the hyper-parameter choices and implementation details of DAM used for generating all of the results in representation learning experiments of Section 4. We used Adam optimizer for all these experiments. \item All our results are reported by taking the mean and standard deviation over five independent random runs. \item We used the linear activation function for the linear dimensionality reduction experiments, LeakyRelu activation function for the quadratic experiments, and the ELU activation function for the neural network mapping experiments. Note that non-linear activation functions were required for the quadratic and neural network experiments, because of the non-linearity of the problem. We added a DAM layer between the encoder and decoder models to perform dimensionality reduction on the bottleneck layer. \item We use the official implementation of IGMC \footnote{\url{https://github.com/muhanzhang/IGMC}} to run the recommendation systems experiments on Flixter, Douban, and Yahoo-Music datasets. \item We use the PyTorch Geometric implementation of GAE \footnote{\url{https://github.com/rusty1s/pytorch_geometric/blob/master/examples/autoencoder.py}} for our graph representation learning experiments. \item We kept the same architecture as the official implementations of IGMC and GAE for all the recommendation system and graph representation learning experiments. For IGMC-DAM and GAE-DAM, we simply added one DAM layer after the bottleneck layer to perform pruning of the bottleneck dimension. \item For the dimensionality reduction experiments on the MNIST dataset, we used a plain autoencoder setup. We used four layers with 784, 64, 32, 50 neurons for the encoder, and for the decoder, we used four layers with 50, 32, 64, and 784 neurons. ReLU was used as the activation function. After the encoder layer, we used a DAM layer for dimensionality reduction. Likewise, we append an $L_1$-norm layer after the encoder layer for the $L_1$-norm-based dimensionality reduction. \item We varied $\lambda$ values for the graph representation learning experiments and MNIST dataset as follows. We varied the $\lambda$ from 0.01 to 5 for both GAE and GAE-DAM for graph representation learning experiments. We varied the $\lambda$ from 0.01 to 10 for the DAM model on the MNIST dataset. Likewise, we changed the range of $\lambda$ from 0.01 to 25 for the $L_1$-norm model. \item We observed some improvement in the performance of the baseline IGMC model for 100 epochs, although the official implementation used 40 epochs. We kept all other hyperparameters same as the official implementation. \end{itemize} \subsection{Structured Network Pruning (Section 5)} \begin{table}[t] \begin{center} \caption{Experiment Setups For Structured Network Pruning (Section 5).} \begin{small} \vspace{2ex} \begin{tabular}{lllllcc} \thickhline Source & Dataset & Model & Learning Rate & Epochs & $\lambda$ & Cold-Start\\ \hline Fig. 6 & CIFAR-10 & DAM & 0.05, \:$L_2$ = $10^{-3}$ & 200+0+0 & variable & $\beta^{(0)} = 1$, 20 epochs \\ Fig. 6 & CIFAR-10 & Net-Slim & 0.05, \:$L_2$ = $10^{-3}$ & 200+0+50 & - & - \\ Fig. 6 & CIFAR-10 & ChipNet & 0.05, \:$L_2$ = $10^{-3}$ & 200+20+50 & - & - \\ Fig. 6 & CIFAR-100 & DAM & 0.05, \:$L_2$ = $10^{-3}$ & 200+0+0 & variable & $\beta^{(0)} = 1$, 20 epochs \\ Fig. 6 & CIFAR-100 & Net-Slim & 0.05, \:$L_2$ = $10^{-3}$ & 200+0+50 & - & - \\ Fig. 6 & CIFAR-100 & ChipNet & 0.05, \:$L_2$ = $10^{-3}$ & 200+20+50 & - & - \\\hline Fig. 7 & CIFAR-10 & DAM & 0.05, \:$L_2$ = $10^{-3}$ & 200+0+0 & 0.4 & $\beta^{(0)} = 1$, 20 epochs \\ Fig. 7 & CIFAR-10 & Net-Slim & 0.05, \:$L_2$ = $10^{-3}$ & 200+0+50 & - & - \\ Fig. 7 & CIFAR-10 & ChipNet & 0.05, \:$L_2$ = $10^{-3}$ & 200+20+50 & - & - \\\hline Tab. 2 & CIFAR-10 & DAM & 0.05, \:$L_2$ = $10^{-3}$ & 200+0+0 & 0.4 & $\beta^{(0)} = 1$, 20 epochs \\ Tab. 2 & CIFAR-10 & Net-Slim & 0.05, \:$L_2$ = $10^{-3}$ & 200+0+50 & - & - \\ Tab. 2 & CIFAR-10 & ChipNet & 0.05, \:$L_2$ = $10^{-3}$ & 200+20+50 & - & - \\ \thickhline \end{tabular} \label{tab:specifications_NP} \end{small} \end{center} \end{table} \textbf{DAM Implementation Specifications:} \begin{itemize} \item All the models were trained using SGD optimizer. \item Table \ref{tab:specifications_NP} provides full details of the hyperparameter choices and implementation details of DAM for all structured network pruning experiments. \item For running time comparisons, we used an \textit{NVIDIA TITAN RTX} graphic card with \textit{Intel Xeon Gold 6240} CPU on \textit{Ubuntu 18.04 LTS} system. The channel pruning ratio for Net-Slim and ChipNet is set to 0.4 in all our experiments. \item For pruning experiments, we used learning rate decay as adopted in the ChipNet official implementation\footnote{ \url{https://github.com/transmuteAI/ChipNet}}. Table \ref{tab:specifications_NP} only shows the initial learning rate in these experiments. \item For all methods, the epochs are shown in the format of training epochs + pruning epochs + finetuning epochs. We can see that DAM requires 0 pruning epochs and 0 finetuning epochs, Net-Slim has 0 finetuning epochs, whereas ChipNet has non-zero epochs for all three stages. \item For Figure 6, on CIFAR-10 we use the following range of $\lambda$ values for DAM, $\lambda=\{0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.75\}$. For ChipNet and Net-Slim, we used the following range of values for pruning ratios: $\{0.1, 0.2, 0.4, 0.6, 1.0\}$ and $\{0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 1.0\}$, respectively. For CIFAR-100, we use $\lambda=\{0.1, 0.2, 0.3, 0.4, 0.5, 0.75, 1.0\}$ for DAM, and pruning ratios of $\{0.2, 0.4, 0.6, 1.0\}$ and $\{0.2, 0.3, 0.4, 0.5, 0.6, 1.0\}$ for ChipNet and Network Slimming, respectively. We did not report the $0.1$ pruning ratio on CIFAR-100 since both ChipNet and Network Slimming demonstrated unstable results. \end{itemize} \section{Additional Experimental Results} \subsection{Effect of Gradient Noise and Activation Functions on MNIST Dataset} We performed further experiments to evaluate the network pruning performance of DAM using LeNet-5 on MNIST dataset, which is a common dataset for experiments adopted by many previous works. Table \ref{tab:mnist_dam_lenet} (a) shows the results of DAM for pruning the LeNet model at varying values of $\lambda$. Figure \ref{fig:mnist_dam} also shows how test accuracy and pruning ratio varies as we change $\lambda$. We can see that the pruning keeps on continuing even with aggressively large values of $\lambda$ (close to 2), which again demonstrates that DAM does not suffer from the saturation effects of $L_1$-based regularization, as was described in Section 4 of the main paper. In addition to pruning the LeNet, we also examine how adding gradient noise \cite{daneshmand2018escaping} at every epoch of neural network training affects the results. Table \ref{tab:mnist_dam_lenet} (b) shows that by adding gradient noises to the training process leads to slight improvements in accuracy and pruning fractions, implying that more stochasticity in the training process may improve the ability of DAM to perform network pruning. Table \ref{tab:mnist_dam_lenet} (c) further shows the results of DAM on LeNet-5, where we replace all the activation functions with the sine activation function as proposed in \cite{sitzmann2019siren}. Interestingly, the results are much better with sine activation function, implying that the DAM may be compatible with periodic activation functions. \begin{figure}[H] \centering \includegraphics[width=0.95\textwidth]{figures/MNIST.pdf} \caption{Results of DAM trained with varying $\lambda$ on MNIST dataset. Accuracy is reported using the mean values of 5 random runs.} \label{fig:mnist_dam} \end{figure} \begin{table}[ht] \small \centering \caption{DAM on MNIST Dataset, LeNet-5 (\# Neurons 6-16-120)} \label{tab:mnist_dam_lenet} \begin{subtable}{.99\linewidth}\centering \subcaption{Tanh Activation w.o. Gradient Noise} \begin{tabular}{cllllllllll} \thickhline $\lambda$ & 0 & 0.01 & 0.02 & 0.05 & 0.1 & 0.2 & 0.3 & 0.4 & 0.5 & 1.0 \\\hline Parameters & 60.0k & 33.6k & 18.7k & 7.0k & 3.9k & 1.9k & 1.4k & 1.3k & 1.0k & 0.7k \\ Pruned (\%) & 0.00 & 44.15 & 68.82 & 88.41 & 93.59 & 96.78 & 97.71 & 97.85 & 98.31 & 98.90 \\ Accuracy (\%) & 98.85 & 98.61 & 98.47 & 98.16 & 97.49 & 96.54 & 95.47 & 94.79 & 93.70 & 90.12 \\\thickhline \end{tabular} \end{subtable} \begin{subtable}{.99\linewidth}\centering \subcaption{Tanh Activation with 5\% Gradient Noise} \begin{tabular}{cllllllllll}\thickhline $\lambda$ & 0 & 0.01 & 0.02 & 0.05 & 0.1 & 0.2 & 0.3 & 0.4 & 0.5 & 1.0 \\\hline Parameters & 60.0k & 35.0k & 18.8k & 5.9k & 3.9k & 1.8k & 1.4k & 1.3k & 1.0k & 0.6k \\ Pruned (\%) & 0.00 & 41.71 & 68.70 & 90.19 & 93.53 & 96.97 & 97.67 & 97.85 & 98.31 & 99.00 \\ Accuracy (\%) & 98.78 & 98.57 & 98.69 & 98.03 & 97.69 & 96.61 & 95.64 & 94.78 & 94.16 & 90.16 \\\thickhline \end{tabular} \end{subtable} \begin{subtable}{.99\linewidth}\centering \subcaption{Sine Activation w.o. Gradient Noise} \begin{tabular}{cllllllllll}\thickhline $\lambda$ & 0 & 0.01 & 0.02 & 0.05 & 0.1 & 0.2 & 0.3 & 0.4 & 0.5 & 0.6 \\\hline Parameters & 60.0k & 21.5k & 9.2k & 3.4k & 1.9k & 1.5k & 1.1k & 1.2k & 0.8k & 0.6k \\ Pruned (\%) & 0.00 & 64.24 & 84.64 & 94.27 & 96.84 & 97.44 & 98.12 & 98.05 & 98.59 & 98.95 \\ Accuracy (\%) & 98.93 & 99.00 & 98.85 & 98.53 & 98.38 & 97.12 & 96.12 & 96.63 & 94.91 & 95.49 \\\thickhline \end{tabular} \end{subtable} \end{table} \subsection{Additional Results on CIFAR Datasets} Table \ref{tab:cifar} presents additional results of DAM on CIFAR datsets for many other neural network architectures than what was shown in the main paper, including VGG-19, PreResnet-20, PreResNet-56, and PreResnet-110. Note that the DAM results presented in the main paper were obtained using an implementation of our algorithm based on the ChipNet source code \cite{tiwari2021chipnet}, which was published just a few weeks before the time of our submission. Given the recentness of this implementation, we were not able to complete extensive evaluations on all architectures using this implementation. Instead, the results presented in this section are based on an alternate implementation of our DAM algorithm based on the stable source code provided in an older well-established previous work \cite{liu2018rethinking}. In this implementation, the DAM is trained for 160 epochs using AdaBelief \cite{zhuang2020adabelief} optimizer. We release both implementations of our DAM algorithms in the anonymous link of the source code provided in the main paper. \begin{table}[ht] \small \caption{Additional results of pruning different architectures using DAM on CIFAR datasets.} \label{tab:cifar} \centering \vspace{2ex} \begin{tabular}{lllllll}\thickhline Network & Dataset & $\lambda$ & Top-1 (\%) & Params (k) & Pruned C. (\%) & Pruned P. (\%) \\\hline VGG-19 & CIFAR-10 & 0.1 & 93.39 & 1,627 & 71.28 & 91.88 \\ VGG-19 & CIFAR-10 & 0.5 & 90.92 & 264 & 89.17 & 98.68 \\ VGG-19 & CIFAR-100 & 0.1 & 73.40 & 6,190 & 41.30 & 69.17 \\ VGG-19 & CIFAR-100 & 0.5 & 67.17 & 664 & 79.81 & 96.69 \\\hline PreResNet-20 & CIFAR-100 & 0.1 & 67.33 & 228 & 2.72 & 5.88 \\ PreResNet-20 & CIFAR-100 & 0.2 & 66.53 & 217 & 5.37 & 10.50 \\ PreResNet-20 & CIFAR-100 & 0.3 & 66.46 & 206 & 7.72 & 15.13 \\ PreResNet-20 & CIFAR-100 & 0.4 & 65.83 & 191 & 11.25 & 21.18 \\ PreResNet-20 & CIFAR-100 & 0.5 & 66.17 & 183 & 14.12 & 24.67 \\ PreResNet-20 & CIFAR-100 & 1.0 & 63.15 & 121 & 31.84 & 50.05 \\ PreResNet-20 & CIFAR-100 & 2.0 & 54.79 & 47 & 62.35 & 80.45 \\\hline PreResNet-56 & CIFAR-100 & 0.1 & 72.74 & 573 & 3.33 & 6.60 \\ PreResNet-56 & CIFAR-100 & 0.2 & 72.64 & 526 & 7.93 & 14.35 \\ PreResNet-56 & CIFAR-100 & 0.3 & 72.49 & 493 & 10.72 & 19.67 \\ PreResNet-56 & CIFAR-100 & 0.4 & 72.28 & 466 & 14.62 & 24.14 \\ PreResNet-56 & CIFAR-100 & 0.5 & 71.73 & 419 & 19.17 & 31.73 \\ PreResNet-56 & CIFAR-100 & 1.0 & 69.94 & 314 & 33.60 & 48.77 \\ PreResNet-56 & CIFAR-100 & 2.0 & 64.31 & 153 & 62.94 & 75.05 \\\hline PreResNet-110 & CIFAR-10 & 0.1 & 94.51 & 975 & 9.72 & 15.01 \\ PreResNet-110 & CIFAR-10 & 0.2 & 93.73 & 808 & 20.71 & 29.54 \\ PreResNet-110 & CIFAR-10 & 0.3 & 93.28 & 646 & 31.10 & 43.65 \\ PreResNet-110 & CIFAR-10 & 0.4 & 93.35 & 560 & 37.08 & 51.18 \\ PreResNet-110 & CIFAR-10 & 0.5 & 92.97 & 482 & 46.55 & 58.00 \\ PreResNet-110 & CIFAR-10 & 1.0 & 91.61 & 208 & 72.51 & 81.85 \\ PreResNet-110 & CIFAR-10 & 2.0 & 88.90 & 89 & 84.99 & 92.21 \\\hline PreResNet-110 & CIFAR-100 & 0.1 & 75.55 & 1110 & 4.20 & 5.15 \\ PreResNet-110 & CIFAR-100 & 0.2 & 74.73 & 1010 & 10.24 & 13.70 \\ PreResNet-110 & CIFAR-100 & 0.3 & 75.08 & 940 & 14.54 & 19.63 \\ PreResNet-110 & CIFAR-100 & 0.4 & 73.93 & 873 & 18.37 & 25.41 \\ PreResNet-110 & CIFAR-100 & 0.5 & 73.44 & 817 & 21.87 & 30.17 \\ PreResNet-110 & CIFAR-100 & 1.0 & 71.63 & 547 & 39.68 & 53.21 \\ PreResNet-110 & CIFAR-100 & 2.0 & 68.32 & 261 & 66.45 & 77.72 \\ \thickhline \end{tabular} \end{table} \subsection{Analyzing Similarity in Pruned Features} A useful property of \textit{compact} features learned at the hidden layers of a neural network is that they show express `distinct' features upon convergence, such that pruning the neurons any further would lead to drop in accuracy. To evaluate the similarity in the features extracted by comparative structured network pruning methods, we compute the centered kernel alignment (CKA) similarity \cite{kornblith2019similarity} matrix for all pairs of neurons with non-zero mask values at the 54-th layer in the PreResNet-164 architecture pruned using DAM, Net-Slim, and ChipNet. Note that we chose the 54-th layer as it represents one third of the total number of layers at the end of the first `BaseBlock' of PreResNet-164 for ease of implementation, although these results can be visualized for any other layer number too. The CKA similarity matrices of the unpruned network and the three pruned networks are shown in Figure \ref{fig:cka}, where higher off-diagonal values in these matrices represent higher similarity among the features. To further quantify the differences between DAM and the baseline methods, we compute the statistics of the values in the off-diagonal elements of the CKA matrices in Table \ref{tab:cka}. We can observe observe that DAM shows lowest CKA similarity on the off-diagonal elements as compared to Net-Slim and ChipNet, indicating that the features learned by DAM are more distinct from one another. Also note that in Figure \ref{fig:cka}, the size of the pruned features (with non-zero values) extracted by DAM is quite smaller than what we obtain from Net-Slim and ChipNet using their standard implementations made available by their authors. This is because some proportion of pruned channels become nonzero after finetuning in Net-Slim (see details of mask implementation here\footnote{ \url{https://github.com/Eric-mingjie/network-slimming/tree/master/mask-impl}}) and ChipNet. Their current implementations thus result in smaller actual pruning ratios after finetuning for practical use than what is reported (before finetuninng). \begin{table}[ht] \small \caption{Statistics of CKA similarity between different features learned at layer 54 of PreResNet-164 after pruning (calculated using the off-diagonal elements in Figure \ref{fig:cka}).} \label{tab:cka} \centering \vspace{2ex} \begin{tabular}{llllll}\thickhline CKA & Unpruned & DAM & Net-Slim & ChipNet \\\hline mean & 0.273 & \textbf{0.229} & 0.328 & 0.295 \\ std & 0.018 & \textbf{0.013} & 0.021 & 0.020 \\ max & 0.840 & \textbf{0.740} & 0.893 & 0.964 \\ \thickhline \end{tabular} \end{table} \subsection{Additional Results on TinyImageNet Datasets} \begin{table}[H] \small \caption{Additional results of pruning PreResNet-164 using DAM on TinyImageNet datasets.} \label{tab:tinyimagenet} \centering \vspace{2ex} \begin{tabular}{llllllll}\thickhline $\lambda$ & 0.0 & 0.1 & 0.3 & 0.5 & 0.7 & 1.0 & 2.0 \\ \hline Top-1 (\%) & 52.72 & 52.75 & 52.51 & 52.99 & 52.11 & 52.89 & 53.17 \\ Pruned C. (\%) & 0.00 & 6.03 & 20.05 & 30.91 & 38.71 & 45.94 & 68.52 \\ \thickhline \end{tabular} \end{table} We managed to verify the performance of DAM on a larger dataset - TinyImageNet. For this dataset, we used PreResNet-164 as the backbone network with standard configurations of DAM as CIFAR-100 (see Appendix D.2). We used the AdaBelief \cite{zhuang2020adabelief} optimizer for faster convergence on this larger dataset. The optimizer configurations are the same as used for the results shown in Table \ref{tab:tinyimagenet}. We can see that DAM is able to consistently maintain the test accuracy on TinyImageNet even at extreme levels of network pruning close to 68\%. This demonstrates the ability of DAM to achieve useful generalization on larger datasets going beyond CIFAR. \begin{figure}[H] \begin{subfigure}{0.24\textwidth} \centering \includegraphics[width=0.90\linewidth]{figures/supplementary/CKA/cka_unpruned_blk1.pdf} \caption{Unpruned} \label{fig:cka_unpruned} \end{subfigure} \begin{subfigure}{0.24\textwidth} \centering \includegraphics[width=0.90\linewidth]{figures/supplementary/CKA/cka_dam_blk1.pdf} \caption{DAM} \label{fig:cka_dam} \end{subfigure} \begin{subfigure}{0.24\textwidth} \centering \includegraphics[width=0.99\linewidth]{figures/supplementary/CKA/cka_netslim_blk1.pdf} \caption{Net-Slim} \label{fig:cka_netslim} \end{subfigure} \begin{subfigure}{0.24\textwidth} \centering \includegraphics[width=0.99\linewidth]{figures/supplementary/CKA/cka_chipnet_blk1.pdf} \caption{ChipNet} \label{fig:cka_chipnet} \end{subfigure} \caption{CKA similarity between features learned at layer 54 of PreResNet-164 model, before pruning, and after pruning using the three methods.} \label{fig:cka} \end{figure} \section{Related Work} \textbf{Learning with Sparsity:} There is a long history of methods for enforcing compactness (or sparsity) in learned parameters \cite{olshausen1996emergence,tibshirani1996regression}, where it is understood that compact hypotheses can not only result in more efficient data representations but also promote better generalizability \cite{rissanen1986stochastic}. This connection between compactness and generalization has also been recently explored in the context of deep learning \cite{zhou2018compressibility,arora2018stronger}, motivating our problem of learning compact representations. \textbf{Unstructured Pruning:} There are several methods that have been developed for unstructured network pruning \cite{louizos2018learning, frankle2018lottery, frankle2020linear, savarese2020winning}, where the goal is to prune individual weights of the network. A widely used technique in this field is referred to as the {Lottery Ticket Hypothesis} (LTH) \cite{frankle2018lottery}, which suggests that a certain subset of weights in a network may be initialized in such a way that they are likely ``winning tickets'', and the goal of network pruning is then to simply uncover such winning tickets from the initialization of an over-parameterized network using magnitude-based pruning. Similar to our work, there exists a line of work in the area of \textit{dynamic sparse training} for unstructured pruning \cite{zhu2017prune, gale2019state,Mocanu2018ScalableTO, Evci2020Rigging, liu2021actually} that gradually prunes the model to the target sparsity during training. However, while unstructured pruning methods can show very large gains in terms of pruning ratio, they are not directly useful for learning compact representations, since the pruned weights, even though sparse, may not be arranged in a fashion conducive to the goal of reducing the number of features. \textbf{Structured Network Pruning:} The goal of structured pruning is to enforce sparsity over the network substructures (e.g., neurons or convolutional channels) that is directly relevant to the goal of learning compact representations. Most structured pruning SOTA methods need a three-stage process \cite{NIPS2015_ae0eb3ee}, i.e., training, pruning and finetuning, in order to get highly compressed models. Early exploration on the $L_1$ norm based filter pruning can be traced back to \cite{li2016pruning}, followed by \textit{Network Slimming} (NetSlim) \cite{Liu2017learning}, which uses a sparsity-inducing regularization based on $L_1$ norm. Following this line of work, a recent development in the area of network pruning is \textit{ChipNet} \cite{tiwari2021chipnet}, which introduces an additional \textit{crispness loss} to the $L_1$ regularization, and achieves SOTA performance on benchmark tasks. However, network slimming can only work if the underlying architecture has batch normalization layers. It also has training instabilities due to soft-thresholding inherent to Lasso. ChipNet also iterates between soft- and hard-pruning, which is done after the training phase. Further, both these approaches require finetuning or retraining, which can be resource intensive. Faster pruning schemes have also been explored by previous works. Bai et al \cite{bai2020few} proposed a few-shot structured pruning algorithm utilizing filter cross distillation. The SNIP \cite{lee2018snip} took one step ahead by performing single-stage pruning. However, SNIP falls in the category of unstructured pruning. To the best of our knowledge, no existing structured pruning method has been demonstrated to achieve SOTA performance without finetuning. For example, while the method proposed in \cite{louizos2018learning} can be potentially used as a single-stage structured pruning method with the help of group sparsity, the empirical analysis of the paper only focused on unstructured pruning. \textbf{Deep Representation Learning}: Leveraging the power of deep neural networks, high-dimensional data can be encoded into a low-dimensional representation \cite{Hinton504}. Such process is known as deep representation learning. A good representation extracts useful information by capturing the underlying explanatory factors of the observed input. The existence of noises, spurious patterns and complicated correlations among features make it a challenging problem. Previous work \cite{autoencoder} show that an Autoencoder architecture can be used for denoising images. To disentangle correlated features, VAE \cite{kingma2013auto} and $\beta$-VAE \cite{higgins2016beta} encourages the posterior distribution over the generative factors $q(z|x)$ to be closer to the isotropic Gaussian $\mathcal{N}(0, I)$ that explicitly promotes disentanglement of the latent generative factors. Driven by the idea of the autoencoder, the deep representation learning has been found remarkably successful in various of applications, e.g., graph representation learning \cite{kipf2016variational, davidson2018hyperspherical, di2020mutual, mavromatis2020graph, yang2018binarized, pan2018adversarially} and recommendation system \cite{zhang2019inductive}. However, most existing works in representation learning treat the embedding dimension as a hyperparameter, which can be crucial and difficult to choose properly. Small embedding dimensions cannot sufficiently represent the important information in the data that leads to bad representations. On the other hand, large embedding dimensions allow some level of redundancy in the learned representations, even picking up spurious patterns that can degrade model performances. \section{Broader Impacts} \section{Conclusions} \section{Discussion, Open Questions, and Future Works} \label{sec:conclusion} \vspace{-1ex} The effectiveness of DAM in learning compact representations provides a novel perspective into structured network pruning and raises several open questions about its relationships with other concepts in this area. In the following, we list some of these connections and describe the limitations and future extensions of our work. \textbf{Connections with Lottery Ticket Hypothesis}: Our work builds on the intuition of discriminative masking, i.e., we preferentially favor some neurons to be refined while favoring some other neurons to be pruned. This has interesting connections with the lottery ticket hypothesis (LTH) \cite{frankle2018lottery}, where some subsets of initialized weights in the network are hypothesized to contain ``winning tickets'' that are uncovered after a few epochs of training. While there is some open discussion on whether the winning tickets exist even before initialization \cite{frankle2019stabilizing, kathrin2021winingticket}, there are several studies supporting this hypothesis \cite{savarese2020winning, frankle2020linear}. Our results attempts to throw light on the question: ``can we find winning tickets if we discriminatively search for it in a certain subregion of the network?'' Further, we are able to show that the results of DAM are invariant to random permutation of the neuron indices at initialization, since all neurons receive identically distributed weights. Along these lines, we can also explore if there are certain ordering of neurons (e.g., in accordance with their likelihood of containing winning tickets revealed through LTH) that can perform better than random ordering in DAM. \textbf{Connections with Dropout:} Another interesting connection of DAM is with the popular regularization technique of Dropout \cite{srivastava2014dropout} that randomly drops out some neurons during training to break ``co-adaptation'' patterns in the learned features so as to avoid overfitting. Essentially, by randomly dropping a neuron at some epoch of training, the other neurons are forced to pick up the learned features of the dropped neuron, thus resulting in the learning of robust features. This is similar to the ``re-adaptation'' of weights at the active neurons at some epoch of DAM training, while the mask value of the neurons in the transitioning zone (when $0 < g_j < 1$) are gradually dropped by the shifting of the gate function. This motivates us to postulate the \textit{weight re-adaptation hypothesis} as a potential reason behind the effectiveness of DAM in learning compact representations, which requires further theoretical justifications. \textbf{Budget-aware Variants of DAM}: One promising future extension of our current DAM formulation would be to make it budget-aware, i.e., to stop the training process once we arrive at a target level of sparsity. Note that there is a direct correspondence between the value of the learnable gate offset parameter $\beta_i$ (that is minimized at every epoch) and the resulting $L_0$ sparsity (see Equation \ref{eq:l0_norm}). Hence, a simple budget-aware extension of our current DAM formulation would be to start from a large value of lambda (to provide sufficient scope for aggressive pruning) and keep monitoring the level of sparsity at every layer during the training process. As soon as the target sparsity mark is achieved, we can freeze $\beta_i$'s at every layer thus essentially halting the pruning process (note that the network architecture becomes immutable if $\beta_i$'s is fixed). \textbf{DAM Variants for Pre-trained Networks:} One of the fundamental assumptions of our current DAM formulation is that all neurons are symmetrically invariant to each at initialization, and hence we can simply use random neuron ordering for discriminative masking. While this assumption is valid for ``training from scratch'', this may not hold for neurons in a pre-trained network. Future extensions of DAM can include advanced ways of ordering neurons that do not rely on the above assumption and hence can even be used with pre-trained networks. For example, we can order neurons based on the magnitudes of weights of every neuron or the value of mutual information between neuron activations and outputs. This would open novel avenues of research in structured network pruning by finding effective neuron orderings for different initializations of network weights. \section{Backgrounds and Related Works} \textbf{Unstructured Pruning:}\ Pruning individual parameters. \begin{itemize} \item Lottery Ticket Hypothesis \item Sparsity-inducing Regularization Schemes \end{itemize} \textbf{Structured Pruning:}\ Predefined structured pruning \begin{itemize} \item L1-norm based Filter Pruning \end{itemize} Automatic structured pruning (Automatic in DAM) \begin{itemize} \item Network sliming \item Sparse Structure Selection \end{itemize} \begin{equation} \begin{bmatrix} \bm{x_1}& g_1(\bm{x_1})& g_2(\bm{x_1})& g_3(\bm{x_1})\\ \bm{x_2}& g_1(\bm{x_2})& g_2(\bm{x_2})& g_3(\bm{x_2})\\ ...& ...& ...& ...\\ \bm{x_n}& g_1(\bm{x_n})& g_2(\bm{x_n})& g_3(\bm{x_n}) \end{bmatrix} \end{equation} \section{Introduction} A central goal in deep learning is to learn \textit{compact} (or sparse) representations of features at every layer of a neural network that are useful in a variety of machine learning tasks. For example, in unsupervised \textit{representation learning} problems \cite{bengio2013representation}, there is a long-standing goal to learn low-dimensional embeddings of input features that are capable of reconstructing the original data \cite{autoencoder,ranzato2007sparse,le2011optimization,olshausen1996emergence}. Similarly, in supervised learning problems, there is a growing body of work in the area of \textit{network pruning} \cite{blalock2020state}, where the goal is to reduce the size of modern-day neural networks (that are known to be heavily over-parameterized \cite{denil2013predicting, zhu2018improving, kornblith2019similarity, wang2020orthogonal}) so that they can be deployed in resource-constrained environments (e.g., over mobile devices) without compromising on their accuracy. From this unified view of representation learning and network pruning, the generic problem of ``learning compact representations'' has applications in several machine learning use-cases such as dimensionality reduction, graph representation learning, matrix factorization, and image classification. A theoretically appealing approach for learning compact representations is to introduce regularization penalties in the learning objective of deep learning that enforce $L_0$ sparsity of the network parameters, $\theta$. However, directly minimizing the $L_0$ norm requires performing a combinatorial search over all possible subsets of weights in $\theta$, which is computationally intractable. In practice, a common approach for enforcing sparsity is to use a continuous approximation of the $L_0$ penalty in the learning objective, e.g., $L_1$-based regularization (or Lasso \cite{tibshirani1996regression}) and its variants \cite{seto2021halo,yun2019trimming}. While such techniques are capable of pruning individual weights and thus reducing storage requirements, they do not offer any direct gains in inference speed since the number of features generated at the hidden layers can still be large even though the network connectivity is sparse \cite{blalock2020state}. Instead, we are interested in the area of \textit{structured network pruning} for learning compact representations, where the sparsity is induced at the level of neurons by pruning features (or channels) instead of individual weights. \begin{wrapfigure}{t}{0.33\textwidth} \includegraphics[width=0.33\textwidth]{figures/intro/gate.pdf} \captionsetup{font=small} \caption{Illustration of Discriminative Masking. The gate function shifts to the "right" during training resulting in more zeros in the mask on convergence.} \label{fig:dam_intro} \end{wrapfigure} While there is a growing body of work in structured network pruning \cite{li2016pruning,Liu2017learning,tiwari2021chipnet,gordon2018morphnet}, the basic structure of most state-of-the-art (SOTA) methods in this area (e.g., ChipNet \cite{tiwari2021chipnet} and NetSlim \cite{Liu2017learning}) can be described as training a learnable vector of mask parameters, $\mathbf{g} \in \mathbb{R}^n, \mathbf{g} = [g_1, g_2, ..., g_n]^\intercal$, which when multiplied with the features extracted at a hidden layer, $\mathbf{h} \in \mathbb{R}^n$, results in the pruned outputs of this layer, $\mathbf{o} = \mathbf{g}\circ\mathbf{h}$. Sparsity in the mask parameters is generally enforced using different approximations of the $L_0$ norm of $\mathbf{g}$ (e.g., use of Lasso in NetSlim and use of ``crispness'' loss in ChipNet). Despite recent progress in this area, current SOTA in structured pruning suffer from two key limitations. First, since most methods do not explicitly minimize the $L_0$ norm of $\mathbf{g}$ during pruning, they often suffer from \textit{training instabilities}. In particular, most SOTA methods \cite{Liu2017learning,tiwari2021chipnet} involve thresholding techniques to set small non-zero weights to zero leading to large drops in accuracy during the training process, as evidenced by our results in this paper. Second, once the pruning process is complete and we have converged at a compact network, most SOTA methods still need an additional step of \textit{fine-tuning} the network in order to achieve reasonable accuracy. This is not only resource-intensive but there is also an on-going discussion on whether and how we should fine-tune \cite{renda2020comparing} or rewind to initial weights \cite{le2021network} or train from scratch \cite{liu2018rethinking}, making it difficult to prefer one approach over another. At the core of these limitations is the lack of a systematic approach for structured network pruning that jointly prunes and refines weights during training in a single stage, and does not require any fine-tuning upon convergence to achieve SOTA performance. Notice that in existing methods for structured pruning, allowing every neuron $j$ to be pruned differently using an independent mask parameter $g_j$ only increases the number of learnable (or free) parameters in the learning objective, increasing the complexity of the problem. Instead, we ask the question: ``{Can we leverage the intrinsic symmetry of neural networks to design a pruning mask using the least number of free parameters?}'' We present a simple solution to this question by proposing a new single-stage structured pruning method that learns compact representations while training and does not require fine-tuning, termed \textit{DiscriminAtive Masking (DAM)}. The basic idea of DAM is to use a monotonically increasing gate function $\mathcal{G}$ for masking every neuron in a layer that only depends on the index $j = 1, 2, ..., n$ (or position) of the neuron in the layer, i.e., $g_j = \mathcal{G}(j)$, and a scalar parameter $\beta$ to be learned during training (see Figure \ref{fig:dam_intro}). At the start of training, the gate function admits non-zero values for all neurons in the layer, allowing all neurons to be unmasked (or active). As the training progresses, the gate function gradually shifts from ``left'' to ``right'' as a result of updating $\beta$ such that upon convergence, only a subset of neurons (on the extreme right) are active while all others are masked out. The key intuition behind DAM is to \textit{discriminatively} prefer some of the neurons (on the right) to be refined (or re-adapted) during the training process for capturing useful features, while gradually masking out (or pruning) neurons on the left. This preferential pruning of neurons using a very simple gate function helps in regulating the number of features transmitted to the next layer.\footnote{This is somewhat analogous to how a physical dam regulates the flow of water by shifting a movable gate.} \textbf{Contributions:} We show that our proposed DAM approach has remarkably good performance over various applications, including dimensionality reduction, recommendation system, graph representation learning, and structured pruning for image classification, achieving SOTA performance for structured pruning. This shows the versatility of DAM in learning compact representations on diverse problems and network choices, in contrast to baseline methods for structured pruning that are only developed and tested for the problem of image classification \cite{Liu2017learning,tiwari2021chipnet}. Our approach is single-stage, does not require fine-tuning (and hence has lower training time), and does not suffer from training instabilities. We also theoretically show that the learning objective of DAM is directly related to minimizing the $L_0$ norm of the discriminative mask, providing a new differentiable approximation for enforcing $L_0$ sparsity. Our approach is also easy to implement and can be applied to any layer in a network architecture. The simplicity and effectiveness of DAM provides unique insights into the problem of learning compact representations and its relationship with preferential treatment of neurons for pruning and refining, opening novel avenues of systematic research in this rapidly growing area. \section*{Checklist} \newpage \maketitle \section{Proposed Approach} \label{sec:method} \begin{figure}[t] \centering \includegraphics[width=\linewidth]{figures/intro/Intro.pdf} \caption{Illustration of the problems of representation learning (a) and structured network pruning (b). Blue blocks are layers in neural networks while red blocks show non-zero values in the mask layers. Figure (c) and (d) show two states of the gate function for $k=10$. As an example, $\beta$=-2 in (c) prunes 20\% of the neurons while $\beta$=-6 in (d) prunes 60\% of the neurons.} \label{fig:dam} \end{figure} \textbf{Problem Statement:} Let us represent the general architecture of a neural network with $l$ layers as $\mathcal{F}(\bm{x}) = \Psi_l \Psi_{l-1} ... \Psi_2 \Psi_1 \bm{x}$, where $\bm{x}$ are the input features to the network and $\bm{h}_i = \Psi_i(\bm{h}_{i-1})$ are the learned features at layer $i$. Let us also consider the ``masked'' version of this network where the features learned at every hidden layer $i$ are multiplied with a continuous mask layer $G_i$ in the following manner, $\mathcal{F}_{\bm{g}}(\bm{x}) = \Psi_l G_{l-1} \Psi_{l-1} ... G_2 \Psi_2 G_1 \Psi_1 \bm{x}$, where $\bm{g}_i = G_i(\bm{h}_{i})$. The goal of learning compact representations can then be framed as minimizing the following learning objective: \begin{align} \min_{\theta}\, \mathbb{E}_{\bm{x} \sim \mathbb{D}_{tr} } \left[ \mathcal{L}\left( \mathcal{F}_{\bm{g}}(\bm{x}) \right) + \frac{\lambda}{l-1} \sum_{i=1}^{l-1}\norm{\bm{g}_i}_0 \right], \end{align} where $\theta$ are the learnable parameters of the network\footnote{Note the parameter set $\theta$ includes the learnable parameter of DAM layers $\beta$.}, $\mathbb{D}_{tr}$ is the training set, $\mathcal{L}(.)$ is the loss function, and $\lambda$ is the trade-off parameter for enforcing $L_0$ sparsity in the masked outputs, $\bm{g}_i$. Note that this formulation provides a unified view of both representation learning and structured network pruning, which differ in the choice of loss function (typically, reconstruction error for representation learning and cross-entropy for structured pruning), and the number of layers that are pruned (in representation learning, we only aim to prune the bottleneck layer while in structured pruning, we aim to prune all of the layers in the network, see Figure \ref{fig:dam}). Further, notice that we only enforce $L_0$ penalty on the gate outputs $\bm{g}_i$, while the hidden features $\bm{h}_i$ are allowed to be non-sparse. \textbf{DiscriminAtive Masking (DAM)}: To describe the key idea of our proposed DAM approach, we first introduce the concept of an `ordering' among the neurons at any layer $i$, such that we \textit{discriminatively} (or preferentially) focus on pruning neurons lower in the order, while retaining and refining the features learned at neurons higher in the order. Specifically, let us assign every neuron $j$ at layer $i$ with an ``order number,'' $\mu_{ij}$. The masking operation of DAM can then be implemented using a simple gate function $\bm{g}_i$, whose value at neuron $j$ monotonically increases with the order number of the neuron, $\mu_{ij}$, as follows: \begin{align} g_{ij} = \text{ReLU}\left[ \tanh\left( \alpha_i (\mu_{ij} + \beta_i) \right) \right] = \max{ \left[ \tanh\left( \alpha_i (\mu_{ij} + \beta_i) \right), 0 \right]}, \label{eq:gate_function} \end{align} where $\alpha_i$ is a constant scalar parameter (termed as the \textit{steepness} parameter) that is not optimized during training, while $\beta_i$ is a `learnable' scalar parameter (termed the \textit{offset} parameter) that is the \textit{only} parameter optimized during training to control (or regulate) the process of masking in DAM. Figures \ref{fig:dam}(c) and (d) show examples of this gate function (in red) at two different values of $\beta_i$. Note that using a single learnable parameter $\beta_i$ to implement the masking process introduces significant simplicity in the design of the gate function, in contrast to SOTA methods in structured pruning \cite{Liu2017learning,tiwari2021chipnet} where a different masking parameter is trained for every neuron in the network. We hypothesize this simplicity of the gate function, in conjunction with the preferential pruning property of DAM, to result in remarkable gains in learning compact representations, as evidenced later in our experiments. Further, note that while we can use any monotonically increasing function to implement our gates, we found ReLU-tanh to perform best in practice. \textbf{Neuron Ordering in DAM}: We now discuss our approach for assigning neuron order numbers $\mu_{ij}$ for DAM to work. Note that the order numbers only have to be assigned during the initialization step, and do not change during the training process. Further, note that every neuron is initialized with weights that are independent and identically distributed (because of the i.i.d nature of commonly used initialization methods in deep learning \cite{sutskever2013importance}). Hence, all neurons are symmetrically invariant to each other at initialization and any neuron has an equally good chance of refining themselves to capture useful features later in the training process as any other neuron. Hence, any random ordering of the neurons in the DAM approach would result in a similar pruning process (we empirically demonstrate the permutation invariance of $\mu_{ij}$ in Section 5). For simplicity, we consider a trivial choice of $\mu_{ij} = kj/n_i$, where $k$ is a constant parameter that determines the domain size of $\mu_{ij}$, and $n_i$ is the total number of neurons at layer $i$. \textbf{How Does Reducing $\beta_i$ Enforce $L_0$ Sparsity?} Now that we have described the implementation of our gate function $\bm{g}_i$, let us understand how $\bm{g}_i$ behaves as we change the only learnable parameter, $\beta_i$. Figure \ref{fig:dam} (c) shows an example of $g_i$ when $\beta_i = -2$. At this stage, we can see that only a small number of neurons have zero gate values (white). As we reduce $\beta_i$ to $-6$ in Figure \ref{fig:dam} (d), we can see that the gate moves towards the 'right', resulting in more excessive pruning of neurons. In general, the number of non-zero values of the gate function (and hence, its $L_0$ norm) is directly related to $\beta_i$ as follows: \begin{equation} \label{eq:l0_norm} \norm{\bm{g}_i}_0 = \sum_{j=1}^{n_i} \mathbb{1}(g_{ij}>0) = \sum_{j=1}^{n_i} (1 - \mathbb{1}(\mu_{ij} \leq \beta_i)) = \ceil{n_i(1 + \beta_i /k)},\quad \text{for} \quad \beta_i \geq -k, \end{equation} where $\mathbb{1}$ indicates the identity operator and $\ceil{\cdot}$ is the ceiling operator. In order to back-propagate gradients, we use a continuous approximation of Equation (\ref{eq:l0_norm}) (by dropping the ceiling operator) for regularization as $\norm{\bm{g}_i}_0 \approx n_i(1 + \beta_i /k)$. Hence, minimizing $L_0$ norm of $\bm{g}_i$ is directly proportional to minimizing $\beta_i$ with a scaling factor of $n_i/k$. \textbf{Learning Objective of DAM:} While minimizing $\beta_i$ with scaling factors proportional to $n_i$ can explicitly minimize $L_0$ norm of the gate values, we found in practice that layers with smaller number of neurons $n_i$ still require adequate pruning of features for learning compact representations proportional to layers with large $n_i$. Hence, in our learning objective, we drop the scaling factor and directly minimize the sum of $\beta_i$ across all layers in the following objective function. \begin{align} \label{eq:network_pruning_rewrite} \min_{\theta}\, \mathbb{E}_{x \sim \mathbb{D}_{tr} } \left[ \mathcal{L}\left( \mathcal{F}_g(\bm{x}) \right) + \frac{\lambda}{l-1} \sum_{i=1}^{l-1} \beta_i \right], \end{align} \textbf{Theoretical Analysis of DAM:} Analysis of the dynamics of the gate functions and additional specifications for choosing $\alpha_i$ and the gate function are provided in Appendix A. \textbf{Parameter Specification and Implementation Details:} In all of our experiments, we used $\alpha_i=1$ and $k=5$. In our structured network pruning experiments, we used a cold-start of 20 epochs (i.e., the $\beta_i$'s were frozen for the duration of cold-start), so as to allow the leftmost neurons to undergo some epochs of refinement before beginning the pruning process. We also set the initial value of $\beta_i$ to 1, which can also be thought of as another form of cold-starting (since pruning of a layer only starts when $\beta_i$ becomes less than zero). \section{Experiments on Representation Learning Problems} \label{sec:CRL} \subsection{Results on Dimensionality Reduction (DR) Problems} \textbf{Problem Setup:} We evaluate the effectiveness of DAM in recovering the embeddings of synthetically generated dimensionality reduction problems. The general form of the problem is expressed by (\ref{eq:rd_Dam_objective}). Suppose $\Omega \in \mathbb{R}^r$ and all of its $r$ dimensions are independent from each other. A $d$-dimensional data $X$ can be expressed using a transformation $\Psi: \mathbb{R}^r \longrightarrow \mathbb{R}^d$ defined on Hilbert space, and $X = \Psi {\Omega}$, $d > r$. Let $G = \textup{diag}{(\bm{g})}$, we formulated the dimensionality reduction problem as: \begin{align} \min_{\Theta}\left\{ \norm{{\mathcal{F}}_D \cdot G \cdot \mathcal{F}_E \cdot X - X}_F^2 + \lambda \beta \right\} ,\quad \Theta = \{ \theta_E, \theta_D, \beta \} \label{eq:rd_Dam_objective} \end{align} The $\mathcal{F}_E, G, \mathcal{F}_D$ are trained end-to-end using gradient descent. In our experiments, $\Omega$ is sampled from a isotropic normal distribution, i.e., $\Omega \sim{ \mathcal{N}_r(\bm{0}, I_{r})}$. We let $\Psi$ to use the same structure as the decoder $\mathcal{F}_D$ with randomly generated parameters $\theta_\Psi$, i.e., $\Psi = \mathcal{F}_D|_{\theta_D=\theta_\Psi}$, so that the minimum number of dimensions needed in the encoded representation for the decoder to reconstruct $X$ is $r$. \textit{Linear DR:} We test DAM for removing linear correlations in a given rank-deficient matrix. In this case, $\Psi$ is a matrix representing a linear projection from $\mathbb{R}^r$ to $\mathbb{R}^d$. We use two real matrices as the encoder and decoder and train the DAM to find the full-rank representation of $X$. \textit{Nonlinear DR:} To test the ability of DAM for disentangling nonlinearly correlated dimensions, we present two cases: (i) $\Psi$ is a polynomial kernel of degree 2 (we use a QRes layer from \cite{jie2021qres}); (ii) $\Psi$ is a nonlinear transformation expressed by a neural network. We use a deep neural network as the encoder with sufficient complexity. \begin{figure}[ht] \begin{subfigure}{.33\textwidth} \centering \includegraphics[width=.9\linewidth]{figures/dimReduction/linear_rd.pdf} \caption{Linear $\Psi$} \label{fig:linear_rd} \end{subfigure} \begin{subfigure}{.33\textwidth} \centering \includegraphics[width=.9\linewidth]{figures/dimReduction/quad_rd.pdf} \caption{Polynomial $\Psi$} \label{fig:quad_rd} \end{subfigure} \begin{subfigure}{.33\textwidth} \centering \includegraphics[width=.9\linewidth]{figures/dimReduction/mlp_rd.pdf} \caption{Neural Network $\Psi$} \label{fig:mlp_rd} \end{subfigure} \caption{ Bottleneck dimension (of nonzero entries) vs number of epochs during training. } \label{fig:dimensionality reduction} \end{figure} \textbf{Observation:} Figure \ref{fig:dimensionality reduction} shows the convergence of bottleneck dimensions over the training epochs for different synthetic data with varying sizes of underlying factors ($r$). The curves and shades show the mean and standard deviation of five different runs. We can see that DAM consistently uncovers the exact dimension of the underlying factors $r$. We provides details of in-depth sensitivity analysis of DAM results based on its hyper-parameters (e.g., learning rate and $\lambda$) in Appendix C. \textbf{Theoretical Analysis of DAM for linear DR:} We theoretically show that DAM converges to the optimal solution for the linear DR case (see Appendix B for details). \subsection{Recommendation System Results} \textbf{Problem Setup:} We consider the state-of-the-art method for recommendation system problems (IGMC \cite{zhang2019inductive}), which transforms the rating matrix completion task to a link prediction problem, where the ratings are interpreted as links between users and items. In particular, IGMC generates 128-dimensional embeddings to represent the enclosing subgraph and further avoids overfitting using a dropout layer with a dropout rate of 0.5. We replaced the dropout layer with a DAM layer in the IGMC to reduce the dimension of the learned representations. We train our IGMC-DAM model for 100 epochs under the same training configurations. \begin{table}[ht] \small \centering \caption{Results of IGMC with and w.o. DAM on recommendation system tasks.\\} \begin{tabular}{ccccc} \toprule & \multicolumn{2}{c}{IGMC} & \multicolumn{2}{c}{IGMC-DAM} \\ & RMSE & Dimension & RMSE & Dimension \\ \hline Flixter & $0.8715 \pm 0.0005$ & 128 & $\mathbf{0.8706 \pm 0.0003}$ & $\mathbf{32}$ \\ Douban & $0.7189 \pm 0.0002$ & 128 & $\mathbf{0.7183 \pm 0.0004}$ & $\mathbf{17}$ \\ Yahoo-Music & $19.2488 \pm 0.0123$ & 128 & $\mathbf{19.0166 \pm 0.0444}$ & $\mathbf{83}$ \\ \bottomrule \end{tabular} \label{tab:recommender} \end{table} \textbf{Observation:} Table \ref{tab:recommender} shows that DAM successfully reduces the dimensions of the learned representations without any increase in errors, demonstrating that DAM is able to boost the performance of IGMC by learning compact representations over the target graph. \subsection{Graph Representation Learning Results} \textbf{Problem Setup:} Following the previous experiment, we further explore the effectiveness of DAM in learning compact graph representations. Our goal is to learn low-dimensional embeddings for each node in a graph that captures the structure of interaction among nodes. A simple graph autoencoder, e.g., GAE \cite{kipf2016variational}, uses a graph convolutional network (GCN) \cite{kipf2016semi} as an encoder and an inner product as a decoder. The encoder calculates the embedding matrix $Z$ from the node feature matrix $X$ with the adjacency matrix $A$, and the decoder reconstructs a adjacency matrix $\hat{A}$ such that: $\hat{A} = \sigma(ZZ^\top)$, with $Z = \text{GCN}(X, A)$. The reconstruction loss, BCE$(A, \hat{A})$ is backpropagated to train the GAE model. To reduce the dimension of the learned representation, we add a DAM layer in a GAE after the encoder (GAE-DAM). \begin{figure}[ht] \begin{subfigure}{.33\textwidth} \centering \includegraphics[width=.9\linewidth]{figures/dimReduction/cora_lp_updated.pdf} \caption{Cora} \label{fig:cora_lp} \end{subfigure} \begin{subfigure}{.33\textwidth} \centering \includegraphics[width=.9\linewidth]{figures/dimReduction/citeseer_lp_updated.pdf} \caption{CiteSeer} \label{fig:citeseer_lp} \end{subfigure} \begin{subfigure}{.33\textwidth} \centering \includegraphics[width=.9\linewidth]{figures/dimReduction/pubmed_lp_updated.pdf} \caption{PubMed} \label{fig:pubmed_lp} \end{subfigure} \caption{ Link prediction performance for Cora, CiteSeer and PubMed Dataset. Competing models are GAE, GAE-DAM.} \label{fig:link_prediction} \end{figure} \textbf{Observation:} Figure \ref{fig:link_prediction} shows that DAM based GAE method is able to learn meaningful structural information in compact latent embeddings. DAM improves the link prediction performance of the simple GAE for Cora, CiteSeer and PubMed dataset by learning compact representations. \subsection{Representation Learning Results for MNIST Dataset} \textbf{Problem Setup:} We further evaluate DAM on the problem of dimensionality reduction using simple auto-encoders on the MNIST dataset, and also compare the effectiveness of DAM (that directly enforces $L_0$ sparsity) with an ablation of our approach that instead minimizes the $L_1$ norm (similar to Lasso). We vary the trade-off parameter $\lambda$ to compare the sparsity of the learned representations between DAM and $L_1$-norm based ablation method. \begin{figure}[ht] \begin{subfigure}{.33\textwidth} \label{fig:rec-autoenc} \centering \includegraphics[width=.99\linewidth]{figures/dimReduction/mnist_rec_loss.pdf} \end{subfigure} \begin{subfigure}{.33\textwidth} \label{fig:f1-autoenc} \centering \includegraphics[width=.99\linewidth]{figures/dimReduction/mnist_f1_macro.pdf} \end{subfigure} \begin{subfigure}{.33\textwidth} \label{fig:lam-btl-autoenc} \centering \includegraphics[width=.99\linewidth]{figures/dimReduction/mnist_lambda_btl.pdf} \end{subfigure} \caption{ Performance comparison plots of DAM with $L_1$-norm method on MNIST dataset. } \label{fig:aenc_l1_dam} \end{figure} \textbf{Observation:} Figure \ref{fig:aenc_l1_dam} shows that DAM is able to achieve lower reconstruction error as well as higher $F1$ scores over the same bottleneck dimensions than $L_1$ based method. In Figure \ref{fig:aenc_l1_dam} (c), we can see that DAM shows a near-linear descending trend of bottleneck dimensions as $\lambda$ increases (further evidence presented in Appendix E1). In contrast, the $L_1$ based method has a saturating effect at large $\lambda$ values since the weights come close to zero but require some thresholding to be pruned. This shows that DAM is amenable to learning highly compact representations in contrast to $L_1$ based methods. \section{Experiments on Structured Network Pruning} \textbf{Evaluation Setup} Here we demonstrate the effectiveness of DAM on the task of structured network pruning. We compared the performance of our proposed DAM with two SOTA structured pruning algorithms, Network Slimming (Net-Slim) \cite{Liu2017learning} and ChipNet \cite{tiwari2021chipnet}. Net-Slim is well-established SOTA that is widely used as a strong baseline, while ChipNet is the latest SOTA representing a very recent development in the field. ChipNet and Net-Slim are both pretrained for 200 epochs, while the DAM performs single-stage training and pruning in the same number of epochs. Since, our DAM approach does not require additional fine-tuning, we imposed a limited budget of 50 epochs for fine-tuning the SOTA methods. Note that ChipNet also has a pruning stage which involves 20 additional epochs. We evaluate the performance of these methods on the PreResnet-164 architecture on benchmark computer vision datasets, CIFAR-10 and CIFAR-100. Additional evaluation setup details are in Appendix E2. \textbf{Performance and Running time comparison}: Figures \ref{fig:c10} and \ref{fig:c100} demonstrate the performance of different network pruning methods for various pruning ratios. We observe that for both datasets, DAM is able to outperform Net-Slim by a significant margin specially when the models are sparse. Additionally, DAM is able to achieve similar or slightly better performance than ChipNet with no additional fine-tuning. We also compare the total running time for pruning across the different models (divided into the three categories) in Figure \ref{fig:c10_time}. We can see that the training time of the three methods are almost the same, with ChipNet being slightly small. However, the running time for the pruning and fine-tuning stages for DAM are both zero. Net-Slim also does not involve additional pruning after training. However, ChipNet involves 20 epochs of pruning which is significant and is almost comparable to its pretraining time. Finally, comparing the total running time taken by each of the structured pruning methods, we observe that DAM is significantly faster than the current SOTA counterparts owing to its single-stage pruning approach. \begin{figure}[ht] \begin{subfigure}{.32\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/pruning/CIFAR10_PreResNet164.pdf} \caption{CIFAR-10} \label{fig:c10} \end{subfigure} \begin{subfigure}{.32\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/pruning/CIFAR100_PreResNet164.pdf} \caption{CIFAR-100} \label{fig:c100} \end{subfigure} \begin{subfigure}{.34\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/pruning/CIFAR10_PreResNet164_Time.pdf} \caption{Training Time} \label{fig:c10_time} \end{subfigure} \caption{ Performance and running time comparison of DAM with state-of-the-art structured pruning methods on PreResNet-164 for various parameter pruning ratios. } \label{fig:cifar} \end{figure} \textbf{Stability Analysis}: We further analyse the stability of our proposed DAM approach for network pruning through visualization of the training dynamics. We observe that the training cross-entropy (CE) loss and the validation CE loss are very similar to what we expect from a Preresnet model trained on benchmark vision datasets with learning rate changes at 100 and 150 epochs, respectively. We further notice that the total training loss for the DAM is also very stable and does not show any sudden variations, leading to steady convergence. Finally, from the convergence plot for $\mathbb{E}[\beta_i]$ (green-dashed line), we can see that our pruning does not involve any sudden steps and happens in a continuous and steady rate throughout the training stage. The training dynamics of the ChipNet (blue shaded region in the middle panel) is exactly the same as training vanilla vision models since it does not involve sparsity constraints. However, as we move to the pruning stage, we notice a sharp rise in both training and validation losses (white region). This is due to the use of a different optimizer AdamW as opposed to SGD which was used in the training stage. Further, a very interesting phenomenon happens in the fine-tuning stage (red shaded region) where the training and validation losses increases for the first 25 epochs and then takes a sharp decrease once the learning rate is adjusted. This suggests that after the pruning stage, finetuning the model with large learning rate forces the model to make large updates in the initial epochs (akin to training from scratch), which further drives the model out of the local minima. Once the learning rate is adjusted, the model is able to slowly progress towards a new local optima and ultimately converges to the fine-tuned minima. Finally, both the training and fine-tuning dynamics of the Net-Slim (rightmost panel) appears to be highly unstable. This suggests that the pre-training with sparsity loss is not stable and can lead to large fluctuations in the training loss. Also, note that Net-Slim does not have a validation set as it instead uses the test set to choose the best model. We have refrained from using the best model by looking at the performance on the test set, and instead evaluate the model from the last epoch. \begin{figure}[ht] \label{fig:stability} \centering \includegraphics[width=\textwidth]{figures/pruning/stability.pdf} \caption{Stability analysis for DAM (left), ChipNet (middle) and Network Slimming (right) through visualization of the loss curves. Blue, white and red shades denote the training, pruning and fine-tuning stages respectively. } \end{figure} \textbf{Permutation Invariance}: To test the effect of permuting the neuron order on the performance of DAM, Table \ref{tab:permutation_invariance} provides results across five randomly permuted values of $\mu_{ij}$ across every neuron in the network, while using the same initialization as previous experiments. We can see that DAM is invariant to permutations of neuron order during initialization, validating our simple choice of assigning neuron ordering based on their index values. \begin{table}[ht] \small \centering \caption{Permutation Invariance results on PreResNet-164 on CIFAR-10. RSD denotes the relative standard deviation.\\} \label{tab:permutation_invariance} \begin{tabular}{cclllcc} \thickhline & Run 1 & Run 2 & Run 3 & Run 4 & Run 5 & RSD \\ \hline Test Accuracy & 94.11\% & 93.86\% & 93.71\% & 93.93\% & 93.52\% & 0.0024 \\ Channels Pruned & 43.31\% & 43.14\% & 43.31\% & 43.14\% & 43.02\% & 0.0029 \\ Parameters Pruned & 64.01\% & 63.40\% & 63.97\% & 63.64\% & 63.37\% & 0.0048 \\ \thickhline \end{tabular} \end{table} \textbf{Additional Results:} To illustrate generalizibility we provide additional network pruning results for more networks such as VGG-19, PreResnet-20, PreResNet-56 and PreResnet-110 on CIFAR datasets and LeNet-5 on MNIST in Appendix E3. To demonstrate decorrelated kernels obtained after pruning using DAMs we use CKA similarity \cite{kornblith2019similarity}. The results can be found in Appendix E3. For extreme values of $\lambda$, we demonstrate that DAM is able to pruning entire bottleneck layers for ResNet architectures by visualizing the pruned architectures in Appendix E4.
\section{Introduction} \label{sec:introduction} The Covid-19 pandemic has created a new dynamic in terms of social behavior. Its impacts over society are widespread through all fields, from psychological effects on individuals (as in \cite{kontoangelos2020mental}) up to economic effects over countries, as examined by International Monetary Fund (IMF) publications (e.g. \cite{deb2020economic}). In this paper we aim at a particular effect of the virus-spread: the impacts of restrictions to mobility over its effects on Covid-19 cases and deaths. We use a panel dataset at the municipal level in Brazil to measure the short-term impacts of reduction in mobility on the dynamics of Covid-19. Throughout the first year of the pandemic (2020), many countries adopted circulation restrictions with the objective of reducing the spread of the disease on the population. However, there is a large heterogeneity in terms of the restriction degrees over the countries: while New Zealand imposed a high-level centralized lockdown strategy, Brazil only imposed decentralized mobility restrictions. In this scenario, evaluating causal effects of mobility impacts on the infection proliferation is a challenging duty, as we are not able to divide regions in a pure randomized way and evaluate the effects of circulation restrictions. There is an additional complication of mapping behavioral (non-observable) variables (such as the usage of masks, social distancing and the adoption of better hygiene measures, among many others) that may affect mobility and infection levels, generating an omitted bias issue. On the other hand, when the rates of infection are high, people tend to comply more with restrictive measures, generating a simultaneity bias. This paper has the objective of analyzing empirically the effects of restrictions to circulation on the infection spread, without recurring to epidemiological models or theoretical formulation of individual behavior. The literature that approached the mobility problem has focused mainly on two points: (i) prediction of the impact of lockdown policies; (ii) evaluation of mobility restrictions in terms of Covid-19 cases and deaths. There is also a third branch that focus on analyzing the effects of Covid-19 on mobility (i.e. the converse of our causal identification), and we only provide some references about such studies. The first ``prediction" group focus in the impact of lockdown policies in terms of evaluating Covid-19 spread. Inside this group, we also make two distinctions: (i) synthetic controls; (ii) alternative sources of data and models. On the synthetic control subgroup, we point out \cite{carneiro2020lockdown} who adopted an Artificial Counterfactual (ArCo) approach to assess the impacts of the short-run evolution of number of cases (and deaths) in the US. The prediction suggests that, in absence of the restriction measures, the number of cases would be two times larger than observed. On the same line of using synthetic controls, we point out \cite{bayat2020synthetic}, recurring to a synthetic control methodology to analyze the effects of lockdown measures and the potential impact of those policies on the development of the herd immunity. On the other subgroup, we focus on studies that used either machine learning models to assess the non-linearities intrinsic to the projection problem (as in \cite{said2020deep}) or the ones who have used alternative sources of data, as Google Mobility (\cite{gerlee2021predicting}) or large-scale mobility data from telecommunication providers (\cite{schwabe2021predicting} and \cite{vespe2021mobility}). These last papers are somehow related to the alternative data sources that we have adopted for controlling the behavioral channel that is not directly measured by conventional variables. The second group constitutes a larger share of the empirical work and is based on different methodologies to assess the effects of mobility restrictions directly on the evolution of the infection. Based on the availability of Covid-19 infection data, the models are predominantly analyzed in a panel of weekly cases and deaths (to reduce noise effects on daily published data) between or within countries. In terms of methodology, \cite{liu2021panel} suggest the usage of dynamic panel data model to generate forecasts for panel data to capture the inertial elements that affect the infection situation. The authors opt to model the growth rate of the infections, assuming that this variable can be represented by fluctuations around a downward sloping deterministic trend (with a break). This is also the case of \cite{huang2020effective}, where the author also makes use of the growth rate modelling based on counterfactual analysis to find that social distancing intervention is effective in reducing the weekly growth rate by 9.8\% and deaths by 7.0\% at state-level in the United States. Another example of panel estimation is \cite{chen2020works} based on a cross-country panel analysis to evaluate each non-pharmaceutical intervention in terms of reducing the reproduction number. In terms of Brazilian data, \cite{resende2021social} explored a panel-data regression for São Paulo municipalities using labor market dynamics, medical infrastructure and government transfers as controls. The authors found that an increase in 1\% on social distancing reduces infections in 4.14\% in a week and diminishes 2.8\% deaths after two-weeks. Also in terms of country specific effects of mobility restrictions, \cite{vespe2021mobility} evaluate the effects of restriction on mobility in Italy using mobile network operator data and electricity consumption data to assess the impacts of the Covid-19 wave on the ``three-tier" system. Similarly, \cite{barboza2021role} aim to infer the effects of changes on mobility on the dynamics of the transmission of the Covid-19 in Costa Rica while using Google Mobility to evaluate the effects of sanitary measures. There are also some other studies that aim to analyze the effects of mobility due to Covid-19 as \cite{engle2020staying}, the effects of non-pharmaceutical interventions in terms of Covid-19 spread as \cite{kong2020disentangling} and also some country specific analyzes which focus on evaluating the effects on mobility after Covid-19 as \cite{batty2021london} for London, \cite{janiak2021covid} for Chile and \cite{benitez2020responses} for Latin-America Countries. The approach that we have adopted is inserted on the second causal category with some data elements of the prediction group, as we aim to identify how mobility (even in absence of a strict lockdown) affected the infection evolution by recurring to a causal relation framework. We focus on modeling the growth rate of Covid-19 cases and deaths as in \cite{liu2021panel} and \cite{huang2020effective}. Our results are in line with \cite{resende2021social}, but there are three main distinctions in our approach: (i) we model growth rates instead of total number of infections (this avoids the non-stationarity in the infection series due to the high inertial behavior of Covid-19 evolution); (ii) we use national data instead of focusing on a single state analysis; (iii) we adopted soft-data variables to control for non-observable behavioral actions. In terms of our modelling approach, we created a weekly based panel data for all Brazilian municipalities in order to evaluate the effects of restrictions in mobility in terms of effectiveness while affecting the pandemic evolution. Our paper contributes with the ongoing literature of causal identification of mobility effects based on panel-data evaluation by adding unstructured data (Google Trends and News-indexes) in order to generate proxies for non-observable behavioral variables that affects the Covid-19 spread. We considered a sample that comprehends the period of May, 2020 - August, 2021 (significantly wider than the studies that focused on the effects of mobility) and we also conduct a sub-sample analysis to capture only non-vaccination periods to evaluate locally the effects of restrictions to circulation. Estimation results suggest that increasing residential mobility (reducing overall mobility) diminishes significantly the number of cases (from 6.19\% on the first week reaching a 3.02\% reduction in four-weeks) and deaths (reducing 2.47\% in one-week growing to a 6.51\% effect in terms of overall reduction in deaths). For the sub-sample period (2020 only) the effects of reducing mobility are similar to the complete sample analysis, but the effects are accumulated with the effect of workplace mobility in terms of cases (deaths): increasing workplace mobility results in a increase in both cases (about 1\%) and deaths (about 2\%) over the reference horizon. The results have been shown to be robust to variations in terms of mobility variables added on the model, geographical aggregation of cases, vaccination campaign variables and Dynamic Panel specifications. The remainder of this paper is structured in four additional sections. The next section describes the identification strategy, the Direct Acyclic Graphs (DAG) approach, the fixed-effects and dynamic-panel models and all unstructured data that has been created to proxy for non-observable behavioral effects. The third section describes the data. The fourth section describes the estimation results for both all-sample period (2020 and 2021) and only for non-vaccination period (2020 sub-sample). The last section concludes this paper. \section{Identification Strategy} \label{sec:ident} We motivate our identification strategy recurring to a Direct Acyclic Graph (DAG) approach, following \cite{elwert2013graphical}. In Appendix A we provide an introduction to the concept of DAGs. In our specification, we want to estimate the impact of mobility on cases (deaths) due to Covid-19, represented by the $\boldsymbol{\beta}$ coefficient. However, there are many confounding factors that may affect mobility (or even the infection situation) that generates an omitted variable bias problem. To overcome such an issue, we specify carefully some of those factors following our hypothesis regarding the causal relation between the variables. Some prevention measures such as using masks, washing hands and using hand sanitizer may affect the virus infection, i.e. through individual behavior. However, such variable (denoted B, from now on) is non-observable. Therefore, we should include some control variables to capture some of this effect. We use Google Trends searches (gt-series) and News (n-index), both regarding Covid-19 prevention behavior, in order to capture this omitted effect, represented by coefficients $\boldsymbol{\gamma_b}$ and $\boldsymbol{\eta_b}$, respectively. We also include lagged Covid-19 cases (deaths) to capture the lagged effects through tge behavioral channel, inducing a lag structure between Covid-19 spreading over time. In Figure \ref{fig:dag2021} we plot the DAG representing the causal relation between the variables that we adopt in order to identify our model. We then structure the channels that are represented on the DAG of Figure \ref{fig:dag2021} on the following manner: we consider that vaccination may affect number of cases (deaths), mobility and individual behavior (measured through Google Trends and News proxies with respect to Covid-19 related keywords and searches). We also consider that gt-series and n-index should affect only mobility and may not affect the spread of the disease through direct channels. Therefore, we should have that mobility is mainly determined by vaccination and individual behavior (measured by gt-series and n-index). Nonetheless, we consider that Covid-19 spread is determined by mobility, individual behavior and vaccination. However, if we analyze solely the first year of the pandemic (2020), the vaccination variable turns out to be innocuous (as the vaccination only started in Brazil by 2021). Therefore, all the channels that relate vaccination with mobility measures, Google Trends searches and Covid-19 related news disappears from the DAG. The result is the DAG present in Figure \ref{fig:dag2020}. Note that the identification of such model is mainly a reduced form of the overall sample model. After motivating the causal relation that we aim to identify, the econometric specification adopted is straightforward. As we deal with a panel of municipalities at weekly base, we recur to the following functional form: \begin{equation} \ln \left(\frac{Y_{j,t}}{Y_{j,t-1}} \right) \equiv \Delta \ln(Y_{j,t}) = \beta_0 + \boldsymbol{X_{j,t-m}^{\prime}}\boldsymbol{\beta} + \boldsymbol{Z_{j,t}} + \alpha_j + \delta_t + u_{j,t} \label{eq:eqn1} \end{equation} \noindent where: \begin{equation*} \boldsymbol{Z_{j,t}} = \displaystyle\sum_{h = 1}^{4}\phi_h\ln \left(\frac{Y_{j,t-h}}{Y_{j,t-h-1}}\right) + \boldsymbol{GT_{j, t-m}^{\prime}}\boldsymbol{\gamma} + \boldsymbol{N_{j,t-m}^{\prime}}\boldsymbol{\eta} + \boldsymbol{V_{j,t-m}}\boldsymbol{\nu} \end{equation*} \noindent where $\beta_0, \boldsymbol{\beta}, \boldsymbol{\phi}, \boldsymbol{\gamma}, \boldsymbol{\eta}, \boldsymbol{\nu}, \alpha_j \text{ and } \delta_t $ are parameters to be estimated. Note that $\boldsymbol{\gamma} = (\boldsymbol{\gamma_g}, \boldsymbol{\gamma_b})$ and $\boldsymbol{\eta} = (\boldsymbol{\eta_g}, \boldsymbol{\eta_b)}$ representing gt-series and n-index channels through general Covid-19 related searches or news (g) and through proxies for non-observable behavioral effects (b), respectively. The indexes $j \in \{1, \cdots, 5570\}$ represents municipalities, $t \in \{1, \cdots, 67\}$ is a weekly time-index and $m \in \{1,2,3,4\}$ is the lag structure that we impose over the regressors of the model\footnote{The lag structure is important to capture delayed effects of model's variables in terms of Covid-19 spreading.}. Also, $\alpha_j$ is an individual fixed-effect whereas $\delta_t$ is a time fixed-effect. The constant $\beta_0$ represents a common trend trajectory for all municipalities\footnote{All estimations include an intercept due to the normalization adopted by Stata. Instead of setting the intercept equal to zero, the program adopts the following normalization: \begin{equation*} \sum_{i = 1}^{N} \sum_{t=t_0}^{T} (\beta_0 + \alpha_i) = 0 \end{equation*}}. In terms of estimation, we impose an within transformation with respect to each municipality and we include time-dummies to capture heterogeneous time-effects throughout time. As robustness check, We also estimate the model using a Dynamic Panel structure (Arellano-Bond transformation with four lags) to capture the effects induced by the inclusion of lagged dependent variables in terms of lag structure, considering the inertial behavioral spreading channel. Finally, the coefficients associated with mobility and vaccination represents elasticities, i.e. relates the effects of a one percentage change on mobility with the effects over the growth rate of Covid-19 cases (deaths). The coefficients associated with gt-series and the n-index represents semi-elasticities, as they relates the effects of one additional search (or news) with its associated growth-rate effects on Covid-19 spread. \section{Data} \label{sec:data} \par There are mainly two types of data (labeled as ``hard data" and ``soft data" from now on) that have been used to estimate our model. The main distinction between them is that the first set is disposed in an objective/highly organized format, whereas the second type relates subjective data that could (e.g. Google Trends) or not (e.g. News-Index) have been organized earlier. Soft data relies on text-related data (unstructured) based on counting measures (structured). The first set of hard indicators is the number of cases and deaths by Covid-19, which constitutes our dependent variables. Those have been extracted from SRAG data\footnote{SRAG is the acronym for ``Vigilância de Síndrome Respiratória Aguda Grave", which consolidates all data related to harsh respiratory syndrome in Brazil, including Covid-19, for 2020 and 2021. Note that SRAG data only consider patients that effectively enter on hospitals due to a respiratory syndrome and therefore does not represents mild cases.} disposable at the OpenDataSUS website\footnote{OpenDataSUS is an initiative of the Ministry of Health of Brazil.}. The main difference between the construction of Covid-19 cases and deaths series regards the filtering date: for number of cases we have set the first symptom date as reference for aggregation, whereas for number of deaths we set the obit date as reference. In both cases we construct series at the municipality level based on the residence and notification area of the Covid-19 cases (deaths). Such distinction produces different aggregations as they constitute different hypothesis in terms of disease contamination process. In Figure \ref{fig:comp} we compare the effects of different types of date aggregation for number of cases and deaths. The next set of hard indicators comprehends mobility measures that constitute the object of interest in our estimations. These variables are break down in six mobility categories (workplace, residential, parks, transit, grocery and retail)\footnote{Residence mobility is measured in time spent in-locus, whereas the other five categories are measured in terms of number of visitors.} and compared to the 5‑week baseline period of Jan 3 – Feb 6, 2020, in terms of percentage change. We extract mobility data from the Covid-19 Community Mobility Reports from Google. Regarding controls, we start by extracting vaccination hard-data regarding timing and immunization type (first or second dose) also from the OpenDataSUS website, which comprehends data at the individual level. As a robustness check, we also collect vaccination from the SRAG data set. The two data sets differs as the first considers the national vaccination campaign, whereas the second considers individuals that are actually inside the SRAG accounting. Both types of vaccination variables are consolidated into a weekly-based period at the municipality level. The other two variables, Google Trends and News-Index (gt-series and n-index), constitutes our set of soft-controls. Google Trends data have been extracted using the Google Trends API and reveals the number of searches of a given topic for a certain period. News-Index data has been generated based on news collected from G1\footnote{G1 is a local newspaper that belongs to Grupo Globo.} that possess an in-depth coverage of Covid-19 in Brazil\footnote{Only Covid-19 related news constitutes about 142,697 for the period of May 1, 2020 - August 1, 2021. The advantage of considering G1 news is that they are divided into sub-regions, i.e. news-data is locally stamped at the state level.}. These two set of controls relies on a subjective categorization of search terms and keywords selection that needs to be specified in order to generate data-series for our estimates. The formulation of the indexes and the categories/keywords are presented in Appendix B. Finally, we constitute a weekly base panel data at Municipality level\footnote{Only soft data controls as Google Trends and our News-Index are disposed at State Level, whereas all other variables are disposed in more granular Municipality level} starting on May 3, 2020 up to August 1, 2021\footnote{Two important points: (i) We start (May, 2020) and end our reference panel (August, 2021) to avoid issues regarding both tail data problems or post-publication of statistics from the government, i.e. lack of update of vintages; (ii) the panel data covers a full-week period starting by Monday of a reference week ending at Sunday of the same week.}. Table \ref{tab:stats} and \ref{tab:corr} includes the descriptive statistics and correlation matrix, respectively, for all series used on our estimate. \section{Results} \label{sec:result} The results of the estimations are divided into two different sections. The first sub-section analyses the effects of mobility over Covid-19 cases (deaths) through all sample (2020-2021), whereas the second sub-section restricts our model to the sub-sample period of 2020. In both cases, restrictions in mobility tends to display relevant impact on the evolution of the Covid-19 infection rate. To estimate Equation (\ref{eq:eqn1}), we need to make a consideration regarding the number of lags $m \in \{1,2,3,4\}$ used on our specification. In terms of Covid-19 cases, it is known that the average number of days taken up to the first symptom is about five days (see \cite{cintra2020estimative}). Therefore, inside the 5-days window, the individual may spread the virus without knowing about his infection situation. In terms of deaths, we computed the median number of days taken from the first symptom to obit, represented in Figure \ref{fig:death}. The results suggest that, in the SRAG sample, the median is about seventeen days (third week), while the minimum is about eight days (second week) and the maximum is twenty two days (fourth week). As we consider weekly windows, the horizon that we may consider for cases is from one to four weeks (a month) after the infection and two up to four weeks (a month) for deaths. Regarding mobility, Table \ref{tab:stats} reveals that only workplace mobility is present in all municipalities that are available in Google's Mobility website. Coming after workplace, residential mobility is also present in a high share overall municipalities. This is not the case for the the other four mobility measures. This generates a higher probability of measurement errors and missing observations in a non-random form. We therefore choose to run the regressions only on the first two measures to obtain a cleaner specification. We also present a full model with all six mobility measures and the results that we find are robust to this inclusion. \subsection{Complete Sample Estimation: 2020 and 2021} The estimation results are displayed on Table \ref{tab:res2021}, based on fixed-effects estimations for Covid-19 cases (columns 1 to 4) and deaths (columns 5 to 8). In each column, we highlight the number of lags $m$ growing from $m = 1$ up to $m = 4$ weeks for cases and from $m=2$ to $m=4$ for deaths. The coefficient of interest is the residential and workplace mobility, as they are associated with the highest number of observations for municipalities. The first important result is that increasing residential mobility (i.e. decreasing overall mobility) reduces the growth rate of both number of infections and deaths through the sample. The impact over Covid-19 cases is higher over the first reference week, where it diminishes cases at a 6.19\% rate, and slowly decreases through the 4-week window, reaching 3.02\% after one month. Regarding Covid-19 deaths, we also observe that reducing mobility affects negatively the growth rate of deaths. However, this effect grows from 2.47\% reaching 6.51\% at a month horizon. If we consider that this effect can be combined week-by-week (inducing an over-estimate of the overall effect) we can determine that the overall (maximum) upper bound effect of a 1\% decrease in mobility results in a reduction of 20.83\% in cases and a reduction in 14.35\% in deaths, both at a one-month horizon. The vaccination, gt-series and n-index controls displays important role while capturing the effects suggested on the DAGs. This is also observable with the inertial behavior that seems to be captured on the coefficients associated with the lagged dependent variables. The overall R-squared is at least 18\% for cases and 23\% for deaths (higher explanatory power), and the F-test rejects the null hypothesis that all coefficients are zero for all estimates. All lagged dependent variables display negative inertial effect on the evolution of both cases and deaths. On Appendix C we display first stage estimations with the objective of validating the DAG channels presented on Figure \ref{fig:dag2021} assumptions displayed on Section \ref{sec:ident}. In Table \ref{tab:1stage} we display estimation results of mobility against gt-series, n-index and lagged dependent variables and we find high associated R-squared and null rejection of F-test. Table \ref{tab:vac/cases} relates cases (deaths) regression against vaccination campaign, finding mostly negative coefficients as expected. Table \ref{tab:vac/mob} relates mobility with the national vaccination campaign and with SRAG vaccination, finding high associated R-squared. It is important to notice that the SRAG data has higher explanatory power, but only consider vaccination on individuals inside the SRAG data set, which is restrictive in terms of causal determination. We also display a regression with all six mobility measures on Appendix D. The results present in Table \ref{tab:moball} suggests some ambiguity: transit and grocery seems to display a negative impact on the growth rate of cases and deaths. We do not take these estimated coefficients as pure effects due to: (i) lack of observations in smaller counties; (ii) the effects are smaller than 0.5\%, to little to be tacking into account. Additionally, Appendix D display three different estimation outputs. Table \ref{tab:not2021} uses notification area instead of residence place while aggregating Covid-19 cases (deaths). The results are similar to the ones that has been founded using residence area. Table \ref{tab:vac} uses SRAG vaccination data (log of vaccines for SRAG) instead of national campaign vaccination data (that comprehends first and second dose breakdown), with similar results. Finally, Table \ref{tab:dynpan} uses a Dynamic-Panel (Arellano-Bond with four lags) methodology (in line with \cite{liu2021panel}) to estimate recursively the effects of the lagged variable impact over the dependent variable and the residential mobility estimates still reveals a negative sign and with decaying (increasing) effects for cases (deaths). \subsection{Sub-sample Estimation: 2020} This section has the objective of estimating the impact of mobility on Covid-19 cases (deaths) only at the first year of the Covid-19 pandemic. By limiting the sample solely for 2020, we can redefine the causal relation that we aim to identify as the vaccination only started in 2021. This results on the DAG that is presented on Figure \ref{fig:dag2020}, in which we remove the vaccination node and solely focus on mobility-related variables. The estimation results are presented on Table \ref{tab:res2020} and two effects are directly observable: (i) the negative sign associated with residential mobility is still present; (ii) workplace mobility displays an important role while explaining number of cases (deaths) due to Covid-19 spread. The magnitude of the effects of reducing mobility and growth rate of number of cases is still on the order of 5.04\% on a first-week horizon, decreasing to 4.08\% at a month. For deaths, this effect frows from 3.31\% over two weeks up to 6.25\% after a month. The effects of increasing mobility, however, tends to increase over the estimation window for both cases and deaths growth rate, oscillating positively around 1-2\%. By recurring to the same exercise of combining the effects in order to generate an upper bound for mobility effects, we can check that a 1\% mobility increase for workplace generates a similar 20.73\% and 16.36\% reduction for cases and deaths, respectively. There is however the effect of the reduction on workplace mobility, that a 1\% decrease can combined generate a 4.8\% and 6.07\% decrease in cases and deaths, respectively. In Appendix D we also display Dynamic-Panel estimates for the 2020 sub-sample and the coefficients still presents compatible magnitudes to the ones observed in Table \ref{tab:res2020}. \section{Conclusion} \label{sec:conclusion} In this paper we aimed in developing an empirical framework to be able to address the questions related to causal effects of mobility restrictions in terms of Covid-19 infections. By recurring to a DAG approach, we developed causal channels that required the design of ``soft-data" proxies to capture non-observable effects of individuals, as prevention measures. The methodology adopted to estimate the effects is in line with the panel-data estimates by \cite{liu2021panel} and \cite{huang2020effective} with even similar dimensions in terms of the mobility elasticity sizes: a 1\% reduction in mobility (through an increase in residential mobility) reduces cases and deaths in a one-month horizon for both 2020-2021 sample and 2020-only. The combined upper bound effect is around a 20\% reduction for cases and 15\% reduction for deaths. There are some limitations in our analysis based on potential non-linearities on the effect of vaccination over mobility: vaccines can induce higher or lower mobility depending on the overall vaccination campaign or even on the Covid-19 infection level. We therefore avoid interpreting vaccination related coefficients as they can be misleading. The same happens while analyzing other mobility coefficients, due to the intrinsic measurement error in those variables. Finally, the paper suggests that restricting mobility is able to reduce the number of cases and deaths with particular robustness throughout sample and methodological evaluation. The objective of developing a causal framework based on DAGs is sustained by the estimation outputs and the mobility effects are solely determined by the causal hypothesis. \newpage \singlespacing \setlength\bibsep{0pt} \bibliographystyle{plainnat}
\section{The geometry of the special fiber of the unitary Rapoport-Zink space of signature $(1,n-1)$} \paragraph{}We consider the Rapoport-Zink space $\mathcal M$ associated to an unramified unitary PEL datum with signature $(1,n-1)$ ; we refer to \cite{vw1} and \cite{vw2} for the precise definitions. It is a separated formal scheme over $\mathrm{Spf}(\mathbb Z_{p^2})$ which is formally locally of finite type. Because the associated PEL datum is unramified, the space $\mathcal M$ is also formally smooth. The reduced special fiber of $\mathcal M$ is the reduced closed $\mathbb F_{p^2}$-scheme $\mathcal M_{\mathrm{red}}$ defined by the ideal of locally topologically nilpotent elements. By \cite{RZ} Proposition 2.32, each irreducible component of $\mathcal M_{\mathrm{red}}$ is projective. The geometry of the special fiber $\mathcal M_{\mathrm{red}}$ has been thoroughly described by Vollaard and Wedhorn, and we shall recall a few of their constructions. \paragraph{}While the space $\mathcal M$ is defined by classifying $p$-divisible groups with additional structures, one may use (covariant) Dieudonné theory in order to describe the rational points of $\mathcal M$ and of $\mathcal M_{\mathrm{red}}$ defined over any perfect field extension $k$ of $\mathbb F_{p^2}$. By doing so, one shifts to a problem involving linear algebra which we now explain.\\ Let $\mathbf V$ be an $n$-dimensional $\mathbb Q_{p^2}$-vector space equipped with a nondegenerate $\sigma$-hermitian form $\{\cdot,\cdot\}$. By a lattice in $\mathbf V$, we will always mean a free finitely generated $\mathbb Z_{p^2}$-submodule containing a basis of $\mathbf V$. Given two lattices $M_1$ and $M_2$, the notation $M_1 \overset{d}{\subset} M_2$ means that $M_1\subset M_2$ and the quotient module $M_2/M_1$ has length $d$. The integer $d$ is called the \textbf{index} of $M_1$ in $M_2$, and is denoted $d = [M_2:M_1]$. We have $0\leq d \leq n$. Given a lattice $M\subset \mathbf V$, the dual lattice is denoted $M^{\vee}$. It consists of all vectors $v\in \mathbf V$ such that $\{v,M\}\subset \mathbb Z_{p^2}$. We make the assumption that there exists a lattice $\mathbf M$ such that $$p\mathbf M^{\vee} \overset{1}{\subset} \mathbf M \overset{n-1}{\subset} \mathbf M^{\vee}.$$ Let $\mathbb X$ be the supersingular $p$-divisible group over $\mathbb F_{p^2}$ whose deformations are classified by the moduli space $\mathcal M$. We may relate $\mathbf M$ and $\mathbf V$ to $\mathbb X$ in the following way. Let $N$ denote the isocristal of $\mathbb X$ and $M\subset N$ its Dieudionné module. Then $N$ is a $\mathbb Q_{p^2}$-vector space of dimension $2n$ equipped with an action of the Frobenius $\mathbf F$ and the Verschiebung $\mathbf V$, and $M$ is a stable $\mathbb Z_{p^2}$-lattice. The additional structures on $\mathbb X$ (that is, the PEL datum which stands for Polarization, Endomorphism action and Level structure) induce a non-degenerated symplectic form $\langle \cdot , \cdot \rangle$ on the isocristal $N$ for which $M$ is autodual, as well as a Hodge decomposition \begin{align*} N = N_0 \oplus N_1 & & M = M_0 \oplus M_1. \end{align*} This is a $\mathbb Z/2\mathbb Z$-grading with respect to the action of the Frobenius and the Verschiebung. For $i = 0$ or $1$, the module $M_i$ is a $\mathbb Z_{p^2}$-lattice in $N_i$. The spaces $N_0$ and $N_1$ (resp. the modules $M_0$ and $M_1$) are totally isotropic and dual of each other. By equipping $N_0$ with the form $\{\cdot,\cdot\} := \theta \langle \cdot , \mathbf F \cdot \rangle$ where $\theta \in \mathbb Z_{p^2}^{\times}$ is some scalar such that $\sigma(\theta) = -\theta$, it becomes a non-degenerated $\mathbb Q_{p^2}$-hermitian space of dimension $n$. Then, the hermitian space $\mathbf V$ that we defined together with the lattice $\mathbf M$ can be identified with $N_0$ together with $M_0$.\\ The existence of such a lattice $\mathbf M$ in $\mathbf V$ implies that the $\sigma$-hermitian structure over $\mathbb Q_{p^2}$ on $\mathbf V$ is isomorphic to any one described by the following two matrices $$T_{\text{odd}}:= \left(\begin{matrix} & & & 1 \\ & & \iddots & \\ & \iddots & & \\ 1 & & & \\ \end{matrix}\right) \quad \quad T_{\text{even}}:= \left(\begin{matrix} p & & & \\ & & & 1 \\ & & \iddots & \\ & 1 & & \\ \end{matrix} \right) .$$ \begin{prop}[(\cite{vw1} 1.15)] There exists a basis of $\mathbf V$ such that $\{\cdot,\cdot\}$ is represented by the matrix $T_{\text{odd}}$ is $n$ is odd, and by $T_{\text{even}}$ if $n$ is even. \end{prop} \paragraph{}Given a perfect field extension $k$ over $\mathbb F_{p^2}$, we denote by $\mathbf V_k$ the base change $\mathbf V \otimes_{\mathbb Q_{p^2}} W(k)_{\mathbb Q}$. The form may be extended to $\mathbf V_k$ by the formula $$\{v\otimes x,w\otimes y\} := xy^{\sigma}\{v,w\}\in W(k)_{\mathbb Q}$$ for all $v,w\in \mathbf V$ and $x,y\in W(k)_{\mathbb Q}$. The notions of index and duality for $W(k)$-lattices can be extended as well. We have the following description of the rational points of the Rapoport-Zink space. \noindent \begin{prop}[(\cite{vw1} 1.10)] Let $k$ be a perfect field extension of $\mathbb F_{p^2}$. There is a natural bijection of $\mathcal M(k) = \mathcal M_{\mathrm{red}}(k)$ with the set of lattices $M$ in $\mathbf V_k$ such that for some integer $i\in \mathbb Z$, we have $$ p^{i+1}M^{\vee} \overset{1}{\subset} M \overset{n-1}{\subset} p^i M^{\vee} .$$ \end{prop} \paragraph{}There is a decomposition $\mathcal M = \bigsqcup_{i\in \mathbb Z} \mathcal M_i$ into formal subschemes which are open and closed. The rational points of $\mathcal M_i$ are those lattices $M$ satisfying the relation above with the given integer $i$. Similarly, we have a decomposition into open and closed subschemes $\mathcal M_{\mathrm{red}} = \bigsqcup_{i\in \mathbb Z} \mathcal M_{i,\mathrm{red}}$. In particular, the lattice $\mathbf M$ defined in the previous paragraph is an element of $\mathcal M_0(\mathbb F_{p^2})$.\\ Not all integers $i$ can occur though, as a parity condition must be satisfied by the following lemma. \noindent \begin{lem}[(\cite{vw1} 1.7)] The formal scheme $\mathcal M_i$ is empty if $ni$ is odd. \end{lem} \paragraph{}Let $J = \mathrm{GU}(\mathbf V)$ be the group of unitary similitudes attached to $\mathbf V$. It consists of all linear transformations $g$ which preserve the hermitian form up to a unit $c(g)\in \mathbb Q_{p}$, called the \textbf{multiplier}. One may think of $J$ as the group of $\mathbb Q_p$-rational point of a reductive algebraic group. The space $\mathcal M$ is endowed with a natural action of $J$. At the level of points, the element $g$ acts by sending a lattice $M$ to $g(M)$.\\ By \cite{vw1} 1.16, the action of $g\in J$ induces, for every integer $i$, an isomorphism $\mathcal M_i \xrightarrow{\sim} \mathcal M_{i+\alpha}$ where $\alpha$ is the $p$-adic valuation of the multiplier $c(g)$. According to 1.17 in loc. cit. the integer $\alpha$ can take any value if $n$ is even, and only even values if $n$ is odd. Combining with the previous lemma, we obtain the following statement. \noindent \begin{prop}[(\cite{vw1} 1.18)] The formal scheme $\mathcal M_i$ is empty if and only if $ni$ is odd. If $i$ and $i'$ are two integers such that both $ni$ and $ni'$ are even, then there exists an element $g\in J$ whose action induces an isomorphism $\mathcal M_i \xrightarrow{\sim} \mathcal M_{i'}$. Moreover, if the integers $i$ and $i'$ share the same parity, then $g$ can be taken in the center of $J$. \end{prop} \noindent The same statement also holds for the special fiber $\mathcal M_{\mathrm{red}}$. \paragraph{}A classification of all unitary Dieudonné spaces of signature $(1,n-1)$ is obtained in \cite{bw} 3.6. It leads to the definition of the \textbf{Ekedahl-Oort stratification} on $\mathcal M_{\mathrm{red}}$, as explained in \cite{vw2} 3.3. For $0\leq \theta \leq m$, there is a locally closed subscheme $\mathcal M_{\mathrm{red}}(2\theta+1)$ that is locally of finite type and smooth. Moreover, if $k$ is any perfect field extension of $\mathbb F_{p^2}$, then we have a decomposition $$\mathcal M_{\mathrm{red}}(k) = \bigsqcup_{0\leq \theta \leq m} \mathcal M_{\mathrm{red}}(2\theta +1)(k).$$ The Ekedahl-Oort stratification is compatible with the individual $\mathcal M_{i,\mathrm{red}}$, and subsequently defines a stratification on each of them. \paragraph{}To give a concrete description of the points in a given stratum, one needs the notion of \textbf{superspecial gap} as defined in \cite{vw2} 3.4. Given a perfect field extension $k$ of $\mathbb F_{p^2}$, let $\tau = \sigma^2\cdot \mathrm{id}$ denote the $\mathbb Q_{p^2}$-linear automorphism of $\mathbf V_k$ acting by applying $\sigma^2$ to the scalars in $W(k)_{\mathbb Q}$. If $k = \mathbb F_{p^2}$, then $\tau$ is just the identity. Given a lattice $M$ in $\mathbf V_k$, we have $(M^{\vee})^{\vee} = \tau(M)$ which may be different from $M$ in general. We use the following notation $$\Lambda^+(M) := \sum_{l \geq 0} \tau^{l}(M).$$ Then $\Lambda^+(M)$ is a lattice in $\mathbf V_k$ which is stable by $\tau$. The \textbf{superspecial gap} of $M$ is defined as the lattice index $\sigma(M) = [\Lambda^+(M):M]$. It is invariant under field extension. The following proposition sums up the properties of the superspecial gap. \noindent \begin{prop}[(\cite{vw1} 2.1)] The integer $\sigma(M)$ is the least integer $d$ such that the lattice $\sum_{l=0}^{d} \tau^l(M)$ is stable by $\tau$. We have the inequality $$0\leq \sigma(M) \leq m.$$ Moreover, if $i\in \mathbb Z$ is such that $M \in \mathcal M_{i,\mathrm{red}}(k)$, then we have the following chain of inclusions $$p^{i+1}(\Lambda^+(M))^{\vee}\subset p^{i+1}M^{\vee} \overset{1}{\subset} M \overset{\sigma(M)}{\subset} \Lambda^+(M) \overset{n-2\sigma(M)-1}{\subset} p^{i}(\Lambda^+(M))^{\vee} \subset p^iM^{\vee}.$$ Eventually, the index $[p^{i+1}(\Lambda^+(M))^{\vee}:\Lambda^+(M)]$ equals $2\sigma(M)+1$. \end{prop} \noindent The name "superspecial gap" is a reference to the superspecial lattices in \cite{vw1}. A lattice in $\mathcal M_{red}(k)$ is called superspecial if it is stable under $\tau$. This happens if and only if the gap is zero. \noindent \begin{theo}[(\cite{vw2} Theorem 3.4)] Let $k$ be a perfect field extension of $\mathbb F_{p^2}$ and $M\in \mathcal M_{\mathrm{red}}(k)$. We have $M\in \mathcal M_{\mathrm{red}}(2\theta +1)(k)$ if and only if $\sigma(M) = \theta$. \end{theo} \paragraph{}The next construction we need to recall from \cite{vw2} 4. is that of the Bruhat-Tits stratification on the special fiber. Let $i\in\mathbb Z$ such that $ni$ is even. We define $$\mathcal L_i := \{\Lambda\subset \mathbf V \text{ a lattice}\,|\, p^{i+1}\Lambda^{\vee}\subsetneq \Lambda \subset p^i\Lambda^{\vee}\}.$$ If $\Lambda\in \mathcal L_i$, we define its \textbf{orbit type} $t(\Lambda):= [\Lambda:p^{i+1}\Lambda^{\vee}]$. In particular, the lattices in $\mathcal L_i$ of orbit type $1$ are precisely the $\mathbb F_{p^2}$-rational points of $\mathcal M_{i,\mathrm{red}}$. \noindent \begin{prop}[(\cite{vw1} Remark 2.3)] The orbit type $t(\Lambda)$ of a lattice $\Lambda\in \mathcal L_i$ is always an odd integer between $1$ and $n$. \end{prop} \noindent By sending $\Lambda$ to $g(\Lambda)$, an element $g\in J$ defines a bijective map $\mathcal{L}_i\xrightarrow{\sim} \mathcal{L}_{i+\alpha}$ where $\alpha$ is the $p$-adic valuation of the multiplier of $g$. It is an order-preserving, type-preserving bijection, see \cite{vw1} 2.3.\\ For any integer $i$ such that $ni$ is even and any odd number $t$ between $1$ and $n$, there exists a lattice $\Lambda\in \mathcal L_i$ of orbit type $t$. Indeed, by fixing a bijection $\mathcal{L}_i \xrightarrow{\sim} \mathcal{L}_0$ it is enough to find such a lattice for $i=0$, and one can easily be constructed using a basis in which the hermitian form is described as in \textbf{1.2}. \paragraph{}With the help of $\mathcal L_i$, one may construct an abstract simplicial complex $\mathcal B_i$. For $s\geq 0$, an $s$-simplex of $\mathcal B_i$ is a subset $S\subset \mathcal L_i$ of cardinality $s+1$ such that for some ordering $\Lambda_0,\ldots ,\Lambda_s$ of its elements, we have a chain of lattices $p^{i+1}\Lambda_0^{\vee}\subsetneq \Lambda_0 \subsetneq \Lambda_1 \subsetneq \ldots \subsetneq \Lambda_s$. We must have $0\leq s \leq m$ for such a simplex to exist.\\ We introduce $\tilde{J} = \mathrm{SU}(\mathbf V)$, the derived group of $J$. It acts on $\mathcal L_i$ by mapping any $\Lambda$ to $g(\Lambda)$. In fact, two lattices in $\mathcal L_i$ share the same orbit type if and only if they lie in the same $\tilde{J}$-orbit, see \cite{vw1} 1.14. \\ We consider the abstract simplicial complex $\mathcal B(\tilde J,\mathbb Q_p)$ of the Bruhat-Tits building of $\tilde{J}$. A concrete description of this complex is given in \cite{vw1}, while proving the following theorem. \noindent \begin{theo}[(\cite{vw1} 3.5)] The abstract simplicial complex $\mathcal B(\tilde J,\mathbb Q_p)$ of the Bruhat-Tits building of $\tilde J$ is naturally identified with $\mathcal B_i$ for any fixed integer $i$ such that $ni$ is even. There is in particular an identification of $\mathcal L_i$ with the set of vertices of $\mathcal B(\tilde J,\mathbb Q_p)$. The identification is $\tilde J$-equivariant. \end{theo} \paragraph{}Given a lattice $\Lambda\in \mathcal L_i$, the authors of \cite{vw2} define a subfunctor $\mathcal M_{\Lambda}$ of $\mathcal M_{i,\mathrm{red}}$ classifying those $p$-divisible groups for which a certain quasi-isogeny, depending on $\Lambda$, is in fact an actual isogeny. In Lemma 4.2, they prove that it is representable by a projective scheme over $\mathbb F_{p^2}$, and that the natural morphism $\mathcal M_{\Lambda} \hookrightarrow \mathcal M_{i,\mathrm{red}}$ is a closed immersion. The schemes $\mathcal M_{\Lambda}$ are called the \textbf{closed Bruhat-Tits strata of $\mathcal M$}. Their rational points are described as follows. \noindent \begin{prop}[(\cite{vw2} Lemma 4.3)] Let $k$ be a perfect field extension of $\mathbb F_{p^2}$, and let $M\in \mathcal M_{i,\mathrm{red}}(k)$. Then we have the equivalence $$M\in \mathcal M_{\Lambda}(k) \iff M \subset \Lambda_k := \Lambda \otimes_{\mathbb Z_{p^2}} W(k).$$ \end{prop} \noindent The set of lattices satisfying the condition above was conjectured in \cite{vw1} to be the set of points of a subscheme of $\mathcal M_{i,\mathrm{red}}$, and it was proved in the special cases $n=2,3$. In \cite{vw2}, the general argument is given by the construction of $\mathcal M_{\Lambda}$. \paragraph{}One may relate the notions of superspecial gap and of orbit type together. Let $k$ be a perfect field extension of $\mathbb F_{p^2}$ and $M\in \mathcal M_{i,\mathrm{red}}(k)$. The fact that $\Lambda^+(M)$ is stable by $\tau$ implies that it can be expressed as $\Lambda \otimes_{\mathbb Z_{p^2}} W(k)$ for some lattice $\Lambda\subset \mathbf V$. As the lattice index is invariant under field extension, \textbf{1.7} implies that $\Lambda \in \mathcal L_i$ and has orbit type $t(\Lambda)=2\sigma(M)+1$. Thus, we have $M\in \mathcal M_{\Lambda}(k)$. \section{Generalized Deligne-Lusztig varieties and the isomorphism with the closed Bruhat-Tits strata} \paragraph{}One of the main result in \cite{vw2} is the construction of an isomorphism between $\mathcal M_{\Lambda}$ and a \enquote{generalized} Deligne-Lusztig variety. Let us recall how such varieties are constructed, following the notations of \cite{bonnafe}. In this section, let $q$ denote a power of the prime number $p$.\\ Let $\mathbf G$ be a reductive group defined over an algebraic closure $\overline{\mathbb F_q}$ of $\mathbb F_{q}$. Let $F$ be a Frobenius morphism defining an $\mathbb F_q$-structure on it. If $\mathbf P$ is any parabolic subgroup of $\mathbf G$, we may consider the generalized parabolic Deligne-Lusztig variety $$X_{\mathbf P} := \{g\mathbf P\in \mathbf G/\mathbf P\,|\,g^{-1}F(g)\in \mathbf P F(\mathbf P)\}.$$ When these varieties were first introduced in \cite{dl} only the case of Borel subgroups was considered, hence the adjective \enquote{parabolic}. Moreover, parabolic Deligne-Lusztig varieties have mostly been studied with the additional assumption that $\mathbf P$ contains an $F$-stable Levi complement, see for instance \cite{dm}. This is not required by the definition above, hence the adjective \enquote{generalized}. \paragraph{}One may give another description of these varieties by fixing a pair $(\mathbf T,\mathbf B)$ consisting of a maximal torus $\mathbf T$ contained in a Borel subgroup $\mathbf B$, both of them being $F$-stable. Such a pair always exists up to $G=\mathbf G^F$-conjugation. We then obtain a Coxeter system $(\mathbf W,\mathbf S)$ on which $F$ acts, where $\mathbf W = \mathbf W(\mathbf T)$ is the Weyl group attached to $\mathbf T$ and $\mathbf S$ is the set of simple reflexions. This Coxeter system along with its action of $F$ can be identified with \textit{the} Weyl group of $\mathbf G$, as defined in \cite{dl}. For $I\subset \mathbf S$, we consider $\mathbf P_I$ the standard parabolic subgroup of type $I$, and we denote by $\mathrm{Par}_I$ the variety classifying the conjugates of $\mathbf P_I$. We have a natural identification with the flag variety $\mathrm{Par}_I\simeq \mathbf G/\mathbf P_I$. We also denote by $\mathbf W_I$ the subgroup of the Weyl group generated by $I$. For $I,I'\subset \mathbf S$ we have the generalized Bruhat decomposition $$\mathbf P_I\backslash \mathbf G / \mathbf P_{I'} = \bigsqcup_{w\in\, ^I\mathbf W^{I'}} \mathbf P_I\backslash \mathbf P_Iw\mathbf P_{I'}/\mathbf P_{I'} \simeq \mathbf W_{I}\backslash \mathbf W / \mathbf W_{I'}.$$ Here, we denote by $^I\mathbf W^{I'}$ the set of elements $w\in \mathbf W$ which are $(I,I')$-reduced, and this is identified with the double coset space $\mathbf W_{I}\backslash \mathbf W/ \mathbf W_{I'}$. Therefore, the variety $\mathrm{Par}_I\times \mathrm{Par}_{I'}$ is the disjoint union of the orbits $\mathcal O_{I,I'}(w)$ of pairs $(\mathbf P_I,^w\mathbf P_{I'})$ for the $\mathbf G$-conjugation, where $w\in\,^I\mathbf W^{I'}$.\\ We let $\mathcal O_I(w):=\mathcal O_{I,F(I)}(w)$ for $w\in\, ^I\mathbf W^{F(I)}$. The generalized parabolic Deligne-Lusztig varieties may be defined in the following way. \begin{align*} X_I(w) := & \{\mathbf P\in \mathrm{Par}_I \, | \, (\mathbf P,F(\mathbf P))\in \mathcal O_I(w)\}\\ = & \{g\mathbf P_I\in \mathbf G/\mathbf P_I \,|\, g^{-1}F(g)\in \mathbf P_IwF(\mathbf P_I)\} \end{align*} Remark 1 in \cite{bonnafe} explains how to go from to definition to the other. With this description, the additional assumption in \cite{dm} translates into the equation $w^{-1}Iw = F(I)$, which is a sort of compatibility condition between the parameters $w$ and $I$. \paragraph{}The variety $X_I(w)$ is defined over $\mathbb F_{q^{\iota}}$, where $\iota$ is the least integer such that $F^{\iota}(I) = I$ and $F^{\iota}(w) = w$. It is the intersection of $\mathcal O_I(w)$ with the graph of the Frobenius morphism in $\mathrm{Par}_I\times \mathrm{Par}_{F(I)}$. This is a transversal intersection, hence it gives the following dimension formula as stated in \cite{vw2} 4.4. $$\dim X_I(w) = l(w) + \dim \mathrm{Par}_{I\cap F(I)} - \dim \mathrm{Par}_I.$$ Here, $l(w)$ denotes the length of $w$ with respect to the set of simple reflexions $\mathbf S$. \paragraph{}Let us fix $i\in \mathbb Z$ such that $ni$ is even and $\Lambda \in \mathcal L_i$. We now introduce the Deligne-Lusztig variety which will turn out to be isomorphic to $\mathcal M_{\Lambda}$. We define $V_{\Lambda}:= \Lambda/p^{i+1}\Lambda^{\vee}$. Because $p\Lambda \subset p\cdot p^i\Lambda^{\vee}$, this is an $\mathbb F_{p^2}$-vector space of dimension $t(\Lambda) = 2\theta + 1$. It comes together with a non-degenerate $\sigma$-hermitian form $(\cdot,\cdot)$, induced by $p^{-i}\{\cdot,\cdot\}$. This hermitian structure over $\mathbb F_{p^2}$ is unique up to isomorphism. If $k$ is a perfect field extension of $\mathbb F_{p^2}$, we may extend the pairing to $(V_{\Lambda})_k = V_{\Lambda}\otimes_{\mathbb F_{p^2}} k$ by setting $$(v\otimes x,w\otimes y):=xy^{\sigma}(v,w)\in k$$ for all $v,w\in V_{\Lambda}$ and $x,y\in k$. If $U$ is a subspace of $(V_{\Lambda})_k$ we denote by $U^{\#}$ its orthogonal, that is the subspace of all vectors $x\in (V_{\Lambda})_k$ such that $(x,U)=0$. Thus, if $\tau$ denotes the $\mathbb F_{p^2}$-linear automorphism $\sigma^2\cdot \mathrm{id}$ of $(V_{\Lambda})_k$ then we have the identity $(U^{\#})^{\#} = \tau(U)$, which may be different from $U$ in general similarly to \textbf{1.7}. \paragraph{}We let $\widetilde{J}_{\Lambda}$ be the finite group of Lie type $\mathrm{U}(V_{\Lambda},(\cdot,\cdot))$. It is defined as the group of $F$-fixed points of $\mathbf G := \mathrm{GL}(V_{\Lambda})_{\overline{\mathbb F_p}}$ with $F$ a non-split Frobenius morphism. We may think in terms of matrices once we fix a basis of $V_{\Lambda}$.\\ Let us fix a basis of $V_{\Lambda}$ in which $(\cdot,\cdot)$ is described by the square matrix $\dot{w}_0$ of size $2\theta +1$, having $1$ on the anti-diagonal and $0$ everywhere else. The group $\mathbf G$ may be identified with $\mathrm{GL}_{2\theta+1}$ over $\overline{\mathbb F_p}$, with $\mathbb F_p$-structure induced by the Frobenius morphism $F(M):=\dot{w}_0(M^{(p)})^{-t}\dot{w}_0$. Here, $M^{(p)}$ denotes the matrix $M$ having all coefficients raised to the power $p$. We may then identify $\widetilde{J}_{\Lambda}$ with the finite unitary group $\mathrm{U}_{2\theta+1}(p) = \mathbf G^F$.\\ The pair $(\mathbf T,\mathbf B)$ consisting of the maximal torus of diagonal matrices and the Borel subgroup of upper-triangular matrices in $\mathbf G$ is $F$-stable. The Weyl system of $(\mathbf T,\mathbf B)$ may be identified with $(\mathfrak S_{2\theta+1},\mathbf S)$ in the usual manner, where $\mathbf S$ is the set of simple transpositions $s_i:=(i\quad i+1)$ for $1\leq i \leq 2\theta$. Under this identification, the Frobenius acts on $\mathbf W$ as the conjugation by the element $w_0$, characterized for having the maximal length. It satisfies $w_0(i) = 2\theta + 2 -i$, and a natural representative of $w_0$ in $\mathrm N_{\mathbf G}(\mathbf T)$ is no other than $\dot{w}_0$. Since $w_0$ has order $2$, the action of the Frobenius on $\mathbf W$ is involutive. It also preserves the simple reflexions with the formula $F(s_i) = s_{2\theta+1-i}$.\\ We define the following subset of $\mathbf S$ $$I:=\{s_1,\ldots ,s_{\theta} ,s_{\theta+2},\ldots ,s_{2\theta}\} = \mathbf S\setminus \{s_{\theta+1}\}.$$ We have $F(I) = \mathbf S \setminus \{s_{\theta}\} \not = I$. We finally consider the generalized Deligne-Lusztig variety $X_{I}(\mathrm{id})$. It has dimension $\theta$ and is defined over $\mathbb F_{p^2}$. \paragraph{}\begin{theo}[(\cite{vw2} Theorem 4.8)] There is an isomorphism $\mathcal M_{\Lambda}\xrightarrow{\sim} X_{I}(\mathrm{id})$. In particular, the scheme $\mathcal M_{\Lambda}$ is projective, smooth, geometrically irreducible of dimension $\theta = \frac{t(\Lambda)-1}{2}$. \end{theo} \noindent The geometric irreducibility is a consequence of the criterion proved in \cite{bonnafe}. We may explain how this isomorphism works at the level of $k$-rational points.\\ Let $k$ be a perfect field extension of $\mathbb F_{p^2}$ and $M\in \mathcal M_{\Lambda}(k)$, so that $M \subset (\Lambda)_k$. This inclusion can be made more precise by considering duals. We actually have $$p^{i+1}\Lambda_k^{\vee} \overset{\theta}{\subset}p^{i+1}M^{\vee} \overset{1}{\subset} M \overset{\theta}{\subset} \Lambda_k.$$ Given these inclusions, we may consider the image $\overline{M}$ of $M$ as a subspace of $(V_{\Lambda})_k$. This subspace then has dimension $\theta+1$. \\ One may check that $\overline{p^{i+1}M^{\vee}} = \overline{M}^{\#}$, so that $\overline{M}$ is a subspace containing its own orthogonal. Conversely, one proves that any subspace of $(V_{\Lambda})_k$ of dimension $\theta+1$ containing its orthogonal arises from one such $M$. \paragraph{}\begin{prop}[(\cite{vw1} 2.7)] We have an identification $$\mathcal M_{\Lambda}(k) \simeq \{U\subset (V_{\Lambda})_k \,|\, \dim U = \theta+1 \text{ and }U^{\#}\subset U\}$$ where $t(\Lambda) = 2\theta +1$ is the dimension of $V_{\Lambda}$. \end{prop} \noindent This set is precisely the same as $X_{I}(\mathrm{id})(k)$. Indeed, as we are working with $\mathbf G = \mathrm{GL}_{2\theta+1}$, points of associated Deligne-Lusztig varieties may be interpreted as vectorial flags in a relative position with respect to their image by the Frobenius. According to \cite{vw1} 2.12, the Frobenius acts on a flag $\mathcal F$ by sending it to its orthogonal flag $\mathcal F^{\#}$. Explicitely, we have $$ \begin{tikzcd}[column sep=scriptsize] \mathcal F\; &[-25pt] : \quad \{0\} &[-25pt] \subset &[-25pt] \mathcal F_1 &[-25pt] \subset &[-25pt] \ldots &[-25pt] \subset &[-25pt] \mathcal F_r &[-25pt] \subset &[-25pt] (V_\Lambda)_k\\[-15pt] \mathcal F^{\#}\; &[-25pt] : \quad \{0\} &[-25pt] \subset &[-25pt] \mathcal F^{\#}_r &[-25pt] \subset &[-25pt] \ldots &[-25pt] \subset &[-25pt] \mathcal F^{\#}_1 &[-25pt] \subset &[-25pt] (V_\Lambda)_k \end{tikzcd} $$ Here, given our choice of $I$, a $k$-rational point of $\mathrm{Par}_I$ corresponds to a flag of the type $$\mathcal F: \{0\} \subset U \subset (V_{\Lambda})_k$$ with $U$ having dimension $\theta+1$. The condition that $\mathcal F$ is in relative position $\mathrm{id}$ with respect to $\mathcal F^{\#}$ precisely means that $U$ must contain $U^{\#}$.\\ \section{The Ekedahl-Oort stratification of a closed Bruhat-Tits stratum} \paragraph{} Recall the Ekedahl-Oort stratification of $\mathcal M_{\mathrm{red}}$ defined in \textbf{1.6}. Let $i\in \mathbb Z$ such that $ni$ is even and take an element $\Lambda \in \mathcal{L}_i$. We write $t(\Lambda) = 2\theta + 1$ and we consider an integer $0\leq \theta' \leq m$. We define the reduced locally closed subscheme $\mathcal M_{\Lambda}(2\theta'+1)$ of $\mathcal M_{\Lambda}$ such that for any perfect field extension $k$ of $\mathbb F_{p^2}$, we have $\mathcal M_{\Lambda}(2\theta'+1)(k) = \mathcal M_{\Lambda}(k) \cap \mathcal M(2\theta'+1)(k)$. It leads to the Ekedahl-Oort stratification of $\mathcal M_{\Lambda}$. The next proposition follows from \cite{vw2} Theorem 5.9. \noindent \begin{prop} The Ekedahl-Oort stratum $\mathcal M_{\Lambda}(2\theta' +1)$ is zero unless $0\leq \theta' \leq \theta$. Moreover, the closure of the stratum $\mathcal M_{\Lambda}(2\theta'+1)$ in $\mathcal M_{\Lambda}$ is the union of all the strata $\mathcal M_{\Lambda}(2s+1)$ for $s \leq \theta$. \end{prop} \paragraph{}It turns out that each Ekedahl-Oort stratum $\mathcal M_{\Lambda}(2\theta'+1)$ is again isomorphic to a Deligne-Lusztig variety. The relevant parameters are the following. We use the same notations as in \textbf{2.5} and we define the subset $$I_{\theta'}:=\{s_1,\ldots ,s_{\theta - \theta' -1},s_{\theta + \theta' + 2},\ldots ,s_{2\theta}\} \subset \mathbf S.$$ The subset $I_{\theta'}$ consists of all $2\theta$ simple reflexions in $\mathbf S$, except that we removed the $2\theta'+2$ ones in the middle. Thus, it has cardinality $2(\theta - \theta' - 1)$. In particular, it is empty for $\theta' = \theta$ or $\theta-1$. We also define the cycle $w_{\theta'} := (\theta + \theta' + 1 \quad \theta + \theta' \, \ldots \, \theta +1)$. Its decomposition into simple reflexions is $w_{\theta'} = s_{\theta'+1}\ldots s_{\theta + \theta'}$. When $\theta' = 0$, it is the identity. We note that even though $I_{\theta} = I_{\theta-1} = \emptyset$, we still have $w_{\theta} \not = w_{\theta-1}$.\\ One may check that $F(I_{\theta'}) = I_{\theta'}$ and that $w_{\theta'}$ belongs to $^{I_{\theta'}}\mathbf W^{I_{\theta'}}$. Moreover, the additional assumption of \cite{dm} is satisfied here as we have $w_{\theta'}^{-1}I_{\theta'}w_{\theta'} = I_{\theta'}$. Indeed, the reduced decomposition for $w_{\theta'}$ does not use any simple reflexion that is adjacent to those in $I_{\theta'}$. As a consequence, every result found in loc. cit. applies to the varieties $X_{I_{\theta'}}(w_{\theta'})$ which are defined over $\mathbb F_{p^2}$. \paragraph{}\begin{theo}[(\cite{vw2} Corollary 5.12)] The isomorphism $\mathcal M_{\Lambda}\xrightarrow{\sim} X_I(\mathrm{id})$ of \textbf{2.6} induces an isomorphism of $\mathcal M_{\Lambda}(2\theta'+1)$ with the Deligne-Lusztig variety $X_{I_{\theta'}}(w_{\theta'})$. In particular the Ekedahl-Oort stratum $\mathcal M_{\Lambda}(2\theta'+1)$ has dimension $l(w_{\theta'})= \theta'$. \end{theo} \noindent Following the proof of Theorem 2.15 of \cite{vw1}, we recall how this isomorphism works at the level of points over a perfect extention $k$ of $\mathbb F_{p^2}$. Because of the choice of $I_{\theta'}$, a $k$-point of $X_{I_{\theta'}}(w_{\theta'})$ is a flag $$ \begin{tikzcd}[column sep=scriptsize] \mathcal F\; : \quad \{0\} \subset \mathcal F_{-\theta'-1} \subset \ldots \subset \mathcal F_{-1} \subset \mathcal F_1 \subset \ldots \subset \mathcal F_{\theta'+1} \subset (V_{\Lambda})_k \end{tikzcd} $$ with $\dim(\mathcal F_{-i}) = \theta+1-i$ and $\dim(\mathcal F_i) = \theta+i$ for $1\leq i \leq \theta' +1$. To say that $\mathcal F$ and $\mathcal F^{\#}$ are in relative position $w_{\theta'}$ means that we have a diagram of the following type. $$ \begin{tikzcd}[column sep=scriptsize] \mathcal F : &[-25pt] \mathcal F_{-\theta'-1} \arrow[equal]{d} &[-25pt] \subset \ldots \subset &[-25pt] \mathcal F_{-1} \arrow[equal]{d} &[-25pt] \subset &[-25pt] \mathcal F_1 \arrow[d,equal,"/"{anchor=center,sloped}] \arrow[hook]{drr} &[-25pt] \subset &[-25pt] \mathcal F_2 \arrow[d,equal,"/"{anchor=center,sloped}] \arrow[hook]{dr} &[-25pt] \subset \ldots \arrow[hook]{dr} \subset &[-25pt] \mathcal F_{\theta'} \arrow[d,equal,"/"{anchor=center,sloped}] \arrow[hook]{drr} &[-25pt] \subset &[-25pt] \mathcal F_{\theta'+1} \arrow[equal]{d} \\[10pt] \mathcal F^{\#} : &[-25pt] \mathcal F_{\theta'+1}^{\#} &[-25pt] \subset \ldots \subset &[-25pt] \mathcal F_{1}^{\#} &[-25pt] \subset &[-25pt] \tau(\mathcal F_1) &[-25pt] \subset &[-25pt] \tau(\mathcal F_2) &[-25pt] \subset \ldots \subset &[-25pt] \tau(\mathcal F_{\theta'}) &[-25pt] \subset &[-25pt] \tau(\mathcal F_{\theta'+1}) \end{tikzcd} $$ \noindent Here, the automorphism $\tau$ is as in \textbf{2.4}. This diagram implies that $\tau(\mathcal F_i) = \mathcal F_{i-1} + \tau(\mathcal F_{i-1})$ for all $2\leq i \leq \theta'+1$. This rewrites as $\mathcal F_{i} = \mathcal F_{i-1} + \tau^{-1}(\mathcal F_{i-1})$. We deduce that $$\mathcal F_i = \sum_{l=0}^{i-1} \tau^{-l}(\mathcal F_1)$$ for all $1\leq i \leq \theta'+1$. Thus, the whole flag is determined by the subspace $\mathcal F_1$, which has dimension $\theta'+1$ and contains its orthogonal. As in \textbf{2.7}, there is a unique lattice $M \in \mathcal M_{\Lambda}(k)$ whose image in $(V_{\Lambda})_k$ is $\mathcal F_1$. Moreover, according to the diagram above we see that $\theta'$ is the smallest integer such that the space $\sum_{l=0}^{\theta'} \tau^{-l}(\mathcal F_1)$ is stable by $\tau^{-1}$. This is equivalent to $\sum_{l=0}^{\theta'} \tau^{l}(\mathcal F_1)$ being stable under $\tau$, and implies that $\theta'$ is the superspecial gap of $M$ by \textbf{1.7}. Thus, $M$ really is a point in $\mathcal M_{\Lambda}(2\theta'+1)(k)$ as expected, and the mapping of a flag $\mathcal F$ to the lattice $M$ is bijective. \paragraph{}The Deligne-Lusztig varieties $X_{I_{\theta'}}(w_{\theta'})$ are related to Coxeter varieties for smaller unitary groups as we now explain. We use the same notations as in \textbf{2.5}. We define $$J_{\theta'} := \{s_1,\ldots s_{\theta-\theta'-1}, s_{\theta-\theta'+1},\ldots , s_{\theta+\theta'}, s_{\theta+\theta'+2}, \ldots , s_{2\theta}\} = \mathbf S \setminus \{s_{\theta-\theta'}, s_{\theta+\theta'+1}\}.$$ The set $J_{\theta'}$ is obtained from $I_{\theta'}$ by adding back the $2\theta'$ simple reflexions in the middle. It has cardinality $2\theta - 2$, and it satisfies $F(J_{\theta'}) = J_{\theta'}$. We have $I_{\theta'} \subset J_{\theta'}$ with equality if and only if $\theta'=0$.\\ Recall that $\widetilde{J}_{\Lambda}$ is identified with the finite unitary group $G = \mathrm U_{2\theta+1}(p)$ by choosing a basis of $V_{\Lambda}$. We consider the standard parabolic subgroup $\mathbf P_{J_{\theta'}}$, and we denote by $\mathbf U_{J_{\theta'}}$ its unipotent radical and by $\mathbf L_{J_{\theta'}}$ the unique Levi complement containing the maximal torus $\mathbf T$. We write $P_{J_{\theta'}}, U_{J_{\theta'}}$ and $L_{J_{\theta'}}$ respectively for the groups of points fixed by the Frobenius $F$. \noindent \begin{prop} There is a $G$-equivariant isomorphism $$X_{I_{\theta'}}(w_{\theta'}) \simeq G/U_{J_{\theta'}} \times_{L_{J_{\theta'}}} X_{I_{\theta'}}^{\mathbf L_{J_{\theta'}}}(w_{\theta'})$$ where $X_{I_{\theta'}}^{\mathbf L_{J_{\theta'}}}(w_{\theta'})$ is a Deligne-Lusztig variety for $\mathbf L_{J_{\theta'}}$. The zero-dimensional variety $G/U_{J_{\theta'}}$ has a left action of $G$ and a right action of $L_{J_{\theta'}}$. \end{prop} \begin{proof} This is an application of \cite{dm} Proposition 7.19 which is the geometric identity behind the transitivity of the Deligne-Lusztig functors. It can be applied here because $J_{\theta'}$ contains $I_{\theta'}$, it is stable by the Frobenius and because $w_{\theta'}$ belongs to the parabolic subgroup $\mathbf W_{J_{\theta'}} \simeq \mathfrak S_{\theta-\theta'}\times \mathfrak S_{2\theta'+1} \times \mathfrak S_{\theta-\theta'}$ generated by $J_{\theta'}$, inside the Weyl group $\mathbf W\simeq \mathfrak S_{2\theta +1}$ . \end{proof} \paragraph{}The Levi complement $\mathbf L_{J_{\theta'}}$ is isomorphic to the product $\mathrm{GL}_{\theta-\theta'} \times \mathrm{GL}_{2\theta' +1} \times \mathrm{GL}_{\theta - \theta'}$ as a reductive group over $\overline{\mathbb F_p}$. It embeds in $\mathbf G = \mathrm{GL}_{2\theta +1}$ by block-diagonal matrices. We still denote by $F$ the Frobenius morphism defined in \textbf{2.5} for smaller linear groups. Given a matrix $M = \mathrm{diag}(A,C,B) \in \mathbf L_{J_{\theta'}}$, we have $F(M) = \mathrm{diag}(F(B),F(C),F(A))$. In particular, $F$ fixes the middle factor but exchanges the side factors of $\mathbf L_{J_{\theta'}}$. Writing $\mathbf H$ for the product of the side factors, we may eventually write $\mathbf L_{J_{\theta'}} \simeq \mathbf H \times \mathrm{GL}_{2\theta' +1}$ and both factors inherit an $\mathbb F_p$-structure by means of $F$.\\ The matrix $M$ above is fixed by $F$ if and only if $C = F(C)$ and $A = F(B) = F^2(A)$. Thus $C\in \mathrm U_{2\theta' +1}(p)$ and $A\in \mathrm{GL}_{\theta-\theta'}(p^2)$ while $B$ is determined by $A$. Thus $L_{J_{\theta'}} \simeq \mathrm{GL}_{\theta-\theta'}(p^2) \times \mathrm U_{2\theta' +1}(p)$, the first factor corresponding to $\mathbf H^F$. \paragraph{}The Weyl group of $\mathbf L_{J_{\theta'}}$ is isomorphic to $\mathbf W_{\mathbf H}\times \mathfrak S_{2\theta' +1}$ where $\mathbf W_{\mathbf H} \simeq \mathfrak S_{\theta-\theta'}\times \mathfrak S_{\theta-\theta'}$ is the Weyl group of $\mathbf H$. Via this decomposition, the permutation $w_{\theta'}$ corresponds to $\mathrm{id}\times \widetilde{w_{\theta'}}$, where $\widetilde{w_{\theta'}}$ is the restriction of $w_{\theta'}$ to $\{\theta - \theta' + 1, \ldots , \theta + \theta' + 1\}$. Similarly, the set of simple reflexions $\mathbf S$ decomposes as $\mathbf S_{\mathbf H}\sqcup \widetilde{\mathbf S}$, the second term corresponding to the simple transpositions in $\mathfrak S_{2\theta'+1}$. Then, we have $I_{\theta'} = \mathbf S_{\mathbf H} \sqcup \emptyset$.\\ The Deligne-Lusztig variety for $\mathbf L_{J_{\theta'}}$ decompose accordingly as the following product $$X_{I_{\theta'}}^{\mathbf L_{J_{\theta'}}}(w_{\theta'}) = X_{\mathbf S_{\mathbf H}}^{\mathbf H}(\mathrm{id}) \times X_{\emptyset}^{\mathrm U_{2\theta'+1}(p)}(\widetilde{w_{\theta'}}).$$ The first term is just a point, that is a trivial Deligne-Lusztig variety for $\mathbf H$ as the whole set of simple reflexions in $\mathbf W_{\mathbf H}$ is selected in the parameters. The second term is a Deligne-Lusztig variety for the unitary group of size $2\theta' +1$.\\ It turns out that the latter variety is of Coxeter type. Indeed, the permutation $\widetilde{w_{\theta'}}$ is the product of exactly one simple transposition of $\mathfrak S_{2\theta' +1}$ for each orbit of the Frobenius. Coxeter varieties and their cohomology with coefficients in $\overline{\mathbb Q_{\ell}}$ where $\ell$ is a prime number different from $p$ are well understood thanks to the work of Lusztig in \cite{cox}. \section{Irreducible unipotent representations of the finite unitary group} \paragraph{}In the section 4, 5 and 6, the notations are independent of the remaining of the paper. We recall the known classification theorems for the irreducible unipotent representations of the finite unitary group, and we explain the underlying combinatorics. \\ Let $q$ be a power of prime number $p$, and let $\mathbf G$ be a reductive connected group over an algebraic closure $\overline{\mathbb F_q}$ of $\mathbb F_q$. Assume that $\mathbf G$ is equipped with an $\mathbb F_q$-structure induced by a Frobenius morphism $F$. Let $G = \mathbf G^F$ be the associated finite group of Lie type. Let $(\mathbf T,\mathbf B)$ be a pair consisting of an $F$-stable maximal torus $\mathbf T$ and an $F$-stable Borel subgroup $\mathbf B$ containing $\mathbf T$. Let $\mathbf W = \mathbf W(\mathbf T)$ denote \textit{the} Weyl group of $\mathbf G$. For $w\in \mathbf W$, let $\dot{w}$ be a representative of $w$ in the normalizer $\mathrm N_{\mathbf G}(\mathbf T)$ of $\mathbf T$. By the Lang-Steinberg theorem, one can find $g\in \mathbf G$ such that $\dot{w} = g^{-1}F(g)$. Then $^g\mathbf T := g\mathbf T g^{-1}$ is another $F$-stable maximal torus, and $w \in \mathbf W$ is said to be the \textbf{type} of $^g \mathbf T$ with respect to $\mathbf T$. Every $F$-stable maximal torus arises in this manner. According to \cite{dl} Corollary 1.14, the $G$-conjugacy class of $^g \mathbf T$ only depends on the $F$-conjugacy class of the image $w$ of the element $g^{-1}F(g) \in \mathrm N_{\mathbf G}(\mathbf T)$ in the Weyl group $\mathbf W$. Here, two elements $w$ and $w'$ in $\mathbf W$ are said to be $F$-conjugates if there exists some element $\tau \in \mathbf W$ such that $w = \tau w' F(\tau)^{-1}$.\\ For every $w\in \mathbf W$, we fix $\mathbf T_w$ an $F$-stable maximal torus of type $w$ with respect to $\mathbf T$. The Deligne-Lusztig induction of the trivial representation of $\mathbf T_w$ is the virtual representation of $G$ defined by the formula $$R_w := \sum_{i\geq 0} (-1)^i\mathrm H^i_c(X_{\emptyset}(w))$$ where $X_{\emptyset}(w)$ is a Deligne-Lusztig variety for $\mathbf G$ as defined in \textbf{2.2}. According to \cite{dl} Theorem 1.6, the virtual representation $R_w$ only depends on the $F$-conjugacy class of $w$ in $\mathbf W$. An irreducible representation of $G$ is said to be \textbf{unipotent} if it occurs in $R_w$ for some $w\in \mathbf W$. The set of isomorphism classes of unipotent representations of $G$ is usually denoted $\mathcal E(G,1)$ following Lusztig's notations. \\ Assume that the Coxeter graph of the reductive group $\mathbf G$ is a union of subgraphs of type $A_m$ (for various $m$). Let $\check{\mathbf W}$ be the set of isomorphism classes of irreducible representations of its Weyl group $\mathbf W$. The action of the Frobenius $F$ on $\mathbf W$ induces an action on $\check{\mathbf W}$, and we consider the fixed point set $\check{\mathbf W}^F$. Then, the following classification theorem is well known. \noindent \begin{theo}[(\cite{ls} Theorem 2.2)] There is a bijection between $\check{\mathbf W}^F$ and the set of isomorphism classes of irreducible unipotent representations of $G = \mathbf G^F$. \end{theo} \noindent We recall how the bijection is constructed. If $V\in \check{\mathbf W}$ is an irreducible $F$-stable representation of $\mathbf W$, according to loc. cit. there is a unique automorphism $\widetilde{F}$ of $V$ of finite order such that $$R(V) := \frac{1}{|\mathbf W|}\sum_{w\in \mathbf W} \mathrm{Trace}(w\circ \widetilde{F} \,|\, V)R_w$$ is an irreducible representation of $G$. Then the map $V \mapsto R(V)$ is the desired bijection.\\ In the case $\mathbf G = \mathrm{GL}_n$ with the Frobenius morphism $F$ being either standard or twisted (ie. $G = \mathrm{GL}_n(q)$ or $\mathrm{U}_n(q)$), we have an equality $\check{\mathbf W}^F = \check{\mathbf W}$. Moreover, the automorphism $\widetilde{F}$ is the identity in the former case and multiplication by $w_0$ on the latter, where $w_0$ is the element of maximal length in $\mathbf W$. Thus, in both cases the irreducible unipotent representations of $G$ are classified by the irreducible representations of the Weyl group $\mathbf W\simeq \mathfrak S_n$, which in turn are classified by partitions of $n$ or equivalently by Young diagrams. We now recall the underlying combinatorics behind the representation theory of the symmetric group. A general reference is \cite{james}. \paragraph{}A partition of $n$ is a tuple $\lambda = (\lambda_1 \geq \ldots \geq \lambda_r)$ with $r\geq 1$ and each $\lambda_i$ is a positive integer, such that $\lambda_1 + \ldots + \lambda_r = n$. The integer $n$ is called the length of the partition, and it is denoted by $|\lambda|$. If a partition has a series of repeating integers, it is common to write it shortly with an exponent. For instance, the partition $(3,3,2,2,1)$ of $11$ will be denoted $(3^2,2^2,1)$. A Young diagram of size $n$ is a top left justified collection of $n$ boxes, arranged in rows and columns. There is a correspondance between Young diagrams of size $n$ and partitions of $n$, by associating to a partition $\lambda = (\lambda_1, \ldots, \lambda_r)$ the Young diagram having $r$ rows consisting successively of $\lambda_1, \ldots, \lambda_r$ boxes. We will often identify a partition with its Young diagram, and conversely.\\ For example, the Young diagram associated to $\lambda = (3^2,2^2,1)$ is the following one. \begin{center}\ydiagram{3,3,2,2,1}\end{center} To any partition $\lambda$ of $n$, one can naturally associate an irreducible representation of the symmetric group $\mathfrak S_n$. An explicit construction is given, for instance, by the notion of Specht modules as explained in \cite{james} 7.1. We will not recall their definition, however we may still describe the character values. The character of the irreducible representation associated to $\lambda$ will be denoted $\chi_{\lambda}$. \paragraph{}We recall the Murnaghan-Nakayama rule which gives a recursive formula to evaluate the characters $\chi_{\lambda}$. We first need to introduce skew Young diagrams. Consider a pair $\lambda$ and $\mu$ of two partitions respectively of integers $n+k$ and $k$. Assume that the Young diagram of $\mu$ is contained in the Young diagram of $\lambda$. By removing the boxes corresponding to $\mu$ from the diagram of $\lambda$, one finds a shape consisting of $n$ boxes denoted by $\lambda\setminus \mu$. Any such shape is called a \textbf{skew Young diagram} of size $n$. It is said to be connected if one can go from a given box to any other by moving in a succession of adjacent boxes.\\ For example, consider the partition $\lambda = (3^2,2^2,1)$ as above, and let us define the partitions $\mu_1 = (2^2)$, $\mu_2 = (3,1^2)$ and $\mu_3 = (2,1)$. The diagrams below correspond, from left to right, to the skew Young diagrams $\lambda \setminus \mu_i$ for $i=1,2,3$. \begin{center}\ydiagram{2+1,2+1,2,2,1} \qquad \ydiagram{0,1+2,1+1,2,1} \qquad \ydiagram{2+1,1+2,2,2,1}\end{center} The skew Young diagram $\lambda\setminus \mu_1$ is not connected, whereas the others are connected. A skew Young diagram is said to be a \textbf{border strip} if it is connected and if it does not contain any $2\times 2$ square. The \textbf{height} of a border strip is defined as its number of rows minus $1$. For instance, among the three skew Young diagrams above only $\lambda\setminus \mu_2$ is a border strip. Its size is $6$ and its height is $3$. \\ The characters $\chi_{\lambda}$ are class functions, so we only need to specify their values on conjugacy classes of the symmetric group $\mathfrak S_n$. These conjugacy classes are also naturally labelled by partitions of $n$. Indeed, up to ordering any permutation $\sigma \in \mathfrak S_n$ can be uniquely decomposed as a product of $r\geq 1$ cycles $c_1,\ldots ,c_r$ with disjoint supports. We denote by $\nu_i$ the cycle length of $c_i$ and we order them so that $\nu_1 \geq \ldots \geq \nu_r$. We allow cycles to have length $1$, so that the union of the supports of all the $c_i$'s is $\{1,\ldots ,n\}$. Thus, we obtain a partition $\nu = (\nu_1,\ldots,\nu_r)$ of $n$, which is called the \textbf{cycle type} of the permutation $\sigma$. Two permutations are conjugates in $\mathfrak S_n$ if and only if they share the same cycle type. We denote by $\chi_{\lambda}(\nu)$ the value of the character $\chi_{\lambda}$ on the conjugacy class labelled by $\nu$. \noindent \begin{theo}[(Murnaghan-Nakayama rule)] Let $\lambda$ and $\nu$ be two partitions of $n$. We have the following recursive formula $$\chi_{\lambda}(\nu) = \sum_{S} (-1)^{\mathrm{ht}(S)}\chi_{\lambda\setminus S}(\nu\setminus \nu_1)$$ where $S$ runs over the set of all border strips of size $\nu_1$ in the Young diagram of $\lambda$, such that removing $S$ from $\lambda$ gives again a Young diagram. Here, the integer $\mathrm{ht}(S) \in \mathbb Z_{\geq 0}$ is the height of the border stip $S$, the Young diagram $\lambda \setminus S$ is the one obtained by removing $S$ from $\lambda$, and $\nu\setminus\nu_1$ is the partition of $n - \nu_1$ obtained by removing $\nu_1$ from $\nu$. \end{theo} \noindent Applying the Murnaghan-Nakayama rule in successions results in the value of $\chi_{\lambda}(\nu)$. We see in particular that $\chi_{(n)}$ is the trivial character whereas $\chi_{(1^n)}$ is the signature. We illustrate the computations with $\lambda = (3^2,2^2,1)$ as above and $\nu = (4^2,3)$. There are only two elligible border strips of size $4$ in the diagram of $\lambda$, as marked below. \begin{center} \ydiagram{3,3,1}*[\times]{0,0,1+1,2,1} \qquad and \qquad \ydiagram{3,1,1,1,1}*[\times]{0,1+2,1+1,1+1} \end{center} Both border strips have height $2$. Thus, the formula gives $$\chi_{(3^2,2^2,1)}(4^2,3) = \chi_{(3^2,1)}(4,3) + \chi_{(3,1^4)}(4,3).$$ In each of the two Young diagrams obtained after removal of the border strips, there is only one elligible strip of size $4$, and eventually the three last remaining boxes form the final border strip of size $3$. \begin{center} \ydiagram{3}*[\times]{0,3,1} $\implies$ \ydiagram[\times]{3} \qquad \qquad \qquad \qquad \ydiagram{3}*[\times]{0,1,1,1,1} $\implies$ \ydiagram[\times]{3} \end{center} Taking the heights of the border strips into account, we find \begin{align*} \chi_{(3^2,1)}(4,3) = - \chi_{(3)}(3) = - \chi_{\emptyset} = -1 & & \chi_{(3,1^4)}(4,3) = - \chi_{(3)}(3) = - \chi_{\emptyset} = -1 \end{align*} Here, $\emptyset$ denotes the empty partition. The computation finally gives $\chi_{(3^2,2^2,1)}(4^2,3) = -2$. \paragraph{}The irreducible unipotent representation of $\mathrm U_n(q)$ (resp. $\mathrm{GL}_n(q)$) associated to $\chi_{\lambda}$ by the bijection of \textbf{4.1} Theorem is denoted by $\rho_{\lambda}^{\mathrm U}$ (resp. $\rho_{\lambda}^{\mathrm{GL}}$). The partition $(n)$ corresponds to the trivial representation and $(1^n)$ to the Steinberg representation in both cases. We will omit the superscript when the group we are talking about is clear by the context.\\ The degree of the representations $\rho_{\lambda}^{\mathrm{GL}}$ and $\rho_{\lambda}^{\mathrm U}$ are given by expressions known as \textbf{hook formula}. Given a box $\mathord{\scalerel*{\Box}{gX}}$ in the Young diagram of $\lambda$, its \textbf{hook length} $h(\mathord{\scalerel*{\Box}{gX}})$ is $1$ plus the number of boxes lying below it or on its right. For instance, in the following figure the hook length of every box of the Young diagram of $\lambda = (3^2,2^2,1)$ has been written inside it. \\ \ytableausetup{mathmode, centertableaux} \begin{center} \begin{ytableau} 7 & 5 & 2 \\ 6 & 4 & 1 \\ 4 & 2 \\ 3 & 1 \\ 1 \end{ytableau} \end{center} \noindent \begin{prop}[(\cite{geck2} Propositions 4.3.1 and 4.3.5)] Let $\lambda = (\lambda_1 \geq \ldots \geq \lambda_r)$ be a partition of $n$. The degrees of the irreducible unipotent representations $\rho_{\lambda}^{\mathrm{GL}}$ and $\rho_{\lambda}^{\mathrm U}$, respectively of $\mathrm{GL}_n(q)$ and $\mathrm U_n(q)$, are given by the following formulas \begin{align*} \deg(\rho_{\lambda}^{\mathrm{GL}}) = q^{a(\lambda)}\frac{\prod_{i=1}^k q^i - 1}{\prod_{\mathord{\scalerel*{\Box}{gX}} \in \lambda} q^{h(\mathord{\scalerel*{\Box}{gX}})} - 1} & & \deg(\rho_{\lambda}^{\mathrm{U}}) = q^{a(\lambda)}\frac{\prod_{i=1}^k q^i - (-1)^i}{\prod_{\mathord{\scalerel*{\Box}{gX}} \in \lambda} q^{h(\mathord{\scalerel*{\Box}{gX}})} - (-1)^{h(\mathord{\scalerel*{\Box}{gX}})}} \end{align*} where $a(\lambda) = \sum_{i=1}^r (i-1)\lambda_i$. \end{prop} \paragraph{}We recall from \cite{geck} 3.1 and 3.2 some definitions on classical Harish-Chandra theory. Let $G = \mathbf G^F$ be a finite group of Lie type over $\mathbb F_q$. A parabolic subgroup of $G$ is a subgroup $P\subset G$ such that there exists an $F$-stable parabolic subgroup $\mathbf P$ of $\mathbf G$ with $P = \mathbf P^F$. A Levi complement of $G$ is a subgroup $L \subset G$ such that there exists an $F$-stable Levi complement $\mathbf L$ of $\mathbf G$, contained inside some $F$-stable parabolic subgroup, such that $L = \mathbf L^F$. Any parabolic subgroup $P$ of $G$ has a Levi complement $L$.\\ Let $L = \mathbf L^F$ be a Levi complement of $G$ inside a parabolic subgroup $P = \mathbf P^F$. Let $U = \mathbf U^F$ be the $F$-fixed points of the unipotent radical $\mathbf U$ of $\mathbf P$. The \textbf{Harish-Chandra induction and restriction functors} are defined by the following formulas. \begin{align*} \mathrm{R}^G_{L\subset P}: \mathrm{Rep}(L) & \to \mathrm{Rep}(G) & ^*\mathrm{R}^G_{L\subset P}: \mathrm{Rep}(G) & \to \mathrm{Rep}(L) \\ \sigma & \mapsto \mathbb C[G/U]\otimes_{\mathbb C[L]}\sigma & \rho & \mapsto \mathrm{Hom}_G(\mathbb C[G/U],\rho) \end{align*} \noindent Here, $\mathrm{Rep}(G)$ is the category of complex representations of $G$, and similarily for $\mathrm{Rep}(L)$. In other words, the Harish-Chandra induction of $\sigma$ is the succession of inflating $\sigma$ to a representation of $P$ by letting $U$ acts trivially, then applying classical induction for finite groups to $G$. The Harish-Chandra restriction of $\rho$ is the process of taking the $U$-fixed points of $\rho$, and looking at it as a representation of $L$. These two functors are adjoint, and up to isomorphism they do not depend on the choice of the parabolic subgroup $P$ containing the Levi complement $L$. For this reason, we will denote the functors $R^G_L$ and $^*R^G_L$ instead.\\ An irreducible representation of $G$ is called \textbf{cuspidal} if its Harish-Chandra restriction to any proper Levi complement is zero. We consider pairs $(L,X)$ where $L$ is a Levi complement of $G$ and $X$ is an irreducible representation of $L$. We define an order on the set of such pairs by setting $(L,X) \leq (M,Y)$ if $L\subset M$ and if $X$ occurs in the Harish-Chandra restriction of $Y$ to $L$. A pair is said to be \textbf{cuspidal} if it is minimal with respect to this order, in which case $X$ is a cuspidal representation of $L$. If $(L,X)$ is a cuspidal pair, we will denote by $[L,X]$ its conjugacy class under $G$.\\ Given a cuspidal pair $(L,X)$ of $G$, its associated \textbf{Harish-Chandra series} $\mathcal E(G,(L,X))$ is defined as the set of isomorphism classes of irreducible constituents in the induction of $X$ to $G$. Each series is non empty. Two of them are either disjoint or equal, the latter occuring if and only if the two cuspidal pairs are conjugates in $G$. Thus, the series are indexed by the conjugacy classes of cuspidal pairs $[L,X]$. Moreover, the isomorphism class of any irreducible representation of $G$ belongs to some Harish-Chandra series. Thus, Harish-Chandra series form a partition of the set of isomorphism classes of irreducible representations of $G$. If $\rho$ is an irreducible representation of $G$, the conjugacy class $[L,X]$ corresponding to the series to which $\rho$ belongs is called the \textbf{cuspidal support} of $\rho$. If $T$ denotes a maximal torus in $G$ (that is, $T = \mathbf T^F$ where $\mathbf T$ is a maximal $F$-stable torus of $\mathbf G$), then the series $\mathcal E(G,(T,1))$ is called the \textbf{unipotent principal series} of $G$. \paragraph{}For the general linear group $\mathrm{GL}_n(q)$, there is no unipotent cuspidal representation unless $n=1$, in which case the trivial representation is cuspidal. Moreover, the unipotent representations all belong to the principal series. The situation for the unitary group is very different. First, by \cite{classical} 9.2 and 9.4 there exists an irreducible unipotent cuspidal representation of $\mathrm U_n(q)$ if and only if $n$ is an integer of the form $n = \frac{t(t+1)}{2}$ for some $t\geq 0$, and when that is the case it is the one associated to the partition $\Delta_t := (t, t-1,\ldots,1)$, whose Young diagram has the distinctive shape of a reversed staircase. Here, as a convention $\mathrm U_0(q)$ denotes the trivial group.\\ For example, here are the Young diagrams of $\Delta_1,\Delta_2$ and $\Delta_3$. Of course, the one of $\Delta_0$ the empty diagram. \begin{center}\ydiagram{1} \quad \quad \ydiagram{2,1} \quad \quad \ydiagram{3,2,1}\end{center} \noindent Furthermore the unipotent representations decompose non trivially into various Harish-Chandra series, as we recall from \cite{geck} 4.3.\\ We consider an integer $t\geq 0$ such that $n$ decomposes as $n = 2a + \frac{t(t+1)}{2}$ for some $a\geq 0$. We also consider the block-diagonal Levi complement $L_t \simeq \mathrm{GL}_1(q^2)^a \times \mathrm U_{\frac{t(t+1)}{2}}(q)$ which corresponds to the choice of simple reflexions $s_{a+1}, \ldots , s_{n-a-1}$ with the notations of \textbf{2.5}. We write $\rho_t$ for the irreducible character obtained by coupling the unique unipotent cuspidal character of the unitary component with the trivial characters for the various $\mathrm{GL}_1$ components. Then $\mathcal E(\mathrm U_n(q),1)$ decomposes as the disjoint union of all the Harish-Chandra series $\mathcal E(\mathrm U_n(q), (L_t,\rho_t))$ for all possible choices of $t$. With these notations, the principal unipotent series corresponds to $t=0$ if $n$ is even and to $t=1$ if $n$ is odd.\\ Given an irreducible unipotent representation $\rho_{\lambda}$ of $\mathrm U_n(q)$, there is a combinatorical way of determining the Harish-Chandra series to which it belongs. We consider the Young diagram of $\lambda$. We call \textbf{domino} any pair of adjacent boxes in the diagram. It may be either vertical or horizontal. We remove dominoes from the diagram of $\lambda$ so that the resulting shape is again a Young diagram, until one can not proceed further. This process results in the Young diagram of the partition $\Delta_t$ for some $t\geq 0$, and it is called the \textbf{$2$-core} of $\lambda$. It does not depend on the successive choices for the dominoes. Then, the representation $\rho_{\lambda}$ belongs to the series $\mathcal E(\mathrm U_n(q),(L_t,\rho_t))$ if and only if $\lambda$ has $2$-core $\Delta_t$. \\ For instance, the diagram $\lambda = (3^2,2^2,1)$ given in \textbf{4.2} has $2$-core $\Delta_1$, as it can be determined by the following steps. We put crosses inside the successive dominoes that we remove from the diagram. Thus, the unipotent representation $\rho_{\lambda}$ of $\mathrm{U}_{11}(q)$ belongs to the unipotent principal series $\mathcal E(\mathrm U_{11}(q),(L_1,\rho_1))$. \begin{center} \ydiagram{3,3,1,1,1}*[\times]{0,0,1+1,1+1} $\implies$ \ydiagram{3,1,1,1,1}*[\times]{0,1+2} $\implies$ \ydiagram{3,1,1}*[\times]{0,0,0,1,1} $\implies$ \ydiagram{1,1,1}*[\times]{1+2} $\implies$ \ydiagram{1}*[\times]{0,1,1} $\implies$ \ydiagram{1} \end{center} \section{Computing Harish-Chandra induction of unipotent representations in the finite unitary group} \paragraph{}We now recall from \cite{geck} 3.2 how Harish-Chandra induction of unipotent representations can be explicitely computed. Given a finite group of Lie type $G = \mathbf G^F$, we denote by $W = \mathbf W^F$ its Weyl group. It is again a Coxeter group, whose set of simple reflexions $S$ is identified with the set of $F$-orbits on $\mathbf S$. Let $(L,X)$ be a cuspidal pair of $G$. The \textbf{relative Weyl group of $L$} is given by $W_G(L) := N_{\mathbf G}(\mathbf L)^F/L\subset W$. The relative Weyl group of the pair $(L,X)$, also called \textbf{the ramification group of $X$} in \cite{howlett}, is the subgroup $W_G(L,X)$ of $W_G(L)$ consisting of elements $w$ such that $wX \simeq X$, where $wX$ denotes the representation $wX(g) := X(wgw^{-1})$ of $L$. It is yet again a Coxeter group if $\mathbf G$ has a connected center or if $X$ is unipotent. \\ By studying the endomorphism algebra of Harish-Chandra induced representations and relating it to the theory of Hecke algebra, one can establish a bijection between the Harish-Chandra series $\mathcal E(G,(L,X))$ and the set $\mathrm{Irr}(W_G(L,X))$ of isomorphism classes of irreducible complex characters of $W_G(L,X)$, see \cite{geck} Theorem 3.2.5. These bijections for $G$ and for various Levi complements in $G$ can be chosen to be compatible with Harish-Chandra induction. This is known as Howlett and Lehrer's comparison theorem which was proved in \cite{howlett}. \noindent \begin{theo}[(\cite{geck} Comparison Theorem 3.2.7)] Let $(L,X)$ be a cuspidal pair for the finite group of Lie type $G$. For every Levi complement $M$ in $G$ containing $L$, the bijection between $\mathrm{Irr}(W_M(L,X))$ and $\mathcal E(M,(L,X))$ can be taken so that the diagrams $$ \begin{tikzcd} \mathbb Z\mathcal E(G,(L,X)) \arrow{rr}{\sim} & & \mathbb Z\mathrm{Irr}(W_{G}(L,X)) \\[10pt] \mathbb Z\mathcal E(M,(L,X)) \arrow{rr}{\sim} \arrow{u}{\mathrm R_M^{G}} & & \mathbb Z\mathrm{Irr}(W_{M}(L,X)) \arrow[swap]{u}{\mathrm{Ind}} \end{tikzcd} \quad\quad \begin{tikzcd} \mathbb Z\mathcal E(G,(L,X)) \arrow{rr}{\sim} \arrow[swap]{d}{^*\mathrm R_M^{G}} & & \mathbb Z\mathrm{Irr}(W_{G}(L,X)) \arrow{d}{\mathrm{Res}} \\[10pt] \mathbb Z\mathcal E(M,(L,X)) \arrow{rr}{\sim} & & \mathbb Z\mathrm{Irr}(W_{M}(L,X)) \end{tikzcd} $$ are commutative. Here, $\mathrm{Ind}$ and $\mathrm{Res}$ on the right-hand side of the diagrams are the classical induction and restriction functors for representations of finite groups. \end{theo} \noindent In other words, the theorem states that computing Harish-Chandra induction and restrictions of representations in $G$ can be entirely done at the level of the associated Coxeter groups. In order to use this statement for unitary groups, we need to make the horizontal arrows explicit and to understand the combinatorics behind induction and restriction of the irreducible representations of the relevant Coxeter groups. This has been explained consistently in \cite{fong} for classical groups. \paragraph{}We focus on the case of the unitary group. Let $t\geq 0$ such that $n = 2a + \frac{t(t+1)}{2}$ for some $a\geq 0$. We consider the cuspidal pair $(L_t,\rho_t)$ as in \textbf{4.6}, with $L_t = \mathrm{GL}_1(q^2)^a\times \mathrm{U}_{\frac{t(t+1)}{2}}(q)$. The relative Weyl group $W_{\mathrm{U}_n(q)}(L_t)$ is isomorphic to the Coxeter group of type $B_a$, which is usually denoted by $W_a$. Indeed, note first that all elements of the normalizer group $N_{\mathrm U_n(q)}(L_t)$ acting only on the unitary component of $L_t$ become identity in $W_{\mathrm{U}_n(q)}(L_t)$ once quotient by $L_t$ is taken. So one needs to focus on the $\mathrm{GL}_1$-components of $L_t$ instead. As in \cite{geck2} 1.4.1, the Weyl group $W_{\mathrm U_n(q)}(L_t)$ admits a presentation by elements $\sigma_1,\ldots, \sigma_{a-1}$ and $\theta$ of order $2$ satisfying the following relations. \begin{align*} \theta\sigma_1\theta\sigma_1 & = \sigma_1 \theta \sigma_1 \theta & \theta\sigma_i & = \sigma_i \theta & & \forall \; 2\leq i \leq m-1 \\ \sigma_i \sigma_{i+1} \sigma_i & = \sigma_{i+1} \sigma_i \sigma_{i+1} & \sigma_i \sigma_j & = \sigma_j \sigma_i & & \forall\; |i-j| \geq 2 \end{align*} Explicitely, the element $\sigma_i$ is represented by the permutation matrix of the double transposition $(i\quad i+1)(n-i\quad n-i+1)$ and the element $\theta$ by the matrix of the transposition $(1 \quad n)$, all of which belong to $N_{\mathrm U_n(q)}(L_t)$. Moreover, in our case the ramification group $W_{\mathrm U_n(q)}(L_t,\rho_t)$ is equal to the whole of $W_{\mathrm U_n(q)}(L_t) \simeq W_m$. The isomorphism of the ramification group with the Coxeter group $W_a$ of type $B_a$ is naturally induced by the isomorphism of the absolute Weyl group $\mathbf W$ with $\mathfrak S_n$, which has already been fixed. In order to proceed further, we need to explain the representation theory of the groups $W_a$. \paragraph{}Let $W_a$ be a Coxeter group of type $B_a$ given with a presentation by elements $\sigma_1,\ldots ,\sigma_{a-1}$ and $\theta$ satisfying equations as in \textbf{5.2}. For $1\leq i \leq a-1$, we define $\theta_i = \sigma_i\ldots \sigma_1\theta\sigma_{1}\ldots \sigma_{i}$. In particular $\theta_0 = \theta$. Following \cite{geck2} 3.4.2, we define \textbf{signed blocks} to be elements of the following form. Given $k\geq 0$ and $e\geq 1$ such that $k + e \leq a$, the positive (resp. negative) block of length $e$ starting at $k$ is \begin{align*} b^+_{k,e} := \sigma_{k+1}\sigma_{k+2}\ldots \sigma_{k+e-1} & & b^-_{k,e} := \theta_k\sigma_{k+1}\sigma_{k+2}\ldots \sigma_{k+e-1} \end{align*} A \textbf{bipartition} of $a$ is an ordered pair $(\alpha,\beta)$ where $\alpha$ is a partition of some integer $0\leq j \leq a$ and $\beta$ is a partition of $a - j$. Given a bipartition $(\alpha,\beta)$ of $a$ and writing $\alpha = (\alpha_1,\ldots ,\alpha_r)$ and $\beta = (\beta_1,\ldots ,\beta_s)$, we define the element $$w_{\alpha,\beta} := b^-_{k_1,\beta_1}\ldots b^-_{k_s,\beta_s}b^+_{k_{s+1},\alpha_1}\ldots b^+_{k_{s+r},\alpha_r}$$ where $k_1 = 0$, $k_{i+1} = k_i + \beta_i$ if $1\leq i \leq s$ and $k_{i+1} = k_i + \alpha_{i - s}$ if $s+1\leq i \leq s+r - 1$. In particular, we have $k_{r+s} + \alpha_r = a$. According to \cite{geck2} Proposition 3.4.7, the conjugacy classes in $W_a$ are labelled by bipartitions of $a$, and a representative of minimal length of the conjugacy class corresponding to the bipartition $(\alpha,\beta)$ is given by $w_{\alpha,\beta}$. This proposition also implies that the irreducible representations of $W_a$ can be labelled by bipartitions of $a$ too. An explicit construction of these irreducible representations is given in \cite{geck2} 5.5. We will not recall it, however we may again give a method to compute the character values, similar to the Murnaghan-Nakayama formula. The character of the irreducible representation of $W_a$ associated in loc. cit. to the bipartition $(\alpha,\beta)$ of $a$ will be denoted $\chi_{\alpha,\beta}$. If $(\gamma,\theta)$ is another bipartition of $a$, we denote by $\chi_{\alpha,\beta}(\gamma,\theta)$ the value of the character $\chi_{\alpha,\beta}$ on the conjugacy class of $W_a$ labelled by $(\gamma,\theta)$.\\ One can think of a bipartition $(\alpha,\beta)$ of $a$ as an ordered pair of two Young diagrams of combined size $a$. A \textbf{border strip} of a bipartition $(\alpha,\beta)$ is a border strip either of the partition $\alpha$ or of $\beta$, as in \textbf{4.3}. The height of a border strip is defined in the same way. \noindent \begin{theo}[(\cite{geck2} Theorem 10.3.1)] Let $(\alpha,\beta)$ and $(\gamma,\theta)$ be two bipartitions of $a$. If $\gamma \not = \emptyset$, let $\epsilon = 1$ and let $x$ be the last integer in the partition $\gamma$. If $\gamma = \emptyset$, let $\epsilon = -1$ and let $x$ be the last integer of the partition $\theta$. We have the following recursive formula $$\chi_{\alpha,\beta}(\gamma,\theta) = \sum_S (-1)^{\mathrm{ht}(S)}\epsilon^{f_S}\chi_{(\alpha,\beta)\setminus S}((\gamma,\theta)\setminus x)$$ where $S$ runs over the set of all border strips of size $x$ in the bipartition $(\alpha,\beta)$, such that removing $S$ from $(\alpha,\beta)$ gives again a pair of Young diagrams. Here, the pair of Young diagrams $(\alpha,\beta)\setminus S$ is the one obtained after removing $S$, and $(\gamma,\theta)\setminus x$ is the bipartition obtained by removing $x$ from $(\gamma,\theta)$. Eventually, the integer $f_S$ is $0$ if $S$ is a border strip of $\alpha$, and it is $1$ if $S$ is a border strip of $\beta$. \end{theo} \noindent Applying this formula in successions results in the value of $\chi_{(\alpha,\beta)}(\gamma,\theta)$. In particular, one sees that $\chi_{(a),\emptyset}$ is the trivial character and $\chi_{\emptyset,(1^a)}$ is the signature character of $W_a$. We illustrate the computations with $(\alpha,\beta) = ((3,1^2),(4,2))$ and $(\gamma,\theta) = ((4),(5,2))$. There is only elligible border strip of size $4$ in the pair of diagrams $(\alpha,\beta)$, as marked below. \begin{center} \ydiagram{3,1,1}\quad , \quad \ydiagram{1,1}*[\times]{1+3,1+1} \end{center} This border strip $S$ has height $1$. It was taken in the diagram of $\beta$ so $f_S = 1$. Because $\gamma \not = \emptyset$ we have $\epsilon = 1$. Applying the formula, we obtain $$\chi_{(3,1^2),(4,2)}((4),(5,2)) = - \chi_{(3,1^2),(1^2)}(\emptyset,(5,2)).$$ We are now looking for border strips of size $2$ in the pair of diagrams of the bipartition $(3,1^2),(1^2)$. Three of them are eligible, as marked below. \begin{center} \ydiagram{3,1,1}\quad , \quad \ydiagram[\times]{1,1} \quad \text{and} \quad \ydiagram{1,1,1}*[\times]{1+2} \quad , \quad \ydiagram{1,1} \quad \text{and} \quad \ydiagram{3}*[\times]{0,1,1} \quad , \quad \ydiagram{1,1} \end{center} These three border strips have respective heights $1,0$ and $1$. The corresponding values of $f_S$ are respectively $1$, $0$ and $0$. Moreover, the partition $\gamma$ is now empty so $\epsilon = -1$. The formula gives $$\chi_{(3,1^2),(1^2)}(\emptyset,(5,2)) = \chi_{(3,1^2),\emptyset}(\emptyset,(5)) + \chi_{(1^3),(1^2)}(\emptyset,(5)) - \chi_{(3),(1^2)}(\emptyset,(5)).$$ In the bipartitions $((1^3),(1^2))$ and $((3),(1^2))$ there is no border strip of size $5$ at all. Thus, the formula tells us that the corresponding character values are $0$. On the other hand, the bipartition $((3,1^2),\emptyset)$ consists of a single border strip of size $5$ and height $2$. The formula gives $$\chi_{(3,1^2),\emptyset}(\emptyset,(5)) = \chi_{\emptyset} = 1.$$ Putting things together, we deduce that $\chi_{(3,1^2),(4,2)}((4),(5,2)) = -1$. \paragraph{}In \cite{fong}, the authors defined a labelling of the irreducible representations of finite classical groups in terms of symbols. Among other things, it gives a new labelling of the irreducible unipotent representations of the finite unitary groups, which we will use to make the connexion with representations of Coxeter groups of type $B$ and the comparison theorem.\\ The new labelling of the (isomorphism classes of) irreducible unipotent representations of $\mathrm U_n(q)$ involves triples of the form $(\Delta_t,\alpha,\beta)$ where $t$ is a nonnegative integer such that $n = 2a + \frac{t(t+1)}{2}$ for some integer $a\geq 0$, and where $(\alpha,\beta)$ is a bipartition of $a$. The corresponding representation will be denoted $\rho_{\Delta_t,\alpha,\beta}$. With this labelling, the unipotent Harish-Chandra series $\mathcal E(\mathrm U_n(q),(L_t,\rho_t))$ consists precisely of all the representations $\rho_{\Delta_t,\alpha,\beta}$ with $(\alpha,\beta)$ varying over all bipartitions of $a$. The bijection $\mathbb Z\mathcal E(\mathrm U_n(q),(L_t,\rho_t)) \xrightarrow{\sim} \mathbb Z\mathrm{Irr}(W_{\mathrm U_n(q)}(L_t,\rho_t))$ involved in the Comparison theorem in \textbf{5.1} simply sends $\rho_{\Delta_t,\alpha,\beta}$ to $\chi_{\alpha,\beta}$. Here, we made use of the identification $W_{\mathrm U_n(q)}(L_t,\rho_t) \simeq W_a$ as in \textbf{5.2}.\\ More generally, if $M$ is a block-diagonal Levi complement in $\mathrm U_n(q)$ containing $L_t$, we may write $M \simeq \mathrm U_b(q)\times \mathrm{GL}_{a_1}(q^2) \times \ldots \times \mathrm{GL}_{a_r}(q^2)$ where $n = 2(a_1 + \ldots + a_r) + b$ and $b\geq \frac{t(t+1)}{2}$. The irreducible unipotent representations of $M$ in the Harish-Chandra series $\mathcal E(M,(L_t,\rho_t))$ are those of the form $\rho_{\Delta_t,\alpha,\beta}\boxtimes \rho^{\mathrm{GL}}_{\lambda_1}\boxtimes \ldots \boxtimes \rho^{\mathrm{GL}}_{\lambda_r}$ where $\lambda_i$ is a partition of $a_i$ for $1\leq i \leq r$ and $(\alpha,\beta)$ is a bipartition of the integer $c:= \frac{1}{2}\left(b - \frac{t(t+1)}{2}\right)$.\\ On the other hand, the relative Weyl group $W_M(L_t,\rho_t)$ can be identified with the subgroup of $W_{\mathrm U_n(q)}(L_t,\rho_t) \simeq W_a$ isomorphic to the product $W_c\times \mathfrak S_{a_1}\times \ldots \times \mathfrak S_{a_r}$ (note that $c + a_1 + \ldots + a_r = a$). With the notations of \textbf{5.2}, the $W_c$-component is generated by the elements $\theta,\sigma_1,\ldots \sigma_{c-1}$, the $\mathfrak S_{a_1}$-component by the elements $\sigma_{c+1}\ldots ,\sigma_{c+a_1-1}$, and so on. Irreducible characters of $W_M(L_t,\rho_t)$ have the shape $\chi_{\alpha,\beta}\boxtimes \chi_{\lambda_1} \boxtimes \ldots \boxtimes \chi_{\lambda_r}$ where $(\alpha,\beta)$ is a bipartition of $c$ and $\lambda_i$ is a partition of $a_i$ for $1\leq i \leq r$.\\ Then, according to \cite{fong} (4.2), the bijection $\mathbb Z\mathcal E(\mathrm M,(L_t,\rho_t)) \xrightarrow{\sim} \mathbb Z\mathrm{Irr}(W_M(L_t,\rho_t))$ involved in the Comparison theorem in \textbf{5.1} sends $\rho_{\Delta_t,\alpha,\beta}\boxtimes \rho^{\mathrm{GL}}_{\lambda_1}\boxtimes \ldots \boxtimes \rho^{\mathrm{GL}}_{\lambda_r}$ to $\chi_{\alpha,\beta}\boxtimes \chi_{\lambda_1} \boxtimes \ldots \boxtimes \chi_{\lambda_r}$. \paragraph{}In order to relate the two labellings together, one needs the notion of $2$-quotient which we now define. For the following constructions to work well, one should allow partitions to have $0$ terms at the end. Thus, let us write $\lambda = (\lambda_1 \geq \ldots \geq \lambda_r)$ with $\lambda_r \geq 0$. The \textbf{$\beta$-set} of $\lambda$ is the sequence of decreasing nonnegative integers $\beta_i := \lambda_i + r - i$ for $1\leq i \leq r$. Mapping a partition $\lambda$ to its $\beta$-set gives a bijection between the set of partitions having $r$ terms and the set of decreasing sequences of nonnegative integers of length $r$. The inverse mapping sends a sequence $(\beta_1> \ldots > \beta_r \geq 0)$ to the partition $\lambda$ given by $\lambda_i = \beta_i + i - r$.\\ Let $\lambda$ be a partition of $n$ as above, and let $\beta$ be its $\beta$-set. We let $\beta_{\text{even}}$ (resp. $\beta_{\text{odd}}$) be the subsequence consisting of all even (resp. odd) integers of $\beta$. Then, we define the following sequences. \begin{align*} \beta^0 := \left(\frac{\beta_i}{2} \,\middle|\, \beta_i \in \beta_{\text{even}}\right) & & \beta^1 := \left(\frac{\beta_i - 1}{2} \,\middle|\, \beta_i \in \beta_{\text{odd}}\right) \end{align*} The sequences $\beta^0$ and $\beta^1$ are the $\beta$-sets of two partitions, which we call $\mu^0$ and $\mu^1$ respectively. Then, the \textbf{$2$-quotient} of $\lambda$ is the bipartition $(\mu^0,\mu^1)$ if $r$ is odd, and $(\mu^1,\mu^0)$ if $r$ is even. We note that the ordering of $\mu^0$ and $\mu^1$ in the $2$-quotient may vary in the literature. Here, we followed the conventions of \cite{fong} section 1. A different ordering is used in \cite{james} 2.7.29. In loc. cit. Theorem 2.7.37, another construction of the $2$-quotient using Young diagrams is proposed.\\ Let $\lambda'$ be another partition which differs from $\lambda$ only by $0$ terms at the end. While the $\beta$-sets of $\lambda$ and $\lambda'$ are not the same, the resulting $2$-quotients are equal up to $0$ terms at the end of the partitions. Thus, from now on we identify all partitions differing only from $0$ terms by removing all of them. The $2$-quotient of a partition is then well-defined. \noindent \begin{theo}[(\cite{james} Theorem 2.7.30)] A partition $\lambda$ is uniquely characterized by the data of its $2$-core $\Delta_t$ and its $2$-quotient $(\lambda^0,\lambda^1)$. Moreover, the lengths of these partitions are related by the equation $$|\lambda| = |\Delta_t| +2(|\lambda^0| + |\lambda^1|)$$ and $|\Delta_t| = \frac{t(t+1)}{2}$. \end{theo} \noindent We illustrate the computation of the $2$-quotient with the example of $\lambda = (3^2,2^2,1)$ as in \textbf{4.2}. We have $r=5$ and the $\beta$-set of $\lambda$ is given by the sequence $(7,6,4,3,1)$. Thus, we obtain $\beta^0 = (3,2)$ and $\beta^1 = (3,1,0)$. The length of $\beta^0$ is $2$, so the partition $\mu^0$ can be computed as $(3+1-2,2+2-2) = (2,2)$. The length of $\beta^1$ is $3$, so the partition $\mu^1$ can be computed as $(3+1-3,1+2-3,0+3-3) = (1,0,0) = (1)$. Because $r = 5$ is odd, the $2$-quotient of $\lambda$ is the bipartition $(\lambda^0,\lambda^1) = (\mu^0,\mu^1) = ((2^2),(1))$. Recall that the $2$-core of $\lambda$ is $\Delta_1$. Thus, the equation on the lengths of the partitions is satisfied, as we have $11 = 1 + 2(4+1)$. \paragraph{}We may now relate the two labellings $\{\rho^{\mathrm U}_{\lambda}\}$ and $\{\rho_{\Delta_t,\alpha,\beta}\}$ of the irreducible unipotent representations of $\mathrm U_n(q)$ together. \noindent \begin{prop}[(\cite{fong} Appendix)] Let $\lambda$ be a partition of $n$. Denote by $\Delta_{t'}$ its $2$-core and by $(\lambda^0,\lambda^1)$ its $2$-quotient. On the other hand, let $t\geq 0$ be such that $n = 2a + \frac{t(t+1)}{2}$ for some $a\geq 0$ and let $(\alpha,\beta)$ be a bipartition of $a$. Then the irreducible representations $\rho^{U}_{\lambda}$ and $\rho_{\Delta_{t},\alpha,\beta}$ are equivalent if and only if $t=t'$ and $(\lambda^0,\lambda^1) = (\alpha,\beta)$ if $t$ is even or $(\beta,\alpha)$ if $t$ is odd. \end{prop} \noindent For instance, for $\lambda = (3^2,2^2,1)$ as before, the representation $\rho_{\lambda}^{\mathrm{U}}$ is equivalent to $\rho_{\Delta_1,(1),(2^2)}$. \paragraph{} We now have a general strategy in order to compute the Harish-Chandra induction of an irreducible unipotent representation of a Levi complement $M$ inside a unitary group $\mathrm U_n(q)$. First we may assume that $M$ is block diagonal and we decompose it as $M \simeq \mathrm U_b(q)\times \mathrm{GL}_{a_1}(q^2) \times \ldots \times \mathrm{GL}_{a_r}(q^2)$ where $n = 2(a_1 + \ldots + a_r) + b$. The representation of $M$ is of the form $\rho_{\lambda}^{\mathrm U}\boxtimes \rho^{\mathrm{GL}}_{\lambda_1}\boxtimes \ldots \boxtimes \rho^{\mathrm{GL}}_{\lambda_r}$ where $\lambda$ is a partition of $b$, $\lambda_i$ is a partition of $a_i$. By computing the $2$-core and $2$-quotient of $\lambda$, we write $\rho_{\lambda}^{\mathrm U}$ as $\rho_{\Delta_t,\alpha,\beta}$ and we put $c = \frac{1}{2}\left(b - \frac{t(t+1)}{2}\right)$. We may also write $n = 2a + \frac{t(t+1)}{2}$ for some $a\geq 0$. By the Howlett-Lehrer bijection, the unipotent representation is sent to the irreducible character $\chi_{\alpha,\beta}\boxtimes \chi_{\lambda_1} \boxtimes \ldots \boxtimes \chi_{\lambda_r}$ of the subgroup $W_c\times \mathfrak S_{a_1} \times \ldots \times \mathfrak S_{a_r}$ of $W_a$. We induce it using the known computational rules for Coxeter groups of type $B$. We obtain a bunch of irreducible characters of $W_a$ of the form $\chi_{\gamma,\theta}$ where $(\gamma,\theta)$ are bipartitions of $a$. By the Howlett-Lehrer bijection in the other direction, they are sent to a bunch of irreducible unipotent representations of $\mathrm{U}_n(q)$ of the form $\rho_{\Delta_t,\gamma,\theta}$. All that remains is to find the partitions $\mu$'s whose $2$-cores and $2$-quotients are given by $\Delta_t$ and the data of $\gamma$ and $\theta$.\\ The methods for computing inductions in Coxeter groups of classical type may be found in \cite{geck2} Section 6.1. It turns out that we will only need one specific case of such inductions, and the corresponding method is known as the Pieri rule for groups of type $B$ which we now recall. \noindent \begin{prop}[(\cite{geck2} 6.1.9)] Let $a \geq 1$ and consider $r,s \geq 0$ such that $r+s = a$. We think of the group $W_r \times \mathfrak S_s$ as a subgroup of $W_a$ as in \textbf{5.4}. \begin{itemize} \item Let $(\alpha,\beta)$ be a bipartition of $r$. Then the induced character $$\mathrm{Ind}_{W_r \times \mathfrak S_s}^{W_a}\left(\chi_{(\alpha,\beta)} \boxtimes \chi_{(s)} \right)$$ is the multiplicity-free sum of all the characters $\chi_{\gamma,\theta}$ such that for some $0\leq d \leq s$, the Young diagram of $\gamma$ (resp. $\theta$) can be obtained from that of $\alpha$ (resp. $\beta$) by adding $d$ boxes (resp. $s-d$ boxes) so that no two of them lie in the same column. \item Let $(\gamma,\theta)$ be a bipartition of $a$. The restricted character $$\mathrm{Res}_{W_r}^{W_a}\left(\chi_{\gamma,\theta}\right)$$ is the multiplicity-free sum of all the characters $\chi_{(\alpha,\beta)}$ such that for some $0\leq d \leq s$, the Young diagram of $\alpha$ (resp. $\beta$) can be obtained from that of $\gamma$ (resp. $\theta$) by deleting $d$ boxes (resp. $s-d$ boxes) so that no two of them lie in the same column. \end{itemize} \end{prop} \noindent We will use this rule on concrete examples in the sections that follow. \section{The cohomology of the Coxeter variety for the unitary group} \paragraph{}We give a formula for the cohomology of the Coxeter variety of the unitary group in odd dimension in terms of the classification of unipotent characters that we recalled in the previous section. The cohomology groups are entirely understood by the work of Lusztig in \cite{cox}.\\ We use the notations of \textbf{2.2} and \textbf{2.5} for the unitary groups. The \textbf{Coxeter variety} for $\mathrm U_{2k+1}(q)$ is the Deligne-Lusztig variety $X_{\emptyset}(\mathrm{cox})$, where $\mathrm{cox}$ is any Coxeter element of the Weyl group $\mathbf W \simeq \mathfrak S_{2k+1}$. Recall that a Coxeter element is a permutation which can be written as the product, in any order, of exactly one simple reflexion for each $F$-orbit on $\mathbf S$. The variety $X_{\emptyset}(\mathrm{cox})$ does not depend on the choice of the Coxeter element. It is defined over $\mathbb F_{q^2}$ and is equipped with commuting actions of both $\mathrm U_{2k+1}(q)$ and $F^2$.\\ We first recall known facts on the cohomology of $X_{\emptyset}(\mathrm{cox})$ from Lusztig's work. We will write $\mathrm{H}_c^{\bullet}(X_{\emptyset}(\mathrm{cox}))$ as a shortcut for $\mathrm{H}_c^{\bullet}(X_{\emptyset}(\mathrm{cox})\otimes \overline{\mathbb F},\overline{\mathbb Q_{\ell}})$ where $\overline{\mathbb F}$ is an algebraic closure of $\mathbb F_{p^2}$. \noindent \begin{theo}[(\cite{cox})] The following statements hold. \begin{enumerate}[label=\upshape (\arabic*), topsep = 0pt] \item The variety $X_{\emptyset}(\mathrm{cox})$ has dimension $k$ and is affine. The cohomology group $\mathrm{H}^i_c(X_{\emptyset}(\mathrm{cox}))$ is zero unless $k\leq i \leq 2k$. \item The Frobenius $F^2$ acts in a semisimple manner on the cohomology of $X_{\emptyset}(\mathrm{cox})$. \item The group $\mathrm{H}^{2k}_c(X_{\emptyset}(\mathrm{cox}))$ is $1$-dimensional, the unitary group $\mathrm U_{2k+1}(q)$ acts trivially whereas $F^2$ has a single eigenvalue $q^{2k}$. \item The group $\mathrm H^{k+i}_c(X_{\emptyset}(\mathrm{cox}))$ for $0 \leq i < k$ is the direct sum of two eigenspaces of $F^2$, for the eigenvalues $q^{2i}$ and $-q^{2i+1}$. Each eigenspace is an irreducible unipotent representation of $\mathrm{U}_{2k+1}(q)$. \item If $0 \leq a \leq 2k$, the dimension of the eigenspace of $(-q)^a$ inside the sum $\sum_{i\geq 0} \mathrm H_c^i(X_{\emptyset}(\mathrm{cox}))$ is given by the formula $$q^{\frac{(2k-a)(2k+1-a)}{2}}\prod_{j = 1}^{2k-a} \frac{q^{a + j} - (-1)^{a+j}}{q^{j} - (-1)^{j}}.$$ \item The sum $\sum_{i\geq 0} \mathrm H_c^i(X_{\emptyset}(\mathrm{cox}))$ is multiplicity-free as a representation of $\mathrm U_{2k+1}(q)$. \end{enumerate} \end{theo} \paragraph{} We wish to identify these unipotent representations of $\mathrm U_{2k+1}(q)$ occuring in the cohomology of $X_{\emptyset}(\mathrm{cox})$. For this purpose, we start be defining the following partitions. If $0\leq a \leq 2k$, we put $\lambda_a^k := (1 + a, 1^{2k - a})$. Note that $\lambda_0^k = (1^{2k+1})$ and $\lambda_{2k}^k = (2k+1)$. \noindent \begin{lem} If $a = 2a'$ is even, then the $2$-core of $\lambda_{a}^k$ is $\Delta_1$ and its $2$-quotient is $((1^{k-a'}),(a'))$.\\ If $a = 2a'+1$ is odd, then the $2$-core of $\lambda_a^k$ is $\Delta_2$ and its $2$-quotient is $((a'),(1^{k-a'-1}))$. \\ In particular, the irreducible unipotent representation $\rho_{\lambda_a^k}$ of $\mathrm U_{2k+1}(q)$ is equivalent to the representation $\rho_{\Delta_1,(a'),(1^{k-a'})}$ if $a = 2a'$ is even, and to $\rho_{\Delta_2,(a'),(1^{k-a'-1})}$ if $a=2a'+1$ is odd. \end{lem} \begin{proof} The Young diagram of the partition $\lambda_a^k$ has the following shape. \begin{center} \ydiagram{3,1,1}*[\dots]{3+1}*[\vdots]{0,0,0,1}*{4+1,0,0,0,1} \end{center} The first row has an odd number of boxes when $a$ is even, and an even number of boxes when $a$ is odd. To compute the $2$-core, one removes horizontal dominoes from the first row, right to left, and vertical dominoes from the first column, bottom to top. The process results in $\Delta_1$ when $a$ is even and $\Delta_2$ when $a$ is odd. \\ The partition $\lambda_a^k$ has $2k + 1 - a$ non zero terms. Its $\beta$-set is given by the sequence $$\beta = (2k+1,2k-a,2k-a-1,\ldots ,1).$$ Assume that $a = 2a'$ is even. Then the sequences $\beta^0$ and $\beta^1$ are given by \begin{align*} \beta^0 = (k-a',k-a'-1,\ldots 1) & & \beta^1 = (k,k-a'-1,k-a'-2,\ldots ,0) \end{align*} The sequence $\beta^0$ has length $k-a'$ while $\beta^1$ has length $k-a'+1$. The associated permutations are then respectively $\mu_0 = (1^{k-a'})$ and $\mu_1 = (a')$. Because $2k + 1 - a$ is odd, the two quotient is given by $(\mu_0,\mu_1)$ as claimed.\\ Assume now that $a = 2a'+1$ is odd. Then the sequences $\beta^0$ and $\beta^1$ are given by \begin{align*} \beta^0 = (k-a'-1,k-a'-2,\ldots 1) & & \beta^1 = (k,k-a'-1,k-a'-2,\ldots ,0) \end{align*} The sequence $\beta^0$ has length $k-a'-1$ while $\beta^1$ has length $k-a'+1$. The associated permutations are then respectively $\mu_0 = (1^{k-a'-1})$ and $\mu_1 = (a')$. Because $2k + 1 - a$ is even, the two quotient is given by $(\mu_1,\mu_0)$ as claimed.\\ The last statement follows from \textbf{5.6} Proposition. \end{proof} \paragraph{}\begin{prop} For $0 \leq i < k$, the cohomology group of the Coxeter variety for the finite unitary group $\mathrm U_{2k+1}(q)$ is given by $$\mathrm H_c^{k+i}(X_{\emptyset}(\mathrm{cox})) = \rho_{\lambda_{2i}^k} \oplus \rho_{\lambda_{2i+1}^k}$$ with the first summand corresponding to the eigenvalue $q^{2i}$ of $F^2$ and the second to $-q^{2i+1}$. Moreover, $\mathrm H_c^{2k}(X_{\emptyset}(\mathrm{cox})) = \rho_{\lambda_{2k}^k}$ with eigenvalue $q^{2k}$. \end{prop} \noindent Before going to the proof, one may notice that the statement is consistent with the dimensions. Indeed, the formula given in \textbf{6.1} Theorem (5) coincides with the hook formula for the degree of the representation $\rho^{\mathrm U}_{\lambda^{k}_a}$ given in \textbf{4.4} Proposition. \begin{proof} First, the statement on the highest cohomology group $\mathrm H_c^{2k}(X_{\emptyset}(\mathrm{cox}))$ follows from \textbf{6.1} Theorem (3). It is the only cohomology group in the case $k=0$. We will prove the formula by induction on $k$. Because the case $k=0$ is already done, let us now assume $k\geq 1$ and that the proposition is known for $k-1$. Because we have to introduce Coxeter varieties for various $k$, in order to distinguish them in the notations we will temporarily write $X^k_{\emptyset}(\mathrm{cox})$ instead of $X_{\emptyset}(\mathrm{cox})$. If $0\leq i \leq k-1$, we know that $\mathrm H_c^{k+i}(X^k_{\emptyset}(\mathrm{cox}))$ is the sum of two irreducible unipotent representations. So let us write $$\mathrm H_c^{k+i}(X^k_{\emptyset}(\mathrm{cox})) = \rho_{\mu_i} \oplus \rho_{\nu_i}$$ where $\mu_i$ and $\nu_i$ are two partitions of $2k+1$, and so that $\rho_{\mu_i}$ corresponds to the eigenvalue $q^{2i}$ of $F^2$, whereas $\rho_{\nu_i}$ corresponds to $-q^{2i+1}$.\\ We consider the block-diagonal Levi complement $L \subset \mathrm U_{2k+1}(q)$ attached to the choice of simple reflexions $\{s_2,\ldots ,s_{2k-1}\}$. It is isomorphic to $\mathrm{GL}_1(q^2) \times \mathrm U_{2k-1}(q)$. Let $V$ denote the unipotent radical of the standard parabolic subgroup containing $L$. According to \cite{cox} Corollary 2.10, one can build a geometric isomorphism between the quotient variety $X^k_{\emptyset}(\mathrm{cox})/V$ and the product of the Coxeter variety for $L$ and of a copy of $\mathbb G_m$. By a discussion similar to that in \textbf{3.6}, the Coxeter variety for $L$ is isomorphic to the Coxeter variety $X^{k-1}_{\emptyset}(\mathrm{cox})$ for $\mathrm U_{2k-1}(q)$. We write $^*\mathrm R_{k-1}^{k}$ for the composition of the Harish-Chandra restriction from $\mathrm U_{2k+1}(q)$ to $L$, with the usual restriction from $L$ to the subgroup $\mathrm U_{2k-1}(q)$. For any nonnegative integer $i$, taking the cohomology groups on both sides of the isomorphism gives the following $\mathrm{U}_{2k+1}(q), F^2$-equivariant identity \begin{equation}\label{eq} ^*\mathrm R_{k-1}^{k} \left(\mathrm H^{k+i}_c(X^k_{\emptyset}(\mathrm{cox}))\right) \simeq \mathrm H^{k-1+i}_c(X^{k-1}_{\emptyset}(\mathrm{cox})) \oplus \mathrm H^{k-1+(i-1)}_c(X^{k-1}_{\emptyset}(\mathrm{cox}))(1)\tag{$*$} \end{equation} Here, $(1)$ denotes the Tate twist (the action of $F^2$ on a twist $M(n)$ is obtained from the action on the space $M$ by multiplication with $q^{2n}$). By induction, the right-hand side of this identity is given by the formula of the Proposition. Let us look at the left-hand side.\\ We fix $0\leq i \leq k-1$ and we denote by $(\Delta_t,\alpha,\beta)$ and by $(\Delta_d,\gamma,\theta)$ the alternative labelling of the representations $\rho_{\mu_i}$ and $\rho_{\nu_i}$ respectively as introduced in \textbf{5.4} and \textbf{5.6}. By the Howlett-Lehrer comparison theorem for restriction in \textbf{5.1} and by the Pieri rule in \textbf{5.7}, we know that the restriction $^*\mathrm R_{k-1}^{k} \left(\rho_{\Delta_t,\alpha,\beta}\right)$ is the multiplicity-free sum of all the representations $\rho_{\Delta_t,\alpha',\beta'}$ where the bipartition $(\alpha',\beta')$ can be obtained from $(\alpha,\beta)$ by removing exactly one box, of either $\alpha$ or $\beta$. The similar description also holds for $^*\mathrm R_{k-1}^{k} \left(\rho_{\Delta_d,\gamma,\theta}\right)$.\\ By using \textbf{6.2} Lemma and the induction hypothesis, we may write down the identity $(*)$ explicitely. Moreover, as it is $F^2$-equivariant we can identify the components corresponding to the same eigenvalues on both sides. We distinguish $4$ different cases depending on the values of $k$ and $i$. \begin{itemize} \item \textbf{Case }$\mathbf{k=1}$. We only need to consider $i=0$. On the right-hand side of $(*)$, the second term is $0$ because $k-1 + (i-1) = -1 < 0$. On the other hand, the first term is $\rho_{\lambda^0_0} \simeq \rho_{\Delta_1,\emptyset, \emptyset}$ and it corresponds to the eigenvalue $(-q)^0 = 1$. By identifying the eigenspaces, we have $^*\mathrm R_{0}^{1} \left(\rho_{\Delta_t,\alpha,\beta}\right) \simeq \rho_{\Delta_1,\emptyset,\emptyset}$ and $^*\mathrm R_{0}^{1} \left(\rho_{\Delta_d,\gamma,\theta}\right) = 0$. The second equation implies that there is no box to remove from $\gamma$ nor from $\theta$. Thus, $\gamma = \theta = \emptyset$. The value of $d$ is given by the relation $2k+1 = 3 = 2(0+0) + \frac{d(d+1)}{2}$, that is $d=2$. This corresponds to the partition $\nu_0 = \lambda^{1}_1$. We notice in passing that the representation $\rho_{\nu_0}$ is the unique unipotent cuspidal representation of $\mathrm U_3(q)$.\\ As for $\mu_0$, the equation $^*\mathrm R_{0}^{1} \left(\rho_{\Delta_t,\alpha,\beta}\right) \simeq \rho_{\Delta_1,\emptyset,\emptyset}$ tells us that there is only one removable box from $(\alpha,\beta)$. After removal of this box, both partitions are empty. Thus, we deduce that $t=1$ and $(\alpha,\beta) = ((1),\emptyset) \text{ or } (\emptyset,(1))$. This corresponds respectively to $\mu_0 = \lambda^1_2$ or $\mu_0 = \lambda^1_0$. That is, $\rho_{\mu_0}$ is either the trivial or the Steinberg representation of $\mathrm U_3(q)$. We can deduce which one it is by comparing the degree of the representations with the formula of \textbf{6.1} Theorem (5). According to this formula, the dimension of the eigenspace for $(-q)^0 = 1$ is $q^3$. This is precisely the degree of the Steinberg representation $\rho_{\lambda^{1}_0}$ as given by the hook formula in \textbf{4.4} Proposition, and it excludes the possibility of $\rho_{\mu_0}$ being trivial. Thus, we have $\mu_0 = \lambda^1_0$ as claimed. \end{itemize} From now, we assume $k\geq 2$. \begin{itemize} \item \textbf{Case }$\mathbf{i=0}$. On the right-hand side of $(*)$, the second term is $0$ because $k-1 + (i-1) = k-2 < k-1$. The first term is $\rho_{\lambda^{k-1}_0} \oplus \rho_{\lambda^{k-1}_1} \simeq \rho_{\Delta_1,\emptyset,(1^{k-1})} \oplus \rho_{\Delta_2,\emptyset,(1^{k-2})}$. Identifying the eigenspaces, we have $^*\mathrm R_{k-1}^{k} \left(\rho_{\Delta_t,\alpha,\beta}\right) \simeq \rho_{\Delta_1,\emptyset,(1^{k-1})}$ and $^*\mathrm R_{k-1}^{k} \left(\rho_{\Delta_d,\gamma,\theta}\right) \simeq \rho_{\Delta_2,\emptyset,(1^{k-2})}$. We deduce that $t=1$ and $d=2$. Moreover, it also follows that there is only one removable box in $(\alpha,\beta)$ and in $(\gamma,\theta)$. After removal, we should obtain respectively $(\emptyset,(1^{k-1}))$ and $(\emptyset,(1^{k-2}))$. The only possibility is that $(\alpha,\beta) = (\emptyset,(1^k))$ and $(\gamma,\theta) = (\emptyset,(1^{k-1}))$. This corresponds to $\mu_0 = \lambda^{k}_0$ and $\nu_0 = \lambda^{k}_1$ as claimed. \item \textbf{Case }$\mathbf{i=k-1}$. On the right-hand side of $(*)$, the first term is $\rho_{\lambda^{k-1}_{2(k-1)}}\simeq \rho_{\Delta_1,(k-1),\emptyset}$ and the second term is $\rho_{\lambda^{k-1}_{2(k-2)}} \oplus \rho_{\lambda^{k-1}_{2(k-2)+1}} \simeq \rho_{\Delta_1,(k-2),(1)} \oplus \rho_{\Delta_2,(k-2),\emptyset}$. Identifying the eigenspaces while taking the Tate twist into account, we have $^*\mathrm R_{k-1}^{k} \left(\rho_{\Delta_t,\alpha,\beta}\right) \simeq \rho_{\Delta_1,(k-1),\emptyset} \oplus \rho_{\Delta_1,(k-2),(1)}$ and $^*\mathrm R_{k-1}^{k} \left(\rho_{\Delta_d,\gamma,\theta}\right) \simeq \rho_{\Delta_2,(k-2),\emptyset}$. We deduce that $t=1$ and $d=2$. Moreover, there are two removable boxes in $(\alpha,\beta)$ and only one removable box in $(\gamma,\theta)$. After removal of one of the two boxes in $(\alpha,\beta)$, we can get either $((k-1),\emptyset)$ or $((k-2),(1))$ ; and after removal of the box in $(\gamma,\theta)$ we obtain $(k-2,\emptyset)$. The only possibility is that $(\alpha,\beta) = ((k-1),(1))$ and $(\gamma,\theta) = ((k-1),\emptyset)$. This corresponds to $\mu_{k-1} = \lambda^k_{2(k-1)}$ and $\nu_{k-1} = \lambda^{k}_{2(k-1)+1}$ as claimed. \item \textbf{Case }$\mathbf{1\leq i \leq k-2}$. On the right-hand side of $(*)$, the first term is $\rho_{\lambda^{k-1}_{2i}} \oplus \rho_{\lambda^{k-1}_{2i+1}} \simeq \rho_{\Delta_1,(i),(1^{k-1-i})} \oplus \rho_{\Delta_2,(i),(1^{k-2-i})}$. The second term is $\rho_{\lambda^{k-1}_{2(i-1)}} \oplus \rho_{\lambda^{k-1}_{2(i-1)+1}} \simeq \rho_{\Delta_1,(i-1),(1^{k-i})} \oplus \rho_{\Delta_2,(i-1),(1^{k-1-i})}$. Identifying the eigenspaces while taking the Tate twist into account, we have $^*\mathrm R_{k-1}^{k} \left(\rho_{\Delta_t,\alpha,\beta}\right) \simeq \rho_{\Delta_1,(i),(1^{k-1-i})} \oplus \rho_{\Delta_1,(i-1),(1^{k-i})}$ and $^*\mathrm R_{k-1}^{k} \left(\rho_{\Delta_d,\gamma,\theta}\right) \simeq \rho_{\Delta_2,(i),(1^{k-2-i})} \oplus \rho_{\Delta_2,(i-1),(1^{k-1-i})}$. We deduce that $t = 1$ and $d=2$. Moreover, there are exactly two removable boxes from $(\alpha,\beta)$ and from $(\gamma,\theta)$. After removal of one of the two boxes in $(\alpha,\beta)$, we can get either $((i),(1^{k-1-i}))$ or $((i-1),(1^{k-i}))$ ; and after removal of one of the two boxes in $(\gamma,\theta)$, we can get either $((i),(1^{k-2-i}))$ or $((i-1),(1^{k-1-i}))$. The only possibility is that $(\alpha,\beta) = ((i),(1^{k-i}))$ and $(\gamma,\theta) = ((i),(1^{k-1-i}))$. This corresponds to $\mu_i = \lambda^k_{2i}$ and $\nu_i = \lambda^k_{2i+1}$ as claimed. \end{itemize} \end{proof} \section{The cohomology of a closed Bruhat-Tits stratum} \paragraph{}We may now go on with the computation of the cohomology of the variety $\mathcal M_{\Lambda}$. We use the same notations as in section 2 and 3. We first compute the cohomology of each Ekedahl-Oort stratum, before using the spectral sequence associated to the stratification to conclude.\\ We fix $i \in \mathbb Z$ such that $ni$ is even and $\Lambda \in \mathcal L_i$. We write $t(\Lambda) = 2\theta +1$. Recall that $\mathcal M_{\Lambda}$ has dimension $\theta$, is defined over $\mathbb F_{p^2}$ and is equipped with an action of $\mathrm{U}_{2\theta+1}(p)$. As before, we will write $\mathrm{H}_c^{\bullet}(\mathcal M_{\Lambda})$ as a shortcut for $\mathrm{H}_c^{\bullet}(\mathcal M_{\Lambda}\otimes \overline{\mathbb F},\overline{\mathbb Q_{\ell}})$ where $\overline{\mathbb F}$ is an algebraic closure of $\mathbb F_{p^2}$. \noindent \begin{theo} The following statements hold. \begin{enumerate}[label=\upshape (\arabic*), topsep = 0pt] \item The cohomology group $\mathrm H_c^i(\mathcal M_{\Lambda})$ is zero unless $0 \leq i \leq 2\theta$. There is an isomorphism $\mathrm H_c^i(\mathcal M_{\Lambda}) \simeq \mathrm H_c^{2\theta-i}(\mathcal M_{\Lambda})^{\vee}(\theta)$ which is equivariant for the actions of $F^2$ and of $\mathrm U_{2\theta+1}(p)$. \item The Frobenius $F^2$ acts like multiplication by $(-p)^i$ on $\mathrm H_c^i(\mathcal M_{\Lambda})$. \item For $0\leq i \leq \theta$ we have $$\mathrm H_c^{2i}(\mathcal M_{\Lambda}) = \bigoplus_{s=0}^{\min(i,\theta - i)} \rho_{(2\theta + 1 - 2s, 2s)}.$$ For $0\leq i \leq \theta - 1$ we have $$\mathrm H_c^{2i+1}(\mathcal M_{\Lambda}) = \bigoplus_{s=0}^{\min(i,\theta - 1 - i)} \rho_{(2\theta - 2s, 2s + 1)}.$$ \end{enumerate} \end{theo} \noindent Thus, in the cohomology of $\mathcal M_{\Lambda}$ all the representations associated to a Young diagram with at most $2$ rows occur, and there is no other. Such a diagram has the following general shape. \begin{center} \ydiagram{4,2}*[\ldots]{4+1,2+1}*{5+1,3+1} \end{center} We may rephrase the result by using the alternative labelling of the irreducible unipotent representations as in \textbf{5.6}. The partition $(2\theta+1-2s,2s)$ has $2$-core $\Delta_1$ and $2$-quotient $(\emptyset,(\theta-s,s))$ ; whereas the partition $(2\theta-2s,2s+1)$ has $2$-core $\Delta_2$ and $2$-quotient $((\theta-1-s,s),\emptyset)$. Thus, according to \textbf{5.6} Proposition, we have \begin{align*} \rho_{(2\theta + 1 - 2s, 2s)} \simeq \rho_{\Delta_1,(\theta-s,s),\emptyset} & & \rho_{(2\theta - 2s, 2s + 1)} \simeq \rho_{\Delta_2,(\theta-1-s,s),\emptyset} \end{align*} In particular, all irreducible characters in the cohomology groups of even index belong to the unipotent principal series $\mathcal E(\mathrm U_{2\theta +1}(p),(L_1,\rho_1))$, whereas all the ones in the groups of odd index belong to the Harish-Chandra series $\mathcal E(\mathrm U_{2\theta+1}(p),(L_2,\rho_2))$. \begin{proof} Point (1) of the statement follows from a general property of the cohomology groups, namely Poincaré duality. It is due to the fact that $\mathcal M_{\Lambda}$ is projective and smooth. It also implies the purity of the Frobenius $F^2$ on the cohomology : we know at this stage that all eigenvalues of $F^2$ on $\mathrm H_c^i(\mathcal M_{\Lambda})$ have absolute value $p^i$.\\ We prove the points (2) and (3) by explicit computations. As in \textbf{6.2}, we denote by $\lambda^k_a$ the partition $(1+a, 1^{2k-a})$ of $2k+1$. Let $0\leq \theta' \leq \theta$. Using the same notations as in section 3, for $0\leq i \leq 2\theta$ we will write $$\mathrm R_{a}^{\theta'} := \mathrm R_{L_{J_{\theta'}}}^{\mathrm U_{2\theta+1}(p)}\left(\rho_{(\theta-\theta')}^{\mathrm{GL}}\boxtimes \rho^{\mathrm U}_{\lambda^{\theta'}_{a}}\right).$$ Recall that \textbf{3.4} Proposition gives an isomorphism between the Ekedahl-Oort stratum $\mathcal M_{\Lambda}(2\theta' +1)$ and the variety $G/U_{J_{\theta'}} \times_{L_{J_{\theta'}}} X^{\mathbf L_{J_{\theta'}}}_{I_{\theta'}}(w_{\theta'})$. It implies that the cohomology of the Ekedahl-Oort stratum is the Harish-Chandra induction of the cohomology of the Deligne-Lusztig variety $X_{I_{\theta'}}^{\mathbf L_{J_{\theta'}}}(w_{\theta'})$. According to \textbf{3.6}, this cohomology is related to that of the Coxeter variety for $\mathrm U_{2\theta' + 1}(p)$. Combining with the formula of \textbf{6.3} Proposition, for $0 \leq i \leq \theta - 1$ it follows that \begin{align*} \mathrm H_c^{\theta' + i}(\mathcal M_{\Lambda}(2\theta'+1)) = \mathrm R_{2i}^{\theta'} \oplus \mathrm R_{2i+1}^{\theta'} & & \mathrm H_c^{2\theta'}(\mathcal M_{\Lambda}(2\theta' +1)) = \mathrm R_{2\theta'}^{\theta'} \end{align*} The representation $R_{a}^{\theta}$ in this formula is associated to the eigenvalue $(-p)^a$ of $F^2$.\\ \noindent We first compute $\mathrm R_a^{\theta}$ explicitely. By the combination of the Howhlett-Lehrer comparison theorem in \textbf{5.1} and the Pieri rule for groups of type $B$ as in \textbf{5.7}, one can compute the Harish-Chandra induction $\mathrm R_a^{\theta}$ by adding $\theta-\theta'$ boxes to the bipartition corresponding to the representation $\rho^{\mathrm U}_{\lambda^{\theta'}_a}$ with no two added boxes in the same column. Recall from \textbf{6.2} Lemma that the representation $\rho_{\lambda_{2i}^{\theta'}}$ of $\mathrm U_{2\theta'+1}(q)$ is equivalent to the representation $\rho_{\Delta_1,(i),(1^{\theta'-i})}$, and that $\rho_{\lambda_{2i+1}^{\theta'}}$ is equivalent to $\rho_{\Delta_2,(i),(1^{\theta'-1-i})}$.\\ In order to illustrate the argument, let us say that we want to add $N$ boxes to a bipartition of the shape as in figure below, so that no two added boxes lie in the same column. \begin{center} \ydiagram{3}*[\ldots]{3+1}*{4+1} \quad , \quad \ydiagram{1,1,1,0,1}*[\vdots]{0,0,0,1} \end{center} We will add $N_1$ boxes to the first diagram and $N_2$ to the second, where $N = N_1 + N_2$. In the first diagram, the only places where we can add boxes are in the second row from left to right, and at the end of the first row. Because no two added boxes must be in the same column, the number of boxes we add on the second row must be at most the number of boxes already lying in the first row. Of course, it must also be at most $N_1$.\\ In the second diagram, the only places where we can add boxes are at the bottom of the first column and at the end of the first row. Because no two added boxes must be in the same column, we can only put up to one box at the bottom of the first column and all the remaining ones will align at the end of the first row.\\ At the end of the process, we will obtain a bipartition of the following general shape. \begin{center} \ydiagram[*(yellow)]{3}*{0,2}*[*(yellow) \dots]{3+1}*[\dots]{0,2+1}*[*(yellow)]{4+1}*{0,3+1}*[\ldots]{5+1}*{6+1} \quad , \quad \ydiagram[*(yellow)]{1,1,1,0,1}*{1+1}*[*(yellow) \vdots]{0,0,0,1}*[\dots]{2+1}*[?]{0,0,0,0,0,1}*{3+1} \end{center} We coloured in yellow the boxes that were already there before we added new ones. The box with a question mark may or may not be placed there.\\ We now make the result more precise, and write down exactly what the irreducible components of $\mathrm R_{a}^{\theta'}$ are depending on the parity of $a$. \begin{itemize} \item For $0\leq i \leq \theta'$, the representation $\mathrm R_{2i}^{\theta'}$ is the multiplicity-free sum of all the representations $\rho_{\Delta_1,\alpha,\beta}$ where the bipartition $(\alpha,\beta)$ satisfies, for some $0 \leq d \leq \theta - \theta'$, $$\begin{cases} \alpha = (i + d - s, s) \text{ for some } 0\leq s \leq \min(d,i)\\ \beta = (\theta - \theta' - d, 1^{\theta' - i}) \text{ or } (\theta - \theta' - d + 1, 1^{\theta' - i - 1}) \end{cases}.$$ \item For $0\leq i \leq \theta' - 1$, the representation $\mathrm R_{2i+1}^{\theta'}$ is the multiplicity-free sum of all representations $\rho_{\Delta_2,\alpha,\beta}$ where the bipartition $(\alpha,\beta)$ satisfies, for some $0 \leq d \leq \theta - \theta'$, $$\begin{cases} \alpha = (i + d - s, s) \text{ for some } 0\leq s \leq \min(d,i)\\ \beta = (\theta - \theta' + 1 - d, 1^{\theta' - 1 - i}) \text{ or } (\theta - \theta' +2 - d, 1^{\theta' - 2 - i}) \end{cases}.$$ \end{itemize} \noindent In our notation, we used the convention that the partitions $(0)$ and $(1^0)$ are the empty partition $\emptyset$. Moreover if $i$ takes the maximal value, there is only one possibility for $\beta$ that is respectively $(\theta-\theta'-d)$ in the first case and $(\theta - \theta' + 1 - d)$ in the second case.\\ By the Ekedahl-Oort stratification, the variety $\mathcal M_{\Lambda}$ is the union of the strata $\mathcal M_{\Lambda}(2\theta' + 1)$ for $0\leq \theta' \leq \theta$ and the closure of the stratum for $\theta'$ is the union of all strata $\mathcal M_{\Lambda}(2s+1)$ for $s \leq \theta'$. At the level of cohomology, it translates into the following $F^2,\mathrm{U}_{2\theta+1}(p)$-equivariant spectral sequence $$\mathrm E_1^{p,q} : \mathrm H_c^{p+q}(\mathcal M_{\Lambda}(2p+1)) \implies \mathrm H_c^{p+q}(\mathcal M_{\Lambda}).$$ The first page of the sequence is drawn below, it has a triangular shape. \begin{adjustwidth}{-1cm}{0pt} $$ \begin{tikzcd} \, & \, & \, & \, & \, & \, & \, & \mathrm R_{2\theta}^{\theta}\\ \, & \, & \, & \, & \, & \, & \quad \mathrm R_{2\theta - 2}^{\theta-1} \quad \arrow{r} & \mathrm R_{2\theta - 2}^{\theta} \oplus \mathrm R_{2\theta-1}^{\theta}\\ \, & \, & \, & \, & \reflectbox{$\ddots$} & \, & \, & \vdots\\ \, & \, & \quad \mathrm R_4^2 \quad \arrow{r} & \, & \ldots & \arrow{r} & \mathrm R_4^{\theta - 1} \oplus \mathrm R_5^{\theta-1} \arrow{r} & \mathrm R_4^{\theta} \oplus \mathrm R_5^{\theta}\\ \, & \quad \mathrm R^1_2 \quad \arrow{r} & \mathrm R^2_2 \oplus \mathrm R^2_3 \arrow{r} & \, & \ldots & \arrow{r} & \mathrm R_2^{\theta - 1} \oplus \mathrm R_3^{\theta-1} \arrow{r} & \mathrm R_2^{\theta} \oplus \mathrm R_3^{\theta} \\ \mathrm R_0^0 \arrow{r} & \mathrm R_0^1 \oplus \mathrm R_1^1 \arrow{r} & \mathrm R_0^2 \oplus \mathrm R_1^2 \arrow{r} & \, & \ldots & \arrow{r} & \mathrm R_0^{\theta-1} \oplus \mathrm R_1^{\theta-1} \arrow{r} & \mathrm R_0^{\theta}\oplus \mathrm R_1^{\theta} \end{tikzcd} $$ \end{adjustwidth} \noindent The representation $\mathrm R^{\theta'}_{a}$ corresponds to the eigenvalue $(-p)^a$ of $F^2$ as before. Because we already know the purity of the cohomology of $\mathcal M_{\Lambda}$, the spectral sequence must degenerate on the second page. Moreover, it also follows that all terms which do not lie on the first nor second diagonal of this triangular shape must vanish. Point (2) of the theorem now readily follows.\\ By the previous computations, we understand precisely all the terms in this spectral sequence. The key observation is that two terms of the sequence which lie on the same row but are separated by at least $2$ arrows, do not have any irreducible components in common. That is the reason why we will be able to make out precisely what remains and what vanishes after the first page. We make the argument more precise in the following two paragraphs, distinguishing the cohomology groups of even and odd index.\\ \noindent We first compute the cohomology group $\mathrm H_{c}^{2\theta'}(\mathcal M_{\Lambda})$, for $0\leq \theta' \leq \theta$. We look at the following portion of the first page $$ \begin{tikzcd} \mathrm R^{\theta'}_{2\theta'} \arrow{r} & \mathrm R_{2\theta'}^{\theta'+1} \oplus \mathrm R_{2\theta' +1}^{\theta' +1} \arrow{r} & \mathrm R_{2\theta'}^{\theta' + 2} \oplus \mathrm R_{2\theta' +1}^{\theta' +2} \end{tikzcd}. $$ By extracting the eigenspaces corresponding to $p^{2\theta'}$, we actually have the following sequence. $$ \begin{tikzcd} \mathrm R^{\theta'}_{2\theta'} \arrow{r}{u} & \mathrm R_{2\theta'}^{\theta'+1} \arrow{r}{v} & \mathrm R_{2\theta'}^{\theta' + 2} \end{tikzcd}. $$ The representation $\mathrm R^{\theta'}_{2\theta'}$ is the sum of all the representations $\rho_{\Delta_1,\alpha,\beta}$ where for some $0\leq d \leq \theta - \theta'$ and for some $0\leq s \leq \min(d,\theta')$, we have $\alpha = (\theta' + d - s, s)$ and $\beta = (\theta - \theta' - d)$.\\ The representation $\mathrm R^{\theta'+1}_{2\theta'}$ is the sum of all characters $\rho_{\Delta_1,\alpha',\beta'}$ where for some $0\leq d' \leq \theta - \theta' - 1$ and for some $0\leq s \leq \min(d',\theta')$, we have $\alpha' = (\theta' + d' - s, s)$ and $\beta' = (\theta - \theta' - d')$ or $(\theta - \theta' - d' - 1, 1)$.\\ The whole of $\mathrm R^{\theta+1}_{2\theta}$ must vanish in the second page of the spectral sequence because of the purity. Now, inside the representation $\mathrm R^{\theta'+2}_{2\theta'}$, all the irreducible representations have the shape $\rho_{\Delta_1,\alpha'',\beta''}$ with $\beta'' = (?,1)$ or $(?,1^2)$. In particular, all the representations $\rho_{\Delta_1,\alpha',\beta'}$ of $\mathrm R^{\theta'+1}_{2\theta'}$ with $\beta' = (\theta - \theta' - d')$ automatically lie inside the kernel of $v$.\\ Because all of these representations must vanish in the second page, they also lie inside the image of $u$. As a consequence, all the representations $\rho_{\Delta_1,\alpha,\beta}$ inside $\mathrm R^{\theta'}_{2\theta'}$ having $d \not = \theta - \theta'$ are not in the kernel of $u$. Thus, they will all vanish in the second page.\\ The remaining representations in $\mathrm R^{\theta'}_{2\theta'}$ are those having $d = \theta - \theta'$, and they do not occur in the codomain of $u$. By the argument above, they must form the whole of $\mathrm{Ker}(u)$.\\ Thus, we have proved that $$\mathrm H_{c}^{2\theta'}(\mathcal M_{\Lambda}) \simeq \mathrm{Ker}(u) = \bigoplus_{s = 0}^{\min(\theta',\theta-\theta')} \rho_{\Delta_1,(\theta'-s,s),\emptyset}$$ and it coincides with the formula of point (3).\\ \noindent We now compute the cohomology group $\mathrm H_{c}^{2\theta'+1}(\mathcal M_{\Lambda})$, for $0\leq \theta' \leq \theta-1$. We look at the following portion of the first page $$ \begin{tikzcd} \mathrm R^{\theta'}_{2\theta'} \arrow{r} & \mathrm R_{2\theta'}^{\theta'+1} \oplus \mathrm R_{2\theta' +1}^{\theta' +1} \arrow{r} & \mathrm R_{2\theta'}^{\theta' + 2} \oplus \mathrm R_{2\theta' +1}^{\theta' +2} \arrow{r} & \mathrm R^{\theta' + 3}_{2\theta'} \oplus \mathrm R^{\theta' + 3}_{2\theta' +1} \end{tikzcd}. $$ By extracting the eigenspaces corresponding to $-p^{2\theta'+1}$, we actually have the following sequence. $$ \begin{tikzcd} 0 \arrow{r} & \mathrm R_{2\theta'+1}^{\theta'+1} \arrow{r}{u} & \mathrm R_{2\theta'+1}^{\theta' + 2} \arrow{r}{v} & \mathrm R^{\theta' + 3}_{2\theta' +1} \end{tikzcd}. $$ The representation $\mathrm R^{\theta'+1}_{2\theta'+1}$ is the sum of all the representations $\rho_{\Delta_2,\alpha,\beta}$ where for some $0\leq d \leq \theta - \theta' - 1$ and for some $0\leq s \leq \min(d,\theta')$, we have $\alpha = (\theta' + d - s,s)$ and $\beta = (\theta - \theta' - d)$.\\ The representation $\mathrm R^{\theta'+2}_{2\theta'+1}$ is the sum of all the representations $\rho_{\Delta_2,\alpha',\beta'}$ where for some $0\leq d' \leq \theta - \theta' - 2$ and for some $0\leq s \leq \min(d',\theta')$, we have $\alpha' = (\theta' + d' -s,s)$ and $\beta' = (\theta-\theta' - 1 - d', 1)$ or $(\theta - \theta' - d')$.\\ The whole of $\mathrm R^{\theta'+2}_{2\theta'+1}$ must vanish in the second page of the spectral sequence because of the purity. Now, inside the representation $\mathrm R^{\theta'+3}_{2\theta'+1}$, all the irreducible components have the shape $\rho_{\Delta_2,\alpha'',\beta''}$ with $\beta'' = (?,1)$ or $(?,1^2)$. In particular, all the representations $\rho_{\Delta_2,\alpha',\beta'}$ of $\mathrm R^{\theta'+2}_{2\theta'+1}$ with $\beta' = (\theta - \theta' - d')$ automatically lie inside the kernel of $v$.\\ Because all of these characters must vanish in the second page, they also lie inside the image of $u$. As a consequence, all the characters $\rho_{\Delta_2,\alpha,\beta}$ inside $\mathrm R^{\theta'+1}_{2\theta'+1}$ having $d \not = \theta - \theta' - 1$ are not in the kernel of $u$. Thus, they will all vanish in the second page.\\ The remaining characters in $\mathrm R^{\theta'+1}_{2\theta'+1}$ are those having $d = \theta - \theta' - 1$, and they do not occur in the codomain of $u$. By the argument above, they must form the whole of $\mathrm{Ker}(u)$.\\ Thus, we have proved that $$\mathrm H_{c}^{2\theta'+1}(\mathcal M_{\Lambda}) \simeq \mathrm{Ker}(u) = \bigoplus_{s = 0}^{\min(\theta-\theta'-1, \theta')} \rho_{\Delta_2,(\theta'-1-s,s),\emptyset}$$ and one may check that it coincides with the formula of point (3). \end{proof} \newpage \phantomsection \printbibliography[heading=bibintoc, title={Bibliography}] \markboth{Bibliography}{Bibliography} \end{document}
\section{Introduction} During the past decade, deep neural networks (DNNs) have achieved the state-of-the-art performance in many machine learning tasks such as computer vision and natural language processing. However, the DNN suffers from a training-prediction dilemma from the perspective of statistical inference: {\it A small DNN model can be well calibrated, but tends to get trapped into a local optimum; on the other hand, an over-parameterized DNN model can be easily trained to a global optimum (with zero training loss), but tends to be miscalibrated \citep{CalibrationDNN2017}}. In consequence, it is often unclear whether a DNN is guaranteed to have a desired property after training instead of getting trapped into an arbitrarily poor local minimum, or whether its decision/prediction is reliable. This difficulty makes the trustworthiness of AI highly questionable. To resolve this difficulty, researchers have attempted from two sides of the training-prediction dilemma. Towards understanding the optimization process of the DNN training, a line of researches have been done. For example, \cite{GoriTesi1992} and \cite{Nguyen2017TheLS} studied the training loss surface of over-parameterized DNNs. They showed that for a fully connected DNN, almost all local minima are globally optimal, if the width of one layer of the DNN is no smaller than the training sample size and the network structure from this layer on is pyramidal. Recently, \cite{AllenZhu2019ACT,Du2019GradientDF, Zou2020GradientDO} and \cite{ZouGu2019} explored the convergence theory of the gradient-based algorithms in training over-parameterized DNNs. They showed that the gradient-based algorithms with random initialization can converge to global minima provided that the width of the DNN is polynomial in training sample size. To improve calibration of the DNN, different methods have been developed, see e.g., Monte Carlo dropout \citep{MCdropout2016} and deep ensemble \citep{Deepensemble2017}. However, these methods did not provide a rigorous study for the asymptotic distribution of the DNN prediction and thus could not correctly quantify its uncertainty. Recently, researchers have attempted to address this issue with sparse deep learning. For example, for Bayesian sparse neural networks, \cite{liang2018bayesian}, \cite{polson2018posterior} and \cite{SunSLiang2021} established the posterior consistency, and \cite{Wang2020UncertaintyQF} further established the Bernstein-von Mises (BvM) theorem for linear and quadratic functionals. The latter guarantees in theory that the Bayesian credible region has a faithful frequentist coverage. However, since the theory by \cite{Wang2020UncertaintyQF} does not cover the point evaluation functional, the uncertainty of the DNN prediction still cannot be correctly quantified. Moreover, their theory is developed with the spike-and-slab prior (i.e., each weight or bias of the DNN is subject to a spike-and-slab prior), whose discrete nature makes the resulting posterior distribution extremely hard to simulate. To facilitate computation, \cite{SunSLiang2021} employed a mixture Gaussian prior. However, due to nonconvexity of the loss function of the DNN, a direct MCMC simulation still cannot be guaranteed to converge to the right posterior distribution even with the mixture Gaussian prior. In this paper, we provide a new framework for sparse deep learning, which successfully resolved the training-prediction dilemma. In particular, we propose two prior annealing algorithms, one from the frequentist perspective and one from the Bayesian perspective, for learning sparse neural networks. The algorithms start with an over-parameterized deep neural network and then have its structure gradually sparsified. We provide a theoretical guarantee that the training procedures are immune to local traps, the resulting sparse structures are consistent, and the predicted values are asymptotically normally distributed. The latter enables the prediction uncertainty correctly quantified. Our contribution in this paper is two-fold: \begin{itemize} \item We provide a new framework for sparse deep learning, which is immune to local traps and miscalibration. \item We lay down the theoretical foundation for how to make statistical inference with sparse deep neural networks. \end{itemize} The remaining part of the paper is organized as follows. Section 2 lays down the theoretical foundation for sparse deep learning. Section 3 describes the proposed prior annealing algorithms. Section 4 presents some numerical results. Section 5 concludes the paper. \section{Theoretical Foundation for Sparse Deep Learning} As mentioned previously, sparse deep learning has received much attention as a promising way for addressing the miscalibration issue of the DNN. Theoretically, the approximation power of the sparse DNN has been studied for various classes of functions \citep{Schmidt-Hieber2017Nonparametric,Bolcskei2019}. Under the Bayesian setting, posterior consistency has been established in \cite{liang2018bayesian,polson2018posterior,SunSLiang2021}. In particular, the work \cite{SunSLiang2021} has achieved important progress toward taming sparse DNNs into the framework of statistical modeling. They provide a neural network approximation theory fundamentally different from the existing ones. In the existing theory, no data is involved and a small network can potentially achieve an arbitrarily small approximation error by allowing connection weights to take values in an unbounded space. In contrast, the theory by \cite{SunSLiang2021} links the network approximation error, the network size, and the bound of connection weights to the training sample size. They prove that for a given training sample size $n$, a sparse DNN of size $O(n/\log(n))$ has been large enough to approximate many types of functions, such as affine functions and piecewise smooth functions, arbitrarily well as $n\to \infty$. Moreover, they prove that the sparse DNN possesses many theoretical guarantees. For example, its structure is more interpretable, from which the relevant variables can be consistently identified for high-dimensional nonlinear systems; and its generalization error bound is asymptotically optimal. From the perspective of statistical inference, some gaps remain toward taming sparse DNNs into the framework of statistical modeling. This paper bridges the gap by establishing (i) asymptotic normality of the connection weights, and (ii) asymptotic normality of the prediction. \subsection{Posterior consistency and structure selection consistency} This subsection provides a brief review of the sparse DNN theory developed in \cite{SunSLiang2021} and gives the conditions that we will use in the followed theoretical developments. Without loss of generality, we let $D_{n}=(\boldsymbol{x}^{(i)},y^{(i)})_{i=1,...,n}$ denote a dataset of $n$ $i.i.d$ observations, where $\boldsymbol{x}^{(i)}\in R^{p_n}$ and $y^{(i)}\in R$. Consider a generalized linear model with the distribution of $y$ given by \[ f(y|\mu^*({\boldsymbol x}))=\exp\{A(\mu^*({\boldsymbol x}))y+B(\mu^*({\boldsymbol x}))+C(y)\}, \] where $\mu^*({\boldsymbol x})$ is a nonlinear function of ${\boldsymbol x}$ and $A(\cdot)$, $B(\cdot)$ and $C(\cdot)$ are appropriately defined functions. For example, for normal regression, we have $A(\mu^*)=\mu^*/\sigma^2$, $B(\mu^*)=-{\mu^*}^2/2\sigma^2$, $C(y)=-y^2/2\sigma^2-\log(2\pi \sigma^2)/2$, and $\sigma^2$ is a constant. We approximate $\mu^*({\boldsymbol x})$ using a fully connected DNN with $H_{n}-1$ hidden layers. Let $L_h$ denote the number of hidden units at layer $h$ with $L_{H_n}=1$ for the output layer and $L_{0}=p_{n}$ for the input layer. Let $\boldsymbol{w}^{h}\in \mathbb{R}^{L_{h}\times L_{h-1}}$ and $\boldsymbol{b}^{h}\in \mathbb{R}^{L_{h}\times1}$, $h\in\{1,2,...,H_n\}$ denote the weights and bias of layer $h$, and let $\psi^{h}: \mathbb{R}^{L_{h}\times1}\to \mathbb{R}^{L_{h}\times1}$ denote a coordinate-wise and piecewise differentiable activation function of layer $h$. The DNN forms a nonlinear mapping \begin{equation} \label{appeq} \mu({\boldsymbol \beta},\boldsymbol{x})=\boldsymbol{w}^{H_{n}}\psi^{H_{n}-1}\left[\cdots\psi^{1}\left[\boldsymbol{w}^{1}\boldsymbol{x}+\boldsymbol{b}^{1}\right]\cdots\right]+\boldsymbol{b}^{H_{n}}, \end{equation} where ${\boldsymbol \beta}=({\boldsymbol w},{\boldsymbol b})=\big\{ {w}_{ij}^{h},{b}_{k}^{h} : h\in\{1,\ldots,H_{n}\}, i,k\in\{ 1,\ldots,L_{h}\}, j\in\{ 1,\ldots,L_{h-1}\} \big\}$ denotes the collection of all weights and biases, consisting of $K_{n}=\sum_{h=1}^{H_{n}}\left(L_{h-1}\times L_{h}+L_{h}\right)$ elements. For convenience, we treat bias as a special connection and call each element in ${\boldsymbol \beta}$ a connection weight. In order to represent the structure for a sparse DNN, we introduce an indicator variable for each connection weight. Let ${\boldsymbol \gamma}^{\boldsymbol{w}^{h}}$ and ${\boldsymbol \gamma}^{\boldsymbol{b}^{h}}$ denote the indicator variables associated with $\boldsymbol{w}^{h}$ and $\boldsymbol{b}^{h}$, respectively. Let $\boldsymbol{\gamma}=\{ \gamma_{ij}^{\boldsymbol{w}^{h}},\gamma_{k}^{\boldsymbol{b}^{h}}: h\in\{1,\ldots,H_{n}\}$, $i,k\in\left\{ 1,\ldots,L_{h}\right\} ,j\in\left\{ 1,\ldots,L_{h-1}\right\}\} $, which specifies the structure of the sparse DNN. With slight abuse of notation, we will also write $\mu({\boldsymbol \beta},{\boldsymbol x})$ as $\mu({\boldsymbol \beta}, {\boldsymbol x}, {\boldsymbol \gamma})$ to include the information of the network structure. We assume $\mu^*({\boldsymbol x})$ can be well approximated by a {\it parsimonious neural network} with relevant variables, and call this parsimonious network as the {\it true DNN model}. More precisely, we define the {\it true DNN model} as \begin{equation} \label{trueDNNeq} ({\boldsymbol \beta}^*,{\boldsymbol \gamma}^*)=\underset{({\boldsymbol \beta},{\boldsymbol \gamma})\in {\cal G}_n,\, \|\mu({\boldsymbol \beta},{\boldsymbol \gamma}, {\boldsymbol x})-\mu^*({\boldsymbol x})\|_{L^2(\Omega)} \leq \varpi_n}{\operatorname{arg\,min}}|{\boldsymbol \gamma}|, \end{equation} where ${\cal G}_n:={\cal G}(C_0,C_1,\varepsilon,p_n,H_n,L_1,L_2,\ldots,L_{H_n})$ denotes the space of valid sparse networks satisfying condition A.2 (given below) for the given values of $H_n$, $p_n$, and $L_h$'s, and $\varpi_n$ is some sequence converging to 0 as $n \to \infty$. For any given DNN $({\boldsymbol \beta},{\boldsymbol \gamma})$, the error $\mu({\boldsymbol \beta},{\boldsymbol \gamma},{\boldsymbol x})-\mu^*({\boldsymbol x})$ can be generally decomposed as the network approximation error $\mu({\boldsymbol \beta}^*,{\boldsymbol \gamma}^*,{\boldsymbol x})-\mu^*({\boldsymbol x})$ and the network estimation error $\mu({\boldsymbol \beta},{\boldsymbol \gamma},{\boldsymbol x})-\mu({\boldsymbol \beta}^*,{\boldsymbol \gamma}^*,{\boldsymbol x})$. The $L_2$ norm of the former is bounded by $\varpi_n$, and the order of the latter will be given in Lemma \ref{2normal}. For the sparse DNN, we make the following assumptions: \begin{enumerate} \item[A.1] The input ${\boldsymbol x}$ is bounded by 1 entry-wisely, i.e. ${\boldsymbol x}\in \Omega=[-1,1]^{p_n}$, and the density of ${\boldsymbol x}$ is bounded in its support $\Omega$ uniformly with respect to $n$. \item[A.2] The true sparse DNN model satisfies the following conditions: \begin{itemize} \item[A.2.1] The network structure satisfies: $r_nH_n\log n$ $+r_n\log\overline L+s_n\log p_n\leq C_0n^{1-\varepsilon}$, where $0<\varepsilon<1$ is a small constant, $r_n=|{\boldsymbol \gamma}^*|$ denotes the connectivity of ${\boldsymbol \gamma}^*$, $\overline{L}=\max_{1\leq j\leq H_n-1}L_j$ denotes the maximum hidden layer width, $s_n$ denotes the input dimension of ${\boldsymbol \gamma}^*$. \item[A.2.2] The network weights are polynomially bounded: $\|{\boldsymbol \beta}^*\|_\infty\leq E_n$, where $E_n=n^{C_1}$ for some constant $C_1>0$. \end{itemize} \item[A.3] The activation function $\psi$ is Lipschitz continuous with a Lipschitz constant of 1. \end{enumerate} Refer to \cite{SunSLiang2021} for explanations and discussions on these assumptions. We let each connection weight and bias be subject to a mixture Gaussian prior, i.e., \begin{equation} \label{marprior} \begin{split} & {w}_{ij}^{h} \sim\lambda_{n}N(0,\sigma_{1,n}^{2})+(1-\lambda_{n})N(0,\sigma_{0,n}^{2}), \quad {b}_{k}^{h} \sim\lambda_{n}N(0,\sigma_{1,n}^{2})+(1-\lambda_{n})N(0,\sigma_{0,n}^{2}), \end{split} \end{equation} where $\lambda_n\in (0,1)$ is the mixture proportion, $\sigma_{0,n}^{2}$ is typically set to a very small number, while $\sigma_{1,n}^{2}$ is relatively large. \paragraph{Posterior Consistency} Let $P^{*}$ and $E^{*}$ denote the respective probability measure and expectation with respect to data $D_{n}$. Let $d(p_1,p_2)$ denote the Hellinger distance between two densities $p_{1}(\boldsymbol{x},y)$ and $p_{2}(\boldsymbol{x},y)$. Let $\pi(A\mid D_{n})$ be the posterior probability of an event $A$. \begin{lemma}\label{2normal} (Theorem 2.1 of \cite{SunSLiang2021}) Suppose Assumptions A.1-A.3 hold. If the mixture Gaussian prior (\ref{marprior}) satisfies the conditions: $\lambda_n = O( 1/\{K_n[n^{H_n}(\overline Lp_n)]^{\tau}\})$ for some constant $\tau>0$, $E_n/\{H_n\log n+\log \overline L\}^{1/2} \lesssim \sigma_{1,n} \lesssim n^{\alpha}$ for some constant $\alpha>0$, and $\sigma_{0,n} \lesssim \min\big\{ 1/\{\sqrt{n} K_n (n^{3/2} \sigma_{1,0} /H_n)^{H_n}\}$, $1/\{\sqrt{n} K_n (n E_n/H_n)^{H_n}\} \big\}$, then there exists an error sequence $\epsilon_n^2 =O(\varpi_n^2)+O(\zeta_n^2)$ such that $\lim_{n\to \infty} \epsilon_n= 0$ and $\lim_{n\to \infty} n\epsilon_n^2= \infty$, and the posterior distribution satisfies \begin{equation}\label{postcon} \begin{split} & P^*\left\{ \pi[d(p_{{\boldsymbol \beta}},p_{\mu^*}) > 4 \epsilon_n |D_n] \geq 2 e^{-cn \epsilon_n^2} \right\} \leq 2 e^{-cn \epsilon_n^2},\\ & E_{D_n}^* \pi[d(p_{{\boldsymbol \beta}},p_{\mu^*}) > 4 \epsilon_n | D_n] \leq 4 e^{-2cn \epsilon_n^2}, \end{split} \end{equation} for sufficiently large $n$, where $c$ denotes a constant, $\zeta_n^2=[r_nH_n\log n+r_n\log \overline L+s_n\log p_n]/n$, $p_{\mu^*}$ denotes the underlying true data distribution, and $p_{\boldsymbol \beta}$ denotes the data distribution reconstructed by the Bayesian DNN based on its posterior samples. \end{lemma} \paragraph{Structure Selection Consistency} The DNN is generally nonidentifiable due to the symmetry of network structure. For example, $\mu({\boldsymbol \beta},{\boldsymbol \gamma}, {\boldsymbol x})$ can be invariant if one permutes certain hidden nodes or simultaneously changes the signs or scales of certain weights. As in \cite{SunSLiang2021}, we define a set of DNNs by $\Theta$ such that any possible DNN can be represented by one and only one DNN in $\Theta$ via nodes permutation, sign changes, weight rescaling, etc. Let $\nu({\boldsymbol \gamma},{\boldsymbol \beta}) \in \Theta$ be an operator that maps any DNN to $\Theta$ via appropriate weight transformations. To serve the purpose of structure selection in $\Theta$, we consider the marginal inclusion posterior probability (MIPP) approach proposed in \cite{LiangSY2013}. For each connection, we define its MIPP by $q_i=\int \sum_{{\boldsymbol \gamma}} e_{i|\nu({\boldsymbol \gamma},{\boldsymbol \beta})} \pi({\boldsymbol \gamma}|{\boldsymbol \beta},D_n) \pi({\boldsymbol \beta}|D_n) d{\boldsymbol \beta}$ for $i=1,2,\ldots, K_n$, where $e_{i|\nu({\boldsymbol \gamma},{\boldsymbol \beta})}$ is the indicator of connection $i$. The MIPP approach is to choose the connections whose MIPPs are greater than a threshold $\hat{q}$, i.e., setting $\hat{{\boldsymbol \gamma}}_{\hat{q}}=\{i: q_i > \hat{q}, i=1,2,\ldots, K_n\}$ as an estimator of ${\boldsymbol \gamma}^*\in \Theta$. Let $A(\epsilon_n)=\{{\boldsymbol \beta}: d(p_{\boldsymbol \beta},p_{\mu^*})\geq \epsilon_n\}$ and define $ \rho(\epsilon_n) = \max_{1\leq i\leq K_n} \int_{A(\epsilon_n)^c} \sum_{{\boldsymbol \gamma}} |e_{i|\nu({\boldsymbol \gamma},{\boldsymbol \beta})}-e_{i|\nu({\boldsymbol \gamma}^*,{\boldsymbol \beta}^*)}|\pi({\boldsymbol \gamma}|{\boldsymbol \beta}, D_n) \pi({\boldsymbol \beta}|D_n)d{\boldsymbol \beta}, $ which measures the structure difference between the true and sampled models on $A({\epsilon_n})^c$. Then we have: \begin{lemma} \label{Selectlem} (Theorem 2.2 of \cite{SunSLiang2021}) If the conditions of Lemma \ref{2normal} hold and $\rho(\epsilon_n) \to 0$ as $n\to \infty$ and $\epsilon_n\to 0$, then (i) $\max_{1\leq i\leq K_n}\{|q_i-e_{i|\nu({\boldsymbol \gamma}^*,{\boldsymbol \beta}^*)}|\}\stackrel{p}{\to} 0$; (ii) (sure screening) $P({\boldsymbol \gamma}_* \subset \hat{{\boldsymbol \gamma}}_{\hat{q}}) \stackrel{p}{\to} 1$ for any pre-specified $\hat{q} \in (0,1)$; (iii) (Consistency) $P({\boldsymbol \gamma}_* =\hat{{\boldsymbol \gamma}}_{0.5}) \stackrel{p}{\to} 1$. \end{lemma} Lemma \ref{Selectlem} implies consistency of variable selection for the true DNN model as defined in (\ref{trueDNNeq}). \subsection{Asymptotic Normality of Connection Weights} In this section, we establish the asymptotic normality of the network parameters and predictions. Let $n l_n({\boldsymbol \beta}) = \sum_{i=1}^n\log(p_{{\boldsymbol \beta}}({\boldsymbol x}_i, y_i))$ denote the log-likelihood function, and let $\pi({\boldsymbol \beta})$ denote the density of the mixture Gaussian prior (\ref{marprior}). Let $h_{i_{1},i_{2},\dots,i_{d}}({\boldsymbol \beta})$ denote the $d$-th order partial derivatives $\frac{\partial^{d} l_n({\boldsymbol \beta})}{\partial\beta_{i_{1}}\partial{\boldsymbol \beta}_{i_{2}}\cdots\partial{\boldsymbol \beta}_{i_{d}}}$. Let $H_{n}({\boldsymbol \beta})$ denote the Hessian matrix of $l_{n}({\boldsymbol \beta})$. Let $h_{ij}({\boldsymbol \beta})$ and $h^{ij}({\boldsymbol \beta})$ denote the $(i,j)$-th component of $H_n({\boldsymbol \beta})$ and $H_n^{-1}({\boldsymbol \beta})$, respectively. Let $\bar{\lambda}_n({\boldsymbol \beta})$ and $\underline{\lambda}_n({\boldsymbol \beta})$ denotes the maximum and minimum eigenvalue of the Hessian matrix $H_n({\boldsymbol \beta})$, respectively. Let $B_{\lambda,n}= {\bar{\lambda}_n^{1/2}({\boldsymbol \beta}^*)}/{ \underline{\lambda}_n({\boldsymbol \beta}^*)}$ and $b_{\lambda,n}=\sqrt{r_n/n} B_{\lambda,n}$, where $r_n$ is the connectivity of ${\boldsymbol \gamma}^*$. For a DNN parameterized by ${\boldsymbol \beta}$, we define the weight truncation at the true model ${\boldsymbol \gamma}^*$: $({\boldsymbol \beta}_{{\boldsymbol \gamma}^*})_i = {\boldsymbol \beta}_i$ for $i\in {\boldsymbol \gamma}^*$ and $({\boldsymbol \beta}_{{\boldsymbol \gamma}^*})_i = 0$ otherwise. For the mixture Gaussian prior (\ref{marprior}), let $B_{\delta_n}({\boldsymbol \beta}^*) = \{{\boldsymbol \beta}: |{\boldsymbol \beta}_i-{\boldsymbol \beta}^*_i| < \delta_n, \forall i\in {\boldsymbol \gamma}^*, |{\boldsymbol \beta}_i-{\boldsymbol \beta}^*_i| < 2\sigma_{0,n}\log(\frac{\sigma_{1,n}}{\lambda_n\sigma_{0,n}}),\forall i \notin {\boldsymbol \gamma}^* \}$. We follow the definition of asymptotic normality in \cite{castillo2015bernstein} and \cite{Wang2020UncertaintyQF}: \begin{definition} Denote by $d_{\beta}$ the bounded Lipschitz metric for weak convergence and by $\phi_n$ the mapping $\phi_n: {\boldsymbol \beta} \to \sqrt n (g({\boldsymbol \beta})-g_*)$. We say that the posterior distribution of the functional $g({\boldsymbol \beta})$ is asymptotically normal with the center $g_*$ and variance $G$ if $d_{\beta}(\pi[\cdot\mid D_n]\circ \phi_n^{-1}, N(0, G))\to 0$ in ${P^*}$-probability as $n\to \infty$. We will write this more compactly as $\pi[\cdot\mid D_n]\circ \phi_n^{-1} \rightsquigarrow N(0, G)$. \end{definition} Theorem \ref{bvm} establishes the asymptotic normality of $\tilde{\nu}({\boldsymbol \beta})$, where $\tilde{\nu}({\boldsymbol \beta})$ denotes a transformation of ${\boldsymbol \beta}$ which is invariant with respect to $\mu({\boldsymbol \beta},{\boldsymbol \gamma},{\boldsymbol x})$ while minimizing $\|\tilde{\nu}({\boldsymbol \beta})-{\boldsymbol \beta}^*\|_{\infty}$. \begin{theorem}\label{bvm} Assume the conditions of Lemma \ref{Selectlem} hold with $\rho(\epsilon_n) = o(\frac{1}{K_n})$ and $C_1>\frac{2}{3}$ in Condition A.2.2. For some $\delta_n$ s.t. $\frac{r_n}{\sqrt{n}} \lesssim \delta_n \lesssim \frac{1}{\sqrt[3]{n}r_n}$, let $A(\epsilon_n,\delta_n) = \{{\boldsymbol \beta}:\max_{i\in {\boldsymbol \gamma}^{*}}|\beta_{i} - \beta_i^*| > \delta_n, d(p_{\boldsymbol \beta},p_{\mu^*}) \leq \epsilon_n\}$, where $\epsilon_n$ is the posterior contraction rate as defined in Lemma \ref{2normal}. Assume there exists some constants $C>2$ and $M>0$ such that \begin{enumerate} \item[C.1] ${\boldsymbol \beta}^*=(\beta_1^*,\beta_2^*,\ldots,\beta_{K_n}^*)$ is generic, $\min_{i\in {\boldsymbol \gamma}^*}|\beta^*_i| > C\delta_n$ and $\pi(A(\epsilon_n,\delta_n) \mid D_n) \rightarrow 0$ as $n\rightarrow \infty$. \item [C.2] $|h_i({\boldsymbol \beta}^*)|<M$, $|h_{j,k}({\boldsymbol \beta}^*)| < M$, $|h^{j,k}({\boldsymbol \beta}^*)| < M$, $|h_{i,j,k}({\boldsymbol \beta})| < M$, $|h_l({\boldsymbol \beta})|<M$ hold for any $i,j,k \in {\boldsymbol \gamma}^*$, $l \notin {\boldsymbol \gamma}^*$ and ${\boldsymbol \beta}\in B_{2\delta_n}({\boldsymbol \beta}^*)$. \item [C.3] $\sup\left\{ |E_{{\boldsymbol \beta}}(a^T U)^3|: \|{\boldsymbol \beta}_{\gamma^*}-{\boldsymbol \beta}^*\| \leq 1.2 b_{\lambda,n}, \|a\|=1 \right\} \leq 0.1 \sqrt{n/r_n} \underline{\lambda}_n^2({\boldsymbol \beta}^*)/\bar{\lambda}_n^{1/2}({\boldsymbol \beta}^*)$ and $B_{\lambda,n}=O(1)$, where $U=Z-E_{{\boldsymbol \beta}_{\gamma^*}} (Z)$, $Z$ denotes a random variable drawn from a neural network model parameterized by ${\boldsymbol \beta}_{\gamma^*}$, and $E_{{\boldsymbol \beta}_{\gamma^*}}(Z)$ denotes the mean of $Z$. \end{enumerate} Then $\pi[\sqrt n (\tilde{\nu}({\boldsymbol \beta})-{\boldsymbol \beta}^*) \mid D_n] \rightsquigarrow N(0, {\boldsymbol V})$ in ${P^*}$-probability as $n\to \infty$, where ${\boldsymbol V}=(v_{ij})$, and $v_{i,j} = E(h^{i,j}({\boldsymbol \beta}^*))$ if $i,j \in {\boldsymbol \gamma}^*$ and $0$ otherwise. \end{theorem} Condition C.1 is essentially an identifiability condition, i.e., when $n$ is sufficiently large, the DNN weights cannot be too far away from the true weights if the DNN produces approximately the same distribution as the true data. Condition C.2 gives typical conditions on derivatives of the DNN. Condition C.3 ensures consistency of the MLE of ${\boldsymbol \beta}^*$ for the given structure ${\boldsymbol \gamma}^*$ \cite{Portnoy1988}. \subsubsection{Asymptotic Normality of Prediction} Theorem \ref{predictionbvm} establishes asymptotic normality of the prediction $\mu({\boldsymbol \beta}, {\boldsymbol x}_0)$ for a test data point ${\boldsymbol x}_0$, which implies that a faithful prediction interval can be constructed for the learnt sparse neural network. Let $\mu_{i_{1},i_{2},\dots,i_{d}}({\boldsymbol \beta},{\boldsymbol x}_0)$ denote the $d$-th order partial derivative $\frac{\partial^{d}\mu({\boldsymbol \beta},{\boldsymbol x}_0)}{\partial\beta_{i_{1}}\partial{\boldsymbol \beta}_{i_{2}}\cdots\partial{\boldsymbol \beta}_{i_{d}}}$. \begin{theorem}\label{predictionbvm} Assume the conditions of Theorem \ref{bvm} and the following condition hold: $|\mu_i({\boldsymbol \beta}^*,{\boldsymbol x}_0)| < M$, $|\mu_{i,j}({\boldsymbol \beta},{\boldsymbol x}_0)| < M$, $|\mu_k({\boldsymbol \beta},{\boldsymbol x}_0)| < M$ hold for any $i,j \in {\boldsymbol \gamma}^*, k \notin {\boldsymbol \gamma}^*$ and ${\boldsymbol \beta}\in B_{2\delta_n}({\boldsymbol \beta}^*)$, where $M$ is as defined in Theorem \ref{bvm}. Then $\pi[\sqrt n (\mu({\boldsymbol \beta}, {\boldsymbol x}_0)-\mu({\boldsymbol \beta}^*,{\boldsymbol x}_0)) \mid D_n] \rightsquigarrow N(0, \Sigma)$, where $\Sigma = \nabla_{{\boldsymbol \gamma}^*}\mu({\boldsymbol \beta}^*, {\boldsymbol x}_0)^{T}H^{-1}\nabla_{{\boldsymbol \gamma}^*}\mu({\boldsymbol \beta}^*, {\boldsymbol x}_0)$ and $H = E(-\nabla^2_{{\boldsymbol \gamma}^*} l_n({\boldsymbol \beta}^*))$ is the Fisher information matrix. \end{theorem} The asymptotic normality for general smooth functional has been established in \cite{castillo2015bernstein}. For linear and quadratic functional of deep ReLU network with a spike-and-slab prior, the asymptotic normality has been established in \cite{Wang2020UncertaintyQF}. The DNN prediction $\mu({\boldsymbol \beta}, {\boldsymbol x}_0)$ can be viewed as a point evaluation functional over the neural network function space. However, in general, this functional is not smooth with respect to the locally asymptotic normal (LAN) norm. The results of \cite{castillo2015bernstein} and \cite{Wang2020UncertaintyQF} are not directly applicable for the asymptotic normality of $\mu({\boldsymbol \beta}, {\boldsymbol x}_0)$. \section{Prior Annealing Algorithms for Sparse DNN Computation} As implied by Theorems \ref{bvm} and \ref{predictionbvm}, a consistent estimator of $({\boldsymbol \gamma}^*,{\boldsymbol \beta}^*)$ is essential for statistical inference of the sparse DNN. Toward this goal, \cite{SunSLiang2021} proved that the marginal inclusion probabilities $q_i$'s can be estimated using Laplace approximation at the mode of the log-posterior. Based on this result, they proposed a multiple-run procedure. In each run, they first maximize the log-posterior by an optimization algorithm, such as SGD or Adam; then sparsify the DNN structure by truncating the weights less than a threshold to zero, where the threshold is calculated from the prior (\ref{marprior}) based on the Laplace approximation theory; and then refine the weights of the sparsified DNN by running an optimization algorithm for a few iterations. Finally, they select a sparse DNN model from those obtained in the multiple runs according to their Bayesian evidence or BIC values. The BIC is suggested when the size of the sparse DNN is large. Although the multiple-run procedure works well for many problems, it is hard to justify that it will lead to a consistent estimator of the true model $({\boldsymbol \gamma}^*,{\boldsymbol \beta}^*)$. To tackle this issue, we propose two prior annealing algorithms, one from the frequentist perspective and one from the Bayesian perspective. \subsection{Prior Annealing: Frequentist Computation} It has been shown in \cite{Nguyen2017TheLS, GoriTesi1992} that the loss of an over-parameterized DNN exhibits good properties: \begin{itemize} \item[($S^*$)] For a fully connected DNN with an analytic activation function and a convex loss function at the output layer, if the number of hidden units of one layer is larger than the number of training points and the network structure from this layer on is pyramidal, then almost all local minima are globally optimal. \end{itemize} Motivated by this result, we propose a prior annealing algorithm, which is immune to local traps and aims to find a consistent estimate of $({\boldsymbol \beta}^*,{\boldsymbol \gamma}^*)$ as defined in (\ref{trueDNNeq}). The detailed procedure of the algorithm is given in Algorithm \ref{priorannealing}. \begin{algorithm} \caption{Prior annealing: Frequentist} \label{priorannealing} \begin{itemize} \item[(i)]({\it Initial training}) Train a DNN satisfying condition (S*) such that a global optimal solution ${\boldsymbol \beta}_0= \arg\max_{{\boldsymbol \beta}} l_n({\boldsymbol \beta})$ is reached, which can be accomplished using SGD or Adam \cite{adam2015}. \item[(ii)] ({\it Prior annealing}) Initialize ${\boldsymbol \beta}$ at ${\boldsymbol \beta}_0$ and simulate from a sequence of distributions $\pi({\boldsymbol \beta}|D_n,\tau,\eta^{(k)}, \sigma_{0,n}^{(k)})$ $\propto e^{n l_n({\boldsymbol \beta})/\tau} \pi_{k}^{\eta^{(k)}/\tau}({\boldsymbol \beta})$ for $k=1,2,\ldots,m$, where $0<\eta^{(1)} \leq \eta^{(2)} \leq \cdots \leq \eta^{(m)}=1$, $\pi_k = \lambda_n N(0, \sigma_{1,n}^2) + (1-\lambda_n) N(0, (\sigma_{0,n}^{(k)})^{2})$, and $\sigma_{0,n}^{init} = \sigma_{0,n}^{(1)} \geq \sigma_{0,n}^{(2)} \geq \cdots \geq \sigma_{0,n}^{(m)} = \sigma_{0,n}^{end}$. The simulation can be done in an annealing manner using a stochastic gradient MCMC algorithm \citep{welling2011bayesian,SGHMC2014,ma2015complete,nemeth2019stochastic}. After the stage $m$ has been reached, continue to run the simulated annealing algorithm by gradually decreasing the temperature $\tau$ to a very small value. Denote the resulting DNN by $\hat{{\boldsymbol \beta}}=(\hat{\beta}_1,\hat{\beta}_2,\ldots, \hat{\beta}_{K_n})$. \item[(iii)] ({\it Structure sparsification}) For each connection $i \in \{1,2,\ldots,K_n\}$, set $\tilde{\gamma}_{i}=1$ if $|\hat{\beta}_i|>\frac{\sqrt{2} \sigma_{0,n}\sigma_{1,n}}{\sqrt{\sigma_{1,n}^2-\sigma_{0,n}^2}}$ $\sqrt{\log\left( \frac{1-\lambda_n}{\lambda_n} \frac{\sigma_{1,n}}{\sigma_{0,n}} \right)}$ and 0 otherwise, where the threshold value of $|\hat{\beta}_i|$ is obtained by solving the conditional distribution $\pi({\boldsymbol \gamma}_i = 1 | {\boldsymbol \beta}_i) > 0.5$ based on the mixture Gaussian prior as in \cite{SunSLiang2021}. Denote the yielded sparse DNN structure by $\tilde{{\boldsymbol \gamma}}$. \item[(iv)] ({\it Nonzero-weights refining}) Refine the nonzero weights of the sparsified DNN by maximizing $l_n({\boldsymbol \beta})$. Denote the resulting estimate by $\tilde{{\boldsymbol \beta}}_{\tilde{{\boldsymbol \gamma}}}$, which represents the MLE of ${\boldsymbol \beta}^*$. \end{itemize} \end{algorithm} For Algorithm \ref{priorannealing}, the consistency of $(\tilde{{\boldsymbol \gamma}}, \tilde{{\boldsymbol \beta}}_{\tilde{{\boldsymbol \gamma}}})$ as an estimator of $({\boldsymbol \gamma}^*,{\boldsymbol \beta}^*)$ can be proved based on Theorem 3.4 of \cite{Nguyen2017TheLS} for global convergence of ${\boldsymbol \beta}_0$, the property of simulated annealing (by choosing an appropriate sequence of $\eta_k$ and a cooling schedule of $\tau$), Theorem \ref{Selectlem} for consistency of structure selection, Theorem 2.3 of \cite{SunSLiang2021} for consistency of structure sparsification, and Theorem 2.1 of \cite{Portnoy1988} for consistency of MLE under the scenario of dimension diverging. Intuitively, the initial training phase can reach the global optimum of the likelihood function. In the prior annealing phase, as we slowly add the effect of the prior, the landscape of the target distribution is gradually changed and the MCMC algorithm is likely to hit the region around the optimum of the target distribution. More explanations on the effect of the prior can be found in the supplementary material. In practice, let $t$ denote the step index, a simple implementation of the initial training and prior annealing phases of Algorithm \ref{priorannealing} can be given as follows: (i) for $0 < t < T_1$, run initial training; (ii) for $T_1 \leq t \leq T_2$, fix $\sigma_{0,n}^{(t)} = \sigma_{0,n}^{init}$ and linearly increase $\eta_t$ by setting $\eta^{(t)} = \frac{t - T_1}{T_2 - T_1}$; (iii) for $T_2 \leq t \leq T_3$, fix $\eta^{(t)} = 1$ and linearly decrease $\sigma_{0,n}^{(t)}$ by setting $\sigma_{0,n}^{(t)} = \frac{T_3 - t}{T_3 - T_2} \sigma_{0,n}^{init} + \frac{t - T_2}{T_3 - T_2} \sigma_{0,n}^{end}$; (iv) for $t > T_3$, fix $\eta^{(t)} = 1$ and $\sigma_{0,n}^{(t)} = \sigma_{0,n}^{end}$ and gradually decrease the temperature $\tau$, e.g., setting $\tau_t = \frac{c}{t-T_3}$ for some constant $c$. \subsection{Prior Annealing: Bayesian Computation} For certain problems the size (or \#nonzero elements) of ${\boldsymbol \gamma}^*$ is large, calculation of the Fisher information matrix is difficult. In this case, the prediction uncertainty can be quantified via posterior simulations. The simulation can be started with a DNN satisfying condition (S*) and performed using a SGMCMC algorithm \cite{ma2015complete, nemeth2019stochastic} with an annealed prior as defined in step (ii) of Algorithm \ref{priorannealing} (For Bayesian approach, we may fix the temperature $\tau=1$). The over-parameterized structure and annealed prior make the simulations immune to local traps. To justify the Bayesian estimator for the prediction mean and variance, we study the deviation of the path averaging estimator $\frac{1}{T}\sum_{t=1}^{T}\phi({\boldsymbol \beta}^{(t)})$ and the posterior mean $\int \phi({\boldsymbol \beta}) \pi({\boldsymbol \beta}|D_n, \eta^*, \sigma_{0,n}^*) d{\boldsymbol \beta}$ for some test function $\phi({\boldsymbol \beta})$. For simplicity, we will focus on SGLD with prior annealing. Our analysis can be easily generalized to other SGMCMC algorithms \cite{chen2015convergence}. For a test function $\phi(\cdot)$, the difference between $\phi({\boldsymbol \beta})$ and $\int \phi({\boldsymbol \beta}) \pi({\boldsymbol \beta}|D_n, \eta^*, \sigma_{0,n}^*) d{\boldsymbol \beta}$ can be characterized by the Poisson equation: \[ \mathcal{L} \psi({\boldsymbol \beta}) = \phi({\boldsymbol \beta}) - \int \phi({\boldsymbol \beta}) \pi({\boldsymbol \beta}|D_n, \eta^*, \sigma_{0,n}^*) d{\boldsymbol \beta}, \] where $\psi(\cdot)$ is the solution of the Poisson equation and $\mathcal{L}$ is the infinitesimal generator of the Langevin diffusion. i.e. for the following Langevin diffusion $\text{d}{\boldsymbol \beta}^{(t)} = \nabla\log(\pi({\boldsymbol \beta}|D_n, \eta^*, \sigma_{0,n}^*)) \text{d}t + \sqrt{2}I \text{d}W_t$, where $I$ is identity matrix and $W_t$ is Brownian motion, we have \[ \mathcal{L}\psi({\boldsymbol \beta}) := \langle \nabla\psi({\boldsymbol \beta}), \nabla\log(\pi({\boldsymbol \beta}|D_n, \eta^*, \sigma_{0,n}^*)) + \text{tr}(\nabla^2 \psi({\boldsymbol \beta})) \] Let $\mathcal{D}^k\psi$ denote the kth-order derivatives of $\psi$. To control the perturbation of $\phi({\boldsymbol \beta})$, we need the following assumption about the function $\psi({\boldsymbol \beta})$: \begin{assumption} \label{anneal_assump_1} For $k\in \{0,1,2,3\}$, $\mathcal{D}^k\psi$ exists and there exists a function $\mathcal{V}$, s.t. $||\mathcal{D}^k \psi|| \lesssim \mathcal{V}^{p_k}$ for some constant $p_k > 0$. In addition, $\mathcal{V}$ is smooth and the expectation of $\mathcal{V}^p$ on ${\boldsymbol \beta}^{(t)}$ is bounded for some $p\leq 2 \max_{k} \{p_k\}$, i.e. $\sup_{t} \mathbb{E} (\mathcal{V}^p({\boldsymbol \beta}^{(t)})) < \infty$, $\sum_{s\in(0,1)}\mathcal{V}^p(s{\boldsymbol \beta}_1 + (1 - s) {\boldsymbol \beta}_2) \lesssim \mathcal{V}^p({\boldsymbol \beta}_1) + \mathcal{V}^p({\boldsymbol \beta}_2)$. \end{assumption} In step $t$ of the SGLD algorithm, the drift term is replaced by $\nabla_{{\boldsymbol \beta}}\log\pi({\boldsymbol \beta}^{(t)}|D_{m,n}^{(t)}, \eta^{(t)}, \sigma_{0,n}^{(t)})$, where $D_{m,n}^{(t)}$ is used to represent the mini-batch data used in step t. Let $\mathcal{L}_t$ be the corresponding infinitesimal generator. Let $\delta_t = \mathcal{L}_t - \mathcal{L}$. To quantify the effect of $\delta_t$, we introduce the following assumption: \begin{assumption} \label{anneal_assump_2} ${\boldsymbol \beta}^{(t)}$ has bounded expectation and the expectation of log-prior is Lipschitz continuous with respect to $\sigma_{0,n}$, i.e. there exists some constant $M$ s.t. $\sup_{t}\mathbb{E}(|{\boldsymbol \beta}^{(t)}|) \leq M < \infty$. For all $t$, $|\mathbb{E} \log(\pi({\boldsymbol \beta}^{(t)}| \lambda_n, \sigma_{0,n}^{(t_1)}, \sigma_{1,n})) - \mathbb{E} \log(\pi({\boldsymbol \beta}^{(t)}| \lambda_n, \sigma_{0,n}^{(t_2)}, \sigma_{1,n}))| \leq M |\sigma_{0,n}^{(t_1)} - \sigma_{0,n}^{(t_2)}|$. \end{assumption} Then we have the following theorem: \begin{theorem} \label{anneal_thm} Suppose the model satisfy assumption \ref{anneal_assump_2}, and a constant learning rate of $\epsilon$ is used. For a test function $\phi(\cdot)$, if the solution of the Poisson equation $\psi(\cdot)$ satisfy assumption \ref{anneal_assump_1}, then \begin{equation} \small \mathbb{E}\left(\frac{1}{T} \sum_{t = 1}^{T - 1} \phi({\boldsymbol \beta}_t) - \int \phi({\boldsymbol \beta}) \pi({\boldsymbol \beta}|D_n, \eta^*, \sigma_{0,n}^*) d{\boldsymbol \beta} \right) = O(\frac{1}{T\epsilon} + \frac{\sum_{t = 0}^{T-1} (|\eta^{(t)} - \eta^*| +|\sigma_{0,n}^{(t)} - \sigma_{0,n}^{*} |)}{T} + \epsilon), \end{equation} where $\sigma_{0,n}^*$ is treated as a fixed constant. \end{theorem} Theorem \ref{anneal_thm} shows that with prior annealing, the path averaging estimator can still be used for estimating the mean and variance of the prediction and constructing the confidence interval. For the case that a decaying learning rate is used, a similar theorem can be developed as in \cite{chen2015convergence}. \section{Numerical Experiments} This section illustrates the performance of the proposed method on synthetic and real data examples. For the synthetic example, the frequentist algorithm is employed to construct prediction intervals. The real data example involves a large network, so both the frequentist and Bayesian algorithms are employed along with comparisons with some existing network pruning methods. \subsection{Synthetic Example} We consider a high-dimensional nonlinear regression problem, which shows that our method can identify the sparse network structure and relevant features as well as produce prediction intervals with correct coverage rates. The datasets were generated as in \cite{SunSLiang2021}, where the explanatory variables $x_{1},\dots,x_{p_n}$ were simulated by independently generating $e,z_{1},\dots,z_{p_n}$ from $N(0,1)$ and setting $x_{i}=\frac{e+z_{i}}{\sqrt{2}}$. The response variable was generated from a nonlinear regression model: \begin{equation} \nonumber \begin{split} y&=\frac{5x_{2}}{1+x_{1}^{2}}+5\sin(x_{3}x_{4})+2x_{5} +0x_{6}+\cdots+0x_{2000}+\epsilon, \end{split} \end{equation} where $\epsilon \sim N(0,1)$. Ten datasets were generated, each consisting of 10000 samples for training and 1000 samples for testing. This example was taken from \cite{SunSLiang2021}, through which we show that the prior annealing method can achieve similar results with the multiple-run method proposed in \cite{SunSLiang2021}. We modeled the data by a DNN of structure 2000-10000-100-10-1 with tanh activation function. Here we intentionally made the network very wide in one hidden layer to satisfy the condition (S*). Algorithm \ref{priorannealing} was employed to learn the model. The detailed setup for the experiments were given in the supplementary material. The variable selection performance were measured using the false selection rate $FSR=\frac{\sum_{i=1}^{10}|\hat{S}_{i}\backslash S|}{\sum_{i=1}^{10}|\hat{S}_{i}|}$ and negative selection rate $NSR=\frac{\sum_{i=1}^{10}|S\backslash\hat{S}_{i}|}{\sum_{i=1}^{10}|S|}$, where $S$ is the set of true variables, $\hat{S}_{i}$ is the set of selected variables from dataset $i$ and $|\hat{S}_{i}|$ is the size of $\hat{S}_{i}$. The predictive performance is measured by mean square prediction error (MSPE) and mean square fitting error (MSFE). We compare our method with the multiple-run method (BNN\_evidence) \cite{SunSLiang2021} as well as other existing variable selection methods including Sparse input neural network(Spinn) \cite{feng2017sparse}, Bayesian adaptive regression tree (BART) \cite{bleich2014variable}, linear model with lasso penalty (LASSO) \cite{tibshirani1996regression}, and sure independence screening with SCAD penalty (SIS)\cite{fan2008sure}. To demonstrate the importance of selecting correct variables, we also compare our method with two dense model with the same network structure: DNN trained with dropout(Dropout) and DNN trained with no regularization(DNN). Detailed setups for these methods were given in the supplementary material as well. The results were summarized in Table \ref{Simulation}. With a single run, our method BNN\_anneal achieves similar result with the multiple-run method. The latter trained the model for 10 times and selected the best one in Bayesian evidence. While for Spinn (with LASSO penalty), even with over-parametrized structure, it performs worse than the sparse BNN model. \begin{table*}[t] \caption{Simulation Result: MSFE and MSPE were calculated by averaging over 10 datasets, and their standard deviations were given in the parentheses. } \label{Simulation} \begin{center} \begin{tabular}{ccccccc} \toprule Method & $|\hat S|$ & FSR & NSR & MSFE & MSPE \\ \midrule BNN\_anneal & 5(0) & 0 & 0 & 2.353(0.296) & 2.428(0.297) \\ BNN\_Evidence & 5(0) & 0 & 0 & 2.372(0.093) & 2.439(0.132) \\ Spinn & 10.7(3.874) & 0.462 & 0 & 4.157(0.219) & 4.488(0.350) \\ DNN & - & - & - & 1.1701e-5(1.1542e-6) & 16.9226(0.3230) \\ Dropout & - & - & - & 1.104(0.068) & 13.183(0.716) & \\ BART50 & 16.5(1.222) & 0.727 & 0.1 & 11.182(0.334) & 12.097(0.366) & \\ LASSO & 566.8(4.844) & 0.993 & 0.26 & 8.542(0.022) & 9.496(0.148) & \\ SIS & 467.2(11.776) & 0.991 & 0.2 & 7.083(0.023) & 10.114(0.161) & \\ \bottomrule \end{tabular} \end{center} \end{table*} To quantify the uncertainty of the prediction, we conducted 100 experiments over different training sets as generated previously. We constructed 95\% prediction intervals over 1000 test points. Over the 1000 test points, the average coverage rate of the prediction intervals is $94.72\%(0.61\%)$, where $(0.61\%)$ denote the standard deviation. Figure \ref{CI} shows the prediction intervals constructed for 20 of the testing points. Refer to the supplementary material for the detail of the computation. \begin{figure} \centering \includegraphics[height=2.5in,width=6.0in]{anneal_CI.eps} \caption{Prediction intervals of 20 testing points, where the y-axis is the response value, the x-axis is the index, and the blue point represents the true observation.} \label{CI} \vspace{-0.1in} \end{figure} \subsection{Real Data Example} As a different type of applications of the proposed method, we conducted unstructured network pruning experiments on CIFAR10 dataset\cite{krizhevsky2009learning}. Following the setup in \cite{lin2020dynamic}, we train the residual network\cite{he2016deep} with different networks size and pruned the network to different sparsity levels. The detailed experimental setup can be found in the supplementary material. We compared the proposed methods, BNN\_anneal (Algorithm \ref{priorannealing}) and BNN\_average (averaged over last 75 networks simulated by the Bayesian version of the prior annealing algorithm), with several state-of-the-art unstructured pruning methods, including Consistent Sparse Deep Learning (BNN\_BIC) \cite{SunSLiang2021}, Dynamic pruning with feedback (DPF) \cite{lin2020dynamic}, Dynamic Sparse Reparameterization (DSR) \cite{mostafa2019parameter} and Sparse Momentum (SM) \cite{dettmers2019sparse}. The results of the baseline methods were taken from \cite{lin2020dynamic} and \cite{SunSLiang2021}. The results of prediction accuracy for different models and target sparsity levels were summarized in Table \ref{CIFAR}. Due to the threshold used in step (iii) of Algorithm \ref{priorannealing}, it is hard for our method to make the pruning ratio exactly the same as the targeted one. We intentionally make the pruning ratio smaller than the target ratio, while our method still achieve better test accuracy. Compared to BNN\_BIC, the test accuracy is very close, but the result of BNN\_BIC is obtained by running the experiment 10 times while our method only run once. To further demonstrate that the proposed method result in better model calibration, we followed the setup of \cite{maddox2019simple} and compared the proposed method with DPF on several metrics designed for model calibration, including negtive log likelihood (NLL), symmetrized, discretized KL distance between in and out of sample entropy distributions (JS-Distance), and expected calibration error (ECE). For JS-Distance, we used the test data of SVHN as out-of-distribution samples. The results were summarized in Table \ref{CIFAR_calibration}. As discussed in \cite{maddox2019simple,CalibrationDNN2017}, a well calibrated model tends to have smaller NLL, larger JS-Distance and smaller ECE. The comparison shows that the proposed method outperforms DPF in most cases. In addition to the network pruning method, we also train a dense model with the standard training set up. Compared to the dense model, the sparse network has worse accuracy, but it tends to outperform the dense network in terms of ECE and JS-Distance, which indicates that sparsification is also a useful way for improving calibration of the DNN. \begin{table} \caption{ResNet network pruning results for CIFAR-10 data, which were calculated by averaging over 3 independent runs with the standard deviation reported in the parentheses. } \label{CIFAR} \begin{center} \begin{tabular}{ccccccccc} \toprule & \multicolumn{2}{c}{ResNet-20} & & \multicolumn{2}{c}{ResNet-32} \\ \cline{2-3}\cline{5-6} Method & Pruning Ratio & Test Accuracy & & Pruning Ratio & Test Accuracy \\ \midrule DNN\_dense & 100\% & 92.93(0.04) & & 100\% & 93.76(0.02) \\ \midrule BNN\_average & 19.85\%(0.18\%) & 92.53(0.08) & & 9.99\%(0.08\%) & {93.12(0.09)} \\ BNN\_anneal & 19.80\%(0.01\%) & {92.30(0.16)} & & 9.97\%(0.03\%) & {92.63(0.09)} \\ BNN\_BIC & 19.67\%(0.05\%) & {92.27(0.03)} & & 9.53\%(0.04\%) & {92.74(0.07)} \\ SM & 20\% & 91.54(0.16) & & 10\% & 91.54(0.18) \\ DSR & 20\% & 91.78(0.28) & & 10\% & 91.41(0.23) \\ DPF & 20\% & 92.17(0.21) & & 10\% & 92.42(0.18) \\ \midrule BNN\_average & {9.88\%(0.02\%)} & 91.65(0.08) & & 4.77\%(0.08\%) & { 91.30(0.16)} \\ BNN\_anneal & {9.95\%(0.03\%)} & 91.28(0.11) & & 4.88\%(0.02\%) & {91.17(0.08)} \\ BNN\_BIC & 9.55\%(0.03\%) & {\ 91.27(0.05)} && 4.78\%(0.01\%) & {91.21(0.01)} \\ SM& 10\% & 89.76(0.40) & & 5\% & 88.68(0.22) \\ DSR& 10\% & 87.88(0.04) & & 5\% & 84.12(0.32) \\ DPF& 10\% & 90.88(0.07) & & 5\% & 90.94(0.35) \\ \bottomrule \end{tabular} \end{center} \end{table} \begin{table*}[t] \caption{ResNet network pruning results for CIFAR-10 data, which were calculated by averaging over 3 independent runs with the standard deviation reported in the parentheses.} \label{CIFAR_calibration} \begin{center} \adjustbox{width=1.0\textwidth}{ \begin{tabular}{ccccccc} \toprule Method & Model & Pruning Ratio & NLL & JS-Distance & ECE \\ \midrule DNN\_dense & ResNet20 & 100\% & 0.2276(0.0021) & 7.9118(0.9316) & 0.02627(0.0005) \\ \midrule BNN\_average & ResNet20 & {9.88\%(0.02\%)} & 0.2528(0.0029) & 9.9641(0.3069) & 0.0113(0.0010)\\ BNN\_anneal & ResNet20 & {9.95\%(0.03\%)} & 0.2618(0.0037) & 10.1251(0.1797) & 0.0175(0.0011) \\ DPF & ResNet20 & 10\% & 0.2833(0.0004)& 7.5712(0.4466) & 0.0294(0.0009)\\ \midrule BNN\_average & ResNet20 & 19.85\%(0.18\%) & 0.2323(0.0033)& 7.7007(0.5374) & 0.0173(0.0014) \\ BNN\_anneal & ResNet20 & 19.80\%(0.01\%) & 0.2441(0.0042) & 6.4435(0.2029) & 0.0233(0.0020)\\ DPF & ResNet20 & 20\% & 0.2874(0.0029) & 7.7329(0.1400) & 0.0391(0.0001)\\ \midrule DNN\_dense & ResNet32 & 100\% & 0.2042(0.0017) & 6.7699(0.5253) & 0.02613(0.00029)\\ \midrule BNN\_average & ResNet32 & 9.99\%(0.08\%) & 0.2116(0.0012) & 9.4549(0.5456) & 0.0132(0.0001) \\ BNN\_anneal & ResNet32 & 9.97\%(0.03\%) & 0.2218(0.0013) & 8.5447(0.1393) & 0.0192(0.0009) \\ DPF & ResNet32 & 10\% & 0.2677(0.0041)& 7.8693(0.1840) & 0.0364(0.0015)\\ \midrule BNN\_average & ResNet32 & 4.77\%(0.08\%) & 0.2587(0.0022) & 7.0117(0.2222) & 0.0100(0.0002) \\ BNN\_anneal & ResNet32 & 4.88\%(0.02\%) & 0.2676(0.0014) & 6.8440(0.4850) & 0.0149(0.0006) \\ DPF & ResNet32 & 5\% & 0.2921(0.0067)& 6.3990(0.8384) & 0.0276(0.0019)\\ \bottomrule \end{tabular} } \end{center} \vspace{-0.2in} \end{table*} \section{Conclusion} This work, together with \cite{SunSLiang2021}, has built a solid theoretical foundation for sparse deep learning, which has successfully tamed the sparse deep neural network into the framework of statistical modeling. As implied by Lemma \ref{2normal}, Lemma \ref{Selectlem}, Theorem \ref{bvm}, and Theorem \ref{predictionbvm}, the sparse DNN can be simply viewed as a nonlinear statistical model which, like a traditional statistical model, possesses many nice properties such as posterior consistency, variable selection consistency, and asymptotic normality. We have shown how the prediction uncertainty of the sparse DNN can be quantified based on the asymptotic normality theory, and provided algorithms for training sparse DNNs with theoretical guarantees for its convergence to the global optimum. The latter ensures the validity of the down-stream statistical inference. \newpage
\section{Introduction} \label{sec:introduction} The history of optimal transport can be traced back to the 18-th century when the French mathematician Monge introduced this tool for his engineering projects. In optimal transport problems one seeks an optimal strategy to move resources from an initial distribution to a target one. This theory has initially had a tremendous impact to fields such as economics and logistics. During the last decades, with new efficient computational methods \citep{cuturi2013sinkhorn} and more available computational power, optimal transport theory has also been used for addressing a broad class of problems both within the machine learning community \citep{peyre2019computational, solomon2014wasserstein, solomon2015convolutional, arjovsky2017wasserstein}, but also in related fields such as imaging \citep{haker2004optimal} and systems and control \citep{chen2016relation}. The multi-marginal optimal transport (MOT) is a natural extension of the standard optimal transport to scenarios with more than two marginal distributions. In the discrete setting, the objective of MOT is to find an optimal coupling between $m$ marginals $\mu_1,\dots,\mu_m\in \mathbb{R}_+^n$ over $X$, where $X$ is a discrete space with support in $n$ points. A $m$-mode tensor ${\bf B} \in \mathbb{R}_+^{n^m}$ is a feasible transport plan if it satisfies the assigned marginals, $P_k({\bf B}) = \mu_k$, where \begin{equation} [ P_k({\bf B}) ] (x_k) = \sum_{ {\bf x} \setminus x_k} {\bf B}( {\bf x}), \quad \text{for all } x_k \in X, \end{equation} where ${\bf x} = (x_1,\dots, x_m) \in X^m$. In this paper we consider a version of this problem where the marginals are typically only imposed on a subset of the transport tensors nodes, and we denote this subset of indices by $\Gamma \subset \{1,\dots,m\} $. The set of feasible transport plans, consistent with these marginals $\{\mu_k\}_{k\in\Gamma}$, is then in the set \begin{equation} {\Pi_\Gamma^m((\mu_k)_{k\in \Gamma})} = \{ {\bf B} \in \mathbb{R}^{n^m} : P_k({\bf B}) = \mu_k, \forall k \in \Gamma \}. \end{equation} Given a non-negative cost tensor ${\bf C} \in \mathbb{R}^{n^m}_+$, where ${\bf C}({\bf x})$ denotes the cost associated with a unit mass on the tuple ${\bf x}$, the multi-marginal optimal transport problem reads \begin{align}\label{eq:unregu mot} \min_{ {\bf B} \in {\Pi_\Gamma^m((\mu_k)_{k\in \Gamma})} } \langle {\bf C}, {\bf B} \rangle. \end{align} The MOT problem is a linear program, thus, in principle, the simplex algorithm can be used to solve it exactly. The complexity however explodes quickly as the problem size increases. In practice, the MOT is solved approximately instead. The goal of these approximation algorithms is to find $ \widehat {\bf B} \in {\Pi_\Gamma^m((\mu_k)_{k\in \Gamma})}$ such that $\langle {\bf C}, \widehat {\bf B} \rangle$ is an $\epsilon$-approximation of the MOT problem \eqref{eq:unregu mot}. That is, $\widehat {\bf B}$ is an approximation of the transport tensor and satisfies \begin{equation} \langle {\bf C}, \widehat {\bf B} \rangle \leq \min_{ {\bf B} \in {\Pi_\Gamma^m((\mu_k)_{k\in \Gamma})}} \langle {\bf C}, {\bf B} \rangle + \epsilon. \end{equation} A popular method to approximately solve the MOT problem \eqref{eq:unregu mot} is to solve an entropic regularized version of it where an entropy barrier term is added to the objective. This regularized problem can be solved by the renowned Sinkhorn iterations \citep{DemSte40,cuturi2013sinkhorn}. \paragraph{Related work:} A fundamental question in the study of MOT algorithms is understanding their complexities, and several complexity bounds have been derived over the last few years for various MOT algorithms \citep{lin2020complexity, altschuler2020polynomial, carlier2021linear}. The best known complexity bound for the general multi-marginal Sinkhorn iterations is% \footnote{Here $\mathcal{ \tilde O}$ denotes the growth rate, it ignores polylogarithmic factors in $n$. See "Notation" for the definition.} $\mathcal{ \tilde O}(\frac{m^3n^m}{\epsilon^2})$ \citep{lin2020complexity}, which scales exponentially in the number of marginals $m$. This is not surprising as the size of the variable ${\bf B}$ grows exponentially. The complexity bound can be improved by exploiting the structure of the cost tensor ${\bf C}$. A well-known example is the Wasserstein barycenter problem where the cost can be decomposed into pairwise costs between the marginals and the barycenter. \citet{kroshnin2019complexity} shows that the iterative scaling algorithm finds an $\epsilon$-approximate solution to the barycenter between $L$ distributions in $ \mathcal{ \tilde O}(\frac{ L n^2}{\epsilon^2})$ operations. A more general class of costs where better computation complexity can be achieved is associated with the graphical structure (see Section \ref{sec:graph}). Such structures appear in various applications, such as barycenter problems \citep{lin2020fixedsupport, kroshnin2019complexity}, interpolation problems \citep{solomon2015convolutional}, and estimation problems \citep{elvander2020multi}. It was shown in \citet{haasler2021pgm} that a complexity bound for MOT problems with tree-structured cost (including the barycenter problem as a special case) is $ \mathcal{ \tilde O}(\frac{ m^4 n^2}{\epsilon^2})$, where $m$ denotes the number of marginals. Also in \citet{altschuler2020polynomial}, it was shown that the complexity scales polynomially as the number of marginals increases for MOT with general graph-structured cost, as long as the tree-width of the graph is properly bounded. \paragraph{Our contribution:} The purpose of this work is to provide a tighter complexity bound for solving the MOT with graph-structured costs. Graph-structured optimal transport problems are often formulated as a sum of bi-marginal optimal transport problem. The numerical scheme is then based on regularizing each of the bi-marginal problems locally. In this work we suggest to use a regularization on the multi-marginal transport tensor similar to the one suggested in \citet{carlier2021linear}. This regularization simplifies the complexity analysis (see Remark \ref{rem:regularizer}). For the cases where the MOT problem is structured according to a tree, i.e., the graph does not contain any cycles, we show that an $\epsilon$-approximation of the solution can be found within $ \mathcal{\tilde O}(d(G) m n^2\epsilon^{-2})$ operations. This improves on the previous result for tree-structured MOT in \cite{haasler2021pgm}. Moreover, for the barycenter problem, which corresponds to the special case of a star-shaped graph, this matches the best known bound when no further acceleration of the method is applied. In the case of a general graph $G$, the complexity is $ \mathcal{ O} \left( \frac{d(G) m n^{w(G)+1} }{\epsilon^2} \right)$, where $w(G)$ is the tree-width of $G$. \paragraph{Notation:} For a matrix $C \in \mathbb{R}^{n \times n}$, we denote $\|C\|_\infty$ its largest element. We denote a graph as the tuple $G=(V,E)$, where $V$ is the set of vertices, and $E$ is the set of edges. For a vertex $k\in V$, we denote the set of neighbouring vertices by $N(k) \subset V$. Let $\ones_d$ denote the all-ones vector/matrix/tensor in ${\mathbb{R}}^d$, and let $\exp(\cdot), \log(\cdot), \odot$, and $./$ denote the element-wise exponential, logarithm, multiplication, and division of tensors, respectively. We use $p(m,n,\epsilon)=\mathcal{ O}(q(m,n,\epsilon))$ to denote that there exists a positive constant $c_1$ such that $p(m,n,\epsilon) \leq c_1 q(m,n,\epsilon)$. The $p(m,n,\epsilon)=\mathcal{\tilde O}(q(m,n,\epsilon))$ notation absorbs polylogarithmic factors related to $n$, i.e., there exist positive constants $c_2,c_3$ such that $p(m,n,\epsilon) \leq c_2 q(m,n,\epsilon)(\log n)^{c_3} $. \section{Graph-structured MOT}\label{sec:graph} In this paper we consider MOT problems with a cost that decouples according to a graph. Such structures appear in many applications, for instance in barycenter problems \citep{lin2020fixedsupport, kroshnin2019complexity}, interpolation problems \citep{solomon2015convolutional}, and estimation problems \citep{elvander2020multi,SinHaaZha20}. In fact, one of the very first studies of MOT, on the generalized Euler-flow problem, has a graph-structured cost \citep{Bre89,benamou2015iterative}. \begin{example} \label{exa: barycenter} (Fixed-support Wasserstein Barycenter). {\makeatletter \let\par\@@par \par\parshape0 \everypar{} \begin{wrapfigure}{r}{0.28\textwidth} \centering \begin{tikzpicture} \def 40pt {40pt} \tikzstyle{main}=[circle, minimum size = 20pt, thick, draw =black!80] \node[main] at (360:0mm) (center) {$\mu$}; \foreach \i in {1,...,5}{ \node[main,,fill=black!10] at ({\i*70}:40pt) (u\i) {$\mu_{\i}$}; \draw[-, thick] (center)-- (u\i); } \end{tikzpicture} \caption{Graph associated with a barycenter problem \eqref{eq:barycenter_pairwise}, where $L=5$. } \label{fig:barycenter_graph} \end{wrapfigure} A special case of a graph-structured optimal transport problem is the fixed support barycenter problem with uniform weights \begin{align} \label{eq:barycenter_pairwise} \min_{\mu\in \mathbb{R}^n} \sum_{\ell=1}^{L} \frac{1}{L} W(\mu, \mu_\ell), ~ \text{ with }~ W(\mu,\nu)=\inf_{B \in \Pi(\mu,\nu)} \langle C, B \rangle, \end{align} where $\Pi(\mu,\nu)=\Pi^2_{\{1,2\}}(\mu,\nu)$ denotes the standard set of feasible transport plans for two marginals. The underlying structure can be described by a star-graph as illustrated in Figure~\ref{fig:barycenter_graph}. Problem \eqref{eq:barycenter_pairwise} can be written as the multi-marginal problem \eqref{eq:unregu mot}, where the cost tensor ${\bf C} \in \mathbb{R}^{L+1}$ is defined as \begin{equation}\label{eq:barycentercost} {\bf C}(x_1,\dots,x_L,x_{L+1}) = \sum_{\ell=1}^{L} \frac{1}{L} C(x_{L+1}, x_{\ell}), \end{equation} \par } and constraints are given on the set $\Gamma=\{1,\dots, \ell\}$. \end{example} Similar to Example~\ref{exa: barycenter}, we can define a MOT problem that is structured according to any graph $G=(V,E)$. Therefore, we associate each vertex in $V$ with a marginal of the transport plan ${\bf B}$, and each edge in $E$ with a pair-wise cost. That is, for the interaction between vertices $k_1$ and $k_2$ we define a cost matrix $C^{(k_1,k_2)}$, and we let $E$ be the set of all these pair-wise interactions. Then the graph-structured cost tensor is defined by \begin{equation} \label{eq:C_graph} {\bf C} ( x_1,\dots,x_m) = \sum_{(k_1,k_2)\in E} C^{(k_1,k_2)}(x_{k_1},x_{k_2}). \end{equation} Problem \eqref{eq:unregu mot} with a cost tensor of the form \eqref{eq:C_graph} is called a graph-structured MOT problem \citep{haasler2020tree, haasler2021pgm}. Many graph-structured optimal transport problem, for instance interpolation and barycenter problems, are naturally described by tree graphs, i.e., graphs that do not contain any cycles. Moreover, any graph can be converted into a tree using the junction tree technique \citep{KolFri09}. Thus, for the ease of presentation, we focus on the cases of tree-structured MOT in the main paper and leave the discussion of general graphs to the supplementary material. It should be noted that in the case of a tree-structured MOT problem we can without loss of generality consider the case, where $\Gamma$ is the set of leaves \cite[Proposition 3.4]{haasler2020tree}. \section{Sinkhorn belief propagation algorithm} In practical applications the MOT problem is often prohibitively large for standard linear programming solvers, and one therefore has to resort to numerical methods to obtain an appropriate solution. A well-known approach, based on the seminal work by \cite{cuturi2013sinkhorn}, is to regularize the objective in \eqref{eq:unregu mot} with an entropic barrier term \citep{benamou2015iterative}. In particular, we introduce the barrier term \begin{equation} \label{eq:regularization} H({\bf B} \mid {\bf M})=\langle{\bf B}, \log({\bf B})-\log({\bf M}) -\ones_{n^m}\rangle, \end{equation} where \begin{equation} {\bf M}(x_1,x_2,\ldots, x_m)=\prod_{k\in \Gamma} \mu_k(x_k). \end{equation} The regularized MOT problem reads then \begin{align} \label{eq:ot_multi_reg} \min_{ {\bf B} \in {\Pi_\Gamma^m((\mu_k)_{k\in \Gamma})} } \langle {\bf C}, {\bf B} \rangle + \eta H({\bf B}\mid {\bf M}), \end{align} where $\eta>0$ is a small regularization parameter. \begin{remark}\label{rem:regularizer} Note that our choice of entropy regularizer is slightly different from the standard one $\langle{\bf B}, \log({\bf B})-\ones_{n^m}\rangle$ often used for the Sinkhorn algorithm. The extra term $-\langle{\bf B},\log({\bf M})\rangle$ turns out to simplify the approximation procedure (there is no need to alter the marginal distributions first to increase the minimum value of their elements as in \citet{dvurechensky2018computational,lin2020complexity}) and the complexity analysis (see, e.g., Lemma \ref{lem:bound_lambda}). \end{remark} The optimal solution of the regularized multi-marginal optimal transport problem \eqref{eq:ot_multi_reg} can be compactly expressed in terms of the optimal variables of the dual problem. More precisely, the optimal transport tensor is of the form \begin{equation} \label{eq:opt_sol} [{\bf B}( \Lambda )] (x_1,\dots, x_m) = \exp\left( -{\bf C}(x_1,\dots, x_m)/ \eta\right) \prod_{k \in \Gamma} \Big( \exp\left(\lambda_k (x_k)/\eta\right) \mu_k(x_k) \Big) , \end{equation} where $\Lambda = \{ \lambda_k \}_{k \in \Gamma}$ is the optimal solution of the dual of \eqref{eq:ot_multi_reg}, which is given by (cf. \cite{haasler2020tree}) \begin{equation} \label{eq:ot_multi_dual} \min_{ \Lambda } \psi( \Lambda) := \eta P( {\bf B}(\Lambda) ) - \sum_{k\in \Gamma} \mu_k^\text{T} \lambda_k. \end{equation} Here, $P({\bf B}) = \sum_{{\bf x}} {\bf B}({\bf x}) \in \mathbb{R}$ is the projection over all marginals of ${\bf B}$, i.e., the sum over all elements. The optimal solution to \eqref{eq:ot_multi_dual} can be efficiently found by the renowned Sinkhorn iterations \citep{benamou2015iterative, haasler2021pgm}. In particular, the multi-marginal Sinkhorn algorithm is to find the scaled variables $u_k= \exp(\lambda_k /\eta)$, for $k \in \Gamma$, by iteratively updating them according to \begin{equation} \label{eq:sinkhorn} u_k^{(t+1)} \leftarrow u_k^{(t)} \odot \mu_k ./ P_k( {\bf B}(\Lambda^{(t)})). \end{equation} There are several approaches to perform these updates: At each iteration, the next marginal $k\in \Gamma$ to be updated can be picked in a random, cyclic, or greedy fashion \citep{benamou2015iterative,lin2020complexity}. In this paper we discuss the random updating rule. The greedy update requires more operations for each iteration as all the projections for $k\in\Gamma$ are needed for an update. The traditional cyclic update introduces strong couplings between updates which makes the complexity analysis much more challenging. For general MOT, computing the projections $P_k({\bf B}(\Lambda^{(t)}))$ requires $\mathcal{O}(n^m)$ operations, which creates a large computational burden. However, in case the MOT problem has a tree-structure, the projections $P_k( {\bf B}(\Lambda^{(t)}) )$ can be computed by a message-passing algorithm that utilizes the belief propagation algorithm \citep{YedFreWei03}, as described in \cite{haasler2021pgm, haasler2020tree}. This requires only matrix-vector multiplications of size $n$. In particular, the projections are of the form \begin{equation} [ P_k( {\bf B}(\Lambda^{(t)}) )](x_k) = \begin{dcases} u_k^{(t)} (x_k) \mu_k(x_k) m_{\ell \to k} (x_k), & \quad \text{ if } k \in \Gamma \label{eq:proj_messages} \\ \prod_{\ell \in N(k)} m_{\ell \to k} (x_k), & \quad \text{ if } k \notin \Gamma, \end{dcases} \end{equation} where the messages are computed as \begin{subequations}\label{eq:message_updates} \noeqref{eq:message_updates_a,eq:message_updates_b} \begin{align} m_{\ell \to k} (x_k) & = \sum_{x_\ell} K^{(k,\ell)}(x_k,x_\ell) \prod_{j \in N(\ell) \setminus k} m_{j \to \ell} (x_\ell), \quad \text{ if } \ell \notin \Gamma \label{eq:message_updates_a} \\ m_{\ell \to k} (x_k) & = \sum_{x_\ell} K^{(k,\ell)}(x_k,x_\ell) u_\ell^{(t)}(x_\ell) \mu_\ell(x_\ell), \quad \text{ if } \ell \in \Gamma, \label{eq:message_updates_b} \end{align} \end{subequations} where $K^{(k,\ell)}(x_k,x_\ell)= \exp( - C^{(k,\ell)}(x_k,x_\ell)/ \eta)$. Since we can without loss of generality assume that $\Gamma$ is the set of leaves of the tree, each vertex $k\in \Gamma$ has a unique neighbour $\ell_k \in N(k)$. The Sinkhorn iterations \eqref{eq:sinkhorn} with the projections \eqref{eq:proj_messages} thus read \begin{equation} u_k^{(t+1)}(x_k) \leftarrow ( m_{\ell_k \to k} (x_k) )^{-1}. \end{equation} Note that when we update the scaling vectors $u_{k^{(t)}}^{(t)}$ and in the previous iteration updated $u_{k^{(t-1)}}^{(t-1)}$ it is only required to recompute the messages between $k^{(t-1)}$ and $k^{(t)}$ \citep{haasler2021pgm,SinHaaZha20}. The Sinkhorn method is summarized in Algorithm~\ref{algo:sinkhorn}. Here, we apply a random updating scheme, where the next scaling vector to be updated is picked from a uniform distribution of the remaining scaling vectors, except the previous one. Other common update rules for the Sinkhorn iterations, such as cyclic or greedy updates, can be obtained by simply changing the selection of $k^{(t)}$ in Algorithm~\ref{algo:sinkhorn}. \begin{algorithm}[tb] \caption{SINKHORN\_BP($\epsilon', \{\mu_k \}_{k \in \Gamma}, {\bf C}, \eta$)} \label{algo:sinkhorn} \begin{algorithmic} \STATE{ {\bfseries Initialization:} $u_k^{(0)} = \mathbf{1} \in {\mathbb{R}}^n $, for $k \in \Gamma$; \ $t=1$; \ $k^{(0)} \in \Gamma$} \WHILE{ $\sum_{k \in \Gamma} \|P_k({\bf B}(\Lambda^{(t)})) - \mu_k \|_1 \geq \epsilon' $} \STATE{ Randomly pick $k^{(t)} \in \Gamma \setminus k^{(t-1)}$} \STATE{ Update messages $m_{k_1 \to k_2} $ according to \eqref{eq:message_updates} on the path from $k^{(t-1)}$ to $k^{(t)}$ } \STATE{ Update $$u_k^{(t+1)} (x_k) \leftarrow \begin{cases} ( m_{\ell_k \to k} (x_k) )^{-1}, & \text{ for } k=k^{(t)}, \text{ and } \ell_k \in N(k), \\ u_k^{(t)}(x_k), & \text{ for } k \in \Gamma \setminus k^{(t)}, \end{cases} \quad \forall x_k $$} \STATE{ $t \leftarrow t+1$ } \ENDWHILE \STATE { {\bfseries Output:} $u_k^{(t+1)}$, $k \in \Gamma$ } \end{algorithmic} \end{algorithm} From the scaling vectors $\{u_k\}_{k\in \Gamma}$ that are returned from Algorithm~\ref{algo:sinkhorn} we can construct the transport tensor $\widetilde {\bf B}$ as in \eqref{eq:opt_sol}. However, this tensor is not guaranteed to lie in the feasible set ${\Pi_\Gamma^m((\mu_k)_{k\in \Gamma})}$, and thus a rounding step is needed. This is based on the rounding for bi-marginal optimal transport in \cite[Algorithm 2]{altschuler2017near}, and is stated in Algorithm~\ref{algo:round}. Note that a transport tensor that solves a graph-structured MOT problem \eqref{eq:unregu mot} or \eqref{eq:ot_multi_reg} is fully determined by the projections $P_{k_1,k_2}({\bf B})$ on the edges $(k_1,k_2)\in E$ \citep{KolFri09}, which are given by \begin{equation} \label{eq:proj_bi} [P_{k_1,k_2}({\bf B})] (x_{k_1}, x_{k_2}) = \sum_{{\bf x} \setminus\{x_{k_1}, x_{k_2}\} } {\bf B}( {\bf x}). \end{equation} By slight abuse of notation, we let ${\bf B}((B_{k_1,k_2})_{(k_1,k_2) \in E})$ denote this tensor that decouples according to the tree structure $G$ and satisfies the projections $[P_{k_1,k_2}({\bf B})] = B_{k_1,k_2}$ for $(k_1,k_2) \in E$ \citep{KolFri09}. Note that the projections \eqref{eq:proj_bi} can be cheaply computed from the scaling vectors $\{u_k\}_{k\in \Gamma}$ as described in \cite[Theorem~4]{haasler2021pgm}. \begin{algorithm}[tb] \caption{ROUND $({\bf B},\{\mu_k\}_{k \in \Gamma} )$} \label{algo:round} \begin{algorithmic} \STATE {\bfseries Initialization:} ${\bf B}_{k,\ell_k}=P_{k,\ell_k}({\bf B})\in {\mathbb{R}}^{n \times n} $ for all $k \in \Gamma$ and each $\ell_k \in N(k)$ \FOR{$k\in \Gamma$} \STATE{Input $\left({\bf B}_{k,\ell_k};P_{\ell_k}({\bf B}),\mu_k \right)$ into \cite[Algorithm 2]{altschuler2017near} and get $\widehat{{\bf B}}_{k, \ell_k} $ such that $\widehat{{\bf B}}_{k,\ell_k} \in \Pi(P_{\ell_k}({\bf B}),\mu_k)$} \ENDFOR \STATE{ {\bfseries Output:} $ \widehat {\bf B} = \{ \widehat {\bf B}_{k, \ell_k}; k \in \Gamma \} \cup \{ P_{k_1,k_2} ({\bf B}) ; (k_1,k_2)\in E, k_1,k_2 \notin \Gamma \}$ } \end{algorithmic} \end{algorithm} The full method for finding an $\epsilon$-approximate solution to a tree-structured MOT problem is summarized in Algorithm~\ref{algo:complete}. \begin{algorithm}[tb] \caption{$\epsilon$-approximation of tree-structured MOT } \label{algo:complete} \begin{algorithmic} \STATE{ $\eta \leftarrow \frac{\epsilon}{2 m \log(n)}$; \ $\epsilon' \leftarrow \frac{\epsilon }{8 {R_C^\Gamma}} $ .} \STATE{ $\{u_k\}_{k\in \Gamma} \leftarrow \text{SINKHORN\_BP} (\epsilon', \{\mu_k \}_{k \in \Gamma}, {\bf C}, \eta)$. (Algorithm~\ref{algo:sinkhorn}) } \STATE{Construct $\widetilde {\bf B}(B_{k_1,k_2, (k_1,k_2) \in E})$ from $\{u_k\}_{k\in \Gamma}$ \STATE{ $\widehat {\bf B} \leftarrow \text{ROUND} (\widetilde{{\bf B}}, \{\mu_k \}_{k \in \Gamma})$. (Algorithm~\ref{algo:round}) } \STATE{ {\bfseries Output:} $\widehat{{\bf B}}$ } \end{algorithmic} \end{algorithm} \section{Complexity analysis} In this section, we present a complexity bound for the Sinkhorn belief propagation algorithm for solving MOT problems with graph-structured costs. We first provide a few technical lemmas that will be used in the proof. The proofs of all the supporting lemmas are given in the supplementary material. The first result provides bounds for the scaling vector iterates. \begin{lemma} \label{lem:bound_lambda} Let $\lambda_k = \eta \log(u_k)$, where $u_k$ are generated by Algorithm~\ref{algo:sinkhorn}. Let $\Lambda^* = \{\lambda_k^*\}_{k\in \Gamma}$ be a solution of \eqref{eq:ot_multi_dual}. Then for each $k \in \Gamma$ it holds \begin{equation*} \begin{aligned} \max_{x_k} \lambda_k (x_k) -\min_{x_k} \lambda_k (x_k)\leq R_C^k, \\ \max_{x_k} \lambda_k^* (x_k) -\min_{x_k} \lambda_k^* (x_k) \leq R_C^k, \end{aligned} \end{equation*} where \begin{equation*} R_C^k := \|C^{(k,\ell_k)}\|_\infty, \end{equation*} and where $\ell_k \in N(k)$ is the (unique) neighbour of $k$. \end{lemma} The following Lemma relates the error in the dual objective value to the stopping criterion of Algorithm~\ref{algo:sinkhorn}. \begin{lemma} \label{lem:psi2psi_star} Let $\Lambda= \{\lambda_k\}_{k\in \Gamma}$, where $\lambda_k = \eta \log(u_k)$ and $u_k$ are generated by Algorithm~\ref{algo:sinkhorn}, and let $\Lambda^* = \{ \lambda_k^*\}_{k\in\Gamma}$ be a solution to \eqref{eq:ot_multi_dual}. Then it holds \begin{equation} \psi(\Lambda) - \psi(\Lambda^*) \leq {R_C^\Gamma} \sum_{k\in \Gamma} \| P_k({\bf B}(\Lambda)) - \mu_k \|_1 , \end{equation} with $ {R_C^\Gamma} = \max_{k\in \Gamma} R_C^k $, where $R_C^k$ is defined as in Lemma~\ref{lem:bound_lambda}. \end{lemma} The increment between two sequential Sinkhorn iterates is related to the stopping criterion of Algorithm~\ref{algo:sinkhorn} as described in the following. \begin{lemma} \label{lemma:incremental psi} For any $\Lambda^{(t)}$, let $\Lambda^{(t+1)}$ be the next iterate of the algorithm in \eqref{eq:sinkhorn}. \begin{equation}\label{eq:iter_improve} {\mathbb{E}} \left[ \psi(\Lambda^{(t)}) - \psi(\Lambda^{(t+1)}) \right] \geq \frac{\eta}{2 |\Gamma|^2} \left( e_t\right)^2, \end{equation} with \begin{equation} e_t:=\sum_{k \in \Gamma} \| P_k({\bf B}(\Lambda^{(t)})) - \mu_k \|_1. \end{equation} The expectation is over the uniform distribution of $k^{(t+1)} \in \Gamma \setminus k^{(t)}$. \end{lemma} We need the following lemma from \citet{altschuler2020random} to connect the per-iteration expected improvement and the number of iterations. \begin{lemma}{\cite[Lemma 5.3]{altschuler2020random}} \label{lemma:iter_bound} Assume $A>a, h>0$. Let $(Y_t)_{t=1}^\infty$ be a sequence of random variables adapted to a filtration $({\mathcal{F}}_t)_{t=0}^\infty$ such that (i) $Y_0 \leq A$ almost surely, (ii) $0 \leq Y_{t-1}-Y_t \leq 2(A-a)$ almost surely, and \begin{align*} \text{(iii) } {\mathbb{E}} \left[Y_t -Y_{t+1}| {\mathcal{F}}_t, Y_t \geq a \right] \geq h \quad \forall t =0,1,2,\ldots. \end{align*} Then the stopping time $s=\min \{t: Y_t \leq a \}$ satisfies 1) the expectation bound ${\mathbb{E}}[s] \leq \frac{A-a}{h}+1$; and 2) $\forall \delta \in(0,1/e)$, the probability bound ${\mathbb{P}} (s \leq \frac{6(A-a)}{h} \log \frac{1}{\delta}) \geq 1-\delta$ holds. \end{lemma} We are now ready to state our first main result, which gives two probabilistic bounds on the required number of iterations in Algorithm~\ref{algo:sinkhorn}. \begin{theorem} \label{theo:t bound} Algorithm \ref{algo:sinkhorn} generates a tensor ${\bf B}(\Lambda^{(t)})$ satisfying \begin{equation*} \sum_{ k \in \Gamma} \| P_k({\bf B}(\Lambda^{(t)})) - \mu_k \|_1 \leq \epsilon', \end{equation*} within $\tau$ iterations, where \begin{equation*} {\mathbb{E}}[\tau] \leq \frac{8 |\Gamma|^2 {R_C^\Gamma} }{\eta \epsilon'}. \end{equation*} Moreover, for any $\delta \in (0,0.5),$ it holds that \begin{equation*} {\mathbb{P}}\left( \tau \leq \frac{48 |\Gamma|^2 {R_C^\Gamma} }{\eta \epsilon'} \log \frac{1}{\delta}\right) \geq 1-{\delta}. \end{equation*} \end{theorem} \begin{proof} Define the stopping time $\tau:=\min \left\{t: e_t \leq \epsilon'\right\}$. Let $\{{\mathcal{F}}_t := \sigma \left(\Lambda^{(1)},\ldots,\Lambda^{(t)} \right)\}_t$ be the natural filtration. By Lemma \ref{lem:psi2psi_star} and Lemma \ref{lemma:incremental psi}, \begin{align*} {\mathbb{E}} \left[ \psi(\Lambda^{(t)}) - \psi(\Lambda^{(t+1)}) |{\mathcal{F}}_t, t < \tau \right] \geq \frac{\eta}{2 |\Gamma|^2} \left(\max\left\{\frac{\psi(\Lambda^{(t)})-\psi(\Lambda^*)}{{R_C^\Gamma} }, \epsilon' \right\}\right)^2, \end{align*} For shorthand, denote $\widetilde{\psi}(\Lambda^{(t)})=\psi(\Lambda^{(t)})-\psi(\Lambda^*)$, and let $\tau_1$ be the first iteration when $ \widetilde{\psi}(\Lambda^{(t)}) \leq {R_C^\Gamma} \epsilon'$ and $\tau_2:=\tau-\tau_1 \geq 0$. Define \begin{equation} Z_t = \begin{cases} \widetilde{\psi}(\Lambda^{(t)}) & \mbox{if}~ t \leq \tau, \\ \widetilde{\psi}(\Lambda^{(t)}) - (t -\tau)\frac{\eta(\epsilon')^2}{2|\Gamma|^2} & \mbox{if}~ t>\tau. \end{cases} \end{equation} A direct observation is that $Z_t$ is monotonically decreasing. For $t\in [ \tau_1, \tau]$, let $Y_{t-\tau_1}=Z_{t}$. Then the expected improvement of $Y_t$ per iteration is at least $\frac{\eta(\epsilon')^2}{2|\Gamma|^2} $, that is \begin{align*} {\mathbb{E}} \left[ Y_t - Y_{t+1} |{\mathcal{F}}_t, Y_t \geq 0 \right] \geq \frac{\eta(\epsilon')^2}{2|\Gamma|^2}. \end{align*} With choices $A={R_C^\Gamma} \epsilon'$, $a=0$, and $h=\frac{\eta (\epsilon')^2}{2 |\Gamma|^2}$, clearly $Y_t\le A$ and $0\le Y_t-Y_{t+1}\le 2(A-a)$. Thus, Lemma \ref{lemma:iter_bound} implies \begin{align*} {\mathbb{E}}[\tau_2'] \leq \frac{2|\Gamma|^2 {R_C^\Gamma} }{\eta\epsilon'} +1 \quad \text{where } \tau_2'= \min \{t: Y_t \leq 0 \}. \end{align*} Whenever $t \leq \tau,$ we have $\widetilde{\psi}(\Lambda^{(t)} ) \geq 0$ and as such $Z_t \geq 0$. So $\tau:=\min \left\{t: e_t \leq \epsilon'\right\}$ is achieved earlier than $\min\{ t: Z_t \leq 0 \}$ and this implies \begin{align}\label{eq:tau_2} \tau-\tau_1=\tau_2 \leq \tau_2'= \min \{t: Z_t \leq 0 \} -\tau_1 \quad \Rightarrow \quad {\mathbb{E}}[\tau_2] \leq {\mathbb{E}}[\tau_2'] \leq \frac{2|\Gamma|^2 {R_C^\Gamma}}{\eta\epsilon'} +1. \end{align} To bound $\tau_1$, we define $D_0={R_C^\Gamma} e_0$ and $D_i:=D_{i-1}/2$ for $i=1,2,\ldots$ until $D_N \leq {R_C^\Gamma} \epsilon'$. Let $\tau_{1,i}$ be the number of iterations when $D_i \leq \widetilde{\psi}(\Lambda^{(t)})\leq D_{i-1}$. Let $t_{1,i}=\min \{t: \widetilde{\psi}(\Lambda^{(t)}) \leq D_{i-1} \}$. Consider $A=D_{i-1}$, $a=D_i$, $h=\frac{\eta}{2 |\Gamma|^2 {R_C^\Gamma}^2} D_i^2$, and $Y_t=Z_{t+t_{1,i}} $. It holds \begin{align*} {\mathbb{E}} \left[ Y_t - Y_{t+1} |{\mathcal{F}}_t, Y_t \geq D_i \right] \geq \frac{\eta}{2 |\Gamma|^2 {R_C^\Gamma}^2} \widetilde{\psi}(\Lambda^{(t)})^2 \geq \frac{\eta}{2 |\Gamma|^2 {R_C^\Gamma}^2} D_i^2. \end{align*} In addition $Y_t\le A$ and $0 \le Y_t-Y_{t+1}\le D_{i-1} \le 2 (A-a)$ by the nonnegativity and monotonicity of $Y_t$. From Lemma~\ref{lemma:iter_bound} and the definition of the sequence $D_i$ it follows that \begin{align}\label{eq:tau_1i} {\mathbb{E}}[ \tau_{1,i}] \leq \frac{D_{i-1}- D_i}{ \eta D_i^2} 2|\Gamma|^2 {R_C^\Gamma}^2 + 1 \leq \frac{2|\Gamma|^2{R_C^\Gamma}^2}{\eta D_i}+1. \end{align} Summing up Equation \eqref{eq:tau_1i} for $i=1,2,\ldots,N$ and Equation \eqref{eq:tau_2} yields \begin{align*} {\mathbb{E}} [\tau] \leq \frac{2|\Gamma|^2 {R_C^\Gamma}}{\eta\epsilon'} +1+ \sum_{i=1}^N \frac{2 |\Gamma|^2{R_C^\Gamma}^2}{\eta D_i}+N \leq \frac{2 |\Gamma|^2 {R_C^\Gamma}}{\eta\epsilon'} +1+ \frac{4 |\Gamma|^2{R_C^\Gamma}}{\eta \epsilon'}+ \log_2 \ceil*{\frac{e_0}{\epsilon'}}. \end{align*} Since $\log_2 \left( \frac{e_0}{\epsilon'} \right) \leq \frac{e_0}{\epsilon'} \leq \frac{2 |\Gamma|}{\epsilon'} \leq \frac{2 |\Gamma|^2 {R_C^\Gamma}}{\eta \epsilon'}$, it further follows \begin{align*} {\mathbb{E}} [\tau] \leq \frac{8 |\Gamma|^2{R_C^\Gamma}}{\eta \epsilon'}. \end{align*} Next we prove the high probability bound. By Lemma \ref{lemma:iter_bound}, $\forall \delta \in (0,0.5)$, \begin{equation} \label{eq:tau2_prob} {\mathbb{P}}\left( \tau_2> \frac{12 |\Gamma|^2 {R_C^\Gamma}}{\eta \epsilon'} \log \frac{2}{\delta}\right) <\frac{\delta}{2} \end{equation} and with $\delta_i:= {\delta}/{2^{N-i+2}}$ for each $i=1,\ldots,N$, \begin{align*} {\mathbb{P}}\left( \tau_{1,i}> \frac{12 |\Gamma|^2 {R_C^\Gamma}^2}{\eta D_i} \log \frac{1}{\delta_i}\right) <\delta_i. \end{align*} Given the series summation $\sum_{i=0}^\infty 2^{-i} =\sum_{i=0}^\infty i \cdot 2^{-i} =2$ and the definition of $\delta_i$ and $D_N$, we have \begin{align*} \sum_{i=1}^N \frac{\log \frac{1}{\delta_i}}{D_i} =\frac{1}{D_N}\sum_{i=0}^{N-1} 2^{-i}{\left(\log \frac{4}{\delta}+i\log2 \right)} \leq \frac{2}{D_N}{\left(\log \frac{4}{\delta}+\log2 \right)} \leq \frac{3}{{R_C^\Gamma} \epsilon'}{\log \frac{4}{\delta}}. \end{align*} By taking the union over $\tau_{1,i}$ it follows \begin{align}\label{eq:tau1_prob} {\mathbb{P}}\left( \tau_{1}> \frac{36 |\Gamma|^2 {R_C^\Gamma}}{\eta \epsilon'} \log \frac{4}{\delta}\right) \leq \sum_{i=1}^N {\mathbb{P}}\left( \tau_{1,i}> \frac{12 |\Gamma|^2 {R_C^\Gamma}^2}{\eta D_i} \log \frac{1}{\delta}\right) <\frac{\delta}{2}. \end{align} Taking a union bound over Equation \eqref{eq:tau2_prob} and Equation \eqref{eq:tau1_prob}, we conclude that \begin{equation*} {\mathbb{P}}\left( \tau> \frac{48 |\Gamma|^2 {R_C^\Gamma}}{\eta \epsilon'} \log \frac{4}{\delta}\right) <{\delta}. \end{equation*} \end{proof} In order to provide the complexity on the full method in Algorithm~\ref{algo:complete} we need the following two lemmas, which deal with the rounding method in Algorithm~\ref{algo:round}. \begin{lemma} \label{lem:round bound} Let ${\bf B} \in {\mathbb{R}}^{n^m}$, where $m\geq 3$, be a nonnegative $m$-mode tensor and $\{\mu_k\}_{k \in \Gamma}$ be a sequence of probability vectors, Algorithm \ref{algo:round} returns $\widehat{{\bf B}}$ satisfying $P_k({\bf B})=P_k(\widehat{{\bf B}})$, for $k \in \Gamma$, and $P_k(\widehat{{\bf B}})=\mu_k$, for $k \in \Gamma$. Moreover, it holds that \begin{equation*} \langle {\bf C}, {\bf B}\rangle-\langle{\bf C}, \widehat{{\bf B}}\rangle \leq 2\sum_{k\in \Gamma} \|C^{(k,\ell_k)}\|_{\infty} \|\mu_k-P_k({{\bf B}}) \|_1, \end{equation*} where $\ell_k$ is the unique neighbour of $k$, for each $k \in \Gamma$. \end{lemma} \begin{lemma} \label{lem:Bhat_Bstar} Let $\widetilde{{\bf B}}$ be the output of Algorithm \ref{algo:sinkhorn}, let $ \widehat{{\bf B}} $ be the output of Algorithm~\ref{algo:round} with input $(\widetilde{{\bf B}}, \{\mu_k\})$, and let ${\bf B}^*$ denote the optimal solution to the unregularized MOT problem \eqref{eq:unregu mot}. Then it holds that \begin{align*} \<{\bf C}, \widehat{{\bf B}}\>-\<{\bf C}, {\bf B}^*\> \leq & m \eta \log(n) + 4 \sum_{k\in \Gamma} \|C^{(k,\ell_k)}\|_{\infty} \|\mu_k - P_k(\widetilde{{\bf B}})\|_1. \end{align*} \end{lemma} We now have the tools to state our new complexity bound for finding $\epsilon$-approximate solutions to tree-structured MOT problems. Denote by $d(G)$ the maximum distance of two nodes in the graph $G$. \begin{theorem}\label{thm:opercomplexity} Algorithm~\ref{algo:complete} finds an $\epsilon$-approximate solution to the tree-structured MOT problem \eqref{eq:unregu mot} in $T$ arithmetic operations, where \begin{equation*} {\mathbb{E}}[T] = \mathcal{O} \left( \frac{d(G) m |\Gamma|^2 n^2 ({R_C^\Gamma})^2 \log(n)}{\epsilon^2} \right). \end{equation*} Moreover, for all $\delta \in (0,0.5)$ it holds that \begin{equation*} {\mathbb{P}}\left( T \leq \frac{ c d(G) m |\Gamma|^2 n^2 ({R_C^\Gamma})^2 \log(n) \log(1/\delta) }{\epsilon^2} \right) \geq 1-{\delta} \end{equation*} where $c$ is a universal constant. \end{theorem} \begin{proof} With the specific choices $\eta=\frac{\epsilon}{2 m \log(n)}$ and $\epsilon'= \frac{\epsilon }{8 {R_C^\Gamma}}$ we get $\langle {\bf C}, {\widehat{{\bf B}}} \rangle -\langle {\bf C}, {{\bf B}^*} \rangle \leq \epsilon$. By Theorem~\ref{theo:t bound}, the stopping time $\tau$ satisfies \begin{align*} {\mathbb{E}} [\tau] = \frac{8 |\Gamma|^2 {R_C^\Gamma}}{\eta \epsilon'} = \mathcal{O} \left(\frac{ m |\Gamma|^2 ({R_C^\Gamma})^2 \log(n)}{\epsilon^2} \right). \end{align*} Since in each iteration of Algorithm~\ref{algo:sinkhorn} the messages between two leave nodes of the tree are updated, and each message update is of complexity $\mathcal{O}(n^2)$, one iteration takes at most $\mathcal{O}( d(G) n^{2}) $ operations. Thus, in expectation, a solution is achieved in \begin{equation} \mathcal{O} \left(\frac{ d(G) n^2 m |\Gamma|^2 ({R_C^\Gamma})^2 \log(n)}{\epsilon^2} \right) \end{equation} operations. Algorithm \ref{algo:round} takes $\mathcal{O}(|\Gamma|n^2)$ (see Lemma 7 in \citet{altschuler2017near}). Hence, the bound on ${\mathbb{E}}[T]$ follows. The bound in probability follows similarly. \end{proof} \begin{remark} \label{rem:average_dist} The complexity bound in Theorem \ref{thm:opercomplexity} can be improved slightly to $\mathcal{O} \left(\frac{ \bar d(G) n^2 m |\Gamma|^2 ({R_C^\Gamma})^2 \log(n)}{\epsilon^2} \right)$ where $\bar d(G)$ is the average distance between any two nodes in $\Gamma$. The argument is similar to that of Theorem \ref{theo:t bound} and Theorem \ref{thm:opercomplexity} but requires a more careful combination of the results, since the per iteration complexity is not independent of the random choice of the update. More details can be found in the supplementary material. \end{remark} \begin{remark} \label{rem:barycenter} Consider the barycenter problem introduced in Example~\ref{exa: barycenter}. This problem is a MOT problem \eqref{eq:unregu mot} with underlying graph as illustrated in Figure~\ref{fig:barycenter_graph}. Here, $d(G)=2$, $|\Gamma|=L$, and $m=L+1$. Moreover, by \eqref{eq:barycentercost}, we have $ {R_C^\Gamma} = \frac{1}{L} \|C\|_\infty $. Thus, Algorithm~\ref{algo:complete} is expected to return an $\epsilon-$approximate solution to problem \ref{eq:barycenter_pairwise} in $\mathcal{O}( L n^2 \|C\|_\infty^2 \log(n)\epsilon^{-2} )$. This coincides with the best known bound for the barycenter problem \citep{kroshnin2019complexity,lin2020fixedsupport} without acceleration. We also point out that the regularizer used in the Wasserstein barycenter literature is different from ours: one is pairwise regularization and one is regularization over the full tensor ${\bf B}$. For more details on this comparison, see \citet{haasler2020tree}[Section 5]. \end{remark} \begin{remark} \label{cor:bound_mot} In many cases ${R_C^\Gamma} = \mathcal{O} (|\Gamma|^{-1} \|{\bf C}\|_\infty)$ (see discussion in the supplementary material). Then from Theorem~\ref{thm:opercomplexity}, Algorithm~\ref{algo:complete} finds an $\epsilon$-approximate solution to the tree-structured MOT problem \eqref{eq:unregu mot} in $T$ operations, where \begin{equation} {\mathbb{E}}[T] = \mathcal{ O} \left( \frac{d(G) m n^2 \|{\bf C}\|_\infty^2 \log(n)}{\epsilon^2} \right). \end{equation} \end{remark} Remark~\ref{cor:bound_mot} lets us compare our result with the bound for general MOT problems in \citet{lin2020complexity}, which is given by $ \mathcal{ O} \left( \frac{ m n^{m} \|{\bf C}\|_\infty^2 \log(n)}{\epsilon^2} \right)$. \begin{remark} \label{rem:general_graph} The methods presented in this paper can be generalized to any graph $G$ that is not necessarily a tree. In this case each iteration of ISBP takes $\mathcal{O}( d(G) n^{w(G)+1} )$, where $w(G)$ is the tree-width of $G$. Thus, a generalization of Algorithm~\ref{algo:complete} is expected to return an $\epsilon$-approximate solution to the MOT problem in $\mathcal{ O} \left( \frac{d(G) m n^{w(G)+1} \|{\bf C}\|^2_\infty \log(n)}{\epsilon^2} \right)$ with Remark~\ref{cor:bound_mot}. For a complete graph this matches the best known result without acceleration in \citet{lin2020complexity}. \end{remark} \section{Conclusion} In this work we considered a class of multi-marginal optimal transport problems where the cost functions can be decomposed according to a graph. It turns out that the computational complexity of MOT can be significantly reduced by exploiting the graphical structures. More specifically, without any structure, the complexity grows exponentially as the number of marginals increases. With graphical structure, the dependence becomes polynomial. We provide a complexity bound $ \mathcal{\tilde O}(m |\Gamma|^2n^2\epsilon^{-2})$ for solving the tree-structured MOT problems based on the Sinkhorn belief propagation algorithm \citep{haasler2021pgm,SinHaaZha20} with the random updating rule. We also provide a similar bound for general graphical-structured MOT problems. One limitation of the present work is that the proof techniques do not seem to be applicable to Sinkhorn iterations with cyclic updating rule, which is the most popular strategy used in practice. This will be a future research direction. We also plan to accelerate the Sinkhorn belief propagation algorithm using ideas from \citet{lin2020complexity,kroshnin2019complexity}. This work is a pure theoretical study and we don't foresee any negative societal impacts.
\section{Summary}\label{summary}} \texttt{album} (Schmidt, Albrecht, and Harrington 2021) is a decentralized distribution platform for solutions to specific scientific problems. It works across platforms, tools, and data domains and is designed to address limitations in reproducibility of scientific data software solutions and workflows, particularly when interactivity is needed. \texttt{album} can be used to programmatically define how to interoperate between applications. It can ship versatile applications while tweaking them for a specific target audience or use case. An updated list of features and applications can be found on the \href{https://album.solutions}{documentation} site. \hypertarget{composition}{% \section{Composition}\label{composition}} A schema of the composition of all \texttt{album} components is shown in figure \autoref{fig:schema}. \texttt{album} is deployed as a pip package for command line usage. Each \texttt{album} solution can be defined using a single Python file, including metadata like authorship, usage instructions, and a description of the compatible \texttt{Conda} (Anaconda, Inc. 2021) environment. The metadata format is derived from the \texttt{bioimage.io} specification (Beuttenmüller, F. and Pape, C. and Ouyang, W. and Kutra, D. and Melnikov, E. and Schmidt, D. and Gómez de Mariscal, E. and Novikov, M. 2021). Solutions can be shared via URL, hard drive location, or deployed to \texttt{zenodo} and shared via DOI. Catalogs make it possible to bundle solutions and also share them via git repository. \begin{figure} \centering \includegraphics{img/album-schema.png} \caption{The components of the \texttt{album} ecosystem are shown. \texttt{album} is the core tool for accessing catalogs and solutions. Remote catalogs (shown in gray) can be added and removed to a user's local collection which enables solutions to be installed, tested, and run. \texttt{album-app} is a graphical interface to \texttt{album} that provides a user-friendly way to access catalogs and run solutions.\label{fig:schema}} \end{figure} Moreover, we have created a graphical user interface based on \texttt{SciJava} (Rueden et al. 2017) called \texttt{album-app} (Schmidt 2021). It guides the user through setting up the entire \texttt{album} installation and makes it easy to add catalogs, install and run solutions, and handling input parameters graphically. An example screenshot of \texttt{album-app} is shown in \autoref{fig:screenshot}. \begin{figure} \centering \includegraphics{img/album-app-welcome.png} \caption{An example screenshot of the album-app user interface displaying the user's local collection dialog. The interface provides a way to quickly add new \texttt{album} catalogs, load existing catalogs into the collection, and quickly run recently installed solutions.\label{fig:screenshot}} \end{figure} \hypertarget{statement-of-need}{% \section{Statement of need}\label{statement-of-need}} There is a vast spectrum of available scientific (image analysis) tools with novel approaches appearing online on a daily basis. However, many are hard to install, have nonexistent, or outdated documentation, are unmaintained, and error prone. Often scientists are neither trained nor encouraged to focus on software reproducibility, usability, maintenance, and interoperability. When trying to solve a specific problem it becomes increasingly unfeasible to review all existing tools and plugins. \texttt{album} is aiming for a different view by helping scientists to describe use cases and automate solutions as much as possible to allow reproducibly sharing specific results (see figure \autoref{fig:comparison}). \begin{figure} \centering \includegraphics{img/album-comparison.png} \caption{\texttt{album} focuses on automating tool usage based on specific scientific problems. Currently software tools that are designed to solve problems have independent interfaces for execution. \texttt{album} provides a unified method for installing and running solutions in addition to a catalog that collects software solutions into a single location.\label{fig:comparison}} \end{figure} Existing package managers like \texttt{Conda} (Anaconda, Inc. 2021), \texttt{npm} (npm, Inc. 2021), \texttt{apt} (The Debian Project 2020), or \texttt{Homebrew} (Max Howell 2021) can be used by non experts, but they don't provide scientists with a well defined, reproducible entry point for solving a specific problem. Some lack cross platform support or a way to deploy packages to a self hosted location. \texttt{album} runs on Linux, Windows and MacOS. \texttt{album} solutions can be collectively shared via so called catalogs, living on a hard drive location or a git repository. \texttt{album} provides all the functionalities to enable research software facilities (e.g.~imaging facilities) to deploy a curated list of software tools in an easily maintainable fashion. Existing scientific software frameworks like \texttt{Fiji} (Schindelin et al. 2012), \texttt{ImJoy} (Ouyang et al. 2019), and \texttt{napari} (Sofroniew, N., Talley Lambert, Evans, K., Nunez-Iglesias, J., Yamauchi, K., Solak, A. C., et al. 2020) are often limited in language support and bound to the environment of the base software. Many users therefore suffer from version clashes or lack of version transparency. In \texttt{album} each solution defines it's own \texttt{Conda} environment, making it possible to launch most open source tools from a simple python script snippet included in the solution and adjust it's usage based on the problem to be solved. The environments can and should include fixed versioning to be as reproducible as possible. We currently provide templates for \texttt{Python}, \texttt{Java}, \texttt{ImageJ}, \texttt{ImageJ2} (Rueden et al. 2017), \texttt{BigDataViewer} (Pietzsch et al. 2015) and \texttt{ImgLib2} (Pietzsch et al. 2012), \texttt{sciview} (Günther and Harrington 2020), and \texttt{napari} (Sofroniew, N., Talley Lambert, Evans, K., Nunez-Iglesias, J., Yamauchi, K., Solak, A. C., et al. 2020). Existing workflow tools like \texttt{biaflows} (Rubens et al. 2020), \texttt{Snakemake} (Köster and Rahmann 2012), \texttt{Galaxy} (Goecks, Nekrutenko, and Taylor 2010), or \texttt{Nextflow} (Di Tommaso et al. 2017) aimed to solve scientific problems in a reproducible manner have a high entry barrier and are therefore rarely used by people without a computer science degree. While user-friendly workflow tools like \texttt{KNIME} (Berthold et al. 2009) often lack the ability to run native applications and focus on cloud computing instead. \texttt{album} provides a user-friendly way to develop and distribute reproducible scientific solutions that can even include interactive, and native applications. We provide graphical interfaces to setup and launch solutions. \texttt{album} can also run multiple solutions in a row - this feature will be expanded in the future. Connecting existing lab notebook tools like \texttt{LabBook} (Kandogan et al. 2015) with \texttt{album} could enable scientists to log scientific procedures conveniently by making sure computational setups can easily be reproduced by other labs. \hypertarget{acknowledgements}{% \section{Acknowledgements}\label{acknowledgements}} We acknowledge support from the Helmholtz Imaging. \hypertarget{references}{% \section*{References}\label{references}} \addcontentsline{toc}{section}{References} \hypertarget{refs}{} \begin{CSLReferences}{1}{0} \leavevmode\vadjust pre{\hypertarget{ref-conda}{}}% Anaconda, Inc. 2021. \emph{Conda} (version 4.10.1). \url{https://conda.io}. \leavevmode\vadjust pre{\hypertarget{ref-berthold2009knime}{}}% Berthold, Michael R, Nicolas Cebron, Fabian Dill, Thomas R Gabriel, Tobias Kötter, Thorsten Meinl, Peter Ohl, Kilian Thiel, and Bernd Wiswedel. 2009. {``KNIME-the Konstanz Information Miner: Version 2.0 and Beyond.''} \emph{AcM SIGKDD Explorations Newsletter} 11 (1): 26--31. \leavevmode\vadjust pre{\hypertarget{ref-bioimageiospec}{}}% Beuttenmüller, F. and Pape, C. and Ouyang, W. and Kutra, D. and Melnikov, E. and Schmidt, D. and Gómez de Mariscal, E. and Novikov, M. 2021. \url{https://github.com/bioimage-io/spec-bioimage-io/}. \leavevmode\vadjust pre{\hypertarget{ref-di2017nextflow}{}}% Di Tommaso, Paolo, Maria Chatzou, Evan W Floden, Pablo Prieto Barja, Emilio Palumbo, and Cedric Notredame. 2017. {``Nextflow Enables Reproducible Computational Workflows.''} \emph{Nature Biotechnology} 35 (4): 316--19. \leavevmode\vadjust pre{\hypertarget{ref-goecks2010galaxy}{}}% Goecks, Jeremy, Anton Nekrutenko, and James Taylor. 2010. {``Galaxy: A Comprehensive Approach for Supporting Accessible, Reproducible, and Transparent Computational Research in the Life Sciences.''} \emph{Genome Biology} 11 (8): 1--13. \leavevmode\vadjust pre{\hypertarget{ref-gunther2020tales}{}}% Günther, Ulrik, and Kyle IS Harrington. 2020. {``Tales from the Trenches: Developing Sciview, a New 3d Viewer for the ImageJ Community.''} In \emph{Eurographics: VisGap - the Gap Between Visualization Research and Visualization Software}. \leavevmode\vadjust pre{\hypertarget{ref-kandogan2015labbook}{}}% Kandogan, Eser, Mary Roth, Peter Schwarz, Joshua Hui, Ignacio Terrizzano, Christina Christodoulakis, and Renée J Miller. 2015. {``Labbook: Metadata-Driven Social Collaborative Data Analysis.''} In \emph{2015 IEEE International Conference on Big Data (Big Data)}, 431--40. IEEE. \leavevmode\vadjust pre{\hypertarget{ref-koster2012snakemake}{}}% Köster, Johannes, and Sven Rahmann. 2012. {``Snakemake---a Scalable Bioinformatics Workflow Engine.''} \emph{Bioinformatics} 28 (19): 2520--22. \leavevmode\vadjust pre{\hypertarget{ref-homebrew}{}}% Max Howell. 2021. \emph{Homebrew} (version f7689d1). \url{https://brew.sh}. \leavevmode\vadjust pre{\hypertarget{ref-npm}{}}% npm, Inc. 2021. \emph{Npm} (version 7.24.0). \url{https://www.npmjs.com/}. \leavevmode\vadjust pre{\hypertarget{ref-ouyang2019imjoy}{}}% Ouyang, Wei, Florian Mueller, Martin Hjelmare, Emma Lundberg, and Christophe Zimmer. 2019. {``ImJoy: An Open-Source Computational Platform for the Deep Learning Era.''} \emph{Nature Methods} 16 (12): 1199--1200. \leavevmode\vadjust pre{\hypertarget{ref-pietzsch2012imglib2}{}}% Pietzsch, Tobias, Stephan Preibisch, Pavel Tomančák, and Stephan Saalfeld. 2012. {``ImgLib2---Generic Image Processing in Java.''} \emph{Bioinformatics} 28 (22): 3009--11. \leavevmode\vadjust pre{\hypertarget{ref-pietzsch2015bigdataviewer}{}}% Pietzsch, Tobias, Stephan Saalfeld, Stephan Preibisch, and Pavel Tomancak. 2015. {``BigDataViewer: Visualization and Processing for Large Image Data Sets.''} \emph{Nature Methods} 12 (6): 481--83. \leavevmode\vadjust pre{\hypertarget{ref-rubens2020biaflows}{}}% Rubens, Ulysse, Romain Mormont, Lassi Paavolainen, Volker Bäcker, Benjamin Pavie, Leandro A Scholz, Gino Michiels, et al. 2020. {``BIAFLOWS: A Collaborative Framework to Reproducibly Deploy and Benchmark Bioimage Analysis Workflows.''} \emph{Patterns} 1 (3): 100040. \leavevmode\vadjust pre{\hypertarget{ref-rueden2017imagej2}{}}% Rueden, Curtis T, Johannes Schindelin, Mark C Hiner, Barry E DeZonia, Alison E Walter, Ellen T Arena, and Kevin W Eliceiri. 2017. {``ImageJ2: ImageJ for the Next Generation of Scientific Image Data.''} \emph{BMC Bioinformatics} 18 (1): 1--26. \leavevmode\vadjust pre{\hypertarget{ref-schindelin2012fiji}{}}% Schindelin, Johannes, Ignacio Arganda-Carreras, Erwin Frise, Verena Kaynig, Mark Longair, Tobias Pietzsch, Stephan Preibisch, et al. 2012. {``Fiji: An Open-Source Platform for Biological-Image Analysis.''} \emph{Nature Methods} 9 (7): 676--82. \leavevmode\vadjust pre{\hypertarget{ref-albumapp}{}}% Schmidt, Deborah. 2021. \emph{Album-App} (version ab0bb99b). \url{https://gitlab.com/album-app/album-app}. \leavevmode\vadjust pre{\hypertarget{ref-album}{}}% Schmidt, Deborah, Jan Philipp Albrecht, and Kyle Harrington. 2021. \emph{Album} (version 21a329f4). \url{https://album.solutions}. \leavevmode\vadjust pre{\hypertarget{ref-napari}{}}% Sofroniew, N., Talley Lambert, Evans, K., Nunez-Iglesias, J., Yamauchi, K., Solak, A. C., et al. 2020. \url{https://zenodo.org/record/4048613}. \leavevmode\vadjust pre{\hypertarget{ref-apt}{}}% The Debian Project. 2020. \emph{Advanced Package Tool (Apt)} (version 1.8.2.2). \url{https://wiki.debian.org/Apt}. \end{CSLReferences} \end{document}
\section{Introduction} \label{sec:intro} Biometrics authentication is a security measure for uniquely identifying an individual on the basis of his/her physical or behavioral traits. Commonly used biometrics sources include face, fingerprint, and voice. Face recognition is common due to its high accuracy and seamless user interaction. Advances in deep neural networks (DNNs) have greatly improved the performance of face recognition \cite{DBLP:conf/cvpr/TaigmanYRW14,DBLP:conf/nips/SunCWT14,DBLP:conf/bmvc/ParkhiVZ15}. For these and other reasons, face recognition is being used real-life applications, ranging from immigration inspection to smartphone authentication. As with other forms of biometrics authentication, face authentication is susceptible to spoofing attacks, a type of attack in which an adversary attempts to bypass authentication by appearing to be genuine. There are mainly two approaches to bypassing authentication via spoofing. First, the adversary may carry out spoofing during authentication, e.g., present an image that looks genuine during authentication in real-time. Second, the adversary may register adversarial images in the system's database, i.e., \textit{data poisoning}, to confound the system during authentication occurring sometime later. We mainly focus on the latter approach in this study. Consider the following scenario in which an adversary registers/enrolls a slightly modified image of a genuine individual, the real identity of whom is denoted as \textit{A}, to the authentication system. During authentication, the system compares the enrolled image with a user-input image. We consider an attack to be successful only when the system is able to authenticate \textit{A} (no reasonable suspicion arises) as well as another individual \textit{B}, where $B\neq A$ (spoofing is successful). This allows \textit{B} to be authenticated even though \textit{B} is not enrolled, compromising the authentication system. A more agnostic form of spoofing, where the modified image matches with more than two individuals, is also possible. An adversary equipped with such an image can potentially break into multiple distinct authentication systems without needing knowledge about the specific identities registered to the authentication systems. This led us to investigate \textit{universal} spoofing attacks against face recognition. Particularly, we consider an adversary that registers an adversarial example (AX), an input image with a small amount of noise added, to an authentication system. Such an image with inconceivably small noise is preferred from the adversary's perspective, as it helps hide the adversary's trace without raising human suspicion. We call such images that spoof multiple identities \textbf{universal adversarial spoofing examples (UAXs)}, to differentiate them from conventional AXs with which the only aim is to to cause misidentification. The UAX matches with faces images of different genders, races, illumination, poses, and expressions. The highlights of our contribution in this work are as follows: \begin{itemize} \item Using adversarial perturbations, we propose a UAX-crafting method for enabling universal multiple-identity spoofing attacks on face recognition systems. \item Experimental results on multiple datasets and models indicate that our method is effective not only on targeted/known identities, but also generalizable to unknown identities. In particular, the UAXs crafted with our method have a 99\% spoofing success rate (for both known and unknown identities we have tested them with) against the VGG2 feature extractor. \end{itemize} These vulnerabilities severely undermine the authentication capability of current face recognition systems and should be treated as a legitimate threat when deploying such systems in an industrial setting. The rest of the paper is organized as follows. We first provide preliminaries and background relevant to our work in Section \ref{sec:pre}. In section \ref{sec:method}, we present the proposed method of crafting UAXs. We discuss the extensive experimental evaluations we considered in Section \ref{sec:eval}. Finally, we conclude the paper in Section \ref{sec:conclusion}. \section{Background} \label{sec:pre} \paragraphb{Face recognition.} Broadly speaking, the task of face recognition is divided into two categories. The first category is face identification, or \textit{closed-set face recognition}, where the task is to execute a multi-class classification of faces belonging to a set of pre-determined identities. \footnote{Face recognition systems should reject unknown identities not belonging to the pre-determined set of identities. The \textit{open-set face recognition} protocol, which was designed to achieve this, has also been investigated \cite{DBLP:journals/corr/GuntherCRB17}.} The second category is face verification. During authentication, the face recognition system compares the user-input image with images enrolled in the system's database and determines whether they belong to the same identity. The focus of our study was on face verification. State-of-the-art face recognition systems use DNNs to extract a low-dimensional feature representation from a face image for face verification \cite{DBLP:conf/cvpr/LiuWYLRS17,DBLP:conf/cvpr/WangWZJGZL018,DBLP:conf/cvpr/DengGXZ19}. The similarity of two images can then be quantified by measuring the distance between their feature representations. Euclidean distance and cosine distance are common similarity metrics (the smaller the distance is, the more similar the images are). The system subsequently determines if the two images belong to the same individual on the basis of a pre-determined decision threshold. The DNN architectures used to train face recognition feature extractors are typically those that work well in the image recognition domain. The VGG \cite{DBLP:journals/corr/SimonyanZ14a} and Inception \cite{DBLP:conf/cvpr/HeZRS16} networks are common DNN architectures. We now describe the training process of feature extractors. One common approach is training a DNN to execute classification on a pre-determined set of identities. The output of the penultimate layer is then treated as the feature to be used for face verification. Another approach involves training the feature extractor directly via metric learning \cite{DBLP:conf/cvpr/SchroffKP15}. This approach involves constructing a triplet of two matching face images and a non-matching face image, but suffers from scalability issues, i.e., the number of triplet combinations increases exponentially with the number of training data points. We used feature extractors implementing the former approach in this study. It is worthwhile to note that recent releases of large annotated databases have also helped advance the field of face recognition. Widely used databases include CASIA-WebFace \cite{DBLP:journals/corr/YiLLL14a}, VGGFace2 \cite{DBLP:conf/fgr/CaoSXPZ18}, MS1M \cite{DBLP:conf/eccv/GuoZHHG16}, and LFW \cite{LFWTech}. The CASIA-WebFace dataset contains 0.49M images from 10,575 celebrities. The VGGFace2 is a large-scale dataset with large variations in pose, age, illumination, ethnicity, and profession. A total of 3.31M images from 9131 celebrities can be found in this dataset. The MS-Celeb1M dataset (MS1M) is another large-scale dataset with about 10k celebrities with 10M images. A refined version of this dataset (MS1MV2) containing less noise and with 3.8M images of 85,164 celebrities is also available \cite{DBLP:conf/cvpr/DengGXZ19}. The Labeled Face in the Wild dataset (LFW) is a smaller dataset (13k images from 1,680 people) that is typically used for validation. \paragraphb{Adversarial examples.} The phenomenon in which a small crafted perturbation (noise) added to an input may lead to misclassification by the DNN was first discussed in \cite{DBLP:journals/corr/SzegedyZSBEGF13}. Subsequently, various methods of crafting adversarial perturbations have been proposed, including those involving gradient updates \cite{DBLP:journals/corr/GoodfellowSS14,DBLP:conf/iclr/KurakinGB17,DBLP:conf/iclr/MadryMSTV18}. For example, a ``fast" one-step gradient update along the direction of the sign of gradient (FGSM) was carried out \cite{DBLP:journals/corr/GoodfellowSS14}. Iterative methods with higher probability of fooling DNNs have been proposed in \cite{DBLP:conf/iclr/KurakinGB17}. The Carlini-Wagner attack relies on optimization problem solving \cite{DBLP:conf/sp/Carlini017}, which has been empirically shown to be extremely successful at attacking DNNs with minimal perturbation. While the aforementioned methods focus on causing misclassification, Rozsa et al. \cite{DBLP:conf/icb/RozsaGB17} crafted AXs that align the internal layer representation with the target representation, which can be adapted to generate AXs to manipulate the feature representation of face images when one considers attacks on face verification. We also notice that the study of ``universal'' adversarial perturbation is available in the literature \cite{DBLP:conf/cvpr/Moosavi-Dezfooli17}, where the aim of such an attack is to create a single perturbation to mis-classify various images (e.g., images from class A mis-classified as class B). The attacks crafted with our method are different in the sense that, when the perturbation is added to a face image, they are able to match many classes (e.g., class A mis-classified not only as class B, but also class C, class D etc.). Since previous works focused on classification problems, it is not obvious that such universal behavior exists in face verification (where the task is calculating how similar two feature vectors are), which is rather different from classification (where the task is calculating how likely an image belongs to a certain class). \paragraphb{Attacks on face recognition.} Security issues of face recognition have attracted much attention. For example, Sharif et al. \cite{DBLP:conf/ccs/SharifBBR16} showed that it is possible to fool face recognition systems deployed in the physical world by adding perturbations in the eyeglass region. In \cite{DBLP:conf/cvpr/DongSWLL0019}, a method of attacking face recognition in a black-box fashion has been proposed. Attacking face recognition using generative adversarial networks (GANs) has been studied as well \cite{DBLP:journals/corr/abs-1811-12026}. It should be noted that most studies on attacks on face recognition focus on tricking the authentication system into misidentifying an individual, orthogonal to our adversarial purposes of spoofing multiple identities. Finding a generic sample that is similar to many of the enrolled templates is known as a wolf attack in biometrics \cite{DBLP:conf/icb/UneOI07}. \footnote{It is also known as dictionary attack in computer security.} Previous works have focused on finger-vein-, fingerprint- and voice-based authentication systems \cite{DBLP:conf/icb/UneOI07,DBLP:conf/btas/BontragerRTMR18,DBLP:conf/interspeech/MarrasKMF19}. \cite{DBLP:journals/corr/abs-1906-08507} and \cite{DBLP:conf/icb/NguyenYEM20} investigated multiple-identity attacks and have adversarial purposes similar to the present work. To carry out multiple-identity attack, \cite{DBLP:journals/corr/abs-1906-08507} used face morphing methods and searched in a gallery for natural faces that match with two identities. However, they considered neither adversarial perturbations nor dictionary attacks, where a single face can match with more than two identities, which constitute the core part of the present work, were considered in \cite{DBLP:journals/corr/abs-1906-08507}. \cite{DBLP:conf/icb/NguyenYEM20} considers \textit{Master Faces}, multi-identity spoofing images crafted using GANs. This is different from our method of crafting images using adversarial perturbations, which is a stealthier form of attack. Our study is more extensive in the sense that we demonstrated the effectiveness of our attack by performing evaluation on multiple DNNs, in contrast with \cite{DBLP:conf/icb/NguyenYEM20}, who conducted an evaluation only on a single DNN. \section{Proposed Method} \label{sec:method} Our aim is to craft a UAX that can spoof as many identities as possible. We craft the UAX by adding perturbations to a ``seed" genuine image, $x_A$. Given a training dataset, $A_{\rm train}$, our crafting strategy is as follows. We add perturbations to $x_A$ such that its similarities with \textit{all} images from $A_{\rm train}$ are maximized. We further prepare a separate dataset containing a disjoint population of individuals, $A_{\rm test}$, to test the spoofing capability of UAXs with unseen identities. \subsection{Formulating Universal Adversarial Spoofing Examples} \label{subsec:targetform} Let us provide a more precise formulation of our proposed method. Let $\phi(\cdot)$ denote the DNN feature extractor. The feature representation extracted from the image of individual $A$, $x_A$, and individual $B$, $x_B$, are $\phi(x_A)$ and $\phi_(x_B)$, respectively. Without loss of generality, we consider adding a small perturbation, $\nu$, to $x_A$ so that the UAX may be written as \begin{align} x' \equiv x_A + \nu. \end{align} The corresponding feature representation $\phi(x')$ is required to have a large enough similarity score with $B$ for successful spoofing. Requiring $\nu$ to be small can be formulated as $||\nu||_p < \xi$, where $\xi$ is a parameter controlling the size of the perturbation, and $p$ refers to the $l_p$ norm with $p \in [1,\infty)$ (we focus on $p=\infty$ for the rest of this paper). \subsection{Algorithm} The goal with proposed method is to craft a UAX ($x'$) that spoofs as many images in $A_{\rm train}$ as possible. To achieve this, our algorithm iteratively searches for $x'$ that minimizes \begin{align} f(x';x^j) \equiv \left\| \phi(x') - \phi(x^j)\right\|_2 \end{align} by searching for $\Delta \nu$ and aggregating it to the current value of $\nu$ at each iteration, where $x^j \in A_{\rm train}$. The proposed method requires updating the gradient in a mini-batch fashion. We first initialize \begin{align*} \nu &\leftarrow 0, \\ x' &\leftarrow x_A + \nu. \end{align*} At each iteration $i$, we then perform the following steps: \begin{itemize} \item \textbf{Mini-batch sampling.} Sample a mini-batch of size $n$ from $A_{\rm train}$, i.e., $S^i_{\rm batch} \leftarrow \{x_B: x_B \in A_{\rm train}\}$. \item \textbf{Loss evaluation and optimization.} Minimize \begin{align} \label{eq:optim} F(x';S^i_{\rm batch}) \equiv \frac{1}{n} \sum_{x_B\in S^i_{\rm batch}} \left\|\phi(x') - \phi(x_B)\right\|_2 \end{align} under the constraint \begin{align*} \left\|\nu\right\|_p < \xi. \end{align*} \end{itemize} The iteration may be terminated after a certain pre-determined number of iterations. In this work, we test with 500 and 5,000 iterations. \paragraphb{Optimization details.} Before solving Eq. \ref{eq:optim}, we normalize the range of $x$ to $[0,1]$ . The following change from $x$ to $w$ is then made: \begin{align} x = \frac{1}{2} ( \text{tanh}\ (w) +1). \end{align} We solve for $w$ using the stochastic gradient descent (SGD) method. Finally, we clip the perturbation ($\nu \leftarrow \mathcal{P}(\nu; p, \xi)$) using the following projection operator: \begin{align} \label{eq:project} &\mathcal{P}(\nu; p, \xi) \equiv \operatorname*{argmin}_\rho \left\|\rho - \nu\right\|_2 \ \text{s.t.}\ ||\rho||_p < \xi. \end{align} \section{Evaluation} \label{sec:eval} In this Section, we describe the experimental evaluation of the proposed method. Two attack scenarios are considered: \begin{itemize} \item \textit{White-box attacks.} The attacker crafts UAXs using the victim's feature extractor. \item \textit{Black-box attacks.} The attacker crafts UAXs using feature extractors different from the one he or she is targeting. \end{itemize} \subsection{Experimental Setup} \paragraphb{Network settings.} To test the validity of our approach, we conducted an empirical evaluation by using a variety of open-source feature extractors as the target of our attack, namely VGG \footnote{https://github.com/yzhang559/vgg-face}, VGG2 \footnote{https://github.com/rcmalli/keras-vggface}, SphereFace \footnote{https://github.com/clcarwin/sphereface\_pytorch}, and InsightFace \footnote{https://github.com/TreB1eN/InsightFace\_Pytorch}. These feature extractors use well-known backbone architectures (convolutional neural networks (CNNs) and Resnets) and have been trained to classify a pre-determined set of identities in a supervised manner. Details of the network settings of the feature extractors, including training method, architecture and dataset used for training are summarized in Table \ref{tab:fe}. \begin{table}[t] \scriptsize \centering \caption{Details of feature extractors used in this work. Name of the feature extractor, training method (loss function used), DNN architecture and dataset used for training are shown. See text for links to open-source codes.} \label{tab:fe} \begin{tabular}{|c|c|c|c|c|} \hline Model name & Training method & Architecture & Training dataset \\ \hline \hline VGG & Softmax & VGG16& VGGFace\\ \hline VGG2 & Softmax & Resnet50& VGGFace2\\ \hline SphereFace & SphereFace \cite{DBLP:conf/cvpr/LiuWYLRS17}& 36-layer CNN& CASIA-WebFace \\ \hline InsightFace & ArcFace \cite{DBLP:conf/cvpr/DengGXZ19}& SE-Inception50 & MS1MV2 \cite{DBLP:conf/cvpr/DengGXZ19} \\ \hline \end{tabular} \end{table} \begin{table}[t] \centering \caption{Datasets and number of instances used for training and testing UAXs.} \label{tab:dataset} \begin{tabular}{|c|c|c|} \hline Dataset name & Train & Test \\ \hline \hline VGGFace2 & 10,000 & 5,000 \\ \hline LFW & 3,438 & 1,549\\ \hline \end{tabular} \end{table} \paragraphb{Datasets.} Four datasets were constructed from VGGFace2 and LFW datasets to craft (train) and evaluate (test) UAXs (two each for training and testing). From VGGFace2 (LFW) dataset, we selected 10 (5) images to be the ``seeds" that will be added with perturbations to craft UAXs. The VGGFace2 train (test) dataset used for evaluation was constructed by sampling 2000 (1000) identities and 5 images from each identity from the train (test) subset of VGGFace2. To evaluate with LFW dataset, we selected all images from the recommended train and test pairs \cite{LFWTech} to construct the train (3,438 images) and test (1,549 images) dataset respectively. Note that the train and test datasets were mutually exclusive (no over-lapping identities). The details of the datasets are summarized in Table \ref{tab:dataset}. For image pre-processing, we employed the multitask convolutional neural network (MTCNN) to detect and crop face images to $112 \times 112$ pixels \cite{DBLP:journals/spl/ZhangZLQ16}. \paragraphb{Evaluation metrics.} Before deployment, practitioners of the face recognition systems need to determine a decision threshold on the similarity score to verify whether two face images belong to the same identity. In this study, we used the equal error rate (EER) as the decision threshold. This measurement is also known as the imposter attack presentation match rate (IAPMR). The discriminative power of a feature extractor is measured using the false matching rate (FMR) (the smaller an FMR is, the better a feature extractor is). Conversely, the FMR is also used as a metric to quantify the attack success rate (the higher an FMR is, the higher attack success rate a UAX has). \subsection{White-box attacks} \label{subsec:exp2} For our first evaluation, we assumed that the adversary has full knowledge of the victim's feature extractor, such that a white-box attack is viable, where the adversary crafts the UAXs using the victim's feature extractor. We fixed the perturbation size to $\xi = 10 / 255$, or $\epsilon = 10$. By crafting the UAXs on the basis of the discussion in Section \ref{sec:method}, we show how the FMRs change from non-UAXs (zero-effort imposters) to UAXs. Tables \ref{tab:res1}-\ref{tab:res4} list the results for the four targeted feature extractors. Note that the FMRs are shown as the average among the 10 (5) UAXs we crafted on the basis of the VGGFace2 (LFW) dataset. The UAXs consistently outperformed the non-UAXs by a significant margin at spoofing. The VGG2 feature extractor was the most vulnerable; 99\% of the images in the train and test datasets were successfully spoofed since the UAXs were crafted with 5,000 iterations. Even against the state-of-the-art feature extractor, InsightFace, the UAXs were relatively successful, being able to spoof as much as around 20 \% of the dataset (for both train and test datasets). Figure \ref{fig:masterface} gives another view of UAXs, where the score distributions of genuine faces, zero-effort imposter faces, and UAXs are shown. Zero-effort imposter faces consisted of ``seed" images and different identities as we use in white-box evaluation. Genuine faces were constructed by sampling pairs of face images from the same identity. Although the adversarial perturbation was quite small, each sample could spoof over 99\% of the different identities. \noindent \textbf{Observations.} The feature vector of our face recognition module is of 512 dimensions, and the hypersphere is theoretically large enough to hold large-scale identities with a small misidentifying probability if the feature vectors of each identity are distributed uniformly (see, e.g., \cite{DBLP:conf/cvpr/DengGXZ19}). Our results indicate otherwise. It seems that the feature vectors of different identities are more “concentrated” than expected. We hope this observation spurs further theoretical investigation and analysis in the future. \begin{table}[t] \scriptsize \centering \caption{Average FMRs for ``seed" images (*-*-$b$) and UAXs (*-*-$a$, in bold text), when measured with instances of train (*-$train$-*) and test (*-$test$-*) datasets, constructed from VGGFace2 ($VGG$-*-*) and LFW ($LFW$-*-*). The \textit{VGG} feature extractor was used in this configuration.} \label{tab:res1} \begin{tabular}{|l|c|c|} \hline Dataset & $\epsilon=10$, $500$ iteration &$\epsilon=10$, $5,000$ iteration \\ \hline VGG-train-b & $0.094\pm 0.033$& $0.094\pm 0.033$ \\ \textbf{VGG-train-a} & $\bf 0.15\pm 0.071$& $\bf 0.32\pm 0.11$ \\ \hline VGG-test-b & $0.098\pm 0.033$& $0.098 \pm 0.033$ \\ \textbf{VGG-test-a} & $\bf 0.15\pm 0.061$& $\bf 0.32\pm 0.11$ \\ \hline LFW-train-b & $0.061\pm 0.018$& $0.061\pm 0.018$ \\ \textbf{LFW-train-a} & $\bf 0.15\pm 0.032$& $\bf 0.34\pm0.078$ \\ \hline LFW-test-b & $0.063\pm 0.018 $& $0.063\pm 0.018 $ \\ \textbf{LFW-test-a} & $\bf 0.15\pm 0.031$& $\bf 0.34\pm 0.083$ \\ \hline \end{tabular} \end{table} \begin{table}[t] \scriptsize \centering \caption{VGG2 feature extractor was used in this configuration. See title of Table \ref{tab:res1} for details.} \label{tab:res2} \begin{tabular}{|l|c|c|} \hline Dataset & $\epsilon=10$, $500$ iteration &$\epsilon=10$, $5,000$ iteration \\ \hline VGG-train-b & $0.056\pm 0.030$& $0.056\pm 0.030$ \\ \textbf{VGG-train-a} & $\bf 0.69\pm 0.18$& $\bf 0.99\pm 0.0017$ \\ \hline VGG-test-b & $0.060\pm 0.029$& $0.060\pm 0.029$ \\ \textbf{VGG-test-a} & $\bf 0.70\pm 0.17$& $\bf 0.99\pm 0.0018$ \\ \hline LFW-train-b & $0.068\pm 0.023$& $0.068\pm 0.023$ \\ \textbf{LFW-train-a} & $\bf 0.76\pm 0.047$& $\bf 0.99\pm0.0063$ \\ \hline LFW-test-b & $0.066\pm 0.027 $& $0.066\pm 0.027 $ \\ \textbf{LFW-test-a} & $\bf 0.77\pm 0.049$& $\bf 0.99\pm0.0054$ \\ \hline \end{tabular} \end{table} \begin{table}[t] \scriptsize \centering \caption{Insightface feature extractor was used in this configuration. See title of Table \ref{tab:res1} for details.} \label{tab:res3} \begin{tabular}{|l|c|c|} \hline Dataset & $\epsilon=10$, $500$ iteration &$\epsilon=10$, $5,000$ iteration \\ \hline VGG-train-b & $0.075\pm 0.013$& $0.075\pm 0.013$ \\ \textbf{VGG-train-a} & $\bf 0.19\pm 0.025$& $\bf 0.25\pm 0.012$ \\ \hline VGG-test-b & $0.075\pm 0.011$& $ 0.075\pm 0.011 $ \\ \textbf{VGG-test-a} & $\bf 0.18\pm 0.019$& $\bf 0.23\pm 0.014$ \\ \hline LFW-train-b & $0.056\pm 0.011$& $0.056\pm 0.011$ \\ \textbf{LFW-train-a} & $\bf 0.20\pm 0.013$& $\bf 0.24\pm0.00051$ \\ \hline LFW-test-b & $0.057\pm 0.0040 $& $0.057\pm 0.0040 $ \\ \textbf{LFW-test-a} & $\bf 0.20\pm 0.014$& $\bf 0.25\pm 0.0017$ \\ \hline \end{tabular} \end{table} \begin{table}[t] \scriptsize \centering \caption{SphereFace feature extractor was used in this configuration. See title of Table \ref{tab:res1} for details.} \label{tab:res4} \begin{tabular}{|l|c|c|} \hline Dataset & $\epsilon=10$, $500$ iteration &$\epsilon=10$, $5,000$ iteration \\ \hline VGG-train-b & $0.11\pm 0.034$& $0.11\pm 0.034$ \\ \textbf{VGG-train-a} & $\bf 0.60\pm 0.040$& $\bf 0.63\pm 0.0032$ \\ \hline VGG-test-b & $0.11\pm 0.028 $& $ 0.11\pm 0.028$ \\ \textbf{VGG-test-a} & $\bf 0.62\pm 0.040$& $\bf 0.66\pm 0.0022$ \\ \hline LFW-train-b & $0.067\pm0.038$& $0.067\pm0.038$ \\ \textbf{LFW-train-a} & $\bf 0.56\pm 0.0011$& $\bf 0.57\pm0.00024$ \\ \hline LFW-test-b & $0.067\pm 0.038 $& $0.067\pm 0.038 $ \\ \textbf{LFW-test-a} & $\bf 0.57\pm 0.0024$& $\bf 0.58\pm 0.000072$ \\ \hline \end{tabular} \end{table} \begin{figure}[!tbp] \scriptsize \begin{subfigure}[b]{0.2\textwidth} \includegraphics[width=4.0cm]{imgs/masterface_hist_train.png} \caption{Train} \label{fig:m1} \end{subfigure} \hspace{5mm} \begin{subfigure}[b]{0.2\textwidth} \includegraphics[width=4.0cm]{imgs/masterface_hist_test.png} \caption{Test} \label{fig:m2} \end{subfigure} \caption{Euclidean distance distributions of LFW face images with respect to train and test datasets. Distance distributions of same-identity face images (\textit{genuine faces}), different-identity face images (\textit{zero-effort imposter faces}), and UAXs without adversarial perturbations (\textit{UAXs}).} \label{fig:masterface} \end{figure} \subsection{Black-box attacks} \label{subsec:black} For the second evaluation, we transferred the UAXs generated from each feature extractor to the other ones and measured the FMRs for all combinations of different feature extractors. Figure \ref{fig:masterface_bb} shows the heat maps of adversarial transferability in the train and test datasets. The UAXs generally did not transfer well to the other feature extractors. In the best case, $10\%$ of the UAXs crafted by attacking the InsightFace model were transferable to the SphereFace model. \begin{figure}[!tbp] \scriptsize \begin{subfigure}[b]{0.2\textwidth} \includegraphics[width=4.0cm]{imgs/bb_train.png} \caption{Train} \label{fig:m1} \end{subfigure} \hspace{5mm} \begin{subfigure}[b]{0.2\textwidth} \includegraphics[width=4.0cm]{imgs/bb_test.png} \caption{Test} \label{fig:m2} \end{subfigure} \caption{Adversarial transferability among VGG, VGG2, InsightFace, SphereFace models. We tested FMRs on UAXs with 5,000 iterations, $\epsilon$ is 10.} \label{fig:masterface_bb} \end{figure} \section{Discussion and conclusion} \label{sec:conclusion} We conducted the first analysis of multiple-identity attacks on face verification using adversarial perturbations. We showed, particularly in a white-box attack scenario, that an adversary can significantly enhance the spoofing capability of face images using our proposed method. Even without the knowledge of the identities registered to a certain face recognition system, an adversary can use the universal spoofing capability of the image to break into the authentication process with a markedly improved success rate. Our crafted UAXs do not transfer well, as shown in Section \ref{subsec:black}. Some direct methods resolving this include training our UAXs with many different architectures to increase transferability, which is left for future work. Other future research directions include developing defenses against UAXs. {\small \bibliographystyle{ieee}
\section{Introduction} Salient object detection (SOD) methods can be categorized into RGB based ones, RGB-D based ones, and the recently proposed light field based ones. By only based on static images, although RGB SOD methods \cite{hou2017deeply, liu2020picanet, liu2019simple, zhao2020suppress} have achieved excellent performance on many benchmark datasets, they still can not handle challenging and complex scenes. This is because the appearance saliency cues conveyed in RGB images are heavily constrained, especially when the foreground and background appearance are complex or similar. To solve this problem, depth information is introduced to provide supplementary cues in RGB-D SOD methods \cite{chen2018progressively, zhao2019contrast, piao2019depth, liu2020learning}. However, it is not easy to obtain high-quality depth maps and many current RGB-D SOD benchmark datasets only have noisy depth maps. On the contrary, light field data Hence, the light field SOD problem has much potential to explore. \begin{figure}[!t] \graphicspath{{figure/}} \centering \includegraphics[width=1\linewidth]{figure/figure1_new.pdf} \caption{(a) and (b) show the comparison of traditional dense graph models and our proposed local graph model. (c) illustrates the framework of our model. \begin{normalsize}{\textcircled{\footnotesize{R}}}\end{normalsize} means the reciprocative unit.} \label{fig:figure1} \vspace{-0.5cm} \end{figure} Besides the focal stack images, light field data also have an all-focus image that provides the context information. Thus, light field SOD has two key points, \ie, \emph{how to effectively fuse multiple focal stack features and how to cooperate the focal stack cues with the all-focus information}. A straightforward way to solve the first problem is to concatenate focal stack features and use a convolution layer for fusion. Such a simple way can not sufficiently explore the complex interaction within different focal slices, hence may limit the model performance. It is also an ill-posed solution since convolution requires a fixed input number, hence many methods have to randomly pad the input images when they are less than the pre-defined number. Adopting ConvLSTM \cite{shi2015convolutional} is another popular solution, where the focal stack images are processed one by one in a pre-defined sequential order using the memory mechanism. This also involves an ill-posed problem setting since there is no meaningful order among focal stack images. Furthermore, the usage of the sequential order may cause ConvLSTM to ignore the information of the focal slices that are input earlier. As for the second problem, most previous works \cite{wang2019dlsd} simply concatenate or sum the focal stack feature with the all-focus feature and then adopt convolutional fusion only once. Such a straightforward fusion method heavily limits the exploration of complex supplementary relations between these two kinds of information. To solve the first problem, adopting the powerful graph neural networks (GNNs) \cite{gori2005new,scarselli2008graph} is a possible way. GNNs aggregate the contextual information from neighbouring nodes and propagate it to the target node, thus can achieve effective feature fusion. At the same time, it avoids the ill-posed implementation problem since the graph connection can be built flexibly and does not depend on a sequential order. A straightforward way is to view each pixel location in the feature maps of the focal stack as a node and construct dense edge connections among all locations, as shown in Figure~\ref{fig:figure1}(a). However, this is impractical since light field SOD requires large feature maps for focal slices to obtain fine-grained segmentation. Hence, building a densely connected graph involves prohibitive computational costs. To this end, we propose to build local graphs to efficiently aggregate contexts in different focal slices. We treat each image pixel location in the focal stack as nodes and build the graph only within local neighbouring nodes, as shown in Figure~\ref{fig:figure1}(b). As such, the context propagation within focal slices can be efficiently performed with dramatically reduced edge connections. One can further introduce multiscale local neighbours, hence incorporating larger context information with acceptable computational costs. Besides building a graph within the focal stack, we also build a focal-all graph to introduce external guidance from the all-focus feature for the fusion of focal features, thus resulting in a novel dual local graph (DLG) network. To tackle the second key point in light field SOD, we propose a novel reciprocative guidance architecture, as shown in Figure~\ref{fig:figure1}(c). It introduces multi-step guidance between the all-focus image feature and the focal stack features. In each step, the former is first used to guide the fusion of the latter, and then the fused feature is used to update the former. We perform such a process in a reciprocative fashion, where mutual guidance can be conducted recurrently. Finally, the two kinds of features can be improved with more discriminability, benefiting the final SOD decision. Our main contributions can be summarised as: \vspace{-3mm} \begin{itemize} \item We propose a new GNN model named dual local graph to enable effective context propagation in focal stack features under the guidance of the all-focus feature and also avoid high computational costs. \vspace{-1mm} \item We propose a novel reciprocative guidance scheme to make the focal stack and the all-focus features guide and promote each other at multiple steps, thus gradually improving the saliency detection performance. \vspace{-1mm} \item Extensive experiments illustrate the effectiveness of our method. It surpasses other light field methods by a large margin. Moreover, with much less training data, our method also shows competitive or better performance compared with RGB-D or RGB based SOD models. \end{itemize} \section{Related Work} \subsection{Light Field SOD} Although the usage of CNNs has improved RGB SOD and RGB-D SOD by a large margin \cite{wang2021salient,zhou2021rgb}, there are still lots of challenges in the SOD task, especially when the visual scenes are complex. Hence, several works have tried to leverage the focal cues in light field data to perform SOD. \cite{li2014saliency} was the first work to explore SOD with light field data, and constructed the first benchmark dataset. After that, the background prior \cite{zhang2015saliency}, weighted sparse coding \cite{li2015weighted}, and light field flow \cite{zhang2017saliency} are widely used for this new task. More details about traditional methods can be found in \cite{Fu2020lightSOD}. When it comes to the deep learning era, several deep-learning methods have promoted the light field SOD performance significantly. Zhang \etal \cite{zhang2019memory} inputted the feature maps of focal slices and the all-focus image into a ConvLSTM \cite{shi2015convolutional} to fuse them one by one. This scheme has the ill-posed implementation problem. On the other hand, their method only fuses focal stack and all-focus features once. Wang \etal \cite{wang2019dlsd} and Piao \etal \cite{piao2020exploit} both fused the features from different focal slices using varying attention weights, which are inferred at multiple time steps in a ConvLSTM. As such, they performed feature fusion within focal slices several times. However, \cite{wang2019dlsd} conducted focal stack and all-focus feature fusion only once, while \cite{piao2020exploit} did not perform such a fusion. They adopted knowledge distillation \cite{hinton2015distilling} to improve the representation ability of the all-focus branch. Different from previous works, our proposed DLG network enables efficient context fusion among all focal slice images. We also introduce the guidance from the all-focus feature into the focal stack fusion process, and our proposed reciprocative architecture introduces mutual guidance between the two kinds of features multiple times. These two points have never been explored by previous works. \begin{figure*}[!t] \graphicspath{{figure/}} \centering \includegraphics[width=1\linewidth]{figure/Archtecture_new.pdf} \caption{Overview of our proposed model. DLG: the proposed dual local graph; FSFA: focal stack feature aggregation; AM: used to generate the attention matrix $A$ in \eqref{eq:fsfa}; $\otimes$: element-wise multiplicationl; $\oplus$: element-wise addition; GRU: ConvGRU \cite{cho2014learning}. Due to space limitation, we only illustrate the reciprocative guidance process at three time steps.} \label{network_overview} \vspace{-0.4cm} \end{figure*} \subsection{Grapth Neural Network} Graph neural networks (GNNs) were proposed by \cite{gori2005new} and developed by \cite{scarselli2008graph} to model data structures in graph domains. Since GNNs can model the relationships among nodes, they have been applied in many fields, such as molecular biology \cite{gilmer2017neural}, natural language processing \cite{beck2018graph}, knowledge graph \cite{hamaguchi2017knowledge}, and disease classification \cite{rhee2017hybrid}. Recently, GNNs have also been widely explored in the field of computer vision. Wang \etal \cite{wang2018videos} adopted a graph convolutional network to build the spatial-temporal relationships for action recognition. For dense prediction tasks, Luo \etal \cite{luo2020cascade} used GNNs to construct graphs among feature maps and learn cross-modality and cross-scale reasoning simultaneously for RGB-D SOD. In \cite{wang2019zero}, Wang \etal proposed an attentive GNN to learn the semantic and appearance relationships among several video frames for video object segmentation. Zhang \etal \cite{zhang2020adaptive} adopted a graph convolutional network to jointly implement both intra-saliency detection and inter-image correspondence for co-saliency detection. Both the latter two works constructed densely-connected pixel-pixel graphs, which are computationally expensive and lack scalability, especially for the light field data that can have more than 10 focal stack images. On the contrary, we propose a novel graph architecture with local pixel-pixel connections for light field SOD. We also introduce dilated neighbouring connections to incorporate large contexts with computational efficiency. Furthermore, we build two graphs to simultaneously propagate context interaction among focal stack images and incorporate the guidance from the all-focus image. \subsection{Reciprocative Models} Reciprocative or recurrent models, including RNN, LSTM \cite{hochreiter1997lstm}, and GRU \cite{cho2014gru}, process temporal sequences using internal state or memory, and progressively update their states. There are also many other saliency detection works or other related tasks using reciprocative models. AGNN \cite{wang2019zero} and CAS-GNN \cite{luo2020cascade} used reciprocative models as the node updating function in GNNs to update graph node embeddings. DMRA \cite{piao2019depth}, DLSD \cite{wang2019dlsd}, ERNet \cite{piao2020exploit}, and MoLF \cite{zhang2019memory} combined attention models with reciprocative models to refine a given feature or a set of features. R3Net\cite{deng2018r3net} and RFCN \cite{wang2016rfcn} recurrently fused a saliency map with CNN features or the input image to refine the saliency map. Different from them, we use reciprocative models to iteratively update two kinds of features, \ie, the focal stack feature and the all-focus feature, where the interactions between them are considered to introduce mutual guidance. \section{Proposed model} In Figure~\ref{network_overview}, we illustrate the overview of the proposed model. First, we use two encoders to extract features from the all-focus image and the corresponding focal slices, respectively. Then, we input them into the proposed DLG model to propagate contextual features among focal slices, which are further aggregated by the focal stack feature aggregation model. With the proposed reciprocative guidance scheme, focal stack and the all-focus features can be fused with each other several times, hence being improved progressively. Finally, the fused feature is fused with a low-level feature to predict the final saliency map. \subsection{General GNNs}\label{Section:General GNNs} GNNs have powerful capability to propagate contexts from neighbouring nodes for graph-structured data. Given a specific GNN model $\mathcal{G}=(\mathcal{V}, \mathcal{E})$, $\mathcal{V} = \{v_{1},v_{2},... ,v_{N}\}$ represents the set of nodes and $e_{i, j} \in \mathcal{E}$ represents the edge from $v_{j}$ to $v_{i}$. Each node $v_i$ has a corresponding node embedding as its inital state $h_{i}^{0}$. We use $\mathcal N_{i}$ to represent the set of neighbouring nodes of $v_i$. GNNs first aggregate contextual information from $\mathcal N_{i}$ to update the state of $v_i$ with a learned message passing function $M$, which has specific formulations in different kinds of GNNs. The general formulation of the message passing process for $v_i$ at step $k$ can be written as: \begin{equation} \label{eq:message} m_{i}^{k} = M([h_1^{k-1}, h_2^{k-1}, ...h_j^{k-1}],[e_{i,1},e_{i,2},...e_{i,j},]), \end{equation} where each $v_{j} \in \mathcal N_{i}$. After message passing, a state update function $U$ can be learned to update the state of $v_{i}$ based on the aggregated message, which can be defined as: \begin{equation} \label{eq:update} h_{i}^{k+1} = U(h_{i}^{k}, m_{i}^{k}). \end{equation} Finally, after $K$ steps updating, a readout function can be applied to $h_{i}^{K}$ to get the final output. \subsection{Feature Encoders} \label{Section:enc} For the problem of light field SOD, we have an all-focus image $I_a$ and its corresponding focal stack $I_f$ with $N$ focal slices $\{I_{f_{1}}, I_{f_{2}},...I_{f_{N}}\}$, which have different focused regions. Before defining nodes and their embeddings in the graph, we first use encoder networks to extract image features. As shown in Figure~\ref{network_overview}, $I_a$ and $I_f$ are first inputted into two unshared encoders to extract all-focus image features and focal stack features. Similar to previous works \cite{piao2020exploit, zhang2019memory}, we adopt the VGG-19 \cite{simonyan2014very} network without the last pooling layer and fully connected layers as the backbone of our encoder. We obtain high-level features from the last three convolutional stages. Then, we fuse them in an top-down manner \cite{lin2017fpn} and obtain the fused multiscale features $F_{a}\in{\mathbb{R}^{1 \times C \times H \times W}}$ and $F_{f}\in{\mathbb{R}^{N \times C \times H \times W}}$ at the $1/4$ scale, where $F_{f}=\{F_{f_{1}}, F_{f_{2}},...F_{f_{N}}\}$ represents the feature set of $N$ focal slices, $W$, $H,$ and $C$ denote the width, height, and channel number of the feature maps, respectively. \subsection{Dual Local Graph} We use graph models to fuse the focal stack features $F_{f}$ by propagating contexts within the focal slices and also under the guidance from the all-focus feature $F_{a}$. The latter can provide external guidance for the feature update of $F_{f}$. Directly constructing a densely connected graph among $F_{f}$ and $F_{a}$, which is the case in \cite{wang2019zero,zhang2020adaptive}, requires $(N+1)WH \times (N+1)WH$ edge connections. This scheme is computationally prohibitive for the message passing process when the feature maps have large spatial sizes. The reason for \cite{wang2019zero,zhang2020adaptive} to use densely connected graphs is that the target objects in video object segmentation and co-saliency detection are usually located in different spatial locations. Thus, global context is needed. However, for light field SOD, each all-focus image and its corresponding focal stack images are spatially aligned. Hence, using local context solely is enough. Therefore, in this paper we propose a novel DLG model that only constructs edge connections within local neighbouring nodes for light field SOD. We design two subgraphs, named the focal-focal graph and the focal-all graph, to propagate contextual information from focal slices to focal slices and from the all-focus image to focal slices, respectively. The whole process can be defined as: \begin{equation} \label{eq:mlg} F_f' = DLG(F_{f}, F_{a}), \end{equation} where $F_f'\in{\mathbb{R}^{N \times C \times H \times W}}$ represents the updated feature after context aggregation. \vspace{-3mm} \paragraph{Defination of the surrounding area:} Before the introduction of the proposed graph network, we first define a surrounding area of a location in a feature map. Given the pixel location $(w,h)$ in a feature map, we have a sampling window with a size of $k \times k$ and dilation $d$, centering at $(w,h)$. Then, we can view all sampled locations except the central one, \ie, the location $(w,h)$ itself, as its surrounding area, as shown as the blue dots in Figure~\ref{graph}. The surrounding area defines the context in a local region and can be used to construct local graph connections. \vspace{-3mm} \paragraph{Focal-Focal Graph:} First, we build a graph $\mathcal{G}^f_{w,h} = (\mathcal{V}^f_{w,h}, \mathcal{E}^f_{w,h})$ for each spatial location $(w,h)$ only in focal features. To ease the presentation, we omit the subscript below. Given the extracted focal stack feature map $F_{f}$, we can view it as having $N$ points from $N$ focal slices with $C$ channels for each spatial location. To be specific, for the location $(w,h)$, we have $N$ target nodes with a $C$-dimensional embedding, which can be defined as $\mathcal{V}_{T}$. In the surrounding area of $(w,h)$, we also have $N \times (k \times k - 1)$ nodes with a $C$-dimensional embedding, where we use $\mathcal{V}_{S}$ to represent the set of these nodes. Here we have $\mathcal{V}_{T} \cup \mathcal{V}_{S} = \mathcal{V}^f$. \begin{figure}[!t] \graphicspath{{figure/}} \centering \includegraphics[width=1\linewidth]{graph.pdf} \caption{Structure of the Focal-Focal Graph and the Focal-All Graph. For each spatial location $(w,h)$ in $F_f$, we have $N$ target nodes (\textcolor[RGB]{234, 112, 14}{orange}). For their corresponding surrounding area, we have $N \times (k \times k - 1)$ nodes (\textcolor[RGB]{49, 133, 156}{blue}). In $F_a$, we regard the same location $(w,h)$ and its surrounding area as the guidance context and obtain $k \times k$ nodes (\textcolor[RGB]{121, 149, 64}{green}). The connections between one target node and its neighbors in two graphs are shown on the right.} \label{graph} \vspace{-0.3cm} \end{figure} After that, we define edges to link these nodes. We follow two rules: \textbf{1)} The nodes in $\mathcal{V}_{T}$ are our modeling targets. Hence they are linked to each other, including themselves. \textbf{2)} The nodes in $\mathcal{V}_{S}$ serves as local contexts for the target nodes. Therefore, they are linked to each node in $\mathcal{V}_{T}$. Except for these edges, there are no other connections in the graph. The two kinds of edges constitute $\mathcal{E}^f$. Now, we need to define edge embeddings. For simplicity, we use $u$ and $v$ to represent a target node and one of its neighbours, respectively, \ie, $u \in \mathcal{V}_{T}$ and $v \in \mathcal{V}^f$. Their states (features) can be written as $h_u$ and $h_v$. The edge embedding $e_{u, v}^f$ represents the relation from $v$ to $u$. As the two nodes are both from the focal stack feature map, we use inner product to compute the edge embeddings as: \begin{equation} \label{eq:edge_f} e_{u, v}^f = {\theta^f (h_u)}^{\top} \phi^f (h_v), \end{equation} where $\theta^f(*)$ and $\phi^f(*)$ are two linear transformation functions with learnable parameters. They have the same output dimensions and can be implemented by fully connected layers. As a result, the computed $e_{u, v}^f $ is a scalar. \vspace{-3mm} \paragraph{Focal-All Graph:} For the target of using the all-focus feature to guide the updating of focal features, we also build a graph $\mathcal{G}^a = (\mathcal{V}^a, \mathcal{E}^a)$ for focal and all-focus image features together at each spatial location $(w,h)$. Again we omit the subscript $(w,h)$ for easy presentation. For location $(w,h)$ in $F_{f}$, we have the same target node set $\mathcal{V}_{T}$. Then, we regard the same location $(w,h)$ in $F_{a}$ and its surrounding area as the guidance context, and obtain a set of $k \times k$ nodes $\mathcal{V}_{S}'$. Here $\mathcal{V}_{T} \cup \mathcal{V}_{S}' = \mathcal{V}^a$. We connect all nodes in $\mathcal{V}_{S}'$ to each node in $\mathcal{V}_{T}$ to incorporate the guidance context for all target nodes. Here we use $u$ and $q$ to represent a target node and one of its neighbours, respectively, \ie, $u \in \mathcal{V}_{T}$ and $q \in \mathcal{V}_{S}'$. Similarly, their states are denoted by ${h}_{u}$ and $h_{q}$. Since the two nodes are from two different feature spaces, we use a linear transformation to build the edge embedding from $q$ to $u$, which can be defined as: \begin{equation} \label{eq:edge_a} e_{u, q}^a = \psi([{\theta^a (h_u)}, \phi^a (h_q)]), \end{equation} where $[,]$ denotes the concatenation operation, $\theta^a(*)$ and $\phi^a(*)$ represent two linear transformation functions. The last linear function $\psi$ projects the input to a scalar. \vspace{-3mm} \paragraph{Message passing:} After getting the embedding for each node and edge, we can define the formulation of the message passing process now. For the target node $u$, we respectively define the message passing in the Focal-Focal Graph and the Focal-All Graph as: \begin{equation} \label{eq:msg_f} m_u^f =\sum_{v \in \mathcal{V}^f} \alpha_{u,v}^f g^{f}(h_v), \end{equation} \begin{equation} \label{eq:msg_a} m_u^a =\sum_{q \in \mathcal{V}_{S}'} \alpha_{u,q}^a g^{a}(h_q), \end{equation} where $g^f(*)$ and $g^a(*)$ are two linear transformation functions in the two Graphs, and $\alpha_{*}^*$ can be computed by the Softmax normalization: \begin{equation} \alpha_{u,v}^f = \frac{exp(e_{u, v}^f)}{\sum_{j \in \mathcal{V}^f} exp(e_{u, j}^f)}, \end{equation} \begin{equation} \alpha_{u,q}^a = \frac{exp(e_{u, q}^a)}{\sum_{j \in \mathcal{V}_{S}'} exp(e_{u, j}^a)}. \end{equation} From \eqref{eq:msg_f} and \eqref{eq:msg_a}, we can aggregate the contexts and guidance from neighbour nodes by considering the relationships inferred in \eqref{eq:edge_f} and \eqref{eq:edge_a}. \vspace{-3mm} \paragraph{Node Updating:} After achieving the messages from neighbours in the two subgraphs, we can update the state of $u$ by: \begin{equation} h_u' = \varphi^f (m_u^f) + \varphi^a (m_u^a) + h_u \end{equation} where $\varphi^f(*)$ and $\varphi^a(*)$ are two linear transformation functions in the Focal-Focal Graph and the Focal-All Graph, respectively, to transform the messages to the original node embedding space. By adopting the proposed local graph model, the computational complexity of modeling the context propagation in light field images is reduced from $O(((N+1)(HW))^{2}C)$ to $O(NHWC(N+1)k^{2})$. Considering $k^2 \ll HW$, our model shows significant efficiency. \vspace{-3mm} \paragraph{Multiscale surrounding area:} With the introduced surrounding area, the proposed two graph networks can aggregate information in a local region, which can reduce computational costs dramatically. However, only using one sampling window is sensitive to scale variations. Motivated by ASPP \cite{chen2017rethinking}, we combine multiple sampling windows with different dilation rates to incorporate multiscale and larger contexts, as shown in Figure~\ref{graph}, in which we use two $3 \times 3$ sampling windows with dilation rates of 1 and 3, respectively. \subsection{Focal Stack Feature Aggregation} \label{Section:Focal Stack Feature Aggregation} After updating each node embedding $h_u'$ in the DLG model, we can obtain the final output focal stack feature $F_f'$ in \eqref{eq:mlg}. The features of different focal slices have communicated with each other and received guidance from the all-focus feature. Now we can tell useful and useless features among them and aggregate $N$ feature maps into one. First, we use a $1 \times 1$ convolutional layer to reduce the channel number of $F_f'$ from $C$ to $1$. Then, the Softmax normalization function is used along the first dimension to obtain an attention matrix $A \in{\mathbb{R}^{N \times 1 \times H \times W}}$, where the $N$-dimensional attention weights at each location encode the usefulness of each focal slice at this location. The final aggregated focal stack feature can be obtained by: \begin{equation} \label{eq:fsfa} \begin{aligned} O &= FSFA(F_f'),\\ &= \sum_{i=1}^N A^i \odot F_{f_i}', \end{aligned} \end{equation} where $O\in{\mathbb{R}^{C \times H \times W}}$, $\odot$ is the element-wise multiplication, $A^i$ and $F_{f_i}'$ mean the attention map and the feature map for the $i^{th}$ focal slice, respectively. \subsection{Reciprocative Guidance}\label{Section:Reciprocative Guidance} Although the aggregated focal stack feature $O$ can be directly fused with the all-focus feature $F_a$ for predicting the saliency map, we argue that the single-phase fusion scheme can not effectively mine complex interactions and supplements between the two kinds of features, which are crucial for light field SOD. Hence, we propose a reciprocative guidance scheme to make the two kinds of features promote each other for multiple steps. Here, to avoid confusion, we redefine the outputs from the encoders as $F_{f}^{0}=\{F_{f1}^{0}, F_{f2}^{0},...F_{fN}^{0}\}$ and $F_{a}^{0}$, where the superscripts represent the initial reciprocative step. Then, we define the proposed reciprocative guidance process as: \begin{equation} F_{f}^{t+1} = DLG(F_{f}^{t}, F_{a}^{t}), \end{equation} \begin{equation} O^{t+1} = FSFA(F^{t+1}_{f}), \end{equation} \begin{equation} \label{eq:ConvGRU} F^{t+1}_{a} = ConvGRU(O^{t+1}, F^{t}_{a}), \end{equation} where $t \in [0, T-1]$, $ConvGRU$ is the convolutional gated recurrent unit model \cite{cho2014learning}. In each step, the all-focus feature $F_{a}^{t}$ is first used to guide the feature fusion of the focal features $F_{f}^{t}$. After the graph model and the feature aggregation, the aggregated focal stack feature $O^{t+1}$ is further used to enhance $F_{a}^{t}$ for saliency detection via ConvGRU. At last, ConvGRU can effectively fuse the two kinds of features, \ie, $O^{t+1}$ and $F_{a}^{t}$, in all reciprocative steps using the memory mechanism. As the reciprocative process goes on, the two features can be improved step by step under the guidance of each other, thus benefiting the final saliency detection. On the other hand, as the reciprocative process goes on, the context propagation in the focal-focal graph can be performed multiple times, hence also enhancing the feature fusion within $F_{f}^{t}$. \subsection{Saliency Prediction and Loss Function} Since it has been proved that low-level features can benefit the recovery of object details, we also leverage the low-level all-focus feature to perform saliency map refinement after the reciprocative guidance process. Specifically, we use a skip-connection to incorporate the all-focus feature from the first stage of the encoder VGG network and sum it with the upsampled $F^{T}_{a}$. Then, we perform feature fusion at the 1/2 scale via three $ 3\times 3$ convolutional layers with ReLU activation functions. After that, another $3 \times 3$ convolutional layer with the Sigmoid activation function is used to obtain the final saliency map, as shown in Figure~\ref{network_overview}. After each reciprocative process, we can obtain an enhanced feature $F_{a}^{t}$. In order to guide our model to gradually enhance the image features, we add a $1 \times 1$ convolutional layer with a sigmoid active function on $F_{a}^{t}$ to predict a saliency map. Then we employ the binary cross-entropy loss to supervise the training of the $t$-th reciprocative step. Finally, the overall loss is the summation of each loss at each step. \section{Experiments} \subsection{Datasets} Our experiments are conducted on three public light field benchmark datasets: LFSD \cite{li2014saliency}, HFUT \cite{zhang2017saliency}, and DUTLF-FS \cite{wang2019dlsd}. DUTLF-FS is the largest dataset that contains 1462 light field images and is split into 1000 and 462 images for training and testing, respectively. HFUT and LFSD are relatively small, containing only 255 and 100 samples, respectively. Each sample includes an all-focus image, several focal slices, and the corresponding ground-truth saliency map. \subsection{Evaluation Metrics} We follow many previous works to adopt the maximum F-measure ($F_{\beta}$) \cite{achanta2009frequency}, S-measure ($S_{\alpha}$) \cite{fan2017structure}, the maximum E-measure ($E_{\phi}$) \cite{fan2018enhanced}, and the Mean Absolute Error (MAE) to evaluate the performance of different models in a comprehensive way. \begin{table*}[t!] \centering \scriptsize \renewcommand{\arraystretch}{1.2} \renewcommand{\tabcolsep}{1.8mm} \caption{Benchmarking results. $\uparrow \& \downarrow$ denote larger and smaller is better, respectively. The best scores in each group are indicated in \blu{blue}, and the best scores in all groups are indicated in \red{red}. * means we do not compare with this model due to incompatible training/test split.} \begin{tabular}{lrc|cccc|cccc|cccc} \hline & & &\multicolumn{4}{c|}{HFUT \cite{zhang2017saliency}} &\multicolumn{4}{c|}{DUTLF-FS \cite{wang2019dlsd}} &\multicolumn{4}{c}{LFSD \cite{li2014saliency}} \\ & Methods & Years & $S_{\alpha}\uparrow$ & $F_{\beta}\uparrow$ & $E_{\phi}\uparrow$ & $MAE\downarrow$ & $S_{\alpha}\uparrow$ & $F_{\beta}\uparrow$ & $E_{\phi}\uparrow$ & $MAE\downarrow$ & $S_{\alpha}\uparrow$ & $F_{\beta}\uparrow$ & $E_{\phi}\uparrow$ & $MAE\downarrow$\\ \hline \multirow{8}{*}{\textit{Light Field}} & Ours & - & 0.766 & 0.697 & 0.839 & \red{0.071} & \red{0.928} & \red{0.936} & \red{0.959} & \red{0.031} & \red{0.867} & \red{0.870} & \red{0.906} & \blu{0.069} \\ & ERNet \cite{piao2020exploit} & 2020 & \blu{0.778} & \blu{0.722} & \blu{0.841} & 0.082 & 0.899 & 0.908 & 0.949 & 0.039 & 0.832 & 0.850 & 0.886 & 0.082 \\ & MAC \cite{zhang2020light} & 2020 & 0.731 & 0.667 & 0.797 & 0.107 & 0.804 & 0.792 & 0.863 & 0.102 & 0.782 & 0.776 & 0.832 & 0.127 \\ & MoLF \cite{zhang2019memory} & 2019 & 0.742 & 0.662 & 0.812 & 0.094 & 0.887 & 0.903 & 0.939 & 0.051 & 0.835 & 0.834 & 0.888 & 0.089 \\ & DLSD \cite{piao2019deep} & 2019 & 0.711 & 0.624 & 0.784 & 0.111 & * & * & * & * & 0.786 & 0.784 & 0.859 & 0.117 \\ & LFS \cite{li2017saliency} & 2017 & 0.565 & 0.427 & 0.637 & 0.221 & 0.585 & 0.533 & 0.711 & 0.227 & 0.681 & 0.744 & 0.809 & 0.205 \\ & WSC \cite{li2015weighted} & 2015 & 0.613 & 0.508 & 0.695 & 0.154 & 0.657 & 0.621 & 0.789 & 0.149 & 0.700 & 0.743 & 0.787 & 0.151 \\ & DILF \cite{zhang2015saliency} & 2015 & 0.675 & 0.595 & 0.750 & 0.144 & 0.654 & 0.585 & 0.757 & 0.165 & 0.811 & 0.811 & 0.861 & 0.136 \\\hline \multirow{6}{*}{\textit{RGB-D}} & BBS \cite{fan2020bbs} & 2020 & 0.751 & 0.676 & 0.801 & \blu{0.073} & 0.865 & 0.852 & 0.900 & 0.066 & \blu{0.864} & 0.858 & 0.900 & 0.072\\ & SSF \cite{zhang2020select} &2020 & 0.725 & 0.647 &0.816 & 0.090 & 0.879 & 0.887 & 0.922 & 0.050 & 0.859 & \blu{0.868} & 0.901 & \red{0.067} \\ & S2MA \cite{liu2020learning} & 2020 & 0.729 & 0.650 & 0.777 & 0.112 & 0.787 & 0.754 & 0.839 & 0.102 & 0.837 & 0.835 & 0.873 & 0.094\\ & ATSA \cite{zhang2020asymmetric} & 2020 & 0.772 & \blu{0.729} & 0.833 & 0.084 & \blu{0.901} & \blu{0.915} & \blu{0.941} & \blu{0.041} & 0.858 & 0.866 & \blu{0.902} & 0.068 \\ & JLDCF \cite{fu2020jl} & 2020 & \blu{0.789} & 0.727 & \red{0.844} & 0.075 & 0.877 & 0.878 & 0.925 & 0.058 & 0.862 & 0.867 & \blu{0.902} & 0.070\\ & UCNet \cite{zhang2020uc} & 2020 & 0.748 & 0.677 & 0.804 & 0.090 & 0.831 & 0.816 & 0.876 & 0.081 & 0.858 & 0.859 & 0.898 &0.072 \\ \hline \multirow{6}{*}{\textit{RGB}} & LDF \cite{wei2020label} & 2020 & 0.780 & 0.708 & 0.804 & 0.093 & 0.873 & 0.861 & 0.898 & 0.061 & 0.821 & 0.803 & 0.843 & 0.096 \\ & ITSD \cite{zhou2020interactive} & 2020 & \red{0.805} & \red{0.759} & \blu{0.839} & 0.089 & \blu{0.899} & \blu{0.899} & \blu{0.930} & 0.052 & 0.847 & 0.840 & 0.879 & 0.088\\ & MINet \cite{pang2020multi} & 2020 & 0.792 & 0.720 & 0.816 & \blu{0.086} & 0.890 & 0.882 & 0.916 &\blu{0.050} & 0.834 & 0.828 & 0.861 & 0.091\\ & EGNet \cite{zhao2019egnet} & 2019 & 0.769 & 0.676 & 0.796 & 0.092 & 0.886 & 0.868 & 0.910 & 0.053 & 0.843 & 0.821 & 0.872 & 0.083 \\ & PoolNet \cite{liu2019simple} & 2019 & 0.769 & 0.676 & 0.794 & 0.091 & 0.883 & 0.859 & 0.911 & 0.051 & \blu{0.858} & \blu{0.848} & \blu{0.894} & \blu{0.074}\\ & PiCANet \cite{liu2018picanet} & 2018 & 0.783 & 0.715 & 0.816 & 0.107 & 0.876 & 0.865 & 0.907 & 0.072 & 0.832 & 0.834 & 0.866 & 0.103 \\ \hline \end{tabular} \label{tab:Performance_Comparison} \vspace{-0.2cm} \end{table*} \begin{figure*}[!t] \graphicspath{{figure/}} \centering \includegraphics[width=1\linewidth]{SOTA.pdf} \caption{Visual comparison of the saliency maps between our model and state-of-the-art methods.} \label{fig:quali_cmp} \vspace{-0.4cm} \end{figure*} \subsection{Implementation Details} We design two sampling windows with size $k=3$ and dilation rates $d=1,3$ in DLG, and set the reciprocative step number $T$ as 5 based on experiments. For a fair comparison, we use the same training set with \cite{piao2020exploit}, which includes the training set of DUTLF-FS and 100 samples selected from HFUT. We also augment the training data with random flipping, cropping, and rotation. We use Adam \cite{kingma2014adam} as the optimization algorithm and set the learning rate to 1e-4. The minibatch size is set to 1 and our network is trained for 200,000 steps. The learning rate is multiplied by 0.1 at the 150,000 and 180,000 steps, respectively. In both training and testing, we resize images to $256 \times 256$ for easy implementation. The proposed method is implemented using the Pytorch toolbox \cite{paszke2017automatic} and all experiments are conducted on one RTX 2080Ti GPU. The inference time of our model averaged on all three datasets is only 0.07s per image. Our code is publicly available at: \url{https://github.com/wangbo-zhao/2021ICCV-DLGLRG}. \subsection{Comparison with State-of-the-art Methods} \paragraph{Quantitative Comparison:} For comprehensive comparisons, we compare our method with 19 state-of-the-art models, including six RGB SOD methods: LDF \cite{wei2020label}, ITSD \cite{zhou2020interactive}, MINet \cite{pang2020multi}, EGNet \cite{zhao2019egnet}, PoolNet \cite{liu2019simple} and PiCANet \cite{liu2018picanet}, six RGB-D SOD models: BBS \cite{fan2020bbs}, SSF \cite{zhang2020select}, S2MA \cite{liu2020learning}, ATSA \cite{zhang2020asymmetric}, JLDCF \cite{fu2020jl} and UCNet \cite{zhang2020uc}, and seven light field SOD methods: ERNet \cite{piao2020exploit}, MAC \cite{zhang2020light}, MoLF \cite{zhang2019memory}, DLSD \cite{piao2019deep}, LFS \cite{li2017saliency}, WSC \cite{li2015weighted}, and DILF \cite{zhang2015saliency}. As shown in Table~\ref{tab:Performance_Comparison}, our method can achieve the best performance on DUTLF-FS and LFSD compared with all RGB, RBG-D, and light field methods. When it comes to the HFUT, our method can surpass other methods in terms of $MAE$, but performs worse in terms of the other three metrics. We argue that this is because many images in HFUT have uncommon SOD annotations, such as numbers and texts, which are rarely related to focus information. Thus, our model is not good at handling them. It is noteworthy that on DUTLF-FS and LFSD, our method significantly outperforms ERNet \cite{piao2020exploit}, MoLF \cite{zhang2019memory} and DLSD \cite{piao2019deep}, which all use ConvLSTM models. This result demonstrates the superiority of our proposed reciprocative scheme. We also note that with only 1100 training samples, our method can achieve better performance on DUTLF-FS and LFSD than most deep RGB-D and RGB SOD methods, which are usually trained on much more images. This indicates that our method can effectively explore the information conveyed in light field data. \vspace{-0.7cm} \paragraph{Qualitative Comparison:} In Figure~\ref{fig:quali_cmp}, we visualize some representative saliency map comparison cases. We can find that, compared with other SOTA methods, our model can not only more accurately localize salient objects, but also more precisely recover object details. \subsection{Ablation Study} In this section, we conduct ablation experiments on the largest DUTLF-FS dataset to thoroughly analyze our proposed model. \begin{table}[] \centering \footnotesize \caption{Quantitative results of using different feature fusion strategies. ``Enc" means our feature encoders in Section~\ref{Section:enc}, ``R" denotes our proposed reciprocative guidance scheme, and ``r" means using the low-level all-focus feature to refine the saliency map. \blu{Blue} indicates the best performance.} \begin{tabular}{l|l|cccc} \hline \multicolumn{2}{l|}{\multirow{2}{*}{Settings}} & \multicolumn{4}{c}{DUTLF-FS} \\ \multicolumn{2}{l|}{} & \multicolumn{1}{l}{$S_{\alpha}\uparrow$} & \multicolumn{1}{l}{$F_{\beta}\uparrow$} & \multicolumn{1}{l}{$E_{\phi}\uparrow$} & \multicolumn{1}{l}{MAE $\downarrow$} \\ \hline \multicolumn{2}{l|}{Enc-concat} & 0.891 & 0.898 & 0.934 & 0.062 \\ \multicolumn{2}{l|}{Enc-lstm} & 0.900 & 0.909 & 0.940 & 0.047 \\ \hline \multicolumn{2}{l|}{Enc-DLG} & 0.907 & 0.911 & 0.944 & 0.044 \\ \multicolumn{2}{l|}{Enc-DLG-R} & 0.923 & 0.932 & 0.957 & 0.035 \\ \multicolumn{2}{l|}{Enc-DLG-R-r} & \blu{0.928} & \blu{0.936} & \blu{0.959} & \blu{0.031} \\ \hline \end{tabular} \label{tab:main_ablation} \vspace{-0.6cm} \end{table} \noindent\textbf{Effectiveness of Different Model Components.} We first verify the effectiveness of our different model components in Table~\ref{tab:main_ablation}. For fair comparisons, we keep our feature encoders in Section~\ref{Section:enc} unchanged and try different decoder architectures to fuse the focal stack feature $F_f$ and the all-focus feature $F_a$. We first report the results of two baseline models of fusing $F_f$ and $F_a$ using naive concatenation and LSTM, respectively. For the first one, we follow many previous methods to randomly replicate focal slices in each focal stack to 12 images, then $F_{f}\in{\mathbb{R}^{12 \times C \times H \times W}}$. Next, we concatenate $F_f$ with $F_a$ and use convolution to fuse these 13 feature maps. We denote this strategy as ``Enc-concat". For the second one, we use a ConvLSTM to directly fuse the $N+1$ feature maps in $F_f$ and $F_a$, which is denoted as ``Enc-lstm". We find that using LSTM performs better for fusing the two kinds of features. Next, we progressively adopt our proposed DLG model, the reciprocative guidance scheme, and the refinement decoder using the low-level all-focus feature. These three models are denoted as ``Enc-DLG", ``Enc-DLG-R", and ``Enc-DLG-R-r", respectively. From Table~\ref{tab:main_ablation}, we can see that the three models can progressively improve the light field SOD performance, finally outperforming the two baseline models by a large margin. Using the DLG model achieves better results than using naive concatenation and LSTM, and also avoids their ill-posed implementation problem. We also try to use a densely connected graph network to fuse the $N+1$ feature maps, but only to obtain the out of memory error. This result proves the efficiency of our DLG model. Furthermore, we find that the reciprocative guidance scheme brings the largest model improvement, clearly demonstrating its powerful capacity. We believe this strategy can also benefit future light field SOD research a lot. We also show the comparison of the feature maps and saliency maps with and without using the DLG model in Figure~\ref{ablation:DLG}. We can see that by using DLG, the feature maps can filter out distractions in backgrounds and focus more on the salient objects, hence resulting in better SOD results. \begin{figure}[!t] \graphicspath{{figure/}} \centering \includegraphics[width=1\linewidth]{DLG.pdf} \caption{Comparison of models with and without using the proposed DLG model in terms of both feature maps and saliency maps. (a): Images. (b): Feature maps w/o using DLG. (c): Feature maps w using DLG. (d): Saliency maps w/o using DLG. (e): Saliency maps w using DLG.} \label{ablation:DLG} \vspace{-0.4cm} \end{figure} \noindent\textbf{DLG Settings.} Since we build multiscale local neighbours in DLG to introduce larger contexts with acceptable computational costs, we also explore different multiscale settings in DLG in Table~\ref{tab:dlg_ablation}. Specifically, we test different settings of the sampling window size $k$ and the dilation rates $d$ in the ``Enc-DLG-R" model. We start from the naive setting with $1\times 1$ sampling window. From Table~\ref{tab:dlg_ablation}, we can find that, when we use more and larger windows, the performance of our model can be gradually improved. However, the performance is saturated when using two $3\times 3$ sampling windows with dilation rates of 1 and 3. Further using one more window with $d=5$ only brings little improvement. Considering the computational costs, we choose $k=3$ and $d=1,3$ as our final setting. To verify the effectiveness of simultaneously using the focal-focal graph $\mathcal{G}^f$ and the focal-all graph $\mathcal{G}^a$, we try to use them separately and report the results in the last two rows in Table~\ref{tab:dlg_ablation}. We find that using them separately will degrade the model performance, hence verifying the necessity of our proposed dual graph scheme. \noindent\textbf{Reciprocative Steps.} We conduct experiments to choose the optimal reciprocative step number $T$ in Table~\ref{tab:reci_ablation}. Note that, when $T=1$, the model downgrades to the ``Enc-DLG" model. We find that, as we increase $T$ from 1 to 5, the performance can be improved progressively. When $T>5$, we observe that the performance has been saturated and the model will exceed the GPU memory. Hence, we take $T=5$ as the final setting for our reciprocative guidance scheme. We also visualize two representative samples to show the improvements of the saliency maps obtained at different reciprocative steps in Figure~\ref{ablation:reciprocative}. We can find that, along with the reciprocative guidance learning, false-positive highlights can be gradually suppressed and the SOD results can be steadily improved. \begin{table}[] \centering \footnotesize \caption{Comparison of using different DLG Settings.} \begin{tabular}{l|l|l|l|cccc} \hline \multicolumn{4}{c|}{Settings} & \multicolumn{4}{c}{DUTLF-FS} \\ \hline $k$ & $d$ & $\mathcal{G}^f$ & $\mathcal{G}^a$ & \multicolumn{1}{l}{$S_{\alpha}\uparrow$} & \multicolumn{1}{l}{$F_{\beta}\uparrow$} & \multicolumn{1}{l}{$E_{\phi}\uparrow$} & \multicolumn{1}{l}{MAE $\downarrow$} \\ \hline 1 & 1 & \ding{51} & \ding{51} & 0.914 & 0.919 & 0.946 & 0.042 \\ 3 & 1 & \ding{51} & \ding{51} & 0.915 & 0.919 & 0.950 & 0.038 \\ 3 & 1,3 & \ding{51} & \ding{51} & 0.923 & 0.932 & 0.957 & \blu{0.035} \\ 3 & 1,3,5 & \ding{51} & \ding{51} & \blu{0.924} & \blu{0.933} & \blu{0.960} & \blu{0.035} \\ \hline 3 & 1,3 & \ding{51} & \ding{55} & 0.917 & 0.929 & 0.953 & 0.038 \\ 3 & 1,3 & \ding{55} & \ding{51} & 0.919 & 0.927 & 0.952 & 0.037 \\ \hline \end{tabular} \label{tab:dlg_ablation} \vspace{-0.2cm} \end{table} \begin{table}[] \centering \footnotesize \caption{Comparison of using different reciprocative step numbers.} \begin{tabular}{l|cccc} \hline \multirow{2}{*}{$T$} & \multicolumn{4}{c}{DUTLF-FS} \\ & \multicolumn{1}{l}{$S_{\alpha}\uparrow$} & \multicolumn{1}{l}{$F_{\beta}\uparrow$} & \multicolumn{1}{l}{$E_{\phi}\uparrow$} & \multicolumn{1}{l}{MAE $\downarrow$} \\ \hline 1 & 0.907 & 0.911 & 0.944 & 0.044 \\ 3 & 0.917 & 0.924 & 0.952 & 0.040 \\ 5 & \blu{0.923} & \blu{0.932} & \blu{0.957} & \blu{0.035} \\ \hline \end{tabular} \label{tab:reci_ablation} \vspace{-0.2cm} \end{table} \begin{figure}[!t] \graphicspath{{figure/}} \centering \includegraphics[width=1\linewidth]{T_visualize.pdf} \caption{Visualization of the saliency maps at different reciprocative steps.} \label{ablation:reciprocative} \vspace{-0.6cm} \end{figure} \section{Conclusion} In this paper, we propose a novel dual local graph neural network and a reciprocative guidance architecture for light field SOD. Our DLG model efficiently aggregates contexts in focal stack images under the guidance of the all-focus image. The reciprocative guidance scheme introduces iterative guidance between the two kinds of features, making them promote each other at multiple steps. Experimental results show that our method achieves superior performance over state-of-the-art RGB, RGB-D, and light field based SOD methods on most datasets. \vspace{-4mm} \paragraph{Acknowledgments:} This work was supported in part by the National Key R\&D Program of China under Grant 2020AAA0105701, the National Science Foundation of China under Grant 62027813, 62036005, U20B2065, U20B2068. {\small \bibliographystyle{ieee_fullname} \section{Introduction} Please follow the steps outlined below when submitting your manuscript to the IEEE Computer Society Press. This style guide now has several important modifications (for example, you are no longer warned against the use of sticky tape to attach your artwork to the paper), so all authors should read this new version. \subsection{Language} All manuscripts must be in English. \subsection{Dual submission} Please refer to the author guidelines on the ICCV 2021 web page for a discussion of the policy on dual submissions. \subsection{Paper length} Papers, excluding the references section, must be no longer than eight pages in length. The references section will not be included in the page count, and there is no limit on the length of the references section. For example, a paper of eight pages with two pages of references would have a total length of 10 pages. {\bf There will be no extra page charges for ICCV 2021.} Overlength papers will simply not be reviewed. This includes papers where the margins and formatting are deemed to have been significantly altered from those laid down by this style guide. Note that this \LaTeX\ guide already sets figure captions and references in a smaller font. The reason such papers will not be reviewed is that there is no provision for supervised revisions of manuscripts. The reviewing process cannot determine the suitability of the paper for presentation in eight pages if it is reviewed in eleven. \subsection{The ruler} The \LaTeX\ style defines a printed ruler which should be present in the version submitted for review. The ruler is provided in order that reviewers may comment on particular lines in the paper without circumlocution. If you are preparing a document using a non-\LaTeX\ document preparation system, please arrange for an equivalent ruler to appear on the final output pages. The presence or absence of the ruler should not change the appearance of any other content on the page. The camera ready copy should not contain a ruler. (\LaTeX\ users may uncomment the \verb'\iccvfinalcopy' command in the document preamble.) Reviewers: note that the ruler measurements do not align well with lines in the paper --- this turns out to be very difficult to do well when the paper contains many figures and equations, and, when done, looks ugly. Just use fractional references (e.g.\ this line is $095.5$), although in most cases one would expect that the approximate location will be adequate. \subsection{Mathematics} Please number all of your sections and displayed equations. It is important for readers to be able to refer to any particular equation. Just because you didn't refer to it in the text doesn't mean some future reader might not need to refer to it. It is cumbersome to have to use circumlocutions like ``the equation second from the top of page 3 column 1''. (Note that the ruler will not be present in the final copy, so is not an alternative to equation numbers). All authors will benefit from reading Mermin's description of how to write mathematics: \url{http://www.pamitc.org/documents/mermin.pdf}. \subsection{Blind review} Many authors misunderstand the concept of anonymizing for blind review. Blind review does not mean that one must remove citations to one's own work---in fact it is often impossible to review a paper unless the previous citations are known and available. Blind review means that you do not use the words ``my'' or ``our'' when citing previous work. That is all. (But see below for tech reports.) Saying ``this builds on the work of Lucy Smith [1]'' does not say that you are Lucy Smith; it says that you are building on her work. If you are Smith and Jones, do not say ``as we show in [7]'', say ``as Smith and Jones show in [7]'' and at the end of the paper, include reference 7 as you would any other cited work. An example of a bad paper just asking to be rejected: \begin{quote} \begin{center} An analysis of the frobnicatable foo filter. \end{center} In this paper we present a performance analysis of our previous paper [1], and show it to be inferior to all previously known methods. Why the previous paper was accepted without this analysis is beyond me. [1] Removed for blind review \end{quote} An example of an acceptable paper: \begin{quote} \begin{center} An analysis of the frobnicatable foo filter. \end{center} In this paper we present a performance analysis of the paper of Smith \etal [1], and show it to be inferior to all previously known methods. Why the previous paper was accepted without this analysis is beyond me. [1] Smith, L and Jones, C. ``The frobnicatable foo filter, a fundamental contribution to human knowledge''. Nature 381(12), 1-213. \end{quote} If you are making a submission to another conference at the same time, which covers similar or overlapping material, you may need to refer to that submission in order to explain the differences, just as you would if you had previously published related work. In such cases, include the anonymized parallel submission~\cite{Authors14} as additional material and cite it as \begin{quote} [1] Authors. ``The frobnicatable foo filter'', F\&G 2014 Submission ID 324, Supplied as additional material {\tt fg324.pdf}. \end{quote} Finally, you may feel you need to tell the reader that more details can be found elsewhere, and refer them to a technical report. For conference submissions, the paper must stand on its own, and not {\em require} the reviewer to go to a tech report for further details. Thus, you may say in the body of the paper ``further details may be found in~\cite{Authors14b}''. Then submit the tech report as additional material. Again, you may not assume the reviewers will read this material. Sometimes your paper is about a problem which you tested using a tool which is widely known to be restricted to a single institution. For example, let's say it's 1969, you have solved a key problem on the Apollo lander, and you believe that the ICCV70 audience would like to hear about your solution. The work is a development of your celebrated 1968 paper entitled ``Zero-g frobnication: How being the only people in the world with access to the Apollo lander source code makes us a wow at parties'', by Zeus \etal. You can handle this paper like any other. Don't write ``We show how to improve our previous work [Anonymous, 1968]. This time we tested the algorithm on a lunar lander [name of lander removed for blind review]''. That would be silly, and would immediately identify the authors. Instead write the following: \begin{quotation} \noindent We describe a system for zero-g frobnication. This system is new because it handles the following cases: A, B. Previous systems [Zeus et al. 1968] didn't handle case B properly. Ours handles it by including a foo term in the bar integral. ... The proposed system was integrated with the Apollo lunar lander, and went all the way to the moon, don't you know. It displayed the following behaviours which show how well we solved cases A and B: ... \end{quotation} As you can see, the above text follows standard scientific convention, reads better than the first version, and does not explicitly name you as the authors. A reviewer might think it likely that the new paper was written by Zeus \etal, but cannot make any decision based on that guess. He or she would have to be sure that no other authors could have been contracted to solve problem B. \medskip \noindent FAQ\medskip\\ {\bf Q:} Are acknowledgements OK?\\ {\bf A:} No. Leave them for the final copy.\medskip\\ {\bf Q:} How do I cite my results reported in open challenges? {\bf A:} To conform with the double blind review policy, you can report results of other challenge participants together with your results in your paper. For your results, however, you should not identify yourself and should not mention your participation in the challenge. Instead present your results referring to the method proposed in your paper and draw conclusions based on the experimental comparison to other results.\medskip\\ \begin{figure}[t] \begin{center} \fbox{\rule{0pt}{2in} \rule{0.9\linewidth}{0pt}} \end{center} \caption{Example of caption. It is set in Roman so that mathematics (always set in Roman: $B \sin A = A \sin B$) may be included without an ugly clash.} \label{fig:long} \label{fig:onecol} \end{figure} \subsection{Miscellaneous} \noindent Compare the following:\\ \begin{tabular}{ll} \verb'$conf_a$' & $conf_a$ \\ \verb'$\mathit{conf}_a$' & $\mathit{conf}_a$ \end{tabular}\\ See The \TeX book, p165. The space after \eg, meaning ``for example'', should not be a sentence-ending space. So \eg is correct, {\em e.g.} is not. The provided \verb'\eg' macro takes care of this. When citing a multi-author paper, you may save space by using ``et alia'', shortened to ``\etal'' (not ``{\em et.\ al.}'' as ``{\em et}'' is a complete word.) However, use it only when there are three or more authors. Thus, the following is correct: `` Frobnication has been trendy lately. It was introduced by Alpher~\cite{Alpher02}, and subsequently developed by Alpher and Fotheringham-Smythe~\cite{Alpher03}, and Alpher \etal~\cite{Alpher04}.'' This is incorrect: ``... subsequently developed by Alpher \etal~\cite{Alpher03} ...'' because reference~\cite{Alpher03} has just two authors. If you use the \verb'\etal' macro provided, then you need not worry about double periods when used at the end of a sentence as in Alpher \etal. For this citation style, keep multiple citations in numerical (not chronological) order, so prefer \cite{Alpher03,Alpher02,Authors14} to \cite{Alpher02,Alpher03,Authors14}. \begin{figure*} \begin{center} \fbox{\rule{0pt}{2in} \rule{.9\linewidth}{0pt}} \end{center} \caption{Example of a short caption, which should be centered.} \label{fig:short} \end{figure*} \section{Formatting your paper} All text must be in a two-column format. The total allowable width of the text area is $6\frac78$ inches (17.5 cm) wide by $8\frac78$ inches (22.54 cm) high. Columns are to be $3\frac14$ inches (8.25 cm) wide, with a $\frac{5}{16}$ inch (0.8 cm) space between them. The main title (on the first page) should begin 1.0 inch (2.54 cm) from the top edge of the page. The second and following pages should begin 1.0 inch (2.54 cm) from the top edge. On all pages, the bottom margin should be 1-1/8 inches (2.86 cm) from the bottom edge of the page for $8.5 \times 11$-inch paper; for A4 paper, approximately 1-5/8 inches (4.13 cm) from the bottom edge of the page. \subsection{Margins and page numbering} All printed material, including text, illustrations, and charts, must be kept within a print area 6-7/8 inches (17.5 cm) wide by 8-7/8 inches (22.54 cm) high. Page numbers should be included for review submissions but not for the final paper. Review submissions papers should have page numbers in the footer with numbers centered and .75 inches (1.905 cm) from the bottom of the page and start on the first page with the number 1. Page numbers will be added by the publisher to all camera-ready papers prior to including them in the proceedings and before submitting the papers to IEEE Xplore. As such, your camera-ready submission should not include any page numbers. Page numbers should automatically be removed by uncommenting (if it's not already) the line \begin{verbatim} \end{verbatim} near the beginning of the .tex file. \subsection{Type-style and fonts} Wherever Times is specified, Times Roman may also be used. If neither is available on your word processor, please use the font closest in appearance to Times to which you have access. MAIN TITLE. Center the title 1-3/8 inches (3.49 cm) from the top edge of the first page. The title should be in Times 14-point, boldface type. Capitalize the first letter of nouns, pronouns, verbs, adjectives, and adverbs; do not capitalize articles, coordinate conjunctions, or prepositions (unless the title begins with such a word). Leave two blank lines after the title. AUTHOR NAME(s) and AFFILIATION(s) are to be centered beneath the title and printed in Times 12-point, non-boldface type. This information is to be followed by two blank lines. The ABSTRACT and MAIN TEXT are to be in a two-column format. MAIN TEXT. Type main text in 10-point Times, single-spaced. Do NOT use double-spacing. All paragraphs should be indented 1 pica (approx. 1/6 inch or 0.422 cm). Make sure your text is fully justified---that is, flush left and flush right. Please do not place any additional blank lines between paragraphs. Figure and table captions should be 9-point Roman type as in Figures~\ref{fig:onecol} and~\ref{fig:short}. Short captions should be centered. \noindent Callouts should be 9-point Helvetica, non-boldface type. Initially capitalize only the first word of section titles and first-, second-, and third-order headings. FIRST-ORDER HEADINGS. (For example, {\large \bf 1. Introduction}) should be Times 12-point boldface, initially capitalized, flush left, with one blank line before, and one blank line after. SECOND-ORDER HEADINGS. (For example, { \bf 1.1. Database elements}) should be Times 11-point boldface, initially capitalized, flush left, with one blank line before, and one after. If you require a third-order heading (we discourage it), use 10-point Times, boldface, initially capitalized, flush left, preceded by one blank line, followed by a period and your text on the same line. \subsection{Footnotes} Please use footnotes\footnote {This is what a footnote looks like. It often distracts the reader from the main flow of the argument.} sparingly. Indeed, try to avoid footnotes altogether and include necessary peripheral observations in the text (within parentheses, if you prefer, as in this sentence). If you wish to use a footnote, place it at the bottom of the column on the page on which it is referenced. Use Times 8-point type, single-spaced. \subsection{References} List and number all bibliographical references in 9-point Times, single-spaced, at the end of your paper. When referenced in the text, enclose the citation number in square brackets, for example~\cite{Authors14}. Where appropriate, include the name(s) of editors of referenced books. \begin{table} \begin{center} \begin{tabular}{|l|c|} \hline Method & Frobnability \\ \hline\hline Theirs & Frumpy \\ Yours & Frobbly \\ Ours & Makes one's heart Frob\\ \hline \end{tabular} \end{center} \caption{Results. Ours is better.} \end{table} \subsection{Illustrations, graphs, and photographs} All graphics should be centered. Please ensure that any point you wish to make is resolvable in a printed copy of the paper. Resize fonts in figures to match the font in the body text, and choose line widths which render effectively in print. Many readers (and reviewers), even of an electronic copy, will choose to print your paper in order to read it. You cannot insist that they do otherwise, and therefore must not assume that they can zoom in to see tiny details on a graphic. When placing figures in \LaTeX, it's almost always best to use \verb+\includegraphics+, and to specify the figure width as a multiple of the line width as in the example below {\small\begin{verbatim} \usepackage[dvips]{graphicx} ... \includegraphics[width=0.8\linewidth] {myfile.eps} \end{verbatim} } \subsection{Color} Please refer to the author guidelines on the ICCV 2021 web page for a discussion of the use of color in your document. \section{Final copy} You must include your signed IEEE copyright release form when you submit your finished paper. We MUST have this form before your paper can be published in the proceedings. {\small \bibliographystyle{ieee_fullname}
\section{Introduction} The equation of state (EoS) for Quantum Chromodynamics (QCD) plays a crucial role in the search for a proposed critical endpoint in the QCD phase diagram. The EoS is needed as input in the hydrodynamic simulations that describe the system created during HICs \cite{Dexheimer:2020zzs,Monnai:2021kgu}. The determination of the QCD equation of state and phase diagram at finite density from first principles is currently limited, due to the Fermi sign problem. To support the RHIC experimental effort, theoretical predictions on the location of the critical point \cite{Critelli:2017oub,Bazavov:2017dus,DElia:2016jqh,Pasztor:2018yae,Fodor:2004nz,Fischer:2012vc,Borsanyi:2020fev, Fu:2019hdw} and its effect on observables \cite{An:2020vri,Mroczek:2020rpm,Bluhm:2020mpc} have recently been developed and explored. Along those lines, a family of equations of state, which agree with the one from lattice QCD in the density regime where it is available,as well as including a critical point in the 3D Ising model universality class (the one expected for QCD) has been developed within the framework of the BEST collaboration \cite{Parotto:2018pwx,Karthein:2021nxe}. This approach provides an EoS in a region of the phase diagram relevant for Beam Energy Scan physics. Furthermore, the location of the critical point and the strength of the critical region can be chosen by the user. This approach can thus be constrained through comparisons with the experimental data from Beam Energy Scan II. This EoS has already been in use for the study of out-of-equilibrium approaches to the QCD critical point \cite{Dore:2020jye,Hama:2020nfp}, the sign of the kurtosis \cite{Mroczek:2020rpm}, and to calculate transport coefficients \cite{McLaughlin:2021dph}. \section{Methodology} \label{method} In order to study the effect of a critical point on QCD thermodynamics, we utilized the principle of universality classes to map the critical behavior onto the phase diagram of QCD. The 3D Ising model is the correct choice for this approach because it exhibits the same scaling features in the vicinity of a critical point as QCD, which is to say that they belong to the same universality class \cite{Pisarski:1983ms,Rajagopal:1992qz}. We implemented the non-universal mapping of the 3D Ising model onto the QCD phase diagram in such a way that the final pressure agrees with Lattice QCD results on the EoS where they are available. This prescription can be summarized as follows: \begin{enumerate} \item Parametrize the 3D Ising model in the vicinity of the critical point, as previously done in the literature \cite{Guida:1996ep, Nonaka:2004pg, Stephanov:2011pb, Parotto:2018pwx}, \begin{equation} \label{IsingEoS} \begin{split} M &= M_0 R^{\beta} \theta \\ h &= h_0 R^{\beta \delta} \tilde{h}(\theta) \\ r &= R(1- \theta^2) \end{split} \end{equation} where the magnetization $M$, the magnetic field $h$, and the reduced temperature $r$, are functions of the external parameters $R$ and $\theta$. The normalization constants for the magnetization and magnetic field are $M_0=0.605$ and $h_0=0.364$, respectively, $\beta=0.326$ and $\delta=4.8$ are critical exponents in the 3D Ising Model, and $\tilde{h}(\theta)=\theta (1-0.76201\theta^2+0.00804\theta^4$). This renormalization group approach leads to the following definition of the singular part of the Gibbs' free energy, from which one can get the pressure via a sign change: % \begin{equation} \label{GFreeEner} \begin{split} P_{\text{Ising}} &= - G(R,\theta) \\ &= h_0 M_0 R^{2 - \alpha}(\theta \tilde{h}(\theta) - g(\theta)), \end{split} \end{equation} % where $\tilde{h}(\theta)$ is defined above and $g(\theta)$ is a polynomial in $\theta$, the full form of which can be found in \cite{Parotto:2018pwx,Karthein:2021nxe}. \item Map the critical point onto the QCD phase diagram via a linear map from \{$T$, $\mu_B$\} to \{$r,h$\} at a location $\{T_c,\mu_{B,c}\}$: \begin{equation} \label{mapT} \frac{T-T_c}{T_c}=\omega(\rho r \sin{\alpha_1} + h \sin{\alpha_2}) \end{equation} \begin{equation} \label{mapmuB} \frac{\mu_B-\mu_{B,c}}{T_c} = \omega(-\rho r \cos{\alpha_1} - h \cos{\alpha_2}) \end{equation} where $\alpha_1$ and $\alpha_2$ are the angles between the axes of the QCD phase diagram and the Ising model ones and $\omega$ and $\rho$ are scaling parameters for the Ising-to-QCD map. \item Reduce the number of free parameters in the non-universal mapping from six to four, by placing the critical point along the chiral phase transition line, such that the $r$ axis of the Ising model is tangent to the transition line of QCD at the critical point: % \begin{equation} \label{chiraltrans} T=T_0 + \kappa \, T_0 \, \left(\frac{\mu_B}{T_0}\right)^2 + \mathcal{O}(\mu_B^4). \end{equation} % The choice we made for the critical point here was \{$T_c$=143.2 MeV, $\mu_{B,c}$=350 MeV\}, with angular parameters $\alpha_1$=3.85\textdegree and $\alpha_2$=93.85\textdegree, and scaling parameters $\omega$=1 and $\rho$=2. It is important to note that such a choice of parameters only has an illustrative purpose. We do not, by making this choice, claim any prediction for the location of the critical point or the size of the critical region. Here, we seek to provide an estimate of the effect of critical features on heavy-ion-collision systems, and leave the freedom of choice of the parameters to the users. An additional comment regarding the scaling parameters is in order: varying the parameters $\omega$ and $\rho$ will increase or decrease the effects of the critical point \cite{Parotto:2018pwx,Bzdak:2019pkr,Mroczek:2020rpm}. In order to reduce the parameter space, we are relying on experimental data from the BES-II to constrain the parameters and narrow down the location of the critical point. \item Calculate the Ising model susceptibilities and perform the matching of the Taylor expansion coefficients order by order to Lattice QCD results at $\mu_B=0$. This yields a non-Ising, or background, pressure, which is, by construction, the difference between the lattice and Ising contributions: % \begin{equation} \label{coeffmatch} T^4 c_n^{\rm{LAT}}(T) = T^4 c_n^{\rm{Non-Ising}}(T) + T_c^4 c_n^{\rm{Ising}}(T) \end{equation} \begin{figure*}[t] \centering \begin{tabular}{c c c} \includegraphics[width=0.33\textwidth]{chi0_all_Lat_Ising_NonIsing.pdf} & \includegraphics[width=0.33\textwidth]{chi2_all_Lat_Ising_NonIsing.pdf} & \includegraphics[width=0.33\textwidth]{chi4_all_Lat_Ising_NonIsing.pdf} \end{tabular} \caption{Taylor expansion coefficients of the pressure up to $\mathcal{O}$($\mu_B^4$). The critical contributions from the Ising Model (black, dashed lines) are compared to the lattice QCD results (red, solid lines), which determines the non-critical terms (blue, dot-dashed lines) as detailed in Eq. (\ref{coeffmatch}). } \label{fig:chis_all} \end{figure*} \item Reconstruct the full pressure as the sum of critical and non-critical components \begin{equation} \label{fullpress} \begin{split} P(T,\mu_B)=T^4 \sum_n c_n^{\rm{Non-Ising}}(T) \left(\frac{\mu_B}{T} \right)^n \\ + P_{\rm{crit}}^{\rm{QCD}}(T,\mu_B), \end{split} \end{equation} % where $P_{\rm{crit}}^{\rm{QCD}}$ is the singular part of pressure that has been mapped onto the QCD phase diagram as described in steps 1 and 2. \item Merge the full pressure from step 5 with the pressure from the ideal HRG model, calculated using the SMASH hadronic list, at low temperatures in order to smoothen any non-physical artifacts of the Taylor expansion. We utilize the hyperbolic tangent for this smooth merging: % \begin{equation} \label{eq:Pmerging} \begin{split} \frac{P_{\text{Final}}(T,\mu_B)}{T^4} = \frac{P(T,\mu_B)}{T^4} \frac{1}{2} \Big[1 + \tanh{\Big(\frac{T-T'(\mu_B)}{\Delta T}}\Big)\Big] \\ + \frac{P_{HRG}(T,\mu_B)}{T^4} \frac{1}{2} \Big[1 - \tanh{\Big(\frac{T-T'(\mu_B)}{\Delta T}}\Big)\Big], \end{split} \end{equation} % where $T'(\mu_B)$ acts as the switching temperature and $\Delta T$ is the overlap region where both pieces contribute. The merging is performed along a line parallel the QCD transition line with an overlap region of $\Delta T$=17 MeV. \item Calculate thermodynamic quantities as derivatives of the pressure from step 6. \end{enumerate} For a thorough description of this procedure, including an investigation of the parameter space and further discussion, we refer the reader to the original development of this EoS in Ref. \cite{Parotto:2018pwx}. More details on the implementation of strangeness neutrality can be found in Ref. \cite{Karthein:2021nxe}. We also calculate the correlation length as given in the 3D Ising model. For this quantity, we only provide the critical contribution as the authors are not aware of a calculation of the QCD correlation length on the lattice yet. We adopt the procedure from Refs. \cite{Brezin:1976pt, Berdnikov:1999ph, Nonaka:2004pg}, which follows Widom’s scaling form in terms of Ising model variables: \begin{equation} \label{corr_length} \begin{split} \xi^2(r,M) = f^2 |M|^{-2 \nu / \beta} g(x), \end{split} \end{equation} where $f$ is a constant with the dimension of length, which we set to 1 fm, $\nu$ = 0.63 is the correlation length critical exponent in the 3D Ising Model, $g(x)$ is the scaling function and the scaling parameter is $x$=$\frac{|r|}{|M|^{1/\beta}}$. This scaling function takes two forms in the $\epsilon$-expansion and asymptotic formulations, which must be merged at an appropriate value of the scaling parameter, according to Ref. \cite{Nonaka:2004pg}. Further details on this procedure can be found in Ref. \cite{Karthein:2021nxe}. \section{Results} The results for the final thermodynamics are shown in Figs. \ref{fig:press} and \ref{fig:entr} along with the calculation of the correlation length. The location of the critical point is indicated in each of the plots of the thermodynamics to guide the reader to the critical region. The pressure itself is a smooth function of \{T,$\mu_B$\} in the crossover region and shows a slight kink for chemical potentials larger than $\mu_{B,c}$. The derivatives of the pressure help to reveal the features of the critical region, as shown for the baryon density and entropy. In the right panel of Fig. \ref{fig:entr}, the critical contribution to the correlation length, calculated as described in section 2, is shown in the QCD phase diagram. The smoothly merged correlation length is uniform everywhere in the phase diagram, except in the critical region. Near the critical point the correlation length increases and then diverges at the critical point itself, following the expected scaling behavior. We also calculated the isentropic trajectories in the phase diagram, as shown in Fig. \ref{fig:isen}, and note that these curves, in particular, show the importance of incorporating the constraints on the conserved charges present in HICs. \begin{figure*} \centering \includegraphics[width=0.4\textwidth]{Press3D.pdf} \includegraphics[width=0.49\textwidth]{BarDens3D_v3.pdf} \caption{Left: The pressure for the choice of parameters as listed in Section \ref{method}. Right: The baryon density for the same choice of parameters.} \label{fig:press} \end{figure*} \begin{figure*} \centering \includegraphics[width=0.45\textwidth]{Entr3D.pdf} \includegraphics[width=0.45\textwidth]{CorrLength3D.pdf} \caption{Left: The entropy for the choice of parameters as listed in Section \ref{method}. Right: The critical correlation length calculated within the 3D Ising model.} \label{fig:entr} \end{figure*} \begin{figure*} \centering \includegraphics[width=0.5\textwidth]{Isentropes_compare.pdf} \caption{Isentropic trajectories in the QCD phase diagram that show the path of the system in a heavy-ion collision in the case of strangeness neutrality and vanishing $\mu_Q$ and $\mu_S$.} \label{fig:isen} \end{figure*} \section{Conclusions} We provide an equation of state that obeys the experimental conserved charge conditions of strangeness neutrality and fixed baryon-number-to-electric-charge ratio to be used in hydrodynamic simulations of HICs. In addition to probing the slice of the 4D QCD phase diagram covered by the experiments, the equation of state can also be coupled to the SMASH hadronic afterburner because it exclusively includes the hadronic list from that framework \cite{Petersen:2018jag}. Furthermore, we provide a calculation of the critical correlation length, which exhibits the expected scaling behavior and is important for the calculation of the critical scaling of transport coefficients near the critical point. \section{Acknowledgments} This material is based upon work supported by the National Science Foundation under grants no. PHY1654219, PHY-2116686 and OAC-2103680 and the National Science Foundation Graduate Research Fellowship Program under Grant No. DGE-1746047, and by the US-DOE Nuclear Science Grant No. DE-SC0020633, and within the framework of the Beam Energy Scan Topical (BEST) Collaboration. We also acknowledge the support from the Center of Advanced Computing and Data Systems at the University of Houston. P.P. acknowledges support by the DFG grant SFB/TR55. \bibliographystyle{JHEP}
\section{Introduction} The biological intelligence of living beings has long attracted us to explore their innate ability to learn complex tasks. For instance, despite their limitations in terms of cognitive capabilities and energy resources, flying insects can outperform some of the most advanced aerial robots nowadays on navigating autonomously through complex environments with fast and agile maneuvers \cite{Zheng2018}. In recent years, this inspiration has led to the development of controllers for unmanned aerial vehicles (UAVs) that mimic the structural and functional principles of the brain \cite{Jiang2017}. Neuromorphic control systems, as opposed to classical model-based approaches, can adapt to unknown scenarios (e.g. unmodelled dynamics or disturbances) due to their learning nature \cite{Ijspeert2008, Yu2014}. Artificial neural networks (ANNs) \cite{Abiodun2018} have proven successful for controlling different flying robots such as a hexacopter \cite{Kusumoputro2016}, a helicopter \cite{Suprijono2017}, or a quadrotor \cite{Ary2017}. However, when it comes to light-weight micro air vehicles (MAVs), conventional ANNs present several disadvantages regarding energy consumption and response latency \cite{Yousefzadeh2019}. Spiking neural networks (SNNs), are a promising research direction in this regard. By processing information using just a small population of spikes with a precise relative timing, they allow for a more efficient learning and control \cite{Maass1997, Lee2016}. \begin{figure}[t] \centering \includegraphics[width=0.95\columnwidth]{imgs/extra/front_image.png} \vspace{-2mm} \caption{Proposed autonomous altitude control system for an indoor airship. Evolution of the blimp altitude for two different setpoints ($h_a$ and $h_b$) for several timestamps ($t_0,\dots,t_4$).} \label{fig:front_figure} \end{figure} Among the main advantages of SNNs for aerial robotic applications, we can highlight that they enable computing with highly parallel architectures and provide low-power and energy efficiency traits \cite{loihi,ubrain}. Additionally, they are universal value function approximators \cite{Foderaro2010b}, which theoretically makes them suitable for addressing complex control tasks. However, they have not yet become a common method for designing controllers. This is mainly due to the discrete spiking nature of SNNs, which prevents the use of gradient-based optimization algorithms, such as the widely used back-propagation strategy for conventional ANNs. This makes the training process challenging. To tackle these issues, in this paper we present a SNN-based altitude controller for a low-cost micro airship with an open-source design, equipped with an airborne radar (Figure \ref{fig:front_figure}). The choice of the problem of tracking an altitude command is motivated by its relevance in key MAV applications such as autonomous package delivery \cite{Mathew2015, Arbanas2016}, or landing \cite{Croon2013, Borowczyk2017}, among others. On the other hand, the selection of a lighter-than-air craft as a test platform instead of a rotorcraft, is driven by the complementary advantages it poses, such as extended flight times, excellent ease of assembly, low acoustic footprint, low power consumption, and a simpler design \cite{Li2011}. By incorporating an airborne radar, the sensory feedback required for the control loop is robust to variant illumination and visibility conditions, while keeping the payload and computational requirements within reasonable limits. The main contributions of this paper are then twofold. First, we present an evolved altitude controller for a micro air vehicle based on a SNN, which relies solely on the sensory feedback provided by an airborne radar. We successfully demonstrate the performance of the radar-based neurocontroller onboard the aerial platform in real-world experiments, quantitatively comparing the results with those of an ANN and a proportional-integral-derivative (PID) controllers. Second, we propose the design of an open-source, low-cost, lightweight blimp platform with a 3D printable gondola, that allows for the inclusion of custom sensors and actuators. This facilitates its replication and customization for different applications. The remainder of the paper is organized as follows: Section \ref{sec:related_work} provides an overview of the state-of-the-art in micro-airship design and spiking flight neurocontrollers. Afterwards, in Section \ref{sec:methodology}, we present the proposed MAV design, introduce the altitude control scheme based on the airborne radar, the structure of the SNN controller, the evolutionary strategy for training the network, and a blimp computational model to perform the training in a simulated environment. Then, in Section \ref{sec:results}, we describe the real-world experimental setup as well as discuss the obtained results. Finally, Section \ref{sec:conclusion} concludes the work and delineates future research directions. \section{Related Work} \label{sec:related_work} \subsection{Micro-airship Design} Even though the golden era of giant cargo airships has faded, the advantages offered by lighter-than-air crafts prevail. Blimps are, slowly but surely, attracting increasing interest in the realm of unmanned aerial vehicles \cite{Artaxo2020, Price2020}. They present endless possibilities in terms of their design. For example in~\cite{Gorjup2020}, a three-propeller, low-cost platform is presented that is equipped with a camera and a compact, but closed-configuration gondola. An alternative design is proposed in \cite{UlFerdous2019}, where the authors introduce a novel actuation mechanism based on two propellers mounted on a rotating shaft, which is oriented using a servomotor. Other examples of higher complexity include \cite{Watanabe2015,Oh2006,Burri2013}. Although these alternatives have proven successful for their specific applications, they lack the versatility that can be achieved by leaving room for incorporating additional sensors and/or actuators. Besides, only \cite{Gorjup2020} is open-source and lightweight enough to be mounted on commercially available blimp balloons. For the purpose of clear comparison, the main contributions of the state-of-the-art and our approach are summarized in Table \ref{tab:blimp_soa}. \begin{table}[h] \renewcommand{\arraystretch}{1.2} \caption{Comparison between the different blimp designs} \label{tab:blimp_soa} \centering \resizebox{\columnwidth}{!}{\begin{tabular}{c|cccccc} \hline\hline \textbf{Property} & \textbf{\cite{Gorjup2020}} & \textbf{\cite{UlFerdous2019}} & \textbf{\cite{Watanabe2015}} & \textbf{\cite{Oh2006}} & \textbf{\cite{Burri2013}} & \textbf{Ours} \\ \hline Easily customizable gondola & - & \ding{51} & - & - & - & \ding{51} \\ Low-cost design & \ding{51} & \ding{51} & \ding{51} & \ding{51} & - & \ding{51} \\ Open-source availability & \ding{51} & - & - & - & - & \ding{51} \\ Lightweight Microfoil blimp & \ding{51} & - & - & - & - & \ding{51} \\ Number of propellers & 3 & 2 & 4 & 6 & 4 & 2 \\ Number of servomotors & - & 1 & - & 3 & - & 1 \\ \hline\hline \end{tabular}} \end{table} \subsection{Spiking Neural Network-based MAV Control} The inherent nonlinear dynamics of most MAVs makes them challenging to control. Moreover, their restrictive weight constraints inevitably limit the computational power of the controller. SNNs enable computing with highly parallel architectures made of simple integrate-and-fire neurons interconnected by weighted synapses. Implementations of spiking flight neurocontrollers include \cite{Howard2014a}, where the authors propose a SNN for robust control of a simulated quadrotor in challenging wind conditions. They achieve a better performance in waypoint holding experiments compared with a hand-tuned PID and a multi-layer perceptron network. Another example is presented in \cite{Clawson2016a}, where a SNN controller that adapts online to control the position and orientation of a flapping drone is proposed. SNNs have also been applied to obstacle avoidance tasks, as direct flight \cite{Foderaro2010b} or decision-making \cite{Zhao2018} controllers. In both cases they use reward-modulated learning rules for training the SNN. Although these MAV controllers have excelled in simulated environments, their main limitation is that they have not been evaluated in real-world experiments. The scope of works that have implemented SNN controllers for MAVs in real scenarios is much more limited. The first work that integrates a SNN in the closed-loop control of a real-world flying robot is very recent \cite{Hagenaars2020}. There, the authors present a SNN for controlling the landing of a quadrotor by exploiting the optical flow divergence from a downward-looking camera and the readings of an inertial measurement unit (IMU). To address the learning problem of SNNs \cite{Wang2020a}, they adopt an evolutionary training strategy. In \cite{Dupeyroux2021}, this controller is enhanced by using hardware specifically designed for neuromorphic applications. Although not tested in free flight experiments, the potential advantages of SNN controllers implemented in these devices are also demonstrated in \cite{Sandamirskaya2021}. Our work aims to extend the framework proposed in \cite{Hagenaars2020}, by (1) controlling the altitude instead of landing; (2) considering an open-source micro blimp, which has less control authority and harder to model dynamics than a quadrotor; and (3) exploiting solely the range measurements provided by a radar, reducing the number of required sensors on-board (i.e., no IMU). \section{Methodology} \label{sec:methodology} \subsection{Open-source Micro-airship} The proposed design for the micro autonomous airship is illustrated in Figure \ref{fig:gondola}. The reader interested in replicating the platform can find further details, links to re-sellers, prices, and parts for 3D printing at: \url{https://github.com/tudelft/blimp_snn}. The airship's gondola can be 3D printed and assembled in a modular fashion, with a total frame weight of just $9$g. Due to its open configuration, the components mounted on the gondola can be easily interchanged, leaving room for versatility on the selection of sensors and actuators. In addition, we include a rotary shaft with a case for accommodating the propellers on both ends for controlling the altitude. Finally, we incorporate four hitches on top of the gondola, where we tape Velcro strips for attaching the envelope. Regarding the electronic components, we use a Raspberry Pi W Zero as the central communication and control unit, running the Raspbian Lite operating system. The robot's steering is achieved through the micro servomotor mounted on the gondola and the two core-less direct current (DC) motors attached at each end of the shaft. Specifically, the servo is responsible for the rotation of the shaft, up to 180\degree, and the DC motors allow for an independent control of the thrust on each side. Additional peripheral components include a step-up voltage regulator, a 500 mAh Li-Po battery and a motor driver. Finally, a fast chirp frequency-modulated continuous wave (FMCW) radar module from Infineon with a resolution of $\pm 20$ cm is used as a ranging sensor for the closed-loop control. Concerning the airship's envelope, the material chosen is Microfoil due to its excellent gas retention capabilities \cite{Gorjup2020}. We select a model that provides the largest achievable payload among the commercially available miniature blimps ($150$g) while keeping a relatively low price. For our application, we use helium as the lifting gas. Considering all the aforementioned elements, the proposed platform weights a total of 147g. To integrate the different components and perform the computations on-board we adopt the Robot Operating System (ROS) \cite{Quigley2009} framework. In addition, a tele-operation package to manually control the airship from a ground computer keyboard via a secure shell (SSH) connection is also provided in the repository included at the beginning of this section. \begin{figure}[t] \centering \includegraphics[width=\columnwidth]{imgs/blimp_design/gondola_parts_scale.png} \caption{Scheme of the proposed airship design. (A) Raspberry Pi W Zero; (B) 24 GHz Infineon Radar Position2Go; (C) Sub-micro Servo SG51R; (D) 8520 Coreless Motor; (E) PowerBoost 500 Basic; (F) 550mA 3.8V Li-Po Battery.} \label{fig:gondola} \vspace{-3mm} \end{figure} \subsection{Altitude Controllers} In order to control the autonomous airship's altitude, the commands are provided in terms of motor voltages, $u \in [-u_{\max},u_{\max}]$ $[V]$, with $u_{max} = 3.3$ $[V]$. The larger the absolute value of $u$, the more thrust the propellers provide, and therefore, the greater the acceleration of the blimp will be. The sign of the voltage does not represent the polarity of the electric signal, but the direction in which the airship is moving. Thus, when $u>0$, the robot moves upwards and, when $u<0$, the robot moves downwards, with the shaft rotated $180\degree$. To determine the required control actions for tracking an arbitrary reference altitude, $h_{\textit{ref}}$, we process the readings from the Infineon Position2Go airborne radar to get an estimate of the current height of the blimp, $h_{\textit{curr}}$ \cite{Wessendorp2021}. Specifically, the range-Doppler algorithm \cite{Winkler2007RangeDD} is used for the processing. Afterward, a median filter and a moving average filter are used to decrease the signal noise and remove possible outliers. Then, to effectively track an arbitrary altitude command, we design a controller that provides a mapping between the altitude error, $h_{\textit{ref}}-h_{\textit{curr}}$, and the motor voltages, $u$, such that the former is minimized. We consider three distinct approaches for benchmarking purposes: a linear PID, an artificial neural network, and a spiking neural network. \subsubsection{Proportional-integral derivative controller} A conventional PID is one of the most simple, yet widespread methods for addressing control problems. In discrete form, the mapping between the error signal $e_k=h_{ref}(k)-h_{curr}(k)$ and the motor command $u_k$ is given by \cite{Ogata87}: \begin{equation} u_k = K_p e_k + \frac{K_d}{T} \left(e_k - e_{k-1}\right) + K_i T \left(e_k + e_{k-1}\right) \end{equation} where $K_p$, $K_i$ and $K_d$ refer to the proportional, integral and derivative gains, respectively, and $T$ to the sampling period. These are tuned empirically using the proposed MAV platform until we achieve the desired behavior. \subsubsection{Artificial neural network controller} For the ANN case, the tracking error $h_{\textit{ref}}-h_{\textit{curr}}$ is directly fed into the network in the form of a continuous signal. The proposed neuron architecture, from the input to the output layer, follows a $1-3-2-1$ scheme. The input and the two hidden layers operate with a $\tanh()$ activation function. At the output layer, a linear neuron provides the value of the motor command $u$, clamped to the interval $\pm u_{\max}$ $[V]$. \begin{figure} \centering \includegraphics[width=\columnwidth]{imgs/architectures/snn.pdf} \caption{Scheme of the SNN controller architecture. The (evolved) network parameters are highlighted in violet, being $w$ the synaptic weights, $\theta$ the spiking threshold, $\alpha_{v/t}$ the scaling constant for the increase of the voltage/trace by a single spike, and $\tau_{v/t}$ the decay for the voltage/trace.} \label{fig:snn_arch} \end{figure} \subsubsection{Spiking neural network controller} The proposed SNN architecture is illustrated in Figure \ref{fig:snn_arch}. The network consists of three fully connected layers of sizes 10, 5 and 1 neuron, from the input to the output. The input layer acts as a position placeholder that encodes the altitude error signal into spikes. More specifically, the input values of $h_{\textit{ref}}-h_{\textit{curr}}$ are divided into 10 intervals, with each of them assigned to a different neuron. The range of the first and last intervals corresponds to $\left]-\infty,\,-0.4\right[$ and $\left]0.4,\,\infty\right[$, respectively, while the remainder 8 are uniformly distributed between $\left[-0.4,\,0.4\right]$. Each time the altitude error falls within one of these "gaps", the corresponding neuron fires a single spike. The hidden layer consists of five leaky integrate-and-fire (LIF) neurons, where the membrane potential of the $i$-th neuron, $v_i(t)$, is governed by the following equation: \begin{equation} v_i(t) = \tau_{v_i} \cdot v_i(t-\Delta t) + \alpha_{v_i}u_i(t)\qquad i=1,\dots,5 \end{equation} referring $\tau_{v_i} \in [0,1]$ to the decay factor per time-step $\Delta t$, $\alpha_{v_i}$ to a scaling constant, and $u_i(t)$ to the synaptic input current: \begin{equation} u_i(t) = \sum_{j=1}^{10} w_{ij} s_j(t). \end{equation} that is, multiplying the incoming spikes from the $j$-th input neuron $s_j(t)$, by the synaptic weights $w_{ij}$. Whenever the membrane potential $v_i(t)$, reaches a certain threshold $\theta_i$, a postsynaptic spike is triggered and $v_i(t)$ resets back to $0$. The output layer decodes the spikes back into a real value. It consists of a single non-spiking neuron with a scaled $\tanh()$ activation function. The neuron conducts a weighted sum of the so-called spike traces, $X_i(t)$, which is computed as: \begin{equation} X_i(t)=\tau_{t_i} \cdot X_i(t-\Delta t)+\alpha_{t_i}s_i(t), \end{equation} being the definition of $\tau_{t_i}$ and $\alpha_{t_i}$ analogous to $\tau_{v_i}$ and $\alpha_{v_i}$. The resulting value is scaled within the control limits, $\pm u_{\max}$. Following this, the motor command, $u$, is given by: \begin{equation} u(t) = u_{\max}\cdot\tanh\left(\sum_{i=1}^5w_{i}X_i(t)\right) \end{equation} \subsection{Evolutionary Framework} \label{sec:evolutionary_framework} For training the neural network controllers we adopt an evolutionary strategy. Each evolution begins with a randomly initialized population of $N$ individuals. As in \cite{Hagenaars2020}, a mutation-only procedure is then followed. The offspring is obtained by performing a randomized tournament selection of $M$ individuals i.e. randomly selecting $M$ aspirants from the population and keeping the one with the best fitness. This is repeated $N$ times, so that the population size is invariant. The $n$-th individual is mutated with a probability of $p_{\textit{mut}}^{(n)}=0.4$, and its $m$-th parameter with $p_{\textit{mut}}^{(m)}=0.6$. These mutations take place according to uniform probability distributions $\mathcal{U}\left\{,\right\}$, whose range is shown in Table \ref{tab:snn_params} and \ref{tab:ann_params} for the SNN and ANN, respectively. For the latter, the open parameters are the biases, $b_i$, and analogously to SNNs, the weights, $w_{ij}$. \vspace{-1mm} \begin{table}[h] \renewcommand{\arraystretch}{1.2} \centering \caption{SNN parameters mutated during evolution} \vspace{-1mm} \label{tab:snn_params} \begin{tabular}{c|cc} \hline\hline \textbf{Parameter} & \textbf{Domain} & \textbf{Mutation} \\ \hline $w_{ij}$ & $[-5,\dots,5]$ & $\mathcal{U}\left\{-2.5,2.5\right\}$ \\ $\theta_{i}$ & $[0,\dots,1]$ & $\mathcal{U}\left\{-0.5,0.5\right\}$ \\ $\alpha_{{v_i/t_i}}$ & $[0,\dots,2]$ & $\mathcal{U}\left\{-1.0,1.0\right\}$ \\ $\tau_{{v_i/t_i}}$ & $[0,\dots,1]$ & $\mathcal{U}\left\{-0.5,0.5\right\}$ \\ \hline\hline \end{tabular} \end{table} \begin{table}[h] \renewcommand{\arraystretch}{1.2} \centering \caption{ANN parameters mutated during evolution} \vspace{-1mm} \label{tab:ann_params} \begin{tabular}{c|cc} \hline\hline \textbf{Parameter} & \textbf{Domain} & \textbf{Mutation} \\ \hline $w_{ij}$ & $[-5,\dots,5]$ & $\mathcal{U}\left\{-2.5,2.5\right\}$ \\ $b_{i}$ & $[-5,\dots,5]$ & $\mathcal{U}\left\{-2.5,2.5\right\}$ \\ \hline\hline \end{tabular} \end{table} The mutated offspring is then evaluated in a model-based simulation environment (see Section \ref{subsec:model-based_sim}), where a source of random Gaussian noise is added to the radar signal. Since this randomization stimulates the persistence of controllers that are independent of such disturbances, it helps minimizing the reality gap \cite{Scheper2020}. During the evaluation, a set of 10 different reference altitudes $h_{\textit{ref}}\in [0,3]$ is provided along a total simulated duration of $T = 15$ seconds each. The fitness of each individual is then quantified as the root mean squared altitude error (RMSAE): \begin{equation} \label{eq5} \text{RMSAE} = \sqrt{\frac{1}{T}\sum_{k = 0}^{T} \left( h_{\textit{ref}}(k) - h_{\textit{curr}}(k) \right)^2} \end{equation} During the evolution process, a \textit{hall of fame} which holds the 5 best performing individuals across all generations, is maintained. This prevents discarding those who have achieved a good performance. After $N_{\textit{gen}}$ generations, the individuals are also reevaluated on five more random sets of altitudes to increase the robustness. The best-performing ones are selected for further real-world experiments. \subsection{Model-based Simulation Environment} \label{subsec:model-based_sim} The altitude controllers evolve in a simulated environment since it would be infeasible to perform all the required evaluations in the real world. For that, we develop a dynamical model of the blimp. Essentially, the idea is to obtain a mapping between the motor commands provided by the controller and the evolution of the blimp's altitude over time. We assume that the acceleration at the $k$-th time step $\ddot{h}_k$, is proportional to the voltage applied to the motors, $u$, i.e. \begin{equation} \ddot{h}_k = a_1 u_{k-1} + a_2 u_{k-2} \end{equation} where $a_i$ is the proportionality constant for the motor command at time instant $k-i$. However, since the acceleration cannot be directly measured with the radar sensor, we can instead express this relation in terms of the measured altitude, $h$ by taking Euler's discretization of the derivative \begin{equation} h_{k} - 2h_{k-1}+ h_{k-2} = a_1 u_{k-1} + a_2 u_{k-2} \end{equation} Applying the Z-transform, we obtain the following transfer function, which maps the commands $u_k$ to the altitude $h_k$, and allows us to easily simulate the blimp's dynamic behavior \begin{equation} \label{eq:blimp} h_k = \frac{a_1z^{-1}+a_2z^{-2}}{1-2z^{-1}+z^{-2}} u_k \end{equation} \begin{figure*} \centering \includegraphics[width=0.7\textwidth]{imgs/extra/diagram_with_board.pdf} \caption{System overview. After processing the feedback provided by the radar sensor, an estimate of the range is sent to the Raspberry Pi Zero W control unit. Only data recording and real-time plotting operations are conducted on the ground computer, which communicates with the Pi via an SSH connection. The OptiTrack is used during the post-processing stage just for validation purposes.} \label{fig:real_all} \end{figure*} To determine the unknown parameters $a_i$, we collected a dataset by tele-operating the blimp and measuring its altitude over time. After subtracting the mean, we infer the model parameters by minimizing the normalized root mean squared altitude error (NRMSAE): \begin{equation} \label{eq:nrmse} \text{NRMSAE} = \sqrt{\frac{\sum_{k}\left(\hat{h}_k-h_k\right)^2}{\sum_{k}\hat{h}_k^2}} \end{equation} which can be interpreted as a measure of how well the expected response $h_k$ matches the observed data $\hat{h}_k$. \section{Results} \label{sec:results} \subsection{Experimental Setup} \subsubsection{Simulation} To train the neural controllers, we evolved five randomly initialized populations of 100 individuals through 300 generations, following the procedure described in Section \ref{sec:evolutionary_framework}. The implementation of the evolutionary optimization is based on the Distributed Evolutionary Algorithms in Python (DEAP) \cite{deap2012} framework, while the simulation of the networks is performed by means of the PySNN library \cite{BasBuller2019}. \subsubsection{Real-World} An overview of the setup is shown in Figure \ref{fig:real_all}. The on-board control unit is a 1GHz single-core processor Raspberry Pi Zero W with 512MB RAM. The Infineon Position2Go radar provides altitude measurements. The control loop runs at a rate of 5 Hz. \begin{figure} \centering \includegraphics[width=0.85\columnwidth]{imgs/model/model_legend.pdf} \caption{Validation of the blimp model. \textbf{\textit{Bottom:}} Motor commands. \textbf{\textit{Top:}} The ground truth evolution of the altitude, $h_{\textit{real}}$, compared with the evolution predicted by the model, $h_{\textit{model}}$. The error is represented by the blue area.} \label{fig:results_model} \end{figure} \begin{figure} \centering \includegraphics[width=0.75\columnwidth]{imgs/block_diagram/block3.pdf} \caption{Proposed control scheme for closing the reality gap of the neural network-based controllers trained in simulation.} \label{fig:block} \end{figure} \subsection{Blimp Model} Following the procedure explained in Section \ref{subsec:model-based_sim}, we infer the parameters of a blimp model of the form \eqref{eq:blimp}, based on experimental data gathered using the real hardware. The resulting model is given by: \begin{equation} \label{eq:blimp_model} h_{model} = 10^{-3}\cdot\frac{-0.969 z^{-1} + 1.019 z^{-2}}{1-1.99z^{-1}+0.99z^{-2}}u_{motor} \end{equation} where we have also considered the denominator's parameters as open, yielding almost identical values to the theoretical ones. In Figure \ref{fig:results_model} we show a comparison between the evolution of the altitude predicted by the model and the ground truth when applying identical motor commands. We can see that we are able to reproduce the blimp's behavior using the proposed data-driven model, with a RMSAE of 0.27m over the 300 seconds run. \subsection{Controller Evaluation} \label{subsec:sim_real_results} We evaluate the performance of three different altitude controllers based on a linear PID, an ANN, and a SNN. The tracking precision is tested on a sequence of five different waypoints $h_d=\left\{3,2,1,2.5,1.5\right\}$m, maintained during $60$s. Additionally, due to the existing mismatch between the linear simulated model and the real robot, directly taking the output of the evolved networks as the rotor commands would lead to deficient performance. To reduce the reality gap, we propose the control scheme shown in Figure \ref{fig:block}. Essentially, we tune a parallel PD controller in the real-world setup to account for the contribution of disturbances and neglected dynamics. The chosen gains are small so that the PD addition is kept at a maximum of 16\% with respect to the magnitude of the motor command. \subsubsection{PID controller} The experimental results are depicted in Figure \ref{fig:results_ann_and_snn}(a), using the gains $K_p$, $K_i$ and $K_d$ indicated in Table \ref{tab:gains_pid}. We can see that we can track the altitude commands effectively. Quantitatively, we obtain a RMSAE of 0.29m, which indicates a satisfactory performance, considering that the uncertainty of the radar sensor is of $\pm0.2$m. \begin{figure}[t] \centering \includegraphics[width=0.85\columnwidth]{imgs/results/results_together.pdf} \caption{Experimental evaluation of the considered controllers. For all three sub-figures, at the bottom we have the motor commands, and on top, the evolution of the blimp's altitude $h_{\textit{real}}$ compared with the reference $h_{\textit{ref}}$. \textbf{\textit{(a) PID}:} $u$ refers to the motor command, and $u_{\textit{smooth}}$ is obtained after smoothing it with a moving average. \textbf{\textit{(b) ANN}:} $u_{\textit{ANN}}$ stands for the output of the evolved controller, $u_{\textit{PD}}$ to the contribution of the PD parallel controller, and $u_{total} = u_{\textit{ANN}} + u_{\textit{PD}}$. \textbf{\textit{(c) SNN}:} Analogous to the ANN controller.} \label{fig:results_ann_and_snn} \end{figure} \subsubsection{ANN controller} The obtained results are shown in Figure \ref{fig:results_ann_and_snn}(b), after reducing the reality gap with the PD gains specified in Table \ref{tab:gains_pid}. We can see that the blimp effectively converges to the altitude set-point but presents an oscillatory behavior. This is mainly because of two reasons: the minor contribution of the diminished discrepancies between the model and the vehicle's inherent dynamics; and the slow responsiveness of the system, especially when the motor commands are not too abrupt, as it is the case. However, it can be noted that the trajectory is smoother than with a PID. The RMSAE now corresponds to 0.27m. \subsubsection{SNN controller} The experimental results for this case are displayed in Figure \ref{fig:results_ann_and_snn}(c), using the PD gains from Table \ref{tab:gains_pid}. We can observe that the behavior and performance are similar to the previous case, but with faster oscillations, due to the output's binary nature caused by the presence or absence of the spike. The RMSAE is also of 0.27m. \begin{table}[t] \renewcommand{\arraystretch}{1.2} \centering \caption{Gains comparison between the different controllers} \label{tab:gains_pid} \begin{tabular}{c|ccc} \hline\hline \diagbox[width=1.8cm,trim=lr]{Gain}{Strategy}& \textbf{PID} & \textbf{ANN} & \textbf{SNN} \\ \hline \textbf{$K_p$} & 6.0 & 1.3 & 1.4 \\ \textbf{$K_i$} & 0.4 & - & - \\ \textbf{$K_d$} & 0.9 & 0.4 & 0.3 \\\hline\hline \end{tabular} \end{table} \begin{figure}[t] \centering \includegraphics[width=0.8\columnwidth]{imgs/results/barras1col.pdf} \caption{Comparison between the PID, ANN and SNN controllers. \textbf{\textit{Left:}} Motor command contribution of the neurocontrollers against the parallel PD. \textbf{\textit{Right:}} Relative control effort, computed according to Equation \eqref{eq:control_effort}.} \label{fig:bars} \end{figure} \subsubsection{Comparison} Figure \ref{fig:bars} shows a comparison between the control commands provided by each controller. On the left, we observe that the contribution of the parallel PD is similar for both neuromorphic controllers, remaining below 16\%. On the right, we perform the analysis in terms of the magnitude of the control effort, relative to that of the PID, \begin{equation} \label{eq:control_effort} \%u_{\textit{ANN}/\textit{SNN}} = \frac{\sum_{k} \left| u_{\textit{ANN}/\textit{SNN}}(k) \right|}{\sum_{k}\left| u_{\textit{PID}}(k) \right|}\cdot 100\% \end{equation} which gives an estimate of how energy efficient the controllers are. We can see that, even though the three control strategies present a similar RMSAE, the neurocontrollers, and especially our SNN design, exhibit less control effort, which saves energy. \section{Conclusion} \label{sec:conclusion} Despite the recent advancements, it is still challenging for micro air vehicles (MAVs) to carry on-board the complex controllers required to fly autonomously. In this paper, we push the state-of-the-art in MAV control by presenting a novel altitude controller based on a spiking neural network (SNN). Our SNN architecture is evolved within a model-based simulation. The results obtained in real-world experiments successfully demonstrate the system's performance. By comparing it with a standard PID and an artificial neural network, we corroborate the advantages offered by SNNs in terms of adaptability and low control effort. Although there is still room for improvement in terms of performance and network complexity, future research will involve the use of specific neuromorphic hardware to better reflect the promises of neuromorphic computing in MAV control. \bibliographystyle{IEEEtran}
\section{Introduction} \vspace{-0.3cm} In the last years, the ongoing advances in the detection of gravitational waves produced by binary black hole (BH) mergers, has been leading us to develop analytical and exact models in order to complement the current powerful codes developed in numerical relativity. Although simplified binary BH models can be found in stationary spacetimes, these are very useful to conceive a general picture on how they might interact and evolve. In this direction, in an earlier paper \cite{Cabrera2018}, we were able to solve exactly the axis conditions with the main objective to describe dynamical scenarios between two unequal rotating Kerr BHs separated by a massless strut (conical singularity \cite{BachW,Israel}). These setups are well defined by means of an asymptotically flat metric that belongs to a $5$-parametric subclass of the well-known double-Kerr-NUT solution \cite{KramerNeugebauer}, but which is now fully characterized by arbitrary physical Komar parameters \cite{Komar}. This physical representation permits us to gain more novel information whether one attempts to study the dynamical aspects related to the spin-spin interaction (repulsion or attraction) within the binary system (BS), when the coalescence among two BHs is carrying out, or even before such a process could take place, and it can only be succeeded by getting concise expressions for the half-length BH horizons $\sigma_{1}$ and $\sigma_{2}$ in terms of Komar parameters. On the other hand, more general descriptions of stationary axisymmetric binary BHs can be analyzed once the electromagnetic field to the aforementioned rotating systems \cite{Cabrera2018} is added, nonetheless, it increases considerably the laborious task to obtain exact results, and for such a reason, alluding to their symmetric nature, we have considered first a pair of identical corotating charged binary BH models \cite{CCHV} where magnetic charges are not taken into account in the solution. In the present paper we provide a $7$-parametric asymptotically flat exact solution that permits the description of the most general case of a BS composed of two unequal Kerr-Newman (KN) BHs \cite{ENewman} separated by a massless strut, where the functional form of their BH horizons as well as all the thermodynamical properties contained in the Smarr formula \cite{Smarr} are given by concise formulae. Due to the fact that the conditions on the axis and the absence of individual magnetic charges are fulfilled, the full metric is completely characterized by physical Komar parameters: the masses $M_{i}$, electric charges $Q_{i}$, and angular momenta $J_{i}$, while the centers of the sources are keeping apart by a coordinate distance $R$. In passing, we show that in a similar way as in the vacuum situation \cite{Cabrera2018}, the BHs interact via a dynamical law that is now defined by a septic algebraic equation, and when the strut is removed, it can be trivially reduced to some equilibrium laws already known; the case concerning vacuum systems \cite{MankoRuiz} and the electrostatic one \cite{Alekseev}. We also obtain quite trivial expressions for the thermodynamic relations of the BS during the merger limit (ML), whereas the result of Dietz and Hoenselaers \cite{DH} on the interaction force of two spinning particles at large distances has been generalized to include the contribution of the electric charges. Finally, in the seek of equilibrium states among the BHs without a supporting strut, some scenarios during the merger process have been found, where the new source that is being created might be seen as a BH, satisfying the subextreme condition $M^{2}-Q^{2}-(J/M)^{2}\geq0$ and avoiding the apparition of closed timelike curves (CTC) outside its event horizon \cite{Bonnor}. The outline of the paper is as follows. In Sec. II we adopt a suitable parametrization for the double KN problem in order to get the corresponding asymptotically flat metric. Later on, the axis conditions and the one that eliminates both magnetic charges in the solution are solved exactly. In Sec. III, the thermodynamical features for each KN BH are given concisely once the expressions for the half-length BH horizons are derived. The dynamical limits of the interaction suffered by both BHs in the BS are well identified, in particular, we study equilibrium states with no strut during the merger process. Summary and outlook are introduced in Sec. IV. \section{Suitable parametrization of the double KN problem} \vspace{-0.4cm} As has been previously outlined in Ref.\ \cite{CCHV}, the Ernst potentials $({\cal{E}}, \Phi)$ \cite{Ernst} on the upper part of the symmetry axis conveniently can be written in the form \vspace{-0.1cm} \begin{align} {\cal E}(0,z)&=\frac{\mathfrak{e}_{1}}{\mathfrak{e}_{2}}, \qquad \Phi(0,z)=\frac{(Q+iB)z+\mathfrak{q}_{o}}{\mathfrak{e}_{2}}, \nonu \\ \mathfrak{e}_{1}&=z^{2}-[M + i(\mathfrak{q}+2J_{0})]z +\mathcal{P}_{+}+i P_{1} \nonu\\ &-2iJ_{0} \bigg[M-i\mathfrak{q}+\frac{P_{2}}{\mathfrak{q}}\bigg], \nonu\\ \mathfrak{e}_{2}&=z^{2} + (M -i\mathfrak{q})z + \mathcal{P}_{-} + i P_{2}, \nonu\\ \mathcal{P}_{\pm}&= \frac{2\Delta_{o}-R^{2}-2 M\epsilon_{1}}{4} \mp \frac{\epsilon_{2}R-\mathfrak{q}{\rm S}_{1}+2(Q q_{o}+ B b_{o})}{2M}, \nonu\\ {\rm S}_{1}&=P_{1}+P_{2},\qquad \epsilon_{1,2}= \sigma_{1}^{2} \pm \sigma_{2}^{2}, \nonu\\ \Delta_{o}&= M^{2}-Q^{2}-B^{2}-\mathfrak{q}^{2}, \qquad \mathfrak{q}_{o}=q_{o}+i b_{o}, \label{ernstaxiselectro}\end{align} \vspace{-0.1cm} \noi where the multipolar expansion \cite{Simon,HP,Sotiriou} enables us to show that $M$, $Q$, and $B$ are the total mass, total electric charge, and total magnetic charge of the binary setup, respectively. Moreover, the total electric and magnetic dipole moments, $Q_{o}$ and $B_{o}$, are given by the expressions \vspace{-0.1cm} \be Q_{o}=q_{o}-B(\mathfrak{q}+J_{0}), \qquad B_{o}=b_{o}+Q(\mathfrak{q}+J_{0}) \ee \vspace{-0.1cm} \noi while $J_{0}$ is the well-known NUT charge \cite{NUT} which is depicted as follows \vspace{-0.1cm} \begin{align} J_{0}&=\frac{\mathfrak{q}}{8M^{2}} \left( \frac{N_{0}}{\mathfrak{q}^{2}P_{-}+P_{2}(P_{2}+M\mathfrak{q})} \right), \nonu \\ N_{0}&=M^{2}\left\{4(P_{1}P_{2}+|\mathfrak{q}_{o}|^{2})+(R^{2}-\Delta_{o}) (2\epsilon_{1}-\Delta_{o})+\epsilon_{2}^{2}\right\} \nonu \\ & -\left[\mathfrak{q}{\rm S}_{1}-\epsilon_{2}R-2(Q q_{o}+ B b_{o})\right]^{2}. \label{NUTcharge}\end{align} \vspace{-0.1cm} For completeness, the total angular momentum of the system takes the simple aspect \vspace{-0.1cm} \be J=M \mathfrak{q}-\frac{{\rm S}_{2}}{2}+J_{0}\left(2M+\frac{P_{2}}{\mathfrak{q}}\right), \quad {\rm S}_{2}=P_{1}-P_{2}.\label{Multipolarterms}\ee \vspace{-0.0cm} \begin{figure}[ht] \centering \includegraphics[width=6.0cm,height=5.0cm]{DKEXT.eps} \caption{Binary setups of unequal KN sources: (a) BH configuration when $\sigma_{i}^{2}>0$; (b) hyperextreme sources if $\sigma_{i} \rightarrow i \sigma_{i}$ (or $\sigma_{i}^{2}<0$ ); (c) extreme BHs for $\sigma_{i}=0$.} \label{DK}\end{figure} \vspace{-0.1cm} The above Ernst potentials (the axis data) Eq.\ (\ref{ernstaxiselectro}) contain a total of eleven parameters within the set $\{M,\mathfrak{q},Q,B,q_{o},b_{o},R,\sigma_{1},\sigma_{2},P_{1},P_{2}\}$.\footnote{More particulars on the construction of the axis data Eq.\ (\ref{ernstaxiselectro}) can be found in Ref.\ \cite{CCHV}.} In addition these complex potentials fulfill the characteristic equation \cite{Sibgatullin,RMJ} \vspace{-0.1cm} \be {\cal E}(0,z) + \overline{{\cal E}}(0,z)+ 2 \Phi(0,z) \overline{\Phi}(0,z)=0,\label{characteristic}\ee \vspace{-0.1cm} \noi and its solution contains four roots $\alpha_{n}$ that determine the location of the sources. These are given by \vspace{-0.1cm} \be \alpha_{1,2}=\frac{R}{2}\pm \sigma_{1}, \qquad \alpha_{3,4}=-\frac{R}{2}\pm \sigma_{2}, \label{thealphas}\ee \vspace{-0.1cm} \noi where $R$ is a relative distance of separation between the sources, while the real or complex nature of the parameter $\sigma_{i}$ defines BHs if $\sigma^{2}_{i}\geq0$ or hyperextreme sources whether $\sigma_{i}^{2}<0$, as shown in Fig.\ \ref{DK}. \vspace{-0.3cm} \subsection{The asymptotically flat exact solution} \vspace{-0.4cm} With the aim to declare an asymptotically flat spacetime from the aforementioned axis data Eq.\ (\ref{ernstaxiselectro}), it is necessary to eliminate the gravitomagnetic monopole (or NUT charge). In order to simplify a little bit more the calculations of the next section, we are going to kill first the global magnetic charge $(B=0)$. So, the condition $J_{0}=0$ in Eq.\ (\ref{NUTcharge}) is achieved by virtue of \vspace{-0.1cm} \begin{align} \epsilon_{1}&=\frac{\Delta}{2}\nonu\\ &+\frac{[\mathfrak{q}{\rm S}_{1}-\epsilon_{2} R-2Qq_{o}]^{2}-M^{2}\left[4(P_{1}P_{2}+|\mathfrak{q}_{o}|^2)+\epsilon_{2}^{2}\right]}{2M^{2}(R^{2}-\Delta)},\nonu\\ \Delta&= M^{2}-Q^{2}-\mathfrak{q}^{2}.\label{factorizes}\end{align} \vspace{-0.1cm} \noi and this result derives the axis data for asymptotically flat spacetimes, namely \vspace{-0.1cm} \begin{align} {\cal E}(0,z)&=\frac{z^{2}-(M + i\mathfrak{q})z +P_{+}+i P_{1}}{z^{2} + (M -i\mathfrak{q})z + P_{-} + i P_{2}}, \nonu\\ \Phi(0,z)&=\frac{Qz+\mathfrak{q}_{o}}{z^{2} + (M -i\mathfrak{q})z + P_{-} + i P_{2}}, \nonu \\ P_{\pm}&= \frac{2\Delta-R^{2}-2 M\epsilon_{1}}{4} \mp \frac{\epsilon_{2}R-\mathfrak{q}{\rm S}_{1}+2Q q_{o}}{2M}. \label{ernstaxiselectroII}\end{align} \vspace{-0.1cm} Recalling that the complex potentials ${\cal{E}}=f-|\Phi|^{2}+i\Psi$ and $\Phi=-A_{4}+iA'_{3}$ satisfy the Ernst equations \cite{Ernst} for stationary axisymmetric systems in electrovacuum, which are given by \vspace{-0.1cm} \bea \begin{split} \left({\rm{Re}} {\cal{E}}+|\Phi|^{2}\right)\Delta{\cal{E}}&=(\bnabla{\cal{E}}+ 2\bar{\Phi}\bnabla \Phi)\cdot\bnabla {\cal{E}}, \\ \left({\rm{Re}}{\cal{E}}+|\Phi|^{2}\right)\Delta \Phi&=(\bnabla{\cal{E}}+ 2\bar{\Phi}\bnabla\Phi)\cdot \bnabla\Phi, \label{ERNST} \end{split} \eea \vspace{-0.1cm} \noi while the metric functions $f$, $\omega$, and $\gamma$, define the Papapetrou line element \cite{Papapetrou} \vspace{-0.1cm} \be ds^{2}=f^{-1}\big[e^{2\gamma}(d\rho^{2}+dz^{2})+\rho^{2}d\varphi^{2}\big]- f(dt-\omega d\varphi)^{2}. \label{Papapetrou}\ee \vspace{-0.1cm} A straight application of Sibgatullin's method \cite{Sibgatullin,RMJ} on Eq.\ (\ref{ernstaxiselectroII}) allows us to generate the Ernst potentials and metric functions in all the spacetime, where after some algebraic manipulations eventually it is possible to obtain \vspace{-1.6cm} \begin{widetext} \begin{align} {\cal{E}}&=\frac{\Lambda+\Gamma}{\Lambda-\Gamma},\qquad \Phi=\frac{\chi}{\Lambda-\Gamma}, \qquad f=\frac{|\Lambda|^{2}-|\Gamma|^{2}+ |\chi|^{2}}{|\Lambda-\Gamma|^{2}},\qquad \omega=2\mathfrak{q}+\frac{{\rm{Im}}\left[(\Lambda-\Gamma)(2z\overline{\Gamma}+ \overline{\mathcal{G}})-\chi \overline{\mathcal{I}} \right]}{|\Lambda|^{2}-|\Gamma|^{2}+ |\chi|^{2}}, \nonu\\ e^{2\gamma}&=\frac{|\Lambda|^{2}-|\Gamma|^{2}+ |\chi|^{2}}{256\sigma_{1}^{2}\sigma_{2}^{2}\kappa^{2} r_{1}r_{2}r_{3}r_{4}}, \qquad \Lambda=4\sigma_{1}\sigma_{2} \left[\kappa(r_{1}+r_{2})(r_{3}+r_{4})+a(r_{1}-r_{3})(r_{2}-r_{4})\right]+\Big[2\kappa(\Delta-\epsilon_{1})-a R_{-}\Big]\nonu\\ &\times(r_{1}-r_{2})(r_{3}-r_{4})-16i\sigma_{1}\sigma_{2} \Big \{ R\left[ \mathfrak{q} {\rm Re}(s_{1+})+ {\rm Im}(p_{1+}) \right]+(R^{2}+\epsilon_{2}){\rm Im}(s_{1+})-2\mathfrak{q}\sigma_{1}R_{1-} \Big\}r_{3}r_{4}\nonu\\ &+2i(\Lambda_{+}\mathfrak{r}_{1}-\Lambda_{-}\mathfrak{r}_{2}), \quad \Gamma=2\big(M\Gamma_{o}- b\chi_{+}\big), \quad \chi=-2\big(Q\Gamma_{o}+2\mathcal{Q}\chi_{+}\big), \quad \Gamma_{o}=R \chi_{-}-2\sigma_{1}\sigma_{2}\chi_{s}+2\chi_{1+},\nonu\\ \Lambda_{\pm}&=\Big(\mathfrak{q} {\rm Re}(s_{1+})+ {\rm Im}(p_{1+})\Big) \Big[ (R \pm c_{\mp})r_{3}-(R\pm c_{\pm})r_{4}\Big]+{\rm Im}(s_{1\pm})\big( R_{\pm}r_{3}-R_{\mp}r_{4} \big), \nonu\\ \mathcal{G}&= 4\sigma_{1}\sigma_{2} \bigg\{ \Big[2R\big({\rm Re}(a)-2|\mathfrak{q}_{o}|^{2}\big) +Q\big(QR(R^{2}-2\epsilon_{1}) +4q_{o}\epsilon_{2} \big)\Big](r_{1}r_{2}-r_{3}r_{4}) +i\big[2R{\rm Im}(a)+Q\xi-4\mathfrak{q}|\mathfrak{q}_{o}|^{2}\big]\nonu\\ &\times (r_{1}-r_{3})(r_{2}-r_{4})+4i\kappa(r_{2}r_{3}+r_{1}r_{4})\bigg\} -2b(R\chi_{-}+2\sigma_{1}\sigma_{2}\chi_{s}),\nonu\\ &-R_{-}\bigg\{2c_{+}\Big[a-2\Big((R-c_{-}+i\mathfrak{q})s_{1-}+p_{1-} \Big) (R-c_{+})\Big] +i\left(Q\xi+4Qb_{o}R_{+} -4\mathfrak{q} |\mathfrak{q}_{o}|^{2}\right)\bigg\}(r_{1}-r_{2})(r_{3}-r_{4}) \nonu\\ &+\sigma_{2}\bigg\{4\Big[ 2\kappa(\Delta+\epsilon_{2}) -(R^{2}+\epsilon_{2}){\rm Re}(a)\Big]r_{4}+\Big[Q(R^{2}-\epsilon_{1})\xi_{1}-2Q\sigma_{1}^{2}\xi_{2} +4(R^{2}+\epsilon_{2})|\mathfrak{q}_{o}|^{2}\Big](r_{3}+r_{4})\bigg\}(r_{1}-r_{2})\nonu\\ &+\sigma_{1}\bigg\{4\Big[ 2\kappa(\Delta-\epsilon_{2})-(R^{2}-\epsilon_{2}){\rm Re}(a)\Big]r_{2} -\Big[Q(R^{2}-\epsilon_{1})\xi_{2}-2Q\sigma_{2}^{2}\xi_{1}-4(R^{2}-\epsilon_{2})|\mathfrak{q}_{o}|^{2} \Big](r_{1}+r_{2})\bigg\}(r_{3}-r_{4}) \nonu\\ &+2M\Big[R^{2}\chi_{+}+2R\chi_{1-}+4\sigma_{1}\sigma_{2}(\chi_{p}-\chi_{2})\Big] -2(Qb+2M\mathcal{Q}) \Big[\sigma_{2}(\overline{\kappa}_{1-}\mathfrak{r}_{1} -\overline{\kappa}_{1+}\mathfrak{r}_{2})+ \sigma_{1}(\overline{\kappa}_{2+}\mathfrak{r}_{3} -\overline{\kappa}_{2-}\mathfrak{r}_{4})\Big]\nonu\\ \mathcal{I}&=A\Big[4\sigma_{1}\sigma_{2}(r_{1}-r_{3})(r_{2}-r_{4})-R_{-}(r_{1}-r_{2})(r_{3}-r_{4})\Big] +\kappa_{2+}\Big[B_{+}(R+c_{+})\mathfrak{r}_{1}-B_{-}(R-c_{-})\mathfrak{r}_{2} \Big]r_{4}\nonu\\ &-\kappa_{2-}\Big[B_{+}(R+c_{-})\mathfrak{r}_{1}-B_{-}(R-c_{+})\mathfrak{r}_{2} \Big]r_{3}-8\sigma_{1}\sigma_{2}\bigg\{\Big[ MR_{1-}\kappa_{1-}-B_{+}(2\mathfrak{q}_{o}R-\epsilon_{2}Q)\Big]r_{3}r_{4}-\kappa(Qb+2M\mathcal{Q})\bigg\}\nonu\\ &+ \Big[Q\big(3R^{2}-2\Delta-2\epsilon_{1}-2i{\rm S}_{1}\big) +4i\mathfrak{q} \mathcal{Q}\Big]\chi_{+}+ 2(3R\mathcal{Q}-2\epsilon_{2}Q)\chi_{-} +4\mathcal{Q}(\chi_{1+}+\sigma_{1}\sigma_{2}\chi_{s}) +4Q(R\chi_{1-}+2\sigma_{1}\sigma_{2}\chi_{p}), \nonu\\ \chi_{\pm}&=\sigma_{2}(s_{1+}\mathfrak{r}_{1}-s_{1-}\mathfrak{r}_{2}) \pm \sigma_{1}(s_{2+} \mathfrak{r}_{3}-s_{2-}\mathfrak{r}_{4}), \quad \chi_{1\pm}=\sigma_{2}(p_{1+}\mathfrak{r}_{1}+p_{1-}\mathfrak{r}_{2}) \pm \sigma_{1}(p_{2+}\mathfrak{r}_{3}+p_{2-}\mathfrak{r}_{4}),\nonu\\ \chi_{2}&=\sigma_{1}(s_{1+}\mathfrak{r}_{1}-s_{1-}\mathfrak{r}_{2}) + \sigma_{2}(s_{2+}\mathfrak{r}_{3}-s_{2-} \mathfrak{r}_{4}),\quad \chi_{p}=p_{1+}\mathfrak{r}_{1}-p_{1-}\mathfrak{r}_{2} + p_{2+}\mathfrak{r}_{3}-p_{2-}\mathfrak{r}_{4}, \quad \kappa=R_{+}R_{-},\nonu\\ \chi_{s}&=s_{1+}\mathfrak{r}_{1}+s_{1-}\mathfrak{r}_{2}+s_{2+}\mathfrak{r}_{3}+s_{2-}\mathfrak{r}_{4}, \quad \xi=Q\Big[ 2M{\rm S}_{2}-\mathfrak{q}(R^{2}-2\Delta+2\epsilon_{1})\Big]-4\Big[ q_{o}{\rm S}_{1}+b_{o}(R^{2}-M^{2}+\mathfrak{q}^{2})\Big],\nonu\\ A&=M\Big[ \big[ 2 \mathcal{Q}+ Q(R-2\sigma_{1})\big]s_{1-}+2Qp_{1-}\Big] +B_{-}\Big[Q\big( R^{2}-\Delta +\epsilon_{2}-i{\rm S}_{1}\big)-2(R+i\mathfrak{q})\mathfrak{q}_{o} \Big], \quad \mathcal{Q}=\mathfrak{q}_{o}+i \mathfrak{q} Q,\nonu\\ B_{\pm}&= [R s_{1\pm} \pm p_{1\pm} +Q \overline{\kappa}_{1\pm}]/M, \quad p_{j\pm}=-2\sigma_{j}(R^{2}-\Delta)\pm i(-1)^{j}\Big[ M{\rm S}_{2}+2b_{o}Q+(R-i(-1)^{j}\mathfrak{q}) {\rm Im}(s_{j\pm})\Big],\nonu\\ s_{j\pm}&=\Delta \mp 2\sigma_{j}R-(-1)^{j}\epsilon_{2}-i\Big[{\rm S}_{1}-\mathfrak{q}(R \mp 2\sigma_{j}) \Big],\quad \kappa_{j \pm}=2\mathfrak{q}_{o}-(-i)^{j} R(Q\pm2\sigma_{j}), \quad \xi_{j}=4q_{o}R-(-1)^{j}Q(R^{2}-4\sigma_{j}^{2}), \nonu\\ a&=2(R+i\mathfrak{q})p_{1+}-s_{1+}\Big[\bar{s}_{2-}-2(R+i\mathfrak{q})(R-c_{-}+i\mathfrak{q})\Big], \quad b=\Big[ \mathfrak{q}{\rm S}_{1}-\epsilon_{2}R-2q_{o}Q+i M\big({\rm S}_{2}-2M\mathfrak{q}\big) \Big]/M, \nonu\\ R_{\pm}&=R^{2}-c_{\pm}^{2}, \quad c_{\pm}=\sigma_{1} \pm \sigma_{2}, \quad \mathfrak{r}_{1,2}=R_{1 \mp}r_{1,2}, \quad \mathfrak{r}_{3,4}=R_{2 \pm}r_{3,4},\quad R_{j\pm}=R^{2}\pm 2\sigma_{j}R-(-1)^{j}\epsilon_{2},\nonu\\ r_{1,2}&=\sqrt{\rho^{2}+(z-R/2 \mp \sigma_{1})^{2}},\quad r_{3,4}=\sqrt{\rho^{2}+(z+R/2 \mp \sigma_{2})^{2}}. \label{Ernst9}\end{align} \end{widetext} \vspace{-0.3cm} \subsection{Two unequal KN sources separated by a massless strut} \vspace{-0.4cm} If we are interested in the description of a BS composed by two KN sources; BHs or hyperextreme sources, therefore, we need to solve first the axis condition in the middle region of the symmetry axis, which reads as \vspace{-0.1cm} \be \omega\Big(\rho=0, {\rm{Re}}(\alpha_{3})<z< {\rm{Re}}(\alpha_{2})\Big)=0.\label{omegamiddle}\ee \vspace{-0.3cm} After placing Eq.\ (\ref{factorizes}) into this condition, eventually it is possible to obtain the following result \vspace{-0.2cm} \begin{widetext} \begin{align} &\mathfrak{q}(R+M)\big[2s_{o}+(R+M)Q^{2}\big]\epsilon_{2}^{2} +2\Big\{ \big[t_{o}s_{o} +\mathfrak{q}^{2}(R+M)(p_{o}-M^{2})\big]{\rm S}_{1} +2\mathfrak{q}q_{o}Q\big[s_{o}-(R+M)p_{o}\big]\Big\}\epsilon_{2}\nonu\\ &-\mathfrak{q}\Big\{2M^{2}(p_{o}{\rm S}_{2}^{2}-2Q^{2}P_{1}P_{2})-\big[ 2t_{o}(R^{2}+MR-\Delta)+\mathfrak{q}^{2}Q^{2}\big] {\rm S}_{1}^{2}\Big\} + 2M^{2}(R^{2}-\Delta)\big[M\mathfrak{q}^{2}+(R+M)(p_{o}+Q^{2})\big]{\rm S}_{2}\nonu\\ &+4q_{o}Q\big[(M^{2}+\mathfrak{q}^{2})p_{o}-t_{o}(R^{2}+MR-\Delta) \big]{\rm S}_{1}+4\mathfrak{q}q_{o}^{2} \big[M^{2}P_{0}-Q^{2}(2p_{o}+Q^{2})\big]+ 4b_{o}M^{2}P_{0}\big[\mathfrak{q}b_{o}+Q(R^{2}-\Delta)\big]\nonu\\ &-M^{2}\mathfrak{q}(2MR+2M^{2}-Q^{2})(R^{2}-\Delta)^{2}=0,\nonu\\ P_{0}&=(R+M)^{2}+\mathfrak{q}^{2}, \quad p_{o}=R^{2}+MR+\mathfrak{q}^{2},\quad s_{o}=M\mathfrak{q}^{2}-(R+M)(R^{2}-\Delta), \quad t_{o}=M^{2}-\mathfrak{q}^{2}+MR. \label{conditionmiddle} \end{align} Despite it has been previously assumed $B=0$ to remove the global magnetic charge, the solution describes itself two unequal sources endowed with identical magnetic charges but carrying opposite signs. The presence of the Dirac string connecting the sources is unavoidable unless both magnetic charges have been completely eliminated. This task may be accomplished when is solved the condition written below \cite{Tomi} \vspace{-0.1cm} \begin{align} &{\rm Re}(\Phi)\Big(\rho=0,z={\rm{Re}}(\alpha_{2i-1})\Big)-{\rm Re}(\Phi)\Big(\rho=0,z={\rm{Re}}(\alpha_{2i})\Big)=0,\nonu\\ i&=1,2, \label{nomagneticcharge}\end{align} \vspace{-0.1cm} \noi and taking into account once again Eq.\ (\ref{factorizes}), the condition killing both magnetic charges and, therefore, the Dirac string, is given by \vspace{-0.1cm} \begin{align} &\mathfrak{q} Q(R+M)^{3}\epsilon_{2}^{2}+(R+M)\Big\{ Q\big[MP_{0}-2\mathfrak{q}^{2}(R+M)\big] {\rm S}_{1}-2\mathfrak{q}q_{o}\big[MP_{0}-2(R+M)Q^{2} \big]\Big\}\epsilon_{2}\nonu\\ &+\mathfrak{q}Q \Big\{ \big[ MP_{0}-(R+M)(2M^{2}+2MR-\mathfrak{q}^{2})\big]{\rm S}_{1}^{2}-4M^{2}(R+M) P_{1}P_{2}\Big\}+M^{2}\big[2\mathfrak{q}P_{0}b_{o}-Q\left(P_{0}-2\mathfrak{q}^{2}\right) (R^{2}-\Delta) \big]{\rm S}_{2}\nonu\\ &-2q_{o}\big[ M(\Delta+M R)P_{0}+2\mathfrak{q}^{2}(R+2M)Q^{2}\big]{\rm S}_{1} -4\mathfrak{q}q_{o}^{2}Q\big[ MP_{0}-(R+M)Q^{2}\big]\nonu\\ &-M^{2}(M\mathfrak{q}^{2}-s_{o}) \big[ 2P_{0}b_{o}+\mathfrak{q} Q(R^{2}-\Delta) \big]=0. \label{conditionnoBcharge} \end{align} \end{widetext} \vspace{-0.1cm} Note that both Eqs.\ (\ref{conditionmiddle}) and (\ref{conditionnoBcharge}) represent a pair of quadratic algebraic equations defined by any of the variables $\epsilon_{2}$, $q_{o}$, $P_{1}$, and $P_{2}$. The easiest solution satisfying Eqs.\ (\ref{conditionmiddle}) and (\ref{conditionnoBcharge}) appears when $\mathfrak{q}=0$, leading us to \vspace{-0.2cm} \be P_{1,2}=-\frac{b_{o}}{M}\Bigg(\frac{(R^{2}-M^{2}+Q^{2})(MR\pm\epsilon_{2}),}{2q_{o}R-\epsilon_{2}Q}\pm Q\Bigg),\ee \vspace{-0.1cm} \noi where the signs $+$ and $-$ are associated to the subscripts $1$ and $2$. In this respect, it represents two unequal counterrotating KN BHs that are apart by a massless strut, which has been considered before in Ref.\ \cite{ICM}. However, regardless of such a trivial case, these two quadratic equations are solved \emph{exactly} in the most general case through the following parametrization: \vspace{-0.1cm} \begin{widetext} \begin{align} \epsilon_{2}&=- \frac{t_{o}{\rm S}_{1}+Mr(R^{2}-\Delta)+2\mathfrak{q} q_{o}Q}{\mathfrak{q}(R+M)},\quad q_{o}=\frac{(M\mathfrak{q}^{2}-s_{o})(\mathfrak{q} \delta_{1}-Qr)- QP_{0}{\rm S}_{1}-\mathfrak{q}^{2}\delta_{1}{\rm S}_{2}}{2\mathfrak{q}P_{0}},\nonu \\ b_{o}&= \frac{(R^{2}-\Delta)(\delta_{1} r-\mathfrak{q} Q)-Q(R+M){\rm S}_{2}}{2P_{0}}, \nonu\\ P_{1,2}&=\Bigg(\frac{s_{o}}{2P_{0}}-\frac{\mathfrak{q}^{2}(R+M)Q^{2}}{4P_{0}^{2}}\Bigg)r -\frac{\mathfrak{q}^{2}(R+M)}{(R^{2}-\Delta)^{2}} \Bigg(\frac{2p_{o}}{P_{0}}+ \frac{\mathfrak{q}^{2}(Q^{2}-\delta_{1}^{2})}{P_{0}^{2}} \Bigg)\frac{J^{2}}{r} + \Bigg(\frac{\mathfrak{q}^{2}Q\delta_{1}}{P_{0}(R^{2}-\Delta)} \mp 1 \Bigg)J\nonu\\ & + \mathfrak{q}\Bigg(M \mp \frac{(M\mathfrak{q}^{2}+s_{o})Q\delta_{1}}{2P_{0}(R^{2}-\Delta)} \Bigg) +\frac{\mathfrak{q}(R+M)}{(R^{2}-\Delta)^{2}}\Bigg[2M\mathfrak{q}^{2}\Bigg(1-\frac{Q^{2}} {P_{0}}\Bigg) + \frac{\mathfrak{q}^{2}(M\mathfrak{q}^{2}+s_{o})(Q^{2}-\delta_{1}^{2})}{P_{0}^{2}} -R(R^{2}-\Delta)\Bigg] \frac{J}{r}\nonu \\ &-\frac{\mathfrak{q}^{2}(R+M)(M\mathfrak{q}^{2}+s_{o})}{4(R^{2}-\Delta)} \Bigg[2M\bigg(1-\frac{Q^{2}}{P_{0}}\bigg) + \frac{(M\mathfrak{q}^{2}+s_{o})(Q^{2}-\delta_{1}^{2})}{P_{0}^{2}} \Bigg]\frac{1}{r}. \label{solution}\end{align} \end{widetext} \vspace{-0.1cm} \noi Due to the fact that in the BS one can interchange the location of its components as well as their physical properties, it is worth noting that our analytical result solving exactly Eqs.\ (\ref{conditionmiddle}) and (\ref{conditionnoBcharge}), accomplishes the conditions $\{P_{1,2},q_{o},b_{o},\epsilon_{1},\epsilon_{2}\} \rightarrow \{-P_{2,1},-q_{o},b_{o},\epsilon_{1},-\epsilon_{2}\}$, under the change $\{J,r\}\rightarrow \{J,-r\}$. Moreover, in the absence of electromagnetic field; i.e., when $Q=0$, $q_{o}=0$, $b_{o}=0$, and \vspace{-0.1cm} \begin{align} J&=M\mathfrak{q}+\frac{(R^{2}-M^{2}+\mathfrak{q}^{2})(\mathfrak{q}-a_{1}-a_{2})}{2(R+M)}, \nonu\\ r&=a_{1}-a_{2},\label{conditionvacuum}\end{align} \vspace{-0.1cm} \noi the above exact solution is reduced to the one earlier studied in Ref.\ \cite{Cabrera2018} for vacuum systems, where $a_{i} \equiv J_{i}/M_{i}$ defines the Komar angular momentum per unit mass of each source. At this point, we would like to remark that our analytical result solving the axis conditions in combination with the absence of individual magnetic charges is quite convenient in the description of BHs and hyperextreme sources (or naked singularities). This statement is supported by the fact that our ansatz satisfying these physical requirements involves the squares of the quantities $\sigma_{1}$ and $\sigma_{2}$ in terms of the remaining parameters. Nonetheless, in the remainder of this paper, we will focus our attention to the BH sector. \vspace{-0.3cm} \section{Thermodynamical and dynamical aspects of the double-KN solution} \vspace{-0.4cm} Because $\sigma_{i}^{2}\geq0$ defines a BH, a more transparent and physical representation of the double-KN solution might be achieved if we are able to entirely express the BH horizons in terms of Komar's parameters. To perform such a task we have at hand the well-known Tomimatsu's formulas for stationary axisymmetric spacetimes in electrovacuum \cite{Tomi,Galtsov} \footnote{The absence of magnetic charges in the BS avoids the contribution of the term $\frac{1}{8\pi}\int_{H_{i}} (A_{3}^{'}A_{3})_{,z}\, d\varphi dz$ in the above Eq.\ (\ref{Tomy}), preserving the conventional Smarr formula for the mass.}, \vspace{-0.1cm} \begin{align} M_{i}&= -\frac{1}{8\pi}\int_{H_{i}} \big[\omega \Psi_{,z}-2(A_{3}^{'}A_{3})_{,z}\big]\, d\varphi dz, \nonu\\ Q_{i}&=\frac{1}{4\pi}\int_{H_{i}}\omega A_{3,z}^{'}\, d\varphi dz, \nonu\\ J_{i}&=-\frac{1}{8\pi}\int_{H_{i}}\omega\left[1+ \frac{\omega \Psi_{,z}}{2} -\tilde{A}_{3}A_{3,z}^{'}-(A_{3}^{'}A_{3})_{,z}\right]d\varphi dz, \label{Tomy} \end{align} \vspace{-0.1cm} \noi with $\tilde{A}_{3}=A_{3}+ \omega A_{4}$ and $\Psi={\rm Im}(\cal{E})$, where the magnetic potential $A_{3}$ is the real part of Kinnersley's potential $\Phi_{2}$ \cite{Kinnersley}, thus having \vspace{-0.1cm} \begin{align} A_{3}&={\rm Re}(\Phi_{2})=-2\mathfrak{q} A_{4}-zA'_{3}+{\rm Im} \bigg(\frac{\mathcal{I}}{\Lambda-\Gamma}\bigg), \nonu\\ \Phi_{2}&=\frac{(2\mathfrak{q}+iz)\chi-i\mathcal{I}}{\Lambda-\Gamma}, \label{Kinnersley} \end{align} \vspace{-0.1cm} \noi where we must bear in mind that $-A_{4}$ and $A'_{3}$ are the real and imaginary components of the Ernst potential $\Phi$, respectively. The integrals shall be evaluated over the BH horizons, which in cylindrical coordinates $(\rho,z)$ are looked as thin rods having a domain inside the intervals $\alpha_{2i}\leq z \leq \alpha_{2i-1}$, \, $i=1,2$. A combination of Eqs.\ (\ref{Tomy}) allows us to prove that each BH satisfies the Smarr formula \cite{Smarr,Tomi} \vspace{-0.1cm} \begin{align} M_{i}&=\sigma_{i}+2\Omega_{i}J_{i}+ \Phi_{i}^{H}Q_{i}=\frac{\kappa_{i}S_{i}}{4\pi}+2\Omega_{i}J_{i}+\Phi_{i}^{H}Q_{i},\nonu\\ i&=1,2. \label{Massformula}\end{align} \vspace{-0.1cm} \noi On one hand $\Omega_{i}$ and $\Phi_{i}^{H}$ are the angular velocity and the electric potential in the rotating frame of the $i \rm {th}$ BH horizon, respectively. On the other hand, $S_{i}$ is the area of the horizon while $\kappa_{i}$ represents the surface gravity. Before deriving the thermodynamical properties contained in the Smarr formula, it is necessary to get first both analytical expressions of the BH horizons as a function of physical Komar parameters. In order to carry out this rather involved assignment, one substitutes Eqs.\ (\ref{factorizes}), (\ref{Ernst9}), (\ref{solution}), and (\ref{Kinnersley}), inside Eq.\ (\ref{Tomy}), to obtain the corresponding masses $M_{i}$ and electric charges $Q_{i}$ for both BHs. The result is \vspace{-0.0cm} \begin{align} M_{1,2}&=\frac{M\pm \delta_{2}}{2},\qquad Q_{1,2}=\frac{Q\pm \delta_{1}}{2},\nonu \\ \delta_{2}&=\frac{(J-M\mathfrak{q})\left[2P_{0}(R^{2}+MR+\mathfrak{q}^{2})+\mathfrak{q}^{2}(Q^{2}-\delta_{1}^{2}) \right]}{r P_{0}(R^{2}-\Delta)}\nonu \\ &+\frac{\mathfrak{q}\left[2MP_{0}+(Q^{2}-\delta_{1}^{2})(R+M)\right]} {2rP_{0}},\label{massesandcharges}\end{align} \vspace{-0.1cm} \noi and it can be noticed that the total mass $M=M_{1}+M_{2}$ and total electric charge $Q=Q_{1}+Q_{2}$, whereas $\delta_{2}=M_{1}-M_{2}$ and $\delta_{1}=Q_{1}-Q_{2}$. In addition, the two angular momenta are given by \vspace{-0.1cm} \begin{align} J_{1}&= \frac{\mathfrak{q}(R^{2}-\Delta)H_{1+}H_{1-}+(J-M\mathfrak{q})\mathcal{P}_{1}} {P_{0}^{2}(R^{2}-\Delta)(M_{1}-M_{2})}, \nonu\\ J_{2}&=\frac{\mathfrak{q}(R^{2}-\Delta)H_{2+}H_{2-} +(J-M\mathfrak{q})\mathcal{P}_{2}} {P_{0}^{2}(R^{2}-\Delta)(M_{2}-M_{1})},\nonu\\ \mathcal{P}_{i}&=H_{i-}C_{i}-(-1)^{i}(M_{1}-M_{2})Q^{2}_{i}P_{0}^{2},\nonu\\ C_{i}&=P_{0}^{2}-2M_{i}(R+M)P_{0}+2\mathfrak{q}^{2} Q_{1}Q_{2},\nonu\\ H_{i\pm}&=M_{i}P_{0}\pm Q_{1}Q_{2}(R+M). \label{angularmomenta}\end{align} \vspace{-0.1cm} \noi whose sum is exactly the total angular momentum of the BS; i.e., $J=J_{1}+J_{2}$. In a similar way like in the vacuum case, the appropriate dynamical law for interacting KN sources with struts can be accomplished via trivial algebraic manipulations on both expressions contained in Eq.\ (\ref{angularmomenta}). This law has the simplified aspect \vspace{-0.1cm} \begin{align} &\mathfrak{q}\mathcal{P}_{0}-J_{1}\mathcal{P}_{2}-J_{2}\mathcal{P}_{1}=0, \nonu\\ &\mathcal{P}_{0}=M\mathcal{P}_{1}-(R^{2}-\Delta)H_{1+}H_{1-}\nonu\\ &\equiv M\mathcal{P}_{2}-(R^{2}-\Delta)H_{2+}H_{2-}. \label{condition}\end{align} \vspace{-0.1cm} After combining the above set of Eqs.\ (\ref{massesandcharges}) and (\ref{angularmomenta}) it can be doable to get two relations that completely characterize the exact result given by Eq.\ (\ref{solution}) in terms of arbitrary physical Komar parameters, namely \vspace{-0.1cm} \begin{align} J&=M \mathfrak{q}+\frac{2(R^{2}-\Delta)N_{1}}{\mathcal{P}_{1}+\mathcal{P}_{2}-MP_{0}^{2}(R^{2}-\Delta)}, \nonu\\ r&=\frac{2P_{0}N_{2}}{M(\mathcal{P}_{1}+\mathcal{P}_{2})-(M_{1}-M_{2})^{2}P_{0}^{2}(R^{2}-\Delta)},\nonu\\ N_{1}&=M_{1}M_{2}P_{0}^{2}(\mathfrak{q}-a_{1}-a_{2})+\mathfrak{q}Q_{1}^{2} Q_{2}^{2}(R+M)^{2},\nonu\\ N_{2}&= M_{1}M_{2} (C_{1}+C_{2})(a_{1}-a_{2})-\mathfrak{q}\Big[Q(M_{2}Q_{1}-M_{1}Q_{2})\nonu\\ &\times (H_{1+}+H_{2+})-(M_{1}-M_{2})Q_{1}Q_{2}RP_{0}\Big], \label{conditionparameters}\end{align} \vspace{-0.1cm} \noi where it is observed that after placing $Q_{1}=Q_{2}=0$ into Eq.\ (\ref{conditionparameters}), it brings us immediately the aforementioned Eq.\ (\ref{conditionvacuum}), which describes vacuum systems \cite{Cabrera2018}. Moreover, by using these two expressions contained above for $J$ and $r$, the algebraic quantities $P_{1}$ and $P_{2}$ can be written down in a more compact form \vspace{-0.1cm} \begin{align} P_{1,2}&=\frac{(2H_{2}A_{2}-RP_{0}\mathcal{P}_{2})J_{1}-(2H_{1}A_{1}-RP_{0}\mathcal{P}_{1})J_{2}}{2P_{0}\mathcal{P}_{0}} \nonu\\ &\pm (M\mathfrak{q}-J),\nonu\\ A_{i}&=\mathcal{P}_{i}-(R^{2}-\Delta)H_{i+}P_{0}, \nonu\\ H_{i}&=M_{i}P_{0}-Q_{i}Q(R+M), \label{simplePx}\end{align} \vspace{-0.1cm} \noi while the electric and magnetic dipole moments are reduced to \vspace{-0.1cm} \begin{widetext} \begin{align} Q_{o}&=\frac{2\mathfrak{q} (Q_{1}J_{2}-Q_{2}J_{1})}{P_{0}}+\frac{1}{2} Q_{1}(R-2M_{2})-\frac{1}{2} Q_{2}(R-2M_{1}),\nonu\\ B_{o}&=\mathfrak{q} Q+\Bigg[(Q_{1}C_{2}-Q_{2}C_{1})\bigg(\frac{J_{1}}{\mathcal{P}_{1}}-\frac{J_{2}}{\mathcal{P}_{2}}\bigg) -\frac{\mathfrak{q}}{P_{0}}\Bigg(Q -\frac{Q_{1}H_{1+}\big[Q_{1}(Q_{1}-Q_{2})P_{0}-2(R+M)H_{1-}\big]} {\mathcal{P}_{1}} \nonu\\ &-\frac{Q_{2}H_{2+}\big[Q_{2}(Q_{2}-Q_{1})P_{0}-2(R+M)H_{2-}\big]}{\mathcal{P}_{2}} \Bigg) \Bigg] \frac{(R^{2}-\Delta)}{2}. \label{simpleQx}\end{align} \end{widetext} \vspace{-0.1cm} Finally, as a result of combining Eqs.\ (\ref{factorizes}), (\ref{solution}), (\ref{condition}), and (\ref{conditionparameters}), together with a few non-trivial efforts, the explicit formula for both unequal BH horizons $\sigma_{i}$ in a physical representation are \vspace{-0.1cm} \begin{align} \sigma_{i}&=\sqrt{D_{i}-J_{i}\left( \frac{J_{i}G_{i}-2\mathfrak{q}A_{i}B_{i}}{P_{0}^{2}\mathcal{P}_{i}^{2}}\right)},\nonu\\ D_{i}&=M_{i}^{2}- Q_{i}^{2}F_{i}-2(-1)^{i}Q_{i}F_{0}, \nonu\\ G_{i}&=\left[2(R+M)\mathcal{P}_{i}+P_{0}(R^{2}-\Delta)C_{i}\right]^{2}-4P_{0}\mathcal{P}_{1}\mathcal{P}_{2},\nonu\\ F_{0}&=\frac{M_{2}Q_{1}-M_{1}Q_{2}}{R+M} \bigg( 1-\frac{\mathfrak{q}^{2}}{P_{0}}\bigg), \nonu\\ F_{i}&=1-\frac{Q_{i}^{2}\mathfrak{q}^{2}}{P_{0}^{2}} \bigg(1-\frac{A_{i}^{2}}{\mathcal{P}_{i}^{2}}\bigg)+\frac{Q^{2}\mathfrak{q}^{2}}{P_{0}^{2}},\nonu\\ B_{i}&=Q_{i}^{2}P_{0}(R^{2}-\Delta)C_{i}-2H_{i}\mathcal{P}_{i}, \quad i=1,2.\label{sigmas}\end{align} \vspace{-0.1cm} We observe that the above expressions contained in Eq.\ (\ref{sigmas}) acquire a symmetric character since both horizons can be obtained from each other under the change of their constituents; i.e., $\sigma_{2}=\sigma_{1(1\leftrightarrow2)}$. In the absence of electromagnetic field, the horizons adopt the simplified form \cite{Cabrera2018} \vspace{-0.1cm} \begin{align} \sigma_{1}&=\sqrt{M_{1}^{2}-a_{1}^{2}+\gamma_{12}},\qquad \sigma_{2}=\sqrt{M_{2}^{2}-a_{2}^{2}+\gamma_{21}},\nonu\\ \gamma_{12}&=4a_{1}M_{2}\frac{a_{1}M_{2}\mathfrak{q}^{2}+ [M_{1}(\mathfrak{q}+a_{1}-a_{2})+a_{1}R]P_{0}} {P_{0}^{2}},\nonu\\ \gamma_{21}&=4a_{2}M_{1}\frac{a_{2}M_{1}\mathfrak{q}^{2}+ [M_{2}(\mathfrak{q}-a_{1}+a_{2})+a_{2}R]P_{0}} {P_{0}^{2}}, \label{sigmasvacuum}\end{align} \vspace{-0.1cm} \noi where the physical parameters $\{M_{1},M_{2},J_{i},J_{2},R\}$ are related to each other via a cubic equation \vspace{-0.1cm} \begin{align} &\mathfrak{q} P_{0}-a_{1}p_{1}-a_{2}p_{2}=0, \nonu\\ p_{1}&=(R+M_{1})^{2}-M_{2}^{2}+\mathfrak{q}^{2}, \nonu\\ p_{2}&=(R+M_{2})^{2}-M_{1}^{2}+\mathfrak{q}^{2}. \label{conditionvacuumII}\end{align} \vspace{-0.1cm} The reader should be aware that this last equation is nothing less than Eq.\ (\ref{conditionvacuum}), which has been differently written; it represents the non-electrically charged version of Eq.\ (\ref{condition}). Actually, it should be pointed out that unlike the vacuum case, the dynamical law Eq.\ (\ref{condition}) does not give us the opportunity to express the BH horizons in terms of the seven physical parameters $\{M_{1},M_{2},Q_{1},Q_{2},J_{i},J_{2},R\}$ in a explicit form, because it corresponds to a seventh-degree equation in terms of the variable $\mathfrak{q}$, therefore, one must make use of numerical analysis. Furthermore, in the lack of rotation; i.e., $\mathfrak{q}=0$ and $J_{1}=J_{2}=0$, there exists no dynamical law and the horizons become electrostatics; both are given by \cite{VCH} \vspace{-0.1cm} \begin{align} \sigma_{i}&=\sqrt{M_{i}^{2}- Q_{i}^{2}-2(-1)^{i}Q_{i}\frac{M_{2}Q_{1}-M_{1}Q_{2}}{R+M_{1}+M_{2}}}, \nonu\\ i&=1,2. \label{VarzChist} \end{align} \vspace{-0.1cm} Once we already know the functional form of $\sigma_{1}$ and $\sigma_{2}$, our experience acquired in the vacuum scenario \cite{Cabrera2018}, suggests us that it might be possible to determine simple expressions for the thermodynamical characteristics of the BS displayed in the Smarr formula Eq.\ (\ref{Massformula}), indeed this will be the case, as we shall see next. First of all, we have that the area of the horizon and surface gravity can be computed via the formulas \cite{Tomi,Carter} \vspace{-0.1cm} \be S_{i}=\frac{4\pi \sigma_{i}}{\kappa_{i}}, \qquad \kappa_{i}= \sqrt{-\Omega_{i}^{2}e^{-2\gamma^{H_{i}}}},\ee \vspace{-0.1cm} \noi where $\Omega_{i}= \omega_{i}^{-1}$. Reminding that $\omega_{i}$ and $\gamma^{H_{i}}$ are the constant values that metric functions $\omega$ and $\gamma$ take on the axis part denoting the horizon $H_{i}$. Secondly, the electric potential $\Phi_{i}^{H}$ can be obtained in a straightforward manner by using the Smarr formula Eq.\ (\ref{Massformula}). Cumbersome calculations permits us to determine the following concise results \vspace{-0.1cm} \begin{align} \Omega_{i}&= \frac{\mathfrak{q} A_{i}}{P_{0}\mathcal{P}_{i}} + \frac{J_{i}P_{0}^{3}\mathcal{P}_{i}(R^{2}-\Delta) \Big[(R+\sigma_{i})^{2}-\sigma_{j}^{2}\Big]}{\mathcal{P}_{i}^{2}\mathcal{N}_{i}^{2}+ P_{0}^{2}(R^{2}-\Delta)^{2}\mathcal{M}_{i}^{2}}, \nonu\\ \frac{S_{i}}{4\pi}&= \frac{\mathcal{P}_{i}^{2}\mathcal{N}_{i}^{2}+ P_{0}^{2}(R^{2}-\Delta)^{2}\mathcal{M}_{i}^{2}}{P_{0}\mathcal{P}_{i}^{2} \left[(R+\sigma_{i})^{2}-\sigma_{j}^{2}\right]}, \nonu\\ \Phi_{i}^{H}&= \frac{M_{i}-\sigma_{i}-2\Omega_{i}J_{i}}{Q_{i}},\nonu\\ \mathcal{N}_{i}&=P_{0}(M_{i}+\sigma_{i})-2\mathfrak{q}J_{i}-Q_{i}Q(R+M),\nonu\\ \mathcal{M}_{i}&=J_{i}C_{i}+\mathfrak{q}Q_{i}^{2}H_{i+},\qquad i,j=1,2, \quad i \neq j. \label{Horizonproperties}\end{align} \vspace{-0.1cm} Then we have that for a binary KN BH configuration, the peculiar aspect of the formula for angular velocity reveals a natural mechanism to better interpret the induced angular velocity in a source that has lost its own angular momentum. For instance, if we assume that this is case for the second BH, then $J_{2}=0$, and its non zero angular velocity is \vspace{-0.1cm} \begin{align} \Omega_{2}&=\frac{\mathfrak{q} A_{2}}{P_{0}\mathcal{P}_{2}}\equiv \frac{J_{1}A_{2}}{P_{0}\mathcal{P}_{0}}, \label{velocityind}\end{align} \vspace{-0.1cm} \noi where it has been used the relation Eq.\ (\ref{condition}) with $J_{2}=0$, to express Eq.\ (\ref{velocityind}) in two different ways. It follows that in this particular configuration the two BH horizons read \vspace{-0.2cm} \begin{align} \sigma_{1}&=\sqrt{D_{1}-\mathfrak{q}^{2}\mathcal{P}_{0}\left( \frac{\mathcal{P}_{0}G_{1}-2A_{1}B_{1}\mathcal{P}_{2}}{P_{0}^{2}\mathcal{P}_{1}^{2}\mathcal{P}_{2}^{2}}\right)},\nonu\\ \sigma_{2}&=\sqrt{D_{2}}.\label{sigmasII}\end{align} \vspace{-0.1cm} \noi where $D_{i}$ is defined in Eq.\ (\ref{sigmas}). It is quite evident how the first BH induces rotation to the second one via the parameter $\mathfrak{q}$, where it should be observed that the second BH horizon does not remain purely electrostatic [see Eq.\ (\ref{VarzChist})] due to its interaction with the first rotating BH. Somehow the induced rotation on the second BH is hidden by its own electric charge. A similar description for the induction of electric charge can be added too, if we suppose now that $Q_{2}=0$, after considering a careful calculation, the non zero electric potential $\Phi_{2}^{H}$ acquires the simple aspect \vspace{-0.2cm} \begin{align} \Phi_{2}^{H}&=\frac{Q_{1}(R+M)}{P_{0}}, \label{inducedpotential}\end{align} \vspace{-0.1cm} \noi and the induction of electric charge from the first BH to the second one is restricted to solve for $\mathfrak{q}$ the next cubic equation \vspace{-0.1cm} \begin{align} M_{1}\big(\mathfrak{q}P_{0}-a_{1}p_{1}-a_{2}p_{2}\big)\nonu\\ -Q_{1}^{2}\big[M_{2}\mathfrak{q}+(M_{1}-M_{2})a_{2}\big]=0, \label{relacionnocharge}\end{align} \vspace{-0.1cm} \noi which arises directly from Eq.\ (\ref{condition}) once is fixed $Q_{2}=0$. Thus having the following BH horizons \vspace{-0.1cm} \begin{widetext} \begin{align} \sigma_{1}&=\sqrt{M_{i}^{2}- Q_{1}^{2}\left(\frac{p_{1}}{P_{0}}+\frac{Q_{1}^{2}\mathfrak{q}^{2}a_{0}^{2}}{P_{0}^{2}c_{0}^{2}}\right) -J_{1}\left(\frac{J_{1}g_{1}-2\mathfrak{q}a_{0}b_{1}}{P_{0}^{2}c_{0}^{2}}\right)},\quad \sigma_{2}=\sqrt{M_{2}^{2}-a_{2}^{2}\left(1+\frac{Q_{1}^{2}\big(2p_{2}+Q_{1}^{2}\big)}{P_{0}^{2}}\right)+\gamma_{21}},\nonu\\ g_{1}&=p_{1}\Big[p_{1}\big(p_{2}+Q_{1}^{2}\big)^{2}-4M_{2}P_{0}c_{0}\Big], \quad a_{0}=c_{0}-M_{1}\big(R^{2}-\Delta_{1}\big),\quad b_{1}= Q_{1}^{2}\big(R^{2}-\Delta_{1}\big)p_{2}-2c_{0}h_{1}, \nonu\\ c_{0}&=M_{1}p_{2}+(M_{1}-M_{2})Q_{1}^{2}, \quad h_{1}= M_{1}P_{0}-Q_{1}^{2}(R+M),\quad \Delta_{1}=M^{2}-Q_{1}^{2}-\mathfrak{q}^{2}, \label{sigmaselectro} \end{align} \end{widetext} \vspace{-0.1cm} Another physical property of these configurations is the interaction force related to the conical singularity, which is understood as a measure of how much pressure each source is feeling during the dynamical interaction, where the strut prevents both sources from collapsing over each other. In order to calculate the force we use the formula $\mathcal{F}=(e^{-\gamma_{s}}-1)/4$ \cite{Israel,Weinstein}, where $\gamma_{s}$ defines the constant value that metric function $\gamma$ takes on the region of the strut. The force in the electrovacuum case, after a lengthy algebraic procedure with the aid of Eqs.\ (\ref{condition}) and (\ref{sigmas}) assumes the final form \vspace{-0.1cm} \begin{align} \mathcal{F}&=\frac{\mathcal{N}_{0}}{P_{0}^{3}(R^{2}-M^{2}+Q^{2}+\mathfrak{q}^{2})}, \nonu\\ \mathcal{N}_{0}&=(M_{1}M_{2}P_{0}^{2}-\mathfrak{q}^{2}Q_{1}^{2}Q_{2}^{2})\left[(R+M)^{2} -\mathfrak{q}^{2}\right]\nonu\\ &-(Q_{1}-F_{0})(Q_{2}+F_{0})P_{0}^{3} +\mathfrak{q}^{2}\Big\{(M_{1}Q_{2}-M_{2}Q_{1})^{2}P_{0}\nonu\\ +&Q_{1}Q_{2}\left[ 2(R^{2}+MR+\mathfrak{q}^{2})P_{0}+(P_{0}+Q_{1}Q_{2})Q^{2}\right] \Big\}. \label{force} \end{align} \vspace{-0.1cm} The expression of the force offers relevant information to define the limits of the interaction distance between the BHs. For instance, the minimal distance at which both horizons are touching each other (the ML) is reached when the force tends to its maximum value; i.e., $\mathcal{F} \rightarrow \infty$, and this is possible only if the denominator is equal to zero. Hence, one may conclude that the distance $R\equiv R_{0}=\sqrt{M^{2}-Q^{2}-\mathfrak{q}^{2}}= \sigma_{1}+\sigma_{2}$ defines the ML, while on the other hand, from Eq.\ (\ref{conditionparameters}) one gets the value $\mathfrak{q}=J/M$. Surprisingly, in the ML it can be possible to obtain very simple formulas for $\Omega_{i}$, $\Phi_{i}^{H}$, $\kappa_{i}$, and $S_{i}$, which are given by \vspace{-0.1cm} \begin{align} \Omega_{i}&=\frac{J/M}{d_{0}},\qquad \Phi_{i}^{H}=\frac{Q(R_{0}+M)}{d_{0}}, \nonu\\ \frac{S_{i}}{4\pi}&=\frac{\sigma_{i}}{\kappa_{i}}=\frac{d_{0}\sigma_{i}}{R_{0}},\qquad d_{0}=\big(R_{0}+M\big)^{2}+\big(J/M\big)^{2},\nonu\\ R_{0}&=\sqrt{M^{2}-Q^{2}-(J/M)^{2}}, \label{HorizonpropertiesII}\end{align} \vspace{-0.1cm} \noi whereas the final values of the BH horizons at this limit are eventually simplified as \vspace{-0.2cm} \be \sigma_{i}=M_{i}-\frac{Q_{i}Q(R_{0}+M)+2J_{i}(J/M)}{d_{0}}. \label{Smarrfusion}\ee \vspace{-0.1cm} \noi Notice that Eq.\ (\ref{Smarrfusion}) is nothing less than the Smarr formula for the mass, which still holds in the ML. As a matter of fact, both BHs acquire the same final value on their thermodynamical properties at this limit. The extreme case for BHs $(\sigma_{i}=0)$ during the ML can be also considered here; it emerges after setting $R_{0}=0$ in Eq.\ (\ref{Smarrfusion}), where both angular momenta $J_{i}$ satisfying such a condition have the form \vspace{-0.1cm} \begin{align} J_{i}&=M_{1}\sqrt{M^{2}-Q^{2}}-\frac{Q(M_{2}Q_{1}-M_{1}Q_{2})} {2\sqrt{M^{2}-Q^{2}}}, \nonu \\ J_{2}&=M_{2}\sqrt{M^{2}-Q^{2}}+\frac{Q(M_{2}Q_{1}-M_{1}Q_{2})} {2\sqrt{M^{2}-Q^{2}}},\end{align} \vspace{-0.1cm} \noi and it follows that the sum is recovering the well-known expression for extreme KN BHs, namely \vspace{-0.1cm} \be J_{1}+J_{2}=(M_{1}+M_{2})\sqrt{(M_{1}+M_{2})^{2}-(Q_{1}+Q_{2})^{2}}. \label{extremerelation} \ee \vspace{-0.1cm} Thus, we have that the merger process is producing one single extreme KN BH of mass $M=M_{1}+M_{2}$, angular momentum $J=J_{1}+J_{2}$, and total electric charge $Q=Q_{1}+Q_{2}$. On the other hand, with the aim to gain more insight on how the sources are affecting to each other at large distances it is necessary to observe the asymptotic behavior of the interaction force when $R \rightarrow \infty$, therefore, we use Eqs.\ (\ref{condition}) and (\ref{force}) to obtain \vspace{-0.1cm} \begin{align} \mathcal{F}&\simeq\frac{M_{1}M_{2}-Q_{1}Q_{2}}{R^{2}} \Bigg[1+\frac{M^{2} -Q^{2}-3(a_{1}+a_{2})^{2}}{R^{2}} \nonu\\ &-\frac{M_{2}Q_{1}-M_{1}Q_{2}}{M_{1}M_{2}-Q_{1}Q_{2}}\Bigg(\frac{Q_{1} -Q_{2}}{R} \nonu\\ &-\frac{2(M_{2}Q_{1}-M_{1}Q_{2})+M_{1}Q_{1}-M_{2}Q_{2}}{R^{2}}\Bigg)\nonu\\ &+ O \left(\frac{1}{R^{3}} \right)\Bigg],\label{asymptoticforce} \end{align} \vspace{-0.1cm} \noi and since $\mathfrak{q} \rightarrow a_{1}+a_{2}$ when the sources are far away from each other, one may recover from Eq.\ (\ref{sigmas}) the formula $\sigma_{i}=\sqrt{M_{i}^{2}-Q_{i}^{2}-J_{i}^{2}/M_{i}^{2}}$ representing a single KN BH. It is pretty much clear that expression Eq.\ (\ref{asymptoticforce}) extends the formula of Dietz and Hoenselaers \cite{DH} that describes the spin-spin interaction at large distances, which is recovered after killing the contribution of both electric charges. Finally, we are going to discuss the physical scenario in which the strut is removed, where is crucial to impose the condition $\mathcal{F}=0$. In this circumstance the numerator of $\mathcal{F}$ defines a bicubic equation in terms of the variable $\mathfrak{q}$ that assumes the form \vspace{-0.1cm} \begin{align} &\mathfrak{q}^{6}+3A_{1}\mathfrak{q}^{4}+3A_{2}\mathfrak{q}^{2}+A_{3}=0,\nonu\\ A_{1}&= \frac{(R+M)^{2}\mu_{+}-Q_{1}Q_{2}\Big[2R(R+M)+Q^{2}+Q_{1}Q_{2}\Big]}{3(M_{1}M_{2}-Q_{1}Q_{2})}, \nonu\\ A_{2}&=(R+M)^{2}\bigg(A_{1}-\frac{(R+M)^{2}}{3}\bigg)\nonu\\ &-\frac{(R+M)^{2}\Big((R+M)^{2}\mu_{-}-2Q_{1}^{2}Q_{2}^{2}\Big)+Q_{1}^{2}Q_{2}^{2}Q^{2}} {3(M_{1}M_{2}-Q_{1}Q_{2})}, \nonu\\ A_{3}&=-\frac{(R+M)^{6}\mu_{-}}{M_{1}M_{2}-Q_{1}Q_{2}}, \nonu\\ \mu_{\pm}&= M_{1}M_{2}\pm \bigg(Q_{1}-\frac{M_{2}Q_{1}-M_{1}Q_{2}}{R+M_{1}+M_{2}}\bigg) \nonu\\ &\times \bigg(Q_{2}+ \frac{M_{2}Q_{1}-M_{1}Q_{2}}{R+M_{1}+M_{2}}\bigg), \label{nostrut} \end{align} \vspace{-0.1cm} \noi where fortunately this bicubic equation can be solved analytically. Before giving its explicit solution, let us show that if any of the electric charges is set to zero, for instance $Q_{2}=0$, this equation together with Eq.\ (\ref{condition}) satisfy the following result \vspace{-0.1cm} \begin{align} &J_{1}+J_{2}+R\bigg(\frac{J_{1}}{M_{1}}+\frac{J_{2}}{M_{2}}\bigg)-(R+M_{1}+M_{2})\mathfrak{q}=0, \nonu\\ \mathfrak{q}&=-\epsilon\sqrt{(R+M_{1}+M_{2})^{2}-\frac{Q_{1}^{2}(R+M_{2})}{M_{1}}}, \nonu\\ \epsilon &= \pm 1, \label{nostrutI} \end{align} \vspace{-0.1cm} \noi and $Q_{1}=0$ leads to the equilibrium law for vacuum systems \cite{MankoRuiz}. The case concerning unequal counterrotating KN binary BHs \cite{ICM} that is obtainable from Eqs.\ (\ref{condition}) and (\ref{nostrut}) by fixing $\mathfrak{q}=0$, is another special case, which permits an explicit relation between the physical parameters, namely \vspace{-0.1cm} \begin{align} M_{1}M_{2}&- \bigg(Q_{1}-\frac{M_{2}Q_{1}-M_{1}Q_{2}}{R+M_{1}+M_{2}}\bigg) \nonu\\ &\times \bigg(Q_{2}+ \frac{M_{2}Q_{1}-M_{1}Q_{2}}{R+M_{1}+M_{2}}\bigg)=0, \nonu\\ &J_{1}+J_{2}+R\bigg(\frac{J_{1}}{M_{1}}+\frac{J_{2}}{M_{2}}\bigg)=0, \label{nostrutII} \end{align} \vspace{-0.1cm} \noi where in the lack of rotation it is reduced to the static relation first discovered in \cite{Alekseev}. Nevertheless, the most general case that solves Eq.\ (\ref{nostrut}), and gives the chance to balance the sources once the strut has been eliminated turns out to be \vspace{-0.1cm} \begin{align} \mathfrak{q}^{2}_{(k)}&= -A_{1} + e^{i 2\pi k/3}\big[\mathfrak{b}_{o}+ \sqrt{\mathfrak{b}_{o}^{2}-\mathfrak{a}_{o}^{3}}\big]^{1/3} \nonu\\ &+ e^{-i 2\pi k/3}\mathfrak{a}_{o} \big[\mathfrak{b}_{o} + \sqrt{\mathfrak{b}_{o}^{2}-\mathfrak{a}_{o}^{3}}\big]^{-1/3}, \quad \mathfrak{a}_{o}=A_{1}^{2}-A_{2},\nonu\\ \mathfrak{b}_{o}&=(1/2)\big[3A_{1}A_{2}-A_{3}-2A_{1}^{3}\big], \quad k=0,1,2. \label{theq} \end{align} \vspace{-0.1cm} \begin{figure}[ht] \begin{minipage}{0.49\linewidth} \centering \includegraphics[width=4.3cm,height=4.5cm]{F10.eps} \end{minipage} \begin{minipage}{0.49\linewidth} \centering \includegraphics[width=4.3cm,height=4.5cm]{F20.eps} \end{minipage}\vspace{0.1cm} \begin{minipage}{0.49\linewidth} \centering \includegraphics[width=4.3cm,height=4.5cm]{F30.eps} \end{minipage} \begin{minipage}{0.49\linewidth} \centering \includegraphics[width=4.3cm,height=4.5cm]{F40.eps} \end{minipage} \vspace{-0.1cm} \caption{The stationary limit surfaces $(f=0)$ of the BS in the presence of the strut for the values $M=1$, $M=2$, $a_{1}=0.9$, $a_{2}=2.507$, $Q_{1}=1.2$, $Q_{2}=0.5$, and various distances $R$; (a) $R=2.45$, (b) $R=2.439$, (c) $R=1.4913$ (the ML). (d) During the merger process at $R=0.0047$, the first BH tends to increase its rotation acquiring the value $a_{1}=2.4$ in order to compensate the repulsion of the second one, establishing an equilibrium state with no strut in between BHs, where the new source agrees with the condition $M^{2}-Q^{2}-(J/M)^{2}\geq 0$.} \label{MPI}\end{figure} \vspace{-0.2cm} \begin{table}[ht] \begin{tabular}{c c c c c c c} \hline \hline $\sigma_{1}$&$\sigma_{2}$&$ a_{1}$ & $a_{2}$ & $Q_{1}$& $R$ & $\mathfrak{q}$ \\ \hline 0.1872 & 0.2023 & 2.4 & 2.507 & 1.2 & 0.0047 & 2.4756 \\ 0.1815 & 0.2321 & 1.1 & -2.79 & 2.1 & 0.0310 & -1.4949 \\ 0.7914 & 0.3917 & 0.7 & 4.180 & -0.2 & 0.0896 & 3.0727 \\ 1.2300 & 0.9676 & 0.7 &-4.890 & -0.2 & 0.0685 &-3.0520 \\ 0.4265 & 0.1316 & 1.2 & 3.476 & 0.8 & 0.0567 & 2.7571 \\ 0.9666 & 0.2492 & -0.9 & 4.8 & -1.5 & 0.1557 & 2.9416 \\ \hline \hline \end{tabular} \centering \vspace{-0.2cm} \caption{Equilibrium states fixing the values $M_{1}=1$, $M_{2}=2$, and $Q_{2}=0.5$. } \label{table1} \end{table} \vspace{-0.1cm} In the search for equilibrium configurations in which the condition $\mathcal{F}=0$ is satisfied, similarly to the vacuum scheme \cite{Cabrera2018}, we have not been able to find equilibrium states before the BHs reach the merger limit (at the distance $R_{0}=\sqrt{M^{2}-Q^{2}-(J/M)^{2}}$), except during the merger process. This laborious task has been done for a wide range of numerical values. In Table \ref{table1} are displayed several numerical values fulfilling equilibrium states during the merger process where the first and second sets of values define a source that apparently can be seen as a BH since it satisfies the condition $M^{2}-Q^{2}-(J/M)^{2}\geq 0$ [see Fig.\ \ref{MPI}(d)]. Moreover, in the remaining sets of values, such a condition is negative and therefore the newly formed source cannot be considered a BH due to the appearance of closed timelike curves (CTC). The CTC are contained within the region defined by $g_{\varphi \varphi} \equiv \rho^{2}f^{-1}-f\omega^{2}<0$ as shown in Fig.\ \ref{MPII}. This result agrees with the description that the CTC region of a KN BH must be always contained inside the event horizon \cite{Bonnor}. \vspace{-0.1cm} \begin{figure}[ht] \begin{minipage}{0.49\linewidth} \centering \includegraphics[width=4.3cm,height=4.5cm]{F50.eps} \end{minipage} \begin{minipage}{0.49\linewidth} \centering \includegraphics[width=4.3cm,height=4.5cm]{F60.eps} \end{minipage} \vspace{-0.1cm} \caption{Appearance of CTC during the merger process in the absence of a strut, for the values $M=1$, $M=2$, $Q_{1}=-0.2$, $Q_{2}=0.5$, $a_{1}=0.7$ and (a) $a_{2}=4.180$, $R=0.0896$, (b) $a_{2}=-4.890$, $R=0.0685$. The condition $M^{2}-Q^{2}-(J/M)^{2}<0$ holds in both cases.} \label{MPII}\end{figure} \vspace{-0.3cm} \section{Summary and outlook} \vspace{-0.4cm} In this paper we have reported the most general exact model that permits a description of two unequal interacting KN BHs separated by a massless strut in stationary axisymmetric spacetimes. First of all, the conditions on the axis and the one eliminating both magnetic charges were established and solved analytically through an appropriate parametrization that eventually allowed us the derivation of non-trivial formulas for the half-length horizons $\sigma_{i}$, as a function of seven arbitrary physical parameters of the system $\{M_{i},J_{i},Q_{i},R\}$, $i=1,2$. As a matter of fact, such formulas are generalizations of the vacuum problem \cite{Cabrera2018} and the electrostatic one \cite{VCH}, where also other simpler rotating models endowed with electric charges can be trivially found \cite{CCHV,ICM}. Subsequently, the whole thermodynamical characteristics of the BS have been also depicted by very concise expressions. It is noteworthy that in the same manner as in the vacuum scenario \cite{Cabrera2018}, there exists a dynamical law for interacting KN BHs with struts, which is now defined by a septic algebraic equation. Unfortunately, there is no chance to solve analytically this higher degree equation, however, it has been quite helpful in better understanding the physical limits of the solution. The well-known equilibrium cases with no strut \cite{MankoRuiz,Alekseev} can be directly derived from this higher degree equation. On the other hand, the strut can be eliminated during the merging process, where unlike the vacuum case, apparently the new source that has been created is a BH, which is also free of some pathologies like CTC. We believe that this novel result opens new expectations in further studies with an astrophysical meaning. For instance, it would be plausible to consider the study of the induction of rotation or charge from one BH to another, within the framework of the well-known Penrose energy extraction process \cite{Penrose}. The extension of the binary model to include unequal magnetic charges on each KN BH, and thus define a rotating dyonic binary BH system it might be possible to achieve once a duality rotation procedure a la Carter \cite{Carter} is applied \cite{Cabrera2020}. However, even though it seems quite trivial to achieve this goal when electrical charges are identical, in the unequal case this problem can be hard to deal with. We expect to consider this and other issues related to interacting binary BHs in the future. \vspace{-0.6cm} \section*{Acknowledgements} \vspace{-0.4cm} The author acknowledges the financial support of SNI-CONACyT, M\'exico, grant with CVU No. 173252.
\section*{Supplemental Material} \label{Sec:materials and methods} \subsection{Experimental setup} \label{Sec:setup} A sketch of the experimental setup is displayed in \Fig{setup}. We induce the nucleation and growth of water droplets on a rigid substrate (sample), inside a condensation chamber (6$\times$5$\times$4~cm). The sample is placed in direct contact with a 4-mm thick aluminium plate-fin 6$\times$5~cm. The plate is positioned on top of a 12~V fan, and acts like a heat sink. The temperature control of the condensation substrate is realized by controlling the temperature of the aluminium plate with a computer-regulated feedback mechanism. To this aim, a thermistor (NTC 30~k$\Omega$, Amphenol Advanced Sensors) measures the temperature of the plate and sends the signal to a PID controller, programmed on an Arduino microcontroller. Both the thermistor and the fan are connected to the PID controller. The PID controller compares the measured temperature of the plate, $T_{p}$, with the desired temperature, $T_p^*$, and varies the speed of the fan, until $T_{p}=T_p^*\pm0.1\ensuremath{^{\circ}\text{C}}$. To guarantee a constant water deposition rate, the sample is placed inside a humidity chamber. A constant flux of saturated vapour is introduced through two openings on opposite sides of the chamber. To generate such a flux, a pump (Tetra APS50 Air Pump) insufflates a constant air flux at the bottom of a deionized water column (5~cm diameter $\times$ 50 cm height). The air bubbles raise through the column collecting saturated vapour. From the top of the column, they are conveyed into a second column, repeating the process. The humidity of the vapour flux at the exit of the second column is measured with a humidity sensor (393 - AM2302 Digital Temperature and Humidity Sensor, 5V, Adafruit), connected to a second Arduino microcontroller. The vapour flux is turned on before lowering the temperature of the plate. Within few seconds, the humidity increases up to the point where it reaches full saturation (100\%) and the measure (which has a precision higher than 0.01\%) does not change anymore. All our experiments are done in full saturation conditions of the air flux (100\% humidity), with a constant temperature difference between the controlled lab environment (24\ensuremath{^{\circ}\text{C}}) and the aluminium plate (5\ensuremath{^{\circ}\text{C}}~or 10\ensuremath{^{\circ}\text{C}}). We choose to change the plate temperature to vary the deposited water flux, as this provides the best experimental controllability and reproducibility, respect to changing the flow or the thickness of the substrate. The samples are imaged from the top with a Nikon SMZ80N microscope. Recording is done with a ThorLabs USB 3.0 Digital Camera. To improve the imaging, a LED light (ThorLabs MCWHL5) is shed through one of the objectives of the microscope and a 100~$\mu$l water droplet is deposited between the sample and the aluminium plate. \begin{figure} \includegraphics[width=0.75\textwidth]{setup.png} \caption{Sketch of the experimental setup} \label{Fig:setup} \end{figure} \subsection{Sample fabrication} \label{Sec:samples} The condensation experiment is performed with substrates made of two different materials: silicon gel and hydrophobic glass. The silicone gel substrates are fabricated by spin-coating a layer of polydimethylsiloxane (PDMS) on top of a glass cover slip (Menzel-Gl\"{a}ser 24x50~mm, N.~1.5). For the PDMS preparation, we use a commercial binary mixture of Sylgard\texttrademark 184 Silicone Elastomer (Dow Corning, Base and Curing Agent). The two components are mixed with different mass ratios (4:1 and 10:1) to achieve different stiffness of the condensation substrates. The mixture is degassed in vacuum and spin-coated on top of the cover-slip for 1 min at 1000~rpm. The samples are then cured at 40\ensuremath{^{\circ}\text{C}}, for 7 days. The stiffness of the cured substrate is measured through the Young's elastic modulus $E$, by means of a compression test performed with a texture analyzer (Stable Microsystem TA.XT plus). The 4:1 and 10:1 substrates have an elastic modulus of $E = 2\pm 0.18$~MPa and $E = 1 \pm0.2$~MPa respectively. The glass substrates are made hydrophobic by silane vapour deposition, using the following procedure: a glass cover slip (Menzel-Gl\"{a}ser 24x50~mm N.~1.5) is exposed to UV radiation for 20 minutes. Subsequently, it is positioned inside a vacuum desiccator together with a 1~ml droplet of tridecafluoro -1,1,2,2 - tetrahydrooctyl trichlorosilane 97\%. We generate a 5 mbar depression inside the desiccator and we isolate it from the air-void line. After 24~h, we remove the glass from the desiccator, we wash it with toluene and we vacuum dry it. We measure the static contact angle of the droplets $\theta_c$ on the different substrates by means of side imaging with a CMOS Camera (Thorlabs, DCC3240M) and back-illumination with a $3.5''\times 6''$ white LED (Edmundoptics). We find a static contact angle of the order of 90\ensuremath{^{\circ}} for silicone and fluor-silanized glass ($95.5\ensuremath{^{\circ}}\pm 2\ensuremath{^{\circ}}$ for 4:1 silicone, $94.3\ensuremath{^{\circ}}\pm 2\ensuremath{^{\circ}}$ for 10:1 silicone and $92.2\ensuremath{^{\circ}}\pm 2\ensuremath{^{\circ}}$ for fluor-silanized glass), while HMDS-silanized glass has a contact angle of $67\ensuremath{^{\circ}}\pm 2\ensuremath{^{\circ}}$. Given the slow speed of the condensation process, the droplets can be considered in their equilibrium shape during growth by direct water deposition. Though such shape may change during droplets merging, the relaxation time of a droplet formed by coalescence is very fast (below few seconds for the largest droplets in the late regime), hence droplets with a non-circular footprint are rarely captured in the images and statistically irrelevant for the analysis. \subsection{Image processing} \label{Sec:imaging} The image processing is carried out with a combination of Fiji and Matlab scripts. In order to eliminate artifacts due to possible uneven illumination, we first subtract the background from the original images, by using the Fiji plugin 'Pseudo flat field correction' of the Jan Borcher's Biovoxxel toolbox \cite{bro14_BioVoxxel}. The images are then converted from grey scale to black and white by means of the 'Enhance local contrast (CLAHE)' \cite{zui94} or with the standard 'Adjust/Threshold' Fiji plugin. The droplets appear as black areas on a white background. The binarized images are visually inspected to correct the imperfections due to reflections on the surface of the large droplets. We use the 'Binary/Fill holes' plugin, to correct the images where white areas appear in the middle of the large droplets, due to such reflections. The segmentation of connected droplets is done with Michael Schmid's Fiji 'Adjustable Watershed' plugin \cite{sch12_plugin}, with an appropriately selected tolerance parameter and subsequently manually corrected when required. The detection of the radius and the coordinates of the centre of the droplets is performed with a Matlab self-developed code. The static contact angle for the different substrates are measured with Stalder's Fiji Low Bond Axisymmetric Drop Shape Analysis plugin \cite{sta10}. \subsection{Data collection and statistical analysis} \label{Sec:statistics} For the droplet number density, $n(s,t)$, we consider only the droplets whose centre of mass resides inside the field of view. For each time point, the corresponding droplets size distribution is calculated based on at least 3000 droplets. To this aim, at each time, we collect several images, in different points of the sample (at least 10) . \subsection{Scaling arguments for size distribution} \label{Sec:scaling of size distribution} We revisit here the main aspects of the theory of breath figures \cite{fam88,fam89}. Specifically, we address predictions of the time-asymptotic scaling of the droplet number density $n(s,t)$, and its bearing to the asymptotic power-law decay of the droplet number and the porosity. Let $r$ be the radius of the circular area covered by the droplet and let the `size' $s=r^3$ be a proxy for the droplet volume. The size is related to the volume by a constant factor that depends of the wetting angle of the droplets, and hence on the surface properties. By applying the Buckingham-Pi theorem \cite{bar03_BOOK}, one can write \begin{equation} n(s,t) = \Sigma^{-\theta} f(x,y) \, , \label{Eq:Buckingham theorem} \end{equation} where $f(x,y)$ is a non-dimensional scaling function. Such a function depends on the dimensionless ratios $x = s/\Sigma(t)$ and $y = s/s_0$, where $s_0$ is a constant characterizing the smallest droplets in the system and $\Sigma(t)$ the maximum droplet size at time $t$. By purely dimensional considerations, the exponent $\theta$ must be $\theta = (D+d)/D$ \cite{fam89}, where $D$ is the dimensionality of the droplets, and $d$ is the dimensionality of the substrate. In our case, for three-dimensional droplets ($D=3$), on a two-dimensional substrate ($d=2$), we have $\theta = 5/3$. The theory for breath figures \cite{fam88,fam89} asserts that the droplet arrangement in the late-time regime is self-similar and features a scaling range. Moreover, the tails of the distribution, encompassing the smallest and the largest droplets, lie outside of the scaling range \cite{fam89,bla10}. Hence, the droplet number density can be expressed as \begin{equation} n(s,t) = K \; \Sigma^{-\theta} \biggl[\frac{s}{\Sigma(t)}\biggr]^{-\tau} \; \hat{f}\biggl(\frac{s}{\Sigma(t)}\biggr) \; \hat{g}\biggl(\frac{s}{s_0}\biggr)\, , \label{Eq:n(s,t)} \end{equation} where $\hat{f}(s/\Sigma(t))$ and $\hat{g}(s/s_0)$ are the so-called 'cutoff functions', describing the large and small droplets respectively, \emph{i.e.}~ the tails of the distribution, while $K$ is a constant, chosen in such a way that $\hat{f}(x) = 1$ for small arguments $x$, and $\hat{g}(y) = 1$ for large $y$. Here, the polydispersity exponent $\tau$ must take a value $0 < \tau < \theta$ to cope with a finite droplet volume and droplet number at all times~\cite{kol89}. The scaling range of $n(s,t)$ amounts to the interval of $s/\Sigma(t)$ where both cutoff functions, $\hat{f}(x)$ and $\hat{g}(y)$, are constant. It increases over time, since $\Sigma(t)$ grows in time, while $s_0$ is a constant. \subsection{Scaling arguments for droplet growth exponent} \label{Sec:largest droplet size} The radius of the largest droplet in the system, $R$, is expected to grow in time as $R\sim t^\nu$, where $\nu$ is a constant. Different values have been reported in the literature for the exponent $\nu$ \cite{bey86,per87,vio88,bri91,bri91a,bla12}, depending on the mechanism governing the individual droplets growth (e.g. surface or bulk diffusion of the vapour, heat dissipation, etc.). Typical values of $\nu$ range from $1/9$ to $1/3$, in the monodisperse non-coalescing growth phase \cite{bey86,bri91,bri91a}, and from $1/3$ to $1$ in the polydisperse growth phase \cite{bri91a,bla12}. In line with previous observations, our data show the values $\nu = 1/3$ in the initial nucleation phase (called (i) in \Fig{stages}), and $\nu = 1$ in the late-time regime (called (iv) in \Fig{stages}). Such values can be explained by purely geometrical considerations, under the following assumptions: \\ 1. All droplets take the shape of spherical caps, such that their volume $V$ is proportional to the cube of the radius $R$ of the wetted area. In particular, $V = \alpha \Sigma$, where $\Sigma = R^3$ is the size of the droplet, conserved when two droplets merge and $\alpha = (\pi/3) (2+\cos\theta_c)(1-\cos\theta_c)^2/(\sin\theta_c)^3$, with $\theta_c$ the contact angle, measured through the liquid phase. Hence for hemispherical droplets, $\theta_c = \pi/2$ and $\alpha = 2\pi/3$. \\ 2. The water flux $\Phi$ (water volume per unit area per unit time) is constant in time and impinges uniformly on the surface. \\ 3. In growth regime (i) there is a constant number $N_0$ of droplets that are roughly monodisperse and equally spaced such that each droplet covers an area $A_0$. The water flux impinging on the surface is entirely and uniformly distributed between the droplets, due to surface diffusion. Hence, in the initial phase each droplet collects the flux impinging on a constant area $A_0$ such that \begin{align} \frac{\ensuremath{\mathrm{d}} (\alpha s)}{\ensuremath{\mathrm{d}} t} &= A_0 \, \Phi = \text{const} \\ &\quad\Rightarrow\quad \Sigma(t) = s_0 + \frac{A_0 \, \Phi}{\alpha} \, (t-t_0) \\ &\quad\Rightarrow\quad R(t) = \biggl[ s_0 + \frac{A_0 \, \Phi}{\alpha} \, (t-t_0) \biggr]^{1/3} \end{align} Here $s_0$ and $t_0$ denote the initial droplet size and the initial time, respectively. The droplet size grows linear in time, and its radius with a $1/3$ power law. \\ 4. In the late stage, self-similar growth regime (iv) the surface is densely covered by droplets such that direct water deposition on the droplets dominates and each droplet collects the flux impinging on an area proportional to the surface that it covers, \begin{align} \frac{\ensuremath{\mathrm{d}} (\alpha s)}{\ensuremath{\mathrm{d}} t} &= \pi \, R^2 \; \Phi = \pi \: s^{2/3} \; \Phi \\ &\quad\Rightarrow\quad \Sigma(t) = \biggl[ s_0^{1/3} + \frac{\pi\Phi}{3\alpha}( t-t_0 ) \biggr]^3 \label{Eq:Sigma(t)} \\ &\quad\Rightarrow\quad R(t) = s_0^{1/3} + \frac{\pi\Phi}{3\alpha}( t-t_0 ) \label{Eq:Rmax(t)} \end{align} The droplet's volume grows asymptotically as $t^3$ while the radius grows linearly in time with a velocity $\pi\Phi/(3\alpha)$, equal to $\Phi/2$ for hemispherical droplets. Hence, in the late-regime we have $R\sim t^\nu$ and $\Sigma \sim t^{3\nu}$, with $\nu = 1$. \subsection{Time decay of the porosity} \label{Sec:derivation p(t)} In order to determine the time dependence of the porosity, we express the fraction $a$ of the surface area covered by droplets as \begin{equation} a(t) = \int_0^\infty \; C s^{d/D} \; n(s,t) \; \mathrm{d}s \, \label{Eq:a(t)} \end{equation} where $C = \pi$. We then employ \Eq{n(s,t)} to derive \begin{align} a(t) &= K' \; \int_0^\infty \; s^{d/D} \; \Sigma^{-\theta} \; \left( \frac{s}{\Sigma} \right)^{-\tau} \; \hat{f}\biggl(\frac{s}{\Sigma(t)}\biggr) \; \hat{g}\biggl(\frac{s}{s_0}\biggr)\; \mathrm{d}s \\ &= K' \; \int_{s_p/\Sigma(t)}^{x_p} \; x^{\theta-\tau-1} \; \mathrm{d}x \label{Eq:a(t)} \end{align} where $K ' = KC$, $x=s/\Sigma$ and the cutoff functions are taken into account by an informed choice of the constant values $s_p$ and $x_p$ in the integration bounds. In the long-time limit the lower integration bound, $s_p/\Sigma$, will approach zero and the surface area will be fully covered such that $a = 1$. Consequently, \begin{align} 1 = K' \; \int_{0}^{x_p} \; x^{\theta-\tau-1} \; \mathrm{d}x = K' \; \frac{ x_p^{\theta-\tau }}{ \theta-\tau } \, , \end{align} from which we derive \begin{equation} K' = \frac{ \theta-\tau }{x_p^{\theta-\tau }} \label{Eq:expression K'} \end{equation} By making use of Eqs.~\ref{Eq:a(t)} and \ref{Eq:expression K'} , the porosity can then be written as \begin{align} p(t) &= 1 - a(t) = \left[ \frac{s_p}{ x_p \; \Sigma(t)} \right]^{\theta-\tau} \label{Eq:p(t),1} \end{align} We substitute \Eq{Rmax(t)}, inside \Eq{p(t),1} and we derive \begin{equation} p(t) = \left(\frac{s_p}{x_p}\right)^{\theta-\tau} \, R_{max}^{-k} \, , \label{Eq:p(Rmax)} \end{equation} where \begin{equation} k = 3\nu(\theta - \tau) \label{Eq:exponent k, porosity decay} \end{equation} from which \begin{equation} p(t) = \left(\frac{27 s_p \alpha^3}{\pi^3 x_p \Phi^3}\right)^{\theta-\tau} \, t^{-k} \, . \label{Eq:p(t)} \end{equation} Thus the porosity decays in time as $p\sim t^{-k}$. For Blackman's prediction $\tau^* = 19/12$ \cite{bla00} in combination with the values $\nu = 1$ from geometrical considerations and $\theta = 5/3$ from dimensional analysis, we find that $p(t) \sim t^{-1/4}$. Note that the observed decay of the porosity implies that $\tau < \theta$. We conclude the analysis by taking a closer look at the prefactor of the power law. The ratio in the brackets amounts to the width of the scaling range, with cutoffs at the non-dimensional sizes $s_p / \Sigma(t)$ and $x_p$ in Fig.~\ref{Fig:prob density}. For a given size $\Sigma(t)$ of the largest droplet, the width of the scaling range for different systems is expected to differ mostly due to differences in the lower cutoff function \cite{bla00}. Due to the exponent $\theta-\tau = 1/12$, even a difference of two decades for vastly different materials, would imply that the prefactor of the power law varies by at most $30\%$. \subsection{Time decay of the number of droplets} \label{sec:derivation N(t)} In view of \Eq{n(s,t)} one can write the number of droplets per unit area of substrate, $N(t)$, as \begin{align} N(t) &= \int_0^\infty n(s,t) \: \mathrm{d}s \\ &= K \; \int_0^\infty \; \Sigma^{-\theta} \; \left( \frac{s}{\Sigma} \right)^{-\tau} \; \hat{f}\biggl(\frac{s}{\Sigma(t)}\biggr) \; \hat{g}\biggl(\frac{s}{s_0}\biggr)\; \mathrm{d}s \\ &= K \; \Sigma^{-d/D} \; \int_{s_N/\Sigma(t)}^{x_N} \; x^{\theta-\tau-1} \; \mathrm{d}x \\ &= \frac{K}{1-\tau} \; \Sigma^{-d/D} \; \left[ x_N^{1-\tau} - \left( \frac{s_N}{\Sigma(t)} \right)^{1-\tau} \right] \, . \label{Eq:N(t),1} \end{align} Here $s_N$ and $x_N$ in the integration bounds are constants chosen in such a way to keep into account the cutoff functions. For $\tau<1$ the second term in the square bracket in \Eq{N(t),1} is sub-dominant, and the total droplet number is obtained by dividing the total area $A_{\text{tot}}$ of the surface by the area $\Sigma^{d/D}$ covered by a typical large droplet. In view of Fig.~\ref{Fig:prob density}, this is at variance with the finding that small droplets dominate the droplet size distribution in the late-regime. Hence, in the late regime, $\tau > 1$ and \begin{equation} N(t) \sim \Sigma^{\tau - 1+d/D} = \Sigma^{\tau - \theta} \sim t^{-3 \; (\theta-\tau)} \, . \label{Eq:N(t),2} \end{equation} With $\theta = 1 - d/D$ and $\Sigma = R_{\text{max}}^3$ one obtains that \begin{align} N^* = \frac{ N(t) }{ K \, s_N^{1-\tau} } = R_{\text{max}}^{-k} \, . \label{Eq:N*} \end{align} Hence, in dominant order the droplet number $N(t)$ shows the same power-law decay as the porosity, namely $N \sim t ^{-k}$. Its dependence as function of $R_{\text{max}}$ is provided in Fig.~\ref{fig:Nt-Rmax}. However, the data analysis is complicated in this case because the power law suffers from a cross over, even in the large-time asymptotic regime (see \Eq{N(t),1}). Therefore, whenever possible, the analysis of the power law time decay of the porosity should be preferred as a way to assess scaling in the late regime, respect to the analysis of the number of droplets. \begin{figure} \includegraphics[width=0.48\textwidth]{Rmax_N_raw_rescaled.png} \caption{\label{fig:Nt-Rmax} Evolution of the number of droplet $N$ as a function of the largest radius $R_{max}$ in non-rescaled (a) and rescaled form (b) with $N^*$ provided in Eq.~\ref{Eq:N*}.} \label{Fig:N(Rmax) diff rescaled only vertically} \end{figure} \subsection{Kinetic Monte Carlo simulations} \label{Sec:simulations} The numerical simulations are performed with a lattice Kinetic Monte Carlo algorithm \cite{gil76,bat08,jan12_BOOK} implemented in Python using object-oriented programming. The code used in this work is a direct adaptation of the code developed in \cite{soe18} for the description of atoms aggregating in 3D clusters over surfaces. The simulations are performed in a non-dimensional fashion. In order to present the results in dimensional form, the appropriate length and time units are chosen in such a way that the numerical late time evolution of the largest droplet matches the experimental one (Fig.~\ref{Fig:Rmax, simulations}). The computational domain consists of a square lattice of $N_c = 1200\times1200$ cells (the 'sites') with periodic boundary conditions. Each site can be 'empty' or 'occupied', \emph{i.e.}~ completely filled with water. Each droplet consists of a set of contiguous occupied sites, symmetrically arranged around the droplet's center. Therefore, each droplets is a circle approximated by its staggered version, in perfect analogy with the pixel resolution of the experimental optical measurements. Initially, no droplets are present and all sites are empty. As time progresses, water is deposited and the droplets start to nucleate, grow and merge with each other. Time progression happens in a discrete fashion, assuming that, at each time $t_j$ an instantaneous 'event' (deposition of a discrete amount of water) occurs. The event is then followed by a waiting time, \emph{i.e.}~ a time step, $\Delta t_j$, when nothing happens. Thus, the next time instant will be $t_{j+1} = t_j+\Delta t_j$. Note that the time intervals $\Delta t_j$ are not constant, but randomly chosen from a Poisson distribution, since the events are considered as rare and independent from each other \cite{gil76,bat08,jan12_BOOK}. The average of such a distribution is $1/k_{tot}$, where $k_{tot} = \hat{\Phi} A_{tot}$ with $A_{tot}$ the total area of the substrate, namely the total number of sites and $\hat{\Phi}$ the number of events (falling droplets) per unit time per unit surface, hence $k_{tot}$ represents the total frequency at which the events take place on average, \emph{i.e.}~ the number of events per unit time. The flux $\Phi$, i.e. the water volume deposited per unit area, can be determined as $\Phi = \hat{\Phi}V_0$, where $V_0$ is a constant representing the volume deposited in a single event. However, changing $\Phi$ is equivalent to a mere time rescaling \cite{soe18} and does not affect the critical exponents. Therefore one can take both $\hat{\Phi}$ and $V_0$ equal to unity and choose the time and length units to achieve dimensional matching with both the size of the smallest droplet detected in the experiments and the experimental late time evolution of the largest droplet. \begin{figure} \includegraphics[width=0.95\columnwidth]{t_p_N_sim_color.png} \caption{Numerical results for time evolution of porosity (grey, red online, right vertical axis) and number of droplets per unit area (black, left vertical axis), averaged over 11 simulations. The dashed line represent the theoretical prediction for the time decay of both the porosity and the number of droplets.} \label{Fig:p(t),N(t) simulations} \end{figure} Once the time step to advance the system has been decided, the algorithm chooses the type of event that takes place. In particular, two types of events can occur: the nucleation of a new droplet on an empty site or the growth of an existing droplet due to direct water deposition. The type of event is randomly determined, at each time, based on the probability that either growth or nucleation occurs. Such probabilities are $N_{c,occ}/N_c$ for droplet growth, and $(N_c-N_{c,occ})/N_c$ for droplet nucleation, where $N_{c,occ}$ is the total number of occupied sites. The volume of deposited water at each time step is constant, analogous to the deposition of a droplet. At this point, once the type of event (droplet growth or nucleation) has been decided, the exact position where the water volume will fall is determined with a third random number, based on the probabilities associated to each existing droplet and nucleation site. In particular, if the event is a droplet's growth, each existing droplet $i$ will have a probability $N_{i}/N_{c,occ}$ to grow, where $N_{i}$ is the number of sites occupied by the droplet $i$. If the event is a nucleation, each free site will entail a probability $1/(N_c - N_{c,occ})$ to host the new droplet. Whenever one of these events leads to overlapping between droplets, \emph{i.e.}~ occupation of the same site by more than one droplet, all the involved droplets are merged. The merging of droplets is assumed to be instantaneous and preserves the droplets' volume. A droplet resulting from a merging event has the same volume as the sum of the merging droplets and the center located at the center of mass of the system formed by the two merging droplets. The process is sequentially repeated until no more overlapping between droplets is present and each site is occupied at most by a single droplet. \begin{figure} \includegraphics[width=0.85\columnwidth]{t_Rmax_sim_exp.png} \caption{Time evolution of the largest droplet in simulations (solid line), dimensionally matched to the experiments presented in Fig.~\ref{Fig:stages} (dash-dotted line).} \label{Fig:Rmax, simulations} \end{figure} \newpage \begin{figure*} \includegraphics[width=0.7\textwidth]{glass_nucleation.png} \caption{Initial phases of water deposition on fluor-silanized glass: at the beginning of the experiment (a), after 1 sec (surface completely covered by water, possibly in the form of droplets below resolution)(b), 5 sec (c), 10 sec (d).} \label{Fig:glass, nucleation} \end{figure*} \begin{figure*} \includegraphics[width=0.6\textwidth]{t_N_diffSurf.png} \caption{Time evolution of the number of droplet $N$ on different surfaces with plate temperature $T_p^*=5\ensuremath{^{\circ}}$~C, for the same conditions displayed in \Fig{porosity diff}.a.} \label{Fig:N(t) diff} \end{figure*} \begin{figure*} \includegraphics[width=0.6\textwidth]{t_Rmax_diffSurf.png} \caption{Time evolution of the largest radius $R_{max}$ for different rigid surfaces with plate temperature $T_p^*=5\ensuremath{^{\circ}}$~C, for the same conditions displayed in \Fig{porosity diff}.a.} \label{Fig:Rmax(t) diff before rescaling} \end{figure*} \end{document}
\section{Introduction} \label{Intro} Although the Global Positioning System (GPS) has been widely used for decades, its availability and accuracy suffer in urban canyons and indoor environments \cite{901174}. Urban environments generally have a dense population and hence many mobile users. Additionally, Environmental Protection Agency (EPA) reports that we spend $86.9\%$ of our time in indoor areas \cite{klepeis2001national}. Therefore, a large share of users reside in environments where GPS comes short. Furthermore, with the expansion of location-based services and emergence of new technologies such as autonomous vehicles and unmanned aerial systems (UAS) traffic management, the need for highly accurate positioning data is growing \cite{junglas2008location}. GPS cannot always deliver the required level of accuracy as GPS-enabled smartphones are typically only accurate within a $4.9$ m under open sky \cite{GPSacccuracy1}. Evidently, there is a need for alternative localization technologies. To this end, researchers have been proposing different localization methods. \emph{Trilateration} and \emph{triangulation} are two localization techniques that rely on intersections formed by signals coming from multiple anchor nodes (ANs). Several studies have already proposed adapting these techniques for massive Multiple-Input Multiple Output (MIMO) \cite{9097149,4384492, 7577201}. The disadvantage of these techniques is that they cannot be used for single-site localization, where only one AN is used to accomplish localization. \emph{Fingerprinting} is a technique that consists of geo-tagging communication parameters (e.g. Receive Signal Strength (RSS) or Channel State Information (CSI)), followed by a machine learning model that predicts the user's location when presented with a new measurement. Several fingerprinting techniques have been proposed in mmWave Massive MIMO systems that tackle both static and dynamic environments \cite{8307353,vieira2017deep,sun2019fingerprint,9128640, ferrand2020dnn, de2020mamimo, Hejazi2021DyLocDL}. Most recent works use convolutional neural networks (CNNs) to train the fingerprinting model. Using a CNN approach, these techniques reported millimeter range accuracy\cite{Hejazi2021DyLocDL}. The drawback of data-driven approaches is that they require elaborate measurement campaigns to cover every location in the environment. Furthermore, {these methods also require several} hours of training. During these two relatively prolonged procedures, it is probable that the environment changes and the dataset becomes invalid \cite{zafari2019survey}. In mmWave systems, the signal propagation is highly directive and only a small number of spatial paths contribute to the received power \cite{8761825}. Some studies have taken advantage of the sparse channel to formulate the localization problem as a compressive sensing (CS) problem. These works typically combine channel estimation and localization by using different optimization techniques such as Bayesian Learning \cite{8761825,9154215} or Distributed Compressed Sensing - Simultaneous Orthogonal Matching Pursuit (DCS-SOMP) \cite{8269069,8240645}. In these techniques, CS is first used to extract Angle of Arrival (AoA), Angle of Departure (AoD), and Time of Arrival (ToA) from the sparse received signal. Then, the location is recovered using the estimated parameters. These models require only one transmitter and have been shown to work both for line-of-sight (LOS) and non-line-of-sight (NLOS) scenarios. However, the simulations in these works use very simple models with a limited number scatterers in the environment. To the best of the authors' knowledge, none of the CS techniques have been validated in complex multipath scenarios where there are many scatterers and blockers present in the environment. Examples of {datasets in such environments include}, but are not limited to the DeepMIMO \cite{alkhateeb2019deepmimo} and the ViWi\cite{alrabeiah2020viwi} datasets. Map-assisted positioning with angle and time (MAP-AT) \cite{9013365} uses a 3-dimensional (3D) map of the environment and ray tracing to localize the user in a mmWave system using a single base station (BS). Using AoD and ToA, the authors perform a ray tracing exercise to locate the user. They also show that if AoA and ToA are available instead, the rays can be back-propagated to find the user's location. The main issue with this approach is that ray tracing parameters are not explicitly available in practice. The communication system requires additional effort to acquire these parameters which can be a complex and laborious task for the BS. On the other hand, CSI is a common communication parameter often used to quantify the quality of the link and the performance experienced by the user \cite{8395053}. Although MAP-AT works well in theory, the proposed map-assisted CSI (MAP-CSI) localization is a simpler and more practical implementation approach. By leveraging the already estimated CSI, we can alleviate the workload at the BS In this work, we propose a novel map-assisted localization approach using CSI data. CSI, as one of the most fundamental concepts in wireless communication \cite{8395053}, is estimated any time we want to know the channel properties and link quality. In other words, most practical systems perform some sort of channel estimation. Many different techniques have already been proposed for channel estimation in massive MIMO and any of these techniques can be used to estimate CSI \cite{9165822}. CSI data preserves all the propagation characteristics of the channel, but AoD and ToA cannot be directly extracted from it. Fortunately, using a linear transformation, CSI can be converted to \emph{angle delay profile (ADP)}\cite{8307353}. The ADP is interpreted as a visual representation of all distinguishable paths between the user and the BS \cite{Hejazi2021DyLocDL}. In this paper, we demonstrate how AoD and ToA can be recovered from ADP and then be used to superimpose the main propagation rays on a 2-dimensional (2D) environment map to localize the user. In our simulation, we consider a single user and a single BS equipped with a MIMO antenna. We explore two scenarios located in the same environment. In the LOS scenario, all user location data points are in the BS LOS view. While the Mixed scenario has approximately half of the samples with the LOS view obstructed. The main contributions of our work can be encapsulated as follows: \begin{itemize} \item Modifying the ADP definition in \cite{sun2019fingerprint} to increase the angular and temporal resolution. \item Proposing an algorithm to cluster potential user's locations and select which cluster corresponds to the actual user's location. \item Benchmarking the performance of map-assisted localization techniques, MAP-AT and MAP-CSI, on the ViWi public dataset \cite{alrabeiah2020viwi} for both LOS and Mixed dataset. \end{itemize} The rest of the paper is organized as follows. In Section \ref{SystemModel}, we define the channel model and describe how ToA and AoD are obtained from CSI. Next, in Section \ref{Localization}, we discuss both the MAP-CSI and the MAP-AT methods. Then, in Section \ref{Simulation}, we present the {employed} dataset and simulation results. Finally, in Section \ref{Conculsion}, we summarize the work and highlight the main points. \section{System Model} \label{SystemModel} Consider an environment with a single user and a single BS communicating using a typical MIMO-Orthogonal Frequency Division Multiplexing (OFDM) wireless network. For the ease of exposition, we use the channel model similar to \cite{ali2017millimeter}. Suppose that the BS is equipped with a uniform linear array (ULA), with half wavelength spacing between two adjacent antennas, and the user's device has a single omni-directional antenna. The BS has $N_t$ antennas, and uses OFDM signaling with $N_c$ sub-carriers. We assume a geometric channel model between the BS and the user with $C$ distinguishable clusters. Moreover, each cluster constitutes of $R_C$ distinguishable paths. Each path can be characterized by a delay, also referred to as ToA ($\tau_{m}^{(k)}$), an AoD from the BS ($\theta_{m}^{(k)}$), and a complex gain ($\alpha_{m}^{(k)}$), where $k \in \{ 1, \dots,C\}, m \in \{ 1, \dots,R_C\}$ \cite{ali2017millimeter}. Assuming a wide-band OFDM system, we can define the ToA as \begin{equation} \tau_{m}^{(k)} = n_{m}^{(k)} T_s, \label{eq_ToA} \end{equation} where $T_s$ and $n_{m}^{(k)}$ are the sample interval and the sampled delay belonging to the path $m$ of the cluster $k$, respectively \cite{sun2019fingerprint}. Assuming these parameters, channel frequency response (CFR) for each sub-carrier $l$ can be written as \cite{alkhateeb2016frequency} \begin{equation} \boldsymbol{h}[l] = \sum_{k=1}^{C} \sum_{m=1}^{R_C} \alpha_{m}^{(k)} \boldsymbol{e}(\theta_{m}^{(k)}) e^{-j 2\pi \frac{l \: n_{m}^{(k)}}{N_c} } \,, \label{eq_CSIdef} \end{equation} where $j$ is the imaginary unit and $\boldsymbol{e}(\theta)$ is the array response vector of the ULA given by \begin{equation} \boldsymbol{e}(\theta) = [1,e^{-j2 \pi \frac{d cos(\theta)}{\lambda}},\dots,e^{-j2 \pi \frac{(N_t - 1)d cos(\theta)}{\lambda}}]^T\,. \end{equation} The overall CFR matrix of the channel, also known as CSI, can be expressed as \begin{equation} \boldsymbol{H} = [\boldsymbol{h}[1],\dots,\boldsymbol{h}[N_c]]\,. \end{equation} The ADP is computed from the CSI matrix $\boldsymbol{H}$ as follows \begin{equation} \boldsymbol{A} = \mid \boldsymbol{V}^H \boldsymbol{H} \boldsymbol{F} \mid, \label{eq_CSI2ADP} \end{equation} where $\boldsymbol{V}$ and $\boldsymbol{F}$ are the discrete Fourier transform (DFT) matrices, $|.|$ denotes absolute value, and $\boldsymbol{V}^H$ is the Hermitian transform of matrix $\boldsymbol{V}$. In \cite{sun2019fingerprint}, the DFT matrices are square matrices of size $\boldsymbol{V} \in \mathbb{C}^{N_{t} \times N_{t}}$ and $\boldsymbol{F} \in \mathbb{C}^{N_{c} \times N_{c}}$, which limits the ADP to the size of $\boldsymbol{A} \in \mathbb{C}^{N_{t} \times N_{c}}$. Using this definition, a high-resolution ADP requires a large number of transmitter antenna elements and a large number of sub-carriers. This is often not practical. Here, we change the definition of the ADP to increase the resolution of the ADP without increasing $N_t$ and $N_c$. Let us define a new DFT matrix $\boldsymbol{V} \in \mathbb{C}^{N_t \times N_{tt}}$ as $$[\boldsymbol{V}]_{\: z,q} \overset{\Delta}{=} e^{-j \pi (z-1) cos( \frac{q\pi}{N_{tt}})},$$ and new matrix $\boldsymbol{F} \in \mathbb{C}^{N_c \times N_{cc}}$ as $$[\boldsymbol{F}]_{\: z,q} \overset{\Delta}{=} e^{j 2 \pi \frac{zq}{N_{cc}} },$$ where $N_{tt}$ and $N_{cc}$ are arbitrary integers larger than $N_t$ and $N_c$, respectively. Then, the size of the new ADP matrix is $\boldsymbol{A} \in \mathbb{C}^{N_{tt} \times N_{cc}}$. By increasing $N_{tt}$ and $N_{cc}$, we can increase the angular and temporal resolutions, respectively. \begin{figure}[H] \vspace{-1mm} \centering \includegraphics[width=3.0in,height=2.5 in]{BW_ADP2.png} \caption {\small {Local maximas in the ADP are marked with the five squares in (a), while their corresponding paths are shown in (b). The green rectangle represents the BS and the black rectangle is the user. The buildings on both sides of the street are the reflection surfaces. }} \vspace{-3mm} \label{fig_testADP} \end{figure} An example of the ADP matrix plot is shown in Fig. \ref{fig_testADP}a. The x-axis corresponds to ToA, the y-axis to AoD and the intensity is RSS. Five dominant clusters may be deducted with ToA and AoD approximately at ($137ns$, $23^o$), ($140ns$, $26^o$), ($157ns$, $35^o$), ($162ns$, $40^o$), and ($237ns$, $57^o$). The clusters formed around the local maximas consist of multipath components (MPCs) that can be categorized by two types of scattering: 1- Specular Components (SpecC), and 2- Dense Multipath Components (DMC). SpecC is a strong specular-like reflection from large physical surfaces. Around a SpecC there are many weaker DMCs with slightly different angles and delays \cite{poutanen2011geometry}. Fig. \ref{fig_testADP}b shows the 2D bird-view of the environment and the propagation paths of the five clusters marked in Fig. \ref{fig_testADP}a. By knowing the environment map, we can determined where the reflection surfaces are located in the environment. Then, we use this knowledge in combination with the AoD and ToA to plot each propagation path using the ray reflection model defined in Section \ref{ReflectionModel}. The location where the paths intersect is the user's position. The paths can intersect in more than one location; therefore, we use ToA to estimate the length by each ray to eliminate some of the locations where the paths intersect. The total distance traveled by the ray using $\tau_{m}^{(k)}$ is calculated as \begin{equation} d = \tau_{m}^{(k)} * c, \label{eq_distance} \end{equation} where $c$ is the speed of light and $d$ is the distance. Combining the distance traveled with the environment map, we can find the end destination for each ray. This point becomes a \emph{candidate user's location}. Some ambiguity is associated with recovering ToA from the ADP matrix. Referring to (\ref{eq_ToA}) and (\ref{eq_CSIdef}), if $n_m^{(k)}<N_c$, the delay in ADP is equal to ToA. However, if $n_m^{(k)} \geq N_c$, the delay calculated in ADP is equal to $T_s\times\pmod{(n_m^{(k)}, N_c)}$, which is not the actual ToA. In other words, the actual ToA is the delay obtained from the ADP plus an unknown multiple of $N_c T_s$. Therefore, we have to consider several multiples of $N_c T_s$ for each ray, each of them resulting in a candidate user's location. The candidate user's locations from multiple rays form a cluster around the true user's location. The centroid of this cluster becomes the estimated user's location. \section{Localization} \label{Localization} \subsection{Ray Reflection Model} \label{ReflectionModel} To model the reflection of the propagation paths, we assume that the reflection surfaces are smooth and use the image-based recursive reflection model defined in \cite{7814249}. The ray is reflected over every surface it encounters until the total distance traveled by the ray is equal to the distance calculated in (\ref{eq_distance}). An example of the recursive reflection is shown in Fig. \ref{blocker}, where the total distance traveled by the ray is the sum of the $d_i$'s and the AoD is shown as $\theta$. Referring to the ToA ambiguity discussed in Section \ref{SystemModel}, the propagation path shows three candidate user's locations ($p^1$, $p^2$, and $p^3$). The distance $d_1$ is between the BS and $p^1$, where $d_1$ is proportional to distance traveled in time delay calculated from ADP ($n_m^{(k)}<N_c$). The paths from $p^1$ to $p^2$ and from $p^2$ to $p^3$ are $d_2$ and $d_3$, respectively. The lengths of $d_2$ and $d_3$ are equal and correspond to the distance traveled in time $N_c T_s$. \begin{figure}[H] \vspace{-1mm} \centering \includegraphics[width=2.0in,height=1.2 in]{ray_tracing4.PNG} \caption {\small {Recursive reflection model. }} \vspace{-3mm} \label{blocker} \end{figure} \subsection{Localization using CSI Data} \label{LocalizationAlg} Building on the ray reflection model, we propose MAP-CSI localization. We start by converting the raw CSI sample, measured at time $t$, into an ADP using (\ref{eq_CSI2ADP}). Next, we find the AoD and ToA from the local maximas in the ADP. We then combine the (AoD, ToA) pairs with the environment map using the ray reflection model and find the candidate locations. We label the candidate locations as $p_n^i$ for the $n^{th}$ ray and the $i^{th}$ candidate user's location. Each $p_n^i$ point corresponds to a location in the environment with $x,y$ coordinates. Once all $p_n^i$ are collected, the $p_n^i$'s that are outside the area of interest (AoI) are excluded from the set. AoI is the area that encloses all possible user's locations as shown in Fig. \ref{fig_BWlos}. Typically, $p_n^i$'s form clusters such that the densest cluster is at the user's location. Based on that, we propose Algorithm \ref{alg2} to identify the clusters and to select which cluster most likely corresponds to the actual user's location. \begin{algorithm}[H] \algsetup{ linenosize=\scriptsize, linenodelimiter=: } \vspace{0mm} \caption{Clustering and Classification} \begin{algorithmic}[1] \label{alg2} \footnotesize \REQUIRE{collection of possible user's locations $\mathbb{P}$, threshold $D_{th}$, maximum number of clusters $k_{max}$}\\ \ENSURE{estimated number of clusters $k_e$, estimated location $L_e$} \FOR{all $p_n^i \in \mathbb{P}$} \STATE{$s_p \leftarrow$ number of $p_n^i$ points in $\mathbb{P}$} \IF {$s_p$ == 1} \STATE{ $k_e = 1$} \STATE{$L_e=p_n^i$} \ELSE \STATE{$\overline{p} \leftarrow \sum_{i=1}^{i_{max}}\sum_{n=1}^{n_{max}} \frac{p_n^i}{i_{max}n_{max}}$} \FOR{all $p_n^i(x,y) \in \mathbb{P}$ \STATE{$D(p) \leftarrow$ distance between $p_n^i$ and $\overline{p} $ } \ENDFOR \IF{(max($D$)$<D_{th}$)} \STATE{ $k_e = 1$} \STATE{$L_e = \overline{p} $} \ELSE \FOR{$k = 2:kmax$} \STATE{calculate $s_n^i(k)$ using (\ref{eq_s}), $\forall i,n$}\\ \STATE{calculate $\overline{s}(k)$ using (\ref{eq_smean}), $\forall k$}\\ \ENDFOR \STATE{ calculate $k_e$ using (\ref{eq_sc}) } \\ \STATE{$ [p_n^i,k_n^i] \leftarrow$ kmeans$(k_{e}$,$\mathbb{P}$), $\forall p_n^i$ }\\ \STATE{$L_e \leftarrow$ centroid of cluster with most points}\\ \ENDIF \ENDIF \ENDFOR \\ \end{algorithmic} \end{algorithm} \vspace{0mm} Algorithm \ref{alg2} has three inputs: maximum number of clusters ($k_{max}$), threshold distance ($D_{th}$) and set $\mathbb{P}$ of points that contains all $p_n^i, \forall n\in[1, n_{max}], i\in[1, i_{max}]$, where $n_{max}$ and $i_{max}$ depend on the environment. Initially, the algorithm finds the centroid of all points, denoted by $\overline{p}$, and the Euclidian distance of the point farthest from the centroid, denoted by $D$. If $D \leq D_{th}$, then the centroid becomes the estimated location and this means that there exists only one cluster. This is the ideal situation. However, if $D> D_{th}$, this indicates that there are more clusters. In this case, Silhouette Coefficient ($SC$) clustering \cite{kodinariya2013review} is used to find the optimal number of clusters, where $k_{max}$ is the maximum number of clusters considered. The parameters $D_{th}$ and $k_{max}$ are tunable and can vary based on the environment. The Silhouette value $s_n^i(k)$ is defined as follows \begin{equation} s_n^i(k)= \frac{b_n^i-a_n^i}{max(b_n^i,a_n^i)}, \label{eq_s} \end{equation} where $k$ is the number of clusters, $a_n^i$ is the average distance between the point $p_n^i$ and all other points in the cluster to which it belongs to and $b_n^i$ is the minimum of the average distance between point $p_n^i$ and all the points in the other clusters \cite{kodinariya2013review}. The clusters are estimated using k-means. The range of $s$ values is between $-1$ and $1$. If all the $s$'s are close to 1, the set is well classified. On the other hand, if $s$ is close to $-1$, then that point is misclassified. The average Silhouette value for a given $k$ is \begin{equation} \overline{s}(k) =\sum_{i=1}^{i_{max}}\sum_{n=1}^{n_{max}}\frac{s_n^i(k)}{i_{max}n_{max}}. \label{eq_smean} \end{equation} After $\overline{s}(k)$ is computed for all $2\leq k\leq k_{max}$, the optimal value ($k_{e}$) is the $k$ corresponding to the maximum $\overline{s}(k)$ \begin{equation} k_e = \arg\max_{k} \overline{s}(k). \label{eq_sc} \end{equation} \ Finally, k-means is used to classify all points in $\mathbb{P}$ into $k_{e}$ clusters. Each point $p_n^i$ is assigned a class $k_n^i$, where $k_n^i$ ranges from 1 to $k_e$. The centroid of the cluster with the most points is selected as the estimated user's location $L_e$. It is worth noting that both the SC clustering method and k-means Elbow method \cite{kodinariya2013review} were considered when designing the algorithm. Sometimes one method performs better than the other depending on the dataset. However, for this application there was no notable difference between the two methods, so SC was arbitrarily selected. \footnote{The authors release their codes in the following link ”https://github.com/katarinavuckovic/MAPCSI”.} \section{Simulation Results} \label{Simulation} \subsection{Dataset} \label{Dataset} ViWi Dataset \cite{alrabeiah2020viwi} is a public mmWave MIMO dataset. We use datasets from two ViWi scenarios: 1) LOS and 2) Mixed. For the LOS scenario, all locations are in BS LOS view as shown in Fig \ref{fig_testADP}a. On the other hand, the Mixed scenario is created by adding two buses to the same environment. The buses block the LOS view for approximately half of the samples as shown in Fig. \ref{fig_BWlos}. Furthermore, the AoI is the same for both scenarios. \begin{figure}[H] \vspace{0mm} \centering \includegraphics[width= 2.6 in,height= 0.5 in]{BW_NLOS.png} \caption {\small {LOS and NLOS regions of the AoI in the Mixed dataset. The red rectangles are the buses that block the LOS view.}} \vspace{-3mm} \label{fig_BWlos} \end{figure} Every sample in a dataset consists of a user location tagged with AoD, ToA, RSS, and CSI data. The parameters used to generate the dataset are listed in Table \ref{tb1}. We assume a single BS with an ULA antenna aligned with the $x$-axis with 60 antenna elements. We select the 60 GHz channel. We set OFDM bandwidth to 0.5 GHz and 60 sub-carriers. \begin{table}[H] \vspace{-1mm} \begin{center} \caption{\small{Parameters used to generate the Datasets.}} \begin{tabular}{ |c|c| } \hline Frequency Band & 60 GHz\\ \hline Bandwidth & 0.5 GHz\\ \hline Base Station Antenna & ULA aligned in x-axis \\ \hline Antenna Elements ($N_t$) & 60 \\ \hline Sub-carrier Number ($N_c$) & 60 \\ \hline Path Number & 25 \\ \hline \end{tabular} \vspace{0mm} \label{tb1} \end{center} \end{table} Fig. \ref{fig_BWlabel} shows the AoI enclosed by the white rectangle that occupies an approximate size of 90 m $\times$ 4 m. There are 5 different horizontal positions (green lines in AoI) and 1000 different vertical positions (not shown), creating a total of 5000 grid points of equally spaced user positions. The buildings and the buses represent reflection surfaces. However, for a path directed towards a bus, there are two viable options that the ray can take. Path 2a is reflected and Path 2b continues traveling in the same direction. We have to consider both of them. The map is the 2D view of the environment and as such does not convey the height of the objects in the image. However, extending this to a 3D view, we realize that the height of the bus is limited and that the ray can still propagate above the bus and reach some of the users located near the NLOS region edges. This creates two different directions that a single ray can propagate in which increases the number of candidate user location points. In our analysis in Section \ref{Results}, we separate the results from the LOS and NLOS regions to analyze the impact of LOS blockage. The environment also contains some smaller objects such as stop lights and a fire hydrant. We ignore them in our simulations as their reflection surface is hard to model due to their complex shapes. \begin{figure}[H] \vspace{0mm} \centering \includegraphics[width= 2.8 in,height=0.6 in]{BW_label.PNG} \caption {\small {Environment map showing the blockage in Mixed dataset.}} \vspace{-3mm} \label{fig_BWlabel} \end{figure} \subsection{State of the Art} We compare our results to the MAP-AT approach, similar to what is presented in \cite{9013365}. In this approach, RSS, ToA, and AoD are required and assumed to be available. To obtain this information, the BS calculates the ToA and AoD for each MPC, which is an oppressive task for the BS. However, assuming the information is available, the authors in \cite{9013365} use multiple MPC components in combination with the environment map to identify candidate locations. Here we added the AoI filtering which is not present in the original version of MAP-AT presented in \cite{9013365}. AoI filtering is used to improve the performance of the classifier and reduce the number of clusters by discarding the $p_n^i$'s that we know for sure are not at the true user's location. Next, MAP-AT groups $p_n^i$'s such that the maximum distance between any two points in the cluster is less than $d_{th}$, where $d_{th}$ is a tunable parameter. We modify this part to use Algorithm \ref{alg2} instead to make it easier to compare with MAP-CSI. \subsection{Results} \label{Results} In this section, we compare the results of MAP-CSI to MAP-AT. Although MAP-CSI can never outperform MAP-AT in term of accuracy due to the ambiguity associated with AoD and ToA, it provides a practical implementation solution for a real-world wireless communication system. This is the main advantage of MAP-CSI. Therefore, MAP-AT is presented as the lower bound for the error. We set the tunable parameters in the algorithm to $n_{max}=5$, $i_{max}=7$, and $k_{max}=3$. \begin{figure}[H] \vspace{-1mm} \centering \includegraphics[width= 3.0 in,height=1.7 in]{LOS_results.png} \caption {\small {LOS dataset results comparing MAP-CSI and MAP-AT}} \vspace{-3mm} \label{Fig_results1} \end{figure} \begin{figure}[H] \vspace{-2mm} \centering \includegraphics[width=3.0 in,height=1.7 in]{Mixed_results.png} \caption {\small {Mixed dataset results comparing MAP-CSI and MAP-AT}} \vspace{-3mm} \label{Fig_results2} \end{figure} Fig. \ref{Fig_results1} and Fig. \ref{Fig_results2} show the average error in meters versus the $N_{tt}$ size for different $N_{cc}$ values for the LOS and Mixed dataset, respectively. The AoD and ToA are directly available in MAP-AT which implies that the size of the ADP is irrelevant and therefore error remains constant for all $N_{tt}$ and $N_{cc}$ values. Furthermore, we observe that increasing $N_{tt}$ and $N_{cc}$ in MAP-CSI reduces the average error. The best results are achieved when $N_{tt}$ and $N_{cc}$ are both 180 where the error is $1.8$ m for LOS and $2.8$ m for the Mixed dataset. We further examine the Mixed dataset by separating the LOS and NLOS samples as shown in Fig. \ref{Fig_MixedBar}. The error for the LOS samples is comparable to the results in Fig. \ref{Fig_results1}. The error of the NLOS samples is larger since the blockers can obstruct some of the critical paths to the user, thus reducing the number of points in the cluster nearest to the user. Instead, these paths are diverted in other directions forming a denser cluster at another location that is farther away from the user. The classifier may then select the cluster farther from the user as the estimated location causing the error to increase. Nevertheless, the error for both LOS and NLOS samples reduces when $N_{tt}$ and $N_{cc}$ are larger. The smallest error is achieved when $N_{tt} = N_{cc} = 180$, which is $2.1$ m for LOS region and $3.1$ m for NLOS region. \begin{figure}[H] \vspace{0 mm} \centering \includegraphics[width=3.0 in,height=1.5 in]{LOS_NLOS_barplot.png} \caption {\small {Average Error of LOS and NLOS samples in Mixed Dataset.}} \vspace{-3mm} \label{Fig_MixedBar} \end{figure} \section{Conclusion} \label{Conculsion} We introduced MAP-CSI, a novel map-assisted localization approach that merely uses the CSI data {and the environment map}. The previous SoA map-assisted technique requires explicit AoD and ToA measurements creating a demanding task for the BS which is nonviable for practical applications. On the contrary, CSI data is usually estimated for any communication channel. We show that AoD and ToA can be estimated from CSI data for every MPC. We compare our results to MAP-AT and show that MAP-CSI can approach MAP-AT accuracy when the size of the ADP is large. \vspace{-1mm} \section*{Acknowledgment} \vspace{-1.5mm} This work is supported by the National Science Foundation under Grant No. CCF-1718195. \vspace{-1.5mm} \bibliographystyle{IEEEbib}
\section{Introduction} \lettrine[lines=3, findent=3pt, nindent=0pt]{A}{utonomous underwater vehicles (AUVs)} have in the last decades become important tools in ocean research. Untethered from umbilical cables, these vehicles are suitable for a high variety of applications including bathymetric mapping, water sampling and environmental monitoring. A notorious challenge for AUVs is to navigate and \textit{georeference} acquired sensor data during operations as GPS signals can't propagate trough water. Conventional solutions to this issue involve adding acoustic navigational or/and positioning instruments to the AUV payload. Due to the good propagation of sound in water, doppler velocity loggers and acoustic baseline systems are considered the backbone in AUV navigation and underwater positioning \cite{b10}, \cite{b35}. However, these traditional sensors are often expensive and consumes large amounts of power. In AUV fleets, the cost of adding acoustic instruments is compounded with the number of vehicles. In this paper we consider a limited sensor suite consisting of an IMU sensor and a pressure transducer, where acoustic instruments are partially available to collect experimental training data. Collected DVL velocity measurements from only a few missions are used as a reference in supervised neural network training. The aim for the trained network is to complement DR navigation when the DVL sensor is inaccessible, for example in AUV fleets with budget limitations. \newline \newline The absence of acoustic navigational and positioning instruments has traditionally been compensated by model-based observers like Extended Kalman Filters (EKFs). These are derived from AUV dynamics to form an estimation model \cite{b8}, \cite{b9}, \cite{b31}, \cite{b32}. Unfortunately, model-based observers rely on parameters that are difficult to obtain in practice. The dynamics of an AUV is derived based on intricate hydrodynamic models. Experiments must be carried out in a towing-tank facility or using expensive CFD (Computational Fluid Dynamics) software to obtain hydrodynamic damping coefficients \cite{b38}, \cite{b3}. If the external geometry of the AUV changes, i.e. when making small modifications to payload sections, the coefficients need to be updated. \newline \newline To avoid deriving complex AUV models and conducting time consuming towing-tank or CFD experiments, this paper presents a data-driven approach to dead-reckoning navigation. Using experimental data from AUV missions and simulations, a neural network is trained to learn and generalize relative AUV motions. Data-driven neural network regression abolishes the need for knowledge of a dynamic model, and avoids modelling and estimation errors related to classical state observers \cite{b4}, \cite{b5}. A recurrent neural network (RNN) is developed to relax time-delayed effects in the AUV dynamics which occurs due to vehicle inertia, under actuation and added mass effects \cite{b1}, \cite{b6}. With an input layer composed of standard sensory measurements (pressure sensor, inertial measurement unit) and control actions, the RNN network aims to predict relative surge $u_{r}$ and sway $v_{r}$ velocities. These are further implemented in a dead-reckoning algorithm to approximate North and East positions during operations. \subsection{Related Work} Several articles have addressed artificial neural network state estimation for marine crafts. In Zhang \textit{et al.} \cite{b4} a Short-Term Long-Term-Memory (LSTM) recurrent neural network is proposed to estimate the relative position of an AUV. The LSTM network used data from a pressure sensor, an inertial measurement unit (IMU), and an acoustic doppler velocity logger (DVL) to predict the horizontal north and east positions. Training and validation data were collected from a series of surface trajectories while logging GPS locations, which were projected as ground truth measurements. A similar study with the same AUV is presented in Mu \textit{et al.} \cite{b5}, where a bi-directional LSTM network was used. A neural network approach to dead-reckoning navigation of dynamically positioned ships is presented in Skulestad \textit{et al.} \cite{b6}. Control actions and commands from vessel thrusters combined with heading measurements was used as input data in a RNN network to aid navigation during GNSS outages. Experiments were conducted in a vessel simulator with time-varying environmental disturbances such as wind forces, sea waves and ocean currents. In Chen \textit{et al.} \cite{b18} a neural network is presented to assist navigation during DVL malfunction. A nonlinear autoregressive network with exogenous SINS (Strapdown Inertial Navigation System) inputs was used. The network was tested and validated on a ship with a DVL mounted on the vessel hull to provide training and validation data. \newline \newline The remaining parts of this paper are detailing the following segments - Section II and III addresses the concept of dead-reckoning navigation and the neural network velocity observer respectively. Section IV presents the AUV platforms and datasets used to train and test the neural networks. The results are detailed in section V and the conclusion and recommendations for further work are presented in VI. \section{Dead-Reckoning Navigation} In the absence of GNSS (Global Navigation Satellite Systems) systems, AUVs enters a dead-reckoning mode while under water. The DR algorithm predicts the position of the AUV based on estimates at the previous time-step. With a reference of the heading and attitude combined with relative velocity measurements, the position is determined by numerical integration. To compute the relative position of the AUV, the measured/estimated relative velocities must be rotated with respect to the inertial reference frame of the vehicle. Following \cite{b1} the inertial frame of underwater vehicles is defined by North-East-Down (NED) local tangent plane coordinates. The NED velocities $\boldsymbol{\dot{\chi}} = [\dot{N}, \dot{E}, \dot{D}]^T$ of an AUV are derived by an rotation matrix from the body frame $\{b\}$ to the inertial frame $\{n\}$ \cite{b1}. An AUV influenced by ocean currents $\boldsymbol{\upsilon}_{c}$ will have a relative velocity $\boldsymbol{\upsilon}_{r}$. Assuming that the ocean currents are irrotational they are derived following \cite{b1} as $\boldsymbol{\upsilon}_{r} = [u_{r},v_{r},w_{r}]^T = [u - u_{c}, v - v_{c}, w - w_{c}]^T$. Accordingly, the relationship between the relative body-fixed and inertial velocities are given as \begin{equation} \boldsymbol{\dot{\chi}} = \boldsymbol{R}_{b}^{n}(\boldsymbol{\Theta})\cdot \boldsymbol{\upsilon}_{r} \label{ned_velocities} \end{equation} Where $\boldsymbol{\Theta} = [\phi, \theta, \psi]^T$ is the attitude and heading of the AUV provided by an inertial measurement unit (IMU). Equation \ref{ned_velocities} can be written in expanded form as \begin{equation} \begin{bmatrix} \dot{N} \\ \\ \dot{E} \\ \\ \dot{D} \end{bmatrix} = \begin{bmatrix} u_{r}\cdot c(\psi)c(\theta) + v_{r}\cdot [c(\psi)s(\theta)s(\phi) - s(\psi)c(\phi)] \\ + w_{r} \cdot[s(\psi)s(\phi) + c(\psi)c(\phi)s(\theta))] \\ \\ u_{r} \cdot s(\psi) c(\theta) + v_{r} \cdot [c(\psi) c(\phi) + s(\phi) s(\theta) s(\psi)] \\ \\ -u_{r} \cdot s(\theta) + v_{r} \cdot c(\theta) s(\phi) + w_{r} \cdot c(\theta) c(\phi) \\ \\ \end{bmatrix} \label{DR_expanded} \end{equation} where $c() = cos()$ and $ s() = sin()$. \newline For AUVs that typically operate with a zero angle of attack the attitude can be neglected in eq. \ref{DR_expanded}. However, for other vehicles like underwater gliders which can perform spiraling motions with non-zero attitude $[\phi,\theta]^T \neq 0$, it persist. After rotating the relative velocities according to the inertial frame of the vehicle, numerical integration is performed to obtain the position. Given the previous predicted position $\boldsymbol{\chi}_{t} = [N_{t}, E_{t}, D_{t}]^T$ the DR algorithm is derived following \cite{b6} \begin{equation} \boldsymbol{\chi}(t+1) = \boldsymbol{\chi}(t) + \boldsymbol{R}^{n}_{b}(\boldsymbol{\Theta})\cdot \boldsymbol{\upsilon_{r}}(t+1) \cdot \Delta t \label{DR_algo} \end{equation} Where $\Delta t$ is the time step between the predictions. \begin{figure}[h] \centering \includegraphics[width = 6.4cm]{AUV_DR_illustration.png} \caption{DR navigation Illustration} \label{fig:RNN} \end{figure} \section{Neural Network Aided Dead-Reckoning Navigation} \subsection{Sensor Inputs} On-board sensors like IMUs and pressure transducers contains valuable in-situ information about an AUV. These are used as input variables in the RNN network to predict relative horizontal velocities $[u_{r},v_{r}]^T$. The development of MEMS (Micro-Electrical-Mechanical-Systems) based IMUs have led to more affordable inertial measurements. They consist of three-axis gyroscopes and accelerometers, typically confined in a silicon chip. The gyroscope, which give measurements of the angular rates $\boldsymbol{\omega^{b}_{IMU}} = [p_{b}, q_{b},r_{b}]^T$ and the accelerometer which provide measurements of the rate-change of velocities $\boldsymbol{\dot{\upsilon}^{b}_{IMU}} = [\dot{u}_{b}, \dot{v}_{b},\dot{w}_{b}]^T$ can be modelled as \begin{equation} \begin{split} \boldsymbol{\omega}^{b}_{IMU} &= \boldsymbol{\omega}^{b}_{gyro} + \boldsymbol{b}^{b}_{gyro} \\ \boldsymbol{\dot{\upsilon}}^{b}_{IMU} &= \boldsymbol{\dot{\upsilon}}^{b}_{acc} + \boldsymbol{b}^{b}_{acc} \end{split} \end{equation} Where $\boldsymbol{b}^{b}_{gyro}$ and $\boldsymbol{b}^{b}_{acc}$ are sensor biases \cite{b43}. Combined with a three-axis compass, a Kalman Filter derived from a kinematic model impart the euler angles $\boldsymbol{\Theta} = [\phi, \theta, \psi]^T$. A key component in AUVs is the pressure transducer. The relationship between pressure and depth are assumed to be constant, thus the vertical position of the AUV can be approximated by the pressure measurements. Given a measured hydrostatic pressure $\Delta p$, water density $\rho$ and gravitation $g$, the vertical position $z$ and relative heave velocity $w_{r}$ is derived as \begin{equation} z = \rho g \Delta p \implies w_{r} = \boldsymbol{R}^{-1}_{bn}(\boldsymbol{\Theta}) \cdot \dot{z} \end{equation} Where $z$ is assumed to be inertial $\{n\}$ and the relative heave velocity $w_{r}$ is represented in the body-fixed frame $\{b\}$ \subsection{AUV Control Actuators} To enforce the neural network state observer, control actions from the AUV actuators are used together with the sensor data. In this paper two AUVs with different actuator configurations are investigated. Conventional underactuated AUVs are normally equipped with an aft thurster and external control surfaces. The thruster is the propulsion system which generates a hydrodynamic force $\tau$ to induce surge transnational motions, while control surfaces consist of external airfoils that alter attitude and heading depending on their deflection angles. The control surfaces typically consist of a rudder and dive planes denoted $\delta_{R}$ and $\delta_{D}$ respectively. Control actions are determined from feedback controllers which in these studies are decoupled into vertical and horizontal manoeuvres. For thruster based AUVs, speed controllers are used to maintain a desired velocity and reject ocean current disturbances. In addition to the conventional AUV actuators, a variable buoyancy system and internal moving masses are introduced by the AUVs investigated in this paper. The simulated autonomous underwater glider uses buoyancy displacement to alter vertical motions, while a set of fixed wings generates hydrodynamic lift forces to induce forward motions. As gliders operates at low-speeds, control surfaces are ineffective due to low dynamic pressure. Control moments from internal moving masses are used to change the attitude and heading of the vehicle. \subsection{RNN Architecture} The RNN architecture is formed with feedback loops in the hidden layers of the network, providing internal \textit{memory} to capture AUV dynamics with time-delays. To improve the estimation of the relative horizontal surge and sway velocities $[u_{r},v_{r}]^T$, two independent neural networks are used for each velocity vector. This is convenient as surge and sway dynamics are often non-interacting or slightly interacting \cite{b1}, \cite{b4}. Using input variables that holds low dependence to the predicted output variables reduces the generalization of the network and may lead to the notorious issue of \textit{overfitting} \cite{b30}, \cite{b24}. \begin{figure}[h] \centering \includegraphics[width = 9.3cm]{Oceans_RNN_final_rev1_copy.png} \caption{Neural network illustration} \label{fig:RNN} \end{figure} \newline RNN networks are generalized feedforward neural networks, but differs as recurring context layers are included in the hidden layers as illustrated in figure \ref{fig:RNN}. The hidden nodes $\boldsymbol{h}(t)$ summarize the inputs $\boldsymbol{x}$ and weights $w_{xh}$ from the previous layer combined with the recurring layer $\boldsymbol{h}(t-i)$. The hidden neurons $\boldsymbol{h(t)}$ and output neurons $\boldsymbol{y(t)}$ is derived mathematically as \begin{equation} \begin{split} \boldsymbol{h}(t) &= \sigma_{h}(\sum w_{xh} \cdot \boldsymbol{x} + \sum w_{hh}\cdot\boldsymbol{h}(t-i) + \boldsymbol{b}_{n}) \\ \\ \boldsymbol{y}(t) &= lin(\sum w_{hy}\cdot \boldsymbol{h}(t) + \boldsymbol{b}_{y}) \end{split} \end{equation} Trough sequential learning based on AUV datasets, the RNN network learns to predict the relative horizontal velocities. Activation functions $\sigma_{h}$ in the hidden layers are the key to learning the nonlinearity between the selected inputs and predicted outputs. The network is trained based on the renowned concept of \textit{backpropogation} introduced in \cite{b34} to tune the weights and biases. The goal of neural network training is to optimize the network parameters so that the error function $E$ is minimized \begin{equation} E = \frac{1}{2} \sum_{i}(\hat{\upsilon}_{r}(i) - \upsilon_{r}(i))^{2} \end{equation} Where $\hat{\upsilon}_{r}(i) - \upsilon_{r}(i)$ is the difference between the actual and predicted relative velocities. \subsection{Navigational training data} In this work, experimental DVL data and simulated velocities are used as a reference for the supervised neural network training. Alternative approaches may involve using acoustic positioning systems which are not prone to cumulative integration errors \cite{b10}, thus providing more accurate ground truth measurements. However, a disadvantage with these approaches is that the DVL/acoustic modem must be replaced with "dummy" sensor to avoid changing the hydrodynamic properties and net weight of the AUV. Ideally, we want to have a reference of the AUV velocities/positions without changing the geometry and weight. A potential solution is to use visual based (machine vision) pose estimation relative to an assisting AUV/ROV. Machine vision has proven to be successful in autonomous docking operations for AUVs \cite{b39},\cite{b40} and may possibly be extended to tracking applications. \section{AUV Platforms $\&$ Datasets} To train and validate the neural network approach to DR navigation, AUV datasets are needed. In this paper two AUV platforms are investigated. The first dataset originates from sea-trials of the Tethys Long-Range AUV (LRAUV), while the second dataset is from a MATLAB simulation of an underwater glider. \subsection{Tethys AUV} The Tethys Long-Range AUV \cite{b2}, \cite{b20} was developed by the Monterey Bay Research Institute (MBARI) as a research AUV with long-range capabilities. It's characterized as a hybrid AUV as it shares similar control actuators to underwater gliders. This allows it to operate both in undulating glider-like trajectories and at fixed depths. Datasets from the constellation of underwater vehicles at MBARI is available through their public data repository \cite{b24}. \begin{figure}[h] \centering \includegraphics[width=5.5cm]{TETHYS_OCEANS.jpg} \caption{Tethys AUV, courtesy of MBARI} \label{fig:Tethys_auv} \end{figure} \newline A series of missions in Monterey bay, California (U.S) were used to train and validate the neural networks. In-situ measurements from a Microstrain 3DM-GX5-24 IMU, Neil Brown pressure sensor and the control actuators were used as inputs to the neural network. Ground truth relative surge and sway velocities $[u_{r}, v_{r}]^T$ were provided by a LinkQuest 600 KHz micro DVL. With periodic GPS fixes the overall navigation accuracy for DVL-aided inertial DR is 3-4 $\%$ \cite{b2}. The navigational errors arise initially from sensor noise and random walk errors from the inertial measurement sensor. \newline The parameters for the IMU and DVL sensors hosted on the Tethys is presented in table \ref{tab:AHRS} and \ref{tab:DVL} respectively. The maximum operating altitude refer to \textit{bottom lock} navigation, where the AUV measures it's velocities relative to the seafloor. When out of range the DVL can measure the velocities relative to the water (\textit{water lock}). However, water is often considered as a moving reference frame due to ocean currents, which introduces estimation errors depending on the magnitude of the ocean current vector \cite{b10}. \begin{table}[h] \caption{Microstrain 3DM-GX5-25 IMU Parameters} \centering \begin{tabular}{c|c} Error & value \\ \hline Accelorometer Bias Instability & $\pm$ 0.04 mg \\ Gyroscope Bias Instability & $\pm$ $8^{\circ}/h$ \\ Attitude Accuracy & EFK - $\pm$ $0.25^{\circ}$ RMS \\ Heading Accuracy & EFK - $\pm$ $0.8^{\circ}$ RMS \\ \end{tabular} \label{tab:AHRS} \end{table} \begin{table}[h] \caption{LinkQuest 600 KHz Micro DVL Parameters} \centering \begin{tabular}{c|c} Parameter & Value \\ \hline Max Altitude & 110 meters \\ Min Altitude & 0.3 meters \\ Accuracy & 1 $\%$ $\pm$ 1 mm/s \\ Ping rate & 5 Hz \\ \end{tabular} \label{tab:DVL} \end{table} \newline A minor part of the training dataset is presented in figure \ref{fig:Tethys_dataset}. Sensor noise has been filtered out with low-pass filters and Gaussian smoothing. We can observe that the AUV performs saw-tooth trajectories by using the dive plane control surface and internal moving mass actuator. The heading is mostly constant which indicates that the AUV is on a course keeping path governed by a heading controller. \begin{figure}[h] \centering \includegraphics[width=8.6cm,trim={1.1cm 1.5cm 1.5cm 1cm},clip]{merged_tethys_rev1} \caption{Training data Tethys AUV} \label{fig:Tethys_dataset} \end{figure} \newpage \subsection{Underwater Glider} The second dataset is gathered from a MATLAB simulation of the Seawing underwater glider \cite{b3}, \cite{b12}. An underwater glider is characterized as a slender body with fixed wings. A variable buoyancy system (VBS) is used to manipulate the volume that the vehicle is displacing to alter vertical motions in the water column. Underwater gliders exploit hydrodynamic properties using fixed wings to generate a forward motion. To control the attitude and heading of the vehicle, an internal moving mass system is used. This typically consists of a battery-pack that can be translated and rotated inside the vehicle housing. A mathematical model of the glider is derived using the 6DOF vectorial marine craft dynamics presented in Fossen \cite{b1}. State variables can be divided into two vectors following SNAME notation \cite{b26} - The position in the inertial frame $\{n\}$ defined as $\boldsymbol{\eta} = [x,y,z,\phi,\theta,\psi]^T$ and the relative velocity in the body frame $\{b\}$ $\boldsymbol{\nu}_{r} = [u_{r},v_{r},w_{r},p,q,r]^T$. Accordingly, a 6DOF kinematic and maneuvering model of an AUV is derived by \begin{equation} \begin{split} &\boldsymbol{\dot{\eta}} = \boldsymbol{J_{\theta}}(\boldsymbol{\eta})\boldsymbol{\nu_{r}} \\ \\ &\boldsymbol{M}\boldsymbol{\dot{\nu_{r}}} + \boldsymbol{C}(\boldsymbol{\nu_{r}})\boldsymbol{\nu}_{r} + \boldsymbol{D}(\boldsymbol{\nu_{r}})\boldsymbol{\nu_{r}} + \boldsymbol{g}(\boldsymbol{\eta}) = \boldsymbol{\tau} \end{split} \end{equation} Where $\boldsymbol{M} = \boldsymbol{M}_{rb} + \boldsymbol{M}_{A}$ and $\boldsymbol{C}(\boldsymbol{\nu})$ = $\boldsymbol{C}_{rb}(\boldsymbol{\nu})$ + $\boldsymbol{C}_{A}(\boldsymbol{\nu})$ are the transnational and rotational rigid-body dynamics with correlating added mass effects. Hydrodynamic forces and moments are described in the damping matrix $\boldsymbol{D}(\boldsymbol{\nu})$ and the restoring forces are defined by $\boldsymbol{g}(\boldsymbol{\eta})$. $\boldsymbol{\tau}$ is the vector describing the control forces and moments which acts on the vehicle. \newline \newline In presence of ocean currents, the $\boldsymbol{relative}$ $\boldsymbol{velocity}$ is defined by differentiating the body-fixed velocities to the ocean current vector $\boldsymbol{\nu_{r}} = \boldsymbol{\nu} - \boldsymbol{\nu}_{c}$. In the Matlab simulation we consider a two-dimensional irrotational ocean current model. Given an absolute velocity $V_{c} = \sqrt{u_{c}^{2} + v_{c}^{2}}$ we can define the ocean currents in the body frame as \begin{equation} \boldsymbol{\nu}^{b}_{c} = \begin{bmatrix} V_{c}\cdot cos( \beta_{c} - \psi) \\ V_{c}\cdot sin( \beta_{c} - \psi) \\ 0 \end{bmatrix} \end{equation} Many chose to simplify the ocean current model to be constant in the body-fixed frame $\{b\}$, thus $\boldsymbol{\dot{\upsilon^{b}_{c}}}$ = 0 \cite{b27}. However, this only yields during course keeping. A more realistic approach is to assume that the ocean currents are time-varying with respect to rotational motions of the glider. Consider a skew-symmetric matrix $\boldsymbol{S}$ that satisfies $\boldsymbol{S(x)\cdot y} = \boldsymbol{x} \times \boldsymbol{y}$ and the angular velocities in the body frame $\boldsymbol{\omega_{b}}$, the ocean currents can be derived as \begin{equation} \dot{\boldsymbol{\nu}^{b}_{c}}= -\boldsymbol{S}(\boldsymbol{\omega_{b}})\cdot \boldsymbol{\upsilon}^{b}_{c} \end{equation} In order to model ocean currents in the 6DOF manoeuvring model, the rotational dynamics detailing Coriolis and centripetal forces must be derived using \textit{velocity-independent parametrizations} \cite{b1}. Given a center of gravity vector relative to the center of origin $\boldsymbol{r}_{cg} = [x_{cg}, y_{cg}, z_{cg}]^T$ the Coriolis and centripetal matrix can be defined as \begin{equation} \boldsymbol{C}_{rb}(\boldsymbol{\nu}) = \begin{bmatrix} m\cdot \boldsymbol{S}(\boldsymbol{\omega_{b}}) & -m\cdot\boldsymbol{S}(\boldsymbol{\omega_{b}}) \cdot \boldsymbol{S}(\boldsymbol{r}_{cg}) \\ m\cdot \boldsymbol{S}(\boldsymbol{r_{cg}})\cdot \boldsymbol{S}(\boldsymbol{\omega_{b}}) & -\boldsymbol{S}(\boldsymbol{I}_{b} \cdot \boldsymbol{\omega_{b}}) \end{bmatrix} \label{coriolis} \end{equation} Where $\boldsymbol{I}_{b}$ and $m$ is the vehicle inertia and total mass respectively. As demonstrated in eq.\ref{coriolis} the rotational dynamics is derived only using angular velocities $\boldsymbol{\omega_{b}} = [p,q,r]^T$, which satisfies the following property \cite{b1} \begin{equation} \boldsymbol{M}_{rb}\boldsymbol{\nu} + \boldsymbol{C}_{rb}(\boldsymbol{\nu}) \boldsymbol{\nu} = \boldsymbol{M}_{rb}\boldsymbol{\nu}_{r} + \boldsymbol{C}_{rb}(\boldsymbol{\nu}_{r})\boldsymbol{\nu}_{r} \end{equation} Glider dynamics was simulated in Simulink for a 10-hour interval. Time-varying control inputs and ocean currents were present during the simulation to provide variance in the training dataset. The simulated trajectories of the glider were a combination of undulating wings-levelled motions and turning/spiral manoeuvres. To control the attitude and heading of the glider, two decoupled PID controllers was implemented. The measured state variables were logged and saved to workspace during the simulation. Each training variable holds 81 000 samples, while the validation dataset resulted in 20 000 samples per variable. The test dataset is a combination of wings-levelled manoeuvres and spiral trajectories which differed from the trajectories used in the training data. Hence, we can validate how well the network is generalized to untrained glider motions. \begin{figure}[h] \centering \includegraphics[width=8cm,trim={0.68cm 1.6cm 1cm 1.2cm},clip]{Glider_training_data_latex} \caption{Simulated glider training data} \label{fig:seawing_MI} \end{figure} \newpage \section{Experimental and Simulation Results} This paper presents a two-folded study which consists of simulated and experimental datasets. Collected AUV data was allocated into Matlab and further used to develop, train, and test the neural networks. The predicted outputs was fed into the dead-reckoning algorithm derived in eq. \ref{DR_algo}. \newline The Deep Learning Toolbox was used to design network architectures and perform backpropogation training. A Scaled Conjugate Gradient (SCG) algorithm was chosen as the training function to deal with the large AUV datasets effectively. The SCG algorithm \cite{b34} abolish the need for line-searches as presented in its predecessor \cite{b35} which reduces the computational load. To improve the generalization of the neural networks, \textit{early-stopping} was introduced. Early-stopping divides the AUV dataset into training and validation batches. The training dataset is fed into the SCG algorithm to tune the weights and biases, while the validation data is used to monitor and detect if occurrences of overfitting is evident \cite{b42}. If the network starts to overfit the dataset, the training is aborted, hence the name early-stopping. \subsection{Case Study 1 - Tethys AUV} Experimental data from the Tethys AUV was investigated in the initial study. Data from three individual surveys was concatenated as a time-series vector and used as training data. Datasets from another mission is used to test the neural network on unseen data. The duration of the test trajectory is approximately 3 hours long. The mission, illustrated in figure \ref{fig:Tethys_survey_monterey}, was conducted in shallow waters were the on-board Link Quest Micro DVL was able to get a \textit{bottom-lock}, although some samples were out of reach for the operating altitude of the DVL sensor. Outliners in the DVL data was removed and further filtered with Gaussian smoothing. \begin{figure}[h] \centering \includegraphics[width=7cm]{Tethys_sawtooth_MAP_rev1.PNG} \caption{Test trajectory in Monterey Bay, California} \label{fig:Tethys_survey_monterey} \end{figure} \newline The test trajectories consist of undulating saw-tooth motions with non-zero angle of attack $\alpha$ as showed in figure \ref{fig:Tethys_auv_3D}. Note that periodic GPS fixes was not accounted for in the results presented in figure \ref{fig:Tethys_auv_3D} and \ref{fig:Tethys_DVL_vs_ANN}. Two RNN networks was developed to isolate relative surge and sway predictions. The following table presents the training parameters used for the Tethys AUV. \begin{table}[h] \caption{ANN Training parameters - Tethys AUV} \centering \begin{tabular}{c|c} & \\ \hline Backpropogation Optimizer & Scaled Conjugate Gradient (SCG) \\ MSE Surge Network & 0.0347 \\ MSE Sway Network & 0.00588 \\ Early Stopping Data Division & Randomly \\ Early Stopping index & Training 70 $\%$, Val. 15$\%$, Test 15$\%$ \\ Hidden layers & 3 \\ Hidden neurons per layer & 40 \\ Regressors per context layer & 5 \\ \end{tabular} \label{tab:Tethys_ANN_parameters} \end{table} \newline The results are presented in figure \ref{fig:Tethys_DVL_vs_ANN} and \ref{fig:Tethys_auv_3D}. The blue dotted line represents the predicted position based on estimated surge and sway velocities from the RNN network. The orange line is the estimated position based on measured DVL velocities. \begin{figure}[h] \centering \includegraphics[width=7.8cm,trim={0.5cm 0.2cm 0.6cm 0.3cm},clip]{Tethys_Sawtooth_oceans_2D} \caption{Neural network aided navigation - Top view} \label{fig:Tethys_DVL_vs_ANN} \end{figure} \newline A 3D view of the same trajectory is presented in figure \ref{fig:Tethys_auv_3D} where depth measurements from the pressure sensor is used for the vertical z-axis. \begin{figure}[h] \centering \includegraphics[width=8.2cm,trim={0cm 0.3cm 0.3cm 0.3cm},clip]{Tethys_Sawtooth_oceans_3D} \caption{Neural network aided navigation - 3D view} \label{fig:Tethys_auv_3D} \end{figure} \newpage The positioning error between the predicted and DVL-aided horizontal positions was used to evaluate the performance. The positioning error is derived as \begin{equation} \begin{bmatrix} N_{error} \\ E_{error} \end{bmatrix} = \begin{bmatrix} \hspace{0.05cm} || \hspace{0.05cm} N_{est} - \hat{N} \hspace{0.05cm} || \hspace{0.05cm} \\ \hspace{0.05cm} || \hspace{0.05cm} E_{est} - \hat{E} \hspace{0.05cm}|| \hspace{0.05cm} \end{bmatrix} \end{equation} Where $\hat{N}$ and $\hat{E}$ are ground truth north and east positions respectively. \begin{figure}[h] \centering \includegraphics[width=7.4cm,trim={0cm 0.1cm 0.3cm 0.3cm},clip]{Tethys_AUV_pos_error} \caption{Positioning Errors - Tethys AUV} \label{fig:Tethys_auv_error} \end{figure} \newline The positioning error relates to an approximate displacement of 2500 meters north and 1500 meter displacement in the east direction. Note that the ground truth north and east positions estimated based on DVL velocities also have estimation errors with an 3-4 $\%$ navigational accuracy \cite{b2}. \subsection{Case Study 2 - Underwater Glider} A second case study was conducted with the simulated autonomous underwater glider. Training and test datasets were generated by the Simulink simulation of the glider dynamics. A two-dimensional ocean current model was added in the dynamics to create a simulated environment that reflects real ocean conditions. Simulated ocean currents are assumed to be constant, but time-varying during glider rotations. \newline Due to decoupled attitude and heading controllers from the simulated trajectories, the interaction between the surge and sway dynamics is assumed to be neglectable. Thus, two isolated RNN networks was developed to predict the relative surge and sway velocities. \newline Table \ref{tab:glider_ANN_parameters} presents the neural network training parameters for the two RNN networks. \begin{table}[h] \caption{ANN Training parameters - Glider} \centering \begin{tabular}{c|c} & \\ \hline Backpropogation Optimizer & Scaled Conjugate Gradient (SCG) \\ MSE Surge Network & 0.000212 \\ MSE Sway Network & 0.00000459 \\ Early Stopping Data Division & Randomly \\ Early Stopping index & Training 70 $\%$, Val. 15$\%$, Test 15$\%$ \\ Hidden layers & 3 \\ Hidden neurons per layer & 50 \\ Regressors per context layer & 5 \\ \end{tabular} \label{tab:glider_ANN_parameters} \end{table} \newline The test trajectory presented in figure \ref{fig:seawing_ned} consists of two spiral motions and a wings-levelled movement. Three different ocean current scenarios was simulated with increasing magnitude, see figure \ref{fig:seawing_ocean_error}. The plot illustrated in figure \ref{fig:seawing_ned} shows the test dataset in presence of low currents - $u_{c} = -0.05 \hspace{0.1cm} m/s$ and $v_{c} = -0.002 \hspace{0.1cm} m/s$. \begin{figure}[h] \centering \includegraphics[width=8.8cm,trim={0.1cm 0.2cm 0.5cm 0.2cm},clip]{Seawing_spiral_oceans_currents} \caption{Estimated NED position vs ground truth} \label{fig:seawing_ned} \end{figure} \newline RNN velocity predictions is presented by the blue dotted line in figure \ref{fig:seawing_ned}. The orange line represents ground truth simulated NED positions. The glider trajectory was simulated for 2.7 hours. The remaining simulations with increasing ocean currents are presented in figure \ref{fig:seawing_ocean_error} where the north and east positioning errors are compared by the three different scenarios. Note that the x-axis relates to total samples with a rate of 2 Hz. Accordingly, the real simulation time was 10 000 sec. \begin{figure}[h] \centering \includegraphics[width=8.5cm,trim={1cm 0.3cm 1cm 0.4cm},clip]{ocean_current_pos_error} \caption{Positioning error with increasing ocean currents} \label{fig:seawing_ocean_error} \end{figure} \newline During the two first simulations with low and medium strong currents the positioning error is slightly increased. The simulation with strongest ocean currents induced a larger divergence for the east positioning error, while a low increase in the north error. \section{Conclusions And Further Work} A neural network approach to aid dead-reckoning navigation for AUVs with a limited sensor suite was proposed in this work. Experimental data from an IMU, a pressure sensor and control actions were gathered from sea-trials and simulations with correlating ground truth DVL and simulated velocities. The objective for the trained RNN networks is to complement AUV navigation in absence of acoustic navigational instruments. Results from the proposed method show promising potential considering a limited sensor payload. Improvements can be made by re-initializing the DR algorithm with GPS fixes when the AUVs are surfacing. The positioning error for the underwater glider grows slightly with increasing magnitude of ocean current disturbances as illustrated in figure \ref{fig:seawing_ocean_error}. Glider positioning errors are significantly lower compared to DVL-less traditional navigation algorithms used in commercial gliders \cite{b41}. However, sensor noise and random walk errors were not present in the simulated IMU measurements. Further iterations of the simulated environment will focus on adding more realistic scenarios by introducing sensor errors, GPS fixes and vertical decomposition of the ocean currents. \newline \newline Recommendations for further work include investigating alternative methods to obtaining experimental data. Vision based pose estimation is considered a promising candidate which avoids replacing the DVL or acoustic modem with a "dummy" sensor. Another interesting subject is to extend the deep learning approach to other underwater robots like remotely operated vehicles (ROVs). Compared to under-actuated AUVs, small/miniaturized ROVs are easy to deploy and does not require large displacements to excite the ROV dynamics, making the experimental procedures less time-consuming. \section{Acknowledgments} We thank the Monterey Bay Research Institute (MBARI) for granting access to mission data from the Tethys AUV. \newline This work was supported by the OASYS project funded by the Research Council of Norway (RCN), the German Federal Ministry of Economic Affairs and Energy (BMWi) and the European Commission under the framework of the ERA-NET Cofund MarTERA.
\section{Introduction} Please follow the steps outlined below when submitting your manuscript to the IEEE Computer Society Press. This style guide now has several important modifications (for example, you are no longer warned against the use of sticky tape to attach your artwork to the paper), so all authors should read this new version. \subsection{Language} All manuscripts must be in English. \subsection{Dual submission} Please refer to the author guidelines on the WACV 2022 web page (\url{http://wacv2022.thecvf.com/submission/}) for a discussion of the policy on dual submissions. \subsection{Paper length} Papers, excluding the references section, must be no longer than eight pages in length. The references section will not be included in the page count, and there is no limit on the length of the references section. For example, a paper of eight pages with two pages of references would have a total length of 10 pages. {\bf There will be no extra page charges for WACV 2022.} Overlength papers will simply not be reviewed. This includes papers where the margins and formatting are deemed to have been significantly altered from those laid down by this style guide. Note that this \LaTeX\ guide already sets figure captions and references in a smaller font. The reason such papers will not be reviewed is that there is no provision for supervised revisions of manuscripts. The reviewing process cannot determine the suitability of the paper for presentation in eight pages if it is reviewed in eleven. \subsection{The ruler} The \LaTeX\ style defines a printed ruler which should be present in the version submitted for review. The ruler is provided in order that reviewers may comment on particular lines in the paper without circumlocution. If you are preparing a document using a non-\LaTeX\ document preparation system, please arrange for an equivalent ruler to appear on the final output pages. The presence or absence of the ruler should not change the appearance of any other content on the page. The camera ready copy should not contain a ruler. (\LaTeX\ users may uncomment the \verb'\wacvfinalcopy' command in the document preamble.) Reviewers: note that the ruler measurements do not align well with lines in the paper --- this turns out to be very difficult to do well when the paper contains many figures and equations, and, when done, looks ugly. Just use fractional references (e.g.\ this line is $087.5$), although in most cases one would expect that the approximate location will be adequate. \subsection{Mathematics} Please number all of your sections and displayed equations. It is important for readers to be able to refer to any particular equation. Just because you didn't refer to it in the text doesn't mean some future reader might not need to refer to it. It is cumbersome to have to use circumlocutions like ``the equation second from the top of page 3 column 1''. (Note that the ruler will not be present in the final copy, so is not an alternative to equation numbers). All authors will benefit from reading Mermin's description of how to write mathematics: \url{http://www.pamitc.org/documents/mermin.pdf}. \subsection{Blind review} Many authors misunderstand the concept of anonymizing for blind review. Blind review does not mean that one must remove citations to one's own work---in fact it is often impossible to review a paper unless the previous citations are known and available. Blind review means that you do not use the words ``my'' or ``our'' when citing previous work. That is all. (But see below for techreports.) Saying ``this builds on the work of Lucy Smith [1]'' does not say that you are Lucy Smith; it says that you are building on her work. If you are Smith and Jones, do not say ``as we show in [7]'', say ``as Smith and Jones show in [7]'' and at the end of the paper, include reference 7 as you would any other cited work. An example of a bad paper just asking to be rejected: \begin{quote} \begin{center} An analysis of the frobnicatable foo filter. \end{center} In this paper we present a performance analysis of our previous paper [1], and show it to be inferior to all previously known methods. Why the previous paper was accepted without this analysis is beyond me. [1] Removed for blind review \end{quote} An example of an acceptable paper: \begin{quote} \begin{center} An analysis of the frobnicatable foo filter. \end{center} In this paper we present a performance analysis of the paper of Smith \etal [1], and show it to be inferior to all previously known methods. Why the previous paper was accepted without this analysis is beyond me. [1] Smith, L and Jones, C. ``The frobnicatable foo filter, a fundamental contribution to human knowledge''. Nature 381(12), 1-213. \end{quote} If you are making a submission to another conference at the same time, which covers similar or overlapping material, you may need to refer to that submission in order to explain the differences, just as you would if you had previously published related work. In such cases, include the anonymized parallel submission~\cite{Authors20} as additional material and cite it as \begin{quote} [1] Authors. ``The frobnicatable foo filter'', F\&G 2020 Submission ID 324, Supplied as additional material {\tt fg324.pdf}. \end{quote} Finally, you may feel you need to tell the reader that more details can be found elsewhere, and refer them to a technical report. For conference submissions, the paper must stand on its own, and not {\em require} the reviewer to go to a techreport for further details. Thus, you may say in the body of the paper ``further details may be found in~\cite{Authors20b}''. Then submit the techreport as additional material. Again, you may not assume the reviewers will read this material. Sometimes your paper is about a problem which you tested using a tool which is widely known to be restricted to a single institution. For example, let's say it's 1969, you have solved a key problem on the Apollo lander, and you believe that the WACV 70 audience would like to hear about your solution. The work is a development of your celebrated 1968 paper entitled ``Zero-g frobnication: How being the only people in the world with access to the Apollo lander source code makes us a wow at parties'', by Zeus \etal. You can handle this paper like any other. Don't write ``We show how to improve our previous work [Anonymous, 1968]. This time we tested the algorithm on a lunar lander [name of lander removed for blind review]''. That would be silly, and would immediately identify the authors. Instead write the following: \begin{quotation} \noindent We describe a system for zero-g frobnication. This system is new because it handles the following cases: A, B. Previous systems [Zeus et al. 1968] didn't handle case B properly. Ours handles it by including a foo term in the bar integral. ... The proposed system was integrated with the Apollo lunar lander, and went all the way to the moon, don't you know. It displayed the following behaviours which show how well we solved cases A and B: ... \end{quotation} As you can see, the above text follows standard scientific convention, reads better than the first version, and does not explicitly name you as the authors. A reviewer might think it likely that the new paper was written by Zeus \etal, but cannot make any decision based on that guess. He or she would have to be sure that no other authors could have been contracted to solve problem B. \medskip \noindent FAQ\medskip\\ {\bf Q:} Are acknowledgements OK?\\ {\bf A:} No. Leave them for the final copy.\medskip\\ {\bf Q:} How do I cite my results reported in open challenges? {\bf A:} To conform with the double blind review policy, you can report results of other challenge participants together with your results in your paper. For your results, however, you should not identify yourself and should not mention your participation in the challenge. Instead present your results referring to the method proposed in your paper and draw conclusions based on the experimental comparison to other results.\medskip\\ \begin{figure}[t] \begin{center} \fbox{\rule{0pt}{2in} \rule{0.9\linewidth}{0pt}} \end{center} \caption{Example of caption. It is set in Roman so that mathematics (always set in Roman: $B \sin A = A \sin B$) may be included without an ugly clash.} \label{fig:long} \label{fig:onecol} \end{figure} \subsection{Miscellaneous} \noindent Compare the following:\\ \begin{tabular}{ll} \verb'$conf_a$' & $conf_a$ \\ \verb'$\mathit{conf}_a$' & $\mathit{conf}_a$ \end{tabular}\\ See The \TeX book, p165. The space after \eg, meaning ``for example'', should not be a sentence-ending space. So \eg is correct, {\em e.g.} is not. The provided \verb'\eg' macro takes care of this. When citing a multi-author paper, you may save space by using ``et alia'', shortened to ``\etal'' (not ``{\em et.\ al.}'' as ``{\em et}'' is a complete word.) However, use it only when there are three or more authors. Thus, the following is correct: `` Frobnication has been trendy lately. It was introduced by Alpher~\cite{Alpher02}, and subsequently developed by Alpher and Fotheringham-Smythe~\cite{Alpher03}, and Alpher \etal~\cite{Alpher04}.'' This is incorrect: ``... subsequently developed by Alpher \etal~\cite{Alpher03} ...'' because reference~\cite{Alpher03} has just two authors. If you use the \verb'\etal' macro provided, then you need not worry about double periods when used at the end of a sentence as in Alpher \etal. For this citation style, keep multiple citations in numerical (not chronological) order, so prefer \cite{Alpher03,Alpher02,Authors20} to \cite{Alpher02,Alpher03,Authors20}. \begin{figure*} \begin{center} \fbox{\rule{0pt}{2in} \rule{.9\linewidth}{0pt}} \end{center} \caption{Example of a short caption, which should be centered.} \label{fig:short} \end{figure*} \section{Formatting your paper} All text must be in a two-column format. The total allowable width of the text area is $6\frac78$ inches (17.5 cm) wide by $8\frac78$ inches (22.54 cm) high. Columns are to be $3\frac14$ inches (8.25 cm) wide, with a $\frac{5}{16}$ inch (0.8 cm) space between them. The main title (on the first page) should begin 1.0 inch (2.54 cm) from the top edge of the page. The second and following pages should begin 1.0 inch (2.54 cm) from the top edge. On all pages, the bottom margin should be 1-1/8 inches (2.86 cm) from the bottom edge of the page for $8.5 \times 11$-inch paper; for A4 paper, approximately 1-5/8 inches (4.13 cm) from the bottom edge of the page. \subsection{Margins and page numbering} All printed material, including text, illustrations, and charts, must be kept within a print area 6-7/8 inches (17.5 cm) wide by 8-7/8 inches (22.54 cm) high. Page numbers should be in footer with page numbers, centered and .75 inches from the bottom of the page and make it start at the correct page number rather than the 9876 in the example. To do this find the secounter line (around line 33 in this file) and update the page number as \begin{verbatim} \setcounter{page}{123} \end{verbatim} where the number 123 is your assigned starting page. \subsection{Type-style and fonts} Wherever Times is specified, Times Roman may also be used. If neither is available on your word processor, please use the font closest in appearance to Times to which you have access. MAIN TITLE. Center the title 1-3/8 inches (3.49 cm) from the top edge of the first page. The title should be in Times 14-point, boldface type. Capitalize the first letter of nouns, pronouns, verbs, adjectives, and adverbs; do not capitalize articles, coordinate conjunctions, or prepositions (unless the title begins with such a word). Leave two blank lines after the title. AUTHOR NAME(s) and AFFILIATION(s) are to be centered beneath the title and printed in Times 12-point, non-boldface type. This information is to be followed by two blank lines. The ABSTRACT and MAIN TEXT are to be in a two-column format. MAIN TEXT. Type main text in 10-point Times, single-spaced. Do NOT use double-spacing. All paragraphs should be indented 1 pica (approx. 1/6 inch or 0.422 cm). Make sure your text is fully justified---that is, flush left and flush right. Please do not place any additional blank lines between paragraphs. Figure and table captions should be 9-point Roman type as in Figures~\ref{fig:onecol} and~\ref{fig:short}. Short captions should be centred. \noindent Callouts should be 9-point Helvetica, non-boldface type. Initially capitalize only the first word of section titles and first-, second-, and third-order headings. FIRST-ORDER HEADINGS. (For example, {\large \bf 1. Introduction}) should be Times 12-point boldface, initially capitalized, flush left, with one blank line before, and one blank line after. SECOND-ORDER HEADINGS. (For example, { \bf 1.1. Database elements}) should be Times 11-point boldface, initially capitalized, flush left, with one blank line before, and one after. If you require a third-order heading (we discourage it), use 10-point Times, boldface, initially capitalized, flush left, preceded by one blank line, followed by a period and your text on the same line. \subsection{Footnotes} Please use footnotes\footnote {This is what a footnote looks like. It often distracts the reader from the main flow of the argument.} sparingly. Indeed, try to avoid footnotes altogether and include necessary peripheral observations in the text (within parentheses, if you prefer, as in this sentence). If you wish to use a footnote, place it at the bottom of the column on the page on which it is referenced. Use Times 8-point type, single-spaced. \subsection{References} List and number all bibliographical references in 9-point Times, single-spaced, at the end of your paper. When referenced in the text, enclose the citation number in square brackets, for example~\cite{Authors20}. Where appropriate, include the name(s) of editors of referenced books. \begin{table} \begin{center} \begin{tabular}{|l|c|} \hline Method & Frobnability \\ \hline\hline Theirs & Frumpy \\ Yours & Frobbly \\ Ours & Makes one's heart Frob\\ \hline \end{tabular} \end{center} \caption{Results. Ours is better.} \end{table} \subsection{Illustrations, graphs, and photographs} All graphics should be centered. Please ensure that any point you wish to make is resolvable in a printed copy of the paper. Resize fonts in figures to match the font in the body text, and choose line widths which render effectively in print. Many readers (and reviewers), even of an electronic copy, will choose to print your paper in order to read it. You cannot insist that they do otherwise, and therefore must not assume that they can zoom in to see tiny details on a graphic. When placing figures in \LaTeX, it's almost always best to use \verb+\includegraphics+, and to specify the figure width as a multiple of the line width as in the example below {\small\begin{verbatim} \usepackage[dvips]{graphicx} ... \includegraphics[width=0.8\linewidth] {myfile.eps} \end{verbatim} } \subsection{Color} Please refer to the author guidelines on the WACV 2022 web page (\url{http://wacv2022.thecvf.com/submission/}) for a discussion of the use of color in your document. \section{Final copy} You must include your signed IEEE copyright release form when you submit your finished paper. We MUST have this form before your paper can be published in the proceedings. Please direct any questions to the production editor in charge of these proceedings at the IEEE Computer Society Press: \url{https://www.computer.org/about/contact}. {\small \bibliographystyle{ieee_fullname} \section{Conclusion} \label{sec:conclusion} In this paper, we present a new approach to estimate the layout of a room from its single image. While most of the recent approaches for this task use robust features learnt from data, they resort to optimization when detecting the final layout. In addition to using learnt robust features, the proposed approach learns an additional ranking function to estimate the final layout instead of using optimization. To learn this ranking function, we propose a framework to train a deep neural network using max-margin structure cost. Also, while most approaches aim at detecting cuboidal layouts, our approach detects non-cuboidal layouts for which we explicitly estimates layout complexity parameters. We use these parameters to propose layout candidates in a novel way. Our approach shows state-of-the-art results on standard datasets with mostly cuboidal layouts and also performs well on a dataset containing rooms with non-cuboidal layouts. \subsection{Robust layout features extraction} \label{sec:features} Robust features are fundamental for correctly localizing candidate room layouts. As suggested by the success of recent works~\cite{PIONet, Mallya,LayoutNet,RoomNet}, we advocate that these features are better learned from data. Consequently, we propose using three kinds of such features together: boundary, corner and segmentation maps. We believe these complement each other in terms of information content and robustness. For instance, visible wall-wall and wall-ceiling boundaries are usually best captured by boundary confidence maps. While wall-wall-ceiling corners are best captured by corner confidence maps. Finally, occluded wall-floor boundaries and wall-wall-floor corners are best captured by analyzing the masks of occluding furniture items in segmentation maps. Beyond estimating the aforementioned visual layout features, we propose using an additional network branch to predict the complexity of the scene depicted in the input image. We define room layout complexity as the number of visible walls in the scene. Since we perform semantic segmentation rather than instance segmentation, our segmentation maps do not separate different walls. Therefore, the predicted number of visible of walls nicely complements the segmentation information. Our proposed RoomStructNet feature extraction module takes an image as an input, and predicts three per-pixel maps and one value representing layout complexity level (see Figure~\ref{fig: whole pipeline}). The corner map, $M_c$, is a 2-channel image with pixel values expressing the confidence of detecting $wwf$ and $wwc$ corners, respectively, in each channel. The boundary map, $M_b$, is a 4-channel image where pixel values in each channel denote, respectively, the confidence of detecting $ww$, $wf$, and $wc$ boundaries as well as non-boundary locations. The segmentation map, $M_s$, is a 3-channel image with each pixel labeled as wall $w$, floor $f$, or ceiling $c$. These labels are the result of a layout segmentation task, which ignores the occluding objects like furniture and labeling as if the room was empty. The module also outputs the predicted layout complexity level as a scalar $\mathcal{C}$, with $\mathcal{C}\geq 0$. To extract these features we use a Dilated Residual Network (DRN)~\cite{yu2017dilated} with a configuration of 105 layers as our backbone network. To the network branches for corner, boundary, and segmentation prediction tasks, we add two convolutional layers with batchnorm and softmax in our network design. To the layout complexity level prediction branch, we add a fully connected layer at the end, which outputs the predicted number of visible walls. We train our proposed feature extraction network in two stages. First, we train jointly the DRN-105 backbone and the subsequent network branches of all four tasks until convergence. Second, we fix parameters of the DRN-105 backbone, and follow by training each branch separately with a smaller learning rate. We employ $L_2$ regression loss for the layout complexity prediction task and binary cross entropy loss for the other three tasks. The total loss of the network is the sum of the losses of all four tasks. \section{Introduction} \label{sec:intro} The problem of room layout estimation from a single image corresponds to identifying the extent of walls, floor, and ceiling of the depicted room as if it was empty. Room layout estimation is a fundamental component of indoor scene understanding that remains unsolved. Furthermore, it has recently gained great interest due to its direct application to holistic scene understanding~\cite{huang2018cooperative, huang2018holistic}, robotic navigation~\cite{IM2CAD} and augmented reality~\cite{gal2014flare, sra2016procedurally}. \begin{figure}[t] \centerline{ \begin{tabular}{c} \resizebox{0.4\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/PipelineComparison.png}}} \\ \end{tabular}} \caption{Comparison of layout prediction pipelines between existing literatures and the proposed approach. The proposed approach differs from existing literatures and has improvement at every step. We use bold font to highlight key contribution and difference of the proposed approach at each step.} \label{fig: pipeline comparison} \end{figure} The first stage of most existing approaches is to detect features to localize the layout, see Figure~\ref{fig: pipeline comparison} left. For instance, classical approaches use vanishing point aligned line segments~\cite{Hedau, Gupta}, superpixels~\cite{Zhang}, or edges~\cite{Mallya}. More recent works have replaced these bottom up image features with CNN based features learned from data, such as: informative edge maps~\cite{Mallya, Ren}, location of boundaries where two room surfaces meet (e.g. wall-wall boundaries)~\cite{PIONet,LayoutNet}, location of corners where three room surfaces meet (e.g. wall-wall-floor corner)~\cite{RoomNet,LayoutNet}, segmentation masks of room surfaces~\cite{IM2CAD,DasGupta,Ren} or depth maps of dominant planes~\cite{GeoLayout, RenderAndCompare}. In a similar manner, we propose to use room boundaries, corners, and surface labels as features to learn. We believe these have complementary information that provides robustness to clutter, which will allow us to estimate better layouts. After feature detection, most approaches use the detected features to estimate a cuboidal layout, see Figure~\ref{fig: pipeline comparison} left. Assuming the room to have a box shape allows for easier parameterization and solution search. Many approaches explicitly estimate orthogonal vanishing points and enforce walls to be oriented along these~\cite{Hedau,Gupta,Mallya,Ren}. Others assume existence of at most 3 walls while estimating surface labels~\cite{DasGupta,Ren}. More recent approaches limit themselves only to layout configurations of visible walls, floor, and ceiling that can occur for a cuboidal layout~\cite{PIONet}. Some approaches even detect the configuration explicitly from a predefined small set of cuboidal room layout types~\cite{RoomNet}. It is worth noting that not all rooms can actually be modeled as a box. This is especially true for modern homes with multi-functional rooms like living room/kitchen area or master bedroom/bathroom area. Hence, we propose a generic room layout model that can also handle such rooms with arbitrary number of walls. Additionally, as part of our feature extraction we propose to train a network to find the parameters of our generic layout model that best suit the given input image, see Figure~\ref{fig: pipeline comparison} right. Moreover, we propose a novel sampling algorithm that generates plausible room layouts based on the estimated generic layout parameters and the attention provided by our robust learned features. Recent approaches that attempted generalization to non-cuboidal layouts operate on panoramic images, whereas we operate on perspective images~\cite{LayoutNet, fernandez2020corners}. The work in~\cite{flat2Layout} uses a representation to detect non-cuboidal layouts which estimates the probability of wall-wall boundary locations and corners in a reprojected the image and uses it to sample layouts. Similarly,~\cite{RenderAndCompare, howard2018thinking} uses planes estimated by analyzing RGB or RGBD images to sample non-cuboidal layouts. In contrast to these works, our model explicitly outputs generic layout parameters such as number of visible walls and corners, instead of just sampling non-cuboidal layouts. \begin{figure*}[ht] \centerline{ \begin{tabular}{c} \resizebox{0.9\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/WholePipeline.png}}} \\ \end{tabular}} \caption{Our RoomStructNet pipeline. First, we predict different feature maps and the layout complexity level using a trained featured extraction network, whose process is shown by the black arrows. Second, we propose candidate layouts using the extracted features and the complexity level, shown by the grey arrows. Lastly, we score the candidate layout, shown by the blue arrow.} \label{fig: whole pipeline} \end{figure*} In order to estimate the room layout, most approaches either use heuristics or an optimization procedure guided by the layout features extracted in previous stages, see Figure~\ref{fig: pipeline comparison} left. These can include aggregating detected features in layout regions~\cite{Ren}, using physics inspired gradient descent on layout boundary confidence maps~\cite{PIONet}, greedy descent of layout boundaries using layout surface label confidence maps~\cite{DasGupta} or optimization using combined 2D and 3D cost functions~\cite{LayoutNet,RenderAndCompare}. Layout structure is complex, it needs to satisfy many constraints such as perpendicularity of floor and walls, planar nature of each surface. Hence, it may require non-trivial combinations of multiple kinds of features. We do believe these combinations are best learned from data. For instance, to exploit the structured nature of a layout, the seminal work of~\cite{Hedau} uses max-margin structured output regression to train a layout ranker as a linear combination of different kinds of features. Instead of a linear combination, we propose a neural network to score layouts and rank them. In addition, we propose a novel way to train this neural network using max-margin structure cost. Comparing to methods~\cite{pintore2020atlantanet} estimating generic layouts from 360\si{\degree} image, the proposed approach address generic layout estimation by using a single perspective image. To evaluate our proposed method, we conduct experiments on the challenging Hedau~\cite{Hedau} and LSUN~\cite{yu2015lsun} room layout benchmark dasasets. Our method outperforms the current state of the art approach of Hsian $\etal$~\cite{flat2Layout} in both datasets by a clear margin. Note that these datasets contain only cuboidal layouts ground truth annotations. Therefore, we created a new dataset with rooms with generic non-cuboidal layouts to fully evaluate the potential of our method. This dataset consists of a large collection images (50K) extracted from panoramas of the PanoContext~\cite{zhang2014panocontext} dataset and relabeled by us. Our method obtains impressive qualitative results on this more challenging unconstrained data, while achieving decent quantitative performance. Our main contributions are: \begin{compactenum} \item We propose a novel generic room layout estimation system that achieves the state-of-the-art performance in both cuboidal and non-cuboidal/generic layout datasets. \item We propose a non-cuboidal layout parametric representation able to handle increasingly complex layouts. For this, we explicitly learn to predict its complexity parameters. \item We present a new way to generate layout candidates based on multiple kinds of feature maps, predicted layout complexity, and visual cue alignment. \item We are, to the best of our knowledge, the first to propose using a deep neural network to rank candidate layouts. For this, we introduce a new framework to train a CNN using max-margin structure loss. \end{compactenum} \section{RoomStructNet for layout estimation} \label{sec:RoomStructNet} Our proposed system RoomStructNet takes an indoor scene image as an input, and estimates its non-cuboidal layout. We are able to handle complex non-cuboidal rooms thanks to our generic layout representation, detailed in Section~\ref{sec:representation}. We show a diagram of our full pipeline in Figure~\ref{fig: whole pipeline}. In the first stage, RoomStructNet uses a network to detect robust layout features as confidence maps that encode layout boundaries, corners, and surface segmentations. This is shown by black arrows in Figure~\ref{fig: whole pipeline}, and discussed in Section~\ref{sec:features}. In the next stage, RoomStructNet uses the computed robust features to generate candidate layouts, shown by gray arrows in Figure.~\ref{fig: whole pipeline}. We present our layout candidate generation methodology in Section~\ref{sec:Proposing layout}. In the last stage, RoomStructNet embeds the candidate layouts jointly with their robust features, and scores them to select the final estimated layout. This process is shown by blue arrows in Figure~\ref{fig: whole pipeline}, and described in Section~\ref{sec:ranking}. \subsection{Generic layout candidate generation} \label{sec:Proposing layout} We pose the problem of layout estimation as an object detection task, where the goal is to detect the layout that best suits the input image. Deep learning based object detection methods can be broadly categorized into two groups. First, we have methods that pose object detection as a regression problem and adopt a unified framework to achieve the goal of either classifying or localizing objects~\cite{redmon2016you, liu2016ssd, najibi2016g}. And then, we have methods that follow the traditional object detection pipeline. That is, first target proposals are produced, and then each proposal is either classified or rank each into different object categories~\cite{girshick2014rich,he2015spatial,girshick2015fast,he2017mask}. Our proposed approach belongs to the second group: we first generate candidate layouts, and then we rank them to obtain the final layout estimate. The goal of our layout candidate generation is to propose wide range of plausible generic layouts that can potentially fit the image with high accuracy. And we do this without the assumption of cuboidal room layout. To achieve this goal, we adopt a two stage process. In the first stage, we initialize all possible layouts for the given predicted layout features and complexity level. In the second stage, we use different visual cues to fine-tune the initial layout candidates and increase the accuracy of their localization. \subsubsection{Candidate layout initialization} \label{sec:Initializing layouts} In contrast to many previous works~\cite{hirzer2020smart,Hedau,DasGupta}, we do not assume that the layout is cuboidal, and hence we cannot initialize the layouts using a limited number of predefined layout templates. We instead rely upon the signals provided by layout features and complexity level predicted by our network described in Sec.~\ref{sec:features} to initialize layouts. During the training of our feature extraction network, we noticed that our prediction of boundary map $M_b$ and layout complexity level $\mathcal{C}$ is very precise for most cases -- the prediction overestimates the number of walls in 16\% of cases but never underestimates the number. So our initialization process uses predicted boundary as a starting point and produces room layout candidates with at most $\mathcal{C}$ walls. We consider all possible combinations of presence of ceiling, walls and floors in an image during the initialization, which includes $\{c,w,f\}, \{c,w\}, \{w,f\}$ and $\{w\}$. To begin with, our initialization process detects $ww$ boundary candidates by using the boundary map $M_b$. Since $ww$ boundaries are mostly visible and crisp in input images, line detection on $M_b$ is straight forward. To detect these boundaries, we use image thresholding followed by morphological operation and line fitting on $M_b$. To guarantee high recall for later stages, we also extract additional boundaries from the corner map $M_c$. For this, we first compute the vanishing points of the image corresponding to three principal orthogonal directions using approach introduced in~\cite{lu20172}. Since we are not assuming the layout to be cuboidal, the vanishing points corresponding to horizontal room planes are not useful for us. We however assume the room walls to be vertical, hence we trust and use the vertical vanishing point in our work. Each pixel of our corner map $M_c$ describes the confidence of detecting one of ${wwf, wwc}$ corner types. We thus detect $wwf$ corners and $wwc$ corners by finding local maxima in $M_c$. We then create bipartite connections between every $wwf$ and $wwc$ corner pair. To select valid $ww$ boundaries, we examine alignment between each $ww$ boundary and the vertical vanishing point. When vanishing point is not successfully computed, the $ww$ boundaries are compared with vertical direction. Figure~\ref{fig: corner wwlines} shows this process of extracting lines from $M_c$. \begin{figure}[th] \centerline{ \begin{tabular}{c} \resizebox{0.47\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/corner_wwlines_pipeline.png}}} \\ \end{tabular}} \caption{An illustration of the wall-wall boundaries proposing process. Given a predicted corner map, as shown in (A), we extract all local maximum as corner candidates and construct bipartite connections between the ceiling corners and the floor corners, as shown in (B). We then compare each ceiling-floor connection with the vertical vanishing point, shown in (C), and select the final wall-wall boundaries that follow the vanish point constraint, shown in (D). } \label{fig: corner wwlines} \end{figure} We then generate layout candidates using the detected $ww$ boundaries. Suppose we detect $N$ $ww$ boundary candidates from the maps $M_b$ and $M_c$ using the approach decribed above. To propose a layout containing $\mathcal{C}$ walls, we first select $\mathcal{C}-1$ of the $N$ $ww$ boundary candidates. We then find the top and bottom point for each $ww$ boundary line segment, corresponding to the $wwc$ and $wwf$ corner, using the floor and ceiling regions of the surface segmentation mask $M_s$. We illustrate this process in Figure~\ref{fig: Initialize layouts}. First we find the intersection between each $ww$ line and region boundaries in $M_s$. If any intersection is too close to an image edge, we will instead replace it with the junction between $ww$ and the image boundary. Finally, we connect the ceiling and floor points in order to form ceiling and floor regions respectively. At the end of the initialization process we obtain many layout candidates. \begin{figure}[htb] \centerline{ \begin{tabular}{cc} \resizebox{0.12\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/sun_abufjhynjnqneima_start.png}}} & \resizebox{0.12\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/sun_abufjhynjnqneima_layout2.png}}} \\ (A) & (B) \end{tabular}} \caption{An examle of layout initialization using $ww$ boundaries and $M_s$ segmentation mask. (A) First, we compute the intersections between $ww$ and $M_s$ mask. If any intersection is too close to an image boundary, we will set it to the intersection of $ww$ and the same boundary. (B) We initialize a layout by connecting ceiling and floor intersections. } \label{fig: Initialize layouts} \end{figure} \subsubsection{Visual cue alignment for layout candidate refinement} \label{sec:optimizing layouts} So far we have obtained a collection of initialized layouts $\textbf{L} = \{L_i\}_{i=0}^n$ of the given input image. Many previous works conduct an optimization process that iteratively move layout connection joints to achieve better score and select the layout with best score as the final output. Although an optimization process can improve layout accuracy, it also comes with drawbacks. First, it is computationally expensive and sometime requires a heuristic stopping criteria. Secondly, many works use the predicted feature map as the optimization space, which often leads to local minimas due to lack of actual visual signals. Instead of executing an iterative optimization process, we refine the candidates by aligning layout lines to visible cues in the scene, as illustrated in Figure~\ref{fig: layout alignment}. We first extract all visible line segments from the input image, and then align the initial layout boundaries to nearby line segments. We log all intermediate layouts and treat them as layout candidates as well. Our refinement procedure should in theory produce similar or better results compared to an optimzation-based approach. For scenes without occlusion, the layout initialization described in the previous section can already generate accurate layouts without additional refinement. For scenes with completely occluded layout boundaries and corners, an optimization process lacks additional signal compared to the feature extraction network. For scenes with partial occlusions, since some parts of layout lines and corners are still visible and detectable, our alignment-based approach has direct signals to improve the layout candidates. Our experiment results also validate our hypothesis here. \begin{figure}[htb] \centerline{ \begin{tabular}{ccc} \resizebox{0.14\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/visual_cue/sun_bhihhtiqlhpcpigw_notaligned.png}}} & \resizebox{0.14\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/visual_cue/sun_bhihhtiqlhpcpigw_cues.png}}} & \resizebox{0.14\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/visual_cue/sun_bhihhtiqlhpcpigw_aligned.png}}} \\ (A) & (B) & (C) \end{tabular}} \caption{An example of the visual cues alignment process. Given an initial layout propose in (A), we generate an layout aligned to the visual cues in (C). We show all computed visual cues in (B) and highlight the line segments used for alignment in green. } \label{fig: layout alignment} \end{figure} \subsection{Candidate layout scoring using CNNs} \label{sec:ranking} Given an image $\mathrm{I}$ and a layout $L_{i}$ proposed by the methodology described in Sec.~\ref{sec:Proposing layout}, we want to determine whether it is a correct layout for the image. One approach is to pose this task as classifying the layout as correct or not, but proposing the ground truth layout is difficult. Instead, like most prior works, we formulate this task as learning a scoring function $f_s(L_{i},\mathrm{I})$ that will assign a higher score to a layout more similar to the ground truth. We illustrate the layout scoring process with the blue arrows in the network architecture in Figure.~\ref{fig: whole pipeline}. To jointly embed the image and a layout, we take concatenated network outputs from one layer before the layout features (described in Section.~\ref{sec:features}) and append them with the layout boundary image $\mathrm{I}^{L_{i}}$ produced from the candidate layout. We then pass it through a network with two Atrous residual blocks~\cite{chen2018encoder} to generate the final layout score. To reinforce the information provided by the candidate layout, we again append $\mathrm{I}^{L_{i}}$ to the network output between the two Atrous residual blocks. Given a set of proposed layouts $\textbf{L} = \{L_{i}\}_{i=1}^{n}$, our system selects the layout with the maximum score as the output: \begin{equation*} L^*=\argmax_{L_{i} \in \textbf{L}}f_s(L_{i},\mathrm{I}). \end{equation*} \textbf{Training using max-margin structure cost.} Room layout is more than just a classification label; it is a complex construct containing structural information of the scene, such as location and orientation of layout lines and their intersections. In this structured space, layouts which are closer to the ground truth should be penalized less than those further away. Thus we use the max-margin structure cost inspired by~\cite{zhang2015improving,li2015maximum} to train our network, which forces the score of the ground truth layout $\hat{L}$ of an image $\mathrm{I}$ to be larger than that of another layout $L_{i}$ by a margin $\Delta(L_{i},\hat{L})$, a non-negative function computing the deviation between two layouts. In this setup, we aim to minimize the structure cost \begin{equation*} E(L_i)=\max \left(0, f_s(L_{i},\mathrm{I}) + \Delta(L_{i},\hat{L}) - f_s(\hat{L},\mathrm{I}) \right). \end{equation*} For the cost function, we minimize the cost for all available layouts, as described in Eq.~\ref{eq:cost2}. In the original Support Vector formulation in~\cite{tsochantaridis2004support}, the authors minimize the cost while maintaining margin constraints by using only the layout that violates the margin constraint the most, as described in Eq.~\ref{eq:cost1}. In their setup, this drastically reduces the number of constraints and hence the linear system of equations to be solved in each iteration. However, for our neural network formulation this adds complexity of search to otherwise differential formulation. We thus chose to adopt Eq.~\ref{eq:cost2}, which leads to faster convergence and allows more training samples and constraints to be utilized. \begin{eqnarray} C_1 &=& \max\nolimits_{i} E(L_i) \label{eq:cost1}\\ C_2 &=& \sum\nolimits_{i}E(L_i)\label{eq:cost2} \end{eqnarray} \textbf{Computing the margin $\Delta(,)$.} Our margin function computes the deviation of a layout $L_i$ from the ground truth layout $\hat{L}$ as a combination of a line-based deviation and area-based deviation, as described in Eq.~\ref{eq:margin}. The line based deviation computes the distance between the respective layout boundaries of the two layouts, by summing the pixel distance and angular distance, as described in Eq.~\ref{eq:margin_line}. To compute the area based deviation, we first convert a layout to the floor/wall/ceiling area masks, denote as $\{M^f,M^w,M^c\}$ respectively, by constructing the wall, ceiling and floor polygons as described in Sec.~\ref{sec:representation}. We then compute $D_{area}$ as defined in Eq.~\ref{eq:margin_area}, where the first term computes the area shrunk in prediction compared with the ground truth, and the second term computes Intersection-over-Union (IOU). In practice, we only consider the floor mask in the computation because floor affordance is more important in most applications. \begin{eqnarray} &\Delta(L_i,\hat{L})=D_{line}(L_i,\hat{L}) + D_{area}(L_i,\hat{L}) \label{eq:margin}\\ &D_{line}(L_i,\hat{L}) = \|L_i,\hat{L}\|^2 + \cos(L_i,\hat{L}) \label{eq:margin_line}\\ &D_{area}(L_i,\hat{L}) = \sum\limits_{\alpha \in \{f, w, c\}} 2-\frac{|M_i^{\alpha} \cap \hat{M}^{\alpha}|}{|\hat{M}^{\alpha}|} -\frac{|M_i^{\alpha} \cap \hat{M}^{\alpha}|}{|M_i^{\alpha} \cup \hat{M}^{\alpha}|} \label{eq:margin_area} \end{eqnarray} \subsection{Generic layout representation} \label{sec:representation} Following the seminal work of Hedau et al.~\cite{Hedau}, most approaches attempt to estimate boxy layouts that segment an image into wall ($w$), ceiling ($c$) and floor ($f$) polygons. This is typically done by either sampling Manhattan rooms using orthogonal vanishing points, or relying upon 11 types of room layout configurations specified in the LSUN dataset~\cite{yu2015lsun}. Unlike previous works, here we propose a representation that makes no grossly simplifying assumptions about the captured room, such as perpendicularity of walls, the number of existing walls, or limited predefined room configurations. We only assume that all walls are vertical to the floor. Given an image $I \in \mathbb{R}^{m\times n \times 3}$, we represent a layout $L$ containing an arbitrary number of walls $n$ as an ordered collection of wall-wall ($ww$) boundaries, which are defined by line segments $L=\{l_0^{ww}, l_1^{ww},\ldots,l_n^{ww}\}$. These line segments should all ideally intersect at the vertical vanishing point lying outside the image. Each segment $l_i$ joins a wall-wall-floor ($wwf$) corner $(x_i^f,y_i^f)$ with a wall-wall-ceiling ($wwc$) corner $(x_i^c,y_i^c)$. These corners can lie either inside the image if visible, or at image boundaries if not visible in the image. To account for $ww$ boundaries for walls not fully visible in the image, we allow $l_0$ to lie on the left image boundary and $l_n$ to lie on the right image boundary. Given the $ww$ line segments, the $i$-th $wf$ segment $l_i^{wf}$ is computed by joining $(x_i^f,y_i^f)$ and $(x_{i+1}^f,y_{i+1}^f)$. The floor polygon is computed by joining $wwf$ corners and the image boundaries. The $wc$ boundaries and ceiling polygon can be constructed in a similar fashion. As a dual representation for layout $L$, we create a 3-channel layout boundary image $I^L$ with each channel encoding one of $ww$, $wf$ or $wc$ boundaries. \section{Experiments} \label{sec:results} In this section, we show our experiment setup and discuss results of the proposed approach. \subsection{Datasets} \label{sec:datasets} We evaluated the proposed approach on two challenging room layout benchmarks: Hedau dataset~\cite{Hedau} and LSUN scene understanding dataset~\cite{yu2015lsun}. Hedau dataset consists of 209 training images and 105 testing images. LSUN is a relatively larger dataset, consisting of 4000 training images, 394 validation images, and 1000 testing images. Both benchmarks assume cuboidal layouts in images. Since Hedau dataset contains too few training images, we did not train the network separately on this dataset. We instead followed the previous works~\cite{Zhang,IM2CAD,PIONet} and performed testing on both LSUN and Hedau datasets using the model trained only on LSUN dataset. To show that the proposed approach can predict generic non-cuboidal layouts, we also evaluated the approach on a new room layout dataset that we created using PanoContext dataset~\cite{zhang2014panocontext}. The original PanoContext dataset consists of 700 full-view panoramas with 418 bedrooms and 282 living rooms. The original annotations make the Manhattan world assumption ~\cite{zou2021manhattan} and contain only cuboidal layouts. To generate the new dataset, we selected 526 panoramas from the original dataset and relabeled the dataset without the Manhattan and cuboidal layout assumption. Then given a relabeled panorama, which covers 360 degrees in longitude and 180 degrees in latitude, we randomly sampled 6 perspective views every 24 degrees in longitude with FOV uniformly distributed between 70 and 120 degrees. Using this process, we generated $47,340$ perspective views with layout labels, and we splitted panarama views to training and testing sets and generated $40,000$ training and $7,340$ testing perspective views. Examples of relabeled panorama and sampled perspective views are shown in Figure~\ref{fig: panoLayout}. \begin{figure}[th] \centerline{ \begin{tabular}{c} \resizebox{0.36\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/panoContextRelabel.png}}} \\ \end{tabular}} \caption{An example of a relabeled panorama and perspective views sampled from it. Upper left: the original labeling for the panorama. Bottom left: our retouched labeling. Right: perspective views sampled from the panorama.} \label{fig: panoLayout} \end{figure} \begin{table}[ht!] \begin{center} \begin{tabular}{lcc} \toprule Method & ${\mathbf{e_{pixel}}}$ & ${\mathbf{e_{corner}}}$ \\ \midrule Hedau $\etal$. (2009)~\cite{Hedau} & 24.23 & 15.48 \\ Mallya $\etal$. (2015)~\cite{Mallya} & 16.71 & 11.02 \\ Dasgupta $\etal$. (2016)~\cite{DasGupta} & 10.63 & 8.20 \\ Ren $\etal$. (2016)~\cite{Ren} & 9.31 & 7.95 \\ Hsian $\etal$. (2019)~\cite{flat2Layout} & 6.68 & 4.92 \\ Hirzer $\etal$. (2020)~\cite{hirzer2020smart} & 7.79 & 5.84 \\ \midrule Ours w/o visual cue alignment & 7.32 & 5.03 \\ RoomStructNet & \textbf{6.21} & \textbf{4.65} \\ \bottomrule \end{tabular} \caption{Quatitative results on LSUN. The proposed approach achieved the best results compared to both existing approaches and the proposed approach without using visual cue alignment.} \label{tab:LSUN results} \end{center} \end{table} \subsection{Evaluation results} \label{sec:evaluation} Similar to most other works, we evaluated the performance of our approach using the following two metrics: \begin{compactitem} \item ${\mathbf{e_{pixel}}}$: Ratio of pixelwise error between predicted ${w, c, f}$ areas and ground truth areas, normalized by the image size. \item ${\mathbf{e_{corner}}}$: Ratio of euclidean distance between positions of predicted layout joints and positions of ground truth joints, normalized by the image diagonal. \end{compactitem} We present the results of the proposed approach and other approaches on LSUN dataset in Table~\ref{tab:LSUN results} and Hedau dataset in Table~\ref{tab:Hedau results}. For LSUN dataset, the ground truth testing set is no longer available on the official evaluation kit. We thus evaluated only on the validation set (also the case with \cite{RoomNet, Ren, LayoutNet}). To verify and highlight the performance gain achieved by visual cue alignment, we conducted an ablation study by skipping the visual cue alignment in the proposed workflow (results also included in Table~\ref{tab:LSUN results} and Table~\ref{tab:Hedau results}). Note that we excluded \cite{PIONet} in our comparison, as it used training data not provided in the benchmark and is thus not directly comparable to the other works. \begin{table}[ht!] \begin{center} \begin{tabular}{lc} \toprule Method & ${\mathbf{e_{corner}}}$ \\ \midrule Hedau $\etal$. (2009)~\cite{Hedau} & 21.2 \\ Mallya $\etal$. (2015)~\cite{Mallya} & 12.83 \\ Dasgupta $\etal$. (2016)~\cite{DasGupta} & 9.73 \\ Ren $\etal$. (2016)~\cite{Ren} & 8.67 \\ Hsian $\etal$. (2019)~\cite{flat2Layout} & 5.01 \\ Hirzer $\etal$. (2020)~\cite{hirzer2020smart} & 7.44 \\ \midrule Ours w/o visual cue alignment & 6.55 \\ RoomStructNet & \textbf{4.81} \\ \bottomrule \end{tabular} \caption{Quantitative results on Hedau dataset. } \label{tab:Hedau results} \end{center} \end{table} We also show the qualitative results of the proposed approach on LSUN dataset in Figure~\ref{fig: LSUN qualitative}. It performs well in highly cluttered scenes. \begin{figure}[th] \centerline{ \begin{tabular}{ccccccc} \resizebox{0.08\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/lsun_demos/sun_aiscytftfpisrhvr.png}}} & \resizebox{0.08\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/lsun_demos/sun_aiscytftfpisrhvr_noopt.png}}} & \resizebox{0.08\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/lsun_demos/sun_aiscytftfpisrhvr_best.png}}} & \resizebox{0.08\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/lsun_demos/sun_aiscytftfpisrhvr_gt.png}}} \\ \resizebox{0.08\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/lsun_demos/sun_akvprucwbcuqbejy.png}}} & \resizebox{0.08\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/lsun_demos/sun_akvprucwbcuqbejy_noopt.png}}} & \resizebox{0.08\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/lsun_demos/sun_akvprucwbcuqbejy_best.png}}} & \resizebox{0.08\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/lsun_demos/sun_akvprucwbcuqbejy_gt.png}}} \\ \resizebox{0.08\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/lsun_demos/sun_aljgtnotqnxryepv.png}}} & \resizebox{0.08\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/lsun_demos/sun_aljgtnotqnxryepv_noopt.png}}} & \resizebox{0.08\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/lsun_demos/sun_aljgtnotqnxryepv_best.png}}} & \resizebox{0.08\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/lsun_demos/sun_aljgtnotqnxryepv_gt.png}}} \\ Input & w/o visual cue & Proposed & GT layout \end{tabular}} \caption{Qualitative results of the proposed approach on LSUN dataset.} \label{fig: LSUN qualitative} \end{figure} \subsection{Results on generic room images} One advantage of the proposed approach is that it can predict non-cuboidal room layouts. Many works addressed generic room layouts prediction in the past. But they either assumed camera model exists in the data and used camera pose in their approaches~\cite{howard2018thinking, RenderAndCompare} or conducted their prediction work on panoramic views~\cite{fernandez2020corners, zou2021manhattan, pintore2020atlantanet}. The only work we found has a similar problem setup as us is~\cite{flat2Layout}, however we could not find the code of their approach online. At this point, to demonstrate this, we evaluated the performance of the proposed approach on the perspective views derived from PanoContext dataset and present results here by using the same evaluation metrics. We present some of qualitative results from our experiment in Figure~\ref{fig: panoLayout qualitative}. We also present qualitative results of layout feature maps extracted from room with generic layouts in Figure~\ref{fig: layout features of generic rooms}. It can be observed from the feature maps that the proposed feature extractor is capable of crisply detecting and locating layout features of given rooms, which enables the capability of detecting the generic layouts in the proposed approach. \begin{figure}[th] \centerline{ \begin{tabular}{c} \resizebox{0.5\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/panoContext.png}}} \\ \end{tabular}} \caption{Qualitative results of the proposed approach on perspective views extarcted from the relabeled PanoContext dataset. It can be observed from the figure that the proposed approach can handle non-cuboidal layouts of the datasets.} \label{fig: panoLayout qualitative} \end{figure} \begin{figure}[th] \centerline{ \begin{tabular}{c} \resizebox{0.46\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/ComplexLayoutsAll_1.png}}} \\ \end{tabular}} \caption{Examples of showing that the proposed layout feature extractor can detect layout features from rooms with generic layouts. } \label{fig: layout features of generic rooms} \end{figure} We believe that the proposed complexity factor which controls the number of walls in predicted layouts plays an important role in generating final layouts. To better understand the impact of the complexity factor to the predicted layouts. We conducted an evaluation in which we included versions of our proposed approach with $\mathcal{C}$ set to different numbers. Worth noting that by setting the complexity factor $\mathcal{C}$ to $3$, the proposed approach will only predict cuboidal layouts. Table~\ref{tab:panoLayout results} summarizes the results described above. We notice that the improvement becomes ignorable when $\mathcal{C}>6$. This is because for most of room images in our relabeled panoContext dataset has the number of walls less than or equal to 6. The proposed approach achieves better performance thanks to its ability to predict generic layouts. Some qualitative results of using different upper bounds for the complexity factor is shown in Figure~\ref{fig: Complexity levels}. \begin{figure}[th] \centerline{ \begin{tabular}{ccccccc} \resizebox{0.5\textwidth}{!}{\rotatebox{0}{ \includegraphics{Pics/png/Complexitylevels/C_all.png}}} \\ \end{tabular}} \caption{Qualitative results of setting different upper bounds for complexity factor $\mathcal{C}$.} \label{fig: Complexity levels} \end{figure} \begin{table}[ht!] \begin{center} \begin{tabular}{lcc} \toprule Method & ${\mathbf{e_{pixel}}}$ & ${\mathbf{e_{corner}}}$ \\ \midrule RoomStructNet, $\mathcal{C}=3$ & 11.32 & 8.12 \\ RoomStructNet, $\mathcal{C}=4$ & 10.97 & 7.81 \\ RoomStructNet, $\mathcal{C}=5$ & 9.74 & 6.92 \\ RoomStructNet, $\mathcal{C}=6$ & 9.37 & 6.54 \\ \bottomrule \end{tabular} \caption{Quatitative results on perspective views derived from PanoContext dataset.} \label{tab:panoLayout results} \end{center} \end{table} \subsection{Structure loss V.S. regression loss} While the proposed approach achieves superior performance by training layout scoring network using max margin structure loss, an alternative way is to train the network as a regression function that fits the layout margin we defined in Eq.~\ref{eq:margin_line}. To compare, we trained the same network using the same LSUN layout candidate set extracted from the layout proposal process, with the loss function changed from structure loss to standard L2 loss. We then computed the average ${\mathbf{e_{pixel}}}$ (\%) for Top 1, 5, 10, 20 layouts ranked by the trained networks. We examined multiple top layouts because a good layout scorer should still select a high quality candidate even when it does not select the best one. We hypothesize that the network trained with the structure loss can better achieve this desired property as it learns the order relationship among input layouts. The experiment results, summarized in Table~\ref{tab:L2 loss compare}, validates our hypothesis. It shows that the error rate for the network trained with the strcuture loss increases more slowly than the one with L2 loss. \begin{table}[ht!] \begin{center} \begin{tabular}{lcccc} \toprule Loss type & Top 1 & Top 5 & Top 10 & Top 20 \\ \midrule L2 loss & 4.82 & 5.26 & 6.94 & 9.52 \\ Structure loss & 4.65 & 4.82 & 6.71 & 9.52 \\ \bottomrule \end{tabular} \caption{A comparison between layout scoring networks trained using two different loss functions. We report the average ${\mathbf{e_{pixel}}}$ (\%) for the top-k layouts ranked by the trained network on LSUN dataset.} \label{tab:L2 loss compare} \end{center} \end{table}
\section*{Highlights} This work provides: \begin{itemize} \item exact algebraic formulas for the integration of polynomials on cutFEM domains; \item exact algebraic formulas for the integration of polynomial trace on cutFEM interface; \item algorithm for the integration on hypercubes cut by arbitrary hyperplanes for any dimension; \item algorithms for the integration on triangles, tetrahedra and prisms cut by arbitrary lines or planes; \item the incorporation of the above theory within the equivalent polynomial framework. \end{itemize} \end{comment} \section{Introduction} Partial differential equation (PDE) solvers are ubiquitous among many engineering and applied mathematics practitioners. Today, there are many PDE solvers which employ a discontinuous function, especially in the context of fluid dynamics problems. These methods make use of discontinuous functions in order to distinguish different domains and to ensure no extrinsic contributions are incurred while utilizing an arbitrary discontinuity. A few particular extensions of the Finite Element Method (FEM) utilizing discontinuous functions are CutFEM or Extended FEM (XFEM), generalized FEM (GFEM), and nonlocal FEM. In XFEM and GFEM, an enrichment function, e.g. the Heavyside function, is employed to distinguish different domains defined by a common interface, alleviating cumbersome remeshing techniques \cite{aragon2010generalized,moes1999finite}. The nonlocal FEM implements a kernel function, defined by the step function, that ensures nonlocal contributions are zero outside of some specified region \cite{aulisa2021nmpde, delia2020acta,friswell2007non}. Venturing outside of the FEM, an example of a method which also employs discontinuous functions is the Volume of Fluid (VOF) method. The VOF method makes use of the characteristic function to determine what portion of a cell is occupied by a fluid \cite{AULISA20072301,aulisa2003mixed, hirt1981volume}. From the aforementioned methods, one can see the important role of discontinuous functions in many of today's PDE solvers, all of which would benefit from an accurate and efficient way of dealing with the integration of a discontinuous function. Discontinuous function integration can be cast as integration over several disjoint subdomains involving continuous functions, i.e. the region over which the integration is to occur can be broken up into multiple subdomains where only continuous functions are defined. However, the boundary defining the subdomains is rarely trivial and traditional integration schemes are not practical. Even invoking the divergence theorem in such cases has proven to be intractable for even simple geometries and discontinuities, as seen in \cite{joulaian2016numerical,ventura2006elimination}, since integration over the subdomain boundaries must be performed. There has also been work devoted to moment fitting approaches, such as in \cite{joulaian2016numerical}, which also rely on the divergence theorem. Another approach, which depends on the convexity of the region of integration, is presented in \cite{mousavi2011numerical}. Although in general, it cannot be expected that the region of integration is convex. The most common approach to discontinuous function integration is the use of an adaptive algorithm, i.e. an algorithm which uses a grid refinement technique in order to better capture the discontinuity and produce a more accurate approximation to the integral. Adaptive methods still require extensive information about the boundaries of the subdomains and typically lead to high computational costs, ultimately slowing down the numerical PDE scheme. There have been several recent developments that deal with the issue of discontinuous function integration, avoiding expensive adaptive methods. Among these are the use of equivalent polynomials \cite{abedian2019equivalent,abedian2013performance,ventura2015equivalent,ventura2006elimination}, more specifically the use of a polynomial that replaces the discontinuous function in the integrand and yields an equivalent integral. Equivalent polynomial methods allow for integration of continuous functions over an entire region without the difficulty of discontinuous functions and, for line/plane discontinuities, the high computation cost of adaptive quadrature methods. The equivalent polynomial method was first introduced in \cite{ventura2006elimination}, where equivalent polynomials were found analytically for simple geometries and discontinuities\cite{gasca2000polynomial,ma1996generalized,neidinger2019multivariate}. The ideas introduced in \cite{ventura2006elimination} were limited to lower order elements, e.g. linear triangles and bi-linear quadrilaterals, as a consequence of using the divergence theorem to analytically calculate the coefficients of the equivalent polynomial. The difficulty behind this method is introduced when analytical integration is applied to a generic discontinuity, since integration must be carried out on two sub-domains. Therefore, information about the discontinuity must be implemented as the region in which the analytical integration takes place. This causes severe restrictions when the dimension increases resulting in impractical discontinuity considerations, even when the discontinuity is a hyperplane. This work was further extendend in \cite{ventura2015equivalent}. The work in \cite{ventura2015equivalent} builds on the core idea presented in \cite{ventura2006elimination}, i.e. the idea of replacing a discontinuous function with an equivalent polynomial. The limitation of the work done in \cite{ventura2006elimination} is overcome by using a regularized Heaviside function, which approaches the Heaviside function in the limit, in place of the Heaviside function. This regularized Heaviside function is continuous and differentiable for any value of the regularization parameter $\rho.$ The use of the regularized Heaviside function allows one to perform analytical integration over the entire domain and then take the limit of the resulting expression when deriving the equivalent polynomial coefficients. The extended work in \cite{ventura2015equivalent} creates a more robust method by eliminating the need for analytical integration over arbitrary sub-domains created by the discontinuity. This method requires equality between the integral of the regularized Heaviside function multiplied by some monomial and the integral of the equivalent polynomial multipled by the same monomial. The highest degree of the monomial and the dimension dictate the size of the linear sysyem that needs to be solved in order to recover the coefficients of the equivalent polynomial. Since the equation for the discontinuity appears in the regularized Heaviside function, the equivalent polynomial coefficients will be dependent upon the discontinuity, as well as the regularization parameter. Large values of the regularization parameter can then be taken to approximate the Heaviside function. Automation of this method relies on numerical libraries in the calculation of the polylogarithm function which naturally arises from the integration of the regularized Heaviside function. As a consequence of using the regularized Heaviside function, one is left with expressions that involve a linear combination of polylogarithm functions of various orders. The two sources of error arising from the use of equivalent polynomials, as mentioned in \cite{ventura2015equivalent}, are the numerical evaluation of the polylogarithm and round-off error introduced by large values of the regularization parameter $\rho.$ In \cite{abedian2019equivalent} the concept of equivalent polynomials was extended to incorporate Legendre polynomials, which give rise to very beneficial properties. The main idea is to represent the equivalent and element shape polynomials with Legendre polynomials. The properties of Legendre polynomials are then utilized to allow for analytical integration over specified squares in 2-D or cubes in 3-D. Hence the error incurred from this method is produced by a spacetree refinement algorithm for complex discontinuities. It is stated in \cite{abedian2019equivalent} that the analytical integration results are the same as those in \cite{ventura2015equivalent} for a line or plane discontinuity; however, the implementation of the equivalent Legendre polynomials for the specified discontinuities lacks the ease of algorithmic automation for the analytical integration. The method we propose utilizes a closed form expression for the analytical equivalent polynomial integral for simple discontinuities. More specifically line, plane, and hyperplane discontinuities. We provide algebraic expressions for analytical subdomain and interface integrals. The proposed method further extends the method in \cite{ventura2015equivalent} by considering the regularized Heaviside function as a special case of the polylogarithm function and utilizing asymptotic properties of the polylogarithm function. This leads to the elemination of the regularization parameter and numerical evaluation of the polylogarithm, which in turn eliminates both sources of error introduced by equivalent polynomials as mentioned in \cite{ventura2015equivalent}. We also give an alternative expression for the closed forms which are not susceptible to round-off errors. By utilizing the asymptotic properties of the polylogarithm and the relationship the Heavyside function shares with the Dirac distribution, we provide closed form expressions for analytical interface integrals. Similar to the method given by \cite{ventura2015equivalent}, the proposed method eliminates the need to integrate over a specified, often times intractable, subdomain $\Omega_i.$ We provide closed form expression for triangles and squares in dimension 2, and for the cube, prism, and tetrahedron in dimension 3. We also provide the pseudo-codes to evaluate integrals on hypercubes cut by hyperplanes for any dimension. Additional pseudo-code is given for the triangle, the tetrahedron and the prism. A great deal of attention has been spent in providing algorithms which avoid overflow with regard to computer arithmetic. All closed form expressions are algebraic and easy to implement, since the need for subdomain integration and the use of expensive numerical libraries has been eliminated. The outline of this paper is as follows. In Section 2, we discuss the properties of the polylogarithm which are implemented in the paper. In Section 3, the closed form expressions for the different elements are given. Also, pseudo code for the n-dimensional cube can be found in this section. Lastly, in Section 4, we provide some useful notes on practical implementation of the equivalent polynomials. All the alghorithms developed in this article are implemented in FEMuS \cite{aulisa2010femus}, an in-house open-source finite element C++ library built on top of PETSc \cite{balay2012petsc} and publicly available on GitHub. \section{Preamble} The polylogarithm, ${\,\mathrm{Li}}_s(z)$ where $s,z\in \mathbb{C}$ with $|z|<1$, can be defined as $${\,\mathrm{Li}}_s(z) = \sum_{k=1}^{\infty} \frac{z^k}{k^s},$$ or in integral form as $${\,\mathrm{Li}}_s(z) = \frac{z}{\Gamma(s)} \int_{0}^{\infty} \frac{x^{s-1}}{e^x - z} \,dx, $$ by analytic continuation, where $\Gamma(s)$ is the gamma function. The integral representation of ${\,\mathrm{Li}}_s(z)$ is analytic for $z \in \mathbb{C} \setminus [1,\infty)$ and $\Re(s)>0$ \cite{dingle1957fermi,truesdell1945function}. When the above integral is replaced with an appropriate complex contour integral we can consider $s \in \mathbb{Z}^{-} \cup \{0\} $\cite{truesdell1945function}. For the purpose of this paper we will only consider polylogarithms of the form ${\,\mathrm{Li}}_s(w)$, where $s \in \{ -1, 0, 1, ... \}$ and $w \in \mathbb{R} $. All identities in this paper are used when ${\,\mathrm{Li}}_s(w)$ is well defined. Two useful properties used throughout this paper are ${\,\mathrm{Li}}_s(-e^w) = -F_{s-1}(w)$, where $F_{s-1}(w)$ is the Complete Fermi-Dirac integral and $\frac{ d L_s(-e^{\mu})}{d\mu} = L_{s-1}(-e^{\mu})$ \cite{dingle1957fermi,rhodes1950fermi}. Therefore results of this paper should be implemented with consideration of the aforementioned properties. The following results are a direct consequence of these properties, as can be seen in \cite{dingle1957fermi,rhodes1950fermi,truesdell1945function}. \begin{proposition}\label{limit} For $s=0,1,2,\dots$, $${\,\mathrm{limLi}}_s (a) := \lim_{t \rightarrow \infty} \frac{{\,\mathrm{Li}}_s (- \exp( a t) )}{t^s} = \begin{cases} -0.5 &\mbox{if } s=0 \mbox{ and } a = 0\\ -\dfrac{a^s}{s!} & \mbox{if } a > 0\\ 0 & \mbox{otherwise} \end{cases} . $$ \end{proposition} \begin{proof} \textbf{Case 1}: $s=a=0$. In this case we have $${\,\mathrm{limLi}}_0 (0) = \lim_{t \rightarrow \infty} {\,\mathrm{Li}}_0(-1) = \frac{-1}{1+1} = -\frac{1}{2}.$$ \textbf{Case 2}: By induction on $s$, with $a>0$.\\ For $s=1$ we have $${\,\mathrm{limLi}}_1(a) = \lim_{t \rightarrow \infty} \frac{{\,\mathrm{Li}}_1 (- \exp( a t) )}{t} = \lim_{t \rightarrow \infty} \frac{-\ln{(1 + e^{at})}}{t} = -a.$$ \\ For $s=k-1$: assume $$ \lim_{t \rightarrow \infty} \frac{{\,\mathrm{Li}}_{k-1}(-e^{a t})}{t^{k-1}} = -\frac{a^{k-1}}{(k-1)!}.$$ \\ Then for $s=k$ we have $$ \lim_{t \rightarrow \infty} \frac{{\,\mathrm{Li}}_{k}(-e^{a t})}{t^{k}} = \lim_{t \rightarrow \infty} \frac{a}{k} \frac{{\,\mathrm{Li}}_{k-1}(-e^{a t})}{t^{k-1}} = -\frac{a^{k}}{k!}, $$ \\ where we have used the property $\frac{ d L_s(-e^{\mu})}{d\mu} = L_{s-1}(-e^{\mu}).$\\ \textbf{Case 3}: For any other case, i.e. $a \leq 0$, $s \ne 0$, the terms of the appropriate series expansion for the Fermi-Dirac integral vanish when the limit is taken inside the series, when the series converges uniformly\cite{dingle1957fermi}. \end{proof} \begin{proposition} \label{prop:defInt} Let $a \ne 0$, $m = 0,1,2, \dots$ and $s=-1,0,1,\dots$, then $$ \int x^m {\,\mathrm{Li}}_s (-\exp(a x))\, dx = \sum_{i=1}^{m+1} \frac{m! \, {(-1)}^{i-1}}{(m+1-i)!} x^{m+1-i} \frac{{\,\mathrm{Li}}_{s+i} (-\exp (a x ) )}{a^{i}} + C.$$ \end{proposition} \begin{proof} In the domain of interest, where the polylogarithm function converges uniformly, we use the following identities $$\frac{ d {\,\mathrm{Li}}_s(-e^{\mu})}{d\mu} = {\,\mathrm{Li}}_{s-1}(-e^{\mu}),$$ and $${\,\mathrm{Li}}_s(-e^{\mu}) = \int {\,\mathrm{Li}}_{s-1}(-e^{\mu}) d\mu+C. $$ For ease of notation we drop the constatnt C in the proof. \\ For $m=0$, we get $$\int {\,\mathrm{Li}}_s (-\exp( (a x +d )t )) dx = \frac{{\,\mathrm{Li}}_{s+1}(-\exp((a x + d)t))}{at}= \sum_{i=1}^{1} \frac{(-1)^{i+1}0!{\,\mathrm{Li}}_{s+i}(-\exp((a x + d)t)) }{(0-i+1!)(ta)^i i^{s+1}}. $$ For m=k assume $$ \int x^k {\,\mathrm{Li}}_{s+1} (-\exp( (a x +d )t )) dx = \sum_{i=1}^{k+1} \frac{k! \ {(-1)}^{i+1}}{(k+1-i)!} x^{k+1-i} \frac{{\,\mathrm{Li}}_{s+1+i} (-\exp( (a x +d )t )}{(a t)^i}.$$ \ Then for $m=k+1$ we have \begin{align*} \int& x^{k+1} {\,\mathrm{Li}}_s (-\exp( (a x +d )t )) dx \\ &= x^{k+1} \int {\,\mathrm{Li}}_s (-\exp( (a x +d )t )) dx - (k+1) \int x^k\frac{{\,\mathrm{Li}}_{s+1} (-\exp( (a x +d )t dx )}{at}\\ &= \frac{x^{k+1}}{at} {\,\mathrm{Li}}_{s+1} (-\exp( (a x +d )t )) - (k+1)\sum_{i=1}^{k+1} \frac{k! \ {(-1)}^{i+1}}{(k+1-i)!} x^{k+1-i} \frac{{\,\mathrm{Li}}_{s+i+1} (-\exp( (a x +d )t )}{(a t)^{i+1}} \\ &= \sum_{i=1}^{k+2} \frac{(k+1)! \ {(-1)}^{i+1}}{(k+2-i)!} x^{k+2-i} \frac{{\,\mathrm{Li}}_{s+i} (-\exp( (a x +d )t )}{(a t)^{i}}. \\ \end{align*} \end{proof} In the next proposition, which applies to a general domain, we relate the polylogarithm functions ${\,\mathrm{Li}}_0$ and ${\,\mathrm{Li}}_{-1}$ to the Heaviside function and the Dirac distribution, respectively. \begin{proposition} \label{stepFunction} Let the region $D$, with boundary $\partial D$, be cut by the plane $\bm n \cdot \bm x + d = 0$ in two subregions $D_1$ and $D_2$, with normal $\bm n$, pointing from $D_2$ to $D_1$. Let $\Gamma$ be the interface between $D_2$ and $D_1$. Let $P_m(\bm x)$ be a polynomial of degree $m$ in $D$. Then, the following integral equalities hold \begin{align} \int_{D_1} P_m(\bm x) d\bm x &=- \lim_{t \rightarrow \infty} \int_D P_m(\bm x) {\,\mathrm{Li}}_0(-\exp( (\bm n \cdot \bm x +d)t )) d \bm x \label{eq:volEquality}\\ &= \lim_{t \rightarrow \infty} \int_D P_m(\bm x) \left(1 + {\,\mathrm{Li}}_0(-\exp( -(\bm n \cdot \bm x +d)t ))\right) d \bm x . \label{eq:volEquality2} \end{align} Moreover, if $\Gamma$ is tangential to $\partial D$ at most on a set of measure zero and $\| \bm n\| = 1$, then \begin{align} \int_{\Gamma} P_m(\bm x) d \bm \mu &=-\lim_{t \rightarrow \infty} \int_D P_m(\bm x) \;t {\,\mathrm{Li}}_{-1}(-\exp( (\bm n \cdot \bm x + d )t )) d \bm x\label{eq:surfEquality}\\ &=-\lim_{t \rightarrow \infty} \int_D P_m(\bm x) \;t {\,\mathrm{Li}}_{-1}(-\exp(-(\bm n \cdot \bm x + d )t )) d \bm x\label{eq:surfEquality2}. \end{align} \end{proposition} \begin{proof} Equality \eqref{eq:volEquality} follows from the integral equality \begin{align*} &\int_{D_1} P_m(\bm x) d \bm x =\int_D P_m(\bm x) {\,\mathrm{U}}(\bm n \cdot \bm x + d) d\bm x. \end{align*} This is due to the equivalence between the unit step function ${\,\mathrm{U}}$ and the limit of the polylogarithm function ${\,\mathrm{Li}}_0$ and from the dominated convergence theorem \cite{wang2018lecture}, i.e., \begin{align*} &\int_D P_m(\bm x) {\,\mathrm{U}}(\bm n \cdot \bm x + d) d\bm x \\ &= \int_D P_m(\bm x) \left(-\lim_{t \rightarrow \infty} {\,\mathrm{Li}}_0(-\exp( (\bm n \cdot \bm x + d) t))\right) d \bm x\\ &= - \lim_{t \rightarrow \infty} \int_D P_m(\bm x) {\,\mathrm{Li}}_0(-\exp( (\bm n \cdot \bm x + d) t)) d \bm x. \end{align*} Eq. \eqref{eq:volEquality2} follows from Eq.~\eqref{eq:volEquality} and the following integral equality \begin{align*} \int_{D_1} P_m(\bm x)d \bm x &= \int_{D} P_m(\bm x) \left(1 - {\,\mathrm{U}}(-(\bm n \cdot \bm x + d))\right) d \bm x. \end{align*} Equality \eqref{eq:surfEquality} follows from the integral equality \begin{align*} &\int_{\Gamma} P_m(\bm x) \bm d \mu = \int_{D} P_m(\bm x) \delta(\bm n \cdot \bm x + d) d \bm x, \end{align*} and from the weak convergence of $ t {\,\mathrm{Li}}_{-1}(-\exp( (\bm n \cdot \bm x + d)t ))$ to the the Dirac distribution $\delta$ \cite{lax2014functional,onural2006impulse}, i.e., \begin{align*} & \int_D P_m(\bm x) \delta(\bm n \cdot \bm x + d) d \bm x\\ & =- \lim_{t \rightarrow \infty} \int_D P_m(\bm x)\, t \, {\,\mathrm{Li}}_{-1}(-\exp( (\bm n \cdot \bm x + d)t )) d\bm x. \end{align*} Eq.~\eqref{eq:surfEquality2} follows from Eq.~\eqref{eq:surfEquality} and the following integral equality \begin{align*} & \int_{D} P_m(\bm x) \delta(\bm n \cdot \bm x + d) d \bm x = \int_{D} P_m(\bm x) \delta(-(\bm n \cdot \bm x + d)) d \bm x. \end{align*} \end{proof} \begin{remark} In proving \eqref{eq:surfEquality}, we assumed that the interface $\Gamma$ is tangential to the boundary of $D$ only on a set of measure zero. Such distinction is needed, since in this situation the Dirac function, centered on $\partial D$ and aligned with the normal direction, would be only half contained within $D$, thus contributing only for half to the interface integral. In all the applications we are going to consider next, $D$ will only be a convex domain with piece-wise flat boundaries. In doing so, $\Gamma$ is either completely tangential or never tangential to $\partial D$. This allows us to compute the interface integral also in the tangential case (the boundary integral) by doubling the value of the computed integral in \eqref{eq:surfEquality}. \end{remark} \begin{corollary} For $a\ne 0$ the following definite integral is given by \begin{align} I_1 &= -\lim_{t \rightarrow \infty} \frac{1}{t^s}\int_0^1 x^m {\,\mathrm{Li}}_s(-\exp( (a x +d )t ) \,dx \nonumber \\ &=\sum_{i=1}^{m+1} \frac{m!}{(m+1-i)!} \frac{1}{(-a)^i} {\,\mathrm{limLi}}_{s+i}(a+d) - \frac{m!}{(-a)^{m+1}} {\,\mathrm{limLi}}_{s+m+1} (d) .\label{int2} \end{align} \end{corollary} \begin{proof} The proof follows directly from combining Propositions \ref{limit} and \ref{prop:defInt}. \end{proof} \begin{definition} For $a\ne 0$, let \begin{equation} I_2 = \sum_{i=0}^{s} \frac{(-a)^{s-i} (a+d)^i}{i!(m+1+s-i)!}.\label{int2a} \end{equation} \end{definition} \begin{remark} \label{remarkOverflow1} In the next proposition we will show that for $s\ge 0$ and positive arguments Eq.~\eqref{int2} is equivalent to Eq.~\eqref{int2a}. In computer arithmetic Eq.~\eqref{int2} suffers from overflow for $d\gg|a|>0$ and $a\rightarrow0$, because of the presence of the $\frac{1}{a^i}$ terms in the sums. Proposition \ref{equivalentFormula} will show all these terms actually simplify after expanding the definition of ${\,\mathrm{limLi}}$ for positive arguments. \end{remark} \begin{remark}\label{remarkOverflow2} In Eq.~\eqref{int2}, for $d\ge0$ and/or $|d|\sim|a|$, and $a\rightarrow0$, either the arguments of the polylogarithm functions are non positive, or if positive they are of the same order of $a$. In the first case the contribution of their limits is zero. In the second case using the definition of ${\,\mathrm{limLi}}$ with positive argument one would get $$\left| \frac{{\,\mathrm{limLi}}_{s+i}(|\sim a|)}{a^i} \right| \sim \left| \frac{(\sim a)^{s+i}}{a^i}\right| \sim |a^s|$$ for all $i$, thus all terms in the sum would have comparable size, and since $a$ does not appear in the denominator it no longer contributes to an overflow issue, for small $a$. \end{remark} \begin{proposition} \label{equivalentFormula} $\,$\\ For $s\ge0$, $a\ne0$, $d>0$ and $a+d>0$ , Eq.~\eqref{int2} is equivalent to Eq.~\eqref{int2a}. \end{proposition} \begin{proof} First note that the conditions $a\ne0$, $d>0$ and $a+d>0$ are equivalent to $\dfrac{-d}{a} \not\in [0,\, 1]$. In proving the proposition one simply needs to apply integration by parts and utilize Proposition \ref{limit}. For a fixed $s\ge0$ and $a\ne0$ we have \begin{align*} -\lim_{t \rightarrow \infty}& \frac{1}{t^s}\int_0^1 x^m {\,\mathrm{Li}}_s(-\exp( (a x +d )t ) \,dx \nonumber \\ &= -\lim_{t \rightarrow \infty} \frac{1}{t^s}\left( \frac{x^{m+1}}{m+1} {\,\mathrm{Li}}_s(-\exp( (a x +d )t )\Big|_0^1 -\frac{at}{m+1}\int_0^1 x^{m+1} {\,\mathrm{Li}}_{s-1}(-\exp( (a x +d )t)) \, dx\right)\nonumber \\ &=\frac{(a+d)^s}{s!(m+1)} - \frac{a}{m+1}\, \left(-\lim_{t \rightarrow \infty} \frac{1}{t^{s-1}}\int_0^1 x^{m+1} {\,\mathrm{Li}}_{s-1}(-\exp( (a x +d )t)) \, dx\right) \nonumber\\ &=\frac{(a+d)^{s}m!}{s!(m+1)!} - \frac{a(a+d)^{s-1}m!}{(s-1)!(m+2)!} \nonumber \\ &\hspace{3cm}-\frac{a^2}{(m+1)(m+2)}\left(-\lim_{t \rightarrow \infty} \frac{1}{t^{s-2}}\int_0^1 x^{m+2} {\,\mathrm{Li}}_{s-2}(-\exp( (a x +d )t)) \, dx\right) \nonumber \\ &=\quad \dots \nonumber \\ &=\sum_{i=0}^{s} \frac{m!(-a)^{s-i} (a+d)^i}{i!(m+1+s-i)!} -\frac{(-a)^{s+1}m!}{(m+2+s)}\left(-\lim_{t \rightarrow \infty} \int_0^1 x^{m+2+s}\, t\, {\,\mathrm{Li}}_{-1}(-\exp( (a x +d )t)) \, dx\right) \nonumber\\ &=\sum_{i=0}^{s} \frac{m!(-a)^{s-i} (a+d)^i}{i!(m+1+s-i)!}. \end{align*} Where we have used the weak convergence of $ t {\,\mathrm{Li}}_{-1}(-\exp( (ax + d)t ))$ to the the Dirac distribution $\delta$ with $\frac{-d}{a} \not\in [0,\, 1]$. \end{proof} \section{LSI: Line Segment Integral on $[0,1]$, with $a \ne 0$} For fix $s=-1,0,1,\dots$, we want to evaluate integrals in the form $$ {\,\mathrm{LSI}\:\!}_s^m(a,d) = -\lim_{t\rightarrow \infty} \frac{1}{t^s} \int_{0}^{1} x^m {\,\mathrm{Li}}_s(-\exp( (a x + d )t ) dx.$$ From Eq.~\eqref{int2} \begin{align} {\,\mathrm{LSI}\:\!}_s^m(a,d) &:= \sum_{i=1}^{m+1} \frac{m!}{(m+1-i)!} \frac{1}{(-a)^i} {\,\mathrm{limLi}}_{s+i}(a+d) - \frac{m!}{(-a)^{m+1}} {\,\mathrm{limLi}}_{s+m+1} (d) . \label{lineFormula} \end{align} For all $a$, $d\in\mathbb{R}$, with $|a|>0$, we have the subdomain integral \begin{equation}\label{LSI0} {\,\mathrm{LSI}\:\!}_0^m(a,d) = \int_{0}^{1} x^m {\,\mathrm{U}}(ax+d) dx, \end{equation} and, for $a^2=1$, the interface integral \begin{equation} \label{LSIm1a} {\,\mathrm{LSI}\:\!}_{-1}^m(a,d) = \int_{0}^{1} x^m \delta(ax+d) dx. \end{equation} For all $|a|>0$ we also have the explicit point evaluation formula \begin{equation} \label{LSIm1} {\,\mathrm{LSI}\:\!}_{-1}^m(a,d) = \begin{cases} \vspace{3pt} \displaystyle \frac{1}{|a|}\left(-\frac{d}{a}\right)^m & \ \mbox{if } 0<-\dfrac{d}{a} < 1\\ \vspace{3pt} \displaystyle \dfrac{1}{2|a|} \left(-\frac{d}{a}\right)^m & \ \mbox{if }\, -\dfrac{d}{a} =0\, \mbox{ or }\,-\dfrac{d}{a} =1 \\ \vspace{3pt} 0 & \ \mbox{elsewhere} \end{cases}, \end{equation} with the assumption that $0^0=1$. That is the case for $m=0$ and $d=0$. Although equivalent to Eq.~\eqref{lineFormula}, for $s=-1$, Eq.~\eqref{LSIm1} is generally faster to compute and does not suffer from overflow in computer arithmetic. Also, for $s\ge0$, $d>0$, and $a+d>0$ we replace Eq.~\eqref{lineFormula} with the equivalent Eq.~\eqref{int2a} to avoid overflow. The pseudo-code for the line segment integration is given in Algorithm \ref{algLSI}. \begin{remark} \label{rmk:bd1} The formula for ${\,\mathrm{LSI}\:\!}_{-1}^m(a,d)$ halves the value of the interface integral if the point $-d/a$ is one of the two boundary points. This happens because half of the Dirac distribution falls outside the line segment, thus it does not contribute to the integral value. If this is not the desired behavior, and the boundary integral should account for the whole value, the definition of ${\,\mathrm{LSI}\:\!}_{-1}^m(a,d)$ should be replaced by \begin{equation} \label{LSIm1b} {\,\mathrm{LSI}\:\!}_{-1}^m(a,d) = \begin{cases} \vspace{3pt} \displaystyle \frac{1}{|a|}\left(-\frac{d}{a}\right)^m & \ \mbox{if } 0\le-\dfrac{d}{a} \le 1\\ 0 & \ \mbox{elsewhere} \end{cases}, \end{equation} again with the assumption that $0^0=1$. \end{remark} \begin{algorithm} \caption{Pseudo-code for integration on the line segment $[0,1]$ with $a\ne0$ and $s=-1,0,1,\dots$. For $s=-1$ and $|a|=1$ it corresponds to the interface integral. For $s=0$ it corresponds to the subdomain integral.} \label{algLSI} \begin{algorithmic}[1] \Function {Line\_Segment\_Integration}{$a$, $d$, $m$, $s$} \If{$s=-1$} \State{\Return $\; {\,\mathrm{LSI}\:\!}_{-1}^m(a,d) $ from Eq.~\eqref{LSIm1}} \Else \If {$d \le 0$ or $a+d \le 0$} \State{\Return $\qquad \mathlarger{\sum}_{i=1}^{m+1} \dfrac{m!}{(m+1-i)!} \dfrac{1}{(-a)^i} {\,\mathrm{limLi}}_{s+i}(a+d) - \dfrac{m!}{(-a)^{m+1}} {\,\mathrm{limLi}}_{s+m+1} (d) $} \Else \State{\Return $ \qquad \mathlarger{\sum}_{i=0}^{s} \dfrac{m!(-a)^{s-i} (a+d)^i}{i!(m+1+s-i)!}$} \EndIf \EndIf \EndFunction \end{algorithmic} \end{algorithm} \subsection{SQI: Square Integral $[0,1]^2$, with $a^2+b^2>0$} Fix $s=-1,0,1,\dots$, we want to evaluate integrals in the form $$ {\,\mathrm{SQI}\:\!}_s^{mn} (a,b,d) = -\lim_{t\rightarrow \infty} \frac{1}{t^s} \int_{0}^{1} \int_{0}^{1} x^m y^n {\,\mathrm{Li}}_s(-\exp( (a x +b y + d )t ) dy\,dx.$$ We will first consider the case when the interface $\Gamma$ is parallel to either the square sides, and then all the remaining cases. If $a=0$ the iterated integral can be split in the product of 2 integrals $$ {\,\mathrm{SQI}\:\!}_s^{mn} (0,b,d) = \int_{0}^{1} x^m dx \left(-\lim_{t\rightarrow \infty} \frac{1}{t^s} \int_{0}^{1} y^n {\,\mathrm{Li}}_s(-\exp( (b y + d )t ) dy \right) = \frac{1}{m+1} {\,\mathrm{LSI}\:\!}_s^n(b,d).$$ Similarly, if $b=0$ $$ {\,\mathrm{SQI}\:\!}_s^{mn} (a,0,d) = \frac{1}{n+1} {\,\mathrm{LSI}\:\!}_s^m(a,d).$$ If both $a$ and $b$ are different from zero, after the integration of the inner integral we get \begin{align} {\,\mathrm{SQI}\:\!}_s^{mn} (a,b,d) &= -\lim_{t\rightarrow \infty} \int_{0}^{1} x^m \left( -\sum_{j=1}^{n+1} \frac{n!} {(n+1-j)!} \, \frac{1}{(-b)^j} \frac{{\,\mathrm{Li}}_{s+j} (-\exp( (a x+b +d )t )}{ t^{s+j}} \right.\nonumber \\ &\hspace{1cm}\left.+ \frac{n!}{(-b)^{n+1}} \frac{{\,\mathrm{Li}}_{s+n+1} (-\exp( (ax + d )t )}{ t^{s+n+1}} \right) dx \nonumber\\ &= -\sum_{j=1}^{n+1} \frac{n!} {(n+1-j)!} \, \frac{1}{(-b)^j} {\,\mathrm{LSI}\:\!}_{s+j}^m(a,b+d) + \frac{n!}{(-b)^{n+1}} {\,\mathrm{LSI}\:\!}_{s+n+1}^m(a,d) , \label{iterative1} \end{align} Then, for all $a$, $b$, $d\in\mathbb{R}$ , such that $a^2+b^2>0$, we have the subdomain integral $${\,\mathrm{SQI}\:\!}_0^{mn}(a,b,d) = \int_{0}^{1} \int_{0}^{1} x^m y^n {\,\mathrm{U}}(ax+by+d) \,dy\,dx,$$ and, for $a^2+b^2 = 1$, the interface integral $${\,\mathrm{SQI}\:\!}_{-1}^{mn}(a,b,d) = \int_{0}^{1} \int_{0}^{1} x^m y^n \delta(ax+by+d)\, dy\,dx.$$ These formulas are general and versatile: they work regardless of where the line $a x + b y + d = 0$ intersects the square domain, and the orientation of the unit step function follows the orientation of the normal $\left<a,b\right>$. \begin{remark} \label{rmk:bd2} In the special cases ${\,\mathrm{SQI}\:\!}_{-1}^{mn}(a,0,d)$ (or ${\,\mathrm{SQI}\:\!}_{-1}^{mn}(0,b,d$)), with $-d/a= 0 \mbox{ or }1 $ (or $-b/d=0 \mbox{ or }1$), the corresponding line $ax+d=0$ (or $by+d=0$) overlaps with one of the sides of the square. Depending on which definition is used for ${\,\mathrm{LSI}\:\!}_{-1}^{m},$ either Eq.~\eqref{LSIm1} or Eq.~\eqref{LSIm1b}, one is left with half the boundary integral or the entire boundary integral, respectively, over the specified side of the square. This is also the case for the cube and the hypercube we are going to consider next. \end{remark} \subsection{CBI: Cube integral on $[0,1]^3$, with $a^2+b^2+c^2>0$.} Fix $s=-1,0,1,\dots$, we want to evaluate integrals in the form $$ {\,\mathrm{CBI}\:\!}_s^{mno} (a,b,c,d) = -\lim_{t\rightarrow \infty} \frac{1}{t^s} \int_{0}^{1} \int_{0}^{1} \int_{0}^{1} x^m y^n z^o {\,\mathrm{Li}}_s(-\exp( (a x +b y +c z+ d )t ) dz\,dy\,dx.$$ For $c=0$ the above integral reduces to the square case, i.e. \begin{align*} & {\,\mathrm{CBI}\:\!}_s^{mno}(a,b,0,d) = \frac{1}{o} {\,\mathrm{SQI}\:\!}_s^{mn}(a,b,d). \end{align*} If $c\ne0$ and both $a=0$ and $b=0$ \begin{align} {\,\mathrm{CBI}\:\!}&_s^{mno} (0,0,c,d) = \frac{1}{m+1} \frac{1}{n+1}{\,\mathrm{LSI}\:\!}_s^o(c,d). \end{align} For all other cases, after integrating in $z$ we get \begin{align} {\,\mathrm{CBI}\:\!}_s^{mno} (a,b,c,d)& = -\lim_{t\rightarrow \infty} \int_{0}^{1}\int_{0}^{1} x^m y^n \left(- \sum_{k=1}^{o+1} \frac{o!} {(o+1-k)!} \, \frac{1}{(-c)^k} \frac{{\,\mathrm{Li}}_{s+k} (-\exp( (a x+by+c +d )t )}{ t^{s+k}} \right. \nonumber \\ & \hspace{1cm}\left. +\frac{o!}{(-c)^{o+1}} \frac{{\,\mathrm{Li}}_{s+o+1} (-\exp( (ax +by + d )t )}{ t^{s+k}} \right) \, dy \, dx \nonumber\\ &= -\sum_{k=1}^{o+1} \frac{o!} {(o+1-k)!} \, \frac{1}{(-c)^k} {\,\mathrm{SQI}\:\!}_{s+k}^{mn}(a,b,c+d) + \frac{o!}{(-c)^{o+1}} {\,\mathrm{SQI}\:\!}_{s+o+1}^{mn}(a,b,d). \label{iterative2} \end{align} The cases $a=0$ or $b=0$ are handled by the square integrals as described in the previous section. Then, for all $a$, $b$, $c$, $d\in\mathbb{R}$, with $a^2+b^2+c^2>0$, we have the subdomain integral $${\,\mathrm{CBI}\:\!}_0^{mno}(a,b,c,d) = \int_{0}^{1} \int_{0}^{1} \int_{0}^{1} x^m y^n z^o {\,\mathrm{U}}(ax+by+cz+d) \,dz\,dy\,dx,$$ and, for $a^2+b^2+c^2 = 1$, the interface integral $${\,\mathrm{CBI}\:\!}_{-1}^{mno}(a,b,c,d) = \int_{0}^{1} \int_{0}^{1} \int_{0}^{1} x^m y^n z^o \delta(ax+by+cz+d) \, dz\,dy\,dx.$$ It is remarkable how such simple formulas can handle all possible intersections between the cube and the plane. Moreover, they can be easily extended to evaluate corresponding integrals on hypercubes cut by hyperplanes for any dimension. \subsection{HCI: Hypercube Integration on $[0,1]^{dim}$, with $\bm n =\langle a_1,a_2,\dots,a_{dim} \rangle, \|\bm n\|>0$ and $\bm m =\langle m_1,m_2,\dots,m_{dim} \rangle$.} We are seeking integrals in the form $$ {\,\mathrm{HCI}\:\!}_{s,dim}^{\bm m} (\bm n,d) = -\lim_{t\rightarrow \infty} \frac{1}{t^s} \int_{[0,1]^{dim}} \prod_{i=1}^{dim} x_i^{m_i} {\,\mathrm{Li}}_s(-\exp( (\bm n \cdot \bm x + d )t ) d \bm x,$$ where we assume $|a_i| \le |a_{i+1}|$. However, if this is not the case, one can perform a reordering of the normal coefficients due to the symmetry of the domain and the integrand. Define $dim_0 \in \mathbb{N}_0$ with $dim_0 \leq dim$ such that $dim_0$ is an upper bound for the indices corresponding to all the $a_i = 0$ $\forall i < dim_0$. Define $dim' := dim - dim_0$, $\bm m' := \langle m_{dim_0+1},\dots, m_{dim} \rangle$ and $\bm n' :=\langle a_{dim_0+1},\dots, a_{dim} \rangle $. Then $$ {\,\mathrm{HCI}\:\!}_{s,dim}^{\bm m} (\bm n,d) = \prod_{i=1}^{dim_0} \frac{1}{1 + m_i} {\,\mathrm{HCI}\:\!}_{s,dim'}^{\bm m'} \big( \bm n' ,d \big).$$ Then, dropping the $'$ superscript, the problem reduces to evaluating integrals in the form $$ {{\,\mathrm{HCI_A}\:\!}}_{s,dim}^{\bm m} (\bm n,d) = -\lim_{t\rightarrow \infty} \frac{1}{t^s} \int_{HC_{dim}} \prod_{i=1}^{dim} x_i^{m_i} {\,\mathrm{Li}}_s(-\exp( (\bm n \cdot \bm x + d )t ) d \bm x,$$ with $|a_i| \le |a_{i+1}|$ and $a_1 \ne 0$. Following the same integration strategy used for the square and the cube, with $m = m_{dim}$ and $a=a_{dim}$, we obtain the following recursive formula \begin{align} {{\,\mathrm{HCI_B}\:\!}}_{s,dim}^{\bm m} (\bm n,d) &= -\sum_{i=1}^{m+1} \frac{m!} {(m+1-i)!} \, \frac{1}{(-a)^i} {{\,\mathrm{HCI_A}\:\!}}_{s+i,dim-1}^{\bm m^-} (\bm n^-, a + d) \nonumber \\ &\hspace{1cm}+\frac{m!}{(-a)^{m+1}} {{\,\mathrm{HCI_A}\:\!}}_{s+m+1 , dim-1}^{\bm m^-}(\bm n^-,d), \end{align} where $\bm m^- = \langle m_{1},\dots, m_{dim-1} \rangle$ and $\bm n^{-} =\langle a_{1},\dots, a_{dim-1} \rangle $. This formula is recursively applied until dimension 1, where the the line segment integration formula, ${\,\mathrm{LSI}\:\!}$, is used. At each level of integration two contributions occur, one that involves a sum and a single term. The most expensive terms to compute are the ones involving a summation, with each one of them requiring the computation of $${\,\mathrm{limLi}}_{s+k}\left(\sum_{i=1}^{dim} a_i +d\right),$$ for some $k\ge dim$. It is then desirable to have $$ \sum_i^{dim} a_i +d < 0,$$ so that all the ${\,\mathrm{limLi}}$ contributions vanish. From Proposition \ref{stepFunction}, changing the sign of the normal without any contribution is only allowed for $s=-1$, hence $$ {{\,\mathrm{HCI_B}\:\!}}_{-1,dim}^{\bm m} (\bm n,d) ={{\,\mathrm{HCI_B}\:\!}}_{-1,dim}^{\bm m} (-\bm n,-d).$$ Similarly to Remarks \ref{remarkOverflow1} and \ref{remarkOverflow2}, the ${{\,\mathrm{HCI_B}\:\!}}$ formula also suffers from overflow in computer arithmetic when $$\sum_{i=1}^{dim} a_i +d>>|a_{dim}|.$$ To overcome these difficulties we introduce the alternative formula \begin{align} {{\,\mathrm{HCI_C}\:\!}}_{s,dim}^{\bm m} (\bm n,d) &= \sum_{i=0}^{s} \frac{m!} {(m+1+i)!} \, {(-a)^i} {{\,\mathrm{HCI_A}\:\!}}_{s-i,dim-1}^{\bm m^-} (\bm n^-, a + d) \nonumber \\ &\hspace{1cm} + \frac{m!}{(m+s+1)!} (-a)^{s+1} {{\,\mathrm{HCI_A}\:\!}}_{-1 , dim}^{\bm m^*}(\bm n,d), \end{align} where $\bm m^* = \langle m_1,m_2,\dots,m_{dim-1},m + s +1 \rangle$. This formula is obtained by utilizing the identity $\frac{ d {\,\mathrm{Li}}_s(-e^{\mu})}{d\mu} = {\,\mathrm{Li}}_{s-1}(-e^{\mu})$ and by recursive use of integration by parts, increasing the monomial power and reducing the polylogarithm order $s$ until it reaches $-1$. More specifically, ${{\,\mathrm{HCI_C}\:\!}}$ follows the idea in Proposition \ref{equivalentFormula}, where an equivalent closed form expression is given in which $a$ does not appear in the denominator. Note that in ${{\,\mathrm{HCI_C}\:\!}}$ $$ {{\,\mathrm{HCI_A}\:\!}}_{-1 , dim}^{\bm m^*}(\bm n,d) = {{\,\mathrm{HCI_A}\:\!}}_{-1 , dim}^{\bm m^*}(-\bm n,-d),$$ which permits choosing the optimal sign for the normal $\bm n$. The pseudo-code for general dimension $dim \ge 1$ is given in Algorithms \ref{alg1} and \ref{alg2}. In Algorithm \ref{alg1}, the contributions of each component with a zero coefficient $a_i$ are handled first. Algorithm \ref{alg2} is then called to compute the contributions from all the remaining components. The recursive nature of the algorithm follows from the patterns developed in the ${\,\mathrm{HCI_A}\:\!}$, ${\,\mathrm{HCI_B}\:\!}$, and ${\,\mathrm{HCI_C}\:\!}$ formulas. Note that Algorithm~\ref{alg1} also handles the case $\bm n =\bm 0$. Although this case was excluded here, it will be needed later when integrating on the prism. \begin{algorithm} \caption{Pseudo-code for the integration on the hypercube $[0,1]^{dim}$ cut by the hyperplane $\bm n \cdot \bm x + d=0$ with $\bm n = \left<a_1,a_2,\dots,a_{dim}\right>$, $\bm m = \left<m_1,m_2,\dots,m_{dim}\right>$ and $s=-1,0,1,\dots$. For $s=-1$ and $\|\bm n\|=1$ it corresponds to the interface integral. For $s=0$ it corresponds to the subdomain integral.} \label{alg1} \begin{algorithmic}[1] \Function {Hypercube\_Integration}{$dim$, $\bm n$, d, $\bm m$, $s$} \State{${\,\mathrm{HCI}\:\!} = 1$} \For{ $i=1,\dots,dim$} \If {$a_i = 0$} \State{${\,\mathrm{HCI}\:\!} \mathrel{*}= \dfrac{1}{m_i+1}$} \State{Remove the $i$-th component of $\bm n$ and $\bm m$} \State{$dim = dim -1$} \State{$i = i - 1$} \EndIf \EndFor \If {$dim>0$} \State{Sort $\bm n$, and accordingly $\bm m$, from the smallest to the largest coefficient in magnitude} \State{\Return ${\,\mathrm{HCI}\:\!} * \text{\sc{Hypercube\_Integration\_A}}(dim,\, \bm n,\, d,\, \bm m,\, s)$} \Else \State {\Return $-{\,\mathrm{HCI}\:\!} * {\,\mathrm{limLi}}_s(d)$ } \EndIf \EndFunction \end{algorithmic} \end{algorithm} \begin{algorithm} \caption{Pseudo-code for the integration on the hypercube $[0,1]^{dim}$ cut by the hyperplane $\bm n \cdot \bm x + d=0$ with $\bm n = \left<a_1,a_2,\dots,a_{dim}\right>$, $a_1 \ne 0$ and $|a_i|\le|a_{i+1}|$ for all $i=1,...,dim-1$, $\bm m = \left<m_1,m_2,\dots,m_{dim}\right>$, and $s=-1,0,1,\dots\;$. For $s=-1$ and $\|\bm n\|=1$ it corresponds to the interface integral. For $s=0$ it corresponds to the subdomain integral.} \label{alg2} \begin{algorithmic}[1] \Function {Hypercube\_Integration\_A}{$dim$, $\bm n$, $d$, $\bm m$, $s$} \If{$dim = 1$} \State{\Return {\sc{Line\_Segment\_Integration}}$(a_1\, d,\, m_1,\, s)$} \EndIf \State{$sum = \sum_{i=1}^{dim} a_i +d$} \If{$s = -1$} \If {$sum \le 0$} \State {\Return $\text{\sc{Hypercube\_Integration\_B}} (dim,\, \bm n,\, d,\, \bm m,\, -1)$} \Else \State{\Return $\text{\sc{Hypercube\_Integration\_B}} (dim,\, -\bm n,\, -d,\, \bm m,\, -1)$} \EndIf \Else \If{ $sum \le |a_{dim}|$} \State{\Return $\text{\sc{Hypercube\_Integration\_B}} (dim,\, \bm n,\, d,\, \bm m,\, s)$} \Else \State{\Return $\text{\sc{Hypercube\_Integration\_C}} (dim,\, \bm n,\, d,\, \bm m,\, s)$} \EndIf \EndIf \EndFunction \end{algorithmic} \vspace{0.25cm} \begin{algorithmic}[1] \Function {Hypercube\_Integration\_B}{$dim$, $\bm n$, $d$, $\bm m$, $s$} \State {$m = m_{dim}; \quad a = a_{dim}$} \State{Remove the last component of $\bm n$ and $\bm m$} \State {\Return \begin{align*}\hspace{.75cm} &-\sum_{i=1}^{m+1} \frac{m!} {(m+1-i)!} \, \frac{1}{(-a)^i} \text{\sc{Hypercube\_Integration\_A}}(dim-1,\, \bm n,\, a+d,\, \bm m,\, s + i) \nonumber \\ &\hspace{1cm}+\frac{m!}{(-a)^{m+1}} \text{\sc{Hypercube\_Integration\_A}}(dim-1,\, \bm n,\, d,\, \bm m,\, s + m +1) \end{align*}} \EndFunction \end{algorithmic} \vspace{0.25cm} \begin{algorithmic}[1] \Function {Hypercube\_Integration\_C}{$dim$, $\bm n$, $d$, $\bm m$, $s$} \State {$m = m_{dim}; \quad a = a_{dim}; \quad m_{dim} = m_{dim} + s + 1$} \State{$${\,\mathrm{HCI}\:\!} = \dfrac{m!}{(m+s+1)!} (-a)^{s+1} \text{\sc{Hypercube\_Integration\_A}}(dim, \bm n,\, d,\, \bm m,\, -1)$$} \State{Remove the last component of $\bm n$ and $\bm m$} \State{\begin{align*}\hspace{.75cm} {\,\mathrm{HCI}\:\!} \mathrel{+}= \sum_{i=0}^{s \dfrac{m!}{(m + i + 1)!} \, (-a)^{i} \text{\sc{Hypercube\_Integration\_A}}(dim-1, \bm n,\, a+d,\, \bm m,\, s - i) \end{align*}} \State {\Return HCI } \EndFunction \end{algorithmic} \end{algorithm} \section{} \subsection{TRI: Triangle Integration on $\left\{ \protect\begin{array}{@{}l@{}} 0\le x\le 1 \\ 0\le y\le 1-x \protect\end{array} \right.,$ with $a^2+b^2>0$} To ease the computation we choose a non-standard polynomial bases, namely $(1-x)^m y^n$. We then seek integrals in the form \begin{equation} {\,\mathrm{TRI}\:\!}_s^{m,n} (a,b,d)= -\lim_{t \rightarrow \infty}\frac{1}{t^s}\iint_{\mbox{\sc{Tri}}} (1-x)^m y^n {\,\mathrm{Li}}_s(-\exp( (a x +b y +d )t )\, dA. \label{TriOrigin} \end{equation} Then, for all $a$, $b$, $d\in\mathbb{R}$ such that $a^2+b^2 >0$, the subdomain integral is given by $${\,\mathrm{TRI}\:\!}_0^{mn}(a,b,d) = \iint_{\mbox{\sc{Tri}}} (1- x)^m y^n {\,\mathrm{U}}(ax+by+d) \, dA,$$ and, for $a^2+b^2 = 1$, the interface integral is given by $${\,\mathrm{TRI}\:\!}_{-1}^{mn}(a,b,d) = \iint_{\mbox{\sc{Tri}}} (1-x)^m y^n \delta(ax+by+d) \, dA.$$ In Eq.\eqref{TriOrigin}, changing variables and renaming constants as follows $$ x' = 1-x, \, y = y, \quad a'=-a, \,b'= b,\, d' = d + a,$$ yields $$ -\lim_{t \rightarrow \infty}\frac{1}{t^s}\int_{0}^{1} \int_0^{x'} {x'}^{\,m} {y'}^{\,n} {\,\mathrm{Li}}_s(-\exp( (a' x' +b' y' +d' )t )) dy'\,dx'.$$ Dropping the $'$ superscript, for a fixed $s=-1,0,1,\dots$, the problem reduces to evaluating integrals in the form \begin{equation} {\,\mathrm{TRI_A}\:\!}_s^{mn}(a,b,d)=-\lim_{t \rightarrow \infty}\frac{1}{t^s}\int_{0}^{1} \int_0^x x^m y^n {\,\mathrm{Li}}_s(-\exp( (a x +b y +d )t ) dy\,dx. \label{TriAfterTransformation} \end{equation} First, we will consider the three separate cases where the interface $\Gamma$ is parallel to one of the triangle edges. For $b=0$ \begin{align} {\,\mathrm{TRI_B}\:\!}_s^{mn}&(a,0,d)=-\lim_{t \rightarrow \infty}\frac{1}{t^s}\int_{0}^{1} \int_0^x x^m y^n {\,\mathrm{Li}}_s(-\exp( (a x +d )t ) \,dy\,dx \nonumber \\ &= -\lim_{t \rightarrow \infty}\frac{1}{t^s} \int_0^1 \frac{x^{m+n+1}}{n+1} {\,\mathrm{Li}}_s(-\exp( (a x +d )t ) dx \nonumber \\ &= \frac{{\,\mathrm{LSI}\:\!}_s^{m+n+1}(a,d)}{n+1}. \label{verticalCut} \end{align} For $a=0$ \begin{align} {\,\mathrm{TRI_B}\:\!}_s^{mn}&(0,b,d)=-\lim_{t \rightarrow \infty} \frac{1}{t^s}\int_{0}^{1} \int_y^1 x^m y^n {\,\mathrm{Li}}_s(-\exp( (b y +d )t ) \,dx\,dy \nonumber \\ &= -\lim_{t \rightarrow \infty}\frac{1}{t^s} \frac{1}{m+1} \int_0^1 (y^n - y^{n+m+1}) {\,\mathrm{Li}}_s(-\exp( (b y +d )t ) dy \nonumber \\ &=\frac{{\,\mathrm{LSI}\:\!}_s^{n}(b,d)-{\,\mathrm{LSI}\:\!}_s^{m+n+1}(b,d)}{m+1}. \label{horizontalCut} \end{align} For $ a + b = 0 $ \begin{align} {\,\mathrm{TRI_B}\:\!}_s^{mn}&(a,-a,d)=-\lim_{t \rightarrow \infty}\frac{1}{t^s}\int_{0}^{1} \int_0^x x^m y^n {\,\mathrm{Li}}_s(-\exp( (a x -a y +d )t ) \,dy\,dx \nonumber \\ &= -\lim_{t \rightarrow \infty}\frac{1}{t^s} \int_0^1 n! \left(\sum_{i=1}^{n+1} \frac{(-1)^{i-1}}{(n+1-i)!} x^{m+n+1-i} \frac{{\,\mathrm{Li}}_{s+i}(-\exp( (a x -a x+ d )t )}{(-at)^i} \right. \nonumber \\ &\qquad\qquad\qquad\qquad\qquad\qquad\quad\left.- (-1)^{n} x^m \frac{{\,\mathrm{Li}}_{s+n+1}(-\exp(a x + d )t )}{(-at)^{n+1}} \right) dx \nonumber \\ &= n! \left(\sum_{i=1}^{n+1} \left(\frac{1}{a}\right)^i \frac{ {\,\mathrm{limLi}}_{s+i}(d)}{(n+1-i)!} \int_0^1 x^{m+n+1-i} dx + \left(\frac{1}{a}\right)^{n+1}{\,\mathrm{LSI}\:\!}_{s+n+1}^{m}(a,d)\right) \nonumber \\ &= n! \left(\sum_{i=1}^{n+1} \left(\frac{1}{a}\right)^i \frac{ {\,\mathrm{limLi}}_{s+i}(d)}{(n+1-i)!\,(m+n+2-i) } + \left(\frac{1}{a}\right)^{n+1}{\,\mathrm{LSI}\:\!}_{s+n+1}^{m}(a,d)\right). \label{YequalsXCut} \end{align} Next, we consider the remaining cases where the interface $\Gamma$ is not parallel to one of the triangle edges. For $a\ne0$, $b\ne0$ and $a+b\ne 0$ \begin{align} {\,\mathrm{TRI_B}\:\!}_s^{mn}&(a,b,d)=-\lim_{t \rightarrow \infty}\frac{1}{t^s}\int_{0}^{1} \int_0^x x^m y^n {\,\mathrm{Li}}_s(-\exp( (a x +b y +d )t ) \,dy\,dx \nonumber \\ &= -\lim_{t \rightarrow \infty}\frac{1}{t^s} \int_0^1 n! \left(\sum_{j=1}^{n+1} \frac{(-1)^{j-1}}{(n+1-j)!} x^{m+n+1-j} \frac{{\,\mathrm{Li}}_{s+j}(-\exp( ((a +b)x + d )t )}{(bt)^j} \right.\nonumber\\ &\qquad\qquad\qquad\qquad\qquad\qquad\quad\left.- (-1)^{n} x^m \frac{{\,\mathrm{Li}}_{s+n+1}(-\exp(a x + d )t )}{(bt)^{n+1}} \right) dx \nonumber\\ &= -\sum_{j=1}^{n+1} \frac{n!}{(-b)^j(n+1-j)!} {\,\mathrm{LSI}\:\!}_{s+j}^{m+n+1-j}(a+b,d) + \frac{n!}{(-b)^{n+1}}{\,\mathrm{LSI}\:\!}_{s+n+1}^{m}(a,d). \label{triangle} \end{align} Alternatively, the same integral could be evaluated by reversing the order of integration. Specifically, \begin{align} {\,\mathrm{TRI_B}\:\!}_s^{mn}&(a,b,d)=-\lim_{t \rightarrow \infty}\frac{1}{t^s}\int_{0}^{1} \int_y^1 x^m y^n {\,\mathrm{Li}}_s(-\exp( (a x +b y +d )t ) \,dx\,dy \nonumber \\ &= -\lim_{t \rightarrow \infty}\frac{1}{t^s} \int_0^1 m! \left(\sum_{j=1}^{m+1} \frac{(-1)^{j-1}}{(m+1-j)!}y^n \frac{{\,\mathrm{Li}}_{s+j}(-\exp( by + a + d )t )}{(at)^j} \right.\nonumber\\ &\hspace{4cm}\left.- \frac{(-1)^{j-1}}{(m+1-j)!} y^{m+n+1-j} \frac{{\,\mathrm{Li}}_{s+j}(-\exp( ((a +b)y + d )t )}{(at)^j} \right) dx \nonumber\\ &=\sum_{j=1}^{m+1} \frac{m!}{(m+1-j)!} \frac{-1}{(-a)}^j \left( {\,\mathrm{LSI}\:\!}_{s+j}^{m+n+1-j}(a+b,d) -{\,\mathrm{LSI}\:\!}_{s+j}^{n}(b,a+d) \right). \label{triangleB} \end{align} In the limit for $b\rightarrow0$, with $|a|>M>0$, Eq.~\eqref{triangle} may suffer from overflow. Similarly, in the limit for $a\rightarrow0$, with $|b|>M>0$, Eq.~\eqref{triangleB} may suffer from overflow. The choice of which formula to use, Eq.~\eqref{triangle} or Eq.~\eqref{triangleB}, should take into consideration the magnitude of $a$ and $b$. \begin{remark} \label{rem:tri} In Eq.~\eqref{triangle}, for $a+b+d\le0$ the summation within the ${\,\mathrm{LSI}\:\!}_{s+j}^{m+n+1-j}(a+b,d)$ terms vanishes. This is due to ${\,\mathrm{limLi}}_{s+1+i}(x) = 0$, with $s\ge-1$, $i\in \mathbb{Z}^+$, and non positive argument $x$. Specifically, for $a+b+d\le0$, Eqs.~\eqref{triangle} and \eqref{triangleB} reduce to \begin{align} {{\,\mathrm{TRI_{BR}}\:\!}}_s^{mn}(a,b,d)=& n!\left( \frac{{\,\mathrm{limLi}}_{s+m+n+2}(d)}{(-(a+b))^{m+n+2}} \sum_{j=1}^{n+1} \frac{(m+n+1-j)!}{(n+1-j)!} \left(\frac{a+b}{b}\right)^j \right. \nonumber \\ &\qquad +\left. \frac{{\,\mathrm{LSI}\:\!}_{s+n+1}^{m}(a,d)}{(-b)^{n+1}}\right), \label{triangleReduced} \end{align} and \begin{align} {{\,\mathrm{TRI_{BR}}\:\!}}_s^{mn}(a,b,d)&= m!\left( - \frac{{\,\mathrm{limLi}}_{s+m+n+2}(d)}{(-(a+b))^{m+n+2}} \sum_{j=1}^{m+1} \frac{(m+n+1-j)!}{(m+1-j)!} \left(\frac{a+b}{a}\right)^j \right. \nonumber \\ &\left. \qquad + \frac{n!}{(-b)^{n+1}} \sum_{j=1}^{m+1} \frac{1}{(m+1-j)!} \frac{{\,\mathrm{limLi}}_{s+n+j+1}(a+d)}{(-a)^{j}} \right), \label{triangleBReduced} \end{align} which are less expensive to compute. For $s=-1$ and $a+b+d>0$, we can still take advantage of this reduction by changing the sign of the normal and utilizing Proposition \ref{stepFunction}. Namely, $${\,\mathrm{TRI_B}\:\!}_{-1}^{mn}(a,b,d) = {\,\mathrm{TRI_{BR}}\:\!}_{-1}^{mn}(-a,-b,-d).$$ A similar reasoning can be extended to the limiting cases ${\,\mathrm{TRI_B}\:\!}_s^{mn} (a,0,d)$, ${\,\mathrm{TRI_B}\:\!}_s^{mn} (0,b,d)$ and ${\,\mathrm{TRI_B}\:\!}_s^{mn} (a,-a,0)$, when $a+d\le0$, $b+d\le0$, and $d\le0$, respectively. However, special attention should be used if $s=-1$ and $a+b+d=0$, since for this case the first terms in the ``supposedly vanishing'' sums would be ${\,\mathrm{limLi}}_0(0) = -0.5 \ne 0$. Rewriting the three reduced formulas in a conservative way, always including the first term in the sum, leads to \begin{align} &{\,\mathrm{TRI_{BR}}\:\!}_s^{mn}(a,0,d)= \frac{1}{n+1}\left(-\frac{{\,\mathrm{limLi}}_{s+1}(a + d ) }{\,a} + (m+n+1)! \frac{(-1)^{m+n+1} {\,\mathrm{limLi}}_{s+m+n+2}(d)}{a^{m+n+2}}\right),\label{trib0}\\ &{\,\mathrm{TRI_{BR}}\:\!}_s^{mn}(0,b,d)= \frac{1}{m+1}\left( n! \frac{(-1)^{n} {\,\mathrm{limLi}}_{s+n+1}(d)}{b^{n+1}} - (m+n+1)! \frac{(-1)^{m+n+1} {\,\mathrm{limLi}}_{s+m+n+2}(d)}{b^{m+n+2}} \right),\label{tria0}\\ &{\,\mathrm{TRI_{BR}}\:\!}_s^{mn}(a,-a,d)= \frac{{\,\mathrm{limLi}}_{s+1}(d )}{ (m+n+1) a} + n! m! \sum_{i=1}^{m+1} \frac{(-1)^{i} {\,\mathrm{limLi}}_{s+n+1+i}(a+d ) }{(m+1-i)!\,a^{n+1+i}}, \label{tribma} \end{align} which hold for $a+b+d\le0$ and $s\ge-1$. \end{remark} We also include the two alternative formulas below. These are obtained by utilizing the property $\frac{ d {\,\mathrm{Li}}_s(-e^{\mu})}{d\mu} = {\,\mathrm{Li}}_{s-1}(-e^{\mu})$ and by recursive use of integration by parts, increasing the monomial power and reducing the polylogarithm order $s$ until it reaches $-1$. Namely, for $s\ge0$ and $b\ne0$, \begin{align} {\,\mathrm{TRI_C}\:\!}_s^{m,n} (a,b,d)&=\dfrac{n!}{(n+s+1)!} (-b)^{s+1} {\,\mathrm{TRI_A}\:\!}_{-1}^{m,n+s+1}(a,b,d) \nonumber \\ &+ \sum_{i=0}^{s} \dfrac{n!}{(n+i+1)!} (-b)^{i} {\,\mathrm{LSI}\:\!}_{s-i}^{m+n+i+1}(a+b,d), \label{triAlternative} \end{align} and, for $s\ge0$ and $a\ne 0$, \begin{align} {\,\mathrm{TRI_C}\:\!}_s^{m,n} (a,b,d)&=\dfrac{m!}{(m+s+1)!} (-a)^{s+1} {\,\mathrm{TRI}\:\!}_{-1}^{m+s+1,n}(a,b,d) \nonumber \\ &+ \sum_{i=0}^{s} \dfrac{m!}{(m+i+1)!} (-a)^{i} \left({\,\mathrm{LSI}\:\!}_{s-i}^{n}(b,d+a)-{\,\mathrm{LSI}\:\!}_{s-i}^{m+n+i+1}(a+b,d)\right). \label{triAlternativeB} \end{align} For $a+b+d>\max(|a|,|b|)$, the combination of Remark \ref{rem:tri} and Eqs.~\eqref{triAlternative}-\eqref{triAlternativeB} yields a formulation which protects against overflow for $a \rightarrow 0$ and/or $b \rightarrow 0$. In particular, the calls to the $${\,\mathrm{TRI_A}\:\!}_{-1}^{m, n+s+1}(a,b,d) \mbox{ and } {\,\mathrm{TRI_A}\:\!}_{-1}^{m+s+1,n}(a,b,d)$$ integrals in Eq.~\eqref{triAlternative} and Eq.~\eqref{triAlternativeB} can be replaced by $${\,\mathrm{TRI_A}\:\!}_{-1}^{m, n+s+1}(-a,-b,-d)\mbox{ and }{\,\mathrm{TRI_A}\:\!}_{-1}^{m+s+1,n}(-a,-b,-d),$$ respectively, for which $(-a) + (-b) +(-d) <0$. At last we include the degenerate case when both $a=0$ and $b=0$ for $s \ge 0$, which was excluded because of the constraint $a^2+b^2>1$. This case is needed for external calls made by higher dimensional objects, such as the tetrahedron and prism, for which the normal $\bm n =\left<a,b,c \right>$ could take the form $\bm n = \left<0,0,c \right>$. After integration \begin{equation} {\,\mathrm{TRI_A}\:\!}_s^{mn}(0,0,d) \label{triDeg} =-\lim_{t \rightarrow \infty}\frac{1}{t^s}\int_{0}^{1} \int_0^x x^m y^n {\,\mathrm{Li}}_s(-\exp( d t ) ) dy\,dx = -\frac{{\,\mathrm{limLi}}_s^{mn}(d)}{(n+1)(m+n+2)}. \end{equation} The pseudo-code for the triangle integration is given in Algorithms \ref{algtri0} and \ref{algtri1}. Algorithm \ref{algtri0} evaluates the integral in Eq.~\eqref{TriOrigin} on the triangle $\{(x,y):x\in[0,1],y\in[0,1-x]\}$. It calls the function {\sc Triangle\_Integration\_A} in Algorithm \ref{algtri1}, which evaluates the transformed integral in Eq.~\eqref{TriAfterTransformation} on the triangle $\{(x,y):x\in[0,1],y\in[0,x]\}$. {\sc Triangle\_Integration\_A} handles the degenerate case $a=b=0$ and sorts the different $s-$cases. For each case it ensures that the reduced integration function, {\sc Triangle\_Integration\_BR}, is called only for $a+b+d\le0$. For $0<a+b+d\le\max(|a|,|b|)$, the function {\sc Triangle\_Integration\_B} is called, otherwise the alternative function {\sc Triangle\_Integration\_C} is used. The recursive calls follow from the patterns developed in Eqs.~\eqref{triAlternative} and \eqref{triAlternativeB}. Every time the line segment integration formula, ${\,\mathrm{LSI}\:\!}$, is needed the function {\sc Line\_Segment\_Integration} in Algorithm \ref{algLSI} is called. \begin{algorithm} \caption{Pseudo-code for the integration of Eq.~\eqref{TriOrigin} on the triangle $\{(x,y):x\in[0,1],y\in[0,1-x]\}$ cut by the line $a\,x + b\,y+ d=0$ with $\bm n = \left<a,b \right>$, $\|\bm n\|>0$, $\bm m = \left<m,n \right>$, and $s=-1,0,1,\dots$. For $s=-1$ and $\|\bm n\|=1$ it corresponds to the interface integral. For $s=0$ it corresponds to the subdomain integral.} \label{algtri0} \begin{algorithmic}[1] \Function {Triangle\_Integration}{$a$, $b$, $d$, $m$ $n$, $s$} \State{\Return $\text{\sc{Triangle\_Integration\_A}} (-a,\,b,\,d+a,\,m,\,n,\,s)$} \EndFunction \end{algorithmic} \end{algorithm} \begin{algorithm} \caption{Pseudo-code for the integration of Eq.~\eqref{TriAfterTransformation} on the triangle $\{(x,y):x\in[0,1],y\in[0,x]\}$ cut by the line $a\,x + b\,y+ d=0$ with $\bm n = \left<a,b \right>$, $\bm m = \left<m,n \right>$ and $s=-1,0,1,\dots$. For $s=-1$ and $\|\bm n\|=1$ it corresponds to the interface integral. For $s=0$ and $\|\bm n\|>0$ it corresponds to the subdomain integral.} \label{algtri1} \begin{algorithmic}[1] \Function {Triangle\_Integration\_A}{$a$, $b$, $d$, $m$ $n$, $s$} \vspace{0.5mm} \If{$b = 0$ and $a = 0$} \Return ${{\,\mathrm{TRI}\:\!}}_s^{mn}(0,0,d) $ from Eq.~\eqref{triDeg} \EndIf \vspace{0.5mm} \If{$s = -1$} \If{$a+b+d \le 0$} \Return $\text{\sc{Triangle\_Integration\_BR}} (a,\,b,\,d,\,m,\,n,\,-1)$\vspace{0.5mm} \Else{} \Return$\text{\sc{Triangle\_Integration\_BR}} (-a,\,-b,\,-d,\,m,\,n,\,-1)$\vspace{0.5mm} \EndIf \Else \If{$a+b+d \le 0$} \Return $\text{\sc{Triangle\_Integration\_BR}} (a,\,b,\,d,\,m,\,n,\,s)$ \vspace{0.5mm} \ElsIf{$a+b+d \le \max(|a|,|b|)$} \Return$\text{\sc{Triangle\_Integration\_B}} (a,\,b,\,d,\,m,\,n,\,s)$\vspace{0.5mm} \Else {} \Return$\text{\sc{Triangle\_Integration\_C}} (a,\,b,\,d,\,m,\,n,\,s)$ \EndIf \EndIf \EndFunction \end{algorithmic} \vspace{0.25cm} \begin{algorithmic}[1] \Function {Triangle\_Integration\_B}{$a$, $b$, $d$, $m$ $n$, $s$} \If{$b = 0$} {\Return $\;{\,\mathrm{TRI_B}\:\!}_s^{mn}(a,0,d) $ from Eq.~\eqref{verticalCut} \vspace{0.5mm}} \ElsIf{$a=0$} {\Return $\;{\,\mathrm{TRI_B}\:\!}_s^{mn}(0,a,d) $ from Eq.~\eqref{horizontalCut}\vspace{0.5mm}} \ElsIf{$a+b=0$} {\Return $\;{\,\mathrm{TRI_B}\:\!}^{mn}(a,-a,d) $ from Eq.~\eqref{YequalsXCut}\vspace{0.5mm}} \Else \If{$|a| \le |b|$} {\Return $\;{\,\mathrm{TRI_B}\:\!}_s^{mn}(a,b,d) $ from Eq.~\eqref{triangle}\vspace{0.5mm}} \Else {} {\Return $\;{\,\mathrm{TRI_B}\:\!}_s^{mn}(a,b,d) $ from Eq.~\eqref{triangleB}\vspace{0.5mm}} \EndIf \EndIf \EndFunction \end{algorithmic} \vspace{0.25cm} \begin{algorithmic}[1] \Function {Triangle\_Integration\_BR}{$a$, $b$, $d$, $m$ $n$, $s$} \If{$b = 0$} {\Return $\;{\,\mathrm{TRI_{BR}}\:\!}_s^{mn}(a,0,d) $ from Eq.~\eqref{trib0}\vspace{0.5mm}} \ElsIf{$a=0$} {\Return $\;{\,\mathrm{TRI_{BR}}\:\!}_s^{mn}(0,a,d) $ from Eq.~\eqref{tria0}\vspace{0.5mm}} \ElsIf{$a+b=0$} {\Return $\;{\,\mathrm{TRI_{BR}}\:\!}^{mn}(a,-a,d) $ from Eq.~\eqref{tribma}\vspace{0.5mm}} \Else \If{$|a| \le |b|$} {\Return $\;{\,\mathrm{TRI_{BR}}\:\!}_s^{mn}(a,b,d) $ from Eq.~\eqref{triangleReduced} \vspace{0.5mm}} \Else {} {\Return $\;{\,\mathrm{TRI_{BR}}\:\!}_s^{mn}(a,b,d) $ from Eq.~\eqref{triangleBReduced}\vspace{0.5mm}} \EndIf \EndIf \EndFunction \end{algorithmic} \vspace{0.25cm} \begin{algorithmic}[1] \Function {Triangle\_Integration\_C}{$a$, $b$, $d$, $m$ $n$, $s$} \If{$|a|\le|b|$} \Return \State{ $ \sum_{i=0}^{s} \dfrac{n!}{(n+i+1)!} (-b)^{i} {\,\mathrm{LSI}\:\!}_{s-i}^{m+n+i+1}(a+b,d)$} \State{ $\qquad +\dfrac{n!}{(n+s+1)!} (-b)^{s+1}\text{\sc{Triangle\_Integration\_A}}(a,\,b,\,d,\,m,\,n+s+1,\,-1) $} \Else {} \Return \State{ $\sum_{i=0}^{s} \dfrac{m!}{(m+i+1)!} (-a)^{i} \left({\,\mathrm{LSI}\:\!}_{s-i}^{n}(b,d+a)-{\,\mathrm{LSI}\:\!}_{s-i}^{m+n+i+1}(a+b,d)\right)$} \State{$\qquad +\dfrac{m!}{(m+s+1)!} (-a)^{s+1} \text{\sc{Triangle\_Integration\_A}}(a,\,b,\,d,\,m+s+1,\,n,\,-1)$} \EndIf \EndFunction \end{algorithmic} \end{algorithm} \subsection{TTI: Tetrahedron Integration on $\left\{ \protect\begin{array}{@{}l@{}} 0\le x\le 1 \\ 0\le y\le 1-x \\0\le z \le 1-x-y \protect\end{array} \right.,$ with $a^2+b^2+c^2>0$} To ease the computation in the case of the tetrahedron, we choose different polynomial bases depending on the magnitude of the coefficients $a$, $b$, and $c$. Let $m_1 = \max( |a+b| , |c-b|)$, $m_2 = \max( |b+c| , |a-c|)$ and $m_3 = \max( |c+a| , |b-a|)$, with the constraints $a^2+b^2+c^2>0$ and $\max(m1,m2,m3) > 0$. For $m_1 \ge \max(m_2,m_3)$, we evaluate integrals in the form \begin{equation} {\,\mathrm{TTI}\:\!}_s^{mno}(a,b,c,d) = -\lim_{t \rightarrow \infty}\frac{1}{t^s}\iiint_{\mbox{\sc{Tet}}} (x+y+z)^m (y+z)^n z^o {\,\mathrm{Li}}_s(-\exp( (a x +b y + c z +d )t ) \,dV, \label{TET1} \end{equation} else, for $m_2>m_3$, we evaluate integrals in the form \begin{equation} {\,\mathrm{TTI}\:\!}_s^{mno}(a,b,c,d) = -\lim_{t \rightarrow \infty}\frac{1}{t^s} \iiint_{\mbox{\sc{Tet}}} x^m (x+y+z)^n (z+x)^o {\,\mathrm{Li}}_s(-\exp( (a x +b y + c z +d )t ) \,dV, \label{TET2} \end{equation} else we evaluate integrals in the form \begin{equation} {\,\mathrm{TTI}\:\!}_s^{mno}(a,b,c,d) = -\lim_{t \rightarrow \infty}\frac{1}{t^s} \iiint_{\mbox{\sc{Tet}}} (x+y)^m y^n (x+y+z)^o {\,\mathrm{Li}}_s(-\exp( (a x +b y + c z +d )t ) \,dV. \label{TET3} \end{equation} We make the following change of variables and constant renaming \begin{itemize} \item for Eq.~\eqref{TET1}, $$x'=x+y+z,\,y'=y+z,\,z'=z,\quad m'=m,\,n'=n,\, o'=o,\quad a'=a,\,b'=b+a,\, c'=c-b,\,d\,'=d,$$ \item for Eq.~\eqref{TET2}, $$x'=x+y+z,\,y'=z+x,\,z'=x,\quad m'=n,\,n'=o,\, o'=m,\quad a'=b,\,b'=c+b,\, c'=a-c,\,d\,'=d,$$ \item for Eq.~\eqref{TET3}, $$x'=x+y+z,\,y'=x+y,\,z'=y,\quad m'=o,\,n'=m,\, o'=n,\quad a'=c,\,b'=a+c,\, c'=b-a,\,d\,'=d,$$ \end{itemize} always obtaining the same integral $$ -\lim_{t \rightarrow \infty}\frac{1}{t^s}\int_{0}^{1} \int_0^{x'} \int_0^{y'} {x'}^{\,m'} {y'}^{\,n'} {z'}^{\,o'} {\,\mathrm{Li}}_s(-\exp( (a' x' +b' y' + c' z' +d' )t ) \,dz'\,dy'\,dx'.$$ Dropping the $'$ superscript, for a fixed $s=-1,0,1,\dots$, the problem reduces to find integrals in the form \begin{equation} {\,\mathrm{TTI_A}\:\!}_s^{mno}(a,b,c,d)=-\lim_{t \rightarrow \infty}\frac{1}{t^s}\int_{0}^{1} \int_0^x \int_0^{y} x^m y^n z^o {\,\mathrm{Li}}_s(-\exp( (a x +b y + c z +d )t ) \,dz\,dy\,dx,\label{tetrahedronA} \end{equation} where $\max(|b|,|c|) = \max(m_1,m_2,m_3)>0$. For $|b| \le |c|$, after integrating in $z$ \begin{align} {\,\mathrm{TTI_B}\:\!}&_s^{mno}(a,b,c,d)\nonumber \\ &= -\lim_{t \rightarrow \infty}\frac{1}{t^s}\int_{0}^{1} \int_0^{x} x^m y^n \Bigg(\sum_{i=1}^{o+1} \frac{o!(-1)^{i-1}}{(o+1-i)!} y^{o+1-i} \frac{{\,\mathrm{Li}}_{s+i}(-\exp( (a x +b y + cy + d )t )}{(ct)^i} \nonumber \\ &\quad - o! (-1)^{o} \frac{{\,\mathrm{Li}}_{s+o+1}(-\exp( (a x +b y + d )t )}{(ct)^{o+1}} \Bigg)dy\,dx.\nonumber\\ &= -\lim_{t \rightarrow \infty}\frac{1}{t^s}\int_{0}^{1} \int_0^{x} \Bigg(\sum_{i=1}^{o+1} \frac{o!(-1)^{i-1}}{(o+1-i)!} x^{m} y^{n+o+1-i} \frac{{\,\mathrm{Li}}_{s+i}(-\exp( (a x + (b+c) y + d )t )}{(ct)^i} \nonumber \\ &\quad - o! (-1)^{o} x^m y^n \frac{{\,\mathrm{Li}}_{s+o+1}(-\exp( (a x +b y + d )t )}{(ct)^{o+1}} \Bigg)dy\,dx. \end{align} Simplifying and using the triangle integration formula yields \begin{align} {\,\mathrm{TTI_B}\:\!}_s^{mno}(a,b,c,d)=& -\sum_{i=1}^{o+1} \frac{o!}{(o+1-i)!} \frac{1}{(-c)^i} \; {\,\mathrm{TRI_A}\:\!}_{s+i}^{m,\;n+o+1-i}(a,b+c,d) + \frac{o!}{(-c)^{o+1}} {\,\mathrm{TRI_A}\:\!}_{s+o+1}^{m n}(a,b,d). \label{TTIB1} \end{align} For $|c| < |b|$, we reverse the order of integration and after simplification get \begin{align} {\,\mathrm{TTI_B}\:\!}_s&^{mno}(a,b,c,d)=-\lim_{t \rightarrow \infty}\frac{1}{t^s}\int_{0}^{1} \int_0^x \int_z^{x} x^m y^n z^o {\,\mathrm{Li}}_s(-\exp( (a x +b y + c z +d )t ) \,dy\,dz\,dx \nonumber \\ & = \sum_{i=1}^{n+1} \frac{n!}{(n+1-i)!} \frac{1}{(-b)^i} \;\left( {\,\mathrm{TRI_A}\:\!}_{s+i}^{m,\;n+o+1-i}(a,b+c,d) - {\,\mathrm{TRI_A}\:\!}_{s+i}^{m+n+1-i,o}(a+b,c,d) \right). \label{TTIB2} \end{align} All limiting cases, are left to be handled by the triangle integration formula as described in the previous section. For $s\ge0$ and $a +b +c+d > \max(|b|,|c|)$, we also include the alternative formulas below. These are obtained by utilizing the property $\frac{ d {\,\mathrm{Li}}_s(-e^{\mu})}{d\mu} = {\,\mathrm{Li}}_{s-1}(-e^{\mu})$ and by recursive use of integration by parts, increasing the monomial power and reducing the polylogarithm order $s$ until it reaches $-1$.. Namely, For $|b|\le|c|$ \begin{align} {\,\mathrm{TTI_C}\:\!}_s^{m,n,o} (a,b,c,d) &=\dfrac{o!}{(o+s+1)!} (-c)^{s+1} {\,\mathrm{TTI_A}\:\!}_{-1}^{m,n,o+s+1}(a,b,c,d) \nonumber \\ &+ \sum_{i=0}^{s} \dfrac{o!}{(o+i+1)!} (-c)^{i} {\,\mathrm{TRI_A}\:\!}_{s-i}^{m, n+o+i+1}(a,b+c,d), \end{align} otherwise \begin{align} {\,\mathrm{TTI_C}\:\!}_s&^{m,n,o} (a,b,c,d) =\dfrac{n!}{(n+s+1)!} (-b)^{s+1} {\,\mathrm{TTI_A}\:\!}_{-1}^{m,n+s+1,o}(a,b,c,d) \nonumber \\ &+ \sum_{i=0}^{s} \dfrac{n!}{(n+i+1)!} (-b)^{i}\left( {\,\mathrm{TRI_A}\:\!}_{s-i}^{m+n+i+1,o}(a+b,c,d) - {\,\mathrm{TRI_A}\:\!}_{s-i}^{m, n+o+i+1}(a,b+c,d) \right). \end{align} The pseudo-code for the integration over the tetrahedron is given in Algorithms \ref{algtet0} and \ref{algtet1}. Every time the triangle integration formula ${\,\mathrm{TRI_A}\:\!}$ is needed, the function {\sc Triangle\_Integration\_A} in Algorithm \ref{algtri1} is called. \begin{algorithm} \caption{Pseudo-code for the integration of Eqs.~\eqref{TET1}-\eqref{TET3} on the tetrahedron $\{(x,y,z):x\in[0,1],y\in[0,1-x], z\in[0,1-x-y]\}$ cut by the plane $a\,x + b\,y+ c\,z + d=0$ with $\bm n = \left<a,b,c \right>$, $\|\bm n\|>0$, $\bm m = \left<m,n,o \right>$ and $s=-1,0,1,\dots$. For $s=-1$ and $\|\bm n\|=1$ it corresponds to the interface integral. For $s=0$ it corresponds to the subdomain integral.} \label{algtet0} \begin{algorithmic}[1] \Function {Tetrahedron\_Integration}{$a$, $b$, $c$, $d$, $m$ $n$, $o$, $s$} \State{$m_1 = \max( |a+b| , |c-b|)$, $m_2 = \max( |b+c| , |a-c|)$ and $m_3 = \max( |c+a| , |b-a|)$} \If{$m_1 \ge \max(m_2,m_3)$} \State{ \Return $\text{\sc{Tetrahedron\_Integration\_A}} (a,\,a+b,\,c-b,\,d,\,m,\,n,\,o,\,s)$} \ElsIf{$m_2 \ge m_2$} \State{ \Return $\text{\sc{Tetrahedron\_Integration\_A}} (b,\,b+c,\,a-c,\,d,\,n,\,m,\,o,\,s)$} \Else \State{ \Return $\text{\sc{Tetrahedron\_Integration\_A}} (c,\,c+a,\,b-a,\,d,\,o,\,m,\,n,\,s)$} \EndIf \EndFunction \end{algorithmic} \end{algorithm} \begin{algorithm} \caption{Pseudo-code for the integration of Eq.~\eqref{tetrahedronA} on the tetrahedron $\{(x,y,z):x\in[0,1],y\in[0,x], z\in[0,y]\}$ cut by the plane $a\,x + b\,y+ c\,z + d=0$ with $\bm n = \left<a,b,c \right>$, either $b\ne0$ or $c \ne 0$, $\bm m = \left<m,n,o \right>$ and $s=-1,0,1,\dots$. For $s=-1$ and $\|\bm n\|=1$ it corresponds to the interface integral. For $s=0$ it corresponds to the subdomain integral. } \label{algtet1} \begin{algorithmic}[1] \Function {Tetrahedron\_Integration\_A}{$a$, $b$, $c$, $d$, $m$ $n$, $o$, $s$} \State{$sum = a + b + c + d$} \If{$s = -1$} \If {$sum \le 0$} \State {\Return $\text{\sc{Tetrahedron\_Integration\_B}} (a,\,b,\,c,\,d,\,m,\,n,\,o,\,-1)$} \Else \State{\Return $\text{\sc{Tetrahedron\_Integration\_B}} (-a,\,-b,\,-c,\,-d,\,m,\,n,\,o,\,-1)$} \EndIf \Else \If{ $sum \le \max(|b|,|c|)$} \State{\Return $\text{\sc{Tetrahedron\_Integration\_B}} (a,\,b,\,c,\,d,\,m,\,n,\,o,\, s)$} \Else \State{\Return $\text{\sc{Tetrahedron\_Integration\_C}} (a,\,b,\,c,\,d,\,m,\,n,\,o,\, s)$} \EndIf \EndIf \EndFunction \end{algorithmic} \vspace{0.25cm} \begin{algorithmic}[1] \Function {Tetrahedron\_Integration\_B}{$a$, $b$, $c$, $d$, $m$ $n$, $o$, $s$} \vspace{1mm} \If{$|b|\le|c|$} \Return ${\,\mathrm{TTI_B}\:\!}$ from Eq.~\eqref{TTIB1} \vspace{1mm} \Else {} \Return ${\,\mathrm{TTI_B}\:\!}$ from Eq.~\eqref{TTIB2} \vspace{1mm} \EndIf \EndFunction \end{algorithmic} \vspace{0.25cm} \begin{algorithmic}[1] \Function {Tetrahedron\_Integration\_C}{$dim$, $\bm n$, $d$, $\bm m$, $s$} \If{$|b|\le|c|$} \Return \State{ $ \sum_{i=0}^{s} \dfrac{o!}{(o+i+1)!} (-c)^{i} {\,\mathrm{TRI_A}\:\!}_{s-i}^{m, n+o+i+1}(a,b+c,d)$} \State{ $\qquad +\dfrac{o!}{(o+s+1)!} (-c)^{s+1}\text{\sc{Tetrahedron\_Integration\_A}}(a,\,b,\,c,\,d,\,m,\,n,\,o+s+1,\,-1) $} \Else {} \Return \State{ $ \sum_{i=0}^{s} \dfrac{n!}{(n+i+1)!} (-b)^{i}\left( {\,\mathrm{TRI_A}\:\!}_{s-i}^{m+n+i+1,o}(a+b,c,d) - {\,\mathrm{TRI_A}\:\!}_{s-i}^{m, n+o+i+1}(a,b+c,d) \right)$} \State{$\qquad +\dfrac{n!}{(n+s+1)!} (-b)^{s+1} \text{\sc{Tetrahedron\_Integration\_A}}(a,\,b,\,c,\,d,\,m,\,n+s+1,\,o,\,-1)$} \EndIf \EndFunction \end{algorithmic} \end{algorithm} \subsection{PRI: Prism Integration on $\left\{ \protect\begin{array}{@{}l@{}} 0\le x\le 1 \\ 0\le y\le 1-x \\-1\le z \le 1 \protect\end{array} \right.,$ with $a^2+b^2+c^2>0$} The implementation of a polynomial basis whose elements are given by $(1-x)^m y^n z^o$, allows for computational simplicity when considering integrals in the form \begin{equation} {\,\mathrm{PRI}\:\!} = -\lim_{t \rightarrow \infty}\frac{1}{t^s}\iiint_{\mbox{\sc{Pri}}} (1-x)^m y^n \left(\frac{1+z}{2}\right)^o {\,\mathrm{Li}}_s(-\exp( (a x +b y+c z +d )t ) \frac{dV}{2}. \label{PriOrigin} \end{equation} By using the following transformation $$ x' = 1-x, \, y' = y, \, z' = \frac{1+z}{2}, \quad a'=-a, b'= b, c'=2 c,\, d' = d + a - c$$ we obtain $$ -\lim_{t \rightarrow \infty}\frac{1}{t^s}\int_{0}^{1} \int_0^{x'} \int_{0}^1 {x'}^{\,m} {y'}^{\,n} {z'}^{\,o} {\,\mathrm{Li}}_s(-\exp( (a' x' +b' y' + c' z' + d' )t )) dz' \,dy'\,dx'$$ Dropping the $'$ superscript, for a fixed $s=-1,0,1,\dots$, the problem reduces to integrals in the form $$ {\,\mathrm{PRI_A}\:\!}_s^{mno}(a,b,c,d)=-\lim_{t \rightarrow \infty}\frac{1}{t^s}\int_{0}^{1} \int_0^x \int_{0}^1 x^m y^n z^o {\,\mathrm{Li}}_s(-\exp( (a x +b y + c z +d )t ) \,dz\,dy\,dx.$$ For $|c|\ge\max(|a|,|b|)$, after integrating in z we get \begin{align} {\,\mathrm{PRI_B}\:\!}&_s^{mno}(a,b,c,d) = -\lim_{t\rightarrow \infty} \int_{0}^{1}\int_{0}^{x} x^m y^n \left(- \sum_{i=1}^{o+1} \frac{o!} {(o+1-i)!} \, \frac{1}{(-c)^i} \frac{{\,\mathrm{Li}}_{s+i} (-\exp( (a x+by+c +d )t )}{ t^{s+i}} \nonumber\right. \\ & \left. \qquad + \frac{o!}{(-c)^{o+1}} \frac{{\,\mathrm{Li}}_{s+o+1} (-\exp( (ax +by + d )t )}{ t^{s+k}} \right) \, dy \, dx \nonumber\\ =& -\sum_{i=1}^{o+1} \frac{o!} {(o+1-i)!} \, \frac{1}{(-c)^k} {\,\mathrm{TRI_A}\:\!}_{s+i}^{mn}(a,b,c+d) + \frac{o!}{(-c)^{o+1}} {\,\mathrm{TRI_A}\:\!}_{s+o+1}^{mn}(a,b,d) . \label{PRIB1} \end{align} For $|b|\ge|a|$, after integrating first in $y$ and simplifying we have \begin{align} {\,\mathrm{PRI_B}\:\!}&_s^{mno}(a,b,c,d) = -\lim_{t \rightarrow \infty}\frac{1}{t^s}\int_{0}^{1} \int_0^1 \int_{0}^x x^m y^n z^o {\,\mathrm{Li}}_s(-\exp( (a x +b y + c z +d )t ) \,dy\,dz\,dx \nonumber\\ =& -\sum_{i=1}^{n+1} \frac{n!} {(n+1-i)!} \, \frac{1}{(-b)^k} {\,\mathrm{HCI}\:\!}_{s+i,2}^{\langle m+n+1-i,o \rangle}(\langle a+b,c \rangle,d) + \frac{n!}{(-b)^{n+1}} {\,\mathrm{HCI}\:\!}_{s+n+1,2}^{\langle m,o \rangle}(\langle a,c\rangle, d) . \label{PRIB2} \end{align} Lastly, for all other cases, after integrating first in $x$ and simplifying we obtain \begin{align} {\,\mathrm{PRI_B}\:\!}&_s^{mno}(a,b,c,d) = -\lim_{t \rightarrow \infty}\frac{1}{t^s}\int_{0}^{1} \int_0^1 \int_{y}^1 x^m y^n z^o {\,\mathrm{Li}}_s(-\exp( (a x +b y + c z +d )t ) \,dx\,dy\,dz \nonumber\\ =& \sum_{i=1}^{m+1} \frac{m!} {(m+1-i)!} \, \frac{1}{(-a)^k} \left(-{\,\mathrm{HCI}\:\!}_{s+i,2}^{\langle n,o \rangle}(\langle b,c \rangle,a+d) + {\,\mathrm{HCI}\:\!}_{s+i,2}^{\langle m+n+1-i,o \rangle}(\langle a+b,c\rangle, d)\right). \label{PRIB3} \end{align} All limiting cases are left to be handled by the triangle and the hypercube integration formulas previously described. For $s\ge0$ and $a +b +c+d > \max(|a|,|b|,|c|)$, we also include the alternative formulas below. These are obtained by utilizing the property $\frac{ d {\,\mathrm{Li}}_s(-e^{\mu})}{d\mu} = {\,\mathrm{Li}}_{s-1}(-e^{\mu})$ and by recursive use of integration by parts, increasing the monomial power and reducing the polylogarithm order $s$ until it reaches $-1$. Namely, for $|c|\ge\max(|a|,|b|)$, we utilize the formula \begin{align} {\,\mathrm{PRI_C}\:\!}_s&^{m,n,o} (a,b,c,d) =\dfrac{o!}{(o+s+1)!} (-c)^{s+1} {\,\mathrm{PRI_A}\:\!}_{-1}^{m,n,o+s+1}(a,b,c,d) \nonumber \\ &+ \sum_{i=0}^{s} \dfrac{o!}{(o+i+1)!} (-c)^{i} {\,\mathrm{TRI_A}\:\!}_{s-i}^{m, n}(a,b,c+d), \end{align} and for $|b|\ge|a|$ we implement \begin{align} {\,\mathrm{PRI_C}\:\!}_s&^{m,n,o} (a,b,c,d) =\dfrac{n!}{(n+s+1)!} (-b)^{s+1} {\,\mathrm{PRI_A}\:\!}_{-1}^{m,n+s+1,o}(a,b,c,d) \nonumber \\ &+ \sum_{i=0}^{s} \dfrac{n!}{(n+i+1)!} (-b)^{i} {\,\mathrm{HCI}\:\!}_{s-i,2}^{\langle m+n+i+1,o \rangle}(\langle a+b,c\rangle, d). \end{align} For any other case we employ \begin{align} {\,\mathrm{PRI_C}\:\!}_s&^{m,n,o} (a,b,c,d) =\dfrac{m!}{(m+s+1)!} (-b)^{s+1} {\,\mathrm{PRI_A}\:\!}_{-1}^{m+s+1,n,o}(a,b,c,d) \nonumber \\ &+ \sum_{i=0}^{s} \dfrac{m!}{(m+i+1)!} (-a)^{i}\left( {\,\mathrm{HCI}\:\!}_{s-i,2}^{\langle n,o \rangle}(\langle b,c\rangle, a + d) - {\,\mathrm{HCI}\:\!}_{s-i,2}^{\langle m+n+i+1,o \rangle}(\langle a+b,c\rangle, d) \right). \end{align} The pseudo-code for integration over the prism is given in Algorithms \ref{algpri0} and \ref{algpri1}. Every time the triangle integration formula ${\,\mathrm{TRI_A}\:\!}$ and the hypercube integration formula ${\,\mathrm{HCI}\:\!}$ are used, the functions {\sc Triangle\_Integration\_A} in Algorithm \ref{algtri1} and {\sc HyperCube\_Integration} in Algorithm \ref{alg1} are called. \begin{algorithm} \caption{Pseudo-code for the integration of Eq.~\eqref{PriOrigin} on the prism $\{(x,y,z):x\in[0,1],y\in[0,1-x], z\in[-1,1]\}$ cut by the plane $a\,x + b\,y+ c\,z + d=0$ with $\bm n = \left<a,b,c \right>$, $\|\bm n\|>0$, $\bm m = \left<m,n,o \right>$ and $s=-1,0,1,\dots$. For $s=-1$ and $\|\bm n\|=1$ it corresponds to the interface integral. For $s=0$ it corresponds to the subdomain integral. } \label{algpri0} \begin{algorithmic}[1] \Function {Prism\_Integration}{$a$, $b$, $c$, $d$, $m$ $n$, $o$, $s$} \State{\Return $\text{\sc{Prism\_Integration\_A}} (-a,\,b,\,2c,\,d+a-c,\,m,\,n,\,o,\,s)$} \EndFunction \end{algorithmic} \end{algorithm} \begin{algorithm} \caption{Pseudo-code for the integration on the prism $\{(x,y,z):x\in[0,1],y\in[0,x], z\in[0,1]\}$ cut by the plane $a\,x + b\,y+ c\,z + d=0$ with $\bm n = \left<a,b,c \right>$, $\|\bm n\|>0$, $\bm m = \left<m,n,o \right>$ and $s=-1,0,1,\dots$. For $s=-1$ and $\|\bm n\|=1$ it corresponds to the interface integral. For $s=0$ it corresponds to the subdomain integral. } \label{algpri1} \begin{algorithmic}[1] \Function {Prism\_Integration\_A}{$a$, $b$, $c$, $d$, $m$ $n$, $o$, $s$} \State{$sum = a + b + c + d$} \If{$s = -1$} \If {$sum \le 0$} \State {\Return $\text{\sc{Prism\_Integration\_B}} (a,\,b,\,c,\,d,\,m,\,n,\,o,\,-1)$} \Else \State{\Return $\text{\sc{Prism\_Integration\_B}} (-a,\,-b,\,-c,\,-d,\,m,\,n,\,o,\,-1)$} \EndIf \Else \If{ $sum \le \max(|a|,|b|,|c|)$} \State{\Return $\text{\sc{Prism\_Integration\_B}} (a,\,b,\,c,\,d,\,m,\,n,\,o,\, s)$} \Else \State{\Return $\text{\sc{Prism\_Integration\_C}} (a,\,b,\,c,\,d,\,m,\,n,\,o,\, s)$} \EndIf \EndIf \EndFunction \end{algorithmic} \vspace{0.25cm} \begin{algorithmic}[1] \Function {Prism\_Integration\_B}{$a$, $b$, $c$, $d$, $m$ $n$, $o$, $s$} \vspace{1mm} \If{$|c|\ge\max(|a|,|b|)$} \Return ${\,\mathrm{PRI_B}\:\!}$ from Eq.~\eqref{PRIB1} \vspace{1mm} \ElsIf {$|b|>|a|$} \Return ${\,\mathrm{PRI_B}\:\!}$ from Eq.~\eqref{PRIB2} \vspace{1mm} \Else{} \Return ${\,\mathrm{PRI_B}\:\!}$ from Eq.~\eqref{PRIB3} \vspace{1mm} \EndIf \EndFunction \end{algorithmic} \vspace{0.25cm} \begin{algorithmic}[1] \Function {Prism\_Integration\_C}{$dim$, $\bm n$, $d$, $\bm m$, $s$} \If{$|c|\ge\max(|a|,|b|)$} \Return \State{ $ \sum_{i=0}^{s} \dfrac{o!}{(o+i+1)!} (-c)^{i} {\,\mathrm{TRI_A}\:\!}_{s-i}^{m, n}(a,b,c+d)$} \State{ $\qquad + \dfrac{o!}{(o+s+1)!} (-c)^{s+1} \text{\sc{Prism\_Integration\_A}}(a,\,b,\,c,\,d,\,m,\,n,\,o+s+1,\,-1)$} \ElsIf {$|b|\ge|a|$} \Return \State{ $\sum_{i=0}^{s} \dfrac{n!}{(n+i+1)!} (-b)^{i} {\,\mathrm{HCI}\:\!}_{s-i,2}^{\langle m+n+i+1,o \rangle}(\langle a+b,c\rangle, d) $} \State{$\qquad +\dfrac{n!}{(n+s+1)!} (-b)^{s+1} \text{\sc{Prism\_Integration\_A}}(a,\,b,\,c,\,d,\,m,\,n+s+1,\,o,\,-1)$} \Else{} \Return \State{ $\sum_{i=0}^{s} \dfrac{m!}{(m+i+1)!} (-a)^{i}\left( {\,\mathrm{HCI}\:\!}_{s-i,2}^{\langle n,o \rangle}(\langle b,c\rangle, a + d) - {\,\mathrm{HCI}\:\!}_{s-i,2}^{\langle m+n+i+1,o \rangle}(\langle a+b,c\rangle, d) \right)$} \State{$\qquad +\dfrac{m!}{(m+s+1)!} (-a)^{s+1} \text{\sc{Prism\_Integration\_A}}(a,\,b,\,c,\,d,\,m+s+1,\,n,\,o,\,-1)$} \EndIf \EndFunction \end{algorithmic} \end{algorithm} \section{Note on the equivalent polynomial} The equivalent polynomial problem can be stated as follows: find the equivalent polynomial coefficients $\bm c$, such that $M \bm c = \bm f_o$, where \begin{align*} \bm f_o &= -\lim_{t\rightarrow \infty} t^{-s} \begin{pmatrix} \int_{\Omega} \bm b_{o,0}(\bm x) {\,\mathrm{Li}}_s (-\exp((\bm n \cdot \bm x)t)) \,d \bm x \\ \\ \int_{\Omega} \bm b_{o,1}(\bm x) {\,\mathrm{Li}}_s (-\exp((\bm n \cdot \bm x)t)) \,d \bm x \\ \vdots \\ \int_{\Omega} \bm b_{o,L}(\bm x) {\,\mathrm{Li}}_s (-\exp((\bm n \cdot \bm x)t)) \,d \bm x \end{pmatrix} \end{align*} and \begin{align*} M = \begin{pmatrix} \int_{\Omega} \bm b_{o,0}(\bm x) \, \bm b_{o,0}(\bm x)\,d \bm x & \int_{\Omega} \bm b_{o,1}(\bm x) \, \bm b_{o,0}(\bm x) \,d \bm x & \cdots & \int_{\Omega} \bm b_{o,L}(\bm x)\, \bm b_{o,0}(\bm x)\,d \bm x \\ \\ \int_{\Omega} \bm b_{o,0}(\bm x) \, \bm b_{o,1}(\bm x)\,d \bm x & \int_{\Omega} \bm b_{o,1}(\bm x) \, \bm b_{o,1}(\bm x) \,d \bm x & \cdots & \int_{\Omega} \bm b_{o,L}(\bm x) \, \bm b_{o,1}(\bm x)\,d \bm x \\ \vdots & \vdots & \ddots & \vdots \\ \int_{\Omega} \bm b_{o,0}(\bm x) \, \bm b_{o,L}(\bm x)\,d \bm x & \int_{\Omega} \bm b_{o,1}(\bm x) \, \bm b_{o,L}(\bm x) \,d \bm x & \cdots & \int_{\Omega} \bm b_{o,L}(\bm x) \, \bm b_{o,L}(\bm x)\,d \bm x \end{pmatrix}, \end{align*} with $s=-1$ or $0$. Here ${\bm b}_o$ is the basis of the polynomial space. Then, the equivalent polynomial is given by $p(\bm x) = \bm c_{o}^T \cdot {\bm b}_o.$ In order to avoid an ill-conditioned Gram matrix $M$, we implement orthogonal polynomials, via Grahm-Schmidt orthogonalization, using the $L^2$ inner product\cite{saad1986condition,xu1993multivariate}. This yields the following relation for basis elements: $\bm b_n = A \bm b_o$, where the components in the new basis, $\bm b_n$, are a linear combination of the components in the old basis, $\bm b_o.$ The matrix $A$ is an $L$x$L$ lower triangular matrix, where $L$ is the dimension of the space spanned by the basis vector $\bm b_o$. The implementation of equivalent polynomial using an orthonormal basis yields $$I \bm{c}_n = \bm{f}_n = A \bm{f}_o,$$ resulting in $$ p(\bm x) = (\bm{c}_n)^T \bm{b}_n = \bm{f}_o^T A^T A \bm{b}_o(\bm x). $$ Note that the term $A^T A \bm{b}_o(\bm x)$ is independent of the hyperplane cut and can be evaluated off-line. Instead $\bm f_o$ changes and has to be recalculated for every new cut. \section{Conclusion} The many closed form algebraic expressions provided in the current work can easily be implemented into numerous PDE solvers when discontinuous functions are implemented. Although the discontinuities we considered were points, lines, and planes, one could utilize a local refinement algorithm to reduce the error generated by approximating the discontinuity. We have eliminated the need to consider complicated subdomains while simultaneously eliminating any error produced by a regularization parameter and polylogarithm approximation. We provide exact formulas for cumbersome subdomain and interface integrals, along with the associated algorithms. These closed forms were designed with floating point arithmetic in mind. The results of this work provide one with the tools to eliminate many of the problems posed by discontinuous function integration. \section*{Acknowledgments} This work was supported by the National Science Foundation (NSF) Division of Mathematical Sciences (DMS) program, project 1912902. \begin{comment} \section*{Author Biography} \begin{minipage}{0.3\textwidth}{\includegraphics[width=66pt,height=86pt]{eugenio.pdf}}\end{minipage} \hspace{-2.4cm}\begin{minipage}{0.8\textwidth} {\textbf{ Eugenio Aulisa} is Professor of Computational Mathematics in the Department of Mathematics and Statistics at Texas Tech University, Lubbock, USA. His primary research interests are in computational fluid mechanics, modeling and simulation of multiphase flows, fluid-structure interaction problems, non-linear analysis of fluid flow filtration in porous media, multigrid solvers with domain decomposition methods and geometric control. He holds a Ph.D in Energetic, Nuclear, and Environmental Control Engineering from the University of Bologna, Italy.} \end{minipage} \vspace{1cm} \begin{minipage}{0.3\textwidth}{\includegraphics[width=66pt,height=86pt]{Loftin_HS.jpg}}\end{minipage} \hspace{-2.4cm}\begin{minipage}{0.8\textwidth} {\textbf{Jonathon Loftin} is a PhD candidate in the department of Mathematics and Statistics at Texas Tech University, Lubbock, USA. Jonathon works under his advisor, Dr. Eugenio Aulisa. His research interests are in applied mathematics, in particular numerical solutions to partial differential equations and scientific computing. Jonathon received his MS in mathematics from the University of Arkansas. } \end{minipage} \end{comment} \bibliographystyle{plain}
\section{Introduction}\label{sec:intro} Although non-native (L2) English speakers outnumber native (L1) English speakers \cite{crystal2003english}, major challenges contribute to a gap between performance of ASR systems on L2 speech, mainly due to the influence of L1 pronunciation on the learned language, and the lack of annotated L2 speech data~\cite{radzikowski2021accent, viglino2019end}. To meet these challenges, previous studies have exhibited two distinct approaches. The first is to make L2 speech representations more closely match those of L1 speech~\cite{radzikowski2021accent}. The second approach leverages L2 speech data to improve model robustness. Due to L2 data scarcity, and hence the challenge of training L2 models from scratch, this second approach necessitates employment of transfer learning or domain adaptation~\cite{shi2021accented,sun2018domain}. \begin{figure}[h] \centering{\includegraphics[width=\linewidth]{splits_mono.png}} \caption{\label{fig:splits} The various data splits we use in our experiments. Shade represents a different run of our training, with the gradient blocks in Split 4 being present in all runs. For cross validation splits, we show a single fold as an example, where number indicates the participants included. } \end{figure} State-of-the-art ASR models based on unsupervised/self-supervised pre-training such as wav2vec ~\cite{schneider2019wav2vec} and wav2vec 2.0~\cite{baevski2020wav2vec}\footnote{Although sometimes referred to as `unsupervised', these models employ a self-supervised objective.} offer a tantalizing starting point for applying the second approach we list above, especially due to their strong performance on ASR even without a language model. However, challenges remain in identifying how best to apply models such as wav2vec 2.0 in L2 fine-tuning scenarios. For this reason, our objective in the current work is to investigate a rich set of conditions under which we can fine-tune ASR models for optimal L2 performance. More concretely, we attempt to achieve the following: \begin{enumerate} \item Evaluate fine-tuning strategies for adapting pre-trained L1 English ASR models to L2 English; \item Explore impact of non-native (L2) accents on performance of these fine-tuned ASR models, comparing multi-accent training to single-accent training; and \item Quantify the impact of L2 fine-tuning on model performance for L1 English speech recognition. \end{enumerate} Although external language models are often used in improving ASR performance~\cite{nakatani2019improving, xu2020independent}, models trained with great quantities of data can potentially internalize this linguistic information ~\cite{graves2014towards}. In particular, some of the wav2vec 2.0 models perform nearly as well with and without a language model on difficult speech such as LibriSpeech Test-Other ~\cite{xu2021self}. We thus use this robust pre-trained model as our starting point, and carry out our work without use of an external language model to see if this performance is retained through the fine-tuning process. The rest of the paper is organized as follows: Section~\ref{sec:lit} is an overview of related works. We describe our data in Section~\ref{sec:data}. Section~\ref{sec:exp} is about our experiments and results. We conclude in Section~\ref{sec:con}. \section{Related Work}\label{sec:lit} Because of the difficulty in linguistically annotating corpora for Hidden Markov Model (HMM)-based ASR ~\cite{graves2014towards}, researchers have broadly embraced End-to-End (E2E) deep learning architectures either based on Connectionist Temporal Classification (CTC) ~\cite{graves2006connectionist,graves2014towards}, Attention ~\cite{chorowski2015attention,chan2016listen, gulati2020conformer}, or hybrids of the two ~\cite{watanabe2017hybrid,wang2020transformer}. Recent efforts inspired by work such as BERT ~\cite{devlin-etal-2019-bert} have improved on these purely supervised learning baselines through self-supervised pre-training ~\cite{schneider2019wav2vec,baevski2019vq, baevski2020wav2vec} and self-training ~\cite{xu2021self}. These self-supervised wav2vec models represent one line of research in speech representation. Other works include models similar to wav2vec that also use a contrastive loss~\cite{oord2018representation}, models using an autoregressive loss function~\cite{ling2020deep,chung2019unsupervised}, as well as models using a masked language model closer to the original BERT ~\cite{liu2020mockingjay}. With these efforts, ASR technologies for native languages have evolved significantly. However, we still observe problems in many applications. In particular, several researchers have emphasized how performance of ASR models drops when the input speech is from non-native speakers whose native languages are different from the models' target languages~\cite{radzikowski2021accent,livescu2000lexical,wang2003comparison,ping2008automatic}. For systems developed for English ASR, this can be a real issue. The reason, as observed earlier, is that large populations of English language speakers are non-native~\cite{crystal2003english}. In line with this argument,~\newcite{ping2008automatic}, for example, pointed out the necessity to improve speech recognition technology for L2 speakers given that many people speak more than one language for economic and social reasons, especially considering human migration is becoming more common these days. It is hoped that continued efforts aiming at improving ASR for non-native speakers will eventually lead to improved results for many as voice recognition technology becomes increasingly pervasive in our daily lives~\cite{ping2008automatic}. As we explained in Section~\ref{sec:intro}, there are two distinct approaches to improve current ASR performance on L2 speech: 1) accent conversion as an extension to the active area of research of voice conversion; and 2) incorporation of L2 speech data, which is often limited in quantity and quality, during the model training process. The first approach takes inspiration from voice conversion, but instead of focusing on modifying the pitch, it modifies the pronunciation to reduce accents. Additionally, voice conversion models aim to generate results that are speaker-dependent, while accent conversion models deal with generalizing accents from a group of speakers, hence being speaker-independent. With this approach, the resulting model can be used as a pre-processing step to remove accents in the data prior to feeding these data into an ASR model.~\newcite{bearman2017accent} adopt this approach but focus on L1 English accents, while ~\newcite{radzikowski2021accent} work on L2 English accents with speakers' L1 being Japanese. ~\newcite{liu2020end} took a step further and turned Hindi-accented English to native American English without utilizing native utterances. The second approach often employs techniques such as domain adversarial training and transfer learning in order to utilize as much available accented speech data as possible. Domain adversarial training (DAT) is a popular approach as it encourages models to learn accent-invariant features~\cite{sun2018domain, hou2019domain, hu2021redat}. Transfer learning is another popular approach in L2 speech recognition, as it possibly allows a model to gain knowledge from both the base task and the new task, even when the new task has limited data~\cite{matassoni2018non, das2021best, shi2021accented}. In the Accented English Speech Recognition Challenge 2020 (AESRC2020), many teams utilize transfer learning to tackle the L2 accent recognition task~\cite{shi2021accented}. In a recent work, ~\newcite{das2021best} combine both DAT and transfer learning to achieve robust accented speech recognition performance. We now introduce our data. \section{Data}\label{sec:data} \subsection{Corpus Information} We choose \textbf{L2-ARCTIC}, a non-native English speech corpus~\cite{zhao2018l2}, for L2 fine-tuning. The recordings are from 24 non-native speakers of English with a total of six different L1s, and each of the L1s consists of two female speakers and two male speakers. The L1s we use for our experiments are Arabic (AR), Hindi (HI), Korean (KO), Mandarin (ZH), Spanish (ES), and Vietnamese (VI). Because L2-ARCTIC is based on the original L1 English corpus, CMU ARCTIC~\cite{kominek2003cmu} (henceforth \textbf{L1-ARCTIC}, for simplicity), we can easily evaluate performance from fine-tuning on same-domain L1 data. Each speaker in L2-ARCTIC contributed approximately one hour of phonetically-balanced read speech based on the L1-ARCTIC prompts, which consist of carefully selected sentences ($1,132$ sentence prompts) from Project Gutenberg \cite{kominek2003cmu}. We note this, as the pretrained wav2vec 2.0 model we use was first pre-trained on LibriSpeech\footnote{http://www.openslr.org/12/}~\cite{panayotov2015librispeech} and then self-trained on Libri-Light\footnote{https://github.com/facebookresearch/libri-light}~\cite{kahn2020libri}. Both corpora rely on audiobooks from the LibriVox project,\footnote{https://librivox.org} much of which comes from Project Gutenberg.\footnote{http://www.gutenberg.org} This minimizes discrepancies between domains of the text. We also evaluate our fine-tuned models on \textbf{1) LibriSpeech} to compare the fine-tuning with the original performance of self-trained wav2vec 2.0 Large (LV-60) model~\cite{xu2021self}, which we will refer to as \textit{Wav2Vec 2.0-ST}. In addition, we evaluate on \textbf{2) L1-ARCTIC}, identical to our L2-ARCTIC corpus but spoken by four native US English speakers, allowing us to identify any degradation in performance on L1 speech. Each of L1-ARCTIC speakers' datasets contain approximately the same number of utterances ($n=\sim1,132*4$) as each of L2-ARCTIC speakers' datasets.\par For the purpose of our experiments, we define \textit{native (L1) accents} as those represented in the LibriSpeech and L1-ARCTIC, and \textit{non-native (L2) accents} as those represented in L2-ARCTIC. \begin{table*}[] \centering \begin{tabular}{llcclcc} \hline & & \multicolumn{2}{c}{\textbf{Accent dependency}} & & \multicolumn{2}{c}{\textbf{Speaker dependency}} \\ \cline{3-4} \cline{6-7} & & \multicolumn{1}{l}{\textbf{Dependent}} & \multicolumn{1}{l}{\textbf{Independent}} & & \multicolumn{1}{l}{\textbf{Dependent}} & \multicolumn{1}{l}{\textbf{Independent}} \\ \hline \textbf{Multi-accent} & Model-1 (Split 1) & x & & & x & \\ & Model-2 (Split 2) & x & & & & x \\ & Model-3 (Split 3) & & x & & & x \\ \hline \textbf{Single-accent} & Model-4 (Split 4) & x & x & & x & x \\ & Model-5 (Split 5) & x & & & & x \\ \hline \end{tabular} \caption{Summary of data splits, fine-tuning, and evaluation setups.} \label{table:model_summary} \end{table*} \subsection{Data Splits} For both L2-ARCTIC and L1-ARCTIC, we split the data into three distinct Train, Dev, and Test sets with an $80$:$10$:$10$ ratio. Importantly, we ensure there is \textit{no overlap between utterances}. For L2-ARCTIC, we split the data across the following settings (see Fig. \ref{fig:splits}). \begin{itemize} \item \textbf{Split-1} \textit{(speaker-dependent, multi-accent split)}: All speakers from all accents in the Train set are also included in the Dev and Test sets; however, no utterances are shared between Train, Dev, and Test. \item \textbf{Split-2} \textit{(speaker-independent cross-validation splits with multiple accents)}: A speaker from each accent\footnote{We use the term `accent' here to loosely refer to variation in speakers with L1 other than English.} is removed from the Train and Dev sets, but other speakers with the same accent remain in the Train and Dev sets. \item \textbf{Split-3} \textit{(speaker-independent zero-shot splits with multiple accents)}: All speakers from one of the accents are entirely removed from the Train and Dev sets. The removed speakers are included in Test. \item \textbf{Split-4} \textit{(all-speaker, single-accent split)}: Speakers are broken down by accents (six accents in total) and all speakers in a given accent are split into the Train, Dev, and Test sets (3 data splits x 6 accents). \item \textbf{Split-5} \textit{(speaker-independent cross-validation splits with single accent)}: One speaker in each accent is removed from the Train and Dev sets, but the other speakers with the same accent remain in the Train and Dev sets. As there are four speakers per accent, four splits are created for each accent, which are further split into the Train, Dev, and Test sets (3 data splits x 6 accents x 4 speakers). \end{itemize} \section{Experiments}\label{sec:exp} For all our wav2vec 2.0 models, we use Fairseq~\footnote{\url{https://github.com/pytorch/fairseq}} fine-tuning default settings as a reference and convert the hyper-parameters to align with Huggingface's implementation. We train each model with three random seeds and take average over three WERs, one each from the three seeds. \subsection{Model Architecture, Fine-tuning, Baselines, and Evaluation} For our model development, we use the wav2vec 2.0 architecture~\cite{baevski2020wav2vec} which is composed of a multi-layer convolutional neural network feature extractor and a Transformer context network. It takes in raw audio and converts it into representations of the input sequence. The encoder consists of multiple blocks of temporal convolution followed by a layer normalization and a GELU activation function. The relative positional embedding in the Transformer is accomplished by a convolutional layer.\par Fine-tuning of pre-trained wav2vec 2.0 is performed with CTC and the transcriptions of the audio segments. For each model, we identify the optimal hyper-parameters on the respective Dev set. We choose hyper-parameters as follows: For \texttt{mask\_feature\_prob}, we pick from \textit{\{0.25, 0.5\}}, for \texttt{mask\_feature\_length}, we choose from \textit{\{15, 30\}}, for \texttt{mask\_time\_prob} we use \textit{\{0.5, 0.75\}}, and a batch size of $16$. To mimic the tri-state learning rate schedule~\cite{baevski2020wav2vec}, we set different learning rates for different stages: warm-up (1e-5, 3e-5), constant stage (1e-5, 3e-5), and decay (1e-5, 3e-5, 5e-6). The decay stage is followed by another constant stage (1e-5, 2e-6, 5e-6) to simulate the Fairseq's fine-tuning configuration. We evaluate all our models in terms of word error rate (WER). \textit{All} our results are the average of three runs, and we use the following baselines: \begin{itemize} \item \textbf{Baseline-I:} Wav2Vec 2.0-ST \cite{xu2021self},\footnote{\url{https://github.com/pytorch/fairseq/tree/master/examples/wav2vec##wav2vec 2.0}} a self-trained version of wav2vec 2.0 \cite{baevski2020wav2vec} exploiting a Transformer large architecture and pre-training on 960 hours of speech data from LibriSpeech~\cite{panayotov2015librispeech}. The self-training is performed on 60K hours of Libri-Light~\cite{kahn2020libri}. We believe this as an already strong baseline. We use the model released via HuggingFace.~\footnote{\url{https://huggingface.co/facebook/wav2vec2-large-960h-lv60-self}} \item \textbf{Baseline-II:} This is Wav2Vec 2.0-ST, the same as Baseline-I, fine-tuned on L1-ARCTIC described earlier. The purpose of Baseline-II is to allow for measuring the trade-off of L1 English ASR performance by fine-tuning the English pre-trained model on L2 accents. \end{itemize} \begin{table*}[ht] \centering \begin{tabular}{llrrlrrlrrlrr} \hline & & \multicolumn{2}{c}{\textbf{L2-ARCTIC}} & & \multicolumn{2}{c}{\textbf{L1-ARCTIC}} & & \multicolumn{2}{c}{\textbf{LS\textsubscript{dev}}} & & \multicolumn{2}{c}{\textbf{LS\textsubscript{test}}} \\ \cline{3-4} \cline{6-7} \cline{9-10} \cline{12-13} \textbf{Model} & & \multicolumn{1}{r}{\textbf{Dev}} & \multicolumn{1}{r}{\textbf{Test}} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{\textbf{Dev}} & \multicolumn{1}{r}{\textbf{Test}} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{\textbf{Clean}} & \multicolumn{1}{r}{\textbf{Other}} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{\textbf{Clean}} & \multicolumn{1}{r}{\textbf{Other}} \\ \hline Baseline-I & & 13.47 & 12.47 & & 2.30 & 2.23 & & \textbf{1.69} & \textbf{3.55} & & \textbf{1.86} & \textbf{3.89} \\ Baseline-II & & 17.29 & 15.95 & & \textbf{1.26} & \textbf{1.30} & & 2.19 & 5.13 & & 2.32 & 5.00 \\ Model-1 & & \textbf{9.78} & \textbf{9.27} & & 1.94 & 1.86 & & 2.75 & 5.55 & & 2.82 & 6.36 \\ \hline \end{tabular} \caption{\label{model-1} Model-1 performance in word error rate (WER) (lower is better) on non-native accents (L2-ARCTIC) and native accents (L1-ARCTIC, LS\textsubscript{dev} and LS\textsubscript{test}). Baseline-I and Baseline-II are reported on the same Dev and Test sets of each corpus for comparison. } \end{table*} \begin{figure}[h] \centering{\includegraphics[scale=.7]{fig_trade-off_abs_color.png}} \caption{\label{fig:trade-off} Trade-offs of fine-tuning on native accents (Baseline-II) vs. non-native accents (Model-1). As we evaluate model accuracy by error rate, the bars extending into the negative values mean that the model gains accuracy by fine-tuning. } \end{figure} \begin{table}[h] \begin{tabular}{llrrlrr} \hline & & \multicolumn{2}{c}{\textbf{Dev\textsubscript{L2}}} & & \multicolumn{2}{c}{\textbf{Test\textsubscript{L2}}} \\ \cline{3-4} \cline{6-7} \textbf{Model} & & \multicolumn{1}{r}{\textbf{Mean}} & \multicolumn{1}{r}{\textbf{SD}} & & \multicolumn{1}{r}{\textbf{Mean}} & \multicolumn{1}{r}{\textbf{SD}} \\ \hline Baseline-I & & 13.47 & 0.23 & & 12.47 & 0.84 \\ Baseline-II & & 17.29 & 0.41 & & 15.96 & 1.58 \\ Model-2 & & \textbf{9.57} & 0.19 & & \textbf{9.96} & 0.64 \\ \hline \end{tabular} \caption{\label{model-2} Model-2 cross validated performance on L2-ARCTIC Dev and Test sets, alongside Baseline-I and Baseline-II performance on the same cross validation splits. Mean refers to the average WER over the four runs and SD refers to the standard deviation. } \end{table} \begin{comment} \begin{table}[h] \begin{tabular}{lrrr} \hline \textbf{L1\textsubscript{removed}} & \multicolumn{1}{r}{\textbf{Dev\textsubscript{L2}}} & \multicolumn{1}{r}{\textbf{Test\textsubscript{all}}} & \multicolumn{1}{r}{\textbf{Test\textsubscript{zeroshot}}} \\ \hline VI & \textbf{7.96} & 9.43 & 18.81 \\ ZH & 9.02 & 9.08 & 12.13 \\ AR & 9.40 & 9.13 & 10.10 \\ ES & 9.38 & \textbf{8.98} & 8.89 \\ KO & 10.10 & 9.01 & 6.95 \\ HI & 10.29 & 9.11 & \textbf{6.67} \\ \hline \end{tabular} \caption{\label{model-3} Model-3 setting, where a different accent is removed each run. Dev\textsubscript{L2} refers to \textit{all} speakers except the ones with L1\textsubscript{removed} accent, Test\textsubscript{all} refers to Test of \textit{all} 24 speakers, and Test\textsubscript{zeroshot} refers to Test of those four speakers who have L1\textsubscript{removed} accent. } \end{table} \end{comment} \begin{table*}[h] \centering \begin{tabular}{cccccc|Hcc} \hline & & \textbf{Baseline-I} & & \textbf{Baseline-II} & & \multicolumn{3}{c}{\textbf{Model-3}} \\ \cline{3-3} \cline{5-5} \cline{7-9} \textbf{L1\textsubscript{removed}} & & \textbf{Test\textsubscript{zeroshot}} & & \textbf{Test\textsubscript{zeroshot}} & & \textbf{Dev\textsubscript{L2}} & \textbf{Test\textsubscript{zeroshot}} & \textbf{Test\textsubscript{all}} \\ \hline VI & & 23.30 & & 28.81 & & \textbf{7.96} & 18.81 & 9.43\\ ZH & & 14.85 & & 19.32 & & 9.02 & 12.13 & 9.08\\ AR & & 10.95 & & 14.82 & & 9.40 & 10.10 & 9.13\\ ES & & 10.48 & & 13.48 & & 9.38 & 8.89 & \textbf{8.98}\\ KO & & 8.18 & & 10.22 & & 10.10 & 6.95 & 9.01\\ HI & & \textbf{6.93} & & \textbf{8.93} & & 10.29 & \textbf{6.67} & 9.11\\ \hline \end{tabular} \caption{\label{model-3} Model-3 setting, where a different accent is removed each run. Test\textsubscript{all} refers to Test of \textit{all} 24 speakers, and Test\textsubscript{zeroshot} refers to Test of those four speakers who have L1\textsubscript{removed} accent. Baseline-I acquires $12.47$ on Test\textsubscript{all}, while Baseline-II acquires $15.95$ on the same test set (i.e., Test\textsubscript{all}). } \end{table*} \begin{table*}[ht] \centering \begin{tabular}{llrlrlrlr|rrr} \hline & & \textbf{Baseline-I} & & \textbf{Baseline-II} & & \textbf{Model-1} & & \multicolumn{4}{c}{\textbf{Model-4}} \\ \cline{3-3} \cline{5-5} \cline{7-7} \cline{9-12} \textbf{L1} & & \textbf{Test\textsubscript{L2}} & & \textbf{Test\textsubscript{L2}} & & \textbf{Test\textsubscript{L2}} & & \textbf{Test\textsubscript{L2}} & \textbf{Test\textsubscript{L1}} & \textbf{LS\textsubscript{Clean}} & \textbf{LS\textsubscript{Other}} \\ \hline VI & & 23.30 & & 28.81 & & 15.14 & & \textbf{12.12} & 2.02 & 3.08 & 6.96 \\ ZH & & 14.85 & & 19.32 & & 11.49 & & \textbf{8.95} & 1.82 & 2.84 & 6.22 \\ AR & & 10.95 & & 14.82 & & 8.90 & & \textbf{6.92} & 1.55 & 2.66 & 6.24 \\ ES & & 10.48 & & 13.48 & & 8.92 & & \textbf{6.68} & 1.56 & 2.53 & 6.11 \\ KO & & 8.18 & & 10.22 & & 6.60 & & \textbf{4.99} & 1.71 & 2.51 & 5.63 \\ HI & & 6.93 & & 8.93 & & 5.51 & & \textbf{4.99} & 1.52 & 2.36 & 6.05 \\ \hline \textbf{Mean} & & 12.45 & & 15.93 & & 9.43 & & 7.44 & 1.70 & 2.66 & 6.20 \\ \hline \textbf{SD} & & 5.97 & & 7.30 & & 3.49 & & 2.72 & 0.20 & 0.26 & 0.43 \\ \hline \end{tabular} \caption{Model-4 performance on L2 accent (Test\textsubscript{L2}) and native accent (Test\textsubscript{L1}, LS\textsubscript{Clean}, LS\textsubscript{Other}), compared with Baseline-I, Baseline-II, and Model-1. SD refers to the standard deviation.} \label{model-4} \end{table*} \begin{table*}[h] \centering \begin{tabular}{lrrrrrr} \hline & \multicolumn{1}{c}{\textbf{VI}} & \multicolumn{1}{c}{\textbf{ZH}} & \multicolumn{1}{c}{\textbf{AR}} & \multicolumn{1}{c}{\textbf{ES}} & \multicolumn{1}{c}{\textbf{KO}} & \multicolumn{1}{c}{\textbf{HI}} \\ \hline \textbf{Baseline-I} & 23.30 & 14.85 & 10.95 & 10.48 & 8.18 & 6.93 \\ \hline \textbf{VI-specific} & 12.12 & 13.62 & 13.01 & 9.95 & 8.55 & 9.62 \\ \texttt{$\Delta$WER } & -11.18 & -1.23 & 2.06 & -0.53 & 0.37 & 2.69 \\ \texttt{$\Delta \%$ } & -48.00 & \textbf{-8.31} & 18.84 & -5.03 & 4.52 & 38.77 \\ \hline \textbf{ZH-specific} & 20.37 & 8.95 & 11.42 & 9.79 & 6.82 & 10.91 \\ \texttt{$\Delta$WER} & -2.93 & -5.90 & 0.47 & -0.69 & -1.36 & 3.98 \\ \texttt{$\Delta \%$} & -12.58 & -39.75 & 4.26 & -6.62 & \textbf{-16.67} & 57.43 \\ \hline \textbf{AR-specific} & 23.88 & 14.86 & 6.92 & 9.86 & 9.16 & 7.74 \\ \texttt{$\Delta$WER} & 0.58 & 0.01 & -4.03 & -0.62 & 0.98 & 0.81 \\ \texttt{$\Delta \%$} & 2.47 & 0.07 & -36.83 & \textbf{-5.92} & 11.94 & 11.69 \\ \hline \textbf{ES-specific} & 20.71 & 13.99 & 11.00 & 6.68 & 7.92 & 8.66 \\ \texttt{$\Delta$WER} & -2.59 & -0.86 & 0.05 & -3.80 & -0.26 & 1.73 \\ \texttt{$\Delta \%$} & \textbf{-11.13} & -5.81 & 0.43 & -36.23 & -3.22 & 25.01 \\ \hline \textbf{KO-specific} & 20.07 & 12.12 & 11.66 & 10.04 & 4.99 & 9.09 \\ \texttt{$\Delta$WER} & -3.23 & -2.73 & 0.71 & -0.44 & -3.19 & 2.16 \\ \texttt{$\Delta \%$} & -13.88 & \textbf{-18.38} & 6.45 & -4.23 & -39.04 & 31.17 \\ \hline \textbf{HI-specific} & 26.18 & 18.39 & 13.51 & 11.90 & 10.72 & 4.99 \\ \texttt{$\Delta$WER} & 2.88 & 3.54 & 2.56 & 1.42 & 2.54 & -1.94 \\ \texttt{$\Delta \%$} & \textbf{12.37} & 23.82 & 23.35 & 13.55 & 31.01 & -27.99 \\ \hline \end{tabular} \caption{Model-4 performance in the zero-shot setting. Bold fonts represent the accent whose WER drops the most in the zero-shot setting. For example, compared with Baseline-I, the VI-specific fine-tuning not only improves performance on VI (i.e., a drop in WER), but also improves on ZH despite ZH being the unseen accent. One notable pattern is that HI-specific fine-tuning only benefits HI-accented speech recognition while all the other fine-tuning hinder performance on the HI accent.} \label{model-4 zeroshot} \end{table*} \begin{figure}[h] \centering{\includegraphics[scale=.7]{fig_model4_zeroshot_abs1_color.png}} \caption{\label{fig:model4-zeroshot1} HI-specific Model-4 evaluated on individual accents. As we evaluate model accuracy by error rate, the bars extending downwards represent the performance gain by fine-tuning. HI-specific fine-tuning benefits HI but hinders performance on all the other accents. } \end{figure} \begin{figure}[h] \centering{\includegraphics[scale=.7]{fig_model4_zeroshot_abs2_color.png}} \caption{\label{fig:model4-zeroshot2} Individual Model-4s evaluated on the HI accent. All the bars except HI extend upwards, meaning that all the other single-accent models hinder performance on the HI accent. } \end{figure} \subsection{Multi-Accent Models} With our multi-accent models, we examine performance using multiple accents during training. We introduce each of our models here, and present the results acquired with each. We provide a summary of our different data splits and models across accent and speaker dependency categories in Table~\ref{table:model_summary}. \textbf{Model-1 (speaker- and accent-dependent):} The model is fine-tuned with Split-1 data to identify any speaker-dependent training impact, as well as an upper limit on performance. In addition to evaluating on L2-ARCTIC Test, we evaluate on L1-ARCTIC Test and LibriSpeech in order to observe any changes in model performance on L1 English. As Table~\ref{model-1} shows, our Model-1 achieves best performance on both Dev and Test of \textbf{L2-ARCTIC} as compared to our two baselines. On Test, our Model-1 acquires $25.66\%$ improvement over our Baseline-I wav2vec 2.0 system on L2-ARCTIC ($9.27$ WER for our model vs. $12.47$ WER for Baseline-I). This gain is not surprising and simply means that a model with access to L2 data for fine-tuning will improve over models fine-tuned with L1 data (Baseline-II, which is fine-tuned on L1-ARCTIC) or not-fine-tuned at all (Baseline-I). Nor is performance on \textbf{L1-ARCTIC} surprising: a model fine-tuned with native data (Baseline-II) outperforms one fine-tuned with accented data (our Model-1), both of which outperform a model without fine-tuning (Baseline-I). These results, however, show that in absence of L1 data, L2 data can be valuable for improving ASR model performance even on L1. For \textbf{LibriSpeech}, Baseline-I, which is trained on LibriSpeech data, outperforms the two fine-tuned models (our Model-1 and Baseline-II). The reason is that these two latter models are fine-tuned on a domain that is different from LibriSpeech. That is, fine-tuning models on out-of-domain data will, and as we see here does, result in deterioration of performance on in-domain data. We also note that our Model-1's performance on LibriSpeech is worse than that of Baseline-II on both the `Clean' (LS\textsubscript{Clean}, native speech under quite recording environments), and `Other' (LS\textsubscript{Other}, both noisy environment and accented recordings), Dev and Test splits. This may be because LibriSpeech is mostly comprised of L1 data and the greater variability on our L2-ARCTIC Train set (24 non-native speakers in our Model-1 vs. 4 native speakers in Baseline-II). \textbf{Model-2 (speaker-independent, accent-dependent):} While Model-1 mimics a situation where we have some training data from speakers that we serve (i.e., test on), this is rarely a realistic scenario. We instead switch to a speaker-independent (but still \textit{accent-dependent}) setting, Split-2. We carry out four-fold cross-validation with the 24 speakers in the data, every time using 18 speakers (three speakers per accent) in Train\footnote{We use 10\% of the utterances from these 18 speakers for development (Dev).} and six speakers in Test (one per accent). We report the average of the four folds/runs, along with standard deviation. As Table~\ref{model-2} shows, Model-2 performance is consistent with Model-1. Our Model-2 outperforms the two baselines on both Dev and Test, reaching $9.96$ WER on Test compared to $12.47$ for Baseline-I and $15.96$ for Baseline-II. These results demonstrate that fine-tuning with multiple accents improves the accented ASR system without access to test speaker data. \textbf{Model-3 (speaker- and accent-independent):} To evaluate performance on \textit{unseen} accents, we adopt a zero-shot strategy by removing one accent at a time from both Train and Dev sets and evaluating on the Test set of the removed accent, Split-3. To evaluate model performance on each accent, we conduct six runs in total with one accent removed at a time. As Table~\ref{model-3} shows, fine-tuning on accented speech benefits unseen accents and speakers (Model-3 setting). All the multi-accent, zero-shot models outperform Baseline-I and Baseline-II, which means each of the six accents benefit from other accents through this process of transfer learning. Our results also show that, in absence of in-accent data, some unseen accents are easier for the model than others. For example, on Test\textsubscript{zeroshot}, Vietnamese (VI) is the most challenging (with $18.81$ WER) and Hindi (HI) is the least challenging (with only $6.67$ WER). \begin{table}[h] \centering \begin{tabular}{llrrlrr} \hline & & \multicolumn{2}{c}{\textbf{Test\textsubscript{all}}} & & \multicolumn{2}{c}{\textbf{Test\textsubscript{zeroshot-speaker}}} \\ \cline{3-4} \cline{6-7} \textbf{L1} & & \multicolumn{1}{r}{\textbf{Mean}} & \multicolumn{1}{r}{\textbf{SD}} & & \multicolumn{1}{r}{\textbf{Mean}} & \multicolumn{1}{r}{\textbf{SD}} \\ \hline VI & & 12.67 & 0.38 & & 14.28 & 4.87 \\ ZH & & 9.65 & 0.31 & & 11.26 & 3.03 \\ AR & & 7.28 & 0.29 & & 8.56 & 2.28 \\ ES & & 6.95 & 0.26 & & 7.76 & 3.99 \\ KO & & 5.22 & 0.18 & & 5.69 & 2.20 \\ HI & & 5.27 & 0.11 & & 5.79 & 1.12 \\ \hline \end{tabular} \caption{Model-5 performance on L2 accent. Test\textsubscript{all} contains utterances by all speakers within each L1 whereas Test\textsubscript{zeroshot-speaker} contains utterances by a single speaker that is absent in the training phase. Mean refers to the average WER over four folds for each L1, and SD refers to the standard deviation.} \label{model-5} \end{table} \begin{table*}[h] \centering \small \begin{tabular}{c|l} \hline \multicolumn{1}{l|}{\textbf{Model}} & \multicolumn{1}{c}{\textbf{Model output}} \\ \hline Ref & at lake linderman i had one canoe very good peterborough canoe \\ \hline \multirow{2}{*}{VI} & at LAY LINDEMAN i had one canoe very good PETERBORROUG CANOES \\ & A lake LNDER MAN i had one canoe very good BIET OF ROCK canoe \\ \hline \multirow{2}{*}{ZH} & at lake LINGERMAN i had ONCE canoe very good PETERBROUGH canoe\\ & at lake LINERMAN i had one canoe very good PETERE BROUGHTA canoe \\ \hline \multirow{2}{*}{AR} & at lake LUNDERBOGH i had one canoe very good BITTERBOROUGH canoe \\ & at lake LUNDERMAN i had one canoe very good BETTER BORT canoe \\ \hline \multirow{2}{*}{ES} & at lake linderman i had one canoe a very good PETERBOURN canoe \\ & at lake linderman i had ONCE canoe very good PIERREBOROUGH canoe \\ \hline \multirow{2}{*}{KO} & at lake linderman i had one canoe very good peterborough canoe\\ & at lake LINDEMAN i had ONCE canoe very good PITTEBRAUG canoe \\ \hline \multirow{2}{*}{HI} & at lake LINDEMAN i had one canoe very good PETERBURGH canoe \\ & at lake linderman i had one canoe A very good PEACHERBROROU canoe \\ \hline \end{tabular} \caption{\label{tab:transcripts} Examples of transcription output of selected utterances from the Test set of Model-4 among all six L1s without a language model. Capitalized words indicate errors. We show samples from two speakers per accent } \end{table*} \subsection{Accent-Specific Models} We evaluate the accent-dependent performance by fine-tuning our models on a single type of L1-specific accent at a time. \textbf{Model-4 (speaker-dependent, accent-dependent):} The model is fine-tuned with Split-4 data to identify any accent-dependent training impact on downstream performance, as well as an upper bound on performance when the model is optimized for a single accent. In addition to evaluating on L2-ARCTIC Test, we test the model on L1-ARCTIC Test and LibriSpeech as a means to identify any degradation on L1 English data. As Table~\ref{model-4} shows, while the multi-accent model (Model-1) outperforms Baseline-I for all six accents, all of the accent-specific models (Model-4 setting) outperform Model-1 on the Test\textsubscript{L2} setting despite the small amount of data (roughly five hours) used for fine-tuning each of the versions of Model-4. On average, Model-4 setting is two points WER better than Model-1. In addition, Model-4 type models (each of which is fine-tuned on one non-native accent) perform reasonably well on L1 data (Test\textsubscript{L1}, LS\textsubscript{Clean}, and LS\textsubscript{Other}). Further, large accent-specific variability is observed across different model types on Test\textsubscript{L2} ($SD$ = [$2.72-7.30$]), compared with native counterparts such as Test\textsubscript{L1} ($SD$ = [$0.20-0.43$]). An interesting result is the apparent difficulty difference between different accents ($HI$ and $KO$ easiest, $VI$ hardest), regardless of model types. We provide sample outputs from Model-4 in Table~\ref{tab:transcripts}. \par As shown in Table~\ref{model-4 zeroshot}, we also perform accent-wise zero-shot evaluation. Results of this set of experiments reveal an interesting pattern: while fine-tuning on a single accent generally benefits \textit{at least one other accent}, fine-tuning on the Hindi accent only benefits Hindi (the same accent) and hinders performance on \textit{all the other accents}. Figure~\ref{fig:model4-zeroshot1} and Figure~\ref{fig:model4-zeroshot2} illustrate this observation. \textbf{Model-5 (speaker-independent and accent-dependent):} This setup simulates a more realistic scenario where we target a single accent, without access to all speakers during development time. Thus, we use Split-5 data which mimics a speaker-independent setting. We cross-validate each L1 subset with one of the four speakers per fold. The hyper-parameters we use are those identified for Model-4. To evaluate the performance on each speaker, we conduct $24$ folds in total with one speaker removed at a time, and report the average and standard deviation of the four folds per each accent. As Table~\ref{model-5} shows, speaker-dependent variability is small for Test\textsubscript{all} ($SD$ = [$0.11-0.38$]) but large for Test\textsubscript{zeroshot-speaker} ($SD$ = [$1.12-4.87$]). These results suggest that individual speaker's differences may play an important role in how much performance gain can be obtained by fine-tuning.\footnote{For those speakers whose TOEFL scores are known~\cite{zhao2018l2}, a strong negative correlation was observed between speaker-specific WERs of Baseline-I and speaker's TOEFL scores, $r$($8$) $ \approx -.77$, $p$ \textless $.01$.} \section{Conclusion}\label{sec:con} We demonstrated potential of developing accent-independent and accent-dependent models that improve non-native speech recognition simply by fine-tuning the pre-trained wav2vec 2.0 model on a small amount of labeled data. Both the multi- and single-accent models improve performance on L2 English speakers. However, each accent benefits differently: results of the multi-accent, zero-shot experiments suggest that transfer learning on accent is possible and single-accent models improve the most for the target L2 accents.\par As to future work, while we chose a language model-free setting to focus specifically on wav2vec 2.0's acoustic capacity, comparison with language model decoding would be a useful direction to explore as a way to gauge any further potential improvements a language model can bring. In addition, finding the optimal combination of accented speech datasets when there is no available dataset for a target accent (Model-3) may constitute another interesting direction. Finally, although we have offered a number of sample transcriptions from one of our models, a thorough error analysis on each experiment would help advance the research into improving ASR models for non-native English speakers. Since L2 English speakers have specific accent characteristics influenced by their native languages, an error analysis focused on each language as well as on groups or families of languages will likely aid effective model development. Future directions could also investigate different strategies for developing ASR systems for challenging languages such as Vietnamese. \bibliographystyle{acl_natbib}
\subsection{The model} The model is parsimonious and depends on a sequence of probability laws~$\mathcal{L}:=L_1,L_2,...$, each $L_n$ supported on nonnegative integers, and a pair $(T_0, x_0)$, where $T_0$ is a locally finite rooted tree with a self-loop\footnote{The role of the self-loop is to avoid periodicity.} attached at the root and $x_0$ is a vertex of $T_0$. The model is a stochastic process $\{(T_n, X_n)\}_{n\geq 0}$ on trees with a marked vertex (the current position of the walker), defined inductively. Given $(T_n,X_n)$ we obtain~$(T_{n+1},X_{n+1})$ according to the rule below: \begin{enumerate} \item[(1)]\underline{Generate $T_{n+1}$}: create a nonnegative random number of new vertices, independently of the history of the process up to time $n$, according to $L_n$ and connect them to~$X_n$; \item[(2)] \underline{Obtain $X_{n+1}$}: given $T_{n+1}$, choose uniformly (and independently from everything else) a neighbor of $X_n$ in $T_{n+1}$: this vertex will be $X_{n+1}$. \end{enumerate} Note that at every time $n$, first the tree $T_n$ may be modified (by the possible addition of new leaves) and then the random walk takes a step on the possibly modified tree $T_{n+1}$. We refer to this model as $\mathcal{L}$-TBRW to emphasize the dependence on the sequence $\mathcal{L}:=\{L_n\}_{n\ge 1}$, which accounts for different probabilities of adding new vertices to the tree along the evolution. We denote by $\mathbb{P}_{x_0, T_0; \mathcal{L}}$ the law of $\{(T_n, X_n)\}_{n\geq 0}$ when $(T_0, X_0)=(T_0,x_0)$ and by $\mathbb{E}_{x_0, T_0;\mathcal{L}}$ the corresponding expectation. It will be helpful to introduce also a sequence of independent nonnegative integer valued random variables $Z:=\{Z_n\}_{n\ge 1}$, such that $Z_n\sim L_n$. That is, $Z_n$ is the number of leaves added at time $n$. We reserve the letters $P$ and $E$ for $P:=L_1\times L_2\times,\dots$ and for the corresponding expectation. Finally, $\mathcal{L}^{(m)}$ will denote the shifted sequence of laws $\mathcal{L}^{(m)}=\{L_{m+n}\}_{n\ge 1}$. When $\tau$ is an $\mathbb N$-valued stopping time with respect to the filtration generated by $Z_1,Z_2,...$, we will also use the notation $\mathcal{L}^{(\tau)}$ for the randomly shifted sequence $\mathcal{L}^{(\tau)}=\{L_{\tau+n}\}_{n\ge 1}$. The behavior of the process $\mathcal{L}$-TBRW may be studied from different perspectives. For example, one may look at $\mathcal{L}$-TBRW {} as a \textit{non-markovian}, \emph{self-interacting} random walk $\{X_n\}_{n\geq 0}$ whose environment is dynamically built by the walker trajectories. From this first perspective, understanding the dichotomy of \textit{transience/recurrence} and questions such as \textit{ballisticity} and \textit{localization} are natural. Another interesting point of view consists of looking at $\mathcal{L}$-TBRW as a random graph model. From this second perspective questions concerning the \textit{structure} and \textit{degree distribution} of the random sequence of trees $\{T_n\}_{n\geq 0}$ stand out. There is also a third perspective, which, in a way, is between the above two. The model $\mathcal{L}$-TBRW may be seen as a Markov chain $\{(T_n, X_n)\}_{n\geq 0}$, in the Polish space of locally finite rooted trees (see \cite{bordenave2012lecture} for an introduction to this space), i.e., each pair $(T_n,X_n)$ may be interpreted as a tree $T_n$ rooted at $X_n$. From this perspective, the existence of stationary measures and the long-time behavior of the random rooted tree $(T_n,X_n)$, are typical questions. For this approach, we refer the reader to \cite{figueiredo2017building} where the authors prove that, when $L_n = \mathsf{Ber}(p),\, \forall n\ge 1$ and $p\in (0,1]$ the sequence $\{(T_n,X_n)\}_{n\ge 0}$ converges, in a suitable sense, to a random infinite rooted tree. The model $\mathcal{L}$-TBRW belongs to a general class of models of random walks that build their trees, called Tree Builder Random Walks (TBRW)~\cite{iacobelli2019tree}. However, in \cite{iacobelli2019tree}, the authors assume a sort of \textit{uniform ellipticity} condition, namely, that $\inf_n P(Z_n\geq 1)=\kappa>0$, i.e., that the probability of adding at least one new leaf is bounded away from zero. Under this assumption, they prove that the corresponding random walk $\{X_n\}_{n\ge 0}$ is \textit{ballistic}. The $\mathcal{L}$-TBRW , with $L_n = \mathsf{Ber}(p),\, \forall n\ge 1$, $p \in (0,1]$, meets the uniform ellipticity condition, and in fact, the ballisticity of the walker had already been proven in \cite{figueiredo2017building}. Uniform ellipticity is a key assumption because, in essence, it induces a \textit{regeneration structure}, similar in spirit to the one introduced in \cite{sznitman2001} for random walks in random environments on $\mathbb{Z}^d$, which allows the walker to forget fixed proportions of the space and regenerate the environment by starting a completely ``new'' tree. A natural question from the random walk's perspective is: \begin{itemize} \item[{\bf (Q1)}] How does the random walk in $\mathcal{L}$-TBRW behave in the absence of the uniform ellipticity condition? \end{itemize} When looking at $\mathcal{L}$-TBRW as a random graph model, it is important to mention that random walks which build their graphs first appeared in the Network Science literature (see, \cite{saramaki2004scale, vazquez2003growing, cannings2013random, amorim2016growing} and references therein) as an attempt to generate \emph{scale-free} random graphs (graphs whose degree distribution is close to a power-law), while relaxing the assumption of \textit{global knowledge} present in the preferential attachment model of Barabási-Albert \cite{barabasi1999emergence} (global, here, refers to the fact the degree of every existing vertex must be known in order to decide the attachment probability). A natural question in this regard is: \begin{itemize} \item[{\bf (Q2)}] Can $\mathcal{L}$-TBRW generate scale-free random graphs? \end{itemize} Note that, the ballisticity of the random walk in $\mathcal{L}$-TBRW , when $L_n= \mathsf{Ber}(p), p \in (0,1]$, is strongly intertwined with the structure of the random trees $\{T_n\}_{n\geq 0}$. In particular, since the walker is moving away from its initial position fast, the trees generated are \textit{path-like} (or vice versa!); at time $n$ the tree has a height of order $n$, and the degree distributions of $\{T_n\}_{n\geq 0}$ have exponential tails. This suggests that the scale-free nature of the sequence $\{T_n\}_{n\geq 0}$ for $\mathcal{L}$-TBRW may only emerge when the uniform ellipticity condition fails. \medskip Here we drop uniform ellipticity, by considering a sequence of laws $\{L_n\}_{n\ge 1}$ such that $\lim_{n\to\infty}L_n(\{0\}) \to 1$, and in such a case, we begin addressing the two questions above: we show the recurrence/transience of the random walk $\{X_n\}_{n\geq 0}$ under certain assumptions on $\mathcal{L}$, and also the power-law degree distribution for the tree sequence $ \{T_n\}_{n\geq 0}$, when $L_n := \mathsf{Ber}(n^{-\gamma})$ with $\gamma \in (2/3,1]$. \medskip \paragraph{\bf Note:} In this paper by ``recurrence'' we mean the property that the walker, starting at the root $x_0$, visits any vertex (even those eventually added) infinitely often, with probability one, while by ``transience'' we mean that the graph distance between the walker and the root tends to infinity almost surely. \begin{remark}[Strong Markov Property] We will often use the Strong Markov Property for the Markov chain $\{(T_n, X_n)\}_{n\geq 0}$. Although it is quite obvious, it is worth noting that since time is discrete, this property automatically holds even though the state space is somewhat unusual (the space of marked/rooted trees). \end{remark} \subsection{Main results} We say that the walker $X$ is {\it recurrent} if for all $m \in \mathbb{N}$ and $v \in T$ \begin{equation*} \inf_{(T,x)}\mathbb{P}_{T,x; \mathcal{L}^{(m)}}\left( X \text{ visits }v\text{ i.o.}\right) = 1\;, \end{equation*} that is, if starting at the vertex $x$ of the tree $T$, the walker visits the vertex $v$ infinitely many times almost surely, when the tree growth is governed by the shifted sequence of laws $\mathcal{L}^{(m)}=\{L_{m+n}\}_{n\ge 1}$. On the other hand, we say that the walker is {\em transient} if for all $m \in \mathbb{N}$, $\inf_{(T,x)} \mathbb{P}_{T,x; \mathcal{L}^{(m)}}\left(\lim\limits_{n\to \infty} d(x,X_n)=\infty\right)=1$, where $d$ denotes the graph distance. \medskip Our first results regard the behavior of the random walker in $\mathcal{L}$-TBRW . \begin{theorem}[Recurrent Regime] \label{thm:general_recurrence} Let $m_n$ denote the first moment of $L_n$, and assume the following about $\mathcal{L}$: \begin{enumerate} \item[(A1)] $m_n<\infty, n\ge 1$; \item[(A2)] $q_n:=L_n(\{0\}) \nearrow 1$, as $n\to\infty$; \item[(A3)] $(1-q_n)\cdot M_n^2\to 0$, as $n\to\infty$, where $M_n:=\sum_1^n m_k$; \end{enumerate} Then, the random walk in $\mathcal{L}$-TBRW is recurrent. \end{theorem} \begin{corollary}\label{cor:recurrence} Let $L_n:=\mathsf{Ber}(p_n)$, with $p_n:=1-q_n:=n^{-\gamma}$. Then the random walk in $\mathcal{L}$-TBRW is recurrent for $\gamma>2/3$. \end{corollary} Theorem~\ref{thm:general_recurrence} cannot be applied to the case $L_n = \mathsf{Ber}(p_n)$ with $p_n=\Theta(n^{-\gamma})$, for $\gamma \leq 2/3$, since assumption A3 is not met. However, in the specific situation $L_n = \mathsf{Ber}(p_n)$ with $p_n=\Theta(n^{-\gamma})$ we manage to extend recurrence of the walker for all $\gamma>1/2$, as stated in the following theorem. \begin{theorem}[Recurrent Regime for $L_n = \mathrm{Ber}\left(n^{-\gamma}\right)$]\label{thm:rec} Consider a $\mathcal{L}$-TBRW where $L_n = \mathrm{Ber}\left(n^{-\gamma}\right)$ and $\gamma > 1/2$. Then, the walk is recurrent. \end{theorem} In Section \ref{tr.many} we will give conditions under which the walk is transient (see, Theorem \ref{thm:tr} and the corollary afterwards.) Specifically, we will see that when there are infinitely many growth times (i.e. $p_n$ is not summable), and there are sufficiently many edges grown at those times, the walk is never recurrent, and under a mild condition on $p_n$ (Condition 3 of Theorem \ref{thm:tr}) it is transient. In our next result, we focus on the tree structure rather than the walker, and show that for $L_n = \mathsf{Ber}(p_n)$ with $p_n=\Theta(n^{-\gamma})$, in the regime $\gamma \in (2/3,1]$, $\mathcal{L}$-TBRW generates trees whose degree distributions converge to the very same limiting distribution as in the celebrated Barabási-Albert model \cite{barabasi1999emergence,bollobas2001degree}. Note that by Corollary \ref{cor:recurrence}, in this regime recurrence holds. Let $\vertexset{n}$ denote the vertex set of $T_n$ (and $|\vertexset{n}|$ its cardinality); for $v \in \vertexset{n}$, let $\degree{T_n}{v}$ denote the degree of $v$ in $T_n$. \begin{theorem}[Power-law degree distribution]\label{thm:powerlaw} Let $\{T_n\}_{n\geq 0}$ denote the sequence of random trees in $\mathcal{L}$-TBRW for $L_n: =\mathsf{Ber}(p_n)$ with $p_n=\Theta(n^{-\gamma})$. Then, for $\gamma \in (2/3, 1]$, any initial condition $(T_0,x_0)$ and $\forall d \in \mathbb{N}\setminus\{0\}$, it holds that \begin{equation*} \lim_{n \rightarrow \infty} \frac{1}{|\vertexset{n}|}\sum_{v\in \vertexset{n}}\mathbb{1}\{\degree{T_n}{v} = d\} = \frac{4}{d(d+1)(d+2)}\;, \quad \mathbb{P}_{T_0, x_0; \mathcal{L}}\text{-a.s.} \end{equation*} \end{theorem} \subsection{Open questions} We list below a couple of questions about the $\mathcal{L}$-TBRW which are yet to be answered. \begin{itemize} \item[1)] For $L_n= \mathsf{Ber}(p_n)$ with $p_n=\Theta(n^{-\gamma})$ we expect that for $\gamma>0$ sufficiently small the random walk is transient. We conjecture that there is a phase transition for recurrence/transience according to whether $\gamma>1/2$ or $\gamma<1/2$; is this really the case? What happens at $\gamma=1/2$? Here by ``transience'' we mean that the distance of the walker from the root tends to infinity almost surely. Of course it is far from being obvious a-priori that this is exactly the negation of recurrence. \item[2)] Concerning the tree structure, for $L_n= \mathsf{Ber}(p_n)$ with $p_n=\Theta(n^{-\gamma})$ and $\gamma>0$ sufficiently small we expect a tree sequence with exponential tail degree distribution. Is $\gamma=1/2$ also a phase transition point for power-law/exponential tail degree distribution? \end{itemize} \section{Introduction} \input{intro_arx} \section{Recurrence of the walker in TBRW (proof of Theorem~\ref{thm:general_recurrence})} \input{recurrence_arx} \section{Recurrence of the walker in TBRW with $L_n = \mathsf{Ber}(p_n)$ with $p_n=\Theta(n^{-\gamma})$ (proof of Theorem~\ref{thm:rec})} \input{recurrence_above_one_half_arx} \section{Power-law degree distribution in TBRW trees (proof of Theorem \ref{thm:powerlaw})} \input{degreedist_arx} \section{Example: recurrence without power-law degree distribution} \input{no_power_law_example_arx} \section{Transience when many edges are grown}\label{tr.many} \input{transience_arx} \medskip \paragraph{\bf Acknowledgments.}{J. E. is indebted to Y. Peres for first bringing the model to his attention and for further helpful conversations.} \bibliographystyle{amsplain} \subsection{Proof of Lemma \ref{lemma:nst}}\label{ss:proofnst} Lemma \ref{lemma:nst} states that in the time window $[n, n+n^{2(1-\gamma)+\delta}]$ the walker spends $o(n^{2(1-\gamma)+\delta})$ steps on the red vertices -- the ones added in the same time window. The natural direction to prove such result would be to prove that the expected number of visits to each new vertex is small enough and then sum over the random number of vertices we could add from $n$ to $n+n^{2(1-\gamma)+\delta}$. However, the expected number of visits to a vertex is sensitive to its degree, which, in our model, can increase over time. So, our proof consists in the following two steps: \begin{itemize} \item[$i)$] bounding from above the expected number of visits to a red vertex in the time window $[n, n+n^{2(1-\gamma)+\delta}]$ by a factor times its expected degree at time $n + n^{2(1-\gamma)+\delta}$ (see, Equation~\eqref{eq:step_i}); \item[$ii)$] controlling the evolution of the degree by showing that there exists $d_0 = d(\gamma)$ such that is extremely unlikely that a red vertex reaches degree greater than $d_0$ (see, Proposition~\ref{lem:step_ii}). \end{itemize} Before proving Lemma~\ref{lemma:nst} we introduce some instrumental notions and an auxiliary result which is a quantitative version of step $ii)$. For $k \in \mathbb{N}$ we let $v_k$ be the vertex possibly added at time $k$, depending on the value of $Z_k$ (if $Z_k=0$ the vertex $v_k$ is not added to the tree). For $t\geq k$, let $D_{k,t}$ denote the degree of vertex $v_k$ at time $t$, i.e., \begin{equation}\label{eq:deg} D_{k,t} := \begin{cases} \mathrm{deg}_t(v_k), & \text{ if }Z_k = 1; \\ 0, & \text{otherwise}\;. \end{cases} \end{equation} Note that if a vertex $v_k$ is not added (i.e., $Z_k=0$) then $D_{k,t}=0$ for all $t$. As mentioned above (step $ii$)), the proof of Lemma~\ref{lemma:nst} relies on controlling the evolution of the degree and this is formally stated in the proposition below (whose quite-technical proof is deferred to Subsection~\ref{sec:step_ii}). \begin{proposition} \label{lem:step_ii} Let $\gamma \in (1/2,1]$ and $\delta<2\gamma -1$. Fix natural numbers $m$ (time shift), $d$ (degree), $k$ (vertex index) with $ k\ge n$ and $n$ sufficiently large. Then, there exists a positive constant~$C_1$ depending on $\gamma$ and $d$, and there exists $\varepsilon>0$ (depending on $\gamma$ and $\delta$, but not on $d$), such that \[ \mathbb{P}_{T,x;\mathcal{L}^{(m)}} (D_{k,n+ n^{2(1-\gamma)+\delta}} \ge d)\le \frac{C_1}{k^\gamma n^{\varepsilon (d-1)}}\;. \] \end{proposition} Given $k\in \mathbb{N}$ (vertex index), $t,s \in \mathbb{N}$ (times) with $k\geq t$ and $d\geq 1$ (degree), we denote by $N_{t,t+s}^{(d)}(v_k)$ the number of visits to $v_k$ when it has degree $d$ in the time interval $[t,t+s]$. Formally, \begin{equation}\label{eq:N} N_{t,t+s}^{(d)}(v_k) := \begin{cases} \sum_{j=t}^{t+s}\mathbb{1}\{X_j = v_k, D_{k,j}=d\}\;, & \text{ if }Z_k = 1;\\ 0\;, & \text{ otherwise}\;. \end{cases} \end{equation} For convenience, when $d=1$, we drop the superscript $(d)$ on the above definition. \begin{proof}[Proof of Lemma \ref{lemma:nst}] Recall that $N_{n,n+n^{2(1-\gamma)+\delta}}$ denotes the number of visits to red vertices from $n$ to $n+n^{2(1-\gamma)+\delta}$. The latter can be written as \[ N_{n,n+n^{2(1-\gamma)+\delta}} = \sum_{k=n}^{n+n^{2(1-\gamma)+\delta}} N_{n,n+n^{2(1-\gamma)+\delta}}(v_k)\;. \] Moreover, to avoid clutter, let us denote by $D^{(\delta)}_{n,k}:=D_{k,n+n^{2(1-\gamma)+\delta}}$, i.e., the degree of vertex $v_k$ (with $k\geq n$) at time $n+n^{2(1-\gamma)+\delta}$. Recall that, by the definition in \eqref{eq:deg}, $D^{(\delta)}_{n,k}=Z_kD^{(\delta)}_{n,k}$. Moreover, since $p_n$ is decreasing, it follows that \begin{equation*} Z_k D^{(\delta)}_{n,k} \succ Z_k\left(1+ \mathsf{Bin}\left(N_{n,n+n^{2(1-\gamma)+\delta}}(v_k), \frac{1}{(n+n^{2(1-\gamma)+\delta} + m)^\gamma}\right)\right)\;, \end{equation*} under $ \mathbb{P}_{T,x;\mathcal{L}^{(m)}}$. Here $\succ$ denotes stochastic domination and $\mathsf{Bin}$ the binomial distribution. The above stochastic domination implies that \begin{equation}\label{eq:step_i} \begin{split} \mathbb{E}_{T,x;\mathcal{L}^{(m)}} \left[N_{n,n+n^{2(1-\gamma)+\delta}}(v_k)\right] &\le (n+n^{2(1-\gamma)+\delta} + m)^\gamma \; \mathbb{E}_{T,x;\mathcal{L}^{(m)}} \left[Z_k\left(D^{(\delta)}_{n,k} -1\right)\right] \\ &\leq n^\gamma(1+o(1)) \,\mathbb{E}_{T,x;\mathcal{L}^{(m)}} \left[Z_k\left(D^{(\delta)}_{n,k} -1\right)\right]\;, \end{split} \end{equation} where, the last inequality holds since $\gamma>1/2$ and $\delta< 2\gamma -1$. % In order to control the RHS of \eqref{eq:step_i}, note that \begin{equation*} \begin{split} \mathbb{E}_{T,x;\mathcal{L}^{(m)}} \left[Z_k\left(D^{(\delta)}_{n,k} -1\right)\mathbb{1}\{2 \le D^{(\delta)}_{n,k}\le d_0\} \right] & \le d_0 \,\mathbb{P}_{T,x;\mathcal{L}^{(m)}}(D^{(\delta)}_{n,k}\ge 2) \;, \\ \mathbb{E}_{T,x;\mathcal{L}^{(m)}} \left[Z_k\left(D^{(\delta)}_{n,k} -1\right)\mathbb{1}\{ D^{(\delta)}_{n,k}\ge d_0\} \right] & \le n^{2(1-\gamma)+\delta}\, \mathbb{P}_{T,x;\mathcal{L}^{(m)}}(D^{(\delta)}_{n,k}\ge d_0)\;, \end{split} \end{equation*} where, the bottom inequality follows from noticing that $D_{n,k}^{(\delta)}$ is at most $n^{2(1-\gamma)+\delta}$ (since a vertex added after time $n$ can, by time $n+n^{2(1-\gamma)+\delta}$, have at most $n^{2(1-\gamma)+\delta}$ neighbors). Moreover, by Proposition~\ref{lem:step_ii}, we have that for every $d\geq 1$ there exists $\varepsilon \in (0, \gamma)$ (which does not depend on $d$) and a positive constant $C$ (depending on $\gamma$ and $d$) such that \[ \mathbb{P}_{T,x;\mathcal{L}^{(m)}}(D^{(\delta)}_{n,k}\ge d)\leq \frac{C}{k^{\gamma} n^{\varepsilon(d-1)}}\;, \] which implies \[ \mathbb{E}_{T,x;\mathcal{L}^{(m)}} \left[Z_k\left(D^{(\delta)}_{n,k} -1\right)\right] \leq d_0\; \frac{C_1}{k^{\gamma}n^\varepsilon} \; + \; n^{2(1-\gamma)+\delta} \; \frac{C_2}{k^{\gamma}n^{\varepsilon(d_0 -1)}}\;. \] Thus, \begin{align*} \mathbb{E}_{T,x; \mathcal{L}^{(m)}}\left[N_{n, n + n^{2(1-\gamma)+\delta}}\right] &\leq n^{\gamma} (1+o(1)) \left(C_1 n^{-\varepsilon} d_0 + C_2 \frac{n^{2(1-\gamma)+\delta}}{ n^{\varepsilon (d_0-1)}}\right) \sum_{k=n}^{n+n^{2(1-\gamma)+\delta}}k^{-\gamma} \\ &\leq (1+o(1))\left(C_1 n^{-\varepsilon} d_0 + C_2 \frac{n^{2(1-\gamma)+\delta}}{ n^{\varepsilon (d_0-1)}}\right) n^{2(1-\gamma)+\delta}\;, \end{align*} where, in the last inequality we use the trivial bound $\sum_{k=n}^{n+n^{2(1-\gamma)+\delta}} \frac{1}{k^{\gamma}} \le n^{2(1-\gamma)+\delta -\gamma}$. % Since $\varepsilon>0$ we clearly have that $ \frac{n^{2(1-\gamma)+\delta}}{n^\varepsilon}=o(n^{2(1-\gamma)+\delta})$, while choosing $d_0$ large enough such that $\varepsilon(d_0-1) > 2(1-\gamma) + \delta$, then one has \begin{equation*} \frac{n^{ 2(1-\gamma)+\delta + 2(1-\gamma) +\delta}}{n^{\varepsilon(d_0-1)}} = o(n^{2(1-\gamma)+\delta})\;. \end{equation*} \end{proof} \subsubsection{Proof of Proposition~\ref{lem:step_ii}} \label{sec:step_ii} The proof of Proposition~\ref{lem:step_ii} relies on three auxiliary results, namely Lemma~\ref{lem:fixedtree} and Lemmas ~\ref{lemma:expecnst} and ~\ref{lemma:rec}, which will be presented below. The first lemma is a general result for SSRW on {\em fixed} trees that will be useful to our proposes. \begin{lemma}\label{lem:fixedtree} Let $T$ be a finite tree and $v$ a vertex of $T$. Let $d:=\mathrm{deg}_T(v)$ be the degree of $v$ and denote by $N_t(v)$ the number of visits to $v$ in $t$ steps of a SSRW on~$T$. Then, for every $\epsilon>0$ there exist $t_0$ such that $\forall t \geq t_0$ the following bound holds \[ E_v\left[N_t(v)\right] \le \frac{(d+\epsilon)\cdot t}{2(|T|-1)}\;, \] where $|T|$ denotes the number of vertices in $T$. \end{lemma} \begin{proof} Define recursively the following sequence of return times: $H_0 \equiv 0$ and for $j\geq 1$, $H_j := \inf\{ n > H_{j-1} \; : \; Y_n = v\}$, i.e., $H_j$ is the $j$-th time $Y$ returns to $v$. For $v$ and $w$ neighboring vertices in $T$ we let $T_{v}(w)$ be the subtree of $T$ containing $w$ and obtained by removing the edge between $w$ and $v$. By a first-step analysis, we have that $$ E_v[H_1] = \frac{\sum_{w\sim v}(1 + E_w[H_1])}{d} = \frac{\sum_{w\sim v}(1 + (2|T_v(w)|-1)}{d} = \frac{2(|T|-1)}{d}\;, $$ where, in the second equality we use that $E_w[H_1]=2|T_v(w)|-1$ (see, e.g., Corollary~10 in \cite{palacios2014hitting}). By the Renewal Theorem we have that \[ \lim_{t \to +\infty} \frac{N_t(v)}{t} = \frac{1}{E_v[H_1]}\;, \text{a.s.}\;, \quad{ and } \quad \lim_{t \to +\infty} \frac{E_v[N_t(v)]}{t} = \frac{1}{E_v[H_1]}= \frac{d}{2(|T|-1)}\;. \] \end{proof} Since in TBRW the domain of the walker changes as it walks, we will need to keep track of the random times when new vertices are added and the times when they have their degrees increased. For this reason we will need some further definitions. For $d \in \mathbb{N}$, define inductively the following sequence of stopping times \begin{equation*} \eta_{k,1} := \begin{cases} k, & \text{ if }Z_k = 1; \\ +\infty, & \text{ otherwise}\;, \end{cases} \end{equation*} and for $d\ge 2$, \[ \eta_{k,d} := \begin{cases} \inf \{ t > \eta_{k,d-1} \; : \; D_{k,t} = d\}\;, & \text{ if $\eta_{k,d-1} <\infty$; } \\ +\infty\;, & \text{ otherwise}\;. \end{cases} \] So, $\eta_{k,d}$ is the first time $v_k$ reaches degree $d$ (if $v_k$ is not added then $\eta_{k,d}=+\infty$, for all $d\geq 1$). % Recall that, given $k\in \mathbb{N}$ (vertex index), $t,s \in \mathbb{N}$ (times) with $k \geq t$ (we are interested in vertices possibly added after time $t$) and $d\geq 1$ (degree), $N_{t,t+s}^{(d)}(v_k)$ denotes the number of visits to $v_k$ when it has degree $d$ in the time interval $[t,t+s]$. Regarding $N_{t,t+s}^{(d)}(v_k)$ we have the following result: \begin{lemma}\label{lemma:expecnst} Fix natural numbers $m$ (time shift), $k$ (vertex index), $d$ (degree), $t,s$ (times) with $ k\ge t$ and $s$ sufficiently large. Then there exist positive constants $C_1$ and $C_2$ depending on $\gamma$ only such that \[ \mathbb{E}_{T,x;\mathcal{L}^{(m)}} \left[N_{t,t+s}^{(d)}(v_k)\right] \le C_1\frac{d\cdot s}{t^{1-\gamma} -1 }\mathbb{P}_{T,x;\mathcal{L}^{(m)}}\left( \eta_{k,d} < t+s\right) + s e^{-C_2t^{1-\gamma}}\;. \] \end{lemma} \begin{proof} By definition of $N_{t,t+s}^{(d)}(v_k)$ (see, \eqref{eq:N}) we have that $N_{t,t+s}^{(d)}(v_k) = N_{t,t+s}^{(d)}(v_k)\mathbb{1}\{\eta_{k,d} < t+s\}$. Moreover, \begin{equation*} \mathbb{1}\{\eta_{k,d} < t+s\} N_{t,t+s}^{(d)}(v_k) \le \mathbb{1}\{\eta_{k,d} < t+s\} N_{0,s}^{(d)}(v_k)\circ \theta_{\eta_{k,d}}\;, \quad \mathbb{P}_{T,x;\mathcal{L}^{(m)}}\text{-a.s.} \end{equation*} It is important to point out that $v_k$ in $N_{0,s}^{(d)}(v_k)$ is not the $k$-th vertex added by the shifted process, but the vertex $v_k$ which belongs to $T_{\eta_{k,d}}$ on the event $\{\eta_{k,d} < t+s\}$. Thus, by the strong Markov property it follows that \begin{equation}\label{eq:smarkovnst} \mathbb{E}_{T,x;\mathcal{L}^{(m)}} \left[N_{t,t+s}^{(d)}(v_k)\right] \le \mathbb{E}_{T,x;\mathcal{L}^{(m)}}\left[ \mathbb{E}_{T_{\eta_{k,d}}, X_{\eta_{k,d}}; \mathcal{L}^{(m+\eta_{k,d})}} \left[N_{0,s}^{(d)}(v_k)\right]\mathbb{1}\{\eta_{k,d} < t+s\} \right]\;. \end{equation} Our next step is to handle \begin{equation}\label{handle} \mathbb{E}_{T_{\eta_{k,d}}, X_{\eta_{k,d}}; \mathcal{L}^{(m+\eta_{k,d})}} \left[N_{0,s}^{(d)}(v_k)\right]\;. \end{equation} Let $\widetilde{X}$ denote the random walk $X$ only when it makes transitions over $T_{\eta_{k,d}}$. Let $W$ denote a SSRW on $T_{\eta_{k,d}}$, starting from $v_k$ and let $N^{W}_{s}(v_k)$ be the number of visits to $v_k$ by the walker $W$ in $s$ steps. We can couple $\widetilde{X}$ (staring from $v_k$) with $W$ in such a way that all possible subsequent visits of $X$ to $v_k$ counted by $N_{0,s}^{(d)}(v_k)$ are counted by $N^{W}_{s}(v_k)$ as well. Since $v_k$ may reach degree $d+1$ before $X$ takes $s$ steps, or $\widetilde{X}$ may take less than $s$ steps over $T_{\eta_{k,d}}$, we just `complete' the remaining steps of $W$ by letting it walking on $T_{\eta_{k,d}}$ independently of $X$ whenever $v_k$ reaches degree $d+1$ and/or after $\widetilde{X}$ takes $s$ steps. Thus, by Lemma \ref{lem:fixedtree}, on the event $\{ \eta_{k,d} < t+s\}$ we can bound the random variable in \eqref{handle} as \begin{equation*} \mathbb{E}_{T_{\eta_{k,d}}, X_{\eta_{k,d}}; \mathcal{L}^{(m+\eta_{k,d})}} \left[N_{0,s}^{(d)}(v_k)\right] \le E_{v_k} \left[ N^{W}_{s}(v_k) \right] + 1 \le \frac{2d\cdot s}{2(|T_{\eta_{k,d}}| -1)} \le \frac{d\cdot s}{|T_t| -1}\;, \end{equation*} where, the last inequality holds since the assumption $k\geq t$ assures that $T_{\eta_{k,d}}$ contains $T_t$. Replacing the above on \eqref{eq:smarkovnst} leads us to \begin{equation}\label{eq:expts} \mathbb{E}_{T,x;\mathcal{L}^{(m)}} \left[N_{t,t+s}^{(d)}(v_k)\right] \le \mathbb{E}_{T,x;\mathcal{L}^{(m)}}\left[ \left( \frac{d\cdot s}{|T_t| -1}\right) \mathbb{1}\{\eta_{k,d} < t+s\} \right]\;. \end{equation} Given the initial condition $(T,x)$, since the tree growth is governed by the shifted sequence of laws $\mathcal{L}^{(m)}=\{L_{m+n}\}_{n\ge 1}$, it follows that $|T_t|$ is \[ |T_t| = |T| + \sum_{r=1}^tZ_{r+m} \implies \mathbb{E}_{T,x;\mathcal{L}^{(m)}} \left[ |T_t| \right] = |T| + \Theta \left((t+m)^{1-\gamma}\right)\;, \] where the constants involved in the $\Theta$ notation depend only on $\gamma$. By Chernoff bounds, there exist positive constants $C_2$ and $C_3$ such that \begin{equation*} \mathbb{P}_{T,x;\mathcal{L}^{(m)}} \left( |T_t| \le C_2(|T| + (t+m)^{1-\gamma})\right) \le e^{-C_3t^{1-\gamma}}. \end{equation*} Combining the above inequality with \eqref{eq:expts} yields \[ \mathbb{E}_{T,x;\mathcal{L}^{(m)}} \left[N_{t,t+s}^{(d)}(v_k)\right] \le \left(\frac{d \cdot s}{C_2(|T|+(t+m)^{1-\gamma}) -1}\right)\mathbb{P}_{T,x;\mathcal{L}^{(m)}}\left( \eta_{k,d} < t+s\right)+ s e^{-C_3t^{1-\gamma}}\;, \] which is enough to prove the lemma. \end{proof} The next result is a recursion for the tail probability of $D_{k,t+s}$. \begin{lemma}\label{lemma:rec} Fix natural numbers $m$ (time shift), $k$ (vertex index), $d$ (degree), $t,s$ (times) with $ k\ge t$ and $s$ sufficiently large, and fix $\varepsilon < \gamma$. Then, there exist positive constants $C_1$ and $C_2$ depending on $\gamma$ such that \[ \mathbb{P}_{T,x;\mathcal{L}^{(m)}} (D_{k,t+s} \ge d+1)\le I+II\;, \] where, $$ I:= \left \lbrace \frac{(t+s+m)^{\gamma}}{(t+m)^{\gamma}}\left[1 - \left( 1- \frac{1}{(t+s+m)^\gamma}\right)^{t^{\gamma-\varepsilon}}\right]+C_1\frac{d\cdot s}{(t^{1-\gamma} -1)t^{\gamma - \varepsilon} }\right \rbrace \mathbb{P}_{T,x;\mathcal{L}^{(m)}}\left( D_{k,t+s} \ge d\right)\;; $$ and $$ II:= \frac{s e^{-C_2t^{1-\gamma}}}{t^{\gamma - \varepsilon}}\;.$$ \end{lemma} \begin{proof} Let us begin noticing the following identity of events: \[ \left \lbrace \eta_{k,d} \le t + s \right \rbrace = \left \lbrace D_{k,t+s} \ge d \right \rbrace\;. \] Then, we have that \begin{equation}\label{eq:dktged} \begin{split} \mathbb{P}_{T,x;\mathcal{L}^{(m)}} (D_{k,t+s} \ge d+1) & \le \mathbb{P}_{T,x;\mathcal{L}^{(m)}} (D_{k,t+s} \ge d+1, N_{t,t+s}^{(d)}(v_k) \le t^{\gamma - \varepsilon})\\ & \quad + \mathbb{P}_{T,x;\mathcal{L}^{(m)}} ( N_{t,t+s}^{(d)}(v_k) \ge t^{\gamma - \varepsilon})\;. \end{split} \end{equation} By Markov's inequality and Lemma~\ref{lemma:expecnst} we have \begin{align} \label{eq:b1} &\mathbb{P}_{T,x;\mathcal{L}^{(m)}} ( N_{t,t+s}^{(d)}(v_k) \ge t^{\gamma - \varepsilon}) \le \frac{C_1d\cdot s}{(t^{1-\gamma} -1)t^{\gamma-\varepsilon} }\mathbb{P}_{T,x;\mathcal{L}^{(m)}}\left( \eta_{k,d} < t+s\right) + \frac{ s e^{-C_2t^{1-\gamma}}}{t^{\gamma-\varepsilon}}\;. \end{align} For the first term of the RHS of \eqref{eq:dktged}, fix $j \le t^{\gamma-\varepsilon}$, then we have the following identity \begin{equation*} \left \lbrace D_{k,t+s} \ge d+1, N_{t,t+s}^{(d)}(v_k) = j \right \rbrace = \left \lbrace Z_{H'_j + 1} = 1, Z_{H'_{j-1}+1} = 0, \dots, Z_{H'_1+1} = 0, \eta_{k,d} < t+s \right \rbrace\;, \end{equation*} where $H'_i$ denotes the time of the $i$-th visit to $v_k$ after time $\eta_{k,d}$, i.e., after reaching degree $d$. In words, the LHS of the above identity denotes the event in which $v_k$ has degree at least $d+1$ before time $t+s$ and has been visited $j$ times while it had degree $d$. This means that at each of these $j$ visits to $v_k$, in the next step it has failed $j-1$ times to increase its degree to $d+1$ and only succeed after the $j$-th visit, that is, at the time $H'_j +1$. The failures and success are described formally by the $Z_{H'_i+1}$'s. Using the independent nature of $Z$'s and the fact that $p_n$ is decreasing in $n$, we have that \begin{equation*} \begin{split} \mathbb{P}_{T,x;\mathcal{L}^{(m)}} (D_{k,t+s} \ge d+1, &N_{t,t+s}^{(d)}(v_k) = j ) \\ &\le \frac{1}{(t+m)^\gamma}\left( 1 - \frac{1}{(t+s+m)^{\gamma}}\right)^{j-1}\mathbb{P}_{T,x;\mathcal{L}^{(m)}}\left( D_{k,t+s} \ge d\right)\;. \end{split} \end{equation*} Summing over $j$ from $1$ to $t^{\gamma - \varepsilon}$ leads to \begin{align*} & \mathbb{P}_{T,x;\mathcal{L}^{(m)}} (D_{k,t+s} \ge d+1, N_{t,t+s}^{(d)}(v_k) \le t^{\gamma - \varepsilon}) \\ &\qquad \le \frac{(t+s+m)^{\gamma}}{(t+m)^{\gamma}}\left[1 - \left( 1- \frac{1}{(t+s+m)^\gamma}\right)^{t^{\gamma-\varepsilon}}\right] \mathbb{P}_{T,x;\mathcal{L}^{(m)}}\left( D_{k,t+s} \ge d\right)\;, \end{align*} which combined with \eqref{eq:b1} proves the result. \end{proof} We are finally ready to prove Proposition~\ref{lem:step_ii}. \begin{proof}[Proof of Proposition~\ref{lem:step_ii}] Setting $t= n$ and $s=n^{2(1-\gamma)+\delta}$, with $\delta<2\gamma -1$ and $\varepsilon<\gamma$ in Lemma~\ref{lemma:rec}, and using the shorthand $D^{(\delta)}_{n,k}:=D_{k,n+n^{2(1-\gamma)+\delta}}$, we obtain that the probability $\mathbb{P}_{T,x;\mathcal{L}^{(m)}} (D^{(\delta)}_{n,k} \ge d+1)$ is bounded from above by \begin{equation*} \begin{split} & \left(\frac{ n+ n^{2(1-\gamma)+\delta} + m}{n + m }\right)^\gamma\left(1 - \left(1-\frac{1}{(n+n^{2(1-\gamma)+\delta} + m)^\gamma}\right)^{n^{\gamma -\varepsilon}} \right) \mathbb{P}_{T,x;\mathcal{L}^{(m)}}\left( D^{(\delta)}_{n,k} \ge d\right) \\ &+\frac{C_1dn^{2(1-\gamma)+\delta}}{(n^{1-\gamma}-1)n^{\gamma-\varepsilon}} \mathbb{P}_{T,x;\mathcal{L}^{(m)}}\left( D^{(\delta)}_{n,k} \ge d\right) + \frac{n^{2(1-\gamma)+\delta}}{n^{\gamma-\varepsilon}}e^{-C_2n^{1-\gamma}}\;. \end{split} \end{equation*} Since $\gamma>1/2$ and $n$ is sufficiently large we obtain: \[ \mathbb{P}_{T,x;\mathcal{L}^{(m)}} (D^{(\delta)}_{n,k} \ge d+1)\leq \left(\frac{ C'_1}{n^{\varepsilon}}+\frac{C_1dn^{2(1-\gamma)+\delta}}{(n^{1-\gamma}-1)n^{\gamma-\varepsilon}}\right) \mathbb{P}_{T,x;\mathcal{L}^{(m)}}\left( D^{(\delta)}_{n,k} \ge d\right) + \frac{n^{2(1-\gamma)+\delta}}{n^{\gamma-\varepsilon}}e^{-C_2n^{1-\gamma}}\;, \] By applying the following bound to $\mathbb{P}_{T,x;\mathcal{L}^{(m)}} (D^{(\delta)}_{n,k} \ge d)$ and continuing the recursion backwards all the way to $d=1$ and recalling that $$ \mathbb{P}_{T,x;\mathcal{L}^{(m)}} (D^{(\delta)}_{n,k} \ge 1) = \frac{1}{(k+m)^{\gamma}}\;, $$ we obtain that $\mathbb{P}_{T,x;\mathcal{L}^{(m)}} (D^{(\delta)}_{n,k} \ge d+1)$ is bounded from above by $$ \frac{1}{k^\gamma}\prod_{j=2}^d \left(\frac{C'_1}{n^{\varepsilon}}+\frac{C_1jn^{2(1-\gamma)+\delta}}{(n^{1-\gamma}-1)n^{\gamma-\varepsilon}}\right) +d\cdot n^\beta e^{-C_2n^{1-\gamma}} \le \frac{1}{k^{\gamma}} \left(\frac{C'_1}{n^{\varepsilon}}+\frac{C_1''dn^{2(1-\gamma)+\delta}}{n^{1-\varepsilon}} \right)^{d-1} \!\!\! +d\cdot n^\beta e^{-C_2n^{1-\gamma}}\;, $$ for some $\beta>0$. Now, by choosing $\varepsilon$ so that $$ 1-\varepsilon -2(1-\gamma) - \delta > \varepsilon \iff \varepsilon < \frac{1-2(1-\gamma) - \delta}{2}\;, $$ there exists $C_2'$ depending on $\gamma$ and $d$ such that $$ \mathbb{P}_{T,x;\mathcal{L}^{(m)}} (D^{(\delta)}_{n,k} \ge d) \le \frac{C_2'}{k^{\gamma}n^{\varepsilon(d-1)}}\;, $$ which proves the result. \end{proof}
\section*{APPENDIX} \clearpage \section*{ACKNOWLEDGMENT} We would like to thank Jim Fan and the NVIDIA AI-ALGO team for their insightful feedback and discussion, and the NVIDIA IsaacGym simulation team for providing technical support. \renewcommand*{\bibfont}{\footnotesize} \printbibliography \end{document} \section{Introduction} \label{sec:intro} Robust robot manipulation for real-world tasks is challenging as it requires controlling robots with many degrees of freedom to perform contact-rich interactions that can quickly adapt to varying conditions. While general reinforcement learning algorithms~\cite{haarnoja2018sac, barth2018d4pg, mahmood2018benchmark} can be employed for designing robot controllers from experiences, a crucial and often neglected design choice is the action space for specifying the desired motions of robots~\cite{martin-martin2019vices}. Recent work has shown promise in using abstract action representations, rather than low-level torque actuation, for expediting manipulation learning. A broad range of action representations have been examined, including task-space commands~\cite{kalakrishnan2011forcecontrol,lee2019multimodal,martin-martin2019vices,sadeghian2014tasknullspace,xian2004quatfeedback,shuzhi1997adaptivenn}, latent-space action embeddings~\cite{allshire2021laser,li2020usermappings,karamcheti2021latentteleop,pahic2021robotskilllearning}, and high-level goal specifications~\cite{lippi2020visualactionplanning,wang2019visualplanningacting}. These action abstractions have been shown to ease the exploration burdens of reinforcement learning and improve its sample efficiency. Among these action representations, Operational Space Control (OSC)~\cite{khatib1987osc} has emerged as an effective task-space controller for contact-rich manipulation tasks~\cite{lee2019multimodal,martin-martin2019vices}. OSC parameterizes motor commands by end-effector displacement and maps these commands into deployable joint torques. It has many advantages with its dynamically consistent formalism, including modeling compliance, compressing the higher-dimensional non-linear $N$-DOF torque control into orthogonal 6-DOF actions, and accelerating learning by enabling agents to reason directly in the task space. However, OSC's benefits are not always realized. As a model-based controller, its practical strength heavily relies on a high-fidelity model of the \emph{mass matrix}. This time-varying quantity accounts for the robot's mass distribution at its current configuration and is crucial for calculating torques. In the presence of inaccuracies in dynamics modeling, OSC's performance quickly deteriorates~\cite{nakanishi2008oscevaluation}. We illustrate this problem in a simple path tracing task in Fig.~\ref{fig:pull}, where unmodeled extrinsics parameters such as friction and external forces significantly reduce the fidelity of the analytical mass matrix and deteriorate the tracking accuracy. The problem with modeling errors is exacerbated by the fact that controller design is often decoupled from policy learning, and becomes especially pronounced during task transfer settings such as simulation-to-real where there can be significant domain shifts. While a policy can finetune itself, mass matrix quality cannot be improved with data due to its analytical formulation. \input{fig-pull} \input{fig-model} How can we overcome the key limitation of OSC? We observe that its key element, the mass matrix, is subject to physics-based constraints as expressed by robot dynamics differential equations~\cite{niku2001introduction} in classical mechanics. Recent advances in physics-informed machine learning has developed a new family of neural networks~\cite{chen2018neuralode, shao2019pinn, li2020fno} that learn such differential equations from data. In particular, Lutter et al.~\cite{lutter2019delan, lutter2019delan4ec} introduced Deep Lagrangian Networks (\textsc{DeLaN}\xspace) that directly infers the mass matrix from sampled trajectories. However, despite promising results on real robots, \textsc{DeLaN}\xspace is limited by its modeling capacity and underlying assumptions, viz., that robots move in free space with constant mass and no external disturbances. This is unrealistic for most robot manipulation tasks, which require contact interaction with the environment. Hence, we need a more versatile and robust model for contact-rich manipulation tasks. \textbf{Our Approach:} To this end, we introduce \underline{OSC} for \underline{A}daptation and \underline{R}obustness (\textsc{OSCAR}\xspace), a data-driven variant of OSC that leverages a neural network-based physics model to infer relevant modeling parameters and enable online adaptation to changing dynamics. \textsc{OSCAR}\xspace addresses \textsc{DeLaN}\xspace's limitations by extending its formulation to be amenable to general dynamic settings such as robot manipulation. Concretely, we introduce latent extrinsics inputs that capture task-specific environment factors and robot parameters, and design an encoder to infer these extrinsics from the state-action history. These extrinsics allow our model to infer wide variations in dynamics during training, and robustly work in out-of-distribution settings. Furthermore, we augment the dynamics model with a residual component. This design factorizes the dynamics model into a canonical task-agnostic component learned online from scratch using free-space motion and a constrained task-specific residual, allowing for fast adaptation to dynamics change through residual learning. We evaluate \textsc{OSCAR}\xspace in three diverse manipulation tasks: Path Tracing, Cup Pouring, and Puck Pushing, all of which become especially challenging due to varying degrees of dynamics variations. We evaluate extensive baselines, and find that \textsc{OSCAR}\xspace is much more \textbf{stable}, being the only model to achieve task success on all tasks when evaluated on training distributions, \textbf{robust}, exhibiting significantly less policy degradation when evaluated in zero-shot under out-of-distribution, and \textbf{adaptive}, being the only model to reconverge to similar levels of task performance across all tasks when quickly finetuned under significant domain shifts. \section{Related Work} \label{sec:related} \textbf{Action Space for Learning Robot Control.} Choosing an appropriate action space for learning methods in robotics can be nontrivial. While joint-space commands can be immediately deployed on a robot, they are high-dimensional and nonlinear. Recent work has demonstrated that the abstraction provided by task-space controllers, such as inverse kinematics (IK)~\cite{goldenberg1985ik} and operational space control (OSC)~\cite{khatib1987osc}, can improve policy performance and reduce sample complexity~\cite{lee2019multimodal,martin-martin2019vices,zhu2020robosuite, luo2019rl_vices}. Nonetheless, these approaches are heavily model-based and require parameter tuning to overcome kinematic redundancies and modeling errors~\cite{dsouza2001learningik, peters2008learningosc}. Despite OSC's more expressive formulation that models compliance, prior work has primarily focused on improving IK~\cite{pannawit2017nn_ik, karlik2000ik_improve, chen2015ik_screw, koker2013ik_errmin}. A few works exploring OSC have sought to learn its parameters in data-driven ways, such as applying reinforcement learning (RL) to track desired trajectories~\cite{peters2007rlosc} or learning the impedance gains for adapting to task-specific dynamics~\cite{martin-martin2019vices}. Unlike these methods which are limited to gain tuning and require knowledge of the underlying dynamics, we seek to completely eliminate the modeling burdens and infer dynamics from trajectories. \textbf{Deep Learning for Dynamical Systems.} In contrast to policy learning methods that seek to \textit{adapt} to environment dynamics, a parallel line of work has explored directly modeling these system dynamics as learnable ordinary differential equations (ODEs) with deep neural networks. While the majority of these works seek to model arbitrary physical dynamics~\cite{lutter2019delan, lutter2019delan4ec, finzi2020chnn, zhong2021contacthnn}, some have explored specific complex physical phenomena such as contact~\cite{hochlehnert2021contact, pfrommer2020contactnets, parmar2021contact_challenges} and fluid dynamics~\cite{wessels2020nn_fluid, portwood2019nn_turbulence}. These works leverage strong physical priors to enforce model plausibility. While these works have demonstrated promising results in restrictive domains, they have yet to show success for realistic contact-rich dynamics, such as high degree-of-freedom robot arms physically interacting with objects. Our work builds upon Lutter et al.~\cite{lutter2019delan,lutter2019delan4ec}'s \textsc{DeLaN}\xspace model. We augment its modeling capacity to perform joint policy and dynamics learning end-to-end for contact-rich manipulation tasks. \textbf{System Identification in Robotics.} Our work is also relevant to methods for system identification (sysID), which seek to estimate accurate models of dynamics from data. Classical methods on sysID~\cite{melsa1971system, astrom1971sysid_survey, ljung1998system} define a priori models and seek to estimate its unknown parameters from sampled data. More recent data-driven methods have relaxed the modeling burdens and proposed to train deep neural networks to capture relevant task dynamics parameters either directly~\cite{chebotar2018sim, yu2019sim} or via latent representations~\cite{cully2014adapt,kumar2021rma}. Recent work on simulation-to-real transfer has focused on estimating distributions of simulated dynamics parameters~\cite{ramos2019bayessim} or allowing end-to-end differentiation through simulation~\cite{freeman2021brax, heiden2021disect} for tuning the simulation model's fidelity. In a similar vein as these works, we leverage simulation with varied dynamics to allow our learned dynamics model to infer both direct and latent representations of these parameters. However, in contrast to most of these works that infer relevant parameters in an end-to-end fashion, we decouple the process into task-agnostic and task-specific phases, allowing our model to generate a reference representation that can be tuned to specific tasks. \section{Background} \label{sec:background} \subsection{Preliminaries} We model robot manipulation tasks as an infinite-horizon discrete-time Markov Decision Process (MDP) $\mathcal{M} = \langle \mathcal{S}, \mathcal{A}, \mathcal{T}, \mathcal{R}, \gamma, \rho_0 \rangle$, where $\mathcal{S}$ is the state space, $\mathcal{A}$ is the action space, $\mathcal{T}(s_{t+1} | s_t, a_t)$ is the state transition probability distribution, $\mathcal{R}(s_t, a_t, s_{t+1})$ is the reward function, $\gamma \in [0, 1)$ is the reward discount factor, and $\rho_0(\cdot)$ is the initial state distribution. Per timestep $t$, an agent observes $s_t$, deploys policy $\pi$ to choose an action $a_t \sim \pi(a_t | s_t)$, and executes the action in the environment, observing the next state $s_{t+1} \sim \mathcal{T}(\cdot)$ and receiving reward $r_t = \mathcal{R}(\cdot)$. We seek to learn policy $\pi$ that maximizes the discounted expected return $\mathds{E} [\sum_{t=0}^{\infty} \gamma^t \mathcal{R}(s_t, a_t, s_{t+1})]$. \subsection{Operational Space Control (OSC)} OSC is a dynamically consistent controller that models compliant task-space motion. It is particularly useful for robot manipulation, where the robot's end-effector is often the critical task point and must produce compliant behavior for either safety or task-specific reasons. The control law is: \begin{equation} \Vec{\tau} = \Vec{J^\top}_{ee}(\Vec{q})[\Vec{\Lambda}_{ee}(\Vec{q})[\Vec{k}_p (\Vec{x}_d - \Vec{x}) - \Vec{k}_v ((\Vec{\Dot{x}}_d - \Vec{\Dot{x}}))]] \label{eq:osc} \end{equation} where the inertial matrix $\Vec{\Lambda}_{ee} \in \mathds{R}^{6 \times 6}$ and the Jacobian $\Vec{J}_{ee}$ both specified in the end-effector frame maps the desired PD $\Vec{k}_p, \Vec{k}_v \in \mathds{R}^6$ control of desired end-effector pose and velocity $\Vec{x}_d, \Vec{\Dot{x}}_d \in \mathds{R}^6$ to joint-space control torques $\Vec{\tau} \in \mathds{R}^N$, where $N$ is the number of robot joints. $\Vec{k}_p$ and $\Vec{k}_v$ specify the relative compliance of the controller~\cite{khatib1987osc}. These values can be either defined \textit{a priori} or learned as part of the action space (VICES~\cite{martin-martin2019vices}). For VICES, the action space is $\mathds{R}^{18}$, instead of the usual $\mathds{R}^6$ with $\Vec{\Dot{x}}_d = 0$. This choice of action space has been shown to be especially advantageous for contact-rich manipulation~\cite{luo2019rl_vices}. For this reason, we apply VICES to all OSC-based models unless otherwise noted. Crucially, $\Vec{\Lambda}_{ee}$ depends on the \textit{mass matrix} $\Vec{H}(\Vec{q})$, which in turn depends on the joint state $\Vec{q}$ and potentially time if the overall system mass is time-varying. Inaccurate modeling of the mass matrix can result in unstable controller behavior. This problem is precisely the challenge that we seek to address through learning $\Vec{H}$ online from sampled trajectories. \subsection{Deep Lagrangian Networks (\textsc{DeLaN}\xspace)} Lutter et al.~\cite{lutter2019delan, lutter2019delan4ec} have shown that arbitrary rigid body dynamics can be inferred from free space motion via the Lagrangian mechanics, captured by the following forward and inverse dynamics equations: \begin{equation} \f = \Vec{H}^{-1} \left( \Vec{\tau} -\Dot{\Vec{H}}\dot{\q} + \frac{1}{2} \T{\left(\frac{\partial}{\partial \q}((\T{\dot{\q}} \Vec{H} \dot{\q})\right)} -\Vec{g} \right) \label{eq:lagrangian_for} \end{equation} \begin{equation} f^{-1}(\q, \qd, \qdd; \H, \g) = \Vec{H} \ddot{\q} + \frac{d}{dt} (\Vec{H}) \dot{\q} - \frac{1}{2} \T{(\frac{\partial}{\partial \q}(\T{\dot{\q}} \Vec{H} \dot{\q}))} + \Vec{g} \label{eq:lagrangian_inv} \end{equation} where $\Vec{q}$, $\dot{\q}$, and $\ddot{\q}$ are the system's generalized coordinates and their first- and second-order time derivatives, respectively, and $\Vec{g}$ is the time-varying sum of potential forces. \textsc{DeLaN}\xspace parameterizes unknown functions $\Vec{H}, \Vec{g}$ with neural networks. Given known values $\Vec{q}_t$, $\dot{\q}_t$, $\ddot{\q}_t$, \textsc{DeLaN}\xspace predicts current torques $\Vec{\tau}_{pred}$ using Eq. \ref{eq:lagrangian_inv}, and additionally uses observed torques $\Vec{\tau}$ to predict joint accelerations $\ddot{\q}_{pred}$ using Eq. \ref{eq:lagrangian_for}. \textsc{DeLaN}\xspace is trained with L2 regression loss with respect to known observed quantities, and includes forward, inverse, and energy conservation dynamics losses (Fig \ref{fig:delan}). In order to allow efficient off-the-shelf back-propagation, the loss computations require analytical first-order derivative computations of $\frac{\partial}{\partial \q}[\Vec{H}]$. Since $\Vec{H}$ is parameterized by a neural network with $\Vec{q}$ as inputs, this can be achieved by exclusively using fully-connected layers (``Lagrangian Layers'') which allow analytical first-order partial derivatives to be computed during the forward pass. \section{Our Method (\textsc{OSCAR}\xspace)} \label{sec:deeposc} \input{fig-delan} We now propose \textsc{OSCAR}\xspace, a data-driven variant of OSC capable of leveraging the strengths of its controller formulation while removing the modeling burden of the high-fidelity and pre-defined mass matrix. We achieve this by learning a dynamics model that directly infers the mass matrix from online trajectories. Crucially, our dynamics model builds upon \textsc{DeLaN}\xspace and concretely improves its modeling capacity by (a) introducing latent extrinsics inputs that capture task-specific environment factors and robot parameters, which can be inferred directly from the state-action history, and (b) augmenting the dynamics model with a residual component, enabling fast adaptation to dynamics changes through residual learning (Fig. \ref{fig:model}). Together, \textsc{OSCAR}\xspace enables end-to-end joint learning of the dynamics model and the policy, and can adapt to out-of-distribution environment variations. We describe each of these key features below. \subsection{Capturing Latent Extrinsics} \label{sec:latent} A key limitation of \textsc{DeLaN}\xspace resides in its modeling capacity, which is bottlenecked by its dependency exclusively on $\Vec{q}$, $\dot{\q}$, and $\ddot{\q}$. While these values may be sufficient to model dynamics for a robot moving through free space in steady state, it can be problematic for settings where these values are not constant, such as during extended external impedance like grasping or applying the same model across a fleet of robots with varying individual dynamical properties. \textsc{OSCAR}\xspace addresses this problem by implicitly inferring relevant extrinsic parameters directly from a robot's state-action history via learned latent embeddings. This follows the intuition that states are jointly dependent on both actions and underlying dynamics. Thus, learning correlations between recent states and actions can be a viable proxy for inferring extrinsic variations. This hypothesis has been validated by recent work \cite{kumar2021rma} that has shown a similar method robust enough for direct simulation-to-real transfer. To this end, we add an additional module to our dynamics model, which takes in the robot's recent joint states $\Vec{q}$, $\dot{\q}$ and low-level torques $\Vec{\tau}$, and generates low-dimensional latent embeddings $\Vec{z}$ that are directly fed into the \textsc{DeLaN}\xspace residual (Sec. \ref{sec:residual}). Because the base network is restrained to inferring relevant dynamics from $\Vec{q}$, augmenting inputs with $\Vec{z}$ can increase the fidelity of the learned dynamics by allowing additional information flow from the state-action history. We use a shallow 4-layer MLP network as our encoder. In order to leverage automatic differentiation for calculating the dynamics loss, we must analytically compute the first-order partial derivative $\frac{\partial}{\partial \q}[\Vec{z}]$. However, we crucially assume that these latent embeddings capture environment extrinsics that are \textit{independent} of $\Vec{q}$, such that $\frac{\partial}{\partial \q}[\Vec{z}] = \Vec{0}$. This makes forward and gradient computations much simpler and also encourages the learned embeddings to be agnostic to spurious correlations with $\Vec{q}$. \subsection{Residual-Augmented Mass Matrices} \label{sec:residual} Under domain shifts that substantially change the system dynamics, it would be advantageous for a pretrained but possibly inaccurate dynamics model to quickly adapt in an online fashion. Therefore, \textsc{OSCAR}\xspace decouples dynamics learning into task-agnostic and task-specific components, inferring an initial reference estimate of the dynamics that can be applied to many models and finetuned on task-specific dynamics. We achieve this by decomposing the learned mass matrix model $\Vec{H}$ into a \textit{task-agnostic} base $\Hat{\Hgt}$ and a small \textit{task-specific} residual $\Tilde{\Hgt}$. Learning the task-agnostic base function mitigates the original modeling burden of OSC, and learning a task-specific residual can reduce the domain shift problem by adapting to the current dynamics. We formulate our residual component $\Tilde{\Hgt}$ as a multiplicative residual outputting constrained scaling factors such that $\Vec{H}$ is the element-wise multiplication of $\Hat{\Hgt}$ and $\Tilde{\Hgt}$: \begin{equation} \Vec{H} = \Hat{\Hgt} \odot \Tilde{\Hgt}(\cdot; \phi), \quad ||\Tilde{\Hgt} - 1||_{\infty} < \epsilon, \quad |\epsilon| \: \text{small} \label{lmm} \end{equation} where $\Tilde{\Hgt}$ is parameterized by a multi-layered neural network similar to \textsc{DeLaN}\xspace, $\phi$ are the learned network weights, and $\odot$ is the element-wise multiplication operator. We choose this multiplicative structure instead of an additive one because we observe that the individual mass matrix elements span multiple orders of magnitude, thereby increasing the optimization difficulty for additive residuals whose outputs must similarly span such a large range of values. We provide joint states $\Vec{q}$, base estimate $\Hat{\Hgt}$, and latent extrinsics $\Vec{z}$ (Sec. \ref{sec:latent}) as the residual's inputs. $\Vec{z}$ is included because we observe that environment extrinsics are often unique to the task at hand, and do not necessarily generalize across domains. For this same reason, we choose to exclude the latent extrinsics dependency during the $\Hat{\Hgt}$ pretraining process, which is meant to capture task-agnostic information about the mass matrix. \input{fig-tasks} To enforce the residual's bounded influence, the residual neural network's output is passed sequentially through a scaled Tanh and Exponential layers. In this way, we can achieve a residual that is centered at 1 (no change to the base model) with symmetric log scale bounds. A final requirement is to ensure that both the positive definiteness of $\Vec{H}$ is preserved, and that $\Vec{H}$'s first-order partial derivative $\frac{\partial}{\partial \q}[\Vec{H}]$ can be analytically computed so that off-the-shelf auto-differentiation packages can still be used. The former is achieved by using a similar decomposition as $\Hat{\Hgt}$ and setting $\Tilde{\Hgt} = \Tilde{\Lgt} + \T{\Tilde{\Lgt}} + \Tilde{\Lgt}_d$, where $\Tilde{\Lgt}$ is a lower diagonal matrix with zeros along the diagonal and $\Tilde{\Lgt}_d$ is a sparse matrix with only non-zero elements along its diagonal. For the latter, $\frac{\partial}{\partial \q}[\Vec{H}]$ can be computed from Equation \eqref{lmm} using chain rule: \begin{equation} \frac{\partial}{\partial \q}[\Vec{H}] = \frac{\partial}{\partial \q}[\Hat{\Hgt}] \odot \Tilde{\Hgt} + \Hat{\Hgt} \odot \left(\frac{\partial}{\partial \q}[\Tilde{\Lgt}] + \frac{\partial}{\partial \q}[\T{\Tilde{\Lgt}}] + \frac{\partial}{\partial \q}[\Tilde{\Lgt}_d]\right) \label{eq:dhdq} \end{equation} By defining $\Tilde{\Lgt}$ and $\Tilde{\Lgt}_d$ as Lagrangian Layers~\cite{lutter2019delan}, we can tractably compute each of their first-order partial derivatives $\frac{\partial}{\partial \q}[(\cdot)]$ directly during the forward pass. We train our model using the same dynamics loss as \textsc{DeLaN}\xspace (Fig. \ref{fig:delan}). \subsection{Training \textsc{OSCAR}\xspace} We seek to decompose our model into a task-agnostic core for maximizing modeling efficiency and a task-specific residual for improved per-task fidelity. We achieve this by splitting learning into pretrain and train phases: \textit{Task-Agnostic Pretraining:} We first learn an initial estimate of the mass matrix $\Hat{\Hgt}$ from scratch by training the core \textsc{DeLaN}\xspace model in conjunction with a policy trained follow randomly generated straight line trajectories in free space. As this is intended to be a reference network, we do not utilize environment randomization nor end-effector masses in order to decouple these influences from initial dynamics learning. \textit{Task-Specific Training:} After pretraining, we discard the original policy and freeze the core \textsc{DeLaN}\xspace backbone. For a new task, we proceed to train our residual extrinsics-aware model in conjunction with a new policy to learn residual mass matrix $\Tilde{\Hgt}$ to better capture the task-specific dynamics. Our dynamics model runs at the same policy frequency (20Hz), and uses residual scaling limit of $\epsilon = 0.1$. \section{Experiments} \label{sec:exp} \input{fig-curves} \subsection{Experimental Setup} \textbf{Tasks.} We propose a set of simulated manipulation tasks that highlight the benefits of robust compliant control (Fig. \ref{fig:tasks}). All experiments are conducted using the Franka Panda robot. We implement our environments using Isaac Gym~\cite{mackoviychuk2021isaacgym}, a high-fidelity simulator that has been shown to enable simulation-to-real transfer learning to physical hardware~\cite{chebotar2018sim, narang2021sim2real}. \textit{Path Tracing:} The robot must follow a set of procedurally generated way-points defining a parameterized path. Sampled paths during training include circles of varying sizes with randomized positions and orientations. The robot also has a sealed container attached to its end-effector containing an unknown mass of randomized weight. Task observations include agent end-effector and goal poses. This task focuses on the robot's ability to accurately follow desired trajectories while being robust to varying impedance. \textit{Cup Pouring:} The robot holds a pitcher containing small particles and must carefully pour them into a cup located on the table while minimizing the amount of spillage. The cup's diameter, height, and position are randomized between episodes. Task observations include end-effector pose, pitcher tilt, cup position, cup radius, cup height, and the proportion of particles both in and outside of the cup. This task focuses on the robot's ability to respond to changing dynamics. \textit{Puck Pushing:} The robot must carefully push a puck between tables while avoiding knocking the puck off the platform. Task observations include end-effector pose, puck position and tilt, relative puck position to next path waypoint, and the proportion of the path completed. This task focuses on the robot's ability to adapt to sustained external contact. In all of the tasks, the robot's initial pose, joint friction, damping, armature, and minimum inertia are randomized between episodes. Specific parameters and reward functions can be found on our website. \input{tab-results_zero_shot} \textbf{Baselines.} We compare \textsc{OSCAR}\xspace against several baseline controllers, including joint-space options Joint Position, Joint Velocity, Joint Torque and task-space options Inverse Kinematics (IK), OSC (no VICES), OSC. Among these controllers, the joint-space controllers must operate in the highly nonlinear joint actuation, and IK cannot model compliance. The torque-based controller baselines are automatically provided with rough estimations of gravitational compensation torques $\tau_{cg} = \sum_{i=1}^{N} \T{\Vec{J}_{i}} m_{i}$, where $\Vec{J}_{i}$ is the Jacobian and $m_{i}$ is the mass for the $i$-th robot link. For \textsc{OSCAR}\xspace, $\tau_{cg}$ is generated directly from the learned dynamics model. In contrast, the IK, Joint Velocity, and Joint Position controllers do not operate in torque space, and so we disable gravity for these controllers. They have a distinct advantage over the torque-based controllers because their learned policies do not have to account for the dynamics influences from gravity. OSC baselines are provided the analytical mass matrix. whereas \textsc{OSCAR}\xspace does not have access to any analytical dynamics parameters from the robot model. \subsection{Performance: Train-Distribution Evaluation} We first consider the normal training performance of each controller on each task. We train our policies using PPO~\cite{schulman2017ppo} with 2048 parallelized environments using 3 random seeds, and utilize identical hyperparameters across all models for fair comparison (Fig. \ref{fig:tasks_train}). We find that OSC is often the strongest baseline across all tasks and consistently outperforms OSC without VICES. This result validates OSC's strengths as a task-space compliant controller and highlights the advantages of dynamically choosing compliance gains to enable policy adaptation to changing dynamics. \textsc{OSCAR}\xspace outperforms all baselines across all tasks, with significant improvements in the more complex Cup Pouring (over $\mathbf{90\%}$) and Puck Pushing tasks (over $\mathbf{60\%}$) compared to the next best baseline. This result indicates that policy learning is not hindered by the \textsc{OSCAR}\xspace's learned dynamics model, and in fact benefits from the learned task-specific dynamics. We also note that while the decomposition of $\Vec{\tau}_{cg}$ is not supervised during training, the learned values are sufficiently stable for \textsc{OSCAR}\xspace to succeed at each task and still significantly outperform other baselines. \subsection{Robustness: Out-of-Distribution Zero-Shot Evaluation} After training, we examine each trained model's robustness to novel task instances in a zero-shot setting. We modify each task's parameters to out-of-distribution combinations previously unseen during training. We maximize the influence of these extrinsics by setting dynamics parameters to their maximum training range values, and significantly increasing relevant masses over the training maximum value. We measure relevant success metrics for each task, and find that \textsc{OSCAR}\xspace is the most robust to policy degradation, outperforming the next best baseline by $\mathbf{63\%}$ on the Puck Pushing task and $\mathbf{3780\%}$ on the Cup Pouring task (Table \ref{tab:results_zero_shot}). These results show that \textsc{OSCAR}\xspace can be readily deployed in previously unseen dynamics while maintaining high task performance. \subsection{Adaptability: Out-of-Distribution Finetuning} Finally, we evaluate each model's ability to rapidly adapt to distribution shifts. In this experiment, we aggressively modify the task parameters and then allow each trained model to finetune under the new settings. To reflect more realistic transfer settings with limited resource bandwidth, we train using only 4 parallel environments instead of 2048 as before. We find that \textsc{OSCAR}\xspace re-converges much more quickly compared to all other baselines and also achieves over $\mathbf{500\%}$ for Cup Pouring and $\mathbf{90\%}$ for Puck Pushing performance improvements over the next best baseline (Fig. \ref{fig:tasks_train}). These results suggest that \textsc{OSCAR}\xspace helps overcome the exploration burden for difficult task instances by leveraging a previously trained model and further adapting it online. This property is appealing for task transfer, where \textsc{OSCAR}\xspace can leverage the advantages of large-scale simulations while quickly adjusting to new environment conditions in a sample-efficient manner. \subsection{Ablation Study} Lastly, we compare \textsc{OSCAR}\xspace against multiple ablative self-baselines on the Cup Pouring task to validate some key design decisions. We report both the training distribution performance and zero-shot out-of-distribution degradation (Table \ref{tab:ablation}). We find that while our model is marginally outperformed by some other variant during training, it is the most robust under zero-shot domain shift and results in $\mathbf{34.7\%}$ less degradation compared to the next strongest ablative model. These results validate the key modeling components of \textsc{OSCAR}\xspace: namely, the multiplicative residual (vs. additive), extrinsics encoder (vs. no extrinsics), and two-step task-agnostic task-specific method used (vs. using no residual and manipulating the base \textsc{DeLaN}\xspace structure instead). \input{tab-ablation} \section{Conclusion} We showcased \textsc{OSCAR}\xspace, a data-driven method online learning of dynamics parameters for OSC from scratch, removing OSC's modeling burden and accelerating simultaneous end-to-end training of a task policy and a dynamics model. We showed that compared to extensive baselines, \textsc{OSCAR}\xspace shows better performance during training, less degradation in zero-shot out-of-distribution, and better adaptation when finetuned under significant domain shifts. While we were only able to validate \textsc{OSCAR}\xspace's sim2sim transfer due to limited hardware access during the pandemic, we hope to soon evaluate on sim2real transfer and further develop our method as a means to deploying data-driven OSC control to real robots. \section{INTRODUCTION} This template provides authors with most of the formatting specifications needed for preparing electronic versions of their papers. All standard paper components have been specified for three reasons: (1) ease of use when formatting individual papers, (2) automatic compliance to electronic requirements that facilitate the concurrent or later production of electronic products, and (3) conformity of style throughout a conference proceedings. Margins, column widths, line spacing, and type styles are built-in; examples of the type styles are provided throughout this document and are identified in italic type, within parentheses, following the example. Some components, such as multi-leveled equations, graphics, and tables are not prescribed, although the various table text styles are provided. The formatter will need to create these components, incorporating the applicable criteria that follow. \section{PROCEDURE FOR PAPER SUBMISSION} \subsection{Selecting a Template (Heading 2)} First, confirm that you have the correct template for your paper size. This template has been tailored for output on the US-letter paper size. It may be used for A4 paper size if the paper size setting is suitably modified. \subsection{Maintaining the Integrity of the Specifications} The template is used to format your paper and style the text. All margins, column widths, line spaces, and text fonts are prescribed; please do not alter them. You may note peculiarities. For example, the head margin in this template measures proportionately more than is customary. This measurement and others are deliberate, using specifications that anticipate your paper as one part of the entire proceedings, and not as an independent document. Please do not revise any of the current designations \section{MATH} Before you begin to format your paper, first write and save the content as a separate text file. Keep your text and graphic files separate until after the text has been formatted and styled. Do not use hard tabs, and limit use of hard returns to only one return at the end of a paragraph. Do not add any kind of pagination anywhere in the paper. Do not number text heads-the template will do that for you. Finally, complete content and organizational editing before formatting. Please take note of the following items when proofreading spelling and grammar: \subsection{Abbreviations and Acronyms} Define abbreviations and acronyms the first time they are used in the text, even after they have been defined in the abstract. Abbreviations such as IEEE, SI, MKS, CGS, sc, dc, and rms do not have to be defined. Do not use abbreviations in the title or heads unless they are unavoidable. \subsection{Units} \begin{itemize} \item Use either SI (MKS) or CGS as primary units. (SI units are encouraged.) English units may be used as secondary units (in parentheses). An exception would be the use of English units as identifiers in trade, such as Ò3.5-inch disk driveÓ. \item Avoid combining SI and CGS units, such as current in amperes and magnetic field in oersteds. This often leads to confusion because equations do not balance dimensionally. If you must use mixed units, clearly state the units for each quantity that you use in an equation. \item Do not mix complete spellings and abbreviations of units: ÒWb/m2Ó or Òwebers per square meterÓ, not Òwebers/m2Ó. Spell out units when they appear in text: Ò. . . a few henriesÓ, not Ò. . . a few HÓ. \item Use a zero before decimal points: Ò0.25Ó, not Ò.25Ó. Use Òcm3Ó, not ÒccÓ. (bullet list) \end{itemize} \subsection{Equations} The equations are an exception to the prescribed specifications of this template. You will need to determine whether or not your equation should be typed using either the Times New Roman or the Symbol font (please no other font). To create multileveled equations, it may be necessary to treat the equation as a graphic and insert it into the text after your paper is styled. Number equations consecutively. Equation numbers, within parentheses, are to position flush right, as in (1), using a right tab stop. To make your equations more compact, you may use the solidus ( / ), the exp function, or appropriate exponents. Italicize Roman symbols for quantities and variables, but not Greek symbols. Use a long dash rather than a hyphen for a minus sign. Punctuate equations with commas or periods when they are part of a sentence, as in $$ \alpha + \beta = \chi \eqno{(1)} $$ Note that the equation is centered using a center tab stop. Be sure that the symbols in your equation have been defined before or immediately following the equation. Use Ò(1)Ó, not ÒEq. (1)Ó or Òequation (1)Ó, except at the beginning of a sentence: ÒEquation (1) is . . .Ó \subsection{Some Common Mistakes} \begin{itemize} \item The word ÒdataÓ is plural, not singular. \item The subscript for the permeability of vacuum ?0, and other common scientific constants, is zero with subscript formatting, not a lowercase letter ÒoÓ. \item In American English, commas, semi-/colons, periods, question and exclamation marks are located within quotation marks only when a complete thought or name is cited, such as a title or full quotation. When quotation marks are used, instead of a bold or italic typeface, to highlight a word or phrase, punctuation should appear outside of the quotation marks. A parenthetical phrase or statement at the end of a sentence is punctuated outside of the closing parenthesis (like this). (A parenthetical sentence is punctuated within the parentheses.) \item A graph within a graph is an ÒinsetÓ, not an ÒinsertÓ. The word alternatively is preferred to the word ÒalternatelyÓ (unless you really mean something that alternates). \item Do not use the word ÒessentiallyÓ to mean ÒapproximatelyÓ or ÒeffectivelyÓ. \item In your paper title, if the words Òthat usesÓ can accurately replace the word ÒusingÓ, capitalize the ÒuÓ; if not, keep using lower-cased. \item Be aware of the different meanings of the homophones ÒaffectÓ and ÒeffectÓ, ÒcomplementÓ and ÒcomplimentÓ, ÒdiscreetÓ and ÒdiscreteÓ, ÒprincipalÓ and ÒprincipleÓ. \item Do not confuse ÒimplyÓ and ÒinferÓ. \item The prefix ÒnonÓ is not a word; it should be joined to the word it modifies, usually without a hyphen. \item There is no period after the ÒetÓ in the Latin abbreviation Òet al.Ó. \item The abbreviation Òi.e.Ó means Òthat isÓ, and the abbreviation Òe.g.Ó means Òfor exampleÓ. \end{itemize} \section{USING THE TEMPLATE} Use this sample document as your LaTeX source file to create your document. Save this file as {\bf root.tex}. You have to make sure to use the cls file that came with this distribution. If you use a different style file, you cannot expect to get required margins. Note also that when you are creating your out PDF file, the source file is only part of the equation. {\it Your \TeX\ $\rightarrow$ PDF filter determines the output file size. Even if you make all the specifications to output a letter file in the source - if your filter is set to produce A4, you will only get A4 output. } It is impossible to account for all possible situation, one would encounter using \TeX. If you are using multiple \TeX\ files you must make sure that the ``MAIN`` source file is called root.tex - this is particularly important if your conference is using PaperPlaza's built in \TeX\ to PDF conversion tool. \subsection{Headings, etc} Text heads organize the topics on a relational, hierarchical basis. For example, the paper title is the primary text head because all subsequent material relates and elaborates on this one topic. If there are two or more sub-topics, the next level head (uppercase Roman numerals) should be used and, conversely, if there are not at least two sub-topics, then no subheads should be introduced. Styles named ÒHeading 1Ó, ÒHeading 2Ó, ÒHeading 3Ó, and ÒHeading 4Ó are prescribed. \subsection{Figures and Tables} Positioning Figures and Tables: Place figures and tables at the top and bottom of columns. Avoid placing them in the middle of columns. Large figures and tables may span across both columns. Figure captions should be below the figures; table heads should appear above the tables. Insert figures and tables after they are cited in the text. Use the abbreviation ÒFig. 1Ó, even at the beginning of a sentence. \begin{table}[h] \caption{An Example of a Table} \label{table_example} \begin{center} \begin{tabular}{|c||c|} \hline One & Two\\ \hline Three & Four\\ \hline \end{tabular} \end{center} \end{table} \begin{figure}[thpb] \centering \framebox{\parbox{3in}{We suggest that you use a text box to insert a graphic (which is ideally a 300 dpi TIFF or EPS file, with all fonts embedded) because, in an document, this method is somewhat more stable than directly inserting a picture. }} \caption{Inductance of oscillation winding on amorphous magnetic core versus DC bias magnetic field} \label{figurelabel} \end{figure} Figure Labels: Use 8 point Times New Roman for Figure labels. Use words rather than symbols or abbreviations when writing Figure axis labels to avoid confusing the reader. As an example, write the quantity ÒMagnetizationÓ, or ÒMagnetization, MÓ, not just ÒMÓ. If including units in the label, present them within parentheses. Do not label axes only with units. In the example, write ÒMagnetization (A/m)Ó or ÒMagnetization {A[m(1)]}Ó, not just ÒA/mÓ. Do not label axes with a ratio of quantities and units. For example, write ÒTemperature (K)Ó, not ÒTemperature/K.Ó \section{CONCLUSIONS} A conclusion section is not required. Although a conclusion may review the main points of the paper, do not replicate the abstract as the conclusion. A conclusion might elaborate on the importance of the work or suggest applications and extensions. \addtolength{\textheight}{-12cm} \section*{APPENDIX} Appendixes should appear before the acknowledgment. \section*{ACKNOWLEDGMENT} The preferred spelling of the word ÒacknowledgmentÓ in America is without an ÒeÓ after the ÒgÓ. Avoid the stilted expression, ÒOne of us (R. B. G.) thanks . . .Ó Instead, try ÒR. B. G. thanksÓ. Put sponsor acknowledgments in the unnumbered footnote on the first page. References are important to the reader; therefore, each citation must be complete and correct. If at all possible, references should be commonly available publications.
\section{Introduction} Deep neural networks (DNNs) have achieved great success recently in many different domains. Training DNNs requires solving large-scale non-convex optimization problems. This process is usually time consuming because of the fast increasing size of datasets and complexity of the network structures. As a result, researchers often wait for weeks or months for models to train. For example, finishing a 90-epoch ImageNet-1k ($1$ million training images in resolution $224 \times 224$) training with large scale ResNet (around $25.6$ million parameters) on a single NVIDIA Titan XP GPU takes over 10 days. To accelerate the training process, parallel and distributed processing is widely adopted in deep learning applications. A line of parallel solvers based on Stochastic Gradient Descent \cite{robbins1951stochastic}, or SGD for short, are proposed these years. \cite{zinkevich2010parallelized} first introduces a parallel variants of SGD called synchronous SGD. Theoretical analysis has shown that synchronous SGD with $P$ learners achieves a convergence rate of $O(1/\sqrt{NP})$ for solving non-convex optimization problems, where $N$ is the number of samples processed. In 2012, \cite{dean2012large} presents the Asynchronous SGD (Async-SGD). Different from its synchronous counterpart, each worker communicates with the parameter servers independently of the others when running Async-SGD, and thus, the communication cost is reduced. \cite{lian2015asynchronous} shows that Async-SGD (e.g., ~\cite{recht2011hogwild,KP15}) converges for non-convex objectives and achieves the same convergence rate when the staleness is bounded. In practice, however, Async-SGD is hard to implement because of the requirement of small learning rates and the difficulty in controlling the staleness. Recently, \cite{zhou2017convergence} introduces the K-step average SGD (K-AVG) which allows delayed gradient aggregation to minimize the communication overhead. In this algorithm, the communication interval $K$ is manually chosen. \cite{zhou2017convergence} theoretically and empirically verifies that the optimal $K\neq 1$ for many different cases. A large $K$ greatly reduces the communication cost. Thus, the negative impact on convergence caused by asynchrony can be avoided. Moreover, K-AVG scales better and allows larger learning rates than Async-SGD. Many machine learning models, however, are often trained using algorithms equipped with momentum such as Momentum SGD \cite{polyak1964some} where a weighted average of the previous update is added to the current gradient. For example, MSGD can achieve the best test accuracy for training ResNet for image classification tasks \cite{HZR16a}. \cite{ghadimi2016accelerated} show that MSGD is guaranteed to converge to the first order stationary point for non-convex objective. \cite{yang2016unified} provides a uniform framework to analyze the convergence of SGD with momentum for both convex and non-convex objectives. They further show that MSGD can achieve $O(1/\sqrt{N})$ convergence rate for non-convex objectives. Another line of research tends to study the reason behind the good performance of MSGD. \cite{wilson2016lyapunov} suggest that momentum accelerates computation by avoiding ``long ravines" and ``sharp curvatures" in the sub-level sets of cost function. \cite{liu2018toward} theoretically proves that MSGD can help avoid saddle points for the streaming PCA problem. \cite{ochs2015ipiasco} presents an illustrative example to show that the momentum can potentially avoid local minima. Recent years, people start to focus on the application of momentum in parallel computing both empirically and theoretically. Empirical study such as \cite{chen2016scalable,lin2018don} observe that momentum can improve the convergence and text accuracy for distributed training of neural networks. \cite{yu2019linear} considers a distributed communication efficient MSGD method and proving its linear speedup property. \cite{liu2018towards} shows that there is an acceleration trade-off between momentum and delay while using Async-MSGD. Based on the previous study, in this paper, we propose the Momentum Average SGD (M-AVG) algorithm to incorporate the advantage of momentum in K-AVG. Specifically, at the meta-level (global learner level), one momentum term is applied to add the weighted average of the previous update to the current one, while at each individual learner level, K-step SGD is implemented.We theoretically study the convergence property of M-AVG algorithm and compare it with K-AVG to show the positive impact of the momentum. The main advantage of adding momentum is the speed-up, i.e., with properly chosen step size, M-AVG can achieve same accuracy using less samples than K-AVG. At the same time, adding momentum will inherit the advantage of K-AVG in reducing optimization cost. In fact, our theoretical analysis and experimental result verify that the optimal $K$ is not equal to 1 even in the presence of the momentum parameter. Moreover, to ease the tuning process in practice, several tuning guidelines are included in the paper. Our main contributions are summarized as follows: \begin{itemize} \item We propose a new momentum method M-AVG and prove the convergence rate. \item We show that M-AVG can achieve faster convergence rate than K-AVG. \item Several useful tuning guidelines are provided to ease the implementation. \end{itemize} {\it Using an image recognition benchmark, we demonstrate the nice convergence properties of K-AVG in comparison to two popular ASGD implementations: Downpour [Dean et al., 2012] and EAMSGD [Zhang et al., 2015]. In EAMSGD, global gradient aggregation among learners simulates an elastic force that links the parameters they compute with a center variable stored by the parameter server. In both Downpour and EAMSGD, updates to the central parameter server can also have a K-step delay. On our target platform, when K is small, K-AVG significantly reduces the communication time in comparison to Downpour and EAMSGD while achieving similar training and test accuracies. The training time reduction is up to 5 much better training and test accuracies than Downpour and EAMSGD after the same amount of data samples are processed. For example, with 128 GPUs, K-AVG is up to about 7 and 2-6 times faster than Downpour and EAMSGD respectively, and achieves significantly better accuracy} The rest of the paper is organized as follows: In section 2, we introduce the M-AVG algorithm and the optimization problem we considered. Assumptions needed to analyze SGD methods is inclueded; In section 3, we formally the standard convergence results of M=AVG with fixed stepsize for non-convex objectives. Based on the convergence result, we analyze the speed up of M-AVG over K-AVG and investigate the optimal choice of K. Some useful tunning guidelines is provided in this section; In section 4, we present our experimental results to validate our analysis. Notations: Given a vector $ v = (v^{(1)}, \ldots, v^{(d)})^\top\in\RR^{d}$, we define the vector norm: $\norm{v}^2 = \sum_j(v^{(j)})^2$. $P$ denote s number of processors. $K$ denotes the length of the delay. $B_n$ or $B$ denotes the size of mini-batch. $\eta_n$ or $\eta$ denotes the step size. $\mu$ denotes the momentum parameter. $\xi_{k,s}^j$ denotes the i.i.d. realizations of a random variable $\xi$ generated by the algorithm on different processors and in different iterations, where $j=1,...,N$, $k=1,...,K,$ and $s=1,..,B.$ \section{Algorithm and Model} We propose to solve the following general non-convex minimization problems: \begin{align}\label{opt} \min_{\bw\in\cX}F(w), \end{align} where the objective $F:\RR^m\rightarrow R$ is a continuously differentiable non-convex function over $\cX\in \RR^m.$ Training deep neural networks is a special case of \eqref{opt}, where $F(\bw)=\frac{1}{n}\sum_{i=1}^n \ell (y_i,f(x_i,\bw))$ given $n$ observations denoted by $\{(x_i, y_i)\}_{i=1}^{n}$, where $x_i$ is the $i$-th input feature, $y_i$ is the response and $\ell$ is the loss function. We will impose the following regularity conditions on the objective $F,$ throughout our analysis. \begin{assumption}\label{assumption} \begin{itemize} \item $\nabla F$ is $L$-Lipschitz, i.e., $$\norm{\nabla F(x)-\nabla F(y)}_2\leq L\norm{x-y}_2,~~\forall x,y.$$ \item $F$ is lower bounded by a constant $F^*.$ \item Bounded Gradient: $\nabla F$ is bounded, i.e., there exists a constant $M$ such that $$\norm{\nabla F(x)}_2^2\leq M, ~~\forall x.$$ \item $F$ is bounded below by a constant $F^*.$ \item Unbiased Estimate: For any fixed parameter $\bw$, the stochastic gradient $\nabla F(\bw; \xi)$ is an unbiased estimator of the true gradient corresponding to the parameter $\bw$, namely, $$ \EE_{\xi} \nabla F(\bw; \xi) = \nabla F(\bw). $$ \item Bounded Variance: There exist a constant $\sigma \geq 0$ such that, $$ \EE_{\xi} \big\| \nabla F(\bw;\xi)\big\|_2^2 - \big\|\EE_{\xi} \nabla F(\bw;\xi) \big\|_2^2 \leq \sigma^2. $$ \end{itemize} \end{assumption} Same assumptions have been used in \cite{zhou2017convergence}. To solve problem \eqref{opt}, we propose the following M-AVG algorithm in Algorithm \ref{alg:avg} based on K-AVG algorithm. Specifically, Each learner runs mini-batch SGD for k steps and return the $k-th$ iteration to the server. Then at the meta level, th global learner average these returns, update the momentum and the weight estimation. Note that in Algorithm \ref{alg:avg}, $\bd$ is actually the product of K-step average gradient and the step size. If we denote $G_n=\frac{1}{B_n P}\sum_{j=1}^P\sum_{t=0}^{K-1}\sum_{s=1}^{B_n} \nabla F(\bw_{n+t}^j,\xi_{t,s}^j).$ Then the update of M-AVG algorithm can be written as \begin{align}\label{alg} \bv_{n+1}&=\mu \bv_n-\eta_n G_n,\\\nonumber \tilde{\bw}_{n+1}&=\tilde{\bw}_{n}+v_{n+1} \end{align} where $\mu$ is the momentum parameter and $\eta_n$ is the step size. We will use the update \eqref{alg} to carry on our theoretical analysis. We further note that since the momentum is added to the meta level, we call this momentum block momentum. We can also add momentum to the learner level. \begin{algorithm} initialize $\widetilde{\bw}_1$;\\ $v\leftarrow0;$\\ \For{$n=1,...,N$}{ Processor $P_j$, $j=1,\dots,P$ do concurrently:\\ set $\bw_n^j=\widetilde{\bw}_n$ ;\\ \For{$k=1,...,K$}{ randomly sample a mini-batch of size $B_n$ and update: $$ \bw_{n+k}^j = \bw_{n+k-1}^j - \frac{\gamma_n}{B_n} \sum\limits_{s=1}^{B_n} \nabla F(\bw_{n+k-1}^j;\xi_{k,s}^j) $$ } $\ba\leftarrow\frac{1}{P}\sum_{j=1}^P \bw_{n+K}^j$;\\ $\bd\leftarrow\ba-\widetilde{\bw}_{n} $;\\ $\bv \leftarrow \mu \bv +d$;\\ $\widetilde{\bw}_{n+1} = \widetilde{\bw}_{n}+\bv$;\\ } \caption{M-AVG Algorithm} \label{alg:avg} \end{algorithm} \section{Main Results} \subsection{Convergence of M-AVG} We study the convergence of M-AVG algorithm. In Theorem \ref{thm}, we show that the algorithm can converge to first order stationary point. We present the upper bound on the expected average squared gradient norms. \begin{theorem}\label{thm} Under Assumption \ref{assumption}, suppose Algorithm \ref{alg:avg} is run with fixed step size $\eta>0,$ batch size $B>0$ and momentum parameter $\mu\in[0,1)$ such that the following condition holds. $$1\geq \frac{L^2\eta^2(K+1)(K-2)}{2(1-\mu)^2}+\frac{2\eta LK}{1-\mu}$$ and $$1-\delta\geq L^2\eta^2/(1-\mu)^2,$$ for some constant $\delta\in(0,1).$ Then the expected average squared gradient norms of $F$ satisfy the following bounds for all $N\in \NN:$ \begin{align}\label{ineq_thm} \frac{1}{N} \sum_{i=1}^{N}\EE\big\| \nabla& F(\widetilde{\bw}_{i})\big\|_2^2\leq \frac{2(1-\mu)(F(w_{1})-F^*)}{N(K-1+\delta)\eta}\notag\\&+\frac{L^2\eta^2\sigma^2(2K-1)K(K-1)}{6(K-1+\delta)B(1-\mu)^2}\notag\\ &+\frac{2LK^2\sigma^2 \eta}{PB(K-1+\delta)(1-\mu)}\left(1+\frac{\mu^2}{2(1-\mu)^2}\right)\notag\\&+\frac{L\eta\mu^2K^2M}{(K-1+\delta)(1-\mu)^3}. \end{align} \end{theorem} \begin{remark} Note that when $\mu=0$, M-AVG is reduced to $K-AVG$. Our Theorem \ref{thm} is also a generalization of Theorem 3.1 in \cite{zhou2017convergence}. In fact, take $\mu=0$ in \ref{ineq_thm}, the right hand side is equivalent to that of (3.2) in \cite{zhou2017convergence}. \end{remark} \begin{proof} The proof follows the proof idea in \cite{yang2016unified}. Since M-AVG shares the same learner level procedure with K-AVG, some important results in \cite{zhou2017convergence} will also be used in our proof. Define an auxiliary sequence $z_{n}=\tilde{w}_{n}+\frac{\mu}{1-\mu} v_{n}.$ Then $z$ is updated as follows: \begin{align}\label{z_update} z_{n+1}=z_n-\frac{\eta_n}{1-\mu} G_n. \end{align}Recall that $\nabla F$ is $L$-Lipschitz, thus we have for any $x, y,$ the following inequality holds. \begin{align}\label{Lip_ineq} F(y)\leq F(x)+\nabla F(x)^\top(y-x)+\frac{L}{2}\norm{y-x}_2^2. \end{align} Combine \eqref{z_update} and \eqref{Lip_ineq} together, we get \begin{align}\label{bound1} &F(z_{n+1})-F(z_n)\notag\\\leq& \nabla F(z_n)^\top(z_{n+1}-z_{n})+\frac{L}{2}\frac{\eta_n^2}{(1-\mu)^2}\norm{G_n}_2^2\notag\\ \leq& -\frac{\eta_n}{1-\mu}\nabla F(z_n)^\top G_n+\frac{L}{2}\frac{\eta_n^2}{(1-\mu)^2}\norm{G_n}_2^2\notag\\ =&-\frac{\eta_n}{1-\mu}\left(\nabla F(z_n)-\nabla F(\tilde{\bw}_n)\right)^\top G_n\notag\\&-\frac{\eta_n}{1-\mu}\nabla F(\tilde{\bw}_n)^\top G_n+\frac{L}{2}\frac{\eta_n^2}{(1-\mu)^2}\norm{G_n}_2^2\notag\\ \leq& \frac{1}{2L} \norm{\nabla F(z_n)-\nabla F(\tilde{\bw}_n)}_2^2+\frac{L}{2}\frac{\eta_n^2}{(1-\mu)^2}\norm{G_n}_2^2\notag\\&-\frac{\eta_n}{1-\mu}\nabla F(\tilde{\bw}_n)^\top G_n+\frac{L}{2}\frac{\eta_n^2}{(1-\mu)^2}\norm{G_n}_2^2\notag\\ =&\frac{1}{2L} \norm{\nabla F(z_n)-\nabla F(\tilde{\bw}_n)}_2^2-\frac{\eta_n}{1-\mu}\nabla F(\tilde{\bw}_n)^\top G_n\notag\\&~~~~+\frac{L\eta_n^2}{(1-\mu)^2}\norm{G_n}_2^2. \end{align} We only need bound the three terms on the left hand side of \eqref{bound1}. We start from the first term. By the Lipschitz continuity of $\nabla F,$ we have \begin{align*} \frac{1}{2L}\norm{\nabla F(z_n)-\nabla F(w_n)}_2^2&\leq \frac{L}{2}\norm{z_n-w_n}_2^2\\&=\frac{L}{2}\frac{\mu^2}{(1-\mu)^2}\norm{v_n}_2^2. \end{align*} Thus, we only need bound the norm of $v_n.$ Denote $\Gamma_{n-1}=\sum_{i=0}^{n-1}{\mu^i }=\frac{1-\mu^n}{1-\mu}\leq\frac{1}{1-\mu}.$ We can rewrite $v_n$ as the weighted sum of $\{G_i\}_{i=0}^{n-1}.$ Specifically, we have \begin{align*} v_n=\mu v_{n-1}-\eta_{n-1} G_{n-1}=\sum_{i=0}^{n-1}{\mu^i \eta_{n-i} G_{n-i}}. \end{align*} Then, the expected norm of $v_n$ can be bounded as follows. \begin{align*} \EE \norm{v_n}_2^2&=\EE \norm{\sum_{i=0}^{n-1}{\mu^i \eta_{n-i} G_{n-i}}}_2^2\\&=\Gamma_{n-1}^2\EE \norm{\sum_{i=0}^{n-1}{\frac{\mu^i}{\Gamma_{n-1}} \eta_{n-i} G_{n-i}}}_2^2\notag \\&\leq\Gamma_{n-1}^2{\sum_{i=0}^{n-1}{\frac{\mu^i}{\Gamma_{n-1}} \eta_{n-i} ^2\EE \norm{G_{n-i}}_2^2}}\\&=\Gamma_{n-1}{\sum_{i=0}^{n-1}{{\mu^i} \eta_{n-i} ^2\EE\norm{G_{n-i}}_2^2}}. \end{align*} By the bounded gradient and variance assumption, we have \begin{align}\label{normbound} \EE \norm{G_{n-i}}_2^2&=\EE \norm{\frac{1}{B P}\sum_{j=1}^P\sum_{t=0}^{K-1}\sum_{s=1}^{B} \nabla F(\bw_{n-i+t}^j,\xi_{t,s}^j)}_2^2\notag\\ &\leq \frac{K}{P^2B^2}\sum_{t=0}^{K-1}\EE \norm{\sum_{j=1}^P\sum_{s=1}^{B} \nabla F(\bw_{n-i+t}^j,\xi_{t,s}^j)}_2^2\notag\\ &\leq \frac{K}{P^2B^2}\sum_{t=0}^{K-1}\EE \norm{\sum_{j=1}^P\sum_{s=1}^{B} \Big(\nabla F(\bw_{n-i+t}^j,\xi_{t,s}^j)\notag\\ &-\nabla F(\bw_{n-i+t}^j)+\nabla F(\bw_{n-i+t}^j)\Big)}_2^2\notag\\ &\leq \frac{K^2 \sigma^2}{PB}+K\sum_{t=0}^{K-1}\EE\norm{\nabla F(\bw_{n-i+t}^j)}_2^2\notag\\ &\leq \frac{K^2 \sigma^2}{PB}+K^2M. \end{align} Thus, we have the bound of $\EE \norm{v_n}_2^2.$ \begin{align*} \EE \norm{v_n}_2^2&\leq\Gamma_{n-1}{\sum_{i=0}^{n-1}{{\mu^i} \eta_{n-i} ^2\EE\norm{G_{n-i}}_2^2}}\\&\leq \Gamma_{n-1}{\sum_{i=0}^{n-1}{{\mu^i} \eta_{n-i} ^2\left(\frac{K^2 \sigma^2}{PB}+K^2M\right)}}\\&\leq \frac{\eta^2}{(1-\mu)^2}\left(\frac{K^2 \sigma^2}{PB}+K^2M\right). \end{align*} Then we have the bound of the first term. \begin{align}\label{term1bound} &\frac{1}{2L}\norm{\nabla F(z_n)-\nabla F(w_n)}_2^2\notag\\\leq& \frac{L}{2}\frac{\mu^2}{(1-\mu)^2}\frac{\eta^2}{(1-\mu)^2}\left(\frac{K^2 \sigma^2}{PB}+K^2M\right). \end{align} For the second on the right hand side of \eqref{bound1}, the proof follows that of Theorem 3.1 in \cite{zhou2017convergence}. We first expend $G_n$ in the second term as follows. \begin{align*} &-\frac{\eta_n}{1-\mu} \nabla F(\tilde{\bw}_n)^\top G_n\\ =&-\frac{\eta_n}{1-\mu}\nabla F(\tilde{\bw}_n)^\top \left(\frac{1}{B_n P}\sum_{j=1}^P\sum_{t=0}^{K-1}\sum_{s=1}^{B_n} \nabla F(\bw_{n+t}^j,\xi_{t,s}^j)\right)\\ =&-\frac{\eta_n}{1-\mu}\frac{1}{B_n P}\sum_{j=1}^P\sum_{t=0}^{K-1}\sum_{s=1}^{B_n} \nabla F(\tilde{\bw}_n)^\top \nabla F(\bw_{n+t}^j,\xi_{t,s}^j). \end{align*} Given $\tilde \bw_n,$ for fixed $j$ and $t,$ by the tower property of conditional expectation, we have \begin{align*} &\frac{1}{B_n}\sum_{s=1}^{B_n} \EE\nabla F(\tilde{w}_n)^\top \nabla F(\bw_{n+t}^j,\xi_{t,s}^j)\\=&\frac{1}{B_n}\sum_{s=1}^{B_n}\EE\left[\EE\left[ F(\tilde{w}_n)^\top \nabla F(\bw_{n+t}^j,\xi_{t,s}^j)|\bw_{n+t}^j\right]\right]\\ =&\EE\left[F(\tilde{w}_n)^\top \nabla F(\bw_{n+t}^j)\right]. \end{align*} Moreover, given $\tilde \bw_n,$ since noise $\xi's$ are i.i.d, and for each $j,$ $\bw_{n+t}^j$ follows the same updated rule, which implies for any fixed t, $ \nabla F(\bw_{n+t}^j)'s$ are i.i.d. Thus, we get rid of the summation over $j$ as follows. \begin{align*} &\frac{1}{P}\sum_{j=1}^P\frac{1}{B_n}\sum_{s=1}^{B_n} \EE\nabla F(\tilde{w}_n)^\top \nabla F(\bw_{n+t}^j,\xi_{t,s}^j)\\=&\frac{1}{P}\sum_{j=1}^P\EE\left[F(\tilde{w}_n)^\top \nabla F(\bw_{n+t}^j)\right]=\EE\left[F(\tilde{w}_n)^\top \nabla F(\bw_{n+t}^j)\right]. \end{align*} Together with bound (3.14) in \cite{zhou2017convergence}, we get the bound of the expectation of the second term. \begin{align}\label{term2bound} &\EE\left[-\frac{\eta_n}{1-\mu}\nabla F(\tilde{\bw}_n)^\top G_n\right]\notag\\\leq&-\frac{(K+1)\eta_n}{2(1-\mu)}\Big(1-\frac{L^2\eta_n^2K(K-1)}{2(1-\mu)^2(K+1)} \Big) \big\| \nabla F(\widetilde{\bw}_{n})\big\|_2^2\notag\\ & -\frac{\eta_n}{2(1-\mu)}\Big( 1- \frac{L^2\eta_n^2(K+1)(K-2)}{2(1-\mu^2)}\Big)\sum\limits_{t=1}^{K-1}\EE\Big\|\nabla F(\bw_{n+t}^j)\Big\|_2^2\notag\\&+\frac{L^2\eta_n^3\sigma^2(2K-1)K(K-1)}{12B(1-\mu)^3}. \end{align} Following similar lines to \eqref{normbound}, we get the bound of the expectation of the last term. \begin{align}\label{term3bound} &\frac{L\eta_n^2}{(1-\mu)^2}\EE \norm{G_n}_2^2\notag\\ \leq & \frac{LK^2\sigma^2 \eta_n^2}{PB(1-\mu)^2}+\frac{\eta_n^2LK}{(1-\mu)^2}\sum\limits_{t=0}^{K-1}\EE\Big\|\nabla F(\bw_{n+t}^j)\Big\|_2^2\notag\\ \leq & \frac{LK^2\sigma^2 \eta_n^2}{PB(1-\mu)^2}+\frac{\eta_n^2LK}{(1-\mu)^2}\sum\limits_{t=1}^{K-1}\EE\Big\|\nabla F(\bw_{n+t}^j)\Big\|_2^2\notag\\&+\frac{\eta_n^2LK}{(1-\mu)^2}\| \nabla F(\widetilde{\bw}_{n})\big\|_2^2. \end{align} Combine \eqref{term2bound}, \eqref{term3bound} and \eqref{term1bound} together, and we have \begin{align*} &\EE\{F(z_{n+1})-F(z_n)\}\notag\\\leq& -\frac{(K+1)\eta}{2(1-\mu)}C_1 \EE\big\| \nabla F(\widetilde{\bw}_{n})\big\|_2^2\notag\\ &-\frac{\eta}{2(1-\mu)}C_2\sum\limits_{t=1}^{K-1}\EE\Big\|\nabla F(\bw_{n+t}^j)\Big\|_2^2\notag\\&+\frac{L^2\eta^3\sigma^2(2K-1)K(K-1)}{12B(1-\mu)^3}\notag\\&+\frac{LK^2\sigma^2 \eta^2}{PB(1-\mu)^2}\left(1+\frac{\mu^2}{2(1-\mu)^2}\right)+\frac{L\eta^2\mu^2K^2M}{2(1-\mu)^4},\notag\\ \end{align*} where $C_1=1-\frac{L^2\eta^2K(K-1)}{2(1-\mu)^2(K+1)}-\frac{2\eta LK}{(1-\mu)(K+1)},$ $C_2= 1- \frac{L^2\eta^2(K+1)(K-2)}{2(1-\mu^2)}-\frac{2\eta LK}{1-\mu}.$ Under the condition $1\geq \frac{L^2\eta^2(K+1)(K-2)}{2(1-\mu)^2}-\frac{2\eta LK}{1-\mu},$ i.e., $C_1\geq 0,$ the second term on the right hand side can be discarded. At the same time, the above condition also yields the following inequality. $$\frac{L^2\eta^2K(K-1)}{2(1-\mu)^2(K+1)}+\frac{2\eta LK}{(1-\mu)(K+1)}\geq \frac{K- L^2\eta^2/(1-\mu)^2}{K+1}.$$ For some $\delta\in(0,1)$ such that $1-\delta\geq L^2\eta^2/(1-\mu)^2,$ we have \begin{align*} &\EE\{F(z_{n+1}) F(z_n)\}\notag\\\leq &-\frac{(K-1+\delta)\eta}{2(1-\mu)} \EE\big\| \nabla F(\widetilde{\bw}_{n})\big\|_2^2+\frac{L^2\eta^3\sigma^2(2K-1)K(K-1)}{12B(1-\mu)^3}\notag\\&+\frac{LK^2\sigma^2 \eta^2}{PB(1-\mu)^2}\left(1+\frac{\mu^2}{2(1-\mu)^2}\right)+\frac{L\eta^2\mu^2K^2M}{2(1-\mu)^4}. \end{align*} The above inequality holds for all $i=1,1,...,N$ sum them together and we get \begin{align*} &\EE\{F(z_{N+1})-F(z_1)\}\notag\\\leq &-\frac{(K-1+\delta)\eta}{2(1-\mu)} \sum_{i=1}^{N}\EE\big\| \nabla F(\widetilde{\bw}_{i})\big\|_2^2\notag\\&+\frac{NL^2\eta^3\sigma^2(2K-1)K(K-1)}{12B(1-\mu)^3}\notag\\&+\frac{NLK^2\sigma^2 \eta^2}{PB(1-\mu)^2}\left(1+\frac{\mu^2}{2(1-\mu)^2}\right)+\frac{NL\eta^2\mu^2K^2M}{2(1-\mu)^4}, \end{align*} which is equivalent to \begin{align*} &\frac{(K-1+\delta)\eta}{2(1-\mu)} \sum_{i=1}^{N}\EE\big\| \nabla F(\widetilde{\bw}_{i})\big\|_2^2\notag\\\leq& \EE\{F(z_{1})-F(z_{N+1})\}+\frac{NL^2\eta^3\sigma^2(2K-1)K(K-1)}{12B(1-\mu)^3}\notag\\&+\frac{NLK^2\sigma^2 \eta^2}{PB(1-\mu)^2}\left(1+\frac{\mu^2}{2(1-\mu)^2}\right)+\frac{NL\eta^2\mu^2K^2M}{2(1-\mu)^4}\\ \leq&\EE\{F(z_{1})-F^*\}+\frac{NL^2\eta^3\sigma^2(2K-1)K(K-1)}{12B(1-\mu)^3}\notag\\&+\frac{NLK^2\sigma^2 \eta^2}{PB(1-\mu)^2}\left(1+\frac{\mu^2}{2(1-\mu)^2}\right)+\frac{NL\eta^2\mu^2K^2M}{2(1-\mu)^4}. \end{align*} Note that $z_1=w_1$ implies $\EE\{F(z_{1})-F^*\}=F(w_{1})-F^* .$ Multiply each hand side by $\frac{2(1-\mu)}{N(K-1+\delta)\eta},$ we have \begin{align*} \frac{1}{N} \sum_{i=1}^{N}\EE\big\| \nabla& F(\widetilde{\bw}_{i})\big\|_2^2\leq \frac{2(1-\mu)(F(w_{1})-F^*)}{N(K-1+\delta)\eta}\notag\\&+\frac{L^2\eta^2\sigma^2(2K-1)K(K-1)}{6(K-1+\delta)B(1-\mu)^2}\notag\\ &+\frac{2LK^2\sigma^2 \eta}{PB(K-1+\delta)(1-\mu)}\left(1+\frac{\mu^2}{2(1-\mu)^2}\right)\notag\\&+\frac{L\eta\mu^2K^2M}{(K-1+\delta)(1-\mu)^3}. \end{align*} \end{proof} We have the following observations based on the upper bound \ref{ineq_thm}. \begin{itemize} \item Convergence to $\epsilon-$optimal solution: Note that the first term on the right hand side of \eqref{ineq_thm} goes to zero as $N\rightarrow\infty,$ while the other term remains unchanged during updating. If we let $\eta\rightarrow 0,$ these terms will vanish. Thus, M-AVG can achieve $\epsilon-$optimal solution where $\epsilon$ can be any positive number given small enough $\eta$ and large $N.$ \item Momentum accelerates convergence but hurts accuracy: The first term is reduced by a factor $1-\mu$ which means M-AVG converges faster than K-AVG. However, adding momentum shows an adverse impact on the final convergence, since the other terms are increased. This observation is constant to that in \cite{liu2018toward}. \item Different from K-AVG, the bound of M-AVG has an additional term $ \frac{L\eta\mu^2K^2M}{(K-1+\delta)(1-\mu)^3}$ which is not affected by $P$ and $B$. This is the additional variance induced by the momentum and can only be controlled by the step size. Thus, adding momentum usually requires a small step size. to guarantee the convergence. \end{itemize} \subsection{Comparison with K-AVG} \noindent $\bullet$ Speed Up: Theorem \ref{thm} demonstrates that M-AVG can converge to the $\epsilon-$optimal solution and accelerate the convergence speed. However, as a con of momentum, the final accuracy is increased. A simple question is under the same hyper-parameter tuples $(N,K,P,B),$ does adding momentum leads to a better estimate? In other words, given a target accuracy, does M-SGD achieve it faster than K-AVG? Lemma \ref{lem_opt_mu} provides a positive answer. It shows that under certain conditions, the optimal momentum parameter $\mu$ to minimize the upper bound obtained in Theorem \ref{thm} is non-zero . \begin{lemma}\label{lem_opt_mu} Under Assumption \ref{assumption}, suppose Algorithm is run with fixed step size $\eta>0,$ batch size $B>0,$ number of learners $P>0a$ for $N$ meta iterations, such that $$ 1> \frac{L^2\eta^2(K+1)(K-2)}{2}+{2\eta LK}$$ and\ $$ 1-\delta> L^2\eta^2, $$ for some constant $\delta\in(0,1).$ When the following conditions hold, $$\eta^2< \frac{B(F(w_{1})-F^*)}{5LN\sigma^2(5/P+6L)}~\text{and}~ K\leq 5$$ or $$1> \frac{N\sigma^2}{2B(F(w_{1})-F^*)}(\frac{1}{2LP}+\frac{1}{L})~\text{and}~ K> 5,$$ we have $$\mu_\text{optimal}>0.$$ \end{lemma} \begin{proof} Details are omitted to conserve space. \end{proof} Lemma \ref{lem_opt_mu} justify that adding momentum does improve the performance of K-AVG under same hyper parameters. The next lemma show that M-AVG running $N$ steps can achieve better upper bound than K-AVG running $1/(1-\mu/2)$ steps. For notational simplicity, let the upper bound in Theorem \ref{thm} be $ g(\mu,N,\eta;P,B,K),$ i.e., \begin{align*} &g(\mu,N,\eta;P,B,K)\\=& \frac{2(1-\mu)(F(w_{1})-F^*)}{N(K-1+\delta)\eta}\notag\\&+\frac{L^2\eta^2\sigma^2(2K-1)K(K-1)}{6(K-1+\delta)B(1-\mu)^2}\notag\\ &+\frac{2LK^2\sigma^2 \eta}{PB(K-1+\delta)(1-\mu)}\left(1+\frac{\mu^2}{2(1-\mu)^2}\right)\notag\\&+\frac{L\eta\mu^2K^2M}{(K-1+\delta)(1-\mu)^3}. \end{align*} \begin{lemma}\label{lem_more_N} Suppose M-AVG is run with fixed $\mu>0,$ $N,$ $\eta,$ $P,$ $B,$ $K$ such that $$1\geq \frac{L^2\eta^2(K+1)(K-2)}{2(1-\mu)^2}+\frac{2\eta LK}{1-\mu}$$ and $$1-\delta\geq L^2\eta^2/(1-\mu)^2,$$ for some constant $\delta\in(0,1).$ Then under the following condition, $$\eta<\sqrt{ \frac{PB(F(w_{1})-F^*)(1-\mu)^3}{2NKC_3}},$$ where $C_3=2{LK\sigma^2 }+{PL^2\sigma^2(2K-1)(K-1)}+{L KMPB},$ we have $$ g(\mu,N,\eta;P,B,K)<g(0,\frac{1}{1-\frac{\mu}{2}}N,\eta;P,B,K).$$ \end{lemma} \begin{proof} Details are omitted to conserve space. \end{proof} We remark that here $1-\mu/2$ can be replaced by any $1-\alpha \mu$ where $\alpha\in (0,1).$ When $\alpha$ is large, a smaller $\eta$ is required. Lemma \ref{lem_more_N} explicitly show the advantage of M-AVG over K-AVG in terms of convergence speed. This $1-\alpha\mu$ improvement is consistent with the finding in \cite{liu2018toward}. Moreover, this improvement can be seen from the update \eqref{z_update} of the auxiliary sequence. In fact, $z$ can be viewed as the K-AVG update using a larger step size, which leads to a $(1-\alpha \mu)$ faster convergence speed according to Theorem 3.1 in \cite{zhou2017convergence}. \noindent $\bullet$ Optimal $K$ is not 1: One important advantage of K-AVG is that frequent averaging is not necessary and the optimal $K$ is proved to be large than 1, which greatly lower the communication cost. We next show that for many cases, this advantage will be inherited even after adding momentum. We consider the same case as in \cite{zhou2017convergence} where the amount of samples processed $N \times K$ is constant, which means that the computational time remains as a constant given a fixed number of processors. We then have the following lemma. \begin{lemma}\label{opt_k_positive} Let $S=N*K,$ be a constant. Suppose the Algorithm 1 is run with a fixed step size $\eta,$ a fixed batch size $B,$ and a fixed number of processors $P.$ Suppose for a fixed $\mu\geq0,$ the optimal frequency is $K_{opt}(\mu).$ Then under the following condition, \begin{align}\label{conditionk} &\frac{1-\delta}{\delta}\frac{(F(w_{1})-F^*)}{S\eta}>\frac{1}{(1-\mu)^3}\frac{L^2\eta^2\sigma^2}{2B}\notag\\&~~+\frac{1}{(1-\mu)^2}\frac{3\delta-1}{2\delta}\left(\frac{\mu^2}{(1-\mu)^2}(\frac{L\sigma^2 \eta}{PB}+{L\eta M})+\frac{2L\sigma^2 \eta}{PB}\right), \end{align} we have $$K_{opt}(\mu)>1.$$ \end{lemma} \begin{proof} Details are omitted to conserve space. \end{proof} Our experiment further shows that the optimal $K$ can be very large such as 32, 64. Thus, M-AVG with large $K$ also enjoys the low communication cost property. Note that condition \eqref{conditionk} requires $(F(w_{1})-F^*)$ to be larger than in Theorem 3.4 in \cite{zhou2017convergence}. Intuitively, Less averaging and adding momentum both increase the variance, which is only preferred far away from the global solution. As a result, M-AVG need the initialization to be further than K-AVG. \subsection{Tuning guidelines} We have shown M-AVG can achieve great performance. However, since M-AVG has 5 hyper parameters $(P,B,K,\eta,\mu)$ which need tuning, it is still difficult to achieve the best performance of M-AVG in practice without any guidelines. In this section we provide two tuning guidelines theoretically to ease the work or practitioners. \noindent $\bullet$ More processors available (Increase P): A nature question is if we have more processors, how to change $\mu$ accordingly. Let the original number of processors be $P_0.$ We consider the case that the total number of samples processed $N*P*B*K$ is a constant and $B,K$ are fixed. We remark that, in the following discussion, we assume the condition in Theorem \ref{thm} holds, i.e., $$1\geq \frac{L^2\eta^2(K+1)(K-2)}{2(1-\mu)^2}-\frac{2\eta LK}{1-\mu}$$and $$1-\delta\geq L^2\eta^2/(1-\mu)^2,$$ hold for some $\delta\in(0,1).$ We then have the following lemma. \begin{lemma}\label{lem_increase_P} Let $S=N*P*B*K,$ be a constant. Suppose the Algorithm 1 is run with a fixed step size $\eta,$ a fixed batch size $B,$ and a fixed frequency $K.$ Suppose for $P=P_0,$ the optimal momentum parameter is $\mu_0^*.$ If the number of processors is increased from $P_0$ to $\lambda P_0,$ where $\lambda>1,$ the momentum parameter $\mu_{\lambda}^*$ satisfies $$\mu_{\lambda}^*>\mu_0^*.$$ \end{lemma} \begin{proof} Details are omitted to conserve space. \end{proof} Intuitively, increasing number of processors will decrease the noise in the average stochastic gradient. Thus, M-AVG can tolerate more variance from a larger momentum. At the same time, since the number of meta iterations decrease, a larger momentum also helps improve the performance. \noindent $\bullet$ Switch From K-AVG to M-AVG: We next show that adding momentum can decrease the optimal $K.$ We consider the same setting as in Lemma \ref{opt_k_positive}. \begin{lemma}\label{opt_k} Let $S=N*K,$ be a constant. Suppose the Algorithm 1 is run with a fixed step size $\eta,$ a fixed batch size $B,$ and a fixed number of processors $P.$ Suppose for a fixed $\mu\geq0,$ the optimal frequency is $K_{opt}(\mu).$ Then under the following condition, \begin{align} &\frac{1-\delta}{\delta}\frac{(F(w_{1})-F^*)}{S\eta}>\frac{1}{(1-\mu)^3}\frac{L^2\eta^2\sigma^2}{2B}\notag\\&~~+\frac{1}{(1-\mu)^2}\frac{3\delta-1}{2\delta}\left(\frac{\mu^2}{(1-\mu)^2}(\frac{L\sigma^2 \eta}{PB}+{L\eta M})+\frac{2L\sigma^2 \eta}{PB}\right), \end{align} we have $$K_{opt}(\mu)\leq K_{opt}(0).$$ \end{lemma} As we discussed after Lemma \ref{opt_k_positive}, frequent averaging and momentum both increase the variance, and thus are conflict. As a direct result, we need to decrease $K$ when $\mu$ is increased. Both of these two tuning guidelines will be empirically verified in Section \ref{experiment}. There are many other cases that worth consideration. Due to space limit, we only present these two and leave others to our future research. \section{Experiment}\label{experiment} We experiment on a cluster of IBM Power9 CPUs with NVIDIA Volta100 GPUs connected with Infiniband. We use Spectrum-MPI for communication. All algorithms are implemented with PyTorch~\cite{PGC17}. We test our implementation with image classification using the \emph{CIFAR-10}\xspace data set and the \emph{ImageNet-1K}\xspace data set. \subsection{MAVG\xspace accelerates convergence} We first demonstrate that MAVG\xspace accelerates convergence using a range of neural network models with the \emph{CIFAR-10}\xspace data set. The 7 state-of-art neural network models we use in our study are: \emph{ResNet-18}\xspace~\cite{HZR16a}, \emph{DenseNet}\xspace~\cite{HLW16}, \emph{SENet}\xspace~\cite{HSS17}, \emph{GoogLeNet}\xspace~\cite{SLJ14}, \emph{MoibleNet}\xspace~\cite{HZC17}, \emph{PreActResNet-18}\xspace~\cite{HZR16a}, and \emph{DPN}\xspace~\cite{CLX17}. They represent some of the most advanced convolution neural network (CNN) architectures used in current computer vision tasks. Figures~\ref{fig:resnet-train},~\ref{fig:preact-train},~\ref{fig:googlenet-train},~\ref{fig:mobilenet-train},~\ref{fig:mobilenet-train},~\ref{fig:dpn92-train},~\ref{fig:senet-train} show the evolution of training accuracies for KAVG\xspace and MAVG\xspace. In the figure, the labels \emph{res}, \emph{pre}, \emph{goo}, \emph{den}, \emph{mob}, \emph{dpn}, and \emph{sen} are for \emph{ResNet-18}\xspace, \emph{PreActResNet-18}\xspace, \emph{GoogLeNet}\xspace, \emph{DenseNet}\xspace, \emph{MoibleNet}\xspace, \emph{DPN}\xspace, and \emph{SENet}\xspace, respectively. \begin{figure}[h] \centering \includegraphics[width=.50\textwidth]{./data/resnet18-train.eps} \caption{\emph{ResNet-18}\xspace} \label{fig:resnet-train} \end{figure} \begin{figure}[h] \centering \includegraphics[width=.50\textwidth]{./data/preactresnet18-train.eps} \caption{\emph{PreActResNet-18}\xspace} \label{fig:preact-train} \end{figure} \begin{figure}[h] \centering \includegraphics[width=.50\textwidth]{./data/googlenet-train.eps} \caption{\emph{GoogLeNet}\xspace} \label{fig:googlenet-train} \end{figure} \begin{figure}[h] \centering \includegraphics[width=.50\textwidth]{./data/mobilenet-train.eps} \caption{\emph{MoibleNet}\xspace} \label{fig:mobilenet-train} \end{figure} \begin{figure}[h] \centering \includegraphics[width=.50\textwidth]{./data/dpn92-train.eps} \caption{\emph{DPN}\xspace} \label{fig:dpn92-train} \end{figure} \begin{figure}[h] \centering \includegraphics[width=.50\textwidth]{./data/senet18-train.eps} \caption{\emph{SENet}\xspace} \label{fig:senet-train} \end{figure} Table~\ref{tab:val-cifar} shows the validation accuracy achieved after 200 epochs. \begin{table}[htbp] \begin{center} \begin{tabular}{|| c || l| l | l || } \hline Model& KAVG\xspace &MAVG\xspace \\ \hline \emph{ResNet-18}\xspace & 94.81& 95.31 \\ \hline \emph{DenseNet}\xspace & 95.2& 95.5 \\ \hline \emph{SENet}\xspace& 94.73& 94.91 \\ \hline \emph{GoogLeNet}\xspace & 94.36& 95.00 \\ \hline \emph{MoibleNet}\xspace & 91.77& 92.16 \\ \hline \emph{PreActResNet-18}\xspace& 94.54& 95.03 \\ \hline \emph{DPN}\xspace& 95.69& 95.75 \\ \hline \end{tabular} \end{center} \caption{Validation accuracy} \label{tab:val-cifar} \end{table} Figures~\ref{fig:imagenet-train} and ~\ref{fig:imagenet-val} shows the training and validation accuracy using ResNet-50 with ImageNet-1K. Again MAVG\xspace performs better than KAVG\xspace, and this demonstrates the acceleration of convergence through momentum. \begin{figure}[h] \centering \includegraphics[width=.50\textwidth]{./data/imagenet-train.eps} \caption{ResNet50} \label{fig:imagenet-train} \end{figure} \begin{figure}[h] \centering \includegraphics[width=.50\textwidth]{./data/imagenet-val.eps} \caption{ResNet50} \label{fig:imagenet-val} \end{figure} \subsection{$\mu$ with P and an optimal $\mu$} we study how to tune $\mu$ when we have more processors. We use ResNet18 with the \emph{CIFAR-10}\xspace data set. We set $P=6,12,24,48$ and for each choice of $P$, we test different $\mu$'s ranged from $0$ to $0.9.$ The validation accuracies are shown in Figures~\ref{fig:P=6},~\ref{fig:P=12},~\ref{fig:P=24},~\ref{fig:P=48}. When $P$ is small, we can see the optimal $\mu$ is 0.7. When $\mu<0.7,$ the larger $\mu$ is, the higher accuracy we can achieve. However, $\mu=0.9$ works the worst among all the choices. This is because the additional variance caused by momentum is too large and ruin the performance. However, as $P$ increases, $\mu=0.9$ becomes a better choice gradually. It is the best choice when $P=48$. These observation is consistent with the tuning guidelines we suggest in Lemma \ref{lem_increase_P} that we can use a lager $\mu$ when we have more processors. \begin{figure}[h] \centering \includegraphics[width=.50\textwidth]{./data1/val-resnet18-6.eps} \caption{P=6} \label{fig:P=6} \end{figure} \begin{figure}[h] \centering \includegraphics[width=.50\textwidth]{./data1/val-resnet18-12.eps} \caption{P=12} \label{fig:P=12} \end{figure} \begin{figure}[h] \centering \includegraphics[width=.50\textwidth]{./data1/val-resnet18-24.eps} \caption{P=24} \label{fig:P=24} \end{figure} \begin{figure}[h] \centering \includegraphics[width=.50\textwidth]{./data1/val-resnet18-48.eps} \caption{P=48} \label{fig:P=48} \end{figure} \section{Conclusions}\label{conclusion} In this paper, we propose a new momentum method M-AVG and theoretically prove the finite sample error bound. Our theory justifies the speed up brought by adding momentum. Thus, M-AVG can achieve faster convergence than K-AVG. At the same time the optimal $K$ is large than 1 which implies M-AVG has low communication cost. We also provide two useful tuning guidelines. Specifically, when we have more processors , we can choose a larger momentum. When we switch from K-AVG to M-AVG, we have use a smaller K. Our M-AVG algorithm adds momentum at the meta level. We can certainly use MSGD instead of simple SGD in the learner level to accelerate. Our numerical experiment find that this algorithm does have a good performance. However, it is theoretically much harder to analyze its behavior. We leave it to our future research. \newpage \bibliographystyle{plain}
\subsubsection*{Preprocessing} \vspace{-4mm} Algorithmic biases in healthcare stem from historical inequities that create spurious associations would link protected class identity to disease outcome in the dataset, when the true underlying causal factor stems from poor social determinants of health. In training algorithms that on health data that have internalized such biases, the distribution of outcomes across ethnicity may be skewed in which under-served Hispanic and Black patients have more delayed referrals for cancer screening, which may result in more high-grade, invasive phenotypes at the time of radiology imaging or tumor biopsy. Such sources of labeling prejudice are known as negative legacy, or sample selection bias, in which biased data curation protocols may induce correlations between protected attributes and other features, and may result in failed convergence of the training algorithm\cite{kamishima2012fairness}. As a result, many data preprocessing steps have been developed beyond "fairness through unawareness", such as importance weighting, resampling, data transformation, and variable blinding that would correct for confounding features and data curation protocols. \noindent\textit{Importance Weighting:} Importance weighting first emerged as an approach for eliminating covariate shift, \textit{e.g. - } $P_{\text{train}}(X) \neq P_{\text{test}}(X)$, in which the train distribution is reweighted to match the test distribution via computing a density ratio $\frac{P_{\text{train}}(X)}{P_{\text{test}}(X)}$\cite{sugiyama2007covariate, buda2018systematic}. In fairness, importance weighting is used to reweight infrequent samples belonging to protected subgroups followed by optimization of fairness metrics such as TPR and FPR for that subgroups\cite{celis2019improved, kamiran2012data, krasanakis2018adaptive, jiang2020identifying, chai2016unsupervised}. For clinical tasks in which the distributions for demography or disease prevalence may not match in the train and test population, importance weighting has been extensively used to correct for sample selection bias. For instance, In MRI scans, importance weighting has been previously applied to reweigh instances of sparsely annotated voxels in Alzheimer's disease diagnosis\cite{goetz2015dalsa, wachinger2016domain}. In skin lesion classification, reweighting approaches have similarly been used for learning with noisy labels\cite{xue2019robust}. A noticeable limitation is that classifiers trained with reweighted samples may not have robust performance on multiple domains, as well as can induce high variance in the estimator for severely underrepresented subgroups\cite{globerson2006nightmare, cortes2010learning}. \noindent\textit{Targeted Data Collection and Resampling:} In practice, many empirical and real-world studies have found that increasing the size of the dataset is able to mitigate biases\cite{chen2018my}. Though audits of current publicly-available and commercial AI algorithms have revealed large performance disparities, collecting data for the under-represented subgroup is able to reduce performance gaps\cite{abernethy2020adaptive, raji2019actionable}. However, such targeted data collection may pose ethical and privacy concerns as a result of additional surveillance, as well as practical limitations especially in collecting protected health information due to stringent data interoperability standards\cite{rolf2021representation}. Similar to importance weighting, resampling aims to correct for sample selection bias via obtaining more fair subsamples of the original training dataset, and can be intuitively applied to correct for under-representation of subgroups\cite{abernethy2020adaptive, iosifidis2018dealing, vodrahalli2018all, barocas2016big, o2016weapons}. However, a computational challenge in fair resampling is maintaining feature diversity, in which over-sampling to correct for under-representation may instead decrease feature diversity. As a result, the development of frameworks for understanding data subsampling has emerged as its own subfield tangent to fair machine learning. One such framework is determinantal point process ($k$-DPP), which proposes quantifiable measures for combinatorial subgroup diversity (via Shannon Entropy) and geometric feature diversity (via measuring the volume of the $k$-dimensional feature space)\cite{celis2016fair}. In tandem with resampling is the problem of optimal data (or resource) allocation in operationalizing dataset collection in statistical surveys, as well as game-theoretic frameworks for understanding the influence of individual data points via Shapley values, which may refine resampling techniques to developing fair and diverse training datasets\cite{lohr2009sampling, chawla2002smote, pukelsheim2006optimal, cesaro2019measuring}. For instance, group distributionally robust optimization (GDRO) is a technique developed to minimize the maximum empirical risk over subgroups with respect to fairness definitions such as disparate impact and mistreatment minimization, and has recently been shown to adapt well to medical imaging tasks such as skin lesion classification\cite{hu2018does, sagawa2019distributionally, rolf2021representation}. Though data allocation would not fix datasets with labeling prejudice, allocations could be used to audit the training set used to develop algorithms for biases. \vspace{-4mm} \subsubsection*{In-processing} \vspace{-4mm} In addition to eliminating disparate impact of algorithms from the input space, the bulk of many approaches adopt a regularization or adversarial loss term within the model that penalize learning discriminatory features in $X$ in predicting outcomes. For example, in structured data modalities such as imaging, many medical imaging modalities such as radiology, pathology, and even fundus photography images have been showed to leak and detect age, gender, and race from subtle cues in the input space\cite{poplin2018prediction, howard2021impact, banerjee2021reading}. These methods can be separated into two classes: 1) constraint optimization approaches that directly impose a non-discrimination term on the learning objective of a probabilistic discriminative model, and 2) fair representation methods, which are generally deep learning-based and can be unsupervised unsupervised in learning invariance to $A$. \begin{center} \begin{spacing}{1} \fbox{\begin{minipage}{42em} \textbf{Box 2. Brief background on fairness criteria.}\\ \includegraphics[width=42em]{box1_graph.jpg} For binary classification tasks, $Y \in \{0,1\}$ denotes a binary target label used to supervise our model, with $R \in [0,1]$ denoting the classification score $P(Y|X)$ made by our model. For clinical tasks, $Y$ can refer to objective health outcomes (\textit{e.g.} survival, response-to-treatment), or subjective clinical annotations and diagnoses (\textit{e.g.} stage, grade, or subtype of disease). In evaluating models for non-discrimination, three representative fairness metrics are used in current practice: a) Demographic Parity, b) Equalized Odds, and c) Calibration. In satisfying these fairness criterias, not all criterion can be satisfied at the same time. \noindent\textit{a. Demographic Parity.} Demographic Parity asserts that the fraction of positive predictions made the model should be equal across protected subgroups, satisfying the \textbf{independence} criteria $R \perp A$ via the constraint: \begin{align} \mathbb{P}\{R=1 \mid A=a\}=\mathbb{P}\{R=1 \mid A=b\} \end{align} for different subgroups $a, b$. Independence reflects the notion that decisions should be made independently of the subgroup identity. However, note that demographic parity only constrains the rate of positive predictions, and does not consider the rate at which the ground truth label may actually occurs in the subgroups. For instance, for $Y=1$ indicating kidney failure, disparate access to healthcare may self-select black patients at a relatively greater proportion than whites in the population, however, equalizing model predictions may decrease the number of black patients that are positively predicted. \noindent\textit{b. Equalized Odds.} Equalized Odds asserts that the true positive and false positive rates (TPR, FPR) should be equalized across protected subgroup, satisfying the \textbf{separability} criteria $R \perp A | Y$ via the constraints: \begin{align} \mathbb{P}\{R=1 \mid Y=1, A=a\}=\mathbb{P}\{R=1 \mid Y=1, A=b\} \\ \mathbb{P}\{R=1 \mid Y=0, A=a\}=\mathbb{P}\{R=1 \mid Y=0, A=b\} \end{align} In comparison to independence, separability states that algorithm scores should be conditionally independent of the protected attribute given the ground truth label. As a result, Equalized Odds considers that subgroups can have different distributions of $P(Y)$ and is incentivized to reduce errors uniformly across all subgroups. \noindent\textit{c. Predictive Quality Parity.} Predictive Quality Parity asserts that the predictive positive and negative values should be equalized across subgroups, satisfying the \textbf{sufficiency} criteria $Y \perp R | A$ via the constraint: \begin{align} \mathbb{P}\{Y=1 \mid R=r, A=a\}=\mathbb{P}\{Y=1 \mid R=r, A=b\} \end{align} For unthresholded scores, Predictive Quality Parity can be viewed as a form of "calibration by group" in which for score $r$ in the support of R, the following calibration constraint is satisfied for all subgroups in $A$: \begin{align} \mathbb{P}\{Y=1 \mid R=r, A = a\}=r, \enspace \forall a \in A \end{align} \end{minipage}} \end{spacing} \end{center} \vspace{-4mm} \noindent\textit{Constraint Optimization.} As suggested, constraint optimization approaches typically include a non-discrimination term in the learning objective of models such as logistic regression classifiers and support vector machines to fulfill disparate impact and treatment mitigation\cite{kamishima2012fairness, kamishima2011fairness1, zafar2017fairness, zafar2017fairness2, goel2018non}. In logistic regression models, loss terms can be created via computing the covariance of the protected attributes with the signed distance of the sample's feature vectors $X$ to the decision boundary, or modifying the decision boundary parameters to maximize fairness (minimizing disparate impact or mistreatment) subject to accuracy constraints\cite{zafar2017fairness}. Modifications to stochastic gradient descent have also been proposed to weigh fairness constraints in online learning as well\cite{kim2018fairness}. A large limitation in constraint optimization approaches is that the learning objective is made non-convex in including additional non-discriminatory terms, which have been shown to reduce performance in comparison to simple reprocessing techniques such as resampling and importance weighting. \begin{figure*} \vspace{-9mm} \begin{center} \includegraphics[width=0.9\textwidth]{Fig_Fairness.jpg} \caption*{\textbf{Figure 1. Strategies for mitigating disparate impact.} \textbf{a.} For under-represented samples in the train and test distribution, importance weighting can be applied to reweight the infrequent samples to match the distributions. Mismatches in train and test distribution may occur in deploying an algorithm in a population with different demographies, disease prevalances, and sample selection biases that result in label prejudice. \textbf{b.} To remove protected attributes in the representation space of structured data modalities such as images and text data, deep learning algorithms can be additionally supervised with the protected attribute as a target label, in which the loss function for attribute prediction is maximized. Such strategies are additionally referred to as debiasing. In clinical machine learning tasks, modalities such as fundus photography images or chest X-ray images have been shown to include subtle biases that may leak protected attribute information such as age, gender, and self-reported race.} \end{center} \end{figure*} \noindent\textit{Adversarial Fair Learning.} Adversarial fair learning focuses on learning an intermediate feature representation via deep learning that retains information from input space $X$ without any features that correlates with $A$, as seen in \textbf{Figure 1}. Adversarial learning was first proposed in the minimax objective of Generative Adversarial Networks (GANs), in which a generator network learns to produce realistic image samples from an adversarial loss computed by a discriminator network\cite{goodfellow2014generative}. In dataset shift, adversarial learning was also used as an adversarial domain adaptation approach, which aims to learni domain-invariant features of the train and test distribution, \textit{e.g. -} $P_{\text{train}}(Y|X) = P_{\text{test}}(Y|X)$\cite{ganin2015unsupervised}. In fairness, such loss functions have been reused to learn race/ethnicity-invariant features via adversarial fairness, for removing disparate impact of deep learning models for a variety of tasks\cite{celis2019improved, zhao2019inherent, rezaei2020fairness, petrovic2020fair, sattigeri2019fairness, xu2018fairgan, xu2021robust, wadsworth2018achieving, adel2019one}. As an unsupervised learning approach, LAFTR (Learned Adversarialy Fair and Tranferable Representations) was one of the first methods for fair dimensionality reduction, and demonstrated fair representations (debiased of $A$) can be freely transferred to other domains without constraints on downstream classifiers as being fair\cite{zemel2013learning, madras2018learning}. LAFTR proposed using adversarial regularization loss that augments the minimax GAN objective to make the latent feature representation invariant to protected class. Moreover, LAFTR also showed that such representations are transferrable, as examined the problem of Charlson Index prediction from insurance claims and physician records in the Heritage Health dataset, in which LAFTR able to transfer to other tasks without leaking sensitive attributes\cite{zemel2013learning, madras2018learning}. Across other tasks in medicine, the novelty of LAFTR can be extended as a privacy-preserving machine learning approach that allows the transfer of useful intermediate features, which could advance multi-institutional collaboration in fine-tuning algorithms without leaking sensitive information. Similar to LAFTR are methods in unsupervised fair clustering, which further evaluates the fairness of debiased representations (via adversarial learning) in achieving attribute-invariant cluster assignments. However, a key limitation in many of these constraint optimization and adversarial fairness approaches is that it depends on having the protected class attribute at-hand in the train distribution, which may not be possible in many practical situations in which protected class identity such as ethnicity is secured in many healthcare systems. \vspace{-4mm} \subsubsection*{Post-processing} \vspace{-4mm} Calibration is a post-processing technique used to satisfy sufficiency in fairness, and is applied to equalize the proportion of positive predictions to that of true positives in classification problems (Predictive Quality Parity). As demonstrated in \textbf{Box 1}, calibration is applied across all protected subgroups to ensure that probability estimates carry the same meaning across subgroups. As a risk tool, calibration theoretically allows risk estimates to have the same independent effectiveness regardless of group membership as seen in in COMPAS. Despite this desirable role in risk assessment, calibration has been extensively studied and demonstrated to not always imply non-discrimination\cite{kleinberg2016inherent}. For instance, redlining in banking is an example of a calibrated algorithm that strategically misclassifies individuals with the intention of discrimination\cite{corbett2018measure}. Calibration has also been shown to be incompatible with alternative definitions of fairness such as equalized odds and disparate impact outside of highly constrained cases\cite{pleiss2017fairness, chouldechova2018case}. To reconcile error parity and calibration, withholding predictive data for randomized inputs is often used as a post-processing step\cite{pleiss2017fairness, liu2019implicit}. However, the exclusion of individual predictions and trade-off in model accuracy highly disfavor the use of this method in criminal justice and healthcare systems. Growing literature has begun exploring complementary concepts in fairness such as multi-calibration, an approach that focuses on identifiable subpopulations of individuals rather that large sets of protected groups. By using small samples of training data, multi-calibration situations where predictions at an individual level are considered the most fair\cite{kearns2019empirical, hebert2018multicalibration}. \end{spacing} \begin{table}[] \footnotesize \begin{tabular}{| P{0.09\linewidth} | P{0.15\linewidth}| P{0.40\linewidth} | P{0.15\linewidth} | P{0.15\linewidth}|} \toprule \textbf{Data} & \textbf{Machine Learning Task} & \textbf{Issue in Fairness} & \textbf{Dataset Shift} & \textbf{Mitigation Strategy} \\ \midrule \midrule \multirow{4}{*}{\parbox{1.5cm}{Clinical Lab Measurements}} & Predicting Kidney Failure using eGFR equation & Race-specific covariate bias kidney function appear better in Black patients, which could delay medication and referrals for precluding kidney failures\cite{diao2021race}. & \multirow{5}{*}{ Population Shift } & \multirow{4}{*}{\parbox{2.7cm}{Race Exclusion, Constraint Optimization, Model Calibration}} \\ & Checking for uterine track infection & Race-specific covariate bias assigns lower odds of checking checked for UTI in black patients, reduces likelihood of scheduling follow-up and referrals\cite{vyas2019challenging}. & & \\ & Predicting Osteoporosis using a bone fracture risk calculator & Race-specific covariate place black women at lower risk of osteoporosis, while high-risk patients receive preventative drugs to minimize fractures\cite{curtis2009population}. & & \\ & Estimating lung function via forceful exhalement of a spirometer (VBAC calculator) & Race-specific covariate delay diagnosis of lung disease in black patients\cite{vyas2019challenging}. & & \\ & Opiod Early Warning System. & Changing from ICD-9 to ICD-10 resulted in a large wave of false negatives and a much higher prevalence of opiod-related codes\cite{heslin2017trends}. & Label / Annotation Shift & Model Calibration \\ \midrule \multirow{6}{*}{ Pathology } & \multirow{4}{*}{\parbox{2.7cm}{Cancer Diagnosis, Cancer Prognosis, Organ Rejection Prediction}} & Lack of race/ethnicity-stratified evaluation of AI-SaMDs due to poor data interoperability, which results in poor algorithm fairness evaluation. & Population Shift & Federated Learning \\ & & Underserved patients with poor access to health care may developed more poorly-differentiated and invasive grade tumors due to delayed biopsies, leading to unconscious algorithm biases. & Population Shift & Federated Learning, Importance Weighting \\ & & Model Leakage of self-reported ethnicity information due to site-specific staining techniques, leaking to poor generalization to external cohorts\cite{howard2021impact}. & Domain / Acquisition Shift & Adversarial Regularization \\ & & Only patients developing symptoms will be biopsied, which produces disparities in patients who will get pathology services due to access to care, leading to dataset imbalance. & Sample Selection Bias & Federated Learning, Importance Weighting \\ \end{tabular} \end{table} \begin{table}[] \footnotesize \begin{tabular}{|P{0.09\linewidth}| P{0.15\linewidth}| P{0.40\linewidth} | P{0.15\linewidth} | P{0.15\linewidth}|} \multirow{2}{*}{\parbox{1.5cm}{Genomics}} & Mutation Prediction & Genetic variation amongst patients of different ancestry and ethnicity, located in different geographical locations with additional local environmental factors, results in different phenotypes, leading to classification disparities in inferred mutation prediction\cite{shi2014prospective}. & Population Shift & Race Inclusion \\ & Polygenic Risk Scores & Variations in linkage disequilibrium structures and minor allele frequencies across ancestral populations contributes to worse performance of genetic polygenic risk models in Black populations\cite{li2021targeting}. & Population Shift & Federated Learning\\ \midrule Radiology & \multirow{3}{*}{\parbox{2.7cm}{Disease Segmentation and Detection in MRI / CT / Chest X-Ray / Mammography Scans}} & AI algorithms trained on publicly-available radiology images misdiagnose under-served patients at a disproportionate rate compared to the baseline population\cite{seyyed2020chexclusion}. & Population Shift & Federated Learning, Importance weighting \\ & & Model leakage of self-reported ethnicity information after controlling for site-specific technical artifacts and potential anatomic differences\cite{banerjee2021reading}. & Unknown & Disentanglement of Causal Factors * \\ & & Under-served patients with poor access to health care may developed more poorly-differentiated and invasive grade tumors due to delayed biopsies, leading to unconscious algorithm biases. & Population Shift & Federated Learning, Importance weighting \\ \midrule Dermatology & Skin Lesion Segmentation and Detection & Google dermatology app originally had no dark brown/black skin types in dataset, which may over- or under-diagnosis non-White patients with under-represented Fitzpatrick skin types. & Population Shift / Sample Selection Bias & Federated Learning, Importance Weighting \\ \midrule \multirow{2}{*}{\parbox{1.5cm}{Opthalmology}} & \multirow{2}{*}{\parbox{2.7cm}{Retinopathy Grading, Risk Assessment, and Vessel Segmentation}} & Fundus photography images have recently been shown to predicting risk factors such as age and gender, which may contribute towards disparate treatment in cardiovascular risk assessment. & Unknown & Importance Weighting \\ & & Differing clinical education in training opthamologists, as well as inherent intraobserver variability, results in different segmentation results of pathological features such as soft and hard exudates. & Label / Annotation Shift & Federated Learning, Model Calibration \\ \midrule Rheumatology & Predicting Pain and Surgery Eligibility & Disparities in how self-reported race and ethnic population respond to pain, may bias algorithms trained on reported pain score\cite{pierson2021algorithmic}. & Label / Annotation Shift & Importance Weighting, Model Calibration \\ \bottomrule \end{tabular} \caption*{\textbf{Table 2. Examples of algorithm unfairness, their associated dataset shift, and mitigation strategies.}} \end{table} \begin{spacing}{1.5} \noindent\textbf{\large{Emerging Challenges in AI-SaMD Deployment}} Current techniques for satisfying group fairness have largely revolved controlling for unwanted confounders that leak information about the protected subgroups, with strong assumptions placed that the training and testing dataset are independently and identically drawn (i.i.d.) from the same distribution. Though satisfying notions of fairness on the training dataset, algorithms that forget to consider dataset shift at deployment time may still have disparate performance on the test dataset. Dataset shift occurs when there is a mismatch between the training and testing distribution during algorithm development, and is a re-occurring phenomena in medical AI as a result of differences such as population demographics and genetics, image acquisition techniques, disease prevalence, and social determinants of health\cite{quinonero2009dataset, subbaswamy2019preventing, subbaswamy2020development, maness2021social}. For instance, in developing an AI algorithm trained on cancer pathology data from the United States and deployed on data from Turkey, domain shifts as a result of H\&E staining protocols, as well as population shifts due to imbalanced ethnic minority representation, may cause the model to severely misdiagnose Turkish cancer patients. In other cases, hospitals may operate with different ICD systems, which results in label shifts in how algorithms are evaluated\cite{tedeschi1984classification, heslin2017trends}. Overall, algorithms that would be sensitive to dataset shift during deployment, may also be prone to exacerbating healthcare disparities and under-perform on fairness metrics. With access to ground truth labels normally unavailable at test time, their are also limitations in how AI models can be fairly evaluated at all in real-world clinical settings. In this section, we examine several domain-specific challenges in current AI deployment in healthcare from the perspective of group fairness and dataset shift, illustrated for the case of pathology in \textbf{Figure 2} and \textbf{Figure 3}. A high-level overview of dataset shift with examples in medicine can be found in \textbf{Table 2}, with a formal introduction referred to other literature\cite{quinonero2009dataset, castro2020causality}. \begin{figure*} \vspace{-9mm} \begin{center} \includegraphics[width=0.9\textwidth]{Fig_Demography.jpg} \caption*{\textbf{Figure 2. Genetic drift as population shift.} Demography characteristics and gene mutation frequencies for EGFR of lung adenocarcinoma patients in the TCGA (green) and PIONEER (orange) cohort. Of the 528 lung adenocarcinoma patients in the TCGA, only 1.5\% ($n=8$) self-report as "Asian", versus the 1482 Asian patients enrolled in PIONEER, which includes a more fine-grained self-reported ethnicity / nationality categorization of: Mandarin Chinese, Cantonese, Taiwanese, Vietnamese, Thai, Filipino and Indian. As a result of under-representation of Asian patients in the TCGA, the mutation frequency for genes such as EGFR, which is commonly used in guiding the use of TKIs as treatment, is only 37.5\% ($n=3$). In PIONEER, overall EGFR mutation frequency for all Asian patients was found to be 51.4\% ($n=653$), with differing mutation frequencies found across different ethnic subpopulations.} \end{center} \end{figure*} \vspace{-4mm} \subsubsection*{Missing Ethnic and Ancestral Diversity in Biomedical Datasets} \vspace{-4mm} In the current development and integration of AI-based computer-aided diagnosis (CAD) systems in healthcare, the vast majority of models are trained on race-skewed datasets that over-represent individuals of European ancestry, with race-stratified evaluation largely ignored in reporting precision and recall. Moreover, much of our understanding of many diseases has been developed using biobank repositories that predominantly represent individuals with European ancestry\cite{kraft2018beyond, west2017genomics, sudlow2015uk}. Ethnicity, along with other demographic data, is a crucial determination of the mutational landscape and the pathogenesis of cancer, with the prevalence of certain mutations only detectable in high-throughput sequencing of large and representative cohorts\cite{landry2018lack}. For instance, individuals with Asian ancestry are known to have a high prevalence of EGFR mutations as detected in the PIONEER cohort that enrolled 1482 Asian patients (\textbf{Figure 2})\cite{shi2014prospective}. However, in the The Cancer Genome Atlas (TCGA), across 8,594 tumor samples from 33 cancer types, 82.0\% of all cases were from Whites, 10.1\% were from Blacks or African Americans, 7.5\% were from Asians, and 0.4\% from extremely under-reported minorities such as Hispanics, Native Americans, Native Hawaiians and other Pacific Islanders (denoted as "Other" in the TCGA) (\textbf{Figure 2})\cite{gao2013integrative}. As a result of population shift, many common genomic alterations such as EGFR (discovered by other high-sequencing efforts) are undetectable in the TCGA, which has been extensively used to discover molecular subtypes and redefine World Health Organization (WHO) taxonomies for cancer classification\cite{spratt2016racial, zhang2019characterization}. In other areas of precision medicine research, variations in linkage disequilibrium structures and minor allele frequencies across ancestral populations contributes to worse performance of genetic polygenic risk models in Black populations\cite{duncan2019analysis, lam2019comparative, martin2019clinical, mccarty2011emerge, gottesman2013electronic, manrai2016genetic}. Despite these disparities in representation, many AI algorithms undergoing "clinical-grade" validation are trained and evaluated on race-skewed, public biobank datasets without considering their disparate impact on minority subpopulations due to population shift. For instance, the first AI models to surpass clinical-grade performance on predicting lymph node metastases were trained and evaluated on the CAMELYON16/17 datasets sourced entirely from the Netherlands\cite{bejnordi2017diagnostic, campanella2019clinical}. However, such algorithms have yet evaluated race-stratified performance due to a lack of large and ethnic-diverse external cohorts. For cancer types such breast cancer in which their is known genetic diversity in hormone receptor status amongst ethnic subpopulations, phenotypic manifestations of genetic diversity may leak ethnicity subgroup information in diagnostic algorithms\cite{zavala2020cancer, zhang2017racial, ooi2011disparities, henderson2012influence, gamble2021determining}. In this example, ancestry and genetic variation are latent variables that may manifest in the tissue microenvironment, which poses a challenge in the representation space and would thus entail debiasing strategies such as adversarial learning or regularization. Many attempts in establishing histology-genomic correspondences have also been only accomplished using the TCGA and other European biobanks, which makes computational pathology and genomics a challenging domain in dataset shift and model calibration\cite{kather2019deep, kather2020pan, fu2020pan}. \begin{figure*}[h] \includegraphics[width=\textwidth]{Fig_DomainShift.jpg} \caption*{\textbf{Figure 3. Dataset shift in AI-SaMD deployment for a clinical-grade pathology AI algorithm.} Examples of site-specific H\&E stain variability under different whole slide scanners, and their downstream affect on attention-based heatmaps of weakly-supervised AI algorithms in model audit.} \end{figure*} In some applications, it may also be beneficial to include protected attributes such as ethnicity into algorithms, especially when the target label is inferring genetic variation which is correlated with ancestry. One of the most promising deep learning applications in pathology and genomics integration is mutation prediction from Whole Slide Images (WSIs), which if successful can be adopted as a low-cost, screening approach for inferring genetic aberrations without high-throughput sequencing\cite{echle2021deep}. A direct clinical application of deep learning-based mutation prediction is to predict biomarkers such as microsatellite instability (MSI), an FDA-approved biomarker for guiding the use immune-checkpoint inhibition therapy, or EGFR in guiding treatment of multiple tyrosine kinase inhibitors (TKI) in lung cancer\cite{kather2019deep}. However, such an approach trained on TCGA and evaluated on the PIONEER cohort may predict low EGFR mutation frequency and misguide Asian patients with incorrect cancer treatment strategies, even with strategies such as importance weighting as the demography size for protected subgroups may be too minuscule. In this particular instance, using protected class information such as ancestry as a conditional label may improve performance on mutation prediction tasks. At the moment, there is no current work on disentangling genetic variation and measuring the contribution of ancestry towards phenotypic variation in the tissue microenvironment, which is precluded by a lack of large, publicly-available, and also multimodal biobank data. \vspace{-4mm} \subsubsection*{Image Acquisition and Measurement Variation} \vspace{-4mm} In addition genetic drift in the population, variations in image acquisition and biological measurement techniques can also be confounders that leak protected class information. This type of covariate shift is known as domain (or acquisition) shift, in which patients with the same underlying phenotype and annotation may still vary due to institution-specific protocols and other non-biological factors that affect data acquisition\cite{castro2020causality}. For example, in radiology, collected X-Ray, mammography, or CT imaging data may vary due to radiation dosage which affects the signal-to-noise ratio in producing the image. In pathology, there is also enormous heterogeneity in tissue preparation and staining protocols, as well as as scanner-specific camera parameters for slide digitization, which has been shown to affect model performance in slide-level cancer diagnostic tasks (\textbf{Figure 3}). Though medical domain shift is a well-recognized problem, domain shift as a result of site/region-specific factors that correlate with demographic characteristics may also introduce spurious associations with ethnicity. For example, a recent audit study assessing site-specific stain variability of pathology slides in the TCGA found shifts in stain intensity in University of Chicago, which notably was the only site with a greater prevalence of patients with African ancestry\cite{howard2021impact}. As a result, many of the aforementioned clinical-grade AI algorithms in pathology may be learning inadvertent cues for ethnicity via institution-specific staining patterns. In this instance of domain shift, variable staining intensity can be corrected using domain adaptation and optimal transport techniques that adapt the test distribution to the training dataset, which can be performed on either the input or representation space. For instance, recent deep learning techniques using generative adversarial networks have been able to learn stain features as a form of style transfer, in which a GAN can be used to preprocess at data at deployment time to match the training distribution\cite{ganin2015unsupervised, shaban2019staingan}. Other in-processing techniques such as adversarial regularization can be leveraged to learn domain-invariant features using semi-supervised learning using samples from both the training and test distributions. However, a practical limitation in both mitigation strategies is that the respective style-transfer or gradient-reversal layers would need to be finetuned with data from the test distribution for each deployment site, which can be challenging to due stagnant data interoperability between institutions as well as regulations for refining AI-SaMDs\cite{us2019proposed}. In some applications, disentangling sources of shift presents a challenge in developing bias mitigation strategies that would remove confounding non-biological factors. For instance, despite no known anatomic and phenotype population features in radiology, recent work has found that CNNs can reliably predict race in chest X-ray and radiology images despite controlling for image acquisition factors, removing bone density information and severe degradation of image quality using low- and high-pass filtering\cite{banerjee2021reading}. \vspace{-4mm} \subsubsection*{Evolving Dataset Shifts Over Time} \vspace{-4mm} In medicine, dataset shift can occur also as a result from changes in technology, population and environment, and human behavior over time\cite{finlayson2020clinician}. Canonical examples include the migration from ICD-8 to ICD-9 with reclassified the refactored the coding for "surgical" procedure, or the migration from ICD-9 to ICD-10 which created a large spike in opiod-related inpatient stays\cite{tedeschi1984classification, heslin2017trends}. A more recent example of label shift is seen with the Epic Sepsis Model (ESM), a sepsis prediction model that was deactivated in April 2020 due to the changes in patient demographic characteristics confounded by the onset of COVID-19. To mitigate dataset shifts, proposed guidelines have emphasized the importance of guaranteeing model stability to how the data were generated\cite{subbaswamy2020development}, with reactive and proactive approaches for intervening on temporal dataset shift in in active, early-warning systems such as sepsis prediction\cite{guo2021evaluation, subbaswamy2019preventing}. In the context of fairness, such shifts are difficult to avoid as available data may have been generated through an inherently discriminatory process. Moreover, evaluation of fairness metrics may be difficult at deployment time without access to the test labels, which may further be exacerbated with annotation shift in: 1) intra-observer variability amongst clinicians and 2) evolving clinical knowledge. To date, most work has focused on fine-tuning static pre-trained fair classifiers using few short learning,or developing new fairness measures that address short- and long-term decision-making with multi-task objectives\cite{slack2020fairness, dai2021fair, heidari2019long, wen2021algorithms, heidari2019long, wen2021algorithms}. At the moment, however, analyses of fairness metrics under temporal dataset shift has not yet been examined in current AI-SaMDs. \vspace{-4mm} \subsubsection*{Fragility of Race} \vspace{-4mm} Similar to the problem of label shift across train and test distributions, different geographic regions and countries may collect protected attribute data with varying levels of strigency and granularity. One issue that complicates the incorporation of race as a covariate in evaluations of fairness of medical AI models is the active evolution of the medical community’s understanding of race itself\cite{board1998aaa}. As discussions regarding race and ethnicity have moved more into the mainstream, the medical community has begun to realize that the racist taxonomies of the past do not adequately represent the groups of people that they purport to. Indeed, it is now accepted that race is a social construct and that there is greater genetic variability within a particular race than there is between races\cite{oni2021embracing, calhoun2021pathophysiology, sun2020don}. As such, categorization of patients by race can obscure a host of potential confounders to fairness analyses including culture, history, and socioeconomic status that all may separately and synergistically influence a particular patient’s health\cite{lannin1998influence, bao2021s}. These manifold factors can also vary by location so that the same person may be considered of different races in different geographic locations, as seen in the example of self-reported Asian ethnicity in the TCGA versus Pioneer and self-reported race in COMPAS\cite{shi2014prospective, bao2021s}. Ideally, discussions should center explicitly around each component of race and include ancestry, a concept with a clear definition (the geographic origins of one’s ancestors) and one more directly connected to the patient’s underlying genetics. Unfortunately, introducing this granularity to fairness evaluations has clear drawbacks in terms of the power of subgroup analyses and this data is not routinely gathered on patients at most institutions which often fall back on the traditional dropdown menu that allows one to select only a single race and/or ethnicity. Performing fairness evaluations without explicitly considering these potential confounders of race may mean that the AI system under study is sensitive to some unaccounted-for factor hidden from the analysis\cite{lannin1998influence}. \noindent\textbf{\large{Paths Forward}} \subsubsection*{Distributed Learning to Overcome Unfair Dataset Shift} Unlike machine learning performed over a centralized pool of training data, federated learning is a distributed learning paradigm in which, loosely speaking, a network of participating users utilize their own compute resources and local data to collectively train a global model stored on a server\cite{hao2019efficient, yang2019federated, bonawitz2017practical, bonawitz2019towards}. This way, users in principle retain oversight of their own data and instead only have to share the update of weight parameters or gradient signals from their locally trained model with a central server. As a result of privacy-preserving guarantees in training machine learning algorithms without centralized data, federated learning paradigms have been applied to a wide variety of tasks in medicine in: 1) overcoming data interoperability standards that would usually prohibit sensitive health data from being shared: 2) eliminating low data regimes of clinical machine learning tasks that predicting rare diseases (\textbf{Figure 4a})\cite{brisimi2018federated, huang2019patient, xu2021federated, chakroborty2021beyond, ju2020federated, li2019privacy, kaissis2021end, chen2018my, rieke2020future, sheller2020federated, choudhury2019differential, kushida2012strategies, van2003data, veale2017fairer, fiume2019federated, hernandez2020privacy}. For example, in EMR data, federated learning has been previously demonstrated in satisfying privacy-preserving guarantees for transferring sensitive health data, as well as developing early warning systems for hospitalization, sepsis, and other preventive tasks\cite{choudhury2019differential, duan2018odal}. In radiology, federated learning has been recently used for multi-institutional collaboration and validation of AI algorithms for prostate segmentation, brain cancer detection, and monitoring Alzheimer's disease progression from MRI scans, as well as classification of paediatric chest X-ray classification under various network architectures, privacy-preserving protocols, and ablation studies to adversarial attacks\cite{sarma2021federated, sheller2020federated, li2019privacy, silva2019federated, roy2019braintorrent}. In pathology, model audit studies have assessed the the robust performance of weakly-supervised algorithms for WSIs under various privacy-preserving noise levels in diagnostic and prognostic tasks\cite{lu2020federated}. As a result of the SARS-CoV-2 pandemic in 2019, federated learning has been employed overcoming low sample sizes of COVID-19 pathology in AI model development, as well as independent test cohort evaluation\cite{dou2021federated, yang2021federated , vaid2021federated}. \vspace{-4mm} \begin{figure*} \vspace{-9mm} \includegraphics[width=\textwidth]{Fig_FL.jpg} \caption*{\textbf{Figure 4. Enabling multi-institution collaboration via decentralized learning.} \textbf{a}. A proposed federated learning framework in training with multi-institutional cohorts from various countries, each distributed client shown as a country with weigh updates made to a central server. \textbf{b.} A proposed swarm learning framework in which weigh updates are made over edge layers using blocktrain contracts, which precludes communication with a central server.} \end{figure*} With respect to fairness, federated learning paradigms for decentralized AI-SaMD development has been demonstrated to have a directly mitigate disparate impact via model development on larger and more diverse patient populations\cite{li2021targeting}. For instance, In the case of population shift as a result of genetic variation, decentralized information infrastructure have been previously proposed to harmonize biobank protocols and developed tangible material transfer agreements amongst three hospitals, which demonstrates the potential applicability of federated learning paradigms in developing large and diverse biobank data for diverse populations\cite{mandl2020genomics}. In developing polygenic risk scores, federated learning has been used as an integration strategy in merging heterogeneous population data from multiple healthcare institutions, with subsequent validation of federated models on underrepresented populations\cite{cai2021unified, li2021targeting}. In the previous examples of site-specific staining variability across different hospital sites, federated learning can be used to train decentralized models that are invariant to stain via domain generalization, as well as domain adaptation in refining AI-SaMDs locally to the test data distribution with minimal updates\cite{howard2021impact}. Many of the current research directions in federated learning point towards multi-site domain adaptation across distributed clients\cite{liang2020we, song2020privacy, li2020multi, peterson2019private, peng2019federated}. For instance, Federated Multi-Target Domain Adaptation (FMTDA) is a task that addresses domain gaps between unlabeled, distributed client data and labeled, centralized data over the server, as well as degraded performances of federated domain adaptation methods\cite{yao2021federated}. Though federated learning may overcome data interoperability standards and enable training AI-SAMDs with diverse cohorts, the evaluation of AI biases in federated learning settings is yet to be extensively studied. Despite numerous technical advances made in improving communication efficiency, robustness and security of parameter updates, one of the key statistical challenges is learning from non-i.i.d data, which arises due to the sometimes vast differences in local data distribution at contributing sites, which can lead to the divergence of local model weights during training following a synchronized initiation of model weights\cite{zhao2018federated, bonawitz2017practical, konevcny2016federated, lin2017deep}. Accordingly, the performance of FL algorithms, including the well-known FedAvg algorithm\cite{mcmahan2017communication, li2018federated} that uses averaging to aggregate local model parameter updates has been shown to deteriorate substantially when applied to non-i.i.d. data\cite{sattler2019robust}. Such statistical challenges may produce further disparate impact depending on heterogeneity of data distributions across clients. For instance, in using multi-site data in the TCGA as individual clients for federated learning, for the TCGA Invasive Breast Carcinoma (BRCA) cohort, a majority of parameter updates would come from clients that over-represent individuals with European ancestry, with only one parameter update coming from a single client that has majority representation for African ancestry. For decentralized training with diverse biomedical datasets, an important consideration is thus the added complexity in disentangling the impact of site-specific dataset shift from non-i.i.d. data on algorithm fairness, which will not only be problem-specific but also highly-variable from the collaboration structure of participating institutions from differing geographic locations. Moreover, federated learning models can still be affected by biases in the local dataset of each participating client or institution, as well as other variables such as the weighted contribution of each site in updating the global model and the varying frequencies at which different sites participate in training\cite{abay2020mitigating}. In the previous example of multi-site data from the TCGA-BRCA cohort, federated models would be subject to site-specific biases such as H\&E stain intensity, intra-observer variability, ethnic minority under-representation found in centralized models\cite{howard2021impact}. Though federated learning would enable the application of finetuning AI-SaMDs per deployment site, race/ethnicity-evaluation of federated models has yet to be benchmarked. Lastly, access to protected attribute data in each site may still pose in issue in fairness evaluation, as sensitive information such as race and ethnicity are typically isolated in separate databases and may produce additional logistic barriers despite interoperability. A final but important consideration in the practical adoption of fair and federated learning paradigms is the current difficulty for practitioners in operationalizing fairness principles for much simpler AI development and deployment life-cycles of centralized models. In current organizational structures, the roles and responsibilities created for implementing fairness principles are typically isolated into: 1) practitioner / "data regulator" roles, which design AI fairness checklists for guiding the ethical development of algorithms in the organization, and 2) engineer / data user roles, which follow the checklist during algorithm implementation\cite{mcnamara2019costs}. Though intuitive, such binary roles may have poor efficacy in practice, as fairness checklists are often too broad, abstractive, and not co-designed with engineers in addressing problem-specific, technical challenges for achieving fairness\cite{madaio2020co}. In the consideration of federated learning paradigms for AI-SaMD development and deployment, the design of fairness checklists would require not only interdisciplinary collaboration from all healthcare-related roles (\textit{e.g.} clinicians, ethics practitioners, engineers, researchers), but also further involvement from stakeholders at participating institutions in identifying potential site-specific biases that may be propagated during parameter sharing. Similar to the problem of label / annotation shift that may occur at various sites, the design of a global fairness checklist has additional complexity in considering culture-specific factors within each geographic region that would affect access to protected information, as well as definitions and criteria for fairness from differing moral and ethical philosophies\cite{awad2018moral}. Though access to protected attributes may pose in issue in model evaluation at local sites, a potential advantage that may benefit the design of fair and federated models is that the geography of the client identities may be used as proxy variables for subgroup identity, which may inform the development of novel fairness techniques without access to sensitive information. Recent decentralized frameworks have demonstrated that federated learning, in combination with GAN-based fair representation learning methods such as LAFTR, can be used to learn federated, adversarial, debiasing (FADE) representations with similar privacy-preserving and transferable properties as LAFTR, and was benchmarked on mild cognitive impairment detection from sensor data\cite{hong2021federated}. In comparison to other paradigms, FADE as a unique property in that protected attributes are not needed to learn invariant representations, in that the client identities are instead used during adversarial regularization. In application to other areas of fairness, data preprocessing strategies such as importance weighting can potentially be developed to reweight not only infrequent samples, but also model updates from clients containing only under-represented minority subpopulations. In addition, fairness evaluation criteria can potentially be evaluated at the client-level, which may contribute towards developing novel in-processing and post-processing techniques without knowledge of protected attributes. In instances such as multi-site TCGA data which leak ethnicity subgroup membership largely due to the correlation of sample selection bias and H\&E stain variability, many fairness evaluation criteria and post-processing techniques can potentially be performed at the client-level without detailed knowledge of patient demography. In training with heterogeneous data sources, such an assumption may hold for many clinical tasks as geography has been shown to be a closer link to genetic diversity than ethnicity\cite{manica2005geography}. \begin{figure*} \vspace{-9mm} \includegraphics[width=\textwidth]{Fig_FADE.jpg} \caption*{\textbf{Figure 5. A decentralized framework that integrates federated learning with adversarial learning and disentanglement.} In addition to developing algorithms on larger and more diverse patient populations, federated learning can also be integrated with many current techniques in representation learning and unsupervised domain adaptation that can additionally learn with unobserved protected attributes. In FADE, the client IDs are used as protected attribute, with adversarial learning used to debias the representation to be invariant to geographic region (attribute network branch, colored red)\cite{hong2021federated}. In FedDis, disentanglement was used to disentangle shape and apperance features in brain MRI scans, with only the shape parameter shared between clients (disentangled representation, colored orange)\cite{bercea2021feddis}. In FADA, disentanglement and adversarial learning can be used to further mitigate domain shift across clients (both attribute network branch and disentangled representation, colored red and orange)\cite{ke2021style}. Federated learning can also be used in combination with style transfer, synthetic data generation, and image normalization in which domain adapted target data would need to be shared (reconstruction network branch, colored green)\cite{ke2021style, pfohl2019federated, xin2020private, rajotte2021reducing}.} \end{figure*} \subsubsection*{Fair Representation Learning via Disentanglement} Tangential to the work of unsupervised fair representation learning in LAFTR and FADE is disentanglement in generative models, which can also be used to further promote fairness in learned representations without access to protected attributes. Disentanglement is a growing research subfield within representation learning which aims as disentangling independent and easy-to-interpret factors of data in the latent space, and has demonstrated success in isolating sources of variation of objects such as color, pose, position, and shape\cite{hadad2018two, achille2018emergence, chen2018isolating, kim2018disentangling, higgins2016beta}. The first method to demonstrate and quantify disentanglement in deep generative model was BetaVAE, which uses a variational autoencoder (VAE) bottleneck for unsupervised learning, followed by proposing a disentanglement score via training a linear classifier to predict the fixed factor of variation from the representation\cite{higgins2016beta}. Entropy-based metrics such as Mutual Information Gap (MIG), Modularity, Separated Attribute Predictability (SAP), and the Disentanglement-Completeness-Informativeness (DCI) framework have similar been proposed for quantifying pairwise mutual information of all possible individual latent codes in the representation\cite{chen2018isolating, ridgeway2018learning, eastwood2018framework, locatello2019challenging, kumar2017variational}. In application to medicine, disentangled VAEs with adversarial loss components have been used in disentangling size, skin color, and eccentricity in dermoscopy images, with subsequent improvement found in clustering and skin lesion classification\cite{sarhan2019learning}. In longitudinal time-series data, VAEs with Guassian Priors have been used in disentangling physiological waveforms from causal health conditions and other anatomic factors\cite{gyawali2021learning, bing2021disentanglement}. Outside of VAEs, other unsupervised learning techniques such as GANs (\textit{e.g.} - InfoGAN, BigBIGAN, StyleGAN) have achieved similar disentanglement-like properties while also demonstrating strong performance on downstream tasks\cite{donahue2019large, chen2016infogan, nie2020semi}. In synthetic image generation for natural images, approaches such as StyleGAN are able to not only separate style from content in an image, but also achieve unsupervised separation of local- to high-level attributes ($\textit{e.g.}$ - stochastic variation of hair split ends to hair color) in performing fine-grained image editing. On brain MRI scans, approaches similar to StyleGAN have been used in performing feature disentanglement of 19/20 chromosomal gain\cite{jonnalagedda2020feature}. In cardiac MRI and CT imaging, disentanglement has also been used in factorizing images into spatial anatomical factors and non-spatial modality factors with improvement found in multi-task segmentation, regression, and image-to-image synthesis tasks\cite{chartsias2019disentangled}. In relation to fairness, disentanglement can be viewed as a form of data preprocessing that can de-bias datasets before model development. Similar to separating content and style in natural images, disentanglement can potentially be used as an unsupervised approach for isolating protected attribution information such as ethnicity, which can be subsequently truncated from the latent code for downstream fairness tasks\cite{cisse2019fairness, mcnam}. Recent exhaustive studies on the evaluation of unsupervised VAE-based disentangled models have demonstrated that disentanglement scores correlate with fairness metrics, benchmarked on numerous fair classification tasks without protected attribute information\cite{locatello2019fairness}. In application to face identification, disentanglement-like methods have been proposed in clustering human faces without latent code information that contain dominant features such as as skin and hair color\cite{li2020deep}. Though applicable in settings with unobserved protected attributes, disentanglement can also be used in conjunction with adversarial learning to enforce orthogonality constraints to force independence of protected and non-protected latent codes, similarly applied to faces\cite{sarhan2020fairness}. In combination with federated learning, frameworks such as FedDis has been demonstrated to isolate sensitive attributes in non-i.i.d. MRI lesion data, in which images are disentangled into shape and appearance features with only the shape parameter shared between clients (\textbf{Figure 5})\cite{bercea2021feddis}. Within current development and deployment lifecycles for AI-SaMDs and other AI algorithms, the adaptability of unsupervised disentanglement methods can potentially be used in refining the distribution of responsibilities in organizational structures in also including the role of "data producers", who produce "cleaned" versions of the input that are still informative in downstream tasks and can further quantify fairness-accuracy trade-offs in using disentangled representations\cite{mcnamara2019costs}. In this setting, the role of "data users" would be separated from that of "data regulators", which may allow conventional model development pipelines without considering additional fairness constraints. Such an approach may pave a path forwards for a novel three-party governance model that simplifies communication overhead in discussing concerns of accuracy-fairness trade-offs, and may adapt to test populations without the complexities introduced by federated learning which also needs access to protected attributes. However, a limitation for current application is that though current state-of-the-art methods perform well on disentanglement scores, methods using disentanglement have not bee demonstrated in reach competitive performance with other unsupervised learning techniques such as contrastive learning and student-teacher knowledge distillation methods\cite{chen2020simple, caron2021emerging}. Moreover, a large body of disentanglement approaches are only bench-marked on synthetic or semi-synthetic data that are generated in controlled settings. As an ongoing and promising research direction, future work into understanding disentanglement and adapting it robust self-supervised learning paradigms would contribute to improving fairness in transfer learning tasks, as well as also serving as a privacy-preserving measure that would be useful in clinical machine learning tasks. \subsubsection*{Model Auditing using Interpretability} In addition to measuring disparate impact, algorithm interpretability is an important goal in the fair, accountable and transparent machine learning (FATML) research community as it can be used as a tool for model auditing and mitigating sources of bias in dataset collection. Interpretability in deep learning algorithms has emerged as its own technical subfield in order to derive explanations from "black-box" algorithms, especially in learning applications that operate on structured data modalities such as images and text. In this subsection, we briefly review interpretability methods, and their role in fairness and medicine. \noindent\textit{Saliency Maps and Perturbations}. Saliency mapping is a class of methods that aims to find sensitive input features that would explain the decision made by a network. For images, the partial derivatives of the predictions with respect to pixel intensities computed during back-propagation of the network, which then produce a fine-grained visualization of informative image regions. Saliency maps were first proposed in visualizing image classification models, and have since inspired a wide class of methods such as Class Activation Maps (CAM)\cite{simonyan2013deep}. CAM methods such as Grad-CAM are layer attribution techniques that attributes how a neuron of an intermediate feature layer of a CNN would affect the output. The attributions for the targeted layer are then upsampled to the original image size and viewed as a mask to identify discriminative image regions\cite{selvaraju2017grad}. Guided Grad-CAM overcomes the issue with non-negative gradients in standard back-propagation and Grad-CAM, where ReLU activations are overridden such that only non-negative gradients are back-propagated. Within the medical imaging community, CAM-based methods have gained widespread adoption in the interpretation of CNNs for clinical interpretability, as salient regions refer to high-level image features rather than low-level pixel intensities. Because these techniques can be applied without modifying the networks, existing and/or deployed models can be readily adapted to understand network predictions, and have since been used to audit models in various AI-based medicine applications such as skin lesion detection, chest x-ray disease localization, and CT organ segmentation\cite{sayres2019using, patro2019u, irvin2019chexpert, grewal2018radnet, arun2020assessing, poplin2018prediction, pierson2021algorithmic, schlemper2018attention, schlemper2019attention, oktay2018attention}. In tabular-structured clinical data such as genomic and transcriptomic features, similar gradient-based techniques such as Integrated Gradients have been developed for quantifying local- and global-level feature importances in corroborating the role of cancer-driving genes in cancer prognostication and single nucleotide polymorphisms (SNPs) in genome-wide association studies (GWAS)\cite{chen2020pathomic, chen2021pan, sharma2020deep}. Tangent gradient-based methods are also perturbative-based techniques such as (\textit{e.g.} - Occlusion, ArchDetect, Shapley Sampling), in which individual features are permuted to assess counterfactual feature importance\cite{hickey2020fairness, lundberg2017unified, sundararajan2017axiomatic, janizek2021explaining, tsang2020does, zeiler2014visualizing}. To assess the quality of interpretability or retrieved feature importance results, frameworks such as Remove and Retrain (ROAR) propose masking different thresholds of important features followed by retraining and model evaluation, in which masked importance features should degrade performance\cite{kindermans2019reliability, hooker2018benchmark}. \noindent\textit{Attention-based interpretability}. In comparison to gradient-based methods, attention-based methods require direct modifications to the neural network to implement a Softmax activation function that computes a probability weight distribution over the inputs, which are used as feature importance and subsequent interpretability\cite{ilse2018attention, lu2021data}. Attention-based interpretability is typically designed for network architectures that operate over set-based data structures (\textit{e.g.} - bags of word embeddings, single cell features, image patch embeddings), in which for a bag of feature embeddings $ \textbf{x} = \{x_1, \dots, x_n\}$, the network computes a normalized score $\textbf{w}$ such that $\sum_{i}^N w_i = 1$ using Softmax activation\cite{ilse2018attention}. During training and evaluation, these scores are used as weights in permutation-invariant set aggregation operations such as global pooling layers at the end of the network, in which a higher weight indicates greater feature importance attributed to a given feature embedding in the set. In weakly-supervised algorithms for computational pathology, techniques such as attention-based multiple instance learning have been developed to saliently localize diagnostic and prognostic image regions in gigapixel pathology images, finding "needles in a haystack"\cite{lu2021data}. Similarly in EMRs, visualization of self-attention weights in Transformer architectures have demonstrated that language models can learn relationships between clinical concept embeddings. In combination with fairness and medicine, interpretability techniques can be used to audit failure modes of potential AI-SaMDs that would have disparate impact on under-served or under-represented subpopulations at deployment time. For instance, in model auditing of algorithms to predict credit limit, feature importances of demography data revealed surprisingly little attribution to male or female gender status\cite{adebayo2016iterative}. On the COMPAS dataset, global shifts in interpretability via attribution-based methods were discovered following importance weighting\cite{cesaro2019measuring}. In clinical scenarios, the recent discovery that found correlations site-specific staining variability and ethnicity in the TCGA was made via model auditing using attention-based interpretability on patch-based features\cite{howard2021impact}. In mortality prediction on EMR dataset, protected subgroups were found to have variable global feature importance, which revealed odd interactions such as different subsets of features being used for specific subgroups\cite{meng2021mimic}. Though successful as an model auditing strategy in these examples, in the previous problem of unknown dataset shift of radiology images leaking self-reported race, saliency maps were used in performing model auditing but were unable to point towards explainable anatomic landmarks or image acquisition factors\cite{banerjee2021reading}. At the moment, the intersection of interpretability, fairness, and machine learning for health research remains quite a narrow, with only a few works examining the cross-section of how feature importances and interpretability shifts across protected subgroups\cite{meng2021mimic}. As artificial intelligence continues to cross the precipice into clinical workflows with calls to action on model auditing and interpretability gaining traction, FATML-centered research in healthcare will be center in refining FDA regulatory frameworks in AI-SaMDs. \end{spacing} \section*{References} \vspace{2mm} \begin{spacing}{0.9} \bibliographystyle{naturemag}
\section{Introduction} Soft gamma-ray repeaters (SGR) and anomalous X-ray pulsars (AXPs) are associated with highly magnetized neutron stars or magnetars. They generate bursts of emission at irregular time intervals. The crust of the neutron star is thought to break owing to the intense shifts of the ultrastrong magnetic field causing the emission of hard X-rays and gamma rays. During these short ($\sim$0.1\,s) bursts, the brightness of these objects can increase by a factor of 1000 or more. Within this category, the most extreme giant flares are so intense that in the case of the 2004 27 December event from SGR\,1806-20, they can influence the Earth's ionosphere and magnetic field \citep[e.g.,][]{Inan:2007}. \subsection{SGRs and Nonthermal emission} For many years it was unclear whether nonthermal emission mechanisms are involved in these burst activities. Recently the Large Area Telescope (LAT) aboard the Fermi satellite detected GeV gamma-ray emission from an extragalactic magnetar in the Sculptor galaxy group \citep{FermiMagnetar:2021}. The location of the recorded burst is consistent with several galaxies, including the starburst galaxy NGC\,253 (the Sculptor galaxy) at 3.5\,Mpc distance. The unusually long delay (19\,s) of the GeV emission from the first spike and quasi-periodic oscillation seen in the MeV signal suggest a giant magnetar flare causing gamma emission well outside the magnetar's light cylinder radius. At present, the GeV radiation is attributed to optically thin synchrotron emission, suggesting the presence of relativistic electrons. The potential for very high energy (VHE) gamma emission from extraordinary giant magnetar flares has been discussed, for example, in the context of SGR\,1806$-$20 as a possible hadronic accelerator~\citep{Ioka:2005}. In the case of accelerated electrons, the strong magnetic field of the emission region could induce electron$-$positron pair cascades that can quench any VHE gamma-ray emission. This internal absorption of VHE photons can be avoided if the emission region is located far away from the surface of the magnetar. This is realized, for example, in the trapped fireball scenario~\citep{Thompson_2001}. So far, searches for VHE emission (variable or persistent) from the magnetars SGR\,1806$-$20, 4U\,0142+61 and 1E\,2259+5864 have not revealed any detections \citep{MAGIC-magnetars:2013,HESS-SGR1806:2018}. \subsection{Fast radio bursts and magnetars} Fast radio bursts (FRBs) are powerful radio pulses with a duration of several milliseconds with high brightness temperatures suggesting a coherent emission mechanism~\citep{Petroff:2019tty}. It is believed that FRBs are of extragalactic origin. Over the past few years a rapidly growing number of FRBs have been detected in the radio band, including repeating ones~\citep{Petroff:2016tcr}. Various theoretical emission and source models were put forward since the first detection of these enigmatic bursts~\citep{2020Natur.587...45Z}. Magnetars are proposed as sources of FRBs~\citep{Popov:2007uv}. For example, some magnetars could produce FRBs through strongly magnetized pulses that interact with the material in the surrounding nebula and produce synchrotron maser emission~\citep[e.g.][]{Lyubarsky:2014jta,Metzger:2019,Beloborodov:2020}. Some models suggest that repeating FRBs are generated not far from the surface of the magnetar through ultrarelativistic internal shocks and blast waves in the magnetar wind associated with flares~\citep[e.g.][]{2017ApJ...843L..26B}. \subsection{Past observations of FRBs with Imaging Atmospheric Cerenkov Telescopes} The High Energy Stereoscopic System (H.E.S.S.) is an array of one 28 m and four 12m imaging atmospheric Cerenkov telescopes (IACTs) located in the Khomas Highland in Namibia at an altitude of 1835 m. It is capable of detecting VHE gamma rays from energies of a few tens of GeV to 100 TeV. In the past, H.E.S.S. targeted two FRBs, FRB\,20150215~\citep{2017MNRAS.469.4465P} and FRB\,20150418~\citep{2017A&A...597A.115H} with several hours to days of delay. No significant VHE emission was found from either observations. Simultaneous observations of repeating and nonrepeating FRBs with IACTs and radio telescopes did not reveal gamma-ray counterparts: VERITAS observed FRB\,20121102 and FRB\,180814.J0422+73 simultaneously with the Green Bank Telescope, detecting 15 radio bursts during the campaign~\citep{2019ICRC...36..698H}. MAGIC observed FRB\,20121102 simultaneously with Arecibo, which detected five radio bursts~\citep{Acciari:2018hnf}. \subsection{SGR~1935+2154} Following its discovery in 2014~\citep{Swift_discovery}, SGR\,1935+2154 has probably become the most burst-active SGR, emitting dozens of X-ray bursts over the past few years~\citep{Lin:2020-I}. SGR\,1935+2154 is associated with the middle-aged galactic SNR\,G57.2+0.8 at a distance of about 6.6~kpc~\citep{Zhou:2020}. In 2020 late April and May SGR\,1935+2154 showed renewed X-ray burst activity culminating with a ``forest of bursts" as detected by BAT on board the Neil Gehrels Swift Observatory. Many other X-ray and soft gamma-ray telescopes (Fermi-GBM, INTEGRAL, sAGILE, HXMT, Konus–Wind, NICER) also reported sustained bursting activity into late May. This situation became considerably more interesting with the detection of short, intense radio bursts from the direction of SGR\,1935+2154. Two millisecond-duration radio bursts (FRB\,20200428) were detected, the first burst being a double-peaked one detected by CHIME and STARE2~\citep{SGR1935_STAR2, SGR1935_CHIME} on 2020 April 28, at 14:34:33 UTC and the second burst by FAST \citep{FAST_FRB} on April 30, at 21:43:00 UTC. The radio energy released under the assumption of an isotropic emission of the bursts at 6.6 kpc is about $10^{34}$-$10^{35}$\,erg, just below the low end of the extragalactic FRB distribution observed so far. After removing the radio dispersion delay, the timing of the first radio burst appears to line up very well with one of the bright X-ray bursts seen by AGILE~\citep{tavani2020xray}, Konus-Wind~\citep{Ridnaia:2021}, INTEGRAL~\citep[burst G in][]{INTEGRAL_BURST_A} and Insight-HXMT~\citep{HXMT_Bursts,HXMT_Delay}. This coincidence is the first evidence that magnetars are linked to FRBs, or at least a subset of (repeating) bursts. It is also shown that the X-ray bursts overlapping the double-peaked CHIME radio burst have an unusually hard spectrum, and it is suggested that these X-rays and the radio bursts arise from a common scenario \citep{Ridnaia:2021}. Furthermore, the nonthermal nature of the Insight-HXMT burst~\citep{li2020insighthxmt} points to the production of multi-TeV electrons. Multi-GeV to TeV gamma-ray emission via the inverse-Compton process may then accompany this X-ray emission. We here report on searches for VHE gamma-ray emission associated with the flares of SGR\,1935+2154 with H.E.S.S. during the period of high activity on 2020 April 28. This paper is organized as follows: Sec.~\ref{sec:SGR1935_observations} describes the H.E.S.S. observations and provides an overview of MWL observations of SGR\,1935+2154. Sec.~\ref{sec:SGR1935_hess_analysis} presents the H.E.S.S. data analysis and results. Sec.~\ref{sec:SGR1935_discussion} discusses our findings, which are concluded in Sec.~\ref{sec:SGR1935_conclusion}. \section{Observation summary} \label{sec:SGR1935_observations} The top panel of Fig.~\ref{fig:SGR1935_obs}, gives an overview of the MWL bursts detected from SGR\,1935+2154 over the years. The middle panel zooms in on the 2020 active period. The bottom panel zooms in on the period around the H.E.S.S. observations. The observations during the active period are summarized in the following. \begin{figure*}[!tb] \centering \includegraphics[width=1.0\linewidth]{Figures/lc_SGR1935_final.pdf} \caption{SGR\,1935+2154 observations with gamma-ray, X-ray optical and radio telescopes.This plot presents X-ray bursts from the source detected by Fermi-GBM~\citep{Lin_2020,SGR1935_GBM1,SGR1935_GBM2,SGR1935_GBM3,SGR1935_GBM4,SGR1935_GBM5,SGR1935_GBM6,von_Kienlin_2020,Gruber_2014,von_Kienlin_2014,Bhat_2016}, Swift-BAT~\citep{Swift-BAT_ATel}, NICER/XTI, NuSTAR~\citep{Borghese_2020}, INTEGRAL~\citep{INTEGRAL_BURST_A}, HXMT~\citep{HXMT_Bursts2,HXMT_Bursts}, AGILE~\citep{AGILE_ATEL,tavani2020xray} and Konus-Wind~\citep{Ridnaia:2021,SGR1935_KONUS-WIND2,SGR1935_KONUS-WIND3,SGR1935_KONUS-WIND4,SGR1935_KONUS-WIND6,SGR1935_KONUS-WIND7,SGR1935_KONUS-WIND8,SGR1935_KONUS-WIND9,SGR1935_KONUS-WIND10,SGR1935_KONUS-WIND11,SGR1935_KONUS-WIND12,SGR1935_KONUS-WIND13}; radio burst from CHIME~\citep{SGR1935_CHIME,SGR1935_CHIME2}, STARE2~\citep{SGR1935_STAR2}, FAST~\citep{FAST_FRB} and the Westerbork (RT1), Onsala (25m), Toruń (30m) dishes~\citep{Kirsten_2020}. Plot also shows the H.E.S.S., FAST, BOOTES and LCOGT observations~\citep{2020Natur.587...63L} with upper limits from all shown instruments.} \label{fig:SGR1935_obs} \end{figure*} Gamma rays and X-rays: Fig.~\ref{fig:SGR1935_obs} (and references therein) shows detected bursts with AGILE, Fermi-GBM, INTEGRAL, Konus-Wind, HXMT, NuSTAR, NICER/XTI and Swift-BAT from 2009 until the end of 2020. From the Konus-Wind detected burst clusters on 2020 April 27~\citep{SGR1935_KONUS-WIND9} we show only the most intense bursting activity that occurred around 18:33:01 (58965.77293 MJD) with a duration of $\sim$23\,s and a very high fluence of $1.09 \times 10^{-4}\, \mathrm{erg}\,\mathrm{cm}^{-2}$. Four Fermi-GBM bursts occurred during the H.E.S.S. follow-up observations of the source~\citep{Lin_2020}. Moreover, INTEGRAL reported the detection of an X-ray burst at 03:47:52.2 UTC (burst A in~\citet{INTEGRAL_BURST_A} at 58967.15824306\,MJD) that coincides with the fourth Fermi-GBM burst during the last data-taking run by H.E.S.S. Therefore, the H.E.S.S. observations provide for the first time simultaneous VHE gamma-ray observational data with X-ray bursts emanating from a SGR. An X-ray burst is detected by AGILE, Konus-Wind, HXMT and INTEGRAL~\citep[burst G in][]{INTEGRAL_BURST_A} simultaneously to the FRB from CHIME and STARE2 (FRB\,20200428). Radio: FRB\,20200428 associated with SGR\,1935+2154 is detected by CHIME~\citep{SGR1935_CHIME,SGR1935_CHIME2} at 2020 April 28 14:34:33 UTC and STARE2~\citep{SGR1935_STAR2} at 2020 April 28 14:34:25 UTC ($\sim$58967.60733\,MJD). Several X-ray instruments detected coincident X-ray bursts as shown in Fig.~\ref{fig:SGR1935_obs}. Follow-up observations by the FAST radio telescope (Pingtang, China) in the 1.25\,GHz band did not reveal radio bursts down to a fluence of $<22\,\mathrm{mJy\,\,ms}$~\citep{2020Natur.587...63L}; however, a weak, highly linearly polarized radio burst was detected on April~30~\citep{FAST_FRB} (58969\,MJD). Moreover, no radio bursts were detected in the observation campaigns by the Arecibo, Effelsberg, LOFAR, MeerKAT, MK2 and Northern Cross radio telescopes (not shown in Fig.~\ref{fig:SGR1935_obs}) reported in~\citet{Bailes_2021}. The upper limits derived from these observations are between 18\,mJy and 25\,mJy. Two additional radio bursts separated by $\mathrm{~\sim 1.4\,s}$ on 2020 May 24 (\citet{Kirsten_2020};58993\,MJD) were detected following an X-ray burst detected by HXMT during a joint campaign between the Westerbork (RT1), Onsala (25 m), and Toruń (30 m) radio dishes. The burst fluences are several orders of magnitude lower than the two bursts detected by CHIME and STARE2 with values of $\mathrm{112 \pm 22\,Jy\,ms}$ and $\mathrm{24\pm 5\,Jy\,ms}$, respectively. The four FRBs detected from SGR\,1935+2154 thus span around seven orders of magnitude in fluence. No FRBs were detected during the time of the H.E.S.S. data acquisition. VHE gamma rays: The H.E.S.S. transients' follow-up system triggered Target of Opportunity follow-up observations on SGR\,1935+2154 after the reception of a first Swift-BAT alert, indicating a high-intensity X-ray burst from SGR\,1935+2154 at 2020 Aril 27 18:26:19.95 UTC (58966.76828646\,MJD). A second Swift-BAT alert arrived $\sim$6.5 minutes later~\citep{SWIFT_1_2}. Darkness and visibility constraints only allowed follow-up observations to commence $\sim$7.5 hr later. The observations lasted 2 hr and consisted of four runs taken with {\it wobble} offsets whereby the source is alternately offset by 0.5 deg in opposite directions of the R.A. and decl. The positions reported by Swift-BAT has a 3' uncertainty and are thus fully comprised within the H.E.S.S. field of view of 2.5 deg radius. A summary of the observations is presented in Tab.~\ref{tab:SGR1935_OBS} and we put them in context with the MWL observations of the burst activity of SGR\,1935+2154 in Fig.~\ref{fig:SGR1935_obs}. \begin{table}[!hb] \centering \begin{tabular}{ccc} \toprule Start time (UTC) & Duration & Average Zenith Angle \\ \midrule 2020 April 28 01:55:00 & 28 minutes & 55.0 deg\\ 2020 April 28 02:26:55 & 28 minutes & 51.0 deg \\ 2020 April 28 02:56:08 & 28 minutes & 48.1 deg \\ 2020 April 28 03:25:24 & 28 minutes & 46.2 deg \\ \bottomrule \end{tabular} \caption{Summary of the H.E.S.S. observations of SGR\,1935+2154. \textbf{Note:} The observations overlapped with magnetar bursts detected by INTEGRAL and Fermi-GBM.} \label{tab:SGR1935_OBS} \end{table} Optical: No optical emission has been detected by the BOOTES-3 (New Zealand) telescopes observing contemporaneously to the first detected FRB, and $3\sigma$ upper limits in the Z-band are given as $>17.9$\,mag during this epoch~\citep{2020Natur.587...63L}. No optical emission was seen by LCOGT (California, USA), other BOOTES telescopes or the MeerLICHT (not shown in Fig.~\ref{fig:SGR1935_obs}) optical telescope~\citep{Bailes_2021}. \section{Data Analysis and Results} \label{sec:SGR1935_hess_analysis} The H.E.S.S. results presented here use data from all four 12\,m telescopes. The quality of the obtained data has been thoroughly verified and standard quality selection criteria~\citep{Aharonian2006a} are applied. The data are then analyzed using the \textit{standard cuts} of the semi-analytical \textit{Model Analysis} described in~\citet{de-Naurois2009a}. The standard \textit{Ring background} technique~\citep{RingBg} is used to determine the background with a radial acceptance and a $\mathrm{0.1\,deg}$ ON region. We obtain a total number of ON events $\mathrm{N_{ON} = 26}$ and OFF events $\mathrm{N_{OFF} = 270}$ in the source region, with $\mathrm{\alpha = 0.0813}$ leading to an excess value of $4.0$. We derive the significance map shown in Fig.~\ref{fig:SGR1935_SIG} using the formalism described in~\citet{LiMa} and an oversampling radius of $0.1~\mathrm{deg}$. In this map no significant signal above $5\sigma$ can be found at the position of the SGR or elsewhere in the covered region. We therefore conclude that no significant VHE gamma-ray emission has been detected by H.E.S.S. during the follow-up observations of SGR\,1935+2154. \begin{figure} \centering \includegraphics[width=1.0\linewidth]{Figures/SGR1935+2154q_SignificanceMap_Stereo1_Std_PostJira.pdf} \caption{Significance map computed from the H.E.S.S. observational data taken on SGR\,1935+2154.} \label{fig:SGR1935_SIG} \end{figure} \begin{comment} derived the excess map of gamma-ray-like events in the observed field of SGR\,1935+2154 shown in Fig.~\ref{fig:SGR1935_Exc} . \begin{figure} \centering \includegraphics[width=1.0\linewidth]{Figures/SGR1935+2154_ExcessMap_Stereo1_Std_PostJira.pdf} \caption{Excess map computed from the H.E.S.S. observational data taken on SGR\,1935+2154.} \label{fig:SGR1935_Exc} \end{figure} This map is used to derive the significance map shown in Fig~\ref{fig:SGR1935_SIG} using the formalism described in~ Eq. 17 of~\citet{LiMa}. In this map no significant signal above $5\sigma$ can be found at the position of the SGR or elsewhere in the covered region. The significance histogram of Fig.~\ref{fig:SGR1935_SIG} is shown in Fig~\ref{fig:SGR1935_SIGDist}. It follows a Gaussian distribution and is consistent with the background-only hypothesis. \begin{figure} \centering \includegraphics[width=1.0\linewidth]{Figures/SGR1935+2154_RingSig_Dist.pdf} \caption{Distribution of the significance shown in Fig.~\ref{fig:SGR1935_SIG} computed from the H.E.S.S. observational data taken on SGR\,1935+2154.} \label{fig:SGR1935_SIGDist} \end{figure} \end{comment} A low-energy threshold is defined as the energy where the effective area is at least 10\% of its maximum value. Influenced by the relatively high zenith angle of the observations, a value of $E_{thr}\mathrm{ = 600 \, GeV}$ is found. Assuming a generic $E^{-2.5}$ energy spectrum we compute 95\% confidence level differential upper limits shown in Fig.~\ref{fig:SGR1935_DiffUL} at the position of SGR\,1935+2154 using a Poisson likelihood method described in~\citet{Rolke}. Integrating above 600 GeV gives a value of ${\Phi_{\gamma}\mathrm{(E > 600\,GeV)} < 1.5\cdot10^{-12}\,\mathrm{cm}^{-2}\,\mathrm {s}^{-1}}$. If we consider an $E^{-2}$ spectrum, this value drops by $\sim$13\% and for a $E^{-3}$ spectrum it increases by $\sim$7\%. The analysis presented in this section has been cross-checked and validated with an independent event calibration and reconstruction analysis~\citep{Parsons2014a}. \begin{figure}[htp] \centering \includegraphics[width=1.0\linewidth]{Figures/SGR1935_DiffUL_Rolke_Final.pdf} \caption{Differential 95\% C.L. upper limits derived from the H.E.S.S. observational data taken on SGR\,1935+2154.} \label{fig:SGR1935_DiffUL} \end{figure} In addition to the standard analysis, we perform the Cumulative Sum, ON-OFF and Exp- tests described in~\citet{Brun_transient_tools} to search for a variable or transient VHE signal. For that we use the gamma-candidate events that are selected after the cut applied by the \textit{Model Analysis}. No significant variability was detected at minute to hour timescales. Furthermore, a search for gamma-candidate doublets arriving within millisecond time windows from the direction of SGR\,1935+2154, which could be associated with a magnetar burst, is conducted. No such doublets are detected. This search is extended to clusters of gamma candidates around the Fermi-GBM and INTEGRAL bursts. As an example, Fig.~\ref{fig:SGR1935_GammaLike} shows the arrival times of gamma candidates around the INTEGRAL burst. No gamma-candidate events from the source region are found within less than 9 s of any Fermi-GBM or INTEGRAL burst occurring during our observations. We note that the gamma candidates are expected background events that passed the selection cuts from the \textit{Model Analysis} and should not be misinterpreted with gamma rays. The H.E.S.S. sensitivity for this kind of fast transient phenomena, i.e. assuming detection of gamma-candidate multiplets at millisecond-scale time windows, is at the order of ${\sim 10^{-9}}$\,erg$\,$cm$^{-2}$ depending on the zenith angle of the observations. \begin{figure} \centering \includegraphics[width=1.0\linewidth]{Figures/SGR1935_gamma_like_events_burst.pdf} \caption{VHE gamma candidates detected by H.E.S.S. from SGR1935+2154 at the time of the X-ray burst A detected by INTEGRAL~\citep{INTEGRAL_BURST_A}. The vertical line designates the burst. The gamma candidates are expected background events.} \label{fig:SGR1935_GammaLike} \end{figure} \section{Discussion} \label{sec:SGR1935_discussion} The H.E.S.S. observations described here present the first VHE gamma-ray observations of a magnetar during a high-activity phase. Our observations are coincident with four X-ray bursts detected by two instruments (Fermi-GBM and INTEGRAL) and put stringent upper limits on the VHE emission during the active phase of the magnetar. With a spectral index of 2, the INTEGRAL burst~\citep[burst G from][]{INTEGRAL_BURST_A} coincident with the FRB detected by CHIME and STARE2 has a harder spectral shape than from other bursts detected by INTEGRAL. It is also more energetic than burst A that occurred during the H.E.S.S. observations: ${F_G/F_A = 5.3}$ with $F_G$ and $F_A$ the fluence values of bursts A and G, respectively. Assuming that burst A could be connected to another coincidental FRB half an order of magnitude less energetic than the detected radio burst, FRB\,20200428, this hypothetical FRB would still be within the sensitivity of radio instruments. The fact that several X-ray bursts happened during FAST radio observations and the lack of radio burst detection (${\mathrm{UL} \sim 2.75 \times 10^{-19}\, \mathrm{erg}\,\,\mathrm{cm}^{-2}}$) leads us to believe that these ordinary SGR bursts (including burst A) are different from burst G. Moreover, the HXMT burst associated with the FRB is dominated by a power law and is therefore primarily nonthermal in nature according to \citet{li2020insighthxmt}, which is very rare for SGRs (6\% of SGR bursts as per~\citet{li2020insighthxmt}). The lack of VHE gamma rays is consistent with expectations from regular magnetar bursts~\citep{Kaspi:2017fwg} when thermal emission mechanism is involved. The integral upper limits derived from the 2 hr of H.E.S.S. observation, assuming a spectral index of $E^{-2.5}$, can be translated into upper limits on the flux $F\mathrm{(E > 600\,GeV)} < 2.4 \times 10^{-12} \,\mathrm{erg} \, \mathrm{cm}^{-2}\,\mathrm{s}^{-1}$. Assuming a distance of 6.6 kpc we derive a luminosity upper limit $L\mathrm{(E > 600\,GeV)} < 1.3 \times 10^{34} \,\mathrm{erg}\,\mathrm{s}^{-1}$. This places constraints on persistent VHE emission from SGR\,1935+2154 during the H.E.S.S. observations. The sensitivity to gamma-ray multiplets can be transformed into sensitivity to the isotropic energy from a VHE burst $\mathrm{E_{VHE,iso}\mathrm{(E > 600\,GeV)} \leq 5.2 \times 10^{36} \,erg}$. This sensitivity is higher than the isotropic energies of the FRB bursts detected from the source ($\mathrm{\sim10^{34} \,erg - 10^{35}\, erg}$). However, it can be compared to the energy released in the X-ray domain during the coincident Fermi-GBM and INTEGRAL bursts ($\mathrm{\sim10^{38} \,erg - 10^{39}\, erg}$), indicating that if there were an isotropic VHE emission related to these X-ray bursts during the time of H.E.S.S. observations it would have been detected. The nondetection by H.E.S.S. may suggest that the inverse-Compton process is suppressed in the magnetar surroundings, making the VHE emission too weak to be detected. An explanation for that is that the gamma-ray emission is happening too close to the magnetar surface and pair production and photon splitting result in significant energy losses for the VHE gamma rays, leading to strong cutoffs in the MeV to GeV energy range. This flux suppression could be avoided in scenarios where the gamma rays are generated well away from the magnetar's intense magnetic field~\citep{Hu_2019} or in scenarios involving axions~\citep{Archer:2020znv}. In case of detection, the H.E.S.S. observations could therefore also probe the particle transport aspects (such as outflows) in the vicinity of SGR\,1935+2154 during the recent flaring episode. Further MWL observations of flaring magnetars are needed for a robust conclusion on the nature of the observed bursts. We cannot draw any conclusions concerning VHE counterpart emissions from FRBs since the H.E.S.S. data presented here are not contemporaneous with any radio burst and the coincident X-ray bursts seem to be different in nature from the bursts associated with FRB\,20200428. The predicted energy released during a VHE pulse from magnetar nebulae by~\citet{Lyubarsky:2014jta} is detectable at distances of roughly hundreds Mpc. The derived sensitivity of H.E.S.S. to TeV photons suggests that such VHE bursts would be detectable by H.E.S.S. This motivates further observations of magnetars and FRBs in the VHE domain. \section{Conclusions} \label{sec:SGR1935_conclusion} H.E.S.S. observed SGR\,1935+2154 during its period of high activity on 2020 April 28. We gather MWL information on the source from the time of discovery until the high-activity period recorded in 2020. Four X-ray bursts were detected by INTEGRAL and Fermi-GBM during the H.E.S.S observation period. The data analysis does not show any significant detection of VHE gamma rays from the source and variability searches do not show emission of gamma rays on the minutes, seconds and milliseconds scales. We thus use H.E.S.S. observations to derive upper limits. SGR\,1935+2154 established the link between FRBs and X-ray bursts thanks to the coincident radio and X-ray bursts. While the H.E.S.S. upper limits cannot be used to constrain VHE emission from the source's FRBs, they place for the first time constraining upper limits on the persistent and transient VHE emission coincident with magnetar X-ray bursts. The details of the underlying emission mechanism are still unclear and further MWL observations of these objects are necessary. We note that SGR\,1935+2154 renewed its activity in the beginning of 2021 with bursts detected by INGTERAL~\citep{INTEGRAL_2021}, Fermi-GBM~\citep{SGR1935_GBM_2021-1}~\citep{SGR1935_GBM_2021-2}, CGBM~\citep{CGBM_2021} and Konus-Wind~\citep{SGR1935_KONUS-WIND_2021}. The H.E.S.S. program on transient phenomena includes various triggered and untriggered campaigns and aims at providing additional pieces to the puzzle of the origin of FRBs and the mechanisms of magnetar flares. \section*{acknowledgments} The support of the Namibian authorities and of the University of Namibia in facilitating the construction and operation of H.E.S.S. is gratefully acknowledged, as is the support by the German Ministry for Education and Research (BMBF), the Max Planck Society, the German Research Foundation (DFG), the Helmholtz Association, the Alexander von Humboldt Foundation, the French Ministry of Higher Education, Research and Innovation, the Centre National de la Recherche Scientifique (CNRS/IN2P3 and CNRS/INSU), the Commissariat a l'\'energie atomique et aux \'energies alternatives (CEA), the U.K. Science and Technology Facilities Council (STFC), the Knut and Alice Wallenberg Foundation, the National Science Centre, Poland grant No. 2016/22/M/ST9/00382, the South African Department of Science and Technology and National Research Foundation, the University of Namibia, the National Commission on Research, Science \& Technology of Namibia (NCRST), the Austrian Federal Ministry of Education, Science and Research and the Austrian Science Fund (FWF), the Australian Research Council (ARC), the Japan Society for the Promotion of Science and by the University of Amsterdam. We appreciate the excellent work of the technical support staff in Berlin, Zeuthen, Heidelberg, Palaiseau, Paris, Saclay, T\"ubingen and in Namibia in the construction and operation of the equipment. This work benefited from services provided by the H.E.S.S. Virtual Organisation, supported by the national resource providers of the EGI Federation. We thank Sergei Popov, Konstantin Postnov and Maxim Pshirkov for fruitful discussions on the interpretation of the observations. \begin{comment} \section*{Data Availability} The H.E.S.S. raw data and the code used in this study are not public but belong to the H.E.S.S. collaboration. All derived higher-level data that are shown in plots will be made available on the H.E.S.S. collaboration’s web site upon publication of this study. \end{comment}
\section{Introduction} \input{sections/1_introduction} \section{Wind turbine model and its cone coefficient}\label{sec:2} \input{sections/2_model} \section{Blade effective wind speed estimator}\label{sec:3} \input{sections/3_theory} \section{Case study}\label{sec:4} \input{sections/4_case_study} \section{Conclusions}\label{sec:5} \input{sections/5_conclusions} \bibliographystyle{IEEEtran} \subsection{Proportional integral notch estimator} \noindent In our previous work~\cite{Liu_LCSS2021}, we revisited the widely-used I\&I estimator and extended the proportional-only structure by including an integral correction term. Inspired by the extended I\&I estimator which returns an estimate of the REWS, this letter proposes a novel wind speed estimator called the Proportional Integral Notch (PIN) estimator to estimate the BEWS. The frequency content of the wind speed experienced by each blade is composed of specific harmonics that are related to (integer multiples of) the rotor rotational frequency. This is due to, e.g., the wind shear and tower shadow. The BEWS can thus be estimated by amplifying those specific frequencies via a feedback control structure. Therefore, the periodic wind speed over an individual blade $i$ can be estimated as \begin{equation} \begin{cases} \epsilon_i=\hat{m}_i\left(\omega_\mathrm{r}, \hat{U}_{i}, \hat{q}_i, \psi_i \right)-m_i,\\ \hat{U}_i(s) = K(s)\epsilon_i(s) = \left( k_\mathrm{p} K_\mathrm{N}(s) + k_\mathrm{i}/s \right) \epsilon_i, \end{cases} \label{PIN equation} \end{equation} where $\left\{ k_\mathrm{p},\, k_\mathrm{i}\right\} \in\mathbb{R}^{+}$ are the proportional and integral gains. The error between the estimated and measured MOoP is indicated by $\epsilon_i$. The notch transfer function $K_\mathrm{N}(s)$ is scheduled by the rotor speed $\omega_\mathrm{r}$ and is defined as: \begin{equation} \label{eq:Notch-peak} K_\mathrm{N}(s) = \frac{2 w_\mathrm{r} s}{s^2+w_\mathrm{r}^2}. \end{equation} As a result, the PIN estimator transfer matrix $C_{\text{PIN}}(s,\omega_\mathrm{r})$ is formulated as: \begin{equation} \left[ \begin{matrix} \hat{U}_1(s) \\ \hat{U}_2(s) \\ \hat{U}_3(s) \end{matrix} \right] := \underbrace{\left[ \begin{matrix} K(s) & 0 & 0 \\ 0 & K(s) & 0 \\ 0 & 0 & K(s) \end{matrix} \right]}_{C_{\text{PIN}}(s,\omega_\mathrm{r})} \left[ \begin{matrix} \epsilon_1(s) \\ \epsilon_2(s) \\ \epsilon_3(s) \end{matrix} \right]. \label{PIN estimator} \end{equation} \begin{figure} \centering \includegraphics[width=1\columnwidth]{pics/block_diagram_sum.pdf} \caption{Block diagram of the BEWS estimators formed by a negative feedback interconnection of a linear estimator gain and a nonlinear azimuth-dependent cone coefficient. (a) PIN estimator, (b) Coleman estimator.} \label{block_diagram} % \end{figure} From Eq.~\eqref{PIN estimator}, it is evident that a diagonal and decoupled BEWS estimator $K(s)$ solely responds to its local blade load measurements which is depicted in Fig.~\ref{block_diagram}(a). However, it is well known that there exists a significant amount of dynamic coupling between the blades of a turbine rotor~\cite{Mulders_2019}, that is, the coupling is present between the wind speed $\hat{U}_i(s)$ and the blade load $m_j(s)$ for $i \ne j$. The PIN estimator $C_{\text{PIN}}(s,\omega_\mathrm{r})$ is diagonal and thus the off-diagonal terms are nonexistent, which implies that the proposed estimator is unable to take the coupling effects between blades into account. The lack of information on the coupled blade dynamics will degrade the performance of the wind speed estimator, as will become apparent during the numerical simulations in Section~\ref{sec:4}. To cope with the problem of unmodeled dynamics, we propose a second estimation technique which employs the Coleman transformation in a similar estimation framework. This will be outlined in the next subsection. Afterwards, the resemblances between and differences of both estimators are discussed. \subsection{Coleman estimator} \noindent The Coleman transformation~\cite{Bir_2008} is an important technique to convert the wind turbine dynamics to the non-rotating frame. By replacing the diagonal part of the PIN estimator with the forward and inverse Coleman transformations and by including a diagonal integral transfer matrix, the so-called Coleman estimator is formulated as shown in Fig.~\ref{block_diagram}(b). The forward Coleman transformation used in the estimator is defined as follows: \begin{multline} \left[ \begin{matrix} \epsilon_{\text{col}} \\ \epsilon_{\text{tilt}} \\ \epsilon_{\text{yaw}} \end{matrix} \right] := \underbrace{ \frac{2}{3} \left [ \begin{matrix} {1}/{2} & {1}/{2} & {1}/{2} \\ \sin{(\psi_1)} & \sin{\left(\psi_2\right)} & \sin{\left(\psi_3\right)} \\ \cos{(\psi_1)} & \cos{\left(\psi_2\right)} & \cos{\left(\psi_3\right)} \end{matrix} \right ]}_{T_{\text{cm}}(\psi(t))} \left[ \begin{matrix} \epsilon_{1} \\ \epsilon_{2} \\ \epsilon_{3} \end{matrix} \right], \label{Coleman transformation} \end{multline} where $\epsilon_{\text{tilt}}$ and $\epsilon_{\text{yaw}}$ are the error signals of the estimated and projected MOoP in tilt and yaw directions, respectively, while $\epsilon_{\text{col}}$ indicates that of the collective MOoP estimation. With the transfer function matrix $C_{\text{cm}}$ these quantities are mapped to the estimated collective, tilt and yaw wind speed components. The matrix $C_{\text{cm}}$ is composed out of pure integrals in a diagonal structure to obtain the estimate of the wind speeds in the non-rotating frame, and is defined as: \begin{equation} \left[ \begin{matrix} \hat{U}_{\text{col}} \\ \hat{U}_{\text{tilt}} \\ \hat{U}_{\text{yaw}} \end{matrix} \right] := \underbrace{ \left [ \begin{matrix} {K_{\text{col}}}/{s} & 0 & 0 \\ 0 & {K_{0}}/{s} & 0 \\ 0 & 0 & {K_{0}}/{s} \end{matrix} \right ]}_{C_{\text{cm}}(s)} \left[ \begin{matrix} \epsilon_{\text{col}} \\ \epsilon_{\text{tilt}} \\ \epsilon_{\text{yaw}} \end{matrix} \right], \label{Ccm} \end{equation} where $K_{\text{col}}$ is the integral gain for estimating the collective component of the wind speed whereas the gain $K_0$ is used for both the tilt and yaw referred wind speeds for simplicity. Finally, the signals are projected back into the rotating frame to obtain BEWS with the inverse Coleman transformation \begin{align} \left[ \begin{matrix} \hat{U}_{1} \\ \hat{U}_{2} \\ \hat{U}_{3} \end{matrix} \right] &:= \underbrace{ \left [ \begin{matrix} 1 & \sin{(\psi_1)} & \cos{(\psi_1)} \\ 1 & \sin{\left(\psi_2\right)} & \cos{\left(\psi_2\right)} \\ 1 & \sin{\left(\psi_3\right)} & \cos{\left(\psi_3\right)} \end{matrix} \right ]}_{T_{\text{cm}}^{\text{inv}}(\psi(t))} \left[ \begin{matrix} \hat{U}_{\text{col}} \\ \hat{U}_{\text{tilt}} \\ \hat{U}_{\text{yaw}} \end{matrix} \right] \,. \label{inverse Coleman} \end{align} \subsection{Similarities between PIN and Coleman estimators} \noindent Given these two seeming dissimilar BEWS estimators, it is compelling to attempt to understand their similarities. To achieve this goal, the transfer function matrix form of the Coleman estimator gain is first derived in Proposition~\ref{prop: transfer function matrix}. \begin{prop} \label{prop: transfer function matrix} Let us consider the wind turbine operating at a constant rotor speed, that is, $\omega_\mathrm{r}(t)=\omega_0$. The Coleman estimator gain $C_\mathrm{col}$ consisting of ~\eqref{Coleman transformation}, \eqref{Ccm} and \eqref{inverse Coleman} is equivalent to the following transfer function matrix: \begin{equation} C_\mathrm{col}(s,\omega_0) := \left[ \begin{matrix} K_\mathrm{R,a}(s) &K_\mathrm{R,b}(s) &K_\mathrm{R,c}(s) \\ K_\mathrm{R,c}(s) &K_\mathrm{R,a}(s) &K_\mathrm{R,b}(s) \\ K_\mathrm{R,b}(s) &K_\mathrm{R,c}(s) &K_\mathrm{R,a}(s) \end{matrix} \right] \,, \label{eq:Coleman transfer function matrix} \end{equation} where the subscript '$R$' the rotating reference frame, and the transfer functions $K_\mathrm{R,a}$, $K_\mathrm{R,b}$ and $K_\mathrm{R,c}$ are defined as: \begin{align} K_\mathrm{R,a}(s) &:= \frac{(2 K_0 + K_\mathrm{col})s^2+ K_\mathrm{col}\omega_0^2}{3 s(s^2+\omega_0^2)} ,\nonumber\\ K_\mathrm{R,b}(s) &:= \frac{(K_\mathrm{col}-K_0)s^2 + ( K_0 \sqrt{3}\omega_0 )s + K_\mathrm{col}\omega_0^2}{3 s(s^2+\omega_0^2)} ,\nonumber\\ K_\mathrm{R,c}(s) &:= \frac{(K_\mathrm{col}-K_0)s^2 - ( K_0 \sqrt{3}\omega_0 )s + K_\mathrm{col}\omega_0^2}{3 s(s^2+\omega_0^2)}\nonumber. \end{align} \end{prop} \begin{proof} The transfer function between the estimated wind speed in the non-rotating frame $\hat{U}_\text{col,tilt,yaw}(s)$ and $\hat{U}_{1,2,3}(s)$ in the rotating reference frame is given by \begin{multline} \left[ \begin{matrix} \hat{U}_1(s) \\ \hat{U}_2(s) \\ \hat{U}_3(s) \end{matrix} \right] = \mathcal{C}_{-}^\mathrm{T} \left[ \begin{matrix} \hat{U}_\text{col}(s-\mathrm{j}\omega_\mathrm{r}) \\ \hat{U}_\text{tilt}(s-\mathrm{j}\omega_\mathrm{r}) \\ \hat{U}_\text{yaw}(s-\mathrm{j}\omega_\mathrm{r}) \end{matrix} \right] + \mathcal{C}_{+}^\mathrm{T} \\ \left[ \begin{matrix} \hat{U}_\text{col}(s+\mathrm{j}\omega_\mathrm{r}) \\ \hat{U}_\text{tilt}(s+\mathrm{j}\omega_\mathrm{r}) \\ \hat{U}_\text{yaw}(s+\mathrm{j}\omega_\mathrm{r}) \end{matrix} \right] + \mathcal{C}_\text{col}^\mathrm{T} \left[ \begin{matrix} \hat{U}_\text{col}(s) \\ \hat{U}_\text{tilt}(s) \\ \hat{U}_\text{yaw}(s) \end{matrix} \right], \label{q:thetaTY_to_theta123} \end{multline} where \begin{multline*} \mathcal{C}_{-} = \frac{1}{2} \left[ \begin{matrix} 0 & 0 & 0 \\ 0 & 1 & \mathrm{j} \\ 0 & -\mathrm{j} & 1 \end{matrix} \right] \left[ \begin{matrix} 0 & 0 & 0 \\ \cos{(0)} & \cos{(\frac{2\pi}{3})} & \cos{(\frac{4\pi}{3})} \\ \sin{(0)} & \sin{(\frac{2\pi}{3})} & \sin{(\frac{4\pi}{3})} \end{matrix} \right], \end{multline*} \begin{multline*} \mathcal{C}_{+} = \frac{1}{2} \left[ \begin{matrix} 0 & 0 & 0 \\ 0 & 1 & -\mathrm{j} \\ 0 & \mathrm{j} & 1 \end{matrix} \right] \left[ \begin{matrix} 0 & 0 & 0 \\ \cos{(0)} & \cos{(\frac{2\pi}{3})} & \cos{(\frac{4\pi}{3})} \\ \sin{(0)} & \sin{(\frac{2\pi}{3})} & \sin{(\frac{4\pi}{3})} \end{matrix} \right], \end{multline*} and \begin{equation*} \mathcal{C}_\text{col} = \left[ \begin{matrix} 1 & 1 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{matrix} \right], \end{equation*} with $\mathrm{j}=\sqrt{-1}$ being the imaginary unit. Given the diagonal integral form of Eq.~\eqref{Ccm}, it is straightforward to derive the frequency-shifted transfer function as: \begin{equation} \label{eq: tf1} \left[ \begin{matrix} \hat{U}_\text{col}(s-\mathrm{j}\omega_\mathrm{r}) \\ \hat{U}_\text{tilt}(s-\mathrm{j}\omega_\mathrm{r}) \\ \hat{U}_\text{yaw}(s-\mathrm{j}\omega_\mathrm{r}) \end{matrix} \right] = C_\text{cm}(s-\mathrm{j}\omega_\mathrm{r}) \left[ \begin{matrix} \epsilon_\text{col}(s-\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_\text{tilt}(s-\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_\text{yaw}(s-\mathrm{j}\omega_\mathrm{r}) \end{matrix} \right], \end{equation} and \begin{equation} \label{eq: tf2} \left[ \begin{matrix} \hat{U}_\text{col}(s+\mathrm{j}\omega_\mathrm{r}) \\ \hat{U}_\text{tilt}(s+\mathrm{j}\omega_\mathrm{r}) \\ \hat{U}_\text{yaw}(s+\mathrm{j}\omega_\mathrm{r}) \end{matrix} \right] = C_\text{cm}(s+\mathrm{j}\omega_\mathrm{r}) \left[ \begin{matrix} \epsilon_\text{col}(s+\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_\text{tilt}(s+\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_\text{yaw}(s+\mathrm{j}\omega_\mathrm{r}) \end{matrix} \right]. \end{equation} \noindent Combining Eqs.~\eqref{eq: tf1} and~\eqref{eq: tf2}, Eq.~\eqref{q:thetaTY_to_theta123} is rewritten as: \begin{multline} \label{eq:MTY_to_theta123} \left[ \begin{matrix} \hat{U}_1(s) \\ \hat{U}_2(s) \\ \hat{U}_3(s) \end{matrix} \right] = \mathcal{C}_{-}^\mathrm{T} C_\text{cm}(s-\mathrm{j}\omega_\mathrm{r}) \left[ \begin{matrix} \epsilon_\text{col}(s-\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_\text{tilt}(s-\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_\text{yaw}(s-\mathrm{j}\omega_\mathrm{r}) \end{matrix} \right]\\ + \mathcal{C}_{+}^\mathrm{T} C_\text{cm}(s+\mathrm{j}\omega_\mathrm{r}) \left[ \begin{matrix} \epsilon_\text{col}(s+\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_\text{tilt}(s+\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_\text{yaw}(s+\mathrm{j}\omega_\mathrm{r}) \end{matrix} \right] + \mathcal{C}_\text{col}^\mathrm{T} C_\text{cm}(s) \left[ \begin{matrix} \epsilon_\text{col}(s) \\ \epsilon_\text{tilt}(s) \\ \epsilon_\text{yaw}(s) \end{matrix} \right]. \end{multline} \noindent In addition, the Coleman transformed expressions of $\epsilon_{1,2,3}$ are formulated in the frequency domain as: \begin{multline} \label{eq:MTY_to_M123} \left[ \begin{matrix} \epsilon_\text{col}(s) \\ \epsilon_\text{tilt}(s) \\ \epsilon_\text{yaw}(s) \end{matrix} \right] = \frac{2}{3} \mathcal{C}_{-} \left[ \begin{matrix} \epsilon_1(s-\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_2(s-\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_3(s-\mathrm{j}\omega_\mathrm{r}) \end{matrix} \right] + \\ \frac{2}{3} \mathcal{C}_{+} \left[ \begin{matrix} \epsilon_1(s+\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_2(s+\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_3(s+\mathrm{j}\omega_\mathrm{r}) \end{matrix} \right] + \frac{1}{3} \mathcal{C}_\text{col} \left[ \begin{matrix} \epsilon_1(s) \\ \epsilon_2(s) \\ \epsilon_3(s) \end{matrix} \right], \end{multline} \noindent Substituting Eq.~\eqref{eq:MTY_to_M123} into Eq.~\eqref{eq:MTY_to_theta123} yields \begin{multline} \label{eq:MTY_to_theta123_simple} \left[ \begin{matrix} \hat{U}_1(s) \\ \hat{U}_2(s) \\ \hat{U}_3(s) \end{matrix} \right] = \mathcal{C}_{-}^\mathrm{T} C_\text{cm}(s-\mathrm{j}\omega_\mathrm{r}) \left( \frac{2}{3} \mathcal{C}_{-} \left[ \begin{matrix} \epsilon_1(s-2\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_2(s-2\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_3(s-2\mathrm{j}\omega_\mathrm{r}) \end{matrix} \right]\right. \\ + \left. \frac{2}{3} \mathcal{C}_{+} \left[ \begin{matrix} \epsilon_1(s) \\ \epsilon_2(s) \\ \epsilon_3(s) \end{matrix} \right] + \frac{1}{3} \mathcal{C}_\text{col} \left[ \begin{matrix} \epsilon_1(s-\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_2(s-\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_3(s-\mathrm{j}\omega_\mathrm{r}) \end{matrix} \right] \right) \\ + \mathcal{C}_{+}^\mathrm{T} C_\text{cm}(s+\mathrm{j}\omega_\mathrm{r}) \left( \frac{2}{3} \mathcal{C}_{-} \left[ \begin{matrix} \epsilon_1(s) \\ \epsilon_2(s) \\ \epsilon_3(s) \end{matrix} \right] + \frac{2}{3} \mathcal{C}_{+} \left[ \begin{matrix} \epsilon_1(s+2\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_2(s+2\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_3(s+2\mathrm{j}\omega_\mathrm{r}) \end{matrix} \right]\right. \\ + \left. \frac{1}{3} \mathcal{C}_\text{col} \left[ \begin{matrix} \epsilon_1(s+\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_2(s+\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_3(s+\mathrm{j}\omega_\mathrm{r}) \end{matrix} \right] \right) + \mathcal{C}_\text{col}^\mathrm{T} C_\text{cm}(s) \left( \frac{2}{3} \mathcal{C}_{-} \left[ \begin{matrix} \hat{U}_1(s-\mathrm{j}\omega_\mathrm{r}) \\ \hat{U}_2(s-\mathrm{j}\omega_\mathrm{r}) \\ \hat{U}_3(s-\mathrm{j}\omega_\mathrm{r}) \end{matrix} \right]\right. \\ + \left. \frac{2}{3} \mathcal{C}_{+} \left[ \begin{matrix} \epsilon_1(s+\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_2(s+\mathrm{j}\omega_\mathrm{r}) \\ \epsilon_3(s+\mathrm{j}\omega_\mathrm{r}) \end{matrix} \right] + \frac{1}{3} \mathcal{C}_\text{col} \left[ \begin{matrix} \epsilon_1(s) \\ \epsilon_2(s) \\ \epsilon_3(s) \end{matrix} \right] \right), \end{multline} which can be simplified by the remarkable property: \begin{align} \mathcal{C}_{-}^\mathrm{T}\mathcal{C}_{-} = \mathcal{C}_{+}^\mathrm{T}\mathcal{C}_{+} = \mathcal{C}_{-}^\mathrm{T}\mathcal{C}_\text{col} = \mathcal{C}_{+}^\mathrm{T}\mathcal{C}_\text{col} = \mathcal{C}_\text{col}^\mathrm{T}\mathcal{C}_{-} = \mathcal{C}_\text{col}^\mathrm{T}\mathcal{C}_{+} = 0,\nonumber \end{align} and results in the following equation: \begin{multline} \label{eq:MTY_to_theta123_simplified} \left[ \begin{matrix} \hat{U}_1(s) \\ \hat{U}_2(s) \\ \hat{U}_3(s) \end{matrix} \right] = \left( \frac{2}{3} \mathcal{C}_{-}^\mathrm{T} C_\text{cm}(s-\mathrm{j}\omega_\mathrm{r}) \mathcal{C}_{+} \right. \\ \left. + \frac{2}{3} \mathcal{C}_{+}^\mathrm{T} C_\text{cm}(s+\mathrm{j}\omega_\mathrm{r}) \mathcal{C}_{-} + \frac{1}{3} \mathcal{C}_\text{col}^\mathrm{T} C_\text{cm}(s) \mathcal{C}_\text{col} \right) \left[ \begin{matrix} \epsilon_1(s) \\ \epsilon_2(s) \\ \epsilon_3(s) \end{matrix} \right], \end{multline} which results in the transfer function matrix form of the proposed Coleman estimator \label{eq:MBCestimator} and completes the proof. \end{proof} Bode magnitude plots of the transfer function matrix $C_{\text{col}}(s,\omega_0)$ are illustrated in Fig.~\ref{MBCgain}, where $\omega_\mathrm{r}=2\pi f_r$ with $f_r = 0.2$~[Hz] refers to a constant $1$P frequency of the considered wind turbine model. \begin{figure} \centering \includegraphics[width=1\columnwidth]{pics/MBCgain.pdf} \caption{Bode magnitude plots of the Coleman estimator defined by the transfer function matrix in Eq.~\eqref{eq:Coleman transfer function matrix}, where 1P frequency is assumed as constant, which is indicated by a red vertical line.} \label{MBCgain} % \end{figure} The similarities between the PIN estimator (Eq.~\eqref{PIN estimator}) and the Coleman estimator (Eq.~\eqref{eq:Coleman transfer function matrix}) are now further illustrated in the frequency domain. \begin{theorem} Consider the wind turbine operating at a constant rotor speed $\omega_0$. Given the nonlinear and azimuth-dependent cone coefficient of Eq.~\eqref{Cm table}, $C_\mathrm{PIN}(s,\omega_\mathrm{r})$ defined in Eq.~\eqref{PIN estimator} is equivalent to a diagonal structure of $C_\mathrm{col}(s)$ in Eq.~\eqref{eq:Coleman transfer function matrix} only including $K_\mathrm{R,a}(s)$, where \begin{align} k_\mathrm{i} &= \frac{K_\mathrm{col}}{3},\qquad k_\mathrm{p} = \frac{K_0}{3\omega_0}. \label{condition 1} \end{align} \label{theorm 1} \end{theorem} \begin{proof} To prove Theorem~\ref{theorm 1}, the equality $K(s) = K_\mathrm{R,a}(s)$ needs to hold under the conditions of Eq.~\eqref{condition 1}. It is known from Eqs.~\eqref{PIN equation} and \eqref{eq:Notch-peak} that \begin{align} K(s) &= k_\mathrm{p} \frac{2\omega_\mathrm{r} s}{s^2+\omega_\mathrm{r}^2} + \frac{k_\mathrm{i}}{s} \\ &= \frac{k_\mathrm{p} s}{s} \frac{2\omega_\mathrm{r} s}{s^2+\omega_\mathrm{r}^2}+\frac{k_\mathrm{i}}{s} \frac{s^2+\omega_\mathrm{r}^2}{s^2+\omega_\mathrm{r}^2} \\ &= \frac{(2k_\mathrm{p}\omega_\mathrm{r} +k_\mathrm{i})s^2+k_\mathrm{i} \omega_\mathrm{r}^2}{s(s^2+\omega_\mathrm{r}^2)}. \label{proof of thereom 1} \end{align} Given condition~\eqref{condition 1}, it is evident that \eqref{proof of thereom 1} is equal to $K_\mathrm{R,a}$ in~\eqref{eq:Coleman transfer function matrix} which proves that the PIN estimator is equivalent to a particular diagonal structure of the Coleman estimator. \end{proof}
\section{Introduction} \label{sec:intro} Let $F$ be a non-Archimedean local field whose residue field has characteristic $p$. In the local Langlands program, division algebras play an important role because of the Jacquet-Langlands correspondence. This correspondence states that for a division algebra $D$ of invariant $1/n$ over $F$ there is an injection \begin{center} \adjustbox{scale=1.4}{ \begin{tikzcd} \left\{\substack{\text{irreducible smooth} \\ \text{representations} \\ \text{ of } D^\times \text{ over } \overline{\Q}_\ell} \right\}/\simeq \ar[hook]{r} & \left\{ \substack{\text{irreducible smooth} \\ \text{representations}\\ \text{of }\GL_n(F) \text{ over } \overline{\Q}_\ell} \right\}/\simeq \end{tikzcd} } \end{center} where one can describe the image well. Here, we choose the prime $\ell$ so that $\ell\neq p$. The objects on the right side appear in the Langlands correspondence for $\GL_n$, which is then in natural bijection with certain Galois representations over $\overline{\Q}_\ell$. When we instead take representations over a field of characteristic $p$, the problem becomes more difficult. There has been some progress towards proving a characteristic $p$ local Langlands correspondence, such as in \cite{breuil2010emerging}, but in general it is not clear how to formulate the Jacquet-Langlands correspondence given above. One attempt has been made in \cite{scholze2015p}, where for a division algebra of invariant $1/n$ over $F$, Scholze constructs a functor \begin{center} \adjustbox{scale=1.4}{ \begin{tikzcd} \left\{ \substack{\text{smooth admissible} \\ \text{representations}\\ \text{of }\GL_n(F) \text{ over }\F_p} \right\} \ar{r}{\mathcal{F}} & \left\{\substack{\text{smooth admissible} \\ \text{representations} \\ \text{ of } D^\times \text{ over } \F_p} \right\} \end{tikzcd} } \end{center} where $\mathcal{F}(\pi)$ also carries an action of $\Gal(\overline{F}/F)$. This gives some evidence for a mod $p$ analogue of the Jacquet-Langlands correspondence. Because of this, understanding the representation theory of $D^\times$ with $\overline{\F}_p$ coefficients can be expected to be of use in the mod $p$ local Langlands program. The irreducible representations of $D^\times$ over $\overline{\F}_p$ are easy to classify, however because $\Rep(D^\times)$ is not semisimple it is important to understand extensions between irreducible representations. These are what we will ultimately characterize. Let $D$ be a central simple division algebra over $F$ of degree $d$, with a choice of uniformizer $\varpi_D$ and ring of integers $\O_D$. For $a|d$, set $D_a^\times = F^\times \O_D^\times \langle \varpi_D^a \rangle$. Then let $\pi = \Ind_{D_a^\times}^{D^\times}\chi$ and $\pi' = \Ind_{D_{a'}^\times}^{D^\times}\chi'$ be irreducible representations, where $\chi$ and $\chi'$ are characters of $D_a^\times$ and $D_{a'}^\times$. In \S\ref{sec:Ext1}, we prove the following main theorem with some mild constraints on the residue field characteristic of $F$. \begin{theorem}[Theorem \ref{thm: main_thm}] Let $\chi,\chi', \pi$ and $\pi'$ be as above. Let $S=\{\chi^s : s=\varpi_D^i, 0\le i < \gcd(a,a')\}$, so that the elements $s$ form a set of coset representatives for $D_{a'}^\times \setminus D^\times / D_a^\times$. There are two types of direct summands in $\Ext^1_{D^\times}(\pi,\pi')$. If $\Res^{D_{a'}^\times}_{D_{\lcm(a,a')}^\times} \chi'$ is equal to some $\chi^s\in S$, we have a nonzero direct summand $A_{\chi^s}$ fitting into an exact sequence \begin{display} 0 \ar{r} & \overline{\F}_p \ar{r} & A_{\chi^s} \ar{r} & \H^1(1+\pi_F \O_F, \overline{\F}_p) \ar{r}& 0. \end{display} We also get a nonzero direct summand $A_{\chi^s} \simeq \overline{\F}_p$ for each $\chi^s\in S$ for which $\Res^{D_{a'}^\times}_{D_{\lcm(a,a')}^\times} \chi' \otimes (\chi^s)^\ast$ is extended trivially from a character $x \mapsto \left(\frac{x}{\sigma(x)}\right)^{p^i}$. Set $A_{\chi^s}=0$ otherwise. Then $\Ext^1_{D^\times}(\pi,\pi')\simeq \bigoplus_{\chi^s\in S} A_{\chi^s}$. \end{theorem} We note that the cohomology ring of the pro-$p$ group $1+\pi_F \O_F$ with the trivial action is known to be $\bigotimes_{i\in I} \overline{\F}_p[x_i]/x_i^2$ for some index set $I$ when $p$ is large enough so that there is no $p$-torsion. In this case $1+\pi_F\O_F$ is a direct product of $|I|$ copies of $\Z_p$ as a topological group. In the $p$-adic case we have $|I| = [F:\Q_p]$, and in the local function field case we have $I=\N$. Thus, $A_{\chi^s}$ of the first type described in the theorem has dimension $[F:\Q_p]+1$ as an $\overline{\F}_p$-vector space in the $p$-adic case and countable dimension in the local function field case. This paper is organized as follows: in \S \ref{sec:prelims}, we go over some basic information about local division algebras and their representations. In \S\ref{sec:red to cohom}, we translate the problem of computing extensions to one of computing certain cohomology groups. Then, in \S \ref{sec:H1}, we compute the cohomology group $\H^1(1+\varpi_D \O_D, \pi)$ for any smooth irreducible representation $\pi$. Setting $I_1=1+\varpi_D \O_D$, we do this by computing the Frattini subgroup $[I_1,I_1]I_1^p$. We additionally show that almost all elements of this subgroup are of the form $[x,y]z^p$ for $x,y,z\in I_1$. More explicitly, when $d>4$ this is true for every element of the Frattini subgroup that does not also lie in the subgroup $I_3 = 1+\varpi_D^3\O_D$. In \S \ref{sec:Ext1}, we use this to compute $\Ext^1_{D^\times}(\pi,\pi')$ for arbitrary smooth irreducible representations $\pi$ and $\pi'$ of $D^\times$. In the $p$-adic case, we use Poincar\'{e} duality to compute higher extensions and also show how to get partial information about $\H^2(I_1,\overline{\F}_p)$. This is enough to compute all extension groups for a quaternion algebra over $\Q_p$. \subsection{Notation} Throughout, we will fix some notation. We let $F$ be a $p$-adic field of ramification degree $e$ and residue field degree $f$ over $\Q_p$. We also allow $F$ to be an extension of $\F_p\llrrparen{t}$. We denote a choice of uniformizer by $\pi_F$, the ring of integers by $\O_F$, and the residue field by $k_F=\F_q$. The choice of discrete valuation is given by $\nu_F$, normalized so that $\nu_F(\pi_F) = 1$. Over $F$, we consider a degree $d>1$ central simple division algebra $D$, so that $\dim_{F} D = d^2$. We use $\varpi_D$ for a choice of a uniformizer with respect to $\nu_D := \frac{1}{d}\nu_F \circ \Nrd$, where $\Nrd$ is the reduced norm on $D$. We moreover choose $\varpi_D$ so that $\varpi_D^d=\pi_F$. We denote the ring of integers by $\O_D$, and the residue field by $k_D=\F_{q^d}$. We fix an algebraic closure $\overline{\F}_p$ and embeddings $k_F\hookrightarrow k_D \hookrightarrow \overline{\F}_p$. The notation $[\cdot]$ is used for the Tiechmuller lift $[\cdot]: k_D \to D$. We let $\sigma$ be a generator of $\Gal(k_D/k_F)$ such that $\varpi_{D} [x] \varpi_D^{-1} = [\sigma(x)]$ for all $x\in k_D$, and set $I_1=1+\varpi_D \O_D$ to be the unique pro-$p$ Iwahori subgroup of $D^\times$. We assume that $p>de+1$ in the $p$-adic case, as this ensures there is no $p$-torsion in $I_1$. This is automatic in the local function field case; there we instead just assume $\gcd(p,d)=1$. For $a|d$ we set $D_a^\times := F^\times \O_D^\times \langle \varpi_D^a \rangle$. Given a smooth representation $\pi$ of a locally profinite group $G$, we use $\Ext_G^n(\pi,-)$ to denote the $n$th derived functor of $\Hom_G(\pi,-)$, where $\Hom_G(\pi,\pi')$ is the space of $G$-equivariant linear maps from $\pi$ to another smooth $G$-representation $\pi'$. All representations will be over $\overline{\F}_p$. We use $\mathbf{1}$ to denote the trivial character of $G$, which is the space $\overline{\F}_p$ with the trivial action. If $\chi:G\to\overline{\F}_p^\times$ is a character of $G$, then we use $\chi^\ast$ to denote the dual character, so $\chi\otimes\chi^\ast = \mathbf{1}$. For a normal subgroup $H\le G$ and a character $\chi: H \to \overline{\F}_p^\times$, define $\chi^s(h)$ to be $\chi(s^{-1}hs)$ for $s\in G$ and $h\in H$ - we use this in the Mackey formula. Throughout, the cohomology groups $\H^n(G,A)$ are continuous cohomology groups for a topological group $G$ and discrete $G$-module $A$. As a special case of this, $\Hom(G,A)$ is the group of continuous homomorphisms from $G$ to $A$, which we sometimes emphasize by writing it as $\Hom_{\mathrm{cont}}(G,A)$. For a compact open subgroup $K$ of a locally profinite group $G$, the Hecke algebra $\mathcal{H}_K$ is the algebra $\overline{\F}_p[K\setminus G/K]$ of $\overline{\F}_p$-valued bi-$K$-invariant continuous functions of compact support under convolution. For any group $G$ and $g,h\in G$, we use the convention $[g,h] = ghg^{-1}h^{-1}$. We use $[G,G]$ and $[G,G]G^p$ to denote the closures of the commutator and Frattini subgroups of an $\ell$-group group $G$. \section{Preliminaries} \label{sec:prelims} \subsection{Structure of division algebras} There is a decomposition \[D^\times \simeq \varpi_D^\Z \ltimes (k_D^\times \ltimes I_1),\] similar to the analogous decomposition of $F^\times$ except we must use semidirect products due to non-commutativity. The subgroup $I_1$ has a filtration \[I_i = 1+\varpi_D^i \O_D,\] where $I_i/I_{i+1} \simeq k_D$ as an additive group for $i\ge 1$. We may understand elements of $D$ explicitly via Tiechmuller lifts $[\cdot]: k_D \to D$, which allows a unique representation of every element as $x = \sum_{i\ge n} [x_i] \varpi_D^i$. Up to isomorphism, the central simple division algebras $D$ over $F$ are classified by the result of the invariant map \begin{display} \mathrm{Br}(F) \ar{r}{\mathrm{inv}_F} & \Q/\Z. \end{display} This is an isomorphism, and the isomorphism classes $[D]$ of degree $d$ central simple division algebras are obtained as preimages of $\frac{r}{d}$ where $\gcd(r,d) = 1$. The value $r$ reflects the choice of the generator $\sigma := (x\mapsto x^{q^r})$ of $\Gal(k_D/k_F)$, such that $\varpi_D[x]\varpi_D^{-1}=[\sigma(x)]$. \subsection{Representations of \texorpdfstring{$D^\times$}{Dx}} We work with smooth representations of $D^\times$ with coefficients in $\overline{\F}_p$, which makes the following well-known lemma crucial: \begin{lemma-N} Let $G$ be a pro-$p$ group. Then any nonzero smooth $\overline{\F}_p$-representation $V$ has $V^G \neq 0$. \label{lem:pro-p_reps} \end{lemma-N} \begin{proof} This is a classical result, which can be easily deduced from Proposition 26 in \cite{serre1977linear} which deals with finite $p$-groups. \end{proof} To begin, we would like to understand the characters of $D^\times$. There is an exact sequence \begin{display} 1 \ar{r} & D^\times_{\Nrd=1} \ar{r} & D^\times \ar{r}{\Nrd} & F^\times \ar{r} & 1, \end{display} where exactness follows from the fact that $\Nrd$ is surjective. This is because the degree $d$ unramified extension $E/F$ is contained in $D$ and one can show $\Nrd|_{E}=\Nm_{E/F}$, so surjectivity of $\Nrd$ follows from surjectivity of the norm map from $\O_E^\times$ to $\O_F^\times$ for unramified extensions and the fact that $\Nrd(\varpi_D)$ is a unit multiple of $\pi_F$. It is known that $D^\times_{\Nrd=1} = [D^\times, D^\times]$, see for example \S 1.4.3 of \cite{platonov1993algebraic}. Then any character $D^\times \to \overline{\F}_p^\times$ arises as \begin{display} \chi: D^\times \ar{r}{\Nrd} & F^\times \ar{r}{\kappa} & \overline{\F}_p^\times \end{display} because $\overline{\F}_p^\times$ is abelian, so any homomorphism into this group must factor through the abelianization. We can easily classify the characters $\kappa$ of $F^\times$ via $F^\times \simeq \pi_F^\Z \times k_F^\times \times (1+\pi_F \O_F)$, where the final component is pro-$p$ and hence we only need to compute characters of $\pi_F^\Z \times k_F^\times$ by the previous lemma. These are both cyclic groups, so the characters are then determined by where we send the generators of each component. Now we turn to classifying characters of $D_a^\times$. Recall that this subgroup is defined to be $F^\times \O_D^\times \langle \varpi_D^a \rangle$ where $a|d$. As special cases, $D_d^\times = F^\times \O_D^\times$ and $D_1^\times=D^\times$. We have a decomposition \[D_a^\times \simeq \varpi_D^{a\Z} \ltimes (k_D^\times \ltimes I_1),\] and so we can denote elements by $(\varpi_D^{an},x,y)$ where $x\in k_D^\times$ and $y\in I_1$. \begin{lemma-N} The characters of $D_a^\times$ are given by \[\chi_{a,\alpha,m}: (\varpi_D^{an},x,y) \mapsto \alpha^{n} \Nm_{k_D/\F_{q^a}}(x)^m.\] Here, $\alpha\in \overline{\F}_p^\times$ and $m\in \Z$. \end{lemma-N} \begin{proof} As $I_1$ is a pro-$p$ group, Lemma \ref{lem:pro-p_reps} implies that any character mapping to $\overline{\F}_p^\times$ must only depend on $\varpi_D^{an}$ and $x$. Because $\varpi_D^{a\Z}$ and $k_D^\times$ are cyclic and $k_D^\times$ embeds into $\overline{\F}_p^\times$, such a character must be of the form $\chi: (\varpi_D^{an},x,y) \mapsto \alpha^{n} x^m$. The only thing to work out is exactly which values of $m$ are allowed. In order for $\chi$ to be well-defined on $D_a^\times$, it must be the case that \[\chi([x])=\chi(\varpi_D^a [x] \varpi_D^{-a})=\chi([\sigma^a(x)]).\] In particular, $x^m=\sigma^a(x^m)$ for all $x\in k_D^\times$. This gives a congruence condition on $m$. Namely, viewing $m \in \Z/|k_D^\times|\Z$, if $\sigma$ sends $x \mapsto x^{q^r}$ we have $m \equiv q^{ar}m \pmod{|k_D^\times|}$. This means $\frac{q^{d}-1}{q^{a}-1}$ divides $m$, and so the character restricted to $k_D^\times$ factors through the norm map $\Nm_{k_D/\F_{q^a}}$. From this we know that any character must take the form given in the lemma. \end{proof} \begin{corollary-N} Suppose $a|a'$ are divisors of $d$. Then \[\Res^{D_a^\times}_{D_{a'}^\times} \chi_{a,\alpha,m} = \chi_{a',\alpha^{a'/a},m'}\] where $m'=\frac{q^{a'}-1}{q^{a}-1}m$, which implies that $\Nm_{k_D/\F_{q^{a}}}(x)^m = \Nm_{k_D/\F_{q^{a'}}}(x)^{m'}$ for all $x\in k_D^\times$. \label{cor:char_restriction} \end{corollary-N} In particular, we see that we can obtain all characters $\chi_{a',\alpha',0}$ from restrictions of characters $\chi_{1,\alpha,0}= \kappa \circ \Nrd$ of $D^\times$ as we may choose $\alpha$ to be an $a$th root of $\alpha'$ (recall $d$ is assumed to be coprime to $p$ in any case). We will now show that all irreducible representations can be obtained from inductions of characters of $D_a^\times$. In the following theorem, a character $\chi$ of $k_D^\times$ is said to be of order $a$ if $a$ is the minimal integer such that $\chi(x)=\chi(\sigma^a(x))$ for all $x\in k_D^\times$. Such a character can be inflated along the quotient map $\O_D^\times \to k_D^\times$, and then extended trivially to $F^\times \O_D^\times$. By assigning the value of $\varpi_D^a$ to be $1$, it is then extended to $D_a^\times$. \begin{theorem-N}[\cite{ly2013representations}, Prop. 1.3.1] The smooth irreducible mod $p$ representations $V$ of $D^\times$ are given by \[V_{\chi,\kappa} := \Ind_{D_a^\times}^{D^\times} \left(\chi \otimes \kappa \right).\] Here, $\kappa$ is a character of the type $\chi_{a,\alpha,0}$. The character $\chi$ is extended from an order $a$ character of $k_D^\times$. We have $V_{\chi,\kappa} \simeq V_{\chi',\kappa'}$ if and only if $\kappa = \kappa'$ and $\chi = (\chi')^s$ for some $s\in D^\times$. \label{thm:irrep_classification} \end{theorem-N} \begin{proof} Let $V$ be an irreducible representation of $D^\times$ over $\overline{\F}_p$. Then, again by Lemma \ref{lem:pro-p_reps}, we know $V^{I_1}$ is a nonzero subrepresentation because $I_1$ is pro-$p$ and normal, so $V^{I_1}=V$. It follows that irreducible representations of $D^\times$ are in bijection with those of \[D^\times/I_1 \simeq \varpi_D^\Z \ltimes k_D^\times.\] The irreducible representations of this group over $\overline{\F}_p$ are well-known, as it is a semidirect product of $\varpi_D^\Z\simeq \Z$ and a finite abelian group with order prime to $p$. This is shown in \cite{serre1977linear} \S 8.2, and the irreducibles match up to those given in the theorem statement. \end{proof} \section{Reduction to cohomology}\label{sec:red to cohom} We will begin by explaining how to reduce the computation of $\Ext^n_{D^\times}(\pi,\pi')$ to extensions between characters, after which we can reduce that problem to computation of certain cohomology groups. There are two main facts used in this reduction: first, that $\pi$ and $\pi'$ are induced from characters. Secondly, the inductions are from \textit{finite index} subgroups, so Frobenius reciprocity is a two-sided adjunction. \begin{lemma-N} For a locally profinite group $G$, let $H\le G$ be a closed subgroup such that $[G:H]<\infty$, and let $V$ and $W$ be smooth representations of the groups $H$ and $G$ respectively. Then we have \[\Ext^n_G(\Ind_H^G V, W) \simeq \Ext^n_H(V, \Res^G_H W).\] This also holds in the other direction. \end{lemma-N} \begin{proof} This is a well-known fact from category theory: Frobenius reciprocity carries on to the derived functors of $\Hom$ because we have an adjunction both ways, since for finite index subgroups compact induction agrees with induction. \end{proof} Now we can use this to reduce our problem to computing extensions of characters. Consider irreducible representations $\pi = \Ind_{D_{a}^\times}^{D^\times}\chi$ and $\pi' = \Ind_{D_{a'}^\times}^{D^\times}\chi'$. Here, we have absorbed the $\kappa$ component in the notation of Theorem \ref{thm:irrep_classification} into $\chi$, so that $\chi$ and $\chi'$ are more general characters of $D_a^\times$ and $D_{a'}^\times$ rather than characters extended from $k_D^\times$. We would like to compute the dimension of $\Ext_{D^\times}^n(\pi,\pi')$. \begin{theorem-N} Let $\chi,\chi',\pi$ and $\pi'$ be as given above. Then \[\Ext^n_{D^\times}(\pi, \pi') \simeq \bigoplus_{\overline{s} \in D_{a'}^\times \setminus D^\times / D_a^\times} \Ext^n_{D_{\lcm(a,a')}^\times}(\mathbf{1}, (\Res^{D_{a'}^\times}_{D_{\lcm(a,a')}^\times} \chi' )\otimes (\chi^s)^\ast),\] where $s$ is a coset representative of the double coset $\overline{s}$. The characters $\chi^s$ on $D_{\lcm(a,a')}^\times$ are defined as $\chi^s(x)=\chi(s^{-1}xs)$, and so are conjugated restrictions of $\chi$. \label{thm:reduction_to_chars} \end{theorem-N} \begin{proof} We first apply Frobenius reciprocity, the first time on the right induced representation. By the previous lemma, we may apply it for $\Ext^n$ as the subgroups $D_a^\times$ and $D_{a'}^\times$ have finite index in $D^\times$. We have \[\Ext^n_{D^\times}(\pi,\pi') = \Ext^n_{D^\times} (\Ind_{D_a^\times}^{D^\times}\chi,\Ind_{D_{a'}^\times}^{D^\times}\chi') \simeq \Ext^n_{D_{a'}^\times}(\Res^{D^\times}_{D_{a'}^\times}\Ind_{D_{a}^\times}^{D^\times}\chi,\chi').\] By the Mackey formula, we have \[\Res^{D^\times}_{D_{a'}^\times}\Ind_{D_{a}^\times}^{D^\times}\chi \simeq \bigoplus_{\overline{s} \in D_{a'}^\times \setminus D^\times / D_{a}^\times} \Ind_{sD_a^\times s^{-1} \cap D_{a'}^\times}^{D_{a'}^\times} \chi^s,\] where $s$ is a representative of the double coset $\overline{s}$. Because $D_a^\times$ is normal, the subgroup we induce from is simply $D_a^\times \cap D_{a'}^\times = D_{\lcm(a,a')}^\times$. We now pull out the direct sum and apply Frobenius reciprocity on the other side. We then obtain \[\bigoplus_{\overline{s} \in D_{a'}^\times \setminus D^\times / D_{a}^\times} \Ext^n_{D_{a'}^\times} (\Ind_{D_{\lcm(a,a')}^\times}^{D_{a'}^\times} \chi^s, \chi') \simeq \bigoplus_{\overline{s} \in D_{a'}^\times \setminus D^\times / D_{a}^\times} \Ext^n_{D_{\lcm(a,a')}^\times}(\chi^s, \Res^{D_{a'}^\times}_{D_{\lcm(a,a')}^\times} \chi').\] The result then follows after tensoring with $(\chi^s)^\ast$ on each individual extension group. \end{proof} Thus, it suffices to be able to compute $\Ext^n_{D_a^\times}(\mathbf{1},\chi)$ for any character $\chi$ of $D_a^\times$. We can now employ all the tools of group cohomology to solve our problem. It is tempting to try to use the Hochschild-Serre spectral sequence and identify $\Ext^n_{D_a^\times}(\mathbf{1},\chi)$ with $\H^n(D_a^\times, \chi)$, but this does not quite work. Since we must work with continuous cohomology and smooth representations, and $D_a^\times$ is not a profinite group, we cannot use the Hochschild-Serre spectral sequence in this case. However, we can recover a similar spectral sequence. \begin{proposition-N} There is a first quadrant spectral sequence \[E_2^{i,j} = \H^i(D_a^\times/I_1,\H^j(I_1,\chi)) \implies \Ext^{i+j}_{D_a^\times}(\mathbf{1},\chi).\] \label{prop: ext_spectral_seq} \end{proposition-N} \begin{proof} From equation (33) in \S 9 of \cite{paskunas2007extensions}, letting $\mathcal{H}=\overline{\F}_p[D_a^\times/I_1]$ be the Hecke algebra of $I_1$, we have a spectral sequence \[E_2^{i,j} = \Ext^i_{\mathcal{H}}(\mathbf{1},\H^j(I_1,\chi)) \implies \Ext^{i+j}_{D_a^\times}(\mathbf{1},\chi).\] We may ignore the central character in our setting. The extension group is computed in the category of all $\mathcal{H}$-modules or equivalently $D_a^\times/I_1$-representations, which allows us to identify $\Ext^i_{D_a^\times/I_1, \mathrm{all}}(\mathbf{1},-) \simeq \H^i_{\mathrm{all}}(D_a^\times/I_1,-)$. Because the quotient $D_a^\times/I_1 \simeq \varpi_D^{a\Z} \ltimes k_D^\times$ is a discrete group, it follows that this is the same as the continuous cohomology. We then obtain a spectral sequence \[E_2^{i,j} = \H^i(D_a^\times/I_1,\H^j(I_1,\chi)) \implies \Ext^{i+j}_{D_a^\times}(\mathbf{1},\chi)\] as desired. \end{proof} As the spectral sequence of Proposition \ref{prop: ext_spectral_seq} is a first quadrant spectral sequence, we may obtain the following five-term exact sequence of low degree terms: \begin{display} 0 \ar{r} & \H^1(D_a^\times/I_1,\chi) \ar{r} & \Ext^1_{D_a^\times}(\mathbf{1},\chi) \ar{r} \ar[draw=none]{d}[name=X, anchor=center]{} & (\Hom(I_1,\overline{\F}_p) \otimes \chi)^{D_a^\times/I_1} \ar[rounded corners, to path={ -- ([xshift=2ex]\tikztostart.east) |- (X.center) \tikztonodes -| ([xshift=-2ex]\tikztotarget.west) -- (\tikztotarget)}]{dll}[at end]{} \\ & \H^2(D_a^\times/I_1,\chi) \ar{r} & \Ext^2_{D_a^\times}(\mathbf{1},\chi) \end{display} Here, we have expanded the definition of $\H^1(I_1,\chi)^{D_a^\times/I_1}$. Thus, we obtain an exact sequence similar to the inflation-restriction exact sequence we would obtain via the Hochschild-Serre spectral sequence if $D_a^\times$ were a profinite group. In Corollary \ref{cor: general_ext_sequence}, we use the same spectral sequence to obtain a description of $\Ext^n_{D_a^\times}(\mathbf{1},\chi)$ in terms of the cohomology of $I_1$, so this step in our method works for all degrees of extensions. \section{Cohomology of \texorpdfstring{$I_1$}{I1}} \label{sec:H1} Recall that we use $I_1$ to denote the subgroup $1+\varpi_D\O_D$ of $D^\times$. A key step in computing all extensions of irreducible representations of $D^\times$ is to understand the space $\H^1(I_1,\pi)$ as a representation of $D_a^\times/I_1$, where $\pi$ is a smooth irreducible representation of $D_a^\times$. Note that at the end of the previous section we had reduced to the case where $\pi$ was a character, but the computation is the same if $\pi$ is an irreducible of any dimension which is what we will assume here. Since the action of $I_1$ is trivial on $\pi$, we have $\H^1(I_1,\pi) \simeq \Hom(I_1,\overline{\F}_p) \otimes \pi$, where the action of $g\in D_a^\times/I_1$ on $\Hom(I_1,\overline{\F}_p)$ sends a homomorphism $\varphi(x)$ to $\varphi(g^{-1}xg)$ and we view $\pi$ as a representation of $D_a^\times/I_1$. Note that we use the normality of $I_1$ here - in general, this cohomology group is only a module over the Hecke algebra $\mathcal{H}_{I_1}$. Thus, we seek to understand the homomorphism space $\Hom(I_1,\overline{\F}_p)$. Because the additive group $\overline{\F}_p$ is abelian and every element is $p$-torsion, any homomorphism $\varphi:I_1\to \overline{\F}_p$ will factor through the following diagram: \begin{display} I_1 \ar{r}{\varphi} \ar{d} & \overline{\F}_p \\ \frac{I_1}{[I_1,I_1]I_1^p} \ar[dotted]{ru}{\varphi'} & \end{display} The homomorphism $\varphi'$ is unique given $\varphi$. The closed subgroup $[I_1,I_1]I_1^p\triangleleft I_1$ generated by commutators and $p$th powers is called the Frattini subgroup of $I_1$. Hence, we can reduce our problem of computing $\Hom(I_1,\overline{\F}_p)$ to that of computing $\Hom(I_1/[I_1,I_1]I_1^p,\overline{\F}_p)$. We do this by computing the Frattini subgroup itself. \subsection{The Frattini subgroup} To compute $[I_1,I_1]I_1^p$, we will begin with computing $I_1^p$. In the $p$-adic case, this has a simple description. \begin{proposition-N} If $F$ is an extension of $\Q_p$, then $I_1^p = 1+\varpi_D^{de+1}\O_D$. \label{prop:pth_powers} \end{proposition-N} \begin{proof} First we show that $I_1^p\subset 1+\varpi_D^{de+1}\O_D$. Let $1+x\in I_1$ for $x\in \varpi_D\O_D$. Then we have $(1+x)^p = \sum_{0\le i\le p} \binom{p}{i}x^i = 1+px\sum_{1\le i\le p-1} \left(\binom{p}{i}/p\right)x^{i-1}+x^p$. Because $F$ is a $p$-adic field, we have $\varpi_D^{de} = \pi_F^e=pu$ for some unit $u\in \O_F^\times$. Thus, because $x\in \varpi_D\O_D$, $px$ is in $\varpi_D^{de+1}\O_D$. Moreover, because $p>de+1$, we have that $x^p$ is in $\varpi_D^{de+1}\O_D$, so $(1+x)^p$ is in $1+\varpi_D^{de+1}\O_D$ as desired. Now we show that $I_1^p\supset 1+\varpi_D^{de+1}\O_D$. Let $1+y\in 1+\varpi_D^{de+1}\O_D$ for some $y\in \varpi_D^{de+1}\O_D$. As a formal power series, we know that \[\left(\sum_{n=0}^\infty \binom{1/p}{n} Y^n\right)^p = 1+Y,\] so to prove that $1+y\in I_1^p$ it suffices to show that $\sum_{n=0}^\infty \binom{1/p}{n} y^n$ converges in $I_1$. Because the $n=0$ term in this series is $1$ and $\varpi_D\O_D$ is closed in $D$, it suffices to show that $\nu_D\left(\binom{1/p}{n} y^n\right)>0$ for all $n>0$ and that $\nu_D\left(\binom{1/p}{n} y^n\right)\to\infty$ as $n\to\infty$. We have the identity \[\binom{1/p}{n} = \frac{(-1)^n}{n!} \prod_{0\le i \le n-1} \left(\frac{ip-1}{p}\right).\] Thus, because $\nu_D = \nu_F = e\nu_p$ on $\Q_p$ (where $\nu_p$ is the $p$-adic valuation), we compute $\nu_D\left(\binom{1/p}{n} y^n\right) = \nu_D(y^n)-(e\nu_p(n!)+e\nu_p(p^n)) = n\nu_D(y)-e(\nu_p(n!)+n)$. We also have $\nu_D(\varpi_D) = \frac{1}{d}$, so because $y\in \varpi_D^{de+1}\O_D$, we have $\nu_D(y)\ge \nu_D(\varpi_D^{de+1}) = e\left(1+\frac{1}{de}\right)$. By Legendre's formula, $\nu_p(n!)$ is bounded above by $\frac{n}{p-1}$. Therefore, \[\nu_D\left(\binom{1/p}{n} y^n\right)\ge ne\left(1+\frac{1}{de}\right)-ne\left(\frac{1}{p-1}+1\right),\] and because $p-1>de$ this will be greater than $0$ for $n>0$ and approach $\infty$ as $n\to\infty$. \end{proof} When $F$ is an extension of $\F_p\llrrparen{t}$, we work in characteristic $p$, so we have $(1+x)^p = 1 + x^p$. This implies that \[I_1^p = 1+(\varpi_D\O_D)^p.\] We now turn to computing $[I_1,I_1]$. The following decomposition will be useful here, as well as later on. \begin{lemma-N} Suppose $p>de+1$ if $F/\Q_p$ or $\gcd(d,p)=1$ in the local function field case. We have a decomposition \[I_1 = (1+\pi_F \O_F) \times I_{1,\Nrd=1},\] where $I_{1,\Nrd=1}$ is the kernel of the reduced norm restricted to $I_1$. \label{lem:subgrp_generators} \end{lemma-N} \begin{proof} Because there is no $p$-torsion, $1+\pi_F \O_F$ is a direct product of copies of $\Z_p$ as a multiplicative group. It follows that every element has a unique $d$th root, which means that $\Nrd|_{1+\pi_F \O_F}: x \mapsto x^d$ is surjective. Any element $x\in I_1$ can then be divided by an element of $1+\pi_F \O_F$ to land in $I_{1,\Nrd=1}$, which shows $I_1 = (1+\pi_F \O_F)I_{1,\Nrd=1}$. These subgroups have trivial intersection, since the only $d$th root of $1$ in $1+\pi_F \O_F$ is $1$. Finally, both of these subgroups are normal because $1+\pi_F\O_F$ is central, so we have $I_1 = (1+\pi_F \O_F) \times I_{1,\Nrd=1}$ as desired. \end{proof} As $1+\pi_F \O_F$ is central in $I_1$, we then have $[I_1,I_1]=[I_{1,\Nrd=1},I_{1,\Nrd=1}]$. We compute this using \S 1.4 of \cite{platonov1993algebraic}. The following lemma is useful when considering the lowest nonzero coefficients in a commutator in $[I_{1,\Nrd=1},I_{1,\Nrd=1} \cap I_i]$. This will be used in the theorem that follows. \begin{lemma-N} Let $i\ge 0$, and for $y\in k_D$ let $\varphi_{i,y}\in \End_{k_F}(k_D)$ denote the map \[\varphi_{i,y}: x\mapsto \sigma(x)y-x\sigma^i(y).\] The image of $\varphi_{i,y}$ is the subspace \[\ker (\Tr_{k_D/k_F}) \cdot \prod_{0\le j\le i} \sigma^j(y),\] which has codimension one for $y\in k_D^\times$. \label{lem:codim_1} \end{lemma-N} \begin{proof} Since $\sigma$ fixes $k_F$, the $k_F$-linearity of this map follows immediately. When $y=0$, the result is clear, so suppose now that $y\in k_D^\times$. We first compute the kernel of this map. We have $\varphi_{i,y}(x)=0$ if and only if $\sigma(x) y = x \sigma^i(y)$. For $x\neq 0$, this is equivalent to $\frac{x}{\sigma(x)} = \frac{y}{\sigma^i(y)}$, which always has a solution $x$ by the multiplicative version of Hilbert's theorem 90 as \[\Nm_{k_D/k_F}(y/\sigma^i(y))=1\] and $\sigma$ is a generator of the Galois group. Again since $\sigma$ is a generator, we have $k_D^{\langle\sigma\rangle} = k_F$, so the kernel is one-dimensional: supposing for nonzero $x'$ we have $\frac{x'}{\sigma(x')} = \frac{x}{\sigma(x)}$, then $\sigma(\frac{x'}{x})=\frac{x'}{x}$ so the ratio lies in $k_F^\times$. Thus, $\im \varphi_{i,y}$ is a codimension one subspace. Noting that \[\frac{\varphi_{i,y}(x)}{\prod_{0\le j\le i} \sigma^j(y)} = \frac{\sigma(x)}{\prod_{0 < j \le i} \sigma^j(y)} - \frac{x}{\prod_{0\le j < i} \sigma^j(y)},\] applying $\sigma$ to the second term on the right hand side yields the first term, so the right hand side is contained in $\ker(\Tr_{k_D/k_F})$ and \[\im\varphi_{i,y}\subset\ker (\Tr_{k_D/k_F}) \cdot \prod_{0\le j\le i} \sigma^j(y).\] The additive version of Hilbert's theorem 90 says $\ker \Tr_{k_D/k_F} = \im(\sigma(x)-x) = \im \varphi_{i,1}$, which was shown to also have codimension one. Hence, we have equality. \end{proof} \begin{theorem-N} We have \[[I_1,I_1]I_1^p=I_{1,\Nrd=1}I_1^p \cap I_2.\] When $F/\Q_p$, we may describe $I_1^p$ as in Proposition \ref{prop:pth_powers}, and when $F/\F_p\llrrparen{t}$ we have $I_1^p=1+(\varpi_D \O_D)^p$. Here, we make the same assumptions on $p$ as Lemma \ref{lem:subgrp_generators}. \label{thm:GL1_frattini_subgroup} \end{theorem-N} \begin{proof} There is a filtration $I_{i,\Nrd=1} := I_{1,\Nrd=1} \cap I_i$. As previously discussed, by Lemma \ref{lem:subgrp_generators} we have \[[I_1,I_1]=[I_{1,\Nrd=1},I_{1,\Nrd=1}].\] By Theorem 1.9 in \cite{platonov1993algebraic}, for $d>2$ this commutator subgroup equals $I_{2,\Nrd=1}$. This can be extended to the case of $d=2$ here because of the restrictions on $p$. Because $I_1^p\subset I_2$, the claim of the theorem follows immediately. The argument in \cite{platonov1993algebraic} is short, so we summarize it here. We show first that under the quotient map $q_i: I_i \to I_i/I_{i+1} \simeq k_D$ we have $q_{i+1}([I_{1,\Nrd=1}, I_{i,\Nrd=1}]) = q_{i+1}(I_{i+1,\Nrd=1})$. Indeed, a computation shows that the image $q_{i+1}([I_{1,\Nrd=1}, I_{i,\Nrd=1}])$ contains the elements $\varphi_{i,y}(x)$ where $y\in k_D$ and $x\in q_i(I_{i,\Nrd=1})$, where we have $q_i(I_{i,\Nrd=1}) = k_D$ if $d\nmid i$ and $q_i(I_{i,\Nrd=1}) = \ker(\Tr_{k_D/k_F})$ if $d|i$. Then Lemma \ref{lem:codim_1} can be used to show that these generate all of $q_{i+1}(I_{i+1,\Nrd=1})$ in either case: when $d|(i+1)$, we have $\im (\varphi_{i,y}) = \ker(\Tr_{k_D/k_F})$ for any $y$, so we indeed get all of $q_{i+1}(I_{i+1,\Nrd=1})$; when $d \nmid (i+1)$, we can show that we generate all of $q_{i+1}(I_{i+1,\Nrd=1})=k_D$ by first finding $y,y'\in k_D$ so that $\im (\varphi_{i,y}) \neq \im (\varphi_{i,y'})$. Choosing $y=1$ and $y'$ such that $\prod_{0\le j\le i} \sigma^j(y')$ does not lie in $k_F$, we can always do this. If, in addition, $d|i$, the values $x$ are restricted to $\ker( \Tr_{k_D/k_F})$ so we need to justify why this still suffices. The image of $\varphi_{i,y}|_{\ker (\Tr_{k_D/k_F})}$ still has codimension one since $k_F=\ker (\varphi_{i,y})$ has trivial intersection with $\ker( \Tr_{k_D/k_F})$ (because $p$ and $d$ are coprime) and so restricted to $\ker (\Tr_{k_D/k_F})$ the map $\varphi_{i,y}$ is an isomorphism. Thus, we have $q_{i+1}([I_{1,\Nrd=1}, I_{i,\Nrd=1}]) = q_{i+1}(I_{i+1,\Nrd=1})$. It then follows that \[[I_{1,\Nrd=1}, I_{i,\Nrd=1}] I_{i+2,\Nrd=1} = I_{i+1,\Nrd=1}.\] Now $[I_{1,\Nrd=1},I_{1,\Nrd=1}]$ is a non-central normal subgroup of $D^\times_{\Nrd=1}$, and so by Theorem 3.3 in \cite{platonov1993algebraic} it is open and contains $I_{j,\Nrd=1}$ for some $j$. Supposing that the minimal such $j$ satisfies $j>2$, then we have \[[I_{1,\Nrd=1},I_{1,\Nrd=1}] \supset [I_{1,\Nrd=1},I_{j-2,\Nrd=1}] I_{j,\Nrd=1} = I_{j-1,\Nrd=1},\] which contradicts the fact that $j$ is minimal. Thus, we must have $j\le 2$. But we also have $[I_{1,\Nrd=1},I_{1,\Nrd=1}]\subset I_{2,\Nrd=1}$, so we have equality. \end{proof} \begin{remark} In the case of $d=2$, as shown in \cite{riehm1970norm}, \S 5, the same result about the commutator subgroup of $I_{1,\Nrd=1}$ being $I_{2,\Nrd=1}$ will still hold so long as $D$ is not a dyadic division algebra. This case is ruled out because $\gcd(p,d)=1$ in any case, so this assumption is important to include. \end{remark} \subsection{A commutator construction} While not needed for computing $\H^1(I_1,\pi)$, we can actually show that nearly all elements of $[I_1,I_1]I_1^p$ are products of a single commutator and a $p$th power, rather than products of many commutators and a $p$th power as done above. Namely, every element of $[I_1,I_1]I_1^p$ that does not lie in $I_3$ is a product of a commutator and $p$th power when $d>4$. We first study $q_2([I_1,I_1])$ in detail in Proposition \ref{prop: comm_choice} to determine the exact number of ways a given value in $k_D$ can be produced. We use this in the corollary that follows to show there are enough ways to do this that we can inductively choose $x,y\in I_1$ so that $[x,y]$ produces the desired commutator by studying the coefficient of $\varpi_D^i$ in the expansion of $[x,y]$ using Tiechmuller representatives. \begin{proposition-N} Suppose $d>4$ and fix $\alpha \in k_D^\times$. There exist $1+[x]\varpi_D\neq 1$ and $1+[y]\varpi_D\neq 1$ such that \[q_2([1+[x]\varpi_D,1+[y]\varpi_D])=\alpha,\] and $x/y$ does not lie in any proper subfield of $k_D$. \label{prop: comm_choice} \end{proposition-N} \begin{proof} If we show that there are more than $\frac{q^{d/2+1}-1}{q-1}$ ratios $x/y$ achieve any given value of $\alpha$, then the claim follows. This is because $\frac{q^{d/2+1}-1}{q-1}\ge \sum_{a\le d/2} q^a \ge |\bigcup_{a|d, a<d} \F_{q^a}|$, the number of elements in the union of all proper subfields of $k_D$. We first show that the number of ratios can be deduced from the number of pairs $(x,y)$. To have $q_2(1+[x]\varpi_D,1+[y]\varpi_D])=\alpha$ requires $x \sigma(y)-\sigma(x)y=\alpha$. Viewed as a curve $C_\alpha$ over $k_D$, this has many symmetries. The $(q+1)$th roots of unity $\langle \zeta \rangle = \mu_{q+1}(k_D)$ act on $C_\alpha$. In particular, given $(x,y) \in C_\alpha(k_D)$ we have $(\zeta x, \zeta y)$ as another solution. If we fix the ratio $x/y$, then the system \[x\sigma(y)-\sigma(x)y =\alpha, x/y = \beta\] gives $x=y\beta$, so we solve $y\beta \sigma(y) - \sigma(y) \sigma(\beta)y = \alpha$. Note that $\beta-\sigma(\beta) \neq 0$ as $\alpha \neq 0$, so if solutions exist there are $|\mu_{q+1}(k_D)|$ of them. Thus, over nonzero values $\alpha$ the number of ratios $x/y$ from $(x,y)\in C_\alpha(k_D)$ is precisely $|C_\alpha(k_D)|/|\mu_{q+1}(k_D)|$, where $|C_\alpha(k_D)|$ denotes the number of points over $k_D$. Thus, we now want to show $|C_\alpha(k_D)|$ exceeds $|\mu_{q+1}(k_D)|\frac{q^{d/2+1}-1}{q-1}$. If we are given $x,y\in k_D^\times$, then $(x,y)$ lies on some $C_\alpha(k_D)$ for $\alpha\in k_D$. Via Lemma \ref{lem:codim_1}, we may show exactly $|k_D^\times|\cdot |k_F^\times|$ of these yield $\alpha=0$. Then we conclude \[\sum_{\alpha \in k_D^\times} |C_\alpha(k_D)| = (|k_D^\times|)^2-|k_D^\times|\cdot |k_F^\times|.\] There are two relevant actions on the family of curves $C_\alpha$: \begin{itemize} \item For $z\in k_D^\times$, if $(x,y)\in C_\alpha(k_D)$ then $(zx,zy)\in C_{z\sigma(z)\alpha}(k_D)$. \item For $A\in \GL_2(k_F)$, if $(x,y)\in C_\alpha(k_D)$ then $A \cdot (x,y)$ lies in $C_{\det A \cdot \alpha}(k_D)$. \end{itemize} Let $d$ be odd. The first point shows the cosets $k_D^\times/k_D^{\times(q+1)}$ take on common values as the image of $z\sigma(z)$ is identical to $z^{q+1}$. As $d$ is odd, the image of $z^{q+1}$ consists of all the squares. The second item shows that these two common values are the same. Thus, $|C_\alpha(k_D)|=|k_D|-|k_F|=q^d-q$ when $\alpha \in k_D^\times$ because we have produced bijections between $C_\alpha(k_D)$ over all $\alpha \in k_D^\times$. Now let $d$ be even, and let $\alpha \in k_D$. We claim the curve $C_\alpha:x\sigma(y) - \sigma(x)y=\alpha$ has $k_D$ points in bijection with $X_{\alpha}:\sigma(x)x+\sigma(y)y=\zeta \alpha$. Here, we choose $\zeta \neq 0$ so that $\sigma(\zeta)=-\zeta$. Explicitly, given $(x,y)\in X_{\alpha}$ we first choose $\omega$ such that $\sigma(\omega)\omega=-1$. Then $(x+\omega y, \omega x + y)$ is a solution to $x\sigma(y)+\sigma(x)y=(\sigma(\omega)+\omega)\zeta \alpha$. We have $(\sigma(\omega)+\omega)\in k_F^\times$. Dividing the $x$ coordinate by $\zeta$, we get a solution to $x\sigma(y)-\sigma(x)y=(\sigma(\omega)+\omega) \alpha$. Using the $\GL_2(k_F)$ action, the solutions are in bijection. Finally, we observe that points in $X_{\alpha}(k_D)$ are in bijection with solutions to $x^{q+1}+y^{q+1}=\zeta \alpha$, simply because $x^{q+1}$ and $\sigma(x)x$ take on the same values and have equal numbers of preimages for each value. The explicit number of solutions to this general type of equation is computed in \cite{weil1949numbers}, and will satisfy the desired bound so long as $d > 4$. In particular, the values $|C_\alpha(k_D)|$ take on constant values for each coset of $k_D^\times/k_D^{\times(q+1)}$, with one coset for $\zeta \alpha = -1$ taking the value $q^{d}+1+(-q)^{d/2}\frac{q-q^3}{q+1}-(q+1)$ and the others a common value so that the average is $q^d-q$. The coset for $\zeta \alpha = -1$ counts points on $x^{q+1}+y^{q+1}+1=0$, which when projectivized (to add $q+1$ points) is the Fermat curve $x^{q+1}+y^{q+1}+z^{q+1}=0$. The zeta function of this curve is well-known over $\F_{q^2}$ - see \cite{shioda1979fermat}. That the remaining cosets take the same value can be seen from the explicit formula of \cite{weil1949numbers}. Thus, we have shown the desired bound on $|C_\alpha(k_D)|$ and the proposition follows. \end{proof} The following result is analogous to the result at the end of \S 1.4.3 of \cite{platonov1993algebraic}, which states that in $[D^\times, D^\times]$ every element is a product of at most two commutators (this was originally shown in \cite{wang1950commutator}). \begin{corollary-N} Suppose $d>4$. Any element $\alpha\in [I_1,I_1]I_1^p\setminus I_3$ can be constructed as a product of a commutator and a $p$th power. \label{cor:comm_construct} \end{corollary-N} \begin{proof} We wish to write $\alpha = [x,y] z^p$ for $x,y,z\in I_1$. Suppose we have $x = 1+\sum_{i\ge 1} [x_i]\varpi_D^i$, and similarly for $y$. We fix $x_1$ and $y_1$ to be as in Proposition \ref{prop: comm_choice}, so $q_2([x,y])=q_2(\alpha) \in k_D^\times$ and $x_1/y_1$ does not lie in a proper subfield of $k_D$. Let $i>1$ and assume $x_1, \ldots, x_{i-1}$ and $y_1, \ldots, y_{i-1}$ are fixed. A calculation shows that the $\varpi_D^{i+1}$ coefficient of $[x,y]$ is a Tiechmuller lift of \[C + \varphi_{i,x_1}(y_i) + \varphi_{i,y_1}(x_i).\] Here, $C\in k_D$ is a constant only depending on $x_1, \ldots, x_{i-1}$ and $y_1, \ldots, y_{i-1}$. To do this calculation, we recall that we have $[x]+[y]=[x+y]+O(p)$. If $F/\F_p\llrrparen{t}$, this error is zero, while in the $p$-adic case by Proposition \ref{prop:pth_powers} we can absorb it into the $I_1^p$ component $z^p$. We use this expression to construct commutators inductively. By Lemma \ref{lem:codim_1}, we know $\{C + \varphi_{i,x_1}(y_i) + \varphi_{i,y_1}(x_i): x_i,y_i\in k_D\}\subset k_D$ is a sum of two codimension one subspaces, shifted by $C$. This is all of $k_D$ if and only if the two subspaces are distinct, which will depend on the choice of $x_1$ and $y_1$. By Lemma \ref{lem:codim_1}, $\im(\varphi_{i,x_1}) = \im(\varphi_{i,y_1})$ if and only if \[\prod_{0\le j \le i} \sigma^j(x_1/y_1) \in k_F,\] since $c \cdot \ker(\Tr_{k_D/k_F}) = \ker(\Tr_{k_D/k_F})$ if and only if $c\in k_F$ due to the non-degeneracy of the trace pairing. A calculation shows that this condition on $x_1/y_1$ holds if and only if $x_1/y_1$ is in the degree $\gcd(i+1,d)$ extension of $k_F$. Because $x_1/y_1$ does not lie in a proper subfield of $k_D$, we may obtain any Tiechmuller lift of $k_D$ as the coefficient of $\varpi_D^{i+1}$ of $[x,y]z^p$ when $d\nmid (i+1)$. When $d\mid (i+1)$, the values obtained for this coefficient are in the coset $C+\im(\varphi_{i,x_1})=C+\im(\varphi_{i,y_1})$, which has codimension one in $k_D$. Using Lemma \ref{lem:subgrp_generators}, we can count the number of elements of $I_{1,\Nrd=1}$ modulo $I_i$ for any $i$ and use this to compute the number of elements of $[I_1,I_1]I_1^p\setminus I_3 = I_{1,\Nrd=1}I_1^p \cap (I_2\setminus I_3)$ modulo $I_i$. Doing this gives exactly the number of elements of $[I_1,I_1]I_1^p$ modulo $I_i$ that we can produce by multiplying a commutator and a $p$th power as above, thus proving the claim. \end{proof} Following through the same arguments by inspecting the values from Proposition \ref{prop: comm_choice} and comparing to $|\mu_{q+1}(k_D)| \frac{q^{d/2+1}-1}{q-1}$, we can get results for $d=2,3,4$ as well. For $d=2,3$ we can get the same final result, but for $d=4$ Proposition \ref{prop: comm_choice} does not hold since the exact number of points on $C_\alpha(k_D)$ need not exceed the bound $|\mu_{q+1}(k_D)| \frac{q^{d/2+1}-1}{q-1}$. However, it does hold for $\frac{q}{q+1}|k_D^\times|$ values in $k_D^\times$. \subsection{Computing cohomology} With our understanding of the Frattini subgroup, we can now compute the structure of $\H^1(I_1,\pi)$ as a representation of $D_a^\times/I_1$. For most of this section, we focus on computing the $D^\times/I_1$-representation structure where $\pi$ is a smooth irreducible representation of $D^\times$ because, as shown after the proof of Proposition \ref{prop:H1_module_struct}, we can obtain the $D_a^\times/I_1$-representation structure from this simply by restricting. First we review why we have a $D^\times/I_1$ representation structure on $\H^1(I_1,\pi)$ for an irreducible smooth representation $\pi$. Being the pro-$p$ Iwahori subgroup of $D^\times$, there is the structure of a module over the Hecke algebra $\mathcal{H}_{I_1} \simeq \overline{\F}_p[I_1\setminus D^\times/I_1]$ on $\pi^{I_1}$. Since $I_1$ is normal, this has the structure of a representation of $D^\times/I_1$. The derived functors of this are the continuous cohomology groups $\H^i(I_1,\pi)$, hence there is a structure of a representation of $D^\times/I_1$ on $\H^1(I_1,\pi)$. As $\H^1(I_1,\pi) \simeq \H^1(I_1,\overline{\F}_p) \otimes \pi$, we will only need to compute this structure for the trivial representation. For $\H^1(I_1,\overline{\F}_p)$, the structure as a representation can be described very explicitly as the conjugation action of $D^\times/I_1$ on homomorphisms. Namely, $g\in D^\times/I_1$ sends a homomorphism $\varphi(x)$ to $\varphi(g^{-1}xg)$. We now compute the homomorphisms in $\H^1(I_1,\overline{\F}_p)$ using Theorem \ref{thm:GL1_frattini_subgroup}. \begin{theorem-N} We have a decomposition \[\H^1(I_1,\overline{\F}_p) \simeq \H^1(I_{1,\Nrd=1},\overline{\F}_p) \oplus \H^1(1+\pi_F \O_F, \overline{\F}_p),\] where $\H^1(I_{1,\Nrd=1},\overline{\F}_p) \simeq \Hom(k_D,\overline{\F}_p)\simeq \overline{\F}_p^{df}$ and $\H^1(1+\pi_F \O_F, \overline{\F}_p)$ is isomorphic to $\overline{\F}_p^{ef}$ in the $p$-adic case and $\bigoplus_{i\in \N} \overline{\F}_p$ in the local function field case. \label{thm:homomorphism_classification} \end{theorem-N} \begin{proof} Due to Lemma \ref{lem:subgrp_generators}, the decomposition into these cohomology groups follows immediately. This is for the first cohomology group so we do not need more advanced methods, but it is worth noting this is a subcase of the K\"{u}nneth theorem for profinite groups. By the proof of Theorem \ref{thm:GL1_frattini_subgroup}, we know that the Frattini subgroup of $I_{1,\Nrd=1}$ is $I_{1,\Nrd=1} \cap I_2 = I_{2,\Nrd=1}$. We then have \[\H^1(I_{1,\Nrd=1}, \overline{\F}_p) \simeq \Hom(I_{1,\Nrd=1}/I_{2,\Nrd=1}, \overline{\F}_p).\] The quotient $I_{1,\Nrd=1}/I_{2,\Nrd=1}$ is isomorphic to $k_D$: we know it is a finite dimensional $\F_p$-vector space since it is finite, abelian, and $p$-torsion. In the decomposition of Lemma \ref{lem:subgrp_generators}, upon taking the elements $1+[x]\varpi_D$ over $x\in k_D$, the $I_{1,\Nrd=1}$ components yield coset representatives of $I_{1,\Nrd=1}/I_{2,\Nrd=1} \subset k_D$ for any element of $k_D$. This is because $d\ge 2$, so division by an element of $1+\pi_F \O_F$ cannot affect the coefficient of $\varpi_D$. Thus, we have \[\H^1(I_{1,\Nrd=1},\overline{\F}_p) \simeq \Hom(k_D,\overline{\F}_p),\] where this last space is isomorphic to $\overline{\F}_p^{df}$ because the additive group of $k_D$ is $\F_p^{df}$. Now we turn to $1+\pi_F \O_F$. In the $p$-adic case, the assumption $p>de+1$ ensures this group has no $p$-torsion, while in the local function field case this fact is a given. This implies that as a topological group we have $1+\pi_F \O_F$ is isomorphic to $\Z_p^{[F:\Q_p]}$ in the $p$-adic case, and $\Z_p^\N$ in the local function field case. As $\Hom_{\mathrm{cont}}(\Z_p,\overline{\F}_p) \simeq \overline{\F}_p$, in the $p$-adic case the claim follows. In the local function field case \[\Hom_{\mathrm{cont}}(1+\pi_F \O_F, \overline{\F}_p) \simeq \Hom_{\mathrm{cont}}(\Z_p^\N, \overline{\F}_p) \simeq \bigoplus_{i\in \N} \Hom_{\mathrm{cont}}(\Z_p,\overline{\F}_p),\] which is what we wanted. \end{proof} \begin{corollary-N} For $0\le i < df$ and $\eta_i\coloneqq (x\mapsto x^{p^i}) \in \Aut_{\F_p}(k_D)$, define the homomorphisms $\phi^{\eta_i}:I_1\to \overline{\F}_p$ by the compositions \begin{display} I_1 \ar{r} & I_1/I_2 \ar{r}{\simeq} & k_D \ar{r}{\eta_i} & k_D \ar{r} & \overline{\F}_p \end{display} where the last map is the inclusion that we have fixed. These form a basis of the $\overline{\F}_p$-vector space $\H^1(I_{1,\Nrd=1},\overline{\F}_p) \subset \H^1(I_1,\overline{\F}_p)$. For homomorphisms $\eta: 1+\pi_F \O_F \to \overline{\F}_p$, define homomorphisms $\psi^\eta:I_1\to\overline{\F}_p$ by \begin{display} I_1 \ar{r}{\Nrd} & 1+\pi_F\O_F \ar{r}{\eta} & \overline{\F}_p. \end{display} Taking a basis $\{\eta_j\}$ of $\Hom_{\mathrm{cont}}(1+\pi_F \O_F, \overline{\F}_p)$, the maps $\{\psi^{\eta_j}\}$ form a basis of $\H^1(1+\pi_F \O_F, \overline{\F}_p) \subset \H^1(I_1,\overline{\F}_p)$. \label{cor:homs_basis} \end{corollary-N} \begin{proof} We note that $\phi^{\eta_i}|_{1+\pi_F \O_F}=0$ and that $\psi^{\eta_j}|_{I_{1,\Nrd=1}}=0$, so the proposed basis elements lie in the correct components of the decomposition in Theorem \ref{thm:homomorphism_classification}, and we would like to show that they indeed form bases of these components. We do this for the $\phi^{\eta_i}$ first. We already computed the dimension of $\H^1(I_{1,\Nrd=1},\overline{\F}_p)\subset \H^1(I_1,\overline{\F}_p)$, so it suffices to show that the $\phi^{\eta_i}$ are linearly independent. By surjectivity of the quotient map $I_1 \to I_1/I_2$, it suffices to show that the $\eta_i \in \Hom(k_D,\overline{\F}_p)$ are linearly independent. Viewing these as polynomials $x \mapsto x^{p^i} \in \overline{\F}_p[x]$, any linear combination that is equal to zero corresponds to a degree $< p^{df}$ polynomial having $p^{df}$ roots, which means the coefficients must all be zero. It follows that these homomorphisms are linearly independent. Now consider the $\psi^{\eta_j}$. The reduced norm $\Nrd$ restricts to $x \mapsto x^d$ on $F$, so as in Lemma \ref{lem:subgrp_generators} we see $\Nrd:I_1\to 1+\pi_F\O_F$ is a surjection since $1+\pi_F \O_F \subset I_1$. The maps $\eta_j$ by definition give a basis of $\Hom_{\mathrm{cont}}(1+\pi_F \O_F, \overline{\F}_p)=\H^1(1+\pi_F \O_F, \overline{\F}_p)$, and so by surjectivity of the reduced norm the maps $\psi^{\eta_j}$ form a basis of $\H^1(1+\pi_F \O_F, \overline{\F}_p) \subset \H^1(I_1,\overline{\F}_p)$. \end{proof} We may now compute the structure of $\H^1(I_1,\overline{\F}_p)$ as a representation of $D^\times/I_1$. \begin{proposition-N} As a representation of $D^\times/I_1$ via the conjugation action, we have \[\H^1(I_1,\overline{\F}_p) \simeq \H^1(1+\pi_F \O_F, \overline{\F}_p) \oplus \bigoplus_{i\in \Z/f\Z} \Ind_{D_d^\times/I_1}^{D^\times/I_1} \chi_{\eta_i}\] where the action on $\H^1(1+\pi_F \O_F, \overline{\F}_p)$ is trivial and $\chi_{\eta_i}$ is extended trivially from the order $d$ character $k_D^\times\to\overline{\F}_p^\times$ given by $x \mapsto \left(\frac{\sigma(x)}{x}\right)^{p^i}$. Up to isomorphism, the choice of a coset representative of $i$ does not matter. \label{prop:H1_module_struct} \end{proposition-N} \begin{proof} By Corollary \ref{cor:homs_basis}, we see that every map in the component $\H^1(1+\pi_F \O_F, \overline{\F}_p) \subset \H^1(I_1,\overline{\F}_p)$ factors through $\Nrd$. As a result, the conjugation action of $D^\times/I_1$ is trivial on this component and it is a direct sum of copies of the trivial representation. We now turn to the action on $\H^1(I_{1,\Nrd=1}, \overline{\F}_p)$. To do this, we will use the basis $\phi^{\eta_i}$ provided by Corollary \ref{cor:homs_basis}. As $D^\times/I_1 \simeq \varpi_D^\Z \ltimes k_D^\times$, it suffices to study the $k_D^\times$ and $\varpi_D^\Z$ actions. Supposing $\varpi_D [x] \varpi_D^{-1} = [\sigma(x)]$ and $\sigma$ sends $x \mapsto x^{q^r}$, the conjugation action of $\varpi_D$ is by \[\varpi_D \cdot \phi^{\eta_i} = \phi^{\eta_{i-rf}}.\] Similarly, $[x] \cdot \phi^{\eta_i} = \left(\frac{\sigma(x)}{x}\right)^{p^i} \phi^{\eta_i}$ for all $x\in k_D^\times$. Defining $V_i$ to be the span of the $\phi^{\eta_{i'}}$ where $i' \equiv i \pmod{f}$, each is a subrepresentation so we obtain \[\H^1(I_{1,\Nrd=1}, \overline{\F}_p) = \bigoplus_{i\in \Z/f\Z} V_i.\] Each $V_i$ is a dimension $d$ representation. We have $\Res^{D^\times/I_1}_{D_d^\times/I_1} V_i \simeq \bigoplus_{i' \equiv i \pmod{f}} \chi_{\eta_{i'}}$ where we define $\chi_{\eta_{i'}}$ for $i'\in \Z/(df)\Z$ as sending $x\in k_D^\times$ to $\left(\frac{\sigma(x)}{x}\right)^{p^{i'}}$ and extend trivially to $D_d^\times/I_1$. It follows that \[\Hom_{D_d^\times/I_1}(\chi_{\eta_i}, \Res^{D^\times/I_1}_{D_d^\times/I_1}V_i)\neq 0,\] which by Frobenius reciprocity means $\Hom_{D^\times/I_1}(\Ind_{D_d^\times/I_1}^{D^\times/I_1} \chi_{\eta_i}, V_i)\neq 0$. However, by the classification of irreducible representations, the induced representation is irreducible of dimension $d$. As $\dim V_i = d$, it follows that $V_i$ is isomorphic to $\Ind_{D_d^\times/I_1}^{D^\times/I_1} \chi_{\eta_i}$. \end{proof} For any smooth irreducible representation $\pi$ of $D^\times$, this immediately gives us \[\H^1(I_1,\pi) \simeq (\H^1(1+\pi_F \O_F, \overline{\F}_p) \otimes \pi) \oplus \bigoplus_{i\in \Z/f\Z} \Ind_{D_d^\times/I_1}^{D^\times/I_1}(\chi_{\eta_i} \otimes \Res_{D_d^\times/I_1}^{D^\times/I_1} \pi).\] We have already determined how to compute the restriction of a character of $D^\times$ in general in Corollary \ref{cor:char_restriction}, so when $\pi$ is a character it is easy to write this down explicitly. We can now derive the $D_a^\times$-representation structure for other values of $a|d$. For the trivial representation, this is \[\Res^{D^\times/I_1}_{D_a^\times/I_1} \H^1(I_1,\overline{\F}_p) \simeq \H^1(1+\pi_F \O_F,\overline{\F}_p) \oplus \bigoplus_{i\in \Z/f\Z} \Res^{D^\times/I_1}_{D_a^\times/I_1} \Ind_{D_d^\times/I_1}^{D^\times/I_1} \chi_{\eta_i}.\] The Mackey formula decomposes each term in the direct sum as \[\Res^{D^\times/I_1}_{D_a^\times/I_1} \Ind_{D_d^\times/I_1}^{D^\times/I_1} \chi_{\eta_i}\simeq \bigoplus_{\overline{s}\in D_a^\times \setminus D^\times/D_d^\times} \Ind_{D_d^\times/I_1}^{D_a^\times/I_1} \chi_{\eta_i}^s.\] We can similarly compute the tensor product with a smooth irreducible representation $\pi$ of $D_a^\times$. \begin{remark} In \cite{koziol2018hecke}, for a split reductive $p$-adic group $G$ and for a pro-$p$ Iwahori subgroup $I_1$ of $G$, the group $\H^1(I_1,\overline{\F}_p)$ is computed as a module over the Hecke algebra $\mathcal{H}_{I_1}$. Our result is somewhat analogous to Theorem 6.4 in that paper in how $\H_1(I_1,\overline{\F}_p)$ splits into two components, but the fact that $D^\times$ is anisotropic modulo its center makes its structure far more interesting than that of $\GL_1(F)$. Notably, our decomposition as a module over $\mathcal{H}_{I_1}$ similarly does not involve supersingular modules, but computing the same cohomology group for $\GL_2(D)$ using Theorem \ref{thm:GL1_frattini_subgroup} does actually produce supersingular modules if we assume $d>1$, as would be expected from the main theorem of \cite{koziol2018hecke}. \end{remark} \section{Extensions of irreducibles} \label{sec:Ext1} Having computed the $D_a^\times/I_1$-representation structure of $\H^1(I_1,\pi)$, we are now ready to use this to compute extensions. \subsection{\texorpdfstring{$\Ext^1_{D^\times}$}{Ext1} for all irreducible representations} Let $\chi$ be any smooth character of $D_a^\times$. To use the exact sequence of low degree terms at the end of \S\ref{sec:red to cohom} to compute $\Ext_{D_a^\times}^1(\mathbf{1},\chi)$, and ultimately to compute $\Ext_{D^\times}^1(\pi,\pi')$ for any $\pi$ and $\pi'$, we will also need to compute the structure of $\H^i(D_a^\times/I_1,\chi)$. \begin{proposition-N} We have $\H^i(D_a^\times/I_1, \chi)=0$ unless the action by $\chi:D_a^\times \to \overline{\F}_p^\times$ is trivial, in which case $\H^1(D_a^\times/I_1, \chi)\simeq \overline{\F}_p$ and $\H^i(D_a^\times/I_1, \chi)=0$ for $i>1$. \label{prop:group_cohom_zero} \end{proposition-N} \begin{proof} Because we have a semidirect product $D_a^\times/I_1 \simeq \varpi_D^{a\Z} \ltimes k_D^\times$, we have a normal subgroup $k_D^\times$ and a quotient $\varpi_D^{a\Z}$ making an exact sequence \begin{display} 0 \ar{r} & k_D^\times \ar{r} & D_a^\times/I_1 \ar{r} & \varpi_D^{a\Z} \ar{r} & 0. \end{display} The group in question is discrete, and hence without requiring cochains to be continuous the cohomology is the same as taking all cochains. We may therefore use the Hochschild-Serre spectral sequence in ordinary cohomology. We first show $\H^{i}(k_D^\times, \chi)=0$ for any $\chi$ and $i>0$. Observe that the composition \begin{display} \H^i(k_D^\times,\chi) \ar{r}{\mathrm{res}} & \H^i(1,\chi) \ar{r}{\mathrm{cores}} & \H^i(k_D^\times, \chi) \end{display} is multiplication by $|k_D^\times|$, and hence an isomorphism as we work in characteristic $p$. But the middle group is $0$, so this is also the zero map. It follows the cohomology group $\H^i(k_D^\times, \chi)$ is trivial. One can also see this by observing that $\widehat{\H}^0(k_D^\times,\chi)$ and $\widehat{\H}_0(k_D^\times,\chi)$ are both $0$ since $|k_D^\times|$ is prime to $p$, and then using Tate periodicity. Because $\H^{i}(k_D^\times, \chi)=0$ is trivial for $i>0$, $\H^i(\varpi_D^{a\Z}, \chi^{k_D^\times}) \simeq \H^i(\varpi_D^{a\Z} \ltimes k_D^\times, \chi)$ via the inflation map in the higher inflation-restriction exact sequences arising from the Hochschild-Serre spectral sequence. The cohomological dimension of $\varpi_D^{a\Z}\simeq\Z$ is $1$, so for $i>1$ we have now shown the claim. For $i=1$, $\H^1(\varpi_D^{a\Z},\chi^{k_D^\times})=0$ unless $\chi^{k_D^\times}$ is trivial, in which case we get $\overline{\F}_p$. We only get $\chi^{k_D^\times}$ as the trivial $\varpi_D^{a\Z}$-character when $\chi$ itself is trivial. \end{proof} With this, we can now determine $\Ext^1_{D_a^\times}(\mathbf{1},\chi)$ via the spectral sequence Proposition \ref{prop: ext_spectral_seq}. We also obtain the following corollary: \begin{corollary-N} There is an exact sequence \begin{display} 0 \ar{r} & \H^1(D_a^\times/I_1, \H^{i-1}(I_1,\chi)) \ar{r} & \Ext_{D_a^\times}^{i}(\mathbf{1},\chi) \ar{r} & \H^{i}(I_1,\chi)^{D_a^\times/I_1} \ar{r} & 0. \end{display} \label{cor: general_ext_sequence} \end{corollary-N} \begin{proof} Proposition \ref{prop:group_cohom_zero} shows that $\H^i(D_a^\times/I_1,V)=0$ for $i\ge 2$ for any representation $V$ of $D_a^\times/I_1$. Indeed, the previous argument can be adapted directly for $i\ge 2$ because $\Z$ still has cohomological dimension $1$ and $\Rep(k_D^\times)$ is semisimple as $|k_D^\times|$ is prime to $p$, and so we can decompose $V = \bigoplus_j \chi_j$ as a representation of $k_D^\times$ to get $\H^i(k_D^\times,V)=\bigoplus_j \H^i(k_D^\times,\chi_j) = 0$. We have a spectral sequence \[E_2^{i,j} = \H^i(D_a^\times/I_1,\H^j(I_1,\chi)) \implies \Ext^{i+j}_{D_a^\times}(\mathbf{1},\chi)\] via Proposition \ref{prop: ext_spectral_seq} which we now know consists of two columns on the $E_2$ page, from which we get the above exact sequence as the $E_2$ page equals the $E_\infty$ page. \end{proof} We now compute $\Ext^1_{D_a^\times}(\mathbf{1},\chi)$. \begin{theorem-N} Let $D$ be a degree $d$ division algebra over $F$. Let $\chi$ be a character of $D_a^\times$ where $a|d$. There are two cases where the extensions $\Ext^1_{D_a^\times}(\mathbf{1},\chi)$ can be nontrivial: \begin{itemize} \item When $\chi$ is trivial, there is an exact sequence \begin{display} 0 \ar{r} & \overline{\F}_p \ar{r} & \Ext^1_{D_a^\times}(\mathbf{1},\chi) \ar{r} & \H^1(1+\pi_F \O_F,\overline{\F}_p) \ar{r}& 0 \end{display} where $\H^1(1+\pi_F \O_F,\overline{\F}_p) \simeq \Hom(I_1, \overline{\F}_p)^{D_a^\times/I_1}$ is as in Theorem \ref{thm:homomorphism_classification}. \item When $a=d$, and $\chi$ is extended trivially from a character $x \mapsto \left(\frac{x}{\sigma(x)}\right)^{p^i}$ of $k_D^\times$ for some $i$, we have $ \Ext^1_{D_a^\times}(\mathbf{1},\chi) \simeq \overline{\F}_p$. \end{itemize} Otherwise, $\Ext^1_{D_a^\times}(\mathbf{1},\chi)=0$. \label{thm:char_exts} \end{theorem-N} \begin{proof} Due to Proposition \ref{prop:group_cohom_zero}, in the exact sequence of low degree terms arising from Proposition \ref{prop: ext_spectral_seq}, we obtain \begin{display} 0 \ar{r} & \H^1(D_a^\times/I_1,\chi) \ar{r} & \Ext^1_{D_a^\times}(\mathbf{1},\chi) \ar{r} & (\Hom(I_1, \overline{\F}_p) \otimes \chi)^{D_a^\times/I_1} \ar{r} & 0. \end{display} When $\chi = \mathbf{1}$, by Proposition \ref{prop:H1_module_struct} we see that $\Hom(I_1, \overline{\F}_p)^{D_a^\times/I_1} \simeq \H^1(1+\pi_F \O_F, \overline{\F}_p)$ since this is the trivial component of the representation. Additionally, Proposition \ref{prop:group_cohom_zero} tells us that $\H^1(D_a^\times/I_1,\overline{\F}_p)\simeq \overline{\F}_p$. We then recover the first case of the theorem statement. When $\chi$ is nontrivial, $\H^1(D_a^\times/I_1,\chi) = 0$ so we have $\Ext^1_{D_a^\times}(\mathbf{1},\chi) \simeq (\Hom(I_1, \overline{\F}_p) \otimes \chi)^{D_a^\times/I_1}$ via the restriction map. We know this as a $D_a^\times/I_1$-representation, so we just need to compute the trivial component. Recall that as a $D_a^\times/I_1$-representation, we have already shown \[\H^1(I_1,\chi) \simeq (\H^1(1+\pi_F \O_F, \overline{\F}_p)\otimes \chi) \oplus \bigoplus_{i\in \Z/f\Z} (\Res^{D^\times}_{D_a^\times} \Ind_{D_d^\times}^{D^\times} \chi_{\eta_i}) \otimes \chi.\] As $\H^1(1+\pi_F \O_F, \overline{\F}_p)$ has a trivial action and $\chi$ is nontrivial, we know the $(\H^1(1+\pi_F \O_F, \overline{\F}_p) \otimes \chi)$ component is nontrivial. By the Mackey formula, the remaining component before tensoring with $\chi$ is \[\bigoplus_{i\in \Z/f\Z} \Res^{D^\times}_{D_a^\times} \Ind_{D_d^\times}^{D^\times} \chi_{\eta_i} \simeq \bigoplus_{i\in \Z/f\Z} ~ \bigoplus_{\overline{s} \in D_a^\times \setminus D^\times / D_d^\times} \Ind_{D_d^\times}^{D_a^\times} \chi^s_{\eta_i}.\] By the Mackey irreducibility criterion, $\Ind_{D_d^\times}^{D_a^\times} \chi^s_{\eta_i}$ is irreducible as it breaks down as a direct sum of distinct characters upon restriction to $D_d^\times$. When we tensor with $\chi$, we can further pull $\chi$ into the induction via the push-pull formula to obtain a direct sum of inductions of the form \[\Ind_{D_d^\times}^{D_a^\times} (\chi_{\eta_i}^s\otimes\Res_{D_d^\times}^{D_a^\times}\chi) \eqqcolon \Ind_{D_d^\times}^{D_a^\times} \chi'.\] This remains irreducible since we have tensored with a chraracter. Now the trivial representation is irreducible as well, so if $\Ind_{D_d^\times}^{D_a^\times} \chi'$ contains a copy of the trivial representation then it must itself be trivial. It follows that we must have $a=d$ in this case, and also that $\chi_{\eta_i}^s\otimes\Res_{D_d^\times}^{D_a^\times}\chi \simeq \mathbf{1}$. As $a=d$, this just says that $\chi$ must be dual to some $\chi_{\eta_i}^s$, which can only be the case for at most one $i$ and $\overline{s}$. This is precisely the criterion in the theorem. \end{proof} This gives a way to compute any particular extension group. \begin{theorem-N} Let $\chi,\chi', \pi$ and $\pi'$ be as in Theorem \ref{thm:reduction_to_chars}. Let $S=\{\chi^s : s=\varpi_D^i, 0\le i < \gcd(a,a')\}$, so that the elements $s$ form a set of coset representatives for $D_{a'}^\times \setminus D^\times / D_{a}^\times$. There are two types of direct summands in $\Ext^1_{D^\times}(\pi,\pi')$. If $\Res^{D_{a'}^\times}_{D_{\lcm(a,a')}^\times} \chi'$ is equal to some $\chi^s\in S$, we have a nonzero direct summand $A_{\chi^s}$ fitting into an exact sequence \begin{display} 0 \ar{r} & \overline{\F}_p \ar{r} & A_{\chi^s} \ar{r} & \H^1(1+\pi_F \O_F, \overline{\F}_p) \ar{r}& 0. \end{display} We also get a nonzero direct summand $A_{\chi^s} \simeq \overline{\F}_p$ for each $\chi^s\in S$ for which $\Res^{D_{a'}^\times}_{D_{\lcm(a,a')}^\times} \chi' \otimes (\chi^s)^\ast$ is extended trivially from a character $x \mapsto \left(\frac{x}{\sigma(x)}\right)^{p^i}$. Set $A_{\chi^s}=0$ otherwise. Then $\Ext^1_{D^\times}(\pi,\pi')\simeq \bigoplus_{\chi^s\in S} A_{\chi^s}$. \label{thm: main_thm} \end{theorem-N} \begin{proof} We get this result simply by applying the result of Theorem \ref{thm:char_exts} in Theorem \ref{thm:reduction_to_chars}. \end{proof} If $\lcm(a,a')<d$, only the first type of direct summand occurs a single time; it is only in the case that $\lcm(a,a')=d$ that the situation can be more complicated. We illustrate the example of $d=2$ below. \begin{example-N}\label{ex:ext_1_quat_alg} Let $D$ be a quaternion algebra over a $p$-adic field $F$. We will consider the case where $\pi=\Ind_{D_2^\times}^{D^\times} (\chi \otimes \kappa)$ and $\pi'=\Ind_{D_2^\times}^{D^\times} (\chi' \otimes \kappa')$ (in the notation of Theorem \ref{thm:irrep_classification}), since this is the case where the most interesting types of extensions occur. Explicitly, these characters of $D_2^\times$ are of the form $\chi_{2,\alpha,m}$, where $q+1 \nmid m$ so that the characters have order $2$. There are four different possibilities for $\dim \Ext^1_{D^\times}(\pi,\pi'): 0, 1, ef+1,$ and $ef+2$. We obtain dimension $ef+1$ when $\kappa=\kappa'$ and $\chi \otimes (\chi')^{\ast}$ is trivial, or $\kappa=\kappa'$ and $\chi \otimes ({\chi'}^{\varpi_D})^\ast$ is trivial. The character ${\chi'}^{\varpi_D}$, when we set $\chi'=\chi_{2,1,m'}$, is $\chi_{2,1,qm'}$. These conditions cannot both occur at the same time, which is why dimension $2ef+2$ is not possible. Dimension $ef+2$ can occur when one of the above conditions holds, for example $\kappa=\kappa'$ and $\chi \otimes (\chi')^{\ast}$ is trivial. We then additionally require $\chi \otimes ({\chi'}^{\varpi_D})^\ast$ to be some character $x \mapsto (x^{1-q})^{p^i}$ when restricted to $k_D^\times$. This situation can occur, as well as the opposite situation where $\kappa=\kappa'$ and $\chi \otimes ({\chi'}^{\varpi_D})^\ast$ is trivial and $\chi \otimes ({\chi'})^\ast$ is some character $x \mapsto (x^{1-q})^{p^i}$ on $k_D^\times$. We can obtain dimension $1$ when $\chi \otimes (\chi')^{\ast}$ is $x \mapsto (x^{1-q})^{p^i}$ on $k_D^\times$, but $\chi \otimes ({\chi'}^{\varpi_D})^\ast$ is nontrivial and vice versa. Finally, we get dimension $0$ in all other cases. \end{example-N} \subsection{Higher degree extensions in the \texorpdfstring{$p$}{p}-adic case} In \cite{lazard1965groupes}, many fundamental results about $p$-adic analytic pro-$p$ groups are shown which will be helpful in understanding the structure of the higher cohomology groups in the case where $F$ is a $p$-adic field. Here, by a $p$-adic analytic group we mean a topological group with the structure of a $p$-adic analytic manifold over $\Q_p$ such that the group multiplication and inversion operations are analytic. \begin{theorem}[\cite{lazard1965groupes} \S 2.5.8] Let $G$ be a $p$-adic analytic pro-$p$ group and with no $p$-torsion, and let $r=\dim_{\Q_p} G$. Then $G$ is a Poincar\'{e} duality group of dimension $r$ over $\F_p$. That is, \begin{itemize} \item $\H^n(G,\F_p)$ is finite dimensional for all $n\in \N$. \item $\dim_{\F_p} \H^r(G,\F_p)=1$. \item The cup product \[\H^n(G,\F_p) \times \H^{r-n}(G,\F_p) \to \H^r(G,\F_p)\] is a non-degenerate bilinear form. \end{itemize} Here, as always, all cohomology taken is continuous. \end{theorem} We will be interested in the case of $I_1=G$, and we will also want to understand how the cup product interacts with the $D_a^\times/I_1$-representation structure on the cohomology group. We note that $I_1$ is a $p$-adic analytic group as it is an open subgroup of $D^\times$, and since $p>de+1$ it has no $p$-torsion. Thus, $I_1$ is a Poincar\'{e} duality group. The most difficult part of the following result is that the $D_a^\times/I_1$-representation structure on the top cohomology is trivial. This is the main result of \cite{koziol2020functorial} for general connected reductive groups. Using the method of Theorem 7.2 in \cite{koziol2018hecke}, we can alternatively show this by finding the uniform pro-$p$ subgroup $I_{de+1}$ and computing explicitly the action on its first cohomology, which determines the action on its top cohomology as the cohomology ring is an exterior algebra. We can then show that this action is trivial, and that it must agree with the action on the top cohomology of $I_1$ using the corestriction map. \begin{proposition-N}[\cite{koziol2020functorial}] \label{prop:poincare_duality} Let $r=d^2ef$. As $D_a^\times/I_1$-representations, we have that $\H^n(I_1,\overline{\F}_p)^\ast \simeq \H^{r-n}(I_1,\overline{\F}_p)$. Here, $V^\ast$ denotes the dual representation. \end{proposition-N} \begin{proof} As representations of $D^\times/I_1$ are equivalent to modules over $\mathcal{H}_{I_1}$ and $\dim_{\Q_p} I_1=d^2ef$, the structure on $\H^r(I_1,\F_p)$ as a $D^\times/I_1$-representation, and hence as a $D_a^\times/I_1$-representation, is trivial by \cite{koziol2020functorial}. The cup product \[\H^n(I_1,\F_p) \times \H^{r-n}(I_1,\F_p) \to \H^r(I_1,\F_p) \simeq \F_p\] is a non-degenerate bilinear form, which behaves well with respect to the $D_a^\times/I_1$-action. Let $d$ be an element of $D_a^\times/I_1$. Then we have for $\alpha \in \H^n(I_1,\F_p)$ and $\beta \in \H^{r-n}(I_1,\F_p)$ that \[d \cdot (\alpha \smile \beta) = (d\cdot \alpha) \smile (d\cdot \beta).\] It follows from the triviality of the top cohomology that Poincar\'{e} duality yields an isomorphism $\H^n(I_1,\F_p)^\ast \simeq \H^{r-n}(I_1,\F_p)$. Tensoring with $\overline{\F}_p$ gives the desired isomorphism. \end{proof} We will now again use the spectral sequence \[E_2^{i,j} = \H^i(D_a^\times/I_1,\H^j(I_1,\chi)) \implies \Ext^{i+j}_{D_a^\times}(\mathbf{1},\chi)\] from Proposition \ref{prop: ext_spectral_seq}. The work has already been done in Corollary \ref{cor: general_ext_sequence} and the previous proposition. \begin{lemma-N} Let $r=d^2ef$ and let $\chi$ be a smooth character of $D_a^\times$. There is an exact sequence \[0 \to \H^1(D_a^\times/I_1, \H^{r-i+1}(I_1,\chi)^\ast) \to \Ext_{D_a^\times}^{i}(\mathbf{1},\chi^\ast) \to (\H^{r-i}(I_1,\chi)^\ast)^{D_a^\times/I_1} \to 0.\] \end{lemma-N} \begin{proof} This follows from Corollary \ref{cor: general_ext_sequence} combined with the previous proposition. \end{proof} For $i=r+1$, we get $\Ext^{r+1}_{D_a^\times}(\mathbf{1},\chi^\ast) \simeq \H^1(D_a^\times/I_1, \chi^\ast)$, which is trivial unless $\chi=\mathbf{1}$ in which case we get $\overline{\F}_p$. After $r+1$, the extensions are all trivial. We can make use of this lemma when $i=r$ as well, since we have results about the surrounding terms in the exact sequence. We have \begin{display} 0 \ar{r} & \H^1(D_a^\times/I_1, \H^{1}(I_1,\chi)^\ast) \ar{r} & \Ext_{D_a^\times}^{r}(\mathbf{1},\chi^\ast) \ar{r} & (\chi^\ast)^{D_a^\times/I_1} \ar{r} & 0. \end{display} We may determine the first group via Proposition \ref{prop:group_cohom_zero} - the dimension is the multiplicity of the trivial representation. This is precisely what was determined in Theorem \ref{thm:char_exts}. In the case of $d=2$ and $F=\Q_p$, this is enough to determine all extension groups because $r=d^2ef=4$. For a smooth character $\chi$ of $D^\times$, we can compute all $\H^i(I_1,\chi)$ to do this. It is worth noting that this cohomology computation is known and of independent interest in stable homotopy theory, for example see \cite{henn2007finite} Proposition 7. The group $I_1$ appears as the Morava stabilizer group attached to a formal group law, and $\H^\bullet(I_1, \F_p)$ controls certain localization functors $L_{K(n)}$ in Morava $K$-theory. Here, we provide an alternative proof using our results. We have $\H^0(I_1,\chi)\simeq \chi$, so $\H^4(I_1,\chi) \simeq \chi$. As for $\H^1$, it becomes \[\H^1(I_1,\chi) \simeq (\overline{\F}_p \oplus \Ind_{D_2^\times}^{D^\times} \chi_{\eta})\otimes \chi,\] where $\chi_\eta$ is extended from the character of $\F_{p^2}^\times$ sending $x \mapsto x^{p-1}$. The representation $\H^3(I_1,\chi)$ is the dual of $\H^1(I_1,\overline{\F}_p)$ tensored with $\chi$, so it is given by \[\H^3(I_1,\chi)\simeq (\overline{\F}_p\oplus \Ind_{D_2^\times}^{D^\times} \chi_{\eta}^\ast)\otimes\chi. \] What remains is to compute $\H^2(I_1,\overline{\F}_p)$. In this case, the Euler characteristic of $I_1$ will be $0$ using the main result of \cite{totaro1999euler}, so we can deduce that $\dim \H^2(I_1,\overline{\F}_p)=4$. Via Lemma \ref{lem:subgrp_generators} and the K\"{u}nneth formula for profinite groups, \[\H^2(I_1,\overline{\F}_p) \simeq \bigoplus_{i+j=2} \H^i(1+p\Z_p,\overline{\F}_p)\otimes \H^j(I_{1,\Nrd=1},\overline{\F}_p).\] The isomorphism is via the cross product, which makes this an isomorphism on the level of representations as well because $1+p\Z_p$ and $I_{1,\Nrd=1}$ are normal. As $1+p\Z_p \simeq \Z_p$, its second cohomology is trivial, so there are only two nontrivial terms in the K\"{u}nneth formula. The first is $\H^1(1+p\Z_p,\overline{\F}_p)\otimes \H^1(I_{1,\Nrd=1},\overline{\F}_p)$, which we already know is $\Ind_{D_2^\times}^{D^\times} \chi_{\eta}$ via the decomposition of $\H^1(I_1,\overline{\F}_p)$ in Theorem \ref{thm:homomorphism_classification}. The other nontrivial component is $\H^0(1+p\Z_p,\overline{\F}_p)\otimes \H^2(I_{1,\Nrd=1},\overline{\F}_p)$, which can be found as the image of the Bockstein \[\beta_p: \H^1(I_{1,\Nrd=1},\F_p) \to \H^2(I_{1,\Nrd=1},\F_p),\] after noting that the elements in $\H^1(I_{1,\Nrd=1},\Z/p^2\Z) \simeq \Hom(k_D, \Z/p^2\Z)$ are sent to $0$ so that the map becomes an injection. Note that the isomorphism \[\H^1(I_{1,\Nrd=1},\Z/p^2\Z) \simeq \Hom(k_D, \Z/p^2\Z)\] still follows from the commutator calculation: $[I_{1,\Nrd=1},I_{1,\Nrd=1}]=I_{2,\Nrd=1}$. Tensoring with $\overline{\F}_p$, we see that \[\H^2(I_1,\chi) \simeq (\Ind_{D_2^\times}^{D^\times} \chi_{\eta})^{\oplus 2} \otimes \chi.\] This has dimension four, so we are done. Via Corollary \ref{cor: general_ext_sequence} we can determine all extension groups as well. \begin{remark} When $F$ is a more general $p$-adic field or we consider a general division algebra, this method only provides partial information about $\H^2(I_1,\chi)$. The K\"{u}nneth decomposition can provide a subrepresentation of $\H^2(I_1,\overline{\F}_p)$ by considering the image of the Bockstein in $\H^2(I_{1,\Nrd=1},\overline{\F}_p)$ isomorphic to $\H^1(I_{1,\Nrd=1},\overline{\F}_p)$. The other two components are completely determined, as $\H^1(I_1,\overline{\F}_p)$ is known and all cohomology groups of $1+\pi_F \O_F$ are easy to find since it is isomorphic to a direct product of $ef$ copies of $\Z_p$ as a topological group. We can thus use another K\"{u}nneth decomposition on it to show that $\H^i(1+\pi_F \O_F, \overline{\F}_p) \simeq \overline{\F}_p^{\binom{ef}{i}}$. In summary, we have \[\H^1(I_{1,\Nrd=1},\overline{\F}_p)^{\oplus 2} \oplus \overline{\F}_p^{\binom{ef}{2}} \subset \H^2(I_{1},\overline{\F}_p),\] where each summand is also as representations of $D^\times/I_1$, with $\overline{\F}_p^{\binom{ef}{2}}$ having the trivial action. \end{remark} \section{Acknowledgements} The authors would like to thank Tasho Kaletha and Karol Koziol for providing valuable mentorship throughout this project, helping simplify several components of this paper, and pointing out errors. They would also like to thank the University of Michigan Math REU for making this project possible. This research was supported by NSF grant DMS-1801687. \providecommand{\bysame}{\leavevmode\hbox to3em{\hrulefill}\thinspace} \providecommand{\MR}{\relax\ifhmode\unskip\space\fi MR } \providecommand{\MRhref}[2]{% \href{http://www.ams.org/mathscinet-getitem?mr=#1}{#2} } \providecommand{\href}[2]{#2}
\section{Type system}~\label{sec:type-rules} In this section, we introduce the {\sc SolType}\xspace refinement type system for the {\sc MiniSol}\xspace language. \subsection{Preliminaries} We start by discussing the environments and judgments used in our type system; these are summarized in Figure~\ref{fig:env}. \input{figures/syntax_types} \paragraph{Environments} Our type system employs a local environment $\Env$ and a set of \emph{guard} predicates $\Guards$. A local environment $\Env$ is a sequence of type bindings (i.e., $x : \tau$), and we use the notation $\dom(\Env)$ to denote the set of variables bound in $\Env$. The guard predicates $\Guards$ consist of (1) a set of path conditions under which an expression is evaluated and (2) a \emph{lock status} $L$ ($\mathsf{Locked}$ or $\mathsf{Unlocked}$) that tracks whether the state variables are currently being modified. In addition to $\Env$ and $\Guards$, our typing rules need access to struct and function definitions. For this purpose, we make use of another environment $\Delta$ that stores function signatures, struct definitions, and types of the state variables. To avoid cluttering notation, we assume that $\Delta$ is implicitly available in the expression and statement typing judgments, as $\Delta$ does not change in a function body. We use the notation $\Delta(S)$ to indicate looking up the fields of struct $S$, and we write $\Delta(S, x)$ to retrieve the type of field $x$ of struct $S$. Similarly, the notation $\Delta(f)$ yields the function signature of $f$, which consists of a sequence of argument type bindings as well as the return type. Finally, given a state variable $x$, $\Delta(x)$ returns the type of $x$. \paragraph{Typing Judgments} As shown in Figure~\ref{fig:env}, there are three different typing judgments in {\sc MiniSol}\xspace: \begin{itemize}[leftmargin=*] \item \emph{Expression typing judgments}: We use the judgment $\tjudg{\Env;\Guards}{e}{\tau}$ to type check a {\sc MiniSol}\xspace expression $e$. In particular, this judgment indicates that expression $e$ has refinement type $\tau$ under local environment $\Env$, guard $\Guards$, and (implicit) global environment $\Delta$. \item \emph{Statement typing judgments}: Next, we use a judgment of the form $\tjudgS{\Env;\Guards}{s}{\Env';\Guards'}$ to type check statements. The meaning of this judgment is that statement $s$ type checks under local environment $\Env$ and guard $\Guards$, and it produces a new local type environment $\Env'$ and guard $\Guards'$. Note that the statement typing judgments are flow-sensitive in that they modify the environment and guard; this is because (1) let bindings can add new variables to the local type environment, and (2) fetch/commit statements will modify the guard. \item \emph{Join typing judgments}: Finally, we have a third typing judgment for join points of conditionals. This judgment is of the form $\tjudgS{\Env;\Guards;(\Env_1;\Guards_1);(\Env_2;\Guards_2)}{j}{\Env';\Lock}$ where $\Env, \Guards$ pertain to the state before the conditional, $\Env_i, \Guards_i$ are associated with the state after executing each of the branches, and $\Env'$ and $\Lock$ are the resulting environment and lock status after the join point. \end{itemize} \paragraph{Subtyping} Finally, our type system makes use of a subtyping judgment of the form: $$\subty{\Env;\Guards}{\tau_1}{\tau_2}$$ which states that, under $\Env$ and $\Guards$, the set of values represented by $\tau_1$ is a subset of those represented by $\tau_2$. As expected and as shown in Figure~\ref{fig:subtype}, the subtyping judgment reduces to checking logical implication. In particular, we use a function $\mathsf{Encode}$ to translate $\Env, \gamma$ and the two terms $t_1, t_2$ to logical formulas which belong to the quantifier-free fragment of the combined theory of rationals, arrays, equality with uninterpreted functions. Thus, to check whether $\tau_1$ is a subtype of $\tau_2$, we can use an off-the-shelf SMT solver. Since our encoding of refinement types into SMT is the standard scheme used in \cite{liquidtype08,liquidtype10,rsc2016}, we do not explain the $\mathsf{Encode}$ procedure in detail. \begin{example} Consider the following subtyping judgment: \[ \subty{\Gamma; c\geq d} {\rtype{\tint}{\nu = a}}{\rtype{\tint}{\nu \geq d}} \] where $\Gamma$ contains four variables $a,b,c,d$ all with base type $\tint$ and $a$ has the refinement $\nu = b+c$. This subtyping check reduces to querying the validity of the following formula: \[ \phi_\btype \land a = b + c \land c \geq d \land \nu = a \implies \nu \geq d \] where $\phi_\btype$ are additional clauses that restrict the terms of type $\tint$ to be in the interval $[0, \pmaxint]$. \end{example} \begin{figure}[t] \centering \input{figures/judg-subtype} \caption{Subtyping relation}~\label{fig:subtype} \end{figure} \subsection{Refinement Typing Rules}\label{sec:check-basic} In this section, we discuss the basic typing rules of {\sc SolType}\xspace, starting with expressions. Note that the typing rules we describe in this subsection are \emph{intentionally} imprecise for complex data structures involving nested mappings or mapping of structs. Since precise handling of complex data structures requires introducing additional machinery, we delay this discussion until the next subsection. \subsubsection{Expression Typing} \begin{figure} \input{figures/typing_expr} \vspace{-0.1in} \caption{Main refinement typing rules for expressions}~ \label{fig:typing_expr} \vspace{-0.1in} \end{figure} Fig~\ref{fig:typing_expr} shows the key typing rules for expressions. Since the first two rules and the rules involving structs are standard, we focus on the remaining rules for arithmetic expressions and mappings. \paragraph{Arithmetic expressions.} The \textsc{TE-Plus} and \textsc{TE-Mul} rules capture the overflow safety properties of 256-bit integer addition and multiplication respectively. In particular, they check that the sum/product of the two expressions is less than $\mathsf{MaxInt}$ (when treating them as mathematical integers). The next rule, \textsc{TE-Minus}, checks that the result of the subtraction is not negative (again, when treated as mathematical integers). Finally, the {\sc TE-Div} rule disallows division by zero, and constrains the result of the division to be in the appropriate range. \paragraph{Mappings.} The next two rules refer to reading from and writing to mappings. As stated earlier, we only focus on precise typing rules for variables of type $\mathsf{Map(UInt)}$ in this section and defer precise typing rules for more complex maps to the next subsection. Here, according to the \textsc{Te-MapInd} rule, the result of an evaluating $e_1[e_2]$ is less than or equal to $\mathsf{Sum}(e_1)$, where $\mathsf{Sum}$ is an uninterpreted function. According to the next rule, called \textsc{Te-MapUpd}, if we write value $e_3$ at index $e_2$ of mapping $e_1$, the sum of the elements in the resulting mapping is given by: \[ \mathsf{Sum}(e_1) - e_1[e_2] + e_3 \] Thus, this rule, which is based on an axiom from a previous work \cite{verx2019}, allows us to precisely capture the sum of elements in mappings whose value type is $\tint$. \subsubsection{Statement Typing} \begin{figure} \input{figures/typing_stmt} \caption{Main typing rules for statements and function definitions} ~\label{fig:typing_stmt} \end{figure} Next, we consider the statement typing rules shown in Figure~\ref{fig:typing_stmt}. Again, since some of the rules are standard, we focus our discussion on aspects that are unique to our type system. \paragraph{Conditionals.} In the conditional rule {\sc TS-If}, we separately type check the true and false branches, adding the appropriate predicate (i.e., $e$ or $\neg e$) to the statement guard for each branch. The results of the two branches are combined using the join typing judgment {\sc T-Join} (also shown in Figure~\ref{fig:typing_stmt}). In particular, the join rule checks the type annotations for variables that are introduced via $\Phi$ nodes in SSA form and requires that the type of the $x_i$ variants in each branch is a subtype of the declared type $\tau_i$ of $x_i$. Note also that the join rule requires agreement between the lock states in the two branches. This means that either (1) both branches commit their changes to state variables, or (2) both have uncommitted changes. \paragraph{Fetch and Commit.} As mentioned earlier, {\sc MiniSol}\xspace contains $\mathsf{fetch}$ and $\mathsf{commit}$ statements, with the intention of allowing temporary violations of contract invariants. The {\sc TS-Fetch} and {\sc TS-Commit} rules provide type checking rules for these two statements. Specifically, the \textsc{TS-Fetch} rule says that, when no ``lock" is held on the state variables (indicated by a lock status $\unlocked$), a fetch statement can be used to ``acquire" a lock and copy the current values of the state variables into a set of freshly declared variables. The contract invariant will be assumed to hold on these variables. Next, according to the \textsc{TS-Commit} rule, a commit statement can be used to ``release" the lock and write the provided expressions back to the state variables. The contract invariant will be checked to hold on the provided expressions. Thus, our fetch and commit constructs allow temporary violations of the contract invariant \emph{in between} these fetch and commit statements. \paragraph{Function Calls.} The {\sc TS-Call} rule in Figure~\ref{fig:typing_stmt} is used to type check function calls. In particular, since the contract invariant should not be violated between different transactions, our type system enforces that all state variables have been committed by requiring that the current state is $\mathsf{Unlocked}$. Since the type checking of function arguments and return value is standard, the rest of the rule is fairly self-explanatory. \paragraph{Function Definitions.} Finally, we consider the type checking rule for function definitions (rule \textsc{T-FunDecl} rule in Figure~\ref{fig:typing_stmt}). According to this rule, a function declaration is well-typed if its body $s$ is well-typed (with the environment initially set to the arguments and lock status being $\unlocked$), and the returned expression has type $\btype_r$ after executing $s$. \subsection{Generalizing Sum Axioms to Deeply Nested Mappings} \label{sec:agg-props} The \textsc{TE-MapInd} and \textsc{TE-MapUpd} rules that we presented in Fig.~\ref{fig:typing_expr} are sufficient for handling maps over integers; however, they are completely imprecise for more complex data structures, such as nested mappings or mappings of structs. Since Solidity programs often employ deeply nested mappings involving structs, it is crucial to have precise typing rules for more complex data structures. Therefore, in this section, we show how to generalize our precise typing rules for mappings over integers to arbitrarily nested mappings. To gain some intuition about how to generalize these typing rules, consider the \lstinline{usrs} mapping in Fig.~\ref{fig:erc20-example-struct}. The update to \lstinline{usrs} on line~\ref{line:struct_ex_add} is expressed in our IR as a sequence of map lookup operations followed by a sequence of updates: \begin{lstlisting}[language=minisol, escapechar=|, frame=none, numbers=none] // usrs0 has type mapping(address => mapping(uint => User)) let m0 = usrs0[msg.sender]; // lookup let u0 = m0[accno]; // lookup let b0 = u0[.bal]; // access bal field let u1 = u0[.bal |$\triangleleft$| b0 + amt]; // update bal field of struct let m1 = m0[accno |$\triangleleft$| u1]; // update usrs[msg.sender] with updated struct let usrs1 = usrs0[msg.sender |$\triangleleft$| m1]; // update usrs with updated nested mapping \end{lstlisting} Before we consider the revised typing rules, let us first consider the constraints we would \emph{want} to generate for this example: \begin{itemize}[leftmargin=*] \item For the first line, \lstinline{usrs0} is a nested mapping containing a struct called \lstinline{User} which has an integer field called \lstinline{bal}, and \lstinline{m0} is a mapping over \lstinline{User}s. Based on the semantics of our refinement terms, the assignment on the first line imposes the following constraint on \lstinline{m0}: \[ \psum(\pfld_{bal}(m0)) \leq \psum(\pfld_{bal}(\pflat(usrs0))) \] \item Using similar reasoning, we can infer the following constraint on \lstinline{u0}, which is of type \lstinline{User}: \[ u0[.bal] \leq \psum(\pfld_{bal}(m0)) \] \item When we update \lstinline{m1} on the fourth line, this again imposes a constraint involving $\psum$: \[ \begin{split} \psum(\pfld_{bal}(m1)) = \psum(\pfld_{bal}(m0)) - m0[accno].bal + u1.bal \end{split} \] \item Finally, for the update on the last line, we can infer: \[ \begin{array}{l} \psum(\pfld_{bal}(\pflat(usrs1))) = \\ \qquad \psum(\pfld_{bal}(\pflat(m0))) - \psum(\pfld_{bal}(m0)) + \psum(\pfld_{bal}(m1)) \end{array} \] \end{itemize} As we can see from this example, the \emph{shape} of the constraints we infer for complex map reads and writes is very similar to what we had in the {\sc TE-MapInd} and the {\sc TE-MapUpd} rules from Figure~\ref{fig:typing_expr}. In particular, reading from a map imposes constraints of the form: \begin{equation} \hole_2(m[k]) \leq \hole_1(m) \label{eq:sctx_lookup_template} \end{equation} whereas updating a map imposes constraints of the form: \begin{equation} \hole_1(\eupd{m}{k}{v}) = \hole_1(m) - \hole_2(m[k]) + \hole_2(v) \label{eq:sctx_update_template} \end{equation} Therefore, we can easily generalize the {\sc TE-MapInd} and the {\sc TE-MapUpd} rules to arbitrarily complex mappings as long as we have a way of figuring out how to instantiate $H_1, H_2$ in Equations~\ref{eq:sctx_lookup_template} and~\ref{eq:sctx_update_template}. \begin{comment} In Section~\ref{sec:overview}, we illustrated how a summation can impose an upper bound on an individual mapping value, and that such a bound can be used to prove overflow safety of addition. This snippet involves three upper bounds: \begin{itemize} \item on the \lstinline{bal} field of \lstinline{b0}, by the summation of the bal fields of the entries in \lstinline{u0}; \item on the summation of the bal fields of all struct entries in \lstinline{u0}, by that of \lstinline{m0}; \item and on the summation of the bal fields of all struct entries in \lstinline{m0}, by that of \lstinline{usrs0}. \end{itemize} Despite each mapping having different types of values, note that each bound is of the form \begin{equation} \hole_1(m) \geq \hole_2(m[k]) \label{eq:sctx_lookup_template} \end{equation} where $m$ is the mapping, $k$ is the index, $H_2$ is some summation operator over $m[k]$, and $H_1$ is some summation operator over $m$. The shape of the bound matches the one used in the \textsc{TE-MapInd} rule, except written as a lower bound on $\hole_1(m)$ rather than an upper b ound on $\hole_2(m[k])$. Similarly, observe that the two mapping update operations update the "new" summations in the following way: \begin{itemize} \item The summation over the \lstinline{bal} fields of the entries in \lstinline{m1} is equal to that of \lstinline{m0} plus the difference between the bal field of \lstinline{u1} and the bal field of \lstinline{u0}. \item The summation over all \lstinline{bal} fields of all struct entries in \lstinline{usrs1} is equal to that of \lstinline{usr0} plus the difference between the summations in \lstinline{m1} and \lstinline{m0}. \end{itemize} Despite being over mappings of different types, each of the new summations can be expressed in the form \begin{equation} \hole_1(\eupd{m}{k}{v}) = \hole_1(m) - \hole_2(m[k]) + \hole_2(v) \label{eq:sctx_update_template} \end{equation} where $m$ is the mapping to update, $k$ is the key to update, $v$ is the new value, $H_1$ is some summation operator on mappings, and $H_2$ is some summation operator on mapping values. Again, the shape of this predicate matches one we have already seen, namely the one in the \textsc{TE-MapUpd} rule. \end{comment} \subsubsection{Refinement Term Templates} Based on the above observation, given a source expression $e$ of some base type $T$, we want a way to automatically generate relevant refinement terms of the form $\hole(e)$. To facilitate this, we first introduce the notion of \emph{templatized refinement terms}: \begin{definition}{\bf (Templatized refinement term)} A \emph{ refinement term template} $\hole$ is a refinement term containing a unique hole, denoted $\square$. Given such a template $\hole$, we write $\hole(e)$ to denote the refinement term obtained by filling the hole $\square$ in $\hole$ with $e$. \end{definition} For instance, $\hole = \psum(\pfld_\emph{bal}(\square))$ is a valid template, and $\hole(m0)$ yields $ \psum(\pfld_\emph{bal}(m0))$. Next, given a type $T_h$, we need a way to generate all templates that can be applied to expressions of type $T_h$. Towards this purpose, we introduce a \emph{template synthesis judgment} of the following form: \[ \begin{array}{rllr} \multicolumn{3}{l}{\tjudgP{\btype_h}{\hole}{\btype}{w}} & \text{(Template synthesis judgment)} \end{array} \] The meaning of this judgment is that, given an expression $e$ of type $T_h$, $\hole(e)$ is a well-typed term of type $T$. In this judgment, $w$ is a so-called \emph{access path} that keeps track of the field accesses we need to perform to get from $e$ to $\hole(e)$. In particular, an access path is a sequence of field names defined according to the following grammar: \[ \begin{array}{rllr} w & ::= & \epsilon \mid x, w & \text{(Access path)} \\ \\ \end{array} \] where $x$ is the name of a field. As we will see shortly, we need this concept of access path to ensure that we do not generate non-sensical constraints in our generalized type checking rules for map reads and writes. \begin{figure} \input{figures/typing_paths} \caption{Inference rules for type-directed synthesis of refinement term templates} \label{fig:hole_rules} \end{figure} Figure~\ref{fig:hole_rules} shows our rules for synthesizing refinement term templates. The first rule, {\sc TH-Sum}, states that we can apply the $\psum$ operator to an expression whose base type is $\tmapping{\tint}$. The second rule, {\sc TH-Flatten}, allows applying a $\pflat$ operation to any term of type $\tmapping{\tmapping{\btype}}$. The third rule, {\sc TH-Fld}, states that we can apply a projection operator to an expression that is a mapping of structs. In other words, if $\hole$ is a mapping over structs $S$ and $S$ has a field called $x$, then we can generate the template $\pfld_x(\hole)$. Since this involves a field access, note that the {\sc TH-Fld} rule adds $x$ to the access path. The next rule, {\sc Th-FldAcc}, is very similar but applies to structs instead of mappings of structs. In particular, if $\hole$ has struct type $S$ with field $x$, it is valid to access the $x$ field of $H$. As in the previous case, this rule appends $x$ to the resulting access path. The final rule, {\sc TH-Hole} is a base case and states that the hole is constrained to have the specified type $\btype_h$. \begin{comment} \subsubsection{Sum Contexts} Based on our observation, we can generalize the lookup and update axioms in the \textsc{TE-MapInd} and \textsc{TE-MapUpd} rules by adopting Eqs.~\ref{eq:sctx_lookup_template} and \ref{eq:sctx_update_template} as templates (with the former written as a lower bound) and finding some way to instantiate $\hole_1$ and $\hole_2$. First, we have previously defined the $\psum$, $\pflat$, and $\pfld_x$ operators, which should be sufficiently expressive to capture the summations we have shown in our running example. For example, we can instantiate \eqref{eq:sctx_lookup_template} for \lstinline{m0} as follows: $$ \psum(\pflat(\pfld_{bal}(usrs1))) \geq \psum(\pfld_{bal}(m0))) $$ which captures the property that $$ \sum_i\sum_j usrs1[i][j].bal \geq \sum_j usrs1[msg.sender][j].bal $$ Second, we must figure out how to compose these operators. We define a \textit{sum context} as \input{figures/syntax_holes} where $\holet$ is a special variable called the \emph{hole}. $\hole$ can be thought of a template for a summation term that can be constructed by substituting $\holet$ with some term $t$. We write $\hole(t)$ to denote such a substitution. Next, we define a special form of typing judgment that can be used to construct sum contexts in a type-directed manner: \[ \begin{array}{rllr} w & ::= & \epsilon \mid x, w & \text{(Access path)} \\ \\ \multicolumn{3}{l}{\tjudgP{\btype_h}{\hole}{\btype}{w}} & \text{(Sum context synthesis judgment)} \end{array} \] where $w$, which we call an \textit{access path}, is a sequence of struct field names. We use $\epsilon$ to denote the empty sequence. Intuitively, the judgment asserts that if we start with some term $\holet$ of type $\btype_h$, then we can synthesize a term $\hole$ that has type $\btype$. The struct fields accessed in the construction of $\hole$ are collected in $w$. We must be able to distinguish between different access paths, otherwise we could construct nonsensical axioms such as $$\text{For all $k$,} \qquad m[k].x_1 \leq \sum_i m[i].x_2$$ The inference rules for this judgment are shown in Fig~\ref{fig:hole_rules}. The \textsc{TH-Hole} rule acts like an identity: if the term to substitute is the desired type $\btype_h$, then just use the provided term. \textsc{TH-Sum} and \textsc{TH-Flatten} work in the obvious way. The interesting rules are \textsc{TH-FldAcc} and \textsc{TH-Fld}. If we are able to synthesize some $\hole$ with type $\tstruct{S}$, then \textsc{TH-FldAcc} says that we can access some field $x$ to synthesize a term with the type of $x$. Similarly, \textsc{TH-Fld} says that we can project out a struct field inside a mapping of structs. \end{comment} \subsubsection{Generalized Typing Rules for Map Reads and Writes} \begin{figure} \centering \begin{mathpar} \input{figures/rule_map_with_holes.tex} \end{mathpar} \caption{Updated typing rules for mappings, where refinement term templates are used to generate sum properties over nested data structures.} \label{fig:new_map_typing_rules} \end{figure} Equipped with the template synthesis rules, we are now ready to present the generalized and precise versions of \textsc{TH-MapInd} and \textsc{TH-MapUpd} rules for arbitrarily complex mappings. The new {\sc TE-MapInd} rule shown in Figure~\ref{fig:new_map_typing_rules} generates precise constraints on $e_1[e_2]$ where $e_1$ is has type $\mathsf{Map}(T)$. As illustrated earlier through the example, this rule generates constraints of the form $\hole_2(\nu) \leq \hole_1(e_1)$, where $\hole_1, \hole_2$ are templates that can be applied to terms of type $\mathsf{Map}(T)$ and $T$ respectively. Since a given struct can have multiple integer fields, this rule generates a conjunction of such constraints, one for each integer field. Note that, for each constraint of the form $H_{i2}(\nu) \leq H_{i1}(e_1)$ in this rule, we enforce that the corresponding access paths $w_i$ match, as, otherwise, the generated constraints would not make sense. Next, we consider the new {\sc TE-MapUpd} rule in Figure~\ref{fig:new_map_typing_rules} for updating maps. Specifically, given an expression $e_1[e_1 \triangleleft e_3]$ where $e_1$ is of type $\mathsf{Map}(T)$, this rule generates a conjunction of constraints of the form: \[ H_{i1}(\nu) = H_{i2}(e_1) - H_{i2}(e_1[e_2]) + H_{i2}(e_3), \] one for each integer field accessible from $T$. As in the previous case, we use the notion of access paths to ensure that the hole templates $H_{i1}$ and $H_{i2}$ correspond to the same field sequence. \begin{example} Consider again the update to \lstinline{usrs} on line~\ref{line:struct_ex_add} of Fig~\ref{fig:erc20-example-struct}. We demonstrate how the \textsc{TE-MapInd} rule generates typing constraints. First, since \lstinline{usrs} has type $\tmapping{\tmapping{\emph{User}}}$, we have $\btype = \tmapping{\emph{User}}$. From the synthesis rules, one such instantiation for $H_{i1}$ is $\psum(\pfld_{bal}(\pflat(\holet)))$, as shown by the following derivation tree: \begin{center} \small \begin{mathpar} \inferrule*[Left=TH-Sum]{ \inferrule*[Left=TH-Fld]{ \inferrule*[Left=TH-Flatten]{ \inferrule*[Left=TH-Hole]{ }{ \tjudgP{\tmapping{\tmapping{{User}}}}{\holet}{\tmapping{\tmapping{{User}}}}{\epsilon} } } { \tjudgP{\tmapping{\tmapping{{User}}}}{\pflat(\holet)}{\tmapping{User}}{bal} } \\ \defns(User, bal) = \tint } { \tjudgP{\tmapping{\tmapping{{User}}}}{\pfld_{bal}(\pflat(\holet))}{\tmapping{\tint}}{bal} } } { \tjudgP{\tmapping{\tmapping{{User}}}}{\psum(\pfld_{bal}(\pflat(\holet)))}{\tint}{bal} } \end{mathpar} \end{center} Next, we find an instantiation for $H_{i2}$ that accesses the same fields $w = bal$. It can be proven that $$\tjudgP{\tmapping{\tstruct}}{\psum(\pfld_{bal}(\holet))}{\tint}{bal}$$ which yields $H_{i2} = \psum(\pfld_{bal}(\holet))$. Then, using the \textsc{TE-MapInd} rule, we obtain the constraint \begin{equation} \psum(\pfld_{bal}(\nu)) \leq \psum(\pfld_{bal}(\pflat(usrs))) \label{eq:hole_ex_p1} \end{equation} Note that this is only \emph{one} of the predicates that we can derive. For example, if the \lstinline{User} had another integer field called \lstinline{frozen}, we would also generate the following predicate: \begin{align} \psum(\pfld_{frozen}(\nu)) &\leq \psum(\pfld_{frozen}(\pflat(usrs))) \label{eq:hole_ex_p2} \end{align} Taking the conjunction of \eqref{eq:hole_ex_p1} and \eqref{eq:hole_ex_p2}, we obtain the following type for \lstinline{usrs[msg.sender]}: \begin{align*} usrs[msg.sender] : \rtypei{ \nu \mid & \nu = usrs[msg.sender] \\ & \land \psum(\pfld_{bal}(\nu)) \leq \psum(\pfld_{bal}(\pflat(usrs))) \\ & \land \psum(\pfld_{frozen}(\nu)) \leq \psum(\pfld_{frozen}(\pflat(usrs))) } \end{align*} \end{example} \subsection{Soundness} We characterize the soundness of our type system in the typical way through progress and preservation theorems for both expressions and statements. We briefly state the key propositions and refer the reader to the supplementary materials for details. \begin{proposition}[Progress for Expressions] \label{prop:progress-expr} If \ $\tjudg{\Env;\Guards}{\expr}{\type}$, then $\expr$ is a value or there exists an $\expr'$ such that $\stepE{\expr}{\expr'}$. \end{proposition} Here, $\stepE{e}{e'}$ is the standard expression evaluation relation, and progress can be proven by induction in the standard way. On the other hand, proving preservation is more interesting, mainly due to the rules from Fig.~\ref{fig:new_map_typing_rules} for complex data structures. To prove preservation, we first need to prove a lemma that that relates each sum function generated in the refinement of a mapping to that of the corresponding sum function generated for each entry (value) in the mapping. With such a lemma, we can prove the following preservation theorem in a fairly standard way: \begin{proposition}[Preservation for Expressions] \label{prop:pres-expr} If \ $\tjudg{\Env;\Guards}{\expr}{\type}$ and $\stepE{\expr}{\expr'}$, then $\tjudg{\Env;\Guards}{\expr'}{\type}$. \end{proposition} Next, to state the progress and preservation theorems for statements, we first introduce the following notation: \[ \begin{array}{lr} \store & \text{(State variable store)} \\ \stepS{s}{\store}{s}{\store'}{\store_{sub}} & \text{(Statement evaluation relation)} \\ \tjudgStore{\store} & \text{(Store typing)} \end{array} \] The state variable store $\store$ contains the value bindings for the state variables. The statement evaluation relation $\stepS{s}{\store}{s'}{\store'}{\store_{sub}}$ indicates that, starting with state variable bindings $\store$, the statement $s$ will step to a statement $s'$ with updated bindings $\store'$ and a set of local variable bindings $\store_{sub}$ to apply to the statements following $s'$. The store typing judgment $\tjudgStore{\store}$ asserts that $\store$ is well-typed. With this notation in place, we can state the progress and preservation theorems for statements as follows: \begin{proposition}[Progress for Statements]\label{thm:prog-stmt} If \ $\tjudgS{\Env_1;\Guards_1}{s}{\Env_2;\Guards_2}$ and \ $\tjudgStore{\store}$, then $s = \sskip$, $s = \sassume \efalse$, or there exist $s', \store', \store_{sub}$ such that $\stepS{s}{\store}{s'}{\store'}{\store_{sub}}$. \end{proposition} \begin{proposition}[Preservation for Statements] If \ $\tjudgS{\Env_1;\Guards_1}{s}{\Env_2;\Guards_2}$ and $\tjudgStore{\store}$ and \ $\stepS{s}{\store}{s'}{\store'}{\store_{sub}}$, then there exist $\Env_1', \Guards_1'$ such that $\tjudgS{\Env_1';\Guards_1'}{s'}{\Env_2;\Guards_2}$ and $\tjudgStore{\store'}$. \end{proposition} Note that $\sassume \efalse$ in Proposition~\ref{thm:prog-stmt} corresponds to a failed runtime check. \section{Conclusion}~\label{sec:concl} We have presented {\sc SolType}\xspace, a refinement type system for Solidity that can be used to prove the safety of arithmetic operations. Since integers in smart contracts often correspond to financial assets (e.g., tokens), ensuring the safety of arithmetic operation is particularly important in this context. One of the distinguishing features of our type system is its ability to express and reason about arithmetic relationships between integer variables and aggregations over complex data structures such as multi-layer mappings. We have implemented our proposed type system in a prototype called {\sc Solid}\xspace, which also has type inference capabilities. We have evaluated {\sc Solid}\xspace on {\TotContractCount}\ smart contracts from two datasets and demonstrated that it can fully automatically discharge \TotAsSafePct\% of redundant {\sc SafeMath}\xspace calls in our benchmarks. Furthermore, {\sc Solid}\xspace, even when used in a fully automated mode, significantly outperforms {\sc Verismart}\xspace, a state-of-the-art Solidity verifier, in terms of both false positive rate and running time. While the design of {\sc SolType}\xspace was largely guided from the perspective of proving arithmetic safety, our proposed type system could also be used for proving other types of properties. In future work, we plan to explore the applicability of our refinement type system in other settings and extend it where necessary. \section{Evaluation}~\label{sec:eval} In this section, we describe a series of experiments that are designed to answer the following research questions: \begin{itemize}[leftmargin=*] \item {\bf RQ1:} Can {\sc Solid}\xspace successfully remove redundant overflow checks without manual annotations? \item {\bf RQ2:} What is {\sc Solid}\xspace's false positive rate? \item {\bf RQ3:} How long does {\sc Solid}\xspace take to type check real-world smart contracts? \item {\bf RQ4:} How does {\sc Solid}\xspace compare against existing state-of-the art tools? \item {\bf RQ5:} How important are type inference and the proposed refinement typing rules for more complex data structures? \end{itemize} \paragraph{Baseline.} To answer our fourth research question, we compare {\sc Solid}\xspace against {\sc Verismart}\xspace, which is a state-of-the-art Solidity verifier that focuses on proving arithmetic safety properties~\cite{verismart2020}. We choose {\sc Verismart}\xspace as our baseline because it has been shown to outperform other smart contract verifiers for checking arithmetic safety~\cite{verismart2020}. {\sc Verismart}\xspace infers so-called \emph{transaction invariants} through a domain-specific instantiation of the \emph{counterexample-guided inductive synthesis (CEGIS)} framework~\cite{cegis} and uses the inferred invariants to discharge potential overflow errors. To perform this evaluation, we built the latest version of {\sc Verismart}\xspace from source (version from May 31, 2020) and ran both tools on all the benchmarks, using versions 0.4.26 and 0.5.17 of the Solidity compiler. \paragraph{Setup} We performed all experiments on a computer with an AMD Ryzen 5900X CPU and 32GB of RAM. We used version 4.8.9 of the Z3 SMT solver, which also has the built-in Spacer CHC solver \cite{spacer2014}. In our experiments, we set a time limit of 10\ seconds per Z3 query. \paragraph{Settings} Our implementation can be used in two modes that we refer to as {\sc Auto}-\toolname and {\sc Semi}-\toolname. In particular, {\sc Auto}-\toolname is fully automated and uses our type inference procedure to infer type annotations for state variables (i.e., contract invariants). On the other hand, {\sc Semi}-\toolname requires the programmer to provide contract invariants but automatically infers types for local variables. To use {\sc Solid}\xspace in this semi-automated mode, we manually wrote refinement type annotations for state variables by inspecting the source code of the contract. \subsection{Benchmarks} We evaluate {\sc Solid}\xspace on two different sets of benchmark suites that we refer to as ``{\sc Verismart}\xspace benchmarks'' and ``{\sc Etherscan}\xspace benchmarks''. As its name indicates, the former one is taken from the {\sc Verismart}\xspace evaluation and consists of 60 smart contracts that have at least one vulnerability reported in the CVE database. Since these benchmarks are from 2018 and do not reflect rapid changes in smart contract development, we also evaluate our approach on another benchmark suite collected from {\sc Etherscan}\xspace. The latter benchmark suite consists of another 60 contracts randomly sampled from {\sc Etherscan}\xspace in March 2021. Table~\ref{tbl:ether-stat} presents some relevant statistics about the contracts in this dataset. \begin{comment} \paragraph{{\sc Verismart}\xspace} This dataset comes from {\sc Verismart}\xspace's publicly available suite of benchmarks, which consist of 60 smart contracts reported to the CVE security vulnerability database. Since the {\sc Verismart}\xspace suite is outdated (collected before 2018) and it does not reflect the rapid changes in smart contract development, we also consolidate another dataset from {\sc Etherscan}\xspace. \paragraph{{\sc Etherscan}\xspace} We downloaded the entire 67,153 (as of March 18, 2021) contracts from {\sc Etherscan}\xspace. Table~\ref{tbl:ether-stat} summarizes the statistics of the {\sc Etherscan}\xspace data set. In particular, our benchmarks on average have 389\ lines of source code with the maximum and minimum LOC being 1573\ and 86, respectively. Since we have to manually figure out the groundtruth for each contract, we randomly sampled 60 of the popular~\footnote{Popular according to the number of transactions.} {\sc Etherscan}\xspace contracts and (1) replaced all {\sc SafeMath}\xspace operations with primitive unchecked arithmetic, and (2) determined whether each original {\sc SafeMath}\xspace call is redundant or not. \end{comment} \begin{table}[] \begin{tabular}{|l|c|} \hline {\bf Description } & {\bf Stats} \\ \hline \hline \hline \% contracts containing mappings of structs & 26.7\% \\ \hline \% contracts containing nested mappings & 81.3\% \\ \hline Average lines of code & 389 \\ \hline Average number of methods & 29.6 \\ \hline \end{tabular} \caption{Statistics about our benchmarks from {\sc Etherscan}\xspace} \label{tbl:ether-stat} \end{table} \subsection{Discharging Redundant SafeMath Calls} We performed a manual inspection of all 120 benchmarks to determine how many of the {\sc SafeMath}\xspace \footnote{Recall that {\sc SafeMath}\xspace is a library that inserts runtime checks before each arithmetic operation.} run-time checks are redundant. In total, among the \TotTotOps\ run-time checks, we determined \TotTotGtNeg\ of them to be redundant (390\ in {\sc Verismart}\xspace and 463\ in {\sc Etherscan}\xspace). In this experiment, we evaluate what percentage of these redundant checks {\sc Verismart}\xspace, {\sc Auto}-\toolname, and {\sc Semi}-\toolname are able to discharge. The results from this evaluation are shown in Table~\ref{tbl:check}. The key-take away is that {\sc Auto}-\toolname is able to discharge more run-time checks in both benchmark suites. In particular, for the {\sc Verismart}\xspace benchmarks, {\sc Auto}-\toolname can discharge approximately \VsEvalSafePctDelta\% more overflow checks, and for the {\sc Etherscan}\xspace benchmarks, this difference increases to \EsEvalSafePctDelta\%. If we additionally leverage manually-written refinement type annotations, then {\sc Semi}-\toolname can discharge almost \TotSsSafePctRounded\% of the redundant checks across both datasets. \\ \begin{table}[] \begin{tabular}{|l|l|l|l|l|l|l|l|l|} \hline \multirow{2}{*}{Dataset} & \multirow{2}{*}{Ops} & \multirow{2}{*}{\#redundant} & \multicolumn{2}{l|}{{\sc Verismart}\xspace} & \multicolumn{2}{l|}{{\sc Auto}-\toolname} & \multicolumn{2}{l|}{{\sc Semi}-\toolname} \\ \cline{4-9 } & & & Safe & \% & Safe & \% & Safe & \% \\ \hline {\sc Verismart}\xspace & 642 & 390 & 294 & \VsEvalVsSafePct \% & 340 & \VsEvalAsSafePct\% & 351 & \VsEvalSsSafePct\% \\ \hline {\sc Etherscan}\xspace & 667 & 463 & 272 & \vsSafePct \% & 396 & \asSafePct\% & 417 & \ssSafePct\% \\ \hline\hline \textbf{Total} & \TotTotOps & \TotTotGtNeg & \TotVsSafe & \TotVsSafePct\% & \TotAsSafe & \TotAsSafePct\% & \TotSsSafe & \TotSsSafePct\% \\ \hline \end{tabular} \caption{{Number and percentage of redundant overflow checks that can be eliminated by each tool. The Ops column displays the total number of SafeMath checks. Under each tool, the Safe column lists the number of arithmetic operations that can be proven safe by that tool, and the \% column shows the percentage of redundant overflow checks that can be discharged. }} \label{tbl:check} \end{table} \fbox{ \begin{minipage}{0.9\linewidth} {\bf Result for RQ1:} {\sc Solid}\xspace can automatically prove that \TotAsSafePct\% of the redundant {\sc SafeMath}\xspace calls are unnecessary. In contrast, {\sc Verismart}\xspace can only discharge \TotVsSafePct\%. \end{minipage} } \subsection{False Positive Evaluation} \begin{table}[] \begin{tabular}{|l|c|c|c|} \hline & {\sc Verismart}\xspace & {\sc Auto}-\toolname & {\sc Semi}-\toolname \\ \hline {\bf Verismart Benchmarks } & & & \\ \hline \# false positives & 97 & 50 & 41 \\ \hline \# true positives & 251 & 252 & 252 \\ \hline False positive rate & 27.9\% & 16.2\% & \VsEvalSsFpr\% \\ \hline {\bf Etherscan Benchmarks } & & & \\ \hline \# false positives & \vsFpCount & \asFpCount & \ssFpCount \\ \hline \# true positives & \vsTpCount & \asTpCount & \asTpCount \\ \hline False positive rate & \vsFpr\% & \asFpr\% & \ssFpr\% \\ \hline {\bf Overall } & & & \\ \hline \# false positives & \TotVsFpCount & \TotAsFpCount & \TotSsFpCount \\ \hline \# true positives & \TotVsTpCount & \TotAsTpCount & \TotAsTpCount \\ \hline False positive rate & \TotVsFpr\% & \TotAsFpr\% & \TotSsFpr\% \\ \hline \end{tabular} \caption{Comparison of false positive rates} \label{tbl:fp} \end{table} Next, we evaluate {\sc Solid}\xspace's false positive rate in both the fully-automated and semi-automated modes and compare it against {\sc Verismart}\xspace. In particular, Table~\ref{tbl:fp} shows the number of true and false positives as well as the false positive rate for each tool for both benchmark suites. Across all benchmarks, {\sc Verismart}\xspace reports \TotVsFpCount\ false alarms, which corresponds to a false positive rate of \TotVsFpr\%. On the other hand, {\sc Auto}-\toolname only reports \TotAsFpCount\ false alarms with a false positive rate of \TotAsFpr\%. Finally, {\sc Semi}-\toolname has an ever lower false positive rate of \TotSsFpr\%. It is worth noting that the false positive rate for {\sc Semi}-\toolname can be further reduced by spending additional effort in strengthening our refinement type annotations. When performing this evaluation, we did not refine our initial type annotations based on feedback from the type checker. \paragraph{Cause of false positives for {\sc Auto}-\toolname} As expected, the cause of most false positives for {\sc Auto}-\toolname is due to the limitations of the CHC solver. There are several cases where the CHC solver times-out or returns unknown, causing {\sc Auto}-\toolname to report false positives. \paragraph{Qualitative comparison against {\sc Verismart}\xspace} We believe that {\sc Solid}\xspace outperforms {\sc Verismart}\xspace largely due to its ability to express relationships between integers and aggregate properties of data structures. In particular, while {\sc Verismart}\xspace can reason about summations over basic mappings, it cannot easily express aggregate properties of more complex data structures. \\ \fbox{ \begin{minipage}{0.9\linewidth} {\bf Result for RQ2 and RQ4.} In its fully automated mode, {\sc Solid}\xspace has a false positive rate of \TotAsFpr\%. In contrast, {\sc Verismart}\xspace has a significantly higher false positive rate of \TotVsFpr\%. \end{minipage} } \subsection{Running Time} Next, we investigate the running time of {\sc Solid}\xspace and compare it against {\sc Verismart}\xspace. Table~\ref{tbl:perf} gives statistics about the running time of each tool. As expected, {\sc Semi}-\toolname is faster than {\sc Auto}-\toolname, as it does not need to rely on the CHC solver to infer contract invariants. However, even {\sc Auto}-\toolname is significantly faster than {\sc Verismart}\xspace despite producing fewer false positives. \\ \fbox{ \begin{minipage}{0.9\linewidth} {\bf Result for RQ3 and RQ4:} In its fully automated mode, {\sc Solid}\xspace takes an average of 41\ seconds to analyze each benchmark, and is significantly faster compared to {\sc Verismart}\xspace despite generating fewer false positives. \end{minipage} } \begin{table}[] \begin{tabular}{|l|c|c|c|} \hline Dataset & {\sc Verismart}\xspace & {\sc Auto}-\toolname & {\sc Semi}-\toolname \\ \hline \hline {{\sc Verismart}\xspace} & 476 & 62 & 9 \\ \hline {{\sc Etherscan}\xspace} & 425 & 24 & 10 \\ \hline \hline {\bf Overall} & 451 & 41 & 10 \\ \hline \end{tabular} \caption{Comparison of average running times in seconds} \label{tbl:perf} \end{table} \subsection{Impact of Type Inference} In this section, we perform an experiment to assess the impact of the type inference procedure discussed in Section~\ref{sec:infer}. Towards this goal, we consider the following two ablations of {\sc Solid}\xspace: \begin{table}[] \begin{tabular}{|l|c|c|c|} \hline & {\sc Solid}\xspace-NoInfer & {\sc Solid}\xspace-NoSoft & {\sc Solid}\xspace \\ \hline False positive rate & 48.7\% & 69.4\% & \asFpr\% \\ \hline \end{tabular} \caption{Experiments to evaluate type inference. This experiment is conducted on the {\sc Etherscan}\xspace benchmarks.} \label{tbl:ablation-infer} \end{table} \begin{itemize}[leftmargin=*] \item {\bf {\sc Solid}\xspace-NoInfer:} This is a variant of {\sc Solid}\xspace that does not perform global type inference to infer contract invariants. In particular, {\sc Solid}\xspace-NoInfer uses \texttt{true} as the type refinement of all state variables; however, it still performs local type inference. \item {\bf {\sc Solid}\xspace-NoSoft:} This variant of {\sc Solid}\xspace differs from the type inference procedure in Figure~\ref{alg:infer} in that it treats all overflow checks as hard constraints. \end{itemize} In this experiment, we compare the false positive rate of each ablated version against {\sc Solid}\xspace on the {\sc Etherscan}\xspace benchmarks. The results of this experiment are summarized in Table~\ref{tbl:ablation-infer}. \paragraph{Importance of contract invariant inference.} As we can see by comparing {\sc Solid}\xspace against {\sc Solid}\xspace-NoInfer, global type inference is quite important. In particular, if we do not infer contract invariants, the percentage of false positives increases from \asFpr\% to 48.7\%. \paragraph{Importance of soft constraints.} Next, we compare the false positive rate of {\sc Solid}\xspace against that of {\sc Solid}\xspace-NoSoft. Since {\sc Solid}\xspace-NoSoft treats all overflow checks as hard constraints, type inference fails if \emph{any} potential overflow in the contract cannot be discharged. Since most contracts contain at least one unsafe overflow, {\sc Solid}\xspace-NoSoft fails for most benchmarks, meaning that all overflows are considered as potentially unsafe. Thus, the false positive rate of {\sc Solid}\xspace-NoSoft jumps from \asFpr\% to~69.4\%. \subsection{Impact of the Type Checking Rules from Section~\ref{sec:agg-props}} In this section, we describe an ablation study to assess the impact of the more complex typing rules from Figure~\ref{fig:new_map_typing_rules} for non-trivial mappings. Towards this goal, we consider the following ablation: \begin{table}[] \begin{tabular}{|l|c|c|} \hline & {\sc Solid}\xspace-NoNested & {\sc Solid}\xspace \\ \hline False positive rate & 39.0\% & 23.5\% \\ \hline \end{tabular} \caption{Ablation study to evaluate rules from Section~\ref{sec:agg-props}. This experiment is conducted on {\sc Etherscan}\xspace benchmarks that contain non-trivial mappings.} \label{tbl:ablation-map} \end{table} \begin{itemize}[leftmargin=*] \item {\bf {\sc Solid}\xspace-NoNested:} This variant of {\sc Solid}\xspace uses the simpler refinement type checking rules from Section~\ref{sec:check-basic} but it does not utilize the typing rules from Section~\ref{sec:agg-props} that pertain to complex data structures. \end{itemize} In this experiment, we compare {\sc Solid}\xspace-NoNested against {\sc Solid}\xspace on those contracts from {\sc Etherscan}\xspace that contain complex data structures. As shown in Table~\ref{tbl:ablation-map}, the more involved typing rules from Section~\ref{sec:agg-props} are quite important for successfully discharging overflows in contracts with non-trivial mappings. In particular, without our refinement templates from Section~\ref{sec:agg-props}, the false positive rate increases from 23.5\% to 39.0\% on these benchmarks. \\ \fbox{ \begin{minipage}{0.9\linewidth} {\bf Result for RQ5:} Our proposed typing rules from Section~\ref{sec:agg-props} for more complex data structures and the proposed type inference algorithm from Section~\ref{sec:infer} are both important for achieving good results. \end{minipage} } \section{Limitations} In this section, we discuss some of the limitations of both our type system as well as prototype implementation. First, while logical qualifiers in {\sc SolType}\xspace express relationships between integers and aggregate properties of mappings, they do not allow quantified formulas. In principle, there may be situations that necessitate quantified refinements to discharge arithmetic safety; however, this is not very common. Second, {\sc Solid}\xspace uses an off-the-shelf CHC solver to infer refinement type annotations. Since this problem is, in general, undecidable, the CHC solver may return unknown or fail to terminate in a reasonable time. In practice, we set a small time limit of 10\ seconds per call to the CHC solver. {Third, {\sc Solid}\xspace is designed with checking arithmetic overflows in mind, so the proposed refinement typing rules may not be as effective for checking other types of properties.} \section{Implementation}~\label{sec:impl} We implemented our type checking and type inference algorithms in a prototype called {\sc Solid}\xspace. Our tool is written in Haskell, with about 3000 lines of code for the frontend (e.g., Solidity preprocessing, lowering, SSA transformation) and 4000 lines of code for the backend (e.g., constraint generation, SMT embedding, solving). {\sc Solid}\xspace uses the Z3 SMT solver~\cite{z3} and the Spacer CHC solver \cite{spacer2014} in its backed, and it leverages the Slither~\cite{slither} analyzer as part of its front-end. In what follows, we discuss various aspects of Solidity and how we handle them in the MiniSol IR. \paragraph{Preprocessing Solidity code.} To facilitate verification, we preprocess Solidity smart contracts before we translate them to the MiniSol IR. In particular, we partially evaluate constant arithmetic expressions such as \lstinline{6 * 10**26}, which frequently appear in constructors and initialization expressions. We also inline internal function calls. \begin{comment} \paragraph{Arithmetic Handling} For every arithmetic operation, {\sc Solid}\xspace adds the overflow safety predicate to the path condition. This is equivalent to assuming that all arithmetic operations either 1) do not overflow; or 2) are checked at runtime, aborting the current execution whenever an operation overflows. We directly use multiplication in our SMT embedding and We find that it works decently for proving overflow safety in practice despite the undecidability problems. Since Spacer does not support division, we approximate division using the following function whenever encountering an expression of the form $c = a / b$: $$div(a, b, c) \implies \left(ite\ (a = 0)\ (c = 0)\ (c * b \leq a \leq c * (b + 1)) \right)$$ This is sufficiently precise to prove the safety of subtractions involving the \textit{percentage expressions} that frequently appear in Solidity contracts, such as $$a - (a * 50) / 100$$ \end{comment} \paragraph{Function call handling} Our implementation automatically inserts fetch and commit statements between function call boundaries, such as at the beginning of a function, before and after function calls or calls to external contracts, and before returning from a function. This includes most function calls, including monetary transfers like \lstinline{msg.sender.send(..)} and calls to ``non-pure" functions in the same file. In Solidity, functions may be marked ``pure", meaning they do not read or write to state variables. We modified the \textsc{TS-Call} rule to not require the state variables to be unlocked when making calls to a pure function. \paragraph{Loops} Our implementation supports while-loops and for-loops using a variation of the \textsc{TS-If} rule. Performing effective type inference in the presence of loops (particularly, doubly-nested loops) is challenging, as existing CHC solvers have a hard time solving the resulting constraints. Inferring invariants for complex loops could be an interesting direction for future work, however, in practice, such loops are rare \cite{mariano2020demystifying} and we found they are mostly irrelevant to proving overflow safety. Our prototype implementation does not support complex control flow inside loops such as break or continue statements. \paragraph{References and aliasing.} Since everything is passed by value in MiniSol, the language shown in Figure~\ref{fig:syntax} does not have aliasing. Thus, as standard ~\cite{ESC-Java,boogie}, our translation from Solidity to MiniSol introduces additional mappings to account for possible aliasing. At a high-level, the idea is that, for any variables $X = \{x_1, \ldots, x_n\}$ that may alias each other, we introduce a mapping $M_X$ and model stores (resp. loads) to any $x_i$ as writing to (resp. reading from) $M_X[x_i]$. \paragraph{Unsupported features.} Our implementation does not support some Solidity features such as inline assembly, states of external contracts, bitwise operations, and exponentiation. When translating to the MiniSol IR, we model these statements using "havoc" expressions as is standard~\cite{boogie}. \section{Type Inference}~\label{sec:infer} In this section, we describe our algorithm for automatically inferring refinement type annotations. Since writing refinement type annotations for every variable can be cumbersome, {\sc Solid}\xspace infers types for both local and global (state) variables. As mentioned earlier, the key idea underlying our type inference algorithm is to reduce the type inference problem to Constrained Horn Clause (CHC) solving~\cite{chc}. However, since not all arithmetic operations in the program are guaranteed to be overflow-safe, the CHC constraints generated by the type checking algorithm will, in general, not be satisfiable. Thus, our high-level idea is to treat the overflow safety constraints as \emph{soft constraints} and find type annotations that try to satisfy as many soft clauses as possible. Before we explain our algorithm, we first clarify some assumptions that we make about the type checking phase. First, we assume that, during constraint generation, the refinement type of every variable $v$ without a type annotation is represented with a fresh uninterpreted predicate symbol $p_v$. Second, we assume that the generated constraints are marked as either being hard or soft. In particular, the overflow safety constraints generated using the {\sc TE-Plus}, {\sc TE-Minus} etc. rules are considered to be soft constraints, while all other constraints are marked as hard. Third, we assume that the constraint generation phase imposes a partial order on the soft constraints. In particular, if $c, c'$ are soft constraints generated when analyzing expressions $e, e'$ and $e$ must be evaluated before $e'$, then we have $c \prec c'$. As we will see shortly, this partial order allows us to assume, when trying to satisfy some soft constraint $c$, that overflow safety checks that happened before $c$ did not fail. Our type inference procedure {\sc InferTypes} is shown in Figure~\ref{alg:infer} and takes three inputs, namely a set of soft and hard constraints, $C_s$ and $C_h$ respectively, and a partial order $\preceq$ on soft constraints as described above. The output of the algorithm is a mapping $\Sigma$ from each uninterpreted predicate symbol to a refinement type annotation. Initially, the algorithm starts by initializing every uninterpreted predicate symbol $p_v$ to true (line~\ref{line:infer-init-preds}) and then enters a loop where the interpretation for each $p_v$ is gradually strengthened. In particular, in every loop iteration, we pick one of the soft constraints $c$ and try to satisfy $c$ along with all the hard constraints $C_H$. In doing so, we can assume all the overflow safety checks that happened to prior to $c$; thus, at line~\ref{line:infer-solvechc}, we feed the following constraint to an off-the-shelf CHC solver: \[ \Big ( \Big (\bigwedge_{c_i \prec c} c_i \Big ) \rightarrow c \Big ) \land \bigwedge_{c_j \in C_h} c_j \] In other words, we try to satisfy this particular soft constraint together with all the hard constraints, under the assumption that previous overflow checks did not fail. This assumption is safe since {\sc Solid}\xspace inserts run-time overflow checks for any operation that cannot be statically verified. If this constraint is unsatisfiable, we move on and try to satisfy the next soft constraint. On the other hand, if it is satisfiable, we strengthen the type annotation for the unknown predicates by conjoining it with the assignment produced by the CHC solver (line \ref{line:infer-update-pred}). \input{figures/alg_infer} \section{Introduction}~\label{sec:intro} Smart contracts are programs that run on top of the blockchain and perform financial transactions in a distributed environment without intervention from trusted third parties. In recent years, smart contracts have seen widespread adoption, with over 45 million~\cite{etherscan} instances covering financial products, online gaming, real estate~\cite{case1}, shipping, and logistics~\cite{case2}. Because smart contracts deployed on a blockchain are freely accessible through their public methods, any functional bugs or vulnerabilities inside the contracts can lead to disastrous losses, as demonstrated by recent attacks~\cite{attack1,attack2,attack3,attack4}. Therefore, unsafe smart contracts are increasingly becoming a serious threat to the success of the blockchain technology. For example, recent infamous attacks on the Ethereum blockchain such as the DAO~\cite{attack1} and the Parity Wallet~\cite{attack2} attacks were caused by unsafe smart contracts. To make things worse, smart contracts are immutable once deployed, so bugs cannot be easily fixed. One common type of security vulnerability involving smart contracts is arithmetic overflows. In fact, according to a recent study, such bugs account for over 96\% of CVEs assigned to Ethereum smart contracts~\cite{verismart2020}. Furthermore, because smart contracts often use integers to represent financial assets, arithmetic bugs, if exploited, can cause significant financial damage~\cite{attack3}. For this reason, smart contracts rarely \emph{directly} perform arithmetic operations (e.g., addition) but instead perform arithmetic indirectly by calling a library called {\sc SafeMath}\xspace. Since this library inserts run-time checks for over- and under-flows, this approach is effective at preventing exploitable vulnerabilities but comes with run-time overhead. Furthermore, because computation on the blockchain costs money (measured in a unit called \emph{gas}), using the {\sc SafeMath}\xspace library can significantly increase the cost of running these smart contracts. Motivated by this observation, we are interested in \emph{static} techniques that can be used to prevent integer overflows. Specifically, we propose a refinement type system for Solidity, called {\sc SolType}\xspace, that can be used to prove that arithmetic operations do not over- or under-flow. Arithmetic operations that are proven type-safe by {\sc SolType}\xspace are guaranteed to not overflow; thus, {\sc SolType}\xspace can be used to eliminate unnecessary runtime checks. While {\sc SolType}\xspace is inspired by prior work on logically qualified types~\cite{liquidtype08,liquidtype10,rsc2016}, it needs to address a key challenge that arises in Solidity programs. Because smart contracts often use non-trivial data structures (e.g., nested mappings or mappings of structs) to store information about accounts, it is important to reason about the relationship between integer values and aggregate properties of such data structures. Based on this observation, {\sc SolType}\xspace allows relational-algebra-like refinements that can be used to perform projections and aggregations over mappings. While this design choice makes {\sc Solid}\xspace expressive enough to discharge many potential overflows, it nonetheless enjoys decidable type checking. Furthermore, our implementation, called {\sc Solid}\xspace, incorporates a type inference engine based on Constrained Horn Clause (CHC) solvers \cite{chc} and can therefore automatically infer useful type annotations, including non-trivial contract invariants. \begin{comment} Refinement types hold the promise of a precise, modular and extensible analysis for both functional and imperative programs. Here, basic types are decorated with refinement predicates. Due to its extensibility and modularity, refinement types have been applied to many programming languages such as ML~\cite{liquidtype08}, C~\cite{liquidtype10}, and Typescript~\cite{rsc2016}. However, developing a refinement type system to prevent overflows in smart contracts is challenging because the value of many integer-valued variables are derived from contents of complex data structures such as maps, structs, and nested maps. Thus, we need a richer type system that can reason about values derived from data structures yet do this in a way that keeps type checking decidable. To deal with this challenge, we introduce {\sc Solid}\xspace, a new refinement type system that allows us to reason about relationships between integer values and aggregations over data structures. In particular, our system takes as input a program and a set of logical qualifiers which are simple boolean predicates over the program variables. Using off-the-shelf CHC solvers, {\sc Solid}\xspace then infers liquid types, which are dependent types where the refinement predicates are conjunctions of the logical qualifiers. We carefully design the refinement type system to permit refinement inference to ensure a decidable type checking as well as an efficient type inference using off-the-shelf CHC solvers~\cite{spacer2014}. \end{comment} We evaluate {\sc Solid}\xspace on 120 smart contracts and compare it against {\sc Verismart}\xspace~\cite{verismart2020}, a state-of-the-art verifier for checking arithmetic safety in smart contracts. Our evaluation shows that (1) {\sc Solid}\xspace can discharge \TotAsSafePct\% of unnecessary runtime overflow checks, and (2) {\sc Solid}\xspace is both faster and has a lower false positive rate compared to {\sc Verismart}\xspace. We also perform ablation studies to justify our key design choices and empirically validate that they are important for achieving good results. In summary, this paper makes the following contributions:\looseness=-1 \begin{itemize}[leftmargin=*] \item We present a new refinement type system called {\sc SolType}\xspace for proving arithmetic safety properties of smart contracts written in Solidity. Notably, our type system allows expressing relationships between integers and aggregate properties of complex data structures. \item We implement the proposed type system in a tool called {\sc Solid}\xspace, which also incorporates a type inference procedure based on Constrained Horn Clause solvers. \item We evaluate {\sc Solid}\xspace on 120 real-world smart contracts and show that it is useful for eliminating many run-time checks for arithmetic safety. We also compare {\sc Solid}\xspace against {\sc Verismart}\xspace and demonstrate its advantages in terms of false positive rate and running time. \end{itemize} \section{Language}~\label{sec:lang} \begin{figure} \centering \input{figures/syntax_lang.tex} \caption{Syntax of {\sc MiniSol}\xspace} \label{fig:syntax} \end{figure} In this section, we present the syntax of {\sc MiniSol}\xspace (Figure~\ref{fig:syntax}), an intermediate representation for modeling Solidity smart contracts. In what follows, we give a brief overview of the important features of {\sc MiniSol}\xspace relevant to the rest of the paper. \subsection{{\sc MiniSol}\xspace Syntax} In {\sc MiniSol}\xspace, a program is a contract $C$ that contains fields (referred to as \emph{state variables}), struct definitions $S$, and function declarations $f$. State variables are declared and initialized in a constructor $ctor$. Functions include a type signature, which provides a type $\type_i$ for each argument $x_i$ as well as return type $\type_r$, and a method body, which is a sequence of statements, followed by an expression. Statements in {\sc MiniSol}\xspace include let bindings, conditionals, function calls (with pass-by-value semantics), assertions, and assumptions. As {\sc MiniSol}\xspace programs are assumed to be in SSA form, we include a \emph{join point} $j$ for if statements and while loops. In particular, a join point consists of a list of $\Phi$-node variable declarations, where each $x_i$ is declared to be of type $\type_i$ and may take on the value of either $x_{i1}$ or $x_{i2}$, depending on which branch is taken. In line with this SSA assumption, we also assume variables are not redeclared. As mentioned previously, another feature of {\sc MiniSol}\xspace is that it contains fetch and commit statements for reading the values of all state variables from the blockchain and writing them to the blockchain respectively. Specifically, the construct \[ \sfetch{x_1' \sas x_1, \dots, x_n' \sas x_n} \] \emph{simultaneously} retrieves the values of state variables $x_1', \ldots, x_n'$ and writes them into local variables $x_1, \ldots, x_n$. Similarly, the commit statement \[ \scommit{e_1 \sto x_1, \dots, e_n \sto x_n} \] simultaneously stores the result of evaluating expressions $e_1, \ldots, e_n$ into state variables $x_1, \ldots, x_n$. Note that Solidity does not contain such fetch and commit constructs; however, we include them in {\sc MiniSol}\xspace to allow temporary violations of contract invariants inside procedures. Such mechanisms have also been used in prior work \cite{liquidtype10,alias-types} for similar reasons. \begin{comment} \end{comment} Expressions in {\sc MiniSol}\xspace consist of variables, unsigned integer and boolean constants, binary operations, and data structure operations. Data structures include maps and structs, and we use the same notation for accessing/updating structs and maps. In particular, $e_1[e_2]$ yields the value stored at key (resp. field) $e_1$ of map (resp. struct) $e_2$. Similarly, $e_1[e_2 \triangleleft e_3]$ denotes the new map (resp. struct) obtained by writing value $e_3$ at key (resp. field) $e_2$ of $e_1$. We may prefix the key with a dot when accessing a struct field (e.g. $e_1[.x]$) to emphasize that the accessed data structure is a struct. \subsection{Types} Similar to previous refinement type works, {\sc MiniSol}\xspace provides both \emph{base type} annotations as well as \emph{refinement type} annotations (bottom of Figure~\ref{fig:syntax}). Base types correspond to standard Solidity types, such as unsigned integers (256-bit), booleans, mappings, and structs. We shorten ``mappings" to $\mathsf{Map}$ and assume that all keys are $\tint$s, as most key types in Solidity mappings are coercible to $\tint$. Thus, $\tmapping{\btype}$ is a mapping from unsigned integers to $\btype$s. A refinement type $\rtype{T}{\phi}$ refines the base type $T$ with a logical qualifier $\phi$. In this paper, logical qualifiers belong to the quantifier-free combined theory of rationals, equality with uninterpreted functions, and arrays. Note that determining validity in this theory is decidable, and we intentionally use the theory of rationals rather than integers to keep type checking decidable in the presence of non-linear multiplication. In more detail, logical qualifiers are boolean combinations of binary relations $\oplus$ over refinement terms $t$, which include both {\sc MiniSol}\xspace expressions as well as terms containing the special constructs $\psum$, $\pfld$, and $\pflat$ (represented as uninterpreted functions) that operate over terms of type $\mathsf{Map}$. In particular, \begin{itemize}[leftmargin=*] \item $\psum(t)$ represents the sum of all values in $t$. \item Given a mapping $t$ containing structs, $\pfld_x(t)$ returns a mapping that only contains field $x$ of the struct. Thus, $\pfld$ is similar to the projection operator from relational algebra. \item Given a nested mapping $t$, $\pflat(t)$ flattens the map. In particular, given a nested mapping $\mathsf{Map}(\mathsf{Map}(t))$, $\pflat$ produces a mapping $\mathsf{Map}(t)$ where each value of the mapping corresponds to a value of one of the nested mappings from $\mathsf{Map}(\mathsf{Map}(t))$. \end{itemize} In addition to these constructs, refinement terms in {\sc MiniSol}\xspace also include a constant called $\pmaxint$, which indicates the largest integer value representable in $\tint$. \begin{example} Consider the \lstinline{usrs} mapping in Fig.~\ref{fig:erc20-example-struct}. The predicate \[ \psum(\pfld_{bal}(\pflat(usrs))) \leq \pmaxint \] expresses that if we take the \lstinline{usrs} mapping (which is of type $\tmapping{\tmapping{\emph{User}}}$) and (a) flatten the nested mapping so that it becomes a non-nested mapping of $\emph{User}$; (b) project out the \lstinline{bal} field of each struct to obtain a $\tmapping{\tint}$; and (c) take the sum of values in this final integer mapping, then the result should be at most $\mathsf{MaxInt}$. \end{example} \section{Expression Rules} Syntax and judgments: \[ \begin{array}{r c l l} \val & ::= & &\textbf{Value} \\ && n \mid \etrue \mid \efalse \mid \\ &\mid& \emapping{\btype}{\overrightarrow{n_i \mapsto \val_i}} \mid \estruct{S}{\overrightarrow{x_i \mapsto \val_i}} \\ \Ectx & ::= & & \textbf{Expression evaluation context} \\ && \cdot \mid \Ectx \binop \expr_2 \mid \val \binop \Ectx & \\ & \mid & \eind{\Ectx}{e_2} \mid \eind{\val_1}{\Ectx} \mid \eupd{\Ectx}{\expr_2}{\expr_3} \mid \eupd{\val_1}{\Ectx}{\expr_3} \mid \eupd{\val_1}{\val_2}{\Ectx} & \text{mapping index/update} \\ & \mid & \eind{\Ectx}{.x} \mid \eupd{\Ectx}{.x}{\expr} \mid \eupd{\val}{.x}{\Ectx} & \text{struct index/update} \\ \\ \multicolumn{3}{c}{\stepE{\expr}{\expr'}} & \textbf{Expression evaluation relation} \end{array} \] The expression evaluation relation $\stepE{e}{e'}$ and the expression evaluation context $\mathbb{E}$ have the standard meanings. \subsection{Expression Rules} We now present the operational semantics for expressions. First, we define $\mathsf{ZeroVal}(\btype)$, the \emph{zero value} of a base type $\btype$, similar to how it is defined in Solidity: \[ \mathsf{ZeroVal(\btype)} = \begin{cases} 0 & \text{ if } \btype = \tint \\ \efalse & \text{ if } \btype = \tbool \\ \emapping{\btype}{} & \text{ if } \btype = \tmapping{\btype} \\ \estruct{S}{\overrightarrow{x_i \mapsto \mathsf{ZeroVal}(\btype_i)}} & \text{ if } \btype = \tstruct{S} \text{ and } \forall x_i. \defns(S, x_i) = \btype_i \end{cases} \] The evaluation rules are shown below. Here we subscript binary operations with $\mathbb{N}$ to indicate an operation performed in the $\mathbb{N}$ domain instead of as a syntactic object. \begin{mathpar} \inferrule*[Right=EE-Ctx]{ \stepE{\expr}{\expr'} }{ \stepE{\Ectx(\expr)}{\Ectx(\expr')} } \\ \inferrule*[Right=EE-Plus]{ n = n_1 +_\mathbb{N} n_2 }{ \stepE{n_1 + n_2}{n} } \and \inferrule*[Right=EE-Minus]{ n_1 \geq_\mathbb{N} n_2 \\ n = n_1 -_\mathbb{N} n_2 }{ \stepE{n_1 - n_2}{n} } \\ \inferrule*[Right=EE-MapInd1]{ v_M = \emapping{\btype}{n_1 \mapsto \val_1, \dots, n_i \mapsto \val_i, \dots, n_k \mapsto \val_k} }{ \stepE{ \eind{v_m}{n_i} }{\val_i} } \\ \inferrule*[Right=EE-MapInd2]{ \not\exists i.\ n_i = n \\ }{ \stepE{ \eind{\left(\emapping{\btype}{n_1 \mapsto \val_1, \dots, n_k \mapsto \val_k}\right)}{n} }{\mathsf{ZeroVal(T)}} } \\ \inferrule*[Right=EE-MapUpd1]{ v_M = \emapping{\btype}{n_1 \mapsto \val_1, \dots, n_i \mapsto \val_i, \dots, n_k \mapsto \val_k} }{ \stepE{ \eupd{v_M}{n_i}{\val} }{ \emapping{\btype}{n_1 \mapsto \val_1, \dots, n_i \mapsto \val, \dots, n_k \mapsto \val_k} } } \\ \inferrule*[Right=EE-MapUpd2]{ v_M = \emapping{\btype}{n_1 \mapsto \val_1, \dots, n_k \mapsto \val_k} \\ \not\exists i.\ n_i = n }{ \stepE{ \eupd{v_M}{n}{\val} }{ \emapping{\btype}{n_1 \mapsto \val_1, \dots, n_k \mapsto \val_k, n \mapsto \val} } } \\ \inferrule*[Right=EE-SctInd]{ }{ \stepE{ \eind{\left(\estruct{S}{x_1 \mapsto \val_1, \dots, x_i \mapsto \val_i, \dots, x_k \mapsto \val_k}\right)}{.x_i} }{\val_i} } \\ \inferrule*[Right=EE-SctUpd]{ v_R = \estruct{S}{x_1 \mapsto \val_1, \dots, x_i \mapsto \val_i, \dots, x_k \mapsto \val_k} }{ \stepE{ \eupd{v_R}{.x_i}{\val} }{\estruct{S}{x_1 \mapsto \val_1, \dots, x_i \mapsto \val, \dots, x_k \mapsto \val_k}} } \end{mathpar} All of these rules are standard with the exception of the mapping rules. The \textsc{EE-MapInd1} rule retrieves the accessed value if it is contained in the mapping; otherwise, the \textsc{EE-MapInd2} rule returns the zero value of the value type. Similarly, \textsc{EE-MapUpd1} replaces the currently existing entry if the key exists; otherwise, the key is added to the mapping in \textsc{EE-MapUpd2}. \subsection{Template Families} We introduce new, less ambiguous notation for constructing the templates used for the \textsc{TE-MapInd} and \textsc{TE-MapUpd} rules. A \emph{template family} is a function $\Hfam$ that takes a pair $\btype, \btype_h$ and produces a set of tuples of templates of sort $\btype$ that can be synthesized using holes of type $\tmapping{\btype_h}, \btype_h$ (resp.), along with the access path $w$ used. \[ \Hfam(\btype, \btype_h) = \{(\hole_1, \hole_2, w) \mid \tjudgP{\tmapping{\btype_h}}{\hole_1}{\btype}{w} \text{ and } \tjudgP{\btype_h}{\hole_2}{\btype}{w} \} \] Observe that for any given pair of $\btype$ and $\btype_h$, $\Hfam(\btype, \btype_h)$ will be finite, so by convention we assume that there exists a unique ordering \[ \mathcal{H}(T, T_h) = \{(\hole_{11}, \hole_{12}, w_1), \dots, (\hole_{n1}, \hole_{n2}, w_n)\} \] \subsection{New Notation in TE-MapInd and TE-MapUpd Rules} Using the template family notation, we update the \textsc{TE-MapInd} and \textsc{TE-MapUpd} rules: \begin{mathpar} \inferrule*[Right=TE-MapInd]{ \tjudg{\Env;\Guards}{e_1}{\tmapping{\btype}} \and \tjudg{\Env;\Guards}{e_2}{\tint} \\ \Hfam(\tint, \btype) = \{(\hole_{i1}, \hole_{i2}, w_i), \dots, (\hole_{\ell 1}, \hole_{\ell 2}, w_\ell)\} \\ \qual_a = \bigwedge_{i=1}^\ell \hole_{i2}(\nu) \leq \hole_{i1}(e_1) }{ \tjudg{\Env;\Guards}{e_1[e_2]}{\rtype{\btype}{\nu = e_1[e_2] \land \qual_a}} } \\ \inferrule*[Right=TE-MapUpd]{ \tjudg{\Env;\Guards}{e_1}{\tmapping{\btype}} \and \tjudg{\Env;\Guards}{e_2}{\tint} \and \tjudg{\Env;\Guards}{e_3}{\btype} \\ \Hfam(\tint, \btype) = \{(\hole_{i1}, \hole_{i2}, w_i), \dots, (\hole_{\ell 1}, \hole_{\ell 2}, w_\ell)\} \\ \qual_a = \bigwedge_{i=1}^\ell \left(\hole_{i1}(\nu) = \hole_{i1}(e_1) - \hole_{i2}(e_1[e_2]) + \hole_{i2}(e_3)\right) }{ \tjudg{\Env;\Guards}{\eupd{e_1}{e_2}{e_3}}{\rtype{\tmapping{\btype}}{\nu = \eupd{e_1}{e_2}{e_3} \land \qual_a}} } \end{mathpar} \subsection{Typing Rules Omitted in the Main Text} We omitted some typing rules in the main text, notably that of the constants, so we provide them here. \begin{mathpar} \inferrule*[Right=TE-Nat]{ 0 \leq_\mathbb{N} n \leq_\mathbb{N} \pmaxint }{ \tjudg{\Env; \Guards}{n}{\rtype{\tint}{\nu = n}} } \\ \inferrule*[Right=TE-True]{ }{ \tjudg{\Env; \Guards}{\etrue}{\rtype{\tint}{\nu = \etrue}} } \and \inferrule*[Right=TE-False]{ }{ \tjudg{\Env; \Guards}{\efalse}{\rtype{\tint}{\nu = \efalse}} } \\ \inferrule*[Right=TE-StructConst]{ \text{for all $x_i$ such that } \defns(S, x_i) = \btype_i, \and \tjudg{\Env; \Guards}{\val_i}{\btype_i} \\ \val = \estruct{S}{\overrightarrow{x_i \mapsto \val_i}} }{ \tjudg{\Env; \Guards}{\val}{\rtype{\tstruct{S}}{\nu = v}} } \\ \inferrule*[Right=TE-MappingConst]{ \text{for $i = 1 \dots k$,} \and \tjudg{\Env; \Guards}{\val_i}{\btype} \\\\ \Hfam(\tint, \btype) = \{(\hole_{11}, \hole_{12}, w_1), \dots, (\hole_{\ell 1}, \hole_{\ell 2}, w_\ell)\} \\\\ \val = \emapping{\btype}{n_1 \mapsto \val_1, \dots, n_k \mapsto \val_k} \\ \phi = \bigwedge_{j=1}^\ell \hole_{j1}(\nu) = \ConstAgg(\btype, \hole_{j1}, w_j, \val) }{ \tjudg{\Env; \Guards}{\val}{ \rtype{\tmapping{\btype}}{\nu = v \land \phi} } } \end{mathpar} \begin{align*} \ConstAgg(\btype, \hole, w_j, \val) &= \begin{cases} \bot & \text{if } \hole = \holet \\ \ConstSum(w, \val) & \text{if } \hole = \psum(\hole') \text{ and } \btype = \tint \end{cases} \\ % \ConstSum(w, \val) &= \begin{cases} n & \text{if } \val = n \\ \sum_{i=1}^k \ConstSum(w, v_i) & \text{if } \val = \emapping{\btype}{\overrightarrow{n_i \mapsto \val_i}} \text{ for } i = 1 \dots k \\ \ConstSum(w', \val') & \text{if } w = xw' \text{ and } v = \estruct{S}{\dots, x \mapsto v', \dots} \end{cases} \end{align*} The \textsc{TE-True} and \textsc{TE-False} rules are standard. The \textsc{TE-StructConst} rule directly refines the type of a struct constant with its exact concrete value, since a struct can be directly encoded into SMT in our chosen theory. The \textsc{TE-Nat} rule is similar to what would be an integer typing rule in a typical type system, except that it explicitly enforces the number to be within machine bounds. Note that this only affects numbers appear in the program and does not necessarily include numbers appearing in refinements. The most interesting rule is \textsc{TE-MappingConst}. Similar to \textsc{TE-StructConst}, the type of a mapping constant is refined with its exact concrete value (since the number of values is finite), but further includes the clause $\phi$ that sets the values of the synthesized symbolic sum functions. Specifically, $\phi$ equates the symbolic value $\hole_{j1}(\nu)$ representing the aggregation to the concrete, numerical value of the aggregation computed by the $\ConstAgg$ helper function. $\ConstAgg(\btype, \hole, w, v)$ computes the concrete value of the aggregation of $v$, where the aggregated values are only those obtained by accessing the struct fields in $w$. In our presentation, we only have the sum aggregation, which is computed by the $\ConstSum$ helper function. $\ConstSum(w, v)$ computes the concrete sum of a number, mapping, or struct field in the natural number domain. \begin{example} Suppose $v_i = \estruct{S}{x_a \mapsto i, x_b \mapsto 1}$ for $i = 1, \dots, 10$. Then if $v = \emapping{\tstruct{S}}{\overrightarrow{i \mapsto v_i}}$, then \begin{align*} \ConstSum(x_a, v) &= 55 \\ \ConstSum(x_b, v) &= 10 \end{align*} \end{example} \section{Progress and Preservation for Expressions} \subsection{Some useful lemmas} \begin{lemma}[Zero values are well-typed] For every $\btype$, there exists a $\type$ such that $\tjudg{\Env;\Guards}{\mathsf{ZeroVal}(\btype)}{\type}$ and $\subty{\Env;\Guards}{\type}{\btype}$. \end{lemma} \begin{proof} By induction on $\btype$. \end{proof} \begin{lemma}[Inversion for evaluation context type] \label{lem:eval-ctx-arg-typed} If $\tjudg{\Env;\Guards}{\Ectx(\expr)}{\type}$, then there exists a $\type'$ such that $\tjudg{\Env;\Guards}{\expr}{\type'}$. \end{lemma} \begin{proof}[Proof sketch] By induction. \end{proof} \begin{lemma}[Well-typedness of swapping evaluation context argument] \label{lem:eval-ctx-swap-typed} If $\tjudg{\Env;\Guards}{\Ectx(\expr)}{\type}$ and $\tjudg{\Env;\Guards}{\expr}{\type'}$ and $\tjudg{\Env;\Guards}{\expr'}{\type'}$, then $\tjudg{\Env;\Guards}{\Ectx(\expr')}{\type}$. \end{lemma} \begin{proof}[Proof sketch] By induction. \end{proof} \subsection{Relating symbolic sum functions to their concrete counterparts} The following lemma shows that the $\ConstSum$ function is well-defined with respect to the aggregation function templates synthesized for the \textsc{TE-MapInd} and \textsc{TE-MapUpd} rules. Furthermore, it relates the symbolic value of an aggregation of mapping (i.e. some sum function) to the concrete value of the aggregation. \begin{lemma}[Correctness of template synthesis for Sum] \label{lem:sum-correctness} Suppose \begin{align} (\hole_1, \hole_2, w) &\in \Hfam(\tint, \btype) \\ \hole_1 &= \psum(\hole_1') \\ v &= \emapping{\btype}{n_1 \mapsto v_1, \dots, n_k \mapsto v_k} \\ \forall v_i, \quad &\tjudg{\Env;\Guards}{v_i}{\btype} \label{eq:sum-correctness-vtype} \end{align} and let $\phi$ be the additional clauses generated when encoding $v$ into SMT. Then $\ConstSum(w, v)$ is well-defined, and for all $v_i$, the formula \begin{equation} \phi \implies \Encode(\hole_2(v_i) = \ConstSum(w, v_i)) \end{equation} is valid. \end{lemma} \begin{example} Consider the mapping \[ \begin{array}{l} v = \emapping{\tstruct{S}}{ \\ \qquad 1 \mapsto \estruct{S}{a \mapsto \emapping{\tint}{5 \mapsto 11}}, \\ \qquad 2 \mapsto \estruct{S}{a \mapsto \emapping{\tint}{4 \mapsto 6, 10 \mapsto 3}} \\ } \end{array} \] It is only possible to sum over the nested mapping values at the $a$ field in each struct, so the templates corresponding to this mapping are \begin{align*} \hole_1 &= \psum(\pflat(\pfld_a(\holet))) \\ \hole_2 &= \psum(\holet[.a]) \\ \Hfam(\tint, \tstruct{S}) &= \{(\hole_1, \hole_2, a)\} \end{align*} Let us write $v_2$ to be the struct value at index 2 of $v$. The concrete aggregation values of $v$ and $v_2$ are given, respectively, by \begin{align*} \ConstSum(a, v) &= 11 + 6 + 3 = 20 \\ \ConstSum(a, v_2) &= 6 + 3 = 9 \end{align*} Intuitively, the value of $\psum(v_2[.a])$ should be equal to the concrete sum $\ConstSum(a, v_2)$, which is what the lemma says: \[ \hole_2(v_2) = \psum(v_2[.a]) = 9 \] This concludes the example of Lemma~\ref{lem:sum-correctness}. \end{example} \begin{proof}[Proof of Lemma~\ref{lem:sum-correctness}] By induction on $\btype$. \begin{itemize} \item Case $\btype = \tint$: By inversion of the derivation of the synthesis judgment used for $\hole_2$, we see that the derivation must have used \textsc{TH-Hole}, so \begin{align} \hole_2(v_i) &= v_i \\ w &= \epsilon \end{align} By inversion on the derivation of Eq.~\eqref{eq:sum-correctness-vtype}, we must have $v_i \in \mathbb{N}$. Thus, we have \[ \ConstSum(w, v) = \sum_{j=1}^k v_j \] The required result follows immediately. \item Case $\btype = \tmapping{\btype'}$: By definition of $\Hfam$, we have \begin{equation} \tjudgP{\tmapping{\btype'}}{\hole_2}{\tint}{w} \end{equation} By inversion on the derivation of this judgment, we see that \textsc{TH-Sum} must have been used. \begin{align} \hole_2 &= \psum(\hole_2') \\ \tjudgP{\tmapping{\btype'}&}{\hole_2'}{\tmapping{\tint}}{w} \end{align} By inversion on the derivation of Eq.~\eqref{eq:sum-correctness-vtype}, we see that \textsc{TE-MapConst} must have been used. \begin{align} v_i &= \emapping{\btype'}{n_1 \mapsto v_1', \dots, n_q \mapsto v_q'} \end{align} Note that there must exist at least one $\hole_2''$ such that $(\hole_2, \hole_2'', w) \in \Hfam(\tint, \btype')$. By applying the inductive hypothesis, we see that for every $p = 1 \dots q$, $\ConstSum(w, v_p')$ is well-defined. Thus, we have \begin{equation} \ConstSum(w, v_i) = \sum_{p=1}^q \ConstSum(w, v_p') \end{equation} So $\ConstSum(w, v)$ is well-defined as well. It follows that the following formula appears in the type of $v_i$: \begin{align} \hole_2(\nu) &= \sum_{p=1}^q \ConstSum(w, v_p') \end{align} The required result follows by transitivity of equality. \item Case $\btype = \tstruct{S}$: By inversion on the derivation of Eq.~\eqref{eq:sum-correctness-vtype}, we must have \begin{align} v_i &= \estruct{S}{\dots, x \mapsto v_i', \dots} \\ \defns(S, x) &= \btype' \\ \tjudg{\Env;\Guards&}{v_i'}{\btype'} \label{eq:prf-sum-correct-vip-ty} \end{align} By definition of $\Hfam$, we have \begin{equation} \tjudgP{\tstruct{S}}{\hole_2}{\tint}{w} \label{eq:prf-sum-correct-fld-h2} \end{equation} By inversion, the derivation of Eq.~\eqref{eq:prf-sum-correct-fld-h2}, must have used \textsc{TH-Hole} as the very first axiom, followed by an application of \textsc{TH-FldAcc}. \begin{mathpar} \inferrule*{ \inferrule*{ \inferrule*[Right=TH-FldAcc]{ \inferrule*[Left=TH-Hole]{ } { \tjudgP{\tstruct{S}}{\holet}{\tstruct{S}}{\epsilon} } \and \defns(S, x) = \btype' } { \tjudgP{\tstruct{S}}{\holet[.x]}{\btype'}{x} } }{ \tjudgP{\tstruct{S}}{\hole_2'(\holet[.x])}{\btype''}{xw''} } \\\\ \vdots }{ \tjudgP{\tstruct{S}}{\hole_2}{\tint}{xw'} } \end{mathpar} This suggests that we can synthesize a new hole $\hole_2''$ by using a derivation similar to that of $\hole_2$, where we substitute $\tstruct{S}$ with $\btype'$ and $\holet[.x]$ with $\holet$: \begin{mathpar} \inferrule*{ \inferrule*{ \inferrule*[Left=TH-Hole]{ } { \tjudgP{\btype'}{\holet}{\btype'}{\epsilon} } } { \tjudgP{\btype'}{\hole_2'(\holet)}{\btype''}{w''} } \\\\ \vdots }{ \tjudgP{\btype'}{\hole_2''}{\tint}{w'} } \end{mathpar} Now, we construct a mapping constant $v'$ as follows: \begin{equation} v' = \emapping{\btype'}{n_1 \mapsto v_1', \dots, n_k \mapsto v_k'} \end{equation} Observe that there exists some hole $\hole_2'''$ such that $(\psum(\hole_2'''), \hole_2'', w') \in \Hfam(\tint, \btype')$. Thus, the conditions required for the inductive hypothesis are satisfied, so we conclude that $\ConstSum(w', v')$ is well-defined. From the definition of $\ConstSum$, we then have \begin{align} \ConstSum(w, v_i) &= \ConstSum(w', v') \\ \ConstSum(w, v) &= \sum_{j=1}^k \ConstSum(w, v_j) \end{align} so $\ConstSum(w, v)$ is well-defined. Furthermore, note that \begin{equation} \hole_2(\holet) = \hole_2''(\holet[.x]) \end{equation} By the inductive hypothesis, $\hole_2''(v_i') = \ConstSum(w', v_i')$. But then we have $v_i[.x] = v_i'$, which implies the required result. \end{itemize} \end{proof} \subsection{Progress and Preservation} \begin{theorem}[Progress for expressions] \label{thm:progress-expr} If $\tjudg{\Env;\Guards}{\expr}{\type}$, then $\expr$ is a value or there exists an $\expr'$ such that $\stepE{\expr}{\expr'}$. \end{theorem} \begin{proof}[Proof sketch] By induction on the derivation of $\tjudg{\Env;\Guards}{\expr}{\type}$. \end{proof} \begin{theorem}[Preservation for expressions] \label{thm:pres-expr} If $\tjudg{\Env;\Guards}{\expr}{\type}$ and $\stepE{\expr}{\expr'}$, then $\tjudg{\Env;\Guards}{\expr'}{\type}$. \end{theorem} \begin{proof} By induction on the derivation of $\stepE{\expr}{\expr'}$. \begin{itemize} \item Case {\sc EE-Ctx}: Then \begin{align} \expr &= \Ectx(\expr_1) \\ \stepE{\expr_1&}{\expr_1'} \label{eq:prf-pres-ctx-step} \\ \expr' &= \Ectx(\expr_1') \end{align} By Lemma~\ref{lem:eval-ctx-arg-typed}, there exists a $\type_1$ such that \begin{equation} \tjudg{\Env;\Guards}{\expr_1}{\type_1} \label{eq:prf-pres-ctx-e1-type} \end{equation} By applying the inductive hypothesis to \eqref{eq:prf-pres-ctx-step} and \eqref{eq:prf-pres-ctx-e1-type}, \begin{equation} \tjudg{\Env;\Guards}{\expr_1'}{\type_1} \end{equation} The required result is obtained by applying Lemma~\ref{lem:eval-ctx-swap-typed}. \item Case {\sc EE-Plus}: Then \begin{align} \expr &= n_1 + n_2 \\ \expr' &= n_1 +_\mathbb{N} n_2 \\ \type &= \rtype{\tint}{\nu = n_1 + n_2} \end{align} By inversion on the derivation of $\tjudg{\Env;\Guards}{\expr}{\type}$, we see that the derivation must have used \textsc{T-Plus}: \begin{align} &\tjudg{\Env;\Guards}{n_1}{\tint} \\ &\tjudg{\Env;\Guards}{n_2}{\rtype{\tint}{\nu + n_1 \leq \pmaxint}} \end{align} Since $\expr = n_1 + n_2 \implies \expr \leq \pmaxint$ is valid and $\expr = (n_1 +_\mathbb{N} n_2)$, we can apply \textsc{TE-Nat} to obtain \begin{equation} \tjudg{\Env;\Guards}{\expr'}{\rtype{\tint}{\nu = n_1 +_\mathbb{N} n_2}} \end{equation} Applying \textsc{Sub-Base} to the above typing judgment then yields the desired result. \item Case {\sc EE-Minus}: Similar. \item Case {\sc EE-MapInd1}: Then \begin{align} \expr &= \expr_1[\expr_2] \\ \expr_1 &= \emapping{\btype}{n_1 \mapsto \val_1, \dots, n_i \mapsto \val_i, \dots, n_k \mapsto \val_k} \\ \expr_2 &= n_i \\ \expr' &= v_i \end{align} By inversion on the derivation of $\tjudg{\Env;\Guards}{\expr}{\type}$, we see that the derivation must have used \textsc{T-MapInd}: \begin{align} \type &= \rtype{\btype}{\nu = \eind{\expr_1}{\expr_2} \land \phi} \\ &\tjudg{\Env;\Guards}{\expr_1}{\tmapping{\btype}} \\ &\tjudg{\Env;\Guards}{\expr_2}{\tint} \\ \Hfam(\tint, \btype) &= \{(\hole_{11}, \hole_{12}, w_1), \dots, (\hole_{\ell 1}, \hole_{\ell 2}, w_\ell)\} \\ \phi &= \bigwedge_{j=1}^\ell \hole_{j2}(\nu) \leq \hole_{j1}(\expr_1) \end{align} By inversion on the derivation of $\tjudg{\Env;\Guards}{\expr_1}{\tmapping{\btype}}$, we see that the derivation must have used \textsc{Sub-Base} and \textsc{T-MapConst}: \begin{align} &\subty{\Env;\Guards}{\tau'}{\tmapping{\btype}} \\ &\tjudg{\Env;\Guards}{\expr_1}{\tau'} \\ \tau' &= \rtype{\tmapping{\btype}}{\nu = e_1 \land \phi'} \\ \mathsf{Encode}(\Env) \land \mathsf{Encode}(\Guards) &\land \mathsf{Encode}\left(\left(\nu = e_1 \land \phi'\right)[\subst{\nu}{\expr_1}]\right) \implies \etrue \quad\text{valid} \\ \text{for $m = 1 \dots k$,}\qquad &\tjudg{\Env; \Guards}{\val_m}{\btype} \label{eq:prf-pres-mapind-v} \\ \phi' &= \bigwedge_{j=1}^\ell \left(\hole_{j1}(\nu) = \ConstAgg(\btype, \hole_{j1}, w_j, e_1)\right) \end{align} By Lemma~\ref{lem:sum-correctness} and the definition of $\ConstSum$, we have \begin{equation} \ConstSum(w_j, e_1) \geq \ConstSum(w_j, v_i) \end{equation} Thus, the following implication is valid: \[ \hole_{j1}(\nu) = \ConstSum(w_j, e_1) \land \hole_{j2}(v_i) = \ConstSum(w_j, v_i) \implies \hole_{j1}(\nu) \geq \hole_{j2}(v_i) \] Consequently, the implication \begin{equation} \mathsf{Encode}(\Env) \land \mathsf{Encode}(\Guards) \land \etrue \implies \mathsf{Encode}(\nu = \eind{\expr_1}{n_i} \land \phi) \end{equation} is also valid, so the required result is then obtained by applying \textsc{Sub-Base} to \eqref{eq:prf-pres-mapind-v}. \item Case {\sc EE-MapInd2}: Similar. \item Case {\sc EE-MapUpd1}: Then \begin{align} \expr &= \eupd{\expr_1}{\expr_2}{\expr_3} \\ \expr_1 &= \emapping{\btype}{n_1 \mapsto \val_1, \dots, n_i \mapsto \val_i, \dots, n_k \mapsto \val_k} \\ \expr_2 &= n_i \\ \expr_3 &= \val \\ \expr' &= \emapping{\btype}{n_1 \mapsto \val_1, \dots, n_i \mapsto \val, \dots, n_k \mapsto \val_k} \end{align} By inversion on the derivation of $\tjudg{\Env;\Guards}{\expr}{\type}$, we see that the derivation must have used \textsc{T-MapUpd}: \begin{align} \type &= \rtype{\btype}{\nu = \eupd{\expr_1}{n_i}{\val} \land \phi} \\ &\tjudg{\Env;\Guards}{\expr_1}{\tmapping{\btype}} \\ &\tjudg{\Env;\Guards}{n_i}{\tint} \\ &\tjudg{\Env;\Guards}{v}{\btype} \\ \Hfam(\tint, \btype) &= \{(\hole_{11}, \hole_{12}, w_1), \dots, (\hole_{\ell 1}, \hole_{\ell 2, w_\ell})\} \\ \phi &= \bigwedge_{j=1}^\ell \hole_{j1}(\nu) = \hole_{j1}(\expr_1) - \hole_{j2}(\expr_1[n_i]) + \hole_{j2}(\val) \end{align} By inversion on the derivation of $\tjudg{\Env;\Guards}{\expr_1}{\tmapping{\btype}}$, we see that the derivation must have used \textsc{Sub-Base} and \textsc{T-MapConst}: \begin{align} &\subty{\Env;\Guards}{\tau'}{\tmapping{\btype}} \\ &\tjudg{\Env;\Guards}{\expr_1}{\tau'} \\ \tau' &= \rtype{\tmapping{\btype}}{\nu = e_1 \land \phi'} \\ \mathsf{Encode}(\Env) \land \mathsf{Encode}(\Guards) &\land \mathsf{Encode}\left(\left(\nu = e_1 \land \phi'\right)[\subst{\nu}{\expr_1}]\right) \implies \etrue \quad\text{valid} \\ \text{for $m = 1 \dots k$,}\qquad &\tjudg{\Env; \Guards}{\val_m}{\btype} \label{eq:prf-pres-mapupd-v} \\ \phi' &= \bigwedge_{j=1}^\ell \left(\hole_{j1}(\nu) = \ConstAgg(\btype, \hole_{j1}, w_j, e_1)\right) \end{align} By definition of $\ConstAgg$, the following equation holds: \begin{align} \ConstSum(w_j, e') - \ConstSum(w_j, e_1) &= \ConstSum(w_j, v) - \ConstSum(w_j, v_i) \end{align} Together, the above equation and Lemma~\ref{lem:sum-correctness} imply that the following implication is valid: \begin{equation} \begin{array}{rlr} \hole_{j1}(\nu) &= \ConstSum(w_j, e') &\land \\ \hole_{j1}(e_1) &= \ConstSum(w_j, e_1) &\land \\ \hole_{j2}(v) &= \ConstSum(w_j, v) &\land \\ \hole_{j2}(v_i) &= \ConstSum(w_j, v_i) &\\ \implies \\ \multicolumn{3}{c}{\hole_{j1}(\nu) = \hole_{j1}(e_1) - \hole_{j2}(v) + \hole_{j2}(v_i)} \end{array} \end{equation} Therefore we can construct a $\phi''$ defined as \begin{align} \phi'' &= \bigwedge_{j=1}^\ell \left(\hole_{j1}(e') = \ConstAgg(T, \hole_{j1}, w_j, e')\right) \end{align} The required result is then obtained by applying \textsc{TE-MappingConst} and \textsc{Sub-Base}. \item Case {\sc EE-MapUpd2}: Similar. \item Case {\sc EE-SctInd}: Similar to \textsc{EE-MapInd1}. \item Case {\sc EE-SctUpd}: Similar to \textsc{EE-MapUpd1}. \end{itemize} \end{proof} \section{Statement Rules} \subsection{Syntax and Judgments} \[ \begin{array}{r c l l} \Sctx & ::= & & \textbf{Statement evaluation context} \\ && \odot \mid \slet{x}{\type}{\Ectx} \mid \Sctx; s \mid \sassert \Ectx \mid \sassume \Ectx & \\ &\mid& \sif{\Ectx}{s_1}{s_2}{j} & \\ &\mid& \scommit{v_1 \sto x_1, v_2 \sto x_2, \dots, \Ectx \sto x_i, e_{i+1} \sto x_{i+1}, \dots} & \\ &\mid& \scall{x:\type}{f}{v_1, v_2, \dots, v_{i-1}, \Ectx, e_{i+1}, \dots} & \\ \\ \store & \in & Var \to Value & \textbf{State variable store} \\ \\ \defnsE & ::= & \epsilon \mid (\declFun{f}{x_1:\ \type_1, \dots, x_n:\ \type_n}{\type_r}{s}{e}), \defnsE & \textbf{Global declarations for evaluation} \\ \\ \multicolumn{3}{l}{\stepS{s}{\store}{s}{\store'}{\store_{sub}}} & \textbf{Statement evaluation relation} \\ \end{array} \] Similar to the expression evaluation context, the statement evaluation context $\Sctx$ defines the evaluation order of expressions nested in statements. The state variable store $\store$ maps each state variable to its concrete value. The statement evaluation relation $\stepS{s}{\store}{s}{\store'}{\store_{sub}}$ asserts that starting from state variable store $\store$, $s$ will step to $s'$, update the store to $\store'$, and generate new local variable bindings $\store_{sub}$ to be set in the next statement. We will assume that $\defnsE$ is fixed and implicitly defined everywhere. \subsection{Statement evaluation rules} \begin{mathpar} \inferrule*[Right=ES-Ctx]{ \stepE{\expr}{\expr'} }{ \stepS{\Sctx(\expr)}{\store}{\Sctx(\expr')}{\store}{\epsilon} } \\ \inferrule*[Right=ES-AssertTrue]{ }{ \stepS{\sassert \etrue}{\store}{\sskip}{\store}{\epsilon} } \and \inferrule*[Right=ES-AssumeTrue]{ }{ \stepS{\sassume \etrue}{\store}{\sskip}{\store}{\epsilon} } \\ \inferrule*[Right=ES-Seq1]{ \stepS{s_1}{\store}{s_1'}{\store'}{\store_{sub}} \\ \store_{sub} = \overrightarrow{x_i \mapsto v_i} }{ \stepS{s_1;s_2}{\store}{s_1';\substp{s_2}{\overrightarrow{\subst{x_i}{v_i}}}}{\store'}{\store_{sub}} } \and \inferrule*[Right=ES-Seq2]{ }{ \stepS{\sskip;s}{\store}{s_2}{\store}{\epsilon} } \\ \inferrule*[Right=ES-Let]{ }{ \stepS{\slet{x}{\type}{\val}}{\store}{\sskip}{\store}{(x \mapsto v)} } \\ \inferrule*[Right=ES-Call]{ \defnsE(f) = \declFun{f}{x_1:\ \type_1, \dots, x_n:\ \type_n}{\type_r}{s}{e} \\\\ s' = s \text{ with variable declarations alpha renamed} }{ \stepS{\scall{x: \type}{f}{v_1, \dots, v_n)}}{\store} {(\substp{s}{\subst{x_1}{v_1}, \dots, \subst{x_n}{v_n}};\slet{x}{\type}{e})}{\store}{\epsilon} } \\ \inferrule*[Right=ES-Fetch]{ \text{for $i = 1..n$,\quad} \sigma(x_i') = v_i }{ \stepS{\sfetch{x_1' \sas x_1, \dots, x_n' \sas x_n}}{\store}{\sskip}{\store}{(x_1 \mapsto v_1, \dots, x_n \mapsto v_n)} } \\ \inferrule*[Right=ES-Commit]{ \dom(\store) = \{x_1, \dots, x_n\} }{ \stepS{\scommit{v_1 \sto x_1, \dots, v_n \sto x_n}}{\store}{\sskip}{(x_1 \mapsto v_1, \dots, x_n \mapsto v_n)}{\epsilon} } \\ \inferrule*[Right=ES-IfTrue]{ j = x_1:\type_i = \phi(x_{11}, x_{12}),\dots,x_n:\type_n = \phi(x_{n1}, x_{n2}) \\ s_j = \slet{x_1}{\type_1}{x_{11}};\cdots;\slet{n_1}{\type_n}{x_{n1}} }{ \stepS{\sif{\etrue}{s_1}{s_2}{j}}{\store}{s_1;s_j}{\store}{\epsilon} } \\ \inferrule*[Right=ES-IfFalse]{ j = x_1:\type_i = \phi(x_{11}, x_{12}),\dots,x_n:\type_n = \phi(x_{n1}, x_{n2}) \\ s_j = \slet{x_1}{\type_1}{x_{12}};\cdots;\slet{n_1}{\type_n}{x_{n2}} }{ \stepS{\sif{\efalse}{s_1}{s_2}{j}}{\store}{s_2;s_j}{\store}{\epsilon} } \end{mathpar} \subsection{Store and Globals Typing} The \emph{store typing judgment} $\tjudgStore{\store}$ means that all state variables are present in $\store$ and that the state variables are well-typed with respect to "each other". That is, the refinements of the state variables may only have the other state variables as free variables. \newcommand{\tjudgGlobals}[1]{\vdash #1} The \emph{global declarations typing judgment}, which is of the form $\tjudgGlobals{\defnsE}$, means that all of the functions in the global declarations structure $\defnsE$ are well-typed. \begin{mathpar} \inferrule*[Right=T-Store]{ \store = (x_1 \mapsto v_1, \dots, x_n \mapsto v_n) \\\\ \text{for $i = 1 \dots n,$} \and \defns(x_i) = \type_i \and \tjudg{\Env;\epsilon}{v_i}{\type_i} \\\\ \Env = x_1 : \type_1, \dots, x_n : \type_n }{ \tjudgStore{\store} } \\ \inferrule*[Right=T-GloDecls]{ \defnsE = decl_1, \dots, decl_n \\\\ \text{for }i = 1 \dots n, \and decl_i = \declFun{f_i}{\overrightarrow{x_{ij}:\ \type_{ij}}}{\type_{r_i}}{s_i}{e_i} \and \vdash decl_i }{ \tjudgGlobals{\defnsE} } \end{mathpar} \section{Progress and Preservation for Statements} \subsection{Useful lemmas} \begin{lemma}[Substitution for expressions] \label{lem:subst-expr} If $\tjudg{\Env;\Guards}{\expr}{\type}$ and $\Env(x) = \type_x$ and $\tjudg{\Env;\Guards}{\expr_1}{\type_x}$, then $\tjudg{\Env;\Guards}{\substp{\expr}{\subst{x}{\expr_1}}}{\type}$. \end{lemma} \begin{proof}[Proof sketch] By induction. \end{proof} \begin{lemma}[Substitution for statements] \label{lem:subst-stmt} If $\tjudgS{\Env_1;\Guards_1}{s}{\Env_2;\Guards_2}$ and $\Env_1(x) = \type_x$ and $\tjudg{\Env;\Guards}{\expr_1}{\type_x}$, then $\tjudgS{\Env_1;\Guards_1}{\substp{s}{\subst{x}{\expr_1}}}{\Env_2;\Guards_2}$. \end{lemma} \begin{proof}[Proof sketch] By induction. \end{proof} \begin{lemma}[Inversion for statement eval context type] \label{lem:eval-sctx-arg-typed} If $\tjudgS{\Env_1;\Guards_1}{\Sctx(\expr)}{\Env_2;\Guards_2}$, then there exists a $\type$ such that $\tjudg{\Env_1;\Guards_1}{\expr}{\type}$. \end{lemma} \begin{proof}[Proof sketch] By induction. \end{proof} \begin{lemma}[Well-typedness of swapping statement eval context argument] \label{lem:eval-sctx-swap-typed} If $\tjudgS{\Env_1;\Guards_1}{\Sctx(\expr)}{\Env_1;\Guards_2}$ and $\tjudg{\Env_1;\Guards_1}{\expr}{\type}$ and $\tjudg{\Env_1;\Guards_1}{\expr'}{\type}$, then $\tjudgS{\Env_1;\Guards_1}{\Sctx(\expr')}{\Env_1;\Guards_2}$. \end{lemma} \begin{proof}[Proof sketch] By induction. \end{proof} \subsection{Progress and Preservation} To ease the notational burden, let us first assume that we use a single global declarations $\defnsE$ and that $\defnsE$ is well-typed. \begin{theorem}[Progress for statements] If $\tjudgS{\Env_1;\Guards_1}{s}{\Env_2;\Guards_2}$ and $\tjudgStore{\store}$, then $s = \sskip$, $s = \sassume \efalse$, or there exist $s', \store', \store_{sub}$ such that $\stepS{s}{\store}{s'}{\store'}{\store_{sub}}$. \end{theorem} \begin{proof}[Proof sketch] By induction on the derivation of $\tjudgS{\Env_1;\Guards_1}{s}{\Env_2;\Guards_2}$. \end{proof} \begin{theorem}[Preservation for statements] If $\tjudgS{\Env_1;\Guards_1}{s}{\Env_2;\Guards_2}$ and $\tjudgStore{\store}$ and $\stepS{s}{\store}{s'}{\store'}{\store_{sub}}$, then there exist $\Env_1', \Guards_1'$ such that $\tjudgS{\Env_1';\Guards_1'}{s'}{\Env_2;\Guards_2}$ and $\tjudgStore{\store'}$. \end{theorem} Intuitively, what this says is that if the typing judgment relates the initial and final states of the execution of $s$ but $s$ can step to another statement $s'$, then $s'$ should be well-typed under an intermediate state that can be taken to the final state by executing $s'$. \begin{proof} By induction on the derivation of $\stepS{s}{\store}{s'}{\store'}{\store_{sub}}$. \begin{itemize} \item Case {\sc ES-Ctx}: Then \begin{align} s &= \Sctx(e) \\ \stepE{e&}{e'} \label{eq:prf-spres-ctx-step} \\ \store_{sub} &= \epsilon \\ s' &= \Sctx(e') \end{align} By Lemma~\ref{lem:eval-sctx-arg-typed}, there exists a $\type$ such that \begin{equation} \tjudg{\Env_1;\Guards_1}{\expr}{\type} \label{eq:prf-spres-ctx-e-type} \end{equation} By applying Theorem~\ref{thm:pres-expr} to \eqref{eq:prf-spres-ctx-step} and \eqref{eq:prf-spres-ctx-e-type}, \begin{equation} \tjudg{\Env;\Guards}{\expr'}{\type} \end{equation} The required result is obtained by applying Lemma~\ref{lem:eval-sctx-swap-typed}. \item Cases {\sc ES-AssertTrue, ES-AssumeTrue}: Follows immediately by application of \textsc{TS-Skip}. \item Case {\sc ES-Seq1}: Then \begin{align} s &= s_1;s_2 \\ \stepS{s_1}{\store&}{s_1'}{\store'}{\store_{sub}} \\ \store_{sub} &= (x_1 \mapsto v_1, \dots, x_n \mapsto v_n) \\ s' &= s_1';s_2[\subst{x_1}{v_1}, \dots, \subst{x_n}{v_n}] \end{align} By inversion on the derivation of $\tjudgS{\Env_1;\Guards_1}{s_1;s_2}{\Env_2;\Guards_2}$, we see that the derivation must have used \textsc{TS-Seq}: \begin{align} \tjudgS{\Env_1;\Guards_1&}{s_1}{\Env_1';\Guards_1'} \label{eq:prf-spres-seq1-s1type} \\ \tjudgS{\Env_1';\Guards_1'&}{s_2}{\Env_2;\Guards_2} \end{align} By the induction hypothesis, there exist $\Env_1'', \Guards_1''$ such that \begin{align} \tjudgS{\Env_1'';\Guards_1''}{&s_1'}{\Env_1';\Guards_1'} \\ \tjudgStore{&\store'} \end{align} By case analysis on $\store_{sub}$: \begin{itemize} \item Case $\store_{sub} = \epsilon$: Then the required result is obtained by applying \textsc{TS-Seq}. \item Case $\store_{sub} \neq \epsilon$: Then a \textsc{ES-Let} or \textsc{ES-Fetch} rule must have been applied in the derivation of $\stepS{s_1}{\store}{s_1'}{\store'}{\store_{sub}}$. By inversion of Eq.\eqref{eq:prf-spres-seq1-s1type}, every $v_i = \store_{sub}(x_i)$ are exactly the $x_i$'s and $v_i$'s bound by $s_1$, so $x_i$ and $v_i$ both have type $\Env_1'(x_i)$. The required result then follows by Lemma~\ref{lem:subst-stmt}. \end{itemize} \item Case {\sc ES-Seq2}: Follows immediately by inversion of the derivation of $\tjudgS{\Env_1;\Guards_1}{s}{\Env_2;\Guards_2}$. \item Case {\sc ES-Let}: Then \begin{align} s &= \slet{x}{\type}{v} \\ s' &= \sskip \end{align} By inversion on the derivation of $\tjudgS{\Env_1;\Guards_1}{\slet{x}{\type}{v}}{\Env_2;\Guards_2}$, \begin{align} \Env_1 &= \Env \\ \Guards_1 &= \Guards_2 = \Guards \\ \Env_2 &= \Env_1[x \mapsto v] \\ x &\notin \dom(\Env) \end{align} The required result is obtained by applying \textsc{TS-Skip}: \begin{equation} \tjudgS{\Env_2;\Guards}{\sskip}{\Env_2;\Guards} \end{equation} \item Case {\sc ES-Fetch}: {\it Proof sketch}: Similar to \textsc{ES-Let}. \item Case {\sc ES-Commit}: Then \begin{align} s &= \scommit{v_1 \sto x_1, \dots, v_n \sto x_n} \\ s' &= \sskip \\ \dom(\store) &= \{x_1, \dots, x_n\} \\ \store_{sub} &= \epsilon \\ \store' &= (x_1 \mapsto v_1, \dots, x_n \mapsto v_n) \end{align} By inversion on the derivation of $\tjudgS{\Env_1;\Guards_1}{s}{\Env_2;\Guards_2}$, we see that the derivation must have used \textsc{TS-Commit}: \begin{align} \defns(x_i) &= \type_i' & \text{for $i = 1..n$} \\ \tjudg{\Env;\Guards&}{v_i}{\type_i} & \text{for $i = 1..n$} \\ \subty{\Env;\Guards&}{\type_i}{\substp{\type_i'}{\subst{x_1}{v_1}, \dots, \subst{x_i}{\nu}, \dots, \subst{x_n}{v_n}}} & \text{for $i = 1..n$} \\ \Env_1 &= \Env_2 = \Env \\ \Guards_1 &= \locked, \Guards' \label{eq:prf-spres-commit-g1} \\ \Guards_2 &= \unlocked, \Guards' \label{eq:prf-spres-commit-g2} \end{align} By applying \textsc{TS-Skip}, we obtain the first required result (out of two): \begin{equation} \tjudgS{\Env;\Guards_2}{\sskip}{\Env;\Guards_2} \end{equation} To show the other required result, \begin{equation} \tjudgStore{\store'} \end{equation} observe that the free variables of the refinements of $\type_1', \dots \type_n'$ are a subset of $\{x_1, \dots, x_n\}$. Thus, we can obtain the required result by inverting the derivation of $\tjudgStore{\store}$ and applying \textsc{T-Store}. \item Case {\sc ES-Call}: Then \begin{align} s &= \scall{x:\type}{f}{v_1, \dots, v_n} \\ \defnsE(f) &= \declFun{f}{x_1:\ \type_1, \dots, x_n:\ \type_n}{\type_r}{s_f}{e} \\ s' &= \substp{s_f}{\subst{x_1}{v_1}, \dots, \subst{x_n}{v_n}};\slet{x}{\type}{e} \\ \store' &= \store \\ \store_{sub} &= \epsilon \end{align} By inversion on the derivation of $\tjudgS{\Env_1;\Guards_1}{s}{\Env_2;\Guards_2}$, we see that the derivation must have used \textsc{TS-Call}: \begin{align} \Guards_1 &= \Guards_2 = \unlocked,\Guards' \\ \defns(f) &= ((x_1' \mapsto \type_1', \dotsi, x_n' \mapsto \type_n'), \tau_r) \\ \tjudg{\Env_1;\Guards_1&}{v_i}{\type_i} & \text{for $i = 1..n$} \\ \subty{\Env_1;\Guards&}{\type_i}{\type_i'[x_1' \mapsto e_1, \dots, x_i' \mapsto \nu, \dots, x_n' \mapsto e_n]} & \text{for $i = 1..n$} \\ \Env_2 &= x : \tau_r[x_1' \mapsto e_1, \dots, x_n' \mapsto e_n], \Env_1 \end{align} By inversion on $\tjudgGlobals{\defnsE}$, we see that $f$ is well-typed using \textsc{T-FunDecl}: \begin{align} \tjudgS{\overrightarrow{x_i:\type_i};\unlocked}{s_f}{\Env_f;\Guards_f} \\ \Guards_f = \unlocked,\Guards_f' \\ \tjudg{\Env_f;\Guards_f}{e}{\type_r'} \\ \subty{\Env_f;\Guards_f}{\type_r'}{\type_r} \end{align} Since the set of free variables of $s_f$ have an empty intersection with $\dom(\Env_1)$, it follows that $\dom(\Env_1) \cap \dom(\Env_f) = \emptyset$. Thus, we can construct an environment $\Env_1'$ which we can use to weaken the type of $s_f$, and we can add the guard predicates $\Guards'$ to the RHS of the type of $s_f$. Finally, using the notions of precondition strengthening and postcondition weakening, we can add guard predicates $\Guards'$ and drop the guard predicates $\Guards_f$ from the type of $s_f$. \begin{align} \Env_1' &= \Env_1, \Env_f \\ \tjudgS{\Env_1';\unlocked,\Guards'&}{s_f}{\Env_1';\unlocked,\Guards'} \end{align} The desired result can then be obtained by applying \textsc{TS-Seq}, \textsc{TS-Let}, and \textsc{Sub-Base}. \item Case {\sc ES-IfTrue}: {\it Proof sketch}: Invert the derivation of the type of $s$. Apply \textsc{TS-Let} multiple times to obtain $\tjudgS{\Env_{11};\Guards}{s_j}{\Env_2;\Guards}$. Apply \textsc{TS-Seq} and conclude. \item Case {\sc ES-IfFalse}: Similar. \end{itemize} \end{proof} \end{document} \section{Overview}~\label{sec:overview} In the section, we go through the high-level idea of our refinement type system using a representative example. \subsection{Verifying Overflow Safety: A Simple Example} Figure~\ref{fig:erc20-example} shows a snippet from a typical implementation of an ERC20 token. Here, the \lstinline{mint} function allows an authorized "owner" address to generate tokens, and the \lstinline{transfer} function allows users of the contract to transfer tokens between each other. User token balances are tracked in the mapping \lstinline{bals}, with the total number of issued tokens stored in \lstinline{tot}. It is crucial that the arithmetic does not overflow in either function; otherwise it would be possible for a malicious agent to arbitrarily create or destroy tokens. This contract does not contain any arithmetic overflows because it maintains the invariant that the summation over the entries in \lstinline{bals} is at most \lstinline{tot}. This invariant, together with the \lstinline{require} clauses in \lstinline{mint} and \lstinline{transfer}, ensures that there are no overflows. Such \emph{contract invariants} can be expressed as refinement type annotations in {\sc Solid}\xspace. In particular, as shown in line 4, \lstinline{bals} has the refinement type $\{ \nu \ | \ \mathrm{sum}(\nu) \leq \mathrm{tot} \}$, which is sufficient to prove the absence of overflows in this program. In the remainder of this section, we illustrate some of the features of {\sc Solid}\xspace using this example and its variants. \begin{comment} \begin{equation} \sum_i bals[i] \leq tot \label{eq:ex_sum_prop} \end{equation} across function calls, since \lstinline{tot} increases by the same amount as the sum of \lstinline{bals} in \lstinline{mint}, and the sum of \lstinline{bals} remains constant in \lstinline{transfer}. The \lstinline{require} statements on lines \ref{line:ex_mint_check} and \ref{line:ex_tran_check} are runtime overflow checks for lines \ref{line:ex_mint_add1} and \ref{line:ex_tran_sub}, respectively. To prove that the arithmetic on lines \ref{line:ex_mint_add2} and \ref{line:ex_tran_add} are overflow-safe despite not having additional runtime checks, first note that the contract maintains the invariant \begin{equation} \sum_i bals[i] \leq tot \label{eq:ex_sum_prop} \end{equation} across function calls, since \lstinline{tot} increases by the same amount as the sum of \lstinline{bals} in \lstinline{mint}, and the sum of \lstinline{bals} remains constant in \lstinline{transfer}. Overflow safety immediately follows from this invariant. o additional runtime checks are needed as long as this \textit{contract invariant} is maintained. We encode such assumptions as refinement type annotations on the state variables. For example, the annotation on line \ref{line:ex_annot} captures a weaker, quantifier-free version of \eqref{eq:ex_sum_prop} that is sufficient for proving overflow safety. \end{comment} \begin{figure} \begin{lstlisting}[language=solidity,escapechar=|] contract ExampleToken is IERC20 { address owner; uint tot; mapping(address => uint) /* { sum(v) <= tot } */ bals; |\label{line:ex_annot}| constructor(address _owner) public { owner = _owner; } function mint(uint amt) public { require(msg.sender == owner); require(tot + amt >= tot); |\label{line:ex_mint_check}| tot = tot + amt; |\label{line:ex_mint_add1}| bals[msg.sender] = bals[msg.sender] + amt; |\label{line:ex_mint_add2}| } function transfer(address recipient, uint amt) public { require(bals[msg.sender] >= amt); |\label{line:ex_tran_check}| bals[msg.sender] = bals[msg.sender] - amt; |\label{line:ex_tran_sub}| bals[recipient] = bals[recipient] + amt; |\label{line:ex_tran_add}| } /* ... other functions ... */ } \end{lstlisting} \caption{Excerpt from a typical ERC20 token.} \label{fig:erc20-example} \end{figure} \subsection{Intermediate Representation} Due to imperative features like loops and mutation, Solidity is not directly amenable to refinement type checking. Thus, similar to prior work~\cite{liquidtype10, rsc2016}, we first translate the contract to a intermediate representation (IR) in SSA form that we call MiniSol. Our IR has the following salient features: \begin{itemize}[leftmargin=*] \item Integer variables are assigned exactly once (i.e., SSA form) \item Mappings, structs, and arrays are converted into immutable data structures, \item A \textit{fetch} statement is used to load the values of the storage variables at function entry, and a \textit{commit} statement is used to store the values of the storage variables at function exit. \end{itemize} The resulting IR of the example contract is shown in Fig~\ref{fig:erc20-example-ir}, which we will use for the examples in this section. {Our tool automatically converts Solidity programs to this IR in a pre-processing step and automatically inserts \emph{fetch}/\emph{commit} statements at the necessary places. Similar to the \emph{fold}/\emph{unfold} operations from prior work~\cite{liquidtype10}, the use of these \emph{fetch}/\emph{commit} statements in the MiniSol IR allows temporary invariant violations.} \begin{figure} \begin{lstlisting}[language=minisol,escapechar=|] contract ExampleToken { owner : addr; bals : map(addr => uint) /* { sum(v) <= tot } */; tot : uint; constructor(_owner : addr) public { let owner0 : addr = _owner; let bals0 : map(addr => uint) = zero_map[addr, uint]; let tot0 : uint = 0; commit owner0, bals0, tot0; } fun mint(amt : uint) { fetch owner1, bals1, tot1; require(msg.sender == owner1); require(tot1 + amt >= tot1); |\label{line:mint_tot_check}| let tot2 : uint = tot1 + amt; |\label{line:mint_tot_add}| let bals2 : map(addr => uint) = bals1[msg.sender |$\triangleleft$| bals1[msg.sender] + amt]; |\label{line:mint_bals_add}| commit owner1, bals2, tot2; } fun transfer(recipient : address, amt : uint) { fetch owner3, bals3, tot3; require(bals3[msg.sender] >= amt); |\label{line:trans_req}| let bals4 : map(addr => uint) = bals3[msg.sender |$\triangleleft$| bals3[msg.sender] - amt]; |\label{line:trans_sub}| let bals5 : map(addr => uint) = bals4[recipient |$\triangleleft$| bals4[recipient] + amt]; |\label{line:trans_add}| commit owner3, bals5, tot3; } } \end{lstlisting} \caption{Purely functional IR of the example token (with some irrelevant details omitted)} \label{fig:erc20-example-ir} \end{figure} \subsection{Discharging Overflow Safety on Local Variables} We now demonstrate how our refinement type system can be used to verify arithmetic safety in this example. Consider the \lstinline{mint} function in Fig~\ref{fig:erc20-example-ir}. The require statement on line~\ref{line:mint_tot_check} is a runtime overflow check for \lstinline{tot1 + amt}. If the runtime check fails, then the contract will abort the current transactions, meaning that it discards any changes to state variables. Since {\sc Solid}\xspace keeps track of this run-time check as a \textit{guard predicate}, it is able to prove the safety of the addition on line~\ref{line:mint_tot_add}. Next, we explain how {\sc Solid}\xspace proves the safety of the addition on line~\ref{line:mint_bals_add}. For now, let us assume that the refinement type annotation for \lstinline{bals} is indeed valid, i.e., \lstinline{bals1} has the following refinement type (we omit base type annotations for easier readability): \begin{equation} bals1 : \rtypei{\nu \ | \ \psum(\nu) \leq tot1} \label{eq:ex_bals1_type} \end{equation} Since \lstinline{bals1} contains only unsigned integers, we refine \lstinline{bals1[msg.sender]} with the type: $$bals1[msg.sender] : \rtypei{\nu \ | \ \nu \leq \psum(bals1)}$$ From transitivity of $\leq$, this implies that $bals1[msg.sender] \leq tot1$. Finally, using the guard predicate $tot1+amt \geq tot1$, {\sc Solid}\xspace is able to prove: $$bals1[msg.sender] + amt \leq \pmaxint$$ which implies that the addition does not overflow. In a similar manner, {\sc Solid}\xspace can also prove the safety of the operations in \lstinline{transfer} using the refinement type of state variable \lstinline{bals} and the \lstinline{require} statement at line 25. \subsection{Type checking the contract invariant} \label{sec:overview_cinv_ex} In the previous subsection, we showed that contract invariants (expressed as refinement type annotations on state variables) are useful for discharging overflows. However, {\sc Solid}\xspace needs to establish that these type annotations are valid, meaning that contract invariants are preserved at the end of functions. For instance, at the end of the \lstinline{mint} function, the type checker needs to establish that \lstinline{bals2} has the following refinement type: \begin{equation} bals2 : \rtypei{\nu \ | \ \psum(\nu) \leq tot2} \label{eq:ex_check_inv} \end{equation} To establish this, we proceed as follows: First, from line \ref{line:mint_bals_add}, {\sc Solid}\xspace infers the type of \lstinline{bals2} to be: \begin{equation} \begin{split} bals2 : \rtypei{\nu \ | \psum(\nu) = \psum(bals1) + amt) } \end{split} \label{eq:ex_bals2_type} \end{equation} Then, since \lstinline{tot2} has the refinement type $\{ v \ | \ tot1 + amt \}$ and \lstinline{bals1} has the refinement type $\{ v \ | \ \psum(\nu) \leq tot1 \}$, we can show that $\psum(bals2) \leq tot2$. This establishes the desired contract invariant (i.e., Eq.\ref{eq:ex_check_inv}). Using similar reasoning, {\sc Solid}\xspace can also type check that the contract invariant is preserved in \lstinline{transfer}. \subsection{Contract invariant inference} Although the type annotation is given explicitly in this example, {\sc Solid}\xspace can actually prove the absence of overflows without \textit{any} annotations by performing type inference. To do so, {\sc Solid}\xspace first introduces a ternary uninterpreted predicate $I$ (i.e., unknown contract invariant) for each state variable (\lstinline{owner, bals, tot}) that relates its value $\nu$ to the other two state variables. This corresponds to the following type "annotations" for the state variables: \begin{align*} owner &: \rtypei{\nu \ | \ I_1(\nu, tot, bals)} \\ tot &: \rtypei{\nu \ | \ I_2(owner, \nu, bals)} \\ bals &: \rtypei{\nu \ | \ I_3(owner, tot, \nu)} \end{align*} Given these type annotations over the unknown predicates $I_1$-$I_3$, {\sc Solid}\xspace generates constraints on $I_1$-$I_3$ during type inference and leverages a CHC solver to find an instantiation of each $I_i$. However, one complication is that we cannot feed all of these constraints to a CHC solver because the generated constraints may be unsatisfiable. In particular, consider the scenario where the program contains a hundred arithmetic operations, only one of which is unsafe. If we feed all constraints generated during type checking to the CHC solver, it will correctly determine that there is no instantiation of the invariants that will allow us to prove the safety of \emph{all} arithmetic operations. However, we would still like to infer a type annotation that will allow us to discharge the remaining 99 arithmetic operations. To deal with this difficulty, {\sc Solid}\xspace tries to solve the CHC variant of the well-known MaxSAT problem. That is, in the case where the generated Horn clauses are unsatisfiable, we would like to find an instantiation of the unknown predicates so that the maximum number of constraints are satisfied. {\sc Solid}\xspace solves this "MaxCHC"-like problem by generating one overflow checking constraint at a time and iteratively strengthening the inferred contract invariant. For instance, for our running example, {\sc Solid}\xspace can automatically infer the desired contract invariant $I_3$, namely \lstinline{sum(bals) <= tot} ($I_1$ and $I_2$ are simply $\etrue$). \begin{comment} The generated verification conditions then have the form of constrained horn clauses (CHC) [cite CHC solvers for program verification], which can be solved using an off-the-shelf CHC solver to find an appropriate $I$ that can discharge the verification conditions. We can further extend the inference problem into an optimization problem: assuming that all operations are checked for overflow at runtime, we want to find a contract invariant that can be used to maximize the number of operations whose runtime checks can be proven to be redundant. A direct application of a CHC solver is insufficient for solving the optimization problem, since any one improperly guarded arithmetic operation may cause the solver to fail to find a useful solution. For example, suppose we remove the require statement on line \ref{line:ex_tran_check} of Fig~\ref{fig:erc20-example-ir}. In the original verification setting, if the subtraction on line~\ref{line:ex_tran_sub} overflows, then the contract invariant we determined earlier would not hold at the end of \lstinline{transfer}. Consequently, we would no longer be able to prove the safety of the addition in \lstinline{mint} on line~\ref{line:ex_mint_add2}. In the optimization setting, we would instead mark the overflow check on line~\ref{line:ex_tran_check} as a ``necessary" check (i.e. an error in the verification setting), in which case we \emph{would} be able to prove that the invariant is maintained at the end of \lstinline{transfer}. Thus, we would be able to mark the overflow check on line~\ref{line:ex_mint_add2} as ``redundant" (i.e. overflow-safe in the verification setting). In Section~\ref{sec:infer}, we present a procedure for solving this optimization problem. \end{comment} \subsection{Refinements for Aggregations Over Nested Data Structures} \label{sec:overview_sum_data_structure} A unique aspect of our type system is its ability to express more complex relationships between integer values and data structures like nested mappings over structs. To illustrate this aspect of the type system, consider Fig~\ref{fig:erc20-example-struct}, which is a modified version of Fig~\ref{fig:erc20-example} that stores balance values inside a \lstinline{User} struct in a nested mapping. The addition on line~\ref{line:struct_ex_add} cannot overflow because the contract maintains the invariant that the summation over the \lstinline{bal} fields of all the nested \lstinline{User} entries in \lstinline{usrs} is at most \lstinline{tot}. {\sc Solid}\xspace is able to infer that the type of $usrs$ is \[ \rtypei{\nu \mid \psum(\pfld_{bal}(\pflat(\nu))) \leq tot} \] {In particular, this refinement type captures the contract invariant that the sum of all user balances nested inside the struct of \lstinline{usrs} is bounded by \lstinline{tot}. Using such a refinement type, we can prove the safety of the addition on line~\ref{line:struct_ex_add}. Note that the use of operators like $\mathsf{Flatten}$ and $\mathsf{Fld}_\emph{bal}$ is vital for successfully discharging the potential overflow in this example.} \begin{figure} \begin{lstlisting}[language=minisol, escapechar=|] contract ExampleTokenWithStruct { struct User { uint bal; /* ... other fields ... */ } /* ... other state variables ... */ mapping(address => mapping(uint => User)) usrs; function mint(uint amt, uint accno) public { require(msg.sender == owner); require(tot + amt >= tot); tot += amt; usrs[msg.sender][accno].bal += amt; |\label{line:struct_ex_add}| } /* ... other functions ... */ } \end{lstlisting} \caption{The Solidity source code of the running example (Fig.~\ref{fig:erc20-example}) modified to use nested data structures.} \label{fig:erc20-example-struct} \end{figure} \section{Related Work} Smart contract correctness has received significant attention from the programming languages, formal methods, and security communities in recent years. In this section, we discuss prior work on refinement type systems and smart contract security. \paragraph{Refinement types} Our type system is largely inspired by and shares similarities with prior work on liquid types~\cite{liquidtype08,liquidtype10,liquidhaskell14,rsc2016}. For instance, our handling of temporary contract violations via fetch/commit statements is similar to a simplified version of the \texttt{fold} and \texttt{unfold} operators used in \cite{liquidtype10}. However, a key novelty of our type system is its ability to express and reason about relationships between relationships between integer variables and aggregate properties of complex data structures (e.g., nested maps over struct) that are quite common in smart contracts. Also, similar to the liquid type work, our system also performs type inference; however, a key novelty in this regard is the use of soft constraints to handle programs where not all arithmetic operations can be proven safe. \paragraph{Smart contract verification} Many popular security analysis tools for smart contracts are based on symbolic execution~\cite{symbolic-e}. Well-known tools include Oyente~\cite{oyente}, Mythril~\cite{mythril} and Manticore~\cite{manticore}, and they look for an execution path that violates a given property or assertion. In contrast to these tools, our proposed approach is based on a refinement type system and offers stronger guarantees compared to bug finding tools for smart contracts. To bypass the scalability issues associated with symbolic execution, researchers have also investigated sound and scalable static analyzers~\cite{ecf,securify,madmax,zeus}. Both Securify~\cite{securify} and Madmax~\cite{madmax} are based on abstract interpretation~\cite{CousotC77}, which does not suffer from the path explosion problem. ZEUS~\cite{zeus} translates Solidity code into the LLVM IR and uses an off-the-shelf verifier to check the specified policy~\cite{smack}. The ECF~\cite{ecf} system is designed to specifically detect the DAO vulnerability. In contrast to these techniques, the focus of our work is on proving arithmetic safety which is a prominent source of security vulnerabilities. Similar to {\sc Solid}\xspace, {\sc Verismart}\xspace~\cite{verismart2020} is also (largely) tailored towards arithmetic properties of smart contracts. In particular, {\sc Verismart}\xspace leverages a CEGIS-style algorithm for inferring contract invariants. As we show in our experimental evaluation, {\sc Solid}\xspace outperforms {\sc Verismart}\xspace in terms of false positive rate as well as running time. Some systems~\cite{Hirai17,GrishchenkoMS18,kframework,verx2019} for reasoning about smart contracts rely on formal verification. These systems typically prove security properties of smart contracts using existing interactive theorem provers~\cite{coq}, or leverage temporal verification for checking functional correctness~\cite{verx2019}. They typically offer strong guarantees that are crucial to smart contracts. However, unlike our system, all of them require significant manual effort to encode the security properties and the semantics of smart contracts. Furthermore, \textsc{Solythesis}~\cite{solythesis} inserts runtime checks into smart contract source code to revert transactions that violate contract invariants. We note that this approach is complementary to static verifier such as {\sc Solid}\xspace. \paragraph{Verifying overflow/underflow safety} The problem of checking integer overflow/underflow in software systems is a well-studied problem in the verification community. In particular, Astree~\cite{astree} and Sparrow~\cite{sparrow} are both based on abstract interpretation~\cite{CousotC77} and are tailored towards safety-critical code such as avionics software. As we argue throughout the paper, verifying arithmetic safety of smart contracts requires reasoning about aggregate properties over mappings; hence, standard numeric abstract domains such as the ones used in Astree would not be sufficient for discharging over- and under-flows in Solidity programs. \paragraph{CHC Solving} We are not the first to use CHC solvers in the context of refinement type checking. For example, Liquid Haskell \cite{vazou2014refinement} uses a predicate-abstraction based horn clause solver for refinement type inference. However, in contrast to our work, Liquid Haskell does not tackle the problem of MaxCHC type inference, which is critical for discharging the maximum number of runtime overflow checks in smart contracts. To the best of our knowledge, the only prior work that can potentially address our MaxCHC problem is in the context of network repair. In particular, \cite{hojjat2016optimizing} formulate the problem of repairing buggy SDN configurations as an optimization problem over constrained Horn clauses. They generalize their proposed method to Horn clause optimization over different types of lattices, and our type inference algorithm may be viewed as an instantiation of their more general framework. However, in contrast to their approach, our algorithm leverages domain-specific observations for efficient (but potentially suboptimal) type inference in the context of smart contracts. In particular, we use the fact that all soft constraints correspond to overflow checks that are guaranteed to be satisfied (either because they are safe or we insert a runtime check) to check each soft constraint independently.
\section{Introduction} The \textit{Gaia} mission \citep{2016A&A...595A...1G} has revealed the largest number of white dwarfs (WDs) ever observed in our galaxy. Before \textit{Gaia}, less than 40,000 confirmed white dwarfs were known, mostly from the spectroscopic Sloan Digital Sky Survey \citep{2000AJ....120.1579Y,2006ApJS..167...40E}. This sample was largely incomplete and concentrated in the northern hemisphere. Thanks to \textit{Gaia}'s precise parallaxes and photometric measurements, \citet{2019MNRAS.482.4570G} were able to identify $\sim$260,000 high-confidence white dwarf candidates simply from their position in the HR diagram. The latest data release of \textit{Gaia}, \textit{Gaia} EDR3 \citep{2021A&A...649A...1G}, provided 20 to 30 percent better parallax measurements on average, as well as twice as accurate proper motions and a better measurements of colour, especially for the bluest objects. These improvements allowed \citet{GentileFusillo2021} to update the catalogue, which now includes $\sim$359,000 high-confidence white dwarfs. The wealth of new data provided by \textit{Gaia} DR2 has challenged our understanding of white dwarf cooling, a process that was thought to be well understood. The \textit{Gaia} DR2 colour-magnitude diagram unveiled the presence of the Q branch, a transversal sequence of white dwarfs with mass above $\sim 1~M_\odot$ that was not aligned with theoretical cooling sequences \citep{2018A&A...616A..10G}, which \citet{Tremblay2019} identified as observational evidence of a white dwarf cooling delay due to core crystallization. While a pile-up of white dwarfs in the region of the Q branch is expected in standard crystallization models due to the cooling delay resulting from the release of latent heat in the phase transition from a liquid to solid state \citep{Tremblay2019}, \citet{Cheng2019} presented evidence of an additional anomolous cooling delay on the Q branch in \textit{Gaia} DR2 data experienced by massive ($1.08 - 1.23 M_{\odot}$) WDs that could not be explained by conventional models of core crystallization. This has resulted in much research into the details of WD crystallization, particularly $^{22}$Ne sedimentation, in an attempt to explain this cooling anomaly \citep{Bauer2020,Caplan2020,Blouin2020,Blouin2021,Camisassa2021}. Another significant finding arising from \textit{Gaia} DR2 data was the discovery of a star formation burst in the galactic disc 2-3 Gyr ago based on observations of main sequence stars \citep{Mor2019}. In addition to presenting evidence of such an event, \citet{Mor2019} mathematically characterized the time dependent star formation rate (SFR), modelling it as a bounded exponential function plus a Gaussian component that accounts for the star formation burst. \citet{Isern2019} noted the significance of this star formation history for the white dwarf luminosity function, reconstructing the SFR for 0.9 - 1.1 $M_\odot$ \textit{Gaia} DR2 white dwarfs within 100 pc of the Sun, using the luminosity function of \citet{Tremblay2019} and the BaSTI cooling models for DA white dwarfs and qualitatively comparing this to the SFR of \citet{Mor2019}. The catalogue of \textit{Gaia} EDR3 WDs recently produced by \citet{GentileFusillo2021} provides us with a powerful tool to re-investigate the cooling of massive white dwarfs in the solar neighbourhood with improved statistical power. In this paper, we determine the distribution of cooling ages for massive high-probability white dwarf candidates recently identified by the \citet{GentileFusillo2021} catalogue that are within 200~pc of the Sun. Using the publicly available \texttt{WD\_models} code \citep{sihaocheng}, we use different sets of white dwarf models, including both the carbon/oxygen (C/O) core cooling models of \citet{Bedard2020} and the oxygen/neon (O/Ne) core cooling models of \citet{Camisassa2019}, to determine the masses and cooling ages of each white dwarf candidate from the \textit{Gaia} EDR3 photometric observations. For each set of models, we construct the distribution of cooling ages for objects with mass in the range $0.95-1.25~M_\odot$ and binned into subdivisions by mass within this range. We quantitatively asses the statistical significance of the similarity of the cooling rate distribution of massive \textit{Gaia} EDR3 white dwarfs to the star formation rate of main sequence stars, as characterized by \citet{Mor2019}. We also illustrate how the presence of a significant fraction of mergers among the most massive WDs, with single progenitors created at the \citet{Mor2019} rate of star formation, can explain the nearly uniform distribution that we find for their cooling ages. \section{Methods} \subsection{Models} Throughout this work, we compare multiple sets of white dwarf cooling models to \textit{Gaia} EDR3 white dwarf data. For our analysis, we use the publicly available \texttt{WD\_models} package provided by \citet{sihaocheng}\footnote{The \texttt{WD\_models} package is publicly available at \url{https://github.com/SihaoCheng/WD_models}}. We consider the cooling models of the Montreal group \citep{Bedard2020} and the La Plata group \citep{Camisassa2019,Camisassa2017,Renedo2010}. For each set of cooling models, we consider both H-atmosphere and He-atmosphere models. We use the evolutionary models in conjunction with the publicly available Montreal group synthetic colours\footnote{The Montreal group synthetic colours are publicly available at \url{http://www.astro.umontreal.ca/~bergeron/CoolingModels}.} for pure H and pure He atmosphere models with \textit{Gaia} EDR3 band-pass filters to determine the masses and cooling ages of each white dwarf candidate from the \textit{Gaia} EDR3 photometric observations. For the Montreal group models \citep{Bedard2020}, we consider three cases of atmosphere composition: thick H envelope evolution models with a pure H atmosphere model (``thick H envelope models''), thin H envelope evolution models with a pure H atmosphere model (``thin H envelope models''), and thin H envelope evolution models with a pure He atmosphere model (``He envelope models''). In all of these cases, the Montreal models have a C/O core. We collectively refer to the set of thick H envelope models plus He envelope models as the ``thick Montreal'' models, and analogously refer to the set of thin H envelope models plus He envelope models as the ``thin Montreal'' models. For the La Plata group set of models, we combine the higher mass O/Ne core models of \citet{Camisassa2019} with the lower mass C/O core models of \citet{Renedo2010} and \citet{Camisassa2017}. While the \citet{Camisassa2019} models are available for both DA and DB WDs, the \citet{Renedo2010} models are only available for DA WDs and the \citet{Camisassa2017} are only available for DB WDs. Thus for the La Plata group H-atmosphere models, we used the DA WD models of \citet{Camisassa2019} for masses $\geq 1.1 \ M_{\odot}$ and the models of \citet{Renedo2010} with metallicity $Z = 0.01$ for masses $\leq 0.93 M_{\odot}$, linearly interpolating between these models for masses between 0.93 and 1.1 $M_{\odot}$. To make the full set of He-atmosphere La Plata group models, we used the DB WD models of \citet{Camisassa2019} for masses $\geq 1.1 \ M_{\odot}$ and the models of \citet{Camisassa2017} for masses $\leq 1 \ M_{\odot}$. We collectively refer to all of these models as the ``La Plata'' models. \subsection{Data} We used the main catalogue of \citet{GentileFusillo2021}, which consists of \textit{Gaia} EDR3 white dwarfs with reliable parallax measurements. From this catalogue, we selected sources within a distance of 200 pc and for which the probability of being a white dwarf exceeded 90\%, as determined by the \texttt{Pwd} parameter of the catalogue (see \citet{GentileFusillo2021} for details concerning how this probability was determined). For each source in the catalgoue, \citet{GentileFusillo2021} provide the three parameters \texttt{chisq\_H}, \texttt{chisq\_He}, and \texttt{chisq\_mixed}, indicating the goodness-of-fit of models with different atmosphere compositions: pure H, pure He, and mixed H/He atmospheres, respectively. In our work, we classified each WD as having an atmosphere composition corresponding to the atmosphere model with the smallest (non-empty) chi-squared value. WDs for which all three chi-squared parameters were empty were classified as having an ``unknown'' atmosphere. For a given set of models, this classification was used to determine whether the H-atmosphere or He-atmosphere models were used to determine the mass and cooling age of each source from the observed photometry. He-atmosphere models were used for both the pure He and mixed H/He atmosphere WDs. Following the recommendations of \citet{GentileFusillo2021}, we used H-atmosphere models for WDs with unknown atmosphere composition. \Cref{fig:wd_cmd} depicts our observational sample of white dwarfs identified by \citet{GentileFusillo2021} within 200~pc. Superimposed on the diagram are contours of constant mass and cooling age calculated using the thin H envelope models of \citet{Bedard2020}. The other models considered in our work show similar trends. Furthermore, the thresholds and completion of core crystallisation for carbon/oxygen and oxygen/neon white dwarfs as identified by \citet{Bauer2020} are shown by solid and dashed black lines. These contours are similar to those identified by \citet{Tremblay2019} for carbon/oxygen white dwarfs and to those by \citet{Camisassa2019} for oxygen/neon white dwarfs. For the masses that we consider, the crystallisation occurs between the absolute G-band magnitude of 12 and 14. The magnitude and colour have been de-reddened using the mean $A_V$ values given in the catalogue and the prescription given by \citet{GentileFusillo2021} to convert this extinction in the Johnson V band to extinctions in \textit{Gaia} bands. To illustrate the shift in the CMD caused by reddening, we show the \textit{Gaia} extinction vector for a colour excess of $E(B-V)=0.1$ (the median extinction for stars within 200~pc from the \textit{Gaia} EDR3) as a red arrow in the lower panel of \cref{fig:wd_cmd}. De-reddening undoes the effect illustrated by this arrow, shifting the WDs back in the opposite direction. As the extinction vector is approximately parallel to the phase transition lines for the range of white dwarf masses that we will consider, the location of a white dwarf relative to the phase transition lines is approximately independent of extinction. While reddening will make a white dwarf appear slightly less massive by a few hundredths of a solar mass for $E(B-V)=0.1$, since we will be studying white dwarfs binned into samples one tenth of a solar mass wide, our conclusion should not be very sensitive to the exact treatment of reddening. \begin{figure} \includegraphics[width=\columnwidth]{figures/cmd_B20_thinH.png} \caption{Upper: The \textit{Gaia} colour-magnitude diagram of white dwarf candidates within 200~pc from \citet{GentileFusillo2021}. Lower: Focus on the high-mass white dwarfs. The effect of interstellar extinction with $E(B-V)=0.1$ is indicated by the red arrow. Superimposed on the observations are contours of equal mass, from 0.95 to 1.25 solar masses (right to left), and contours of equal cooling age, from 0.5 to 2.5~Gyr (top to bottom), according to the thin H atmosphere white dwarf cooling models of \citet{Bedard2020}. The four black lines show significant points in core crystallization, as identified by \citet{Bauer2020}. The dashed black lines indicate the region of O/Ne crystallisation, showing the points at which 20\% (top) and 80\% (bottom) of the O/Ne core is frozen. Analogously, the solid black lines show the points at which 20\% (top) and 80\% (bottom) of the C/O core is frozen.} \label{fig:wd_cmd} \end{figure} A key concern in determining the distribution of white dwarf cooling ages is to determine the volume sampled as a function of the luminosity of the white dwarf \citep{2021arXiv210607653R}. Although we could estimate this using the magnitude limits of the \citet{GentileFusillo2021} catalogue, we would still not have a reliable estimate of the completeness rate at the faint end of the catalogue; consequently, we will study the completeness of the catalogue as a function of absolute G-band magnitude and distance using a variant of the \citet{1968ApJ...151..393S} estimator. If the population that we are sampling is uniform surrounding the Sun (which is a good approximation within 200~pc), the number of white dwarfs that we detect should increase linearly with the volume sampled. \Cref{fig:wd_complete} depicts the cumulative number of white dwarfs detected as a function of the volume sampled (normalised by the total volume $V_\textrm{max}$, which is the volume of a sphere with a 200 pc radius). White dwarfs with absolute magnitudes of 14 and brighter are detected with high completeness all the way out to 200~pc. For inherently fainter white dwarfs, the samples become incomplete closer to the Sun. The incompleteness manifests itself as the downward curvature of the cumulative distribution from the linear relation. We choose the limiting volume to be where this curvature develops. In particular we choose the limiting volume to be where the slope of the cumulative distribution deviates by more than five percent relative to its value for small volumes. Consequently, within these limiting volumes, the samples are nearly complete. We only perform this adjustment for samples that we estimate to be less than 85\% complete within 200~pc, that is, for $M_G\geq 15$. The three leftmost vertical lines from left to right show the limiting volume that we choose for $M_G=17, 16$ and $15$. For $M_G \leq 14$, we do not reduce the volume relative to the total volume of the 200~pc sample, and we illustrate this choice as a limiting volume equal to $V_\textrm{max}$ shown by the rightmost vertical line in \cref{fig:wd_complete}. We restrict our sample to objects within their magnitude dependent completeness-limiting volume, $V_\mathrm{lim}(M_G)$. The reduced sampling volume of the faint white dwarfs is then corrected by assigning a weight of $V_{\mathrm{max}} \ / \ V_{\mathrm{lim}}(M_G)$ to objects for which $V_{\mathrm{lim}}(M_G) < V_{\mathrm{max}}$ and a weight of 1 to objects for which $V_{\mathrm{lim}}(M_G) \geq V_{\mathrm{max}}$. \begin{figure} \centering \includegraphics[width=\columnwidth]{figures/edr3_wd_complete.png} \caption{Completeness limits of white dwarf samples as a function of absolute magnitude. The vertical dashed lines indicate the volume limits of the complete samples that we consider as a function of absolute magnitude.} \label{fig:wd_complete} \end{figure} \section{Results} \begin{figure*} \centering \includegraphics[width=\textwidth]{figures/2dhist_subplots_all.png} \caption{Joint distribution of mass and cooling age for massive \textit{Gaia} EDR3 WDs according to different sets of models, weighted to correct for reduced sampling volume. For each subplot, the set of models used to calculate the cooling ages and masses from \textit{Gaia} EDR3 photometry is indicated at the top of the subplot. From left to right, these are the thick Montreal models, the thin Montreal models, and the La Plata models (see main text for details). The fill colour of each bin indicates the corrected count found in that bin, with corresponding value given by the colour bar and white denoting that no objects were found in that bin. The red lines indicate the C/O (solid) and O/Ne (dashed) freezing lines of \citet{Bauer2020}, shown only for reference. From bottom to top, these lines indicate 20\% O/Ne frozen, 20\% C/O frozen, 80\% O/Ne frozen, and 80\% C/O frozen. The vertical dotted lines indicate the edges of the mass bins considered in \cref{fig:cumdists_mbins}.} \label{fig:2dhist} \end{figure*} In \cref{fig:2dhist} we show the joint distribution of masses and cooling ages of \textit{Gaia} EDR3 WDs according to different sets of models. To generate these distributions, the WDs were weighted to correct for the reduced sampling volume required to make the sample complete. For each set of models, the mass and cooling age of each object in our reduced sample was determined by linearly interpolating the models, using either the H-atmosphere or He-atmosphere models depending on the atmosphere classification of the source (as determined by the \texttt{chisq\_H}, \texttt{chisq\_He}, and \texttt{chisq\_mixed} parameters of the \citet{GentileFusillo2021} catalogue). Later in this work we sort the WDs into three mass bins of width 0.1 $M_\odot$, centered on the values 1.0, 1.1, and 1.2 $M_\odot$ (see \cref{fig:cumdists_mbins}, \cref{tab:KS_results_massbins}, and related discussion). The edges of these mass bins are indicated in \cref{fig:2dhist} by light grey dotted vertical lines. For illustrative purposes and to help orient the reader, we also show the core crystallization lines of \citet{Bauer2020} as red lines in \cref{fig:2dhist}. The solid lines indicate C/O crystallization thresholds of 20\% (bottom, solid) and 80\% (top, solid) frozen, while the dashed lines similarly indicate O/Ne crystallization thresholds of 20\% (bottom, dashed) and 80\% (top, dashed) frozen. \citet{Bauer2020} calculated these crystallization thresholds using models with pure He atmospheres and \textit{Gaia} DR2 filters. For consistency with the \citet{Bauer2020} models used to calculate these threshold, we used He-atmosphere models to convert those (\textit{Gaia} DR2) colour-magnitude crystallization thresholds to curves in mass and cooling age. The models used for this conversion consisted of the He-envelope evolution models of each of the three sets of models considered in this work along with the synthetic colours for \textit{Gaia} DR2 filters, rather than those for the EDR3 filters used to determine the masses and cooling ages of objects in our observational sample. By comparison with the crystallization lines in \cref{fig:wd_cmd}, we can identify where the Q branch region of the colour-magnitude diagram has been mapped to in \cref{fig:2dhist}, as the bulk of the Q branch region occurs between the lines of 20\% C/O frozen and 80\% O/Ne frozen. Several trends are immediately apparent from \cref{fig:2dhist}, regardless of which set of models is considered. The decreasing density from left to right across each plot indicates that there are more low-mass WDs than high-mass WDs. Equally striking is that, as the cooling age increases (moving from bottom to top in each plot), the density of WDs gradually increases until it reaches a peak well after the age at which 80\% of a C/O core is frozen. This corresponds to an excess of stars on the Q branch and below it on the colour-magnitude diagram. This effect is much more pronounced for the lower mass WDs, with masses $\sim 0.95 - 1.15~M_\odot$. Since WDs with mass $\gtrsim 1.15~M_\odot$ are much less numerous than WDs on the lower end of the mass range shown in \cref{fig:2dhist}, the scale of the plots makes it difficult to see the trend with cooling age for these most massive WDs; however, our analysis later in this work will reveal that their cooling ages are much closer to uniformly distributed. If the models are correct and the WD birthrate were constant, then the distribution of cooling ages at a given mass would be expected to be uniform. The non-uniform density seen in \cref{fig:2dhist} (for $0.95-1.15~M_\odot$ WDs) indicates that either the WD birthrate is not constant or that these WDs are cooling more slowly than predicted by the models in the region where the density increases. In the latter scenario, the observed pile-up of WDs would imply a cooling delay that spans both the Q branch region and well beyond it, with the apparent delay in fact being much more prominent for WDs that have already finished their Q branch stage of evolution. The peak of this WD pile-up actually roughly coincides with the burst of star formation found by \citet{Mor2019} for \textit{Gaia} DR2 main sequence stars, with the general trend of the density gradually increasing with cooling age to a peak for the first $\sim 3~\mathrm{Gyr}$ seeming to follow the corresponding time-varying star formation rate found in that work. This strongly suggests that the non-uniform distribution of the WD cooling ages seen in \cref{fig:2dhist} is simply the imprint of the time-varying star formation history of their main sequence progenitors rather than an indication of a cooling delay relative to the standard WD cooling models. Progenitor stars that produce massive WDs in the mass range that we consider ($0.95-1.25~M_\odot$) evolve through their pre-WD stages of evolution on timescales that are negligible compared to the cooling ages we consider, with pre-WD lifetimes of less than $100~\mathrm{Myr}$ \citep{2016ApJ...823..102C,pleiades}. Thus, if the massive WDs that we consider are born from single progenitors, then the distribution of their cooling ages should follow the star formation rate of their main sequence progenitors. The distribution of cooling ages for WDs in the mass range 0.95 - 1.25 $M_\odot$, according to different sets of models and weighted to correct for the completeness-limiting reduced sampling volume, are shown in \cref{fig:1dhist}. These plots are the result of marginalizing the joint distributions of \cref{fig:2dhist} over WD mass for the given mass range. The different colours indicate the contribution of WDs with different atmosphere classifications to the total distribution. Nearly all of the youngest WDs, with cooling age $\lesssim 2~\mathrm{Gyr}$, are classified as having a H-atmosphere; while there are significant numbers of both H-atmosphere and He-atmosphere WDs with older cooling ages. WDs with unknown atmosphere composition only make up a very small fraction of the total WDs at any cooling age, so our treatment of these WDs should not significantly impact our results. \begin{figure*} \centering \includegraphics[width=\textwidth]{figures/1dhist_sublots.png} \caption{Distribution of cooling ages (in Gyr) of 0.95 - 1.25 $M_{\odot}$ WDs within 200 pc of the Sun, weighted to correct for reduced sampling volume. This sample was sorted into subgroups based on atmospheric composition, as determined by the fits of \citet{GentileFusillo2021}. WDs with atmospheric composition classified as either pure He or mixed H/He were combined into one group (shown in blue), and He-atmosphere models were used to determine their ages and masses. H-atmosphere models were used to determine the ages and masses of WDs with atmospheric composition classified as either pure H or unknown, but the H-atmosphere WDs (shown in orange) and the unknown-atmosphere WDs (shown in grey) were kept as separate groups. The (corrected) counts for each of these groups are stacked such that the top of the stacked distribution indicates the total (corrected) count from combining all three groups. The black line indicates the star formation rate of main sequence stars determined by \citet{Mor2019}, normalized to the number of WDs with cooling age $\leq$ 3 Gyr.} \label{fig:1dhist} \end{figure*} In each panel of \cref{fig:1dhist}, we also show the star formation rate determined by \citet{Mor2019} for \textit{Gaia} DR2 main sequence stars, which we have normalized to the number of WDs with a cooling age of $\leq$ 3~Gyr. Up to about 3 Gyr, the distribution of massive \textit{Gaia} EDR3 WDs tracks the shape of the SFR distribution, up to a small lag that should be expected due to the time required for a main sequence star to become a white dwarf. \citet{pleiades} have measured the lag between star formation and the formation of a one-solar-mass white dwarf to be less than 100~Myr from the Pleiades, so neglecting this lag is a reasonable approximation. If the WD birthrate were constant, this distribution should be approximately uniform. Instead we see an accumulation of massive WDs at cooling ages that coincide with the look-back time for the star formation burst found by \citet{Mor2019}. Beyond about 3~Gyr, the WD cooling age distribution appears to track the SFR less well. This could indicate that the star formation burst is actually broader than found for the fiducial case of \citet{Mor2019}. The discrepancy for old WDs could alternately be due to the poorer statistics of the oldest WDs or an imperfect correction for the reduced sampling volume of these stars, which are typically fainter and less complete than the younger white dwarfs. The weighting only begins to affect the distributions for cooling ages older than about 3~Gyr, so we can reliably compare the cooling age distribution to the SFR up to at least 3 Gyr even if the latter situation is the issue. We examine the divergence between the weighted and unweighted distribution more closely in our analysis of the cumulative cooling age distributions below. To investigate the effect of white dwarf mass, $M_{\mathrm{WD}}$, on the distribution of cooling ages, we sort the massive WDs into three mass bins: 0.95 - 1.05 $M_{\odot}$, 1.05 - 1.15 $M_{\odot}$, and 1.15 - 1.25 $M_{\odot}$. The cumulative distributions for WDs in each of these mass bins, according to the three sets of models we consider, are shown in \cref{fig:cumdists_mbins}. We show the WD distribution both with and without weighting to correct for the reduced sampling volume for which the \textit{Gaia} EDR3 observations are complete. In each panel of \cref{fig:cumdists_mbins}, we show the cumulative distribution corresponding to the SFR of \citet{Mor2019}, normalized to the unweighted WD distribution at 3 Gyr. For reference, we also show a uniform distribution with the same normalization. From the top and middle rows of this figure, we see that the distributions for WDs in the two lightest mass bins, $0.95-1.05~M_\odot$ and $1.05-1.15~M_\odot$, approximately follow the time-dependent SFR of main sequence stars \citep{Mor2019}. In stark contrast, the distribution of the heaviest WDs, in the mass bin $1.15-1.25~M_\odot$ (bottom row), does not seem to follow the SFR at all; instead, the cooling ages of the heaviest WDs are nearly uniformly distributed. \begin{figure*} \centering \includegraphics[width=\textwidth]{figures/cumdists_mbins.png} \caption{Cumulative distributions of cooling ages (in Gyr) of massive WDs in different mass bins according to the different sets of cooling models considered in this work. Each column corresponds to a particular set of models: thick Montreal (left), thin Montreal (centre), and La Plata (right). Each row corresponds to a particular WD mass bin: $0.95 - 1.05~M_\odot$ (top), $1.05 - 1.15~M_\odot$ (middle), and $1.15 - 1.25~M_\odot$ (bottom). For each subplot, we show both the unweighted (solid blue line) and weighted (dashed blue line) WD distributions. For comparison, we also show the cumulative distribution for the star formation rate of \citet{Mor2019} (solid orange line) and a uniform distribution (dotted black line), both normalized to the (unweighted) WD distribution at 3 Gyr.} \label{fig:cumdists_mbins} \end{figure*} To statistically asses the similarity between the observed cumulative cooling age distributions and the cumulative SFR of \cite{Mor2019}, we perform a series of one-sample Kolmogorov-Smirnov (KS) tests. We test the null hypothesis that the empirical cumulative distribution of a particular sample of WD cooling ages is equal to the analytic cumulative distribution function of the SFR. These cumulative distributions will be equivalent if the models are correct and the WD birthrate is proportional to the SFR of the main sequence progenitors, i.e. if the probability density of producing a WD with a particular cooling age is proportional to the SFR at the equivalent look-back time. Viewing the cooling age of a WD as a random variable drawn from an underlying probability distribution, which here is taken to be proportional to the SFR under the null hypothesis, the p-value from the one-sample KS tests quantifies the probably of randomly drawing a sample from the proposed underlying distribution for which the sample distribution differs from the underlying distribution by at least as much as what is seen for the observed empirical distribution. A small p-value indicates that the observed WD cooling ages are unlikely to have been drawn from the proposed SFR distribution. Viewed as a goodness-of-fit test, a small p-value indicates a poor fit of the SFR to the empirical distribution of cooling ages. We performed separate KS tests for each mass bin and each set of models, as well as for the full mass range $0.95-1.25~M_\odot$ encompassing all bins. As can be seen in \cref{fig:cumdists_mbins}, the weighted distribution starts to deviate from the unweighted distribution at cooling ages $\gtrsim$ 3~Gyr for the first two mass bins, and slightly earlier for the most massive bin. The KS tests do not account for the weighting of the WDs, so we can only use these tests to draw statistically meaningful conclusions for distributions of WDs young enough that the weighted distribution does not yet differ significantly from the unweighted distribution. For each sample we consider in a KS test, the sample includes only WDs with cooling age $\leq t_\mathrm{max}$. For each combination of model set and mass range, we perform KS tests for three choices of maximum cooling age: 2~Gyr, 3~Gyr, and 4~Gyr. The p-values resulting from all of these tests are summarized in \cref{tab:KS_results_massbins}. These different samples allow us to consider different options for balancing the improved statistical power of larger sample numbers with the error for the oldest WDs from not accounting for the reduced sampling volume. For the lightest two mass bins, we consider the sub-samples for which the WD cooling ages are $\leq 3~\mathrm{Gyr}$ to give the best balance between these two considerations. For each of the two lightest mass bins, there are two sets of models that give results consistent with the SFR for the sample with $t_\mathrm{max} = 3~\mathrm{Gyr}$, though the optimal models are different for each bin. The La Plata models give the best results for the $0.95 - 1.05~M_\odot$ mass bin, with a p-value of 0.0266 for $t_\mathrm{max} = 3~\mathrm{Gyr}$, while the thick Montreal models give the best results for the $1.05 - 1.15~M_\odot$ mass bin, with a p-value of 0.0138 for $t_\mathrm{max} = 3~\mathrm{Gyr}$ (and 0.0707 for $t_\mathrm{max} = 4~\mathrm{Gyr}$). For WDs in the heaviest mass bin, $1.15 - 1.25~M_\odot$, none of the models give WD distributions consistent with the SFR (all p-values $< 10^{-4}$). This result is in line with \cref{fig:cumdists_mbins}, which shows that these heaviest WDs have approximately uniformly distributed cooling ages, particularly for cooling ages above $\sim 1$~Gyr, regardless of which set of models is considered. To assess this apparently uniform trend, we performed another series of one-sample KS tests for just WDs in this heaviest bin to compare their cooling age distribution to a uniform distribution. For distributions over the cooling age range $1-2.5~\mathrm{Gyr}$, all of the models give distributions that are highly consistent with a uniform distribution, with p-values for KS tests comparing these distributions to a uniform distribution of 0.9803, 0.6321, and 0.2523 for the thick Montreal, thin Montreal, and La Plata models, respectively. The distributions for the first 1~Gyr (i.e. restricted to the cooling age range $0-1~\mathrm{Gyr}$) are in tension with a uniform distribution, having p-values of 0.0014, 0.0005, and $<10^{-4}$. This indicates that it could take $\sim 1~\mathrm{Gyr}$ for the uniform distribution to develop. \begin{table} \centering \caption{The p-values from one-sample KS tests comparing the (unweighted) cumulative distribution of cooling ages of WDs in different mass bins, according to different models, to the cumulative SFR of \citet{Mor2019} for samples restricted to different maximum cooling ages, $t_\mathrm{max}$ (in Gyr).} \label{tab:KS_results_massbins} \begin{tabular*}{\columnwidth}{lcrrr} \toprule Mass ($M_\odot$) & $t_\mathrm{max}$ (Gyr) & Montreal, thick & Montreal, thin & La Plata \\ \midrule $0.95 - 1.05$ & 2 & 0.0005 & $<10^{-4}$ & $<10^{-4}$ \\ & 3 & 0.0177 & $<10^{-4}$ & 0.0266 \\ & 4 & $<10^{-4}$ & $<10^{-4}$ & $<10^{-4}$ \\ \addlinespace $1.05 - 1.15$ & 2 & $<10^{-4}$ & 0.0103 & 0.0179 \\ & 3 & 0.0138 & 0.0208 & $<10^{-4}$ \\ & 4 & 0.0707 & $<10^{-4}$ & $<10^{-4}$ \\ \addlinespace $1.15 - 1.25$ & 2 & $<10^{-4}$ & $<10^{-4}$ & $<10^{-4}$ \\ & 3 & $<10^{-4}$ & $<10^{-4}$ & $<10^{-4}$ \\ & 4 & $<10^{-4}$ & $<10^{-4}$ & $<10^{-4}$ \\ \midrule $0.95 - 1.25$ & 2 & $<10^{-4}$ & $<10^{-4}$ & 0.0033 \\ & 3 & $<10^{-4}$ & 0.0008 & $<10^{-4}$ \\ & 4 & $<10^{-4}$ & $<10^{-4}$ & $<10^{-4}$ \\ \bottomrule \end{tabular*} \end{table} A possible explanation of the approximately uniform distribution of the most massive WDs is that a large fraction of these WDs formed due to mergers. For the mass ranges we consider, if most WDs in the sample were formed from the evolution of a single progenitor, then the distribution of WD cooling ages would be expected to directly track the SFR of their main sequence progenitors, similar to what we see for the lightest two mass bins. However, WDs that are the result of a double-WD merger event will have a younger apparent cooling age than predicted by single WD evolution models. If a large fraction of WDs in the sample are the result of double-WD merger events, then their cooling ages will be approximately distributed according to the convolution of the SFR of the single progenitors and the distribution of cooling delay times due to mergers. \citet{Cheng2020} have shown strong evidence of the presence of double-WD merger products among \textit{Gaia} DR2 high mass WDs and determined the cooling delay time distribution of double-WD merger products for multiple mass bins using population synthesis simulations. To estimate the cooling age distribution if most of the WDs in our most massive bins are the result of double-WD mergers, we convolve the \citet{Cheng2020} distribution of cooling delay times for $1.14-1.24~M_\odot$ (approximately corresponding to our mass bin) with the \citet{Mor2019} SFR. The result of this convolution is shown as the solid black curve in \cref{fig:mergers_cnts_all}, normalized to the number of WDs with apparent cooling age $\leq 3~\mathrm{Gyr}$ in our heaviest bin according to the thick Montreal models. The dashed coloured curves in \cref{fig:mergers_cnts_all} show the SFR by itself, without convolution with the merger delay time distribution, with each curve normalized the the number of WDs with cooling age $\leq 3~\mathrm{Gyr}$ in the mass bin of the corresponding colour. Each normalization was determined using the most statistically consistent model for that mass bin according to the KS tests. Note that normalizing the SFR to a different mass bin only affects the height of the curve, not the shape. \begin{figure} \centering \includegraphics[width=\columnwidth]{figures/mergers_cnts_all.png} \caption{Distribution of white dwarf cooling ages by mass bin, weighted to correct for the reduced sampling volume of the complete sample. For the lightest two mass bins, we show the distributions made using the set of models that was most consistent with the star formation rate based on the results of KS tests. For the heaviest bin, we used the thick Montreal models. The solid black curve indicates the distribution resulting from convolving the star formation rate of \citet{Mor2019} with the merger delay distribution of \citet{Cheng2020} appropriate for our heaviest mass bin; this curve has been normalized to the number of WDs in the heaviest bin with cooling age $\leq 3$~Gyr. The dashed lines indicate the star formation rate of \citet{Mor2019} analogously normalized to the number of WDs with cooling age $\leq 3~\mathrm{Gyr}$ in the mass bin with the corresponding colour. From top to bottom these are the lightest to heaviest mass bins.} \label{fig:mergers_cnts_all} \end{figure} The cooling age distributions for the observed \textit{Gaia} EDR3 WDs in each mass bin, according to the most consistent set of models for each bin as determined by the earlier KS tests, are shown in \cref{fig:mergers_cnts_all} as histograms with 0.5~Gyr bin width. These distributions were calculated using the same weighting as the previous figures in this work to correct for the reduced sampling volume of the complete samples. The La Plata models were used for the lightest bin and the thick Montreal models for the two heaviest bins. Comparison of the dashed green and solid black curves in \cref{fig:mergers_cnts_all} illustrates the effect on the cooling age distribution of accounting for the merger delay, shifting the peak associated with the star formation burst event to younger cooling ages and overall flattening the distribution, resulting in a distribution much closer to uniform and in better agreement with the observed distribution for WDs in the most massive bin. \section{Conclusions} We have shown that the number density of \textit{Gaia} EDR3 WDs in the mass range $0.95-1.15~M_\odot$ gradually increases with cooling age over the first $\sim 3~\mathrm{Gyr}$ of cooling time. This pile-up of WDs extends over the entire age range associated with the Q branch and continues well beyond it, reaching a peak after the end of core crystallization. If the WD birthrate were constant, this apparent excess of white dwarfs would indicate an anomalous cooling delay relative to the models. However, the discovery of a time-varying star formation rate for \textit{Gaia} DR2 main sequence stars \citep{Mor2019} suggests that the WD birthrate is likely to also vary with time, with the expectation that the distribution of cooling ages for the massive WDs that we consider closely follows this star formation rate if the WDs predominantly originate from single progenitor stars and if the models are correct. We indeed find that WDs in the mass bins $0.95-1.05~M_\odot$ and $1.05-1.15~M_\odot$ have cumulative cooling age distributions that are statistically consistent with the expectation from the star formation rate observed for main sequence stars \citep{Mor2019}. We do not see statistical evidence for an anomalous cooling delay in these results. For slightly more massive white dwarfs, in the mass bin $1.15-1.25~M_\odot$, we find that the distribution of their cooling ages is consistent with a uniform distribution for all sets of models considered over the cooling age range 1 - 2.5 Gyr, and this is not consistent with the star formation rate of \citet{Mor2019}. This could indicate that a large fraction of these most massive WDs formed from double-WD mergers. The binary population synthesis results of \citet{Cheng2020} for WDs in this mass range indicate a merger delay time distribution that, when convolved with the star formation rate of the main sequence progenitors, pushes the peak density to earlier WD cooling ages and overall flattens the distribution. We illustrated this effect for the limiting case that nearly all of the most massive WDs were formed by double-WDs mergers with the merger delay distribution of \citet{Cheng2020}. In reality, we do not expect the totality of white dwarfs in the $1.15-1.25~M_\odot$ bin to be merger remnants, therefore the predicted cooling age distribution would really be some combination of the single progenitor SFR and the cooling age distribution for mergers, with non-negligible contributions from both components. We leave a more detailed analysis of the merger fraction for future work. \section*{Acknowledgements} This work has been supported by the Natural Sciences and Engineering Research Council of Canada through the Discovery Grants program and Compute Canada. I.C. is a Sherman Fairchild Fellow at Caltech and thanks the Burke Institute at Caltech for supporting her research. This work has made use of data from the European Space Agency (ESA) mission \textit{Gaia} (\url{https://www.cosmos.esa.int/gaia}), processed by the \textit{Gaia} Data Processing and Analysis Consortium (DPAC, \url{https://www.cosmos.esa.int/web/gaia/dpac/consortium}) Funding for the DPAC has been provided by national institutions, in particular the institutions participating in the \textit{Gaia} Multilateral Agreement. We used the ``Synthetic Colors and Evolutionary Sequences of Hydrogen- and Helium-Atmosphere White Dwarfs'' website at \url{http://www.astro.umontreal.ca/~bergeron/CoolingModels/}. \section*{Data Availability} The data used in this paper are available through TAP Vizier and the \textit{Gaia} archive. We constructed the 200-pc white dwarf catalogue from \url{https://warwick.ac.uk/fac/sci/physics/research/astro/research/catalogues/gaiaedr3_wd_main.fits.gz}. The corresponding author can also provide software to perform the analysis presented in this paper. \bibliographystyle{mnras}
\section{Introduction} Let $G$ be a connected simple Lie group with finite center. Let $\theta$ be the Cartan involution. Then $K:=G^{\theta}$ is a maximal compact subgroup of $G$. Let $\frg_0$ (resp., $\frk_0$) be the Lie algebra of $G$ (resp., $K$). Let $T$ be a maximal torus of $K$. Let $\fra_0=\sqrt{-1}\frt_0$. Put $A=\exp(\fra_0)$. Then $H:=TA$ is the fundamental Cartan subgroup of $G$. Let $$ \frg_0=\frk_0 + \frp_0 $$ be the Cartan decomposition on the Lie algebra level. As usual, we drop the subscripts to denote the complexifications. Let $\langle \cdot, \cdot \rangle$ be the Killing form on $\frg$. Let $U(\frg)$ be the universal enveloping algebra of $\frg$ and let $C(\frp)$ be the Clifford algebra of $\frp$. To give geometric construction of the discrete series, Parthasarathy introduced the Dirac operator $D\in U(\frg)\otimes C(\frp)$ whose square is a natural Laplacian on $G$ in 1972 \cite{P72}. See \eqref{D-square}. Let $\pi$ be an irreducible $(\frg, K)$ module. Choose a spin module $S$ of $C(\frp)$. Let $\widetilde{K}$ be the subgroup of $K\times {\rm Spin \,\frp_0}$ consisting of the pairs $(k, s)$ such that ${\rm Ad}(k)=p(s)$, where ${\rm Ad}: K\to SO(\frp_0)$ is the adjoint action and $p: {\rm Spin}\, \frp_0 \to SO(\frp_0)$ is the spin double covering map. The Dirac operator $D$ acts on $X\otimes S$. Whenever $\pi$ is unitary, the operator $D$ is self-adjoint on $X\otimes S$; moreover, the eigenvalue of $D^2$ on any $\widetilde{K}$-type of $X\otimes S$ is non-negative. This leads to Parthasarathy's Dirac operator inequality \cite{P80}. See \eqref{Dirac-inequality}. It is very effective in detecting non-unitary modules and thus a valuable tool for studying the unitary dual $\widehat{G}$. To sharpen the Dirac inequality, and to obtain a better understanding of $\widehat{G}$, Vogan introduced Dirac cohomology \cite{Vog97} as the following $\widetilde{K}$-module: \begin{equation}\label{def-Dirac-cohomology} H_D(\pi):=\ker D/ \ker D \cap \im D. \end{equation} Vogan conjectured that $H_D(\pi)$ (whenever nonzero) should reveal the infinitesimal character of $\pi$, suggesting that Dirac cohomology should be a finer invariant of $\pi$. This conjecture was proven by Huang and Pand\v zi\'c \cite{HP1} in 2002. See Theorem \ref{thm-HP}. Since then, classifying $\widehat{G}^{\mathrm d}$---the set of all the equivalence classes of irreducible unitarizable $(\frg, K)$ modules with non-vanishing Dirac cohomology---became an interesting open problem. As suggested by Huang, we call $\widehat{G}^{\mathrm d}$ the \emph{Dirac series} of $G$. It is worth noting that when $\pi$ is unitary, $H_D(\pi)=\ker D=\ker D^2$. Thus $\pi$ is a Dirac series of $G$ if and only if zero is an eigenvalue of $D^2$ on $\pi \otimes S$. Therefore, Dirac series are exactly the members of $\widehat{G}$ on which the Dirac inequality is attained. This paper aims to classify $\widehat{E}_7^{\mathrm{d}}$---the Dirac series of the connected and simply connected complex Lie group such that $\frg_0$ is of type $E_7$. Although many results quoted below hold in a much wider setting, for convenience, we specialize $G$ to be \emph{complex} from now on. Let us build up necessary notation to state our main result. We identify \begin{equation}\label{identifications} \frg\cong \frg_{0} \oplus \frg_0, \quad \frh\cong \frh_{0} \oplus \frh_0, \quad \frt\cong \{(x,-x) : x\in \frh_{0} \}, \quad \fra \cong\{(x, x) : x\in \frh_{0} \}. \end{equation} Denote the Weyl group of $\Delta(\frg_0, \frh_0)$ by $W$, which has identity element $e$ and longest element $w_0$. Then $W(\Delta(\frg, \frh))$ is isomorphic to $W\times W$. By Theorem \ref{thm-Zh}, every irreducible admissible $(\frg, K)$ module is isomorphic to certain $J(\lambda_L, \lambda_R)$, see Section \ref{sec-Zh}. \begin{figure}[H] \centering \scalebox{0.7}{\includegraphics{E7-Dynkin.eps}} \caption{Dynkin diagram for $E_7$} \label{E7-Dynkin} \end{figure} Let us fix the simple roots of complex $E_7$ as in Fig.~\ref{E7-Dynkin}. We enumerate the corresponding fundamental weights as $\varpi_1, \dots, \varpi_7$, and use them as a basis to express weights. That is, $\lambda=[\lambda_1, \cdots, \lambda_7]$ stands for the weight $\sum_{i=1}^{7}\lambda_i\varpi_i$. We say that $\lambda$ is \emph{integral} (resp., \emph{half-integral}) if each coordinate $\lambda_i$ (resp., $2\lambda_i$) is an integer. In this terminology, half sum of the positive roots is expressed as $\rho(E_7)=[1, 1,1,1,1,1,1]$ and it is integral regular. There are $10208$ involutions in the Weyl group $W(E_7)$ in total, among which $8479$ have the property that \begin{equation}\label{def-Is} I(s):=\{1\leq i\leq 7\mid s(\varpi_i)=\varpi_i\} \end{equation} is empty. Write $\{1, 2, 3, \cdots\}$ as $\mathbb{P}$ and $\{0, 1, 2, \cdots\}$ as $\mathbb{N}$. For any fixed involution $s\in W(E_7)$, we collect all these $\lambda=[\lambda_1, \dots, \lambda_l]$ such that \begin{itemize} \item [$\bullet$] $2\lambda_i\in\mathbb{P}$; \item [$\bullet$] $\lambda+s\lambda$ is integral; \item [$\bullet$] $\lambda-s\lambda$ is a $\bbN$-combination of simple roots \end{itemize} as $\Lambda(s)$. By page 5 of \cite{BP} and Section 2.6 of \cite{D2}, any representation in $\widehat{E}_7^{\mathrm{d}}$ must bear the form \begin{equation}\label{can-repns} J(\lambda, -s\lambda), \end{equation} where $s\in W(E_7)$ is an involution and $\lambda\in\Lambda(s)$. This module has lowest $K$-type $\{\lambda+s\lambda\}$, the unique dominant weight to which $\lambda+s\lambda$ is conjugate under the action of $W(E_7)$. \emph{Scattered representations} (resp., \emph{string representations}) of complex $E_7$ consist of those $J(\lambda, -s\lambda)$ in $\widehat{E}_7^{\mathrm{d}}$ such that $I(s)$ is empty (resp., non-empty). By Theorem A of \cite{DD}, the set $\widehat{E}_7^{\mathrm{d}}$ consists of finitely many scattered representations and finitely many strings; moreover, to figure out $\widehat{E}_7^{\mathrm{d}}$, it suffices to pin down the scattered representations in $\widehat{L}_{\mathrm{ss}}^{\mathrm{d}}$, where $L$ runs over the Levi factors of all the $\theta$-stable parabolic subalgebras of $G$ and $L_{\mathrm{ss}}:=[L, L]$ is the semisimple factor of $L$. An algorithm for computing these scattered representations is provided in \cite[Section 4]{D2}. It will be improved slightly in Section \ref{sec-E7-scattered}. Our main result is the following. \medskip \noindent\textbf{Theorem A.} \emph{The set $\widehat{E}_7^{\mathrm{d}}$ consists of $66$ scattered representations (see Tables \ref{table-E7-scattered-part-1} and \ref{table-E7-scattered-part-2}) whose spin-lowest $K$-types are all unitarily small, and $578$ strings of representations (see Section \ref{sec-E7-string}). Moreover, each representation $\pi\in\widehat{E}_7^{\mathrm{d}}$ has a unique spin-lowest $K$-type occurring with multiplicity one.} \medskip In Theorem A, the notion unitarily small (\emph{u-small} for short henceforth) was introduced by Salamanca-Riba and Vogan \cite{SV}. The above result confirms the following conjectures for the group complex $E_7$: \begin{itemize} \item[$\bullet$] Conjecture 1.1 of \cite{BP} in 2011 (see Corollary \ref{cor-main}); \item[$\bullet$] Conjecture 3.4 of \cite{BP} in 2011; \item[$\bullet$] Conjecture B of \cite{D2} in 2019; \item[$\bullet$] Conjecture C of \cite{DD} in 2020 (via the aid of \cite[Lemma 3.4]{DW1}). \end{itemize} The paper is organized as follows: Section 2 collects necessary preliminaries. Section 3 (resp., Section 4) descries the string part (resp., the scattered part) of $\widehat{E}_7^{\mathrm{d}}$. We realize 63 scattered members in $\widehat{E}_7^{\mathrm{d}}$ as string limits in Section 5, thus providing interesting links between the string part and the scattered part. The three scattered members which can \emph{not} be realized as string limits are unipotent representations (not necessarily special). They are discussed in Section 6. The last section aims to develop effective ways to determine the spin LKTs. For string limits, the branching result from \cite{BDW} and a technique suggested by Vogan are helpful. For unipotent representations, we use McGovern \cite{Mc}, Losev, Mason-Brown and Matvieievskyi \cite{LMM}. Among all the exceptional Lie groups, complex $E_8$ is the hardest one from the computational point of view. It is conceivable that our journey here will help people to classify the Dirac series of complex $E_8$ in the future. \section{Preliminaries} Let us adopt the setting of the introduction, and assume that $G$ is a connected complex Lie group (viewed as a real Lie group). \subsection{Zhelobenko classification}\label{sec-Zh} Fix a Borel subgroup $B$ of $G$ containing $H$. Put $$ \Delta^{+}(\frg_0, \frh_0)=\Delta(\frb_0, \frh_0). $$ Let $\rho$ be the half sum of roots in $\Delta^{+}(\frg_0, \frh_0)$. Set $$ \Delta^+(\frg, \frh)=\Delta^+(\frg_0, \frh_0) \times \{0\} \cup \{0\} \times (-\Delta^+(\frg_0, \frh_0)).$$ Let $\rho_{\frg}$ be the half sum of roots in $\Delta^+(\frg, \frh)$. When restricted to $\frt$, we get $\Delta^+(\frg, \frt)$, $\Delta^+(\frk, \frt)$ and $\Delta^+(\frp, \frt)$. Denote by $\rho_c$ the half-sum of roots in $\Delta^+(\frk, \frt)$. We may and we will identify a $K$-type ($\widetilde{K}$-type, $\frk$-type, etc) with its highest weight, which is necessarily dominant integral with respect to $\Delta^{+}(\frk, \frt)$. Let $(\lambda_{L}, \lambda_{R})\in \frh_0^{*}\times \frh_0^{*}$ be such that $\lambda_{L}-\lambda_{R}$ is a weight of a finite dimensional holomorphic representation of $G$. We view $(\lambda_L, \lambda_R)$ as a real-linear functional on $\frh$ by \eqref{identifications}, and write $\bbC_{(\lambda_L, \lambda_R)}$ as the character of $H$ with differential $(\lambda_L, \lambda_R)$ (which exists). By \eqref{identifications} again, we have $$ \bbC_{(\lambda_L, \lambda_R)}|_{T}=\bbC_{\lambda_L-\lambda_R}, \quad \bbC_{(\lambda_L, \lambda_R)}|_{A}=\bbC_{\lambda_L+\lambda_R}. $$ Extend $\bbC_{(\lambda_L, \lambda_R)}$ to a character of $B$, and put $$X(\lambda_{L}, \lambda_{R}) :=K\mbox{-finite part of Ind}_{B}^{G} ( \bbC_{(\lambda_L, \lambda_R)} ). $$ Using Frobenius reciprocity, the $K$-type with extremal weight $\lambda_{L}-\lambda_{R}$ occurs with multiplicity one in $X(\lambda_{L}, \lambda_{R})$. Let $J(\lambda_L,\lambda_R)$ be the unique subquotient of $X(\lambda_{L}, \lambda_{R})$ containing the $K$-type $\{\lambda_L -\lambda_R\}$ (recall that this notation stands for the unique dominant weight to which $\lambda_L-\lambda_R$ is conjugate under the Weyl group action). \begin{thm}\label{thm-Zh} {\rm (Zhelobenko \cite{Zh})} In the above setting, we have that \begin{itemize} \item[a)] Every irreducible admissible ($\frg$, $K$)-module is of the form $J(\lambda_L,\lambda_R)$. \item[b)] Two such modules $J(\lambda_L,\lambda_R)$ and $J(\lambda_L^{\prime},\lambda_R^{\prime})$ are equivalent if and only if there exists $w\in W$ such that $w\lambda_L=\lambda_L^{\prime}$ and $w\lambda_R=\lambda_R^{\prime}$. \item[c)] $J(\lambda_L, \lambda_R)$ admits a nondegenerate Hermitian form if and only if there exists $w\in W$ such that $w(\lambda_L-\lambda_R) =\lambda_L-\lambda_R , w(\lambda_L+\lambda_R) = -\overline{(\lambda_L+\lambda_R)}$. \item[d)] The representation $X(\lambda_{L}, \lambda_{R})$ is tempered if and only if $\lambda_{L}+\lambda_{R}\in i\frh_0^*$. In this case, $X(\lambda_{L}, \lambda_{R})=J(\lambda_{L}, \lambda_{R})$. \end{itemize} \end{thm} Note that $J(\lambda_L,\lambda_R)$ has lowest $K$-type $\{\lambda_L-\lambda_R\}$ and infinitesimal character the $W\times W$ orbit of $(\lambda_L, \lambda_R)$. \subsection{Dirac cohomology}\label{sec-Dirac-coho} Let $Z_1, \dots, Z_n$ be an orthonormal basis of $\frp_0$ with respect to the inner product induced by the Killing form $\langle \cdot, \cdot \rangle$. The Dirac operator is defined as \begin{equation}\label{D-square} D=\sum_{i=1}^{n} Z_i \otimes Z_i \in U(\frg)\otimes C(\frp). \end{equation} It is easy to check that $D$ does not depend on the choice of the orthonormal basis $\{Z_i\}_{i=1}^{n}$ and it is $K$-invariant for the diagonal action of $K$ given by adjoint actions on both factors. By construction, $D^2$ is a natural Laplacian on $G$. Indeed, \begin{equation} D^2=\Omega_{\frk_{\Delta}} -\Omega_{\frg}\otimes 1 + (\|\rho_c\|^2-\|\rho_{\frg}\|^2) 1 \otimes 1. \end{equation} Here $\Omega_{\frg}$ (resp., $\Omega_{\frk}$) is the Casimir operator for $\frg$ (resp., $\frk$), and $\Omega_{\frk_{\Delta}}$ is the image of $\Omega_{\frk}$ under a diagonal embedding $\Delta$ of $\frk$ into $U(\frg)\otimes C(\frp)$. See Section 3.1 of \cite{HP2} for more. Let $\gamma$ be the highest weight of any $\widetilde{K}$-type of $\pi\otimes S$, where $\pi$ is an irreducible \emph{unitary} $(\frg, K)$ module which has infinitesimal character $\Lambda$. Then the eigenvalue of $D^2$ on $(X\otimes S)(\gamma)$ is $\|\gamma+\rho_c\|^2-\|\Lambda\|^2$. This leads to Parthasarathy's Dirac operator inequality \begin{equation}\label{Dirac-inequality} \|\gamma+\rho_c\| \geq \|\Lambda\|. \end{equation} As been sharpened in Theorem 3.5.2 of \cite{HP2}, equality holds in \eqref{Dirac-inequality} if and only if $\gamma+\rho_c$ is conjugate to $\Lambda$ under the action of $W(\frg, \frh)$. Indeed, if \eqref{Dirac-inequality} becomes equality on certain $\widetilde{K}$-type $\gamma$ of $\pi\otimes S$, then $$(\pi\otimes S)(\gamma)\subseteq \ker D^2= H_D(\pi). $$ Thus by Theorem \ref{thm-HP}, $\gamma + \rho_c$ is conjugate to $\Lambda$ under the action of $W(\frg, \frh)$. The following result is the Vogan conjecture proven by Huang and Pand\v zi\'c \cite{HP1}. It is foundational for the study of Dirac cohomology. For instance, although $\pi$ is usually infinite-dimensional, it allows one to focus on finitely many $K$-types to compute $H_D(\pi)$. \begin{thm}{\rm (Huang and Pand\v zi\'c)}\label{thm-HP} Let $\pi$ be an irreducible ($\frg$, $K$) module. Assume that the Dirac cohomology of $\pi$ is nonzero, and that it contains the $\widetilde{K}$-type $E_{\gamma}$ with highest weight $\gamma\in\frt^{*}\subset\frh^{*}$. Then the infinitesimal character of $\pi$ is conjugate to $\gamma+\rho_{c}$ under $W(\frg,\frh)$. \end{thm} \subsection{Spin norm and spin-lowest $K$-type} Inspired by the ideas of Parthasarathy, Vogan, Huang and Pand\v zi\'c, the first named author introduced spin norm and spin-lowest $K$-type in his 2011 HKUST thesis (cf. \cite{D1}). Given a $K$-type $\mu$, its \emph{spin norm} is defined as \begin{equation}\label{spin-norm} \|\mu\|_{\rm spin}:= \|\{\mu-\rho\}+\rho\|. \end{equation} The spin norm $\|\pi\|_{\rm spin}$ of an irreducible $(\frg, K)$ module $\pi$ is defined as the minimum of the spin norm of all the $K$-types showing up in $\pi$. We call $\mu$ a \emph{spin-lowest $K$-type} of $\pi$ if $\mu$ occurs in $\pi$ and $\|\mu\|_{\rm spin}=\|\pi\|_{\rm spin}$. Now assume that $\pi$ is unitary and has infinitesimal character $\Lambda$. Let $\mu$ be any $K$-type of $\pi$. Note that the spin module $S$ is some copies of the $\frk$-type $\rho$ (see Lemma 2.2 of \cite{BP}). Thus using the knowledge of PRV-component \cite{PRV}, one sees that the Dirac inequality \eqref{Dirac-inequality} can be reformulated as \begin{equation}\label{Dirac-inequality-reformulated} \|\mu\|_{\rm spin} \geq \|\Lambda\|. \end{equation} Moreover, results from the previous section guarantee that: \begin{itemize} \item[$\bullet$] $\|\pi\|_{\rm spin}\geq \|\Lambda\|$, and equality holds if and only if $H_D(\pi)$ is non-zero; \item[$\bullet$] $\|\mu\|_{\rm spin}\geq \|\Lambda\|$, and equality holds if and only if $\mu$ contributes to $H_D(\pi)$; \item[$\bullet$] If $H_D(\pi)\neq 0$, it is exactly the spin-lowest $K$-types of $\pi$ that contribute to $H_D(\pi)$. \end{itemize} These properties motivate us to pay close attention to spin norm and spin-lowest $K$-types when classifying Dirac series. \subsection{Vogan pencil} Let $\beta$ be the highest root of $\Delta^{+}(\frg_0, \frh_0)$. As a special case of Lemma 3.4 and Corollary 3.5 of \cite{Vog81}, for any infinite-dimensional irreducible ($\frg$, $K$)-module $\pi$, there is a unique set $$\{\mu_{\fri} \,|\, \fri \in I \} \subseteq i \frt_{0}^{*}$$ of dominant integral weights such that all the $K$-types of $\pi$ are precisely $$\{\mu_{\fri} +n \beta \,|\, \fri \in I, n\in\bbN \}.$$ We call a set of $K$-types \begin{equation}\label{P-delta} P(\delta):=\{\delta +n \beta \,|\, n\in\bbN \} \end{equation} a \emph{Vogan pencil}. For instance, $P(0)$ denotes the pencil starting from the trivial $K$-type. Put \begin{equation}\label{P-mu-prime} P_{\delta}:=\min \{\|\delta +n \beta \|_{\mathrm{spin}}\,|\, n\in\bbN \}. \end{equation} That is, the minimum spin norm of the $K$-types on $P(\delta)$ is denoted as $P_{\delta}$. \section{The string part of $\widehat{E}_7^{\mathrm{d}}$}\label{sec-E7-string} To understand the string part of $\widehat{E}_7^{\mathrm{d}}$, we should obtain the scattered parts of $\widehat{A}_i^{\mathrm{d}}$ for $1\leq i\leq 6$ and $\widehat{D}_j^{\mathrm{d}}$ for $4\leq j\leq 6$. Here by $D_j$ we actually mean the group $Spin(2j, \bbC)$. Let us present the scattered parts of $\widehat{A}_6^{\mathrm{d}}$ and $\widehat{D}_6^{\mathrm{d}}$ in Tables \ref{table-A6-scattered-part} and \ref{table-D6-scattered-part}, respectively. Here we present the folded version as in \cite[Section 3]{D2}. Note that $N_{A_6}=32$ and $N_{D_6}=34$. By Lemma 3.4 of \cite{DW1}, we conclude that each spin-lowest $K$-type of any scattered representation in Table \ref{table-A6-scattered-part} or Table \ref{table-D6-scattered-part} is u-small. Note that scattered representations of $\widehat{A_i}^d$ for $1\leq i\leq 5$ and $\widehat{D_j}^d$ for $4\leq j\leq 5$ have been recorded in \cite{D2}. We remark that the scattered representations of complex classical Lie groups have been studied in \cite{DW1} and \cite{DW2}. Be careful that the group of type $D_j$ in \cite{DW2} actually means $SO(2j, \bbC)$. In particular, a representation in Table \ref{table-D6-scattered-part} passes to a representation of $SO(12, \bbC)$ if and only if $\lambda_5=\lambda_6$ holds there; otherwise, it is a genuine representation of $Spin(12, \bbC)$. In a subsequent work, we will classify genuine unitary representations of $Spin(n, \bbC)$ with non-zero Dirac cohomology. \begin{table} \centering \caption{The scattered part of $\widehat{A}_6^{\mathrm{d}}$ (folded version)} \begin{tabular}{l|c|c|c|r} $s\rho$ & $\lambda$ & spin LKT & mult \\ \hline $[3,-5,3,3,-5,3]$ & $\frac{\rho}{2}$ & $\rho$ & $1$ \\ $[-3, 1, 4, -6, 5, -2]^*$ & $[\frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1]$ & $[1, 1, 1, 2, 0, 1]$& $1$ \\ $[-2,-1,5,-6,5,-2]^*$ & $[1, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1]$ & $[1, 0, 0, 4, 0, 1]$ & $1$ \\ $[-4,2,-1,4,-6,4]^*$ & $[\frac{1}{2}, \frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$ & $[2, 1, 0, 1, 2, 1]$ & $1$ \\ $[-2,-1,-1,5,-6,4]^*$ & $[1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$ & $[1, 1, 0, 2, 1, 1]$& $1$ \\ $[-2,-1,-1,5,-6,4]^*$ & $[1, 1, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$ & $[1, 0, 0, 0, 4, 1]$& $1$ \\ $[-5,3,-1,-1,3,-5]$ & $\frac{\rho}{2}$ & $\rho$ & $1$ \\ $[-5,3,-1,-1,3,-5]$ & $[\frac{1}{2}, \frac{1}{2}, 1, 1, \frac{1}{2}, \frac{1}{2}]$ & $[3,1,0,0,1,3]$ & $1$ \\ $[-3,1,-3,1,3,-5]^*$ & $\frac{\rho}{2}$ & $\rho$ & $1$ \\ $[-2,3,-5,3,-4,2]^*$ & $[1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$ & $[1, 1, 0, 2, 1, 1]$ & $1$ \\ $[-2,-2,1,-2,4,-5]^*$ & $[1, \frac{1}{2}, \frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}]$ & $[2, 1, 0, 0, 2, 2]$ & $1$\\ $[-2,-2,1,-2,4,-5]^*$ & $[1, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$ & $[1, 1, 0, 0, 3, 1]$ & $1$ \\ $[-2,-1,-1,-1,4,-5]^*$ & $[1, 1, 1, 1, \frac{1}{2}, \frac{1}{2}]$ & $[0,0,0,0,0,4]$ & $1$ \\ $[-2,-2,3,-4,2,-3]^*$ & $[1, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$ & $[1, 1, 0, 0, 3, 1]$ & $1$\\ $[-1,-3,1,1,-3,-1]$ & $[1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1]$ & $[1, 2, 0, 0, 2, 1]$& $1$\\ $[-1,-2,-1,2,-3,-1]^*$ & $[1, 1, 1, \frac{1}{2}, \frac{1}{2}, 1]$ & $[2, 0, 0, 0, 0, 4]$ & $1$ \\ $-\rho$ & $[1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1]$ & $[1, 2, 0, 0, 2, 1]$ & $1$ \\ $-\rho$ & $[1, 1, \frac{1}{2}, \frac{1}{2}, 1, 1]$ & $[3, 0, 0, 0, 0, 3]$& $1$ \\ $-\rho$ & $\frac{\rho}{2}$ & $\rho$ & $1$\\ $-\rho$ & $\rho$ & $[0,0,0,0,0,0]$ & $1$ \end{tabular} \label{table-A6-scattered-part} \end{table} \begin{table} \centering \caption{The scattered part of $\widehat{D}_6^{\mathrm{d}}$ (folded version)} \begin{tabular}{l|c|c|c|r} $s\rho$ & $\lambda$ & spin LKT & mult \\ \hline $[-3, 1, 5, -7, 5, 5]$ & $\frac{\rho}{2}$ & $\rho$ & $1$\\ $[-2, -1, 6, -7, 5, 5]$ & $[1,1,\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2}]$ & $[1, 0, 0, 3, 1, 1]$ & $1$ \\ $[-2, 7, -8, 6, -1, -1]$ & $[1,\frac{1}{2},\frac{1}{2},\frac{1}{2},1,1]$ & $[1, 0, 4, 1, 0, 0]$ & $1$ \\ $[4, -6, 5, 4, -6, -2]^*$ & $[\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},1]$ & $[1, 2, 0, 1, 2, 1]$ & $1$ \\ $[7, -9, 7, -3, 1, 1]$ & $\frac{\rho}{2}$ & $\rho$ & $1$ \\ $[-5, 4, -2, 7, -8, -2]^*$ & $[\frac{1}{2},\frac{1}{2},1,\frac{1}{2},\frac{1}{2},1]$ & $[3, 0, 1, 0, 4, 1]$ & $1$ \\ $[5, -7, 5, -7, 5, 5]$ & $\frac{\rho}{2}$ & $\rho$ & $1$ \\ $[7, -9, 7, -1, -1, -1]$ & $[\frac{1}{2},\frac{1}{2},\frac{1}{2},1,1,1]$ & $[1, 5, 1, 0, 0, 0]$ & $1$ \\ $[-1, -3, 1, 7, -9, -1]^*$ & $[1,\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},1]$ & $[2, 0, 1, 0, 3, 2]$ & $1$ \\ $[-6, 4, 5, -6, -2, 4]^*$ & $[\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},1,\frac{1}{2}]$ & $[2, 0, 2, 0, 2, 1]$ & $1$ \\ $[-1, -2, -1, 8, -9, -1]^*$ & $[1,1,1,\frac{1}{2},\frac{1}{2},1]$ & $[0, 1, 0, 0, 7, 0]$ & $1$ \\ $[-9, 7, -5, 3, -1, -1]$ & $[\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},1,1]$ & $[1, 3, 1, 1, 0, 0]$ & $1$ \\ $[-2, -1, 6, -8, -1, 7]^*$ & $[1,1,\frac{1}{2},\frac{1}{2},1,\frac{1}{2}]$ & $[0, 2, 0, 0, 5, 0]$ & $1$\\ $[-7, 5, -7, 5, -1, -1]$ & $[\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},1,1]$ & $[1, 3, 1, 1, 0, 0]$ & $1$ \\ $[-9, 7, -1, -3, 1, 1]$ & $[\frac{1}{2},\frac{1}{2},1,\frac{1}{2},\frac{1}{2},\frac{1}{2}]$ & $[2, 1, 2, 1, 0, 0]$ & $1$ \\ $[-1, -7, 5, -3, 1, 1]$ & $[1,\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2}]$ & $[1, 1, 1, 2, 0, 0]$ & $1$ \\ $[-9, 7, -1, -1, -1, -1]$ & $[\frac{1}{2},\frac{1}{2},1,1,1,1]$ & $[7, 1, 0, 0, 0, 0]$ & $1$ \\ $[-1, -5, 3, -5, 3, 3]$ & $[1,\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2}]$ & $[1, 1, 1, 2, 0, 0]$ & $1$ \\ $[-2, 4, -5, 4, -6, -2]^*$ & $[1,\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},1]$ & $[0, 2, 0, 1, 0, 3]$ & $1$\\ $[-1, -7, 5, -1, -1, -1]$ & $[1,\frac{1}{2},\frac{1}{2},1,1,1]$ & $[5, 2, 0, 0, 0, 0]$ & $1$ \\ $[-1, -1, -5, 3, -1, -1]$ & $[1,1,\frac{1}{2},\frac{1}{2},1,1]$ & $[3, 3, 0, 0, 0, 0]$ & $1$ \\ $[1, -3, 1, -3, -1, 1]^*$ & $[\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},1,\frac{1}{2}]$ & $[0, 2, 0, 2, 0, 1]$& $1$ \\ $[-1, -1, -1, -3, 1, 1]$ & $\frac{\rho}{2}$ & $\rho$ & $1$ \\ $[-1, -1, -1, -3, 1, 1]$ & $[1,1,1,\frac{1}{2},\frac{1}{2},\frac{1}{2}]$ & $[1, 4, 0, 0, 0, 0]$& $1$ \\ $-\rho$ & $[1,\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2}]$ & $[1, 1, 1, 2, 0, 0]$& $1$ \\ $-\rho$ & $\rho$ & [0,0,0,0,0,0]& $1$ \end{tabular} \label{table-D6-scattered-part} \end{table} It is not hard to equip these scattered representations into strings of $\widehat{E}_7^{\mathrm{d}}$. Let us see some examples. \begin{example}\label{exam-HA} Consider one extreme case $L=HA$. Then the corresponding string in $\widehat{E}_7^{\mathrm{d}}$ is: $$ [\lambda_1, \dots, \lambda_7]\in \Lambda(e), $$ where each $\lambda_i\in\frac{1}{2}\mathbb{P}$. All of them are tempered representations. \hfill\qed \end{example} \begin{example}\label{exam-D6} Let us consider another extreme case. Namely, now $L_{\mathrm{ss}}$ is $D_6$. We focus on the first representation in Table \ref{table-D6-scattered-part}, where $s=s_1s_2s_4s_3s_2s_ 1s_5s_6s_4$ and $$ \lambda=[\frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]. $$ Note that $\lambda+s\lambda=[-1, 1, 3, -3, 3, 3]$ and $\lambda-s\lambda=[2, 0, -2, 4, -2, -2]$. Recall that $s\rho(D_6)=[-3, 1, 5, -7, 5, 5]$. There is a unique $\theta$-stable parabolic subalgebra of $G$ whose semisimple factor is of type $D_6$---the one corresponding to $\{\alpha_2, \dots, \alpha_7\}$. Let us denote the counterpart of the involution $s$ in it by $s'$. One can find that $$ s'=s_7s_6s_4s_5s_6s_7s_2s_3s_4, $$ and that $$ s'\rho(E_7)=[\textbf{3}, 5,5,-7,5,1,-3]. $$ Here the non-bolded coordinate comes from those of $s\rho(D_6)$ via permutations. Now the representation $J(\lambda, -s\lambda)$ of $D_6$ gives the following string of $\widehat{E}_7^{\mathrm{d}}$: $$ \lambda^\prime:=[\frac{a}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]\in\Lambda(s'), $$ where $a\in \mathbb{P}$. Note that $$ \lambda^\prime+ s^\prime \lambda^\prime=[a +1, 3, 3, -3, 3, 1, -1], \quad \lambda^\prime- s^\prime \lambda^\prime=[-1, -2, -2, 4, -2, 0, 2]. $$ \hfill\qed \end{example} We will not explicitly give all the strings of $\widehat{E}_7^{\mathrm{d}}$. Instead, let us count them. For this purpose, we denote by $N_i$ the number of $I$-strings in $\widehat{E}_7^{\mathrm{d}}$ such that $|I|=7-i$. Then $N_0 =1$ (see Example \ref{exam-HA}), and \begin{align*} N_1 &=7 N_{A_1}=7,\\ N_2 &=6 N_{A_2}+15 N_{A_1} N_{A_1}=27,\\ N_3 &=6 N_{A_3} +18 N_{A_2} N_{A_1} + 11 N_{A_1} N_{A_1} N_{A_1}=71,\\ N_4 &= N_{D_4} + 5 N_{A_4}+11 N_{A_3} N_{A_1}+12 N_{A_2} N_{A_1} N_{A_1} + 4 N_{A_2} N_{A_2} + 2 N_{A_1} N_{A_1} N_{A_1} N_{A_1}=135,\\ N_5 &=2 N_{D_5}+3 N_{A_5}+ N_{D_4}N_{A_1}+ 5 N_{A_4} N_{A_1} + 3 N_{A_3} N_{A_2} + 3 N_{A_3} N_{A_1}N_{A_1} + 3 N_{A_2} N_{A_2}N_{A_1}\\ & + N_{A_2}N_{A_1}N_{A_1}N_{A_1} =181, \\ N_6 &= N_{D_6}+ N_{A_6}+ N_{A_5}N_{A_1}+ N_{A_3}N_{A_2}N_{A_1}+N_{A_4}N_{A_2}+N_{D_5}N_{A_1}+N_{E_6}=156. \end{align*} Here recall that $N_G$ is the cardinality of the scattered part of $\widehat{G}^{\mathrm{d}}$. Therefore, $\widehat{E}_7^{\mathrm{d}}$ contains $\sum_{i=0}^{6} N_i=578$ strings in total. \section{The scattered part of $\widehat{E}_7^{\mathrm{d}}$}\label{sec-E7-scattered} Similar to Section 4 of \cite{D2}, we proceed as follows to sieve out all the \emph{non-trivial} scattered representations of complex $E_7$: \begin{itemize} \item[$\bullet$] collect the finitely many $\lambda\in \Lambda(s)$ (see the introduction) such that $\|\lambda-s\lambda\|^2\leq 464$ and that $\|2\lambda\|^2 \leq P_{\{\lambda+s\lambda\}}^2$ (see \eqref{P-mu-prime}). \item[$\bullet$] For these $\lambda$ surviving from the above step (if exist), use \texttt{atlas} \cite{ALTV,At} to study the unitarity and $K$-types of $J(\lambda, -s\lambda)$. \end{itemize} In the first step, note that the earlier upper bound for $\|\lambda-s\lambda\|^2$ is $\|2\rho\|^2$, which equals to $798$ for complex $E_7$. This improvement is guaranteed by Theorem 1.1 of \cite{D3}. The relevant files are available from the following link: \begin{verbatim} https://www.researchgate.net/publication/353914493_E7-Files \end{verbatim} \begin{example}\label{exam-E7-first-scattered} Consider the involution $s=s_1 s_4 s_2 s_3 s_1 s_5 s_6 s_7 s_6 s_5 s_4$. Note that $s\rho(E_7)=[-2,6,7,-8,6,1,-3]$. Carrying out the first step above leaves us with the following $6$ candidate representations: \begin{align*} &[\frac{1}{2}, \frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}], \quad [1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}], \quad [1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{3}{2}],\\ &[1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1, \frac{1}{2}, 1], \quad [1, \frac{3}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}], \quad [\frac{3}{2}, \frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]. \end{align*} Only the $\lambda=[1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$ produces a unitary representation. Note that \begin{align*} \lambda + s \lambda=[0, 4, 4, -4, 4, 1, -1],\quad \lambda - s \lambda=[2, -3, -3, 5, -3, 0, 2]. \end{align*} It has a unique spin-lowest $K$-type $[1,1,0,2,1,1,1]$ whose spin norm equals to $\|2\lambda\|$. Moreover, it occurs exactly once. This is the 1st entry of Table \ref{table-E7-scattered-part-1}. \hfill\qed \end{example} \begin{example}\label{exam-E7-3424} Consider the involution $$ s=s_1s_2s_3s_4s_2s_3s_4s_5s_4s_2s_3s_4s_5s_6s_5s_4s_2s_3s_4s_5s_6s_7s_6s_5s_4s_2 s_3s_1s_4s_5s_6s_7. $$ Note that $s\rho(E_7)=[-17,-1,15,-1,-1,-1,-1]$. Carrying out the first step above leaves us with $241$ candidate representations. Only $\lambda=[\frac{1}{2}, 1, \frac{1}{2}, 1, 1, 1, 1]$ produces a unitary representation. Note that $$ \lambda + s\lambda=[-14, 0, 14, 0, 0, 0, 0], \quad \lambda + s\lambda=[15, 2, -13, 2, 2, 2, 2]. $$ It has a unique spin-lowest $K$-type $[13,0,1,0,0,0,0]$ whose spin norm equals to $\|2\lambda\|$. Moreover, it occurs exactly once. This is the 1st entry of Table \ref{table-E7-scattered-part-2}. \hfill\qed \end{example} \begin{example}\label{exam-spherical} Consider the longest involution $w_0=-1$ in $W(E_7)$. Note that $w_0\rho(E_7)=[-1,-1,-1,-1,-1,-1,-1]$. Carrying out the first step above leaves us with $116$ candidate representations. Only the $\lambda=[\frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1]$ produces a unitary representation. It has a unique spin-lowest $K$-type $[1,0,1,2,0,2,0]$ whose spin norm equals to $\|2\lambda\|$. Moreover, it occurs exactly once. This is the 21st entry of Table \ref{table-E7-scattered-part-2}. \hfill\qed \end{example} \section{String limits} This section aims to explain the last columns of Tables \ref{table-E7-scattered-part-1} and \ref{table-E7-scattered-part-2}. \begin{example}\label{ex-string-limit-E6-first} The first row of \cite[Table 6]{D2} gives a scattered member of $\widehat{E}_6^{\mathrm{d}}$ with $s=s_4 s_5 s_6 s_5 s_1 s_3 s_2 s_4 s_1$ and $\lambda=[1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1]$. Note that $s\rho(E_6)=[-2,5,6,-7, 6, -2]$. This scattered representation in $\widehat{E}_6^{\mathrm{d}}$ produces the following string in $\widehat{E}_7^{\mathrm{d}}$: \begin{equation}\label{string-E6-first} J(\lambda^\prime, -s\lambda^\prime), \quad \lambda^\prime=[1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1, \frac{g}{2}], \end{equation} where $g\in\mathbb{P}$. Note that $$ \lambda^\prime + s \lambda^\prime=[0, 4, 4, -4, 4, 0, g+2], \quad \lambda^\prime - s \lambda^\prime=[2, -3, -3, 5, -3, 2, -2]. $$ If we set $g=-1$, the corresponding representation is no longer a member of the string. However, $s_7 ([1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1, -\frac{1}{2}])=[1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$; moreover, if we set $s^\prime=s_7 s s_7^{-1}$, then $s^\prime$ is an involution of $W(E_7)$ such that $I(s^\prime)$ is empty and that $s^\prime \rho(E_7)=[-2, 6, 7, -8, 6, 1, -3]$. One sees that $s^\prime$ and $[1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$ give the first row of Table \ref{table-E7-scattered-part-1}. Therefore, we may view the first entry of Table \ref{table-E7-scattered-part-1} (see Example \ref{exam-E7-first-scattered}), a scattered member of $\widehat{E}_7^{\mathrm{d}}$, as a limit of the above string $J(\lambda^\prime, -s\lambda^\prime)$, whose underlying representation is a scattered member of $\widehat{E}_6^{\mathrm{d}}$. Let us see how to realize the above things in \texttt{atlas}. \begin{verbatim} set G=complex(simply_connected (E7)) set x=KGB(G,2903039) set q=parameter(x,[0,4,4,-4,4,1,-1, 0,0,0,0,0,0,0], [2,-3,-3,5,-3,0,2, 0,0,0,0,0,0,0]) set p=monomials(finalize(q))[0] p Value: final parameter(x=17376,lambda=[2,-2,-2,4,-2,0,2,2,0,0,2,0,1,1]/1, nu=[2,-3,-3,5,-3,0,2,2,-3,-3,5,-3,0,2]/2) \end{verbatim} The representation \texttt{p} is the first entry of Table \ref{table-E7-scattered-part-1}. \begin{verbatim} set q1=parameter(x,[0,4,4,-4,4,0,3, 0,0,0,0,0,0,0], [2,-3,-3,5,-3,2,-2, 0,0,0,0,0,0,0]) set p1=monomials(finalize(q1))[0] p1 Value: final parameter(x=6951,lambda=[2,-1,-1,3,-2,2,-1,2,0,0,2,0,1,1]/1, nu=[2,-3,-3,5,-3,2,-2,2,-3,-3,5,-3,2,-2]/2) \end{verbatim} The representation \texttt{p1} is the string member with $g=1$. \begin{verbatim} set (Q,pp1)=reduce_good_range(p1) Q Value: ([0,1,2,3,4,5,7,8,9,10,11,12],KGB element #6951) pp1 Value: final parameter(x=2670,lambda=[2,-1,-1,3,-2,2,-10,2,0,0,2,0,1,-8]/1, nu=[2,-3,-3,5,-3,2,-2,2,-3,-3,5,-3,2,-2]/2) \end{verbatim} Let us move the inducing module from $g=1$ to $g=-1$, and then do cohomological induction. \begin{verbatim} set ppm1=parameter(x(pp1),lambda(pp1)-[0,0,0,0,0,0,2,0,0,0,0,0,0,0],nu(pp1)) goodness(ppm1,G) Value: "Fair" set ind=theta_induce_irreducible(ppm1,G) ind Value: 1*parameter(x=17376,lambda=[2,-2,-2,4,-2,0,2,2,0,0,2,0,1,1]/1, nu=[2,-3,-3,5,-3,0,2,2,-3,-3,5,-3,0,2]/2) [411] monomials(ind)[0]=p Value: true \end{verbatim} Thus the induced module is irreducible, and it is exactly the representation \texttt{p}. \hfill\qed \end{example} For convenience, we simply say that the first entry of Table \ref{table-E7-scattered-part-1} is a \textbf{string limit} coming from the first scattered representation of $E_6$ with $g=-1$. \begin{example}\label{ex-string-limit-E6-last} The last row of \cite[Table 6]{D2} is the trivial representation of complex $E_6$. Namely, we have that $s\rho(E_6)=[-1,-1,-1,-1,-1,-1]$ and $\lambda=[1, 1, 1, 1, 1, 1]$. It produces the following string in $\widehat{E}_7^{\mathrm{d}}$: \begin{equation}\label{string-E6-last} J(\lambda^\prime, -s\lambda^\prime), \quad \lambda^\prime=[1, 1, 1, 1, 1, 1, \frac{g}{2}], \end{equation} where $g\in\mathbb{P}$. Note that $$ \lambda^\prime + s \lambda^\prime=[0, 0, 0, 0, 0, 0, g+16], \quad \lambda^\prime - s \lambda^\prime=[2, 2, 2, 2, 2, 2, -16]. $$ This string produces the following eight limits in total: \begin{itemize} \item[$\bullet$] $g=-1$, the 8th entry of Table \ref{table-E7-scattered-part-2}; \item[$\bullet$] $g=-3$, the 9th entry of Table \ref{table-E7-scattered-part-2}; \item[$\bullet$] $g=-5$, the 11th entry of Table \ref{table-E7-scattered-part-2}; \item[$\bullet$] $g=-7$, the 13th entry of Table \ref{table-E7-scattered-part-2}; \item[$\bullet$] $g=-9$, the 14th entry of Table \ref{table-E7-scattered-part-2}; \item[$\bullet$] $g=-11$, the 16th entry of Table \ref{table-E7-scattered-part-2}; \item[$\bullet$] $g=-13$, the 17th entry of Table \ref{table-E7-scattered-part-2}; \item[$\bullet$] $g=-15$, the 20th entry of Table \ref{table-E7-scattered-part-2}. \end{itemize} Note that in each case, the inducing module is in the fair range. \hfill\qed \end{example} As recorded in the last columns of Tables \ref{table-E7-scattered-part-1} and \ref{table-E7-scattered-part-2}, we \emph{exhaust} all the string limits coming from the scattered representations of the $E_6$ factor, and the inducing module is always in the fair range. Similar things have been done for the $A_6$ and $D_6$ factor. Let us give a few more examples. \begin{example}\label{ex-string-limit-A6} The 13th row of Table \ref{table-A6-scattered-part} gives a scattered member of $\widehat{A}_6^{\mathrm{d}}$ with $s\rho(A_6)=[-2,-1,-1, -1,4,-5]$ and $\lambda=[1, 1, 1, 1,\frac{1}{2}, \frac{1}{2}]$. It produces the following string in $\widehat{E}_7^{\mathrm{d}}$: \begin{equation}\label{string-A6-13th} J(\lambda^\prime, -s\lambda^\prime), \quad \lambda^\prime=[1, \frac{b}{2}, 1, 1, 1, \frac{1}{2}, \frac{1}{2}], \end{equation} where $b\in\mathbb{P}$. Note that $$ \lambda^\prime + s \lambda^\prime=[0, b+9, 0, 0, 0, 4, -4], \quad \lambda^\prime - s \lambda^\prime=[2, -9, 2, 2, 2, -3, 5]. $$ This string gives the following three limits in total: \begin{itemize} \item[(a)] $b=-1$, the 17th entry of Table \ref{table-E7-scattered-part-1}; \item[(b)] $b=-3$, the 24th entry of Table \ref{table-E7-scattered-part-1}; \item[(c)] $b=-20$, the 18th entry of Table \ref{table-E7-scattered-part-1}. \end{itemize} Note that both (a) and (b) are also string limits coming from the $E_6$ factor, while (c) is not. Moreover, the inducing module for (c) is not in the fair range. The 13th row of Table \ref{table-A6-scattered-part} is marked with a star, meaning that it has a dual representation. Indeed, it is a scattered member of $\widehat{A}_6^d$ such that $s^*\rho(A_6)=[-5,4,-1,-1,-1,-2]$ and $\lambda^*=[\frac{1}{2}, \frac{1}{2}, 1, 1, 1, 1]$. It produces the following string in $\widehat{E}_7^{\mathrm{d}}$: \begin{equation}\label{string-A6-13th-dual} J(\lambda^{\prime\prime}, -s^*\lambda^{\prime\prime}), \quad \lambda^{\prime\prime}=[\frac{1}{2}, \frac{b}{2}, \frac{1}{2}, 1, 1, 1, 1], \end{equation} where $b\in\mathbb{P}$. Note that $$ \lambda^{\prime\prime} + s^* \lambda^{\prime\prime}=[-4, b+8, 4, 0, 0, 0, 0], \quad \lambda^{\prime\prime} - s^* \lambda^{\prime\prime}=[5, -8, -3, 2, 2, 2, 2]. $$ This string gives the following three limits in total: \begin{itemize} \item[(a')] $b=-1$, the representation (c); \item[(b')] $b=-18$, the representation (b); \item[(c')] $b=-20$, the representation (a). \end{itemize} Note that the inducing module for (a') is now in the fair range. \hfill\qed \end{example} \begin{example}\label{ex-string-limit-D6} The 19th row of Table \ref{table-D6-scattered-part} gives a scattered member of $\widehat{D}_6^{\mathrm{d}}$ with $s\rho(D_6)=[-2,4,-5,4,-6,-2]$ and $\lambda=[1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1]$. It produces the following string in $\widehat{E}_7^{\mathrm{d}}$: \begin{equation}\label{string-D6-19th} J(\lambda^\prime, -s\lambda^\prime), \quad \lambda^\prime=[\frac{a}{2}, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1], \end{equation} where $a\in\mathbb{P}$. This string gives no limit. On the other hand, the dual representation has $s^*\rho(D_6)=[-2,4,-5,4,-2,-6]$ and $\lambda^*=[1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1, \frac{1}{2}]$. It produces the following string in $\widehat{E}_7^{\mathrm{d}}$: \begin{equation}\label{string-D6-19th-dual} J(\lambda^{\prime\prime}, -s^*\lambda^{\prime\prime}), \quad \lambda^{\prime\prime}=[\frac{a}{2}, \frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1], \end{equation} where $a\in\mathbb{P}$. Note that $$ \lambda^{\prime\prime} + s^* \lambda^{\prime\prime}=[a+8, -3,0,3,-3,3,0], \quad \lambda^{\prime\prime} - s^* \lambda^{\prime\prime}=[-8,4,2,-2,4,-2,2]. $$ When $a=-1$, this string gives the 31st entry of of Table \ref{table-E7-scattered-part-1}. \hfill\qed \end{example} \begin{example}\label{ex-string-limit-D5A1} Consider the maximal Levi obtained by removing the simple root $\alpha_6$. Put trivial representations on both the $D_5$ factor and the $A_1$ factor. Correspondingly, we have the string $J(\lambda, -s\lambda)$ in $\widehat{E}_7^{\mathrm{d}}$ such that \begin{equation} \lambda+s\lambda=[0, 0, 0, 0, 0, 2 f + 11, 0], \quad \lambda+s\lambda=[2, 2, 2, 2, 2, -11, 2] \end{equation} where $f\in\mathbb{P}$. This string gives the following three limits in total: \begin{itemize} \item[(a)] $f=-1$, the 28th entry of Table \ref{table-E7-scattered-part-1}; \item[(b)] $f=-3$, the 36th entry of Table \ref{table-E7-scattered-part-1}; \item[(c)] $f=-5$, the last entry of Table \ref{table-E7-scattered-part-1}. \end{itemize} We may also put the scattered representation of $\widehat{D}_5^d$ sitting in the second row of \cite[Table 5]{D2}, and put the trivial representation on the $A_1$ factor. They produce the string $J(\lambda', -s'\lambda')$ in $\widehat{E}_7^{\mathrm{d}}$ such that \begin{equation} \lambda'+s'\lambda'=[4, 0, -4, 4, 0, 2 f +4 , 0], \quad \lambda'+s'\lambda'=[-3, 2, 5, -3, 2, -4, 2]. \end{equation} where $f\in\mathbb{P}$. Setting $f=-1$ gives the third entry of Table \ref{table-E7-scattered-part-1}. \hfill\qed \end{example} \medskip \begin{table} \centering \caption{The scattered representations in $\widehat{E}_7^{\mathrm{d}}$ (part one)} \begin{tabular}{r|c|c|c|c} $s\rho$ & $\lambda$ & spin LKT & mult & string limits \\ \hline $[-2,6,7,-8,6,1,-3]$ & $[1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$ & $[1, 1, 0, 2, 1, 1, 1]$ & $1$ & $E_6$, 1st, $g=-1$\\ $[-2,6,7,-8,7,-1,-2 ]$ & $[1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1, 1]$ & $[1,1,0,4,0,0,1]$ & $1$ &$A_2.A_1.A_3$, $d=-1$\\ $[6,-2,-8,6,5,-6,4 ]$ & $[\frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$ & $[1,1,2,1,0,2,1 ]$ & $1$ & $D_5$ 2nd.$A_1$, $f=-1$\\ $[-5,-7,3,5,5,-7,5 ]$ & $\frac{\rho}{2}$ & $\rho$ & $1$ & $A_6$, 4th, $b=-1$ \\ $[-4,-2,3,7,-9,8,-2 ]$ & $[\frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1 ]$ & $[2,1,0,1,3,0,1 ]$ & $1$ & $D_6$, 3rd*, $a=-1$\\ $[-2,-8,-2,7,6,-7,5 ]$ & $[1, \frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2} ]$ & $[1,4,1,0,0,3,1]$ & $1$ & $A_6$, 6th, $b=-1$\\ $[-1,-1,-2,9,-10,9,-2 ]$ & $[1,1,1,\frac{1}{2}, \frac{1}{2}, \frac{1}{2},1]$ & $[0,0,1,0,6,0,1 ]$ & $1$ & $A_4.A_2$, $e=-1$\\ $[8,-2,-10,9,-2,4,-5 ]$ & $[\frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}]$ & $[1,1,4,0,1,0,3]$ & $1$ & $E_6$, 4th*, $g=-1$\\ $[-6,-9,4,8,-2,4,-6 ]$ & $[\frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2} ]$ & $[2,3,1,0,1,1,2 ]$ & $1$ & $A_6$, 8th, $b=-1$\\ $[-8,-1,6,-1,8,-10,8 ]$ & $[\frac{1}{2},1,\frac{1}{2},1,\frac{1}{2},\frac{1}{2},\frac{1}{2}]$ & $[4,0,1,0,1,4,1]$ & $1$ & $D_6$, 8th, $a=-1$\\ $[-2,5,4,-6,10,-12,10 ]$ & $[1, \frac{1}{2},\frac{1}{2},\frac{1}{2}, \frac{1}{2},\frac{1}{2},\frac{1}{2}]$ & $[1,0,1,1,2,1,1]$ & $1$ & $E_6$, 4th, $g=-1$\\ $[9,-1,-11,9,1,-3,-1 ]$ & $[\frac{1}{2},1, \frac{1}{2},\frac{1}{2},\frac{1}{2}, \frac{1}{2},1]$ & $[1,2,3,0,1,0,2]$ & $1$ & $E_6$, 4th*, $g=-3$\\ $[-6,-10,5,8,1,-3,-2]$ & $[\frac{1}{2},\frac{1}{2},\frac{1}{2}, \frac{1}{2},\frac{1}{2},\frac{1}{2},1]$ & $[1,2,2,0,1,1,1 ]$ & $1$ & $E_6$, 5th*, $g=-1$\\ $[-11,5,9,-7,5,5,-7]$ & $\frac{\rho}{2}$ & $\rho$ & $1$ & $E_6$, 7th, $g=-1$\\ $[9,-1,-11,10,-1,-2,-1]$ & $[\frac{1}{2},1,\frac{1}{2},\frac{1}{2},1,1,1]$ & $[1,0,7,0,0,1,0 ]$ & $1$ & $A_1.A_5$, $c=-1$\\ $[-1,-1,-6,4,9,-11,9 ]$ & $[1, 1, \frac{1}{2},\frac{1}{2}, \frac{1}{2},\frac{1}{2}, \frac{1}{2}]$ & $[2,0,2,0,1,3,1 ]$ & $1$ & $D_6$, 8th, $a=-3$\\ $[-2,-12,-1,10,-1,5,-6 ]$ & $[1, \frac{1}{2}, 1, \frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}]$ & $[1,6,0,1,0,0,4 ]$ & $1$ & $E_6$, 8th, $g=-1$\\ $[-6,-10,5,9,-1,-2,-2 ]$ & $[\frac{1}{2},\frac{1}{2}, \frac{1}{2},\frac{1}{2}, 1,1,1 ]$ & $[4,6,0,0,0,1,1 ]$ & $1$ & $A_6$, 13th*, $b=-1$\\ $[-9,7,7,-9,7,5,-7 ]$ & $\frac{\rho}{2}$ & $\rho$ & $1$ & $E_6$, 9th, $g=-1$\\ $[-2,9,8,-10,8,-10,8 ]$ & $[1,\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2} ]$ & $[1,0,1,1,2,1,1]$ & $1$ & $A_4.A_2$, $e=-3$\\ $[-10,-1,8,4,-6,8,-10 ]$ & $[\frac{1}{2},1, \frac{1}{2}, \frac{1}{2},\frac{1}{2}, \frac{1}{2},\frac{1}{2}]$ & $[2,0,1,1,1,2,1 ]$ & $1$ & $E_6$, 6th, $g=-3$\\ $[ -1,-13,-2,11,3,-4,-1]$ & $[1, \frac{1}{2}, 1, \frac{1}{2},\frac{1}{2}, \frac{1}{2},1]$ & $[2,5,0,1,0,0,3 ]$ & $1$ & $E_6$, 8th, $g=-3$\\ $[-10,-1,8,6,-8,6,-8 ]$ & $[\frac{1}{2}, 1, \frac{1}{2},\frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$ & $[2,0,1,1,1,2,1 ]$ & $1$ & $D_6$, 14th, $g=-1$\\ $[-2,-1,9,-11,9,6,-7 ]$ & $[1,1, \frac{1}{2},\frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2} ]$ & $[1,3,0,2,0,0,3 ]$ & $1$ & $E_6$, 11th, $g=-1$\\ $[ -12,8,11,-9,7,-2,-2]$ & $[\frac{1}{2},\frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2},1,1 ]$ & $[1,0,4,0,1,1,1]$ & $1$ & $D_6$, 11th, $a=-3$ \\ $[1,-3,-3,1,11,-13,11 ]$ & $\frac{\rho}{2}$ & $\rho$ & $1$ & $E_6$, 4th, $g=-3$\\ $[-10,10,9,-11,9,-2,-2 ]$ & $[\frac{1}{2},\frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2},1,1 ]$ & $[1,0,4,0,1,1,1 ]$ & $1$ & $A1.A5$, $c=-3$\\ $[-1,-2,-1,-1,12,-13,11 ]$ & $[1,1,1,1,\frac{1}{2},\frac{1}{2}, \frac{1}{2} ]$ & $[0,1,0,0,0,9,1]$ & $1$ & $D_5.A_1$, $f=-1$\\ $[ -1,-14,-1,13,-2,-1,-1]$ & $[1, \frac{1}{2}, 1, \frac{1}{2}, 1, 1, 1]$ & $[0,10,0,0,1,0,0 ]$ & $1$ & $A_6$, $b=-1$\\ $[-12,-2,11,-1,-1,8,-10 ]$ & $[\frac{1}{2}, 1, \frac{1}{2}, 1, 1, \frac{1}{2}, \frac{1}{2} ]$ & $[8,1,0,0,0,1,6 ]$ & $1$ & $D_6$, 17th, $a=-1$\\ $[-14,-7,12,5,-6,4,-2]$ & $[\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},1 ]$ & $[1,0,2,1,1,1,1 ]$ & $1$& $D_6$, 19th*, $a=-1$\\ $[-1,-2,12,-13,12,-2,-1]$ & $[1,1,\frac{1}{2},\frac{1}{2},\frac{1}{2},1,1 ]$ & $[0,7,0,0,2,0,0 ]$ &$1$ & $A_6$, $b=-3$\\ $[-1,-1,-11,9,-1,9,-11 ]$ & $[1,1,\frac{1}{2},\frac{1}{2},1,\frac{1}{2},\frac{1}{2} ]$ & $[6,2,0,0,0,1,5 ]$ & $1$&$D_6$, 17th, $a=-3$\\ $[-1,-2,-1,9,-11,13,-14 ]$ & $[1,1,1,\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2} ]$ & $[ 0,1,0,1,0,6,1]$ & $1$&$E_6$, 13th, $g=-3$\\ $[-13,-2,12,-1,6,-8,-1]$ & $[\frac{1}{2},1,\frac{1}{2},1,\frac{1}{2},\frac{1}{2},1 ]$ & $[7,1,0,0,0,2,4 ]$ &$1$ & $D_6$, 20th, $a=-1$\\ $[-1,-2,-1,11,-13,11,-12]$ & $[1,1,1,\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2} ]$ & $[0,1,0,1,0,6,1 ]$ & $1$ & $D_5.A_1$, $f=-3$\\ $[-1,-1,-12,10,7,-9,-1 ]$ & $[1,1,\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},1 ]$ & $[ 5,2,0,0,0,2,3]$ & $1$& $D_6$, 20th, $a=-3$\\ $[-14,-2,13,4,-6,-1,-1]$ & $[\frac{1}{2},1,\frac{1}{2},\frac{1}{2},\frac{1}{2},1,1 ]$ & $[6,1,0,0,0,3,2 ]$ & $1$ & $D_6$, 21st, $a=-1$\\ $[-2,8,-1,-9,7,10,-12 ]$ & $[1,\frac{1}{2},1,\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2} ]$ & $[4,3,0,0,0,1,4 ]$ & $1$ &$D_6$, 17th, $a=-5$\\ $[-1,7,7,-9,-1,13,-15 ]$ & $[1,\frac{1}{2},\frac{1}{2},\frac{1}{2},1,\frac{1}{2},\frac{1}{2} ]$ & $[0,2,0,1,0,4,2 ]$ & $1$ &$E_6$, 13th, $g=-5$\\ $[-17,1,15,-3,1,-3,1 ]$ & $\frac{\rho}{2}$ & $\rho$ & $1$ & $D_6$, 22nd, $a=-1$\\ $[11,-2,-12,11,-13,11,-2 ]$ & $[\frac{1}{2},1,\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},1 ]$ & $[0,4,1,0,2,0,1 ]$ & $1$ & $A_6$, $b=-5$\\ $[-1,8,7,-9,11,-13,-2 ]$ & $[1,\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},1 ]$ & $[0,1,0,2,0,3,1]$ & $1$ &$E_6$, 15th*, $g=-5$\\ $[-1,10,9,-11,9,-11,-2 ]$ & $[1,\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},1 ]$ & $[0,1,0,2,0,3,1]$ & $1$ & $D_5.A_1$, $f=-5$ \end{tabular} \label{table-E7-scattered-part-1} \end{table} \begin{table} \centering \caption{The scattered representations in $\widehat{E}_7^{\mathrm{d}}$ (part two)} \begin{tabular}{r|c|c|c|c} $s\rho$ & $\lambda$ & spin LKT & mult & string limits\\ \hline $[-17,-1,15,-1,-1,-1,-1]$ & $[\frac{1}{2},1,\frac{1}{2},1,1,1,1]$ & $[13,0,1,0,0,0,0]$ &$1$ & $D_6$, $a=-1$\\ $[4,-6,-6,4,-1,14,-16]$ & $[\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},1,\frac{1}{2},\frac{1}{2}]$ & $[ 1,2,0,1,0,3,2]$ & $1$ & $E_6$, 13th, $g=-7$\\ $[-1,-1,-16,14,-1,-1,-1]$ & $[1, 1, \frac{1}{2}, \frac{1}{2}, 1, 1, 1]$ & $[10,0,2,0,0,0,0 ]$ &$1$ & $D_6$, $a=-3$\\ $[4,-7,-6,5,12,-14,-2 ]$ & $[\frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1 ]$ & $[1,1,0,2,0,2,1]$ & $1$&$E_6$, 15th*, $g=-7$\\ $[-11,9,9,-11,9,-11,9 ]$ & $\frac{\rho}{2}$ & $\rho$ & $1$ & $A_6$, $b=-7$\\ $[-3,-1,1,-3,1,15,-17 ]$ & $[\frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2} ]$ & $[2,2,0,1,0,2,2]$ & $1$ & $E_6$, 13th, $g=-9$\\ $[-1,13,-1,-15,13,-1,-1 ]$ & $[1,\frac{1}{2},1,\frac{1}{2},\frac{1}{2},1,1]$ & $[7,0,3,0,0,0,0 ]$ &$1$ & $D_6$, $a=-5$\\ $[-2,-1,-1,-1,-1,16,-17 ]$ & $[ 1,1,1,1,1, \frac{1}{2},\frac{1}{2}]$ & $[1,0,0,0,0,0,15 ]$ & $1$ & $E_6$, $g=-1$\\ $[-1,-1,-2,-1,15,-16,-1 ]$ & $[ 1, 1, 1, 1, \frac{1}{2},\frac{1}{2}, 1]$ & $[2,0,0,0,0,0,13 ]$ &$1$ & $E_6$, $g=-3$ \\ $[-1,-13,-1,11,-13,11,-1 ]$ & $[1, \frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1 ]$ & $[5,0,3,0,0,1,0]$ & $1$ & $D_6$, $a=-7$\\ $[-1,-1,-1,13,-15,-1,-1]$ & $[1, 1, 1, \frac{1}{2},\frac{1}{2}, 1, 1]$ & $[ 3,0,0,0,0,0,11]$ &$1$ & $E_6$, $g=-5$\\ $[-1,-1,9,-11,9,-11,9 ]$ & $[1, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$ & $[3,0,3,0,0,2,0]$ & $1$&$D_6$, $a=-9$\\ $[-1,11,12,-13,-1,-2,-1 ]$ & $[1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1, 1, 1 ]$ & $[4,0,0,0,0,0,9]$ & $1$& $E_6$, $g=-7$\\ $[10,-10,-11,9,-1,-2,-2]$ & $[\frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1, 1, 1 ]$ & $[4,0,0,0,0,1,7]$ & $1$ & $E_6$, $g=-9$\\ $[6,-1,-8,6,-8,6,-8 ]$ & $[\frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$ & $[2,0,2,1,0,2,0]$ & $1$ &$D_6$, $a=-11$\\ $[-9,-1,7,-8,6,-1,-2 ]$ & $[\frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1, 1]$ & $[4,0,0,0,0,2,5]$ & $1$ & $E_6$, $g=-11$\\ $[-1,-2,-6,4,-5,4,-2 ]$ & $[1,1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1]$ & $[4,0,0,0,0,3,3]$ & $1$ & $E_6$, $g=-13$\\ $[-5,3,3,-5,3,-5,-1 ]$ & $[\frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1]$ & $[1,0,1,2,0,2,0]$ & $1$ &$D_6$, $a=-13$\\ $[-1,1,-1,-3,1,-3,1 ]$ & $\frac{\rho}{2}$ & $\rho$ & $1$ & \\ $[-1,1,-1,-3,1,-3,1 ]$ & $[1, \frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2} ]$ & $[4,0,0,0,0,4,1]$ & $1$& $E_6$, $g=-15$\\ $-\rho$ & $[\frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1]$ & $[1,0,1,2,0,2,0]$ & $1$ &\\ $-\rho$ & $\rho$ & [0,0,0,0,0,0,0] & $1$ & \end{tabular} \label{table-E7-scattered-part-2} \end{table} Note that there are three scattered representations of complex $E_7$ which can not be realized as string limits. Namely, the 19th, 21st and 22nd entries of Table \ref{table-E7-scattered-part-2}. They are all unipotent representations. We will look at them more carefully in the next section. By the way, we note that for complex $E_6$, only the two \emph{spherical} scattered representations can \emph{not} be realized as string limits: the model representation \cite{Mc}, and the trivial representation. \section{Unipotent representations} \label{sec-unip} The following representations are discussed in McGovern \cite{Mc}: \begin{itemize} \item[(i)] $J(\frac{\rho}{2}, \frac{\rho}{2})$ (the 1st entry of \cite[Table 10]{Mc}); \item[(ii)] $J(\frac{\rho}{2}, [\frac{1}{2}, -\frac{1}{2}, \frac{1}{2}, \frac{3}{2}, -\frac{1}{2}, \frac{3}{2}, -\frac{1}{2}])$ (cf. $Q'$ in the proof of \cite[Theorem 2.2]{Mc}); \item[(iii)] $J(\lambda, \lambda)$ with $\lambda=[\frac{1}{2}, \frac{1}{2},\frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1]$ (the 2nd entry of \cite[Table 10]{Mc}); \item[(iv)] $J(\lambda, \lambda)$ with $\lambda=[1, \frac{1}{2}, 1, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$ (the 3rd entry of \cite[Table 10]{Mc}); \item[(v)] $J(\lambda, \lambda)$ with $\lambda=[1,1,1,0,1,0, 1]$ (the 4th entry of \cite[Table 10]{Mc}); \item[(vi)] $J(\lambda, \lambda)$ with $\lambda=[1,1,1,0,1,1, 1]$ (the minimal representation); \item[(vii)] $J(\rho, \rho)$, the trivial representation. \end{itemize} These representations are all unipotent in the sense of Losev, Mason-Brown and Matvieievskyi (\cite{LMM}, \cite{MM}). In particular, if $\lambda$ is integral, then they are special unipotent in the sense of \cite{BV}. All of them are unitary (David Vogan helped us with the representation (v), which used about 290 GB memory in \texttt{atlas}). However, (i) and (iv) have zero Dirac cohomology since neither $\rho$ nor $[2, 1, 2, 1, 1, 1, 1]$ lies in the root lattice of $E_7$, while (v) and (vi) also have zero Dirac cohomology since $\lambda$ is singular. The remaining three representations are all Dirac series. Indeed, (ii), (iii), (vii) are the 19th, 21st and 22nd entries of Table \ref{table-E7-scattered-part-2}, respectively. Let us summarize the discussions as the following. \begin{cor}\label{cor-main} Any Dirac series of complex $E_7$ is either a unipotent representation, or cohomologically induced from a unipotent representation with non-zero Dirac cohomology in the fair range. \end{cor} \section{Calculations of Spin Lowest $K$-types} We mention some calculations on the spin lowest $K$-types $\sigma$ in Table \ref{table-E7-scattered-part-2}. It is easy to check that all of them satisfy $\|\sigma\|_{\mathrm{spin}} = \|\Lambda\| = \|2\lambda\|$. Firstly, let us handle the cases that $J(\lambda,-s\lambda) \in \widehat{G}^d$ can be realized as a string limit. In such a case, it suffices to check that \begin{equation}\label{string-limit-spinLKT} [V(\sigma) : J(\lambda,-s\lambda)] > 0. \end{equation} Indeed, the branching result in \cite{BDW} implies that $\sigma$ must be the unique the spin lowest and it must occur exactly once. Usually, one can us the $\texttt{atlas}$ command $\texttt{branch\_irr}$ to check \eqref{string-limit-spinLKT} directly. However, for a few representations, such a direct calculation in \texttt{atlas} would be time-consuming. Let us mention some ways that are more effective. \subsection*{$\bullet$ $E_6$, $g = -15$ (the 20th entry of Table \ref{table-E7-scattered-part-2})} This representation \texttt{p} has LKT $[0,0,0,0,0,0,1]$ whose height is $27$, while the $K$-type $[4, 0, 0, 0, 0, 4, 1]$ has height $371$. Instead of doing \texttt{branch\_irr(p, 371)}, we do \texttt{branch\_irr(p, 235)} and find that the $K$-type $[0, 0, 0, 0, 0, 4, 1]$ shows up in \texttt{p} exactly once. Using Vogan pencil, we conclude that the $K$-type $$ \sigma:=[0, 0, 0, 0, 0, 4, 1]+ 4 \beta=[4, 0, 0, 0, 0, 4, 1] $$ shows up in \texttt{p}, as desired. It is interesting to note that if we look at the representations $E_6$, $g=-1, -3, \dots, -15$ consecutively, the spin LKTs still demonstrate a vague pattern, whilst the pattern is described explicitly in \cite{DW2} for all classical groups. There are cases that we can not move \emph{down} from the desired spin LKT along the Vogan pencil. Then the following clever way (suggested by David Vogan) could be helpful to get the multiplicity of $\sigma$ in $ J(\lambda,-s\lambda)$. \subsection*{$\bullet$ $D_6$, $a = -13$ (the 18th entry of Table \ref{table-E7-scattered-part-2})} Here $J(\lambda,-s\lambda) = {\rm Ind}_{D_6 \times \mathbb{C}^*}^{E_7}(\mathrm{triv} \boxtimes \det^2)$ with lowest $K$-type $2\beta=[2,0,0,0,0,0,0]$. As mentioned above, it suffices to check $$ [V([1,0,1,2,0,2,0]): {\rm Ind}_{D_6 \times \mathbb{C}^*}^{E_7}(\mathrm{triv} \boxtimes \det^2)] > 0. $$ Using Frobenius reciprocity, it is equivalent to show that \begin{equation} \label{eq-branch1} [\mathrm{triv} \boxtimes \mathbb{C}_{2\beta} : V([1,0,1,2,0,2,0])|_{D_6 \times \mathbb{C}^*}] >0. \end{equation} The branching $V([1,0,1,2,0,2,0])|_{D_6 \times \mathbb{C}^*}$ can be done as follows: $V([1,0,1,2,0,2,0])$ defines a finite-dimensional $(\mathfrak{e}_7, D_6 \times A_1)$-module for the quarterionic real form \texttt{E7\_q}, so the $K$-types of this finite-dimensional module are precisely the branching of $V([1,0,1,2,0,2,0])$ to $D_6 \times A_1$. The following \texttt{atlas} command gives the finite-dimensional module $V([1,0,1,2,0,2,0])$ and its dimension. \begin{verbatim} set G=E7_q set p=parameter(x_open(G),[1,0,1,2,0,2,0]+rho(G),[1,0,1,2,0,2,0]+rho(G)) dimension(p) Value: 2399133156669849600 \end{verbatim} Branching of the module \texttt{p} into $D_6 \times A_1$-modules could cost a lot of time. However, it is easy to see that it starts as follows: \begin{verbatim} print_branch_irr_long(p,KGB(G,62),40) m x lambda hw dim height 1 20 [ 0, 0, 0, 0, 0, 0, 1 ]/1 [ 1, 0, 0, 0, 0, 0, 0 ] 3 27 1 337 [ 1, 0, -1, 1, -1, 1, 0 ]/1 [ 2, 0, 0, 0, 0, 0, 0 ] 5 38 \end{verbatim} with the last 6 coordinates of \texttt{hw} are the highest weights of the $D_6$-module in the decomposition. Therefore, $$ V([1,0,1,2,0,2,0])|_{D_6 \times A_1} = (\mathrm{triv} \boxtimes \mathbb{C}^3) \oplus (\mathrm{triv} \boxtimes \mathbb{C}^5) \oplus \cdots. $$ Here $\bbC^3$ means the 3-dimensional irreducible representation of $A_1$. Thus the restriction $$ V([1,0,1,2,0,2,0])|_{D_6 \times \mathbb{C}^*} $$ decomposes as $$ \left(\mathrm{triv} \boxtimes (\mathbb{C}_{\beta} \oplus \mathbb{C}_0 \oplus \mathbb{C}_{-\beta})\right) \oplus \left(\mathrm{triv} \boxtimes (\mathbb{C}_{2\beta} \oplus \mathbb{C}_{\beta} \oplus \mathbb{C}_0 \oplus \mathbb{C}_{-\beta} \oplus \mathbb{C}_{-2\beta})\right) \oplus \cdots $$ and \eqref{eq-branch1} has multiplicity $ > 0$, as desired. We have also handled the 12th and 15th entry of Table \ref{table-E7-scattered-part-2} in this way. Secondly, let us determine the spin lowest $K$-types of the two unipotent representations. \subsection*{$\bullet$ $J(\frac{\rho}{2}, [\frac{1}{2}, -\frac{1}{2}, \frac{1}{2}, \frac{3}{2}, -\frac{1}{2}, \frac{3}{2}, -\frac{1}{2}])$ (the 19th entry of Table \ref{table-E7-scattered-part-2})} As mentioned in the previous section, this is the unipotent representation $Q'$ appearing in the proof of \cite[Theorem 2.2]{Mc}, whose $K$-types have highest weights in the weight lattice \emph{but not in the root lattice}, all appearing with multiplicity one. In particular $\sigma = \rho$ appears in $Q'$, and this is the only $\sigma$ that satisfies $\{\sigma - \rho\} + \rho = 2\lambda = \rho $. \subsection*{$\bullet$$J(\lambda, \lambda)$, $\lambda=[\frac{1}{2}, \frac{1}{2},\frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}, 1]$ (the 21st entry of Table \ref{table-E7-scattered-part-2})} According to \cite[Table 10]{Mc}, it is conjectured that this unipotent representation would have $K$-types equal to $[a,0,b,c,0,d,0]$ with multiplicity one, where $a, b, c, d$ are non-negative integers. This can be verified by \cite{MM}, which states that this representation is \emph{the} quantization model for the birationally rigid orbit $\mathcal{O} = 3A_1'$, and hence its $K$-spectrum is equal to the ring of regular functions of $\mathcal{O}$. Then the conjecture follows from the results of \cite{C}. It is then easy to check that $[1,0,1,2,0,2,0]$ is the \emph{unique} spin lowest $K$-type in $J(\lambda, \lambda)$. It is also worth noting that this unipotent module, along with the module with string limit $D_6$, $a = -13$ (the 18th entry of Table \ref{table-E7-scattered-part-2}), are the only composition factors of the end point of the complementary series in \cite[Equation (5.29)]{BP}, each occurring once. Hence both modules are unitary. \medskip \centerline{\scshape Acknowledgments} We are deeply grateful to the \texttt{atlas} mathematicians. We also thank Dr. Luan for helping us considering the branching \eqref{eq-branch1}. \medskip \centerline{\scshape Funding} Dong is supported by the National Natural Science Foundation of China (grant 12171344). Wong is supported by the National Natural Science Foundation of China (grant 11901491) and the Presidential Fund of CUHK(SZ).
\section{Introduction} Graphs can be used to represent complex dependencies between many variables. Graph-based analysis are used in many disciplines such as social networks analysis, natural language processing, chemistry, and bioinformatics. Real-world graphs can be large and expensive to store and communicate. Developing efficient methods to compress graphical data are of interest for storage and transmission of data. Classic information theory methods for coding deal with sequential data. Unlike sequential data with starting and stopping points (ordering), graphs are unordered structures. Since ordering is essential in coding, graph coding is challenging. This means that graphs cannot be efficiently compressed using traditional, sequence-based compression methods. In this paper, we first present new universal source coding methods for the lossless compression of unlabeled, unweighted, undirected, simple graphs. Since the graphs are unlabeled, vertices do not have distinct identifications except through their interconnections. Reference \cite{ChoiSzpankowski12} referred to such a graph as a graph \emph{structure}. Our approach has two steps. First, inspired by Steinruecken's method for coding of unordered i.i.d sequences \cite{Steinruecken15}, we transform a graph, $G$, into an equivalent rooted binary tree, $T$. Then, we use graph statistics from $G$ to develop two classes of coders for $T$. The first class utilizes local properties (i.e., formation of graph motifs) such as triangles and the second class uses degree distribution, as a global graph statistics, along with local properties for encoding. This step uses past information (encoded vertices) to encode the connections at the current vertex. This way we can build a probabilistic model based on graph statistics (either by learning or estimating statistics) to encode graphs. Our coders reflect more information about the structure of $G$ and therefore give shorter codelengths compared to structural coding of \cite{ChoiSzpankowski12} for graphs with more structure than \ER\ graphs. In the second half of the paper, we use graph coding for data analysis by using description length, which is the number of bits to describe data. Rissanen proposed using description length for model selection in his work on the minimum description length (MDL) \cite{Rissanen83, Rissanen78, Rissanen86}. Rissanen's MDL principle codifies model selection, which balances between how well a model describes the given data and the complexity of the model. Here, we develop a novel approach for model selection of Gaussian graphical models. We compute the description length of the conditional independence graph (the sparsity pattern of the precision matrix) using our lossless graph coding methods and the data under the assumed Gaussian distribution. The model that minimizes the summation of these two terms will be selected as the best model. Unlike other methods that may only consider the number of edges in conditional independence graph to account for model complexity, our approach considers the whole structure of the conditional independence graph by lossless compression. We showed using synthetic and real-world data the advantages of our methods for both compression and Gaussian graphical model selection. Our approach outperforms competing source coding methods in two different scenarios: 1) compression of a single real-world graph, 2) compression of a graph from a particular type after learning the statistics of its type through training. We also compared our approach with common methods in the literature for model selection in Gaussian graphical models. The experimental results on synthetic data showed that our approach can recover true graph model of data with higher F1-score. We also considered a real-world dataset containing extracted features from 12-lead electrocardiogram (ECG) signals of a group of healthy people and a group of people with Kawasaki disease. We observed that there is a difference between graph model of healthy people and those with Kawasaki disease. The paper is organized as follows. First, we provide an overview of previous works on universal compression methods for graphs in Section~\ref{PriorWork.sec}. In Section~\ref{Coding.sec}, we describe our approach for transforming a graph structure into a rooted binary tree and show that the compression of rooted binary tree is same as the compression of graph structure. Then, we introduce two classes of universal coders based on graph statistics and provide experimental results on synthetic and real-world graphs. In Section~\ref{GLASSO.sec}, we present the application of graph coding for model selection in Gaussian graphical models. We also give the performance results on synthetic data and then apply our approach to ECG data. We make concluding remarks and give some directions for future work in Section~\ref{Conclusion.sec}. \subsection{Prior Work \label{PriorWork.sec}} Graph compression is a relatively new area in source coding. References \cite{LuczakSzpankowski17,LuczakSzpankowski17b,AsadiAbbeVerdu17, delgosha2020graphical} focused on the entropy analysis of graph compression. Other papers have provided practical graph compression algorithms. These algorithms can be designed for the compression of either unlabeled graph (i.e., graph structure) or labeled graph (i.e., encoding vertices labels together with graph structure). In the case of unlabeled graph, the decoder recovers a graph that is isomorphic to the input graph. In the case of labeled graph, the decoder recovers the exact graph (i.e., graph structure with labels) at the expense of longer codewords. In other words, encoding of unlabeled graphs benefits from isomorphism since there are different labeled graphs that have the same structure. Fewer bits are required, in general, to encode an unlabeled graph compared to a labeled graph with the same structure \cite{ChoiSzpankowski12}. Reference \cite{ChoiSzpankowski12} was the first study to develop a compression algorithm to reach the entropy of the distribution on unlabeled \ER\ graphs up to the first two terms. In \cite{host2018coding}, two universal coding methods for arbitrary unlabeled graphs based on degree distribution and formation of triangles were introduced. The authors in \cite{luczak2019compression} presented asymptotically optimal structural compression algorithms for the compression of both unlabeled and labeled preferential attachment graphs. The compression of dynamic graphs generated by duplication model was studied in \cite{turowski2020compression}. The authors developed algorithms for the compression of both unlabeled and labeled versions of such graphs. Reference \cite{basu2018universal} introduced an algorithm for the compression of deep feedforward neural networks by modeling them as bipartite graph layers. An algorithm for the compression of sparse labeled graphs with marks on vertices and edges was introduced in \cite{delgosha2020universal}. A general survey on lossless graph compression methods can be found in \cite{besta2018survey}. Previous compression methods are tailored to specific graph models and can perform poorly on other graph models or real-world graphs. Our approach provides a method to encode arbitrary unlabeled graph structures by building a probabilistic model based on graph properties (e.g., graph motifs and degree distribution). This general approach extracts more information from the graph structure than prior work and results in shorter codelength compared to other source coding methods. The literature on model selection methods for Gaussian graphical models is rich. Existing methods can broadly fall into two main classes: information-based methods and resampling methods. Information-based methods, such as Bayesian information criteria (BIC) \cite{yuan2007model}, Akaike information criteria (AIC) \cite{menendez2010gene}, and extended Bayesian information criteria (EBIC) \cite{foygel2010extended}, select the best model based on the log-likelihood of the data and the complexity of Gaussian graphical model. To account for model complexity, these methods typically consider the number of edges from the conditional independence graph, $G$, induced by the Gaussian graphical model; while easy to obtain, this statistic gives only a rough approximation of the structure of $G$. In contrast, our approach for model selection is to choose the best model based on the description length of the $G$ and the data when encoded with the resulting conditional independence graph \cite{abolfazli2021graph}. Resampling methods measure the performance on out-of-sample data by splitting the data into into a subset of samples for fitting and use the remaining samples to estimate the efficacy of the model. The most common method in this class is cross-validation (CV) \cite{rothman2008sparse}. Other methods are Generalized Approximate Cross-validation (GACV) \cite{lian2011shrinkage}, Rotation Information Criterion (RIC) \cite{lysen2009permuted}, and Stability Approach to Regularization Selection (StARS) \cite{liu2010stability}. The major shortcoming of resampling methods is their high computational cost since they require to solve the problem across all sets of subsamples. A key aspect of model selection in Gaussian graphical models is the structure of the conditional independence graph. Resampling methods overlook this aspect while information-based methods only consider simple graph statistics such as the number of edges in the conditional independence graph. Our approach presents a different perspective to account for a more accurate model complexity. This relies on being able to compute the description length of the conditional independence graph, $G$, using our lossless graph compression methods. \section{\label{Coding.sec}Graph Compression} Consider an unweighted, undirected, simple, unlabeled graph $G(V,E)$, where $V$ is the set of vertices and $E$ is the set of edges. In this paper, we present a method to compress a graph structure inspired by Steinruecken's method for coding unordered i.i.d binary sequences \cite{Steinruecken15}. We use the terms compression and coding interchangeably in this paper as they denote the same process. One can see our methods as extension of \cite{ChoiSzpankowski12} to take into account more graph structure. The general idea is to randomly pick a vertex, $V_i \in V$, and encode information about all the incident edges of $V_i$. A neighbor of $V_i$ is then picked and the information about its incident edges are encoded. To implement this scheme, an unlabeled graph $G$ is transformed into a rooted binary tree $T$. Each level of $T$ associated with the vertex $V_i$ from $G$ to be encoded. An encoder is designed to encode $T$. A decoder will decode $T$ without error to recover $\widetilde{G}(V,E)$, which is identical to $G(V,E)$ up to an automorphism of the nodes. In this paper, we introduce two broad classes of graph coders to efficiently encode the rooted binary tree $T$. \subsection{Definitions and Notation} Let $V_i$ denote the $i$th vertex in $G$. We will exclusively use \emph{vertices} to refer to the nodes in $G$ and \emph{nodes} to refer to the nodes in $T$. The total number of vertices in G is $|V|$. Let $V_i \leftrightarrow V_j$ denote an edge between vertices $V_i$ and $V_j$ in $G$. The degree of vertex $V_i$ is the total number of vertices connected to $V_i$. The degree distribution $P(k)$ is the probability distribution of degrees of vertices in $G$ and is an often used statistics to differentiate between different classes of random graphs. The adjacency matrix of $G$ is shown by $A=[A_{ij}]$, a $|V|\times|V|$ matrix where $A_{ij}=1$ if there is an edge between $V_i$ and $V_j$ in $G$. The structure of the rooted binary tree $T$ is very important in the encoding process. We will divide the organization of $T$ into different levels (also known as depth). Let $[\ell, i]$ denote the $i$th node of the $\ell$-th level of $T$. Note that the root node is $[0,1]$. Figure~\ref{GtoT.fig} shows our naming convention for all the other nodes. A node in $T$ will can contain multiple vertices from $G$. The cardinality of the node $[\ell, i]$ is shown with $|[\ell, i]|$. By default, $|[0, 1]| = |V|$. \begin{defn} A node $[\ell, i]$ is a \emph{left node} if it is the left child of a node in level $\ell -1$. In our convention, left nodes have odd index value $i$. \end{defn} \begin{defn} A node $[\ell, i]$ is a \emph{right node} if it is the right child of a node in level $\ell -1$. In our convention, right nodes have even index value $i$. \end{defn} \begin{defn} For a level $\ell$, the \emph{first nonempty node} refers to node $[\ell, \alpha]$: \begin{equation}\label{fne.eq} [\ell, \alpha]= \begin{cases} [\ell, 1], \text{ if $|[\ell, 1]| > 0$}\\ [\ell, 2], \text{ otherwise}. \end{cases} \end{equation} \end{defn} Often times, we may wish to explicitly refer to the parent or children node of $[\ell, i]$. We use $[\ell, i].\node{parent}$ to refer to the parent node of $[\ell, i]$. We use $[\ell, i].\node{left}$ and $[\ell, i].\node{right}$ to refer to left and right child of node $[\ell, i]$. In the example tree shown in Figure~\ref{GtoT.fig}, node $[1,1] = [2, 1].\node{parent}$, node $[2,3] = [1,2].\node{left}$, and node $[2,4] = [1,2].\node{right}$. Let $\mathcal{R}([\ell, i])$ denote the path from node $[\ell, i]$ to the root node. We find levels where $\mathcal{R}([\ell, i])$ \emph{and} $\mathcal{R}([\ell, \alpha])$ both contain left nodes and store those levels in $\mathcal{CI}([\ell, i])$. We also find levels where $\mathcal{R}([\ell, i])$ \emph{or} $\mathcal{R}([\ell, \alpha])$ contain left nodes and store those levels in $\mathcal{I}([\ell, i])$. For example in Figure~\ref{GtoT.fig}, $\mathcal{R}([2,3]) = \{[2,3], [1,2], [0,1]\}$ and $\mathcal{R}([2,1]) = \{[2,1], [1,1], [0,1]\}$. We can see that $\mathcal{R}([2,3])$ and $\mathcal{R}([2,1])$ (node $[2,1]$ refer to $[2,\alpha]$) both have left nodes at level $\ell=2$ (i.e., nodes $[2,3]$ and $[2,1]$, respectively) and therefore, we get $\mathcal{CI}([2, 3])=\{2\}$. We can also verify that $\mathcal{I}([2,3])=\{1,2\}$ as node $[1,1]$ is another left node in $\mathcal{R}([2,1])$. \begin{figure}[tbh] \begin{centering} \includegraphics[width= 1.5 in]{Figures/Graph.pdf} \caption{\label{Graph.fig}An example graph $G$ with $|V|=7$.} \end{centering} \end{figure} \begin{figure*}[tbh] \begin{centering} \includegraphics[width= 7 in]{Figures/Tree.pdf} \caption{\label{GtoT.fig}Binary tree representation $T$ of the example graph $G$ in Figure~\ref{Graph.fig}. The root contains all vertices of $G$ and next levels are built by branching into neighbors and non-neighbors of vertex $V_i$ among each subset of vertices. The pair of $[\ell, i]$ next to each node shows the level that the node belongs to, $\ell$, and the position of the node in that level $i$ is determined by counting from the left to the right.} \end{centering} \end{figure*} \subsection{Transforming Graph $G$ into Binary Tree $T$} The rooted binary tree $T$ is built by traversing the unlabeled graph $G(V,E)$. Each node in $T$ corresponds to a set of vertices from $G$. The root node $[0,1]$ corresponds to the set of all the vertices, $V$. To build levels $\ell= 1,\ldots, |V|-1$ of the tree we pick a vertex $V_{k(\ell)}$; we will specify shortly how it is picked. Vertex $V_{k(\ell)}$ is removed from the set of vertices. The remaining vertices belonging to each node at level $\ell-1$ is split into two groups: the left node are all vertices connected to $V_{k(\ell)}$, and the right node contain those not connected to $V_{k(\ell)}$. Empty nodes are not split further. It is worth noting that the vertex $V_{k(\ell)}$ is picked randomly from the first non-empty node at level $\ell-1$, i.e., node $[\ell-1, \alpha]$. Figure~\ref{Graph.fig} and Figure~\ref{GtoT.fig} show an example of $G(V,E)$ and its corresponding rooted binary tree representation, $T$, respectively. Since the order of nodes is irrelevant for the structure, here we have assumed $V_{k(\ell)}=V_\ell$. Algorithm~\ref{Alg.GtoT} gives the pseudocode for transforming graph $G$ into the rooted binary tree $T$. Note that hereafter, when we traverse a level in the rooted binary tree $T$, we start from the most left node and finish with the most right node at that level. \begin{algorithm} \caption{Transform graph $G$ into rooted binary tree $T$} \label{Alg.GtoT} \begin{algorithmic}[1] \Function{GraphToTree}{$G$} \State {Create $root$ of $T$ with all vertices in $G$} \For {$\ell \gets 0$ to $|V|-2$} \State {Remove a vertex, $V_{\ell+1}$, randomly from node $[\ell, \alpha]$} \ForEach {node $[\ell,i]$ in the $\ell$th level of $T$} \If {$[\ell,i] \not= NIL$} \State{$[\ell,i].\node{left} \gets \text{neighbors of } V_{\ell+1}$ in $[\ell,i]$} \State{$[\ell,i].\node{right} \gets \text{non-neighbors of } V_{\ell+1}$ in $[\ell,i]$} \EndIf \EndFor \EndFor \State \Return $T$ \EndFunction \end{algorithmic} \end{algorithm} \subsection{Encoding the Rooted Binary Tree $T$} As we are only interested in coding the structure of $G$ (i.e., vertices up to an automorphism), we do not need to explicitly encode the set of vertices corresponding to the nodes in $T$. It is sufficient to encode only the cardinality of nodes; we call the tree with cardinality as node values $\widetilde{T}$ (see Figure~\ref{Tree_tilde.fig}). When we refer to encoding a node $[\ell, i]$, we are referring to encoding the value of the node. Furthermore, we \emph{only} need to encode the left nodes as the value of the siblings (i.e., right nodes) can be deduced given the value of the parent nodes. Consider a nonempty node $[\ell, i]$, we can see that \begin{equation} |[\ell, i]| = \begin{cases} |[\ell, i].\node{left}| + |[\ell, i].\node{right}|+1, \text{ if $[\ell,i]=[\ell, \alpha]$}\\ |[\ell, i].\node{left}| + |[\ell, i].\node{right}|, \text{ otherwise}. \end{cases} \end{equation} The reason for the discrepancy is because of our convention of always removing a vertex to encode at from the first nonempty node $[\ell, \alpha]$ at each level. \begin{figure*}[tbh] \begin{centering} \includegraphics[width= 5.5 in]{Figures/Tree_tilde.pdf} \caption{\label{Tree_tilde.fig}Transforming $T$ in Figure~\ref{GtoT.fig} into $\widetilde{T}$. Each node's value represents the cardinality of the the corresponding node in $T$.} \end{centering} \end{figure*} It is easy to see that once the decoder has reconstructed the tree $\widetilde{T}$ and consequently $T$, one can reconstruct graph $\widetilde{G}$ isomorphic to the original graph $G$. The procedure is very similar to the one for transforming a graph into a binary tree. We start with $|V|$ isolated vertices as determined by the cardinality of the root in $T$. Then for each level $\ell=1,\ldots, |V|-1$, we connect the vertex $V_{\ell}$ to vertices in left nodes at level $\ell$ of $T$. The resulted graph $\widetilde{G}$ is isomorphic to the original graph $G$. The remaining problem now is encoding the values in the tree $\widetilde{T}$. The better the values can be predicted, the shorter the codelength. The encoder/decoder can predict the value either based on global properties of the graph (e.g., degree distribution), or based on local properties, which can depend only on the part of the tree $\widetilde{T}$ already encoded/decoded. One such property is that $|[\ell, i]|$ can only take on integer values $0,1,2 ,\ldots, |[\ell, i].\node{parent}|-1, \text{ if $i = 1, 2$}$ or $0,1,2 ,\ldots, |[\ell, i].\node{parent}|, \text{ if $i > 2$}$. It is important to realize that the properties used for encoding the tree $\widetilde{T}$ should be properties of the original graph, since they presumably have statistical significance. As an example, if the original graph is modeled as \ER\ \cite{bollobas2001random}, it is easy to see that the node values are binomially distributed, $Binom(N, p)$, where \begin{equation}\label{bin.eq} N= \begin{cases} |[\ell, i].\node{parent}| -1, \text{ if $i = 1,2$}\\ |[\ell, i].\node{parent}|, \text{ if $i > 2$}. \end{cases} \end{equation} The encoder uses the global property $p$, which must be known by the decoder. In universal coding, this can be transmitted to the decoder initially. Section \ref{Calc.sec} outlines how to calculate and encode global properties. We call this approach IID coder, as it is based on the i.i.d property of the \ER\ graph. It is about equivalent to the approach introduced in \cite{ChoiSzpankowski12} for the compression of \ER\ graphs. The pseudocode for IID coder is shown in Algorithm~\ref{Alg.IID}. \begin{algorithm} \caption{Encode $\widetilde{T}$ with IID coder} \label{Alg.IID} \begin{algorithmic}[1] \Function{EncodeIID}{$\widetilde{T}, p$} \State{Encode $|[0,1]|$ via a positive integer encoder} \For {$\ell \gets 1$ to $|V|-1$} \ForEach{left node $[\ell, i]$} \State{Encode $|[\ell,i]| \sim Binom(N,p)$ with $N$ from \eqref{bin.eq}} \EndFor \EndFor \EndFunction \end{algorithmic} \end{algorithm} In practice, \ER\ graphs are not good models for real-world graphs as edges are usually not independent \cite{albert2002statistical}. Therefore, we would like to use more advanced graph properties. We classify our coding methods broadly into two classes: 1) Node-by-Node Coder and 2) Level-by-Node Coder. In Node-by-Node Coder, we still use binomial distribution; however, the edge probability, $p$, will depend on local properties (i.e., graph motifs) in $G(V,E)$. In Level-by-Node Coder, we use the degree distribution of $G(V,E)$ as a global property of graph to encode the values of all left nodes in level $\ell$ of $\widetilde{T}$ at the same time. The value of a left node in $\widetilde{T}$ can equivalently be seen as a count of \emph{edges} of the original graph. Since only the \emph{number} of edges are encoded, any local property used for encoding must be shared by all edges in a left node. Equivalently, any property of the original graph used for encoding must be convertible to a property of the tree $\widetilde{T}$. In other words, we convert the original graph $G(V,E)$ into the tree $\widetilde{T}$, and any properties that we want to use for coding must then become properties purely of $\widetilde{T}$. We will describe this with more details for each class of coders. \subsection{\label{EdgeProp.sec} Class 1: Node-by-Node Coder} For Node-by-Node Coders, we will traverse $\widetilde{T}$ back to the root to determine the existence of certain motif structures in $G$. This will help us to better encode graphs that are not \ER\ as in these cases, edges are not independent of one another. \subsubsection{Coding of Triangles \label{Tri.sec}} The first Node-by-Node Coder we consider is the triangle coder. The triangle coder results in shorter codelength for graph classes that induce more triangle structures such as scale-free graphs. A triangle is a cycle graph with three nodes, which is also a 3-clique. Statistics about triangles are often used to characterize graphs \cite{barabasi2016network}. First, we describe how to deduce the existence of triangles in $G$ from the structure of $\widetilde{T}$. We know that the set of vertices corresponding to a left node $[\ell, i]$ are connected to the vertex $V_{\ell}$. We can also deduce if there are edges between the set of vertices corresponding to the left node $[\ell, i]$ and the vertex $V_{\ell-i}, i=1,\ldots, \ell-1$. For that, we look at the ancestor of node $[\ell, i]$ in level $\ell-i$. If it is a left node, then the set of vertices corresponding to the left node $[\ell, i]$ are connected to the vertex $V_{\ell-i}$. To have a triangle, there must be an edge between $V_\ell$ and $V_{\ell-i}$. It can be verified if the ancestor of $[\ell-1, \alpha]$ at level $\ell-i$ is a left node. If that is the case, we can deduce a triangle forms between any of vertices corresponding to the left node $[\ell, i]$, $V_\ell$, and $V_{\ell-i}$. For example, consider node $[4,3] = \{V_6\}$ in Figure~\ref{GtoT.fig}. Since node $[4,3]$ is a left node in level $4$, there is an edge between $V_6$ and $V_4$. We can see that $V_6$ is also connected to $V_3$ because its ancestor in level $3$ (i.e., node $[3,5]$) is a left node. We can also verify that $V_4$ and $V_3$ are connected since node $[3,1]$ (i.e., node $[3, \alpha]$) is a left node at level $3$ and therefore, connected to $V_3$. Considering all these connections, we can deduce that $V_6, V_4, V_3$ form a triangle subgraph in $G$. We can use the formation of triangles to encode the nodal values in $\widetilde{T}$ as follows. Similar to IID coder, we use binomial distribution. However, the triangle coder chooses between two binomial distributions: $Binom(N,\widecheck{p}_\triangle)$ or $Binom(N,p_\triangle)$, where $N$ is given by equation~\eqref{bin.eq}. We decide between these two distributions with the help of $\mathcal{CI}([\ell, i].\node{parent})$. Consider a left node $[\ell, i]$, the coder will use $Binom(N,p_\triangle)$ to encode its value if $\mathcal{CI}([\ell, i].\node{parent})$ has at least one element. Note that $\mathcal{CI}([\ell, i].\node{parent})$ represents levels where $\mathcal{R}([\ell, i].\node{parent})$ and $\mathcal{R}([\ell-1, \alpha])$ both contain left nodes. It means that vertices corresponding to left node $[\ell, i]$ and $V_{\ell-1}$ are both connected to vertex $V_{\ell'}, \ell' \in \mathcal{CI}([\ell, i].\node{parent}$, and therefore, triangle forms among these vertices in $G$. When $\mathcal{CI}([\ell, i].\node{parent})$ is empty, we encode $[\ell, i]$ with $Binom(N,\widecheck{p}_\triangle)$ as no triangle exists among these vertices in $G$. The psuedocode for the triangle coder is given in Algorithm~\ref{Alg.Tri}. \begin{algorithm} \caption{Encode $\widetilde{T}$ with triangles from Class 1} \label{Alg.Tri} \begin{algorithmic}[1] \Function{EncodeTriangles}{$\widetilde{T}, \{ \widecheck{p}_\triangle, p_\triangle \}$} \State{Encode $|[0,1]|$ via a positive integer encoder} \For{$\ell \gets 1$ to $|V|-1$} \ForEach{left node $[\ell, i]$} \If{ $|\mathcal{CI}([\ell,i].\node{parent})|>0$} \State{Encode $|[\ell,i]| \sim Binom(N,p_\triangle)$} \Else \State{Encode $|[\ell,i]| \sim Binom(N,\widecheck{p}_\triangle)$} \EndIf \EndFor \EndFor \EndFunction \end{algorithmic} \end{algorithm} \subsubsection{Coding with the number of common neighbors} In a triangle subgraph, two connected vertices share a single common neighbor. But it may be that two vertices share multiple common neighbors as there is usually a correlation between having an edge between two vertices and the number of their common neighbors. This property is used for link prediction in complex networks \cite{yao2016link, li2018similarity}. Therefore, we can generalize the triangle encoder to encoding with $m$ common neighbors. Instead of using $\widecheck{p}_\triangle$ or $p_{\triangle}$ to parameterize the binomial distribution, we can use $p_{\triangle^{(m)}}$ where $m$ denote the number of common neighbors (note that $p_{\triangle^{(0)}}$ is the same as $\widecheck{p}_\triangle$ in coding with triangles). In other words, we find how many edges exist between any vertex corresponding to left node $[\ell, i]$ and vertex $V_\ell$ and utilize it as statistics that built the graph. The number of common neighbors can range from $0$ to the maximum degree of a vertex in $G$, which we denote by $d_{max}$. The way we encode nodal values of $\widetilde{T}$ with this coder is as follows. For a left node $[\ell, i]$, we look at the cardinality of $\mathcal{CI}([\ell, i].\node{parent})$. It tells us how many vertices already encoded exist that any of vertices corresponding to $[\ell, i]$ and $V_\ell$ are both connected to them. This determines which parameter to pick for binomial distribution. \subsubsection{Coding over 4-node motifs} We can explore motifs of larger sizes in $G$ to develop new coders. However, computational cost can be a limiting factor. Here, we are interested to extend coding to motifs of size 4 vertices. Figure~\ref{4motifs.fig} illustrates motifs that we look for. Note that the priority starts with 4-clique. If 4-clique does not exist, then we look for double-triangle, and finally 4-cycle. Each of these motifs can be encoded with $p_{\boxtimes}$, $p_{\boxbslash}$, and $p_\square$, respectively. If none of them exist, then we encode left node $[\ell,i]$ using $\widecheck{p}_\square$. \begin{figure}[tbh] \begin{centering} \includegraphics[width=3.5 in]{Figures/4nodes_coding.pdf} \caption{\label{4motifs.fig}Motifs of interest over four vertices with three realizations for double-triangle.} \end{centering} \end{figure} As we mentioned earlier, we find the appropriate parameter to encode nodal values of $\widetilde{T}$ by looking at the structure of encoded/decoded part of tree $\widetilde{T}$ up to that point. Depending on the cardinality of $\mathcal{CI}([\ell, i].\node{parent})$, different cases are possible: \begin{itemize} \item $|\mathcal{CI}([\ell, i].\node{parent})| \geq 2:$ For any pair $\ell_1$ and $\ell_2$ in $\mathcal{CI}([\ell, i].\node{parent})$ where $\ell_1 < \ell_2$, we check to see if we can find a case in which the first nonempty node in level $\ell_2$ (i.e., $[\ell_2, \alpha]$) lies in the left subtree of the tree rooted at each node in level $\ell_1$. If such a case exists, we use $Binom(N, p_\boxtimes)$ to encode the value of $[\ell, i]$. Otherwise, the configuration~3 of double-triangle in Figure~\ref{4motifs.fig} occurred; thus, we use $Binom(N, p_\boxbslash)$. \item $|\mathcal{CI}([\ell, i].\node{parent}| = 1:$ Two cases are possible \begin{itemize} \item For the first nonempty node in level $\ell_1, \ell_1 \in \mathcal{CI}([\ell, i].\node{parent})$, and node $[\ell-1, \alpha]$, we check to see if $\mathcal{R}([\ell_1, \alpha])$ and $\mathcal{R}([\ell-1, \alpha])$ contain a left node at the same level. If such a node exists, the configuration~1 of double-triangle in Figure~\ref{4motifs.fig} occurred; thus, we use $Binom(N, p_\boxbslash)$. \item For node $[\ell_1, \alpha]$ and $[\ell, i].\node{parent}$, we check to see if $\mathcal{R}([\ell_1, \alpha])$ and $\mathcal{R}([\ell, i].\node{parent})$ contain a left node at the same level. If such a node exists, the configuration~2 of double-triangle in Figure~\ref{4motifs.fig} occurred; thus, we use $Binom(N, p_\boxbslash)$. \end{itemize} \item $|\mathcal{CI}([\ell, i].\node{parent})| = 0:$ First, we need to find $\mathcal{I}([\ell, i].\node{parent})$ which contains all the levels that $\mathcal{R}([\ell,i].\node{parent})$ or $\mathcal{R}([\ell-1,\alpha])$ have left nodes. For $|\mathcal{I}([\ell, i].\node{parent})| > 1$ and any pair $\ell_1$ and $\ell_2$ in $\mathcal{I}([\ell, i].\node{parent})$ where $\ell_1 < \ell_2$, we look for a case in which the first nonempty node in level $\ell_2$ (i.e., $[\ell_2, \alpha]$) lies in the left subtree of the tree rooted at any node in level $\ell_1$. If such a case exists, we use $Binom(N, p_{\square})$ to encode the value of $[\ell,i]$. \item If none of the abovementioned cases occurred, we use $Binom(N, \widecheck{p}_\square)$ to encode the value of $[\ell,i]$. \end{itemize} Due to similarity, we skip the pseudocode for this coder to avoid repetition. \subsection{\label{EdgeNodeProp.sec}Class 2: Level-by-Node Coder} One important graph statistics is the degree distribution $P(k)$. Class 2 coders utilize the degree distribution in addition to graph motifs presented in Class 1 coders to efficiently encode $\widetilde{T}$. For a given level, $\ell$, in $\widetilde{T}$, Class 1 coders encode the value of each left node (and deduces the value of the right node) independently of one another. Class 2 coders on the other hand, utilize the degree distribution to encode the values of left nodes at the same level altogether. The number of left nodes encountered in $\mathcal{R}([\ell-1, \alpha])$, $\widecheck{k}$, is equal to the number of edges, $V_{\ell} \leftrightarrow V_{\ell - i}, i =1,\ldots, \ell-1$, in $G$. We know that the degree of vertex $V_{\ell}$ is lower bounded by $\widecheck{k}$. The sum of the values of left nodes in level $\ell$ is $k - \widecheck{k}$, where $k$ is the degree of vertex $V_{\ell}$. We can use this relationship to encode all the left nodes in level $\ell$ of $T$ at the same time. Encoding with Class 2 entails two steps. First, we need to send the degree of $V_{\ell}$. Then, we send the conditional probability of seeing specific values for left nodes at level $\ell$ conditioned on their summation to be $k - \widecheck{k}$. For the first step, we use the degree distribution $P(k)$ and the fact that $k \geq \widecheck{k}$. Thus, we encode the degree of $V_{\ell}$ with \begin{equation} P(k|k\geq \widecheck{k})=\frac{P(k)}{\sum\limits_{j \geq \widecheck{k}}P(j)}.\label{Pk2.eq} \end{equation} One should notice that at the time of decoding a given level, the decoder knows $\widecheck{k}$ based on the tree up that point and thus, it can calculate (\ref{Pk2.eq}). Now, the decoder can compute the summation of the left nodes' values at level $\ell$ with \begin{equation}\label{eq:levelsum} \sum_{i \text{ is odd}} |[\ell, i]| = k - \widecheck{k}. \end{equation} Let $[\ell, N_\ell]$ denote last left node in level $\ell$. To encode left nodes' values in level $\ell$, we need to compute the joint probability of observing specific values for left nodes at level $\ell$ (i.e., left nodes take values $|[\ell,1]|, \ldots, |[\ell, N_\ell]|$ respectively) conditioning on their summation being equal to \eqref{eq:levelsum}. \begin{align}\label{eq:class2} P\big( |[\ell,1]|,\ldots, &|[\ell, N_\ell]|\ \big| {\textstyle \sum\limits_{i \text{ is odd}}} |[\ell, i]| = k - \widecheck{k} \big) \nonumber\\ & = \frac{P(|[\ell,1]|,\ldots, |[\ell, N_\ell]|)}{P\big(\sum\limits_{i \text{ is odd}} |[\ell, i]| = k - \widecheck{k}\big)} \nonumber\\ &= \ddfrac{\prod\limits_{i=1}^{N_{\ell}}P(|[\ell, i]|)}{P\big(\textstyle\sum\limits_{i \text{ is odd}} |[\ell, i]| = k - \widecheck{k}\big)}, \end{align} where the numerator is the joint probability of observing $|[\ell,1]|,\ldots, |[\ell, N_\ell]|$ as the values of left nodes and the denominator is the probability corresponding to all configurations with the same summation for left nodes' value, $k - \widecheck{k}$. By independent assumption on the values of left nodes, the joint probability distribution $P(|[\ell,1]|,\ldots, |[\ell, N_\ell]|)$ will reduce to the product of individual probabilities. Assuming the independence assumption, two cases are possible: \begin{enumerate} \item \emph{Identically distributed:} This case happens when we want to compute \eqref{eq:class2} using IID coder. Then, the probability of success is the same for all probabilities and the problem reduces to a counting problem. We can encode the values of left nodes using the probability distribution \begin{align} \label{eq:deg} P\big( |[\ell,1]|,\ldots, &|[\ell, N_\ell]|\ \big| {\textstyle \sum\limits_{i \text{ is odd}}} |[\ell, i]| = k - \widecheck{k} \big) \nonumber\\ &= \ddfrac{\prod_{i \text{ is odd}} { |[\ell, i]|+|[\ell, i+1]| \choose |[\ell,i]|} }{{\sum\limits_{i} |[\ell, i]| \choose \sum\limits_{i \text{ is odd}} |[\ell, i]|}} \nonumber\\ &= \ddfrac{\prod_{i \text{ is odd}} { |[\ell, i]|+|[\ell, i+1]| \choose |[\ell,i]|}}{{\sum\limits_{i} |[\ell, i]| \choose k -\widecheck{k}}}. \end{align} \item \emph{Not identically distributed:} If we use any other coders except IID coder, then different left nodes in the same level \emph{do not} have the same parameter for encoding. For example as we showed with the triangle coder from Class 1, node $[2,1]$ in Figure~\ref{Tree_tilde.fig} would be encoded with $p_\triangle$ while node $[2,3]$ would be encoded with $\widecheck{p}_\triangle$. To take this into account, we need to encode the values of left nodes using the following probability distribution \begin{align}\label{eq:pbd} P\big( &|[\ell,1]|,\ldots, |[\ell, N_\ell]|\ \big| {\textstyle \sum\limits_{i \text{ is odd}}} |[\ell, i]| = k - \widecheck{k} \big) \nonumber\\ &= \ddfrac{\prod_{i \text{ is odd}} { |[\ell, i]|+|[\ell, i+1]| \choose |[\ell,i]|} \theta^{|[\ell,i]|} (1 - \theta)^{|[\ell, i+1]|} } {P\big({\textstyle \sum\limits_{i \text{ is odd}}} |[\ell, i]| = k - \widecheck{k}\big)}, \end{align} where $\theta$ is the relevant parameter for each left node in the tree $\widetilde{T}$ (e.g., $p_\triangle$ or $\widecheck{p}_\triangle$ when using triangles for coding). The denominator in \eqref{eq:pbd} is a generalized version of binomial distribution called Poisson binomial distribution \cite{wang1993number}. It is defined as the sum of independent binomial distributions that are not necessarily identically distributed. Due to the involvement of different probabilities, calculation of denominator in \eqref{eq:pbd} can be cumbersome. To resolve this, some methods were proposed in the literature. Recursive methods were developed in \cite{chen1994weighted,Barlow1984computing} that can compute the denominator in \eqref{eq:pbd} in $O\big((k - \widecheck{k}) \textstyle \sum_{i} |[\ell, i]| \big)$ time. We pay this extra computational cost to have a more efficient coder since the entropy of Poisson binomial distribution is bounded above by the entropy of binomial distribution with the same mean \cite{harremoes2001binomial}. The pseudocode to encode with Class 2 is given in Algorithm~\ref{Alg.Class2}. \end{enumerate} \begin{algorithm} \caption{Encode $\widetilde{T}$ with Class 2} \label{Alg.Class2} \begin{algorithmic}[1] \Function{EncodeClass2}{$\widetilde{T}$} \State{Encode $|[0,1]|$ via a positive integer encoder} \For{$\ell \gets 1$ to $|V|-1$} \State{$\widecheck{k} \gets$ Number of left nodes in $\mathcal{R}([\ell-1, \alpha])$} \State{$\widehat{k} \gets$ Summation of left nodes' values in level $\ell$} \State{$k \gets \widecheck{k}+ \widehat{k}$} \State{Encode $k$ with \eqref{Pk2.eq}} \State{$P \gets$ Compute \eqref{eq:class2}} \State{Encode $P$} \EndFor \EndFunction \end{algorithmic} \end{algorithm} \subsection{\label{Calc.sec}Calculation and Encoding of Statistics} We consider encoding in two scenarios: learned coding, and universal coding. In learned coding, we are given a set of training graphs $\{G_1,\ldots, G_N\}$ of a particular class and have to learn local and global statistics; these statistics, then, are shared to both encoder and decoder. In universal coding, there is no training set and the encoder encodes a single graph. It also has to communicate to the decoder what is the statistics. Below we describe calculation and communication of statistics for each of these scenarios. \subsubsection{Learned Coding} For learned coding, we need to learn statistics from a set of training graphs. To do that, each statistic is calculated by taking an average over the same statistic in the training set. The edge probability $p$ in coding with IID coder can be estimated by the average degree. Other edge statistics are more tricky and should reflect the procedure used for encoding the graph. It means that we cannot simply count the number of triangles in a graph to compute $p_\triangle$. The reason is when we want to encode a graph with triangles, we look for the formation of a triangle in a specific way forced by the coding algorithm as described earlier. Thus, we need to transform each graph $G_i$ from the training set into its rooted binary tree representation $T_i$ and find statistics with coding algorithm. To estimate $p_\triangle$ and $\widecheck{p}_\triangle$, we traverse each $T_i$ the same way we did for coding and divide the tree's nodes into those coded with $p_{\triangle}$ and those coded with $\widecheck{p}_\triangle$. To estimate each of $p_{\triangle}$ and $\widecheck{p}_\triangle$, we compute the ratio of the summation of left nodes' values to the summation of left and right nodes' values in that group. The average over all $T_i$ gives the estimation for $p_\triangle$ and $\widecheck{p}_\triangle$. The same recipe is used to estimate edge statistics for common neighbors and 4-node motifs. The estimation of degree distribution in Class 2 is straightforward. It can be estimated through the histogram. We compute the degree distribution for each graph in the training set and the final degree distribution is estimated by taking average over them. \subsubsection{Universal Coding} For encoding average degree in IID coder, we can send the number of edges $|E|$ in $G$. The number of bits required to encode the number of edges is about $\log\frac{n(n-1)}{2}\approx2\log n$ bits. Once the decoder knows the number of edges, it can compute the parameter of IID coder, $p$, with \begin{equation*} p= \frac{2|E|}{n(n-1)}. \end{equation*} For other local statistics, we use sequential estimation best outlined in \cite[Section 13.2]{CoverBook}. For example in coding with triangles, we use sequential estimation of $p_{\triangle}$ and $\widecheck{p}_\triangle$, specifically the KT estimator \cite{KrichevskyTrofimov81,WillemsAl95}, which is \begin{equation*} \hat{p}=\frac{n_{1}+\frac{1}{2}}{n_{1}+n_{0}+1}, \end{equation*} where $n_{1},n_{0}$ are the summation of left and right nodes' values previously coded in the rooted binary tree, respectively. One should note that the procedure for updating the probabilities $p_{\triangle}$ and $\widecheck{p}_\triangle$ is different for each class. For Class 1 coders, the probabilities will be updated after coding each node of the rooted binary tree. However, for Class 2 coders, the probabilities will be updated after coding each level. The reason is that all nodes at the same level will be encoded together. To estimate statistics for common neighbors and 4-node motifs, we utilize similar sequential approach used for the estimation of $p_\triangle$ and $\widecheck{p}_\triangle$. For the degree distribution, we calculate the degree histogram for the whole graph, and use this for coding. The degree of a node is between 0 and $n-1$. We can therefore think of the degree histogram as putting each of the $n$ (unlabeled) nodes into one of $n$ buckets, and encoding this can be done by encoding the counts in the buckets. The number of possible configurations is a standard problem in combinatorics: ${2n-1 \choose n}$, which can be transmitted with \begin{align*} \log {2n-1 \choose n} & = nH\left(\frac{n}{2n-1}\right)+\frac{1}{2}\log\frac{2n-1}{n^{2}}+c \\ & \approx n-\frac{1}{2}\log n\ \text{bits} \ (|c|\leq2). \end{align*} Hereinafter, in our experiments, we use the above mentioned approach to calculate and communicate local and global statistics of graphs. \subsection{\label{GraphCom_Exp} Experiments} We consider two cases for experiments: 1) using learned coding to encode a graph of the same class of training set, 2) using universal coding to encode a single graph. In the former case, we generate synthetic data for different classes of graphs, whereas in the later case we measure the performance on real-world graphs. We evaluate the performance of our coding methods versus IID coder and also compare the performance of Class 1 and Class 2 against each other. For learned coding, we first need to learn statistics for coders. We considered different classes of graphs in our experiments. In all cases, learning was done on 50 graphs. Then, we used those statistics from the training to encode a test graph of the same type. The results are shown in Figure~\ref{GraphComp.fig}. As expected, for \ER\ graph, IID coder is efficient and all other coders do not offer an improvement. However, for \BA\ and Watts Strogatz graphs, our proposed coders outperform IID coder by a significant margin. One can observe that coders in Class 2 have shorter codelength than their counterparts in Class 1. For \BA\ graph, all encoders in Class 2 almost have the same performance and therefore, choosing one or another does not matter. However, for Watts Strogatz graph, coding with common neighbors through Class 2 is the most efficient. \begin{figure*}[tbh] \begin{centering} \includegraphics[width=7in]{Figures/universal_compression_horizontal.pdf} \par\end{centering} \caption{\label{GraphComp.fig} Comparison of codelength associated with each coder for \ER, \BA, and Watts Strogatz graphs. Left plots are for the graphs of variable size and the average degree of $\langle k \rangle = \frac{n}{50}$. Right plots are for graphs of the same size $n=1000$ and $\langle k \rangle$ ranging from $\frac{n}{100}$ to $\frac{n}{5}$. In \BA\ graph, $m$ denote the number of new edges added by each node. In Watts Strogatz, $k$ is the number of nearest neighbors in the model and $\beta$ refer to rewiring probability.} \end{figure*} For compression of real-world graphs, we use universal coding since there is no training set. Note that the statistics associated with each coder is required to be communicated to the decoder as described in Section~\ref{Calc.sec}. We measure the compression performance of Class 1 and Class 2 coders against each other and also compute the codelength associated with IID coder and arithmetic coding (represented by labeled iid) for comparison. The following undirected graphs, publicly available to download \footnote{\url{http://networkrepository.com/}}\textsuperscript{,}\footnote{\url{https://snap.stanford.edu}}, are considered: \begin{itemize} \item Genetic interaction: a gene interaction network \cite{nr}. \item Economic Network: the economic network of Victoria, Australia in 1880 \cite{nr}. \item Transportation network: A simple graph of Minnesota road network \cite{nr}. \item Collaboration network: extracted from \emph{arXiv} papers and covers collaborations among authors in General Relativity and Quantum Cosmology category \cite{leskovec2007graph}. \item Facebook-politician: represents blue verified Facebook page networks of politicians \cite{rozemberczki2019gemsec}. \item Internet (AS level): An undirected graph representing AS peering information inferred from University of Oregon Route Views Project on January 1, 2000 \cite{leskovec2005graphs}. \end{itemize} As we can see from Table~\ref{RealGraphs.tab}, coders in Class 2 give a better performance compared to their counterparts in Class 1. This improvement comes at the cost of computing \eqref{eq:pbd}. Moreover, shorter codelength is achievable by using Class 1 over IID coder. Another observation is that coding with common neighbors by means of Class 2 outperforms other coders in most cases. However, there are some cases that coding over 4-node motifs and triangles offer improvement over common neighbors. There is no single coder that is best for all graphs. This is no different than the situation for encoding sequences. If one wants the most efficient coder for a particular graph, one can encode with multiple algorithms, and choose the shortest, indicating by a header which is used or use soft combining \cite{VolfWillems98}. In the end it is a tradeoff between compression and complexity. \begin{table*}[tbh] \vspace{0.5cm} \begin{center} \setlength{\tabcolsep}{4pt} \renewcommand{\arraystretch}{1.4} \begin{tabular}{ |c|c|c|c|c|c|c|c|c|c|c|c| } \hline \multirow{2}{*}{Name} & \multirow{2}{*}{$|V|$} & \multirow{2}{*}{$|E|$} & \multirow{2}{*}{Labeled iid} & \multirow{2}{*}{IID coder} &\multicolumn{3}{c|}{Class 1} & \multicolumn{4}{c|}{Class 2} \\ \cline{6-12} & & & & & Triangle & ComNei & 4-node & Degree & Triangle & ComNei & 4-node \\ \hline Genetic interaction & 4227 & 39484 & 365599 & 317379 & 273444 & 235011 & 249467 & 280375 & 235787 & \textbf{206485} & 220191\\ Economic network & 1258 & 7513 & 61224 & 47592 & 49790 & 49597 & 46407 & 45500 & 44159 & 43996 & \textbf{40730} \\ Transportation network & 2642 & 3303 & 37937 & 35424 & 14619 & 14620 & 14596 & 12712 & \textbf{12530} & 12531 & 12540 \\ Collaboration network & 5242 & 14496 & 164224 & 119038 & 60375 & 52041 & 66203 & 106215 & 53647 & \textbf{47320} & 60182 \\ Facebook-politician & 5908 & 41729 & 423451 & 340070 & 222500 & 199514 & 206720 & 327203 & 195739 & \textbf{172386} & 179836 \\ Internet (AS level) & 3570 & 7750 & 86206 & 47685 & 48266 & 46665 & 47222 & 31107 & 30469 & \textbf{29708} & 30897 \\ \hline \end{tabular} \end{center} \caption{\label{RealGraphs.tab}Compression length (bits) for some real-world graphs. Labelled iid encodes the graph with its labels. Degree denote IID coder when we use it along degree distribution in Class 2. The best value for each case is boldfaced.} \end{table*} \section{Model Selection in Gaussian Graphical Models \label{GLASSO.sec}} In this section, we introduce an application of graph coding for model selection in Gaussian graphical models. The goal is to find a graph that describes dependencies among multivariate Gaussian variables accurately \cite{friedman2008sparse}. Multivariate Gaussian distributions are widely used in modeling real-world problems where the relationship among approximately normally distributed variables is of interest. They have been used to model different datasets such as stock returns \cite{kon1984models, golosnoy2012conditional}, protein-protein interactions \cite{baldassi2014fast}, and brain functional activities \cite{varoquaux2010brain}. Let $X = [X_1, \ldots, X_p]^T$ be a $p-$dimensional random vector with multivariate Gaussian distribution $\mathcal{N}(0,\Sigma)$. The inverse of covariance matrix, $\Sigma^{-1} = \Omega$, is known as the precision matrix. If the $(i,j)$ entry of the precision matrix (i.e., $\Omega_{ij}$) is $0$, then $X_i$ and $X_j$ are conditionally independent given all the other variables. Therefore, we can visualize the conditional independence relationships between any pair of variables as an unweighted, undirected graph, $G$ whose adjacency matrix, $A$ is such that \begin{equation} \label{eq:Adj} A_{ij}= \begin{cases} 1 \hspace{0.5cm} &\text{if} \hspace{0.3cm} \Omega_{ij}\neq 0, i \neq j \\ 0 \hspace{0.5cm} &\text{otherwise}. \end{cases} \end{equation} The graph $G$ is known as the conditional independence graph. Its structure is determined by the sparsity pattern of $\Omega$. Often, we are interested in the problem of estimating $G$ from $N$ i.i.d observations. To do that, we need to estimate $\Omega$ first. The problem is especially difficult when $N < p$. In this case, the maximum likelihood estimate does not exist. In most approaches, the estimator of $\Omega$ contains a regularization term $\lambda$ to 1) prevent overfitting, 2) control the sparsity of the estimated solution. A popular sparse estimator of the precision matrix is found by maximizing the $L_1-$penalized log-likelihood \cite{friedman2008sparse, yuan2007model, banerjee2008model} \begin{equation}\label{eq.glasso} \underset{\Omega \succ 0}{\text{max}} \hspace{0.2cm} \mbox{logdet} \hspace{0.1cm} \Omega -\mbox{tr}(S\Omega) - \lambda \|\Omega\|_1, \end{equation} where $S$ is the sample covariance matrix, and $\lambda$ is the regularization parameter that controls sparsity. The performance of the estimator in \eqref{eq.glasso} is highly influenced by the selection of $\lambda$. Depending on the value of $\lambda$, the conditional independence graph can range from a dense graph for small values of $\lambda$ to a graph with zero edges when $\lambda$ takes large values. To find the best value of the regularization parameter $\lambda$, model selection techniques are being used. We use the MDL principle and select $\lambda$ that minimizes the sum of the description length of the conditional independence graph structure and data when encoded under that graph structure \begin{equation} \arg \min_{\lambda} L(G_{\lambda}) + L(D|G_{\lambda}), \label{eq:MDL} \end{equation} where $L(G_{\lambda})$ is the description length of the conditional independence graph $G_{\lambda}$, and $L(D|G_{\lambda})$ is the description length of data $D$ when encoded with $G_{\lambda}$. To compute the description length of the conditional independence graph, $L(G_{\lambda})$, we first need to find the underlying conditional independence graph $G_{\lambda}$. By applying an estimator to the sequence of $N$ i.i.d observations $\{x_1, \ldots, x_N\}$ from $p-$variate Gaussian distribution, we obtain an estimated precision matrix $\widehat{\Omega}$ for each realization of $\lambda$. We have dropped the explicit dependence on $\lambda$ from $\widehat{\Omega}$ and other $\lambda-$related precision and covariance matrices for the sake of simplicity of notation. In this paper, we use graphical lasso \cite{friedman2008sparse}, which is one of the most commonly used solvers of $L_1-$penalized log-likelihood in Gaussian graphical models. It is worth mentioning that our approach can be easily applied to any other estimator. The conditional independence graph $G_{\lambda}$ is obtained from the estimated precision matrix $\widehat{\Omega}$. We then pick a graph coder described in Section~\ref{Coding.sec} to compute the description length of $G_{\lambda}$. To compute the description length of the data, $L(D|G_{\lambda})$, we face two challenges. The first challenge is to deal with real-valued data $\{x_1, \ldots, x_N\}$ where lossless source coding is not generalized directly. Second, we have to encode the data based on the underlying conditional independence graph $G_{\lambda}$. To encode real-valued data, we assume a fixed-point representation with a (large) finite number, $r$, bits after the period, and an unlimited number of bits before the period \cite{Rissanen83}. Therefore, the number of bits required to represent data $x$ according to the probability distribution function (pdf) $f(x)$ is given by \begin{align} L(x) &= - \log \int _{x}^{x+2^{-r}} f(t) dt \approx - \log \left(f(x)2^{-r} \right) \nonumber \\ &= - \log f(x) + r. \end{align} Since we are only interested in relative codelengths between different models, the dependency on $r$ cancels out. The second challenge is how to encode the data with respect to $G_{\lambda}$. As mentioned, the data is generated by multivariate Gaussian distribution, which can be characterized by covariance matrix $\Sigma$. Since we do not have access to the true covariance matrix $\Sigma$, we can find an estimate $\widecheck{\Sigma}$ based on the sample covariance matrix $S$. It should be noted that the structure of $\widecheck{\Sigma}^{-1}$ should match with the structure of $G_{\lambda}$ obtained from the previous step \begin{equation} \label{demp.eq} \begin{cases} \widecheck{\Sigma}_{ij} = S_{ij} &\text{if} \hspace{0.3cm} i=j \ \text{or} \ A_{ij} \neq 0, \\ \widecheck{\Sigma}_{ij}^{-1} = 0 \hspace{0.5cm} &\text{otherwise}. \end{cases} \end{equation} This problem is known as \emph{matrix completion} problem \cite{grone1984positive}. Dempster in \cite{dempster1972covariance}, proved the existence and uniqueness of maximum likelihood solution for $\widecheck{\Sigma}$ when the sample covariance matrix $S$ is positive definite. He presented a coordinate-descent algorithm to find the solution iteratively. It should be noted that the precision matrix obtained from the graphical lasso solution $\hat{\Omega}$ is not necessarily equal to the inverse of estimated covariance matrix $\widecheck{\Sigma}$. Once we estimate $\widecheck{\Sigma}$, we use predictive MDL \cite{Rissanen86} to compute $L(D | G_{\lambda})$ \begin{equation} L(D | G_{\lambda}) = -\sum_{i=0}^{N-1} \log f\left(x_{i+1}|\hat{\theta}(x_1,\ldots, x_i)\right), \label{eq:predMDL} \end{equation} where $f(\cdot|\cdot)$ is the conditional pdf and $\hat{\theta}(x_1,\ldots, x_i)$ denote the maximum likelihood estimate of parameters, which in this case is the estimated covariance $\widecheck{\Sigma}$ obtained under $G_{\lambda}$. The codelength in \eqref{eq:predMDL} is a valid codelength since it is sequentially decodable. Note that it does not work for the first few samples, as there is no estimate for $\widecheck{\Sigma}$. Instead, we encode the first few samples with a default distribution, which is the same among different realizations of $\lambda$. Finally, the best conditional independence graph structure $G_{\lambda^*}$ is obtained by minimizing $L(G_{\lambda}) + L(D|G_{\lambda})$ over $\lambda$. In the following, we present an algorithm to find the best graph model of data $G_{\lambda^*}$ associated with $\lambda^*$. \begin{algorithm} \caption{Find the best graph model of data $G_{\lambda^*}$ via graph coding} \label{Alg} \hspace*{\algorithmicindent} \textbf{Input: }Samples $\{x_1, \ldots, x_N\} \sim \mathcal{N}(0,\,\Sigma)$ and regularization parameters $\{\lambda_1,\ldots, \lambda_K\}$. \\ \hspace*{\algorithmicindent} \textbf{Output:} Best graph model of data $G_{\lambda^*}$. \begin{algorithmic}[1] \For {Each realization of $\lambda \in \{\lambda_1,\ldots, \lambda_K\}$.} \State {Apply graphical model estimator to find $\hat{\Omega}$ and build $G_{\lambda}$ based on \eqref{eq:Adj}.} \State {Use any graph coder in Section~\ref{Coding.sec} to compute $L(G_{\lambda})$.} \State {Compute $L(D|G_{\lambda})$ via \eqref{eq:predMDL} where $\hat{\theta}(x_1,\ldots, x_i)$ denote $\widecheck{\Sigma}$ obtained from \eqref{demp.eq}.} \State {Add up codelengths resulted from step~(3) and step~(4).} \EndFor \State \Return {$G_{\lambda^*}$ associated with the shortest total codelength in step~(5).} \end{algorithmic} \end{algorithm} \subsection{Experiments\label{sec:ModelExp}} We tested our approach on both synthetic and real-world data. For synthetic data, we consider different conditional independence graph structures and the goal is to recover true conditional independence graph. For real-world data, we applied our approach to ECG data of a group of healthy subjects and a group of subjects with Kawasaki disease. We are interested to determine if there is any difference between the conditional independence graph of healthy group versus Kawasaki group. We now provide simulation results on synthetic data generated from zero-mean multivariate Gaussian distribution with known precision matrix, $\Omega$. We will compare the performance of graph coding methods against other methods in the recovery of conditional independence graph $G$. We use F1-score as a widely used metric in the literature. F1-score is the harmonic mean of precision and recall where the precision is the ratio of the number of correctly estimated edges to the total number of edges in the estimated conditional independence graph, and the recall is the ratio of the number of correctly estimated edges to the total number of edges in the true conditional independence graph \cite{liu2010stability}. We consider two cases: 1) the number of observations is larger than the number of variables, $N>p$, with $N/p = 2$ and 2) the number of observations is smaller than the number of variables, $N<p$, with $N/p = 0.5$. The experiments were repeated for $p = 100, 200$. We applied the graphical lasso estimator described in \cite{friedman2008sparse} for $\lambda \in [0.01, 1]$ when $N>p$ and $\lambda \in [0.1, 1]$ when $N<p$ to cover a wide range of structures from dense graphs to totally isolated nodes. \begin{table*}[!tbh] \begin{center} \setlength{\tabcolsep}{4pt} \renewcommand{\arraystretch}{1.4} \begin{tabular}{ |c|c|c|c|c|c|c|c|c|c|c|c|c|c|c| } \hline \multirow{2}{*}{Type} & \multirow{2}{*}{$p$} & \multirow{2}{*}{$N$} & \multirow{2}{*}{Optimum} & \multicolumn{3}{c|}{Benchmark methods} & \multirow{2}{*}{IID} & \multicolumn{3}{c|}{Class 1} & \multicolumn{4}{c|}{Class 2} \\ \cline{5-7} \cline{9-15} & & & & CV & BIC & EBIC & & Triangle & ComNei & 4-node & Degree & Triangle & ComNei & 4-node \\ \hline Cycle & 100 & 200 & 1 & 0.26 & 0.64 & 0.75 & 1 & 0.99 & 0.99 & 1 & 1 & 1 & 1 & 1 \\ Cycle & 200 & 400 & 1 & 0.23 & 0.61 & 0.69 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ AR(1)& 100 & 200 & 0.99 & 0.26 & 0.65 & 0.75 & 0.65 & 0.99 & 0.99 & 0.99 & 0.99 & 0.99 & 0.99 & 0.99 \\ AR(1)& 200 & 400 & 1 & 0.23 & 0.62 & 0.70 & 0.99 & 0.99 & 0.99 & 1 & 1 & 1 & 1 & 1 \\ ER& 100 & 200 & 0.71 & 0.28 & 0.63 & 0.40 & 0.68 & 0.69 & 0.70 & 0.70 & 0.70 & 0.70 & 0.70 & 0.70 \\ ER& 200 & 400 & 0.80 & 0.27 & 0.68 & 0.75 & 0.79 & 0.78 & 0.78 & 0.79 & 0.79 & 0.79 & 0.79 & 0.79 \\ Hub& 100 & 200 & 0.50 & 0.23 & 0.48 & 0.01 & 0.47 & 0.48 & 0.48 & 0.48 & 0.49 & 0.49 & 0.49 & 0.49 \\ Hub& 200 & 400 & 0.44 & 0.22 & 0.43 & 0.16 & 0.43 & 0.43 & 0.43 & 0.43 & 0.44 & 0.44 & 0.44 & 0.44 \\ \hline \end{tabular} \end{center} \caption{\label{ModSel_LowDim.tab}F1-score of conditional independence graph recovery using different model selection methods. Results are the average over 50 replications when $N > p$.} \end{table*} \begin{table*}[!tbh] \begin{center} \setlength{\tabcolsep}{4pt} \renewcommand{\arraystretch}{1.4} \begin{tabular}{ |c|c|c|c|c|c|c|c|c|c|c|c|c|c|c| } \hline \multirow{2}{*}{Type} & \multirow{2}{*}{$p$} & \multirow{2}{*}{$N$} & \multirow{2}{*}{Optimum} & \multicolumn{3}{c|}{Benchmark methods} & \multirow{2}{*}{IID} & \multicolumn{3}{c|}{Class 1} & \multicolumn{4}{c|}{Class 2} \\ \cline{5-7} \cline{9-15} & & & & CV & BIC & EBIC & & Triangle & ComNei & 4-node & Degree & Triangle & ComNei & 4-node \\ \hline Cycle & 100 & 50 & 0.89 & 0.28 & 0.26 & 0.74 & 0.81 & 0.89 & 0.89 & 0.89 & 0.89 & 0.89 & 0.89 & 0.89 \\ Cycle & 200 & 100 & 0.97 & 0.23 & 0.29 & 0.69 & 0.76 & 0.96 & 0.96 & 0.96 & 0.97 & 0.96 & 0.96 & 0.96 \\ AR(1)& 100 & 50 & 0.89 & 0.27 & 0.25 & 0.74 & 0.81 & 0.89 & 0.89 & 0.89 & 0.89 & 0.89 & 0.89 & 0.89 \\ AR(1)& 200 & 100 & 0.97 & 0.23 & 0.28 & 0.69 & 0.73 & 0.95 & 0.95 & 0.97 & 0.97 & 0.96 & 0.96 & 0.97 \\ ER& 100 & 50 & 0.54 & 0.28 & 0.26 & 0.40 & 0.47 & 0.49 & 0.49 & 0.49 & 0.36 & 0.46 & 0.46 & 0.45 \\ ER& 200 & 100 & 0.66 & 0.29 & 0.34 & 0.63 & 0.63 & 0.64 & 0.64 & 0.64 & 0.58 & 0.63 & 0.63 & 0.63 \\ Hub& 100 & 50 & 0.32 & 0.18 & 0.17 & 0.02 & 0.25 & 0.15 & 0.15 & 0.13 & 0.22 & 0.25 & 0.24 & 0.24 \\ Hub& 200 & 100 & 0.31 & 0.15 & 0.20 & 0.03 & 0.25 & 0.13 & 0.13 & 0.13 & 0.26 & 0.27 & 0.27 & 0.27 \\ \hline \end{tabular} \end{center} \caption{\label{ModSel_HighDim.tab}F1-score of conditional independence graph recovery using different model selection methods. Results are the average over 50 replications when $N < p$.} \end{table*} The reason for considering smaller range for $N<p$ is the fact that the graphical lasso estimator does not converge for $\lambda < 0.1$ in our test cases. The values of $\lambda$ are equally spaced apart with the step size of $0.01$. Multivariate Gaussian data was generated with different precision matrix structures that have been frequently used as test cases in the literature \cite{li2010inexact, tan2014learning}: \begin{itemize} \item Cycle structure with $\Omega_{ii} = 1,\ \Omega_{i,i-1} = \Omega_{i-1,i} = 0.5,\ \Omega_{1p} = \Omega_{p1} = 0.4$. \item Autoregressive process of order one AR(1) with $\Omega_{ii} = 1,\ \Omega_{i,i-1} = \Omega_{i-1,i} = 0.5$. \item \ER\ (ER) structure with $\Omega_2 = \Omega_1 + \delta I_p$ where $\Omega_1$ is a matrix with off-diagonal elements taking values randomly chosen from uniform distribution $\mathcal{U}~(0.4,0.8)$ with the probability of $2/p$ and diagonal values set to zero. To keep $\Omega_2$ positive definite, we choose $\delta = \rho +0.05$ where $\rho$ is the absolute value of the minimum eigenvalue of $\Omega_1$. Here $I_p$ is the identity matrix of size $p$. \item Hub structure with two hubs. First, we create the adjacency matrix $A$ by setting off-diagonal elements to one with the probability of $0.01$ and zero otherwise. Next, we randomly select two hub nodes and set the elements of the corresponding rows and columns to 1 with the probability of $0.7$ and zero otherwise. After that for each nonzero element $A_{ij}$, we set $A_{ij}$ with a value chosen randomly from uniform distribution $\mathcal{U}~(-0.75,-0.25) \cup (0.25,0.75) $. Then, we set $\Omega_1 = \frac{1}{2}(A+A^T)$. The final precision matrix $\Omega_2$ is obtained by $\Omega_2 = \Omega_1 + \delta I_p$ with the same set-up as \ER\ structure. \end{itemize} Table~\ref{ModSel_LowDim.tab} and Table~\ref{ModSel_HighDim.tab} show the results of applying different methods to recover the conditional independence graph by applying graphical lasso as the estimator for $N > p$ and $N<p$ cases, respectively. To have a ground-truth for comparison, we provide the highest possible value for F1-score on the regularization path and show it in the column with name Optimum. For benchmark methods, we considered CV, BIC, and EBIC methods. The results for CV are given for 5-fold CV, and for EBIC method are given for recommended value of $\gamma = 0.5$ \cite{foygel2010extended}. The results for graph-coding methods are obtained by following the steps outlined in Algorithm~\ref{Alg}. The values are the average of 50 Monte Carlo trials. It can be seen that graph-coding techniques, i.e., columns named with IID, Class 1, and Class 2, outperform other methods in most of cases. Furthermore, F1-score associated with recovered conditional independence graph by these methods is so close to the optimum value on the regularization path. Among graph coding methods, we observed that coding with Class 1 and Class 2 coders give better performance than coding with IID coder in most of the cases. In addition, often times coders in Class 2 may offer a slight improvement over their counterparts in Class 1 coders. These findings confirm the necessity of having more advanced graph coders that reflect more information about the graph in their codelength. \begin{figure*}[!htbp] \centering \begin{subfigure}[b]{0.47\textwidth} \centering \includegraphics[width=3.6 in]{Figures/NormalGraph.pdf} \caption{} \end{subfigure} \hfill \begin{subfigure}[b]{0.47\textwidth} \centering \includegraphics[width=3.6 in]{Figures/KawasakiGraph.pdf} \caption{} \end{subfigure} \caption{\label{GraphModel.fig}Conditional independence graph of (a) healthy subjects, (b) Kawasaki subjects.} \end{figure*} We also tested our approach on a real-world dataset. This dataset contains extracted features from 12-lead ECG signals of a group of healthy subjects and a group of subjects with Kawasaki disease. All subjects are of age one to three years. The healthy group has $2492$ samples and the Kawasaki group has $197$ samples. This dataset was initially processed to select features with empirical distribution close to normal distribution. The reason is that the underlying assumption in Gaussian graphical models is that the data is normally distributed and this is also a key assumption for encoding data under our approach. After screening all features and selecting those with approximately normal distribution, we ended up with $30$ ECG features. We applied our approach to find the graph model of data for each group of subjects when $\lambda$ takes equally spaced apart values with the step size of $0.01$ within the range $[0.1, 1]$. The results show that the graph model of healthy subjects differs from the graph model of subjects with Kawasaki disease as given in Figure~\ref{GraphModel.fig}. The features with a number from $1$ to $12$ (referring to the lead number) at the end of their name vary across different leads. The rest of features are the same across all leads. The conditional independence graph given by our approach for each group of subjects is the same across different graph coders. As it can be seen, the conditional independence graph of healthy subjects is sparser with only $87$ edges compared to $115$ edges in the conditional independence graph of Kawasaki subjects. Moreover, these two graphs share $65$ edges. \section{Conclusion\label{Conclusion.sec}} In this paper we developed some universal coders based on graph statistics for the compression of unlabeled graphs. We achieved this by first transforming graph structure into a rooted binary tree and showing that the compression of graph structure is equivalent to the compression of its associated rooted binary tree. Then, we used graph statistics to develop two main classes of graph coders. The first class uses graph motifs as local properties and the second class utilizes degree distribution as a global statistics along with graph motifs for coding. We introduced an application of graph coding for model selection in Gaussian graphical models. For future work, we will extend this work in two directions. First is to extend graph compression to undirected graphs with attributes where graph topology will be utilized for the compression of structure and attributes. Second is to extend graph coding to directed graphs and using developed coders for data analysis purposes. Similar to undirected graphs, the idea is to transform directed graph into a rooted tree and encode nodal values on the rooted tree. \bibliographystyle{unsrt}
\section*{Introduction} Feigin--Fourier--Littelmann--Vinberg (FFLV) polytopes are certain convex polytopes which appear in the study of representations of Lie algebras. There are several motivations to research FFLV polytopes. First, they provide information about the PBW filtration and PBW bases, which have important applications in algebraic geometry, representation theory and mathematical physics. Second, they give combinatorial formulas for graded characters of representations of Lie algebras. The study of FFLV polytopes initiated with papers \cite{FFL1}, \cite{FFL2} investigating PBW filtration and bases for Lie algebras $\msl_{n}$ and $\msp_{2n}$, and proving Vinberg conjecture \cite{Vinberg}. The case of $\mso_{2n + 1}$ was handled in \cite{IM} with certain modifications in the definition of polytopes and bases. Recently a preprint providing FFLV type bases for Demazure modules has been posted \cite{Kambaso}. In \cite{Proctor} Proctor proposed a definition of odd symplectic groups $Sp_{2n + 1}$ and defined an analogue of highest weight irreducible representations $\mathcal{V}_{0}(\la)$ for these groups. One of the important results of his work is a Gelfand--Zetlin type character formula for $\mathcal{V}_{0}(\la)$. However, his main motivation was the product formula for dimensions of $\mathcal{V}_{0}(\la)$, which is also equal to a multivariate Ehrhart polynomial of a family of order poset polytopes. Product formulas for Ehrhart polynomials of ordet poset polytopes are still not fully understood. See a survey \cite{PosetDynamics} on a single variable product formulas. According to the work \cite{ABS} there is a bijection between lattice points of marked order polytopes (Gelfand--Zetlin type polytopes) and lattice points of the corresponding marked chain polytopes (FFLV type polytopes). Thus we can define FFLV polytopes for $\msp_{2n + 1}$ based on the work of Proctor by passing to marked chain polytopes. It is natural to ask whether these polytopes share the same properties as in $\msl_{n}$ and $\msp_{2n}$ cases. More precisely, first question is whether lattice points of marked chain polytopes of $\msp_{2n + 1}$ explicitly enumerate a PBW basis of $\operatorname{gr} \mathcal{V}_{0}(\la)$ and $\mathcal{V}_{0}(\la)$. Second question is whether these polytopes have the Minkowski sum property, that was proven for FFLV polytopes of $\msl_n$ and $\msp_{2n}$ in papers \cite{FFL1} and \cite{FFL2}, and further studied in \cite{Fang}, \cite{MinkowskiSums}. In this paper we affirmatively answer these questions. Our contribution is the translation of all results obtained for $\msp_{2n}$ in \cite{FFL2} to the $\msp_{2n + 1}$ case. In particular, we introduce new marked chain polytopes coming from representation theory. We generalize the argument from \cite{FFL2} that allows us to provide PBW bases for indecomposable trace-free representations of $\msp_{2n + 1}$ and irreducible representations of $\msp_{2n}$ simultaneously. \section*{Acknowledgements} The author is partially supported by Laboratory of Mirror Symmetry NRU HSE, RF Government grant, ag. № 14.641.31.0001. The author thanks Evgeny Feigin for discussions and directions. \section{Definitions} \subsection{Lie algebras} Let $U(\g)$ and $S(\g)$ denote the universal enveloping and symmetric algebras of a Lie algebra $\g$ respectively. One of the objects of interest is the PBW filtration. For any Lie algebra $\g$ consider the filtration on $\mathrm{U}(\g)$ with degree $s$ subspace defined as: $$U^{s}(\g) = \mathrm{span}\left\lbrace \prod_{i = 1}^{k} x_{i} \,|\, x_{i} \in \g, 0 \leq k \leq s \right\rbrace.$$ Now assume that $\g$ has a Cartan decomposition $\n^{+} \oplus \h \oplus \n^{-}$. Assume that $V(\la)$ is a highest weight representation of $\g$ with highest weight vector $v_{\la}$. Using the action of $U(\g)$ on $V(\la)$, we can define the PBW filtration on $V(\la)$. \begin{definition} PBW filtration on the highest weight representation $V(\la)$ is defined as $$V^{s}(\la) = U^{s}(\g) v_{\la} = U^{s}(\n^{-}) v_{\la}.$$ \end{definition} The filtration on the module depends on the choice of positive roots. However, it can be shown that the following quantities do not depend on this choice. \begin{definition} The $q$-dimension of the highest weight representation \hspace{-0.6mm}$V(\la)$\hspace{-0.59mm} is $$\dim_q V(\la) = \sum_{s} \dim \thinspace V^{s}(\la) / V^{s - 1}(\la) \cdot q^{s}.$$ \end{definition} \begin{definition} The $q$-character of the highest weight representation $V(\la)$ is $$\ch_q V(\la) = \sum\limits_{\mu, s} \dim V^{s}(\la)^{\mu}/ V^{s - 1}(\la)^{\mu} \cdot e^{\mu},$$ where the summation is over all weight subspaces $V(\la)^{\mu}$. \end{definition} \noindent Note that the associated graded space $\operatorname{gr} V(\la)$ can be considered as an $S(\g)$-module. Following the notation from \cite{FFL2} we set $R^{+}$ to be the set of positive roots of $\msp_{2n}$. Let $\al_i$ and $\omega_i$ be simple roots and the fundamental weights of $\msp_{2n}$. The elements of $R^{+}$ have the form \begin{gather*} \al_{i,j} = \al_i + \al_{i + 1} + \dots + \al_j,\ 1 \le i \le j \le n - 1,\\ \alpha_{i, \overline{j}} = \alpha_i + \alpha_{i + 1} + \ldots + \alpha_n + \alpha_{n - 1} + \ldots + \alpha_j, \ 1 \le i \le j \le n. \end{gather*} Unlike the paper \cite{FFL2} we do not identify $\al_{i, n}$ and $\al_{i, \overline{n}}$. We reserve this notation on purpose for other roots. Let $\msp_{2n} = \n^{+} \oplus \h \oplus \n^{-}$ be a Cartan decomposition. Denote by $f_{\al} \in \n^{-}_{-\al}$ the root vector of $\msp_{2n}$. \subsection{Odd symplectic Lie algebra} Let $V = {\mathbb C}^{2n + 1}$ and let $e_1, ..., e_{2n + 1}$ be a fixed basis. Let $x_1, ..., x_{2n + 1}$ be coordinate functions. Denote by $\omega$ a maximal rank skew-symmetric form on $V$ given by $\omega = \sum_{i=1}^{n} dx_{2i - 1} \wedge dx_{2i}$. Following the work \cite{Proctor} we give a definition. \begin{definition} Odd symplectic group $Sp_{2n + 1}$ is a subgroup of $GL(V)$ that preserves a skew symmetric bilinear form on $V$ of maximal rank. Odd symplectic Lie algebra $\msp_{2n + 1}$ is a Lie algebra of the group $Sp_{2n + 1}$. \end{definition} We can assume that $\omega$ is the preserved form, then $$\msp_{2n + 1} \cong {\mathbb C}^{2n} \rtimes (\msp_{2n} \oplus \gl_1)$$ and in a fixed basis $\msp_{2n + 1}$ has a block matrix form, $$ \msp_{2n + 1} = \begin{bmatrix} \msp_{2n} & 0 \\ * & z \end{bmatrix}. $$ Note that $\msp_{2n + 1} \not\subset \msp_{2n + 2}$. Let $E_{i, j}$ denote the usual matrix unit. Then simple roots of the subalgebra $\msp_{2n}$ can be chosen as $h_{\al_i} = E_{i, i} - E_{n + i, n + i}$. Apart from roots of the subalgebra $\msp_{2n}$ the Lie algebra $\msp_{2n + 1}$ has roots defined by elements $E_{2n + 1, n + i}$ and $E_{2n + 1, i}, \; i = 1, ..., n$. Let us denote the root of $\msp_{2n + 1}$ defined by the element $E_{2n + 1, 2n}$ as $\tilde\al_{n + 1}$. Using the identities $$[E_{i, i} - E_{n + i, n + i}, E_{2n + 1, i}] = -E_{2n + 1, i},$$ $$[E_{i, i} - E_{n + i, n + i}, E_{2n + 1, i}] = E_{2n + 1, n + i},$$ we conclude that $E_{2n + 1, n + i}$ corresponds to the root $\al_i + ... + \al_{n - 1} - \tilde\al_{n + 1}$ and $E_{2n + 1, i}$ corresponds to the root $-\al_i - ... - \al_n - \tilde\al_{n + 1}$. We introduce the notations $$\al_{i, n} = \al_i + ... + \al_n - \tilde\al_{n + 1},$$ $$f_{i, n} = f_{\al_{i, n}} = E_{2n + 1, i}.$$ We also define subspaces $$F^{+} = \bigoplus\limits_{i = 1}^{n} {\mathbb C} \cdot E_{2n + 1, n + i},\,\, F^{-} = \bigoplus\limits_{i = 1}^{n} {\mathbb C} \cdot E_{2n + 1, i}.$$ Consider nilpotent subalgebras $\tilde\n^{\pm} = \n^{\pm} \oplus F^{\pm}$ and Cartan subalgebra $$\tilde\h = \h \oplus {\mathbb C} \cdot E_{2n + 1, 2n + 1}.$$ We will use decomposition $\msp_{2n + 1} = \tilde\n^{-} \oplus \tilde\h \oplus \tilde\n^{+}$ as the analogue of Cartan decomposition. To construct the analogue of irreducible representations for $\msp_{2n + 1}$ Proctor used trace-free tensors construction. \begin{definition} A k-tensor $v \in V^{\otimes k}$ is called trace-free with respect to $\omega$ if all of $k(k - 1)/2$ contractions of $v$ with the form $\omega \in V^{* \otimes 2}$ are equal to 0. \end{definition} Let $\la$ be a Young diagram with $n$ non-zero rows. Let $V^{\la} \subset V^{\otimes |\lambda|}$ be a subrepresentation of $GL(V)$ of highest weight $\la$. Denote by $\mathcal{V}_{0}^{\la}$ the subspace of trace-free tensors of $V^{\la}$. The highest weight vector $v_{\la} \in V^{\la}$ belongs to the subspace of trace-free tensors $\mathcal{V}_{0}(\la)$. It was proven in \cite{Proctor} that $\mathcal{V}_{0}(\la)$ is an indecomposable representation of $\msp_{2n + 1}$ with highest weight $\la$. The analogous description of the irreducible representations of classical groups as subspaces of trace-free tensors can be found in \cite{Weyl}. For Young diagrams $\mu, \lambda$ denote by $\mu \prec \lambda$ the interlacing conditions: $\la_{i + 1} \leq \mu_i \leq \la_i \;\; \forall i$. Denote by $V_{\msp_{2n}}(\la)$ the irreducible representation of $\msp_{2n}$ of highest weight $\la$. The following important connection between representations of $\msp_{2n}$ and $\msp_{2n + 1}$ was given in \cite{Proctor}. \begin{lem}\label{BranchingRule} The representation $\mathcal{V}_{0}(\la)$ under the restriction to subalgebra $\msp_{2n} \oplus \mgl_1$ is decomposed as $$\mathcal{V}_{0}(\la) = \bigoplus_{\mu \prec \la} V_{\msp_{2n}}(\mu) \otimes \mathbb{C}_{|\la| - |\mu|},$$ where $\mathbb{C}_{|\la| - |\mu|}$ is the one dimensional representation with $\mgl_1$ weight $|\la| - |\mu|$. \end{lem} Proctor considered a generalization $\msp_{2n, k} = (\msp_{2n} \oplus \gl_k) \ltimes {\mathbb C}^{2nk}$ with $k > 1$ given by selection of rank $2n$ skew-symmetric form in ${\mathbb C}^{2n + k}$. However, the product formula and representation theory backing it exists only for four families of examples: \begin{enumerate} \item Case $k = 0$ gives $\msp_{2n}$ with FFLV polytopes obtained in \cite{FFL2}, \item Case $k = 1$ gives $\msp_{2n + 1}$ considered in this paper, \item Case $n = 0$ gives $\gl_k$ with FFLV polytopes obtained in \cite{FFL1}, \item Case $n = 1$ gives $(\msp_1 \oplus \gl_k) \ltimes {\mathbb C}^{2m}$. \end{enumerate} Poset for the case $n = 1$ is obtained from $A_k$ poset by adding one extra element. The corresponding product formula for multivariate Ehrhart polynomial of marked order (or chain) polytope for weight $\la = \sum_{i=1}^{k - 1} m_i \omega_i$ contains an additional linear factor: $$\frac{k + \sum_{i=1}^{k - 1} i \cdot m_i}{k} \cdot \prod\limits_{i \leq j} \frac{m_i + m_{i + 1} + ... + m_j + j - i + 1}{j - i + 1}.$$ \subsection{FFLV polytopes} Recall the definition of FFLV polytope for $\msp_{2n}$. Consider the poset formed by all positive roots $R^{+}$ of $\msp_{2n}$ (case $n = 3$ on the diagram): $$ \begin{array}[pos]{ccccccccccccc} && \alpha_{1,1} & \rightarrow & \alpha_{1,2}& \rightarrow & \alpha_{1,\overline{3}}& \rightarrow & \alpha_{1,\overline{2}}& \rightarrow & \alpha_{1,\overline{1}} &&\\ && && \downarrow && \downarrow && \downarrow && \\ && & & \alpha_{2,2}& \rightarrow & \alpha_{2,\overline{3}}& \rightarrow & \alpha_{2,\overline{2}}& & &&\\ && && && \downarrow && && && \\ && & & & & \alpha_{3,\overline{3}} & & & && \end{array} $$ The polytope $FFLV_{2n}(\la)$ is defined in space $\mathbb{R}_{\geq 0}^{n^2}$ with coordinates $(s_{\al})_{\al \in R^{+}}$ by explicit set of inequalities. There is one inequality for each symplectic Dyck path. Symplectic Dyck path is any maximal chain $p = (p(0), ..., p(k))$ in the root poset that starts at the root $p(0) = \al_{i, i}$ for some $i$ and ends either at $\al_{j, j}$ or at $\al_{j, \overline{j}}$ for some $j \geq i$. Let $\D_{2n}$ denote the set of all symplectic Dyck paths for $\msp_{2n}$ root poset. \begin{equation*} FFLV_{2n}(\la):= \bigg\{ \bs \mid \forall p \in \D_{2n}: \begin{array}{l} \text{ If } p(0) = \al_{i, i}, p(k) = \al_{j, j}, \text{ then }\\ \sum_{\al \in p} s_{\al} \leq m_i + \dots + m_j,\\ \text{ if } p(0) = \al_{i, i}, p(k) = \al_{j, \overline{j}}, \text{ then }\\ \sum_{\al \in p} s_{\al} \leq m_i + \dots + m_n\\ \end{array}\bigg\}. \end{equation*} To shorten the notation we use $s_{i,j}$ for $s_{\al_{i, j}}$, and $s_{i,\overline{j}}$ for $s_{\al_{i, \overline{j}}}$. \begin{exam} The polytope $FFLV_{4}(m_1\omega_1 + m_2\omega_2)$ has four coordinates $s_{1, 1}, s_{1, \overline{2}}, s_{2, \overline{2}}, s_{1, \overline{1}} \in \mathbb{R}_{\geq 0}$ constrained by inequalities $$s_{1, 1} \leq m_1, \;\;\; s_{2, \overline{2}} \leq m_2,$$ $$s_{1, 1} + s_{1, \overline{2}} + s_{1, \overline{1}} \leq m_1 + m_2, \;\;\; s_{1, 1} + s_{1, \overline{2}} + s_{2, \overline{2}} \leq m_1 + m_2.$$ \end{exam} For any lattice point $\bs = (s_{\al})_{\al \in R^{+}} \in FFLV_{2n}(\la)$ denote by $f^{\bs}$ the element of the universal enveloping algebra $$f^{\bs} = \prod\limits_{\al} f_{\al}^{s_{\al}} \in U(\n^{-}) \subset U(\msp_{2n}).$$ The product depends on the ordering of the roots $\al$. We suppose that arbitrary fixed ordering is used. Note that all orderings give equivalent elements when we pass from $U(\n^{-})$ to the associated graded $S(\n^{-})$. We denote the set of integral points of a polytope $P$ as $P^{{\mathbb Z}} \subset P$. The following result was proven in \cite{FFL2}. \begin{thm}\label{EvenFFLV} For dominant integral weight $\la$ the set $$f^{\bs} v_{\la}, \bs \in FFLV^{{\mathbb Z}}_{2n}(\la),$$ is a basis of the irreducible representation $V_{\msp_{2n}}(\la)$ and of the associated graded space $\operatorname{gr} V_{\msp_{2n}}(\la)$ with respect to PBW filtration. \end{thm} \noindent As a corollary, this result provides a combinatorial formula for the graded character. Introduce the notation $$\operatorname{wt}(\bs) = \sum_{1 \leq i \leq j < n} \al_{i, j}s_{i, j} + \sum_{1 \leq i \leq j \leq n} \al_{i, \overline{j}}s_{i, \overline{j}}, \;\; \deg(\bs) = \sum_{1 \leq i \leq j < n} s_{i, j} + \sum_{1 \leq i \leq j \leq n} s_{i, \overline{j}}.$$ Then $$\ch_{q} V_{\msp_{2n}}(\la) = \sum_{\bs \in FFLV^{{\mathbb Z}}_{2n}(\la)} e^{\la - \operatorname{wt}(\bs)} q^{\deg(\bs)}.$$ The following results were also obtained in \cite{FFL2}. \begin{thm}\label{EvenSubmodule} The $S(\n^{-})$-module generated by cyclic vector $$v_{\la} \otimes v_{\mu} \in \operatorname{gr} V_{\msp_{2n}}(\la) \otimes \operatorname{gr} V_{\msp_{2n}}(\mu)$$ is isomorphic to $\operatorname{gr} V_{\msp_{2n}}(\la + \mu)$. \end{thm} \begin{thm}\label{EvenMinkowski} We have an equality of the Minkowski sums of lattice points $$FFLV_{2n}^{{\mathbb Z}}(\la) + FFLV_{2n}^{{\mathbb Z}}(\mu) = FFLV_{2n}^{{\mathbb Z}}(\la + \mu).$$ \end{thm} We introduce the root poset for $\msp_{2n + 1}$ that we will work with (case $n = 3$ on the diagram): $$ \begin{array}[pos]{ccccccccccccccc} && \alpha_{1,1} & \rightarrow & \alpha_{1,2} & \rightarrow & \alpha_{1,3} & \rightarrow & \alpha_{1,\overline{3}}& \rightarrow & \alpha_{1,\overline{2}}& \rightarrow & \alpha_{1,\overline{1}} &&\\ && && \downarrow && \downarrow && \downarrow && \downarrow && \\ && & & \alpha_{2,2}& \rightarrow & \alpha_{2,3}&\rightarrow & \alpha_{2,\overline{3}}& \rightarrow & \alpha_{2,\overline{2}}& & &&\\ && && && \downarrow && \downarrow && && && \\ && & & & & \alpha_{3,3} & \rightarrow & \alpha_{3,\overline{3}} & & & && \end{array} $$ The polytope $FFLV_{2n + 1}(\la)$ is defined in space $\R^{n(n + 1)}_{\geq 0}$ with coordinates $s_\al$. The defining inequalities are completely analogous to the $\msp_{2n}$ case. Let $\D_{2n + 1}$ be the set of symplectic Dyck paths for $\msp_{2n + 1}$ root poset. That is, each element $p \in \D_{2n + 1}$ is a maximal chain in $\msp_{2n + 1}$ root poset that starts at $p(0) = \al_{i , i}$ for some $i$ and ends either at $\al_{j, j}$ or at $\al_{j, \overline{j}}$ for some $j \geq i$. \begin{equation*} FFLV_{2n + 1}(\la):= \bigg\{ \bs \mid \forall p \in \D_{2n + 1}: \begin{array}{l} \text{ If } p(0) = \al_{i, i}, p(k) = \al_{j, j}, \text{ then }\\ \sum_{\al \in p} s_{\al} \leq m_i + \dots + m_j,\\ \text{ if } p(0) = \al_{i, i}, p(k) = \al_{j, \overline{j}}, \text{ then }\\ \sum_{\al \in p} s_{\al} \leq m_i + \dots + m_n\\ \end{array}\bigg\}. \end{equation*} \begin{exam} The polytope $FFLV_{5}(m_1\omega_1 + m_2\omega_2)$ has six coordinates $s_{1, 1}, s_{1, 2}, s_{1, \overline{2}}, s_{1, \overline{1}}, s_{2, 2}, s_{2, \overline{2}} \in \mathbb{R}_{\geq 0}$ constrained by inequalities $$s_{1, 1} \leq m_1, \;\;\; s_{2, 2} \leq m_2, \;\;\; s_{2, 2} + s_{2, \overline{2}} \leq m_2,$$ $$s_{1, 1} + s_{1, 2} + s_{2, 2} \leq m_1 + m_2, \;\;\; s_{1, 1} + s_{1, 2} + s_{1, \overline{2}} + s_{1, \overline{1}} \leq m_1 + m_2,$$ $$s_{1, 1} + s_{1, 2} + s_{1, \overline{2}} + s_{2, \overline{2}} \leq m_1 + m_2, \;\;\; s_{1, 1} + s_{1, 2} + s_{2, 2} + s_{2, \overline{2}} \leq m_1 + m_2.$$ \end{exam} We will prove the following results. \begin{thm}\label{OddFFLV} Let $\la = m_1 \omega_1 + ... + m_n \omega_n$ be an integral weight of $\msp_{2n + 1}$ with $m_i \in {\mathbb Z}_{\geq 0}$ for all $i$. Then the set $$f^{\bs} v_{\la}, \bs \in FFLV^{{\mathbb Z}}_{2n + 1}(\la),$$ is a basis of the indecomposable trace-free representation $\mathcal{V}_{0}(\la)$ and of the associated graded space $\operatorname{gr} \mathcal{V}_{0}(\la)$ with respect to PBW filtration. \end{thm} \begin{thm}\label{OddSubmodule} The $S(\tilde\n^{-})$-module generated by cyclic vector $$v_{\la} \otimes v_{\mu} \in \operatorname{gr} \mathcal{V}_{0}(\la) \otimes \operatorname{gr} \mathcal{V}_{0}(\mu)$$ is isomorphic to $\operatorname{gr} \mathcal{V}_{0}(\la + \mu)$. \end{thm} \begin{thm}\label{OddMinkowski} We have an equality of the Minkowski sums of sets $$FFLV_{2n + 1}^{{\mathbb Z}}(\la) + FFLV_{2n + 1}^{{\mathbb Z}}(\mu) = FFLV_{2n + 1}^{{\mathbb Z}}(\la + \mu).$$ \end{thm} To prove these results we first demonstrate basic lemmas about the structure of representations $\mathcal{V}_{0}(\la)$. In particular, we obtain a simpler basis given by monomials from $U(\tilde\n^{-})$. The proof strategy of Theorem \ref{EvenFFLV} from \cite{FFL2} requires modifications in order to be applied to Theorem \ref{OddFFLV}. We show how to modify the strategy. In fact, our modification is a slight generalization because the Theorem \ref{EvenFFLV} follows from our results. \begin{rem} In the work \cite{Proctor} the highest weight $\la$ of $\mathcal{V}_{0}(\la)$ has height up to $n + 1$. However, representations with $\la_{n + 1} \neq 0$ contribute no non-trivial statements since they are obtained from those with $\la_{n + 1} = 0$ by tensoring with $\mgl_1$ representation ${\mathbb C}_{|\la_{n + 1}|}$. \end{rem} \section{Basic structure of $\mathcal{V}_{0}(\la)$} The branching rule given by Lemma \ref{BranchingRule} implies that $\msp_{2n}$ subrepresentations of $\mathcal{V}_{0}(\la)$ are enumerated by tuples $$(\tilde\mu_1, ..., \tilde\mu_n) \in {\mathbb Z}^{n},\; 0 \leq \tilde\mu_i \leq m_i \;\; \forall i.$$ Let $\delta(\la)$ denote the set of such tuples. We also denote by $f^{\tilde\mu}$ the monomial $$f^{\tilde\mu} = \prod\limits_{i = 1}^{n} E_{2n + 1, i}^{\tilde\mu_i} \in U(\tilde\n^{-}).$$ As a result of this section we will prove the following claim. \begin{thm}\label{ExtraThm} Let $\la = m_1 \omega_1 + ... + m_n \omega_n$ be an integral weight of $\msp_{2n + 1}$ with $m_i \geq 0$ for all $i$. Then the set $$f^{\bs}f^{\tilde\mu} v_{\la},\; \tilde\mu \in \delta(\la),\; \bs \in FFLV^{{\mathbb Z}}_{2n}(\la - \tilde\mu),$$ is a basis of the indecomposable trace-free representation $\mathcal{V}_{0}(\la)$ and of the associated graded space $\operatorname{gr} \mathcal{V}_{0}(\la)$ with respect to PBW filtration. \end{thm} Due to isomorphism of $\msp_{2n}$ representations (Lemma \ref{BranchingRule}) $$\mathcal{V}_{0}(\la) \cong \bigoplus_{\mu \prec \la} V_{\msp_{2n}}(\mu),$$ it is enough to prove the spanning property. The linear independence will follow from dimension considerations. We separate the proof into several lemmas. First, we prove that spanning property follows from non-vanishing of projections of certain vectors on $V_{\msp_{2n}}(\mu)$. Second, we prove that the vector $v_{\la}$ is cyclic in $\mathcal{V}_0(\la)$. Finally, we show that Theorem \ref{ExtraThm} follows from these statements. \begin{lem}\label{Lemma1} Suppose the projection of $f^{\tilde\mu}v_{\la}$ on $V_{\mathfrak{sp}_{2n}}(\la - \tilde\mu)$ is non-zero for all $\tilde\mu \in \delta(\la)$. Then Theorem \ref{ExtraThm} is true. \end{lem} \begin{proof} Let us prove that the set of vectors from Theorem \ref{ExtraThm} spans all subrepresentations $V_{\mathfrak{sp}_{2n}}(\mu)$, $\mu \prec \la$. The proof will go by decreasing induction on $\mu$, where the order $\prec$ on the highest weights is the standard one. Induction base: if $\mu$ is maximal with respect to $\prec$, then $\mu = \la$ and $f^{\la - \la}v_{\la} = v_{\la}$. The spanning property follows from the spanning property of the set $f^{\bs} v_{\la}, \; \bs \in FFLV^{{\mathbb Z}}_{2n}(\la)$. Induction step: by assumption the vector $f^{\lambda - \mu}v_{\lambda}$ is non-zero. Its weight with respect to the subalgebra $\msp_{2n} \oplus \mathfrak{gl}_1$ is equal to $(\mu, |\la| - |\mu|)$. By definition of $\prec$ such weight subspace can only be present in representations $V_{\msp_{2n}}(\nu)$ with $\mu \prec \nu$. By induction we can make a linear combination with $f^{\lambda - \mu}v_{\lambda}$ such that it has weight $\mu$ and lies in $V_{\msp_{2n}}(\mu)$. Here we used the fact that the representation $\mathcal{V}_{0}(\la)$ has no multiplicities when restricted to $\msp_{2n}$. The step is finished by the spanning property of the set $f^{\bs} v_{\la}, \; \bs \in FFLV^{{\mathbb Z}}_{2n}(\mu)$. \end{proof} \begin{lem}\label{Lemma2} The highest weight vector $v_{\la}$ is cyclic in representation $\mathcal{V}_{0}(\la)$ with respect to the action of $\msp_{2n + 1}$. \end{lem} \begin{proof} Let $v_{\mu}$ be the highest weight vector of subrepresentation $V_{\msp_{2n}}(\mu)$ of subalgebra $\msp_{2n}$. It is enough to show that $v_{\mu}$ is contained in the orbit of $v_{\la}$. Let $W = \langle e_1, ..., e_n, e_{2n + 1} \rangle$. Note that $v_{\mu} \in W^{\otimes |\la|} \subset V^{\otimes |\la|}$, because its weight with respect to $GL(V)$ action is equal to $$(\mu_1, \mu_2, ..., \mu_n, 0, ..., 0, |\la| - |\mu|).$$ Introduce the subspace $$W^{\la} = W^{\otimes |\la|} \cap \mathcal{V}_{0}(\la).$$ Note that the form $\omega$ vanishes on any pair of vectors from $W$. Therefore $W^{\otimes |\la|}$ consists of trace-free elements and we can write $$W^{\la} = W^{\otimes |\la|} \cap V^{\la}.$$ By definition $V^{\la}$ is equal to the image of $V^{\otimes |\la|}$ under the action of Young symmetrizer $c_{\la}$. We claim that $W^{\lambda} = W^{\otimes |\la|} \cap V^{\la} = c_{\la}(W^{\otimes |\la|})$. The last equality is evident from the consideration of decomposable tensors formed by basis vectors. It follows that $W^{\la} = c_{\la}(W^{\otimes |\la|})$ is isomorphic to the irreducible representation of $\mathfrak{gl}(W)$ of highest weight $\la$. However, there is a subalgebra $\g \subset \mgl(W) \subset \msp_{2n + 1}$ that contains a lower-triangular subalgebra of $\mgl(W)$. It follows that the vector $v_{\la} \in W^{\la} \subset V^{\la}$ is cyclic in $W^{\la}$ with respect to the action of $\mathfrak{g} \subset \mathfrak{gl}(W)$. We conclude that its orbit contains all vectors $v_{\mu}$ and the Lemma follows. \end{proof} \noindent We are ready to prove Theorem \ref{ExtraThm}. \begin{proof} By Lemma \ref{Lemma2} the vector $v_{\la}$ is cyclic. It vanishes under the action of $\tilde\n^{+}$, thus by commutations we find that $U(\tilde\n^{-}) v_{\la} = \mathcal{V}_{0}(\la)$. Since $$[\n^{-}, F^{-}] \subset F^{-},$$ by commutations we can obtain $$U(\n^{-})U(F^{-}) v_{\la} = \mathcal{V}_{0}(\la).$$ Therefore $v_{\mu}$ can be written as $$v_{\mu} = \sum_{j} n_j f_j v_{\la},\; f_j \in U(F^{-}),\; n_j \in U(\n^{-}).$$ However, the vector $v_{\mu}$ does not belong to $\n^{-} \cdot U(\n^{-}) \mathcal{V}_{0}(\la)$ by definition of the highest weight vector. Thus at least for one $j$ we have $n_j = 1$. By weight computation we find that $f_j = C f^{\la - \mu}$ for some constant $C \in {\mathbb C}$. By noting that $v_{\mu} - f_j v_{\la} \in \n^{-}\cdot U(\n^{-})U(F^{-})\mathcal{V}_0(\la)$ we conclude that the projection of $f^{\la - \mu} v_{\la}$ on $V(\mu)$ is non-zero. We finish the proof by Lemma \ref{Lemma1}. \end{proof} \noindent As a corollary we obtain a combinatorial graded character formula. \begin{cor}\label{SimpleqChar} $$\ch_{q} \mathcal{V}_{0}(\la) = \sum\limits_{\substack{\tilde\mu \in \delta(\la),\\ \bs \in FFLV^{{\mathbb Z}}_{2n}(\la - \tilde\mu)}} e^{\la - \operatorname{wt}(\tilde\mu) - \operatorname{wt}(\bs)} q^{\deg(\bs) + \deg(\tilde\mu)}.$$ \end{cor} \noindent Another corollary is Theorem \ref{OddSubmodule}. \begin{proof} We have an equality of $S(\n^{-})$-modules $$\operatorname{gr} \mathcal{V}_{0}(\la) = \bigoplus_{\nu \prec \la + \mu} \operatorname{gr} V_{\msp_{2n}}(\nu).$$ By Theorem \ref{ExtraThm} the projection of the vector $f^{\tilde\la}v_{\la} \otimes f^{\tilde\mu}v_{\mu}$ on $\operatorname{gr} V_{\msp_{2n}}(\la - \tilde\la) \otimes \operatorname{gr} V_{\msp_{2n}}(\mu - \tilde\mu)$ is non-zero and equal to a multiple of $v_{\la - \tilde\la} \otimes v_{\mu - \tilde\mu}$. By Theorem \ref{EvenSubmodule} under the action of $S(\mathfrak{n}^{-})$ the vector $v_{\lambda - \tilde\lambda} \otimes v_{\mu - \tilde\mu}$ generates a submodule isomorphic to $\operatorname{gr} V_{\msp_{2n}}(\lambda + \mu - \tilde\lambda - \tilde\mu) = \operatorname{gr} V_{\msp_{2n}}(\lambda + \mu - \tilde\nu)$. Since $f^{\tilde\nu}(v_{\lambda} \otimes v_{\mu})$ is a sum of linearly independent vectors $$f^{\tilde\nu}(v_{\lambda} \otimes v_{\mu}) = \sum\limits_{\tilde\lambda + \tilde\mu = \tilde\nu} C_{\tilde\lambda, \tilde\mu} f^{\tilde\lambda}v_{\lambda} \otimes f^{\tilde\mu}v_{\mu},$$ for some constants $C_{\tilde\lambda, \tilde\mu}$, then $f^{\tilde\nu}(v_{\lambda} \otimes v_{\mu})$ also generates a submodule isomorphic to $\operatorname{gr} V_{\msp_{2n}}(\lambda + \mu - \tilde\nu)$. It follows that we can combine the results over all $\tilde\nu \in \delta(\la + \mu)$ and conclude that $v_{\lambda} \otimes v_{\mu}$ generates $S(\tilde\n^{-})$-module $\text{gr } \mathcal{V}_{0}(\lambda + \mu).$ \end{proof} \section{Main Theorems} In this section we will prove Theorems \ref{OddFFLV} and \ref{OddMinkowski}. For Theorem \ref{OddFFLV} we will follow the proof strategy of the Theorem \ref{EvenFFLV} from \cite{FFL2} with certain adjustments. Since the main part of the argument remains the same, we do not repeat all the details, referring to \cite{FFL2} where possible. By Theorem \ref{ExtraThm} we have $S(\tilde\n^{-}) v_{\la} = \operatorname{gr} \mathcal{V}_{0}(\la)$. Therefore we can write $\operatorname{gr} \mathcal{V}_{0}(\la)$ as $S(\tilde\n^{-}) / I(\la)$ for some ideal $I(\la)$. By examining the weights we see that the vector $v_{\la} \in \mathcal{V}_{0}(\lambda)$ vanishes under the action of certain operators, $$ f_{i, j}^{m_i + ... + m_j + 1} v_{\la} = 0, \;\; f_{i, \overline{i}}^{m_i + ... + m_n + 1}v_{\la} = 0.$$ It follows that they belong to $I(\la)$. Let $$R = \text{span}\{ f_{i, j}^{m_i + ... + m_j + 1}, \; 1 \leq i \leq j \leq n - 1, \; f_{i, \overline{i}}^{m_i + ... + m_n + 1}, \; 1 \leq i \leq n \}.$$ As a byproduct, during the proof of Theorem \ref{OddFFLV}, we will obtain the following statement. \begin{lem} $I(\la) = S(\tilde\n^{-})(U(\tilde\n^{+}) \circ R).$ \end{lem} We use differential operators $\pa_{\al}$ defined for $\msp_{2n}$ roots $\al \in R^{+}$ as $$ \pa_\al f_\beta = \begin{cases} f_{\beta - \al},\ \text{ if } f_{\beta - \al} \in \tilde\n^{-},\\ 0,\ \text{ otherwise}. \end{cases} $$ We also introduce one new differential operator $$\pa_{1, n} = \ad\; E_{2n + 1, n + 1},$$ with the key property $\pa_{1, n} f_{1, \overline{1}} = [E_{2n + 1, n + 1}, E_{n + 1, 1}] = E_{2n + 1, 1} = f_{1, n}$. We also set up the notation, $$s_{i, \bullet} = \sum_{j = i}^{n} s_{i, j} + \sum_{j = i}^{n} s_{i, \overline{j}}, \;\; s_{\bullet, i} = \sum_{j = 1}^{i} s_{j, i},$$ $$d(\bs) = (s_{n, \bullet}, s_{n - 1, \bullet}, ..., s_{1, \bullet}).$$ Write $d(\bs) > d(\bt)$ if the list $d(\bs)$ is greater than $d(\bt)$ according to the standard lexicographical order. Define the order on the variables $f_{\al} \in S(\tilde\n^{-})$. \begin{equation*} \begin{array}{rcl} & f_{n, \overline{n}} > f_{n, n} > & \\ f_{n - 1,\overline{n - 1}} & > f_{n - 1, \overline{n}} > f_{n - 1, n} > & f_{n - 1, n - 1} > \\ f_{n - 2, \overline{n - 2}} > f_{n - 2, \overline{n - 1}} & > f_{n - 2, \overline{n}} > f_{n - 2, n} > & f_{n - 2, n - 1} > f_{n - 2, n - 2} > \\ \ldots & > \ldots > & \ldots >\\ f_{1, \overline{1}} > f_{1, \overline{2}} > \ldots & > f_{1, \overline{n}} > f_{1, n} > & \ldots > f_{1,2} > f_{1,1}. \end{array} \end{equation*} The order $>$ extends to a monomial order on $S(\tilde\n^{-})$. We will use one more important monomial order on $S(\tilde\n^{-})$. For $\bs, \bt \in {\mathbb Z}_{\geq 0}^{n(n + 1)}$ denote $\bs \succ \bt$ if one of the following conditions hold: \begin{itemize} \item[{\it a)}] $\deg(\bs) > \deg(\bt)$; \item[or {\it b)}] total degree is the same, but $d(\bs) < d(\bt)$; \item[or {\it c)}] total degree is the same, $d(\bs) = d(\bt)$, but $f^\bs > f^\bt$. \end{itemize} We are ready to prove Theorem \ref{OddFFLV}. \begin{proof} From the papers \cite{Proctor} and \cite{ABS} we know that $$\dim \mathcal{V}_{0}(\la) = |FFLV_{2n + 1}^{{\mathbb Z}}(\la)|.$$ Therefore, it is enough to prove that the set of vectors $$f^{\bs} v_{\la}, \; \bs \in FFLV_{2n + 1}^{{\mathbb Z}}(\la),$$ spans $\operatorname{gr} \mathcal{V}_{0}(\la)$. During the proof of Theorem \ref{ExtraThm} we have obtained $$S(\tilde\n^{-}) v_{\la} = \operatorname{gr} \mathcal{V}_{0}(\la).$$ As shown in \cite{FFL2}, it suffices to prove that any element $f^{\bs} \in S(\tilde\n^{-})$ with $\bs \in {\mathbb Z}_{\geq 0}^{n(n + 1)} \setminus FFLV_{2n + 1}^{{\mathbb Z}}(\la)$ has a \textit{straightening law}: $$f^{\bs} + \sum_{\bs \succ \bt} f^{\bt} \in I(\la),$$ where $\succ$ is a monomial order. Before presenting a straightening law we consider a sequence of reductions. Since $\bs \in {\mathbb Z}_{\geq 0}^{n(n + 1)} \setminus FFLV_{2n + 1}^{{\mathbb Z}}(\la)$, then for some symplectic Dyck path $p = (p(0), ..., p(k))$ the inequality is violated. Since the order $\succ$ is monomial, it is enough to find straightening law for $\bs$ restricted to the support of path $p$. Suppose that path $p$ starts at $p(0) = \al_{i, i}$. If $i \neq 1$, then we can apply induction on $n$ by using the inclusion $\msp_{2(n - 1) + 1} \subset \msp_{2n + 1}$. From now on we assume that $p(0) = \al_{1, 1}$. Suppose that path $p$ ends at $p(k) = \al_{j, j}$. Note that any path ending at $\al_{n, n}$ can be extended to end at $\al_{n, \overline{n}}$ without weakening the inequality. Thus we can assume that $j \neq n$. According to \cite{FFL2}, it follows that the straightening law of $\msl_{n}$ can be applied, since the support of $p$ contains only roots of the subalgebra $\msl_{n}$. Therefore the case $p(k) = \al_{j, j}$ is solved. From now on we assume that $p(k) = \al_{j, \overline{j}}$. To sum up the reductions of the previous paragraph, it is enough to consider lattice points $\bs$ with the support on a single path $p$ that starts at $p(0) = \al_{1, 1}$ and ends at $p(k) = \al_{j, \overline{j}}$. Moreover, the inequality $$\sum_{\al \in p} s_{\al} \leq m_1 + ... + m_n$$ is violated. Therefore $\Sigma = \sum_{\al \in p} s_{\al} \geq m_1 + ... + m_n + 1$. And it follows that $f_{1, \overline{1}}^{\Sigma} \in I(\la)$. Define the differential operators $$ \Delta_1 := \pa_{1, i - 1}^{s_{\bullet,\bar i} + s_{i,\bullet}} \underbrace{ \pa_{i + 1, \overline{i + 1}}^{s_{\bullet, i}} \ldots \pa_{n, \overline{n}}^{s_{\bullet, n - 1}} }_{\delta_3} \cdot $$ $$ \cdot\underbrace{ \underline{\pa_{1, n}^{s_{\bullet, n}}} \pa_{1,n-1}^{s_{\bullet, n - 1} + s_{\bullet, \overline{n}}} \ldots \pa_{1,i}^{s_{\bullet,i}+s_{\bullet,\overline{i+1}}} }_{\delta_2} \underbrace{ \pa_{1,\bar i}^{s_{\bullet,i-1}}\dots \pa_{1,\bar 3}^{s_{\bullet,2}}\pa_{1,\bar 2}^{s_{\bullet,1}} }_{\delta_1} $$ (so $\Delta_1 := \pa_{1, i - 1}^{s_{\bullet, \overline{i}} + s_{i, \bullet}} \delta_3 \delta_2 \delta_1$) and $$ \Delta_2:=\pa_{1,1}^{s_{2,\bullet}}\pa_{1,2}^{s_{3,\bullet}}\dots \pa_{1,i-2}^{s_{i-1,\bullet}}. $$ Here we underlined the only difference from operators defined in \cite{FFL2}, the term $\pa_{1, n}^{s_{\bullet, n}}$. We claim that the element $\Delta_2 \Delta_1 f^{\Sigma}_{1, \overline{1}}$ provides a straightening law $$\Delta_2 \Delta_1 f^{\Sigma}_{1, \overline{1}} = c_{\bs} f^{\bs} + \sum_{\bs \succ \bt} c_{\bt} f^{\bt} \in I(\la).$$ The following argument is identical to the one presented in \cite{FFL2}. We can show by induction that $$\delta_1 (f_{1, \overline{1}}) = f^{s_{\bullet, 1}}_{1, 1} f^{s_{\bullet, 2}}_{1, 2} ... f^{s_{\bullet, i - 1}}_{1, i - 1} f^{\Sigma - s_{\bullet, 1} - ... - s_{\bullet, i - 1}}_{1, \overline{1}}.$$ By noticing that all operators from $\pa_{1, i - 1}^{s_{\bullet, \overline{i}} + s_{i, \bullet}} \delta_3\delta_2$ kill the terms $f_{1, j},\; j \leq i - 1$, we write $$\Delta_1 (f_{1, \overline{1}}) = f^{s_{\bullet, 1}}_{1, 1} f^{s_{\bullet, 2}}_{1, 2} ... f^{s_{\bullet, i - 1}}_{1, i - 1} \pa_{1, i - 1}^{s_{\bullet, \overline{i}} + s_{i, \bullet}} \delta_3\delta_2 (f^{\Sigma - s_{\bullet, 1} - ... - s_{\bullet, i - 1}}_{1, \overline{1}}).$$ Next we obtain $$\delta_2 (f^{\Sigma - s_{\bullet, 1} - ... - s_{\bullet, i - 1}}_{1, \overline{1}}) = f^{s_{\bullet, \overline{i}} + s_{\bullet, i - 1}}_{1, \overline{i + 1}} ... f^{s_{\bullet, \overline{n}} + s_{\bullet, n - 1}}_{1, \overline{n}} f^{s_{\bullet, n}}_{1, n} f^{s_{\bullet, \overline{i}}}_{1, \overline{1}} + $$ $$ + \sum_{\bt} (\text{terms with non-zero entries in } \bt \text{ below row } i).$$ Note that no operator from $\Delta_2, \delta_3, \pa_{1, i - 1}$ can decrease the sum of entries of $\bt$ in rows below $i$. Since the monomial order $\succ$ is smaller for elements $f^{\bt}$ with larger $d(\bt)$, we conclude that terms $f^{\bt}$ with non-zero entries below row $i$ will remain smaller than $f^{\bs}$ after the action of all operators. The operator $\delta_3$ kills the term $f_{1, n}$. Therefore the result of its action on $\delta_2 (f^{\Sigma - s_{\bullet, 1} - ... - s_{\bullet, i - 1}}_{1, \overline{1}})$ is analogous to the $\msp_{2n}$ case: $$\delta_3 \delta_2 (f^{\Sigma - s_{\bullet, 1} - ... - s_{\bullet, i - 1}}_{1, \overline{1}}) = f^{s_{\bullet, i}}_{1, i} f^{s_{\bullet, i + 1}}_{1, i + 1} ... f^{s_{\bullet, n}}_{1, n} f^{s_{\bullet, \overline{n}}}_{1, \overline{n}} ... f^{s_{\bullet, \overline{i + 1}}}_{1, \overline{i + 1}} f^{s_{\bullet, \overline{i}}}_{1, \overline{1}} + $$ $$ + \sum_{\bt} (\text{terms with non-zero entries in } \bt \text{ below row } i).$$ The operator $\pa_{1, i - 1}$ either moves the element from row 1 to row $i$ or it changes $f_{1, \overline{1}}$ to $f_{1, \overline{i}}$. To maximize the monomial order $\succ$ we have to minimize the sum of entries in row $i$ (and keep entries in rows below $i$ equal to $0$), which is achieved when $\pa_{1, i - 1}$ is applied $s_{\bullet, \overline{i}}$ times to $f^{s_{\bullet, \overline{i}}}_{1, \overline{1}}$. Denote $$f^{\bs'} = f^{s_{\bullet, 1}}_{1, 1} f^{s_{\bullet, 2}}_{1, 2} ... f^{s_{\bullet, q} - s_{i, q}}_{1, q} f^{s_{i, q}}_{i, q} ... f^{s_{i, \overline{i}}}_{i, \overline{i}},$$ where $q = \min \{ j \vert \; \al_{i, j} \in p\}$ from the poset $1 < 2 < ... < n < \overline{n} < ... < \overline{1}$. Then we can show that $$\Delta_1(f_{1, \overline{1}}^{\Sigma}) = f^{\bs'} + $$ $$ + \sum_{\bs' \succ \bt}(\text{terms with } d(\bt) > d(\bs') \text{ or with } f_{i, i}^{t_{i, i}}f_{i, i + 1}^{t_{i, i + 1}} ... f_{i, \overline{i}}^{t_{i, \overline{i}}} < f_{i, i}^{s_{i, i}} ... f_{i, \overline{i}}^{s_{i, \overline{i}}}).$$ Finally, when applied to $f^{\bs'}$, the operator $\Delta_2$ moves elements from top row 1 to rows between 1 and $i$. To maximize the monomial order $\succ$ it will leave non-zero entries on the support of the considered path as shown in \cite{FFL2}. \end{proof} \begin{rem} It is not hard to show that simultaneous swap of the roots $\al_{i, n}$ and $\al_{i, \overline{n}}$ for all $i$ (and of the elements $f_{i, n}$ and $f_{i, \overline{n}}$ for all $i$) in the root poset definition also gives a valid FFLV polytope and PBW bases. That means, we can instead define $$f_{i, n} = f_{\al_i + ... + \al_n}, \;\; f_{i, \overline{n}} = E_{2n + 1, i},$$ but we have to modify the operators $\Delta_1, \Delta_2$ accordingly. \end{rem} \begin{rem} Note that specializing the argument to the case $s_{i, n} = 0$ for all $i$ gives a basis of subrepresentation $V_{\msp_{2n}}(\la)$ and thus proves Theorem \ref{EvenFFLV}. \end{rem} \begin{cor} $\ch_{q} \mathcal{V}_{0}(\la) = \sum\limits_{\bs \in FFLV^{{\mathbb Z}}_{2n + 1}(\la)} e^{\la - \operatorname{wt}(\bs)} q^{\deg(\bs)}.$ \end{cor} Finally, we show that Theorem \ref{OddMinkowski} is a corollary of Theorem \ref{EvenMinkowski}. \begin{proof} Let $\la = (\la_1, ..., \la_n, 0)$ be the weight of $\msp_{2n + 2}$. Consider the polytope $P_{2n + 1}(\la)$ defined as the the intersection of the polytope $FFLV_{2n + 2}(\la)$ with the subspace $\{ s_{i, \overline{n + 1}} = 0, \; i = 1, 2, ..., n + 1\}$, $$P_{2n + 1}(\la) = FFLV_{2n + 2}(\la) \cap \{ s_{i, \overline{n + 1}} = 0 \; \forall i\}.$$ Convex polytopes $P_{2n + 1}(\la)$ and $FFLV_{2n + 1}(\la)$ are equal as polytopes in $\R^{n(n + 1)}$. By Theorem \ref{EvenMinkowski} and the fact that $s_{i, \overline{n + 1}} \geq 0 \; \forall i$ we get $$P_{2n + 1}^{{\mathbb Z}}(\la) + P_{2n + 1}^{{\mathbb Z}}(\mu) = P_{2n + 1}^{{\mathbb Z}}(\la + \mu),$$ which translates to the equality $$FFLV_{2n + 1}^{{\mathbb Z}}(\la) + FFLV_{2n + 1}^{{\mathbb Z}}(\mu) = FFLV_{2n + 1}^{{\mathbb Z}}(\la + \mu).$$ \end{proof} \printbibliography \end{document}
\section{Introduction} Broadly speaking, the classic OT problem provides a principled approach for transporting one probability distribution onto another following the principle of the least effort. Such a problem, and the distance on the space of probability distributions derived from it, arise in many areas of machine learning (ML) including generative modeling, transfer learning and information retrieval, where OT has been successfully applied. A natural extension of classic OT, in which the admissible transport plan (a.k.a coupling) can have more than two prescribed marginal distributions, is called the multi-marginal optimal transport (MMOT) \citep{Gangbo98}. The latter has several attractive properties: it enjoys the duality theory \citep{Kellerer84} and finds connections with the Wasserstein barycenter problem \citep{Agueh11} used for data averaging and probabilistic graphical models \citep{Haasler20}. While being far less popular than the classic OT with two marginals, MMOT is a very useful framework on its own with some notable recent applications in generative adversarial networks \citep{Cao19}, clustering \citep{Mi21} and domain adaptation \citep{HuiLCHY18,HeZKSC19}, to name a few. The recent success of OT in ML is often attributed to the entropic regularization \citep{Cuturi13} where the authors imposed a constraint on the coupling matrix forcing it to be closer to the independent coupling given by the rank-one product of the marginals. Such a constraint leads to the appearance of the strongly convex entropy term in the objective function and allows the entropic OT problem to be solved efficiently using simple Sinkhorn-Knopp matrix balancing algorithm. In addition to this, it was also noticed that structural constraints allow to reduce the prohibitively high sample-complexity of the classic OT problem \citep{Genevay19,Forrow18}. While these and several other recent works \citep{Chiheng21,Meyer21a} addressed structural constraints in the classic OT problem with two marginals, none of them considered a much more challenging case of doing so in a multi-marginal setting. On the other hand, while the work of \citep{Haasler20} considers the MMOT problem in which the cost tensor induced by a graphical structure, it does not naturally promote the factorizability of transportation plans. \paragraph{Contributions} In this paper, we define and study a general MMOT problem with structural penalization on the coupling matrix. We start by showing that a such formulation includes several popular OT methods as special cases and allows to gain deeper insights into them. We further consider a relaxed problem where hard constraints are replaced by a regularization term and show that it leads to an instance of the difference of convex programming problem. A numerical study of the solutions obtained when solving the latter in cases of interest highlights their competitive performance when compared to solutions provided by the optimization strategies used previously. \section{Preliminary knowledge} \paragraph{Notations.} For each integer $n \geq 1$, we write $[n] := \{1,...,n\}$. For each discrete probability measure $\mu$ with finite support, its negative entropy is defined as $H(\mu) = \langle \mu, \log \mu \rangle$, where the logarithm operator is element-wise, with the convention that $0 \log 0 = 0$. Here, $\langle \cdot, \cdot \rangle$ denotes the Frobenius inner product. The Kullback-Leibler divergence between two discrete probability measures $\mu$ and $\nu$ with finite supports is defined as \begin{equation*} \text{KL}(\mu \vert \nu) = \begin{cases} \langle \mu, \log\frac{\mu}{\nu} \rangle, \text{ if } \mu \text{ is absolutely continuous with respect to } \nu \\ \infty, \text{ otherwise}. \end{cases} \end{equation*} where the division operator in the logarithm is element-wise. In what follows, we write $\mathcal T = (1,...,N)$, for some integer $N \geq 1$. For any positive integers $a_1,..., a_N$, we call $P \in \mathbb R^{a_1 \times ... \times a_N}$ a $N$-D tensor. In particular, a $1$-D tensor is a vector and $2$-D tensor is a matrix. A tensor is a probability tensor if its entries are nonnegative and the sum of all entries is $1$. Given $N$ probability vectors $\mu_1, ..., \mu_N$, we write $\mu = (\mu_n)_{n=1}^N$. We denote $\Sigma_{\mathcal T}$ the set of $N$-D probability tensors and $U_{\mathcal T} \subset \Sigma_{\mathcal T}$ the set of tensors whose $N$ marginal distributions are $\mu_1, ..., \mu_N$. Any coupling in $U_{\mathcal T}$ is said to be \textit{admissible}. We write $\mu_{\mathcal T} := \mu_1 \otimes ... \otimes \mu_N$ the tensor product (or measure product) of $\mu_1, ..., \mu_N$. \paragraph{Multi-marginal OT problem.} Given a collection of $N$ probability vectors $\mu = (\mu_n \in \mathbb R^{a_n})_{n=1}^N$ and a $N$-D cost tensor $C \in \mathbb R^{a_1 \times ... \times a_N}$, the MMOT problem reads \begin{equation} \text{MMOT}(\mu) = \inf_{P \in U_{\mathcal T}} \langle C, P \rangle. \end{equation} In practice, such a formulation is intractable to optimize in a discrete setting as it results in a linear program where the number of constraints grows exponentially in $N$. A more tractable strategy for solving MMOT is to consider the following entropic regularization problem \begin{equation} \label{MMOT_primal} \inf_{P \in U_{\mathcal T}} \langle C, P \rangle + \varepsilon \text{KL}(P \vert \mu_{\mathcal T}). \end{equation} which can be solved using Sinkhorn's algorithm \cite{Benamou14}. We refer the interested reader to Supplementary materials for algorithmic details. \section{Factored Multi-marginal Optimal Transport} In this section, we first define a factored MMOT (F-MMOT) problem where we seek to promote a structure on the optimal coupling given such as a factorization into a tensor product. Interestingly, such a formulation can be shown to include several other OT problems as special cases. Then, we introduce a relaxed version called MMOT-DC where the factorization constraint is smoothly promoted through a Kullback-Leibler penalty. \subsection{Motivation} Before a formal statement of our problem, we first give a couple of motivating examples showing why and when structural constraints on the coupling matrix can be beneficial. To this end, first note that a trivial example of the usefulness of such constraints in OT is the famous entropic regularization. Indeed, while most of the works define the latter by adding negative entropy of the coupling to the classic OT objective function directly, the original idea was to constraint the sought coupling to remain close (to some extent) to a rank-one product of the two marginal distributions. The appearance of negative entropy in the final objective function is then only a byproduct of such constraint due to the decomposition of the KL divergence into a sum of three terms with two of them being constant. Below we give two more examples of real-world applications related to MMOT problem where a certain decomposition imposed on the coupling tensor can be desirable. \paragraph{Multi-source multi-target translation.} A popular task in computer vision is to match images across different domains in order to perform the so-called image translation. Such tasks are often tackled within the GAN framework where one source domain from which the translation is performed, is matched with multiple target domains modeled using generators. While MMOT was applied in this context by \citet{Cao19} when only one source was considered, its application in a multi-source setting may benefit from structural constraints on the coupling tensor incorporating the human prior on what target domains each source domain should be matched to. \paragraph{Multi-task reinforcement learning.} In this application, the goal is to learn individual policies for a set of agents while taking into account the similarities between them and hoping that the latter will improve the individual policies. A common approach is to consider an objective function consisting of two terms where the first term is concerned with learning individual policies, while the second forces a consensus between them. Similar to the example considered above, MMOT problem was used to promote the consensus across different agents' policies in \citep{Cohen21}, even though such a consensus could have benefited from a prior regarding the semantic relationships between the learned tasks. \subsection{Factored MMOT and its relaxation} We start by giving several definitions used in the following parts of the paper. \begin{definition}[Tuple partition] A sequence of tuples $(\mathcal T_m)_{m=1}^M$, with $M \leq N$, is called a \underline{partition} of a $N$-tuple $\mathcal T$ if the tuples $\mathcal T_1, ..., \mathcal T_M$ are nonempty and disjoint, and their concatenation gives $\mathcal T$. \end{definition} Here, we implicitly take into account the order of the tuple, which is not the case for the partition of a set. If there exists a tuple in $(\mathcal T_m)_{m=1}^M$ which contains only one element, then we say $(\mathcal T_m)_{m=1}^M$ is \textit{degenerate}. \begin{definition}[Marginal tensor] Given a tensor $P \in \mathbb R^{a_1 \times ... \times a_N}$ and a partition $(\mathcal T_m)_{m=1}^M$ of $\mathcal T = (1,...,N)$, we call $P_{\# m}$ the \underline{$\mathcal T_m$-marginal tensor}, by summing $P$ over all dimensions not in $\mathcal T_m$. We write $P_{\# \mathcal T} = P_{\# 1} \otimes ... \otimes P_{\# M} \in \mathbb R^{a_1 \times ... \times a_N}$ the tensor product of its marginal tensors. \end{definition} For example, for $M=N=2$ and $\mathcal T = (1,2)$, we have $\mathcal T_1 = (1)$ and $\mathcal T_2 = (2)$. So, given a matrix $P \in \mathbb R^{a_1 \times a_2}$, its marginal tensors $P_{\# 1}$ and $P_{\# 2}$ are vectors in $\mathbb R^{a_1}$ and $\mathbb R^{a_2}$, respectively, defined by $(P_{\# 1})_i = \sum_j P_{ij}$ and $(P_{\# 2})_j = \sum_i P_{ij}$ for $(i,j) \in [a_1] \times [a_2]$. The tensor product $P_{\# \mathcal T} \in \mathbb R^{a_1 \times a_2}$ is defined by $(P_{\# \mathcal T})_{ij} = (P_{\# 1})_i (P_{\# 2})_j$. Clearly, if $P$ is a probability tensor, then so are its marginal tensors. Suppose $\mathcal T_m = (p,...,q)$ for $m=1,...,M$ and $1 \leq p \leq q \leq N$. We denote $\Sigma_{\mathcal T_m}$ the set of probability tensors in $\mathbb R^{a_p \times ... \times a_q}$ and $U_{\mathcal T_m}$ the set of probability tensors in $\mathbb R^{a_p \times ... \times a_q}$ whose $(r)$-marginal vector is $\mu_r$, for every $r = p,...,q$. We define $\mu_{\mathcal T_m} := \mu_p \otimes ... \otimes \mu_q$ by $(\mu_{\mathcal T_m})_{i_p...i_q} := \prod_r (\mu_r)_{i_r}$, for $i_r \in [a_r]$, with $r=p,...,q$. Clearly, we have $\mu_{\mathcal T} = \mu_{\mathcal T_1} \otimes ... \otimes \mu_{\mathcal T_M}$. \begin{definition}[Factored MMOT] Given a partition $(\mathcal T_m)_{m=1}^M$ of $\mathcal T$ and a collection of histograms $\mu$, we consider the following OT problem \begin{equation} \label{factor_mmot} \tag{F-MMOT} \text{F-MMOT}\big( (\mathcal T_m)_{m=1}^M, \mu \big) = \inf_{P \in \mathcal F_M} \langle C, P \rangle, \end{equation} where $\mathcal F_M \subset U_{\mathcal T}$ is the set of admissible couplings which can be factorized as a tensor product of $M$ component probability tensors in $\Sigma_{\mathcal T_1}, ..., \Sigma_{\mathcal T_M}$. \end{definition} Several remarks are in order here. First, one should note that the partition considered above is in general not degenerate meaning that the decomposition can involve tensors of an arbitrary order $<N$. Second, the decomposition in this setting depicts the prior knowledge regarding the tuples of measures which should be independent: the couplings for the measures from different tuples will be degenerate and the optimal coupling tensor will be reconstructed from couplings of each tuple separately. Third, suppose the partition $(\mathcal T_m)_{m=1}^M$ is not degenerate and $M=2$, i.e. the tensor is factorized as product of two tensors, the problem \ref{factor_mmot} is equivalent to a variation of low nonnegative rank OT (see Appendix for a proof). As for the existence of the solution to this problem, we have that $\mathcal F_M$ is compact because it is a close subset of the compact set $U_{\mathcal T}$, which implies that \ref{factor_mmot} always admits a solution. Furthermore, observe that \begin{equation*} \begin{split} \mathcal F_M &= \{ P \in U_{\mathcal T}: P = P_1 \otimes ... \otimes P_M, \text{where } P_m \in \Sigma_{\mathcal T_m}, \forall m = 1,...,M \} \\ &= \{ P \in \Sigma_{\mathcal T}: P = P_1 \otimes ... \otimes P_M, \text{where } P_m \in U_{\mathcal T_m}, \forall m = 1,...,M \}. \end{split} \end{equation*} Thus, the problem \ref{factor_mmot} can be rewritten as \begin{equation*} \text{F-MMOT}\big( (\mathcal T_m)_{m=1}^M, \mu \big) = \inf_{\substack{P_m \in U_{\mathcal T_m} \\ \forall m = 1,...,M}} \langle C, P_1 \otimes ... \otimes P_M \rangle. \end{equation*} So, if $\mathcal T_1,...,\mathcal T_M$ are $2$-tuples and two marginal distributions corresponding to each $U_{\mathcal T_m}$ are identical and uniform, then by Birkhoff's theorem \citep{Birkhoff46}, \ref{factor_mmot} admits an optimal solution in which each component tensor $P_m$ is a permutation matrix. \paragraph{COOT and GW as special cases.} When $N = 4$ and $M=2$ with $\mathcal T_1 = (a_1,a_2)$ and $\mathcal T_2 = (a_3,a_4)$, the problem \ref{factor_mmot} becomes the CO-Optimal transport \citep{Redko20}, where the two component tensors are known as sample and feature couplings. If furthermore, $a_1 = a_3, a_2=a_4$, and $\mu_1 = \mu_3, \mu_2=\mu_4$, it becomes a lower bound of the discrete Gromov-Wasserstein distance \citep{Memoli11}. This means that our formulation can be seen as a generalization of several OT formulations. \iffalse To approximate the solution of \ref{factor_mmot}, we introduce the entropic factorized MMOT problem defined by \begin{equation*} \text{F-MMOT}_{\varepsilon}\big( (\mathcal T_m)_{m=1}^M, \mu \big) = \inf_{\substack{P_m \in U_{\mathcal T_m} \\ m = 1,...,M}} \langle C, P_1 \otimes ... \otimes P_M \rangle + \varepsilon \sum_{m=1}^M \text{KL}(P_{m} \vert \mu_{\mathcal T_m}), \end{equation*} for $\varepsilon > 0$. When $\varepsilon \to 0$, we have $\text{F-MMOT}_{\varepsilon}\big( (\mathcal T_m)_{m=1}^M, \mu \big) \to \text{F-MMOT}\big( (\mathcal T_m)_{m=1}^M, \mu \big)$ and any cluster point of the sequence of minimisers induces a solution of $\text{F-MMOT}\big( (\mathcal T_m)_{m=1}^M, \mu \big)$. See Appendix for proof. We use block coordinate descent to solve this problem, where each iteration consists in solving $M$ entropic OT problems. Talk about the convergence \citep{Tseng01}. \fi Observe that if a probability tensor $P$ can be factorized as a tensor product of probability tensors, i.e. $P = P_1 \otimes ... \otimes P_M$, then each $P_m$ is also the $\mathcal T_m$-marginal tensor of $P$. This prompts us to consider the following relaxation of factored MMOT, where the hard constraint $\mathcal F_M$ is replaced by a regularization term. \begin{definition}[Relaxed Factored MMOT] Given $\varepsilon \geq 0$, a partition $(\mathcal T_m)_{m=1}^M$ of $\mathcal T$ and a collection of measures $\mu$, we define the following problem: \begin{equation} \label{relax_mmot} \tag{MMOT-DC} \text{MMOT-DC}_{\varepsilon} \big( (\mathcal T_m)_{m=1}^M, \mu \big) = \inf_{P \in U_{\mathcal T}} \langle C, P \rangle + \varepsilon \text{KL}(P \vert P_{\# \mathcal T}). \end{equation} \end{definition} From the exposition above, one can guess that this relaxation is reminiscent of the entropic regularization in MMOT and coincides with it when $M = N$. As such it also recovers the classical entropic OT. One should note that the choice of the KL divergence is not arbitrary and its advantage will become clear when it comes to the algorithm. special case of \ref{relax_mmot} is when $M = N$, we recover the entropic MMOT. After having defined the two optimization problems, we now set on exploring their theoretical properties. \subsection{Theoretical properties} Intuitively, the relaxed problem is expected to allow for solutions with a lower value of the final objective function. We formally prove the validity of this intuition below. \begin{proposition} \label{MMOT_dc_prop} (Preliminary properties) \begin{enumerate} \item $\forall \varepsilon \geq 0, \text{MMOT}(\mu) \leq \text{MMOT-DC}_{\varepsilon}\big( (\mathcal T_m)_{m=1}^M, \mu \big) \leq \text{F-MMOT}\big( (\mathcal T_m)_{m=1}^M, \mu \big)$. \item $\forall \varepsilon > 0, \text{MMOT-DC}_{\varepsilon}\big( (\mathcal T_m)_{m=1}^M, \mu \big) = 0$ if and only if $\text{F-MMOT}\big( (\mathcal T_m)_{m=1}^M, \mu \big) = 0$. \end{enumerate} \end{proposition} An interesting property of $\text{MMOT-DC}_{\varepsilon}$ is that it interpolates between MMOT and F-MMOT. Informally, for very large $\varepsilon$, the KL divergence term dominates, so the optimal transport plans tend to be factorizable. On the other hand, for very small $\varepsilon$, the KL divergence term becomes negligible and we approach MMOT. The result below formalizes this intuition. \begin{proposition} \label{interpolation_prop} (Interpolation between MMOT and F-MMOT) For any partition $(\mathcal T_m)_{m=1}^M$ of $\mathcal T$ and for $\varepsilon > 0$, let $P_{\varepsilon}$ be a minimiser of the problem $\text{MMOT-DC}_{\varepsilon}\big( (\mathcal T_m)_{m=1}^M, \mu \big)$. \begin{enumerate} \item When $\varepsilon \to \infty$, one has $\text{MMOT-DC}_{\varepsilon}\big( (\mathcal T_m)_{m=1}^M, \mu \big) \to \text{F-MMOT}\big( (\mathcal T_m)_{m=1}^M, \mu \big)$. In this case, any cluster point of the sequence of minimisers $(P_{\varepsilon})_{\varepsilon}$ is a minimiser of $\text{F-MMOT}\big( (\mathcal T_m)_{m=1}^M, \mu \big)$. \item When $\varepsilon \to 0$, then $\text{MMOT-DC}_{\varepsilon}\big( (\mathcal T_m)_{m=1}^M, \mu \big) \to \text{MMOT}(\mu)$. In this case, any cluster point of the sequence of minimisers $(P_{\varepsilon})_{\varepsilon}$ is a minimiser of $\text{MMOT}(\mu)$. \end{enumerate} \end{proposition} \paragraph{GW distance revisited.} Somewhat surprisingly, the relaxation \ref{relax_mmot} also allows us to prove the equality between GW distance and COOT in the discrete setting. Let $\mathcal X$ be a finite subset (of size $m$) of a certain metric space. Denote $C_x \in \mathbb R^{m \times m}$ its similarity matrix (e.g. distance matrix). We define similarly the set $\mathcal Y$ of size $n$ and the corresponding similarity matrix $C_y \in \mathbb R^{n \times n}$. We also assign two discrete probability measures $\mu_x \in \mathbb R^m$ and $\mu_y \in \mathbb R^n$ to $\mathcal X$ and $\mathcal Y$, respectively. The GW distance is then defined as \begin{equation*} \text{GW}(C_x, C_y) = \inf_{P \in U(\mu_x, \mu_y)} \langle L_p(C_x, C_y), P \otimes P \rangle, \end{equation*} and the COOT reads \begin{equation*} \text{COOT}(C_x, C_y) = \inf_{\substack{P \in U(\mu_x, \mu_y) \\ Q \in U(\mu_x, \mu_y)}} \langle L_p(C_x, C_y), P \otimes Q \rangle, \end{equation*} where the $4$D tensor $L_p(X,Y) \in \mathbb R^{m \times n \times m \times n}$ is defined by $\big(L_p(X,Y)\big)_{i,j,k,l} = \vert X_{i,k} - Y_{j,l} \vert^p$, for some $p \geq 1$, and $U(\mu, \nu)$ is the set of couplings in $\mathbb R^{m \times n}$ whose two marginal distributions are $\mu$ and $\nu$. When $C_x$ and $C_y$ are two squared Euclidean distance matrices, and $p=2$, it can be shown that the GW distance is equal to the COOT \citep{Redko20}. This is also true when $L_p(C_x, C_y)$ is a negative definite kernel \cite{Sejourne20}. Here, we establish another case where this equality still holds. \begin{corollary} \label{kernel_gw_coot} If $L_p(C_x, C_y)$ is a (symmetric) Lipschitz function with respect to both inputs, and induces a strictly positive definite kernel $\exp\big( -\frac{L_p(C_x, C_y)}{\varepsilon} \big)$ on $(\mathcal X \times \mathcal Y)^2$, for every $\varepsilon > 0$, then there exists a solution $(P,Q)$ of COOT such that $P=Q$. As a consequence, we have the equality between GW distance and COOT. \end{corollary} The proof relies on the connection between MMOT-DC and COOT shown in the proposition \ref{interpolation_prop}, and that the two $\mathcal T_1, \mathcal T_2$-marginal matrices of the $4$-D solution of MMOT-DC are in fact identical, under the assumption of the cost tensor. The proof of the second claim is deferred to the Appendix. \section{Numerical solution} \label{sec:algo} We now turn to computational aspects of the problem \ref{relax_mmot}. First, note that the KL divergence term can be decomposed as \begin{equation*} \text{KL}(P \vert P_{\# \mathcal T}) = H(P) - \sum_{m=1}^m H(P_{\# m}), \end{equation*} where the function $H_m$ defined by $H_m(P) := H(P_{\# m})$ is continuous and convex with respect to $P$. Now, the problem \ref{relax_mmot} becomes \begin{equation} \label{relax} \text{MMOT-DC}_{\varepsilon}\big( (\mathcal T_m)_{m=1}^M, \mu \big) = \inf_{P \in U_{\mathcal T}} \langle C, P \rangle + \varepsilon H(P) - \varepsilon \sum_{m=1}^M H_m(P). \end{equation} This is nothing but a Difference of Convex (DC) programming problem (which explains the name MMOT-DC), thanks to the convexity of the set $U_{\mathcal T}$ and the entropy function $H$. Thus, it can be solved by the DC algorithm \citep{Tao86,Tao97} as follows: at the iteration $t$, \begin{enumerate} \item Calculate $G^{(t)} \in \partial(\sum_{m=1}^M H_m)(P^{(t)})$. \item Solve $P^{(t+1)} \in \arg\min_{P \in U_{\mathcal T}} \langle C - \varepsilon G^{(t)}, P \rangle + \varepsilon H(P)$. \end{enumerate} This algorithm is very easy to implement. Indeed, the second step is a classical entropic-regularized MMOT problem and can be solved by the Sinkhorn algorithm \ref{algo:dual_mmot}. In the first step, the gradient can be calculated explicitly. For the sake of simplicity, we illustrate the calculation in a simple case, where $M=2$ and $N=4$ with $\mathcal T_1, \mathcal T_2$ are two $2$-tuples. The function $H_1 + H_2$ is continuous, so $h^{(t)} = \nabla_P (H_1 + H_2)(P^{(t)})$. Given a $4$-D probability tensor $P$, we have \begin{equation*} H_1(P) + H_2(P) = \sum_{i,j,k,l} P_{i,j,k,l} \log\big( \sum_{i,j} P_{i,j,k,l} \big) + P_{i,j,k,l} \log\big( \sum_{k,l} P_{i,j,k,l} \big). \end{equation*} So, \begin{equation*} \label{optim_condition} \frac{\partial (H_1 + H_2)}{\partial P_{i,j,k,l}} = \log \left( \sum_{i,j} P_{i,j,k,l} \right) + \frac{P_{i,j,k,l}}{\sum_{i,j} P_{i,j,k,l}} + \log \left( \sum_{k,l} P_{i,j,k,l} \right) + \frac{P_{i,j,k,l}}{\sum_{k,l} P_{i,j,k,l}}. \end{equation*} The complete DC algorithm for the problem \ref{relax} can be found in the algorithm \ref{algo:dc_MMOT}. \begin{algorithm}[!t] \caption{DC algorithm for the problem \ref{relax_mmot}} \textbf{Input.} Cost tensor $C$, partition $(\mathcal T_m)_{m=1}^M$ of $\mathcal T$, histograms $\mu_1,...,\mu_N$, hyperparameter $\varepsilon > 0$, initialization $P^{(0)}$, tuple of initial dual vectors for the Sinkhorn step $(f_1^{(0)},...,f_N^{(0)})$. \textbf{Output.} Tensor $P \in U_{\mathcal T}$. While not converge \begin{enumerate} \item Compute $G^{(t)} = \sum\limits_{m=1}^M \nabla_P H(P^{(t)}_{\# m})$ the gradient of teh concave term. \item Solve \begin{equation*} P^{(t+1)} \in \arg\min_{P \in U_{\mathcal T}} \langle L(X,Y) - \varepsilon G^{(t)}, P \rangle + \varepsilon H(P), \end{equation*} using the Sinkhorn algorithm \ref{algo:dual_mmot}, with the tuple of initial dual vectors $(f_1^{(0)},...,f_N^{(0)})$. \end{enumerate} \label{algo:dc_MMOT} \end{algorithm} We observed that initialization is crucial to the convergence of algorithm which is not surprising for a non-convex problem. To accelerate the algorithm for large $\varepsilon$, we propose to use the warm-start strategy, which is similar to the one used in the entropic OT problem with very small regularization parameter \citep{Schmitzer19}. Its idea is simple: we consider an increasing finite sequence $(\varepsilon_n)_{n=0}^N$ approaching $\varepsilon$ such that the solution $P_{\varepsilon_0}$ of the problem $\text{MMOT-DC}_{\varepsilon_0}(X,Y)$ can be estimated quickly and accurately using the initialization $P^{(0)}$. Then we solve each successive problem $\text{MMOT-DC}_{\varepsilon_n}(X,Y)$ using the previous solution $P_{\varepsilon_{n-1}}$ as initialization. Finally, the problem $\text{MMOT-DC}_{\varepsilon}(X,Y)$ is solved using the solution $P_{\varepsilon_N}$ as initialization. \begin{algorithm}[H] \caption{DC algorithm with warm start for the problem \ref{relax_mmot}} \textbf{Input.} Cost tensor $C$, partition $(\mathcal T_m)_{m=1}^M$ of $\mathcal T$, histograms $\mu_1,...,\mu_N$, hyperparameter $\varepsilon > 0$, initialization $P^{(0)}$, initial $\varepsilon_0 > 0$, step size $s > 1$, tuple of initial dual vectors $(f_1^{(0)}, ..., f_N^{(0)})$. \textbf{Output.} Tensor $P \in U_{\mathcal T}$. \begin{enumerate} \item While $\varepsilon_0 < \varepsilon$: \begin{enumerate} \item Using algorithm \ref{algo:dc_MMOT}, solve the problem $\text{MMOT-DC}_{\varepsilon_0}(X,Y)$ with initialization $P^{(0)}$ and $(f_1^{(0)}, ..., f_N^{(0)})$ to find the solution $P_{\varepsilon_0}$ and its associated tuple of dual vectors $(f_1^{(\varepsilon_0)}, ..., f_N^{(\varepsilon_0)})$. \item Set $P^{(0)} = P_{\varepsilon_0}, f_i^{(0)} = f_i^{(\varepsilon_0)}$, for $i=1,...,N$. \item Increase regularization: $\varepsilon_0 := s \varepsilon_0$. \end{enumerate} \item Using algorithm \ref{algo:dc_MMOT}, solve the problem $\text{MMOT-DC}_{\varepsilon}(X,Y)$ using the initialization $P^{(0)}$ and $(f_1^{(0)},..., f_N^{(0)})$. \end{enumerate} \label{algo:acc_dc_MMOT} \end{algorithm} \section{Experimental evaluation} \label{sec:exp} In this section, we illustrate the use of MMOT-DC on simulated data. Rather than performing experiments in full generality, we choose the setting where $N = 4$ and $M=2$ with $\mathcal T_1 = (1,2)$ and $\mathcal T_2 = (3,4)$, so that we can compare MMOT-DC with other popular solvers of COOT and GW distance. Given two matrices $X$ and $Y$, we always consider the $4$-D cost tensor $C$, where $C_{i,j,k,l} = \vert X_{i,k} - Y_{j,l} \vert^2$. On the other hand, we are not interested in the $4$-D minimiser of MMOT-DC, but only in its two $\mathcal T_1, \mathcal T_2$-marginal matrices. \paragraph{Solving COOT on a toy example.} We generate a random matrix $X \in \mathbb R^{30 \times 25}$, whose entries are drawn independently from the uniform distribution on the interval $[0,1)$. We equip the rows and columns of $X$ with two discrete uniform distributions on $[30]$ and $[25]$. We fix two permutation matrices $P \in \mathbb R^{30 \times 30}$ (called sample permutation) and $Q \in \mathbb R^{25 \times 25}$ (called feature permutation), then calculate $Y = P X Q$. We also equip the rows and columns of $Y$ with two discrete uniform distributions on $[30]$ and $[25]$. It is not difficult to see that $\text{COOT}(X,Y) = 0$ because $(P, Q)$ is a solution. As COOT is a special case of F-MMOT, we see that $\text{MMOT-DC}_{\varepsilon}\big( (\mathcal T_m)_{m=1}^2, \mu \big) = 0$, for every $\varepsilon > 0$, by proposition \ref{MMOT_dc_prop}. In this experiment, we will check if marginalizing the minimizer of MMOT-DC allows us to recover the permutation matrices $P$ and $Q$. As can be seen from the figure \ref{fig:permu}, MMOT-DC can recover the permutation positions, for various values of $\varepsilon$. On the other hand, it can not recover the true sparse permutation matrices because the Sinkhorn algorithm applied to the MMOT problem implicitly results in a dense tensor, thus having dense marginal matrices. For this reason, the loss only remains very close to zero, but never exactly. \begin{figure}[t] \centering \includegraphics[width=0.8\textwidth,height=0.8\textheight,keepaspectratio]{fig/compare_methods.pdf} \caption{Couplings generated by COOT and MMOT-DC on the matrix recovering task.} \label{fig:permu} \end{figure} We also plot, with some abuse of notation, the histograms of the error between the $(1,3), (1,4), (2,3), (2,4)$-marginal matrices of MMOT-DC and their independent counterpart from F-MMOT. In this example, in theory, as the F-MMOT optimal tensor $P$ can be factorized as $P = P_{12} \otimes P_{34}$, it is immediate to see that $P_{12} = P_{14} = P_{23} = P_{24} \in \mathbb R^{30 \times 25}$ are uniform matrices whose entries are $\frac{1}{750}$. \begin{figure}[t] \centering \includegraphics[width=1.\textwidth,height=1.\textheight,keepaspectratio]{fig/other_marginals.pdf} \caption{Histograms of difference between true independent marginal matrices and their approximations. We see that the marginal matrices obtained by the algorithm \ref{algo:dc_MMOT} approximate well the theoretical uniform matrices.} \label{fig:other_marg} \end{figure} \paragraph{Quality of the MMOT-DC solutions. \label{expe:2}} Now, we consider the situation where the true matching between two matrices is not known in advance and investigate the quality of the solutions returned by MMOT-DC to solve the COOT and GW problems. This means that we will look at the COOT loss $\langle C, P \otimes Q \rangle$, where the smaller the loss, the better when using both exact COOT and GW solvers and our relaxation. We generate two random matrices $X \in \mathbb R^{20 \times 3}$ and $Y \in \mathbb R^{30 \times 2}$, whose entries are drawn independently from the uniform distribution on the interval $[0,1)$. Then we calculate two corresponding squared Euclidean distance matrices of size $20$ and $30$. Their rows and columns are equipped with the discrete uniform distributions. In this case, the COOT loss coincides with the GW distance \citep{Redko20}. We compare four solvers: \begin{enumerate} \item The Frank-Wolfe algorithm \citep{Frank56} to solve the GW (GW-FW). \item The projected gradient algorithm to solve the entropic GW distance \cite{Peyre16} (EGW-PG). We choose the regularization parameter from $\{0.0008, 0.0016, 0.0032, 0.0064, 0.0128, 0.0256 \}$ and pick the one which corresponds to smallest COOT loss. \item The Block Coordinate Descent algorithm to approximate COOT and its entropic approximation \cite{Redko20} (GW-BCD and EGW-BCD, respectively), where two additional KL divergences corresponding to two couplings are introduced. Both regularization parameters are tuned from $\{0, 0.0005, 0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1 \}$, where $0$ means that there is no regularization term for the corresponding coupling and we pick the pair whose COOT loss is the smallest. \item The algorithm \ref{algo:dc_MMOT} to solve the MMOT-DC. We tune $\varepsilon \in \{1, 1.4, 1.8, 2.2, 2.6\}$ and we pick the one which corresponds to smallest COOT loss. \end{enumerate} For GW-FW and EGW-PG, we use the implementation from the library \texttt{PythonOT} \citep{Flamary21}. Given two random matrices, we record the COOT loss corresponding to the solution generated by these three methods. We simulate this process $70$ times and compare the overall performance of these methods. We can see in Table \ref{tab:gw} the average value and standard deviation and the comparison for the values of the loss between the different algorithms in Figure \ref{fig:gw}. The performance is quite similar across methods with a slight advantage for EGW-PG. This is in itself a very interesting result that has never been noted to the best of our knowledge: the entropic version of GW can provide better solution than solving the exact problem maybe because of the "convexification "of the problem due to the entropic regularization. Our approach is also interestingly better than the exact GW-FW which illustrates that the relaxation might help in finding better solutions despite the non-convexity of the problem. \begin{table}[t] \begin{center} \begin{small} \begin{sc} \begin{tabular}{|c|c|c|c|c|c|} \hline GW-FW & EGW-PG & GW-BCD & EGW-BCD & MMOT-DC \\ \hline 0.083 ($\pm$ 0.035) & \textbf{0.079 ($\pm$ 0.035)} & 0.083 ($\pm$ 0.035) & 0.080 ($\pm$ 0.035) & 0.082 ($\pm$ 0.036) \\ \hline \end{tabular} \end{sc} \end{small} \end{center} \caption{Average and standard deviation of COOT loss of the solvers. MMOT-DC is competitive to other solvers, except for EGW-PG and EGW-BCD. \label{tab:gw}} \end{table} \begin{figure}[t] \centering \includegraphics[width=0.7\textwidth,height=0.7\textheight,keepaspectratio]{fig/all_vs_mmot_dc.pdf} \caption{Scatter plots of MMOT-DC versus other solvers. In all four plots, the points tend to concentrate around the line $y=x$, which indicates the comparable performance of MMOT-DC. On the other hand, the top-right plot shows the clear superiority of EGW-PG.} \label{fig:gw} \end{figure} \section{Discussion and conclusion} In this paper, we present a novel relaxation of the factorized MMOT problem called \textit{MMOT-DC}. More precisely, we replace the hard constraint on factorization constraint by a smooth regularization term. The resulting problem not only enjoys an interpolation property between MMOT and factorized MMOT, but also is a DC problem, which can be solved easily by the DC algorithm. We illustrate the use of MMOT-DC the via some simulated experiments and show that it is competitive with the existing popular solvers of COOT and GW distance. One limitation of the current DC algorithm is that, it is not scalable because it requires storing a full-size tensor in the gradient step computation. Thus, future work may focus on more efficiently designed algorithms, in terms of both time and memory footprint. Moreover, incorporating additional structure on the cost tensor may also be computationally and practically beneficial. From a theoretical viewpoint, it is also interesting to study the extension of MMOT-DC to the continuous setting, which can potentially allow us to further understand the connection between GW distance and COOT. \paragraph{Acknowledgements.} The authors thank to Thibault Séjourné for the fruitful discussion on the connection between GW distance and COOT. The authors thank to Titouan Vayer for pointing out the error in the definition of the lower bound of GW distance. \bibliographystyle{plainnat}
\section{CONCLUSIONS \& FUTURE WORK} Motion planning algorithms that optimize simple cost function have the benefit of being interpretable and easily tunable. However, the resulting trajectories can be unnatural in edge and extreme cases. In the literature, the common approach to overcome this limitation is using more complex and general cost functions tuned using real driving demonstrations. But this result comes at the expense of interpretablity and ease of tuning the cost function. In this work we presented an approach to define the driving constraints from demonstrations instead of the cost. The cost function would remain simple to maintain its benefits, while the constraints limit the extent of the movement so that the resulting trajectory remains close the movements observed from the real demonstrations. We trained a constraint function with a VAE architecture at its core using the NGSIM dataset. The constraint function was able to steer the ego vehicle away from collisions and out of road regions. However, the resulting constraints were rather restrictive as there were considerable cases where the motion planner optimization failed to find a solution that satisfy the constraints. In this work, we encoded the state and actions with dynamic OGMs. In our future work, we plan to directly use vector features from the environment and leverage graph neural network (GNN) to map from inputs to constraints. \section{INTRODUCTION} Autonomous driving is an active research topic for the last two decades, studied by both academia and industry. An autonomous driving stack is typically divided into multiple modules including localization, perception, and planning. Despite the recent advancements in perception and localization thanks to data-driven approaches, realizing a reliable and safe planning module has remained challenging. The main challenges include i) uncertainty and inaccuracy in predicting other road participants' behavior and upcoming road occupancies; and ii) the diversity of possible scenarios that a self-driving vehicle require to operate in. These challenges often lead to having an overly cautious planning module with a large number of hand-tuned rules and parameters to handle uncertainties and scenario diversities. Additionally, the module needs regular, manual adjustments to deal with novel scenarios. Moreover, there is a reasonable expectation from an autonomous vehicle to exhibit human-like behaviors in order to be predictable for other human road users such as passengers, pedestrians, cyclists, and human drivers, which adds to the complexity of designing an impeccable planning module. A planning module typically consists of four components: i) mission planning; ii) behavioral planning; iii) motion planning; and iv) motion control. The missing planning module determines a global route from a start point to a destination to navigate the vehicle. The behavioral planner's role is to make high-level decisions required to follow the mission planner route and traffic rules, and interact with other road users. The motion planner plans a safe and feasible trajectory to implicate the behavioral decisions. Lastly, the motion control module control the vehicle to follow the planned trajectories. This paper focuses on behavioral and motion planning as the behaviors of an autonomous vehicle is primely influenced by these two modules. A common practice in designing behavioral and motion planners is to processed the detected objects and predicted occupancies in the behavioral planner through a rule-based scheme (\textit{e.g.} state machines and decision trees) and generate a set of costs and constraints for the motion planner to generate a trajectory. For example, if the behavioral decision is to follow a heading vehicle, the decision is converted to constraints on the vehicle speed and the trajectory length to maintain a minimum gap with the heading vehicle. Such a design offers separation of concerns between different modules as the main advantage. However it suffers from several limitations. First, the design is based on an assumption that the predictions and decisions in the upper stream modules are independent from the level level decisions. This is not a valid assumption as in many cases prediction results depends on the vehicle's own behaviors or a behavior decision may need to change if there are no feasible, safe trajectory to follow the planned behavior. Second, the design is not scalable as it requires a preset mapping between all possible behavioral decisions and motion planning constraints. Any new situations require redefining the mapping and analyzing the effect on motion planning when transitioning from one decision to another. Third, the conversion between behavioral decisions and constraints often ignores contextual dependencies and tends to be conservative to ensure safety in as many scenario as possible. Naturally, this may lead to planning failures and/or requiring additional fall-back schemes to relax or prioritize the constraints. For example, a certain distance gap to other objects may be considered as the constraint when passing a parked vehicle, which can work in a majority of scenarios. But it can cause the motion planner to fail in a narrow and tightly-constrained road. A similar situation can be imagined in a merging scenario with a predefined gap and speed. Recent studies focus on data-driven, learning-based designs to addressed the above-mentioned challenges. Among them are end-to-end designs based on supervised and imitation learning~(IL) methods~\cite{bojarski2016end,schwarting2018planning,yang2018end}, learning a mapping from sensory data to low-level control. End-to-end methods in general require substantial changes in the current autonomous driving stacks, while lacking interpretability and safety assurance. Other approaches include reinforcement learning (RL) and particularly inverse reinforcement learning (IRL) methods~\cite{wu2020efficient,xin2019accelerated}, which involve learning an underlying reward function from human driving trajectories, and using the learned reward function to train a policy. The existing approaches however are simulation-based, which may not generalize well in a real-world setting. More recent approaches~\cite{wei2020perceive,zeng2019end} consider learning a spatio-temporal cost volume for trajectory planning through an end-to-end prediction and planning scheme. In this paper we look at the behavioral and motion planning from a different perspective, and reformulate the planning problem into two operations of constraint generation and trajectory planning. In most driving tasks, designing a cost function is relatively easy, and the challenge is to define context-dependent constraints for motion planning trajectories. To this end, we propose a new approach to infer motion planning constraints based on human driving data as the main contribution. The inferred constraints are then used in a regular motion planning method to generate trajectories. As the main advantage, the proposed method simplifies the motion planning cost to simple terms to evaluate the dynamic features of a trajectory such as maximum curvature, acceleration, and jerk. The proposed method is also compatible with the existing autonomous driving stacks as it can be considered as an add-on module with minimal or no changes to feed constraints to the existing motion planner modules. Compared to other learning methods, it also enables engineers to adjust motion planning costs without requiring any additional training cycles. Contributions of this paper can be summarized as \begin{itemize} \item Proposing an approach to employ Variational Auto-Encoder to estimate the probability density of driving demonstrations, \item Combining ideas from IRL and maximum margin planning to devise a novel approach to infer constraints from demonstrations in a dynamic environment with continuous states and actions, \end{itemize} \subsection{Imitation Learning} \subsection{Generative Adversarial Imitation Learning approaches} In the work of Raunak et al.\cite{bhattacharyya2020modeling} they define the human driving problem as multi-agent, non-linear and stochastic with an unknown cost function. They propose 3 modifications to GAIL to solve the formulated driving problem. To incorporate multi-agent behavior in learning they propose Parameter-Sharing GAIL by combining GAIL with PS-TRPO which has shared policy parameters. With Reward Augmented Imitation Learning they incorporate behavior planning with external penalties whose relative values are defined by the learning task. They propose Burn-InfoGAIL by excluding the learned embedding layer of InfoGAIL to find the latent variability in the demonstration set. They show a comparison with both rule and learning-based methods applied in real driving data. Junning et al. \cite{huang2019learning} propose a modular framework for adversarial style generative learning with data-driven high-level planning and configurable low-level control. They filter different behaviors into one decision module. The module also supports integration with non-differential low-level planning or control modules through reparametrized generative adversarial learning. The method deep mimic [] learns the control policy from simulated characters and their corresponding motion dynamics satisfying certain task boundaries. \subsection{IL vs IRL} IL can be considered as classification which is mimicking the expert's strategy given a set of choices. It is similar to creating a memory of experts behavior and generalizing it. On the other hand, IRL considers expert's policy in MDP and tries retrieve the reward function given some set of expert's demonstration. The learned reward best describes the agent's behavior. \cite{7464854_il_irl_link} tries to establish link between IL and IRL finding a common ground in between them. In their experimental setup, IRL methods do better than IL when a good representation of reward and environment dynamics are given. In the opposite case, IL does better and generalizes more to unknown situations. VDB uses an information bottleneck based [] regularizer to minimize the input information by combining GANs with IRL. \subsection{Inverse Reinforcement Learning} Reinforcement Learning has successfully been used for learning from experiences in the context of sequential decision making games [] , atari games , self-driving cars and many more domains [] . Few of the challenges of RL are the cost of exploration to find the optimal solution and finding am appropriate reward function. Where as Inverse Reinforcement learns the reward function from expert demonstrations. One of the applications of IRL is trajectory planning Sacha et al. \cite{rosbach2020planning} use a single reward function for different driving situations. The reward function is computed with path integral MaxEnt-IRL \cite{Aghasadeghi2011MaximumEI} trained from human driving demonstrations in the context of sample-based planning algorithm. They propose an LSTM based attention deep network that uses a low dimensional context vector of the driving features and actions of sampled-driving policies. They argue the attention vector filters non-human like trajectories. Another sample-based approach is proposed by \cite{Wu_2020}. In this work, a coarse path is created from the samples along the path. Then smoothed with the kinodynamic of the vehicle. The planning has two steps with the first step only the path and the second step finding the speed. The reward is defined as linear-structured with predefined features. The coefficients of the rewards are learned via IRL from the demonstration. A similar approach of sampling is also found in \cite{7535466_swerve} for swerving maneuver with static objects on either side of the road. The sampling-based approach is used to find control points for the swerve maneuver and then fit a path that matches the vehicle kinodynamics to the control points. IRL is used to learn to swerve parameters (control points) from human driving demonstrations. Use of MaxEnt IRL in modeling behavior of pedestrian and cyclist can be found in \cite{Modeling_pedestrian_cyclist}. They combine Maximum Entropy (ME) and Feature Matching(FM) techniques. The MDP is formed with the cyclist as an agent with states composed of distance and speed variables. The FM matches the feature count of the expert trajectories. RL optimization may be costly, \cite{Accelerated_irl} proposed randomly sample a massive set of policies in advance and the choose one of them as optimal policy. If the sampled policy is not optimal then exploration policy is initiated. Gabriel et. al \cite{kalweit2020deep} propose a combination IRL and Q-learning. They argue that their approaches can learn faster than different variants of MaxEnt IRL and can incorporate additional constraints on agent's behavior even if they might violate in the demonstrations. They assume the expert follows a stochastic policy of Boltzmann distribution and predict the "policy that maximizes the entropy over actions locally at each step as an approximation" which they refer as Inverse action-value Iteration (IAVI). They solve the reward function from the system of linear equations formed by the observed transitions. They extend this formulation with count-based policy approximation to update tabular Q values. For the continuous state space, the reward function is estimated with a neural network. In their Deep Constrained IRL, they put a threshold-based constraint on the action space of the demonstrations and learn the new policy. The experiments/comparisons are done in Objectworld Benchmark and SUMO simulator with the task of the lane change. In the work of Maximilian et al. \cite{9196795}, they find suitable cost functions that correspond to human driving behavior. They propose different scenarios based on a cost function that is dependant on different driving tasks, time, and driving performance. They learn from demonstration with IRL using a particular cost function. They propose trajectory selection with the cost functions instead of using the whole set. The selection criteria are based on selecting the segments of the data that end in the optimal time stamp. Their experiments include in-lane, right turning, and stopping scenarios. In \cite{ld_style}, they address the problem of learning a small segment of human driving style on the highway. They extract scalar features similar to cost function from the expert trajectories. Properties such as distance between the vehicles, proper acceleration, jerk are used to define the features. Learning is done in this feature space using MaxEnt IRL. The cost function is defined as a linear sum of these features with corresponding coefficients. For a given set of demonstrations, the distance between the resulting trajectory and demonstrated trajectory is minimized. Chou et al. \cite{Chou_2020} propose a search-based approach to find lower cost trajectories that do not violate the known constraints. It is an alternate/"complementary" solution to recover the latent constraints found within expert demonstration which are shared across multiple tasks. The demonstration set needs to have a boundedly-suboptimal cost that satisfies all the constraints. It can learn also learn from the sub-optimal demonstration. Although they show collision avoidance in 2D space but their method is unable to work for complex constraint representation. In the work of \cite{huang2018learning}, they formulate the expert learning as maxmin problem in the RL setup with MDP. The agent chooses a policy and an adversary chooses a reward function that is consistent with the agent’s current knowledge and minimizes the agent’s reward. The goal of the agent is to learn a policy that maximizes the worst possible reward using ellipsoid method and another solution using follow the perturbed-leader method \cite{KALAI2005291}. Driving can be uncertain due to the presence of sensor noise, occlusion, and unknown intention of dynamic objects in the environment. \cite{8814223_mpc_irl} consider human driver/pedestrian as distributed sensors and observe their behavior and infer the state of the environment from it. The predicted beliefs are modeled as probabilistic planning with MPC whose cost function is parameterized as a linear combination of features and learned via IRL from demonstrations. In this work\cite{YOU20191}, they model driving with MDP which is consistent with any number of lanes and road curvature. They use both RL and IRL to show multiple driving behaviors. At first, an expert agent is trained using RL against a known reward function. The trained expert agent is later used to generate demonstrations and the DNN based reward is extracted from demonstrations using IRL approach by maximizing the entropy of the joint distribution over a short data segment. \cite{sierragonzalez:hal-01396047} use offline demonstration under MaxEnt IRL for predicting the actions of each of the participating vehicles on the highway. The proposed driver model is formed as linear feature-based cost function which is used to predict the future dynamics in the future timestamp. \subsection{IRL for constraints} An expert agent's behavior is often guided by some constraints. \cite{scobee2020maximum} try to estimate the underlying constraints using MaxEnt IRL framework's probability distribution over trajectories to retrieve the constraints. They find the frequency of occurring a trajectory in the observed set and then iteratively select the individual minimal constraint sets with a proper stopping function. Another approach is to use greedy heuristic search where an estimated constraint set is formed with augmenting it to the final set which covers "the most of the uncovered probability mass". They showed this for deterministic MDP in 2D collision avoidance problem. Usman et al. \cite{anwar2020inverse} extend the above work for continuous setting without the consideration of the environment dynamics. They eliminate the state-action space by replacing it with Neural approximating function. The policy is a unconstrained min-max problem in form of the Lagrangian object function. They also add importance sampling on the samples drawn from the policy. They run experiment on environment like reaching a goal in 2D and OpenAI gym 3D motion of Half-Cheetah and Walker. The method T-REX can learn the desired tasks even with sub optimal demonstrations. They have showed that combining with DRL learns meaningful reward function and has capabilities to outperform the initial trajectory distribution. \subsection{Others} \subsection{Self Play} Learning from failures can be challenging. In \cite{sinha2020formulazero}, the authors propose a self-play method that uses distributionally robust bandit optimization for online opponent-modeling with uncertainty in beliefs. The approach does not require any demonstration. They iteratively parameterize other competing agents with population-based synthesis using replica-exchange Markov chain Monte Carlo. The learned policy applied to both simulation and real robot cars can show Formula One-style racing capability. MetaMimic uses memory based approach to learn large network and introduces the idea of one-shot high fidelity imitation in the context of RL and IL. \section{Related Works} Raunak~\textit{et al.}~\cite{bhattacharyya2020modeling} consider the human driving problem as a multi-agent, non-linear and stochastic problem with an unknown cost function, and propose multiple modifications to GAIL to solve the formulated driving problem. Junning~\textit{et al.}~\cite{huang2019learning} propose a modular framework for adversarial style generative learning with data-driven high-level planning and configurable low-level control. They filter different behaviors into one decision module. The module also supports integration with non-differential low-level planning or control modules through reparametrized generative adversarial learning. In~\cite{huang2018learning}, the expert learning is formulated as a max-min problem in the context of RL. The agent chooses a policy and an adversary chooses a reward function that is consistent with the agent’s current knowledge and minimizes the agent’s reward. The goal of the agent is to learn a policy that maximizes the worst possible reward using the ellipsoid method. Sacha \textit{et al.}~\cite{rosbach2020planning} use a single reward function for different driving situations. The reward function is computed with path integral MaxEnt-IRL~\cite{Aghasadeghi2011MaximumEI} trained from human driving demonstrations in the context of sampling-based planning algorithm. A similar sampling-based approach is proposed in~\cite{Wu_2020}, where the reward is defined as a linear-structured function with predefined features, whose coefficients are learned from demonstrations. A similar approach~\cite{7535466_swerve} is used for swerving maneuver with static objects on either side of a road. The swerve parameters are learned from human driving demonstrations. In \cite{ld_style}, a problem of learning human driving styles on highways is considered. A set of scalar features are extracted similar to a cost function from the expert trajectories. Properties such as distance between the vehicles, proper acceleration, and jerk are used to define the features. The cost function is defined as a linear sum of these features. Learning is done in this feature space using MaxEnt IRL, such that the distance between the resulting trajectory and demonstrated trajectory is minimized for a given set of demonstrations. In~\cite{sierragonzalez:hal-01396047}, offline demonstrations are used under MaxEnt IRL for predicting the actions of each of the participating vehicles on a highway scenario. The proposed driver model is formed as a linear feature-based cost function, used to predict the future-time dynamics. Gabriel \textit{et al.}~\cite{kalweit2020deep} propose a hybrid IRL and Q-learning approach, offering faster training compared to other variants of MaxEnt IRL. In~\cite{YOU20191}, both RL and IRL are employed to model multiple driving behaviors. First, an expert agent is trained using RL against a known reward function. Then, the trained agent is used to generate demonstrations. The reward function is extracted from demonstrations using an IRL approach by maximizing the entropy of the joint distribution over a short data segment. Above-mentioned studies have mainly focused on learning a reward function (cost function) to imitate expert drivers. While useful, it's unclear how these approaches can be integrated into safety-critical applications such as autonomous driving. In some cases, designing a cost function for motion planning is a relatively easier tasks compared to finding a suitable constraints. As such, few recent work have studied learning constraints from demonstration. Chou~\textit{et al.}~\cite{Chou_2020} propose a search-based approach to find lower cost trajectories that do not violate the known constraints, as a complementary solution to recover the latent constraints found within expert demonstration shared across multiple tasks. The demonstration set is required to have a boundedly-suboptimal cost that satisfies all the constraints. While it is shown that the resulting solution is capable of avoiding collisions in a 2D space, the method is not extensible for more complex constraint representation cases. An expert agent's behavior is often guided by a set of constraints. In~\cite{scobee2020maximum}, a method is proposed to estimate the underlying constraints using MaxEnt IRL framework. The method is based on finding the frequency of occurring a trajectory in the observed set and iteratively selecting the individual minimal constraint sets with a proper stopping function. \section{Experiments and Result} We have trained and evaluated the proposed approach on the US101 potion of the NGSIM dataset. The vehicles positions in local coordinate (the road coordinate system) was used to generate dynamic OGMs. OGMs were generated with a resolution of 0.5 meter per pixels with width and height of 32 by 128, resulting in 16 meters of lateral coverage and 64 meters of longitudinal coverage with the ego being at the center of the OGM. The state variable consists of one dynamic OGM and an extra channel for lane markings, resulting in a 4x32x128 variable. The action, corresponding to the ego position and speed is also a dynamic OGM with the size 3x32x128. The two variables are concatenated and yield the input to various models. \subsection{Probability Distribution of the Demonstrations} For VAE architecture, we employed a Convolution Neural Network for the encoder side, normal distribution with mean and variance for the latent variable, and a Convolution-transpose Neural Network for decoder. A cyclical schedule for $\beta$ \cite{fu2019cyclical} was employed to train the VAE. Figure~\ref{VAE} shows the input and reconstruction for two input samples. The left image is a sample directly from the demonstration data and its reconstruction shows vehicles in their respective locations. The right image is an artificially created sample with the ego too close to another vehicle. We can see that the reconstruction does not include the vehicle that is too close to ego, which will result in relatively higher reconstruction error. \begin{figure*} \centering \includegraphics[width=1.0\columnwidth]{figures/vae1.png} \includegraphics[width=1.0\columnwidth]{figures/vae2.png} \includegraphics[width=1.0\columnwidth]{figures/vae1_recon.png} \includegraphics[width=1.0\columnwidth]{figures/vae2_recon.png} \caption{VAE input (left) and reconstruction (right) for a sample demonstration dataset (top) and a sample with ego too close to other vehicles (bottom)} \label{VAE} \end{figure*} \subsection{Motion Plan for Optimization} To find the optimal motion plan for a demonstration instance given the constraint function, we used a sample based motion planner in the road frame. A total of 91 candidate trajectories, combination of 7 lateral positions and 13 longitudinal speeds, were generated. The 7 lateral positions cover the range from center of the lane to the left of ego to the center of the lane to the right of ego. The 13 longitudinal speeds were evenly spaced from 0 to 24 [m/s]. The trajectories that satisfied the constraint function were sorted according to a cost function that minimized lateral and longitudinal jerk, with speed as close to speed limit as possible, and lateral position close to the ego lane 5 seconds into the future. \subsection{Constraint Function} The constraint function has an architecture similar to the VAE with an additional fully-connected section for the classifier part. We used the pretrained VAE weights as the starting point for the training of the constraint model. Figure~\ref{constraint_func} show the result of the constraint function in the form of a drivable area. \begin{figure} \centering \includegraphics[width=1.0\columnwidth]{figures/constraint.png} \caption{The drivable region identified by the constraint function. The green pixels show the positions for ego that are not constrained. This figure is generated by evaluating the constraint function for different ego actions (ego positions) in this current state} \label{constraint_func} \end{figure} Once the training of the constraint function is concluded, the constraint function can be used in the optimization problem of a motion planner. We evaluated the resulting motion planner with samples from the NGSIM dataset and checked the performance of the motion planner system. Given that the simplified transition model employed does not simulate the reaction of other vehicles to the movements of the ego vehicle, we limited the evaluation to a single horizon and did not attempt to perform a rolling horizon simulation. A summary of the performance of the resulting motion planner is presented in Table~\ref{mop_table}. Overall, the constraints were effective in preventing collisions and keeping the vehicle withing the road bounds. However, this result was achieved by having rather aggressive constraints, which resulted in the motion planner to fail to find a valid trajectory that satisfy the constraints in 1.5\% of cases. \begin{table}[h!] \begin{center} \caption{Summary of the performance of the motion planning solution utilizing the constraint model learned from demonstrations} \label{mop_table} \begin{tabular}{c|c|c} \textbf{Collision} & \textbf{Out of road} & \textbf{No MoP solution} \\ \textbf{\%} & \textbf{\%} & \textbf{\%} \\ \hline & & \\ 0.5 & 0.3 & 1.6 \\ \end{tabular} \end{center} \end{table} \section{Constraint Inference} Consider a deterministic, finite-horizon Markov Decision Process (MDP) $\mathcal{M}$ with constraints represented with tuple $(\mathcal{S},\mathcal{A}, f, g, r, T)$, where $\mathcal{S} \in \mathbb{R}^{|\mathcal{S}|}$ is the set of states, $\mathcal{A} \in \mathbb{R}^{|\mathcal{A}|}$ is the set of actions, $f: \mathcal{S} \times \mathcal{A} \to \mathcal{S}$ is the state transition function defining next state given current state and action, $g: \mathcal{S} \times \mathcal{A} \to {0, 1}$ is the constraint on state and action pairs, $r(s,a): \mathcal{S} \times \mathcal{A} \to \mathbb{R}$ is the scalar reward for taking action $a$ in state $s$, and $T$ is the decision time horizon. An agent behaving optimally in this environment is effectively solving the optimization problem defined below. \begin{equation} \begin{aligned} \max_{a_t} \quad & \sum_{t=0}^{T}{r(s_t, a_t)} \\ \textrm{s.t.} \quad & s_{t+1} = f(s_t, a_t), & t=0 \dots T-1 \\ & g(s_t, a_t) = 0, & t=0 \dots T-1 \\ \end{aligned} \label{eq_optim} \end{equation} In a regular RL problem, the MDP $\mathcal{M}$ is fully known and the goal is to solve the optimization problem in \eqref{eq_optim} to find the sequence of actions $a_0, \dots , a_{T-1}$. In this work, we assume all the elements of $\mathcal{M}$ are known except the constraint function $g$, and the goal is to infer $g$ by observing the demonstrations from an expert that has optimized \eqref{eq_optim}. Suppose we have a set of $n$ demonstration instances ${\mathcal{D} =\{(\mathsf{S}^i,\mathsf{A}^i,r^i)\}_{i=1}^n}$ sampled from an expert behaving optimally in MDP that is maximizing $\mathcal{M}$, where $\mathsf{S}^i$ and $\mathsf{A}^i$ are lists of length $T$ of the states and actions, respectively, observed by the expert. The reward function $r^i$ is assumed to be unique for each instance and correspond to the experts goal for that instance. We develop our approach on top of the foundation described in \cite{scobee2020maximum} to find the constraint function from demonstrations. At a high level, the approach presented in \cite{scobee2020maximum} can be summarized into starting with an empty constraint set and iteratively performing the following steps: \begin{itemize} \item For each demonstration $i$, find $\hat{\mathcal{D}}^i$, the solution to the optimization problem \eqref{eq_optim} considering the latest estimate of the constraint function $g$ with the initial state $s_0$ being the first state from that demonstration instance. \item Count the state-action visitation of $\hat{\mathcal{D}}^i$ for all demonstrations, and find the state-action pair with the highest visitation that is not present in expert demonstrations. \item Add state-action pair from previous step to the set of state-actions constraints. \end{itemize} This approach relies on counting and comparing the visitation, thus, it is only applicable discrete states and action with a stationary environment with fixed start and goal. Given the nature of driving problems, we devise an algorithm that is applicable to dynamic environments with continuous states and actions and varying start and goal states. We train a model to match the probability distribution of the expert demonstration instances. Effectively, this model would estimate the probability that a given state-action pair is similar to the ones in the expert demonstrations. Additionally, instead of finding the state-action with highest visitation, we employ a sample-based approach to find suitable constraints. We utilize an approach similar to Maximum Margin Planning \cite{ratliff2009learning} to update the constraint function $g$. The steps of our proposed solution are detailed in Algorithm~\ref{alg:cap}. \begin{figure} \centering \includegraphics[width=1.0\columnwidth]{figures/architecture.png} \caption{The architecture of the constraint function} \label{fig_architecture} \end{figure} \begin{algorithm} \caption{Constraints inference algorithm.}\label{alg:cap} \begin{algorithmic} \STATE $p(.) \gets $ probability distribution function of $\mathcal{D}$ \STATE Initialize the constraint model $g(.)$ \WHILE{ not converged } \STATE $\hat{\mathcal{D}}^i \gets$ solution of \eqref{eq_optim} for $\mathcal{D}^i$ \STATE $s_t, a_t \in \mathcal{D}^i \gets $ no-constraint label \STATE $\hat{s}_t, \hat{a}_t \in \hat{\mathcal{D}}^i$, where $p(\hat{s}_t, \hat{a}_t) < p_{th} \gets $ constraint label \STATE Update $g(.)$ with gradient descent with labeled inputs $s_t, a_t$ and $\hat{s}_t, \hat{a}_t$ \ENDWHILE \end{algorithmic} \end{algorithm} \subsection{Constraint Inference in Autonomous Driving} Commonly, the IRL approaches use model-free RL for the optimization step (\textit{e.g.} see \cite{fu2017learning,malik2021inverse}), which are computationally expensive. However, in the context of motion planning for autonomous driving, there are efficient and effective solutions available for the optimization step. Therefore, instead of relying on RL approaches for the optimization step, we employ a sample-based motion planner to find the sequence of actions that optimize \eqref{eq_optim}. We use a sample-based approach similar to the one used in \cite{casas2021mp3} to solve the motion planning problem. For a given starting state corresponding to a demonstration sample, we generate a number of trajectories in the Frenet frame (road coordinate frame) with varying speed and lateral positions. Then, the trajectories are checked against the constraint function $g$, and the ones that violate $g$ are discarded. Finally, the reward corresponding to the remaining trajectories are calculated using function $r_i$. A trajectory with the highest reward is the solution to the optimization problem. \subsection{Implementation} We utilize a Variation Auto-Encoder (VAE) for the probability density function $p(.)$. When trained properly, VAE will have lower reconstruction error for samples from training dataset compared to samples that are outside the training distribution. Therefore, the reconstruction error can be used to identify state-action pairs that are different from expert demonstrations. The constraint function $g$ is represented with a neural network, trained as a classifier to distinguish between constrained and non-constrained state-action pairs. The input to the neural network is state and action and the output is whether they belong to the constrained or non-constrained class. We employ a VAE as the architecture for the function $g$ with an additional fully connected section from the latent variables for the classifier as shown in Figure~\ref{fig_architecture}. While the main training cost for the classifier is based of the constrained and non-constrained labels, the model also has an auxiliary cost associated with VAE latent distribution and reconstruction. These auxiliary costs help with generalizing the training. For a given demonstration instance $\mathcal{D}^i$, the loss for training would be \begin{equation} \begin{aligned} \mathcal{L}^i = & -\sum_{t=0}^{T}{\ln{(1 - y_t^i)} + \ln{\hat{y}_t^i}} \\ & + \sum_{t=0}^{T}{\text{RMSE}(x_t^i,\tilde{x}_t^i)} \\ & + \sum_{t=0}^{T}{KL(z_t^i,\mathcal{N} (0,I))}, \end{aligned} \label{eq_cost} \end{equation} where $y_t^i$ and $\hat{y}_t^i$ are the classifier outputs for station-action pairs from demonstration instance and optimization solution, respectively, $x_t^i$ and $\tilde{x}_t^i$ are the VAE input and its reconstruction representing state-action pairs from demonstration instance, and $z_t^i$ is the latent variable distribution for station-action pairs from demonstration instance. The auxiliary cost of the VAE are only limited to the state-action pairs from the demonstrations and state-action pairs from the optimization solution is not included, as they might not be valid inputs. We encode state and action with 2D multi-channel images in the form of dynamic Occupancy Grid Maps (OGM). A dynamic OGM includes one channel for the occupancy and two channels for speed of occupied pixels along the $x$ and $y$ coordinates. All dynamic OGMs are ego-centric. We use one dynamic OGM for the positions of the ego to represent the ego action. Another dynamic OGM will include position and speed of other vehicles around ego representing the state. Additionally, another single channel will represent the road markings in the form of a 2D image. Since the OGM's are ego-centric, the ego is always at the center, and its action will result in other vehicles moving in the 2D image. \subsection{NGSIM Dataset and State Transition Function} NGSIM dataset is an open dataset tracking all the vehicles in a road section using overhead cameras. Vehicles are tracked as long as they are in the visible range of the cameras. We generate a demonstration instance for each vehicle and frame combination in the dataset that the vehicle would be available for at least T seconds after that frame. For a given vehicle and frame, the vehicle would be the ego, and its sequence of positions for the next $T$ seconds represent its actions for that demonstration instance. Positions of other vehicles around the ego in a frame would make the state of the environment for ego in that frame. We need a state transition function for the optimization step, to calculate the state of the environment for new actions not in the dataset. Ideally, this would be a simulator that can predict the reaction of other vehicles to movements of ego. In the absence of access to such simulator, we employ an approach similar to the one in \cite{bhattacharyya2018multi}. We assume that other vehicle will continue with their movement irrespective of the ego movements. After the model is trained, the expectation is that the solution of the optimization problem would be close to the expert demonstrations, therefore the assumption that other vehicles will continue with their movement would be valid.
\section{Introduction}\label{sec:intro} Gauge symmetry is a central concept in essentially all of modern fundamental physics. The framework of theories in which gauge symmetries play a central role -- gauge theories -- is very general, and many physicists expect that any future discoveries will be accommodated within it. However, there are unresolved issues in the foundations of gauge theories, notably, concerning which features of gauge theories are descriptively redundant, and which are crucial for empirical adequacy. The aim of this Element is is to present precisely what is known on gauge symmetries and the possibility of gauge symmetry breaking, stressing the relevance of foundational and philosophical issues to current scientific practice and open questions, and to further outline what we take to be the most promising avenues forward. This article is thus an invitation to anyone interested in understanding the conceptual foundations of gauge theories, and a reflection upon how these features shape the way we think about elementary fields and particles. Most results on gauge theories stem from approaches which make some drastic simplifications. Gauge theories with weak interactions are often treated using perturbative approximations. In these approximations, many of the geometric properties of non-Abelian gauge theories, like their non-trivial topological features, play little to no role. (Lattice) Simulations, suitable especially for strongly-interacting theories, can be formulated in such a way that the gauge symmetry plays essentially no role in practice. Thus, the conceptual questions concerning the gauge symmetries themselves do not usually arise as problems in practice. However, already a little conceptual reflection shows that the central implicit and explicit foundational assumptions on gauge symmetries are not always consistent with one another. Gauge-dependent objects depend on the choice of gauge fixing, which is made on pragmatic grounds, not dictated by any choice of gauge made on ``nature's'' behalf. This is one among several reasons why it is commonly stated that gauge-dependent objects cannot directly correspond to anything physically real. This assertion, however, casts doubt on the physical reality of elementary particles such as electrons and quarks, together with the fields that represent them. This is in sharp tension with the common discourse and with aspects of the scientific practice in which these gauge-dependent fields are taken to be physically real in the same sense as, say, atoms are usually taken to be physically real. This tension already highlights why properly understanding gauge symmetries is important from an ontological point of view. There are three standard ways to avoid gauge-dependent objects in the treatment of the gauge interactions that form part of the Standard Model of elementary particle physics [\cite{Maas:2017wzi}]: i) in QED a so-called "photon cloud dressing" reestablishes gauge-invariance by including, in the description of the electron, what one might characterize as its "Coulomb tail" [\cite{Haag:1992hx}], ii) in QCD, the resolution, or rather the irrelevance of gauge dependence, is due to confinement, which requires that only uncharged (with respect to the non-Abelian color charge), and thereby gauge-invariant, objects appear at distances at or beyond the radius of hadrons [\cite{McMullan-Lavelle97,BeiglboCk:2006lfa}], and iii) in the electroweak sector, though much less known, it is due to the Fr\"ohlich-Morchio-Strocchi mechanism [\cite{Frohlich:1980gj,Frohlich:1981yi}]. While these three mechanisms will appear quite different at first sight, they eventually all boil down to canceling gauge-dependency by either eliminating the gauge degrees of freedom, or, at least, ensuring they do not appear in the empirically accessible range. However, the fact that gauge-dependent objects can be eliminated in an unobtrusive way in the gauge theories just mentioned seems to depend on features that are specific to the theories combined in the Standard Model and may not hold in extensions of it. A more systematic strategy for eliminating gauge dependence may be necessary for future progress in search for physics beyond the standard model. A ``literal interpretation'' of gauge fields that regards different gauge symmetry-related field configurations as physically distinct, in contrast, may well be an obstacle to such progress. Thus it is necessary to establish whether a manifestly gauge-invariant approach to gauge theories, replacing the current way of thinking about elementary particles, is compelling or perhaps even necessary for further progress. This need, as we shall see, mirrors themes in the recent philosophical discourse on gauge symmetries. The structure of this Element is as follows: It starts out with a review of general features of (gauge) symmetries in Section \ref{Sec:Symmetry}. Many conceptual and technical complications surrounding gauge dependence arise in connection with the spontaneous breaking of gauge symmetry. The understanding of gauge symmetry breaking is particularly central in the context of the Brout-Englert-Higgs effect, and this is discussed in Section \ref{Sec:Breaking}. Based on this discussion, we motivate the search for gauge-invariant approaches in Section \ref{Sec:Why}, and their implementation, given at various level of details, in Sections \ref{The dressing field method} and \ref{Sec:FMS approach}. In Section \ref{Sec:Reflection} we conclude with some reflections about the ultimate consequences of the results presented, and which key steps would have to be taken to answer all substantive open questions about gauge symmetries. \section{State of the Art: The Interpretation of Gauge Symmetries}\label{Sec:Symmetry} \subsection{Introduction} \subsubsection{Symmetries} \label{SYM} It has almost become a cliché to emphasize that symmetry plays a central role in modern physics. Weyl declared that “[a]s far as I see, all a priori statements in physics have their origin in symmetry” \cite[126]{Weyl52}, Yang argued that “symmetry dictates interactions” \cite[42]{Yang1980}, Weinberg famously said that “[s]ymmetry principles have moved to a new level of importance in this century and especially in the last few decades: there are symmetry principles that dictate the very existence of all the known forces of nature” \cite[142]{Weinberg92}, and philosopher Christopher Martin called 20\textsuperscript{th} century physics the “Century of Symmetry” \citep{martin2003continuous}. Cliché or not, it is simply a fact that our currently best physical theories exhibit symmetries. In some cases, symmetry considerations played an important heuristic role in formulating the respective physical theories (e.g., the theory of relativity). In other cases, symmetries were found retrospectively (e.g., classical electrodynamics). Due to the omnipresence of symmetries and the important heuristic role symmetry considerations play in modern physics, it is fair to say that understanding and interpreting symmetries is crucial for understanding our physical theories and what they tell us about the world. Accordingly, reflecting on the mechanism, nature, and heuristic significance of symmetries has become a central task of physicists and philosophers (see, e.g., \cite{Weyl52}, \cite{Wigner1967symmetry}, \cite{Yang1996}, \cite{BradingCastellani2003}). In particular, here we are interested in questions concerning the \textit{ontology} of symmetries. Are certain symmetries mere mathematical artifacts or are they physically real transformations? Here we put a special focus on \textit{gauge symmetries} which are at the very heart of modern physics. Importantly, we do not only argue that understanding the nature of gauge symmetries helps us to better understand our physical theories. We also argue that critical conceptual reflection on the nature of gauge symmetries indicates that textbook accounts of the BEH mechanism are misleading\footnote{It is important to point out that the treatment of the BEH mechanism in the quantum field theoretical setting given by most of these textbooks is based on perturbation theory. In this approach it is stipulated, actually even necessary, that there is a smooth transition from an interacting (non-Abelian) gauge theory to a non-interacting (non-gauge or at most Abelian) theory asymptotically. While this not only violates basic field-theoretical statements like Haag's theorem, this necessarily blurs the line between types of symmetries.}. As we will elaborate below, this line of reasoning is not unfamiliar in the philosophy of physics community. It is one of our aims to present it in its strongest form and show how such considerations naturally lead to gauge-invariant approaches to the BEH mechanism. In this context, as mentioned in Section \ref{sec:intro}, we investigate some available methods for reducing the theories to its gauge-invariant syntax in Sections \ref{The dressing field method} and \ref{Sec:FMS approach}. Before we turn to gauge symmetries, we shall begin with some general remarks about symmetries in physics. Symmetries can concern physical objects and states or physical theories and laws. We say that an object or theory possesses a \textit{symmetry} if there are \textit{transformations} that leave certain features of the objects or the theory to which the transformations are applied \textit{preserved} or \textit{unchanged}. With respect to these features, the object or theory is invariant concerning the respective transformations. In this sense, one can say that “[s]ymmetry is invariance under transformation” \cite[83]{Kosso}. Transformations that leave certain aspects unchanged are referred to as \textit{symmetry transformations}. Groups of such transformations are referred to as \textit{symmetry groups}. Types of symmetries can be distinguished according to types of transformations. In physics, we often find the following distinctions: continuous vs. discrete symmetries, external vs. internal symmetries, and global vs. local symmetries. Continuous symmetry is invariance under continuous transformation. An example of a continuous transformation would be the rotation of a circle. Since the appearance of a circle does not change under continuous rotations, we say that circles possess a continuous symmetry. The appearance of snowflakes, on the other hand, remains unchanged by rotations by sixty degrees but not, say, fifty degrees. This would be an example of a discrete transformation and thus snowflakes possess a discrete symmetry. We are particularly concerned with continuous symmetries. Mathematically, continuous symmetries can be described by Lie groups. External symmetry is invariance under transformations that involve a change of the spacetime coordinates. Examples of external transformations are spatial rotations. Accordingly, circles possess a continuous \textit{external} symmetry and snowflakes a discrete \textit{external} symmetry. Internal symmetries are symmetries in which the respective transformations do \textit{not} involve a change of the spacetime coordinates. Examples of internal transformations would be permutations of particles or phase transformations. The symmetries we are interested in, i.e., the gauge symmetries in quantum field theory, are \textit{internal} symmetries. For our purposes, the most important distinction is the one between \textit{global} and \textit{local} symmetries. It is standard (but slightly inaccurate) to characterize global transformations as transformations that are performed identically at each point in spacetime. Similarly, local transformations are ones that are performed arbitrarily at each point in spacetime. More accurately, we follow Brading and Brown in making a “distinction between symmetries that depend on constant parameters (global symmetries) and symmetries that depend on arbitrary smooth functions of space and time (local symmetries)” \cite[649]{BradingBrown2004}.\footnote{The naive formulation is inappropriate since, in the appropriate mathematical formalism for gauge theories, namely, principal fiber bundles, constant gauge transformations have no meaning without the introduction of a trivialization, which can only be introduced patchwise in spacetimes. So, more accurately, one defines a group of global symmetries to have a finite number of generators---and therefore this group acts `rigidly' on spacetime, since transformations at different spacetime points are not independent. On the other hand, a group of local symmetries acts `malleably', in the sense that transformations at distant points \textit{are} independent \cite{Gomes2021}. Since we are considering in this paper only simple spacetimes, that are covered by a single coordinate patch, the difference between the naive and the precise definition is immaterial. } Let us exemplify the difference between a global and a local transformation by considering a field $\Psi$ undergoing the following phase transformation: $$\Psi(x) \rightarrow \Psi'(x) = e^{i\theta}\Psi(x). $$ This is a (continuous, internal) \textit{global} transformation because the phase change $\theta$ is independent of the spacetime point ($\theta$ does not depend on x). Now consider the phase transformation $$\Psi(x) \rightarrow \Psi'(x) = e^{i\theta(x)}\Psi(x). $$ This is a (continuous, internal) \textit{local} transformation because the phase change $\theta(x)$ depends on the position in the field. The space of theories exhibiting local symmetries is much smaller---i.e. more constrained---than the space of theories only exhibiting a global symmetry (since global symmetries, when they exist, are subgroups of local symmetries). A prominent example of an external global transformation is the Lorentz transformation of special relativity. Accordingly, special relativity is based on an external global symmetry. Prominent examples of external \textit{local} transformations are the arbitrary differentiable coordinate transformations we find in general relativity. Due to its general covariance, i.e., the invariance with respect to such transformations, general relativity is based on an external local symmetry. The symmetries that underlie modern particle physics are internal local symmetries. The Standard Model of particle physics, describing three of the four known fundamental interactions, is a non-abelian gauge theory with an internal local U(1) × SU(2) × SU(3) symmetry group. Concerning our terminology, it is to be noted that we use the terms “local symmetry” and “gauge symmetry” synonymously. Accordingly, any field theory in which the Lagrangian remains invariant under local transformations is a gauge theory. This means that all four fundamental interactions are described by gauge theories (Standard Model + general relativity). Only the interactions between the Higgs particle and fermions as well as Higgs self-interactions are not of this type. Because gauge symmetries play such a prominent role in modern physics, they more than deserve due conceptual reflection. The central topic of this monograph is born out of such reflection, namely, the ontological status of gauge symmetries. Should they be interpreted as mere mathematical structure of our \textit{descriptions} of reality or do they \textit{represent the structure} of reality? To approach this question discussed in more detail in the following section, it is instructive to consider one of the finest examples of synergies between mathematics and physics: Noether’s results concerning the relationship between mathematical symmetries and physical theories. The famous Noether theorem, also known as Noether’s first theorem, relates continuous global symmetries to conserved quantities. Stated informally, the theorem says that to every continuous global symmetry there corresponds a conservation law (see \cite{BradingBrown2003}). Conversely, every conserved quantity corresponds to a continuous global symmetry. Accordingly, global symmetries seem to be physical symmetries, symmetries of nature. And, indeed, there is some consensus that global symmetries are observable and that they have direct empirical significance (\cite{Kosso}, \cite{BradingBrown2004}, \cite{Healey2009}, \cite{Friederich2015}, \cite{Gomes2021}). The situation is very different with respect to local symmetries. The difference can be illustrated by turning from Noether’s first theorem to what is sometimes called Noether’s second theorem (see \cite{BradingBrown2003}, \cite{Earman2002, Earman2004}, \citealt[55f.]{Rickles2008}). It has been pointed out that Noether’s results imply that local symmetries impose “powerful restrictions on the possible form a theory can take” \cite[105]{BradingBrown2003}. Specifically, the second Noether theorem ensures, through a so-called Gauss law, that the dynamics of the force fields are compatible with the dynamics of the charges that are their sources \citep{GomesRobertsNoether}. More broadly, “Noether’s second theorem tells us that in any theory with a local Noether symmetry there is always a prima facie case of underdetermination: more unknowns than there are independent equations of motion” \cite[104]{BradingBrown2003}. As will be discussed in detail below, this underdetermination inherent to gauge theories implies “an apparent violation of determinism” \cite[212]{Earman2002}. \subsubsection{Interpreting Gauge Symmetries: A First Look} \label{INT} \citet{Wigner1967symmetry} compared the gauge invariance of electromagnetism to a theoretical ghost:\footnote{This type of literal `ghost' should not be confused with the actual Fadeev-Popov ghosts that \textit{are} important in gauge theory (see \citealp{Bertlmann} and also Section \ref{quantization}).} ``This invariance is, of course, an artificial one, similar to that which we could obtain by introducing into our equations the location of a ghost. The equations then must be invariant with respect to changes of the coordinate of that ghost. One does not see, in fact, what good the introduction of the coordinate of the ghost does.'' This metaphor seems to describe the accepted view that is also, at least officially and explicitly, reflected in physics textbooks as well as that of prominent voices in the philosophy of physics community, declaring gauge theories to contain ``surplus structure'' \citep{redhead2002gauge}, ``formal redundancy'' \citep{martin2003continuous}, or ``descriptive fluff'' \cite[1239]{Earman2004}. On one widespread understanding, the surplus structure of many theories is manifested in multiplicity of mathematical representation for each physical state of affairs. Under this definition, surplus structure is ubiquitous in physics: the simple use of coordinates in spacetime physics would count as surplus. In some cases, such a representational multiplicity may be simply understood as the capacity of the theory to accommodate the viewpoints of different observers, that is what symmetries are often understood to be about (e.g. in special relativity). Therefore, a more useful definition of surplus structure should not encompass the kind of representational multiplicity that is epistemically unavoidable, or even a theoretical virtue. \citet{redhead2002gauge} provides a more precise characterization of surplus structure. Given the mathematical structure $M$ of a theory used to represent a physical structure $P$, if $P$ actually maps isomorphically only onto a substructure $M'$ of $M$, then by definition the surplus structure of the theory is the complement of $M'$ in $M$. Situations in which the mathematical structure that is understood as correlating to a physical structure is embedded within a larger mathematical structure are not uncommon in modern physics. It is therefore not hard to find examples that fit this description and present no special interpretive difficulties --- the use of complex number in classical wave mechanics or in circuit analysis comes to mind. But obviously there are instances in modern physics where capturing the notion of surplus structure is harder, as the boundary between surplus and essential theoretical structures is hard to draw and may evolve as more knowledge is gained. Generally, which of the mathematical structures of a given theory (if any) correlates to a physical structure is a matter of an interpretation of the theory, that would generally have to balance different theoretical virtues. We take the relation of mathematical formalism to reality to have three layers: i) the measurable, ii) the ontological (or `real', or physical), and iii) the mathematical. With these layers in mind, we can stipulate three desiderata concerning interpretations of gauge theories: \begin{enumerate}[label=(D{{\arabic*}})] \item To avoid ontological indeterminism. \item To avoid ontological commitments to quantities that are not measurable even in principle. \item To avoid surplus mathematical structure that has no direct ontological correspondence. \end{enumerate} The first two desiderata motivate an interpretation of unobservable or underdetermined theoretical concepts as structure that has no bearing on the ontology and is in that sense `surplus'. On the other hand, considerations of locality\footnote{See Section \ref{ABeffect} on the Aharonov-Bohm effect.} and explanatory capacity would often push in the opposite direction, supporting the indispensability of the surplus mathematical structure. In the context of spacetime theories, the desiderata (D2) and (D3) are intimately related to symmetry principles aiming to bring together the symmetries of spacetime and those of the dynamics \citep{earman1989ST}. These principles can be applied in interpreting physical theories as well as in constructing them. A possible way of applying analogous principles in the context of gauge theories is by requiring that the symmetries of the dynamics would coincide with the kinematical symmetries, i.e. with the automorphisms of the mathematical structure taken to represent the possible physical states \citep{hetzroni2020ghosts}. Broadly speaking, interpretations of gauge theories that take gauge transformations to be physically real---i.e. to relate physically distinct objects---support a realist commitment to gauge-dependent quantities. Let us call these T1 interpretations. T1 is clearly in tension with D1 and D2, but not in conflict with D3 because, for T1, gauge transformations have ontological correspondence. In contrast, interpretations that take gauge symmetries to be manifestation of surplus mathematical structure may no longer be in conflict with either D1 or D2, since they restrict ontological commitments to gauge-invariant quantities whose evolution is deterministic (and which may even be measurable). Let us call these interpretations T2. According to T2, gauge theories, in their standard formulations, have mathematical surplus structure, in conflict with D3.\footnote{There are interpretations that lie between these two main options T1 and T2. For instance, one could argue that gauge variant quantities can be real but that within each gauge orbit there is only one phase point that represents a physically possible state \cite[58]{Rickles2008}. With respect to the vector potential, which is a gauge variant quantity, one might hold “that the vector potential was real, and that there is ONE TRUE GAUGE which describes it at any time” \cite[367]{maudlin1998healey}. Such an interpretation makes ontological commitments to gauge-variant quantities but may still fulfill D1. The main problem with this interpretation is that “no amount of observation could reveal the ONE TRUE GAUGE” (\citealp[367]{maudlin1998healey}; see also \citealp[49]{martin2003continuous}). Thus, Redhead calls it “a highly \textit{ad hoc} way of proceeding as a remedy for restoring determinism” \cite[292]{redhead2002gauge}. Technically, choosing one true gauge may be achieved via the procedure of gauge fixing, but this procedure faces the problem that the choice faces an obstruction to locality referred to as Gribov-Singer ambiguity (see \citealp[58f.]{Rickles2008}; \citealp[378]{Attard_et_al2017}; \citealp{Gribov78}; \citealp{Singer78}; \citealp{McMullan-Lavelle97}).} And in fact, D3, as it stands, is a matter of degree: all physical theories harbor \textit{some} amount of surplus structure that is not directly measurable. After all, physics is not formulated solely in terms of---as brackets containing long conjunctions and disjunctions of---directly observable phenomena, like positions of dials and so on. And even if we weaken `measurable' to `ontological', some amount of surplus structure---for instance, a choice of coordinates, units, etc---will usually remain in our description. Thus, these issues do not pertain merely to the interpretation of gauge theories, they can also motivate the reformulation and extension of existing theories that on the one hand remove superfluous structure to obtain a more parsimonious representation, or on the other hand, promote what initially seems like surplus structure to physical structure. Therefore, to proceed, we need to separate the chaff from the wheat with regards to surplus structure, and this requires a more refined notion of the term, identifying it with theoretical or formal features which can be excised from a theory without incurring any detriment to its explanatory and pragmatic virtues. Of course, such criteria still leave open what should be counted as explanatory and pragmatic virtues, an issue that depends on one's viewpoint and goals. Yet, on occasions the criteria are rather clear-cut, and even in more complicated realistic situations, we suggest that some consensus should be pursued so as to make the criteria effective. Here we will exemplify this by the usage of one more criterion: locality. Thus, redundancy of representation in a theory will be counted as surplus structure if eliminating it still allows us to describe physical states via locally determined quantities, or local variables. This will be the motivation for some of the approaches presented in Section \ref{The dressing field method}. The issue at hand is therefore not limited to whether gauge symmetries manifest surplus structure or not; the refined question is how to distinguish between genuinely surplus structure and that having physical signature related to non-locality or non-separability of gauge physics. Answering this refined question provides a hard and fast criterion for a theory to meet all the desiderata D1-D3. \subsection{The Development of Gauge Theories} \subsubsection{Gauge Invariance in Classical Electromagnetism} \label{CEM} The formal property known today as gauge invariance already appeared in Maxwell’s 1856 \textit{On Faraday’s Lines of Force}, in which he showed, \textit{inter alia}, that the magnetic vector potential, introduced a few years earlier by William Thomson, can give rise to a unified mathematical description of different phenomena described by Faraday. This gauge invariance later allowed for the elimination of the vector potential from the equations, in the modern formulation of Maxwell’s equations by Hertz and Heaviside. In classical electromagnetism the equations of motion of the fields are Maxwell's equations: \begin{align} \nabla \cdot \vec{B} &= 0 \label{maxwell1} \\ \nabla \times \vec{E} + \frac{\partial \vec{B}}{\partial t} &= 0 \label{maxwell2} \\ \nabla \cdot \vec{E} &= \rho \label{maxwell3} \\ \nabla \times \vec{B} - \frac{\partial \vec{E}}{\partial t} &= \vec{j}. \label{maxwell4} \end{align} The equations of motion of the particles include the Lorentz force $q\left(\vec{E} + \vec{v}\times B\right)$ derived from the fields. This description appears to have a straightforward interpretation; the electric field $\vec{E}$ and the magnetic field $\vec{B}$ constitute the basic field ontology, Maxwell’s equations determine their behavior. The local values of the field can be found empirically based on the action of Lorentz force on particles. This interpretation seems to yield a local understanding of the interactions, and a picture of a continuous flow of energy in space through electromagnetic radiation. Yet, this theory is not free of conceptual problems.\footnote{Primarily the divergence of the energy density and the total energy in the vicinity of charged point particles, and the self-interaction problem, i.e.\ the question of the influence of the field produced by a particle on the motion of the particle itself (see technical and foundational discussion in \citet{rohrlich2007particles}, and \citet{frisch2005electromagnetism} for a philosophical point of view).} During the first half of the 20th century these problems raised the question of whether the electric and magnetic fields are real mediators of the interaction, or merely a mathematical tool which helps physicists to keep track of it. The central alternative to the field ontology was a picture of point particles directly interacting with each other at a distance. This kind of theory was famously advocated by \citet{wheeler1949action} based on earlier theories. The gauge freedom of the theory is related to a third mathematical representation, based on the electric potential $V$ and the magnetic vector potential $\vec{A}$. This representation is particularly convenient in various kinds of physical situations (such as those involving conductors). It also has the advantage of having \eqref{maxwell1}, \eqref{maxwell2} follow as identities from the kinematics rather than as additional dynamical equations. The potentials are defined such that the fields satisfy. $\vec{E} = -\nabla V - \frac{\partial \vec{A}}{\partial t}$ and $\vec{B} = \nabla \times \vec{A}$. Yet, the potentials are underdetermined by the fields: the same magnetic field can be represented by many mathematically distinct potentials. For given potentials $\vec{A}$ and $V$, the potentials $\vec{A}'=\vec{A} + \nabla f$ and $V'=V - \frac{\partial f}{\partial t}$ represent the same values of the fields $\vec{E}$ and $\vec{B}$ for any arbitrary smooth function of space and time $f$. The following transformation is therefore considered as the \emph{gauge transformation} of the theory: \begin{equation} \label{gaugetransEM} \begin{aligned} \vec{A} \rightarrow \vec{A} + \nabla f, \\ V \rightarrow V - \frac{\partial f}{\partial t}. \end{aligned} \end{equation} Under this transformation the field values do not change, and Maxwell's equations therefore remain invariant; Maxwell’s equations possess a gauge symmetry. According to the field interpretation mentioned above the electric and magnetic potentials are devoid of ontological importance. Gauge invariance is therefore naturally interpreted as a manifestation of a redundancy in the way the potential represents the physical situation, rendering them as mere mathematical auxiliaries. However, future developments in quantum theory and particle physics gave three reasons to think that things may be more complicated. The first is the formal indispensability of the potentials in the theory. The second is the Aharonov-Bohm effect (both described in the next subsection). The third reason is that the property of gauge invariance can be promoted to a \emph{gauge principle} using which the equations that govern the interaction can be derived without appealing to prior knowledge of the classical limit. This method is the basis for the symmetry dictates interaction conception of contemporary field theories (Subsection \ref{principle}). This profound significance of gauge invariance appears to many to stand in conflict to the view that regards this invariance as mere matter of mathematical redundancy (Section \ref{The Gauge Principle Meets Philosophy}). This tension is further sharpened in the context of spontaneous gauge symmetry breaking (see Sections \ref{Sec:Breaking} and \ref{Sec:Why}). \subsubsection{The Aharonov-Bohm Effect} \label{ABeffect} In classical electromagnetism the potentials are non-measurable quantities whose local values are not well defined, and do not form an essential part of the mathematical description of the dynamics, that can be expressed in terms of the fields using Maxwell's equations and the Lorenz force equation. Yet, there is a significant place in which they become indispensable, at least from a formal point of view, and this is the Hamiltonian (and also the Lagrangian) formulation of the theory. In quantum mechanics the Hamiltonian formulation gains fundamental significance as the generator of the temporal dynamics. The theory does not include force as a fundamental entity, but only as a derived phenomenon at a classical limit. Accordingly, it is the electric and magnetic magnetic potentials, and not the fields, which appear in the Hamiltonian and thus in the Schr\"{o}dinger\ equation. Aharonov and Bohm were intrigued by the question of whether this theoretical difference between the quantum and the classical can make an observational difference, and proposed an experiment in which it does. The proposed experiment is an electron interference experiment, in which a beam is split into two branches which are brought back together to form an interference pattern (Fig. \ref{ABfigure})\footnote{\citeauthor{aharonovbohm1959}'s work was conducted independently of the work by \citet{ehrenberg1949refractive} who proposed the same experiment with a different framing in a work that did not receive much attention at the time. In addition, according to \citet{hiley2013ABeffect}, Walter Franz described a similar situation in a talk in 1939.}. The electric and magnetic field along the possible trajectories is zero. In addition, a conducting solenoid is placed between the two branches, in an area of space that is shielded from the beam (the wave function at the neighborhood of the solenoid is zero). The current in the solenoid induces a magnetic field inside it, but the foil insures that there is no overlap between the support of the wave function in space-time and the magnetic field. The surprising fact is that in this scenario the interference pattern would depend on the magnetic field! \begin{figure}[h] \caption{The Aharonov-Bohm experiment. Figure taken from \citet{aharonovbohm1959}.} \label{ABfigure} \includegraphics[width=0.8\textwidth]{AharonovBohmExperiment.png} \end{figure} The dependence of the interference pattern on the field can be expressed in terms of a phase difference between the two branches that is acquired in the process. The following calculation of the phase factor emphasizes the role of gauge invariance. Let us begin with the case $\vec{A}=0$ everywhere and at all times, which, in a particular gauge, describes the experiment conducted with a zero magnetic field (we shall also use $\phi=0$ in all cases). Let us denote the solutions of the Schr\"{o}dinger\ equation for the first branch ABF and for the second branch ACF by $\psi_1^0\left(\vec{r},t\right)$ and $\psi_2^0\left(\vec{r},t\right)$ respectively. An interference pattern is obtained in the interference region, the overlap of the support of these two wave functions, and in this case its form is given by $\left|\psi_1^0\left(\vec{r},t\right)+\psi_2^0\left(\vec{r},t\right)\right|^2$. The experiment is described by the Hamiltonian: \begin{equation} \label{lorentzhamiltonian} H=\frac{1}{2m}\left(\vec{p}-\frac{q}{c}\vec{A}\right)^2+q\phi. \end{equation} It is invariant under the gauge transformation: \begin{equation} \label{magneticgaugetrans} \vec{A}(\vec{r},t)\rightarrow\vec{A}(\vec{r},t)-\nabla\Lambda(\vec{r},t). \end{equation} For arbitrary smooth $\Lambda$. This invariance is helpful for the calculation of the effect of the magnetic field. Let us denote by $\vec{A}^*\left(\vec{r},t\right)$ the magnetic vector potential that describes the situation with a given non-zero magnetic flux $\Phi_B$. For simplicity, the choice of gauge is such that $A^*$ is time independent and that at point A we have $\vec{A}^*=0$. The magnetic field along the first branch is zero. That means that there is a certain gauge transformation $\Lambda_1\left(\vec{r}\right)$ such that the potential $\vec{A}_1\equiv \vec{\nabla}\Lambda_1$ corresponds to a situation with zero magnetic field everywhere (i.e. $\vec{\nabla}\times \vec{A}_1=0$ at all places), but along the first branch $\vec{A}_1=\vec{A}^*$. Similarly, since at any point along the second branch the magnetic field is zero and $\vec{\nabla}\times \vec{A}^*=0$, there exist a gauge transformation $\Lambda_2\left(\vec{r}\right)$ and a corresponding potential $\vec{A}_2\equiv \vec{\nabla}\Lambda_2 $ such that $\vec{\nabla}\times \vec{A}_2=0$ at all places, but along the second branch $\vec{A}_2=\vec{A}^*$. Now, any electromagnetic gauge transformation \eqref{magneticgaugetrans} is a symmetry of the Hamiltonian \eqref{lorentzhamiltonian} when it is accompanied by the local phase transformation $\psi\rightarrow e^{iq\Lambda\left(\vec{r},t\right)/\hbar c}\psi$. As a consequence, if we start from $\vec{A}=0$ everywhere and apply the gauge transformation defined by $\Lambda_1\left(\vec{r}\right)$ which transforms the vector potential into $\vec{A}_1$, the wave function $\psi_1^0\left(\vec{r},t\right)$ would be transformed into $e^{i\Lambda_1\left(\vec{r}\right)}\psi_1^0\left(\vec{r},t\right)$. But since $\vec{A}^*=\vec{A}_1$ along the first branch, the wave function $e^{i\Lambda_1\left(\vec{r}\right)}\psi_1^0\left(\vec{r},t\right)$ would also be the wave function of the wave-packet that travels along the first branch for the case of nonzero magnetic field. Similarly, if we start from $\vec{A}=0$ everywhere and apply the gauge transformation defined by $\Lambda_2\left(r\right)$, the wave function $\psi_2^0\left(\vec{r},t\right)$ would be transformed into $e^{iq\Lambda_2\left(\vec{r}\right)/\hbar c}\psi_2^0\left(\vec{r},t\right)$. This expression would also hold for the wave function that travels along the second branch when the magnetic field is non-zero. Therefore, in this case the interference pattern would be given by $\left|e^{iq\Lambda_1\left(\vec{r}\right)/\hbar c}\psi_1^0\left(\vec{r},t\right)+e^{iq\Lambda_2\left(\vec{r}\right)/\hbar c}\psi_2^0\left(\vec{r},t\right)\right|^2=\left|\psi_1^0\left(\vec{r},t\right)+e^{iq\left[\Lambda_2\left(\vec{r}\right)-\Lambda_1\left(\vec{r}\right)\right]/\hbar c}\psi_2^0\left(\vec{r},t\right)\right|^2$. The definitions above imply that at any point along the first branch $\Lambda_1\left(\vec{r}\right)=\int_A^r{A_1\left(\vec{r'}\right)\cdot\vec{dr'}}$, where the integral is taken from point $A$ along the path of the particle in the first branch. But since $\vec{A}_1$ equals $\vec{A}^*$ in that region, we get $\Lambda_1\left(\vec{r}\right)=\int_A^r{A^*\left(\vec{r}'\right)\cdot\vec{dr}'}$. Similarly, along the second branch, $\Lambda_2\left(\vec{r}\right)=\int_A^r{A^*\left(\vec{r}'\right)\cdot\vec{dr}'}$. In the interference region, the phase difference which is responsible for the change in the interference pattern is given by the difference between these two phase factors which is exactly \begin{equation} \label{ABphase} \Delta\varphi_{AB}=\frac{q}{\hbar c}\oint{A^*\left(\vec{r}\right)\cdot\vec{dr}}, \end{equation} where the loop integral is over the closed loop ABFCA. While this calculation was performed in a specific gauge, its final outcome is gauge independent. According to Stokes' theorem the loop integral equals the magnetic flux, such that the phase difference is $\Delta\varphi_{AB}=q\Phi_B/\hbar c$. The effect gave rise to new controversies concerning both the foundations of quantum theory and of gauge theories. One possible conclusion is that locality and gauge invariant ontology cannot be reconciled. We discuss the issue in more detail in Section \ref{gaugeontology} (and see also Section \ref{AVS}). A closely related issue is the role of topology in physics, which is considered by some physicists and philosophers as the main issue raised by the Aharonov-Bohm effect \citetext{e.g. \citealp{ryder1996qft, Nounou2003AB}}. The point is that it is possible to gauge away the potential in the domain of each paths ABF and ACF, but not in union of the domains, due to the non-trivial topology of this union. In the coordinate-free formulation of classical electromagnetism\footnote{See, for example, \citet{baez1994gauge}.} the vector potential 1-form $A$ and the magnetic field 2-form $B$ satisfy $B=dA$. In any point within the domain accessible by the particle it holds that $dA=B=0$. The vector potential is therefore a \emph{closed} 1-form. According to the Poincar\'{e}\ lemma, on any contractible sub-domain of the configuration space, the differential form $A$ is also \emph{exact}, i.e. in the sub-domain there exists a form $\Lambda$ such that $A=d\Lambda$. Each of the two possible paths lies on such a contractible sub-domain. All holonomies in such a sub-domain would therefore equal zero. But this is not true for the entire configuration space of the particle, whose topology is non-trivial, and therefore the premises of the Poincar\'{e}\ lemma are not satisfied. In the minimal coupling scheme the vector potential 1-form takes the role of the connection of the $U\left(1\right)$ principle bundle over the spacetime manifold that correspond to the region available to the particle. The connection determines the phase-change that occurs in infinitesimal displacements, thus determining the holonomies. Due to the non-trivial topology of the configuration space of the particle, the connection form is not necessarily exact, and holonomies may appear. \subsubsection{The Gauge Principle} \label{principle} In the early 20th century the gauge invariance of classical electromagnetism was not considered as bearing any fundamental significance. An original attempt to rethink the issue was made by \citet{weyl1918gravitation}\footnote{And also in other writings from the same year, see \citet{scholz2004weyl}.}, who aimed for a geometrical unification of gravitation and electromagnetism based on an extension of Einstein's general theory of relativity, introducing the term `gauge transformations' for the first time.\footnote{For more details on the philosophical considerations that motivated Weyl’s gauge principle, particularly the influence of Edmund Husserl’s phenomenology, see \cite{Ryckman2005, Ryckman2020}.} Weyl saw great importance in the notion of locality that is expressed in general relativity in the dependence of the metric on spacetime points. However, the geometry of the theory does not fully manifest the desired form of locality, due to the invariance of the inner product under parallel transport, which defines a global standard of length. Relaxing this condition introduces (in a modern terminology) a connection $\phi$ of the local scaling group, and a corresponding local scale factor $\lambda$ for the transformation of the metric $g(x)\rightarrow\Tilde{g}(x)=\lambda(x)g(x)$. Weyl then identified the components of the connection 1-form $\phi$ with the components of the electromagnetic four-potential. Thus, the curvature of the scaling connection was identified with electromagnetism in the same way the curvature of the Levi-Civita connection is associated with gravity. The empirical adequacy of this identification was soon criticized by Einstein and others. In Weyl's theory the length scale acquires a non-integrable measure factor along a trajectory in spacetime. Just after the introduction of quantum mechanics, \citet{london1927gauge} suggested to reinterpret Weyl's theory based on the observation that the the quantum phase factor can be seen as an imaginary version of Weyl's measure factor. This discrepancy suggested that the relationship revealed through the concept of gauge between electromagnetism and gravity is that of an analogy, rather than a straightforward unification. This analogy was the basis of Weyl's gauge \emph{principle} \citet{weyl1929elektron,weyl1929gravitation} . In these papers Weyl used the rejection of global parallelism to motivate a formulation of general relativity using tetrads (which had been recently introduced by Einstein), and used this formulation to emphasize similarities between the structure of geometry and electromagnetism. Weyl noted that the metric does not fully determine the tetrad: there is a freedom of local Lorentz transformations. Weyl's theory is based on 2-spinors, whose rotation (in internal space) can be regarded as a representation of the same Lorentz group. The tetrads, that define distant-parallelism, thus determine not only spacetime curvature and the connection, but also those of the spinors' internal space. The important point is that the choice of tetrad does not fully determine the state of the spinors, as there remains a freedom of a phase factor. By analogy to the gravitational case, this freedom should be manifested as an invariance under local phase transformations. \begin{quote} ``The transformation of the $\psi$ induced by the rotation of the tetrad is determined only up to such a factor. In special relativity we must regard this gauge-factor as a constant because here we have only a single point-independent tetrad. Not so in general relativity; every point has its own tetrad and hence its own arbitrary gauge factor; because by the removal of a rigid connection between tetrads at different points the gauge-factor necessarily becomes an arbitrary function of position.'' \footnote{English translation in \citet{ORaifeartaigh1997gauge}, pp. 139-140.} \end{quote} This desired local invariance motivated the introduction of a covariant derivative that includes a local quantity $f$ (the connection term in the covariant derivative) such that the action is invariant under the transformation: \begin{align} \psi\rightarrow e^{i\lambda(x)}\psi && f_p\rightarrow f_p-\frac{\partial\lambda}{\partial x_p}. \end{align} Weyl then notes that the resultant $f$ term in the action is identical to ``the manner [..] that the electromagnetic potential interacts with matter according to experiment. This justifies the identification of the quantities $f_p$ introduced here with the electromagnetic potentials''. Weyl then identifies the electromagnetic field $f_{pq}=\frac{\partial f_q}{\partial x_p}-\frac{\partial f_p}{\partial x_q}$. He further notes the connection of the transformation to conservation of electric charge, and stresses the analogy to the connection between conservation of momentum and angular momentum in general relativity and the invariance under local Lorentz transformations (rotation of the tetrads in spacetime). Weyl thus regards the gravitational interaction and the electromagnetic interaction as manifesting the same new principle of gauge invariance (see also \citealp{weyl1929gravitation}). In developing this principle, and later in reflecting on it, Weyl appealed to philosophical considerations, mainly ones that originate in an idealist or Kantian tradition \citep{ryckman2003gauge, hetzroni2021analogies}. Weyl's gauge terminology with respect to the electromagnetic interaction was embraced by \citet{pauli1933handbuch,pauli1941particles} in his influential writings on quantum physics. It allowed for a reconstruction of the electromagnetic interaction in a quantum context from simple principles that do not appeal to classical electromagnetism. For example, the electromagnetic interaction term is introduced into the free Dirac equation $i\gamma^\mu\partial_\mu\psi-m\psi=0$ using the gauge principle by replacing the derivative $\partial_\mu$ with a gauge covariant derivative $D_\mu=\partial_\mu +ieA_\mu$. The resulting equation $i\gamma^\mu\left(\partial_\mu+i e A_\mu\right)\psi-m\psi=0 $ is invariant under local gauge transformations \begin{align} \psi\rightarrow e^{-i\lambda(x)}\psi && A_\mu \rightarrow A_\mu+\frac{1}{e}\partial_\mu \lambda(x). \end{align} The analogy with the electromagnetic case motivated the successful attempt of \citet{yangmills1954} to localize the $SU(2)$ isospin symmetry. The theory involves two Dirac spinors of equal mass, that can be described using the Lagrangian $\mathcal{L}=i\Bar{\psi}\gamma^\mu\partial_\mu\psi-\Bar{\psi}m\psi$ with $\psi\equiv\begin{pmatrix}\psi_1\\\psi_2\end{pmatrix}$. It is initially invariant under a global $SU(2)$ isospin symmetry. The Yang-Mills field $B_\mu$ (a $2\times 2 $ matrix) is similarly introduced by replacing the derivative with a corresponding covariant derivative that renders the theory invariant under local SU(2) transformations. Gauge theories of Yang-Mills type were soon recognized as easy to renormalize. This provided a central motivation to pursue this line \citep{kibble2015electroweak,brown1993renormalization}. Thus, while Yang and Mills's original theory failed to describe the strong nuclear interaction it was try to account for, the method it presented soon became a template used in the construction of the theory of electroweak interactions (see Chapter \ref{Sec:Breaking}) as a gauge theory of the group $SU(2)\otimes U(1)$, and later also in the construction of the strong interaction. The development of the standard model was in this sense based on applying the same pattern of achieving local invariance by introducing gauge fields \citep{mills1989fields}. A retrospective description of these developments is given by \citeauthor{ORaifeartaigh1997gauge} (\citeyear{ORaifeartaigh1997gauge}, emphasis in original): \begin{quotation} invariance with respect to the local symmetry \emph{forces the introduction of the vector fields $A_\mu(x)$ and determines the manner in which these fields interact with themselves and with matter}. The fields $A_\mu(x)$ turn out to be just the well-known radiation fields of particle physics, namely, the gravitational field, the electromagnetic field, the massive vector meson fields $Z^0$, $W^\pm$ of the weak interactions and the coloured gluon fields $A^c_\mu$ of the strong interactions. Thus gauge symmetry introduces all the physical radiation fields in a natural way and determines the form of their interactions, up to a few coupling constants. It is remarkable that this variety of physical fields, which play such different roles at the phenomenological level, are all manifestations of the same simple principle and even more remarkable that the way in which they interact with matter is prescribed in advance. It is not surprising, therefore, to find that the covariant derivative has a deep geometrical significance. [...] the [local gauge groups] $G(x)$ are identified as sections of principal fiber-bundles and the radiation fields $A_\mu(x)$ are mathematical \emph{connections}. \end{quotation} In addition to the gauge symmetries in particle physics, the analogy with gravitation continued to play a role in various works aiming to go beyond general relativity in the description of gravity, or to provide a unified framework for all interactions. In 1956 Ryoyu \citet{Utiyama1956} fully articulated the modern understanding of the gauge argument in terms of ``gauging'' a global symmetry using a Lie group to obtain a gauge theory.\footnote{His work, completed in mid-1954, is independent of the $\SU(2)$ Yang-Mills paper issued the same year and is much more general, the $\SU(2)$ case being yet again independently worked out by R. Shaw - a student of A. Salam - in 1954 and published in his PhD thesis \citep{Shaw1955}. It is arguably an unjust historical oversight that gauge theories are associated mainly to the names of Yang and Mills, while Utiyama's far reaching contribution is seldom remembered. See \citep{ORaifeartaigh1997gauge} for an historical account of the events.} Utiyama applied his approach also to general relativity, showing for the first time that General Relativity can be recovered from a gauge principle applied to the rigid Lorentz group. The theory of \citet{brans1961dicke} generalized general relativity based on conformal transformations, similar to the ones presented in \citet{weyl1918gravitation}. After the success of gauge theoretic approaches to the nuclear interactions in the mid to late 60s and early 70s, and after the inception of supersymmetry, explorations of gauge theories of gravity and super-gravity blossomed in the second half of the 70s (see \citealp{scholz2020metric} for a historical review and \citealp{Blagojevi-et-al2013} for a detailed review of the theories). These theories describe gravity using different non-Riemannian geometries introduced through the process of gauging different groups larger than the Lorentz group. The aim is to bridge the language gap with the description of the other interactions, so as to facilitate either their unification or the quantization of gravity. The classical theory of non-gravitational gauge interactions were understood in terms of the geometry of Ehresmann connections on fiber bundles (see section \ref{Geometric background}). For a long time, the gauge potentials of gravity were thought about in the same terms. Only quite recently was it recognised that gauge gravity is better understood in terms of the geometry of Cartan connections on principal bundles, see e.g.\citep{Wise09, Wise10}. Cartan geometry is indeed the natural generalization of (pseudo) Riemannian geometry, as introduced by {\'E}. Cartan in the 20s, and the direct precursor of the notion of connection introduced in the late 40s by C. Ehresmann (who was a pupil of {\'E}. Cartan). See \citep{Sharpe, Cap-Slovak09} for modern introductions. Interpretive issues surrounding gauge symmetries are thus pressing for gravitational and non-gravitational theories alike. \subsubsection{Quantization} \label{quantization} The advent of quantum field theory required to reshape the understanding of gauge symmetries substantially. Especially, the role of gauge transformations moves from a transformation of solutions of the equations of motion to an integral part of the definition of the quantum theory. This also modifies, to some extent, how gauge transformations are perceived in a quantum field theory, as will be outlined here. In principle, quantizing a gauge theory is performed similarly as with non-gauge theories, but for a few subtleties. For the purpose of illustration, this will be done here using a path-integral approach. We select the vector potential as the integration variable\footnote{Other choices will lead in general to a nonequivalent path integral. While this is mathematically perfectly feasible, these are not empirically adequate. Why this is so is a very good, and unsolved, question.}. A way [\cite{Bohm:2001yx}] to understand the origin of the ensuing subtleties when integrating over the vector potential is to note that any gauge transformation leaves the action invariant, and, as a shift, also does not influence the measure. Hence, there are flat\footnote{A flat direction is one where under the variation of the (path) integration variable the (path) integral kernel does not change, and thus one adds up a constant. This is what happens in a gauge theory. Along the gauge orbit the integrand does not change, thus amassing the infinity. The often quoted non-invertebility of the Hessian is only an issue if one attempts a saddle-point approximation, like in perturbation theory.} directions of the path integral, and thus the integral diverges when integrating along these directions. There are only few possibilities to deal with these divergencies. One is to perform the quantization on a discrete space-time grid in a finite volume. In this way the divergences become controllable, and can be removed before taking the limit to the original theory [\cite{Montvay:1994cy}]. Another one is to transform to manifestly gauge-invariant variables. This would be achieved by a variable transformation to the dressed fields of section \ref{The dressing field method}. However, in most cases, this has been thus far found to be practically impossible. The third option is to remove the divergences by fixing a gauge [\cite{Bohm:2001yx}]. This is achieved by sampling every gauge orbit only partially in such a way that the result is finite while gauge-invariant quantities are not altered. Even though gauge-variant information is removed, this is not equivalent to introducing a gauge-invariant formulation. Any gauge condition will define one distinct way of removing the superfluous degrees of freedom, but what is removed and what is left differs for every choice of gauge. As gauge fixing plays a central role in contemporary particle physics, as well as in section \ref{Sec:FMS approach}, it is worthwhile to detail it further. Gauge-fixing proceeds by selecting a gauge condition $C_\Lambda$, which may involve the gauge field as well as any other fields, and which can be parametrized by some quantity or function $\Lambda$ in an arbitrary way. Necessary conditions for this gauge condition are that every gauge orbit has at least one representative fulfilling this condition. We will furthermore assume, for reasons of practicality, that there is only one such representative. In non-Abelian gauge theories the Gribov-Singer ambiguity makes this requirement very involved [\cite{Gribov78,Singer78}] to implement and formulate, even to the point of practical impossibility [\cite{McMullan-Lavelle97,Vandersickel:2012tg,Maas2011}]. Conceptually, however, this will not be an issue for now. The procedure for determining the amplitude of any gauge-invariant observable $f$ goes as follows: \begin{align} &\frac{1}{{\cal N}}\int_\Omega{\cal D}A_\mu f(A_\mu)\exp(iS[A_\mu])\label{q1}\\ &=\frac{1}{{\cal N}}\int_{\Omega/\Omega_C}{\cal D}g\int_{\Omega_c}{\cal D}A_\mu\Delta[A_\mu]\delta(C_\Lambda)f(A_\mu)\exp(iS[A_\mu])\label{q2}\\ &=\frac{1}{{\cal N'}}\int_{\Omega}{\cal D}A_\mu\Delta[A_\mu] f(A_\mu)\delta(C_\Lambda)\exp(iS[A_\mu])\label{q3}\\ &=\frac{1}{{\cal N^{''}}}\int_{\Omega_C}{\cal D}A_\mu\Delta[A_\mu]f(A_\mu)\exp(iS[A_\mu])\label{q4}, \end{align} in which possible further fields are suppressed. The original expression (\ref{q1}) is an integral over the whole set $\Omega$ of all gauge orbits and all representatives on every gauge orbit. In (\ref{q2}) this set is split into the set $\Omega_C$, which contains for all orbits only the representatives fulfilling $C_\Lambda$, and the remainder $\Omega/\Omega_C$. This allows us to write the integration along gauge orbits $g$ and over gauge orbits separately. This separation requires the introduction of a $\delta$-function on the gauge condition and an additional weight factor, the Faddeev-Popov determinant $\Delta$. The latter ensures that the weight of the representative is the same for all gauge orbits, and thus gauge-invariant, ensuring $\langle 1\rangle=1$. Then the integrals along the gauge orbits are orbit-independent, and can be absorbed in the normalization in (\ref{q3}). Finally, resolving the $\delta$-function in (\ref{q4}) yields the gauge-fixed path integral, yielding yet another normalization. This approach is standard for perturbation theory\footnote{It is often convenient to integrate over the parametrization of the gauge condition, which is e.\ g.\ done for linear covariant gauges like the Feynman gauge.} [\cite{Bohm:2001yx}]. As noted above, beyond perturbation theory the Gribov-Singer ambiguity makes this procedure in practice cumbersome. This manifests itself in the form and properties of both the Faddeev-Popov determinant $\Delta$ and the gauge condition $C_\Lambda$ [\cite{McMullan-Lavelle97,Vandersickel:2012tg,Maas2011}]. In principle, the Fadeev-Popov determinant is a simple functional extension of the following argument: for a function with a single root, $f(x_o)=0$, the Dirac delta function obeys the identity: \begin{equation}\label{delta_identity}\delta(f(x))=\frac{\delta(x-x_o)}{|\det{f\rq{}(x_o)}|}\end{equation} Since the integral of $\delta(x-x_o)$ over $x$ gives unity, then $$|\det{f\rq{}(x_o)}|\int dx \, \delta(f(x))=1$$ The functional setting works in the same way, with \begin{equation}\label{dirac_FP} |\det{J\rq{}(\varphi_o)}|\int \mathcal{D}\varphi\, \delta(F(\varphi))=1 \end{equation} Usually the field $\varphi$ is a gauge-parameter, with \eqref{dirac_FP} determining the factor for a gauge-fixing. Geometrically, the Fadeev-Popov determinant emerges as a functional Jacobian for a change of variables, since one now decomposes, as in Fubini's theorem, a functional integration over all variables into an integration over a gauge-fixing section and an integration over the orbits (see e.g. \cite{Babelon:1979, MottolaFP}). Of course, such a decomposition is also vulnerable to the Gribov ambiguity, and thus would not be available non-perturbatively. Nonetheless, this interpretation leads straightforwardly to the Fadeev-Popov determinant as follows: For the transformation $A_\mu\rightarrow A_\mu^{Cg}$, where $A^C_\mu$ is the gauge-fixed connection, we obtain the respective Jacobian for the measure ${\cal D}A\rightarrow \det{(J)}{\cal D}A^C{\cal D}g$.\footnote{ But note that establishing the Jacobian requires a normalisation of the measures. This is usually defined by a unit Gaussian measure. We then combine that with the variable transformation. For instance, for Landau gauge (in Euclidean signature, and for the Abelian theory), the gauge-fixed potential is a projection of the potential onto its transverse-free part: \begin{equation} A^C_\mu(A)=(\delta^\nu_\mu-\partial_\mu\square^{-2}\partial^\nu)A_\nu. \end{equation} Of course, this case rather trivially furnishes only a field-independent Jacobian, since $J$ does not depend on $A$.} It is an interesting question to ask what happens if one tries to calculate a gauge-dependent amplitude. In fact, if done so by putting a gauge-dependent $f$ in (\ref{q1}), the answer is always zero, up to some $\delta$-functions at coinciding arguments. Of course, such a calculation requires a method like the lattice-regularization. The reason is that for any gauge field configuration with some value $A_\mu(x_0)$ at the fixed position $x_0$, there exists a gauge transformation, which is only non-vanishing at $x_0$, such that the value of the gauge transformed gauge field is $-A_\mu(x_0)$. In this way, any integration over the full gauge group yields zero. The only exception can happen if arguments coincide, yielding squares of the fields. On the other hand, evaluating a gauge-dependent quantity $f$ using (\ref{q4}) yields very non-trivial results. The reason for this apparent disagreement is the step from (\ref{q2}) to (\ref{q3}). Here, the integral $\int{\cal D}g$ was absorbed in the normalization, because none of the remaining expressions depended on it, because all were gauge-invariant. This is no longer true, if $f$ is gauge-dependent. Then the integral over gauge transformations can no longer be separated as a factor and be removed. Thus, from a purely mathematical point of view, the expressions (\ref{q1}-\ref{q2}) and (\ref{q3}-\ref{q4}) are distinct theories. From the point of view of physics, there is just an infinite number of equivalent quantum theories, the one without gauge fixing and the infinitely many choices of $\Omega_c$, or equivalently $C_\Lambda$, which all yield the same gauge-invariant observables, but differ for gauge-dependent ones. Alternatively, this can also be taken to imply that any choice of theory with the action $S'=S-i\ln\Delta$ gives the same gauge-invariant quantities, provided they are integrated over the corresponding set $\Omega_C$, either directly implemented as integration range or by a $\delta$-function. In either way, this leads ultimately to the expression (\ref{q4}). This infinite degeneracy of quantum theories is a consequence of working with gauge freedom. This problem of infinite degeneracy would vanish if a transformation to gauge-invariant variables could be performed, as is aimed at in the dressing-field approach in section \ref{The dressing field method}. Alternatively, an approach like the one in section \ref{Sec:FMS approach} will take all these theories to be equivalent by defining the (gauge-invariant) observables to be only those, which are the same for all. This yields the same observable result as the lattice regularization. \subsection{Interpreting Gauge Theories} \label{Interpreting Gauge Theorie} \subsubsection{The Gauge Principle Meets Philosophy} \label{The Gauge Principle Meets Philosophy} In the late 20th century gauge symmetries began to attract the attention of philosophers. Many of them identified the gauge principle as a prominent example of a fundamental shift in the methodology of theoretical physics, intertwined with the elevation of abstract mathematics. \citeauthor{steiner1998applicability} (\citeyear{steiner1989application,steiner1998applicability}) raised the issue in the context of the question of the applicability of mathematics to natural science. He regarded the gauge argument (especially in the version of Yang and Mills) as a Pythagorean analogy, i.e. one that can only be expressed in a mathematical language and is not based on a physical similarity. Such mathematical analogies, according to Steiner, are motivated by human values (such as aesthetics) that guide the development of mathematics, and their repeated success in physics puts physics at odds with naturalism. A closely related issue is the apparent conflict between the standard understanding of gauge symmetries as a matter of a choice of convention and their great methodological significance. \citeauthor{yangmills1954} described gauge freedom in terms of local conventions: \begin{quote} ``The difference between a neutron and a proton is then a purely arbitrary process. As usually conceived, however, this arbitrariness is subject to the following limitation: once one chooses what to call a proton, what a neutron, at one space-time point, one is then not free to make any choices at other space-time points. It seems that this is not consistent with the localized field concept that underlies the usual physical theories.'' (p.192) \end{quote} This view of gauge invariance became part of the received view, in part due to \citet{Wigner1964invariance} who emphasized the distinction between dynamical symmetries, such as gauge symmetries, and other symmetries such as Lorentz transformations. A philosophical view that adopts this approach was presented by \citet{auyang1995qft} in her book that aimed to present quantum field theory in a Kantian categorical framework of objective knowledge. \citet{teller1997metaphysics,teller2000gauge} criticized this view, raising the question of ``[h]ow can an apparently substantive conclusion follow from a fact about conventions?'' (2000, p. 469). This tension between the significance of gauge invariance as an essential part of the basis for the formulation of successful theories, and the appearance of gauge as essentially a manifestation of mathematical redundancy was dubbed by \citet{redhead2002gauge} as ``the most pressing problem in current philosophy of physics'' (p. 299) and has been the subject of extensive philosophical inquiry. Many \citep{martin2003continuous, norton2003gauge} have pointed the similarity of the question to the controversial issue of the role of general covariance in general relativity \citep{norton1993dispute}, in which a mathematical constraint on the formulation of the theory is seen as fundamental to the construction of the theory. One possible way to approach this question is to adopt a deflationary approach towards the gauge principle. \citet{brown1998objectivity} noted that neither the curvature of the fiber bundle nor the back-reaction of the matter on the gauge field can be explained by the principle. \citet{martin2003continuous} noted that in the gauge argument, the gauge principle is applied in conjuction with other principles such as Lorentz invariance, renormalizability and simplicity. The requirement for a local symmetry does not by itself determine the form of the interaction, nor does it dictate its existence. While this criticism does amend misconceptions that appear in some textbooks, it does not claim to fully resolve the foundational and philosophical questions. A different approach appeals to a notion of direct observability of gauge symmetries, in which the symmetry is restricted to observations performed on a certain subsystem (Section \ref{DES}). A third approach \citep{mack1981gauge,lyre2000equivalence,lyre2001gauging,lyre2003phase} acknowledges gauge covariance as a formal requirement by itself, and aims to account for its applicability by supporting it with an additional equivalence principle, formulated by analogy with Einstein's presentation of general relativity based on general covariance and equivalence principle. The principle roughly states that there is always a choice of gauge such that the gauge-field vanishes at a given point. Applying a generalized version of the equivalence principle can be beneficial in understanding gauge not only at the interpretational level, but already at the level of heuristics. The ``methodological equivalence principle'' prescribes the introduction of an interaction based on an the way the dynamical law of a theory violates invariance requirement. It provides a unified framework of understanding standard gauge theories, the use of general covariance in general relativity and tangent-space symmetries in gauge theories of gravity \citep{hetzroni2020equivalence,hetzroni2021analogies,hetzroni2021gravity}. This approach can motivate an interpretation of gauge theories as grounded in ontology of relational quantities, in harmony with a recent account by \citet{rovelli2014gauge}, and stressing a structural similarity between the gauge argument and Mach's principle \citep{hetzroni2020ghosts}. The origin of the gap between gauge independent physical phenomena and gauge dependent theoretical representation is that while fundamental physical degrees of freedom amount to relations between pairs of physical entities, our theories use variables that refer to single objects, and not their relations. From this perspective gauge invariance naturally arises as a formal property. What calls for an explanation is actually the non-invariance of interaction-free theories (special relativity under diffeomorphisms, Dirac equation under change of local phase convention etc.). The explanation is based on the existence of a gauge field not taken into account by those theories. \subsubsection{Interpretation of Gauge Invariance} \label{gaugeinterpretation} The appearance of a gauge symmetry in a given theory may have crucial implications on its possible interpretations and its ontology. The question of whether gauge symmetries reflect descriptive mathematical redundancy or some physical property is deeply entwined with issues of locality, separability, and determinism. Reconciling such theoretical virtues with each other, and in particular recall (D1)-(D3) introduced in Section \ref{INT}, is a non-trivial matter. Let us now introduce some terminology. We shall do so using the case study of electromagnetism (see \citealp[48]{Rickles2008}). Potentials related by the gauge transformation \eqref{gaugetransEM} (i.e., potentials that lead to the same fields) are \textit{gauge equivalent}. Gauge equivalent configurations lie on the same \textit{gauge orbit}. Accordingly, all potentials related by a gauge transformation are on the same gauge orbit. Our fields $\vec{E}$ and $\vec{B}$ remain constant under the gauge transformation \eqref{gaugetransEM}, they are \textit{gauge invariant}. The 4-vector potential $A^\mu$, i.e. the gauge field, is \textit{gauge variant}. Many mathematically distinct potentials lie on the same gauge orbit and lead to the same field. The fact that it does not matter which vector potential from a given gauge orbit we choose to express the fields is referred to as \textit{gauge freedom}. Gauge freedom implies that our gauge theory is mathematically underdetermined: the values of the gauge field throughout space in a given moment of time together with the Maxwell equations do not determine the potentials in different times. In some interpretations, this underdetermination corresponds to a form of indeterminism. If we have a point $p_0$ on phase space\footnote{Technically, the phase space of the theory can be constructed from the magnetic vector potential $\vec{A}$ and the electric field $\vec{E}$, see \citet{belot1998EM}.} as our starting point, the system does not evolve into a state represented by a unique phase point $p_t$, instead ``we now have an indeterministic time-evolution, with a unique $p_t$ replaced by a gauge orbit'' \cite[289]{redhead2002gauge}. This is to say that if we take a gauge variant quantity such as the vector potential to be physically real, and mathematically distinct vector potentials to be physically distinct, then not only is there no way to determine the state empirically, the state is also underdetermined by the equations of motion. Of course, this problem of indeterminism vanishes if one’s realism is constrained to gauge-invariant quantities, i.e. by identifying all gauge equivalent states with one physical state, an assumption that is often referred to as \textit{Leibniz Equivalence} (see for example \citealp{saunders2003leibniz}). We may therefore make a very broad distinction between two kinds of interpretations of gauge theories. On the one hand those that deny Leibniz equivalence, therefore taking gauge transformations to be physical transformations, allowing for realist commitments to gauge variant quantities, and interpretations that adopt Leibniz equivalence. Such interpretations would usually regard gauge freedom as an expression of surplus mathematical structure, and restrict realist commitments to gauge-invariant quantities. Proponents of the former type of interpretations may argue for a one-to-one correspondence between points on phase space and physical states such that each point on phase space represents a distinct physical state. This would mean that different points within the same gauge orbit would correspond to physically distinct states. In our case of classical electrodynamics, this would mean that gauge equivalent vector potentials would correspond to physically distinct states. These states would be empirically equivalent in the sense that no possible observation or measurement could reveal which gauge equivalent potential is currently in effect. As Rickles puts it, “these physically distinct possibilities are qualitatively indistinguishable” \cite[62]{Rickles2008}. Accordingly, such interpretations that allow gauge variant quantities to be physically real come with the great disadvantage of an awkward indeterminism that allows for physical quantities that are in principle unobservable. However, it is a virtue of such interpretations to avoid the existence of surplus mathematical structure that is typically considered a characteristic feature of gauge theories. Since mathematically distinct descriptions are related to physically distinct states, the problem of explaining surplus mathematical structure vanishes. Proponents of the latter type of interpretations may argue for a many-to-one correspondence between points on phase space and physical states such that points within the same gauge orbit would correspond to one and the same physical state. In our case of classical electrodynamics, this would mean that vector potentials are unphysical and gauge equivalent vector potentials would correspond to the same physical state. Accordingly, such interpretations that restrict realist commitments to gauge-invariant quantities come with the virtue of avoiding indeterminism and restricting realist commitments to quantities that are in principle measurable. However, such interpretations that opt for a many-to-one correspondence between mathematical descriptions and physical states still face the problem of dealing with all the mathematical redundancy. Many physicists and philosophers share the sentiment of Zee that ``gauge theories are also deeply disturbing and unsatisfying in some sense: They are built on a redundancy of description'' \cite[187]{Zee2010}. Instead, many would desire a more direct correspondence between the mathematics and the physics, such that every mathematical degree of freedom has observable effects. \subsubsection{Ontology of Gauge Theories} \label{gaugeontology} Interpretations of gauge theories are often presented as a response to the tension between gauge invariance and locality that is revealed in the Aharonov-Bohm effect (Section \ref{ABeffect}). In their original paper Aharonov and Bohm argued that \begin{quotation} in quantum mechanics, the fundamental physical entities are the potentials, while the fields are derived from them by differentiations[...] Of course, our discussion does not bring into question the gauge invariance of the theory. But it does show that in a theory involving only local interactions (e.g., Schr\"{o}dinger's or Dirac's equation, and current quantum-mechanical field theories), the potentials must, in certain cases, be considered as physically effective, even when there are no fields acting on the charged particles. [...] we are led to regard $A_\mu(x)$ as a physical variable. This means that we must be able to define the physical difference between two quantum states which differ only by gauge transformation. \end{quotation} The radical suggestion that the actual physics behind electromagnetism is not gauge invariant is supposed to maintain locality. \citetext{A straightforward way to interpret classical electromagnetism in this way is to revive the concept of the aether, and consider the vector potential as its velocity field, and the electric field as its acceleration. See \citealp{belot1998EM}}. The idea has several significant disadvantages. One problem is that the interpretation leads to the radical indeterminism discussed in the previous subsection. Such an interpretation is not necessarily local; it might also lead to a form of action at a distance that is more explicit than the nonlocality of the Aharonov-Bohm effect. An electric current which starts to flow, for example, can (depending on the actual gauge) immediately change the values of the vector potential throughout space. Furthermore, it is controversial whether the potentials can provide a truly local explanation for the Aharonov-Bohm effect, due to the issue of separability \citep{healey1997nonlocalityAB, maudlin1998healey, healey1999maudlin, eynck2001AvsB}. The potential's approach was criticized by Aharonov himself, due to the unexplained gap it contains between the gauge independent observed phenomena and their gauge dependent theoretical description \citep{aharonovrohrlich2008QP}. In light of the evident downsides of potentials' ontology, it may be worthwhile to reconsider the standard field interpretation of electromagnetism and see if it can be adapted to account for the Aharonov-Bohm effect. Such an approach was presented by \citet{dewitt1962AB}, who concluded that \begin{quotation} Nonrelativistic particle mechanics as well as relativistic quantum field theories with an externally imposed electromagnetic field can therefore be formulated solely in terms of field strengths, at the expense, however, of having the field strengths appear nonlocally in line integrals. \end{quotation} A different account of a nonlocal influence of fields is described by \citet{aharonovrohrlich2008QP} (mainly Chapters 4-5) in terms of modular variables. Nevertheless, even in this nonlocal approach the potentials are an essential part of the theoretical description of the interaction.\footnote{ \citet{strocchi1973superselection} suggest a local gauge invariant explanation by writing Schr\"{o}dinger's equation as an equation for the current density $j$ expressed in terms of the fields. The locality depends on the existence of a ``tail'' of a non-vanshing wave-function in overlap with the source. A very different local and gauge invariant explanation was offered by \citet{vaidman2012AB} based on a transient entanglement induced by the influence of the field generated by the particle on the source. See discussion in \citet{aharonov2015comment,vaidman2015reply} concerning the question of the formal indispensability of the potentials. } A third explanation was suggested by \citet{wu1975factors}. It closes the gap between the observable properties and the postulated physical properties in a straightforward way. \citeauthor{wu1975factors} noted that the actual observable quantity is not the AB phase difference $\Delta\varphi_{AB}$ itself (Equation \eqref{ABphase}), but rather, the phase factor (or holonomy, or anholonomy): \begin{equation} \label{ABphasefactor} \Phi_{AB}=\exp\left(i\Delta\varphi_{AB}\right)=\exp\left(i\frac{q}{\hbar c}\oint{A^*\left(\vec{r}\right)\cdot\vec{dr}}\right). \end{equation} Their approach, known today as the \emph{holonomies} approach to the Aharonov-Bohm effect, is to promote this factor (defined for any non-intersecting closed curve in space-time) to a fundamental variable from which all other electromagnetic quantities can be derived. The description of electromagnetism based on holonomies is gauge invariant and nonlocal. This kind of nonlocality is not a dynamical action at a distance, but a kinematic non-separability. This interpretation was advocated by \citet{belot1998EM} as a fruitful interpretation and by \citet{eynck2001AvsB} because of the local action and measurability of the holonomies. Forming an analogy with the ontology of space debate, \citet{arntzenius2014space} relates to holonomies interpretation as \textit{gauge relationism}, which he contrasts with \textit{fibre-bundle substantivalism} he presents. The ontology in this approach is a literal reading of the fibre bundle representation of gauge theories. It consists of fibre bundle representing the possible states of a gauge field over spacetime manifold. The structure of the fibre (vector space, Abelian\textbackslash non-Abelian group, etc.) determines the property of the interaction represented by the gauge fields, understood in terms of connections over the bundle. In the most literal reading, gauge transformations in these interpretations do reflect physical change (as in \citealp{maudlin1998healey}). It is possible, however, to formulate ``sophisticated'' version of this substantivalism, which denies the existence of possible worlds that are only connected by a gauge transformation. The main reason to favour substantivalist approaches to gauge, according to Arntzenius, is the availability and simplicity of theories formulated in terms of gauge dependent variable, in contrast to the difficulties in constructing a dynamical theory in which holonomies are a fundamental variable. \subsubsection{Direct Empirical Significance} \label{DES} The debate about the ontological correlates of symmetries is sometimes linked to the question of which symmetries have ``direct empirical significance'' and which do not. The idea here is that if a symmetry is a mere descriptive redundancy, it cannot be said to have any direct empirical significance. (Though it may have indirect empirical significance: the very fact that the theory can be formulated in terms of these symmetries has specific further implications, e.g. conservation laws.) In contrast, symmetries that connect states that are physically distinct yet empirically equivalent are said to have direct empirical significance. This question is intimately related to the distinction between systems and subsystems. There is no physical point of view from which a state of the entire universe and a symmetry-related state could be distinguished empirically, and it is therefore common to regard symmetries of the entire universe as not carrying any empirical significance. For symmetries applied only to proper subsystems of the universe, the situation is different. Here the standard example is the thought experiment known as Galileo's ship: the inertial state of motion of a ship is immaterial to how events unfold in the cabin, but is registered in the values of relational quantities such as the distance and velocity of the ship relative to the shore. The question that is in the centre of the debate about direct empirical significance is whether the same holds for local symmetries as in gauge theories. The orthodox view, that local gauge symmetries do \textit{not} carry empirical significance, has recently been argued to be derivable from three simple assumptions about direct empirical significance and physical identity of subsystem states \citep{Friederich2015,Friederich2017}, see \citep{Murgueitio} for criticism of the assumptions used there. However, recently, dissonant voices have become more prominent e.g. \cite{GreavesWallace,Teh_emp, Wallace2019a, Wallace2019b}. The unorthodox view reproduces, for any subsystem, a common interpretation of asymptotic symmetries within physics: that any gauge transformation that preserves the state at the boundary and yet is not asymptotically the identity, acquires empirical significance. But this transposition of asymptotic conclusions to compact subsystems has come under attack from many directions. For instance, in \cite{Gomes2021} counter-examples were shown to exist in vacuum electromagnetism; follow-up work gauge-fixes the local symmetry and asserts that only global symmetries can carry empirical significance as subsystem transformations, and this occurs only when such global symmetries are associated with covariantly conserved quasi-local charges \cite{GomesNoether}. Moreover, the common view of asymptotic symmetries \textit{can} be recovered within such a gauge-fixed formalism (cf. \cite{RielloSoft}). \subsection{Artificial vs. Substantial Gauge Symmetries} \label{AVS} Depending on the physicist, and the time at which they write, the appearance of gauge symmetries in our most successful theories of fundamental physics is regarded either as a deep insight into the structure of matter and fundamental interactions, or as a mere feature of convenience, reflecting a mathematical redundancy of the descriptive formal apparatus (see section \ref{The Gauge Principle Meets Philosophy}). Indeed the physical importance of gauge symmetries (if only at an heuristic level) is attested by the widespread acceptance of the \emph{gauge principle} -- constraining the form of interacting theories that generalise the free ones possessing fewer symmetries -- as a fundamental concept on par with the relativity or general covariance principle. Both are sometimes seen as symmetry principles uncovering deep structural aspects of physical reality. Such a position, and endorsement of the spirit of Yang's already mentioned aphorism that ``symmetry dictates interactions" \citep{Yang1980}, is prima facie in tension with the view of gauge symmetries as `surplus' theoretical structure. Resolving this tension, we argued in section \ref{INT}, hinges on a refined understanding of what should count as 'surplus structure' in gauge theory. A first step in the right direction is to notice that not all gauge symmetries are necessarily on a par. Indeed, it happens that, for technical reasons, physicists are used to routinely `adding' gauge symmetries to theories that initially had none, using a variety of tools (whose forefather is perhaps the Stueckelberg trick \citep{Ruegg-Ruiz}). But if practically any field theory can be turned into a gauge theory, it is hard to understand how gauge symmetries could be fundamental. This state of affair is reminiscent of a well-know discussion within the philosophy of general relativistic physics, spurred by the \emph{Kretschmann objection}: In 1917, E. Kretschmann criticised the foundational status that Einstein gave to the principle of general covariance for his General Relativity, observing that any theory could in principle be recast - perhaps with some cleverness required on the part of the theoretician - in the language of tensor calculus, thus in a generally covariant way. This prompted a recognition that one should distinguish \emph{substantive} general covariance, native of a theory, from \emph{artificial} general covariance, that is formally forced onto a theory, and that the main question is then to specify a demarcation criterion between the two.\footnote{The complete story is somewhat more subtle, of course. See e.g. \citep{Pooley2017}.} Given the above observation, a \emph{generalised Kretschmann objection} could similarly be leveraged against the gauge principle, suggesting a provisional distinction between \emph{substantive} and \emph{artificial} gauge symmetries \citep{Pitts2008, Pitts2009}. The question would then be: when presented with some gauge field theory, on what ground could we make the distinction? Presumably, one may look for physical signatures of substantive gauge symmetries that are lacking for artificial ones. As discussions in previous sections suggests, there is a feature that is usually recognised as characterising `honest' gauge symmetries: a trade-off between locality and gauge-invariance. It is indeed a fact that some gauge theories can be reformulated in a gauge-invariant way without sacrificing the locality of their basic variables (e.g. scalar electrodynamics and the abelian Higgs model), while others can't (e.g. spinorial electrodynamics and pure Yang-Mills theories) -- see section \ref{The dressing field method}. This certainly does not exhaust the physical content of substantive gauge symmetries, but one may take this trade-off to be a robust physical signature: On the position that physical d.o.f. are gauge-invariant, this criterion would classify `true' gauge theories as ones that display a certain non-locality (entirely distinct from quantum non-locality).\footnote{On the (difficult) position that gauge-variant variables are physically distinct but in principle empirically indistinguishable, the trade-off, though not interpreted as a physical signature, remains. Thus the distinction between the two classes of gauge symmetries still holds.} The famous Aharonov-Bohm effect, discussed in section \ref{ABeffect}, seems to provide support to the claim. Many -- likely all -- interpretive and conceptual issues raised by gauge symmetries, and discussed in this text, concern the substantive kind. Artificial gauge symmetries pose no -- or at least fewer -- mysteries as they can be redefined away, usually by some change of local field variables. Thus, presented with a gauge theory one could first seek to identify which, if any, of its gauge symmetries are artificial, and get rid of them so as to work with a minimal (`Ockhamised') version of the theory displaying only substantive residual gauge symmetries, if any. We might call such a minimal, and still local, version of a gauge theory its ``maximally invariant formulation". The latter is certainly the proper candidate to be subjected to in-depth philosophical and theoretical analysis. \footnote{Section \ref{The dressing field method} highlights an approach aiming to obtain maximally invariant formulations of gauge theories, the Dressing Field Method. Examples are given, but as we will see the application of main interest is the electroweak model -- which is also the main concern of the invariant formulation via the FMS approach of section \ref{Sec:FMS approach}. } According to the definition of `surplus structure' suggested in section \ref{INT}, artificial gauge symmetries are genuine surplus, while substantial gauge symmetries are not since they signal the non-locality -- or non-separability -- of the fundamental d.o.f. of gauge physics. Yet we should remark that, as also hinted in \ref{INT}, it may be that features initially deemed surplus are promoted if it is eventually found that they have a direct physical signature, or one more indirect in the form of an important theoretical virtue. Thus, while the distinction between substantive and artificial gauge symmetries holds good for classical gauge field theories, one may be led to reassess this provisional demarcation in quantum gauge field theory. Notably, a centrally attractive feature of gauge theories is their good renormalization properties under quantization. For a fundamental theory, renormalizability is often deemed an important virtue with deep physical relevance. Admitting this, if it appears that a gauge symmetry classically classified as artificial nonetheless plays a significant role in ensuring that the quantum theory is renormalizable, one would then be justified in promoting it to a substantial symmetry. Let us raise an intriguing possibility though: that on the contrary the distinction would extend to QFT, so that a gauge symmetry initially thought to be necessary to ensure good quantum properties, yet classically marked as artificial, would on second analysis turn out to be dispensable to the quantum theory \footnote{Case in point, if $\SU(2)$ in the electroweak model is classically artificial -- as it arguably is according to section \ref{Invariant formulation of the electroweak model} -- is it really unavoidable to prove the renormalisability of the quantized model?} This we leave as an open question. \subsection{Dualities} \label{DUAL} When discussing the idea of the possibility to eliminate (gauge) symmetries, another item necessarily appearing is the concept of dualities: The situation that physical systems can have two or more equivalent theoretical formulations. The different formulations may have different symmetries, even to the point that there exist a formulation with no symmetries at all. In general, if multiple theories exist, which agree on all observables, but have degrees of freedom which are not in a one-to-one-relation with each other, they are called dual to each other. Such relations are more than just variable transformations. A variable transformation is a mathematical process which is unambiguous, and thus invertible. In theories with the same physical content, but different levels of symmetries, there is necessarily an ambiguity in the relation between variables. A, relatively trivial, example is in classical mechanics the problem of orbital movement in the usual gravitational potential. It is a superintegrable system, which means that out of the three independent degrees of freedom all but one can be eliminated, using the conservation of the Runge-Lenz vector and of orbital angular momentum. But, one can choose to eliminate only one of the two degrees of freedom. This gives an intermediate theory with inequivalent symmetries to the one with only one degree of freedom, and connected to it by a non-invertible variable transformation. There are a vast number of further examples. Perhaps one of the most extreme cases is two-dimensional Yang-Mills theory in flat space-time [\cite{Dosch:1978jt}]. This theory is trivial in the sense that there are no physical excitations, and the only physical state is the (empty) vacuum. Nonetheless, there is a denumerable infinite number of associated gauge theories, Yang-Mills theory with an arbitrary Lie group, which all create this same single state. These theories all differ in terms of their gauge-dependent Green's functions, and thus in the way cancellations occur to create such a single state. There are further theories, which are known to be exactly related to each other, and are non-trivial. However, these are either theories, which are not gauge-theories, like the low-temperature/high-temperature duality of the Ising model [\cite{Kogut:1979wt}], or have a gauge theory only on one side, like the gauged O(4) linear sigma model with punctured target space and the corresponding non-gauge theory of massive scalars and vectors [See section \ref{Examples} and \cite{Maas:2017wzi,Fernandez:1992jh,Evertz:1985fc}]. While theories with trivial dynamics appear to be quite irrelevant, there is a wide variety of non-trivial theories where similar features are, to some extent, established, motivated, or conjectured. Probably most notorious are dualities between weakly coupled theories and strongly coupled theories. These are especially prolific for supersymmetric gauge theories [\cite{Weinberg:2000cr}], but have also been conjectured for some so-called walking theories [see e\ g.\ \cite{Sannino:2009za}]. In such cases often generalized electric and magnetic degrees of freedom are exchanged. However, the celebrated AdS/CFT conjecture [\cite{Freedman:2012zz}] suggests even the possibility that a quantum gauge theory in a fixed space-time could be equivalent to a classical gravitational theory in a different space-time. Would this be proven, especially for any applicable theory describing our universe, this would imply that even the fundamental structure of space-time is exchangeable. Dualities extend the ideas of Kretschmann [\cite{Pitts2009}], whose conjecture was that every theory can be covariantized. These considerations lead to a much stronger conjecture: That for every set of physical observables there exist multiple (gauge) theories, which are not related to each other by unambiguously invertible variable transformations. Finally, we note that very recently the topic of dualities has received some well-deserved attention in the philosophy of physics (see, e.g., \cite{CastellaniRickles} and \cite{HaroButterfield}). Here we find some notable agreement that duality is closely related to symmetry. More precisely, the idea is “that a duality is like a ‘giant symmetry’: a symmetry between theories” \cite[2974]{HaroButterfield}. In section 2.1.1, we have discussed in what sense symmetry is to be understood as “invariance under transformation.” The idea, now, is that while symmetries typically relate different physical states, or, in the case of gauge symmetries, the same physical state to different mathematical descriptions, in the case of dualities theories are related such that different theories describe the same (observable) physics. What makes the interpretation of duality particularly interesting is that dual theories are often associated with radically different ontological commitments. For instance, as it is the case with respect to the AdS/CFT conjecture, if one theory is formulated in D-dimensional space-time and the (allegedly) dual theory in D-1-dimensional space-time, what does this say about the world we live in? When there are two dual theories, describing the world in very different concepts, is one of them true and the other one false? Are both false, indicating that there is a true theory hidden beyond? Or is a unique mathematical description of the physical world impossible and dual theories constitute different (and possibly incomplete) but equally valid perspectives? Obviously, it would go beyond the scope of the paper to discuss this in detail. What we do note, however, is that in the literature dualities have been systematically compared to gauge symmetries (\cite{Rickles2017}, \cite{Haro2017}). This is because “dual theories can indeed ‘say the same thing in different words’—which is reminiscent of gauge symmetries” \cite[68]{Haro2017}. Accordingly, we conclude this section on the interpretation of gauge symmetries by emphasizing the significance of this undertaking. However, we note that the methods we discuss in Sections \ref{The dressing field method} and \ref{Sec:FMS approach} can be regarded as examples of how to establish dualities between gauge theories and non-gauge theories and their important role in gauge-invariant formulations the BEH mechanism. For example, the dressing field method provides a reformulation of the Abelian Higgs model or the Glashow-Weinberg-Salam model of electroweak interactions in terms of gauge-invariant fields at the classical level, see Sec.~\ref{The dressing field method}. In addition, the concept of dualities, relating the state space of different theories, allows for a potential reinterpretation of the BEH mechanism which avoids the terminology of spontaneous gauge symmetry breaking as conjectured in [\cite{Sondenheimer:2019idq}]. The framework proposed by Fr\"{o}lich, Morchio, and Strocchi (FMS) to formulate observables of a BEH theory in a gauge-invariant manner, provides a link between some gauge-invariant observables in one gauge theory to invariant observables with respect to another particular gauge group.\footnote{Note, that the latter group can also be trivial.} Thus, the BEH mechanism, i.e., the introduction of a scalar field with a Mexican hat type interaction potential, does not involve a spontaneous breaking of the original gauge group but induces a duality between particular states of two gauge theories in a specific way that is described by the FMS formulation. The seeming spontaneous breaking rather displays the fact that this duality becomes most apparent in a gauge-fixed language which explicitly breaks the original gauge group. We further elaborate on this relation in Sec.~\ref{Sec:FMS approach}. \section{Symmetry Breaking and the BEH Mechanism}\label{Sec:Breaking} The term `symmetry breaking' refers to a collection of phenomena and theoretical notions generally characterized by a situation in which the state of a system does not respect the symmetry of the laws governing it. The concept became dominant in theoretical physics around the early 1960s, in an interplay between condensed-matter physics and particle physics. The crowning glory of this framework is widely considered to be the Brout-Englert-Higgs (BEH) mechanism. A fundamental part of the electroweak model in particle physics, the mechanism is commonly presented as a case of dynamical spontaneous symmetry breaking of gauge symmetry. This standard account, however, has been challenged on various theoretical and philosophical grounds. The issue is clearly interconnected with that of the interpretation of gauge symmetries. In this chapter we shall briefly present the standard account of the mechanism, and recent developments in its understanding. We shall then focus on motivating gauge-invariant approaches (which will be the subject of the following two chapters) in light of problems with the standard account of symmetry breaking on the one hand, and philosophical discourse on gauge presented in the previous chapter on the other hand. \subsection{Symmetry Breaking at a Glance} \label{symbreak} Historically, one of the first physicists to recognize the systematic significance of the notion of symmetry breaking was Pierre Curie, the 1894 paper `Sur la sym\'{e}trie dans les ph\'{e}nom\`{e}nes physiques' being his principal work on this topic. Symmetry breaking, he noted, is not some obscure, rare phenomenon but is commonplace and may be the reason for the occurrence of phenomena in the first place. According to Curie, \begin{quotation} \textit{A phenomenon can exist in a medium which possesses its characteristic symmetry or that of one of the subgroups of its characteristic symmetry}. In other words, certain symmetry elements can coexist with certain phenomena, but they are not necessary. What is necessary is that some symmetry elements be missing. \textit{Asymmetry is what creates a phenomenon}. \cite[312]{Curie2003} \end{quotation} This idea that `[\textit{a}]\textit{symmetry is what creates a phenomenon}' underscores the significance of symmetry breaking and is a theme not unfamiliar in modern (philosophy of) physics. Castellani, for instance, declares: \begin{quotation} Any symmetry we can perceive (albeit in an approximate way) is indeed the result of a higher order symmetry being broken. This can actually be said of any symmetry which is not the ‘absolute’ one (i.e.\ including all possible symmetry transformations). But we can say even more: in a situation characterized by an absolute symmetry, nothing definite could exist, since absolute symmetry means total lack of differentiation. \cite[p. 322]{Castellani2003} \end{quotation} The claim that phenomena exist due to broken symmetries (or the lack of symmetry) is related to, but not equivalent to, what has become to be known as Curie’s principle. The principle says: “\textit{When certain causes produce certain effects, the symmetry elements of the causes must be found in their effects}” \cite[312]{Curie2003}. Conversely but equivalently, put in terms of asymmetry, the principle reads: "\textit{When certain effects show a certain asymmetry, this asymmetry must be found in the causes which gave rise to them}” \cite[312]{Curie2003}. Partly due to its vagueness, Curie’s principle has met opposing reactions (see \citealp{Earman2004b}). Attempts to make it more precise have resulted in a formulation that, according to prominent voices, “makes it virtually analytic” \cite[173]{Earman2004b}. In slogan form, the principle says: “\textit{if no asymmetry goes in, then no asymmetry comes out}” \cite[580]{Roberts2013}.\footnote{Although the principle is considered “an analytical truth” (\citealp{CastellaniIsmael}), Bryan Roberts has argued that the principle fails in certain cases of time reversal symmetry (\citealp{Roberts2013}). For more details on the relationship between Curie’s principle and spontaneous symmetry breaking, see \cite{Earman2004b}.} This leads us to the following question: How is it possible that our world manifests asymmetries although this world, on a fundamental level, seems to be governed by symmetric laws and theories? How exactly does asymmetry enter the picture and what does it mean and how can it be that a symmetry breaks down? There are two forms of symmetry breaking relevant in modern physics: explicit and spontaneous.\footnote{There are also other options, like breaking due to quantum anomalies. However, for the purposes at hand, such additional options could be lumped into either of the categories, e.\ g.\ anomalies into explicit breaking.} Explicit symmetry breaking is rather straightforward. A symmetry is broken explicitly when the equations of motion describing the system (as a consequence of the Lagrangian or Hamiltonian of the system not being invariant under the symmetry), are not covariant under the transformations. This is the case when a symmetry-breaking term is added in some situations to an otherwise covariant dynamics (e.g. due to an external field). In the case of spontaneous symmetry breaking (SSB) the equations of motion describing the system are covariant concerning the respective symmetry transformations, but the system is in a state that is not invariant under all symmetry transformations. This means that a system that is governed by a symmetric Hamiltonian can evolve into an asymmetric state. In particular, SSB appears when the ground state is degenerate, i.e. there are multiple states with the lowest energy. The transformation that connects these states instantiates a symmetry of the dynamics, yet each of the states does not respect the the symmetry, as it transforms it to one of the other states. The above description relates to classical theories. At the classical level, the choice of a particular ground state can be provided by part of the initial conditions. At the quantum level, this becomes more involved [\cite{Maas:2017wzi,Sartori:1992ib,Birman:2013gaa}]]. In quantum systems with finitely many degrees of freedom, the actual ground state always respects the symmetry. It is a superposition of non-symmetric states that are connected via quantum tunneling. Thus in a quantum theory SSB can only occur in systems with infinitely many degrees of freedom. this can be thought of in terms of the tunneling barriers becoming infinite. In such quantum settings, phenomena associated with SSB can also be described in terms of explicit breaking. If a system shows SSB, it exhibits a well-defined behavior if the symmetry is broken by an external source as well. It will then show a broken (asymmetric) ground state even when taking the limit of a vanishing source\footnote{This is usually observed in quantities known as order parameters, which are local quantities not invariant under the symmetry to be broken. However, it is possible to detect SSB also with other quantities [\cite{Maas:2017wzi}]. Furthermore, in gauge theories there are no gauge-invariant local order parameters [\cite{Frohlich:1981yi,Maas:2017wzi,Elitzur1975}], and whether alternatives exist is unclear, cf footnote \ref{nonlocalfootnote}. We therefore refrain here from using this concept.}. For gauge theories, any such source would itself be gauge-dependent, and thus break the gauge symmetry explicitly. The question thus naturally arises whether external sources are necessary to define spontaneous symmetry breaking. That can already be addressed at the global level. In fact, because the path integral sums over all configurations, there is no possibility without external source for singling out spontaneously a direction and thus break a symmetry. Thus global symmetries are always intact without external sources [\cite{Frohlich:1981yi,Maas:2017wzi}]. Nonetheless, it is still possible to determine how it would react to an external infinitesimal source using suitable observables [\cite{CaudyGreensite2008,Maas:2017wzi}]. If it would react in a non-analytic way, the system is metastable, and this metastability is equivalent to the usual picture of SSB. Thus, external sources are not necessary to identify SSB. In fact, they can even be misleading for gauge theories, as cases are known in which metastability is signalled in absence of actual SSB [\cite{Maas:2013sca}]. Furthermore, Elitzur's theorem even states that gauge symmetries can never experience SSB [\citet{Elitzur1975}]\footnote{\label{analyticityfootnote}Note that many statements such statements use a lattice regulator to make the theory well-defined. Analyticity and regularization have an often tricky relation. This is even more so for the lattice regulator which introduces additional non-analyticities by its very definition depending on a second-order phase transition. While exact proofs are notoriously difficult in continuum quantum field theories, the existing evidence, as well as special results [\cite{Frohlich:1981yi}], strongly suggest that the situation for the present topic is under sufficient control [\cite{Maas:2017wzi}].}. Hence, the whole concept of SSB cannot be transferred directly from global symmetries to gauge symmetries. This leads to the central issue: What is meant when, colloquially, physicists speak of SSB of gauge symmetries? The most prominent example for this issue is the Brout-Englert-Higgs effect (BEH), presented in the following subsection and discussed subsequently. \subsection{Gauge Symmetry Breaking and the BEH Mechanism} \label{gaugesymbreak} The standard text-book account of the BEH mechanism sets off from spontaneous breaking of the global symmetry, and then extends the analysis to the corresponding local gauge symmetry. In a spontaneous breaking of a global continuous symmetry, the different lowest-energy states are connected by a transformation of a degree of freedom that, in particle terms, can be interpreted as massless, spinless `Goldstone's bosons', that interact with the matter fields. The introduction of the field associated with Goldstone's bosons can be described using classical fields, by rewriting the Lagrangian, separating degrees of freedom that are transformed from one ground-state to another and `radial` directions, associated with massive particles. In quantum field theories this reformulation gains further significance, as it corresponds to a perturbative analysis around a particular ground-state. The simplest example concerns two scalar fields $\phi_1$, $\phi_2$ with a $U(1)$ symmetry corresponding to rotation in the internal field space (i.e., continuously transforming the one into the other). The potential is taken to be $V(\phi)=-\frac{1}{2}\mu^2 \phi^2+\frac{1}{4}\lambda \phi^4$, a function of the gauge independent term $\phi^2\equiv\phi_1^2+\phi_2^2$. Thus, all states satisfying $\phi=\mu^2/\lambda\equiv v^2$ have minimal energy. In this model, $\phi$ can be treated as a radial direction, corresponding to a massive boson. Transformations along the tangential direction generate the symmetry, and are associated with a Goldstone boson. This description is said to break the symmetry since perturbative analysis around any particular vacuum state (e.g. $\phi_1=v^2$; $\phi_2=0$) leads to the Lagrangian ${\cal{L}}=\left[\frac{1}{2}\partial_\nu \eta \partial^\nu \eta -\mu^2\eta^2\right]+\left[\frac{1}{2}\partial_\nu \xi \partial^\nu \xi \right]+[\text{interaction terms}]$ with $\eta$ radial perturbation and $\xi$ tangential ($\eta\equiv\phi_1-v^2$ and $\xi\equiv\phi_2$ for the aforementioned state). When applying the gauge principle, the global symmetry is localized, introducing a new massless bosonic field. In the above example the field $A^\nu$ defines a connection over the $U(1)$ bundle. The central point in this standard account is that when the Lagrangian is expressed in terms of $\xi$ and $\eta$, the gauge field $A^\nu$ obtains a non-vanishing mass term (that equals to $\frac{1}{2} \frac{q\mu}{\hbar c \lambda} A_\nu A^\nu$ in the above example). $A^\nu$ is therefore interpreted as massive bosonic field. The breaking of the local symmetry is associated with a choice of particular gauge. In order to allow for the massive-boson interpretation, the gauge is chosen such that the terms corresponding to the peculiar and unobservable Goldstone bosons disappear. Thus the mechanism, according to this standard presentation, allows for gauge bosons to obtain mass at the price of sacrificing gauge invariance. Moving from this toy model to theories with more empirical relevance, the prototypical theory is initially invariant under some local internal symmetry group and would accordingly have some gauge fields $W_\mu^a$, supplemented by one or more scalar fields $\phi$. In some representation of the gauge group the dynamics are defined by the Lagrangian \begin{align} {\cal L}&=-\frac{1}{4}W_{\mu\nu}^aW^{\mu\nu}_a+(D_{\mu\alpha\beta}\phi_\beta)^\dagger D^\mu_{\alpha\gamma}\phi_\gamma-V(\phi),\label{la:hs}\\ W_{\mu\nu}^a&=\partial_\mu W_\nu^a-\partial_\nu W_\mu^a+gf^{abc}W_\mu^b W_\nu^c,\\ D^\mu_{\alpha\beta}&=\partial^\mu\delta_{\alpha\beta}+gT^R_{a\alpha\beta}W_a^\mu. \end{align} The $T$ are suitably normalized generators for the representation $R$ of the scalar field, $f^{abc}$ the corresponding strutcure constants, and $g$ is the newly introduced gauge coupling. The most prominent example is the standard model Higgs sector. In this case the scalar is in the fundamental representation of an SU(2) gauge group. In this special case the theory furnishes also, a global SU(2) symmetry acting only on the scalar field. The Abelian Higgs model is recovered for $f^{abc}=0$ and $T^R=1$. Since the potential is, by construction, a function of gauge-invariant quantities only, so are the minima given by gauge-invariant conditions, \begin{align} \phi^\dagger\phi&=v^2\label{minhpot}, \end{align} where $v\neq 0$ minimizes the potential $V(\phi)$, and is thus a function of the parameters of the potential. These minima are for a polynomial potential necessarily translationally invariant, and therefore the fields satisfying (\ref{minhpot}) need to be constant. The minima need also to be invariant under any intact global symmetry. The condition $v\neq 0$ follows from the structure and parameters of the potential\footnote{This assumes that the quantum effective potential, in a suitable manner, still allows for (\ref{minhpot}) to hold. Furthermore, a suitable renormalization scheme is required to maintain (\ref{minhpot}) literally beyond tree-level [\cite{Bohm:2001yx}]}. This condition is at the root of the BEH effect, and thus of the so-called gauge SSB, and everything else follows from it. The existence of such a non-trivial minimum is then exploited by setting the length of the space-time averaged Higgs field as a gauge condition to the value $v$. To complete the gauge, it is customary to use a local condition \begin{align} \partial^\mu W_\mu^a+ig\zeta\phi_\alpha T^a_{\alpha\beta} v_\beta+\Lambda^a=0\label{thooftg}, \end{align} where $v_\beta$ is a vector of length $v$ and $\zeta$ is an arbitrary gauge parameter. The direction of $v_\beta$ is arbitrary, but fixed by this gauge choice. It is really the second term in (\ref{thooftg}), which enforces that one direction is made special, and thereby breaks the gauge symmetry in such a way as to ensure a vacuum expectation value for the Higgs field. It thereby establishes the BEH effect in the usual picture of a condensation of the Higgs field. Such a gauge choice would not be possible, if the potential did not support a non-trivial minimum $v^2>0$. Returning for a second to the classical level, initial conditions for the equations of motion of the gauge-dependent fields would be needed to be selected to comply with this gauge choice, and therefore implement the BEH effect. At the quantum level, there are no initial conditions. Hence, the gauge choice alone can enforce SSB and, in that sense, the BEH effect. After the gauge is implemented is implemented, calculations can be done, especially in form of perturbation theory. \subsection{Foundational and Interpretational Issues} Already in the early literature on the BEH mechanism it was noted that the gauge condition is not necessary [\cite{Lee:1974zg}]. The vacuum expectation value (VEV) of the Higgs field, while sometimes identified with observable properties, is in fact gauge dependent. Furthermore, gauges that do not fix it are possible, as well as gauges that set it to zero. This may seem surprising from the point of view of the standard perspective of the BEH as relying crucially on SSB, but it is actually not surprising in the light of Elitzur's theorem \citep{Elitzur1975}, which states that local symmetries cannot be spontaneously broken, concluding that ``breaking of local symmetry such as the Higgs phenomenon, for example, is always explicit, not spontaneous. The local symmetry must be broken first explicitly by a gauge-fixing term leaving only global symmetry. This remaining global symmetry can be broken spontaneously'' (p.3981)\footnote{Elitzur's theorem, as well as similar proofs, all rely on lattice regularization. The question to which extent they pertain to continuum theories is not an easy one. See \citep{Maas:2017wzi} for an overview on this issue, cf footnote \ref{analyticityfootnote}}. Gauges in which the VEV is set to zero disable perturbation theory, and for that reason they did not find widespread use, see [\cite{Lee:1974zg,Maas:2017wzi}]). However, their existence makes the answer to the question whether the gauge symmetry has genuinely been broken appear by itself dependent on the choice of gauge! This hard-coding of SSB by gauge-fixing raises the question of whether it is physical. At least when using a lattice regulator in the standard-model case \cite{Osterwalder:1977pc} and \cite{Fradkin:1978dv} showed that there exists only a single phase, in the sense of an analytic free energy. Hence, the BEH effect cannot be a physical distinction. In fact, explicit calculations showed that the possibility to fix the vacuum expectation value of the Higgs field itself is gauge-dependent, and thus an unphysical distinction \citep{CaudyGreensite2008}\footnote{ \label{nonlocalfootnote}Note that many attempts exist to still identify phases using non-local conditions, see e.g. \cite{Greensite:2017ajx,Greensite:2018mhh}.}. As \citet{Friederich2013} puts it, as it depends on the choice of gauge-fixing, SSB of local symmetries does not qualify as a ``natural phenomenon.'' These issues, together with more basic considerations of gauge invariance raised by philosophers in this context (see Section \ref{Sec:Why}) suggest that the standard account of the BEH mechanicsm as an instance of gauge symmetry breaking is misleading. Nonetheless, ignoring these conceptual issues and identifying SSB after gauge fixing with the BEH mechanism, may have played an important heuristic role in the acquisition of a wealth of experimentally confirmed results in particle physics [\cite{Bohm:2001yx,Zyla:2020zbs}]. This is a baffling state of affairs. It strongly suggests the necessity for a reconciliation of both the formal aspects and the phenomenological successes. One way to achieve such a reconciliation will be presented and discussed in Section \ref{Sec:FMS approach}. \section{Motivating Gauge-Invariant Approaches \label{Sec:Why As stressed in Section \ref{Interpreting Gauge Theorie}, there is a prioi a tension between the view of gauge symmetries as an insight into the inner workings of Nature -- as acknowledged by the wide recognition of the heuristic value of the Gauge Principle in discovering empirically successful mathematical descriptions of the fundamental interactions -- and the view of gauge symmetries as essentially a descriptive redundancy of our theoretical apparatus -- as manifested by the near universal acknowledgement that physical d.o.f. (observables ) should be gauge-invariant. Call this the ``profundity vs. redundancy" conundrum (see \cite{martin2003continuous}). While both these views are expressed in the physics literature, their inconsistency doesn't raise much interests or worries there, as it appears to be considered inconsequential to most practical or technical matters. Philosophers of physics on the other hand, whose job it is to worry about such things, have begun to seize on it when turning their attention to the foundations of gauge theories some twenty years ago. About this tension, Michael Redhead (2002) states ``In my view its elucidation is the most pressing problem in current philosophy of physics". \smallskip The one area where philosophers' and physicists' preoccupations (should) converge, and where the problem manifests itself with unique acuity, is when it comes to the notion of gauge SSB, especially given its implementation via the BEH mechanism in the Standard Model (SM) where it is widely seen as a concept pivotal to our understanding of the electroweak interaction. It is indeed a standard textbook presentation, and the conventional wisdom, that in the early history of the Universe, elementary particles interacting with the Higgs field (weak bosons and (most or all) fermions) gained their masses when the latter spontaneously broke the fundamental $\SU(2)$ gauge symmetry of the electroweak theory. But then how is this account compatible with the ``redundancy" stance on gauge symmetries? John Earman expresses the tension particularly vividly: \begin{quotation} As the semi-popular presentations put it, ‘Particles get their masses by eating the Higgs field.’ Readers of \textit{Scientific American} can be satisfied with these just-so stories. But philosophers of science should not be. For a genuine property like mass cannot be gained by eating descriptive fluff, which is just what gauge is. Philosophers of science should be asking the Nozick question: What is the objective (i.e., gauge invariant) structure of the world corresponding to the gauge theory presented in the Higgs mechanism? \cite[1239]{Earman2004} \end{quotation} This is why we say that there is a worrisome tension at the very heart of modern particle physics. On the one hand gauge symmetries are considered unphysical mathematical redundancy but on the other hand the BEH mechanism is explained by gauge SSB. But how could the breaking of unphysical mathematical redundancy have any physical impact on our world? The underlying idea of this joint work is that instead of employing the conceptually dubious notion of gauge SSB one may look for manifestly gauge invariant approaches to the BEH mechanism. This sentiment has found a considerable echo in the philosophy of physics community, where gauge-invariant reformulation of the BEH mechanism is considered a crucial test-bed to clarify the conceptual foundations of gauge field theories (see \cite{Friederich2013, Friederich2014}; \cite{Lyre2008}; \cite{Smeenk2006}; \cite{Struyve2011}). In the physics community, while a narrative about the BEH in terms of SSB remains commons, dissenting views -- such as \cite{Chernodub2008}; \cite{Ilderton-Lavelle-McMullan2010}; \cite{Maas:2017wzi}; \cite{Sondenheimer:2019idq} -- indicate an emerging trend in particle physics where invariant formulations of the BEH mechanism are seen as a promising research endeavor \footnote{Especially so in the lattice community. See \cite{Maas:2017wzi} for a list of references, including an overview of the development of such views since the inception of the BEH effect.} Some physicists familiar with the philosophy literature share this vision, one of us raising the worry that \begin{quotation} \[...\] not acknowledging the insights of philosophers of physics would certainly lead to a long-lived misconception at the heart of particle physics to remain uncorrected for still some times, and important ensuing questions regarding the context of justification of the electroweak model to remain unasked, let alone answered. \cite[475]{Francois2018} \end{quotation} \medskip It was indeed a motivation of this joint text to argue for a better awareness and appreciation of the general conceptual and interpretive issues surrounding gauge symmetries, especially as clear-headedness on these could actually have a concrete impact on the (re-)assessment of the foundation of electroweak physics and, perhaps, on future research avenues in particle physics. \medskip In Section \ref{INT}, we stressed that a satisfying interpretation of gauge theories may fulfil three desiderata that we remind to be \begin{enumerate}[label=(D{{\arabic*}})] \item To avoid ontological indeterminism. \item To avoid ontological commitments to quantities that are not measurable even in principle. \item To avoid surplus mathematical structure that has no direct ontological correspondence. \end{enumerate} We see that restricting one’s realist commitments to gauge-invariant quantities has the crucial advantage of avoiding a problematic indeterminism that allows for quantities that have no observable effects. This speaks in favor of the redundancy interpretation: Gauge symmetries are unphysical, full stop. While this is certainly a viable view some of us might endorse, above we have introduced a more subtle understanding that combines elements of both sides of the “profundity vs. redundancy” conundrum. We suggested that it should be understood as “surplus” any formal structure of a theory whose excision wouldn't be detrimental to its physical content and interpretation nor to its theoretical/pragmatic virtues. We hinted at the fact that for gauge theories, the (field-theoretic) notion of locality provides a robust criterion to detect such structures\footnote{One should note, however, that locality is seen by many, though not all, physicists as convenient but not necessary. Even though genuine non-local theories are much less understood on a technical level.}. On this notion was elaborated in Section \ref{AVS} the distinction between \emph{artificial} and \emph{substantial} gauge symmetries: only artificial gauge symmetries can be eliminated without sacrificing the locality of elementary field variables of a gauge theory, making them genuinely surplus. This distinction already goes some way toward alleviating the ``profundity vs redundancy" tension: the gauge principle reveals its profundity when it points toward theories with substantial gauge symmetries. The general issue at hand is therefore not to assess whether gauge symmetries are surplus structure or not; the refined question is how to distinguish between genuinely surplus gauge structure, and the non-surplus gauge structure whose physical signature relates to the non-locality or non-separability of gauge d.o.f. Gauge theories undergoing gauge SSB are no exception to this general discussion. Given a gauge theory with SSB, two possibilities arise. Either the gauge symmetry is substantial and its breaking correlates to (potential) physical observables, in which case gauge SSB is a genuine phenomenon. Or, the supposedly broken symmetry is artificial, in which case there is an invariant local reformulation of the theory in which SSB cannot occur and is revealed as a formal artifact of the original formulation stemming from an inadequate choice of local field variables. To elucidate which of these obtains in any given theory, one needs to reformulate it in a maximally invariant way -- in the sense of Section \ref{AVS} -- leaving only substantial gauge symmetries. In particular, such a gauge-invariant reformulation of the electroweak model is what is needed to answer Earman's question quoted above, and assess the real ontological status of electroweak SSB in the SM. In the following two sections, we present the state of the art of gauge-invariant approaches to the BEH mechanism. In Section 5, we highlight a tool adapted to such goals, known as the \emph{dressing field method}. We illustrate it via several instructive examples before the main application to the electroweak model in Section \ref{Invariant formulation of the electroweak model}. As we will see then, the dressing field method gives arguments to the effect that the $\SU(2)$ gauge symmetry of the model is artificial and that only the $\mathcal{U}(1)$ symmetry is substantial, so that SSB is superfluous to the empirical success of the SM -- this we observe, is consistent with Elitzur’s theorem. Then, in Section \ref{Sec:FMS approach}, we describe a closely related gauge-invariant formulation of the eletroweak model known as the FMS approach -- for Fr\"ohlich, Morchio, and Strocchi -- which has been much further developed, especially in lattice simulations, and is closer to being a viable alternative to the standard account regarding confrontation with high precision collider experiments. \section{The Dressing Field Method of Gauge Symmetry reduction \label{The dressing field method Given a physical theory with certain gauge symmetries, the discussion in the previous section motivates an attempt to identify its physical degrees of freedom by replacing gauge dependent variables with gauge invariant ones. This step, when successful, results in a \emph{reduction of gauge symmetries}, i.e. the formulation of a theory with less symmetries. In fact, gauge fixing and SSB, discussed in previous sections, similarly apply reduction of gauge symmetries to achieve certain goals, such as to allow for massive gauge fields mediating weak interactions or to control the quantization of the classical theory. In the past few years, another item in the physicist's symmetry reduction toolkit has been developed and is now known as the \emph{dressing field method} (DFM) (\cite{GaugeInvCompFields, Francois2014, Attard_et_al2017}). In a nutshell, this approach allows to systematically build gauge-invariant field variables out of the initial gauge-variant fields of a theory \emph{if} a so-called \emph{dressing field} can be identified within it. In contrast to SSB and gauge fixing the DFM does not reduce the symmetry by replacing gauge invariant Lagrangian with one that has to be expressed in a specific gauge, but rather by removing gauge dependence already at the level of the the field variables. As a matter of fact, the DFM provides a general framework of which one finds various retrospective applications in gauge theory. The tetrad field in gauge reformulations of General Relativity (GR) is probably the first example of dressing field in the physics literature (in the writings of Einstein and Weyl). The ``Stueckelberg trick" (\cite{Stueckelberg1938-I, Stueckelberg1938-II-III, Ruegg-Ruiz}) is another noticeable early instance of the method, as is Dirac's gauge-invariant formulation of QED (\cite{Dirac55}, \cite{Dirac58} section 80). Let us also mention e.g. the study of anomalies in QFT (\cite{Stora1984, Manes-Stora-Zumino1985, Garajeu-Grimm-Lazzarini}), or in QCD the so-called ``proton spin decomposition controversy'' (\cite{LorceGeomApproach, Leader-Lorce, FLM2015_I}) and the issue of constructing physical quark states (\cite{McMullan-Lavelle97, Heinzl:2008bu}). Regarding the interpretive issues about gauge symmetries that we concern ourselves with in this essay, the main takeaway from the DFM is the following. A dressing field, and therefore the gauge-invariant variables constructed from it, can either be local or non-local (like e.g. holonomies). In keeping with the nomenclature reminded in Section 4, if a local dressing field can be extracted, and thus a theory rewritten in a gauge-invariant yet local way, one may/could infer that the original gauge symmetry of the theory was an \emph{artificial} one: it was a genuine surplus structure, a mathematical artifact with no physical signature. When applied in particular to the electroweak model, the DFM suggests that the $\SU(2)$ symmetry -- allegedly broken according to the standard narrative -- is actually artificial, and can be removed in the new "dressed" formulation of the model by a local change of field variables. Such a surprising conclusion is nonetheless in keeping with a body of literature on invariant reformulations of theories undergoing SSB -- see e.g. \cite{Maas:2017wzi} for references -- going all the way back to \cite{Higgs66} and \cite{ Kibble67}. Philosophers of physics, such as \cite{Smeenk2006, Lyre2008, Struyve2011} and \cite{Friederich2013, Friederich2014}), did not fail to appreciate that such reformulations, which they sometimes rediscovered for themselves, should shed new light on these theories and on the electroweak model in particular. To flesh out this short preview, in this section we propose an introduction to the DFM. It is formalised within the framework of differential geometry of fiber bundles,\footnote{For the acquainted reader, let us notice that it is close in spirit to the Bundle Reduction Theorem, various presentations of which can be found in \cite{Trautman, Westenholz, Sternberg, Sharpe}.} which is nowadays widely understood to be the mathematical foundation of classical gauge field theory. So, while the following presentation is fairly technical, we made efforts to make it self-contained and to give it as logically developed a progression as possible. Our aim is for a motivated non-expert to get a firm grasp of the key technical and conceptual notions. We start by providing background material in differential geometry, so that the DFM can be properly described next. We highlight how it can help rewrite gauge theories in an invariant fashion, and why it can be a tool to detect genuine surplus structure -- see also \cite{Francois2018} for further discussion of this point. The general discussion is illustrated via several examples before we turn to the main application to the electroweak model, which is followed by final short comments on the merits and limits of its reformulation via DFM. \subsection{Geometric Background \label{Geometric background Let's take the view that the differential geometry of fiber bundles is the geometrical underpinning of classical gauge field theories. The recipe for one thus consists in a series of geometric ingredients providing the ``kinematics", so to speak, and a physical one providing the dynamics: the Lagrangian. Arguably the central ingredient is then a principal bundle $\P$ over spacetime $\M$ with structure group $H$ (the global/rigid symmetry group) and projection $\pi :\P \rarrow \M$, $p \mapsto \pi(p)=x$. A fiber over $x\in \M$ is $\pi\-(x)=\P_{|x} \subset \P$. Each fiber is an orbit of the right action of the structure group, $\P\times H \rarrow \P$, $(p, h) \mapsto ph =: R_h p$, which is free and transitive. The linearisation of this action induces vectors tangent to the fibers: $\forall X \in$ Lie$H$ corresponds a vertical vector $X^v_{|p}$ at $p$. At $p \in \P$, the span of these vectors is a sub-vector space $V_p\P$ of the tangent space $T_p\P$. The~collection of all such subspaces $\forall p \in\P$ is the canonical vertical subbundle $V\P$ of the tangent bundle $T\P$. We note $\Gamma(VP)$ the space of vertical vector fields $X^v: \P \rarrow V\P$ (i.e. sections of $V\P$). Given representations $(\rho_i, V_i)$ of $H$, one naturally builds associated bundles to $\P$, $E_i\vcentcolon= \P \times_{\rho_i}\!V_i$ with typical fiber $V_i$, whose sections $s_i:\M \rarrow E_i$, $s_i \in \Gamma(E_i)$, represents various kind of matter fields. It is a standard result of bundle theory that sections are in 1:1 correspondance with representation-valued equivariant functions on $\P$, i.e. $\Gamma(E_i)\simeq \Omega^0_{\text{eq}}(\P, V_i):=\big\{ \vphi:\P \rarrow V_i\ |\ R_h^*\vphi = \rho_i(h\-) \vphi \text{ i.e. } \vphi(ph)= \rho_i(h\-) \vphi(p) \big\}$. More generally, one may define the space of representation-valued equivariant forms $\Omega^\bullet_{\text{eq}}(\P, V_i):=\big\{ \alpha \in \Omega^\bullet(\P, V_i)\ |\ R_h^*\alpha= \rho_i(h\-) \alpha) \big\}$, and the important subspace of \emph{tensorial} forms $\Omega^\bullet_{\text{tens}}(\P, V_i):=\big\{ \alpha \in \Omega^\bullet_{\text{eq}}(\P, V_i)\ |\ \alpha(X^v, \ldots)= 0, \text{ for } X^v \in \Gamma(VP) ) \big\}$. A form that satisfies this latter condition, without necessarily being equivariant, is said \emph{horizontal}. Notice that $\Omega^0_{\text{eq}}(\P, V_i) = \Omega^0_{\text{tens}}(\P, V_i)$. Tensorial forms with trivial equivariance are called \emph{basic}. The name is justified by the fact that basic forms induce, or come from, forms on the base $\M$. In fact an alternative definition is $\Omega^\bullet_{\text{basic}}(\P, V_i):=\big\{ \alpha \in \Omega^\bullet(\P, V_i)\ |\ \exists \, \beta \in \Omega^\bullet (\M, V_i) \text{ s.t. } \alpha=\pi^*\beta \big\}$. The exterior derivative $d$ on $\P$ does not preserve the space of tensorial forms, in particular $d \vphi \notin \Omega^1_{\text{eq}}(\P, V_i)$. Hence the introduction on $\P$ of a connection 1-form $\omega \in \Omega^1(\P, \text{Lie}H)$ defined by: \begin{equation} R^*_h \omega = \Ad_{h\-} \omega,\,\,\text{i.e.}\,\,\omega \in \Omega_\text{eq}^1(\P, \text{Lie}H),\label{eq:omega_equi} \end{equation} \begin{equation} \omega_p(X^v_{|p})=X \in \text{Lie}(H), \forall X^v_{|p} \in V_p\P.\label{eq:omega_proj} \end{equation} \noindent From these properties follows that one can define a \emph{covariant derivative}, $D^\omega := d\ + \rho_{i*}(\omega) : \Omega^\bullet_{\text{tens}}(\P, V_i) \rarrow \Omega^{\bullet+1}_{\text{tens}}(\P, V_i)$, where $\rho_{i*}$ are representation maps for Lie$H$. So that in particular $D^\omega \vphi=d\vphi + \rho_{i*}(\omega)\vphi \in \Omega^1_{\text{tens}}(\P, V_i)$, i.e. a connection allows for a good notion of derivation on $\Gamma(E_i)$. The choice of a connection 1-form on $\P$ is non-canonical. The space of all connections $\C$ is an affine space modelled on the vector space $\Omega^1_\text{tens}(\P, \text{Lie}H)$, meaning that for $\omega \in \C$ and $\alpha \in \Omega^1_\text{tens}(\P, \text{Lie}H)$, $\omega':=\omega+\alpha \in \C$. Or, as is clear from the above defining properties, for $\omega, \omega' \in \C$, $\omega+\omega' \notin \C$ and $\omega'-\omega \in \Omega^1_\text{tens}(\P, \text{Lie}H)$. The curvature of a connection is given by $\Omega=d\omega+ \tfrac{1}{2}[\omega, \omega]$. One shows that it is a tensorial form, $\Omega \in \Omega^2_\text{tens}(\P, \text{Lie}H)$. The covariant derivative thus acts on it trivially, which gives the Bianchi identity: $D^\omega \Omega=0$. It is also easily proved that $D^\omega \circ D^\omega = \rho_*(\Omega)$. \medskip The natural maximal group of transformation of $\P$ is its group of automorphisms $\Aut(\P):=\big\{ \Psi \in \Diff(\P)\ |\ \Psi(ph)=\Psi(p)h \big\}$, i.e the subgroup of $\Diff(\P)$ that respects the fibration structure by sending fibers to fibers, and thus projects on $\Diff(M)$. The subgroup of vertical automorphisms is $\Aut_v(\P):=\big\{ \Psi \in \Aut(\P)\ |\ \pi \circ \Psi=\pi\big\}$, i.e. it is those automorphisms that induce the identity transformation on $\M$. The latter group is isomorphic to the gauge group of $\P$, $\H:= \big\{ \gamma:\P \rarrow H\ |\ R^*_h \gamma =h\- \gamma h \big\}$ (itself isomorphic to the space of sections of the bundle $\P\times_\text{Conj} H$), the isomorphism being $\Psi(p)=p\gamma(p)$. The gauge transformation of a differential form $\alpha$ on $\P$ is defined by $\alpha^\gamma := \Psi^* \alpha$, for $\gamma \in\H$ corresponding to $\Psi \in \Aut_v(\P)$. Notably, the gauge transformations of tensorial forms are entirely controlled by their equivariance: for $\alpha \in\Omega^\bullet_{\text{tens}}(\P, V_i)$, $\alpha^\gamma = \rho_i(\gamma\-) \alpha$ (hence the name for such forms). The $\H$-transformation of a connection also assumes a simple form: for $\omega \in \C$, $\omega^\gamma = \gamma\- \omega \gamma + \gamma\- d\gamma$. Transformations induced by the action of $\H \simeq \Aut_v(\P)$ are called \emph{active gauge transformations}, as they are analogous to the action of $\Diff(\M)$ in General Relativity (GR). Notice that as a special case of its action on tensorial forms, the gauge group acts on itself as: $\eta^\gamma =\gamma\- \eta \gamma$ for $\eta, \gamma \in \H$. This ensures that the action of $\H$ on $\Omega^\bullet_{\text{tens}}(\P, V_i)$ and $\C$ is a right action. \medskip A bundle $\P$ is always locally trivial, meaning that for $U\subset \M$ we have $\P_{|U}\simeq U \times H$. A trivialising section is a map $\s : U \rarrow \P_{|U}$, $x \mapsto \s(x)$. By its means, one can pull-back objects of $\P$ down to $\M$. In particular the local representative of $\omega \in \C$ is $A:=\s^*\omega \in \Omega^1(U, \text{Lie}H)$, which is a gauge (Yang-Mills) potential. The field strength of $A$ is the local representative of the curvature $F:=\s^*\Omega \in \Omega^2(U, \text{Lie}H)$. Then the local representatives $\phi:=\s^*\vphi \in \Omega^0(U, V_i)$ are various kinds of matter fields, and $D^A\phi:=\s^*(D^\omega \vphi) \in \Omega^1(U, V_i)$ their minimal coupling to the gauge field. The last three are special cases of local representatives of tensorial forms: $a:=\s^* \alpha \in \Omega^\bullet(U, V_i)$. Considering $U$ and $U'$ s.t. $U \cap U' \neq \emptyset$ and local sections $\s : U \rarrow \P_{|U}$ and $\s' : U' \rarrow \P_{|U'}$ related on the overlap via $\s'=\s g$ where $g : U \cap U' \rarrow H$, $x \mapsto g(x)$, is a (well named) transition function of $\P$. The local representatives on $U$ and $U'$ obtained via $\s$ and $\s'$ satisfy gluing properties on $U \cap U'$ involving $g$'s. For local representatives of a connection and of tensorial forms we have, \begin{align} \label{PassiveGT} A' = g\- A g+ g\-dg, \qquad a'=\rho_i(g\-) a. \end{align} As special case of the second equation, we have the gluings of the field strength and matter fields: $F'=g\-Fg$ and $\phi'=\rho_i(g\-)\phi$. Equations \eqref{PassiveGT} are called \emph{passive gauge transformations}, as they are entirely analogous to coordinate changes, or passive diffeomorphisms, in GR. The latter are formally indistinguishable, yet conceptually different, from \emph{ local active gauge transformations} i.e. the local representatives of the global $\H$-transformations seen above, which on $U$ would read, \begin{align} \label{local-activeGT} A^\upgamma = \upgamma\- A \upgamma+ \upgamma\-d\upgamma, \qquad a^\upgamma=\rho_i(\upgamma\-) a, \qquad \text{for }\ \upgamma \in \H_\text{loc} \end{align} and with the local gauge group over $U$ defined as $\H_\text{loc}:=\big\{ \upgamma=\s^*\gamma, \gamma \in \H \ |\ \upeta^\upgamma=\upgamma\- \upeta \upgamma \big\}$. In the subsequent presentation below we will focus on local active gauge transformations. \medskip With this ends our summary of the geometry underlying the kinematics of a gauge theory. Let us note $\A$ the space of gauge potentials (local connections) and, with slight abuse, $\Gamma(E_i)$ the spaces of matter fields. A gauge theory is specified by a Lagrangian functional $L: \A \times \Gamma(E_i) \rarrow \Omega^n(U, \RR)$, $(A, \phi) \mapsto L(A, \phi)$, with $n=$ dim$\M$. Requiring the passive gauge invariance of $L$, $L(A', \phi')=L(A, \phi)$, amounts to requiring that it has trivial gluings and is well defined across $\M$: $L(A, \phi) \in \Omega^n(\M, \RR)$ . But it formally is indistinguishable from requiring its local active gauge transformation, $L(A^\upgamma, \phi^\upgamma)=L(A, \phi)$, which implies that it comes from a $\H$-invariant, i.e. basic, form on $\P$: $\b L(\omega, \vphi) = \pi^* L(A, \phi) \in \Omega^n_\text{basic}(\P, \RR)$. \subsection{Reduction of Gauge Symmetries via Dressing \label{Reduction of gauge symmetries via dressing We begin by defining the central object of the DFM. We consider a $\H$-gauge theory based on a bundle $\P(\M, H)$. \begin{definition} \label{Def1} Suppose $\exists$ subgroups $K \subseteq H$ of the structure group, to which corresponds a subgroup $\K \subset \H$ of the gauge group, and $G$ s.t. $K\subseteq G \subseteq H$. A $K$-\emph{dressing field} is a map $u:\P \rarrow G$ defined by its $K$-equivariance~$R^*_k u=k\-u$. Denote the space of $G$-valued $K$-dressing fields on $\P$ by $\D r[G, K]$. It follows immediately that the $\K$-gauge transformation of a dressing field is $u^\gamma=\gamma\- u$, for $\gamma \in\K$. \end{definition} Given the existence of a $K$-dressing field, we have the following, \begin{prop} \normalfont \label{Prop1} From $\omega \in \C$ and $\alpha \in \Omega^\bullet_\text{tens}(\P, V_i)$, one defines the \emph{dressed fields} \begin{align} \label{dressed-fields} \omega^u\vcentcolon= u\- \omega u +u\-du, \quad \text{ and } \quad \alpha^u \vcentcolon= \rho_i(u)\-\alpha, \end{align} which have trivial $K$-equivariance and are $K$-horizontal, thus are $K$-basic on $\P$. It~follows that they are $\K$-invariant: $(\omega^u)^\gamma=\omega^u$ and $(\alpha^u)^\gamma=\alpha^u$, for $\gamma \in \K$, as is easily checked. The dressed curvature is $\Omega^u =d\omega^u+\sfrac{1}{2}\left[\omega^u, \omega^u\right]= u\-\Omega u$, and appears when squaring the dressed covariant derivative defined as $ D^{\omega^u}\vcentcolon= d\, + \rho_*(\omega^u)$. It satisfies the Bianchi identity $D^{\omega^u}\Omega^u = 0$. \end{prop} In case the equivariance group of $u$ is $K=H$, $\alpha^u \in \Omega^\bullet_\text{basic}(\P, V_i)$ and $\omega^u\in \Omega^1_\text{basic}(\P, \text{Lie}H)$ are $\H$-invariant, thus project as forms on $\M$. The above results for $\alpha^u$ make sense for $G \supset H$ if we assume that representations $(V_i, \rho_i)$ of $H$ extend to representations of $G$. Let us emphasize an important fact: It should be clear from its definition that $u \notin \K$, so that \eqref{dressed-fields} are \emph{not} gauge transformations, despite the formal resemblance. This means, in particular, that the dressed connection is no more a $H$-connection, $\omega^u \notin \C$, and a fortiori is not a point in the gauge $\K$-orbit $\O_\K[\omega]$ of $\omega$, so that $\omega^u$ must not be confused with a gauge-fixing of $\omega$. \medskip On $U\subset \M$, a local $\K_\text{loc}$-dressing field $\u=\s^*u: U \rarrow G \in \D r[G, K]_\text{loc}$ will be defined (or recognised) by its defining gauge transformation property $\u^\upgamma =\upgamma\-\u$ for $\upgamma \in \K_\text{loc} \subseteq \H_\text{loc}$. The local version of proposition \ref{Prop1} above is, \begin{prop} \normalfont \label{Prop2} Given $A \in \A$ and $a=\s^*\alpha$ for $\alpha \in \Omega^\bullet_\text{tens}(\P, V_i)$, the following \emph{dressed fields} \begin{align} \label{local-dressed-fields} A^\u\vcentcolon= \u\- A \u + \u\-d\u, \quad \text{ and } \quad a^\u \vcentcolon= \rho_i(\u)\-a, \end{align} are $\K_\text{loc}$-invariant (as is easily checked). In particular, so is the dressed curvature $F^\u=dA^\u+\sfrac{1}{2}[A^\u, A^\u]=\u\- F\u$, which satisfies the Bianchi identity $D^{A^\u}F^\u=0$, where the dressed covariant derivative is $D^{A^\u}=d\, +\rho_*(A^\u)$. Of course, in case $\u$ is a $\H_\text{loc}$-dressing field, the dressed fields \eqref{local-dressed-fields} are strictly $\H_\text{loc}$-invariant. \end{prop} \subsubsection{Residual Gauge Transformations \label{Residual gauge transformations Let us indulge in a brief digression that is also a transition. In the BRST framework, infinitesimal gauge transformations are encoded as $\boldsymbol{s} A=-D^A \boldsymbol v$ and $\boldsymbol{s} a = -\rho_*(\boldsymbol{v})a$, where $\boldsymbol s$ is the nilpotent BRST operator and $\boldsymbol v$ the ghost field. The latter has values in Lie$\H$ and satisfies $\boldsymbol{sv}+\sfrac{1}{2}[\boldsymbol{v}, \boldsymbol{v}]=0$. For~this reason, $\boldsymbol s$ is best interpreted geometrically as the de Rham derivative on $\H$ and $\boldsymbol v$ as its Maurer-Cartan form [\cite{Bonora-Cotta-Ramusino}]. One shows that, at a purely formal level, the dressed variables satisfy a modified BRST$^\u$ algebra: $\boldsymbol{s} A^\u=-D^{A^\u} \boldsymbol{v}^\u$ and $\boldsymbol{s} a^\u = -\rho_*(\boldsymbol{v}^\u)a^u$, where one defines the \emph{dressed ghost} $\boldsymbol{v}^\u\vcentcolon= \u\- \boldsymbol{v} \u + \u\- \boldsymbol{s} \u$. In the special where case $\u$ is a $\H_\text{loc}$-dressing, its defining gauge transformation translates as $\bs{s}\u=-\bs{v} \u$. Then the dressed ghost is $\bs{v}^\u=0$ and BRST$^\u$ is trivial, $\bs{s}A^\u=0$ and $\bs{s}a^\u=0$. In the more general case of a $\K_\text{loc}$-dressing $\u$ achieving only partial gauge reduction, BRST$^\u$ only makes sense if it encodes residual gauge transformations of the dressed fields~\eqref{local-dressed-fields}. \medskip To speak meaningfully about these, we must assume that $K$ is a \emph{normal} subgroup, $K \triangleleft H$, so that the $J\vcentcolon= H/K$ is indeed a group, to which corresponds the (residual) gauge subgroup $\J \subset \K$. Now, the action of $\J$ on the initial variables $A$ and $\alpha$ is known. Therefore what will determine the $\J$-residual gauge transformations of the dressed fields is the action of $\J$ on the dressing field. And this in turn is determined by its $J$-equivariance. In that regard, consider the following propositions, \begin{prop} \normalfont \label{Residual1} Suppose the dressing field $u$ has $J$-equivariance given by $R^*_j u =j\-uj$. Then the dressing field has $\J$-gauge transformation $u^\eta=\eta\-u\,\eta$ for $\eta \in \J$, and the residual gauge transformations of the dressed fields are: $(\omega^u)^\eta=\eta\- \omega^u \eta + \eta\-d\eta$ and $(\alpha^u)^\eta=\rho(\eta)\-\alpha^u$. So in particular $(\Omega^u)^\eta=\eta\- \Omega^u \eta$. \end{prop} \noindent The local version is, \begin{prop} \normalfont \label{Residual2} If the $\K_\text{loc}$-dressing field $\u$ has $\J_\text{loc}$-transformation given by $\u^\upeta=\upeta\- \u \upeta$ for $\upeta \in \J_\text{loc}$, then the residual $\J_\text{loc}$-gauge transformations of the dressed fields are: $(A^\u)^\upeta=\upeta\- A^\u \upeta + \upeta\-d\upeta$ and $(a^\u)^\upeta=\rho(\upeta)\-a^\u$, so in particular $(F^\u)^\upeta=\upeta\- F^\u \upeta$. That is, in this case the dressed fields are genuine $\J_\text{loc}$-gauge fields. \end{prop} In the BRST language, the normality of $K$ in $H$ implies $\bs{v}=\bs{v}_K+\bs{v}_J$, where $\bs{v}_K$ and $\bs{v}_J$ are respectively Lie$\K$- and Lie$\J$-valued, and in accordance $\bs{s}=\bs{s}_K+\bs{s}_J$. The defining $\K_\text{loc}$-transformation of the dressing field translates as $\bs{s}_K \u=-\bs{v}_K \u$, while its $\J_\text{loc}$-transformation assumed in Proposition \ref{Residual2} is encoded as $\bs{s}_J \u=[\u, \bs{v}_J]$. The dressed ghost field is thus $\bs{v}^\u=\u\-(\bs{v}_K+\bs{v}_J) \u + \u\- (\bs{s}_K + \bs{s}_J)\u = \u\-(\bs{v}_K+\bs{v}_J) \u + u\- (-\bs{v}_K \u + [\u, \bs{v}_J]) = \bs{v}_J$. Therefore, the modified (actually \emph{reduced}) BRST$^\u$ algebra is: $\bs{s}_J A^\u = -D^{A^\u} \bs{v}_J$ and $\bs{s}_J a^\u = -\rho_*(\bs{v}_J)a^\u$. As expected, it encodes the residual gauge transformations of the dressed fields. \smallskip Consider the Lagrangian $L(A, \phi)$ of our initial $\H_\text{loc}$-gauge theory, and suppose a $\K_\text{loc}$-dressing field satisfying the above propositions is available. Due to the $\H_\text{loc}$-invariance of the Lagrangian, which holds as a formal property of $L$ as a functional, and due to the formal similarity between a gauge transformation \eqref{PassiveGT}/\eqref{local-activeGT} and a dressing operation \eqref{local-dressed-fields}, we have that $L(A, \phi)=L(A^\u, \phi^\u)$. That is, the $\H_\text{loc}$-gauge theory can be rewritten in terms of $\K_\text{loc}$-invariant variables, which means that it becomes a $\J_\text{loc}$-gauge theory: the $\K_\text{loc}$-gauge symmetry sector has been neutralised. In case a $\H_\text{loc}$-dressing field is available, the gauge symmetry of the theory $L$ is fully reduced. Remark again that as $\u\notin \K_\text{loc}\subset \H_\text{loc}$, the dressed fields $\upchi^\u=(A^\u, \phi^\u)$ are not points in the gauge orbits $\O[\upchi]$ of the gauge variables $\upchi=(A, \phi)$. So, the dressed Lagrangian $L(A^\u, \phi^\u)$ is not a gauge-fixed version of $L(A, \phi)$. \subsubsection{Ambiguity in Choosing a Dressing Field \label{Ambiguity in choosing a dressing field The dressed fields may exhibit residual transformations of another kind resulting from a potential ambiguity in choosing the dressing field. A priori two dressings $u, u' \in \D r[G, K]$ may be related by $u'=u\xi$, where $\xi:\P \rarrow G$. Since by definition $R^*_k u =k\-u$ and $R^*_k u' =k\-u'$, one has $R^*_k \xi = \xi$. Let us denote the group of such basic maps $\G \vcentcolon= \left\{\, \xi:\P \rarrow G\, |\, R^*_k \xi = \xi \, \right\}$, and denote its action on a dressing field as $u^\xi=u\xi$. By definition $\G$ has no action on the space of connections $\C$ or on $\Omega^\bullet_\text{tens}(\P, V_i)$: note this $\omega^\xi=\omega$ and $\alpha^\xi=\alpha$. On the other hand, it is clear how $\G$ acts on dressed fields: \begin{align} \label{ResidualGT-2Kind} (\omega^u)^\xi &\vcentcolon= (\omega^\xi)^{u^\xi}=\omega^{u\xi}=\xi\- \omega^u \xi + \xi\-d\xi, \quad \text{and} \notag\\ \quad (\alpha^u)^\xi &\vcentcolon=(\alpha^\xi)^{u^\xi}=\alpha^{u\xi}=\rho(\xi\-) \alpha^u. \end{align} In particular, $(\Omega^u)^\xi=\xi\- \Omega^u \xi$. The new dressed field $(\omega^u)^\xi$ and $(\alpha^u)^\xi$ are also $K$-basic, and therefore $\K$-invariant. It means that the bijective correspondance between the $K$-dressings $(\chi^u)^\xi$, for $\chi=(\omega, \alpha)$, and their gauge $\K$-orbits $\O_\K[\chi]$ holds $\forall \xi \in \G$. So there is a $1:1$ correspondance $\O_\K[\chi] \sim \O_{\G}[\chi^u]$. The local counterpart of the above is clear: The group $\G_\text{loc}:=\big\{ \upxi=\s^*\xi : U\subset \M \rarrow G, \text{for } \xi \in \G \big\}$ parametrises the ambiguity in choosing the local dressing field, s.t. $\u'=\u\upxi$, and consequently acts on the local dressed fields as, \begin{align} \label{ResidualGT-2Kind-local} (A^\u)^\upxi =\upxi\- A^\u \upxi + \upxi\-d\upxi, \quad \text{and} \quad (a^\u)^\upxi =\rho(\upxi\-) a^\u. \end{align} In particular $(F^\u)^\upxi=\upxi\- F^\u \upxi$ and $(D^{A^\u}\phi_i^\u)^\upxi=\rho(\upxi\-)D^{A^\u}\phi_i^\u$. And again, we have a correspondance between the gauge $\K_\text{loc}$-orbits of fields $\upchi=(A, a)$ and the $\G_\text{loc}$-orbits of their dressings $\upchi^\u$: $\O_{\K_\text{loc}}[\upchi] \sim \O_{\G_\text{loc}}[\upchi^\u]$. \medskip What it tells us is that owing to the ambiguity in the choice of dressing, the reduced gauge symmetry is replaced with a local symmetry which is (at least) as big. A way in which a meaningful constraint on this arbitrariness could arise is if the dressing field is built from the initial gauge variables, $\u: \A \times \Gamma(E_i) \rarrow \D r[K, G]_\text{loc}$, $(A, \phi) \mapsto \u(A, \phi)$. Then it may be that this constructive procedure is such that $\G$ (or $\G_\text{loc}$) is reduced to a "small", rigid/global, or perhaps even discrete subgroup. Even if it is not so, this $\G$-symmetry may be an interesting new symmetry. % These situations are represented in most fruitful applications [\cite{Attard-Francois2016_I, Attard-Francois2016_II, Attard_et_al2017, Francois2018}]. Notably, in the context of the tetrad formulation of General Relativity (GR), $\G_\text{loc}=\GL(4, \RR)$ is the group of local coordinate changes. \subsubsection{A Connection-Form on $\mathcal{A}$} Here we comment on another very useful parallel between dressings and a more standard geometric construction, on $\mathcal{A}$, that may shed some light on the arbitrariness of the dressing. The idea is that, just as the action of $H$ on $\mathcal{P}$ permits interesting geometrical constructions, having to do with parallel transport and horizontality, so does the action of $\mathcal{H}$ on $\mathcal{A}$. In truth, the infinite-dimensional space $\mathcal{A}/\mathcal{H}$ is not perfectly analogous to $\mathcal{P}/H$. $\mathcal{A}/\mathcal{H}$ is not a bona-fide (infinite-dimensional) manifold due to the presence of stabilizers; instead it forms only a stratified manifold (cf. \cite{kondracki1983, Mitter:1979un}). Nonetheless, the subset of $\cal A$ without stabilizers is generic (open and dense), and there one can introduce \textit{a functional connection-form} \cite{Gomes-Riello2018, Gomes-et-al2018, GomesRiello_2020}. The main idea of the functional connection-form is to infinitesimally (i.e. perturbatively) define a right-equivariant horizontal distribution. Thus a functional connection-form is a one-form on the field-space $\cal A$ that is valued on $\mathcal H$, obeying (infinite-dimensional versions of the) equivariance and projection equations, as in \eqref{eq:omega_equi}-\eqref{eq:omega_proj}. One of the main advantages of the connection-form is that in theories that possess a kinematic term in a Lagrangian, one can whittle down the enormous space of possible connection-forms, by using this term to define a supermetric on field-space, and thereby define a connection-form by orthogonality with respect to the gauge orbits. This choice has several pragmatic advantages \cite[Sec. 2]{GomesRiello_2020}. Moreover, when the connection-form is integrable, i.e. when it possesses no associated curvature, it also provides a complete dressing. Namely, in the Abelian theory, if $A(s)$ is a path in $\cal A$, with $A(0)=0$ and $A(1)=A$, then we can integrate the connection-form $\varpi$ along this path to obtain the Dirac dressing as: $$u(A):=\int\varpi(\frac{d}{ds}A(s))\, ds . $$ The integrability condition means that the resulting dressing is independent of the path chosen. We refer to \cite[Sec. 5]{GomesRiello_2020} and \cite{Gomes-Riello2018} for more detail. Lastly, one can also reproduce the BRST transformations (cf. Section \ref{Residual gauge transformations}) geometrically in this formalism \cite{GomesRiello2016}. \subsubsection{On Substantial \emph{vs} Artificial Gauge Symmetries \label{On substantial vs artificial gauge symmetries As previous sections have explained, section \ref{AVS} in particular, there is a (usually) recognised trade-off between \emph{locality}, as understood in a field-theoretic sense,\footnote{Related of course but not to be conflated with ``local" in the bundle-theoretic sense used up until now, meaning on an open subset $U\subset\M$ of the base spacetime manifold.} and \emph{gauge-invariance}: a gauge theory is either written in terms of local gauge-variant variables, or in terms of non-local gauge-invariant variables. A theory displaying such trade-off would be said to have a \emph{substantial} gauge symmetry, whereas a theory that does not and can be (re)-written in terms of local gauge-invariant variables would be said to have an \emph{artificial} gauge symmetry. From that viewpoint, a true/substantial gauge symmetry signals that physical degrees of freedom (d.o.f.) have a form of non-locality to them. ``Fake"/artificial gauge symmetries signal nothing of the sort, and can be dispensed with at no physical cost: they are genuine \emph{surplus} as defined in \ref{INT}. The interpretive issues surrounding gauge symmetries and their physical relevance then applies to the substantial kind only. Connecting to this discussion, the DFM may suggest a way to assess the nature of the gauge symmetry in a theory $L(A, \phi)$. If one is able to find, or build, a (field-theoretically) local dressing field $\u(A, \phi)$, then the theory can be rewritten as $L(A^\u, \phi^\u)$ in terms of the variables $A^\u$ and $\phi^\u$ that are gauge-invariant and remain local, showing decisively that the gauge symmetry of the theory is artificial. In a theory with substantial gauge symmetry, any $\u(A, \phi)$ would be non-local, and so would then be the gauge-invariant variables $A^\u$ and $\phi^\u$: the rewriting $L(A, \phi)=L(A^\u, \phi^\u)$ would then be the formal expression of the trade-off alluded to above. Of course, the failure to find a local dressing field may be faulted on a failure of imagination on the part of the theorist, or on a less than thorough search. So the strategy is asymmetric: finding a local dressing field is conclusive, not finding is not. Yet, to all practical purpose it is rather effective. \smallskip As a matter of interpretation, if $\u=\u(A)$ one could say that $\phi^\u$ represents the bare charged matter field shrouded in the gauge field it sources. Similarly, $A^\u$ would be a self-enveloping charged gauge field acting as a source for itself (e.g. gluons in QCD). For abelian gauge fields, the latter interpretation if not available. If on the other hand $\u=\u(\phi)$, one could see $A^\u$ as the gauge field embedded in a pervasive ``sea" generated by $\phi$, idem for $\phi^\u$ itself (which is reminiscent of a Higgs-like interpretation, since, for this interpretation to hold, it must be nowhere vanishin ). Let us consider some examples before coming to the main case of interest, the electroweak model. \subsection{Examples \label{Examples An early example of (abelian) dressing field is the so-called \emph{Stueckelberg field}, introduced in [\cite{Stueckelberg1938-I, Stueckelberg1938-II-III}], see [\cite{Ruegg-Ruiz}] for a review. An abelian Stueckelberg-type model involves a potential $A\in \Omega^1\left(U, \text{Lie}U(1)\right)$ and a Stueckelberg field $B \in \Omega^0(U, \RR)$, respectively transforming as $A^\upgamma=A - d\theta$ and $B^\upgamma=B - \mu \theta$, with $\upgamma=e^{i\theta} \in \mathcal{U}(1)$ and $\mu$ some constant. A prototypical (minimal) Stueckelberg $\mathcal{U}(1)$ model would be \begin{align} \label{Stueck} L(A, B) = \tfrac{1}{2}F\,*\!F + \mu^2 (A-\tfrac{1}{\mu}dB)\,*\!(A-\tfrac{1}{\mu}dB), \end{align} Here, $*:\Omega^\bullet(U) \rarrow \Omega^{n-\bullet}(U)$, with $n=$dim$\M$, is the Hodge dual operator. As just said, $B$ is actually a \emph{local} abelian dressing field: defining $\u(B):=e^{\sfrac{i}{\mu}B}$, it is clear that $\u(B)^\upgamma\vcentcolon= \u(B^\upgamma)=e^{\sfrac{i}{\mu}(B-\mu \theta)}=\upgamma\-\u(B)$. The associated $\mathcal{U}(1)$-invariant local dressed field is then $A^\u:=A+i\u\-d\u=A-\tfrac{1}{\mu}dB$, with field strength $F^\u=F$. So \eqref{Stueck} is manifestly rewritten as, \begin{align} L(A, B)=L(A^\u)= \tfrac{1}{2}F^\u\, *\!F^\u + \mu^2 A^\u\, *\!A^\u, \end{align} which is a Proca Lagrangian for $A^\u$ with no gauge symmetry. According to the DFM, as $\u$ and $A^\u$ are local, the original $\mathcal{U}1)$ symmetry of the model \eqref{Stueck} is artificial. \medskip Theories $L(A, \phi)$ with an abelian gauge potential $A\in \Omega^1\left(U, \text{Lie}U(1)\right)$ coupled to a charged scalar field $\phi \in \Omega^0(U, \CC)$ provide another illustration. The gauge transformations of the potential $A$ and the $\CC$-scalar field $\phi$ are $A^\gamma=A + \upgamma\-d\upgamma$ and $\phi^\upgamma=\upgamma\-\phi$, for $\upgamma\in \mathcal{U}(1)$. Now, one can extract a $\mathcal{U}(1)$-dressing field from the scalar field by the polar decomposition $\phi=\u\rho$ with $\rho=\sqrt{\phi^*\phi}$ its modulus and $\u$ its phase. Obviously $\rho$ is invariant while the phase carries the transformation $\u^\upgamma=\upgamma\-\u$. The latter is indeed a local dressing field whose associated gauge-invariant local fields are $A^\u=A+\u\-d\u$ and $\phi^\u=\u\- \phi=\rho$. Any such theory can be rewritten in terms of these variables, $L(A, \phi)=L(A^\u, \phi^\u)$, which shows that the $\mathcal{U}(1)$-gauge symmetry is artificial. In particular, the Aharonov-Bohm (AB) effect - see section \ref{ABeffect} - formulated in the framework of $\CC$-scalar EM looses its puzzling edge, as identified by Wallace [\cite{Wallace2014}], since it can be interpreted as resulting from the local interaction of the gauge-invariant local fields $A^\u$ and $\phi^\u$ outside the cylinder. The abelian Higgs model also belongs to this framework. The Lagrangian of the theory would be, \begin{align} \label{AbHiggs1} L(A, \phi)&=\tfrac{1}{2}\ F \,*\!F + (D^A\phi)^* *\!D^A\phi - V(\phi) *\!\jone,\\[1mm] & \quad \text{with } \quad V(\phi)= \mu^2 \phi^*\phi + \lambda (\phi^*\phi)^2, \notag \end{align} where $*\jone=\vol_n$ is a volume $n$-form on $U$, $\phi^*$ is the conjugate of $\phi$, and in the potential $V: \CC^2 \rarrow \RR$ we must have $\lambda >0$. Taking this formulation of the model at face value, one notices that for $\mu^2>0$ there is only one invariant vacuum solution $\phi_0=0$ minimizing $V$, but for $\mu^2<0$ there is a whole $\mathcal{U}(1)$-orbit of vacua with modulus $|\phi_0|=\sqrt{\frac{-\mu^2}{2\lambda}}$. If and when $\phi$ settles for one of these vacua - spontaneously breaking $\mathcal{U}(1)$ - and fluctuates around it, $\phi=\phi_0+H$, a mass term $m_A=g\phi_0$ for $A$ appears in the Lagrangian via the minimal coupling term $D^A\phi=d\phi+gA\phi$, with $g$ a coupling constant. A mass for the gauge potential $A$ is thus generated, it seems, via spontaneous gauge symmetry breaking (SSB). Yet as just seen, the model can be rewritten in a $\mathcal{U}(1)$-invariant way via dressing as, \begin{align} \label{AbHiggs2} L(A^\u, \rho)&=\tfrac{1}{2}\ F^\u \,*\!F^\u + (D^{A^\u}\rho)^* *\!D^{A^\u}\rho - V(\rho) *\!\jone, \\[1mm] & \quad \text{with } \quad V(\rho)= \mu^2 \rho^2 + \lambda \rho^4. \notag \end{align} Thus rewritten, there is no gauge symmetry to break. The potential is now $V:\RR^+ \rarrow \RR$ and has a \emph{unique} vacuum configuration for either sign of $\mu^2$, $\rho_0=0$ and $\rho_0=\sqrt{\sfrac{-\mu^2}{2\lambda}}$. Writing $\rho=\rho_0+H$, we see that the theory still has a massless ($\mu^2>0$, $m_A=0$) and a massive ($\mu^2<0$, $m_A=g\rho_0$) phase. The mass is generated via a vacuum phase transition, but it is not tied to a SSB. And indeed as said above, as $A^\u$ and $\rho$ are local gauge-invariant fields, the $\mathcal{U}(1)$-symmetry of the initial model is artificial and plays no physical role. In line with the remarks made earlier in the general setting, despite a formal resemblance the above should not be confused with the \emph{unitary} gauge fixing of the model: the dressed model \eqref{AbHiggs2} is not a gauge fixing of \eqref{AbHiggs1}.\footnote{ Curiously, in the textbook [\cite{Rubakov1999}] the abelian Higgs model is given the dressing treatment, while the electroweak model is treated via the usual unitary gauge and SSB approach. } \bigskip For pure $\H_\text{loc}$-gauge theories $L(A)$, there are not many options to work with to build a dressing field $\u(A)$. One attempt that has been explored in relation with the ``proton spin decomposition controversy'' [\cite{LorceGeomApproach, Leader-Lorce}] is to split the potential as $A=A_\text{phys}+ A_\text{pure}$. By assumption, only $A_\text{phys}$ contributes to the field strength $F=F_\text{phy}$ and it transforms as $A_\text{phys}^\upgamma=\upgamma\- A_\text{phys}\upgamma$ for $\upgamma \in \H_\text{loc}$. So, $A_\text{pure}$ is pure gauge $F_\text{pure}=0$, which means that it can be written as $A_\text{pure}=\u d\u\-$ for some $H$-valued function $\u:U \rarrow H$. Since it must also transforms as a connection, $A_\text{pure}^\upgamma=\upgamma\- A_\text{pure}\upgamma + \upgamma\- d\upgamma$, it means that $\u^\upgamma =\upgamma\- \u$. In other words $\u=\u(A)$ is a local $H$-dressing field. The dressed fields are then $A^\u=\u\- A_\text{phy} \u=:A_\text{phys}^\u$ and $F^\u=F_\text{phys}^\u=dA_\text{phy}^\u +\sfrac{1}{2}[A_\text{phy}^\u, A_\text{phy}^\u]$. So that the theory is rewritten $L(A)=L(A_\text{phy}^\u)$. The same can be done for a theory including spinors, i.e. fermions, $L(A, \psi)=L(A_\text{phy}^\u, \psi^u)$. This however is unsatisfactory. Indeed the ansatz decomposition $A=A_\text{phys}+ A_\text{pure}$ reflects the affine nature of the connection space $\C$, so that $A_\text{phys}$ is the local representative of a tensorial form, and $A_\text{pure}$ that of a flat connection. But then it can be shown that the existence of a global flat connection means the underlying bundle $\P$ is trivial, which further imply that the ambiguity group in choosing $\u$ is isomorphic to the initial gauge group, $\G_\text{loc}\simeq\H_\text{loc}$. In view of \eqref{ResidualGT-2Kind-local}, $\G_\text{loc}$ is a (gauge) symmetry of $L(A_\text{phy}^\u, \psi^u)$. So nothing has been really achieved by the ansatz as the bare and dressed theories are entirely isomorphic. See [\cite{FLM2015_I}] for details. \medskip As far as is known, in pure $\H_\text{loc}$-gauge theories $L(A)$ any dressing field $\u(A)$ is non-local, so that according to the DFM the initial $\H_\text{loc}$ symmetry is substantial. The same seems likely for non-abelian gauge theories including spinor fields, $L(A, \psi)$, as there is no polar decomposition of a spinor $\psi$ from which one could extract a local dressing field $\u(\psi)$. Applications of the DFM in the context of such theories, building non-local $\u(A)$'s, provide in particular a geometric basis for Dirac's gauge-invariant formulation of QED [\cite{Dirac55}] and [\cite{Dirac58}] (section 80) - see [\cite{Francois2018}] for a discussion - as well as for the construction of quark ($\psi^\u$) and gluons ($A^\u$) states in QCD such as [\cite{McMullan-Lavelle97, Lavelle-McMullan-Bagan2000}]. We notice that it is when formulated in the context of spinorial EM that the AB effect retains is physical significance by displaying how EM properties are encoded non-locally. Indeed, the effect cannot be explained by the local interaction of gauge invariant fields outside the cylinder (or so it seems), as the gauge-invariant fields $A^\u$ and $\psi^\u$ are non-local. \medskip Before turning to the main example, let us remark that the latest instance to date of application of the DFM concerns the so-called ``edge modes'' invoked as a way to deal with the problem of boundaries in the study of the symplectic structure of gauge theories. About edge modes see [\cite{DonnellyFreidel2016, Geiller2017, Speranza2018, Teh-et-al2020, Teh2020}], about the problem of boundary and an alternative proposition to edge modes see [\cite{Gomes-et-al2018, Gomes-Riello2018, Gomes2019}]. \subsection{Invariant Formulation of the Electroweak Model} \label{Invariant formulation of the electroweak model} The basic idea behind the DFM featured repeatedly in reformulations of theories undergoing SSB. It is seen in the pioneering work of Higgs on abelian models [\cite{Higgs66}] and of Kibble on non-abelian models [\cite{ Kibble67}]. It resurfaced in the work of Banks \& Rabinovici on the abelian Higgs model [\cite{Banks-Rabinovici1979}], and shortly after in the work of Frohlich, Morchio \&Strocchi [\cite{Frohlich:1980gj, Frohlich:1981yi}] on the invariant formulation of the electroweak model, which is still today a point of reference (known as the FMS approach, see section \ref{Sec:FMS approach} next). Since then, the idea is found again in several works also concerned with invariant formulations of (aspects of) the electroweak model [\cite{GrosseKnetter-Kogerler1993, Buchmuller-1994, McMullan-Lavelle95, Chernodub2008, Faddeev2009, Ilderton-Lavelle-McMullan2010, Masson-Wallet, Kondo:2018qus,Rosten:2010vm,Morris:1999px,Morris:2000fs}]. The recent review on Higgs physics [\cite{Maas:2017wzi}] emphasizes the importance of gauge-invariant formulations, and flavors of the DFM can be recognised there. In the past fifteen years, the fact that such reformulations may cast a new light on the electroweak physics, and gauge physics more generally, has been appreciated by philosophers of physics such as [\cite{Smeenk2006}], [\cite{Lyre2008}], [\cite{Struyve2011}], and [\cite{Friederich2013, Friederich2014}]. In the following we propose the most natural reformulation via DFM of a simplified electroweak model (considering only leptons and massless neutrinos). It may be compared to the FMS approach for this case. The space of field of the model is $\upchi=\{a,b, \vphi, \psi_L, \psi_R \}$. The gauge potentials are $a \in \Omega^1(U, \text{Lie}(U(1)))$ and $b \in \Omega^1(U, \text{Lie}(SU(2)))$, with field strength $F$ and $G$. We have a scalar field in the fundamental representation of $SU(2)$, $\vphi=(\vphi_1, \vphi_2)^T \in \Omega^0(U, \CC^2)$, as well as a left-handed (Weyl) fermion doublet (leptons say) $\psi_L= (\nu_L , \ell_L )^T$, and a right-handed fermion singlet $\psi_R=\ell_R$. The the scalars and fermions couples minimally with the gauge potentials via the covariant derivatives \begin{align*} D\vphi &= d\vphi +(gb+ g'a)\vphi, \\ D\psi_L &= d\psi_L + (gb - g'a) \psi_L, \\ D\psi_R &= d\psi_R - g'2\,a \psi_R, \end{align*} with $g$ and $g'$ coupling constants. The gauge group $\H_\text{loc}=\mathcal{U}(1)\times \SU(2)$ acts, for $\alpha \in \mathcal{U}(1)$ and $\beta\in\SU(2)$, as: \begin{equation} \begin{aligned} \label{FieldGT-EW} a^{\,\alpha}&=a +\tfrac{1}{g'}\alpha^{-1}d\alpha, \quad b^{\,\alpha}=b, \quad \vphi^{\,\alpha} =\alpha^{-1}\vphi,\quad \text{and} \quad \psi_{L/R}^{\,\alpha} = \left\{ \begin{array}{c} \alpha\, \psi_{L} \\ \alpha^2\, \psi_R \end{array} \right. \\ a^{\,\beta}&=a, \quad b^{\,\beta}=\beta^{-1}b\beta + \tfrac{1}{g}\,\beta^{-1}d\beta, \quad \vphi^{\,\beta}=\beta^{-1}\vphi, \quad \text{and}\quad \psi_{L/R}^{\,\beta} = \left\{ \begin{array}{c} \beta^{-1} \psi_{L} \\ \psi_R \end{array} \right. \end{aligned} \end{equation} The $\H_\text{loc}$-invariant Lagrangian form of the theory is, \begin{align} \label{EW-Lagrangian} L(a, b, \vphi, \psi_{L/R})&=\tfrac{1}{2}\Tr(F\wedge *F) +\tfrac{1}{2}\Tr(G\wedge *G) + \langle D\vphi, \ *D\vphi\rangle - V(\vphi) \notag\\ & + \langle \psi_{L/R}, \slashed D \psi_{L/R }\rangle + f_\ell\,\langle \psi_L, \vphi \rangle\, \psi_R + f_\ell\, \b\psi_R \langle \vphi, \psi_L\rangle. \end{align} The potential term is $ V(\vphi) = \mu^2 \langle\vphi, *\vphi\rangle +\lambda \langle\vphi, *\vphi\rangle^2$ with $\mu^2 \in \RR$, $\lambda > 0$ and $\langle\ , \, \rangle$ is a Hermitian form on $\CC^2$. The Dirac operator is $\slashed D = \gamma \w *D$, with $\gamma=\gamma_\mu\, dx^{\,\mu}$ the Dirac matrices-valued 1-form. The constants $f_\ell \in \RR$ are Yukawa couplings specific of each type of leptons ($\ell= e, \mu, \tau$). As the usual narrative goes (see e.g [\cite{Becchi-Ridolfi}]) if $\mu^2<0$, the electroweak vacuum given by $V(\vphi)=0$ seems degenerate as it appears to be an $\SU(2)$-orbit of non-vanishing vacuum expectation values for $\vphi$. When the latter settles randomly, spontaneously, on one of them, this breaks $\SU(2)$ and generates mass terms for the fields with which it couples (minimally of via Yukawa terms). \smallskip The dressing field method suggests an alternative proposition. Indeed it is not hard to find a dressing field in the electroweak model. Considering the polar decomposition in $\CC^2$ of the scalar field $\vphi=\rho \u $ with \begin{align} \label{decomp-phi} \u(\vphi)&= \tfrac{1}{\rho} \begin{pmatrix} \vphi_2^* & \vphi_1 \\ -\vphi_1^* & \vphi_2 \end{pmatrix} \in SU(2) \quad \text{ and }\quad \rho := \vect{0 \\ ||\vphi||} \in \RR^+ \subset \CC^2, \notag\\[1mm] &\text{one has} \quad \vphi^\beta \quad \Rightarrow \quad \u^\beta=\beta\- \u. \end{align} Thus, $\u$ is a $\SU(2)$-dressing field that can be used to construct the $\SU(2)$-invariant composite fields: \begin{align} b^\u&=\u\-b\u+\tfrac{1}{g}\u\-d\u=\vcentcolon B, \quad \text{and} \quad G^\u = \u\-G\u = dB+\tfrac{g}{2}[B, B] \label{eq:CompositeW} \\ \vphi^\u&=\u\-\vphi=\rho, \quad \text{and} \quad (D\vphi)^\u=D^\u\rho=d\rho + (g B + g'a )\rho, \label{eq:Radial} \\ \psi_L^\u&=\u\- \psi_L=\vcentcolon \vect{ \nu_L^\u \\[1mm] \ell_L^\u } \quad \text{and} \quad (D\psi_L)^\u=D^\u\psi_L^\u=d\psi_L^\u + (g B + g'a )\psi_L^\u. \label{eq:CompositeLepton} \end{align} Since $\u$ is \emph{local}, so are the above composite fields. Therefore, we might suggest that the $\SU(2)$-gauge symmetry of the model is \emph{artificial}, so that the theory defined by the electroweak Lagrangian \eqref{EW-Lagrangian} is rewritten as the $\mathcal{U}(1)$-gauge theory\footnote{Note that the quantum version of the Lagrangian receives a further term ($3\log\rho$) from a Jacobian.}, \begin{align} \label{EW-Lagrangian2} L(a, B, \rho, \psi_L^\u, \psi_R)=&\ \tfrac{1}{2}\Tr(F\wedge *F) +\tfrac{1}{2}\Tr(G^\u \wedge *G^\u) \notag\\[.5mm] & + \langle D^\u \rho, \ *D^\u \rho \rangle - V(\rho) \notag \\ + \langle\psi_L^\u, \slashed D^\u \psi_L^\u \rangle & + \langle \psi_R, \slashed D \psi_R \rangle + f_\ell\,\langle \psi_L^\u, \rho \rangle\, \psi_R + f_\ell\, \b\psi_R \langle \rho, \psi_L^\u \rangle. \end{align} The interpretation of the model in terms of SSB is here superfluous, and indeed impossible when expressed in the form \eqref{EW-Lagrangian2}. Analyzing the residual substantial $\mathcal{U}(1)$-gauge symmetry of the model allows us to go a step further in exhibiting the physical d.o.f. \smallskip Let us remark that the dressed fields above essentially reproduces the invariant variables used in [\cite{Banks-Rabinovici1979}] and the seminal FMS approach [\cite{Frohlich:1980gj, Frohlich:1981yi}]. In particular it is easy to compare $\rho \sim ( \vphi_1^* \vphi_1 + \vphi_2^*\vphi_2)^{\sfrac{1}{2}}$ and $ \vect{ \nu_L^\u \\[1mm] \ell_L^\u } = \tfrac{1}{\rho} \vect{ \vphi_2 \nu_L - \vphi_1 \ell_L \\[1mm] \vphi_1^* \nu_L + \vphi_2^* \ell_L } $ to e.g. eq.(6.1) of [\cite{Frohlich:1981yi}]. \subsubsection{Residual $\mathcal{U}(1)$ Symmetry \label{Residual U1 symmetry By its very definition $\rho^{\,\beta}=\rho^\alpha=\rho$, so it is already a fully $\H_\text{loc}$-gauge invariant scalar field which then qualifies as a potential observable. As explained in section \ref{Reduction of gauge symmetries via dressing}, the $\mathcal{U}(1)$-residual gauge transformations of the $\SU(2)$-invariant composite fields depend on the $\mathcal{U}(1)$-gauge transformation of the dressing field $\u$: $(\upchi^\u)^\alpha=(\upchi^\alpha)^{\u^\alpha}$. One finds that, \begin{align*} \u(\vphi)^\alpha \vcentcolon= \u(\vphi^\alpha)= \u(\vphi) \t\alpha, \qquad \text{where} \qquad \t\alpha= \begin{pmatrix} \alpha & 0 \\ 0 & \alpha\- \end{pmatrix}. \end{align*} This is not the kind of residual transformation shown in Proposition \ref{Residual2}, yet the general logic applies and we get $(\upchi^\u)^\alpha=(\upchi^\alpha)^{\u\t\alpha}$. So, using \eqref{FieldGT-EW} we easily find: \begin{align} \label{U(1)-GT} \begin{aligned} B^\alpha &= \t\alpha\- B \t\alpha + \tfrac{1}{g}\t\alpha\-d\t\alpha, & \qquad (G^\u)^\alpha&=\t\alpha \- G^\u \t\alpha, \\ (\psi^\u_L)^\alpha &= \t\alpha\- \alpha\, \psi_L^\u, & \qquad (D^\u\psi^\u_L)^\alpha &= \t\alpha\- \alpha\, D^\u\psi_L^\u, \\ \rho^\alpha &= (\alpha\t\alpha)\- \rho=\rho, & \qquad (D^\u\rho)^\alpha &= (\alpha\t\alpha)\- D^\u\rho. \end{aligned} \end{align} By a simple inspection of the matrices $\alpha \t\alpha = \begin{pmatrix} \alpha^2 & 0 \\ 0 & 1 \end{pmatrix}$ and $\t\alpha\- \alpha = \begin{pmatrix} 1 & 0 \\ 0 & \alpha^2 \end{pmatrix}$, it is clear on the one hand that the top component $\nu_L^\u$ of $\psi_L^\u$ is $\U(1)$-invariant,\footnote{While $(\ell^\u_L)^\alpha=\alpha^2 \ell^\u_L$, is now a match for the singlet $\psi^\alpha_R=\ell^\alpha_R=\alpha^2 \ell_R$, which is relevant to the final form of the Yukawa couplings (eq.\eqref{EW-Lagrangian3}).} and on the other hand that $\mathcal{U}(1)$-invariant combinations of $a$ and (components of) $B$ are to be found in the covariant derivatives. And indeed, given the decomposition $B=B_a \sigma^a$, where $\sigma^a$ are the hermitian Pauli matrices and $B_a \in i\RR$, we have explicitly: \begin{align} \label{B-field} &B=\begin{pmatrix} B_3 & B_1-iB_2 \\ B_1+iB_2 & -B_3 \end{pmatrix}=:\begin{pmatrix} B_3 & W^- \\ W^+ & -B_3 \end{pmatrix}, \notag \\[1.5mm] \textrm{so that} \qquad &B^\alpha=\begin{pmatrix} B_3 +\frac{1}{g}\alpha\-d\alpha & \alpha^{-2}W^- \\[5pt] \alpha^2W^+ & -B_3 -\frac{1}{g}\alpha\-d\alpha \end{pmatrix}. \end{align} The linear combination $gB_3- g' a =: (g^2+{g'}^2)^{\sfrac{1}{2}}\,Z^0$, obviously $\mathcal{U}(1)$-invariant, appears in both $D^\u\rho$ and $D^\u\psi^\u_L$. One may observe that the combination $A := (g^2+{g'}^2)^{-\sfrac{1}{2}}(g'B_3 +g a)$, $\mathcal{U}(1)$-transforms as $A^\alpha=A+\tfrac{1}{e} \alpha\-d\alpha$ with $e=\sfrac{gg'}{\sqrt{g^2+g'^2}}$. It would be natural to expect it appearing, together with $Z^0$, in the bottom component of $(D^\u\psi^\u_L)$. Explicitly \begin{align} D^u\rho&= d\rho+(g'a + gB) \rho =\vect{gW^-\rho \\ d\rho +(g'a- gB_3)\rho} \notag \\[1mm] &=\vect{g W^-\rho \\ d\rho - (g^2+{g'}^2)^{\sfrac{1}{2}}\,Z^0 \rho} =\vect{g W^-\rho \\ d\rho - \tfrac{e}{\cos\theta_W \sin\theta_W}\,Z^0 \rho}, \label{coupling-Higgs-WeakFields} \end{align} so, \begin{align*} (D^u\rho)^\alpha =\begin{pmatrix} \alpha^{-2} & 0 \\ 0 & 1 \end{pmatrix} \vect{gW^-\rho \\ d\rho - \tfrac{e}{\cos\theta_W \sin\theta_W}\,Z^0 \rho}, \end{align*} by \eqref{U(1)-GT} or \eqref{B-field}. And, \begin{align} \label{coupling-leptons-ElectroweakFields} D^\u\psi^\u_L&= d\psi^\u_L+(gB-g'a) \psi^\u_L =\vect{ d\nu^\u_L +(gB_3-g' a) \nu^\u_L + gW^- \ell^\u_L \\[1mm] d\ell^\u_L -(gB_3 + g' a) \ell^\u_L + gW^+ \nu^\u_L } \notag \\[1mm] &= \vect{ d\nu^\u_L + (g^2+{g'}^2)^{\sfrac{1}{2}} Z^0 \nu^\u_L + gW^- \ell^\u_L \\[1mm] d\ell^\u_L -2e A \ell^\u_L - \tfrac{g^2-{g'}^2}{\sqrt{g^2+{g'}^2}} Z^0 \ell^\u_L + gW^+ \nu^\u_L } \\[1mm] &=\vect{ d\nu^\u_L + \tfrac{e}{\cos\theta_W \sin\theta_W} Z^0 \nu^\u_L + gW^- \ell^\u_L \\[1mm] d\ell^\u_L -2e A \ell^\u_L - e\left( \tfrac{1}{\cos\theta_W \sin\theta_W} - 2\tfrac{\sin\theta_W}{\cos\theta_W}\right) Z^0 \ell^\u_L + gW^+ \nu^\u_L }, \notag \end{align} so \begin{align*} (D^\u&\psi^\u_L)^\alpha= \\ &\begin{pmatrix} 1 & 0 \\ 0 & \alpha^{-2} \end{pmatrix} \vect{ d\nu^\u_L + \tfrac{e}{\cos\theta_W \sin\theta_W} Z^0 \nu^\u_L + gW^- \ell^\u_L \\[1mm] d\ell^\u_L -2e A \ell^\u_L - e\left( \tfrac{1}{\cos\theta_W \sin\theta_W} - 2\tfrac{\sin\theta_W}{\cos\theta_W}\right) Z^0 \ell^\u_L + gW^+ \nu^\u_L }, \end{align*} by \eqref{U(1)-GT} or \eqref{B-field}. Above is introduced the weak mixing (or Weinberg) angle variable $\theta_W$ via $\cos \theta_W \vcentcolon= \sfrac{g}{\sqrt{g^2+g'^2}}$ and $\sin\theta_W=\sfrac{g'}{\sqrt{g^2+g'^2}}$, so that the change of field variable $(a, B_3) \rarrow (Z^0, A)$ can be written as a rotation in field space, \begin{align*} \vect{A \\ Z^0} =\begin{pmatrix} \cos\theta_W & \sin\theta_W \\ -\sin\theta_W & \cos\theta_W \end{pmatrix} \vect{a \\ B_3} = \vect{\cos\theta_W a + \sin\theta_W B_3\\ \cos\theta_W B_3 - \sin\theta_W a}. \end{align*} The electroweak theory \eqref{EW-Lagrangian2} is then expressed in terms of the $\H_\text{loc}$-invariant fields $\rho, Z^0, \nu_L^\u$ and the $\mathcal{U}(1)$-gauge fields $W^\pm, A, \ell_L^\u, \ell_R$. Writing explicitly the parts of the Lagrangian relevant to the next point to be discussed, we have: \begin{align} \label{EW-Lagrangian3} & L(A, W^\pm, Z^0, \rho, e^\u_L, e_R, \nu^\u_L)= \ \tfrac{1}{2}\Tr(F\w * F)+ \tfrac{1}{2}\Tr(G^u\w * G^u) \notag\\ &+ d\rho \wedge*d\rho - g^2\rho^2\ W^+\wedge*W^- - (g^2+g'^2)\rho^2\ Z^0\wedge*Z^0 -\left( \mu^2\rho^2 +\lambda \rho^4 \right) *\!\jone \notag \\ & + \langle \psi_L^\u, \slashed D^\u \psi_L^\u \rangle + \langle \psi_R, \slashed D \psi_R \rangle + f_\ell\,\left( \b \ell^\u_L\, \rho\, \ell_R + \b \ell_R\, \rho\, \ell^\u_L \right). \end{align} One can expand the $\RR^+$-valued scalar field $\rho$ around its \emph{unique} groundstate $\rho_0$, given by $V(\rho)=0$, as $\rho=\rho_0+H$, where $H$ is the gauge invariant Higgs field. Then, in the phase $\mu^2<0$ of the theory, where $\rho_0=\sqrt{\sfrac{-\mu^2}{2\lambda}}$, mass terms $m_{Z^0}=\rho_0\sqrt{(g^2+g'^2)}$ and $m_{W^\pm}=\rho_0g$ for $Z^0, W^\pm$ appear from the couplings of the electroweak fields with $\rho$,\footnote{Since $A$ does not couple to $\rho$ directly, eq.\eqref{coupling-Higgs-WeakFields}, it is massless. The two photons decay channel of the H-field involves intermediary fermions.} and the latter's self interaction produces a mass $m_H=\rho_0\sqrt{2\lambda}$ for $H$, while mass terms $m_\ell=\rho_0 f_\ell$ for the Dirac spinor leptons $\ell = (\ell^\u_L, \ell_R)^T$ are produced by Yukawa couplings. Masses for gauge fields and leptons are obtained through a phase transition of the unique electroweak vacuum, but it is not congruent with a spontaneous gauge symmetry breaking, as the model is $\SU(2)$-invariant -- and the physical d.o.f. are manifest -- in both phases.\footnote{According to [\cite{Westenholz}], the very meaning of the terminology ``\textit{spontaneous} symmetry breaking'' lies in the fact that the manifold of vacua is not reduced to a point.} The DFM approach to the electroweak model is consistent with Elitzur's theorem [\cite{Elitzur1975}] stating that in lattice gauge theory a gauge symmetry cannot be spontaneously broken. \subsubsection{Discussion \label{Discussion To reiterate again a general remark in this context, \eqref{EW-Lagrangian3} formally looks like the electroweak Lagrangian in the unitary gauge, yet it is conceptually different as a dressing is not a gauge-fixing. Another noteworthy difference, is that while the model \eqref{EW-Lagrangian} is defined for $\vphi \in \CC^2$, the dressed version \eqref{EW-Lagrangian2}/\eqref{EW-Lagrangian3} is only for $\vphi \in \CC^2/\{0\}$ because the polar decomposition \eqref{decomp-phi} is not well-defined at $\vphi=0$. Thus, the standard and dressed versions have different scalar field configuration topologies. In the massive phase ($\mu^2<0$), this should be of little concern regarding the perturbative regime, and appears also to be irrelevant non-perturbatively [\cite{Fernandez:1992jh}]. This is more troubling, however, in the phase $\mu^2>0$, as this means that the absolute minimum $\rho_0=0$ is not an available configuration, so that the mass terms are not vanishing, but vanishingly small. One could be tempted to retreat behind the fact that this phase of the theory is not realised in nature at present and beyond experimental reach, yet electroweak phase transition is believed to have occurred in the early universe and contributed to baryogenesis. So one cannot evade the necessity to assess the consequences (cosmological and otherwise) of not having strictly zero masses in the $\mu^2>0$ phase. It turns out there are arguments as to why this may finally be irrelevant, or at worst lead to relic monopoles [\cite{Fernandez:1992jh}]. Another question worth pursuing is the quantization of the dressed model. As it is formally similar to the unitary-gauge version of the theory, indications of in-principle possibility to quantize the model in the unitary gauge (instead of the usual $R_\xi$-gauge) [\cite{Irges-Koutroulis2017, Ross1973, Mainland-Oraifeartaigh1974, Woodhouse1974}] may speak in favor of the view that \eqref{EW-Lagrangian3} lends itself well to perturbation theory. It is not obvious that the quantized version of \eqref{EW-Lagrangian3} is exactly equivalent to the standard one, so that it may be interesting to compare them to see if one has some theoretical edge over the other. This has been done in lattice simulations, and within systematic errors no deviations have been observed [\cite{Evertz:1985fc,Philipsen:1996af}]. \smallskip The above mentioned problem in the $\mu^2>0$ phase is avoided in the alternative invariant FMS approach to the model, which is also the one for which serious perturbative and lattice calculations have been done [e.\ g.\ \cite{Maas:2018xxu,Maas:2017wzi, Dudal:2019pyg, Dudal:2020uwb, Sondenheimer:2019idq, Maas-et-al2020, Maas:2020kda}], so is most easily weighted against the standard literature. It has also the advantage of being easily generalisable to $\SU(n)$ gauge theories. \section{The FMS Approach \label{Sec:FMS approach So far, we viewed and used the DFM as a direct reformulation of the degrees of freedom of the electroweak sector of the standard model to demonstrate that the local gauge structure is artificial and a change to a manifestly gauge-invariant formulation is possible. On practical grounds, in particular regarding quantization, an alternative viewpoint on the DFM is useful. Therefore, we keep the basic philosophy of the previous sections but slightly change the perspective. In the following, we quantize the actual gauge symmetry based on the gauge-dependent elementary degrees of freedom but consider only $n$-point functions of strictly gauge-invariant objects. From that perspective, we perform the analysis of physical observables in a gauge theory with BEH mechanism in a QCD-like fashion. In QCD, quarks and gluons are used to describe the microscopic degrees of freedom but observable quantities are only gauge-invariant bound states, e.g., the hadrons. For a general BEH theory, we can do the same. At first sight this seems to be at odds with the tremendous success of the common perturbative treatment to describe electroweak processes at current and past collider facilities. However, certain properties of these gauge-invariant objects can be mapped on properties of gauge-dependent objects within particular classes of gauges which was first observed by Fr\"ohlich, Morchio, and Strocchi (FMS) [\cite{Frohlich:1980gj,Frohlich:1981yi}]. \subsection{The FMS Approach for the Electroweak Model} First of all note that we can already reinterpret the dressed fields defined in Eq.~\eqref{eq:CompositeW} and Eq.~\eqref{eq:CompositeLepton} as gauge-invariant composite bound state operators. Ignoring the common treatment of the BEH mechanism, these are precisely some of the simplest possible gauge-invariant operators one would construct as observables of an $\SU(2)$ gauge theory with fundamental scalar and fermion fields. For instance, one would construct an $\SU(2)$ gauge-invariant combination of a left-handed fermion field with a scalar $\vphi^{\dagger}\psi_{L}$ (cf. $l_{L}^{u}$ in Eq.~\eqref{eq:CompositeLepton}) or the charge conjugate scalar $\tilde{\vphi}^{\dagger}\psi_{L} = (\epsilon \vphi^{*})^{\dagger}\psi_{L}$ (cf. $\nu_{L}^{u}$ in Eq.~\eqref{eq:CompositeLepton}) with $\epsilon$ the two dimensional Levi-Civita tensor of $\SU(2)$. Similarly, we can construct gauge-invariant vector operators (with respect to the Lorentz group), e.g., $\vphi^{\dagger} D \vphi - \tilde{\vphi}^{\dagger} D \tilde{\vphi}$, $\tilde{\vphi}^{\dagger} D \vphi$, and $\vphi^{\dagger} D \tilde{\vphi}$ (cf. $b^{u}$ in Eq.~\eqref{eq:CompositeW}). Keeping this strategy, we can also define a strictly gauge-invariant scalar operator, $\vphi^{\dagger}\vphi$. Here, we do not rely on the polar decomposition of the complex scalar doublet $\vphi$ which factors out the $\SU(2)$ gauge dependent contribution as in Eq.~\eqref{eq:Radial} but construct a gauge-invariant scalar object by dressing the elementary scalar field with its hermitian conjugate. An additional advantage of this viewpoint is the fact that these type of bound state operators can be investigated for all potential forms of the scalar potential $V(\vphi)$ independently as to whether it obeys only one minimum at vanishing field configuration or a multitude of different (possibly even gauge-inequivalent) minima. Thus, we have now a conceptually clean setup which can be used in all parameter regions of the model. However, the apparent disadvantage of these gauge-invariant formulations is given by the circumstance that we have to compute properties of composite objects instead of using perturbative techniques for the elementary degrees of freedom. In general, a bound state is a nontrivial object and the computation of its properties from first principles requires nonperturbative techniques. Nevertheless, the $n$-point functions of some potential bound state operators can be computed in a fairly simple way in a BEH model. In order to examine this, FMS proposed to gauge fix the field configurations, e.g., via 't Hooft gauge, such that the scalar field acquires a nontrivial VEV. In this case, we are able to perform the conventional split \begin{align} \vphi(x) = \frac{v}{\sqrt{2}}\vphi_{0} + \Delta\vphi(x), \label{eq:Split} \end{align} where $\vphi_{0}$ is a unit vector in gauge space denoting the direction of the VEV, e.g., $\vphi_{0} = (0,1)^{\mathrm{T}}$ is a common choice, $v$ is the modulus of the VEV and $\Delta\vphi$ denotes fluctuations around it. The latter contains the field that is usually identified with the Higgs boson as well as the three would-be Goldstone modes which mix with those gauge bosons that acquire a nonvanishing mass term due to the BEH mechanism. With the aid of $\vphi_{0}$, we can extract these fields in a covariant but obviously not in a gauge-invariant way. Therefore, they cannot belong to the physical spectrum of the model if the gauge structure is merely a redundancy in our description. The Higgs field $h = \sqrt{2} \re(\vphi_{0}^{\dagger}\Delta\vphi)$ is the radial component of the fluctuation field in the direction of the VEV while the Goldstone modes are excitations in the remaining orthogonal directions, $\Delta\breve{\vphi} = \Delta\vphi - \re(\vphi_{0}^{\dagger}\Delta\vphi)\vphi_{0}$. By using such a gauge with nonvanishing VEV, we are able to rewrite the $n$-point functions of the gauge-invariant bound state operator in terms of $n$-point functions of gauge-variant objects. For instance, we obtain for the connected part of the propagator, \begin{align} \langle \big(\vphi^{\dagger}\vphi\big) (x)\, \big(\vphi^{\dagger}\vphi\big) (y) \rangle &= v^{2} \langle h(x)\, h(y) \rangle + 2v \langle h(x)\, \big(\Delta\vphi^{\dagger}\Delta\vphi\big) (y) \rangle \notag\\ &\quad + \langle \big(\Delta\vphi^{\dagger}\Delta\vphi\big)(x)\, \big(\Delta\vphi^{\dagger}\Delta\vphi\big) (y) \rangle. \label{eq:FMSScalar} \end{align} We ordered the terms on the right-hand side according to the number of fluctuation fields $\Delta\vphi$ appearing in the $n$-point functions (note that $h$ is also a component of $\Delta\vphi$). However, this FMS expansion of the bound state $\vphi^{\dagger}\vphi$ should not merely be viewed as an expansion in small fluctuations around the VEV. The FMS expansion is finite by construction and rather an exact rewriting of the original gauge-invariant operator. Thus, Eq.~\eqref{eq:FMSScalar} holds for any field amplitude $\Delta\vphi$ even in the nonperturbative regime. Nevertheless, using the number of fluctuation fields as an ordering scheme is an efficient method to extract the main information of the FMS expansion, in particular in the weak coupling regime. The first term on the right-hand side, i.e., the leading order term with respect to the ordering parameter $\Delta\vphi/v$, is the propagator of the (gauge-variant) elementary Higgs field $h$. Therefore, certain properties of the gauge-invariant bound state propagator can already be extracted from $\langle h(x)\, h(y) \rangle$. For instance, let us consider the mass and decay width of the state generated by $\vphi^{\dagger}\vphi$. These properties are encoded in the pole structure of its propagator. Ignoring for a moment the higher-order terms of the FMS expansion, we obtain that the pole of the gauge-invariant bound state propagator coincides with the pole structure of the elementary Higgs propagator. In addition, it can be shown to all orders in a perturbative expansion of the $n$-point functions that the higher-order terms of the FMS expansion do not alter the pole structure on the right-hand side [\cite{Maas:2020kda}]. Therefore, the on-shell properties of $\vphi^{\dagger}\vphi$ are well described by the propagator $\langle h(x)\, h(y) \rangle$. Of course, the pole of the bound state operator has to be gauge-invariant by construction. This translates at the level of the elementary $h$ field to the well-known Nielsen identities which show that the pole of $\langle h(x)\, h(y) \rangle$ is independent of the gauge-fixing parameter within 't Hooft gauges [\cite{Nielsen:1975fs,Grassi:2001bz}]. However, the latter fact does not mean that the elementary Higgs field can be associated with the experimental observed Higgs boson. The Nielsen identities merely show that certain gauge-invariant informations of the model can be extracted from the field $h$, but $h$ itself is still gauge dependent. In particular, every single term on the right-hand side of the FMS expansion is gauge dependent and can only be computed within the specifically chosen gauge. Without gauge fixing, any of these Green's functions will vanish since the action as well as the path integral measure are gauge invariant. The fact that they are nontrivial within the common treatment is merely due to the conventional gauge fixing procedure. Choosing a gauge implies automatically an explicit breaking of the gauge symmetry. However, this is done by hand and should not be confused with spontaneous symmetry breaking. For instance gauges can be constructed which induce a vanishing VEV of the scalar field even if the potential has a nontrivial global minimum. For these type of gauges, the mass parameters of the various elementary fields would be zero to any order in a perturbative expansion. Nonetheless, the properties of a gauge-invariant object as the scalar bound state operator $\vphi^{\dagger}\vphi$ are independent of the gauge. The FMS formulation basically reveals that in some gauges, namely those that are conventionally used in the particle physics community, some gauge-invariant informations of the system can be computed in a convenient way as they are stored in the $n$-point functions of elementary fields. Further, we have perturbative access to them in the weak coupling regime as all terms on the right-hand side of Eq.~\eqref{eq:FMSScalar} can be computed via perturbative techniques. Therefore, we have reduced the problem of calculating the properties of a complicated but strict gauge-invariant bound state operator on computing $n$-point functions of elementary fields and composites of elementary fields in a gauge-fixed setup. That this nontrivial relation is indeed realized has been validated by nonperturbative lattice simulations for an $\SU(2)$ Yangs-Mills-Higgs theory [\cite{Maas:2013aia,Maas:2014pba}]. The lattice formulation provides a clean setup for this check as no gauge fixing is required to compute the properties of a gauge-invariant bound state. Furthermore, gauge-fixed configurations can be generated that allow for a nonperturbative investigation of the elementary $n$-point functions. Thus, both sides of the relation can be investigated independently. By contrast, a perturbative analysis can only investigate the terms on the right-hand side due to the necessity to gauge fix. Investigating the spectrum in the scalar channel of the model, lattice simulations confirm that the mass of the gauge-invariant bound state operator coincides with the mass of the elementary Higgs field as dictated by the FMS relation. Considering the vector channel, one would expect three degenerate massive vector bosons due to the BEH mechanism from the conventional analysis. Constructing bound state operators, we are able to write down a gauge-invariant triplet of states that precisely map on the elementary triplet of vector bosons via the FMS formulation in this model. Also this relation has been confirmed by lattice investigations. \subsubsection{Gauge-Invariant Description of the Electroweak Particles} \label{Gauge-invariant description of the electroweak particles} The remaining question is now if such a type of mapping between a gauge-invariant bound state operator and the elementary fields of the Lagrangian can be implemented for all fields of the electroweak sector. Before we discuss the FMS formulation of the full electroweak model, for the sake of simplicity we neglect the $\mathcal{U}(1)$ hypercharge gauge group and the Yukawa couplings for a moment and focus on the non-Abelian $\SU(2)$ part. To be specific, we consider the Lagrangian~\eqref{EW-Lagrangian} in the limit $f_{l} \to 0$ and put the Abelian gauge field $a$ to zero. Besides the local $\SU(2)$ gauge structure given in the second line of Eq.~\eqref{FieldGT-EW}, the model also obeys a less obvious, additional global $\SU(2)_{R}$ symmetry. It solely acts on the scalar field but in a non-linear way as it relates $\vphi$ with $\t\vphi$, \begin{align} &\vphi^{\kappa} = \kappa_{1} \vphi + \kappa_{2} \t\vphi, \quad \t\vphi^{\kappa} = -\kappa_{2}^{*} \vphi + \kappa_{1}^{*} \t\vphi \notag \\ &\text{where} \quad \kappa_{1/2}\in \mathbb{C} \quad \text{and} \quad |\kappa_{1}|^{2} + |\kappa_{2}|^{2} = 1 \end{align} ($b^{\kappa} = b$, $\psi_{L/R}^{\kappa} = \psi_{L/R}$). Note, that this is a particularity of $\SU(2)$ as only for this group the dual field of the fundamental scalar $\vphi$ transforms under the fundamental representation as well. From the FMS perspective, we can now classify gauge-invariant bound state operators according to their transformation properties with respect to this global $\SU(2)_{R}$ symmetry, i.e., as $\SU(2)_{R}$ multiplets. Again, this is similar to pure QCD with $N_{f}$ fermion flavors where the physical spectrum is described in terms of $\SU(3)$-invariant meson, hadron, and more exotic bound states that form certain multiplets of the global flavor symmetry group. The additional global symmetry can be made more transparent by introducing a bi-doublet, $\Phi = \begin{pmatrix}\t\vphi & \vphi \end{pmatrix}$. The usual gauge transformations act on $\Phi$ by multiplication from the left, $\Phi^{\beta} = \beta\Phi$. The additional global (flavor-like) symmetry acts as multiplication from the right $\Phi^{\kappa} = \Phi\kappa$, $\kappa \in \SU(2)_{R}$. Note, that this bi-doublet is precisely used to construct the local dressing field $u = ||\vphi||^{-1} \Phi$. Further, we would like to emphasize that this global symmetry is broken via the BEH mechanism as well. Nonetheless, in case a gauge with nonvanishing VEV is chosen, a global diagonal subgroup of $\SU(2)\times\SU(2)_{R}$ remains such that the precise breaking pattern of the model reads $\SU(2) \times \SU(2)_{R} \to \SU(2)_{\mathrm{diag}}$. This remaining symmetry also manifests in the elementary spectrum. For instance the weak vector bosons receive the same mass term due to the BEH mechanism and transform as an $\SU(2)_{\mathrm{diag}}$ triplet after gauge fixing.\footnote{Note that we still neglect the hypercharge sector which causes the splitting of the $W$ and $Z$ mass terms in the standard model.} In order to analyze the spectrum of the model, we characterize states due to their global quantum numbers. Therefore, we have an additional quantum number due to the global $\SU(2)_{R}$ symmetry group. First, we consider the scalar channel, i.e., operators that generate states that can be associated with scalar particles. The simplest gauge-invariant operators in this channel contain two elementary scalar fields. These can be combined such that we obtain two different irreducible $\SU(2)_{R}$ multiplets, a singlet or a triplet. We already discussed the scalar $\SU(2)_{R}$ singlet $\Tr(\Phi^{\dagger}\Phi) = \vphi^{\dagger}\vphi + \t\vphi^{\dagger}\t\vphi = 2\vphi^{\dagger}\vphi$. In case a gauge is chosen such that $\vphi$ acquires a nonvanishing VEV, this operator can be mapped on the elementary Higgs field as discussed above. Technically, we can also construct a triplet state $\Tr(\tau_{i_{R}}\Phi^{\dagger}\Phi)$ where $\tau_{i_{R}}$ denotes the generators of $\SU(2)_{R}$.\footnote{In order to make transformation properties with respect to the different $\SU(2)$ groups directly transparent, we will use index notation in the following. Indices with a subscript $R$ or $D$ denote objects transforming with respect to $\SU(2)_{R}$ or $\SU(2)_{\mathrm{diag}}$, respectively. Furthermore, we will use Lorentz indices (greek letters) to highlight the spin quantum number of the operators.} However, this multiplet vanishes identically, $\Tr(\tau_{i_{R}}\Phi^{\dagger}\Phi) =0$, which becomes directly apparent in the $\vphi$-$\t\vphi$ notation where the triplet is given by $\big(\re(\t\vphi^{\dagger}\vphi),\im(\vphi^{\dagger}\t\vphi),\vphi^{\dagger}\vphi - \t\vphi^{\dagger}\t\vphi \big) = (0,0,0)$. In the vector channel, we perform the same analysis. The global $\SU(2)_{R}$ triplet, $\Tr(\tau_{i_{R}}\Phi^{\dagger}D^{\mu}\Phi)$, expands in leading order of the FMS mechanism to the triplet of massive $\SU(2)_{\mathrm{diag}}$ vector fields. Choosing $\vphi_{0} = (0, 1)^{\mathrm{T}}$, i.e., $\Phi = \frac{v}{\sqrt{2}}\mathbbm{1} + \mathcal{O}(\Delta\vphi)$, we have \begin{align} \Tr(\tau_{i_{R}}\Phi^{\dagger}D^{\mu}\Phi) = \frac{gv^{2}}{2} \Tr(\tau_{i_{R}} b^{\mu} ) + \mathcal{O}(\Delta\vphi) = \frac{gv^{2}}{4} \delta_{i_{R}i_{D}} b_{i_{D}}^{\mu} + \mathcal{O}(\Delta\vphi). \end{align} Therefore, we obtain a gauge-invariant vector operator transforming as an $\SU(2)_{R}$ triplet that can be mapped on the triplet of massive elementary vector fields similar to the $\vphi^{\dagger}\vphi\,$-$\,h$ mapping in the scalar sector. Of course, we are also able to construct a vector operator that transforms as an $\SU(2)_{R}$ singlet, $\Tr(\Phi^{\dagger}D_{\mu}\Phi)$. However, this operator does not provide a mapping on an elementary vector field as the $\mathcal{O}(\Delta\vphi^{0})$ term vanishes due to the properties of the $\SU(2)$ group. At $\mathcal{O}(\Delta\vphi^{1})$, we obtain a nontrivial term given by $\sqrt{2}vd_{\mu}h$. Thus, investigating the propagator of the vector singlet, we expect a pole at the mass of the elementary Higgs. Nevertheless, this pole structure does not give rise to a new vector particle with mass $m_{\mathrm{h}}$ as it appears only in the longitudinal part of the correlator such that it does not exhibit the correct Lorentz structure of a vector particle. Note, that not only the pole structure but also the correct Lorentz structure is necessary for a proper particle interpretation. In case of the vector channel, one would expect a structure $(g^{\mu\nu}-p^\mu p^\nu / m_V^2)/(p^2-m_V^2)$ for a proper massive vector particle having Spin = 1. However, we only obtain $p^\mu p^\nu/(p^2-m_h^2)$ which has no meaningful particle interpretation because not only the analytic structure of the propagator is important but also its Lorentz tensor structure. It rather reflects the fact that a derivative acting on a scalar operator transforms as a vector and therefore mixes with operators in the vector channel. Therefore, we do not obtain a new vector particle from the gauge-invariant description, which thus remains consistent with the common perturbative treatment of the model. Furthermore, we have the fermionic sector of the model. Neglecting the hypercharge sector, the right-handed fermion fields are part of the physical spectrum as they are already gauge-invariant, see Eq.~\eqref{FieldGT-EW}.\footnote{Note that we neglect any influence of the strong force under which the right-handed quarks transform as fundamental objects.} However, the left-handed flavors of quarks and leptons within one generation are actually weak gauge charges and thus unobservable due to their non-Abelian nature. Due to the global $\SU(2)_{R}$ symmetry, we are able to construct $\SU(2)$ gauge-invariant fermionic operators that are $\SU(2)_{R}$ doublets. In leading order of the FMS expansion, these expand to the elementary left-handed fermionic fields, \begin{align} \Phi^{\dagger} \psi_{L} = \begin{pmatrix} \t\vphi^{\dagger}\psi_{L} \\ \vphi^{\dagger}\psi_{L} \end{pmatrix} = \frac{v}{\sqrt{2}} \begin{pmatrix} \t\vphi_{0}^{\dagger}\psi_{L} \\ \vphi_{0}^{\dagger}\psi_{L} \end{pmatrix} + \mathcal{O}(\Delta\vphi) = \frac{v}{\sqrt{2}} \begin{pmatrix} \nu_{L} \\ \ell_{L} \end{pmatrix} + \mathcal{O}(\Delta\vphi). \end{align} Therefore, the different flavors of the left-handed components observed within one generation are actually not the weak gauge charges but rather the physically well defined $\SU(2)_{R}$ quantum numbers. So far, we only discussed the spectrum within our reduced electroweak model, i.e., neglecting Yukawa coupling and hypercharge contributions. Allowing for nonvanishing Yukawa and hypercharge couplings, we explicitly break the global $\SU(2)_{R}$ symmetry. Therefore, the $\SU(2)_{\mathrm{diag}}$ symmetry of the gauge fixed formulation is broken as well. Nonetheless, we are still able to investigate gauge-invariant operators that generate states of the aforementioned $\SU(2)_{R}$ multiplets which map on the corresponding $\SU(2)_{\mathrm{diag}}$ multiplets. The only difference to the previous discussion is a splitting of the multiplet levels in the various quantum number channels due to the explicit breaking terms in the Lagrangian which then results in the different observed mass terms for charged leptons and neutrinos or the mass splitting of the $W$ and $Z$ bosons. Furthermore, we have to incorporate a gauge-invariant treatment of the additional $\mathcal{U}(1)$ gauge structure. As the hypercharge sector is an Abelian gauge theory, we might use common dressings via a Dirac phase factor as in QED. For more details see the end of Sec.~\ref{Examples} or Ref.~[\cite{Maas:2017wzi}]. \subsubsection{Phenomenological Implications of the FMS Formulation} \label{Phenomenological implications of the FMS formulation} Besides nontrivial lattice checks of the FMS relation, also perturbative investigations that include higher-order FMS terms shed a new light on the gauge-invariant definition of observables in a gauge theory with BEH mechanism. Note that conventional investigations of, e.g., the properties of the Higgs, merely focus on the first term of the FMS expansion in Eq.~\eqref{eq:FMSScalar}. Although the on-shell properties of $h$ do not depend on the gauge-fixing parameter, the off-shell properties do. In order to examine this further, let us extract the K\"all\'{e}n-Lehmann spectral representation $\rho_{\mathrm{h}}(\lambda)$ from the propagator $\langle h(x)\, h(y) \rangle$. In momentum space we have \begin{align} \langle h(p)\, h(-p) \rangle = \int_{0}^{\infty} d\lambda \frac{\rho_{\mathrm{h}}(\lambda)}{p^{2}-\lambda}. \end{align} We depict the spectral function for the elementary Higgs field computed via a one-loop approximation of the propagator in Fig.~\ref{fig:spectral}, see [\cite{Maas:2020kda}] for further details. The analysis was performed for different gauge fixing parameters $\xi$. The red dotted curve denotes the result for $\xi=1$ (Feynman-'t Hooft gauge), the green dash-dotted curve represents the result for $\xi=2$, and the blue dashed line is $\xi=10$. First of all, we obtain a clear peak at $m_{\mathrm{h}} = 125$ GeV independently of the chosen gauge. Also the width of this peak is the same for all gauges. This is expected due to the Nielsen identities as the peak position (mass) and width (decay width) are determined by the pole of the propagator. \begin{figure} \centering \includegraphics[width=0.8\textwidth]{spectralFunction.pdf} \caption{Spectral density of the elementary Higgs field for different values of the gauge-fixing parameter $\xi$. We depict the spectral function for $\xi=1$ (red dotted line), $\xi=2$ (green dash-dotted line), and $\xi=10$ (blue dashed). Further, we depict the Higgs spectral function extracted from the pinch technique (purple line). The black solid line shows the spectral function of the gauge-invariant bound state $\vphi^{\dagger}\vphi$. The vertical gray dashed lines indicate the mass thresholds at $2m_{\mathrm{W}}$, $2m_{\mathrm{Z}}$, $2m_{\mathrm{h}}$, and $2m_{\mathrm{top}}$ from left to right. For further details see [\cite{Maas:2020kda}]} \label{fig:spectral} \end{figure} Furthermore, we find several continuum thresholds that are associated with observed particle masses. These are indicated as vertical, thin grey dashed lines. The first such line is the $2m_{\mathrm{W}}$ threshold starting at twice the mass of the $W$ boson. Going to higher energies, we also find the thresholds at $2m_{\mathrm{Z}}$, where $m_{\mathrm{Z}}$ is the mass of the Z boson, $2m_{\mathrm{h}}$, as well as $2m_{\mathrm{top}}$. However, we also find unphysical thresholds which are not related to physical particles. These thresholds depend on the gauge-fixing parameter $\xi$ which can easily be figured out by varying $\xi$. More precisely, these unphysical thresholds start at $2\sqrt{\xi}m_{\mathrm{W}}$ and $2\sqrt{\xi}m_{\mathrm{Z}}$. Indeed, for $\xi = 10$ (blue curve), we have two additional spikes at $\approx 505$ GeV and $\approx 575$ GeV while the additional thresholds appear at $\approx 226$ GeV and $\approx 257$ GeV for $\xi=2$ (green line). For $\xi = 1$ (red line), we don't find additional structures in the spectral density as the unphysical thresholds start at the masses of the physical $W$ and $Z$ mass scale which leads to a nontrivial modification of the latter physical thresholds. At this point we would also like to emphasize that the spectral function becomes negative for some gauge conditions. This is also a clear hint that the elementary Higgs field $h$ cannot be identified with a physical observable as the spectral function of such a quantity has to be nonnegative for a physical interpretation. Similar results can also be obtained for the Abelian Higgs model [\cite{Dudal:2019aew,Dudal:2019pyg,Dudal:2020uwb,Dudal:2021pvw}] Of course, the fact that the elementary Higgs propagator depends on $\xi$ is known for a long time. However, the Higgs particle is unstable within the standard model and occurs only as an intermediate resonance in a physical process. Calculating physical $S$-matrix elements, e.g., scattering processes of stable particles, the gauge parameter dependence of the internal Higgs propagators will get cancelled by propagator-like pieces from triangle and box diagrams [\cite{Papavassiliou:1995gs,Papavassiliou:1996zn,Papavassiliou:1995fq}]. Taking these processes into account, a $\xi$-independent definition of the propagator and thus of the spectral function can be introduced via the so called pinch technique [\cite{Binosi:2009qm,Papavassiliou:1997pb}]. This pinch technique propagator is cured from unphysical thresholds by definition. However, its spectral function still violates positivity as can be seen in Fig.~\ref{fig:spectral} (purple solid line). By contrast, let us investigate the spectral function of the bound state operator $\vphi^{\dagger}\vphi$. For that, we include the other two terms of the FMS expansion in Eq.~\eqref{eq:FMSScalar} on the same footage as the elementary Higgs propagator, i.e., we perform a one-loop approximation as the simplest possible nontrivial approximation for these terms as well. The first important result of this calculation is given by the fact that all $\xi$-dependent contributions to the leading order term $\langle h(x)\, h(y) \rangle$ get canceled by gauge-dependent contributions to the other two Green's functions $\langle h(x)\, \big(\Delta\vphi^{\dagger}\Delta\vphi\big) (y) \rangle$ and $\langle \big(\Delta\vphi^{\dagger}\Delta\vphi\big)(x)\, \big(\Delta\vphi^{\dagger}\Delta\vphi\big) (y) \rangle$. Of course, this is not a surprise as the sum of all terms on the right-hand side of the FMS expansion is gauge invariant by construction. Thus, the unphysical thresholds are absent. The second important result is the positivity of the spectral function such that a physical particle interpretation is possible for the bound state [\cite{Maas:2020kda}]. Apart from these more advanced analyses for the Higgs boson, also other interesting phenomenological implications have been investigated in first exploratory studies. For instance, the potential influence on anomalous couplings and the size of the gauge-invariant $W$-Higgs bound state has been studied in [\cite{Maas:2018ska}]. Furthermore, the bound state formulation of observables in the electroweak sector also influences high precision measurements of other sectors as QCD. The necessity to describe hadrons not only as gauge-invariant objects with respect to the strong interaction but also with respect to the weak interaction once they are embedded in the larger standard model context implies that some of them contain additional scalar fields as constituents [\cite{Egger:2017tkd}]. These effects can be addressed in a parton distribution function type of language [\cite{Fernbach:2020tpa}]. Also predictions for potential future lepton colliders should be investigated in light of the FMS formulation as off-shell properties of leptons will get altered similar to the case of the Higgs boson. If some of these effects are not properly accounted for, they could easily be missinterpreted as signals for new physics while being only nontrivial effects of standard model physics. \subsection{The FMS Formulation for General Gauge Theories with a BEH Mechanism} \label{The FMS formulation for general gauge theories with a BEH mechanism} In the previous sections, we discussed different strategies to construct a gauge-invariant formulation of the electroweak sector of the standard model. One of the central advantages of the FMS formulation is its direct generalization to arbitrary gauge groups with scalar fields in arbitrary representations. This is of particular importance as also recent lattice investigations challenge the conventional interpretation of the spectrum of gauge theories with a BEH mechanism [\cite{Maas:2016ngo,Torek:2017czn,Maas:2018xxu,Afferrante:2020hqe}]. States that one would naively expect by the conventional analysis were not found by the nonperturbative lattice simulations of the models. This failure has far reaching consequences for potential model building [\cite{Maas:2017xzh,Sondenheimer:2019idq}]. Using the FMS approach provides a coherent picture for currently observed phenomena of the lattice spectra. The basic FMS ingredients, namely: \begin{itemize} \item[(a)] construct strict gauge-invariant operators with respect to the original gauge group and classify them according to the global symmetries of the model and \item[(b)] chose a gauge with nonvanishing VEV of the scalar field and investigate the FMS expansion, \end{itemize} can be used for any BEH model. In the following, let us consider a gauge theory with gauge group $\H$ that breaks in the conventional treatment of the BEH mechanism to a subgroup $\K \subset \H$. As discussed in detail in the previous sections, this viewpoint has various philosophical and field theoretical inconsistencies. From a field theoretical perspective, the BEH mechanism should rather be considered as a duality relation between the spectra of an $\H$ gauge theory and a $\K$ gauge theory with specific field content [\cite{Sondenheimer:2019idq}]. The FMS formalism reveals which of the potential states in both theories are related. This duality relation can be read in two ways. From a top down perspective, the FMS mechanism shows which $\H$-invariant operators can be computed by potential simpler objects in a $\K$ gauge theory. From a bottom up perspective, the FMS formalism explains which states of a $\K$ gauge theory can be embedded into the spectrum of an $\H$ gauge theory. At first sight, one may be tempted to conclude that the FMS strategy provides a gauge-invariant description of all quantities that are usually considered from the perspective of gauge symmetry breaking, similar to the standard model case. As a simple example, consider the elementary scalar field that is proportional to the direction of the VEV and thus always transforms as a singlet with respect to the unbroken remaining gauge group $\K$ of the BEH mechanism. We find always a strict $\H$-invariant operator that has precisely this particular gauge-dependent field as the nontrivial leading order term of the FMS expansion. We always have $(\phi^{\mathbf{a}})^{*}\phi^{\mathbf{a}} = v h + \cdots$ where $h$ is the elementary $\K$ singlet, $\phi$ a scalar field in an arbitrary representation of the gauge group $\H$ whose potential has nontrivial minima, and $\mathbf{a}$ is a multi-index characterizing the representation. Similar constructions of $\H$-invariant operators can also be done for all those elementary fields that transform as $\K$ singlets. This has been confirmed in all models that have been investigated in lattice calculations so far [\cite{Maas:2016ngo,Torek:2017czn,Maas:2018xxu,Afferrante:2019vsr,Afferrante:2020hqe}]. For instance, consider an $\H = \SU(3)$ gauge theory with fundamental scalar field. Any nontrivial minimum of the potential has a $\K=\SU(2)$ subgroup as stabilizer. Therefore, we would expect a breaking $\SU(3)\to\SU(2)$ due to the BEH mechanism from the conventional perspective. On the level of the particle spectrum this translates in a formulation of $\SU(2)$-invariant objects instead of strict $\SU(3)$-invariant composite bound states. The constituents of the former can be extracted from the $\SU(3)$ gauge and scalar field and arranged in multiplets of the remaining $\SU(2)$ group. For the considered example, we can decompose the $\SU(3)$ gauge field into three different $\SU(2)$ multiplets. Five gauge bosons acquire a nonvanishing mass term. These can be subdivided into a field $A_{\mathrm{s}}$ that transforms as a singlet with respect to the remaining $\SU(2)$ gauge transformations while the other four components form a fundamental multiplet $A_{\mathrm{f}}$. The remaining three (massless) gauge bosons, which we denote by $A_{\mathrm{a}}$, form the pure Yang-Mills sector of the $\SU(2)$ gauge theory. As the elementary $A_{\mathrm{s}}$ is already invariant with respect to the non-Abelian $\SU(2)$ gauge group, it belongs to the gauge-invariant spectrum of the $\SU(2)$ gauge theory. Similar to the elementary Higgs field $h$, we can also construct an $\SU(3)$-invariant vector operator that precisely maps on this particular vector field, $\phi^{\dagger}D^{\mu}\phi \sim A_{\mathrm{s}}^{\mu} + \mathcal{O}(\varphi/v)$ which has been confirmed via lattice investigations [\cite{Maas:2016ngo,Maas:2018xxu}]. By contrast, there is no $\SU(3)$-invariant operator that maps on any other elementary vector field. This is not a surprise. In general we start our investigation with a strict $\H$-invariant operator. All terms that can be extracted from such an object have to be invariant with respect to the remaining $\K$ gauge transformations by construction such that we can only obtain $\K$ singlets but we do not obtain a component of a $\K$ charged multiplet ($A_{\mathrm{f}}$ or $A_{\mathrm{a}}$ for our $\H = \SU(3)$ example). Of course, this does not imply that an object on the right-hand side cannot contain nontrivial $\K$ multiplets. $\K$-invariant combinations of $\K$ multiplets can be extracted from $\H$-invariant composite operators. For our current $\SU(3)$ example, the $\SU(3)$-invariant glueball operator $\Tr(F^{2})$ can be decomposed into an $\SU(2)$ glueball $\Tr(F_{\mathrm{a}}^{2})$ with $F_{\mathrm{a}} = d A_{\mathrm{a}} + \sfrac{1}{2}\left[A_{\mathrm{a}}, A_{\mathrm{a}}\right]$, an $\SU(2)$ bound state formed by the fundamental vector fields $A_{\mathrm{f}}^{\dagger}A_{\mathrm{f}}^{\phantom{\dagger}}$, as well as several other $\SU(2)$-invariant combinations of the elementary $\SU(2)$ multiplets. Although, we can extract these $\SU(2)$-invariant states from a strict $\SU(3)$-invariant operator in a gauge-fixed setup by decomposing the multiplets, the associated states have not been found on the lattice yet. Why this is the case is currently under investigation and an open problem. So far, we can identify two differences that distinguish, for instance, a $\K$ glueball operator from the the elementary Higgs field or the elementary singlet vector field for the $\SU(2)$ case. First, the latter operators can be obtained from $\SU(3)$-invariant operators not only via the standard multiplet decomposition but appear also in a unique way at nontrivial leading order of the FMS expansion of some $\SU(3)$-invariant operators. By contrast, no such mapping of an $\H$-invariant operator on an $\K$-invariant glueball operator exist via the split $\phi = \frac{v}{\sqrt{2}}\phi_{0} + \Delta\phi$ as the constituents of the $\K$ glueball operator are in a subspace orthogonal to the direction of the VEV $\phi_{0}$. Second, the $\K$ glueball as well as various other operators are composites of elementary $\K$ multiplets and form nontrivial bound states already from the perspective of the $\K$ gauge theory. As to whether the BEH duality extends to these objects and if the FMS mappings are able to explain the spectra on a pure group theoretical basis or dynamical effects of bound state formations from either the $\H$ or $\K$ perspective play an important role needs further detailed investigations. The fact that only $\K$-invariant operators can be extracted from $\H$-invariant ones has far reaching implications for model building beyond the standard model. As a simple toy model, let us consider an $\SU(2)$ gauge theory with a scalar field in the adjoint representation. Performing the conventional analysis, the breaking pattern reads $\SU(2) \to \mathcal{U}(1)$ and the particle spectrum consists of a scalar particle described by an elementary scalar field which is a $\mathcal{U}(1)$ singlet, a massive vector boson that is charged with respect to the remaining $\mathcal{U}(1)$ symmetry and its corresponding antiparticle with opposite $\mathcal{U}(1)$ charge, as well as a massless gauge boson being the force carrier of the $\mathcal{U}(1)$ gauge group. Thus, a variety of potential states can be described by elementary fields from the conventional perspective of gauge symmetry breaking. From the FMS perspective, we have to construct $\SU(2)$-invariant states and investigate their FMS expansions. Indeed, it is straightforward to find strict $\SU(2)$-invariant operators that map on the elementary scalar boson as well as on the massless vector particle [\cite{Maas:2017xzh}]. However, no $\SU(2)$-invariant operator exist that maps on an operator generating a $\mathcal{U}(1)$ charged state [\cite{Sondenheimer:2019idq}] which is in accordance with lattice investigations [\cite{Lee:1985yi,Afferrante:2019vsr,Afferrante:2020hqe}]. Again, we can only extract a $\K$ $(=\mathcal{U}(1))$-invariant operator from any $\H$-invariant operator. Thus, it is not possible to embed the $\mathcal{U}(1)$ charged states from the perspective of the $\mathcal{U}(1)$ gauge theory into the spectrum of the $\SU(2)$ gauge theory. This is a generic problem for any physical theory beyond that standard model (BSM) that tries to embed the $\mathcal{U}(1)$ gauge group of the standard model into a larger gauge symmetry. From that perspective, the standard model electroweak gauge group is special. First, it explicitly contains a $\mathcal{U}(1)$ (hypercharge) group whose properties translate into the properties of the remaining $\mathcal{U}(1)$ (electromagnetism) gauge group via the BEH mechanism. Second, the non-Abelian $\SU(2)$ weak gauge sector has a global counterpart which is also described by an $\SU(2)$ structure which purely acts on the scalar fields. Therefore, a sufficient large number of $\SU(2)$ gauge invariant operators can be constructed and classified according to global $\SU(2)_{R}$ multiplets. Due to these particular reasons, we are able to construct the spectrum in a strict gauge-invariant way and the FMS mapping provides a convenient description of it in terms of the conventional analysis via the elementary fields of the gauge-fixed Lagrangian. Similar constructions can be done for BSM models that fulfill the same requirements as the standard model, e.g., two-Higgs-doublet models [\cite{Maas:2016qpu}] as well as general $N$-Higgs-doublet models, such that these models provide reliable BSM models that pass all FMS constraints. \section{Critical Assessment, Reflections, and Challenges}\label{Sec:Reflection} The success of gauge theories in particle physics opened the door to optimism concerning unification in physics based on the concept of symmetry \citep{Yang1980}. Understanding gauge symmetries as descriptive redundancies seems adequate in the light of reasonable conceptual desiderata such as determinism, parsimony of the posited unobservable ontology and elimination of superfluous structure (Section \ref{Sec:Symmetry}). Yet, the fundamental significance of this success seems to be challenged by the apparent indispensability of gauge fixing and spontaneous symmetry breaking. In the context of the BEH mechanism, the very possibility of providing a gauge invariant account (presented already in the unitary-gauge-fixed formulations by \citealp{Higgs66} and \citealp{Kibble67}) can appear as providing a viewpoint benefiting from the best of both worlds \citep{Struyve2011}, reconciling gauge invariance and accounting for massive vector bosons at the same time. However, the foundational importance of such attempts remains questionable as long as they stand as mere reformulations of existing theories, achieving certain theoretical virtues at the price of sacrificing others. While gauge invariance may further resolve some technical issues that arise in the context of lattice theories (Section \ref{Sec:Breaking}), it may seem far from being clear whether these advantages can compete with those of the established framework of spontaneous symmetry breaking. The DFM (Section \ref{The dressing field method}) and the FMS approach (Section \ref{Sec:FMS approach}) may each suggest that the gauge invariant approaches can, in fact, open the door to a wider heuristic and conceptual frameworks. Both of these methods identify gauge invariant field variables, thus achieving reduction of gauge symmetries without compromising on the theoretical virtues that motivate gauge invariance (see Section \ref{Sec:Why}). Applied to the electroweak model, they converge on the conclusion that the spontaneous breaking of gauge symmetry is not a physical phenomenon in this case, and furthermore, at the classical level the results they provide coincide \citep{Maas:2017wzi}, giving rise to a local gauge invariant description of the massive gauge bosons, that renders the $SU(2)$ symmetry an artificial one. However, while neither the DFM nor the FMS are yet in a state of full maturity, we can already point out that despite the aforementioned similarities the two approaches seem to entail different research programs that face different challenges. For example the question of quantizing a dressed theory, with its invariant field variables, is still a programmatic endeavor. The FMS approach is more developed in that regard, as it treats invariant fields as composites of gauge-variant fields and borrows technics from QCD, and it already shows great promises as it appears to mitigate problems appearing in the standard formulation based on SSB (as detailed by the end of Section 6). If future research confirms that such local invariant formulations of the electroweak model have a theoretical edge over the usual approach (gauge-fixing and SSB), then a web of interconnected questions arise: If $\SU(2)$ is indeed artificial, and given that the gauge principle applied to the sole $\mathcal{U}(1)$ substantial gauge symmetry is not enough to explain the structure of the model, presumably this re-opens the question of its conceptual and theoretical foundations -- or at least provide a new angle to reassess those foundations. This question itself is then nested within that of the underlying principle(s) explaining the structure of the full Standard Model, whose substantial gauge symmetry group would then be $\mathcal{U}(1) \times \SU(3)$: A more fundamental theory giving the SM in the effective low energy regime should then explain why it presents this mix of substantial and artificial symmetries. Following that thread could be another avenue toward beyond the SM physics. Constraining the formalism to gauge invariant field variables might come at the price of increased complexity and/or loss of manifest locality. This shows that while gauge symmetries are convenient, they are not always necessary in order to formulate the relevant physical theories. We conclude with some reflections on implications of these findings, and a (possible) future role of gauge-invariant approaches in physical practice. Concerning physical practice, there is overwhelming agreement among physicists that gauge dependent quantities are not empirical. On the other hand, as far as day-to-day physical practice is concerned, this statement is often applied only within the narrow window of perturbative or effective treatments. Only a few, mainly mathematical, physicists have consistently pointed out that the perturbative approach is viable only for very specific theories. In matters of practice, only within the community of lattice theoreticians has non-perturbative gauge invariance become, by necessity, mandatory. Nonetheless, the subtleties in relation to the perturbative treatment, which were emphasized especially by Fr\"ohlich, Morchio and Strocchi, have not been widely appreciated [see \cite{Maas:2017wzi} for an overview of the developments]. Assuming that, in accordance with the recommendations presented here, formulating theories in gauge-invariant ways from the start becomes accepted as a methodological guideline in the future, this leaves us with a number of puzzling insights and challenges. On the one hand, it appears that many, or perhaps even all, gauge theories can be reformulated as theories without gauge symmetries. However, these reformulations come with non-trivial features, like non-local contributions, non-power-countable Lagrangians, involved target spaces, or an infinite number of fields. Moreover, provided that dualities between different gauge theories hold, there could be multiple different gauge theories associated with the same set of gauge-invariant quantities. On the other hand, peaceful co-existence between theoretical practice and gauge symmetries is definitely possible, as long as we maintain a commitment to express observable quantities in terms of gauge-invariant observables. That is, even if gauge symmetries are still a part of the theoretical framework, we assign physical relevance only to quantities that are gauge-independent; this should be contrasted with eliminative approaches that are strictly formulated using gauge invariant variables. Though, as the example of QCD shows, if this commitment to gauge-invariant observable quantities is manifested by e.g. lattice QCD, this resolution may require only marginally less effort than eliminating the gauge symmetry altogether, as manifested by e.g. a reformulation of QCD in terms of Wilson lines. The enormous amount of computing time and person-years in development of algorithms for lattice QCD needs to be compared to the conceptual and technical complications of a reformulation of QCD in terms of Wilson lines. But a number of conceptual challenges emerge in the eliminative approach, from the physics point of view: Can indeed every gauge theory be written in terms of a formalism without gauge-dependent quantities and hence without gauge symmetries? Do there exist gauge theories whose non-gauge version is genuinely local, without the gauge symmetry being trivial? Is any such theory relevant to experiment? Do theories which are dual to experimentally relevant ones exist, which have different gauge symmetries? Answering these questions would tell us a lot about to which extent gauge symmetries are uniquely tied to the observables. Even if the ease of use implies that gauge symmetry will find continued employment in actual calculations, consistently adopting the stance that gauge symmetries are conceptually redundant would have far-reaching implications. For this would imply that, as they are represented in the Lagrangian, each and every elementary particle in the current standard model of particle physics\footnote{With the exception of right-handed neutrinos, if they exist.} is not physical, as the fields corresponding to these particles are all gauge-dependent! The only physical degrees of freedom would be those that correspond to hadrons, the electroweak objects of the FMS approach, and photon-cloud dressed QED states. The conventional notions of quarks, electrons etc.\ would need to be regarded as mere auxiliaries that are technically useful but do not have any physical reality. Given the role these objects play even at the level of school textbooks, this would be a fundamental shift of what are widely, and popularly, regarded as the furniture of reality and the fundamental building blocks of nature\footnote{Such a picture is anyhow imprecise due to the identification of particles with fields, rather than speaking of particles as localized field excitations. However, the issue of particle-field duality is unrelated to the issue of gauge symmetry, and thus glossed over here.}. Thus, eliminating gauge-dependent objects as physical objects might well be the most consequential shift in the way in which we portray nature since the advent of quantum field theory. However, this leaves one stark observation: Every experimentally relevant theory can be written either in a local form using gauge symmetries, or in a non-local form without gauge symmetries. This raises several questions, namely: If we wanted to preserve locality, is the preservation of gauge symmetries our only option? Is a description of experiments without gauge symmetry only possible non-locally? As such, are we guided correctly in assuming that the gauge principle is essential in more fundamental theories? Or does this unnecessarily narrow our perspective? Even when thinking about approaches like loop quantum gravity, gauge-invariant variables originally derive from a local formulation. Could and should a general non-local (or non-gaugeable) approach be searched for? Without experimental guidance, this appears challenging at least. So, as a more pragmatic benchmark, we can ask: does eliminating gauge-dependent objects as an element of reality create progress? These questions need to be answered. And it needs to be understood whether abandoning our current view in terms of quarks, electrons, etc.\ is necessary, or at the very least advantageous. As a concluding comment, we discussed here primarily the situation in ordinary relativistic quantum field theories in flat space-time. But the problem extends beyond those. Most notably, similar problems arise in (quantum) gravity theories, which can be considered to be gauge theories of translations and, in presence of torsion, Lorentz symmetry [\cite{hehl1995gauge,Hehl:1976kj}]. This does not even touch upon the possibilities in more extensive settings, e.\ g.\ string theory. The problems encountered with gauge symmetries are then amplified in gauge theories of gravity, as the space-time structure itself becomes gauge-dependent, including the notion of time. Likewise, similar approaches have been advocated to eliminate the problem of gauge dependence. Most notably, loop-quantum gravity [\cite{Ashtekar:2011ni}] seeks an alternate quantization procedure by quantizing manifestly gauge-invariant quantities. More particle-physics-like approaches are also discussed, where the quantum theory remains a gauge theory. This leads to ideas similar to the dressing-field method [see e.\ g.\ \cite{Donnelly:2015hta,Giddings:2019wmj}] or the FMS approach [\cite{Maas2020}]. However, the concept of locality in particular becomes far more involved. In this context, the concept of local observables is far less developed, and important questions, e.\ g.\ the role of affine parameters instead of space-time coordinates, are far from understood. This issue has also been observed in the philosophy of physics [\cite{Lyre:2004,Healey:2007}]. However, without a clear understanding of the role of gauge symmetries in particle physics a full clarification in the quantum gravity setting appears unlikely.
\section{Introduction} Planets are born and grow in accretion disks around young stars. This is supported by observations of protoplanets embedded in a disk of gas and dust captured during their growth phase \citep[e.g.][]{keppler_discovery_2018}. A protoplanet interacts with the disk around it in every stage of its growth \citep{kley_planet-disk_2012} for example via exchange of angular momentum. This results in the launching of spiral arms \citep{ogilvie-lubow-2002} and, if the planet is massive enough, the opening of a gap and, in some cases, the formation of multiple rings around the planet's orbit \citep{rafikov-2002}. The number of spirals, gaps, and rings as well as their contrast scales with the planet's mass, such that Jupiter-sized planets can have a strong impact on their environment in the right conditions, possibly resulting in multiple ring-like and non-axisymmetric observable features \citep{zhang-zhu-2020, miranda-rafikov-2020a}. This makes the planet--disk interaction scenario a popular interpretation for the numerous high-fidelity ALMA observations of such features. One promising scenario to explain observational asymmetries is the existence of vortices because they naturally accumulate dust at the pressure maxima in their center \citep[see for example][]{marel_major_2013,bae_planetary_2016,perez_disk_2018,hammer_observational_2019,barge-sommeria-1996}. Among the various ways to form vortices, the Rossby-wave instability \citep[RWI,][]{lovelace_rossby_1999} is particularly relevant in the vicinity of gaps. The RWI readily happens in 2D disks at the outer and inner edge of planet-opened gaps \citep{li_potential_2005,val-borro_vortex_2007}. Additional mechanisms that could be relevant in this context are the subcritical baroclinic instability \citep[SBI,][]{klahr_turbulence_2003, lesur_subcritical_2010} and the zombie-vortex instability \citep[ZVI,][]{marcus_zombie_2015,marcus_zombie_2016}. Vortices are then susceptible to viscous spreading as well as secondary instabilities such as the elliptical instability \citep{lesur_stability_2009}, which cause vortex decay. The lifetime of vortices is therefore determined by a competition between vortex-forming and -decaying mechanisms. Aside from possibly causing observable features in the disks, vortices can also affect planet migration in a stochastic fashion \citep{regaly_trapping_2013,ataiee_planet-vortex_2014,mcnally_migrating_2019} and even cause temporary outward migration \citep{lega-etal-2021} for otherwise inwardly-migrating planets. Understanding their formation pathways and lifetimes is therefore critical to the modeling of planet migration using global, low-viscosity simulations. In previous numerical studies, vortex properties have been found to depend on various physical processes such as turbulent viscosity and disk self-gravity. Lower viscosity allows vortices to live longer \citep{godon_vortices_1999,val-borro_vortex_2007,ataiee_asymmetric_2013,fu_long-term_2014,regaly_interpreting_2017} whereas the inclusion of self-gravity tends to weaken vortices, shortening their lifespan \citep{lin_effect_2011, zhu_gas_2016,regaly_vortex_2017,pierens_evolution_2018}. In recent numerical studies, radiative effects have been discovered to have a significant impact on the gap-opening capabilities of planets and therefore the structure of said gaps \citep{ziampras-etal-2020b,miranda-rafikov-2020b}, affecting the development of the RWI and by extension vortices around their edge \citep{tarczay-nehez_vortex_2020}. The present study aims to investigate the role of radiative effects for properties of vortices created by planets. More precisely, we explore how the thermal relaxation timescale of the gas affects the lifetime of vortices created during the growth of Jupiter-sized planets. The impact of thermal relaxation on vortex formation and lifetime was studied for nearly inviscid disks by \cite{les_gap_2015}, and recently \citet{fung_cooling-induced_2021} ran 2D shearing box simulations of RWI-induced vortices. As their simulations did not include a planet, the RWI was triggered by an artificial density bump. They described a baroclinic effect that spins down vortices where the decay is fastest for thermal relaxation times of the order of a tenth of the vortex turnover time. We ran a suite of global two-dimensional hydrodynamics simulations with an embedded Jupiter-sized planet, which naturally creates vortices in the disk, for different choices for the turbulent viscosity and the thermal relaxation timescale, among other physical parameters. The results of these simulations are then post-processed with our newly-developed pipeline for the detection and characterization of vortices. In Sect.~\ref{sec:physics-numerics} we describe our physical model and numerical setup. We present a typical life track of a vortex in our models in Sect.~\ref{sec:lifetrack}, report the dependence of vortex properties on physical parameters in Sect.~\ref{sec:results}, and present the case of long-lived vortices in Sect. \ref{sec:long-lived}. We discuss and comment on our findings in Sect.~\ref{sec:discussion}. Finally, Sect.~\ref{sec:summary} contains a summary of our main results and our conclusions. \section{Physics and numerics} \label{sec:physics-numerics} In this section, we describe the physical and numerical framework that we used in our simulations. We justify the approximations in our model, explain in detail the initialization process, and list technical parameters such as our grid setup and parameter space. \subsection{Hydrodynamics} \label{sec:hydrodynamics} We consider a thin disk of neutral, ideal gas with adiabatic index $\gamma=7/5$ and mean molecular weight $\mu=2.353$ that is orbiting around a star with one solar mass $M_\star=\mathrm{M}_\odot$. The two-dimensional, vertically integrated Navier-Stokes equations in a polar coordinate system $\{r, \phi\}$ read \begin{subequations} \label{eq:navier-stokes} \begin{align} \label{eq:navier-stokes-continuity} \frac{\partial\Sigma}{\partial t} + \vec{u}\cdot\nabla\Sigma & = -\Sigma \nabla\cdot\vec{u} \end{align} % \begin{align} \label{eq:navier-stokes-momentum} \Sigma\frac{\partial\vec{u}}{\partial t} + \Sigma(\vec{u}\cdot\nabla)\vec{u} & = -\nabla p + \Sigma \vec{g} + \nabla \cdot \bm{\upsigma} \end{align} % \begin{align} \label{eq:navier-stokes-energy} \frac{\partial (\Sigma\varepsilon)}{\partial t} +\vec{u}\cdot\nabla(\Sigma\varepsilon) & = -\gamma \Sigma\varepsilon \nabla\cdot\vec{u} + Q_\mathrm{visc} + Q_\mathrm{relax} \end{align} \end{subequations} where $\vec{u}=(u_r, u_\phi)$ and $\varepsilon$ are the velocity and specific internal energy of the gas evaluated at the midplane, and $\Sigma$ is the surface density. The vertically integrated pressure $p$ is defined through the ideal gas law $p = (\gamma-1)\Sigma\varepsilon = \mathrm{R}_\mathrm{g}\Sigma T/\mu$, with $\mathrm{R}_\mathrm{g}$ being the gas constant and $T$ the gas temperature. The isothermal sound speed of the gas is then given by $c_\mathrm{s,iso} = \sqrt{p/\Sigma} = \sqrt{\mathrm{R}_\mathrm{g} T/\mu}$ and relates to the adiabatic sound speed $c_\mathrm{s}$ as $c_\mathrm{s,iso} = c_\mathrm{s}/\sqrt{\gamma}$. For a disk in Keplerian motion and vertical hydrostatic equilibrium, we can also write $c_\mathrm{s,iso} = H\Omega_\mathrm{K}$, where $\Omega_\mathrm{K} = \sqrt{\mathrm{G}M_\star/r^3}$ is the Keplerian orbital frequency at radius $r$ and $H$ is the pressure scale height of the gas. The viscous stress tensor $\bm{\upsigma}$ (following \citet{tassoul-1978}) appears in both the momentum equation \eqref{eq:navier-stokes-momentum} as well as the dissipation function: \begin{equation} \label{eq:dissipation-function} Q_\mathrm{visc} = \frac{1}{2\nu\Sigma}\mathrm{Tr}(\bm{\upsigma}^2) = \frac{1}{2\nu\Sigma}\left(\sigma_{rr}^2 + 2\sigma_{r\phi}^2 + \sigma_{\phi\phi}^2 + \sigma_{zz}^2\right), \end{equation} where $\nu = \alpha c_\mathrm{s} H$ is the kinematic viscosity parametrized according to the $\alpha$-viscosity model of \cite{shakura_reprint_1973}. Here, $\alpha$ is a parameter that captures both radial angular momentum transport that leads to accretion onto the star and heating of the disk due to viscous friction. Numerical simulations of (magneto)hydrodynamical instabilities such as the vertical shear instability \citep[VSI,][]{nelson-etal-2013} or the magneto-rotational instability \citep[MRI,][]{balbus-hawley-1991} have provided numerical estimates of $\alpha$, while observations of young stellar objects surrounded by disks have constrained these estimates \citep{dullemond-etal-2018}. To probe a wide range of diffusion regimes from practically inviscid to moderately viscous, we choose $\alpha\in\{10^{-6}, 10^{-5}, 10^{-4}, 10^{-3}\}$ for our models. Viscous dissipation leads to the heating of the disk. An embedded planet can also deposit significant amounts of thermal energy via the dissipation of spiral shocks \citep{rafikov-2016, ziampras-etal-2020a}. As a cooling solution, we allow the disk to relax to a prescribed temperature profile $T_0$ (see, Eq.~\ref{eq:initial-profiles}) over a relaxation timescale $\tau_\mathrm{relax} = \beta/\Omega_\mathrm{K}$ \citep{gammie_nonlinear_2001}. The thermal relaxation term appears as an additional source term to the energy equation \begin{equation} \label{eq:thermal-relaxation} Q_\mathrm{relax} = -\Sigma c_\mathrm{v}\frac{T-T_0}{\beta}\Omega_\mathrm{K} \Rightarrow \frac{\partial T}{\partial t} = -\frac{T-T_0}{\tau_\mathrm{relax}} \end{equation} where $c_\mathrm{v}=\frac{\mathrm{R}_\mathrm{g}}{\mu(\gamma-1)}$ is the heat capacity of the gas at constant volume. The parameter $\beta$ controls the relaxation timescale, as well as the overall planet--disk interaction process \citep{miranda-rafikov-2020b}, we choose the values $\beta\in\{0.01, 1, 100\}$ which correspond to very fast, moderate, and very slow relaxation. The gravity of the star and planet are included as a source term in $\vec{g}$. We work in a star-centered coordinate system and embed a planet with mass $M_\mathrm{p}$ at a position $\vec{r}_\mathrm{p}$. Thus, the source term reads \begin{equation} \begin{split} \label{eq:gravity} \vec{g} &= \vec{g}_\star + \vec{g}_\mathrm{p} + \vec{g}_\mathrm{ind} \\ &= -\frac{\mathrm{G}M_\star}{r^3}\vec{r} -\frac{\mathrm{G}M_\mathrm{p}}{(d^2 + \epsilon^2)^{3/2}}\vec{d} -\frac{\mathrm{G}M_\mathrm{p}}{r_\mathrm{p}^3}\vec{r}_\mathrm{p}, \quad \vec{d} = \vec{r} - \vec{r}_\mathrm{p}. \end{split} \end{equation} The terms $\vec{g}_\star$, $\vec{g}_\mathrm{p}$, and $\vec{g}_\mathrm{ind}$ denote the acceleration due to the star, the planet, and the indirect term which is a correction needed because the star-centered frame is not an inertial frame. As we are considering fixed, non-migrating planets, disk feedback on the star and planet is neglected. The planet's gravitational pull (2nd term in the RHS of Eq.~\eqref{eq:gravity}) is smoothed using a Plummer potential with a smoothing length $\epsilon = 0.6 H(\vec{r})$ that captures the effect of the vertical structure of a more realistic 3D disk \citep{muller_treating_2012} and prevents singularities near the planet's location. For simplicity, we do not allow the planet to migrate. We chose to limit the degrees of freedom in our model to focus on the dynamics of the vortex and avoid complex and potentially chaotic interplay of the vortex with the planet \citep{lega-etal-2021}. For the same reason of simplicity, we neglect planetary accretion in our models. \subsection{Numerics} \label{sec:numerics} We use two different codes for our numerical models: \texttt{PLUTO 4.2} \citep{mignone_pluto:_2007}, a finite-volume, energy-conserving, shock-capturing code that treats transport by solving the Riemann problem across the interfaces of adjacent cells in both directions ($r$, $\phi$) in an unsplit fashion, and our custom \texttt{FARGO} \citep{masset_fargo:_2000} version, \texttt{FargoCPT} \citep{rometsch_migration_2020}, which uses a finite-difference, dimensionally-split, second-order upwind method for gas advection. Both codes utilize the FARGO method \citep[implemented into \texttt{PLUTO} by][]{mignone_conservative_2012}, in which orbital advection is essentially performed via the Keplerian rotation on top of which the code solves for the residual velocity deviations, significantly relaxing timestep limitations and reducing numerical dissipation in the process \citep{masset_fargo:_2000}. The inherent differences between the two numerical schemes make it worthwhile to carry out our simulations using both codes, to verify the robustness of our results and test for numerical convergence. Namely, the strictly energy-conserving nature of \texttt{PLUTO} and the necessity for artificial viscosity to stabilize \texttt{FargoCPT} are discussed in more detail in Sect.~\ref{sec:fargo-vs-pluto-differences}, among others. \subsubsection{Grid setup} \label{sec:grid-setup} Our computational domain spans the full azimuthal extent and a radial range of $r\in[0.2, 5.0]\,r_\mathrm{p} = [1.04, 26.0]\,\mathrm{au}$, with square cells logarithmically spaced so that the cell aspect ratio is preserved. After carrying out a thorough investigation on the effects of our numerical resolution of the recovery of both radial and azimuthal features caused by the planet, we decide to execute our simulations using a resolution of 8 and 16 cells per scale height (hereafter ``cps'') in both directions ($r$, $\phi$). Because we use a constant aspect ratio together with a logarithmically spaced radial grid, the resolution in cps is constant throughout the domain. At this resolution, the two codes reach good convergence in terms of the presence and contrast of features shaped by the planet and results agree between the codes. This translates to a fiducial resolution of $(N_r, N_\phi) = (528, 1024)$ cells for 8 cps, or $(1056, 2048)$ cells for 16 cps. In addition, using the same resolution in both directions in terms of cps ensures that the effects of numerical viscosity are isotropic (see Appendix~\ref{sec:appendix-grid-resolution}). \subsubsection{Initial and boundary conditions} \label{sec:initial-boundary-conditions} Our disk is initially axisymmetric and in equilibrium in the radial direction, such that the initial radial velocity profile results a constant accretion rate through the disk. The azimuthal velocity is close to the Keplerian profile, with the correction due to the radial pressure gradient. The initial surface density and temperature profiles are simple power laws such that \begin{equation} \label{eq:initial-profiles} \Sigma_0(r) = 222\,\mathrm{g}/\mathrm{cm}^2\, \left(\frac{r}{r_\mathrm{p}}\right)^{-1/2},\quad T_0(r) = 120.7\,\mathrm{K}\, \left(\frac{r}{r_\mathrm{p}}\right)^{-1}, \end{equation} with $r_\mathrm{p} = 5.2\,\mathrm{au}$. This temperature profile translates to a disk with a constant aspect ratio $h(r)=H/r = 0.05$. While the general consensus is that protoplanetary disks are flared (i.e., the aspect ratio increases with distance, see for example \citet{dullemond-2000}), we choose to use a constant aspect ratio since the behavior and lifetime of vortices depends on this quantity \citep{hammer_which_2021}. Thus, we can isolate the dependence of vortices on the physical and numerical parameters in our suite of simulations. The radial and azimuthal velocity components at $t=0$ are then \begin{equation} \label{eq:initial-velocities} u_r(r) = -\frac{3}{2}\frac{\nu}{r},\quad u_\phi(r) = r\Omega_\mathrm{K}\sqrt{1-1.5\,h^2} \end{equation} Near the boundaries, within the radial extent $r\in[0.2,0.25]\cup[4.2,5.0]\,r_\mathrm{p}$, the surface density and velocity are both damped to their initial profiles (see Eqs.~\eqref{eq:initial-profiles}, \eqref{eq:initial-velocities}) using the method of \cite{de_val-borro_comparative_2006}, over a damping timescale of 0.3 periods at the respective boundary. While the radial boundary edges are closed, this minimizes the reflection of spiral waves back into the computational domain. The boundaries are periodic in the azimuthal direction. We then embed a Jupiter-sized planet ($M_\mathrm{p} = 1 \text{M}_\mathrm{J} = 10^{-3} M_\star$) in most models, with some simulations instead containing a less massive planet of $M_\mathrm{p} = 0.5\,\text{M}_\mathrm{J}$. To smoothly introduce the planet into the disk, we typically allow the planet to grow over 100 orbits at $r_\mathrm{p}$ using the formula by \cite{de_val-borro_comparative_2006}. The importance of the growth timescale and planet mass will be discussed in Sect.~\ref{sec:results}. \subsection{Vortex Detection} \label{sec:vortex_detection} We use the gas vortensity \begin{align} \label{eqn:vortensity_definition} \varpi = \frac{(\nabla\times\vec{u}) \cdot\hat{z}}{\Sigma}, \end{align} where $\hat{z}$ is the unit vector in the vertical direction, as a proxy to detect and track the evolution of vortices over hundreds of snapshots for every model. Since these vortices consist of anticyclonic motion, the center of a vortex corresponds to a local minimum in vorticity, $\omega = (\nabla\times\vec{u}) \cdot\hat{z}$. Because vortices tend to accumulate mass towards their center and $\Sigma$ is enhanced inside the vortex, the transition from the background flow to the vortex region is stronger and the vortex is more easily identified in a map of $\varpi$ than in the case of $\omega$ alone. More precisely, we use the gas vortensity normalized by the background vortensity from the initial conditions, $\varpi_0 = (\nabla\times\vec{u}_\text{K}) \cdot\hat{z} \,/\,\Sigma_0$. This eliminates the radial dependence of the Keplerian velocity and the disk's surface density and ensures that our vortex proxy quantity, $\varpi/\varpi_0$, is of order unity everywhere in the disk except for the gap region, due to its very low surface density. The quantity $\varpi/\varpi_0$ usually varies between -1 for strongly counter-rotating vortices to 1 for the background flow. We use our new Python module, called \texttt{Vortector}, that extracts iso-vortensity contours using the computer vision library \texttt{OpenCV} \citep{opencv_library} to detect vortex candidates and then fits a 2D Gaussian to the vortensity and surface density data. The FWHM (or $2.355\sigma$) of this Gaussian is used to define the radial and azimuthal extent of a vortex. Using this method, we also extract information about the shape of the vortex, including its radial and azimuthal extent and the mass it encloses. A more detailed description can be found in Appendix \ref{sec:vortector}. This automated process has the drawback of sometimes producing detection artifacts, as can be seen for example on Fig.~\ref{fig:ts_rampup} below (top panel, dashed orange line), such that the vortex size (and thus its mass) is overestimated near the end of its lifetime as it blends into the disk background. While this effect is partly counteracted by using a median filter in time, we do not manually edit the output of the \texttt{Vortector} on a model-by-model basis. \vspace{1cm} In the following three sections, we present the results of our simulations. First, we present a typical example of vortex formation and evolution (Sect.~\ref{sec:lifetrack}). We then go on to describe the dependence of vortices on physical parameters for the group of vortices with short and intermediate lifetime (Sect.~\ref{sec:results}). Finally, long-lived and migrating vortices are presented (Sect.~\ref{sec:long-lived}). \section{Typical life track of a vortex} \label{sec:lifetrack} \begin{figure*}[t] \centering \includegraphics[width=\textwidth]{vortex-heatmap-example-twocol-fargo.pdf} \caption{Multiple snapshots of the $\alpha=10^{-5}$, $\beta=1$, 8~cps model showcasing the vortex merging process during the early stage of gap opening, the resulting vortex's fully grown size and its subsequent decay. The surface density and vortensity contrast compared to their initial profiles is shown on the left and right panels, respectively. Time is quoted in units of planetary orbits. The horizontal line at $r=1.45\,r_\mathrm{p}$ serves to highlight the outward radial movement of those structures as the gap around the planet grows wider. The planet is located at $r=1\,r_\mathrm{p}$ and $\phi = 0$.} \label{fig:example-vortex-heatmap} \end{figure*} \begin{figure}[t] \centering \includegraphics[width=.5\textwidth]{Lovelace_profiles.pdf} \caption{Evolution of radial Lovelace parameter (see Eq.~\eqref{eqn:lovelace_parameter}) and $\Sigma$ profiles during vortex formation over the first 200 orbits of the sample case from Sect.~\ref{sec:lifetrack}. The vertical lines indicate the center of the plateau in $\mathcal{L}$ (estimated by eye) to guide the eye to the corresponding location of the $\Sigma$ profile. $\mathcal{L}$ is calculated as the azimuthal average at each radius. The dotted horizontal line in the bottom panel marks 10\% of $\Sigma_0$ which we define as the location of the gap edge.} \label{fig:lovelace-profiles} \end{figure} \begin{figure}[t] \centering \includegraphics[width=.5\textwidth]{ts_sample.pdf} \caption{Evolution of vortex properties for the showcase simulations presented in Sect.~\ref{sec:lifetrack}. The panels show, from top to bottom, the mass enclosed in the FWHM ellipse of the vortex fit, $M_\text{vort}$ in Jupiter masses, the radial location of the vortex, $r_\text{vort}$ and its FWHM, $\Delta r$, indicated by the shaded area, and the ratio between minimum vortensity inside the vortex and the azimuthal median of vortensity at the radial location of the vortensity minimum. A dotted vertical line indicates the time when the planet has reached its final mass. The curves are smoothed with a median filter which spans over the next and last 5 datapoints ($\pm50$~orbits at $r_\mathrm{p}$). The orange parts of the line in the bottom panel show the evolution of the vortensity prior to the ``birth'' and after the ``death'' of the vortex. } \label{fig:ts-sample} \end{figure} The Jupiter-sized embedded planet opens a deep gap in all of our simulations. Fig.~\ref{fig:example-vortex-heatmap} shows maps of $\Sigma$ (left) and $\varpi$ (right) normalized by their initial values at five timestamps during the vortex lifetime for a model with $\alpha=10^{-5}$, $\beta=1$, and a resolution of 8~cps performed with the \texttt{FargoCPT} code. Horizontal dotted lines at $r= 1.45\,r_\mathrm{p}$ are superimposed as a reference marking the final location of the vortex center. Here, four small-scale vortices (top row) first merge into two slightly larger vortices (second row) and then finally into one massive vortex (middle) that will last for a little over 1100 orbits. The vortex slowly decays over time, maintaining a large size (fourth row). In the later stages, the vortex is no longer present anymore (bottom row). The non-axisymmetric structure still visible exists due to the planet's spiral arm and is corotating with the planet. During the early gap opening process, the outer gap edge grows Rossby-wave unstable \citep{lovelace_rossby_1999} and several small-scale vortices form around it (top two rows). Fig.~\ref{fig:lovelace-profiles} shows radial profiles of the Lovelace parameter, $\mathcal{L}$, (top) and $\Sigma$ (bottom) at different timestamps during the vortex formation up until $t = 180$ orbits. The Lovelace parameter is defined as \begin{align}\label{eqn:lovelace_parameter} \mathcal{L} = \frac{S^{2/\gamma}}{\varpi} \end{align} with the entropy $S = P/\Sigma^{\gamma}$. The development of a maximum in $\mathcal{L}$, which is one condition for the onset of the RWI, is visible. Vertical lines at the center of the $\mathcal{L}$ maxima (as determined by eye) are added to both panels to guide the eye for a comparison of the location of the maxima in $\mathcal{L}$ and $\Sigma$ at each timestamp. The $\mathcal{L}$ maxima are located on the slope of the gap edge slightly inward of the $\Sigma$ maxima and coincide with the location of the small vortex centers. The maximum in $\mathcal{L}$ moves outward following the maximum in $\Sigma$ as the gap opens. This illustrates that the vortices form due to the RWI at the slope of the outer gap edge. In the absence of self-gravity, these small vortices then quickly merge together (within $\sim$$100$\, planet orbits) into a single large vortex that slowly moves outwards following the gap edge as the gap deepens and widens (third and fourth row in Fig.~\ref{fig:example-vortex-heatmap}). The surviving vortex then typically decays over $\sim$200--2000~orbits. The evolution of three vortex properties is illustrated in Fig.~\ref{fig:ts-sample}. It shows, from top to bottom, the mass $M_\mathrm{vort}$ enclosed within the FWHM ellipse of the 2D Gaussian fit to $\Sigma$, the location of the center of the vortex $r_\text{vort}$ and the radial FWHM width $\Delta r$ as the shaded area, and the vortensity at the vortex center normalized by the azimuthal median. The vertical dotted lines indicate the time when the planet reached its full mass (typically 100 orbits). A short phase of vortex formation is followed by a slow and steady decay process, as can be seen in the decrease of mass and radial size. Because the vortensity contribution of the anticyclonic vortex is negative, an increase in vortensity indicates a decay as well. The line in the bottom panel of Fig.~\ref{fig:ts-sample} is continued (in orange) for another 100 orbits after the vortex decayed according to our criterion presented below in Sect.~\ref{sec:results-lifetime}, to illustrate the return of the curve to 1, which corresponds to an azimuthally symmetric state. During its lifetime, the vortex can become as large as $\Delta r = 0.4\,r_\mathrm{p}$ (2\,au for $r_\mathrm{p} = 5.2\,\mathrm{au}$) with a typical vortex aspect ratio ($r\Delta\phi/\Delta r$) of 6-10. Its mass, $M_\text{vort}$, is typically some tenths of $M_\text{J}$ but can be as large as one $M_\text{J}$, with a surface density enhanced by a factor of up to 7 compared to the initial value. The vortices form around the location where the radial $\Sigma$ profile reaches 10\% of its initial value (see bottom panel of Fig.~\ref{fig:lovelace-profiles}), which we define as the gap edge similar to \citet{crida-etal-2006}. During their lifetime, most vortices tend to stick to this gap edge in the sense that their inner boundary, $r_\text{vort} - \Delta r /2$, roughly coincides with the gap edge location. For some models, we observe that the vortex detaches from the outer gap edge after several hundred orbits and starts migrating outward. These models will be discussed later in Sect.\,\ref{sec:long-lived}. \section{Dependence of vortex properties on physical parameters} \label{sec:results} Having described a typical lifetrack of a vortex in our simulations, we now present the effects of different physics and numerics on vortex lifetime, location, and impact on the overall disk structure. The model parameters are listed with the main results in Table~\ref{tab:lifetimes}. \subsection{Vortex lifetime} \label{sec:results-lifetime} \begin{figure*}[t] \centering \includegraphics[width=\linewidth]{lifetimes.pdf} \caption{Lifetime of vortices as a function of $\beta$ for 8 cps (left) and 16 cps resolution (right). Colors encode $\alpha$, and the different symbols denote the code and the inclusion of self-gravity. The solid lines help guide the eye and connect the lifetime averages between the two codes (without self-gravity) for each value of $\alpha$, where the two codes agree sufficiently. For parameters where there is a difference between the codes, dashed and dotted lines connect to the datapoints of the \texttt{FargoCPT} and \texttt{PLUTO} runs, respectively. A ``$\mapsto$'' next to a symbol marks models that were terminated due to runtime constraints but still contain an active vortex. The horizontal gray line in the right panel indicates the top of the y-axis of the left panel. A list of all vortex lifetimes shown here is provided in Table~\ref{tab:lifetimes}. } \label{fig:masterplot} \end{figure*} We define the vortex lifetime as the time difference between its ``birth'' and ``death'' by analyzing the ratio of $\varpi$ to the azimuthal median value, $\tilde{\varpi}$ as a function of time. The normalization with $\tilde{\varpi}$ instead of $\varpi_0$ is done to eliminate the $\varpi$ evolution of the background disk due to changes in $\Sigma$ and radial pressure gradients, which affect $(\nabla \times \vec{u}) \cdot \hat{z}$ by changing the azimuthal velocity. The ``birth'' is identified as the time when $\varpi/\tilde\varpi$ drops from its initial value of 1 (for an axisymmetric disk) down to lower values (see bottom panel of Fig.~\ref{fig:ts-sample}). Because $\varpi/\tilde\varpi$ drops already for small vortices, the lifetime also includes the stage where there are multiple small vortices (see Sect.~\ref{sec:lifetrack}). The ``death'' of the vortex, however, is less obvious to identify. At this stage, $\varpi/\tilde\varpi$ usually slowly rises back to the background disk's value. Usually, there is a ``knee'' visible in $\varpi/\tilde\varpi$ at or slightly after the point in time where the vortex dies and where $\varpi$ approaches the background flow (see the orange part of the line in the bottom panel of Fig.~\ref{fig:ts-sample} where $\varpi/\tilde\varpi$ is continued for another 100~orbits after the vortex disappeared at $t = 1250\,\mathrm{orbits}$). For some models, this ``knee'' is not visible, and we manually inspect the 2D contour plots of $\varpi/\tilde\varpi$ and identify when no closed iso-value lines (with spacing in $\varpi/\tilde\varpi$ of 0.05) are present anymore. As an additional measure for less obvious cases, we analyze the gas streamlines at different timestamps. In our models, the drop in $\varpi/\tilde\varpi$ happens in a matter of tens of orbits. A conservative estimate for the uncertainty of this ``birth'' time measurement is 50 planetary orbits. From applying the manual method to models where the ``knee'' exists in the $\varpi/\tilde\varpi$ curve (implying the ``death'' of the vortex), we estimate a conservative uncertainty to be 100 planetary orbits. This leaves a total uncertainty of 150 planetary orbits for the lifetime of our vortices. The lifetime of vortices in our grid of simulations is shown as an overview in Fig.~\ref{fig:masterplot}. The left and right panels show vortex lifetimes as a function of $\beta$ for 8 and 16~cps, respectively. The viscous $\alpha$ is encoded in color, and the symbol indicates the simulation code and the inclusion of self-gravity. For each value of $\alpha$ and $\beta$, we calculated the average (``avg(f,p)'') between the two codes (not including the self-gravity models) when the results are close together. The solid-colored lines connect the averages to help visualize the trends. For parameters for which the two codes showed different vortex lifetimes, we added separate lines connecting the average to the \texttt{FargoCPT} and \texttt{PLUTO} results to highlight the differences. Lifetimes range from some hundred to 2000 orbits for the shorter-lived vortex group up to at least 15\,000~orbits for the long-lived vortices discussed later in Sect.~\ref{sec:long-lived}. The most prominent features of the distribution are the trend of decreasing lifetime with increasing $\alpha$ and the minimum of vortex lifetime at $\beta=1$ for low $\alpha$ and high resolution. In the following sections, we address the influence of our model parameters on vortex lifetime. \subsection{Influence of the thermal relaxation timescale} \label{sec:lifetime-beta} The dimensionless thermal relaxation timescale $\beta$ has a strong effect on vortex lifetime. For $\alpha = 10^{-4}$, lifetimes are of the order of several hundred to 1000~orbits with a downward trend as $\beta$ increases. Vortex lifetimes are shortest for $\beta=1$ (around 1250~orbits) and increase towards both sides to around 2000~orbits for $\beta = 100$ and to values of the order of 10\,000~orbits for $\beta=0.01$, high-resolution runs. This decrease in lifetime for non-isothermal disks is consistent with the results of \citet{tarczay-nehez_vortex_2020}. Exceptions to this trend are the 8-cps \texttt{PLUTO} models for $\alpha=10^{-5}$--$10^{-6}$ and $\beta=100$. We could not identify the reason why the two codes did not agree for these parameters, but we note that the two codes match well once again for 16~cps in the same configurations. Models with very long vortex lifetimes will be analyzed later in Sect.~\ref{sec:long-lived}. \citet{fung_cooling-induced_2021} reported a similar trend in vortex lifetime in two-dimensional shearing-box simulations without planets, in which the vortex was introduced by initializing the simulation with a radial density bump. They found that vortex decay is fastest for intermediate $\beta$ in the range 1--10, but their disk model assumes a constant background disk, without gradients in $T$ and $\Sigma$ which change baroclinic effects. Our results indicate that a similar mechanism might be at play in the presence of an embedded planet with strong spiral arm shocks. However, the strong enhancement of vortex lifetime for $\beta = 0.01$ hints at the presence of an additional mechanism which keeps the vortices alive. We discuss these hypotheses further in Sect.~\ref{sec:vortex-conditions}. For a comparison of vortex evolution at different $\beta$ see Fig.~\ref{fig:ts_beta}, where the evolution of vortex properties (analogous to Fig.~\ref{fig:ts-sample}) of three \texttt{FargoCPT} simulations at 8~cps resolution with $\beta = 0.01, 1, 100$ is shown. \begin{figure}[t] \centering \includegraphics[width=0.5\textwidth]{ts_beta.pdf} \caption{Evolution of vortex properties for varying values of the thermal relaxation $\beta$ parameter. The panels are as in Fig.~\ref{fig:ts-sample}. Shown are models run with the \texttt{FargoCPT} code with $\alpha = 10^{-5}$ and at 8~cps resolution (orange ``f8'' dots in Fig.~\ref{fig:masterplot}). \label{fig:ts_beta} } \end{figure} The absolute radial location of vortices varies with $\beta$, as well. This is due to the tendency of the vortices to form and subsequently stick to the outer planet gap edge and the gap opening process being strongly influenced by $\beta$. \citet{miranda-rafikov-2020b} showed that ``extreme'' values of $\beta$ (i.e., $\beta\rightarrow0$ or $\beta\rightarrow\infty$) result in narrower planet-opened gaps but additional gaps in the inner disk, whereas intermediate values of $\beta\sim 0.1$--10 lead to a single, wide gap around the planet's orbit. In our simulations, models with $\beta=0.01$ show the widest gaps, narrower gaps are present for $\beta=1$, and $\beta=100$ models showed an even slightly narrower gap. This is reflected in the vortex locations which are further in for higher $\beta$ (see the center panel of Fig.~\ref{fig:ts_beta}). The difference to \citet{miranda-rafikov-2020b} might be due to the presence of the vortex. \subsection{Planet growth timescale} \begin{figure}[t] \centering \includegraphics[width=0.5\textwidth]{ts_rampup_shifted.pdf} \caption{Influence of the planet introduction time on the evolution of vortex properties. The panels are as in Fig.~\ref{fig:ts-sample}. Solid and dashed lines show models with a $\tau_\mathrm{ramp} = 100\,\mathrm{orbits}$ and $1000\,\mathrm{orbits}$, respectively. The $\tau_\mathrm{ramp} = 100\,\mathrm{orbits}$ curves are shifted to the right (see the horizontal lines) to illustrate that the curves have the same shape in the decay phase, independent of $\tau_\mathrm{ramp}$. Note that the final evolution of the vortex, after it has reached its minimum in vortensity, is the same independent of planet introduction time. \label{fig:ts_rampup} } \end{figure} \cite{hammer_slowly-growing_2017} observed that the lifetime of planet-induced vortices can depend on the timescale over which the planet mass is increased in order to introduce the planet into the simulation. They found that vortex lifetime decreased with a longer planet growth time. In our models, increasing the planet growth timescale from 100 to 1000 orbits caused vortices to live longer by 470 for $\beta=1$ up to 1900 orbits for $\beta=0.01$. Fig.~\ref{fig:ts_rampup} shows the evolution of vortex quantities comparing the \texttt{FargoCPT} runs with a $\tau_\mathrm{ramp} = 100\,\mathrm{orbits}$, already presented in Fig.~\ref{fig:ts_beta}, with their respective counterparts with $\tau_\mathrm{ramp} = 1000\,\mathrm{orbits}$. The curves of runs with $\tau_\mathrm{ramp} = 100\,\mathrm{orbits}$ are shifted to the right by a time $\Delta t$ from 470 to 1900 orbits. This shift clearly illustrates that the decay of these vortices is almost the same for both values of $\tau_\mathrm{ramp}$ in terms of their mass, location and vortensity curves. The only difference caused by the planet injection timescale is how long it takes for the vortex to reach the turnover point, after which it starts to decay. \subsection{Planet mass} \label{sec:results_planet_mass} From our $M_\text{p} = 0.5\,\text{M}_\text{J}$ models we can not draw any conclusions regarding the dependence of vortex lifetime on planet mass, because for the set of parameters, $\beta=0.01$ and $\alpha=10^{-5}$, the vortices are long-lived outliers like the ones discussed in Sect.~\ref{sec:long-lived}. However, the location of the vortex is also influenced by the planet's mass. Lower-mass planets open narrower gaps and cause the location of the vortex, given that this is linked to the gap edge's location, to be further in compared to more massive planets. In our models, the vortices in the $M_\text{p} = 0.5\,\text{M}_\text{J}$ were located $\sim 0.15\,r_\mathrm{p}$ closer to the star. \subsection{Viscosity} \label{sec:viscosity} The observed vortex lifetime typically increases with lower values of $\alpha$. Simulations with $\alpha = 10^{-3}$ show only small vortices forming. They disappear within 100 orbits, thus, they are already gone by the time the planet has grown to its full mass. For models with $\alpha=10^{-4}$, we observe vortex lifetimes of up to around 1000 orbits. Simulations with a lower viscosity ($\alpha=10^{-6}$--$10^{-5}$) show even longer lifetimes, usually in the range between 1000 and 2000 orbits, excluding the outliers that we discuss later in Sect.~\ref{sec:long-lived}. For this range of $\alpha$, vortices usually have similar lifetimes for simulations sharing the same $\beta$ value. For an example, see Fig.~\ref{fig:ts_viscosity} which shows, from top to bottom, the evolution of the mass enclosed in the vortex's region (FWHM), the location and radial extent (in FWHM) of the vortex as determined by the surface density fit, and the ratio of normalized vortensity to the azimuthal median of the latter at the location of the vortex. The vortex location is not influenced by viscosity. Although the gap opening time is $t_\mathrm{gap} \approx 2700 \left(\frac{\alpha}{10^{-3}}\right)^{-3/2}\,T_\mathrm{orb}$ according to the estimate in \cite{kanagawa_modelling_2017}, the bulk of the gas in the planet's vicinity is cleared within the first few hundred orbits. During this time, $\Sigma$ is lowered by two orders of magnitude within the gap region, and the radial gradient of $\Sigma$ becomes steep enough to facilitate vortex formation. \begin{figure}[t] \centering \includegraphics[width=0.5\textwidth]{ts_viscosity.pdf} \caption{Evolution of vortex properties for varying values of $\alpha$. Panels are shown as in Fig.~\ref{fig:ts-sample}. Shown are models run with the \texttt{FargoCPT} code with $\beta=1$ and at 8~cps resolution. The $\alpha=10^{-3}$ run is excluded because no vortex forms. In addition, a run with disk self-gravity enabled is added for the $\alpha=10^{-5}$ case. The similarity between simulations with $\alpha=10^{-5}$ and $10^{-6}$ is apparent. \label{fig:ts_viscosity} } \end{figure} \subsection{Self-gravity} \label{sec:selfgravity} Several studies showed that vortices in weakly or strongly self-gravitating disks might not grow as large because small vortices do not merge into one large vortex \citep{lin_effect_2011} and dissipate more rapidly due to stretching in the azimuthal direction \citep{lovelace_rossby_2013,regaly_vortex_2017,zhu_gas_2016}. This can be the case even for low-mass disks as long as the Toomre stability parameter $Q$ is lower than 50 or $h Q \leqslant \frac{\pi}{2}$. For the choice of parameters in our models, the Toomre parameter is $Q\approx25\,(r/r_\mathrm{p})^{-3/2}$ ($hQ \approx 1.25\,(r/r_\mathrm{p})^{-3/2}$), dropping under 5 at roughly $r/r_\mathrm{p}=2.8$. To check the effect that disk self-gravity has played in our models, we ran additional simulations with \texttt{FargoCPT} with self-gravity activated for all three values of $\beta = 0.01, 1, 100$ and for $\alpha = 10^{-5}$. The lifetimes of vortices in these simulations are shown in Fig.~\ref{fig:masterplot} as the rightmost datapoint in each column (models ``f8sg''). An example evolution of their properties is shown in Fig.~\ref{fig:ts_viscosity}. Self-gravity inhibits the merging of the small initially formed vortices in to one large vortex. Instead, two smaller vortices usually remain until they decay. This leads to a significantly shorter lifetime compared to the analogous simulations without self-gravity, consistent with the above studies. This, however, does not apply to the long-lived, migrating vortices which are discussed in Sect.~\ref{sec:long-lived}. Fig.~\ref{fig:ts_viscosity} shows that the center of the vortex in a model with self-gravity and $\beta=1$ is further in compared to its non-self-gravitating counterpart. This is due to a smaller radial extent of the vortex in the run with self-gravity and the tendency of the inner edge of each vortex to coincide with the gap edge. Because self-gravity does not noticeably change the radial disk profile for the mass regime of our models, the inner edge of the vortices is at the same location, independent of whether self-gravity is included or not. The same effect is also observed for $\beta = 0.01$ and $\beta = 100$. \section{Long-lived and migrating vortices} \label{sec:long-lived} \begin{figure}[t] \centering \includegraphics[width=0.5\textwidth]{ts_outliers.pdf} \caption{Selection of models with long-living and migrating vortices at 16~cps resolution for the two different codes. Both codes agree remarkably well for the blue and orange cases. The panels are as in Fig.~\ref{fig:ts-sample}. In models shown here, $\beta=0.01$. The values of $\alpha$, resolution and code used are indicated in the legend. \label{fig:ts_outliers} } \end{figure} \begin{figure*}[th] \centering \includegraphics[width=\textwidth]{1D-gap-edges.pdf} \caption{Azimuthally averaged surface density profiles as a function of different physical ($\alpha$, $\beta$) and numerical (cps) parameters at two different timestamps. The peak around $r/r_\text{p}=1.5$--$1.6$ corresponds to the pressure bump formed by the planet as the latter pushes material away, forming a gap around its orbit. The smaller, secondary peak at around $r/r_\text{p}=2.1$ is caused by the vortex that forms near the ``primary'', planet-generated bump. Top: radial profiles at $t=1000$~orbits. At this stage, all models pictured feature a vortex near the primary bump. We note the absence of a secondary bump for the models with $\beta=1$. Bottom: the same profiles at $t=5000$ orbits. Here, the primary bump has moved radially outwards as the planet's gap gets deeper and wider. We highlight the depletion of gas near the ``primary'' pressure bump for the second panel from the left ($\beta=0.01$). This is caused by the combination of a vortex migrating outwards to the secondary bump, and the inability of the planet to resupply that zone with material from its now-depleted gap region. Also note the difference between resolutions of 8 and 16~cps (dashed and solid lines), especially for the $\beta=100$ models and the $\beta = 0.01,\,\alpha=10^{-5}$ model (the evolution of this model is shown as the orange line in Fig.~\ref{fig:ts_outliers}).} \label{fig:gap-edges} \end{figure*} In some of the cases, a much longer-lived vortex is observed. In these models, vortices stay close to their peak mass for several thousand orbits and, in some cases, migrate outwards after having stayed at the planet gap edge. This happens only for very low viscosities ($\alpha\leq10^{-5}$) and $\beta = 0.01$ or locally isothermal simulations ($\beta \to 0$). For our standard $M_\text{p}=1\,\text{M}_\text{J}$ planets, the long-lived outliers appear only at the highest resolution of 16~cps but not at 8~cps. For the corresponding $M_\text{p}=0.5\,\text{M}_\text{J}$ model, the long-lived vortex also appeared at 8~cps. Spiral arms launched by the vortex are clearly visible for these long-lived large vortices (see Fig.~\ref{fig:vortector_overview}). They are more pronounced for lower values of $\alpha$. Figure~\ref{fig:ts_outliers} shows the evolution of vortex properties for a selection of models to highlight the observed behavior. The most prominent example is the model with $\alpha=10^{-5}$, $\beta = 0.01$ and a 16~cps resolution. The vortex in those runs lived for 15\,100 orbits before we terminated the two simulations due to their long runtime. Both codes, \texttt{PLUTO} and \texttt{FargoCPT}, agree well for the long-lived cases. Specifically, they are in exceptionally close agreement for $\alpha=10^{-5}$ and only differ at later stages for $\alpha=10^{-6}$ (see orange and blue lines in Fig.~\ref{sec:long-lived}). We do not currently fully understand the mechanism that allows these long-lived vortices to sustain themselves for such long timescales. We attempt to provide a speculative explanation in Sect.~\ref{sec:vortex-conditions}. For $\beta \not=1$, a secondary radial density and pressure bump is observed in the outer disk. This is the result of the vortex generating spiral arms which transport angular momentum. Radially outwards, this results in the accumulation of mass in a second bump (see panels for $\beta \not= 1$ in Fig.~\ref{fig:gap-edges}). This does not happen for $\beta = 1$ due to the less efficient angular momentum transport by spiral arms for this intermediate value of $\beta$ \citep{miranda-rafikov-2020b}. For $\beta = 0.01$, some models show vortices migrating radially outwards (e.g., the $\alpha=10^{-6}$ models in Fig.~\ref{fig:ts_outliers}). This is likely related to the formation of the secondary bump outside of the vortex location (see Fig.~\ref{fig:gap-edges}) and the fact that vortices typically migrate towards pressure bumps \citep{paardekooper_vortex_2010}. For vortices that migrate far enough outside, which only happens for $\beta=0.01$, a weaker secondary vortex appears between them and the planet's gap edge (see Fig.~\ref{fig:vortector_overview}). These secondary vortices then decay over a few hundreds of orbits, already having decayed by the time the ``primary'' vortex disappears. While they are treated as independent entities, they are not included in Fig.~\ref{fig:masterplot} or the discussion above. Their occurrence is likely the result of a multistage process which begins with the secondary bump forming and the ``primary'' vortex migrating radially outwards towards it and meanwhile supplying mass towards the planet-generated gap edge. This then feeds the emerging ``secondary'' vortex. \section{Discussion} \label{sec:discussion} In this section, we address some ways in which our results could be interpreted and their relevance in explaining observations. We also underline some caveats of our models. \subsection{On the conditions to form and sustain a vortex} \label{sec:vortex-conditions} To form a vortex, one needs to create a local vortensity extremum. In the absence of non-conservative forces, the evolution equation for the vortensity in a two-dimensional flow reads \begin{align}\label{eqn:vortensity} \frac{\partial \varpi}{\partial t} + \vec{u}\cdot \nabla \varpi = \frac{\nabla \Sigma \times \nabla P}{\Sigma^3} \cdot \hat{z} + \mathcal{V} = \mathcal{B} + \mathcal{V} \end{align} where $\mathcal{B} = \frac{\nabla \Sigma \times \nabla P}{\Sigma^3} \cdot \hat{z}$ is the baroclinic term and $\mathcal{V}$ describes viscous diffusion of vortensity which can lead to vortex decay. As outlined in the introduction, several instabilities have been discovered that provide a mechanism to form or destroy large-scale vortices, but they all fundamentally rely on Eq.~\eqref{eqn:vortensity} to change the vortensity of the flow. The mechanism responsible for the formation of the vortex in our simulations is most likely the RWI which is triggered during the gap opening process, as we demonstrated in Sect.~\ref{sec:lifetrack} and Fig.~\ref{fig:lovelace-profiles}. To check whether vortices can only form during the gap opening process and not in the quasi-steady state after the bulk of the gas has been pushed out of the gap region, we removed the long-lived vortex from the $\alpha=10^{-5}$, $\beta=0.01$, 16~cps model by replacing the velocities and $\Sigma$ with their azimuthal median values for $r>r_\mathrm{p}$ during the peak of its activity ($t=1880$ orbits). The fact that there is no vortex forming again is an indication that the formation of vortices in our simulations depends on the gap opening process to produce conditions that can trigger the RWI. This is also backed by the observation that the peak in $\mathcal{L}$ is strongest for an intermediate time, $t=70$~orbits, during the gap opening process, after which the maximum disappears and a plateau in $\mathcal{L}$ forms. Vortex decay happens due to at least two mechanisms. Viscous spreading attacks the vortices for high $\alpha = 10^{-4}$--$10^{-3}$, as illustrated by the trend of lower vortex lifetime for higher $\alpha$, and vortex stretching due to self-gravity effects additionally limits vortex lifetime if it is considered \citep{lin_effect_2011, zhu_gas_2016, regaly_vortex_2017}. For sufficiently low $\alpha$, another process that depends on $\beta$ starts to be dominant. We do not fully understand the mechanism but we observed some similarities to the recent work by \citet{fung_cooling-induced_2021}. They found that, in their simulations, vortices decay the fastest for $\beta = 1$--$10$ and decay slower for both smaller and larger $\beta$. Vortex lifetime in their simulations changed by up to an order of magnitude depending on $\beta$. We also find a minimum in vortex lifetime for $\beta = 1$ with lifetimes increasing as $\beta \not= 1$. \citet{fung_cooling-induced_2021} explained the decay mechanism by asymmetries in the structure of $\mathcal{B}$ around the vortex center, which they found to be quadrupolar (see their Fig. 6) and to change with $\beta$. We also find asymmetries in the structure of $\mathcal{B}$, however our simulations differ from theirs in some fundamental aspects. Our simulations are global with radially varying $\Sigma$ and $T$ profiles and include a planet that continually perturbs the disk, whereas their simulations consider a local shearing sheet with a constant background $\Sigma$ and $T$, with only an initial perturbation in the form of a density bump. As a consequence of the radially varying $T$ in our simulations, the structure of $\mathcal{B}$ around the vortex center is dipolar in the azimuthal direction, as can be expected for a Gaussian-like density maximum. Additionally, the planetary spiral arms strongly influence $\mathcal{B}$. Figure~\ref{fig:baroclinic} shows a 2D map of $\mathcal{B}$ for two simulations with $\alpha=10^{-5}$ and 16~cps resolution. The left panels show a short-lived vortex with $\beta=1$ at $t=1000$~orbits and the right panels show the long-lived vortex model which exhibits the ``secondary'' vortex (see Sect.~\ref{sec:long-lived} for a description and Fig.~\ref{fig:vortector_overview} for $\varpi$ and $\Sigma$ maps at the same time). The actual shape of the perturbation of $\mathcal{B}$ inside and around the vortex varies in time because it depends on the phase w.r.t.~to the spiral arm. It is not clear to us, at the moment, how the changes in structure of $\mathcal{B}$ lead to the change in vortex decay and how this proposed mechanism depends on the various parameters in our system. \begin{figure}[t] \centering \includegraphics[width=.5\textwidth]{baroclinic.pdf} \caption{ Baroclinic term (RHS of Eq.~\eqref{fig:baroclinic}) in the outer disk for a short-lived model ($\beta = 1$ at $t=1000$~orbits) and a long-lived vortex ($\beta = 0.01$ at $t=7150$~orbits, see also Fig.~\ref{fig:vortector_overview}) with $\alpha=10^{-5}$ and 16~cps resolution on the left and right side, respectively. The top row shows maps of the baroclinic term with the detected vortices indicated with green ellipses as obtained from the $\Sigma$ fit. The bottom row shows the radial $\Sigma$ profile in orange, the azimuthally averaged baroclinic term in blue and the region between its minimum and maximum shaded in gray. } \label{fig:baroclinic} \end{figure} The long-lived group of vortices for low $\beta$ (see Sect.~\ref{sec:long-lived}) indicates that there might be another vortex formation mechanism at play. Given that the RWI already caused finite perturbations in the disk and our disks exhibit a radial entropy gradient, the SBI \citep{klahr_turbulence_2003,lesur_subcritical_2010} seems to be a natural candidate. However, we verified that the SBI is not active in our disks by analyzing the Richardson number, the ratio of the buoyancy (also called Brunt-Väisälä) frequency to the shear rate, which needs to be negative in a radially extended region over the full azimuth of the disk for the SBI to operate. The Richardson number in our simulation is positive, except for narrow stripes following the spiral arms, which rules out that the SBI is active. To rule out that the difference in lifetime is a result of the initial vortex formation during gap opening, we took the long-lived vortex out of the $\alpha=10^{-5}$, $\beta=0.01$, 16~cps model and inserted it into the $\alpha=10^{-5}$, $\beta=1$, 16~cps model. Although this artificial vortex has the same structure as in its original $\beta=0.01$ model, it decays over nearly the same time as the standard $\beta=1$ vortex. This is an additional indication that the difference in lifetime is caused by the dependence of the decay process on $\beta$ or a possible additional vortex formation channel that sustains the vortex at low $\beta$. This leaves us with the hypothesis that the interaction of the spiral arms with the vortices might play a major role in either slowing down vortex decay or providing an additional vortex formation channel. This hypothesis is motivated by the strong impact of the spiral arms on $\mathcal{B}$ and the dependence of spiral arm properties on $\beta$ \citep{ziampras-etal-2020b,miranda-rafikov-2020b}. Another contribution might be the vortensity jump across the spiral arm shock, which was recently illustrated to be important for the evolution of vortensity in the case of sub-thermal-mass planets \citep{cimerman_planet-driven_2021}. Providing an analysis of both mechanisms in our context is, unfortunately, out of the scope of the present explorative study. \subsection{Effect of in-plane radiation transport} \label{sec:FLD} It has been shown that parametrizing radiative effects with $\beta$ while omitting the effects of in-plane radiation transport can result in a potentially inaccurate radial surface density structure mainly in the inner disk and around the gap, due to the impact of $\beta$ on the capability of a planet to open multiple ``secondary'' gaps at $r<r_\mathrm{p}$ \citep{miranda-rafikov-2020b}. Here, we are not interested in the annular structures of the inner disk, so we chose to ignore in-plane radiation transport. Nevertheless, to check for possible effects of in-plane radiation transport on the vortex dynamics, we repeated the $\alpha=10^{-5}$, $\beta=1$ model at 8~cps. This time we included a flux-limited diffusion (FLD) approach \citep{levermore-pomraning-1981} similar to \citet{ziampras-etal-2020a}, but by parametrizing the diffusion coefficient $D_\mathrm{rad}$ following Eqs.~(12)--(14) of \citet{flock-etal-2017}: \begin{equation} \label{eq:cooling-timescale-diffusion} t_\mathrm{cool} \approx \frac{l^2_\mathrm{thin}}{3D_\mathrm{rad}} + \frac{H^2}{D_\mathrm{rad}} = \beta\Omega_\mathrm{K}^{-1} \Rightarrow D_\mathrm{rad} = \frac{\Omega_\mathrm{K}}{\beta}\left(\frac{l^2_\mathrm{thin}}{3} + H^2\right), \end{equation} where $l_\mathrm{thin}$ is the photon mean free path. We found that including FLD slightly changes the radial surface density structure in the inner disk as predicted by \citet{miranda-rafikov-2020b} and reduces the vortex lifetime from 1200 to 900 orbits. Studying the effect of in-plane radiation transport in more detail requires further investigation. \subsection{About the assumption of a 2D disk} One of the main limitations of our models is the 2D assumption which was done due to runtime constraints in our rather wide exploration of the parameter space. It is entirely possible that various 3D effects can result in quantitative differences in vortex properties. 3D vortices can be susceptible to the elliptical instability \citep{lesur_stability_2009} which would lower their lifetime. On the other hand, the vertical modes of the SBI could provide an additional channel to sustain the vortices, and vertical gas circulation due to the VSI might interfere with vortex growth and decay \citep{flock_gas_2020}. To estimate the impact of including full-3D effects, we ran one 3D simulation with \texttt{FARGO3D} \citep{benitez-llambay_fargo3d:_2016} using a setup analogous to our 2D setup. We chose $\beta=2\pi$, $\alpha=0$ and a resolution of 8~cps in all three directions. The simulation assumed symmetry about the midplane and covered four scale heights in the vertical direction. Similar to our 2D models, a large vortex formed at the outer gap edge and lived for 7000~orbits. This illustrates that while there are differences, large vortices can survive in 3D disk simulations for a long time, even longer than in 2D for our example. We limited the 3D runs to this one test because its runtime at 8~cps resolution was close to 4 months with the simulation performed on 4 NVIDIA K80 GPUs. \subsection{On the observability of vortices at large radii} Sect.~\ref{sec:lifetime-beta} illustrates that vortex lifetime is affected by the thermal cooling timescale $\beta$. The latter is expected to vary with radius in a disk, with values of 1--10 at 5\,au, 0.1 at $\sim$10\,au, and below 0.1--0.01 at $\sim$50\,au \citep{ziampras-etal-2020b}. Thus, we expect vortices to be in the short-lived regime close to the star and in the long-lived regime far from the star. From Fig.~\ref{fig:masterplot} we can estimate the lifetime of vortices in disks with $\alpha \leq 10^{-4}$ to be between 500 and 3000~orbits for $\beta \geqslant 1$ and between 1000 and 15\,000~orbits for $\beta < 1$ for $\alpha \leq 10^{-4}$. Assuming a solar-mass star, this yields estimated lifetimes for a planet-induced vortex between 6--30\,kyr at 5\,au, 175--700\,kyr at 50\,au, and 1--15\,Myr at 100\,au. On the basis of a simple lifetime-centered argument, our results, therefore, suggest that planet-induced vortices are more likely to be observed at larger radii. It should be noted, that planet growth timescales of 100 and 1000 planetary orbits are at the very low end of the spectrum of physically expected planet growth times. \citet{hammer_slowly-growing_2017} provided estimates for more realistic planet growth-times of several thousand up to tens of thousands of orbits. It remains to be seen, whether the effects observed in this study still appear for longer, more realistic, planet growth timescales. However, simulating the disks at the required resolution of at least 16~cps for longer planet growth times along with the additional vortex evolution time is still computationally expensive. \subsection{On using the lifetime of vortices in simulations to explain observations} \label{sec:vortex-lifetime} In the suite of simulations we carried out, the lifetime of vortices in models with identical physical parameters varies significantly with resolution. This was the case for low values of the viscous $\alpha$ parameter ($\alpha = 10^{-5}, 10^{-6}$). We argued that the numerical viscosity of our simulation codes is comparable to $\alpha_\text{num} \lesssim 10^{-5}$. This suggests that simulations with a prescribed viscosity of the order of the numerical viscosity cannot be used as a controlled numerical experiment, at least as far as the occurrence and persistence of vortices is concerned. For prescribed viscosities well above the estimated numerical viscosity ($\alpha = 10^{-4}$, $10^{-3}$ in our case), the consistency of vortex lifetimes between the two codes and numerical choices supports the idea that the numerical experiment is indeed a controlled one. Recent observations of molecular line broadening \citep[e.g.,][]{flaherty_turbulence_2018}, numerical studies of VSI turbulence \citep[e.g.,][]{flock-etal-2017} and planet--disk interaction \citep[e.g.,][]{zhang-etal-2018} point to low $\alpha$ values. The requirement of a numerical viscosity lower than the physical viscosity necessitates high resolution, which poses a challenge for simulations of vortices in protoplanetary disks. \subsection{Resolution and numerical viscosity} \label{sec:numerical-viscosity} Vortex evolution in ``inviscid'' disks is often studied using very high-resolution grids to minimize the effects of numerical viscosity \citep{li_potential_2005,paardekooper_vortex_2010,lin_effect_2011,zhu_gas_2016,hammer_slowly-growing_2017,mcnally_migrating_2019,hammer_which_2021, fung_cooling-induced_2021}. While the resolution of 8 and 16 cells per scale height is likely enough to resolve planet-generated features such as the gap shape and spiral arms (see Appendix~\ref{sec:appendix-grid-resolution}), the numerical viscosity also needs to be low enough not to interfere with vortex decay. An estimation of the numerical viscosity, valid for first-order schemes, is $\nu_\text{num} \sim \frac{\Delta x^2}{\Delta t}$, with a representative cell size $\Delta x$ and the timestep $\Delta t$. For our choices of parameters and assuming $\Delta t \approx \frac{\Delta x}{c_s}$ this corresponds to $\alpha_\text{num} \sim 10^{-2}$--$10^{-1}$. Clearly, we see substantial changes in dynamics down to much lower values of the prescribed $\alpha$. Because we employ a higher-order scheme, this simple estimate is not applicable. To our knowledge, there exists no formula to estimate the numerical viscosity for the higher-order schemes employed in this study, so we attempt to estimate it by comparing the results of our simulations at different values of $\alpha$. In general, we observe a similar behavior between models with $\alpha=10^{-5}$ and $10^{-6}$, both in terms of the behavior of vortices during their lifetime (size, mass, migration patterns) as well as the overall lifetime itself (see Fig.~\ref{fig:masterplot}). This is also true across both codes that we used in this study, with the exception of the 8~cps models for $\beta=100$. We attribute the similarity to the numerical diffusion inherent in the different advection schemes of the two codes and expect that this translates to an effective $\alpha_\mathrm{num}$ between $10^{-6}$ and $10^{-5}$ for our given choices of grid resolution. This implies that our experiments with $\alpha=10^{-6}$ are most likely not controlled ones, and for this reason, we typically group models with $\alpha\leq10^{-5}$ together. Nevertheless, we still observe a different behavior for some models with $\alpha=10^{-6}$ when comparing them to those with $\alpha=10^{-5}$, such as the migration of the long-lived models presented in Sect.~\ref{sec:long-lived} (see the different tracks of $r_\mathrm{vort}(t)$ in Fig.~\ref{fig:ts_outliers}), most of which have a 16~cps resolution. This hints at a lower numerical diffusion for 16~cps of $\alpha_\mathrm{num}\sim10^{-6}$. Because the numerical viscosity in the 8~cps models might interfere with the prescribed $\alpha\leq10^{-5}$, our 8~cps simulations might not be as trustworthy as our higher-resolution 16~cps, $\alpha\leq10^{-5}$ runs. \subsection{On the different numerics of the two codes} \label{sec:fargo-vs-pluto-differences} We used two codes (\texttt{PLUTO} and \texttt{FargoCPT}) with fundamentally different numerical properties. The fact that the two codes agree in terms of results (see the orange lines in Fig.~\ref{fig:ts_outliers} for one striking example) is reassuring, but it is worth discussing their differences nonetheless. \texttt{FargoCPT} requires an artificial viscosity prescription to stabilize the upwind method near regions of strong compression such as shocks. This provides additional dissipation which could affect the evolution of vortices whenever they interact with the spiral shocks induced by the planet. With the exception of the 8~cps models for $\beta=100$, we found no significant differences in vortex lifetimes between the two codes. The one case for which the codes disagreed might be a result of insufficient resolution because the differences disappear for 16~cps. On the other hand, \texttt{PLUTO}'s strictly energy-conserving nature means that the evolved quantity in the energy equation is the sum of kinetic and thermal energy. Since kinetic energy dominates over thermal in typical Keplerian flows (for our setup, $E_\mathrm{kin}/E_\mathrm{th}\approx \frac{\gamma-1}{2h^2} = 80$), numerical errors in the calculation of total energy could affect the thermal energy budget of the disk due to subtractive cancellation error. In order to check this effect, we reran our fiducial model using the \texttt{ENTROPY\textunderscore SWITCH} option of \texttt{PLUTO}, which ensures entropy conservation outside of the vicinity of shocks (which by definition do not conserve entropy, but are captured accurately by the Riemann solver). We found that this did not affect the life track of the generated vortex. Finally, we also reran the fiducial model with \texttt{PLUTO} using a 3rd-order solver and parabolic reconstruction instead of the standard 2nd-order solver and linear reconstruction setup. We found no differences in vortex evolution or lifetime. On the basis of our tests and the agreement of the codes for high resolution, we conclude that the vortex dynamics and effects we observed in our simulations are not numerical artifacts but that they are indeed physical. \section{Summary} \label{sec:summary} We studied vortices created by planets in protoplanetary disks using two-dimensional viscous hydrodynamics simulations. The equation of state was assumed to follow an ideal gas, turbulence was included following the $\alpha$ parametrization, and thermal processes were considered by prescribing a thermal relaxation timescale using the $\beta$ formalism. A focus was brought to vortices exterior to the gap opened by the planet. In order to verify our results, the simulations were carried out with both the \texttt{FARGO} and \texttt{PLUTO} codes which use different numerical schemes. The planet was treated as a non-accreting point mass with a smoothed gravitational potential and kept on a fixed circular orbit. Properties of vortices were automatically extracted using our newly-developed \texttt{Vortector} Python tool, which identifies and characterizes vortices. Vortex identification was performed by looking for elliptical shapes in iso-vortensity lines in the $r$-$\phi$ plane, and characterization was performed by fitting a 2D Gaussian to the vortensity and surface density. Vortices formed during the gap opening process as the embedded Jupiter-mass planet was introduced into the simulation. At the outer gap edge, multiple small vortices formed that usually merged into a single large vortex that lived, depending on parameters, between 200 and several thousand orbits. These vortices had a full width at half maximum (as determined by the fitted 2D Gaussian) of up to $0.4\,r_\mathrm{p}$ (several au for a planet at $r_\mathrm{p}=5.2$\,au). The mass enclosed in this vortex area was up to one planetary mass (one Jupiter-mass in our models) for our choice of disk mass. Vortex lifetime depended on the thermal relaxation timescale such that vortices lived shortest for intermediate cooling times ($\beta = 1$), a result also found by \citet{fung_cooling-induced_2021}. We found two regimes for the vortices' lifetimes. A short-lived regime, with vortex lifetimes of up to 3000 orbits, was observed for slowly-cooling disks ($\beta \geq 1$), in which the vortices decayed faster than expected from viscous dissipation alone. In the long-lived regime, which was observed for fast cooling ($\beta \ll 1$) with the isothermal assumption as an extreme, vortices lived for a much longer time and did not decay rapidly. Vortex lifetimes were considerably longer in this regime, with a lower bound on the maximum lifetime being 15\,000 orbits (the model was terminated while the vortex was still alive due to runtime constraints). From our analysis, we suspect that the long lifetime for small $\beta$ is connected to the interaction of the vortex with the spiral arms, which are a source of vorticity. Details are left to future studies. Additionally, including the disk's self-gravity in our models, with a Toomre parameter $Q \approx 25$, usually shortened the lifetime of vortices and stopped the small initial vortices from merging into one large vortex. Typically, in our models, two smaller vortices remained after the initial gap opening process, which then decayed faster compared to those in models where disk self-gravity was not accounted for. This finding, that self-gravity is detrimental to vortex survival, is in line with previous studies \citep{lovelace_rossby_2013,zhu_gas_2016,regaly_vortex_2017,pierens_evolution_2018}. Outward migration of the vortex was observed in some of the models with $\beta \ll 1$ and $\beta \gg 1$. In those cases, a second density (and thus pressure) bump formed outside of the vortex location, towards which the vortex then migrated \citep{paardekooper_vortex_2010}. In some $\beta=0.01$ models, a small, short-lived, ``secondary'' vortex formed between the planet gap and the ``primary'' vortex. Concerning the dependence of vortex lifetime on viscosity, we found the expected behavior that this lifetime was shorter for higher viscosity \citep{godon_vortices_1999,val-borro_vortex_2007,ataiee_asymmetric_2013,fu_long-term_2014,regaly_interpreting_2017}. For the highest viscosity of $\alpha=10^{-3}$, practically no vortices were observed. For $\alpha = 10^{-5}$ and $10^{-6}$ we found nearly identical results, suggesting that the numerical viscosity in our models with a resolution of 8 and 16 cells per scale height was of the order of $\alpha_{8\text{cps}} \lesssim 10^{-5}$ and $\alpha_\text{16\text{cps}} \approx 10^{-6}$. Allowing the planet to grow over a longer time, 1000 instead of 100 orbits, led to longer vortex lifetimes in all the cases we tested. This disagrees with the findings of \citet{hammer_slowly-growing_2017}, who found reduced vortex lifetimes for longer planet-growth times. In our models, vortices took longer to form in the case of the slower-growing planet. During their decay, however, their evolution was very similar, independent of planet introduction time (see Fig.~\ref{fig:ts_rampup}), which in total increased their lifetime. The fact that vortex lifetime increased for longer planet-growth timescales can be an indication that the effects presented in this study, including the long-lived vortex regime, are also applicable to longer, and arguably more realistic, planet-growth timescales of around 10\,000 orbits. Estimating vortex lifetime from our results, vortices are expected to live much longer at larger distances away from their host star. The increase in expected lifetime is firstly due to the longer orbital period at large radii, but also because the expected $\beta$ values --- the thermal relaxation timescale compared to the orbital timescale -- are much lower and vortices then likely belong to the long-lived regime (see Sect.~\ref{sec:long-lived}). From order-of-magnitude calculations, we find that large planet-induced vortices exterior to the planet at 50--100\,au might live for up to several Myr for low-viscosity disks ($\alpha \lesssim 10^{-4}$). Considering the sensitivity of instruments like ALMA at these distances from the star, this suggests that these vortices should be observable more easily than planet-induced vortices at smaller radii. \begin{acknowledgements} TR and WK acknowledge funding from the Deutsche Forschungsgemeinschaft (DFG) research group FOR 2634 ''Planet Formation Witnesses and Probes: Transition Disks'' under grant DU 414/22-1 and KL 650/29-1, 650/30-1. WB, WK, and AZ acknowledge support by the DFG-ANR supported GEPARD project (ANR-18-CE92-0044 DFG: KL 650/31-1). The authors acknowledge support by the High Performance and Cloud Computing Group at the Zentrum f\"ur Datenverarbeitung of the University of T\"ubingen, the state of Baden-W\"urttemberg through bwHPC and the German Research Foundation (DFG) through grant INST\,37/935-1\,FUGG. Plots in this paper were made with the Python library \texttt{matplotlib} \citep{hunter-2007}. \end{acknowledgements} \bibliographystyle{aa}
\section{Introduction} \label{Sec:introduction} \input{sect_introduction} \section{Bookshelf Organization Problem Setup} \label{Sec:problem_setup} \input{sect_problem_setup} \section{Learning Algorithm} \label{Sec:learning_algorithm} \input{sect_learning_algorithm} \section{Experiment} \subsection{Experiment Setup} \label{Sec:experiment_setup} \input{sect_experiment_setup} \subsection{Unsupervised Learning} \label{Sec:unsupervised_learning} \input{sect_unsupervised_learning} \subsection{Supervised Learning} \label{Sec:supervised_learning} \input{sect_supervised_learning} \subsection{Hardware Experiment} \label{Sec:hardware_experiment} \input{sect_hardware_experiment} \section{Conclusion, Discussion and Future Work} \label{Sec:conclusion} \input{sect_conclusion} \section*{Acknowledgements} The authors would like to thank Abhishek Cauligi and Professor Bartolomeo Stellato for helpful discussions, and Yusuke Tanaka and Hyunwoo Nam for the assisting with hardware implementation. { \bibliographystyle{IEEEtran}
\section{Introduction} Since the advent of the ISOL (Isotope Separation On-Line) method in the 1960s, facilities like CERN-ISOLDE \cite{Borge2017,Catherall2017} have been erected, which provide beams of a variety of radioisotopes. To keep up with the demand for ever more exotic and intense radioactive ion beams, extensive upgrade programs are on the way, \textit{e.g.}, at GANIL (Caen, France) or TRIUMF (Vancouver, Canada) \cite{Blumenfeld2013}. The ISOL technique exploits thick targets (typically at least tens of grams per \si{\centi\meter\squared}) in which nuclides are produced in reactions induced by an energetic driver beam. The nuclides are stopped within the target material and have to diffuse out of the target matrix and effuse into the ion source from where they are electrostatically extracted and separated by mass-to-charge ratio. The target is typically kept at high temperatures of up to ca. \SI{2000}{\celsius} to promote diffusion and effusion processes. Even at these elevated temperatures, many elements cannot be extracted due to their refractory properties, \textit{i.e.}, high melting and boiling points, which prohibit their transport. A powerful method to volatilize elements is the \textit{in-situ} formation of a volatile carrier molecule \cite{Sidenius1961}. While volatile carrier molecules have been proposed for almost all elements \cite{Freeman1973,Herrmann1967}, the \textit{in-situ} volatilization for radioactive ion beam formation was so far only successful for few refractory elements like carbon \cite{franberg2008production} or boron, \cite{Ballof2019} which form compounds that are stable in a high-temperature environment \cite{KoesterImpossibleBeams,Kronenberg2008}. Suitable compound classes are mostly restricted to binary halides or chalcogenides. To increase the variety of volatile carrier compounds, the temperatures of the target and ion source need to be significantly reduced. Cold target concepts have been proposed, which exploit the fast diffusion in nano-materials \cite{RAMOS201681} or fully avoid diffusion and exploit the recoil momentum of nuclear reaction products \cite{ballof2021concept}. However, the ion sources typically used at ISOLDE are not well suited for the ionization of more delicate volatile compounds \cite{Jochendiss}. A review about ion sources for radioactive ion beams can be found, \textit{e.g.}, in ref.~\cite{Stora:1693046}. For compounds with low ionization potential ($\lesssim \SI{6}{\electronvolt}$), hot cavities facilitating surface ionization are typically used. While most elements with higher ionization potential can be efficiently ionized by element-selective resonant laser ionization \cite{Marsh:1967371}, the ionization of compounds is addressed with electron impact ionization. Typically, the Versatile Arc Discharge Ion Source (VADIS) \cite{Penescu2010,LiviuDiss} is used for such compounds at ISOLDE. For surface ionization, the efficiency directly depends on the temperature according to the Saha-Langmuir law \cite{Langmuir1925}. In the VADIS, electrons are released thermionically according to the Richardson–Dushman equation \cite{Wolf2017}. This equally requires high temperatures. Radio-frequency heated plasma ion sources have been proposed \cite{Gaubert2003,Kronberger_2013,suominen2010ionization} which, however, suffer from instabilities in pulsed primary beam operation \cite{Jardin2003} and an electron energy distribution that often favors breakup of the molecule over ionization \cite{PekkaTalkARIS,Jochendiss}. We investigated the operation of the VADIS at ambient temperature by exploiting laser-induced electron release. We have previously reported on a VADIS operated at ambient temperature in which electrons were released from the tantalum cathode by a femto-second laser \cite{ballof2021concept}. We were able to show that the fragile carrier molecule Mo(CO)\textsubscript{6} can be ionized with efficiencies in the same order of magnitude as the noble gas krypton in the same setup. A parameter study was presented that indicates that an ion source based on electron production via the photo-electric effect could reach an efficiency of ca. \SI{1}{\percent}. However, the mechanism of electron production was not identified in our previous experiment. In this work, we have tailored our proof-of-concept experiment to the release of electrons via the photo-electric effect. A copper cathode was used which exhibits a relatively high quantum efficiency and does not require extreme vacuum conditions \cite{Pimpec2013}. The wavelength, pulse energy and pulse length of the laser were chosen such that ablation and thermionic electron generation could be excluded. Non-volatile fragments can be produced in electron-molecule collisions and condense on the surface of a photo-cathode. This work provides a first insight into the influence of these deposited fragments on the quantum efficiency of a photo-cathode. \floatsetup[table]{capposition=top} \begin{figure} \CenterFloatBoxes \begin{floatrow} \ffigbox[22pc]{% \includegraphics[width=22pc]{figs/Cu-VADIS-schema.pdf} \vspace{0.01cm} }{% \caption{\label{fig:CuVADISschema} Schematic of the electron-impact ion source used in our experiment. The electrons were liberated from a copper cathode by a laser beam (photo-electric effect) in a cold environment.}% } \killfloatstyle \ttabbox[\FBwidth]{% \footnotesize \begin{tabular}{l|r|l} parameter & value & unit\\ \hline \multicolumn{3}{l}{} \\ \multicolumn{3}{l}{ion source properties} \\ \hline anode-cathode gap & \num{2.8\pm 0.2} & \si{\milli\meter} \\ cathode material & Cu & \\ \multicolumn{3}{l}{} \\ \multicolumn{3}{l}{laser properties (on the cathode)} \\ \hline center wavelength & \num{215} & \si{\nano\meter} \\ repetition rate & 10 & \si{\kilo\hertz} \\ beam diameter & \num{1.5} & \si{\milli\meter} \\ average power & $\sim \num{10}$ & \si{\milli\watt} \\ pulse length & $\sim \num{30}$ & \si{\nano\second} \\ pulse energy & $ \sim \num{1}$ & \si{\micro\joule} \\ pulse energy fluence & $\sim \num{56}$ & \si{\micro\joule\per\square\centi\meter} \\ \end{tabular} }{% \caption{Parameters of the photo-cathode experiment.}% } \end{floatrow} \end{figure} \section{Experimental setup} The experiments were conducted at the ISOLDE Offline 2 separator \cite{Warren2020}. The ion source used within this work is based on the VADIS version VD7 equipped with a water-cooled transfer-line \cite{Penescu2010,LiviuDiss}. The VADIS VD7 is often referred to, quite incorrectly, as cold Forced Electron Beam Induced Arc Discharge (FEBIAD) ion source. It is schematically shown in fig.~\ref{fig:CuVADISschema}. The ion source is part of a Target and Ion Source (TIS) unit that is equipped with a coil that generates a longitudinal magnetic field (in the following referred to as target magnet). The coil can be supplied with currents of up to ca. \SI{6}{\ampere} which are expected to produce a magnetic field of up to ca.~\SI{30}{\milli\tesla} \cite{MartinezPalenzuela:2672954}. The anode was biased up to \SI{500}{\volt}. The photo-cathode was built by pressing a copper cap on the tantalum cathode of a standard VADIS. The cap was manufactured from a sheet of polished oxygen-free copper. It was degreased in pentane and oxide layers were removed by an aqueous citric acid solution. The cap was rinsed with demineralized water and finally subjected to ultra-sound cleaning in ethanol. The cathode was electrically insulated from the target assembly to enable measurements of the photo-electron current. Additionally, the electron current was obtained as drain current of the anode power-supply. The anode drain current measurement does not differentiate between electrons impinging on the anode grid and electrons entering the anode volume. Differences between cathode and anode drain current might arise \textit{e.g.}, due to the fraction of electrons emerging from the cathode but not arriving at the anode due to space-charge repulsion, or by electron generation by the laser beam on the ion extraction side where metal disks (typically serving as heat shields) are located that are electrically insulated from the anode. Electrons produced in this region are repelled by the extraction electrode and accelerated towards the anode. The cathode was not baked prior to, or during operation. A deep-ultraviolet laser beam (\SI{215}{\nano\meter}, corresponding to \SI{5.77}{\electronvolt} photon energy) was guided through the ion source outlet orifice, through the central hole of the anode grid (both \SI{1.5}{\milli\meter} in diameter), and onto the cathode surface. The UltraViolet (UV) beam was generated by frequency quadrupling of a Ti:sapphire laser, identical to the ISOLDE resonance ionization laser ion source setup \cite{Fedosseev_2017}. It provided \SI{30}{\nano\second}-long pulses at a repetition rate of \SI{10}{\kilo\hertz}. Prior to installation of the ion source on the beam line, the laser beam transmission through the mass separator window and ion source aperture was measured with a laser alignment device that resembles the geometry of a VADIS. The laser beam was focused such that ca.~\SI{73}{\percent} of the power arriving at the ion source reached the cathode surface. The remaining fraction was stopped by the aforementioned heat shields. During the experiment, the laser power was measured in front of the vacuum window. The transmission between the latter position and the cathode was measured to be \SI{35 \pm 2}{\percent}. The power arriving at the cathode was ca.~\SI{10}{\milli\watt} and was varied during the experiment. Krypton (Carbagas, 99.998\%) and carbon dioxide (Carbagas, 99.998\%) at a pressure of \SI{1.2}{\bar} were supplied through a calibrated leak of \SI{1.7e-5}{\milli\bar\liter\per\second} (\SI{1}{bar} abs., air). In addition to Faraday cups, the ion beam was assessed with a MagneToF detector (ETP DM291). The latter was used to determine the time-structure of ion release. The ion beam transmission through the mass separator was estimated to be \SI{87}{\percent}. \section{Results and discussion} The previously described setup was operated under varying conditions for about 6 days. The laser was continuously irradiating the cathode during this period. During the first days, krypton was supplied though the calibrated leak. For the last 66 hours, carbon dioxide was injected. The ion and electron currents were measured as a function of anode voltage, magnet current and laser power. The photo-electron currents were measured as cathode current and anode drain current. Both were in agreement within ca. \SIrange{10}{20}{\percent}, while the anode drain current was typically higher. The maximum observed \textsuperscript{84}Kr current at a relatively strong magnetic field (\SI{5.5}{\ampere}) was ca.~\SI{1}{\nano\ampere}, which corresponds to an ionization efficiency of ca.~\SI{0.004}{\percent}. At the same time, the anode drain current was measured to be ca. \SI{100}{\nano\ampere}. At the same anode voltage of \SI{100}{\volt} and without magnet field, the electron current increased to ca. \SI{270}{\nano\ampere} which is in agreement with the expected space-charge limited current of $\SI[parse-numbers=false]{263^{+42}_{-37}}{\nano\ampere}$ as given by the Child-Langmuir equation \cite{Child1911,Langmuir1913} for a one dimensional emitter, and an anode-cathode distance of \SI{2.8 \pm 0.2}{\milli\meter}. The highest drain current of ca. \SI{1.5}{\micro\ampere} was obtained at an anode voltage of \SI{500}{\volt} and without magnetic field. The space-charge limit at \SI{500}{\volt} is expected to be ca.~\SI{2.5}{\micro\ampere}. The quantum efficiency computes to~\num[exponent-mode = fixed, fixed-exponent = -4]{0.0008 \pm 0.0002}. The value exceeds efficiencies reported by other authors by a factor of ca.~\num{2} \cite{palmer2005review}, and could indicate that the laser beam transmission during the experiment exceeded the estimate of $\SI{35\pm2}{\percent}$ that was obtained during alignment. \begin{figure} [t] \begin{minipage}{18pc} \includegraphics[width=18pc]{figs/anodescan.pdf} \caption{\label{fig:anodescan} (left) Dependence of anode drain current and \textsuperscript{84}Kr ion current on the anode voltage for different settings of the target magnet at a laser power and center wavelength of \SI{8(1)}{\milli\watt} and \SI{215}{\nano\meter}, respectively. Connecting lines were added to guide the eye. (right) Time structure of electron, laser and ion pulses. A photo-diode was used to assess the laser time structure. Laser and electron pulse shape were estimated by measurement of the voltage drop over a \SI{50}{\ohm} resistor. The curve shapes were redrawn from an oscilloscope photograph. The offset between electron and laser pulses was not measured. The ion time structure was obtained with a MagneToF detector and is given relative to the laser pulse.} \end{minipage}\hspace{2pc}% \begin{minipage}{16pc} \includegraphics[width=16pc]{figs/time-structure-export.pdf} \end{minipage} \end{figure} The evolution of ion and anode drain current while varying the anode voltage (anode scan) is given for three settings of the target magnet in fig.~\ref{fig:anodescan}. The target magnet significantly increases the ion currents and decreases the electron currents. This effect is typically explained by an increase of electron density in the ionization volume, which in turn increases the ionization efficiency \cite{LiviuDiss}. At the same time, the higher charge density might reduce the total electron emission due to space-charge repulsion. Without magnetic field, the ion and electron currents increased steadily with anode voltage, likely due to a combination of lower space-charge repulsion at higher voltages and a focusing effect of the electrostatic field. The plateau region (\SIrange{250}{500}{\volt}) could indicate that the electron supply is rather limited by quantum efficiency than space-charge repulsion. At elevated magnet currents (\SI{6.5}{\ampere}), a pronounced maximum in the ion current emerges at ca. \SI{150}{\volt} anode voltage, which can be explained by the electron-energy dependence of electron impact ionization cross sections \cite{Higgins:203081}. The dependence of ion beam current and anode drain current on laser power is shown in fig.~\ref{fig:powerscan}. The measurements were suffering from relatively high errors due to instabilities of ion beams, data acquisition and laser power. Ion and electron currents steadily increased with laser power. The ion currents, in particular the data for a magnet current of \SI{5}{\ampere} and \SI{500}{\volt} anode voltage, show saturation, \textit{i.e.}, an increase in laser power and electron production does not translate into a proportional increase in the ion beam intensity. It seems likely that despite increased electron production, electrons either do not reach the anode volume, their energy is not sufficient for ionization or the probability of ion extraction is negatively impacted. A mass spectrum obtained with the photo-cathode driven ion source in comparison to a regular VADIS is shown in fig.~\ref{fig:mass-scan}. Due to operation at ambient temperature the level of impurity is significantly lower for the photo-cathode ion source. \begin{figure} [t] \begin{minipage}{17pc} \includegraphics[width=17pc]{figs/Powerscan-anode.pdf} \caption{\label{fig:powerscan} Dependence of anode drain current and \textsuperscript{84}Kr ion current on laser power for different anode voltages and magnet currents. The electron current measurement does not differentiate between electrons impinging on the grid and electrons entering the anode volume. The ion currents for \SI{500}{\volt} and \SI{200}{\volt} at \SI{0}{\ampere} magnet current were indistinguishable, and only the data for \SI{500}{\volt} are shown. } \end{minipage}\hspace{2pc}% \begin{minipage}{17pc} \includegraphics[width=17pc]{figs/powerscan-ions.pdf} \end{minipage} \end{figure} The quantum efficiency of a photo-cathode driven ion source could be impacted by poisoning of the cathode surface due to condensation of molecule fragments produced in electron collisions and the unusually high rest gas pressure for photo-cathode operation \cite{palmer2005review}. To evaluate the photo-cathode lifetime in these conditions, we have injected carbon dioxide into the ion source for ca.~$66\;\mathrm{hours}$. The ionization efficiency for the extraction as $\mathrm{CO^{+}_{2}}$ was measured to be ca. \SI{2e-5} .. An immediate effect on the anode drain current could not be observed. However, after $66\;\mathrm{hours}$, the anode drain current reduced to ca.~\SI{35}{\percent} of its original value. The gas pressure inside the ion source was estimated to be ca. \SI{1e-4}{\milli\bar}, following the calculation proposed in \cite{LiviuDiss}, and under consideration of the gas flow rate through the calibrated leak and the conductance of the outlet orifice. The typical pressure inside the ion source of a hot VADIS is far below this value and in the order of \SI{e-6}{\milli\bar}. Measurements of the electron, photon and ion beam time structure are provided in fig.~\ref{fig:anodescan}. The electron pulse shape closely resembles the laser pulse shape as measured by a photo-diode. The $\mathrm{CO}_{2}^{+}$ ions are, in contrast to what has been observed for resonantly ionized atomic species inside a hot VADIS source \cite{Goodacre2016}, contained in a single bunch and arrive ca. \SI{20}{\micro\second} after the laser impact on the cathode at the MagneToF detector. This difference supports the assumption that, for this study, the VADIS is acting predominantly as an electron impact ion source without ion and electron dynamics that govern ion survival and extraction in standard operating conditions of the VADIS. To confirm that the electron production was governed by the photo-electric effect, blue light (\SI{430}{\nano\meter}, corresponding to \SI{2.88}{\electronvolt} photon energy) at a power of \SI{154}{\milli\watt} (second harmonic generation from the same laser system) was guided on the cathode. The work function of copper (\SIrange{4.5}{4.9}{\electronvolt} \cite{CRC2020}) is above the photon energy at that wavelength, so that a single-photon induced electron emission is not possible. In agreement with expectations, no electron production could be observed. \begin{figure} [t] \includegraphics[width=38pc]{figs/mass-spec.pdf} \caption{\label{fig:mass-scan} Mass scan obtained with the photo-cathode ion source obtained at an anode voltage of \SI{200}{\volt} in comparison to a mass scan obtained with a standard VADIS (VD7, thermionic electron emission) operated at \SI{120}{\volt}. Both sources were supplied with krypton. In addition, the standard VADIS was supplied with carbon monoxide gas and residual xenon was present from previous tests. The scales have been adjusted to show a similar level of sensitivity. Negative ion currents for the photo-cathode source have been trimmed to \SI{1e-14}{\ampere}.} \end{figure} \section{Conclusions and outlook} In this study we have demonstrated production of molecular ion beams using an electron impact ion source driven by a photo-cathode at ambient temperature. In combination with high in-target production rates of radioisotopes, the existing ion source design would in principle allow first experiments with fragile radioactive molecules. We have previously proposed a parameter study to increase the ion source efficiency to ca. \SI{1}{\percent}, which would allow a wide range of experiments with exotic molecules \cite{ballof2021concept}. A major efficiency increase requires the modification of the ion source geometry to resolve the space-charge limitation implied by the \SI{1.5}{\milli\meter} laser beam spot on the cathode surface. A further efficiency increase, especially for molecules disintegrating to non-volatile species, could likely be obtained by embedding the anode volume in an ion guiding structure, \textit{e.g.}, an electric quadrupole as applied in the Laser Ion Source and Trap (LIST) ion source \cite{Fink2013}. The new ion source will enable extraction and ionization of molecules at ISOLDE which are not stable at ultra-high temperatures. Development and implementation of this method at ISOLDE will expand its radioactive ion beam capabilities to refractory elements \cite{ballof2021concept} and help to serve the increasing demand in radioactive molecules for spectroscopy applications \cite{Ruiz2020,Safronova2018,Athanasakis:2748712}. \ack We would like to thank Mathieu Bovigny and Julien Thiboud for the assembly of the target unit used in our experiments, James Cruikshank for the support regarding the mass separator and Eric Chevallay for sharing his expertise about copper photo-cathodes. This project has received funding from the European Union’s Horizon 2020 research and innovation program under grant agreement No 654002. \section{Introduction} These guidelines show how to prepare articles for publication in \jpcs\ using \LaTeX\ so they can be published quickly and accurately. Articles will be refereed by the \corg s but the accepted PDF will be published with no editing, proofreading or changes to layout. It is, therefore, the author's responsibility to ensure that the content and layout are correct. This document has been prepared using \cls\ so serves as a sample document. The class file and accompanying documentation are available from \verb"http://jpcs.iop.org". \section{Preparing your paper} \verb"jpconf" requires \LaTeXe\ and can be used with other package files such as those loading the AMS extension fonts \verb"msam" and \verb"msbm" (these fonts provide the blackboard bold alphabet and various extra maths symbols as well as symbols useful in figure captions); an extra style file \verb"iopams.sty" is provided to load these packages and provide extra definitions for bold Greek letters. \subsection{Headers, footers and page numbers} Authors should {\it not} add headers, footers or page numbers to the pages of their article---they will be added by \iopp\ as part of the production process. \subsection{{\cls\ }package options} The \cls\ class file has two options `a4paper' and `letterpaper': \begin{verbatim} \documentclass[a4paper]{jpconf} \end{verbatim} or \begin{verbatim} \documentclass[letterpaper]{jpconf} \end{verbatim} \begin{center} \begin{table}[h] \caption{\label{opt}\cls\ class file options.} \centering \begin{tabular}{@{}*{7}{l}} \br Option&Description\\ \mr \verb"a4paper"&Set the paper size and margins for A4 paper.\\ \verb"letterpaper"&Set the paper size and margins for US letter paper.\\ \br \end{tabular} \end{table} \end{center} The default paper size is A4 (i.e., the default option is {\tt a4paper}) but this can be changed to Letter by using \verb"\documentclass[letterpaper]{jpconf}". It is essential that you do not put macros into the text which alter the page dimensions. \section{The title, authors, addresses and abstract} The code for setting the title page information is slightly different from the normal default in \LaTeX\ but please follow these instructions as carefully as possible so all articles within a conference have the same style to the title page. The title is set in bold unjustified type using the command \verb"\title{#1}", where \verb"#1" is the title of the article. The first letter of the title should be capitalized with the rest in lower case. The next information required is the list of all authors' names followed by the affiliations. For the authors' names type \verb"\author{#1}", where \verb"#1" is the list of all authors' names. The style for the names is initials then surname, with a comma after all but the last two names, which are separated by `and'. Initials should {\it not} have full stops. First names may be used if desired. The command \verb"\maketitle" is not required. The addresses of the authors' affiliations follow the list of authors. Each address should be set by using \verb"\address{#1}" with the address as the single parameter in braces. If there is more than one address then a superscripted number, followed by a space, should come at the start of each address. In this case each author should also have a superscripted number or numbers following their name to indicate which address is the appropriate one for them. Please also provide e-mail addresses for any or all of the authors using an \verb"\ead{#1}" command after the last address. \verb"\ead{#1}" provides the text Email: so \verb"#1" is just the e-mail address or a list of emails. The abstract follows the addresses and should give readers concise information about the content of the article and should not normally exceed 200 words. {\bf All articles must include an abstract}. To indicate the start of the abstract type \verb"\begin{abstract}" followed by the text of the abstract. The abstract should normally be restricted to a single paragraph and is terminated by the command \verb"\end{abstract}" \subsection{Sample coding for the start of an article} \label{startsample} The code for the start of a title page of a typical paper might read: \begin{verbatim} \title{The anomalous magnetic moment of the neutrino and its relation to the solar neutrino problem} \author{P J Smith$^1$, T M Collins$^2$, R J Jones$^{3,}$\footnote[4]{Present address: Department of Physics, University of Bristol, Tyndalls Park Road, Bristol BS8 1TS, UK.} and Janet Williams$^3$} \address{$^1$ Mathematics Faculty, Open University, Milton Keynes MK7~6AA, UK} \address{$^2$ Department of Mathematics, Imperial College, Prince Consort Road, London SW7~2BZ, UK} \address{$^3$ Department of Computer Science, University College London, Gower Street, London WC1E~6BT, UK} \ead{<EMAIL>} \begin{abstract} The abstract appears here. \end{abstract} \end{verbatim} \section{The text} The text of the article should should be produced using standard \LaTeX\ formatting. Articles may be divided into sections and subsections, but the length limit provided by the \corg\ should be adhered to. \subsection{Acknowledgments} Authors wishing to acknowledge assistance or encouragement from colleagues, special work by technical staff or financial support from organizations should do so in an unnumbered Acknowledgments section immediately following the last numbered section of the paper. The command \verb"\ack" sets the acknowledgments heading as an unnumbered section. \subsection{Appendices} Technical detail that it is necessary to include, but that interrupts the flow of the article, may be consigned to an appendix. Any appendices should be included at the end of the main text of the paper, after the acknowledgments section (if any) but before the reference list. If there are two or more appendices they will be called Appendix A, Appendix B, etc. Numbered equations will be in the form (A.1), (A.2), etc, figures will appear as figure A1, figure B1, etc and tables as table A1, table B1, etc. The command \verb"
\section{Introduction} The origin of neutrino masses and their mixing, as evidenced by the neutrino oscillation experiments \cite{2016NuPhB.908....1O}, remains one of the most interesting open questions of physics beyond the Standard Model (SM). In the past half-century, theorists have invented hundreds of models to interpret the existence of the neutrino masses and most of them lead to an effective dimension-five Weinberg operator \cite{Weinberg:1979sa}. Among those models, the most popular and well-studied ones are the tree-level realisations of the Weinberg operator, namely the type I \cite{Minkowski:1977sc,Yanagida:1979as,GellMann:1980vs,Mohapatra:1979ia}, II \cite{Magg:1980ut,Schechter:1980gr,Wetterich:1981bx,Lazarides:1980nt,Mohapatra:1980yp,Ma:1998dx} and III \cite{Foot:1988aq,Ma:1998dn,Ma:2002pf,Hambye:2003rt} seesaw models. However, the difficulty in generating proper neutrino mass naturally with large seesaw couplings and small right-handed (RH) neutrino masses simultaneously reduces the experimental testability of these models, and some low scale seesaw models with extended RH neutrino sectors such as the inverse seesaw model \cite{Mohapatra:1986bd}, the linear seesaw model \cite{Akhmedov:1995ip,Malinsky:2005bi} and other radiative models \cite{Zee:1980ai,Ma:2009dk,Bonnet:2012kz,Cai:2017jrq} have been proposed to make the models more testable. Another great mystery unanswered by the SM is that of cosmological dark matter (DM), which is commonly thought to be some kind of massive new particle which is stable on cosmological timescales. Although many DM candidates have been proposed, the most common mechanism to account for their stability is to invent a discrete symmetry, the simplest example being $Z_2$, under which the dark matter candidate is odd, while the SM particles are even, where such models may be related to neutrino mass and mixing~\cite{Ma:2006km,Cline:2013gha,Heikinheimo:2017ofk,Becker:2018rve,Chianese:2018dsz,Bandyopadhyay:2018qcv,Chianese:2019epo,Dasgupta:2019lha,Liu:2020mxj,Chianese:2020yjo,Cheng:2020gut,Chianese:2020khl,Chang:2021ose}. Although this approach can explain the mystery of invisible dark matter, accounting for about a quarter of the energy density of the universe \cite{Aghanim:2018eyx}, the origin of the discrete symmetry such as $Z_2$ is rarely considered in the literature, but instead is often just imposed, for example as in the case of R-parity in supersymmetry (SUSY). Although discrete symmetries are widely used in model building \cite{deMedeirosVarzielas:2005qg,deMedeirosVarzielas:2006fc,King:2006np,Branco:2011iw,King:2011ab,Cooper:2012wf,King:2013eh,Ding:2013bpa,King:2014nza,Karozas:2014aha,Bjorkeroth:2015ora,Altarelli:2010gt,Ma:2001dn,Babu:2002dz,Altarelli:2005yp}, the SM does not contain such discrete symmetries, only gauge symmetries and accidental (approximate) global symmetries. Consequently, there is good motivation to seek the origin of discrete symmetries as subgroups of gauge symmetries. Recently a new version of the type I seesaw mechanism, named as the type Ib seesaw mechanism \cite{Hernandez-Garcia:2019uof}, that can be just as testable as the low scale seesaw models above has been proposed, with the light neutrino masses originating from a new type of Weinberg operator involving two Higgs doublets and a Dirac heavy neutrino. It has been shown that the model can not only be extended to include dark matter via a neutrino portal \cite{Chianese:2021toe} but can also produce baryon asymmetry in a variant version \cite{Fu:2021fyk}. However in this model, as in many such models, both the type Ib seesaw model itself and the inclusion of dark matter via a neutrino portal requires additional imposed discrete symmetries whose origin is not explained. In this paper we consider the possibility that dark matter is stabilised by a discrete $Z_2$ symmetry which arises from a subgroup of a $U(1)'$ gauge symmetry, and under which the chiral quarks and leptons do not carry any charges. A chiral fermion $\chi$ with half-integer charge is odd under the preserved $Z_2$, and hence becomes a stable dark matter candidate, being produced through couplings to right-handed neutrinos with vector-like $U(1)'$ charges, as in the type Ib seesaw mechanism. However in the present model, no discrete symmetries are required to be added by hand. Indeed our proposed model is a $U(1)'$ gauge extension of the SM $SU(3)_c \times SU(2)_L \times U(1)_Y$ symmetry, where the $U(1)'$ is broken into a $Z_2$ symmetry spontaneously by the vacuum expectation value (VEV) of an integer charged scalar singlet, together with integer charged Higgs doublets. In the minimal type Ib seesaw model, the light neutrino masses originate from a new type of Weinberg operator involving two Higgs doublets and a heavy Dirac neutrino constructed from the vector-like right-handed neutrinos. Assuming the heavy Dirac neutrino is around the GeV scale, we focus on a scenario where the dark matter candidate and the new gauge boson are above TeV scale and explore the parameter space of the model providing the correct dark matter relic abundance. However in such a minimal effective model, chiral quark and lepton masses arise from non-renormalisable operators. To construct a renormalisable model, we consider a complete fourth family of vector-like fermions, in which the chiral quark and lepton masses arise from a seesaw-like mechanism. With the inclusion of the fourth family, the lightest vector-like quark can contribute to the dark matter production, enlarging the allowed parameter space that we explore. The paper is organised as follows. In Sec.\ref{model_eff}, we start with the extension of the minimal type Ib seesaw model and discuss the allowed parameter space in the model assuming the correct dark matter relic abundance. We also derive the required sensitivity of direct and indirect dark matter detections to find the dark fermion. In Sec.\ref{sec:four} we show how the model is completed with a fourth generation of vector-like fermions and recompute the allowed parameter space. Finally, we summarise and conclude in Sec.\ref{sec:Concl}. \section{Extension of the minimal type Ib seesaw model as an effective model \label{model_eff}} \begin{table}[t!] \centering \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|} \hline & ${q_L}_\alpha$ & ${u_R}_\beta$ & ${d_R}_\beta$ & ${\ell_L}_\alpha$ & ${e_R}_\beta$ & $\Phi_{1}$ & $\Phi_{2}$ & $N_{\mathrm{R}1}$ & $N_{\mathrm{R}2}$ & $\chi_R$ & $\phi$\\[1pt] \hline & & & & & & & & & & & \\ [-1em] $SU(2)_L$ & {\bf 2} & {\bf 1} & {\bf 1} & {\bf 2} & {\bf 1} & {\bf 2} & {\bf 2} & {\bf 1} & {\bf 1} & {\bf 1} & {\bf 1} \\ \hline & & & & & & & & & & & \\ [-1em]& & & & & & & & & & & \\ [-1em] $U(1)_Y$ & $\frac{1}{6}$ & $\frac{2}{3}$ & $-\frac{1}{3}$ & $-\frac{1}{2}$ & $-1$ & $-\frac{1}{2}$ & $-\frac{1}{2}$ & 0 & 0 & 0 & 0 \\[2pt] \hline & & & & & & & & & & & \\ [-0.9em] $U(1)'$ & $0$ & $0$ & $0$ & $0$ & $0$ & $1$ & $-1$ & $-1$ & $1$ & $\frac12$ & 1 \\ [0.2em] \hline \end{tabular} \caption{\label{tab:Ib}Irreducible representations of the fields of the model under the electroweak $SU(2)_L \times U(1)_Y \times U(1)'$ gauge symmetry. The fields ${q_L}_{\alpha}, {\ell_L}_{\alpha}$ are left-handed SM doublets while ${u_R}_\beta,{d_R}_\beta,{e_R}_\beta$ are right-handed SM singlets where $\alpha, \beta$ label the three families of quarks and leptons. The fields $N_{\mathrm{R}{1,2}}$ are the two right-handed neutrinos.} \end{table} Here, we introduce the $U(1)'$ extension of minimal type Ib seesaw model with a Majorana fermion singlet. The charges of the fields in the model are summarised in Tab.\ref{tab:Ib}. The $U'(1)$ gauge symmetry, rather than any discrete $Z_3$ or $Z_4$ symmetries \cite{Chianese:2021toe,Fu:2021fyk}, is responsible for making the two Higgs doublets distinguishable and ensuring the type Ib seesaw structure. However, the $U(1)'$ symmetry does not completely take over the function of the discrete symmetries. In fact, the Yukawa interaction between charged fermions and Higgs doublets is forbidden by the $U(1)'$ symmetry. To preserve the fermion mass, a new scalar singlet $\phi$, which is also referred to as the ``Yukon'' \cite{King:2020mau}, is introduced with which dimension-5 interaction is allowed in the form of $\overline{q_L}_\alpha \Phi_2 u_{R\beta} \phi$, $\overline{q_L}_\alpha {\tilde \Phi}_1 d_{R\beta} \phi$ and $\overline{\ell}_\alpha {\tilde \Phi}_1 e_{R\beta} \phi$. After $\phi$ gains a VEV $\langle\phi\rangle=v_\phi/\sqrt{2}$, the Yukawa interactions generating fermion mass after spontaneous symmetry breaking (SSB) of Higgs doublets are \begin{eqnarray} \mathcal{L}_{\rm 2HDM} & \supset & - Y^u_{\alpha \beta} \overline{q_L}_\alpha \Phi_2 u_{\mathrm{R}\beta} - Y^d_{\alpha \beta} \overline{q_L}_\alpha {\tilde \Phi}_1 d_{\mathrm{R}\beta}- Y^e_{\alpha \beta} \overline{\ell}_\alpha {\tilde \Phi}_1 e_{\mathrm{R}\beta} + {\rm h.c.}\, \label{eq:Yuk} \end{eqnarray} However, the $SU(2)\times U(1)\times U(1)'$ symmetry does not help to keep the type II two Higgs doublet model (2HDM) structure, which may lead to unexpected flavour changing process. As will be discussed in Sec.\ref{sec:four}, the problem can be solved by considering a fourth generation of vector-like fermions, which is also motivated by constructing a renormalisable model. After realising the type Ib seesaw model effectively, the type II 2HDM structure appears automatically. Under the $U(1)'$ symmetry, the Yukawa interactions allowed in the type Ib seesaw sector take the form \begin{eqnarray} \mathcal{L}_{\rm seesawIb} & = & - Y_{1\alpha} \overline{\ell_L}_\alpha {\Phi}_1 N_{\mathrm{R}1} - Y_{2\alpha} \overline{\ell_L}_\alpha {\Phi}_2 N_{\mathrm{R}2} - M\overline{N^c_{\mathrm{R}1}} N_{\mathrm{R}2} + {\rm h.c.}\,, \label{eq:lg_Ib} \end{eqnarray} The two ``right-handed'' Weyl neutrinos can actually form a four component Dirac spinor $\mathcal{N} = \left(N^c_{R1},N_{R2} \right)$ with a Dirac mass $M$. The $U(1)'$ Dirac spinor $\mathcal{N}$ can be easily read as 1 from Tab.\ref{tab:Ib}. Notice that any Majorana mass terms of the RH neutrinos break the $U(1)'$ symmetry and therefore the classical type Ia seesaw is forbidden in this model. The type Ib seesaw Lagrangian can be rewritten in $\mathcal{N}$ as \begin{eqnarray} \mathcal{L}_{\rm seesawIb} & = & - Y_{1\alpha}^* \overline{\ell^c_L}_\alpha \Phi_1^* \mathcal{N}_\mathrm{L} - Y_{2\alpha} \overline{\ell_L}_\alpha {\Phi}_2 \mathcal{N}_\mathrm{R} - M_N\overline{\mathcal{N}_\mathrm{L}} \mathcal{N}_\mathrm{R}+ {\rm h.c.}\,. \label{eq:lagNS} \end{eqnarray} \begin{figure}[t!] \begin{center} \begin{fmffile}{FeynDiag/NM} \fmfframe(10,10)(10,10){ \begin{fmfgraph*}(200,45) \fmflabel{$\ell_\beta$}{o1} \fmflabel{}{o2} \fmflabel{}{i2} \fmflabel{${\ell_L}_\alpha$}{i1} \fmfv{}{v1} \fmfv{decor.shape=cross,decor.size=8,label=$M_N$,label.angle=90}{v2} \fmfv{}{v3} \fmfv{label=$\Phi_1$,label.angle=90}{v4} \fmfv{}{v5} \fmfv{label=$\Phi_2$,label.angle=90}{v6} \fmfleft{i1,i2} \fmfright{o1,o2} \fmf{fermion,tension=0.6}{i1,v1} \fmf{fermion,label=$\mathcal{N}$,l.side=left}{v2,v1} \fmf{fermion,label=$\mathcal{N}$,l.side=left}{v3,v2} \fmf{fermion,tension=0.6}{o1,v3} \fmf{phantom,tension=0.6}{i2,v4} \fmf{phantom}{v5,v4} \fmf{phantom}{v5,v6} \fmf{phantom,tension=0.6}{o2,v6} \fmf{dashes,tension=0}{v1,v4} \fmf{phantom,tension=0}{v2,v5} \fmf{dashes,tension=0}{v3,v6} \end{fmfgraph*}} \end{fmffile} \label{fig:NMdirac} \caption{Light neutrino mass generated by the type Ib seesaw mechanism} \end{center} \end{figure} In Tab.\ref{tab:Ib}, the SM fermions are uncharged under $U(1)'$ to avoid chiral anomalies while the two Higgs doublets, the heavy neutrino, the fermion singlet and the Yukon are charged. The kinetic terms of those particles are \begin{eqnarray} \mathcal{L}_{\rm U'(1)} & = & \left(D'_\mu \Phi_1\right)^\dagger {D'}^\mu \Phi_1 + \left(D'_\mu \Phi_2\right)^\dagger {D'}^\mu \Phi_2 + i\overline{\mathcal{N}} \slashed{D}' \mathcal{N} + i\overline{\chi_R} \slashed{D}'\chi_R + D'_\mu \overline{\phi} {D'}^\mu \phi \label{eq:lg_Ib} \end{eqnarray} where the covariant derivative under $SU(1)\times U(1)\times U(1)'$ symmetry is \begin{eqnarray} &D'_\mu= \partial_\mu + i\frac12 g_2\,\boldsymbol{\sigma} \cdot \boldsymbol{W}_\mu + ig_1YB_\mu + ig'_1Y'B'_\mu\,. \end{eqnarray} In addition to the kinetic terms, the dark fermion can only couple to the Yukon through interaction\footnote{The dark fermion $\chi$ takes a chiral form in order to gain Majorana mass through the SSB of $\phi$. The chiral component of a vector-like $\chi$ must have opposite $U(1)'$ charge to be invariant under charge conjugation $\chi_L=\chi_R^c$. Therefore the two chiral components needs to obtain Majorana mass through different Yukawa interactions to the scalar singlet, namely $\overline{\phi}\,\overline{\chi_L^c} \chi_L$ and $\phi\overline{\chi_R^c} \chi_R$ (or $\phi\overline{\chi_L^c} \chi_L$ and $\overline{\phi}\,\overline{\chi_R^c} \chi_R$, depending on their $U(1)'$ charge) which generate the normal Majorana mass terms $m_\chi\overline{\chi_R^c} \chi_R + h.c.$ after SSB. The dark fermion can either be left-handed or right-handed and is chosen to be right-handed without loss of generality.} \begin{eqnarray} y_\chi\phi\overline{\chi_R^c} \chi_R + h.c.\,. \end{eqnarray} After the $U(1)'$ is broken by the VEV of Yukon, the dark fermion $\chi$ gains a Majorana mass $m_\chi=\sqrt{2} y_\chi v_\phi$ and become stable due to its half-integer charge under $U(1)'$. In fact, the VEV of Yukon breaks the $U(1)'$ symmetry into a $Z_2$ symmetry under which $\chi$ is the only charged particle. Besides the dark fermion, the $U(1)'$ gauge boson $Z'$ also gains mass $M_{Z'}=g'_1v_\phi$ from the VEV of Yukon. However, since the Higgs doublets are also charged under the $U(1)'$ gauge symmetry, the mass of $Z'$ also receives contributions from $\langle\Phi_1\rangle$ and $\langle\Phi_2\rangle$ after the electroweak (EW) symmetry breaking, which leads to mixing between the massive gauge bosons. \subsection{Gauge boson mixing} After the SSB of the Higgs doublets, the mass matrix of $W_3$, $B$ and $B'$ reads \begin{eqnarray} \frac{v^2}{4}\begin{pmatrix} g_2^2 & - g_1g_2 & 2g_2g'_1\cos2\beta\\ - g_1g_2 & g_1^2 & -2g_1g'_1\cos2\beta\\ 2g_2g'_1\cos2\beta & -2g_1g'_1\cos2\beta & 4{g'_1}^2 \left(1+ \frac{v_\phi^2}{v^2}\right) \end{pmatrix} \end{eqnarray} where the mass of $B'$ also receives contribution from the SSB of scalar singlet $\phi$ as $M_{Z'}=g'_1v_\phi$. While the photon remains massless, there is a mixing between the SM neutral gauge boson $Z$ and the gauge boson $Z'$ \begin{eqnarray} Z\rightarrow Z \cos\theta - Z'\sin\theta\,, \quad Z'\rightarrow Z' \cos\theta + Z\sin\theta \end{eqnarray} with the expression of the mixing angle given by \begin{eqnarray} \tan2\theta = \frac{2\cos2\beta\, g'_1 v\, M_Z}{M_{Z'}^2-M_Z^2+{g'_1}^2 v^2} = \frac{4\cos2\beta\, g'_1 \sqrt{g_1^2+g_2^2} v^2}{4{g'_1}^2 (v^2+v_\phi^2)-(g_1^2+g_2^2) v^2}\,. \end{eqnarray} Assuming $M_{Z'}\gg M_Z$ and $v_\phi \gg v$, the mixing angle $\theta$ is approximately $\cos2\beta\, \sqrt{g_1^2+g_2^2}\, v^2 / g'_1 v_\phi^2$. The EW Precision Observables provides an upper bound on the mixing angle, which is $\theta \lesssim 10^{-3}$ \cite{DELPHI:1994ufk}. The upper bound can be converted into constraint on the parameters in the model as \begin{eqnarray} g'_1 v_\phi^2 \gtrsim \left( 6.7\, \text{TeV} \right)^2\,. \label{eq:mixing} \end{eqnarray} Due to the perturbativity limit of the $U(1)'$ gauge coupling $g'_1$, $v_\phi$ has to be larger than $3.6$ TeV, which is coincident with the assumption $v_\phi \gg v$ above. \begin{figure}[t!] \begin{center} \begin{fmffile}{FeynDiag/DMpro1} \fmfframe(20,20)(20,20){ \begin{fmfgraph*}(80,45) \fmflabel{$\chi$}{o1} \fmflabel{$\chi$}{o2} \fmflabel{$\mathcal{N}$}{i2} \fmflabel{$\overline{\mathcal{N}}$}{i1} \fmfv{label=$g_1'$}{v1} \fmfv{label=$\frac{g_1'}{2}$}{v2} \fmfleft{i1,i2} \fmfright{o1,o2} \fmf{plain}{i2,v1} \fmf{plain}{i1,v1} \fmf{plain}{v2,o1} \fmf{plain}{v2,o2} \fmf{photon,label=$Z'$}{v1,v2} \fmfdotn{v}{2} \end{fmfgraph*}} \end{fmffile} \begin{fmffile}{FeynDiag/DMpro2} \fmfframe(20,20)(20,20){ \begin{fmfgraph*}(80,45) \fmflabel{$\chi$}{o1} \fmflabel{$\chi$}{o2} \fmflabel{$\overline{\Phi}_i$}{i1} \fmflabel{$\Phi_i$}{i2} \fmfv{label=$g_1'$}{v1} \fmfv{label=$\frac{g_1'}{2}$}{v2} \fmfleft{i1,i2} \fmfright{o1,o2} \fmf{dashes}{i2,v1} \fmf{dashes}{i1,v1} \fmf{plain}{v2,o1} \fmf{plain}{v2,o2} \fmf{photon,label=$Z'$}{v1,v2} \fmfdotn{v}{2} \end{fmfgraph*}} \end{fmffile} \end{center} \caption{\label{fig:Feyn} The processes responsible for DM production} \end{figure} \subsection{Freeze-out production of dark matter } In the early universe, the dark matter candidate $\chi$ can interact with the other particles through the $Z'$ mediated processes as shown in Fig.\ref{fig:Feyn}.\footnote{The Yukon and the $U(1)'$ gauge boson are assumed to be decoupled at the freeze-out temperature. } Since the vertices all involves gauge couplings, we do not expect the interaction to be feeble and therefore consider the freeze-out production of the dark fermion $\chi$. The Boltzmann equation of $\chi$ is \begin{eqnarray} \frac{d Y_\chi}{d X} & = & - \frac{ X \mathfrak{s} }{\mathcal{H}(m)} \left<\sigma\, v\right>_{\chi\chi} \left(Y_\chi^2-{Y_\chi^{\rm eq}}^2\right)\,, \label{eq:BE} \end{eqnarray} where $X\equiv m_\chi/T$. Define $X_f$ as the ratio of DM mass $m_\chi$ and the freeze-out temperature $T_f$. To provide an analytical view of the solution to the Boltzmann equation, we consider both the observational constraint and the general feature of freeze-out. On the one hand, by requiring the correct DM relic abundance, i.e. $Y_{\rm DM}^{\rm obs} = Y_{\chi}^{\rm eq}(X_f)$, $X_f$ has to satisfy \begin{eqnarray} X_f \equiv \frac{m_\chi}{T_f} \simeq 27.4 + 1.07\ln \frac{m_\chi}{1 \text{TeV}}\,.\label{eq:Xf} \end{eqnarray} On the other hand, as a general feature of thermal production, a particle decouples from the thermal bath when the rate of its interaction with particles in the thermal bath drop below the Hubble constant. This freeze-out criterion indicates that $\Gamma_\chi(X_f)\simeq \mathcal{H}(X_f)$, which leads to \begin{eqnarray} \left<\sigma\, v\right>_{\chi\chi}X_f^{-1}= 6.63 \times 10^{-5}\, \text{TeV}^{-2}\,.\label{fo_crit} \end{eqnarray} The thermally averaged cross section $\left<\sigma\, v\right>_{\chi\chi}$ can be computed using a general expression \begin{equation} \left<\sigma_{ij\rightarrow kl}\, v_{ij}\right> = \frac{1}{n^{\rm eq}_{i}\, n^{\rm eq}_{j}}\frac{g_i \, g_j}{S_{kl}}\frac{T}{512\pi^6} \int_{\left(m_i+m_j\right)^2}^\infty ds \, \frac{p_{ij} \, p_{kl} \,K_1\left(\sqrt{s}/T\right)}{\sqrt{s}} \int \overline{\left|\mathcal{M}\right|^2}_{ij\rightarrow kl} \, d\Omega\,. \label{avgsection} \end{equation} with the scattering amplitude of the processes in Fig.\ref{fig:Feyn} \begin{eqnarray} \int \overline{\left|\mathcal{M}\right|^2}_{\chi\chi \rightarrow \mathcal{N}\overline{\mathcal{N}}}\, d\Omega &=& {g'_1}^4\frac{2\pi}{3} \frac{(s+2M^2)(s-m_\chi^2)}{(s-M_{Z'}^2)^2 + M_{Z'}^2 \Gamma_{Z'}^2}\,,\\ \int \overline{\left|\mathcal{M}\right|^2}_{\chi\chi \rightarrow \Phi_{i}\overline{\Phi}_{i}}\, d\Omega &=& {g'_1}^4 \frac{\pi}{6} \frac{(s-4M_{\Phi_i}^2)(s-m_\chi^2)}{(s-M_{Z'}^2)^2 + M_{Z'}^2 \Gamma_{Z'}^2}\,. \end{eqnarray} Prompted by one of the motivations of the type Ib seesaw mechanism, the Dirac neutrino is assumed to be around 1-100 GeV scale, where a testable dark matter model compatible with leptogenesis can be realised \cite{Chianese:2021toe,Fu:2021fyk}. In this research, we focus on dark matter candidates above TeV scale, which means $m_\chi \gg M, M_{\Phi_i}$,\footnote{The case where the RH neutrino is heavier than dark matter candidates has been studied generally in \cite{Blennow:2019fhy}.} and the total averaged cross section reads \begin{eqnarray} \left<\sigma\, v\right>_{\chi\chi} &=& \frac{g_\chi^2}{(n^{\rm eq}_\chi)^2}\frac{T}{2048\pi^5} \, {g'_1}^4 \int_{4m_\chi^2}^\infty ds \,\sqrt{s-4m_\chi^2}\,K_1\left(\sqrt{s}/T\right)\frac{s(s-m_\chi^2)}{(s-M_{Z'}^2)^2 + M_{Z'}^2 \Gamma_{Z'}^2}\,. \label{avgsection_chi} \end{eqnarray} The decay rate of $Z'$ depends on the mass of $Z'$ and gauge coupling $g'_1$ as \begin{eqnarray} \Gamma_{Z'}={g'_1}^2\begin{dcases} \frac{1}{8\pi}M_{Z'} & M_{Z'}<2m_\chi\,, \\ \frac{1}{8\pi}M_{Z'} +\frac{1}{96\pi}\frac{M_{Z'}^2-m_\chi^2}{M_{Z'}^2}\sqrt{M_{Z'}^2-4m_\chi^2} & M_{Z'}>2m_\chi\,. \\ \end{dcases} \end{eqnarray} There are two different scenarios distinguished by whether the gauge boson $Z'$ can decay into two dark fermions or not. If the decay $Z'\rightarrow\chi\chi$ is allowed, i.e. $M_{Z'}>2m_\chi$, a resonant can be observed in Eq.\eqref{avgsection_chi}. To obtain analytical results, we consider two different limits in the masses of the dark fermion and the $U(1)'$ gauge boson: $M_{Z'}\gg m_\chi$ and $M_{Z'}\ll m_\chi$. In the case that $M_{Z'}\gg m_\chi$, the decay process of $Z'$ into dark fermions is kinetically allowed and the total averaged cross section can be simplified into \begin{eqnarray} \left<\sigma\, v\right>_{\chi\chi} &=& \frac{3{g'_1}^4}{64\pi M_{Z'}^4}\left(1+\frac{169}{9216\pi^2}{g'_1}^4 \right)^{-1}\left[m_\chi^2 \frac{K_1^2}{K_2^2} +4m_\chi T\frac{K_1}{K_2}+ \left(m_\chi^2 + 8T^2 \right)\right]\,. \end{eqnarray} Around the freeze-out temperature, Eq.\eqref{eq:Xf} implies $T\ll m_\chi$ and therefore \begin{eqnarray} \left<\sigma\, v\right>_{\chi\chi} &\simeq& \frac{3{g'_1}^4m_\chi^2}{32\pi M_{Z'}^4}\left(1+\frac{169}{9216\pi^2}{g'_1}^4 \right)^{-1} = \frac{3m_\chi^2}{32\pi v_\phi^4} \left( 1+\frac{169}{1024\pi^2}{g'_1}^4 \right)^{-1}\,. \end{eqnarray} By applying the freeze-out criterion in Eq.\eqref{fo_crit}, it can be derived that \begin{eqnarray} v_\phi^2 \simeq \frac{m_\chi}{1\, \text{TeV}}\frac{(4.6\, \text{TeV})^2}{\sqrt{27.4 + 1.07\ln \frac{m_\chi}{1 \text{TeV}}}} \left( 1+\frac{169}{9216\pi^2}{g'_1}^4 \right)^{-1/2}\, \end{eqnarray} However, the gauge coupling $g'_1$ has to be below its perturbativity limit and therefore the assumption $M_{Z'}=g'_1v_\phi \gg m_\chi$ requires \begin{eqnarray} v_\phi \ll 7.1\, \text{TeV}\,. \end{eqnarray} Remember that there is also a lower bound on the value of $v_\phi$ from the gauge boson mixing strength, which is about 3.6 TeV. Thus the limit $M_{Z'}\gg m_\chi$ considered is not eligible. On the other hand, in the case of $M_{Z'} \ll m_\chi$, the thermal average cross section can be compute as \begin{eqnarray} \left<\sigma\, v\right>_{\chi\chi} &=& \frac{3{g'_1}^4}{512\pi m_\chi^2} \end{eqnarray} when the temperature is much lower than the dark fermion mass ($T\ll m_\chi$). Then the freeze-out criterion Eq.\eqref{fo_crit} leads to \begin{eqnarray} {g'_1}^4 m_\chi^{-2} X_f^{-1} &\simeq& 3.55 \times 10^{-2}\, \text{TeV}^{-2}\,. \end{eqnarray} With the approximated expression of $X_f$ in Eq.\eqref{eq:Xf}, the result can be further simplified into the relation between the $U(1)'$ gauge coupling and dark fermion mass \begin{eqnarray} {g'_1}^2&\simeq& 0.19\frac{m_\chi}{1\,\text{TeV}}\sqrt{27.4 + 1.07\ln \frac{m_\chi}{1 \text{TeV}}}\,. \end{eqnarray} Again, by considering the perturbative limit of $g'_1$, the dark matter mass has to satisfy $m_\chi < 12.2\, \text{TeV}$. However, the constraint on the gauge boson mixing requires $v_\phi$ to be at least $3.6$ TeV. Therefore the gauge boson mass $M_{Z'}$ has a lower bound \begin{eqnarray} M_{Z'}\gtrsim{g'_1} \times 3.6\,\text{TeV} &\simeq& 1.5\,\text{TeV}\sqrt{\frac{m_\chi}{1\,\text{TeV}}\sqrt{27.4+ 1.07\ln \frac{m_\chi}{1 \text{TeV}}}}\,. \end{eqnarray} From this lower bound, it can be easily derived that the gauge boson $Z'$ cannot be lighter than the dark fermion $\chi$ if the dark fermion mass $m_\chi$ is less than $13.1$ TeV. Moreover, the ratio $M_{Z'}/m_\chi$ cannot be less than 1 for $m_\chi < 12.2\, \text{TeV}$, which is required by the perturbativity of $g'_1$. Therefore, again, the assumption of this scenario is broken and the scenario is forbidden by the constraint from the gauge boson mixing. \begin{figure}[t!] \begin{center} \subfigure[]{\includegraphics[width=0.49\textwidth]{Figures/Plotg.png}\label{fig:ra_eff}} \subfigure[]{\includegraphics[width=0.49\textwidth]{Figures/Plotg_4th.png}\label{fig:ra_4th}} \includegraphics[width=0.49\textwidth]{Figures/Colorbar.png} \caption{ Allowed values of $U(1)'$ gauge coupling for different masses of dark fermion and $U(1)'$ gauge boson in the effective model (left panel) and renormalisable model. } \end{center} \end{figure} So far the scenarios where $M_{Z'} \gg m_\chi$ and $M_{Z'} \ll m_\chi$ have been proved to be illegal, the only remaining case is $M_{Z'} \sim m_\chi$. For such a scenario, an analytical calculation is hard to be performed so some numerical results are shown in Fig.\ref{fig:ra_eff}. Similar to the analytical derivation, the numerical solution of the gauge coupling is obtained from the Boltzmann equation by requiring the correct dark matter relic abundant for each pair of dark fermion and gauge boson masses $\left(m_\chi,\,M_{Z'}\right)$. By neglecting the GeV scale neutrino mass, the only remaining free parameters affecting dark matter production are the $U(1)'$ gauge coupling $g'_1$, the dark fermion mass $m_\chi$ and the $U(1)'$ gauge boson mass $M_{Z'}$. The allowed parameter space is coloured by the required coupling constant $g'_1$ in the plot, while the excluded region is left unfilled. The red solid and yellow dashed lines in the figure show the perturbativity limits of the gauge coupling $g'_1$ and the Yukawa coupling $y-\chi$, respectively. The constraint from gauge boson mixing is presented as the black dashed line. Besides, the threshold of two different scenarios of the $Z'$ decay is also marked out by a green dashed line. As has been proved analytically, correct relic abundance can only be produced when the masses of the dark fermion $\chi$ and the $U(1)'$ gauge boson $Z'$ are similar. In the allowed region in the parameter space, the VEV of the scalar singlet, which is given by $v_\phi=M_{Z'}/g'_1$, is always far larger than the freeze-out temperature that is typically 20 times below the dark fermion mass $m_\chi$. As a result, no significant thermal effect contribute to the cross section. From Fig.\ref{fig:ra_eff}, it can be easily figured out that the masses of $\chi$ and $Z'$ can not exceed 24 TeV and 44 TeV respectively, while the parameter space for $\chi<1$ TeV and $Z'<2$ TeV is very unfavored by the massive gauge boson mixing angle. The required gauge coupling is relatively small along the threshold line for different scenarios of the $Z'$ decay with a minimum value around 0.04. Above the threshold line, the resonance is statistically suppressed during the freeze-out, while no resonance appears below the threshold line. As the $U(1)'$ gauge boson mass decreases, the coupling $g'_1$ need to be smaller as required by the gauge boson mixing in Eq.\eqref{eq:mixing}. When both the dark fermion $\chi$ and the $U(1)'$ gauge boson are a few TeV, the required coupling $g'_1$ is so small that the correct dark matter density can only be produced through the resonance in the propagator. As a result, the gauge boson mass $M_{Z'}$ is nearly twice the mass of the dark fermion $\chi$, which is also shown in the zoomed-in subfigure on the top left corner. The perturbativity limit of the Yukawa coupling $y_\chi$, although is shown in this figure, is always weaker than the constraint from massive gauge boson mixing and does not help to constrain the parameter space. \subsection{Dark matter detections} Since the neutrino EW eigenstates are not charged under the $U(1)'$ gauge symmetry, the DM annihilation into neutrinos has to be approached either by the mixing of neutrino mass eigenstates or by the mixing between massive neutral gauge bosons. The mixing angle between the neutrinos is given by $m_{\rm D}M_N^{-1}$, where $(m_{\rm D})_{i\alpha}=Y_{i\alpha}v_i/\sqrt2$ and $M_N$ is the mass matrix of the Dirac neutrino, while the mixing angle between the massive gauge bosons is given in Eq.\eqref{eq:mixing} and below. For sub-TeV scale Dirac neutrinos, the experimental upper bound on the largest Yukawa coupling is typically around $0.01$ \cite{Chianese:2021toe}, therefore the active-sterile neutrino mixing can play an important role in indirect detection. At zero temperature limit, the cross section of DM annihilation is given by \begin{eqnarray} \sigma_{\rm ann}&=&\frac{{g'_1}^4}{8\pi}\frac{m_\chi^2}{(4m_\chi^2-M_{Z'}^2)^2+ M_{Z'}^2 \Gamma_{Z'}^2}\left[\sum_{\alpha}\left(\sum_{i}\frac{Y_{i\alpha}v_i}{M} \right)^2 + \left(\frac{0.2 \,\text{TeV} }{M_{Z'}}\right)^4\right]\,. \end{eqnarray} Around the scale of a few TeV, the dark fermion and $U(1)'$ gauge boson masses roughly follow the relation $M_{Z'}=2m_\chi$, and the velocity averaged DM annihilation cross section can be expressed as \begin{eqnarray} \langle\sigma_{\rm ann}v\rangle&=&1.2 \times10^{-25} \,\text{cm}^3/\text{s}\, \left(\frac{1 \,\text{TeV}}{M_{Z'}}\right)^2 \left[\sum_{\alpha}\left(\sum_{i}\frac{Y_{i\alpha}v_i}{M} \right)^2 + \left(\frac{0.2 \,\text{TeV} }{M_{Z'}}\right)^4\right]\,, \end{eqnarray} where the RMS velocity of the standard DM halo and the solar rotation speed are considered as in \cite{Frankiewicz:2015zma}. Inside the bracket, the first term is the contribution from active-sterile neutrino mixing, which is roughly constrained to be less than $10^{-5}$ by collider data \cite{Chianese:2021toe}, while the second term is the contribution from massive gauge boson mixing, which is constrained to be less than $10^{-4}$ as $Z'$ is required to be heavier than 2 TeV to produce the correct relic abundance as shown in figure Fig.\ref{fig:ra_eff}. Therefore the minimum required sensitivity in the velocity averaged DM annihilation cross section is around $10^{-29} \,\text{cm}^3/\text{s}$, which is lower than the expected sensitivity of Hyper-K\cite{Frankiewicz:2015zma}. As in the case of DM annihilation, dark matter can interact with the nucleons through the mixing of massive gauge bosons.\footnote{In the renormalisable model discussed in the next section, the dark matter can also interact with the nucleons through quark mixing with the fourth family quarks. However, such a mixing only appears for the $d$ quark in nucleons as the $u$ quark has zero couplings to the fourth family quarks, and the strength is suppressed by the mass of $d_4$. } The cross section of DM-nucleon scattering has both a spin-independent (SI) and a spin-dependent (SD) component. In this model, their expressions read \cite{Boveia:2016mrp} \begin{eqnarray} \sigma_{\rm SI}&=&5.3\times10^{-49}\,\text{cm}^2 {g'_1}^4\left(\frac{1\,\text{TeV}}{M_{Z'}}\right)^8\, \quad \text{and}\quad \sigma_{\rm SD}=1.9\times10^{-47}\,\text{cm}^2 {g'_1}^4\left(\frac{1\,\text{TeV}}{M_{Z'}}\right)^8\,. \end{eqnarray} Due to Eq.\eqref{eq:mixing}, the SI and SD cross section have to be smaller than $1.3\times10^{-55}$ and $4.6\times10^{-54}$ respectively, which lie below the current sensitivity of direct detection experiments \cite{XENON:2018voc,XENON:2019rxp,PICO:2019vsc,XENON:2020kmp}. \section{Renormalisable model with fourth family vector-like fermions \label{sec:four}} As mentioned before, the minimal model in Tab.\ref{tab:Ib} does not allow renormalisable interaction as the origin of charged fermion mass. Besides, the type II 2HDM structure is not ensured by any symmetry in the dimension-5 operators. Therefore, for the completeness of the theory, it is urgent to construct a renormalisable theory which preserves the structure of type II 2HDM in a natural way. This can be achieved by introducing a fourth family of vector-like fermions as shown in Tab.\ref{tab:Ib_ex}. \begin{table}[t!] \centering \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hline & ${q_L}_\alpha$ & ${u_R}_\beta$ & ${d_R}_\beta$ & ${\ell_L}_\alpha$ & ${e_R}_\beta$ & ${q}_4$ & $u_4$ & $d_4$ & $\ell_4$ & $e_4$ & $\Phi_{1}$ & $\Phi_{2}$ & $\mathcal{N}$ & $\chi_R$ & $\phi$\\[1pt] \hline & & & & & & & & & & & & & & & \\ [-1em] $SU(2)_L$ & {\bf 2} & {\bf 1} & {\bf 1} & {\bf 2} & {\bf 1} & {\bf 2} & {\bf 1} & {\bf 1} & {\bf 2} & {\bf 1} & {\bf 2} & {\bf 2} & {\bf 1} & {\bf 1} & {\bf 1} \\ \hline & & & & & & & & & & & & & & & \\ [-1em]& & & & & & & & & & & & & & & \\ [-1em] $U(1)_Y$ & $\frac{1}{6}$ & $\frac{2}{3}$ & $-\frac{1}{3}$ & $-\frac{1}{2}$ & $-1$ & $\frac{1}{6}$ & $\frac{2}{3}$ & $-\frac{1}{3}$ & $-\frac{1}{2}$ & $-1$ & $-\frac{1}{2}$ & $-\frac{1}{2}$ & 0 & 0 & 0 \\[2pt] \hline & & & & & & & & & & & & & & & \\ [-0.9em] $U(1)'$ & $0$ & $0$ & $0$ & $0$ & $0$ & $-1$ & $1$ & $1$ & $-1$ & $1$ & $1$ & $-1$ & $1$ & $\frac12$ & 1 \\ [0.2em] \hline \end{tabular} \caption{\label{tab:Ib_ex}Irreducible representations of the fields of the model under the electroweak $SU(2)_L \times U(1)_Y \times U(1)'$ gauge symmetry. The fields ${q_L}_{\alpha}, {\ell_L}_{\alpha}$ are left-handed SM doublets while ${u_R}_\beta,{d_R}_\beta,{e_R}_\beta$ are right-handed SM singlets where $\alpha, \beta$ label the three families of quarks and leptons. The two right-handed neutrino fields $N_{\mathrm{R}{1,2}}$ are written as a Dirac pair $\mathcal{N}$.} \end{table} With new vector like fermions, the allowed Yukawa interactions between charged fermions and scalars are \begin{eqnarray} \mathcal{L}_{\rm Yuk} & \supset & - Y^{qu}_{\alpha 4} \overline{q_L}_\alpha \Phi_2 u_4 - Y^{qd}_{\alpha 4} \overline{q_L}_\alpha {\tilde \Phi}_1 d_4 - Y^u_{\beta 4} \overline{u_{\mathrm{R}}}_\beta \Phi_2^\dagger q_4 - Y^d_{\beta 4} \overline{d_{\mathrm{R}}}_\beta {\tilde \Phi}_1^\dagger q_4 - Y^\ell_{\alpha 4} \overline{\ell}_\alpha {\tilde \Phi}_1 e_4 - Y^e_{\beta 4} \overline{e_{\mathrm{R}}}_\beta {\tilde \Phi}_1^\dagger \ell_4 \nonumber \\&& - y^q_{\alpha 4} \phi\, \overline{q_L}_\alpha q_4 - y^u_{\beta 4} \overline{\phi}\, \overline{u_{\mathrm{R}}}_\beta u_4 - y^d_{\beta 4} \overline{\phi}\, \overline{d_{\mathrm{R}}}_\beta d_4 - y^\ell_{\alpha 4} \phi\, \overline{\ell_L}_\alpha \ell_4 - y^e_{\beta 4} \overline{\phi}\, \overline{e_{\mathrm{R}}}_\beta e_4 + {\rm h.c.}\,. \label{eq:Yuk4f} \end{eqnarray} The mass terms of the fourth family fermions are also imposed as \begin{eqnarray} \mathcal{L}_{\rm mass} & \supset & M^q_4 \overline{q_4} q_4 + M^u_{4} \overline{u_4} u_4 + M^d_{4} \overline{d_4} d_4 + M^\ell_{4} \overline{\ell_4} \ell_4 + M^e_{4} \overline{e_4} e_4 \,, \label{eq:mass:quark} \end{eqnarray} where all the masses of the vector-like fermions are considered to be far larger than the EW scale. Similar to the Weinberg operator in the seesaw mechanism, some dimension-5 effective operators can be generated by integrating out the fourth family fermion fields \begin{eqnarray} \mathcal{L}_{\rm eff} &= & - \frac{1}{M^u_4}Y^{qu}_{\alpha 4} (y^u_{\beta 4})^* \overline{q_L}_\alpha \Phi_2 \phi\, u_{\mathrm{R}\beta} - \frac{1}{M^q_4}y^q_{\alpha 4} (Y^u_{\beta 4})^* \overline{q_L}_\alpha \Phi_2 \phi\, u_{\mathrm{R}\beta}\nonumber\\&& - \frac{1}{M^d_4}Y^{qd}_{\alpha 4} (y^d_{\beta 4})^* \overline{q_L}_\alpha {\tilde \Phi}_1 \phi\, d_{\mathrm{R}\beta} - \frac{1}{M^q_4}y^q_{\alpha 4} (Y^d_{\beta 4})^* \overline{q_L}_\alpha {\tilde \Phi}_1 \phi\, d_{\mathrm{R}\beta}\nonumber\\&& - \frac{1}{M^e_4}Y^\ell_{\alpha 4} (y^u_{\beta 4})^* \overline{\ell}_\alpha {\tilde \Phi}_1 \phi\, e_{\mathrm{R}\beta} - \frac{1}{M^\ell_4}y^\ell_{\alpha 4} (Y^u_{\beta 4})^* \overline{\ell}_\alpha {\tilde \Phi}_1 \phi\, e_{\mathrm{R}\beta} + {\rm h.c.} \label{eq:Yuk_eff} \end{eqnarray} The diagrams for interaction between quark doublets and up-type quarks are shown in Fig.\ref{fig:u-quark} as an example. \begin{figure}[t!] \begin{center} \begin{fmffile}{FeynDiag/u_quark_Yuk_1} \fmfframe(10,10)(10,10){ \begin{fmfgraph*}(200,45) \fmflabel{$u_{\mathrm{R}\beta}$}{o1} \fmflabel{}{o2} \fmflabel{}{i2} \fmflabel{$q_\alpha$}{i1} \fmfv{}{v1} \fmfv{decor.shape=cross,decor.size=8,label=$M^u_4$,label.angle=90}{v2} \fmfv{}{v3} \fmfv{label=$\Phi_2$,label.angle=90}{v4} \fmfv{}{v5} \fmfv{label=$\phi$,label.angle=90}{v6} \fmfleft{i1,i2} \fmfright{o1,o2} \fmf{fermion,tension=0.6}{i1,v1} \fmf{fermion,label=$u_4$,l.side=right}{v1,v2} \fmf{fermion,label=$u_4$,l.side=right}{v2,v3} \fmf{fermion,tension=0.6}{v3,o1} \fmf{phantom,tension=0.6}{i2,v4} \fmf{phantom}{v5,v4} \fmf{phantom}{v5,v6} \fmf{phantom,tension=0.6}{o2,v6} \fmf{dashes,tension=0}{v1,v4} \fmf{phantom,tension=0}{v2,v5} \fmf{dashes,tension=0}{v3,v6} \end{fmfgraph*}} \end{fmffile} \begin{fmffile}{FeynDiag/u_quark_Yuk_2} \fmfframe(10,10)(10,10){ \begin{fmfgraph*}(200,45) \fmflabel{$u_{\mathrm{R}\beta}$}{o1} \fmflabel{}{o2} \fmflabel{}{i2} \fmflabel{$q_\alpha$}{i1} \fmfv{}{v1} \fmfv{decor.shape=cross,decor.size=8,label=$M^q_4$,label.angle=90}{v2} \fmfv{}{v3} \fmfv{label=$\phi$,label.angle=90}{v4} \fmfv{}{v5} \fmfv{label=$\Phi_2$,label.angle=90}{v6} \fmfleft{i1,i2} \fmfright{o1,o2} \fmf{fermion,tension=0.6}{i1,v1} \fmf{fermion,label=$q_4$,l.side=right}{v1,v2} \fmf{fermion,label=$q_4$,l.side=right}{v2,v3} \fmf{fermion,tension=0.6}{v3,o1} \fmf{phantom,tension=0.6}{i2,v4} \fmf{phantom}{v5,v4} \fmf{phantom}{v5,v6} \fmf{phantom,tension=0.6}{o2,v6} \fmf{dashes,tension=0}{v1,v4} \fmf{phantom,tension=0}{v2,v5} \fmf{dashes,tension=0}{v3,v6} \end{fmfgraph*}} \end{fmffile} \caption{\label{fig:u-quark} Effective interaction between quark doublets and up-type quarks} \end{center} \end{figure} After the Yukon $\phi$ gains a VEV, the resulting interactions are coincident with the Lagrangian in Eq.\eqref{eq:Yuk} with Yukawa couplings \begin{eqnarray} Y^u_{\alpha \beta} = \frac{Y^{qu}_{\alpha 4} (y^u_{\beta 4})^*\langle\phi\rangle}{M^u_4} + \frac{y^q_{\alpha 4} (Y^u_{\beta 4})^*\langle\phi\rangle}{M^q_4} \,, \\ Y^d_{\alpha \beta} = \frac{Y^{qd}_{\alpha 4} (y^d_{\beta 4})^*\langle\phi\rangle}{M^d_4} + \frac{y^q_{\alpha 4} (Y^d_{\beta 4})^*\langle\phi\rangle}{M^q_4} \,, \\ Y^e_{\alpha \beta} = \frac{Y^\ell_{\alpha 4} (y^u_{\beta 4})^*\langle\phi\rangle}{M^e_4} + \frac{y^\ell_{\alpha 4} (Y^u_{\beta 4})^*\langle\phi\rangle}{M^\ell_4} \,. \label{eq:Yuk_couplings} \end{eqnarray} Although the only constraint on the couplings in Eq.\eqref{eq:Yuk4f} is from the SM fermion mass matrix in a general basis, there exist a particular basis where some of the couplings can be zero \cite{King:2018fcg}. By rechoosing the chiral quark basis, we can find a basis where \begin{eqnarray} y^q_{\alpha 4} = \begin{pmatrix} 0 & 0 & y^q_{34} \end{pmatrix} \,, \quad Y^{qu}_{\alpha 4} =&& \begin{pmatrix} 0 & Y^{qu}_{24} & Y^{qu}_{34} \end{pmatrix} \,, \quad Y^{qd}_{\alpha 4} = \begin{pmatrix} Y^{qd}_{14} & Y^{qd}_{24} & Y^{qd}_{34} \end{pmatrix} \,, \quad \\ Y^u_{\beta 4} = \begin{pmatrix} 0 & 0 & Y^u_{34} \end{pmatrix} &&\,, \quad y^u_{\beta 4} = \begin{pmatrix} 0 & y^u_{24} & y^u_{34} \end{pmatrix} \,, \\ Y^d_{\beta 4} = \begin{pmatrix} 0 & 0 & Y^d_{34} \end{pmatrix} &&\,, \quad y^d_{\beta 4} = \begin{pmatrix} 0 & y^d_{24} & y^d_{34} \end{pmatrix} \,. \end{eqnarray} In such a basis, the quark couplings in Eq.\eqref{eq:Yuk_couplings} read \begin{eqnarray} Y^u_{\alpha \beta} &=& \begin{pmatrix} 0 & 0 & 0 \\ 0 & Y^{qu}_{24} (y^u_{24})^* & Y^{qu}_{24}(y^u_{34})^* \\ 0 & Y^{qu}_{34} (y^u_{24})^* & Y^{qu}_{34}(y^u_{34})^* \end{pmatrix} \frac{\langle\phi\rangle}{M^u_4} + \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & y^q_{34}(Y^u_{34})^* \end{pmatrix} \frac{\langle\phi\rangle}{M^q_4} \,, \\ Y^d_{\alpha \beta} &=& \begin{pmatrix} 0 & Y^{qd}_{14} (y^d_{24})^* & Y^{qd}_{14}(y^d_{34})^* \\ 0 & Y^{qd}_{24} (y^d_{24})^* & Y^{qd}_{24}(y^d_{34})^* \\ 0 & Y^{qd}_{34}(y^d_{24})^* & Y^{qd}_{34}(y^d_{34})^* \end{pmatrix} \frac{\langle\phi\rangle}{M^d_4} + \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & y^q_{34}(Y^d_{34})^* \end{pmatrix} \frac{\langle\phi\rangle}{M^q_4} \,. \end{eqnarray} Without further modification, the first family quark remains massless in this basis. The problem can be solved by considering some more massive particles, such as a neutral Higgs messenger \cite{Ferretti:2006df}, which also helps to explain the quark mass hierarchy. Nevertheless, the massive particles are not likely to make any phenomenological effects other than the up quark mass and therefore are not going to be discussed further. To explain the heaviness of top quark, the mass of $q_4$ is assumed to be lighter than $u_4$ and $d_4$, not to speak of $\ell_4$ and $e_4$. As the Yukawa coupling of top quark, namely $Y^u_{33}$, is determined by $m_{\rm t}/\langle\Phi_2\rangle\simeq1$, $M^q_4$ cannot be much larger than $\langle\phi\rangle$. On the other hand, the experimental limit from vector-like top (VLT) decay on $M^q_4$ is around 1 TeV \cite{King:2020mau}. If $q_4$ is not too heavy, it makes an extra contribution to the amplitude during the freeze-out in addition to the processes in Fig.\ref{fig:Feyn}, as shown in Fig.\ref{fig:Feyn_q4}. \begin{figure}[t!] \begin{center} \begin{fmffile}{FeynDiag/DMpro3} \fmfframe(20,20)(20,20){ \begin{fmfgraph*}(80,45) \fmflabel{$\chi$}{o1} \fmflabel{$\chi$}{o2} \fmflabel{$q_4$}{i2} \fmflabel{$\overline{q_4}$}{i1} \fmfv{label=$g_1'$}{v1} \fmfv{label=$\frac{g_1'}{2}$}{v2} \fmfleft{i1,i2} \fmfright{o1,o2} \fmf{plain}{i2,v1} \fmf{plain}{i1,v1} \fmf{plain}{v2,o1} \fmf{plain}{v2,o2} \fmf{photon,label=$Z'$}{v1,v2} \fmfdotn{v}{2} \end{fmfgraph*}} \end{fmffile} \end{center} \caption{\label{fig:Feyn_q4} The process responsible for DM production in the complete model in addition to those in Fig.\ref{fig:Feyn}} \end{figure} And it will also affect the decay rate of the new gauge boson if $q_4$ is more than twice lighter than $Z'$. Here, to quantify the influence of the vector-like fermions, we consider $q_4$ with a mass of 1 TeV and show the allowed parameter space in Fig.\ref{fig:ra_4th} in a similar style to the one in Fig.\ref{fig:ra_eff} for the effective model. Compared with the result in the effective model, the maximal masses of the dark fermion $\chi$ and the gauge boson $Z'$ increased to 31 TeV and 52 TeV respectively. As the allowed parameter space is enlarged, the perturbativity limit of the Yukawa-type interaction coupling in the dark sector starts to play a role in constraining the parameters. For TeV scale dark matter candidate, again, the relation $M_{Z'}\simeq2m_\chi$ is required by the constraint on $Z-Z'$ mixing angle. \section{Conclusion \label{sec:Concl}} In this paper, we have considered the possibility that dark matter is stabilised by a discrete $Z_2$ symmetry which arises from a subgroup of a $U(1)'$ gauge symmetry, spontaneously broken by integer charged scalars, and under which the chiral quarks and leptons do not carry any charges. A chiral fermion $\chi$ with half-integer charge is odd under the preserved $Z_2$, and hence becomes a stable dark matter candidate, being produced through couplings to right-handed neutrinos with vector-like $U(1)'$ charges. We have constructed an effective model along these lines as an extension of the type Ib seesaw model where the light neutrino mass originates from a new type of Weinberg operator involving two Higgs doublets and a heavy Dirac neutrino. In such a model, the Majorana mass of the heavy neutrinos is forbidden by the $U(1)'$ gauge symmetry and therefore the usual type Ia seesaw mechanism is not allowed. Although the SM charged fermions cannot interact with the Higgs doublets through Yukawa type interaction due to the $U(1)'$ symmetry, they can gain mass from dimension five effective operators involving a Higgs singlet named Yukon, which is integer charged under the $U(1)'$ symmetry, and is responsible for breaking it to $Z_2$. After the $U(1)'$ symmetry breaking, the dark matter candidate $\chi$ can only interact with the thermal bath through processes mediated by the $U(1)'$ gauge boson and therefore can be produced thermally in the early universe. We have explored the allowed parameter space of the effective model providing the correct dark matter relic abundance. Through analytical computation, we have found that the dark matter can only be produced correctly when there is no hierarchy between the masses of the dark fermion $\chi$ and the $U(1)'$ gauge boson. The numerical results show that there exists a resonance in the cross section when the dark fermion mass is half of the $U(1)'$ gauge boson. For this reason, the experimental bound on the massive gauge boson mixing prefers the line $M_{Z'}=2m_\chi$ for TeV scale dark matter candidate. Although the parameter space is not constrained by current experiments, we have estimated the required sensitivity for direct and indirect detections in this model. We then considered a high energy renormalisable model with a complete fourth family of vector-like fermions, where the chiral quark and lepton masses arise from a seesaw-like mechanism. With the inclusion of the fourth family, the lightest vector-like quark can contribute to the dark matter production, enlarging the allowed parameter space that we explore. By integrating out the vector-like fermions, the non-renormalisable type Ib seesaw model can be obtained effectively with the charged fermion masses generated as in a type II 2HDM. Taking the contribution from the lightest fourth family quark into consideration, we have found that the allowed parameter space is enlarged, while the constraint on $Z-Z'$ mixing still keeps the relation $M_{Z'}=2m_\chi$ when the dark matter candidate is around TeV scale. In conclusion, we have proposed and explored a model which can account for both dark matter and neutrino mass and mixing, without requiring the addition of discrete symmetries to stabilise the dark matter mass. We have focussed on a fermiophobic $U(1)'$ model in which vector-like right-handed neutrinos form a Dirac neutrino mass and act as a portal for dark matter production, while at the same time providing a low scale testable seesaw mechanism referred to as type Ib since it involves two different Higgs doublets. \section*{Acknowledgments} We would like to thank Simon King for suggesting the mechanism studied here. BF acknowledges the Chinese Scholarship Council (CSC) Grant No.\ 201809210011 under agreements [2018]3101 and [2019]536. SFK acknowledges the STFC Consolidated Grant ST/L000296/1 and the European Union’s Horizon 2020 Research and Innovation programme under Marie Sklodowska-Curie grant agreement HIDDeN European ITN project (H2020-MSCA-ITN-2019//860881-HIDDeN).
\section{Introduction} Hamilton \cite{a13} defined the notion of Yamabe flow in order to solve the Yamabe problem. The importance of the notion that Yamabe solitons seem as singularity models which are self-similar solutions for Yamabe flows. Many authors has studied this notion intensively. (see \cite{a3}, \cite{a4}, \cite{a5}, \cite{uc}, \cite{a15}, \cite{a17}.) Almost Yamabe solitons, which are the natural generalization of Yamabe solitons was given as follows \cite{a2}; {\it{A Riemannian manifold $M$ is said to be an almost Yamabe soliton $(M, g, \eta, \mu)$ if there exists a vector field $V$ on $M$ which satisfies \begin{align} \frac{1}{2} \mathcal{L}_{\eta} g=(\tau-\mu) g \label{ays}, \end{align} where $\tau$ is the scalar curvature of $M,~ \mu$, a smooth function, $\eta$, a soliton field for $(M, g)$ and $\mathcal{L}$ is the Lie-derivative.}} Moreover, we say that {\it{an almost Yamabe soliton is steady, expanding or shrinking if $\mu=0, ~\mu<0$ or $\mu>0$, respectively.}} An almost Yamabe soliton is said to be the Yamabe soliton if $\mu$ is a constant in the definition (\ref{ays}). It is obvious that Einstein manifolds are almost Yamabe solitons. On the other hand, the theory of Riemannian submersions between Riemannian manifolds were introduced by O'Neill \cite{a16} and Gray \cite{a9}, respectively. It has been extended intensively in the last three decades. (For the interested readers, we refer to \cite{a8F}, \cite{a9}, \cite{a16}, \cite{a19}). Later, Riemannian submersions were considered between almost complex manifolds by Watson \cite{a20} under the name of almost Hermitian submersions. He showed that under almost Hermitian submersions the base manifold takes the form as total space in most cases. Since then, Riemannian submersions have been used as an effective tool to describe the structure of a Riemannian manifold equipped with a differentiable structure. Considering the above studies of almost Yamabe solitons and Riemannian submersions, the objective of the present paper is to study the almost Hermitian submersions whose total space is an almost Yamabe soliton which is also verified through an example. Basic tools of the mentioned theory are given in section 2. Section 3 essentially concerns with Keahler submersions admitting almost Yamabe soliton. Some observations are also mentioned while the potential vector field of almost Yamabe soliton is torqued, recurrent or concurrent vector field. \section{Preliminaries} This section often involve well known definitions and concepts of almost Hermitian submersions which are present in subsequest sections and can be found through the index. \\ Let $(M_1,g_1)$ and $(M_2,g_{\text{\tiny$2$}})$ be Riemannian manifolds, where $\dim(M_1)$ is greater than $\dim(M_2)$. A surjective mapping $\pi:(M_1,g_1)\rightarrow(M_2,g_{2})$ is called a \emph{Riemannian submersion} \cite{a16} if\\ \text{(S1)} $\pi$ has maximal rank, and \\ \text{(S2)} $\pi_{*}$, restricted to $\ker\pi_{*}^{\bot},$ is a linear isometry.\\ In this case, for each $q\in M_2$, $\pi^{-1}(q)$ is a $k$-dimensional submanifold of $M_1$ and called a \emph{fiber}, where $k=\dim(M_1)-\dim(M_2).$ A vector field on $M_1$ is called \emph{vertical} (resp. \emph{horizontal}) if it is always tangent (resp. orthogonal) to fibers. A vector field $X$ on $M_1$ is called \emph{basic} if $X$ is horizontal and $\pi$-related to a vector field $X_{*}$ on $M_2,$ i.e., $\pi_{*}X_{p}=X_{*\pi(p)}$ for all $p\in M_1.$ We will denote by $\mathcal{V}$ and $\mathcal{H}$ the projections on the vertical distribution $\ker\pi_{*}$, and the horizontal distribution $\ker\pi_{*}^{\bot},$ respectively. As usual, the manifold $(M_1,g_1)$ is called \emph{total manifold} and the manifold $(M_2,g_{2})$ is called \emph{base manifold} of the submersion $\pi:(M_1,g_1)\rightarrow(M_2,g_{2})$. The geometry of Riemannian submersions is characterized by O'Neill's tensors $\mathcal{T}$ and $\mathcal{A}$, defined as follows: \begin{equation}\label{tuv} \mathcal{T}_{U}{V}=\mathcal{V}\nabla_{\mathcal{V}{U}}\mathcal{H}{V}+\mathcal{H}\nabla_{\mathcal{V}{U}}\mathcal{V}{V}, \end{equation} \begin{equation}\label{auv} \mathcal{A}_{U}{V}=\mathcal{V}\nabla_{\mathcal{H}{U}}\mathcal{H}{ V}+\mathcal{H}\nabla_{\mathcal{H}{U}}\mathcal{V}{V} \end{equation} for any vector fields ${U}$ and ${V}$ on $M_1,$ where $\nabla$ is the Levi-Civita connection of $g_1$. It is easy to see that $\mathcal{T}_{{U}}$ and $\mathcal{A}_{{U}}$ are skew-symmetric operators on the tangent bundle of $M_1$ reversing the vertical and the horizontal distributions. We now summarize the properties of the tensor fields $\mathcal{T}$ and $\mathcal{A}$. Let $V, W$ be vertical and $X, Y$ be horizontal vector fields on $M_1$, then we have \begin{equation}\label{t1vw} \mathcal{T}_{V}W=\mathcal{T}_{W}V, \end{equation} \begin{equation}\label{a1xy} \mathcal{A}_{X}Y=-\mathcal{A}_{Y}X=\frac{1}{2}\mathcal{V}[X,Y]. \end{equation} On the other hand, from (\ref{t1vw}) and (\ref{a1xy}), we obtain \begin{equation}\label{nvw} \nabla_{V}W=\mathcal{T}_{V}W+\hat{\nabla}_{V}W, \end{equation} \begin{equation}\label{nvx} \nabla_{V}X=\mathcal{T}_{V}X+\mathcal{H}\nabla_{V}X, \end{equation} \begin{equation}\label{nxv} \nabla_{X}V=\mathcal{A}_{X}V+\mathcal{V}\nabla_{X}V, \end{equation} \begin{equation}\label{nxy} \nabla_{X}Y=\mathcal{H}\nabla_{X}Y+\mathcal{A}_{X}Y, \end{equation} where $\hat{\nabla}_{V}W=\mathcal{V}\nabla_{V}W$. If $X$ is basic \[\mathcal{H}\nabla_{V}X=\mathcal{A}_{X}V.\] \begin{remark}\label{remark1} Throughout the article, we have assumed all horizontal vector fields as basic vector fields. \end{remark} It is not difficult to observe that $\mathcal{T}$ acts on the fibers as the second fundamental form while $\mathcal{A}$ acts on the horizontal distribution and measures of the obstruction to the integrability of this distribution. For details on Riemannian submersions, we refer to O'Neill's paper \cite{a16} and the book \cite{a8F}. Furthermore, the O'Neill tensors $\mathcal{T}$ and $\mathcal{A}$ satisfy \begin{align*} \sum_{j=1}^{r} g_1\left(\mathcal{T}_{U} U_{j}, \mathcal{T}_{V} U_{j}\right)=\sum_{i=1}^{n} g_1\left(\mathcal{T}_{U} X_{i}, \mathcal{T}_{V} X_{i}\right) \\ \sum_{j=1}^{r} g_1\left(\mathcal{A}_{X} U_{j}, \mathcal{A}_{Y} U_{j}\right)=\sum_{i=1}^{n} g_1\left(\mathcal{A}_{X} X_{i}, \mathcal{A}_{Y} X_{i}\right) \\ \sum_{j=1}^{r} g_1\left(\mathcal{A}_{X} U_{j}, \mathcal{T}_{U} U_{j}\right)=\sum_{i=1}^{n} g_1\left(\mathcal{A}_{X} X_{i}, \mathcal{T}_{U} X_{i}\right), \end{align*} where $\left\{U_{j}\right\}_{1 \leq j \leq r}$ and $\left\{X_{i}\right\}_{1 \leq i \leq n}$ are orthonormal frames of vertical distribution $\mathcal{V}$ and horizontal distribution $\mathcal{H}$, respectively, for any $X, Y \in \mathcal{H}$ and $U, V \in \mathcal{V}$. Denote the Riemannian curvature tensors of $M_1, M_2$ and any fiber by $R^{\prime}, R$ and $\hat{R}$, respectively. Then, we get \begin{align} R(U, V, F, W)&=\hat{R}(U, V, F, W)+g_1\left(\mathcal{T}_{V} F, \mathcal{T}_{U} W\right)-g_1\left(\mathcal{T}_{U} F, \mathcal{T}_{V} W\right) \label{uvfw},\\ R(X, Y, G, Z)&=R^{\prime}\left(X^{\prime}, Y^{\prime}, G^{\prime}, Z^{\prime}\right) \circ \pi-g_1\left(\mathcal{A}_{Y} G, \mathcal{A}_{X} Z\right)\notag \\ &+2 g_1\left(\mathcal{A}_{X} Y, \mathcal{A}_{G} Z\right)+g_1\left(\mathcal{A}_{X} G, \mathcal{A}_{Y} Z\right)\label{x,y,g,z}, \end{align} for any horizontal vectors $X, Y, G, Z$ and vertical vectors $U, V, F, W$. Moreover, denoting the mean curvature vector of any fiber by $H$ which is given as $N=r H,$ such that \begin{equation} N=\sum_{j=1}^{r} \mathcal{T}_{V_{j}} V_{j},\label{n12} \end{equation} where $\left\{V_{1}, V_{2}, \ldots, V_{r}\right\}$ is an orthonormal frame of $\mathcal{V}$. Also, remark that $$ \mathcal{T}_{U} V=g(U, V) H $$ is satisfied for $U, V$ tangent to $\mathcal{V}$ if and only if the fiber is totally umbilical submanifold. Indeed, the vector field $N$ is zero on $M_1$ if and only if any fiber is minimal. Using \ref{n12}, one has $$ g_1\left(\nabla_{E} N, Z\right)=\sum_{j=1}^{r} g_1\left(\left(\nabla_{E} \mathcal{T}\right)\left(U_{j}, U_{j}\right), Z\right), $$ where $Z$ is any horizontal vector field and $E$, an arbitarary vector field $M_1$.\\ A $(1,1)-$ tensor field $J$ on an $2 n-$ dimensional smooth manifold $M$ is said to be an almost complex structure if $J^{2}=-I$. An almost Hermitian manifold $(M, g, J)$ is a smooth manifold endowed with an almost complex structure $J$ and a Riemannian metric $g$ compatible in the sense that $$ g\left(J X_{1}, X_{2}\right)+g\left(X_{1}, J X_{2}\right)=0, \quad X_{1}, X_{2} \in \chi(M). $$ The Kaehler form of the almost Hermitian manifold is defined by $\Phi\left(X_{1}, X_{2}\right)=g\left(X_{1}, J X_{2}\right)$. An almost Hermitian manifold is called Kaehler manifold if $\nabla J=0,$ where $\nabla$ is a Levi-Civita connection with respect to $g$. Now, we recall some basic notions about almost Hermitian submersions from (\cite{a8F}, \cite{a13J}, \cite{a20}). Let $\left(M_{1}, g_{1}, J_{1}\right)$ and $\left(M_{2}, g_{2}, J_{2}\right)$ be almost Hermitian manifolds. Riemannian submersion $\pi: M_{1} \rightarrow M_{2}$ is said an almost Hermitian submersion if $\phi$ is an almost complex map, i.e. if $\pi_{*} \circ J_{1}=J_{2} \circ \pi_{*}$ holds. Moreover, an almost Hermitian submersion is called a Kaehler if the total space is Kaehler manifold. It is well known that the fibres and the base manifold of an almost Hermitian submersions belong to the same class as the total space. Finally, for a given almost Hermitian submersion the scalar curvatures of total space, the base space and the fibres are related by \begin{align} \tau=\left(\tau^{\prime} \circ \pi\right)+\hat{\tau}-\|\mathcal{T}\|^{2} \label{mtau} \end{align} such that $\|\mathcal{T}\|^{2}=\sum_{i, j} g_1\left(\mathcal{T}_{U_{j}} X_{i}, \mathcal{T}_{U_{j}} X_{i}\right),$ where $\hat{\tau}$ and $\tau^{\prime}$ are the scalar curvatures of any fiber of $\pi$ and the base manifold respectively \cite{a8F}. \section{Almost Hermitian submersions from an almost Yamabe soliton} This section includes our investigation on the almost Hermitian submersion, in particular, the Kaehler submersion $\pi:(M_1, g_1, J_1)\to( M_{2}, g_{2}, J_{2})$ whose total space admits an almost Yamabe soliton. We start with an example to provide a formal assurance of the existence of such solitons on the total manifold of almost Hermitian submersions. \begin{example} Let $\left(\mathbb{R}^{4}, J_{1}, g_{1}\right)$ be an almost Hermitian manifold endowed with an almost complex structure $\left(J_{1}, g_{1}\right)$ which is given by $$ \begin{aligned} &g_{1}=e^{-2 x_{3}} d x_{1}^{2}+e^{-2 x_{4}} d x_{2}^{2}+d x_{3}^{2}+d x_{4}^{2} \\ &J_{1}\left(x_{1}, x_{2}, x_{3}, x_{3}\right)=\left(-x_{2}, x_{1},-x_{4}, x_{3}\right) \end{aligned} $$ Let $\left(\mathbb{R}^{2}, J_{2}, g_{2}\right)$ be an almost Hermitian manifold endowed with an almost complex structure $\left(J_{2}, g_{2}\right)$, given by $$ \begin{aligned} &g_{2}=e^{2 y_{2}} d y_{1}^{2}+d y_{2}^{2} \\ &J_{2}\left(y_{1}, y_{2}\right)=\left(-y_{2}, y_{1}\right) \end{aligned} $$ Let $\pi:\left(\mathbb{R}^{4}, J_{1}, g_{1}\right) \longrightarrow\left(\mathbb{R}^{2}, J_{2}, g_{2}\right)$ be defined by $$ \pi\left(x_{1}, x_{2}, x_{3}, x_{4}\right)=\left(\frac{x_{1}-x_{3}}{\sqrt{2}}, \frac{x_{2}-x_{4}}{\sqrt{2}}\right) $$ Then $$ \operatorname{Ker} \pi_{*}=\operatorname{span}\left\{U_{1}=e_{1}+e_{3}, \quad U_{2}=e_{2}+e_{4}\right\} $$ and $$\left(\operatorname{Ker} \pi_*\right)^\perp=\operatorname{span}\left\{X_{1}=e_{1}-e_{3}, \quad X_{2}=e_{2}-e_{4}\right\}$$ where $\left\{e_{1}=e^{x_{3}} \partial x_{1}, e_{2}=e^{x _ 4} \partial x_{2}, \quad e_{3}=\partial x_{3}, e_{4}=d x_{4}\right\}$ is the basis of $T\mathbb{R}^4$. Then $$ \pi_{*} X_{1}=\sqrt{2} e_{1}^{*}, \quad \pi_{*} X_{2}=\sqrt{2} e_{2}^{*} $$ where $\left\{e_{1}^{*}=e^{-y_{2}} \partial y_{1}, e_{2}^{*}=\partial y_{2}\right\}$ is the basis of $T \mathbb{R}^{2}$. Then, clearly $$ \begin{aligned} &g_{1}\left(X_{1}, X_{1}\right)=2=g_{2}\left(\pi_{*} X_{1}, \pi_{*} X_{1}\right) \\ &g_{1}\left(X_{2}, X_{2}\right)=2=g_{2}\left(\pi_{*} X_{2}, \pi_{*} X_{2}\right) \end{aligned} $$ Therefore $\pi$ is a Riemannian Submersion from $\mathbb{R}^{4}$ to $\mathbb{R}^{2}$. Moreover $$ \begin{aligned} J_{1} X_{1} &=-e_{3}+e_{4} \quad, \quad J_{1} X_{2}=e_{1}-e_{3} \quad \text { then } \\ \pi_{*} J_{1} X_{1}=-\sqrt{2} e_{2}^{*} \quad, \quad \pi_{*} J_{1} X_{2}=\sqrt{2} e_{1}^{*} \end{aligned} $$ Also, $$ J_{2} \pi_{*} X_{1}=-\sqrt{2} e_{2}^{*} \quad, \quad J_{2} \pi_{*} X_{2}=\sqrt{2} e_{1}^{*} $$ Hence $$ \pi_{*} J_{1} X_{1}=J_{2} \pi_{*} X_{1} \quad \text { and } \quad \pi_{*} J_{1} X_{2}=J_{2} \pi_{*} X_{2} $$ Thus $\pi$ is an almost Hermitian submersion from $\left(\mathbb{R}^{4}, J_{1}, g_{1}\right)$ to $\left(\mathbb{R}^{2}, J_{2}, g_{2}\right)$. Further $$ g_{1 i j}=\left[\begin{array}{cccc} e^{-2 x_{3}} & 0 & 0 & 0 \\ 0 & e^{-2 x^{4}} & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{array}\right] \text {then } g_{1}^{i j}=\left[\begin{array}{cccc} e^{2 x_{3}} & 0 & 0 & 0 \\ 0 & e^{2 x_{4}} & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{array}\right] $$ $$ \begin{aligned} &\text { Then }\\ &\Gamma_{11}^{1}=\Gamma_{11}^{2}=\Gamma_{11}^{4}=0 \quad, \quad \Gamma_{11}^{3}=e^{-2 x_{3}}\\ &\Gamma_{12}^{1}=0=\Gamma_{21}^{1}, \quad \Gamma_{12}^{2}=0=\Gamma_{21}^{2}, \Gamma_{12}^{3}=0 \Gamma_{21}^{3}, \quad \Gamma_{12}^{4}=0= \Gamma_{21}^{4}\\ &\Gamma_{13}^{1}=-1=\Gamma_{31}^{1}, \quad \Gamma_{13}^{2}=0=\Gamma_{31}^{2}, \quad \Gamma_{13}^{3}=0 =\Gamma_{31}^{3}, \Gamma_{13}^{4}=0=\Gamma_{31}^{4}\\ &\Gamma_{14}^{1}=0=\Gamma_{41}, \quad \Gamma_{14}^{2}=0=\Gamma_{41}^{2}, \Gamma_{14}^{3}=0=\Gamma_{41}^{3}, \Gamma_{14}^{4}=0=\Gamma_{41}^{4}\\ &\Gamma_{22}^{1}=\Gamma_{22}^{2}=\Gamma_{22}^{3}=0, \Gamma_{22}^{4}=e^{-2 x_{4}}\\ &\Gamma_{23}^{1}=0=\Gamma_{32}, \quad{ }_{23}^{2}=0=\Gamma_{32}^{2}, \Gamma_{23}^{3}=0=\Gamma_{32}^{3}, \Gamma_{23}^{4}=0=\Gamma_{23}^{4}\\ &\Gamma_{24}^{1}=-1=\Gamma_{42}^{1}, \quad \Gamma_{24}^{2}=0=\Gamma_{42}^{2}, \quad \Gamma_{24}^{3}=0=\Gamma_{42}^{3}, \quad \Gamma_{24}^{4}=0=\Gamma_{42}^{4}\\ &\Gamma_{33}^{1}=\Gamma_{33}^{2}=\Gamma_{33}^{3}=\Gamma_{33}^{4}=0 \\ &\Gamma_{44}^{1}=\Gamma_{44}^{2}=\Gamma_{44}^{3}=\Gamma_{44}^{4}=0 \end{aligned} $$ Using these Christoffel symbols, we obtain $$\operatorname{Ric}\left(e_{1}, e_{1}\right)=1, \quad \operatorname{Ric}\left(e_{2}, e_{2}\right)=1, \quad \operatorname{Ric}\left(e_{3}, e_{3}\right)=1 ~\text{and}~ \operatorname{Ric}\left(e_{4}, e_{4}\right)=1$$ Hence the scalar curvature $\tau$ is $$ \tau=\sum_{i} \operatorname{Ric}\left(e_{i}, e_{i}\right)=4 $$ We also have $$ \begin{aligned} \nabla_{U_{1}} U_{1}&=-X_{1}, \quad &\nabla_{U_{1}} U_{2}&=0, \quad &\nabla_{U_{1}} X_{1}&=U_{1}, \quad &\nabla_{U_{1}} X_{2}&=0\\ \nabla_{U_{2}} U_{1}&=0, \quad &\nabla_{U_{2}} U_{2}&=-X_{2}, \quad &\nabla_{U_{2}} X_{1}&=0, \quad &\nabla_{U_{2}} X_{2}&=U_{2}\\ \nabla_{X_{1}} U_{1}&=-X_{1}, \quad &\nabla_{X_{1}} U_{2}&=0, \quad &\nabla_{X_{1}} X_{1}&=U_{1} , \quad &\nabla_{X_{1}} X_{2}&=0\\ \nabla_{X_{2}} U_{1}&=0, \quad &\nabla_{X_{2}} U_{2}&=-X_{2}, \quad &\nabla_{X_{2}} X_{1}&=0, \quad &\nabla_{X_{2}} X_{2}&=U_{2} \end{aligned} $$ Since $T \mathbb{R}^{4}=\left(\operatorname{Ker} \pi_{*}\right)\oplus \left(\operatorname{Ker} \pi_{*}\right)^{\perp}$, therefore any vectors $Z_{1}, Z_{2}, Z_{3} \in T \mathbb{R}^{4}$ can be written as $$ \begin{aligned} &Z_{1}=a_{1} U_{1}+b_{1} U_{2}+c_{1} X_{1}+d_{1} X_{2} \\ &Z_{2}=a_{2} U_{1}+b_{2} U_{2}+c_{2} X_{1}+d_{2} X_{2} \\ &Z_{3}=a_{3} U_{1}+b_{3} U_{2}+c_{3} X{1}+d_{3} X_{2} \end{aligned} $$ where $a_{i}, b_{i}, c_{i}, d_{i} \in \mathbb{R}$, then \begin{equation}\label{eq1} g_{1}\left(Z_{2}, Z_{3}\right)=2\left(a_{2} a_{3}+b_{2} b_{3}+c_{2} c_{3}+d_{2} d_{3}\right) \end{equation} We know that \begin{align}\nonumber \frac{1}{2}\left(\mathcal{L}_{Z_1}g_{1}\right)\left(Z_{2}, Z_{3}\right)&=\frac{1}{2}\left[g_{1}\left(\nabla_{Z_{2}} Z_{1}, Z_{3}\right)+g_{1}\left(\nabla_{Z_{3}} Z_{1}, Z_{2}\right)\right] \\ \nonumber &=c_{1} a_{2}\left(2 a_{3}-c_{3}\right)+a_{1} b_{2}\left(2 b_{3}+d_{3}\right)-a_{1} c_{2}\left(2 c_{3}+a_{3}\right) \\ \label{eq2} \quad ~&-b_{1} d_{2}\left(2 d_{3}+b_{3}\right)-a_{1} a_{2} c_{3}-b_{1} b_{2} d_{3}+c_{1} c_{2} a_{3}+d_{1} d_{2} b_{3} \end{align} Using (\ref{eq1}) and (\ref{eq2}), the following expression $$ \frac{1}{2}\left(\mathcal{L} _{Z_{1}} g_{1}\right)\left(Z_{2}, Z_{3}\right)=(\tau-\lambda) g_{1}\left(Z_{2}, Z_{3}\right) $$ becomes $$\begin{aligned} & c_{1} a_{2}\left(2 a_{3}-c_{3}\right)+d_{1} b_{2}\left(2 b_{3}+d_{3}\right)-a_{1} c_{2}\left(2 c_{3}+a_{3}\right)-b_{1} d_{2}\left(2 d_{3}+b_{3}\right) \\ & -a_{1} a_{2} c_{3}-b_{1} b_{2} d_{3}+c_{1} c_{2} a_{3}+d_{1} d_{2} b_{3}=(4-\lambda) 2\left(a_{2} a_{3}+b_{2} b_{3}+c_{2} c_{3}+d_{2} d_{3}\right) \end{aligned}$$ Since $a_{i}, b_{i}, c_{i}, d_{i} \in \mathbb{R}$, hence $\lambda$ is constant and $\left(\mathbb{R}^{4}, J_{1}, g_{1}\right)$ becomes Yamabe soliton. Moreover, for some suitable choices of $a_{i}, b_{i}, c_{i}$ and $d_{i}$, the Yamabe soliton $\left(\mathbb{R}^{4}, J_{1}, g_{1}\right)$ will be shrinking, steady or expanding according to $\lambda<0, \lambda=0$ or $\lambda>0$, respectively. \end{example} Now we mention some theorems and corollaries for any fibre of the submersion and the base space to be an almost Yamabe soliton and a Yamabe soliton. First we recall the following: \begin{lemma}\label{lfm}\cite{a8} Following are the statements which are equivalent to each other for a Riemannian submersion $\pi$ from a Riemannian manifold $(M_1,g_1)$ onto a Riemannian manifold $(M_2,g_2)$ \begin{itemize} \item [(i)] The horizontal distribution $\mathcal H$ is parallel with respect to $\nabla$ on $M$. \item [(ii)] The vertical distributiuin $\mathcal V$ is parallel with respect to $\nabla$ on $M$. \item [(iii)] The fundamental tensors $\mathcal T$ and $\mathcal A$ vanishes identically.\\ \end{itemize} \end{lemma} \begin{theorem} \label{T1} Let $(M_1, g_1, J_1)$ be an almost Yamabe soliton with the potential vector field $\eta$ and $\pi:(M_1, g_1, J_1)\to( M_{2}, g_{2}, J_{2})$ be a Kaehler submersion. Then the totally geodesic fibres of the submersion are almost Yamabe solitons if the potential vector field $\eta$ is vertical. \end{theorem} \begin{proof} Since $(M_1, g_1, J_1$ be an almost Yamabe soliton, then from (\ref{ays}), we have \begin{align*} \frac{1}{2}(\mathcal{L}_{\eta} g_{1})(U, V)&=(\tau-\mu) g_{1}(U, V)\\ \frac{1}{2}\{g_{1}(\nabla^1_U{\eta}, V)+g_{1}(\nabla_{V}^{1} \eta, U)\}&=(\tau-\mu) g_{1}(U, V). \end{align*} for any vertical vector fields $U, V$ on $M_1$. Since the potential vector field $\eta$ is vertical, by using (\ref{nvw}) we get,\\ $\dfrac{1}{2}\{g_{1}(\hat{\nabla}_{U} \eta, V)+g_{1}(\hat{\nabla}_{V} \eta, U)\}=(\tau-\mu ) g_{1}\left(U,V\right).$\\ By using (\ref{mtau}) and the assumption that the fibres of the submersion are totally geodesic i.e., the second fundamental form of fibres $\mathcal T=0$ \[\dfrac{1}{2}\{g_{1}(\hat{\nabla}_{U} \eta, V)+g_{1}(\hat{\nabla}_{V} \eta, U)\}=({\hat\tau}-\mu){g}_1(U,V).\] In view of the relation (\ref{ays}), above equation yields that \[\dfrac{1}{2}(\mathcal{L}_{\eta} {g}_{1}) (U,V)=({\hat\tau}-\mu){g}_1(U,V),\] which shows that the fibers of the submersion $\pi$ are almost Yamabe solitons with the potential vector field $\eta$.\\ \end{proof} We remark that an almost Yamabe soliton is said to be Yamabe soliton if $\mu$ is constant. As a consequence of the above theorem, we have \begin{corollary}\label{C1} Let $\pi$ be a Kaehler submersion from a Kaehler manifold $\left(M_1, g_{1}, J_{1}\right)$ admitting an almost Yamabe soliton to a Kaehler manifold $\left(M_{2}, g_{2}, J_{2}\right)$. Then the totally geodesic fibres of the submersion are Yamabe soliton if the potential vector field is vertical. \end{corollary} \begin{theorem}\label{T2} Let $\pi:(M_1, g_1, J_1)\to( M_{2}, g_{2}, J_{2})$ be a Kaehler submersion admitting an almost Yamabe soliton with the potential vector field $\eta$ and a smooth function $\mu$ such that the potential vector field is horizontal. If the second fundamental form of fibres $\mathcal {T}$ vanishes then the base manifold $(M_2,g_2,J_2)$ is also an almost Yamabe soliton. \end{theorem} \begin{proof} Since $(M_1,g_1,J_1)$ is an almost Yamabe soliton, then from (\ref{ays}), we get $$ \frac{1}{2} \{ g_{1}\left(\nabla_{X} \eta, Y\right)+g_{1}\left(\nabla_{Y} \eta, X\right)\}=(\tau-\mu) g_{1}\left(X, Y\right)$$ for any horizontal vector fields $X$ and $Y$ on $M_1$. By simply using (\ref{nxy}) and (\ref{mtau}) above equation reaches to $\frac{1}{2}\left\{g_{1}\left(\mathcal{H}\left(\nabla_{X} \eta\right), Y\right)+g(\mathcal{H}(\nabla_Y \eta), X)\right\}=\{(\tau^\prime\circ \pi)+\|\mathcal {T}\|^2-\hat{\tau}-\mu\}g(X,Y)$.\\ Since $\mathcal T=0$ and also we note that $\mathcal{H}\left(\nabla_{X}\eta\right)$ and $\mathcal{H}(\nabla_Y\eta)$ are $\pi$ -related to ${\nabla}^{2}_{X_*}\eta_*$ and ${\nabla}^{2}_{Y_*}\eta_*$, respectively. It follows that \begin{equation}\label{E2} \frac{1}{2}\left\{g_{2}(\nabla_{X_*}^2 \eta_*, Y_*)+g_2(\nabla_{Y_*}^2 \eta_*, X_*)\right\}=\{(\tau^\prime\circ \pi_*)-\mu\}g_2(X_*,Y_*)\circ \pi_*, \end{equation} where the vector fields $X_*, Y_*$ are tangent to $(M_2,g_2,J_2)$ and $\eta_*$ is potential vector field on $M_2$, which is $\pi$-related to $eta$ on $M_1$. By using (\ref{ays}) in (\ref{E2}), it shows that the base manifold $(M_2,g_2,J_2)$ is almost Yamabe soliton with the potential vector field $\eta_*$ and a function $\mu$. \end{proof} As a conclusion of the above theorem, we state the following corollary; \begin{corollary}\label{C2} Let $\pi:(M_1, g_1, J_1)\to( M_{2}, g_{2}, J_{2})$ be a Kaehler submersion admitting Yamabe soliton with the potential vector field $\eta$ and a smooth function $\mu$ such that the potential vector field is horizontal. If the second fundamental form of fibres $\mathcal {T}$ vanishes then the base manifold $(M_2,g_2,J_2)$ is also a Yamabe soliton. \end{corollary} \section{Characterizations on total space of Almost Hermitian submersions} This section gives the characterization on almost Yamabe soliton by investigating the the relation between extrinsic horizontal curvature and extrinsic vertical curvature with function $\mu$. We also obtain some results on torqued, recurrent and concurrent vector fields on Kaehler submersion. \begin{theorem}\label{T3} Let $\pi$ be a Kaehler submersion admitting an almost Yamabe soliton $(M_1, g_1, \eta, \mu)$ such that the potential vector field $\eta$ is vertical and the horizontal distribution is parallel. Then, the extrinsic horizontal scalar curvature $\left.\tau\right|_{\mathcal{H}}$ satisfies $$ \left.\tau\right|_{\mathcal{H}}-\mu=0. $$ \end{theorem} \begin{proof} Since the total space is an almost Yamabe soliton, then from (\ref{ays}), we get $$ \frac{1}{2}\left\{g_1\left(\nabla_{X} \eta, Y\right)+g_1\left(\nabla_{Y} \eta, X\right)\right\}=(\tau-\mu) g_1(X, Y) $$ for any horizontal vectors $X, Y$ on $M_1$. Considering (\ref{nxy}) in the above equation, we have $$ \frac{1}{2}\left\{g_1\left(\mathcal{A}_{X} \eta, Y\right)+g_1\left(\mathcal{A}_{Y} \eta,X\right)\right\}=(\tau|_{\mathcal{H}}-\mu) g_1(X, Y). $$ Since the horizontal distribution is parallel, therefore in view of the properties of the tensor field $\mathcal{A}$ above equality in turn yields $$ \left(\left.\tau\right|_{\mathcal{H}}-\mu\right) g_1(X, Y)=0, $$ for any horizontal vector fields $X, Y$ on $M_1$, which proves our claim. \end{proof} As an immediate consequence of Theorem \ref{T3} we conclude the following observations; \begin{corollary}\label{C2} Let $\pi:(M_1, g_1, J_1)\to( M_{2}, g_{2}, J_{2})$ be a Kaehler submersion admitting an almost Yamabe soliton $(M_1,g,\eta,\mu)$ such that $\eta$ is vertical. If the horizontal distribution is parallel then the followings are hold; \begin{itemize} \item[(i)] ($M_1,g_1,\eta,\mu)$ is shrinking if and only if the extrinsic horizontal scalar curvature is positive. \item[(ii)] ($M_1,g_1,\eta,\mu)$ is expanding if and only if the extrinsic horizontal scalar curvature is negative. \item[(iii)] $(M_1,g_1,\eta,\mu)$ is steady if and only if the extrinsic horizontal scalar curvature is zero. \end{itemize} \end{corollary} \begin{theorem}\label{T4} Let $\pi$ be a Kaehler submersion admitting an almost Yamabe soliton $(M_1, g_1, \eta, \mu)$ such that the potential vector field $\eta$ is horizontal and the horizontal distribution is parallel. Then, the extrinsic vertical scalar curvature $\hat{\tau}$ satisfies $$\hat{\tau}-\mu=0.$$ \end{theorem} \begin{proof} Since $(M_1,g_1,J_1)$ is an almost Yamabe soliton and the potential vector field $\eta$ is horizontal vector field then by using (\ref{nvx}), we arrive at, $$\frac{1}{2}\{g_1(\mathcal{T}_U\eta,V)+g_1(\mathcal{T}_V\eta,U)\}=(\hat{\tau}-\mu)g(U,V)$$ for any vertical vector field U, V on $M$. Since the horizontal distribution is parallel, by using Lemma \ref{lfm}, the extrinsic vertical scalar curvature satisfies $(\hat{\tau}-\mu)=0.$\\ \end{proof} In view of the relation of extrinsic vertical scalar curvature $\hat\tau$ with $\mu$ we mention the following conclusion; \begin{corollary}\label{C3} Let $\pi$ be a Kaehler submersion admitting an almost Yamabe soliton $(M_1, g_1, \eta, \mu)$ such that the potential vector field $\eta$ is horizontal and the horizontal distribution is parallel. Then, \begin{itemize} \item[(i)] $(M_1,g_1,\eta, \mu)$ is shrinking if and only if the fibre has positive scalar curvature. \item[(ii)] $(M_1,g_1,\eta, \mu)$ is expanding if and only if the fibre has negative scalar curvature. \item[(iii)] $(M_1,g_1,\eta, \mu)$ is steady if and only if the fibre has zero scalar curvature. \end{itemize} \end{corollary} \begin{definition}\label{D1} A nowhere vanishing vector field $\eta$ on a Riemannian manifold $M$ is called torse-forming if \begin{align} \nabla_{W}\eta=\varphi W+\alpha(W) \eta, \label{tv} \end{align} where $\varphi$ is a function, $\alpha$ is a 1-form. The vector field $\eta$ is called concircular, if the 1-form $\alpha$ vanishes identically. The vector field $\eta$ is called concurrent if the 1 -form $\alpha$ vanishes identically and the function $\varphi=1$. The vector field $\eta$ is called recurrent if the function $\varphi=0$ \cite{a5.1}, \cite{a5.2}. Finally if $\varphi=\alpha=0$, then the vector field $\eta$ is called a parallel vector field. The nowhere zero vector field $\eta$ is called a torqued vector field if it satisfies \begin{align} \nabla_{W} \eta=\varphi W+\alpha(W) \eta, \quad \alpha(\eta)=0, \label{tv1} \end{align} where the function $\varphi$ is called the torqued function and 1-form $\alpha$ is called the torqued form of $\eta ;$ see $[8]$. \end{definition} \begin{theorem}\label{T5} Let $\pi:\left(M_{1}, g_{1}, J_{1}\right) \rightarrow\left(M_{2}, g_{2}, J_{2}\right)$ be a Kaehler submersion. Then, \begin{itemize} \item[(i)] For any torqued vector field $\eta$ on $\Gamma\left(\operatorname{ker} \pi_{*}\right)^{\perp}, J_{1} \eta$ is not a torqued vector field on $\Gamma{(ker \pi_*)}^\bot .$ \item[(ii)] For torqued vector field $\eta \in \Gamma\left(k e r \pi_{*}\right)^{\perp},[\eta, J \eta]$ does not vanish. \end{itemize} \end{theorem} \begin{proof} Since $M_{1}$ is a Kaehler manifold, then we have $$ \nabla_{X}^{1} J_{1} \eta=J_{1} \nabla_{X}^{1} \eta,~ \text{for~any} \quad X \in \Gamma\left(k e r \pi_{*}\right)^{\perp},$$ where $\eta$ is a torqued vector field which belongs to $\Gamma\left(\operatorname{ker} \pi_{*}\right)^{\perp}$ and $\nabla^1$ is a Levi-Civita connection on $M_1.$ Using (\ref{nxy}), we have $$ \nabla_{X}^{1} J_{1} \eta=J_{1}\left(\mathcal{H} \nabla_{X}^{1} \eta+\mathcal{A}_{X} \eta\right). $$ From (\ref{tv1}) and $\mathcal{A}=0$ we arrive at \begin{align} \nabla_{X}^{1} J_{1} \eta=J_{1}\left(\mathcal{H} \nabla_{X}^{1} \eta\right)=\varphi J_1 X+\alpha(X)J_1\eta \label{nxjn} \end{align} which implies that $J_{1} \eta$ is never a torqued vector field. We also have \begin{align} \mathcal{H} \nabla_{J_{1} \eta}^{1} \eta=\varphi J_1 \eta+\alpha(J_1\eta)\eta. \label{nxjn1} \end{align} Now, by taking $\eta$ instead of $X$ in (\ref{nxjn}) and taking the difference with (\ref{nxjn1}), we obtain $(ii)$. \end{proof} In particular, if we consider $\eta$ as a recurrent or concurrent vector field then we have the following corollaries; \begin{corollary}\label{C4} Let $\pi:\left(M_{1}, g_{1}, J_{1}\right) \rightarrow\left(M_{2}, g_{2}, J_{2}\right)$ be a Kähler submersion. Then, \begin{itemize} \item[(i)] For a recurrent vector field $\eta$ on $\Gamma\left(\operatorname{ker} \pi_{*}\right)^{\perp}, J_{1} \eta$ is also a recurrent vector field on $\left(\operatorname{ker} \pi_{*}\right)^{\perp} .$ \item[(ii)] For recurrent vector field $\eta \in \Gamma\left(k e r \pi_{*}\right)^{\perp}, [\eta, J \eta]$ vanishes. \end{itemize} \end{corollary} For the concurrent vector field, we have the following result from \cite{a12}: \begin{corollary}\label{C5} Let $\pi:\left(M_{1}, g_{1}, J_{1}\right) \rightarrow\left(M_{2}, g_{2}, J_{2}\right)$ be a Kähler submersion. Then, \begin{itemize} \item[(i)] For a concurrent vector field $\eta$ on $\Gamma\left(\operatorname{ker} \pi_{*}\right)^{\perp}, J_{1} \eta$ is not a concurrent vector field on $\left(\operatorname{ker} \pi_{*}\right)^{\perp} .$ \item[(ii)] For concurrent vector field $\eta \in \Gamma\left(k e r \pi_{*}\right)^{\perp},[\eta, J \eta]$ vanishes. \end{itemize} \end{corollary} \begin{theorem}\label{T6} Let $\pi:\left(M_{1}, g_{1}, J_{1}\right) \rightarrow\left(M_{2}, g_{2}, J_{2}\right)$ be a Kähler submersion and $\eta$ be the concurrent potential vector field and $\mu$, a function on $M$. If the second fundamental form of the fibres are totally geodesic then the extrinsic vertical scalar curvature $\hat\tau$ is equal to $\mu+1.$ for $\eta\in \Gamma{(kaer \pi_*)}$ \end{theorem} \begin{proof} As $\left(M_{1}, g_{1}, J_{1}\right)$ be an almost Yamabe soliton with potential vector field $\eta$, then for any $U,V\in\Gamma(ker \pi_*)$ we have \[\frac{1}{2}\{g_{1}(\nabla^1_U{\eta}, V)+g_{1}(\nabla_{V}^{1} \eta, U)\}=(\tau-\mu) g_{1}(U, V)\] Since $\mathcal T=0$, using (\ref{mtau}) we get \[ \frac{1}{2}\{\hat g(\hat{\nabla}_{U} \eta, V)+\hat g (\hat{\nabla}_{V} \eta, U)\}=(\hat{\tau}-\mu)\hat g(U,V).\] Since the potential vector field $\eta$ is concurrent vector field on $M_1$, with the help of (\ref{tv}) we conclude the theorem. \end{proof} In view of the relation between the extrinsic vertical scalar curvature $\hat\tau$ and $\mu$, we give the following result;\\ \begin{corollary}\label{C6} Let $\pi:\left(M_{1}, g_{1}, J_{1}\right) \rightarrow\left(M_{2}, g_{2}, J_{2}\right)$ be a Kähler submersion and $(M_{1}, g_{1})$ be an almost Yamabe soliton with the concurrent potential vector field $\eta$. If $\eta\in\Gamma(ker \pi_*)$ then we have \begin{itemize} \item[(i)] $(M_1,g_1,\eta, \mu)$ is shrinking if and only if the extrinsic vertical scalar curvature $\hat\tau>1$. \item[(ii)] $(M_1,g_1,\eta, \mu)$ is expanding if and only if the extrinsic vertical scalar curvature $\hat\tau<1$. \item[(iii)] $(M_1,g_1,\eta, \mu)$ is steady if and only if the extrinsic vertical scalar curvature $\hat\tau= 1$.\\ \end{itemize} \end{corollary} \subsection*{\bf Data Availability Statement} Data sharing not applicable to this article as no datasets were generated or analysed during the current study.
\section{Introduction} Phase transition and criticality are key concepts for understanding many-body quantum physics, and a general theoretical framework has been formulated to describe and classify the universal aspects of critical phenomena for equilibrium states of matter~\cite{Cardy1996}. Recently, several theoretical studies have found exotic phases of matter without equilibrium counterparts in nonequilibrium conditions, such as many-body localization~\cite{Abanin2019} and Floquet topological phases~\cite{Oka2009,Kitagawa2010,Kitagawa2011,Jiang2011,Rudner2013,Potter2016,Kolodrubetz2018}. The state-of-the-art technologies enable addressing such nonequilibrium phases experimentally~\cite{Schreiber2015,Eckardt2017,McIver2020}. Discrete time crystal (DTC) is a genuinely nonequilibrium phase occurring in periodically-driven quantum (Floquet) systems~\cite{Else2016,VonKeyserlingk2016,Yao2017,Else2017,Zeng2017,Machado2020,Luitz2020, Sacha2015, Russomanno2017, Ho2017, Mizuta2018, Yu2019b, Giergiel2019b, Zhao2019,Pizzi2019} as the time-crystalline behavior is prohibited in equilibrium conditions~\cite{Wilczek2012,Li2012,Bruno2013,Bruno2013a,Watanabe2015,Buca2019}. The DTC is characterized by a breakdown of the discrete time translation symmetry entailing subharmonic oscillations with period $n\tau$, where $\tau$ is the Floquet period and $n=2,3,\cdots$. In idealistic dissipationless cases, the DTC was theoretically proposed in many systems such as many-body localized systems~\cite{Else2016,VonKeyserlingk2016,Yao2017}, prethermal systems~\cite{Else2017,Zeng2017,Machado2020,Luitz2020}, and so on~\cite{Sacha2015, Russomanno2017, Ho2017, Mizuta2018, Yu2019b, Giergiel2019b, Zhao2019, Pizzi2019}. Furthermore, the dissipationless DTC has been experimentally demonstrated in cold-atom systems~\cite{Bordia2017, Zhang2017, Pal2018, Rovny2018a, Rovny2018}, quantum computers~\cite{Ippoliti2020, Randall2021, Mi2021, Frey2021}, and NV centers in diamond~\cite{Choi2017}. In experiments, small dissipation and decoherence are always unavoidable and usually destroy the DTC behavior~\cite{Lazarides2017}. Thus, these experiments are interpreted to have witnessed the DTC as a transient state, which would vanish in the long run. Meanwhile, a new type of DTC, the dissipative DTC, has been proposed in some special models by choosing the dissipation model carefully. In the dissipative DTC, the DTC order is stabilized by dissipation rather than destroyed~\cite{Gong2018, Lledo2019, Lazarides2020, Riera2020, Chinzei2020}, surviving even in the long-time limit. Recently, the dissipative DTC has been experimentally realized in a cavity QED system~\cite{Kebler2021}. However, so far, theories and experiments of the dissipative DTC have been limited to well-designed artificial quantum systems, where one could control dissipation as well as the Hamiltonian. On the other hand, if the DTC is realized in generic solid-state materials, it could offer a new way of controlling nonequilibrium phases of matter in material science. However, solid-state systems are coupled to many external degrees of freedom like phonons, which cannot be fine-tuned and leads to more complicated dissipation than the artificial quantum systems. Based on the theoretical study~\cite{Lazarides2017}, this complicated dissipation is naturally expected to destroy the DTC generically like in the decoherence of the macroscopic Schr\"{o}dinger's cat state~\cite{Walls1985} and many-body localized state~\cite{Luschen2017}. In this paper, we elucidate that it is not true in time crystals and propose a way of realizing a dissipative DTC in solid-state materials subject to generic dissipation to a low-temperature heat bath. For illustration, let us consider the simplest DTC model as an example, in which two ferromagnetic states are switched alternately by consecutive $\pi$-pulses (see Fig.~\ref{fig:illust}(a)). This DTC state can exist even in the presence of the dissipation of solids because the quantum coherence between the two ferromagnetic states is unnecessary for realizing the DTC. The dissipation destroys the quantum superposition between them (i.e., the cat state), materializes either ferromagnetic state, and thereby stabilizes the DTC behavior rather than destroys. \begin{figure*}[t] \includegraphics[width=\linewidth]{illust7.pdf} \caption{ (a) Schematic illustration of DTC in our model with $d=2$. Two ferromagnetic states, which the dissipation stabilizes, are switched by $\pi$-pulses. (b) Free energy picture for our DTC. A state goes back and forth between two minima of the equilibrium free energy by $\pi$-pulses while feeling the past mean-field. The dissipation pushes the state into one of the minima, stabilizing the DTC. (c) Time profiles of magnetization $m^z(t)$ obtained by the time-dependent mean-field theory for $T=0.5$ (blue circles) and $1$ (orange squares) with $\tau=10$. The initial state is $\rho(0)=\ket{\uparrow}\bra{\uparrow}$. } \label{fig:illust} \end{figure*} To verify this scenario microscopically, we propose a prototypical model of the dissipative DTC in solids, a dissipative quantum Ising model periodically driven by a train of $\pi$-pulses. Describing the microscopic dissipation due to thermal contact to a heat bath like phonons by the Bloch-Redfield (BR) equation~\cite{BreuerBook}, we elucidate that the dissipation stabilizes the DTC, where two ferromagnetic states are switched by each $\pi$-pulse (see Fig.~\ref{fig:illust}(a)). We also show that the DTC phase transition is continuous and identify its critical behavior using the time-dependent mean-field theory that solves self-consistently the periodic drive, dissipation, and DTC order parameter. Remarkably, a novel reentrant transition without equilibrium counterparts occurs when changing the pulse interval due to a nontrivial interplay of the periodic drive and dissipation. Furthermore, we demonstrate the rigidity, or robustness, of the DTC against small imperfections of the $\pi$-pulses and find that the discrete time quasicrystal (DTQC)~\cite{Giergiel2019b,Zhao2019,Pizzi2019,Chinzei2020} can appear for the larger imperfections. This rigidity implies that our DTC can be realized in solid-state experiments, where various noises and perturbations are unavoidable. The structure of the paper is as follows. In Sec.~\ref{sec:model}, we introduce a theoretical model for the dissipative DTC in solids: a dissipative quantum Ising model driven by a train of $\pi$-pulses, where the BR equation describes the dissipation. In Sec.~\ref{sec:FMFT}, in order to analyze the spontaneous symmetry breaking accompanied by the DTC phase transition, we invoke the time-dependent mean-field theory and solve the DTC order parameter self-consistently. In Sec.~\ref{sec:trans}, we numerically and analytically investigate the phase transition and criticality of the DTC based on the mean-field theory. In Sec.~\ref{sec:rigid}, we demonstrate the rigidity of our DTC against weak perturbation and show an existence of DTQC under strong perturbation. In Sec.~\ref{sec:ex}, we discuss the possible experimental realizations of our DTC. Finally, we summarize this paper and present future works in Sec.~\ref{sec:fin}. \section{Model of time crystal in solids}\label{sec:model} \subsection{Quantum Ising model and basic picture} As a prototypical model of the dissipative DTC in solids, we consider a quantum Ising model on the $d$-dimensional square lattice periodically driven by a sequence of $\pi$-pulses with idealistic zero pulse width. The Hamiltonian is given by \begin{align} H(t) = - J \sum_{\langle i,j\rangle} \sigma^z_i \sigma^z_j + \frac{\pi}{2} \sum_{j,n} \delta(t-n\tau)\sigma^x_j, \label{eq:Ham} \end{align} where $\tau$ denotes the time interval between the consecutive $\pi$-pulses serving as the time period \begin{align} H(t+\tau)=H(t) \end{align} and $J$ is the Ising interaction. For clarity, we focus on the ferromagnetic interactions $J>0$ and the ferromagnetic DTC. Yet, the following argument equally applies to the antiferromagnetic ones $J<0$ and the N\'{e}el-like DTC (hence a space-time crystal) since these two cases are mathematically equivalent under the transformation $\sigma_i^z\to-\sigma_i^z$ on either sublattice. Without dissipation, the Hamiltonian~\eqref{eq:Ham} exhibits the DTC due to Floquet dynamical symmetry~\cite{Else2016,VonKeyserlingk2016,Yao2017,Chinzei2020,Tindall2019,Buca2019,Buca2021} \begin{align} {U_F}\sigma^z_j {U_F^\dag}=-\sigma^z_j, \end{align} where $U_F={\mathcal{T}}e^{-i\int_0^{\tau}dtH(t)}$ is the one-cycle time evolution operator ($\mathcal{T}$ is the time ordering operator and we set $\hbar=k_B=1$ throughout this paper). This symmetry leads to the time-crystalline evolution with period $2\tau$, \begin{align} \braket{\sigma^z_j(t=t_0+n\tau)} = (-1)^n \braket{\sigma_j^z(t=t_0)}, \end{align} where $\sigma^z_j(t)$ is in the Heisenberg picture, and $\braket{\cdots}$ denotes the expectation value taken for an arbitrary initial state. Nevertheless, this time-crystalline nature is fragile against symmetry-breaking perturbations without additional stabilization mechanisms such as many-body localization~\cite{Else2016,VonKeyserlingk2016,Yao2017}. One thus might anticipate that dissipation generically breaks the DTC. However, this is not necessarily true in solid-state materials. In solids, a typical dissipation is caused by couplings to heat baths at temperature $T$, bringing the system of interest to the same temperature. Therefore, if $T$ is low enough, the dissipation tends to cool our spin system, and the ferromagnetic order should be favored. When flipped by the consecutive $\pi$-pulses, this ferromagnetic state would be a DTC as illustrated in Fig.~\ref{fig:illust}(a). This mechanism can be described by free energy picture as shown in Fig.~\ref{fig:illust}(b), where a state goes back and forth between two minima of equilibrium free energy (corresponding to the two ferromagnetic states) by $\pi$-pulses. This picture lets us imagine the rigidity of the DTC: Even if there exist perturbations disturbing the order, the dissipation brings the state to a nearby free-energy minimum. Although this argument gives a simple interpretation, we need, for complete understanding, a quantitative microscopic theory, by which we will obtain critical exponents and find richer phenomena such as a nontrivial reentrant DTC transition in varying the pulse interval $\tau$. \subsection{Bloch-Redfield equation} To describe dissipation microscopically, we consider a situation that each spin component at all sites is coupled to a bosonic heat bath at temperature $T$, where the system-bath coupling is given by \begin{align} H_\text{SB} = \sum_{j,\mu} \sqrt{\lambda_\mu} \sigma^\mu_j \otimes B^\mu_j. \end{align} Here $\lambda_\mu$ is the dimensionless strength of the system-bath coupling for channel $\mu=x,y,z$ and $B^\mu_j$ is an operator for the bath degree of freedom ($B^\mu_j$ has the energy's dimension in our units). For simplicity, we neglect correlations between different bath degrees of freedom $B^\mu_j$: $\braket{B^\mu_j(t)B^{\mu'}_{j'}(t')}=\delta_{\mu\mu'}\delta_{jj'}\gamma(t-t')$. Here, $\gamma(t)$ is the bath correlation function, which we assume ohmic~\cite{Nathan2020}, \begin{align} \gamma(t) = \int_{-\infty}^\infty d\epsilon \tilde{\gamma}(\epsilon) e^{-i\epsilon t}, \,\,\,\,\,\, \tilde{\gamma}(\epsilon) = \frac{\epsilon e^{-\frac{\epsilon^2}{2\Lambda^2}}}{1-e^{-\epsilon/T}}, \end{align} where $\Lambda$ is the bath spectral cutoff set as $\Lambda=5$ in this work. We note that $\tilde{\gamma}(\epsilon)$ satisfies the so-called Kubo-Martin-Schwinger (KMS) condition, \begin{align} \tilde{\gamma}(-\epsilon)=e^{-\epsilon/T}\tilde{\gamma}(\epsilon), \label{eq:KMS} \end{align} which leads to the thermal equilibrium of the system without the $\pi$-pulses in the weak coupling limit~\cite{BreuerBook}. Tracing out the bath degrees of freedom and using the Born-Markov approximation, the density matrix of the system $\rho$ obeys the following BR equation~\cite{BreuerBook}, \begin{align} \partial_t \rho &= \mathcal{R}_t(\rho) \notag \\ &= -i[H(t),\rho] - \sum_{j,\mu} \lambda_\mu \left( \left[\sigma^\mu_j, \Sigma^\mu_j(t)\rho \right] + \text{h.c.} \right), \label{eq:oriBRE} \end{align} with \begin{align} &\Sigma^\mu_j(t) = \int_{-\infty}^t dt' \gamma(t-t') U(t,t') \sigma^\mu_j U^\dag(t,t'), \\ &U(t,t')\equiv\mathcal{T} \exp\left[-i\int_{t'}^t ds H(s)\right]. \end{align} We note that although the BR equation, in general, can break the positivity of the density matrix, we have not encountered the nonpositivity in our calculations. We set the system-bath coupling to respect the U(1) symmetry (spin rotation around the $z$-axis) of the undriven Hamiltonian $H_0=-J\sum\sigma^z_i \sigma^z_j$. One can easily verify that, for $\lambda_x = \lambda_y$, the BR equation has the U(1) symmetry: $[\mathcal{R}_t, \mathcal{V}_\phi]=0$ ($\mathcal{V}_\phi(\rho) = e^{i\phi\sigma^z_\mathrm{tot}}\rho e^{-i\phi\sigma^z_\mathrm{tot}}$ with $\sigma^z_\mathrm{tot}\equiv\sum_i \sigma^z_i$). In other words, we focus on magnetic materials that are spin-U(1) symmetric, including dissipation. In Eq.~\eqref{eq:Ham}, we have taken the $\pi$-pulse along the $x$-axis, which could have been any direction in the $x$-$y$ plane. Yet, our choice does not lose generality thanks to the U(1) symmetry. In the following, we set $\lambda_x=\lambda_y=0.05$ and $\lambda_z=0.1$ unless otherwise mentioned. \section{Time-dependent mean-field theory} \label{sec:FMFT} In the presence of dissipation, time-periodic drives usually bring the system, in the long-time limit, to the nonequilibrium steady state (NESS) that oscillates with the same period: $\rho_\mathrm{ness}(t+\tau)=\rho_\mathrm{ness}(t)$. This means that the discrete time-translation symmetry of the BR equation $\mathcal{R}_t=\mathcal{R}_{t+\tau}$ is not broken in $\rho_\mathrm{ness}(t)$. Here, we argue that the many-body interaction between the spins can break this symmetry in the NESS in the thermodynamic limit, giving rise to the DTC. To analyze the spontaneous breaking of the discrete time translation symmetry, we invoke the time-dependent mean-field theory~\cite{Esin2021}. Here let us consider a time-dependent order parameter that is uniform in space: \begin{align} m^z(t) = \text{Tr}[\sigma^z_j\rho(t)]. \end{align} Then, the mean-field Hamiltonian is given by \begin{align} H_\text{MF}(t) = - m^z(t) \sigma^z + \frac{\pi}{2} \sum_{n} \delta(t-n\tau)\sigma^x, \end{align} where we have set $Jd=1$ as the unit of energy and omitted the site index $j$ since the mean-field Hamiltonian is decoupled for each site. In the mean-field approximation, the density matrix $\rho$ obeys the following BR equation for a given mean-field $m^z(t)$: \begin{align} \partial_t \rho &= -i[H_\text{MF}(t),\rho] \notag \\ &\hspace{1cm}- \sum_{\mu} \lambda_\mu \left( \left[\sigma^\mu, \Sigma^\mu_\text{MF}(t)\rho \right] + \text{h.c.} \right), \label{eq:mfBRE} \end{align} with \begin{align} &\Sigma^\mu_\text{MF}(t) = \int_{-\infty}^t dt' \gamma(t-t') U_\text{MF}(t,t') \sigma^\mu U^\dag_\text{MF}(t,t'), \\ &U_\text{MF}(t,t') \equiv \mathcal{T} \exp\left[-i\int_{t'}^t ds H_\text{MF}(s)\right]. \end{align} Meanwhile, the mean-field $m^z(t)$ should satisfy the following time evolution equation: \begin{align} \partial_t m^z = \text{Tr}[\sigma^z (\partial_t \rho)]. \label{eq:mfmz} \end{align} Therefore, solving Eqs.~\eqref{eq:mfBRE} and \eqref{eq:mfmz} simultaneously, we obtain the self-consistent solution for $m^z(t)$. In the numerical calculations, we use the forth-order Runge-Kutta method, solving Eqs.~\eqref{eq:mfBRE} and \eqref{eq:mfmz}. The mean-field BR equation~\eqref{eq:mfBRE} has nontrivial non-Markovianity, or memory effect, in the sense that $\Sigma_\text{MF}^\mu(t)$ involves the information of the past state $\rho(t')$ ($t<t'$) via the mean-field $m^z(t') = \text{Tr}[\sigma^z \rho(t')]$. This non-Markovianity derives from the fact that the system has been evolved under the mean-field Hamiltonian $H_\text{MF}(t')$ involving $m^z(t')$. Because of this memory effect, the spins at time $t$ are affected by the past state at $t'<t$ with correlation $\gamma(t-t')$ and tend to face the same direction as the past (see also Fig.~\ref{fig:illust}(b)). We note that the memory time, namely the width of $\gamma(t)$, is finite, which is $O(1/\Lambda)$. The interplay of the periodic drive and the memory effect stemming from the dissipation gives rise to a rich phase diagram, as shown below. We remark that this non-Markovianity is different from the Markovian approximation made in deriving the BR equation, which concerns the memory effect of the bath itself. Let us illustrate the solutions of Eqs.~\eqref{eq:mfBRE} and \eqref{eq:mfmz} in Fig.~\ref{fig:illust}(c), where the time evolution of $m^z(t)$ from an initial state $\rho(0)=\ket{\uparrow}\bra{\uparrow}$ is shown for a low and a high temperature. At the low temperature ($T=0.5$), $m^z(t)$ relaxes to NESS with $m^z(t)=-m^z(t+\tau)$, implying the emergence of period doubling $m^z(t+2\tau)=m^z(t)$, i.e., the DTC behavior. On the other hand, at the high temperature ($T=1$), $m^z(t)$ decays to vanish after a long time, meaning that the system is in the normal phase where the symmetry is not broken. The time profile for $T=0.5$ also shows the nontrivial memory effect. In the NESS, $|m^z(t)|$ decreases just after a pulse is applied, which implies that the spins feel the past mean-field and are about to face the same direction as that in the past due to the memory effect. This DTC transition at lower temperature accompanies a spontaneous $\mathbb{Z}_2$ symmetry breaking. Our Hamiltonian originally has the discrete time translation symmetry $\mathbb{Z}$, $H(t) = H(t+n\tau)$ ($n \in \mathbb{Z}$), and the spin $\pi$-rotation symmetry around the $x$-axis $\mathbb{Z}_2$, $[H(t),P]=0$ ($P=\Pi_j \sigma^x_j$), which also hold in the BR equation, $\mathcal{R}_t=\mathcal{R}_{t+n\tau}$ and $[\mathcal{R}_t, \mathcal{P}]=0$ ($\mathcal{P}(\rho) \equiv P \rho P$). In the DTC phase, the total symmetry $\mathbb{Z} \times \mathbb{Z}_2$ is broken to $\mathbb{Z}$ due to the many-body interaction, which is characterized by the following dynamical symmetry~\cite{Alon1998}: \begin{align} H(t+n\tau) = P^n H(t) P^n \qquad (n\in\mathbb{Z}).\label{eq:dynsym} \end{align} In other words, the mean-field with $m^z(t)=-m^z(t+\tau)$ emerges in the DTC phase, which is consistent with Fig.~\ref{fig:illust}(c). As far as the authors investigated, the dynamical symmetry~\eqref{eq:dynsym} is not broken for any $T$ and $\tau$. Thus, our DTC is a $\mathbb{Z}_2$-symmetry broken state of $\mathbb{Z}\times\mathbb{Z}_2 \rightarrow \mathbb{Z}$. \begin{figure*}[t] \includegraphics[width=\linewidth]{4transitions3.pdf} \caption{ (a) Phase diagram for $m_\text{tc}$ on $T$-$\tau$ plane. The color denotes the magnitude of $m_\text{tc}$ and the red (blue) region corresponds to DTC (normal) phase. The yellow solid line is obtained from the exact analysis~\eqref{eq:yellow}, and the yellow dashed line indicates the equilibrium transition temperature $T=1$. (b) $T$-dependence of $m_\text{tc}$ for $\tau=2$ and (c) $\tau$-dependence of $m_\text{tc}$ for $T=0.2$. Their critical exponents are both $1/2$. (d) Relaxation dynamics of $m_\text{tc}(t_n)$ in the vicinity of critical temperature $T_c \sim 0.7163$ for $\tau=2$. For visibility, $m_\text{tc}$ in every time-period $2\tau$ are plotted. On the critical point, $m_\text{tc}(t_n)$ decays in power-law as $m_\text{tc}(t_n)\sim t_n^{-1/2}$. The inset shows $T$-dependence of relaxation time $\tau_r$ and the red dashed line indicates $T=T_c$. The relaxation time diverges at $T=T_c$ as $\tau_r\sim|T-T_c|^{-1}$. All results in these figures are obtained from the initial state $\rho(0)=\ket{\uparrow}\bra{\uparrow}$. } \label{fig:4tran} \end{figure*} \section{Phase transition and criticality} \label{sec:trans} \subsection{Reentrant transition} Now we investigate the phase transition and the criticality on the $T$-$\tau$ plane. To quantify the symmetry breaking, we introduce the time-crystalline order parameter at $t_n=2n\tau$ ($n\in\mathbb{Z}$): \begin{align} &m_\text{tc}(t_n) = \int_{t_n}^{t_n+\tau} \frac{dt}{2\tau} m^z(t) - \int_{t_n+\tau}^{t_n+2\tau} \frac{dt}{2\tau} m^z(t), \end{align} and its long-time limit, \begin{align} m_\text{tc}\equiv\lim_{n\rightarrow\infty}m_\text{tc}(t_n). \end{align} This order parameter detects the DTC as it vanishes if the discrete time translation symmetry or the spin flip symmetry are not broken (i.e., $m^z(t)=m^z(t+\tau)$ or $m^z(t)=0$). In the long-time limit, the entire phase diagram for $m_\text{tc}$ is shown in Fig.~\ref{fig:4tran}(a) on the $T$-$\tau$ plane. Interestingly, there are two separated DTC regions, and $m_\text{tc}$ exhibits the second-order (continuous) transition at the phase boundaries. Whereas the phase transition occurs once as $T$ varies with $\tau$ fixed, it does twice as $\tau$ changes for constant $T$ (i.e., reentrance of the DTC phase). This reentrant transition by $\tau$ is absent in equilibrium and thus an essentially nonequilibrium phenomenon. Closely looking into the order parameter, we find that the critical exponents for the transition in the $T$ and $\tau$ directions are both 1/2: \begin{align} m_\text{tc} \sim |T-T_c|^{1/2} \,\,\, \text{and} \,\,\, \sim |\tau-\tau_c|^{1/2}, \end{align} respectively, in the vicinity of the phase transition. These behaviors are shown in Figs.~\ref{fig:4tran}(b) and (c) for representative parameters $\tau=2$ and $T=0.2$. The breakdown of DTC for the medium $\tau$ is due to a competition between the pulse interval and the memory time. To intuitively understand this, let us first consider the two limits of $\tau\rightarrow\infty$ and $0$. For $\tau \rightarrow \infty$, although the spin is disturbed just after a pulse is applied, it relaxes to an equilibrium stable point after a long time from the pulse because the memory time is finite (see Fig.~\ref{fig:illust}(c)). In contrast, for $\tau \rightarrow 0$, the pulse interval is so short that we can ignore the disturbance by the pulses, which leads to the relaxation to the equilibrium point as well. Therefore, in these limits, the transition temperature and criticality are equivalent to those in the thermal equilibrium of $H_0=-J\sum \sigma^z_i \sigma^z_j$. According to the mean-field theory in equilibrium, the transition occurs at $T_c=1$ in $\tau \rightarrow 0$ and $\infty$, which is consistent with Fig.~\ref{fig:4tran}(a). However, for the medium $\tau$ comparable with the memory time, the past memory affects the present time evolution significantly, and the $\pi$-pulses disturb the system, leading to the breakdown of the DTC. \subsection{Exact analysis} Remarkably, we can analytically obtain these phase boundaries and critical exponents considering the weak coupling limit $\lambda_\mu \rightarrow 0$, where the BR equation is valid. In this limit, $\partial_t m^z(t) \propto \lambda_\mu\rightarrow0$ except $t=n\tau$, and $m^z(t)$ has the following form, \begin{align} m^z(t) = \begin{cases} +M(t) & (t_n \le t < t_n+\tau) \\ -M(t) & (t_n+\tau \le t <t_{n+1}), \end{cases} \end{align} where $M(t)$ is a continuous function slowly varying in $t$. Thus, the BR equation~\eqref{eq:mfBRE} reduces to the time evolution equation for $M(t)$ (see Appendix~\ref{secap:Mt} for derivation): \begin{align} \partial_t M = \alpha(M) - \beta(M)M. \label{eq:partialM} \end{align} Here we have defined \begin{align} &\alpha(M) = X^-(M) + Y^-(M),\\ &\beta(M) = X^+(M) + Y^+(M), \end{align} and \begin{align} X^{\pm}(M) &= 2\pi \lambda_x \left[ \tilde{\gamma}(\epsilon^+_0) \pm \tilde{\gamma}(\epsilon^-_0) \right], \\ Y^{\pm}(M) &= \frac{8\lambda_y}{\pi} \sum_{k=-\infty}^\infty \frac{\tilde{\gamma}(\epsilon^+_{2k+1}) \pm \tilde{\gamma}(\epsilon^-_{2k+1})}{(2k+1)^2}, \end{align} with $\epsilon^\pm_{k} = k\Omega \pm 2M$ and the DTC frequency $\Omega=2\pi/2\tau$. Here $\epsilon_k^\pm$ correspond to quasienergy differences between the Floquet states of up and down spins that are dressed by $n\pm k$ and $n$ \textit{photons} (not phonons), respectively, originating from the $\pi$-pulses ($n$ and $k$ are integers). The contribution with $\tilde{\gamma}(\epsilon_k^\pm)$ in Eq.~\eqref{eq:partialM} derives from transitions between the Floquet states, in which the excess energy of $k$ photons are compensated by the heat bath~\cite{Ikeda2021}. \begin{figure}[t] \includegraphics[width=7cm]{GM.pdf} \caption{ Profiles of $G(M_0)$ for $\tau=0.5, 1.35$ and $10$ with $T=0.5$. The intersection points of $y=G(M_0)$ and $y=M_0$ correspond to the solutions of Eq.~\eqref{eq:M0SCE}. The blue, orange, and green curves denote the normal, critical, and DTC phases, respectively. } \label{fig:GM} \end{figure} In the long-time limit, $M(t)$ relaxes to a constant $M_0$, which is determined by the stationary condition $\partial_t M=0$ as \begin{align} M_0=\frac{\alpha(M_0)}{\beta(M_0)} \equiv G(M_0), \label{eq:M0SCE} \end{align} where we have used $\beta(M_0)\neq0$. In the two limits of $\tau\to0$ and $\infty$, the $k$-photon processes ($k\neq0$) in $G(M_0)$ are negligible because the photon energy exceeds the bath spectral cutoff in $\tau\to0$ and the photon energy vanishes in $\tau\to\infty$. Therefore, using the KMS condition~\eqref{eq:KMS}, Eq.~\eqref{eq:M0SCE} reduces to the well-known equilibrium self-consistent equation in these limits: \begin{align} M_0=\tanh(M_0/T). \end{align} This is why $T_c$ approaches the equilibrium one ($T_c=1$) in Fig.~\ref{fig:4tran}(a) and consistent with the intuition that the memory effect is not relevant when $\tau\to0$ and $\infty$. In contrast, for the medium $\tau$ comparable with the memory time $\sim O(1/\Lambda)$, those $k$-photon processes dominate to disturb the system significantly, destroying the DTC. The profiles of $G(M_0)$ for representative parameters are depicted in Fig.~\ref{fig:GM}, where $y=M_0$ and $y=G(M_0)$ are plotted, and the intersections between them correspond to the solutions of Eq.~\eqref{eq:M0SCE}. Although there is only one intersection at $M_0=0$ in the normal phase (blue curve), there are three intersections at $M_0=0,\pm m$ in the DTC phase (green curve). In the DTC phase, the intersections at $M_0=\pm m$ correspond to the $\mathbb{Z}_2$ symmetry-broken state whereas one at $M_0=0$ is the symmetry-unbroken state that is unstable. On the critical point, because of $\partial G(M_0)/\partial M_0|_{M_0=0}=1$ (see the orange curve in Fig.~\ref{fig:GM}), we obtain the condition that the critical temperature $T_c$ and interval $\tau_c$ satisfy: \begin{align} T_c = 1 - \frac{4}{\pi^2}\sum_k \frac{\tilde{\gamma}(\epsilon_{2k+1}^0)-2\tilde{\gamma}'(\epsilon_{2k+1}^0)}{(2k+1)^2}.\label{eq:yellow} \end{align} Here, we have defined $\epsilon_{k}^0=k\Omega$ and $\tilde{\gamma}'(\epsilon)=\partial_\epsilon \tilde{\gamma}(\epsilon)$. Note that $\tilde{\gamma}(\epsilon_{2n+1}^0)$ and $\tilde{\gamma}'(\epsilon_{2n+1}^0)$ depend on $T_c$ and $\tau_c$. The solid curves in Fig.~\ref{fig:4tran}(a) indicate the solutions of Eq.\eqref{eq:yellow}, which agree well with the numerically-obtained phase boundaries for $\lambda_x=\lambda_y=0.05$. Besides, by expanding $G(M_0)$ up to $O(M_0^3)$ in Eq.~\eqref{eq:M0SCE} and solving the cubic equation, we obtain the critical behavior near the phase boundaries \begin{align} M\sim\sqrt{a_1(T-T_c)+a_2(\tau-\tau_c)} \end{align} ($a_1$ and $a_2$ are constant, see Appendix~\ref{secap:criticality}). This equation explains the numerically-obtained critical behaviors $m_\text{tc} \sim |T-T_c|^{1/2}$ and $\sim |\tau-\tau_c|^{1/2}$ in a unified manner. \begin{figure*}[t] \includegraphics[width=\linewidth]{tv_DTQC3.pdf} \caption{ (a) Time profiles of $\braket{\sigma^\mu(t)}=\text{Tr}[\sigma^\mu\rho(t)]$ ($\mu=x,y,z$) for $T=0.5, \tau=10$, and $\epsilon=0.3$ ($\braket{\sigma^z(t)}=m^z(t)$). Note that, at $t=n\tau$, the pulse only rotates the spin on the $y$-$z$ plane and does not change $\braket{\sigma^x(t)}$ (although it is hard to see because the change after the pulse is quick). (b,c) (top) Time profiles of $m^z(t)$ for (a) $\tau=2$ and (b) $\tau=0.2$ with various $\epsilon$'s and (bottom) their Fourier spectra in $t\in[100,200]$, where we have used a window function $w(t)=\exp[-(t-150)^2/20^2]$. All results in these figures are obtained from the initial state $\rho(0)=\ket{\uparrow}\bra{\uparrow}$. } \label{fig:tv_dtqc} \end{figure*} \subsection{Dynamical criticality} Besides the long-time limit, yet another critical behavior arises during the relaxation dynamics. Figure~\ref{fig:4tran}(d) shows that, at $T\neq{T_c}$, $m_\text{tc}(t_n)$ exponentially relaxes to $m_\text{tc}$ with the characterisitic relaxation time $\tau_r$ depending on $T$: $m_\text{tc}(t_n) \sim m_\text{tc} + (t_n)^{-\chi} \exp(-t_n/\tau_r)$. At the critical temperature $T=T_c$, $\tau_r$ diverges as \begin{align} \tau_r \sim |T-T_c|^{-1}, \label{eq:taur} \end{align} (see the inset of Fig.~\ref{fig:4tran}(d)), and $m_\text{tc}(t_n)$ decays purely in power-law, $m_\text{tc}(t_n) \sim (t_n)^{-\chi}$, where our numerical calculation gives $\chi\sim 1/2$: \begin{align} m_\text{tc}(t_n) \sim (t_n)^{-1/2}. \label{eq:mtct} \end{align} Since these critical behaviors are manifest in a finite time window, they could be directly addressed in experiments (see Sec.~\ref{sec:ex} for further discussion for possible experiments). We can analytically obtain the dynamical critical behaviors~\eqref{eq:taur} and \eqref{eq:mtct} from Eq.~\eqref{eq:partialM}. On the critical point, expanding the right-hand side of Eq.~\eqref{eq:partialM} up to $O(M^3)$, we have $\partial_t M \sim q_c \beta(0) M^3$ in the lowest order, where we have used $G(M) \sim M + q_c M^3$. Since the $O(M)$ term is absent on the critical point, we obtain the power-law decay by solving the differential equation: \begin{align} M(t) \sim t^{-1/2}, \end{align} which is consistent with the numerical result. On the other hand, in the vicinity of the critical point, we expand Eq.~\eqref{eq:partialM} by $\delta M(t)=M(t)-M_0$, having $\partial_t \delta M \sim \beta(M_0) \left(r_1\delta T + r_2\delta \tau \right) \delta M$ ($\delta T=T-T_c$ and $\delta \tau=\tau-\tau_c$). Here we have used $G(M) \sim G(M_0) + \left(1+r_1\delta T+r_2\delta \tau\right)\delta M$. Unlike on the critical point, it has the linear term of $O(\delta M)$, and, therefore, we obtain the exponential decay: \begin{align} &\delta M(t) \sim \exp\left(-t/\tau_r\right). \end{align} Here $\tau_r$ is the relaxation time \begin{align} &\tau_r \sim |b_1(T-T_c)+b_2(\tau-\tau_c)|^{-1}, \end{align} which is a generalization of Eq.~\eqref{eq:taur} to the case of $\tau-\tau_c\neq0$ (we have defined $b_1=\beta(M_0)r_1$ and $b_2=\beta(M_0)r_2$). See Appendix~\ref{secap:dcriticality} for the detailed derivation. \section{Rigidity of time crystal} \label{sec:rigid} As discussed in Sec.~\ref{sec:model}, the free energy picture implies that our time crystal is robust against perturbations, where the dissipation brings the state to a nearby minimum in the free energy and stabilizes the DTC (see Fig.~\ref{fig:illust}(b)). To verify the rigidity, or robustness against perturbations, of our DTC, we introduce an imperfection $\epsilon$ to the $\pi$-pulse: \begin{align} H_{\epsilon}(t) = - J \sum_{\langle i,j\rangle} \sigma^z_i \sigma^z_j + \frac{\pi(1+\epsilon)}{2} \sum_{j,n} \delta(t-n\tau)\sigma^x_j. \label{eq:Ham_pe} \end{align} Each pulse rotates every spin around the $x$-axis by $\pi(1+\epsilon)$, rather than $\pi$. Note that $H_{\epsilon}(t)$ has the same symmetry $\mathbb{Z}\times\mathbb{Z}_2$ even for $\epsilon\neq0$. Without dissipation, the DTC is broken for $\epsilon\neq0$ since the Floquet dynamical symmetry does not hold, $U_F^\epsilon \sigma^z_j U_F^{\epsilon\dag} \neq -\sigma^z_j$ ($U_F^\epsilon = \mathcal{T} e^{-i\int_0^\tau dt H_\epsilon(t)}$), unless there exists other stabilizing mechanism such as many-body localization. A representative spin dynamics in the robust dissipative DTC is shown in Fig.~\ref{fig:tv_dtqc}(a). At $t=n\tau$ $(n\in\mathbb{N})$, each imperfect $\pi$-pulse rotates the spin in the $y$-$z$ plane, instantaneously changing the $y$ and $z$ spin components while keeping the $x$ component unchanged. The spin then evolves under the dissipation and memory effect, becoming restored to a stable state parallel to the $z$-axis ($\braket{\sigma^{x,y}(t)}=0$ and $m^z(t)=\braket{\sigma^{z}(t)}\sim \pm0.95$), which corresponds to either free-energy minimum. This observation clearly indicates the origin of rigidity: Even if the pulse is not fine-tuned to the perfect $\pi$-pulse, the dissipation generically pulls the spin back to the $z$-axis and stabilizes the $m^z(t)$'s alternating dynamics, i.e., the DTC order. We note that the dynamical symmetry~\eqref{eq:dynsym} is not broken in the DTC even for $\epsilon\neq 0$. The robustness of the DTC against a small imperfection $\epsilon$ holds true for both the large- and small-$\tau$ DTC phases depicted in Fig.~\ref{fig:4tran}(a). Nonetheless, the large-$\tau$ DTC phase is more stable than that for smaller $\tau$. Figures~\ref{fig:tv_dtqc}(b) and (c) show $m^z(t)$ for a large-$\tau$ ($\tau=2$) and small-$\tau$ ($\tau=0.2$) for several $\epsilon$'s. Whereas the DTC is restored up to $\epsilon=0.2$ for $\tau=2$, it is broken already at $\epsilon=0.1$ for $\tau=0.1$. \begin{figure*}[t] \includegraphics[width=\linewidth]{eptau3.pdf} \caption{ (a,b) $\epsilon$-dependence of $m_\text{tc}$ for (a) $\tau=2$ and (b) $0.2$ with $(\lambda_x,\lambda_y,\lambda_z)=$ $(0.05,0.05,0.1)$ (blue circles) and $(0.02,0.02,0.04)$ (orange squares). The temperature is $T=0.2$, and the positive (negative) $m_\text{tc}$ denotes the DTC (DTQC) order. (c,d) Phase diagrams on $\epsilon$-$\tau$ plane for (c) $T=0.2$ and (d) $0.5$. In all panels, $m_\text{tc}$ has been obtained in the long-time limit of dynamics starting from the initial state $\rho(0)=0.55 \ket{\uparrow}\bra{\uparrow} + 0.45 \ket{\downarrow}\bra{\downarrow}$. } \label{fig:eptau} \end{figure*} \begin{figure*}[t] \includegraphics[width=\linewidth]{multi3.pdf} \caption{ (a-d) Time profiles of $m^z(t)$ from initial state $\rho(0)=\alpha\ket{\uparrow}\bra{\uparrow} + (1-\alpha)\ket{\downarrow}\bra{\downarrow}$ for $(\tau,\epsilon) = $ (a) $(2,0.1)$, (b) $(2,0.24)$, (c) $(0.2,0.1)$, and (d) $(0.2,0.045)$. The blue circles (orange squares) indicate the results for $\alpha=1$ ($0.55$). The temperature is $T=0.2$. } \label{fig:multi} \end{figure*} Besides, whereas the DTC directly becomes the normal phase as $\epsilon$ increases for larger $\tau$, it is broken first to the DTQC~\cite{Giergiel2019b,Zhao2019,Pizzi2019,Chinzei2020}, in which $m^z(t)$ never decays but oscillates quasi-periodically in time, before becoming the normal phase. This DTQC is seen in Fig.~\ref{fig:tv_dtqc}(c) for the intermediate $\epsilon$ ($=0.1$ and $0.13$) and clearly indicated in the Fourier spectra of $m^z(t)$. While the DTC is characterized by the Fourier peaks $\omega=(2n+1)\Omega$ (even-order harmonics are absent due to the dynamical symmetry $m^z(t)=-m^z(t+\tau)$ implying $\int_0^{2\tau}dt\, m^z(t)e^{i2n\Omega t}=0$), these peaks are split into two in the DTQC. Intuitively, these distinct fates of the large- and small-$\tau$ DTC phases against $\epsilon$ originate from how effective the dissipation stabilizes the DTC. As discussed above, the rigidity of DTC stems from the restoring force into the free-energy minima by dissipation. However, for small-$\tau$ (i.e., short interval), the state cannot be restored before the next pulse arrives, which leads to the fact that the DTC for small-$\tau$ is more fragile than that for large-$\tau$. Yet, even for small $\tau$, the spin does not necessarily decay to vanish because it can be approximately restored being rotated many times by the sequential imperfect pulses for a short time, which gives rise to the DTQC. These arguments suggest that the DTC and DTQC become more robust as the dissipation strength $\lambda_\mu$ increases. In Fig.~\ref{fig:eptau}, we show the $\epsilon$-dependences of $m_\text{tc}$ with two dissipation strengths for (a) $\tau=2$ and (b) $0.2$. Here, for illustration, we have defined $m_\text{tc}$ in DTQC as the negative value whose norm is the amplitude of the oscillation of $m^z(t)$ in the NESS. For $\tau=2$, the transition point from the DTC to the normal phase becomes large as the dissipation strength $\lambda_\mu$ increases. For $\tau=0.2$, both transition points become large as the dissipation strength while the DTC-DTQC transition point shifts only slightly. These results show that the DTC and DTQC become more rigid due to the stronger dissipation as expected. Besides, in Figs.~\ref{fig:eptau}(a) and (b), we can observe the discontinuous, namely first-order, transition from the DTC to the normal (DTQC) phase for $\tau=2$ ($0.2$). This first-order transition originates from multiple stable states in the vicinity of the transition as shown in Fig.~\ref{fig:multi}, where the time evolutions from different initial states are shown for $\epsilon$'s far from and near the transition points. While, far from the transition points (Figs.~\ref{fig:multi}(a) and (c)), the different initial states relax to the same DTC or DTQC states, near the transition points (Figs.~\ref{fig:multi}(b) and (d)), they relax to different states, which means the existence of multiple stable states in the vicinity of the transition. These imply that the first-order transition occurs due to a jump from a stable state to another. We leave, for future work, the systematic study of all possible states appearing for large $\epsilon$ and emphasize again that the DTCs are stable against small $\epsilon$. We finally show the entire phase diagrams on $\epsilon$-$\tau$ plane for $T=0.2$ and $0.5$ in Figs.~\ref{fig:eptau}(c) and (d), where we have set the initial state as $\rho(0)=0.55\ket{\uparrow}\bra{\uparrow}+0.45\ket{\downarrow}\bra{\downarrow}$. As shown in these figures, at a high temperature ($T=0.5$), the DTQC phase disappears, and the area of the DTC region at the bottom becomes smaller than that at a lower temperature ($T=0.2$). This is because, at higher temperatures, the thermal fluctuation is larger and tends to bring the system to a paramagnetic state with $\braket{\sigma^\mu(t)}=0$. Therefore, to realize the DTQC or more rigid DTC, the lower temperature is generically more advantageous. \section{Experimental realizations} \label{sec:ex} Finally, we argue possible experimental realizations of the dissipative DTC in solids. Although we have assumed the $\pi$-pulses of ideal zero width, approximated ones were experimentally demonstrated~\cite{Schumacher2003,Shiota2012}, in which intense transverse magnetic fields with short pulse width are sequentially applied to magnetic materials to switch their magnetization directions. Thus, the authors think that a dissipative DTC was already realized in a sense despite not being dictated so in the DTC research context~\cite{Kebler2021,Ball2021}. These experiments support the rigidity of our DTC against experimental noises and imperfections. However, these experiments correspond to the large-$\tau$ cases, and the phase transitions and critical phenomena have not been explored yet. To access these theoretical predictions, one needs ultra-short and -intense pulses at a high repetition rate whose interval $\tau$ is comparable to the exchange interaction time-scale $1/J$ and the memory time $\sim O(1/\Lambda)$ (see below for typical values of $\tau$). Another possibility is to make use of the electron-spin resonance (ESR) technique~\cite{Kirilyuk2010}. In ESR, since the ultra-short laser pulses can be used instead of the transverse field, it is easier to make the setup for short $\tau$. Since the driving part of the Hamiltonian is replaced with the light-matter interaction in this setup, it is intriguing to study whether the criticality does not change qualitatively due to the universality. Table~\ref{tb:unit} provides typical values of the upper and lower critical intervals in the reentrant transition denoted by $\tau_{c1}$ and $\tau_{c2}$, respectively. Since $\tau_{c1}$ and $\tau_{c2}$ depend on the temperature $T$ (see Fig.~\ref{fig:4tran}(a)), we take two example values $T=0.5$ and $0.9$ as well as two fundamental energy scales $Jd=10$\,meV and $100$\,meV. This table suggests two ways to obtain larger critical intervals for the upper one $\tau_{c1}$, which are preferable for experimental feasibility. The first way is to use a magnetic material with small exchange interaction $J$ and bath spectral cutoff $\Lambda$ as $\tau_{c1}$ (and $\tau_{c2}$) is proportional to $1/J$ (note that $\Lambda/Jd$ is fixed). However, in this approach, since the transition temperature becomes small proportionally to $J$, one must cool the material to lower temperatures, e.g., 105\,K for $T=0.9$ and $Jd=10$\,meV. The second way is to make the temperature just a little lower than the transition temperature in thermal equilibrium. In fact, in the limit of $T \rightarrow T_c^\text{eq} - 0$ ($T_c^\text{eq}$ is the transition temperature in equilibrium), we have $\tau_{c1} \rightarrow \infty$ (see Fig.~\ref{fig:4tran}(a)). In this approach, while the demand for the small $\tau$ is greatly relaxed, one needs high measurement accuracy to detect the small magnetization as the DTC order parameter is small around $T_c^\text{eq}$. By appropriately choosing a material and temperature based on these trade-off relations, one could have a chance to detect the transition by $\tau$ and the criticality within the current technologies. \begin{table}[t] \caption{ Table of values with units for upper and lower critical intervals $\tau_{c1}$ and $\tau_{c2}$ for $T=0.5$ and $0.9$ depending on two choices of $Jd=10$\,meV and $100$\,meV. We have obtained the values from the analytical result~\eqref{eq:yellow} with $\Lambda=5Jd$. } \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}c|ccc} \hline & Energy scale $Jd$ & 10meV & 100meV \\ \hline \hline $T=0.5$\,\, & Temperature $T$ & 58\,K & 580\,K \\ \,\, & Upper critical point $\tau_{c1}$ & 86\,fs & 8.6\,fs \\ & Lower critical point $\tau_{c2}$ & 17\,fs & 1.7\,fs \\ \hline $T=0.9$\,\, & Temperature $T$ & 105\,K & 1050\,K \\ \,\, & Upper critical point $\tau_{c1}$ & 307\,fs & 30.7\,fs \\ & Lower critical point $\tau_{c2}$ & 13\,fs & 1.3\,fs \end{tabular*} \label{tb:unit} \end{table} \section{Discussions and conclusions} \label{sec:fin} In this paper, using the time-dependent mean-field theory, we have shown that the dissipative time crystals can be realized in solid-state materials and elucidated the criticality and rigidity of them. While generic dissipation has been expected to destroy time-crystalline behaviors, it rather stabilizes the DTC in our scenario without fine-tuning as long as the temperature is low enough. Microscopically analyzing our model, we have found the nontrivial transition behaviors without equilibrium counterparts such as the reentrant transition by changing the pulse interval, which arises from the interplay of the periodic drive and dissipation. Also, to demonstrate the rigidity, we have considered the imperfect spin-rotation angle $\epsilon\pi$ away from $\pi$ of each pulse, showing that the DTC is robust against small $\epsilon$ and finding that the DTQC can appear for large $\epsilon$. Finally, we have discussed the experimental realizations of our DTC. Although we have focused on the $\mathbb{Z}_2$-symmetric materials in this work, our theory could be extended to $\mathbb{Z}_N$-symmetric ones, in which $N$ symmetry broken states are switched one after another in every cycle by appropriate pulses, and the DTC with period $N\tau$ is realized. This could offer a new possibility to create various DTCs in materials, which is also important from the viewpoint of Floquet engineering in solid-state physics~\cite{Bukov2015,Oka2019}. Nonequilibrium universality is a crucial open issue. In this work, we have only focused on the quantum Ising model and the U(1)-symmetric dissipation. According to the equilibrium theory, the criticality only relies on the symmetries and dimensions, which is known as the universality. If this holds true for DTCs, the critical exponents that we have found should be common with any models with the Ising symmetry within the mean-field approximation. Also, finding criticality with different symmetries and calculating critical exponents beyond the mean-field theory are intriguing future directions. We leave these questions for future work. \section*{Acknowledgements} Fruitful discussions with Akihiko Ikeda and Hirokazu Tsunetsugu are gratefully acknowledged. K.C. was supported by JSPS KAKENHI Grant No.~21J11245 and Advanced Leading Graduate Course for Photon Science at the University of Tokyo. T.N.I. was supported by JSPS KAKENHI Grant No.~JP21K13852. The computation in this work has been done using the facilities of the Supercomputer Center, the Institute for Solid State Physics, the University of Tokyo.
\section{Introduction} \label{sec:intro} Nova eruptions are the result of quasi-periodic thermonuclear runaways (TNRs) on the surfaces of accreting white dwarfs in semidetached binary systems \citep[e.g., see][and references therein]{2016PASP..128e1001S}, with eruptions recurring on timescales as short as a year \citep{2014ApJ...793..136K}\footnote{ Novae where more than one eruption has been recorded (i.e., systems with recurrence times less than of order a century) are collectively referred to a ``Recurrent Novae", although the terminology is somewhat misleading given that all systems are believed to be recurrent.}. Novae are among the most luminous optical transients known, with absolute magnitudes at the peak of the eruption averaging M$_V\sim-7.5$, and reaching M$_V\sim-10$ for the most luminous systems. As a result, they can be seen to great distances and have been studied in external galaxies for more than a century \citep[e.g., in M31,][]{1917PASP...29..210R,1929ApJ....69..103H}. The observed properties of novae are predicted theoretically to depend strongly on the structure of the progenitor binary system. The mass of the white dwarf and the rate of accretion onto its surface are the most important parameters, ultimately determining the ignition mass required to initiate the TNR \citep[e.g.,][]{1982ApJ...253..798N,2005ApJ...628..395T,2014ApJ...793..136K}. Systems with high mass white dwarfs accreting at high rates require the lowest ignition masses, and thus have the shortest recurrence times between successive eruptions. The small ignition masses result in eruptions that eject relatively little mass resulting in a rapid photometric evolution (i.e., they produce ``fast" novae). The mass accretion rate is strongly influenced by the evolutionary state of the companion star, with evolved stars typically transferring mass to the white dwarf at a higher rate compared with systems containing main-sequence companions. The amplitudes of the eruptions are also strongly dependent on the nature of the companion star, being as small as $\sim$5 magnitudes as in the case of the M31 recurrent nova M31N~2008-12a \citep{2017ApJ...849...96D}, or as large as $\sim$20 mag as was observed for the Galactic nova, V1500 Cyg \citep{1987SSRv...45....1D}. Finally, it is also thought that the chemical composition of the accreted material may also play an important role in determining the observed properties of nova eruptions \citep[e.g.,][and references therein]{2016PASP..128e1001S}. Given that the nature of the nova eruptions are predicted to depend sensitively on the properties of the progenitor binary, it is reasonable to expect that the observed properties of a novae in a given galaxy might vary with the underlying stellar population. In particular, the specific {\it rate\/} of nova eruptions can be expected to be much higher in a population of novae containing higher mass white dwarfs, where the average recurrence times are relatively short. An early attempt to explore this question was undertaken by \citet{1997ApJ...481..127Y} who computed population synthesis models that predicted that young stellar populations, which contain on average more massive white dwarfs, should produce nova eruptions at a higher rate compared with older populations. Thus, late-type, low mass galaxies, with a recent history of active star formation were predicted to be more prolific nova producers compared with older, quiescent galaxies. To date, nova rates have been estimated in well over a dozen galaxies \citep[e.g., see][and references therein] {2014ASPC..490...77S,2019enhp.book.....S,2020A&ARv..28....3D}. Taken together, the results do not suggest a simple relationship between a galaxy's specific nova rate (usually taken to be its $K$-band luminosity-specific rate, $\nu_K$) and its dominant stellar population (as reflected by its integrated $B-K$ color). Early work by \citet{1990AJ.....99.1079C,2000ApJ...530..193S,2004ApJ...612..867W} failed to find any correlation between $\nu_K$ and Hubble type; however, \citet{1994A&A...287..403D} argued that the bluer, late-type systems such as the Magellanic Clouds and M33, had higher specific nova rates compared with earlier type galaxies. More recently, \citet{2016ApJS..227....1S} and \citet{2017RNAAS...1...11S} have analyzed archival {\it HST\/} imaging data of M87 and made a compelling case that the specific nova rate in this giant elliptical galaxy is at least as high, and perhaps higher, than that found in spiral galaxies and the LMC. Given the uncertainties inherent in measuring extragalactic nova rates, particularly in galaxies other than the Magellanic Clouds (where the rates are relatively well constrained by the Optical Gravitational Lensing Experiment \citep[OGLE,][]{2016ApJS..222....9M}, it's fair to say that the question of whether the specific rates vary systematically with the underlying stellar population has yet to be answered definitively. In an attempt to shed further light on how the underlying stellar population may affect observed nova properties, we have undertaken a multi-year survey of novae in the grand-design spiral M83 (NGC~5236) -- also known as the Southern Pinwheel galaxy -- a metal-rich, late-type barred spiral galaxy of morphological type SAB(s)c \citep{1991rc3..book.....D}. \begin{deluxetable}{lccc} \tablecolumns{4} \tablecaption{Log of Observations\label{tab:log}} \tablehead{\colhead{UT Date} & \colhead{Julian Date} & \colhead{Limiting mag} & \\ \colhead{(yr~mon~day)} & \colhead{(2,450,000+)} & \colhead{($R$)} & \colhead{Notes\tablenotemark{a}} } \startdata 2012 12 12.361 & 6273.861 & 22.3 & 1 \cr 2012 12 18.368 & 6279.868 & 22.7 & 1 \cr 2012 12 22.352 & 6283.852 & 22.5 & 1 \cr 2012 12 23.345 & 6284.845 & 22.9 & 1 \cr 2012 12 28.314 & 6289.814 & 21.8 & 1 \cr \enddata \tablecomments{Table~\ref{tab:log} is published in its entirety in the machine-readable format. A portion is shown here for guidance regarding its form and content.} \tablenotetext{a}{All observations were made with the 1.54-m Danish Telescope at La Silla. Observer(s): (1) K. Hornoch } \end{deluxetable} \begin{figure} \includegraphics[angle=0,scale=0.40]{f1.pdf} \caption{Top panel: A $75''\times57''$ portion of a median-combined image from our survey taken on the night of 2014 Feb 11 UT. Middle panel: An image of the same region of the galaxy one month later on 2014 Mar 11 UT. Bottom panel: The difference of the two images as computed by the ISIS image subtraction software, clearly showing the nova M83N 2014-03a. } \label{fig:novdet} \end{figure} \section{Observations} \label{sec:obs} Our survey for novae in M83 spanned approximately seven years between 2012 December 12 and 2019 March 14. During this time we acquired a total of 205 nightly images of the galaxy. All observations were acquired with the 1.54-m Danish reflector at the La Silla observatory using the DFOSC $2048\times2048$ CCD imager. The telescope-detector combination resulted in final images covering a square area approximately $13.5'$ on a side, with a spatial resolution of 0.396 arcsec~pixel$^{-1}$. In visual light, M83 has an apparent size of $12.9'\times11.5'$, assuring that our observations cover essentially all of the galaxy. However, as described later in section~\ref{ssec:lsnr}, the outer halo of M83 may extend slightly beyond our survey's spatial coverage. The vast majority of our images were taken through a broad-band $R$ filter, with occasional exposure taken through an $I$ filter. We chose to conduct our primary survey in the $R$-band both because novae develop strong H$\alpha$ emission shortly after eruption, which adds to the flux in the $R$-band, and because the quantum efficiency of the CCD detector reaches a peak near the $R$-band. A complete log of our observations is given in Table~\ref{tab:log}. \subsection{Image Processing} All images were pipeline processed in the usual manner by first subtracting the bias and dark current, and then flat-fielding the individual images to remove the high-frequency, pixel-to-pixel variations using APHOT \citep[a synthetic aperture photometry and astrometry software developed by M. Velen and P. Pravec at the Ond\v{r}ejov observatory,][]{1994ExA.....5..375P}. To eliminate cosmic-ray artifacts in our nightly images, we obtained a series of 120-s images that were later spatially registered and median stacked using SIPS\footnote{\tt https://www.gxccd.com/cat?id=146\&lang=409} to produce a final image for a given night of observation intended for nova searching. Photometric and astrometric measurements of the novae were done using APHOT on spatially registered and stacked nightly images. \begin{figure} \plotone{f2.pdf} \caption{Top panel: A $30''\times30''$ portion of our survey image from the night of 2013 Jan 18 UT (North up, East left). The likely supernova is located approximately $2''$ E and $1.6''$ S of the center of the anonymous spiral galaxy. For comparison, the bottom panel shows an identical $30''\times30''$ portion of deep Sloan $r$-band image of the galaxy field taken on 2010 Sep 28 UT by J. L. Prieto using the MEGACAM on the 6.5-m Magellan II - Clay telescope at Las Campanas Observatory. } \label{fig:posssn} \end{figure} \begin{figure} \includegraphics[angle=0,scale=0.33]{f3.pdf} \caption{The light curve of the transient source near the anonymous background galaxy. The proximity of the transient source to the galaxy, coupled with the slow rise to maximum light ($\mathrel{\hbox{\rlap{\hbox{\lower4pt\hbox{$\sim$}}}\hbox{$>$}}} 10$~d), strongly suggests that the object is a supernova (likely of Type~Ia) in the background galaxy, and not a nova in M83. The red triangle represents an upper limit on the flux when the transient was not detected. } \label{fig:snlc} \end{figure} \begin{deluxetable*}{ccccrrc} \tablecolumns{7} \tablecaption{M83 Novae \label{tab:novae}} \tablehead{& & \colhead{R.A. (2000.0)} & \colhead{Decl. (2000.0)} & \colhead{R.A. offset} & \colhead{Decl. offset} & \\ \colhead{Nova \#} & \colhead{Nova name} & \colhead{(h~~m~~s)} & \colhead{($^{\circ}$~~$'$~~$''$)} & \colhead{$\Delta\alpha$~cos($\delta$) ($''$)} & \colhead{$\Delta\delta$ ($''$)} & \colhead{Notes\tablenotemark{a}} } \startdata 1& M83N 2013-01a & 13 36 44.30 & $-29~50~33.9$ &$ -216.2$ &$ 82.8$ & 1 \cr 2& M83N 2013-01b & 13 37 03.42 & $-29~53~39.8$ &$ 32.5$ &$ -103.1$ & 2 \cr 3& M83N 2013-01c & 13 37 06.75 & $-29~56~15.5$ &$ 75.8$ &$ -258.8$ & 3 \cr 4& M83N 2013-01d & 13 37 10.51 & $-29~45~19.6$ &$ 124.8$ &$ 397.1$ & 3 \cr 5& M83N 2013-03a & 13 36 58.76 & $-29~53~22.6$ &$ -28.1$ &$ -85.9$ & 4 \cr 6& M83N 2013-04a & 13 37 05.80 & $-29~48~11.4$ &$ 63.5$ &$ 225.3$ & 5 \cr 7& M83N 2014-01a & 13 37 17.86 & $-29~53~47.7$ &$ 220.3$ &$ -111.0$ & 6 \cr 8& M83N 2014-01b & 13 37 05.81 & $-29~56~02.0$ &$ 63.6$ &$ -245.3$ & 3 \cr 9& M83N 2014-01c & 13 37 15.48 & $-29~56~10.9$ &$ 189.3$ &$ -254.2$ & 3 \cr 10& M83N 2014-03a & 13 37 08.88 & $-29~50~16.6$ &$ 103.6$ &$ 100.1$ & 7 \cr 11& M83N 2015-01a & 13 36 35.15 & $-29~56~41.0$ &$ -335.1$ &$ -284.3$ & 8 \cr 12& M83N 2015-04a & 13 37 08.42 & $-29~51~13.5$ &$ 97.6$ &$ 43.2$ & 9 \cr 13& M83N 2016-02a & 13 36 53.01 & $-29~56~19.9$ &$ -102.8$ &$ -263.2$ & 10 \cr 14& M83N 2016-02b & 13 36 45.52 & $-29~55~57.2$ &$ -200.2$ &$ -240.5$ & 10 \cr 15& M83N 2016-03a & 13 36 36.15 & $-29~51~44.9$ &$ -322.2$ &$ 11.8$ & 11 \cr 16& M83N 2018-01a & 13 37 09.78 & $-29~56~57.6$ &$ 115.2$ &$ -300.9$ & 12 \cr 17& M83N 2018-02a & 13 37 01.26 & $-29~55~48.2$ &$ 4.4$ &$ -231.5$ & 13 \cr 18& M83N 2019-02a & 13 37 03.82 & $-29~48~21.7$ &$ 37.7$ &$ 215.0$ & 14 \cr 19& M83N 2019-03a & 13 37 18.18 & $-29~48~29.0$ &$ 224.6$ &$ 207.7$ & 15 \cr \enddata \tablenotetext{a}{ (1) \citep{2013ATel.4723....1H}; (2) \citep{2013ATel.4732....1H}, \citep[see also][for spectroscopic classification]{2013ATel.4734....1P}; (3) K. Hornoch; (4) K. Hornoch and M. Skarka; (5) A. W. Shafter, K. Hornoch, and M. Wolf; (6) K. Hornoch and J. Vra\v{s}til; (7) K. Hornoch and M. Zejda; (8) K. Hornoch and E. Paunzen; (9) K. Hornoch, E. Paunzen, and M. Zejda; (10) K. Hornoch, P. Zasche, E. Paunzen, and J. Li\v{s}ka; (11) K. Hornoch, M. Wolf, L. Pilar\v{c}\'ik, and J. Vra\v{s}til; (12) \citep{2018ATel11240....1H}; (13) \citep{2018ATel11443....1H}; (14) \citep{2019ATel12539....1H}; (15) \citep{2019ATel12564....1H}.} \end{deluxetable*} \section{Nova Detection} \label{sec:novdet} Novae are transient sources that can be effectively identified through careful comparisons between images from synoptic imaging surveys having a variable cadence such as the one we have conducted. Coarse temporal coverage is sufficient to identify transient sources, but sufficiently dense coverage is required to measure the light curves. The light curves provide assurance that the detected transients are indeed novae and not some other variable objects, such as Luminous Blue Variables (LBVs), or the more common Luminous Red Variables (i.e., Mira variables) that can mimic novae in poorly sampled surveys. Novae can also be distinguished from other variable stars through their $V-I$ color, which is the reason we augmented our data with occasional $I$-band images. The strong H$\alpha$ emission contributing to the $R$-band flux results in a $V-I$ color that is significantly bluer than that of the extremely red Mira variables, which are characterized by $V-I \mathrel{\hbox{\rlap{\hbox{\lower4pt\hbox{$\sim$}}}\hbox{$>$}}} 2$ \citep[e.g., see][]{2019ApJ...884...20B}. Nova candidates were identified using two different procedures: First, through a direct comparison (blinking) of images from different epochs, and secondly, through a comparison of images from differing epochs using the image subtraction software, ISIS \citep{1998ApJ...503..325A}. Direct comparison of the images proved to be a very effective technique for identifying novae in the outer regions of the galaxy; however, in regions of the galaxy with high surface brightness (i.e., within $\sim3'$ of the nucleus and in some very dense regions of the spiral arms) we had to modify our approach. To detect novae in regions of high background, we first created smoothed (median-filtered) images by sliding a $11\times11$ pixel box across the image, pixel-by-pixel, replacing the central pixel by the median of all 121 pixels in the box. This median-smoothed image was then subtracted from the original image to produce a median-subtracted image with greatly reduced background variations. These median-subtracted images were once again blinked by eye. In addition to blinking median-subtracted images, we also employed image subtraction routines from the ISIS image processing package, which increased our sensitivity to novae in regions of high background. Figure~\ref{fig:novdet} shows an example of our ISIS nova detection procedure. The top panel shows a $75''\times57''$ portion of a median-combined image from 2014 Feb 11 UT. The middle panel shows an image of the same region of the galaxy one month later on 2014 Mar 11 UT. The nova, M83N 2014-03a, is visible in the March image, and clearly visible in the ISIS subtracted image at the bottom. We discovered a total of 19 novae over the course of our seven-year survey of M83. Their positions and offsets from the center of M83 (R.A. = $13^h 37^m 00.^s919$, Decl. = $-29^\circ 51' 56.''74$, J2000) are given in Table~\ref{tab:novae}. These detections represent the first novae to be reported in M83. It is worth noting that during our inspection of the images we found one transient source located extremely close ($\sim2''$~E and $\sim1.6''$~S) to the center of an anonymous background spiral galaxy (see Figure~\ref{fig:posssn}). The background galaxy, which is located at R.A. = $13^h~37^m~19.59^s$, Decl. = $-29^{\circ}~53'~47.1''$, lies $242.3''$~E and $110.3''$~S from the center of M83. While it is possible that this transient could be a nova in M83, given its proximity to the nucleus of the spiral, we consider it far more likely to have been a supernova in the galaxy discovered serendipitously during the course of our survey \citep{2013ATel.4747....1H}. This assessment is backed up by the light curve of the transient (see Figure~\ref{fig:snlc}), which shows the relatively slow rise to peak brightness characteristic of supernovae, but not novae. A comparison with the supernova light curve templates given in \citet{1985AJ.....90.2303D} suggests that the transient is likely a supernova of Type~Ia. In view of these considerations, we have excluded this source from our final tally of M83 novae. \subsection{Photometry} \label{ssec:phot} \begin{deluxetable}{lcccc} \tablecolumns{5} \tablecaption{M83 Nova Photometry \label{tab:phot}} \tablehead{\colhead{(UT Date)} & \colhead{(JD - 2,450,000)} & \colhead{Mag} & \colhead{Unc.} & \colhead{Band} } \startdata \cutinhead{2013-nova1 = 2013-01a} 2012 06 01.138 & 6079.638 & [22.6 & &R \cr 2012 12 12.361 & 6273.861 & [22.3 & &R \cr 2012 12 18.368 & 6279.868 & [22.7 & &R \cr 2012 12 23.345 & 6284.845 & [22.9 & &R \cr 2012 12 28.314 & 6289.814 & 21.0 &0.15 &R \cr 2012 12 28.316 & 6289.816 & 21.1 &0.2 &I \cr \enddata \tablecomments{Table~\ref{tab:phot} is published in its entirety in the machine-readable format. A portion is shown here for guidance regarding its form and content.} \end{deluxetable} \begin{figure*}[ht!] \includegraphics[angle=0,scale=1.0]{f4.pdf} \caption{Light curves for 18 of the 19 novae discovered in our survey plotted with consistent axes scales in order to better reveal the relative photometric properties of the novae. The one nova not shown is M83N 2015-04a, where the nova was only seen in one epoch ($R=21.4\pm0.25$ on JD 2,457,120.915). The red triangles represent upper limits on the flux at times when the novae were not detected.} \label{fig:lightcurves} \end{figure*} \begin{figure*} \includegraphics[angle=0,scale=0.11]{f5.pdf} \caption{The positions of the 19 novae discovered in our survey superimposed on an image of M83. The blue squares represent relatively ``fast" novae with $t_2<25$~d, while the red circles show ``slow" novae with $t_2>25$~d. The white triangles show the two novae without sufficient light curve coverage to determine a rate of decline from peak brightness. We find no correlation between speed class and spatial position within the galaxy, and it is clear that the novae are more spatially extended than is the background galaxy light.} \label{fig:spatdist} \end{figure*} Instrumental magnitudes for all nova candidates were determined by summing the fluxes in 2$''$-in diameter circular apertures in all epochs in which they were visible. Calibrated $R$-band magnitudes were then determined by differential photometry with respect to a set of six secondary standard stars in the M83 field. Both the $R$-band and $I$-band magnitudes of the secondary standard stars were photometrically calibrated by us using the same instrumentation as we used for the survey. As primary standards we used the stars and their magnitudes published in \citet{1992AJ....104..340L}. We observed both the primary standards and the M83 field during one night under excellent photometric conditions to get properly calibrated the secondary standards in the field of M83 which allow us to obtain photometry of the novae also in non-photometric nights. The calibrated magnitudes of all 19 novae discovered as part of our survey, on all nights where they were visible, are presented in Table~\ref{tab:phot}. The temporal sampling of our survey was sufficient to produce useful $R$-band light curves for all but one of the 19 novae. The light curves for these 18 novae having multiple epochs of observation are shown in Figure~\ref{fig:lightcurves}. The properties of the light curves (i.e., their peak magnitudes and fade rates) will be explored further in section~\ref{sec:lcproperties}. \section{The Spatial Distribution of M83 Novae} \label{sec:spatdist} \begin{deluxetable}{ccccc} \tabletypesize{\scriptsize} \tablewidth{0pt} \tablecolumns{5} \tablecaption{M83 Surface Photometry\tablenotemark{\scriptsize a}\label{tab:surfphot}} \tablehead{\colhead{Semimajor axis} & \colhead{$\Sigma_R$} & & \colhead{Semimajor axis} & \colhead{$\Sigma_R$} \\ \colhead{(arcsec)} & \colhead{(mag/arcsec$^2$)} & & \colhead{(arcsec)} & \colhead{(mag/arcsec$^2$)} } \startdata 0.4 & 15.90 && 104.1 & 20.29 \cr 2.7 & 16.01 && 107.7 & 20.25 \cr 4.4 & 16.42 && 110.7 & 20.25 \cr 7.1 & 16.98 && 113.8 & 20.25 \cr 9.3 & 17.59 && 117.4 & 20.25 \cr 11.5 & 17.91 && 121.8 & 20.29 \cr 13.7 & 18.17 && 125.3 & 20.33 \cr 16.3 & 18.45 && 128.8 & 20.38 \cr 18.1 & 18.65 && 131.5 & 20.46 \cr 20.7 & 18.80 && 137.7 & 20.55 \cr 22.1 & 18.91 && 142.5 & 20.61 \cr 24.7 & 18.99 && 148.2 & 20.68 \cr 25.6 & 19.06 && 157.1 & 20.74 \cr 27.4 & 19.19 && 165.0 & 20.85 \cr 29.6 & 19.25 && 175.6 & 20.94 \cr 31.8 & 19.30 && 185.7 & 21.02 \cr 33.5 & 19.38 && 199.4 & 21.18 \cr 36.2 & 19.45 && 209.1 & 21.26 \cr 38.4 & 19.51 && 222.4 & 21.37 \cr 41.0 & 19.60 && 236.0 & 21.50 \cr 43.2 & 19.64 && 245.3 & 21.61 \cr 46.8 & 19.68 && 250.2 & 21.72 \cr 49.9 & 19.73 && 259.0 & 21.74 \cr 52.9 & 19.81 && 268.2 & 21.85 \cr 56.9 & 19.86 && 277.1 & 21.95 \cr 60.9 & 19.92 && 287.7 & 22.11 \cr 65.3 & 19.99 && 299.1 & 22.28 \cr 69.7 & 20.03 && 320.0 & 22.56\tablenotemark{\scriptsize b} \cr 73.2 & 20.10 && 350.0 & 22.96\tablenotemark{\scriptsize b} \cr 78.5 & 20.14 && 400.0 & 23.63\tablenotemark{\scriptsize b} \cr 86.0 & 20.20 && 450.0 & 24.31\tablenotemark{\scriptsize b} \cr 90.4 & 20.25 && 500.0 & 24.98\tablenotemark{\scriptsize b} \cr 93.5 & 20.27 && \dots & \dots \cr 98.4 & 20.27 && \dots & \dots \cr \enddata \tablenotetext{\scriptsize a}{D\scriptsize igitized from \citet{2000ApJS..131..441K}. P.A. = 80$^{\circ}$; Ellipticity, $b/a = 0.9$ assumed for all values.} \tablenotetext{\scriptsize b}{\scriptsize extrapolated value} \end{deluxetable} Figure~\ref{fig:spatdist} shows the spatial distribution of the 19 novae discovered in M83 superimposed on a (negative) image of the galaxy. It is immediately apparent that the novae seem to be more spatially extended than the galaxy light. We can explore this impression more quantitatively by comparing the cumulative distribution of the novae with that of the background $R$-band light, as shown in Figure~\ref{fig:raddis}. The cumulative background light has been determined by integrating the surface photometry from Table~\ref{tab:surfphot}, which we have derived from digitizing the radial surface brightness profiles given in Figure~4 of \citet{2000ApJS..131..441K}. Since the high surface brightness near the nucleus of the galaxy renders us effectively blind to novae within $\sim30''$ of the center of the galaxy, and likely significantly incomplete within $60''$, we have considered three cumulative light distributions starting with inner radii at $R_{\mathrm in}=30''$, $R_{\mathrm in}=60''$, and $R_{\mathrm in}=90''$. Regardless of the adopted inner radius, the cumulative background light clearly falls off faster than the observed nova distribution. This result is formally confirmed by Kolmogorov-Smirnov (K-S) tests ($p=1.6\times10^{-3}$, $p=3.7\times10^{-3}$, and $p=1.1\times10^{-2}$ for cases where we considered inner radii of $R_{in}=30''$, $R_{in}=60''$, and $R_{in}=90''$, respectively), suggesting we can reject the null hypothesis (i.e., the nova and light distributions were drawn from the same parent distribution) with $\grtsim99\%$ confidence. Thus, it appears that the novae detected in M83 are primarily associated with a more extended disk population of the galaxy. Before considering possible explanations for why the novae do not appear to follow the overall background light in M83, it is important to rule out the possibility that we may be missing a significant fraction of novae in the inner regions of the galaxy due to the difficulty in detecting them against the high central surface brightness. We explore this possibility below in our determination of the nova rate in M83, which also depends critically on the overall completeness of our survey. \begin{figure} \includegraphics[angle=0,scale=0.32]{f6.pdf} \caption{The cumulative distribution of the isophotal radii of the 19 novae (black histogram) compared with the cumulative galaxy $R$-band light for three representative values of the inner radius, $R_{in}$ (shown in red).} \label{fig:raddis} \end{figure} \section{The Nova Rate in M83} \label{sec:novrat} As transient objects, novae are visible for a limited time that depends both on the intrinsic properties of the novae themselves (e.g., their peak luminosities, fade rates, and spatial location within the galaxy) and on parameters inherent to the survey itself; specifically, the temporal sampling and survey depth (the effective limiting magnitude). Whether or not a given nova in M83 can potentially be detected depends on a combination of its peak apparent magnitude, its position within the galaxy, and on the limiting magnitude of our survey images at that location in the galaxy. Then, whether it will actually be detected depends on the time it erupted relative to the dates of our observations and the rate of decline in the nova's brightness. Given a population of novae with a variety of light curve properties (peak luminosities and fade rates), distributed at different positions within the galaxy, and observed at different times, the only practical way of determining the number of novae we can expect to see in our survey given an intrinsic rate, $R$, is to conduct numerical (Monte Carlo) simulations. Before the simulations can be performed, the first step is to determine the effective completeness of the survey at a given magnitude, $C(m)$. \subsection{The Effective Limiting Magnitude of the Survey} A determination of the limiting magnitude of our survey images is complicated by the fact that the galaxy background surface brightness is highly variable and that the spatial distribution of the novae cannot be assumed to be uniform across the survey images. Thus, no one limiting magnitude can represent the coverage of a given image. We have approached this problem following the procedure described in our earlier work on NGC~2403 \citep{2012ApJ...760...13F}. Specifically, we have conducted artificial nova tests on a representative image (hereafter the fiducial image) under the assumption that the spatial distribution of the artificial novae follows the background light of the galaxy. The artificial novae were generated using tasks in the IRAF DAOPHOT package, which enabled us to match the point-spread-functions of the real stars in the image. Using the routine \texttt{addstar}, the fiducial image was then seeded with 100 artificial novae having apparent magnitudes randomly distributed within each of a total of eight, 0.5-mag wide, bins. For each of the magnitude bins, the artificial novae were distributed randomly, but with a spatial density that was constrained to follow the integrated background galaxy light of M83. We then searched for the artificial novae using the same procedures that we employed in identifying the real novae. The completeness at the fainter magnitudes was somewhat higher using the ISIS image subtraction analysis, but was generally consistent with the results from a direct comparison of median-subtracted images. The fraction of novae recovered from the two search techniques in each magnitude bin yielded the completeness functions shown in Figure~\ref{fig:com}. Given that we discovered the same number of novae in M83 employing both techniques, we have chosen to take the average completeness in a given magnitude bin (the heavy line in Figure~\ref{fig:com}) to form the basis of the completeness function, $C(m)$. To allow for uncertainty in magnitude bins where the completeness functions differ (the shaded regions), we randomly sample allowed values of $C(m)$ in the analysis to follow. This completeness function can be generalized to any epoch, $i$, of observation by applying a shift, $\Delta m_i$ ($= m_{lim,0} - m_{lim,i}$), which represents the difference in the limiting magnitudes (as measured by the faintest star that could be reliably detected near the perimeter of the image away from the galaxy) of our fiducial image and that of the $i$-th epoch image. Thus, for any epoch, $i$, we have $C_i(m) = C(m+\Delta m_i)$. \begin{figure} \includegraphics[angle=0,scale=0.33]{f7.pdf} \caption{The survey completeness as a function of the $R$-band apparent magnitude, $C(m)$, as determined from our artificial nova tests. The red dashed line shows the completeness from the ISIS image subtraction procedure, the blue dot-dash line shows the completeness using the median-subtraction technique, with the heavy black line shows the average completeness in each magnitude bin. The shaded region shows the range of completeness in each magnitude bin bounded by the two search techniques and used in our Monte Carlo nova rate simulations.} \label{fig:com} \end{figure} \subsection{The Monte Carlo Simulation} As in our earlier extragalactic nova studies \citep[e.g.,][]{2012ApJ...760...13F,2010ApJ...720.1155G,2008ApJ...686.1261C,2004ApJ...612..867W}, we have employed a Monte Carlo simulation to compute the number of M83 novae that we would expect to observe during the course of our survey. For a given assumed annual nova rate, $R$, we begin by producing trial novae erupting at random times throughout the time span covered by our survey, each having a peak luminosity and fade rate that has been selected at random from a large sample of known $R$-band light curve parameters. Ideally, we would like to use light curve parameters specific to the full population of M83 novae, but such an unbiased sample does not exist. Instead, we have used the M83 light curve parameters from our observations given in Table~\ref{tab:lcparam}, augmented with additional $R$-band light curve parameters from the M31 light curves observed by \citet{2011ApJ...734...12S}. \begin{deluxetable}{lcccr} \tablecolumns{5} \tablecaption{Light Curve Parameters\label{tab:lcparam}} \tablehead{\colhead{Nova} & \colhead{m$_R$} & \colhead{M$_R$\tablenotemark{a}} & \colhead{$f_R$} & \colhead{$t_2(R)$} \\ \colhead{(M83N)} & \colhead{(peak)} & \colhead{(peak)} & \colhead{(mag~d$^{-1}$)} & \colhead{(d)} } \startdata 2013-01a&$19.58\pm0.04$&$-8.90 \pm0.08$&$0.103\pm0.004$&$ 19.3\pm0.7$ \cr 2013-01b&$21.11\pm0.12$&$-7.37 \pm0.14$&$0.115\pm0.018$&$ 17.5\pm2.7$ \cr 2013-01c&$20.27\pm0.06$&$-8.21 \pm0.09$&$0.046\pm0.002$&$ 43.2\pm2.1$ \cr 2013-01d&$20.80\pm0.04$&$-7.69 \pm0.08$&$0.036\pm0.002$&$ 54.8\pm2.9$ \cr 2013-03a&$21.66\pm0.05$&$-6.82 \pm0.08$&$0.013\pm0.002$&$157.5\pm21.1$ \cr 2013-04a&$20.16\pm0.05$&$-8.32 \pm0.08$&$0.123\pm0.015$&$ 16.3\pm2.1$ \cr 2014-01a&$19.41\pm0.11$&$-9.08 \pm0.13$&$0.256\pm0.014$&$ 7.8\pm0.4$ \cr 2014-01b&$21.68\pm0.06$&$-6.80 \pm0.09$&$0.033\pm0.004$&$ 60.6\pm7.0$ \cr 2014-01c&$18.69\pm0.05$&$-9.80 \pm0.08$&$0.326\pm0.012$&$ 6.1\pm0.2$ \cr 2014-03a&$19.48\pm0.06$&$-9.00 \pm0.09$&$0.169\pm0.012$&$ 11.9\pm0.9$ \cr 2015-01a&$20.63\pm0.03$&$-7.85 \pm0.08$&$0.085\pm0.004$&$ 23.5\pm1.0$ \cr 2016-02a&$20.83\pm0.07$&$-7.65 \pm0.10$&$0.072\pm0.008$&$ 27.7\pm2.9$ \cr 2016-02b&$20.68\pm0.06$&$-7.80 \pm0.09$&$0.058\pm0.005$&$ 34.7\pm3.1$ \cr 2016-03a&$19.90\pm0.08$&$-8.59 \pm0.11$&$0.157\pm0.013$&$ 12.8\pm1.1$ \cr 2018-01a&$20.89\pm0.05$&$-7.60 \pm0.09$&$0.067\pm0.006$&$ 29.9\pm2.5$ \cr 2018-02a&$21.47\pm0.10$&$-7.01 \pm0.12$&$0.024\pm0.007$&$ 83.3\pm22.6$ \cr 2019-02a&$19.91\pm0.09$&$-8.57 \pm0.11$&$0.181\pm0.016$&$ 11.0\pm1.0$ \cr \enddata \tablenotetext{a}{Assuming a distance modulus $\mu_{\circ}(\mathrm{M}83) = 28.34\pm0.14$ \citep{2016AJ....152...50T} and a foreground $R$-band extinction of 0.14 mag \citep{2011ApJ...737..103S}.} \end{deluxetable} Adopting a distance modulus to M83 of $\mu_{0} = 28.34 \pm 0.14$, which represents the mean of the Cepheid and the tip of the red giant branch distances from the recent study by \citet{2016AJ....152...50T}, enables us to compute the expected apparent magnitude distribution at any given epoch, $i$, during our survey, $n_i(m,R)$. To account for uncertainty in the distance, our numerical simulations also randomly select values of the distance modulus normally distributed about the mean value. The number of novae expected to be detectable during the course of our survey, $N_{obs}(R)$, can then be computed by convolving the simulated apparent magnitude distribution with the completeness function, $C_i(m)$, and then summing over all epochs of observation: \begin{equation} N_{\mathrm obs}(R) = \sum_{i}\sum_{m}{C_i(m)~n_i(m,R)}. \label{eqn:NovaNum} \end{equation} The intrinsic nova rate in M83, $R$, and its uncertainty can now be determined through a comparison of the number of novae found in our survey, $n_{\mathrm obs}=19$, with the number of novae predicted by equation (1). We explored trial nova rates ranging from $R=1$ to $R=50$ novae per year, repeating the numerical simulation 10$^{5}$ times for each trial value of $R$. The number of matches, $M(R)$, between the predicted number of observable novae, $N_{obs}(R)$, and the actual number of novae discovered in our survey, $n_{obs}$ = 19, was recorded for each trial value of $R$. The number of matches was then normalized by the total number of matches for all $R$ to give the probability distribution function, $P(R)=M(R)/\sum_{R}{M(R)}$ shown in Figure~\ref{fig:montecarlo}. The most probable nova rate in the portion of the galaxy covered by our survey images is 18$^{+5}_{-3}$~yr$^{-1}$, where the error range (1$\sigma$) for the asymmetrical probability distribution has been computed assuming it can be approximated by a bi-Gaussian function. \begin{figure} \includegraphics[angle=0,scale=0.33]{f8.pdf} \caption{The probability distribution for the nova rate in M83 as determined from our Monte Carlo simulations. The peak of the distribution represents the most likely nova rate in M83. Assuming a bi-Gaussian form for the probability distribution yields a nova rate and associated $1\sigma$ uncertainty of $R_{M83} = 18^{+5}_{-3}$ novae per year.} \label{fig:montecarlo} \end{figure} The $K$-band photometry of M83 from the Two-Micron All Sky Survey (2MASS) suggests that the extended halo may extend out to a distance of $r_{tot}\sim8.5'$ from the center of M83. Thus, it is possible that our survey images may be missing a small fraction ($\mathrel{\hbox{\rlap{\hbox{\lower4pt\hbox{$\sim$}}}\hbox{$<$}}}$5\%) of the light from the extended halo of M83. Under the assumption that we are sampling $0.95\pm0.05$ of the total M83 light, we estimate the global nova rate for M83 to be $R_{M83} = 19^{+5}_{-3}$~yr$^{-1}$. \subsection{The Luminosity-Specific Nova Rate} \label{ssec:lsnr} In order to compare the nova rates between different galaxies or different stellar populations, the rates must first be suitably normalized. Ideally, it would be appropriate to normalize the rates by the mass of stars in the region surveyed, but the mass cannot be measured directly. As a proxy for the mass in stars, it has become standard practice to normalize the nova rate by the infrared $K$-band luminosity of the galaxy. In the case of M83, the integrated apparent $K$-band magnitude as measured by 2MASS is $K=4.62\pm0.03$. Given the distance modulus, $\mu_{0} = 28.34 \pm 0.14$, and taking the absolute $K$-band magnitude of the sun to be $M_K=3.27\pm0.02$ \citep{2018ApJS..236...47W}, we find that M83 has an absolute magnitude in the $K$-band of $M_K=-23.72$, and a corresponding $K$-band luminosity of $(6.32\pm0.84)\times10^{10}$~L$_{\odot,K}$. Since we estimate that our survey covers $0.95\pm0.05$ of the entire galaxy where we have found an overall nova rate of $18^{+5}_{-3}$ yr$^{-1}$, we arrive at a $K$-band luminosity-specific nova rate for M83 of $\nu_K = (3.0^{+0.9}_{-0.6})\times10^{-10}$~yr$^{-1}$~L$_{K,\odot}^{-1}$. As recently reviewed by \citet{2019enhp.book.....S} and \citet{2020A&ARv..28....3D} prior to the present study, luminosity-specific nova rates had been measured for a total of 15 external galaxies. Figure~\ref{fig:lsnr} shows our value of $\nu_K$ for M83, along with the values for the other 15 galaxies taken from Table~7.3 in \citet{2019enhp.book.....S}, plotted as a function of the $B-K$ color of the host galaxy. The specific nova rate for M83 is consistent with those of other spiral galaxies with measured nova rates. As we have noted in previous studies, despite the relatively high $\nu_K$ values reported for the Magellanic Clouds and M87 -- galaxies with very different Hubble types -- there is no compelling evidence that $\nu_K$ varies systematically with the underlying stellar population. \begin{figure} \includegraphics[angle=0,scale=0.32]{f9.pdf} \caption{The luminosity-specific nova rates of all 16 galaxies where nova rates are available plotted as a function of the galaxy $B-K$ color. The data have been taken from Table~7.3 of \citet{2019enhp.book.....S} with the exception of the value for M83 from the current study, which is shown as a red square.} \label{fig:lsnr} \end{figure} \section{Light Curve Properties} \label{sec:lcproperties} As described in section~\ref{ssec:phot}, the temporal coverage during the course of our survey was sufficiently dense to enable us to measure $R$-band light curves for 18 of the 19 M83 novae that were detected. These light curves, drawn from an equidistant sample of novae, offer a rare opportunity to explore the relationship between a nova's peak luminosity and its rate of decline from maximum light, and thus test whether or not the novae obey the canonical (but recently questioned) Maximum-Magnitude versus Rate-of-Decline (MMRD) relation. \subsection{The MMRD Relation} \label{ssec:mmrd} The MMRD relation for novae was first introduced by \citet{1945PASP...57...69M}, who discovered that the most luminous members of a sample of 30 (mostly Galactic) novae faded more quickly than did their fainter counterparts\footnote{In his 1945 paper McLaughlin referred to the MMRD relation as the ``life-luminosity" relation for novae.}. He was able to quantify a linear MMRD relation of the form, $M = a+b~\mathrm{log}(t_3)$, where $a$ and $b$ are fitting parameters and $t_3$ is the time it takes a nova to fade 3 magnitudes from maximum light (in recent years $t_2$, which is more easily measured, is often used as an alternative). Over the years the MMRD relation has been calibrated many times, both in the Galaxy \citep[e.g.,][]{1985ApJ...292...90C, 2000AJ....120.2007D}, and in nearby galaxies such as M31 \citep[e.g.,][]{1989AJ.....97.1622C,2011ApJ...734...12S}, and has often been used as a means for determining the distances to novae where the apparent magnitude at maximum light and the fade rate have been measured. Over the years it has become increasingly apparent that there is significant scatter in the MMRD, with the existence of the relation itself being called into question, initially by \citet[e.g.,][]{2011ApJ...735...94K} who found that a number of M31 novae observed with the Palomar Transient Factory (PTF) appeared to fall below the canonical MMRD relation (but, see \citet{2020A&ARv..28....3D} for a different interpretation.). Recently, it has become clear that a small subset of novae, typically those with massive white dwarfs that are accreting at high rates (e.g., recurrent novae) fade rapidly despite having relatively low peak luminosities, and thus deviate sharply from the MMRD relation. A good example is the M31 recurrent nova M31N 2008-12a \citep{2014A&A...563L...9D,2014ApJ...786...61T}. Given that such systems do in fact exist, it is clear that not all novae will follow a universal MMRD relation. On this basis it has been recently suggested that the notion of an MMRD relation should be abandoned altogether \cite{2018MNRAS.481.3033S}. However, the question of whether it is useful to continue to refer to an MMRD relation would seem to depend on the relative frequency of outliers. If the so-called ``Faint and Fast" (FFN) novae, such as M31N 2008-12a, are intrinsically rare, then continuing to refer to an MMRD might make sense when considering the behavior of the majority of (non recurrent) novae. On the other hand, if such systems are relatively common, but just missed in most surveys that lack the depth and cadence to discover them, then perhaps the existence of an MMRD relation would be best considered as resulting from an observational selection effect. In either case, it appears that broadly speaking, luminous novae do on average fade more quickly than do their low luminosity counterparts. Figure~\ref{fig:mmrd} shows the MMRD relation for the 17 novae in M83 where the light curves were sufficiently complete to allow a measurement of the peak magnitude and the rate of decline (here measured as $t_2$, the time for the nova to fade 2 mags from peak). Although there is significant scatter as expected, there is no question that a general trend, where the more luminous novae fade more quickly, is apparent. The best-fitting linear MMRD relation is given by: $\mathrm{M}_R = (-10.79\pm0.42) + (1.96\pm0.29)~\mathrm{log}~t_2$. The M31 $R$-band MMRD relation from the study of \citet{2011ApJ...734...12S} is shown for comparison, and is remarkably similar\footnote{MMRD relations are sometimes fit using a more complicated {\tt arctan} function, which has been shown to provide a somewhat better fit to data for M31 and the LMC \citep[e.g., see][]{1995ApJ...452..704D}. Given the limited data in the present study, we have chosen to employ the traditional linear fit.}. Whether or not we are missing a putative population of FFN novae in M83 is unknown. The question can only be answered by future studies having greater depth and cadence, such as those that will be possible with the Large Synoptic Survey Telescope \citep[LSST,][]{2019ApJ...873..111I}. \begin{figure} \includegraphics[angle=0,scale=0.33]{f10.pdf} \caption{The peak absolute $R$-band magnitudes for the 17 M83 novae with complete light curves are plotted as a function of the log of the fade rate, as measured by the time in days a nova takes to fade by 2 magnitudes in the $R$-band from its peak luminosity, $t_2(R)$. The M83 nova sample clearly displays a correlation between peak nova luminosity and $\mathrm{log}(t_2)$, as shown by the black dashed line. The $R$-band MMRD relation for M31 from \citet{2011ApJ...734...12S} (red dotted line) is shown for comparison. The two relations are remarkably similar.} \label{fig:mmrd} \end{figure} \subsection{Comparison with the M31 nova population} As part of a comprehensive spectroscopic and photometric survey of novae in M31, \citet{2011ApJ...734...12S} determined $R$-band light curve parameters for a total of 42 novae and found that, as in the case of M83, the M31 nova sample also generally followed a MMRD relation, albeit with significant scatter \citep[see Table~6 and Figure~19 in][]{2011ApJ...734...12S}. The M31 novae are characterized by a mean absolute magnitude, $\langle M_R \rangle =-7.55\pm0.14$ and $\langle t_2(R) \rangle =38^{+6}_{-5}$~d, while their M83 counterparts from Table~\ref{tab:lcparam} yield $\langle M_R \rangle =-8.06\pm0.21$ and $\langle t_2(R) \rangle =25^{+6}_{-5}$~d\footnote{Since the $t_2(R)$ distributions are highly asymmetric, the values of $\langle t_2(R) \rangle$ are computed from the average of the log$~t_2(R)$ values for each galaxy.}. \begin{figure} \includegraphics[angle=0,scale=0.33]{f11.pdf} \caption{The cumulative distribution of the $R$-band absolute magnitudes of M83 novae compared with their M31 counterparts. A K-S test reveals that the two distributions differ with 94\% confidence. } \label{fig:cumr} \end{figure} It is interesting to compare the cumulative distributions of the peak luminosities and fade rates from each galaxy, as shown in Figures~\ref{fig:cumr} and~\ref{fig:cumf}. The results of K-S tests show that the peak luminosity and fade rate distributions differ between each galaxy with 94\% and 74\% confidence, respectively. Thus, there is some evidence that the novae in the M83 sample are, on average, more luminous at maximum light and perhaps fade somewhat more rapidly compared with the M31 sample. A possible explanation for this difference is that M31 is an earlier Hubble type galaxy, SA(s)b, and the nova population observed by \citet{2011ApJ...734...12S} was predominately a bulge population. On the other hand, as discussed earlier, our M83 sample appears to be primarily associated with the galaxy's disk. Taken together, figures~\ref{fig:cumr} and~\ref{fig:cumf} provide additional support for the existence of two populations of novae, as originally suggested for Galactic systems three decades ago by \citet{1990LNP...369...34D} and \citet{1998ApJ...506..818D} based on photometric and spectroscopic observations, respectively. \begin{figure} \includegraphics[angle=0,scale=0.33]{f12.pdf} \caption{The cumulative distribution of the fade rate of M83 novae in the $R$-band compared with their M31 counterparts. A K-S test reveals that the two distributions differ, but with just 74\% confidence. } \label{fig:cumf} \end{figure} \section{Discussion} \label{sec:disc} \subsection{Uncertainty in the Derived Nova Rate} The determination of extragalactic nova rates is challenging, with many sources of uncertainty that must be properly considered in the analysis. Among these, uncertainty in the determination of the survey completeness is perhaps the most important. As described earlier, the completeness -- the fraction of novae erupting in the galaxy that can be detected in a given survey -- depends quite sensitively on the intrinsic properties of the novae and their actual distribution within the galaxy under investigation. Since neither of these factors are known {\it a priori}, assumptions concerning both must always be made. To guard against potential bias in our M83 nova sample, we chose to include light curve parameters from previous observations of novae in M31 in our Monte Carlo nova rate simulations. As a check on the sensitivity of the final nova rate to the inclusion of the M31 light curve parameters, we have also performed the analysis using only the light curve parameters from the M83 novae discovered in our survey. Despite the differences in the light curve properties between the two samples discussed in the previous section, the final nova rate determination is essentially unchanged (the rate ranges from 17~yr$^{-1}$ to 20~yr$^{-1}$ when the analysis is restricted to the M83 and M31 light curve parameters, respectively). In this case, the insensitivity of the nova rate to the choice of light curve parameters results from the fact that the M83 novae generally follow an MMRD relation. The M83 novae are on average brighter compared with their M31 counterparts, and thus easier to detect in our simulations, but they fade generally more quickly, so they are observable on average for less time. Thus, the two effects tend to cancel, leaving the final nova rate insensitive to the choice of light curve parameters. The form of the nova spatial distribution that we have adopted in the artificial nova completeness experiments can also affect the final nova rate computation. In the absence of strong evidence to the contrary, the default approach -- and the one we have followed here -- is to assume that the spatial density of novae follows the surface brightness of the galaxy (i.e., more light, more novae). However, in the case of M83, it appears that this assumption may be violated. As shown in Figure~\ref{fig:spatdist} the {\it observed\/} M83 nova spatial distribution is significantly more extended than the galaxy's $R$-band light. If this result accurately reflects the intrinsic nova spatial distribution (i.e., we are not missing novae in the inner regions of the galaxy), our artificial nova simulations may underestimate the overall completeness of our survey by placing a greater fraction of the artificial novae in the bright central regions of the galaxy where they are generally more difficult to detect. This bias, although we consider it to be small, would have the effect of slightly overestimating the nova rate determined earlier in our Monte Carlo simulations. On the other hand, it is worth noting that M83 is an active star-forming galaxy \citep[e.g., see][]{1999AJ....118..797C}, which likely interacted $\sim$1-2~GYr ago with the nearby metal-poor dwarf galaxy, NGC 5253, triggering starbursts in both galaxies \citep{1980PASP...92..122V,1999AJ....118..797C}. The starburst activity in M83 is concentrated in the spiral arms and near the nucleus of the galaxy, which is heavily shrouded in dust \citep{1991A&A...243..309G, 2008ASPC..390..144L}. These are the same regions of the galaxy where the high surface brightness and complex structure render the detection of novae difficult. Thus, despite our careful nova searches, the possibility that we may be missing some novae in these regions of the galaxy cannot be definitively ruled out. If such a putative population of heavily-extincted novae exists, it would not be properly accounted for by our artificial nova tests, the completeness would be overestimated, and our simulations would then underestimate the true nova rate. \subsection{The Observed Nova Spatial Distribution} As discussed earlier, it was surprising to find that the observed spatial distribution of novae in M83 did not follow the background light of the galaxy. To put this result into context, it is instructive to compare the observed spatial distribution of novae in M83 with similar galaxies for which nova populations have been studied. Such galaxies include the massive, late-type, and nearly face-on spirals M51 and M101 (morphological types SA(s)bc and SAB(rs)cd, respectively), the relatively low-mass, late-type systems NGC~2403 and M33 (SAB(s)cd and SA(s)cd, respectively), and M81, a relatively early-type SA(s)ab spiral with a prominent bulge component. Unfortunately, as we explore below, a review of these studies does not suggest a simple association between the morphological type of the galaxy and the degree to which the nova distribution follows the light of the host galaxy. In the case of the face-on, grand-design spiral M101 \citep{2000ApJ...530..193S,2008ApJ...686.1261C}, the nova density appears to track the background light remarkably well (K-S, p=0.94), while for M33 \citep{2004ApJ...612..867W, 2012ApJ...752..156S}, the cumulative distributions of the novae and the background light were only marginally consistent (K-S, p=0.4). Similar to our result for M83, the spatial distributions of novae in both M51 \citep{2000ApJ...530..193S} and NGC~2403 \citep{2012ApJ...760...13F}, were also found to be more spatially extended than the background light (with 97\% and 75\% confidence, respectively). In theses cases, however, observational incompleteness in the central region of M51 and the spiral arms of NGC~2403 could possibly explain the discrepancy. The situation with regard to M81 is more complex. The spatial distribution of novae in this galaxy has been studied extensively by a number of groups, all of whom have come to somewhat different conclusions about how the nova distribution compares with the galaxy light. Based on a total of 15 and 12 detected novae, respectively, \citet{1993AAS...182.8505M} and \citet{2004AJ....127..816N} argued that the M81 novae most closely follow the galaxy's bulge light, as was found in several studies of the nova population in M31 \citep{1987ApJ...318..520C,2000ApJ...530..193S,2006MNRAS.369..257D}. More recently, however, \citet{2008A&A...492..301H} analyzed a much larger sample of novae (49) than either of the previous studies, finding that the nova density distribution best matches the overall (bulge + disk) background galaxy light. Given that M81 has a prominent bulge component that dominates the overall light in regions where most novae are found, the apparent discrepancy between these studies may be a distinction without much of a difference. In reviewing the earlier studies in more detail, it appears that neither the Moses \& Shafter nor the Neill \& Shara data are inconsistent with the hypothesis that the novae follow the overall light. The only M81 nova study that reached a very different conclusion is that of \citet{1999PASP..111.1367S}, who analyzed a sample of 23 novae discovered nearly a half century earlier on Palomar photographic plates taken between 1950 and 1955. They found a significant (disk) population of novae in the outer regions of the galaxy that resulted in a poor fit of the full nova distribution to the overall galaxy light (and clearly a worse fit to the bulge light). The poor fit to the overall light persisted even after the authors attempted to correct their data for missing novae in the inner bulge region of the galaxy. It is not obvious how to reconcile these early photographic data with subsequent CCD studies other than to posit that perhaps an even larger number of bulge novae than expected were missed due to the difficulty in detecting them on photographic plates when projected against the bright background of the galaxy's bulge. Taken together, the best evidence currently available suggests that the nova distribution in M81 likely follows the overall background light of the galaxy, with novae belonging to both the bulge and disk populations. In the case of most other galaxies, the situation remains less clear. A combination of small-number statistics, spatial variations in extinction (especially in late-type spiral galaxies), and limited spatial coverage (e.g., in M31) have all conspired to make it difficult to differentiate a real spatial (stellar population) variation from biases caused by observational incompleteness. As is often the case, more data will be required before we have a full and complete understanding of how the nova properties, including their specific rates, vary with the underlying stellar population. \section{Summary} \label{sec:sum} The principal results of our M83 nova survey are as follows: \textbf{(1)} We have conducted an imaging survey of the SAB(s)c starburst galaxy M83 and discovered a total of 19 novae over the course of our seven-year survey. \textbf{(2)} After correcting for the survey's limiting magnitude and spatial and temporal coverage, we find an overall nova rate of $R_{M83} = 19^{+5}_{-3}$~yr$^{-1}$ for the galaxy. \textbf{(3)} Adopting an integrated $K$-band magnitude of $K_{M83} = 4.62\pm0.03$ from the 2MASS survey, and a distance modulus for M83 of $(m-M)_0 = 28.34\pm0.14$, we find the absolute magnitude of M83 in the $K$-band is $M_K=-23.72$, which corresponds to a luminosity of $6.32\times10^{10}$~L$_{\odot,K}$. The luminosity-specific nova rate of M83 is then found to be $\nu_K = 3.0^{+0.9}_{-0.6}\times10^{-10}$~yr$^{-1}~L_{\odot,K}^{-1}$. \textbf{(4)} The value of $\nu_K$ for M83 is typical of those found for other galaxies with measured nova rates, and, in agreement with our earlier studies, no compelling evidence is found for a variation of $\nu_K$ with galaxy color, or Hubble type. \textbf{(5)} Our survey has enabled us to measure light curves for a total of 18 of the 19 novae discovered in M83. Of these, the peak brightnesses and fade rates ($t_2$ times) could be measured for 17 of the novae. These data show that the most luminous novae we observed in M83 generally faded the fastest from maximum light in accordance with the canonical MMRD relation. \textbf{(6)} We have found the spatial distribution of novae in M83 to be more extended than the background galaxy light suggesting that they are predominately associated with the disk population of the galaxy. In addition, the M83 novae appear, on average, to reach higher luminosities and to evolve more quickly compared with novae in M31, which are predominately associated with that galaxy's bulge. These findings are consistent with the claim made by \citet{1990LNP...369...34D}, \citet{1998ApJ...506..818D}, and others that there are two populations of novae, a ``disk" population characterized by generally brighter and faster novae, and a ``bulge" population, characterized by novae that are typically slower and less luminous. \begin{acknowledgments} We thank the anonymous referee for their valuable comments and suggestions that have helped us to improve the focus and presentation of this study. This work is based on data collected with the Danish 1.54-m telescope at the ESO La Silla Observatory. We thank J. Vra\v{s}til, E. Kortusov\'a, L. Pilar\v{c}\'ik, and V. Votruba for acquiring some M83 images, J. L. Prieto for providing the M83 image taken with MEGACAM on the 6.5-m Magellan II telescope, and W. Burris for assisting with the artificial nova tests used to assess the limiting magnitude of our survey. The work of K.H., H.K., L.K., M.S., P.K., and P.\v{S}. was supported by the project RVO:67985815. The research of M.W. and P.Z. was supported by the project {\sc Progres Q47 Physics} of the Charles University in Prague. M.S. acknowledges the support by Inter-transfer grant no LTT-20015. \end{acknowledgments} \facilities{1.54-m Danish Telescope, La Silla} \software{APHOT \citep{ 1994ExA.....5..375P}, IRAF \citep{1986SPIE..627..733T}, ISIS \citep{1998ApJ...503..325A} }
\section{Introduction} The operation of distribution system is becoming challenging with the growing integration of distributed energy resources (DERs). DERs are introducing more intermittency and volatility into distribution networks, resulting in fast changing states. To maintain normal operations in such scenarios, numerous advanced optimization and control algorithms have been designed for the distribution system. However, what has been overlooked is distribution system state estimation (DSSE), without which most of the advanced control strategies cannot be properly deployed in practice. DSSE estimates the states of the distribution network by utilizing network parameters, topology and meter reading. Different from transmission system state estimation (TSSE), DSSE features untransposed multiphase lines of high $r/x$ ratios, unbalaned multiphase loads, much less accurate and asynchronous measurement devices, but more volatile system states due to high penetration of DERs \cite{primadianto2016review}. Therefore, the single phase equivalent model and conventional solution methods used for TSSE cannot produce the most efficient and accurate results for DSSE. There have been a lot of efforts devoted to DSSE. Among the existing work, the most widely used method is to formulate a weighted least squares (WLS) problem for DSSE. Based on the choice of state variables, the WLS-based DSSE methods can be categorized into nodal voltage based, branch current based and power injection based methods. A three-phase DSSE method was early proposed with bus voltage as state variables in \cite{Baran1994}, and developments have been made ever since. The authors in \cite{Lu1995} propose to convert nodal power injection measurements to the current injection measurements. To increase the computation efficiency and accuracy, a decomposition method and a load allocation approach is proposed in \cite{Deng2002} by exploiting the network topology. An augmented nodal analysis formulation is proposed in \cite{Francis2013} to increase numerical robustness. A semi-definite programming approach is proposed in \cite{Yao2019} to model virtual-measurements as equality constraints. The first branch-current based method is proposed in \cite{Baran1995} to reduce computation burden and condition number of the gain matrix. The voltage magnitude measurements are incorporated into the branch-current based approach in \cite{Baran2009}. This method is further enhanced by considering the synchrophasor measurements in \cite{Marco13}. A numerically robust and scalable power injection based method is proposed in \cite{zhou2020} to further increase computation efficiency. Dynamic system state estimation approaches are proposed in \cite{Zhao2017, Filho2009, Song2020} for handling fast time-varying system. However, most existing works assume all the measurement data to be available in time, while in real-time DSSE, data from the heterogeneous and asynchronous measurement devices \cite{Zheng2013,von2014}, like PMU and smart meters, may have largely different sampling rates \cite{Angioni2013,Alimardani2015}. Furthermore, communication loss and delay, as well as bad data discarding, also lead to missing and asynchronicity of measurement data. The resulting DSSE problem is not observable, and the classic DSSE methods that assume synchronous data can not be applied. To solve this issue, authors in \cite{Ali2015} model load variation between two consecutive samples as a random variable following a normal distribution, and decrease measurement weights as time goes by. The authors in \cite{BS2014} assume synchronization errors to follow normal distribution with zero mean so that they can be modeled as measurement errors and states can be estimated via WLS method. In \cite{Guido2019}, outdated estimated states are used as measurements to ensure observability. In this work, we do not make any assumption on the distribution of the load variation or synchronization error. We will formulate the DSSE as a time-varying weighted least squares (WLS) problem and propose to solve it via a stochastic gradient descent algorithm instead of Gauss-Newton (GN) method. The stochastic gradient algorithm can accommodate for asynchronous stream of measurement data and deliver accurate estimation efficiently. Stability of the proposed algorithm theoretically proved and numerically illustrated. The remainder of this paper is organized as follows. In Section~\ref{system model}, we introduce the notation, distribution system modeling, and the formulation of time-varying WLS. We next propose the stochastic gradient descent (SGD) algorithm for solving the real-time DSSE problem and provide the convergence analysis in Section~\ref{SGD}. In Section~\ref{Simulation}, the proposed algorithm is numerically tested on IEEE-123 bus feeder. We conclude the paper in Section~\ref{conclusion}. \section{Distribution System State Estimation}\label{system model} \subsection{Notations} In this paper, we use bold letters to represent matrices, e.g., $\mathbf{A}$, italic bold letters to represent vectors, e.g, $\mathbf{A}$ and $\bm{a}$, and non-bold letters to represent {scalars}, e.g., $A$ and $a$. For matrix $\mathbf{A}$, $\mathbf{A}^{\top}$, $\mathbf{A}^{-1}$ and $\tau (\mathbf{A})$ denote its transpose, inverse and smallest eigenvalue, respectively. $\mathbf{diag}(\bm{a})$ denotes a diagonal matrix with vector $\bm{a}$ as its diagonal. $\mathbb{E}[x]$ denotes the expected value of random variable $x$. $\mathfrak{i}:=\sqrt{-1}$ is used as the imaginary unit. \subsection{Distribution system} We consider a multiphase distribution system denoted by a graph ${\cal G}=\{{\cal V}_0, {\cal E}\}$, where ${\cal V}_0 = \{0\}\cup{\cal V}=\{0\}\cup\{1, 2, ..., N\}$ with bus 0 being the slack bus and the set of ${\cal V}$ collecting the rest buses, and ${\cal E} = \{ (i, j) \subseteq {\cal V}_0 \times {\cal V}_0 \}$ denotes the set of lines between buses. Each bus has up to three available phases. We define each phase of a bus in ${\cal V}$ as a node, and define the set of all the nodes as ${\cal N}:= \{1, ..., n \}$ where $n$ is the total number of nodes in the system. Denote by ${\cal N}^l \subseteq {\cal N}$ the subset of all load nodes. Similar to the buses, a line may have up to three available phases, each defined as a branch. A line with $l$ phases features $l$-by-$l$ admittance and impedance matrices. The admittance and impedance matrix for the line between bus $i$ and $j$ are denoted by $\bm{y}_{ij}$ and $\bm{z}_{ij}=\bm{r}_{ij}+\mathfrak{i}\bm{x}_{ij}$, respectively. Let ${\cal V}_{i}$ denote the set of adjacent buses of bus~$i$ and ${\cal I}_i$ the set of nodes within bus $i$. Then the bus admittance matrix ${\bf Y}$ can be characterized by its submatrix ${\bf Y}({{\cal I}_i,{\cal I}_j})$ corresponding to any $(i,j)\in{\cal E}$ as: \begin{align} {\bf Y}({{\cal I}_i,{\cal I}_j}) =\begin{cases} \bm{0}, &\text{if } j \neq i, \text{and } j \not \in {\cal V}_i, \nonumber\\ -\bm{y}_{ij}, &\text{if } j \in {\cal V}_i, \nonumber\\ \sum_{k \in {\cal V}_i} \bm{y}_{ik}, & i=j. \end{cases} \end{align} Also see \cite{Bazrafshan18} for more details of multiphase distribution system modeling. \subsection{Formulation of DSSE} In DSSE, the measurement model for a distribution system is expressed as follows, \begin{align} \bm{y}=\bm{h}(\bm{z})+\bm{e}, \end{align} where $\bm{y} \in \mathbb{R}^{m}$, $\bm{z} \in \mathbb{R}^{2n}$, $\bm{e}\in \mathbb{R}^{m}$ denote the vector of measurements, state variables. \subsubsection{Measurements} For a distribution system, the measurements usually include virtual-measurements, real-time measurements and pseudo-measurements. The virtual-measurements are referred to the known knowledge of zero-injection nodes without any load or generation. The real-time measurements are sampled by a limited number of phasor measurement units and smart meters. Both virtual-measurements and real-time measurements are assumed to have very small standard deviation \cite{Monticelli85}. Meanwhile, most of the load nodes in the distribution system do not have real-time measurements. To have an observable real-time DSSE problem, pseudo-measurements for load nodes are estimated from historical load data with very large standard deviation \cite{Ghosh1997}. \subsubsection{System States} System states are the set of parameters that can be used to determine all system parameters. In power system, the state variable $\bm{z}$ can be nodal complex voltage \cite{Baran1994}, branch complex current \cite{Baran1995} or nodal complex power injection \cite{zhou2020}. Accordingly, we have nodal-voltage based, branch-current based and power injection based DSSE \cite{Prima2017}. Both the nodal-voltage based and branch-current based DSSE can be formulated in polar and rectangular coordinate, while the power injection based DSSE is formulated in rectangular coordinate. The methods to solve the three categories of DSSE are as follow. Nodal-voltage-based DSSE directly applies the WLS method. Branch-current-based DSSE computes the equivalent current injection and updates residuals before applying WLS method, and updates nodal complex voltage through a forward sweep calculation after the WLS method in each iteration. See \cite{zhou2020} for the details of the algorithm of power injection based DSSE. \subsubsection{Weighted Least Squares} Weighted least squares (WLS) estimator is the most popular one among the existing DSSE methods. Based on the assumption that the measurement errors are independent random variables of normal distribution, WLS estimator can achieve the maximized joint probability distribution, or the weighted sum of squared residuals: \begin{eqnarray}\label{eq:WLS} &\underset{\bm{z}}{\min}& \frac{1}{2}(\bm{y}-\bm{h}(\bm{z}))^{\top}\mathbf{W} (\bm{y}-\bm{h}(\bm{z})), \end{eqnarray} where $\mathbf{W}=\text{diag} \{1/\sigma_1^2,\ldots,1/\sigma_m^2\}\in\mathbb{R}^{m\times m}$ is a diagonal weight matrix with the diagonal elements being the reciprocal of the variance of the corresponding measurement errors, reflecting the accuracy of the associated meters. Therefore, the real-time measurements and virtual measurements are assigned with small variance, while the pseudo-measurements are assigned with large variance. We therefore have the following assumption on observability of \eqref{eq:WLS}. \begin{assumption}\label{observable} The distribution system is fully observable. \end{assumption} Full observability of the distribution system can be achieved by using the power injection pseudo-measurements and virtual measurements. \subsection{Conventional Gauss-Newton Algorithm} To solve for WLS problem~\eqref{eq:WLS}, iterative Gauss-Newton (G-N) algorithm is usually applied based on solving its first-order optimality condition: \begin{align} -\mathbf{H}^{\top}\mathbf{W}\big(\bm{y}-\bm{h}(\bm{z})\big)=\bm{0}_{2n}, \label{FONC} \end{align} where $\mathbf{H} \in \mathbb{R}^{m \times 2n}$ denotes the Jacobian matrix of $\bm{h}(\bm{z})$ with respect to $\bm{z}$. Denote the state at the iteration $k$ by $\bm{z}(k)$ and the first-order Taylor series approximation of \eqref{FONC} around the state $\bm{z}(k)$ yields: \begin{eqnarray}\label{GN algorithm} \bm{z} (k+1)=\bm{z} (k)+\mathbf{G}^{-1}\mathbf{H}^{\top} \mathbf{W} \Big(\bm{y}-\bm{h}\big(\bm{z} (k)\big)\Big) \end{eqnarray} where $\mathbf{G}=\mathbf{H}^{\top}\mathbf{W}\mathbf{H}$ is defined as the gain matrix. $\bm{z} (k)$ is the solution vector at the $k$th iteration. \eqref{GN algorithm} is known as the iterative Gauss-Newton (G-N) algorithm. The algorithm is repeated until the stopping criterion is satisfied. \subsection{Motivation for Real-Time DSSE Development} We have so far discussed about the state estimation based on a single batch of the measurements, i.e., offline DSSE. In real-time operation, however, control center may receive temporal series of snapshots of measurements. To track the system states in real-time, the WLS problem \eqref{eq:WLS} is next reformulated for any time $t$ as: \begin{eqnarray}\label{eq:real-time WLS} &\underset{\bm{z}_t}{\min}& \frac{1}{2}(\bm{y}_t-\bm{h}(\bm{z}_t))^{\top}\mathbf{W}_t (\bm{y}_t-\bm{h}(\bm{z}_t)), \end{eqnarray} where $\bm{y}_t \in \mathbb{R}^{m}$, $\bm{z}_t \in \mathbb{R}^{2n}$, $\mathbf{W}_t\in \mathbb{R}^{m}$ denote the vector of measurements, state variables and weight matrix at time $t$. Similarly, we can implement the G-N algorithm to the real-time WLS problem for each time $t$. However in practice, when faster estimation is desired, we may not be able to finish computing all iterations at time $t$ given limited computation capability. More importantly, we may not obtain the whole batch of measurement $\bm{y}_t$ due to asynchronous measurement and communication delays, rendering the G-N updates slow or even infeasible. To address this issue, we will propose a new real-time DSSE paradigm based on stochastic gradient algorithm. \section{Solve Real-Time DSSE via Stochastic Gradient Descent}\label{SGD} One way to significantly improve the timeliness of the DSSE solvers is to take advantage of the asynchronous measurement data, instead of waiting for the whole batch of measurement data to start computation. However, the asynchronous measurements from heterogeneous measurement devices pose a challenge to the G-N algorithm, because the number of real-time measurements at each interval is less than the number of state variables and thus the G-N algorithm cannot be properly executed. To solve this issue, we propose a real-time SGD algorithm, which does not require the whole batch of measurement data for computation at each iteration, and guarantees provable performance. \subsection{Online Gradient Algorithm} We first propose a gradient algorithm which runs sufficient iterations until convergence for each $t$ to completely solve \eqref{eq:real-time WLS}: \begin{align}\label{eq: grad_LPF+Feedback} \bm{z}_t(k+1)=\bm{z}_{t}(k) - \epsilon \mathbf{H}^{\top} \mathbf{W}_t (\bm{h}(\bm{z}_{t}(k))-\bm{y}_t), \end{align} where $\epsilon$ is a constant stepsize and $\mathbf{H}^{\top} \mathbf{W}_t (\bm{h}(\bm{z}_{t}(k))-\bm{y}_t)$ is the gradient of \eqref{eq:real-time WLS} evaluated at $\bm{z}_{t}(k)$. Such gradient updates can be shown to converge to the solutions of \eqref{eq:real-time WLS} given small enough stepsize $\epsilon$ \cite{zhou2020}. In scenarios where we may only have time to run limited iterations from $t$ to $t+1$, e.g., 1 iteration for each $t$, we can hardly expect \eqref{eq: grad_LPF+Feedback} to converge in time. Therefore, we propose the following online gradient descent method for time slot $t$ with a constant stepsize $\epsilon$: \begin{align}\label{eq: r-t grad_LPF+Feedback} \bm{z}_{t} = \bm{z}_{t-1} - \epsilon \mathbf{H}^{\top} \mathbf{W}_t (\bm{h}(\bm{z}_{t-1})-\bm{y}_{t}). \end{align} Note that at each time $t$, the algorithm is initialized at $\bm{z}_{t-1}$ and the gradient is calculated based on the current measurement $\bm{y}_{t}$. We summarize the online gradient-based DSSE (GD) algorithm in Algorithm~\ref{alg:real-time GD}. \begin{algorithm}[h] \caption{Online Gradient Algorithm for DSSE} \begin{algorithmic}\label{alg:real-time GD} \STATE Estimator runs in real time with a constant stepsize $\eta$:\\ \REPEAT \STATE 1) Receive a whole batch of measurements $\bm{y}_t$.\\ \STATE 2) Update weight matrix $\mathbf{W}_t$ and evaluates measurement function $\bm{h}(\bm{z}_{t-1})$. \STATE 3) Update system states with gradient step \eqref{eq: r-t grad_LPF+Feedback}. \STATE 4) Move on to the next time step $t\leftarrow t+1$.\\ \UNTIL being ended. \end{algorithmic} \end{algorithm} \subsection{Stochastic Gradient Algorithm}\label{propose SGA} The scenario used in Algorithm~\ref{alg:real-time GD} is rather ideal, namely, we have assumed that a whole batch of measurement data can be obtained for gradient update at each time $t$. In practice, however, asynchronous measurement and communication delay and loss prevent us from collecting the entire batch of measurement in time. Assume that we only collect $m_t\leq m$ measurements at time $t$, rendering the standard gradient updates \eqref{eq: r-t grad_LPF+Feedback} incomplete. In order to avoid waiting for the entire batch of measurement to arrive and to provide timely updates of the system states, we propose to use stochastic gradient to update with available incomplete measurement data as follows: \begin{align}\label{eq:z_update_LPF_SGD} \bm{z}_t=\bm{z}_{t-1}-\epsilon \mathbf{H}^s_t(\bm{z}_{t-1})^{\top} \mathbf{W}^s_t (\bm{h}^s_{t}(\bm{z}_{t-1})-\bm{y}_t), \end{align} where $\bm{y}_t \in\mathbb{R}^{m_t}$ is the available measurement vector at time $t$, $\mathbf{W}^s_t \in \mathbb{R}^{m_t \times m_t}$ is the submatrix of the weight matrix corresponding to the available measurement, $\bm{h}^s_t(\bm{z}_{t-1}):\mathbb{R}^{2n}\rightarrow \mathbb{R}^{m_t}$ and $\mathbf{H}^s_t(\bm{z}_{t-1}) \in \mathbb{R}^{m_t \times 2n}$ denote the partial measurement functions and the measurement Jacobian matrix corresponding to the available measurements at time $t$ evaluated at $\bm{z}_{t-1}$. We execute dynamic~\eqref{eq:z_update_LPF_SGD} in real time to generate Algorithm~\ref{alg:r-t SGD}. The algorithm repeats the following two steps after the arrival of $m_t$ measurements. First, the estimator updates measurement Jacobian matrix, weight matrix and evaluates measurement residuals. Second, estimator updates state variables with one SGD step. \begin{algorithm}[h] \caption{Online SGD Algorithm for DSSE} \begin{algorithmic}\label{alg:r-t SGD} \STATE Estimator runs in real-time with a constant stepsize $\eta$:\\ \REPEAT \STATE 1) Receive a batch of measurements $\bm{y}_t$.\\ \STATE 2) Updates Jacobian matrix $\mathbf{H}_t^s $, weight matrix $\mathbf{W}_t^s$ and evaluates measurement function $\bm{h}^s_t(\bm{z}_{t-1})$. \STATE 3) Update system states with stochastic gradient step \eqref{eq:z_update_LPF_SGD} \STATE 4) Move on to the next time step $t\leftarrow t+1$.\\ \UNTIL being ended. \end{algorithmic} \end{algorithm} \subsection{Convergence Analysis}\label{convergence analysis} In this subsection, we will show the convergence of SGD algorithm~\eqref{eq:z_update_LPF_SGD} with a fixed stepsize. Because the (stochastic) gradient used in \eqref{eq:z_update_LPF_SGD} corresponds to a nonconvex optimization problem \eqref{eq:real-time WLS} whose optimality and gradient dynamics are difficult to characterize, for convergence analysis we use the convex counterpart of \eqref{eq:real-time WLS} by replacing the nonlinear function $\bm{h}$ with its linearization $\mathbf{H}$ as follows: \begin{eqnarray}\label{eq:real-time convex WLS} &\underset{\bm{z}_t}{\min}& \frac{1}{2}(\bm{y}_t-\mathbf{H} \cdot \bm{z}_t)^{\top}\mathbf{W}_t (\bm{y}_t-\mathbf{H} \cdot \bm{z}_t). \end{eqnarray} The gradient dynamics for solving \eqref{eq:real-time convex WLS} is written as: \begin{align}\label{eq:z_update_LPF} \bm{z}_t=\bm{z}_{t-1}-\epsilon \mathbf{H}^{\top} \mathbf{W}_t (\mathbf{H}\cdot\bm{z}_{t-1}-\bm{y}_t), \end{align} which can be proved to converge asympototically to the solution of \eqref{eq:real-time convex WLS}. For ease of expression, we use the notations defined in the following table in our proof. \begin{table}[htbp] \normalsize \begin{center} \caption{Nomenclature} \begin{tabular}{l l} \cline{1-2} \hline $f(\bm{z}_t)$ & gradient of \eqref{eq:real-time convex WLS}: $\mathbf{H}^{\top} \mathbf{W}_t (\mathbf{H}\cdot\bm{z}_{t-1}-\bm{y}_t)$;\\ $\tilde{f}(\bm{z}_t)$ & gradient in \eqref{eq: r-t grad_LPF+Feedback}: $\mathbf{H}^{\top} \mathbf{W}_t (\bm{h}(\bm{z}_{t-1})-\bm{y}_{t})$;\\ $f_t(\bm{z}_t;\bm{\xi}_t)$ & stochastic gradient of \eqref{eq:real-time convex WLS}:\\ &$\mathbf{H}^s_t(\bm{z}_{t-1})^{\top} \mathbf{W}^s_t (\mathbf{H}^s_t \cdot\bm{z}_{t-1}-\bm{y}_t)$;\\ $\tilde{f}_t(\bm{z}_t;\bm{\xi}_t)$ & stochastic gradient in \eqref{eq:z_update_LPF_SGD}:\\ &$\mathbf{H}^s_t(\bm{z}_{t-1})^{\top} \mathbf{W}^s_t (\bm{h}^s_{t}(\bm{z}_{t-1})-\bm{y}_t)$;\\ $\bm{z}^*_t$ &optimal solution of \eqref{eq:real-time convex WLS};\\ $\tilde{\bm{z}}^*_t$ & optimal solution of \eqref{eq:real-time WLS}.\\ \hline \end{tabular} \label{NOMENCLATURE} \end{center} \end{table} We proceed with the following reasonable assumptions for analytical characterization. \begin{assumption}\label{A1} The discrepancy between the gradient of \eqref{eq:real-time convex WLS} and the gradient in \eqref{eq: r-t grad_LPF+Feedback} is bounded for any feasible $\bm{z}$. Consequently, we have \begin{eqnarray} \|\tilde{f}(\bm{z};\xi)-f(\bm{z};\xi)\|^2\leq \Delta_1,\ \forall t.\label{eq:delta2} \end{eqnarray} where $f(\bm{z};\xi)$ and $\tilde{f}(\bm{z};\xi)$ denote the stochastic gradients of \eqref{eq:real-time convex WLS} and \eqref{eq:real-time WLS}, respectively. $\xi$ denotes the randomness introduced by the SGD algorithm. \end{assumption} \begin{assumption}\label{A2} The expected value of the squared $L2$ norm for the stochastic gradient is bounded for any feasible $\bm{z}$. As a result, we have \begin{eqnarray} \mathbb{E}[\|f(\bm{z};\xi)\|^2]\leq \sigma_f^2.\label{eq:sigma_g} \end{eqnarray} \end{assumption} \begin{assumption}\label{A3} The difference of the optimal solutions of \eqref{eq:real-time convex WLS} between two consecutive time slots is bounded, \begin{eqnarray} &\|\bm{z}_{t+1}^*-\bm{z}_{t}^*\| \leq \Delta_{\bm{z}}, \forall t.\label{eq:delta1} \end{eqnarray} \end{assumption} \begin{assumption}\label{A4} The discrepancy between $\tilde{\bm{z}}_t^*$, the optimal solution of \eqref{eq:real-time WLS}, and $\bm{z}_t^*$, the optimal solution of \eqref{eq:real-time convex WLS}, is very small. \end{assumption} Under the Assumption~\ref{observable}, the gain matrix $\mathbf{H}^{\top} \mathbf{W}_t \mathbf{H}$ is positive definite given the complete measurements. As the gain matrix is the Hessian matrix of \eqref{eq:real-time convex WLS}, the optimization problem \eqref{eq:real-time convex WLS} is strongly convex. Denotes by $\tau_t$ the smallest eigenvalue of the gain matrix $\mathbf{H}^{\top} \mathbf{W}_t \mathbf{H}$ for notational simplicity, and we have the following lemma. \begin{lemma} For any feasible $\bm{z}_t$ and $\bm{z}'_t$, one has: \begin{align}\label{eq:B1} &\big(f(\bm{z}_t)-f(\bm{z}'_t)\big)^{\top}(\bm{z}_t-\bm{z}'_t) \geq \tau_t \|\bm{z}_t-\bm{z}'_t\|^2\geq \tau_1 \|\bm{z}_t-\bm{z}'_t\|^2, \end{align} where denote by $\tau_1$ the lower bound of the smallest eigenvalue of any gain matrix. \end{lemma} \begin{lemma}[Unbiased Estimation \cite{2018Bottou}]\label{lem:unbiased estimate} Stochastic gradient $f(\bm{z};\xi_t)$ is an unbiased estimate of the full gradient $f(\bm{z})$ given $\{\xi_1, \xi_2, ..., \xi_{t-1}\}$, i.e., \begin{eqnarray}\label{eq:ue} \mathbb{E}[f(\bm{z};\xi_t)|\xi_1, ..., \xi_{t-1}]=f(\bm{z}). \end{eqnarray} \end{lemma} Denote by $\eta$ the constant stepsize of the SGD algorithm, and we have the following theorem. \begin{theorem}[Convergence]\label{the:convergence} Under the Assumptions~\ref{observable}--\ref{A4}, if the constant stepsize satisfies $0<\eta \leq\frac{1}{2 \tau_1}$, then the proposed algorithm achieves: \begin{eqnarray}\label{eq:convergence} \lim_{t \rightarrow \infty}\mathbb{E}[\|\bm{z}_{t}^*-\bm{z}_t\|^2]= \frac{\eta^2 \sigma_f^2+\eta^2 \Delta_1+\Delta_{\bm{z}}}{2\eta \tau_1}, \end{eqnarray} where $\bm{z}_{t}^*$ and $\bm{z}_{t}$ denote the optimal solution of \eqref{eq:real-time convex WLS} and the one obtained via the proposed online SGD algorithm at time $t$. \end{theorem} \begin{proof} From the SGD algorithm, we have \begin{align}\label{derivation1:bound_FbSGDvsNoFbGD} &\|\bm{z}_{t+1}-\bm{z}_{t+1}^*\|^2\nonumber\\ =&\|\bm{z}_{t+1}-\bm{z}_{t}^*-(\bm{z}_{t+1}^*-\bm{z}_{t}^*)\|^2\nonumber\\ \leq&\|\bm{z}_t-\eta \tilde{f}(\bm{z}_t;\xi_t)-\bm{z}_{t}^*-(\bm{z}_{t+1}^*-\bm{z}_{t}^*)\|^2\nonumber\\ \leq& \|\bm{z}_t-\eta \tilde{f}(\bm{z}_t;\xi_t)-\bm{z}_{t}^*\|^2+\|\bm{z}_{t+1}^*-\bm{z}_{t}^*\|^2\nonumber\\ =&\|\bm{z}_t-\bm{z}_{t}^*-\eta f(\bm{z}_t;\xi_t)+\eta f(\bm{z}_t;\xi_t)-\eta \tilde{f}(\bm{z}_t;\xi_t)\|^2\nonumber\\ &+\|\bm{z}_{t+1}^*-\bm{z}_{t}^*\|^2\nonumber\\ \leq& \|\bm{z}_t-\bm{z}_{t}^*-\eta f(\bm{z}_t;\xi_t)\|^2\nonumber\\ +&\eta^2 \| f(\bm{z}_t;\xi_t)- \tilde{f}(\bm{z}_t;\xi_t)\|^2+\|\bm{z}_{t+1}^*-\bm{z}_{t}^*\|^2\nonumber\\ =&\|\bm{z}_t-\bm{z}_{t}^*\|^2+\eta^2 \| f(\bm{z}_t;\xi_t)\|^2\nonumber\\ &-2\eta (\bm{z}_t-\bm{z}_{t}^*)^{\top} f(z_t;\xi_t)\nonumber\\ &+\eta^2 \| f(\bm{z}_t;\xi_t)- \tilde{f}(\bm{z}_t;\xi_t)\|^2+\|\bm{z}_{t+1}^*-\bm{z}_{t}^*\|^2 \end{align} The first inequality comes from the nonexpansiveness of projection operation, the second and the third from the triangle inequality of the norm. Taking expectation on both sides of \eqref{derivation1:bound_FbSGDvsNoFbGD} gives: \begin{align}\label{eq: exp-1} &\mathbb{E}[\|\bm{z}_{t+1} -\bm{z}_{t+1}^*\|^2]\nonumber\\ \leq& \mathbb{E}[\|\bm{z}_t-\bm{z}_{t}^*\|^2]+\eta^2 \mathbb{E}[\| f(\bm{z}_t;\xi_t)\|^2]\nonumber\\ &-2\eta \mathbb{E}[(\bm{z}_t-\bm{z}_{t}^*)^{\top} f(z_t;\xi_t)]\nonumber\\ &+\eta^2 \mathbb{E}[\| f(\bm{z}_t;\xi_t)- \tilde{f}(\bm{z}_t;\xi_t)\|^2]+\|\bm{z}_{t+1}^*-\bm{z}_{t}^*\|^2\nonumber\\ =& \mathbb{E}[\|\bm{z}_t-\bm{z}_{t}^*\|^2]+\eta^2 \sigma_f^2-2\eta \mathbb{E}[(\bm{z}_t-\bm{z}_{t}^*)^{\top} f(z_t))]\nonumber\\ &+\eta^2 \Delta_1^2+ \Delta_{\bm{z}} \end{align} where the first equality comes from \eqref{eq:sigma_g}, \eqref{eq:delta2}, \eqref{eq:delta1}. The third term of RHS of the first equality can be expressed by the unbiased estimate as follows, \begin{align}\label{eq:unbais estimate} & 2\eta \mathbb{E}[(\bm{z}_t-\bm{z}_{t}^*)^{\top} f(z_t,\xi_t)]\nonumber\\ =& 2\eta \mathbb{E}[\mathbb{E}[(\bm{z}_t-\bm{z}_{t}^*)^{\top} f(z_t,\xi_t)|\xi_1, \xi_2, ..., \xi_{t-1}]]\nonumber\\ =& 2\eta \mathbb{E}[(\bm{z}_t-\bm{z}_{t}^*)^{\top} \mathbb{E}[f(z_t,\xi_t)|\xi_1, \xi_2, ..., \xi_{t-1}]]\nonumber\\ =& 2\eta \mathbb{E}[(\bm{z}_t-\bm{z}_{t}^*)^{\top} f(z_t)] \end{align} We substitute RHS of \eqref{eq:unbais estimate} for $2\eta \mathbb{E}[(\bm{z}_t-\bm{z}_{t}^*)^{\top} f(z_t)]$ into \eqref{eq: exp-1} to obtain, \begin{align} &\mathbb{E}[\|\bm{z}_{t+1} -\bm{z}_{t+1}^*\|^2]\nonumber\\ =& \mathbb{E}[\|\bm{z}_t-\bm{z}_{t}^*\|^2]+\eta^2 \sigma_f^2-2\eta \mathbb{E}[(\bm{z}_t-\bm{z}_{t}^*)^{\top} f(z_t))]\nonumber\\ &+\eta^2 \Delta_1^2+ \Delta_{\bm{z}}\nonumber\\ \leq & \mathbb{E}[\|\bm{z}_t-\bm{z}_{t}^*\|^2]+\eta^2 \sigma_f^2-2\eta \tau_1 \mathbb{E}[\|\bm{z}_t-\bm{z}_{t}^*\|^2]\nonumber\\ &+\eta^2 \Delta_1^2+ \Delta_{\bm{z}}\nonumber\\ =& (1-2\eta \tau_1) \mathbb{E}[\|\bm{z}_1-\bm{z}_1^*\|^2] +(\eta^2 \sigma_f^2 +\eta^2 \Delta_1+\Delta_{\bm{z}})\nonumber\\ \leq& (1-2\eta \tau_1)^t \mathbb{E}[\|\bm{z}_1-\bm{z}_1^*\|^2]\nonumber\\ &+\frac{1-(1-2\eta \tau_1)^t}{2\eta \tau_1} (\eta^2 \sigma_f^2 +\eta^2 \Delta_1+\Delta_{\bm{z}}) \end{align} where the first inequality comes from \eqref{eq:B1} and the second inequality is obtained by repeating all the previous steps for $t$ times. For $0<\eta\leq \frac{1}{2\tau_1}$, one has $0 \le 1-2\eta \tau_1<1$, so \eqref{eq:convergence} follows. \end{proof} \subsection{Power Injection Based DSSE}\label{algorithm implementation} The modern distribution system will features a lot of zero injection nodes. The power injection measurements of these nodes are accurate, so their weights will be infinite or set very large values for the nodal-voltage based DSSE method. It brings in numerical issue. To circumvent such a problem, the branch-current based DSSE \cite{Baran1995} and power injection based DSSE \cite{zhou2020} are proposed. Based on the numerical study, both approaches achieve similar estimation accuracy, but the latter approach is more efficient. Therefore, we adopt the formulation of the latter approach in this paper. We select nodal power injection $[\bm{p}^{\top}, \bm{q}^{\top}]^{\top}$ for all nodes as the state variables $\bm{z}$. Denote by $\hat{v}_{i,t}$ voltage magnitude measurement for any node $i$ collected in the set ${\cal M}^v_t$ and by $(\hat{p}_{i,t}, \hat{q}_{i,t})$ load pseudo-measurement for any node $i$ collected in the load set ${\cal N}^l$. Then problem~\eqref{eq:real-time WLS} is reformulated as: \begin{subequations}\label{eq:set} \begin{eqnarray} &\hspace{-9mm}\underset{\bm{p}_t,\bm{q}_t}{\min}&\hspace{-5mm}\sum_{i\in{\cal N}^l}\hspace{-2mm}\Big(\frac{\hspace{-0.1mm}(p_{i,t}-\hat{p}_{i,t})^2}{2\sigma_{p_i}^2}\hspace{-1mm}+\hspace{-1mm}\frac{(q_{i,t}-\hat{q}_{i,t})^2}{2\sigma_{q_i}^2}\hspace{-0.1mm}\Big)\hspace{-1mm}+\hspace{-3mm}\sum_{i\in{\cal M}^v}\hspace{-2mm}\frac{(v_{i,t}-\hat{v}_{i,t})^2}{2\sigma_{v_i}^2},\label{eq:WLSt}\\ &\hspace{-9mm}\text{s.t.}& \hspace{-2mm}\bm{v}_t=\bm{g}(\bm{p}_t,\bm{q}_t),\label{eq:voltaget}\\ &\hspace{-9mm}&\hspace{-2mm} (\bm{p}_t,\bm{q}_t)\in\bm{\Omega}_t,\label{eq:Omegat} \end{eqnarray} \end{subequations} where $\bm{g}$ denotes the nonlinear power flow equations, and $\bm{\Omega}_t =\Cross_{i\in{\cal N}} {\Omega}_{i,t}$ with $\Omega_{i,t}=\mathbb{R}^2, \forall i\in{\cal N}^l$ for pseudo-measurement and $\Omega_{i,t}=\{0,0\},\forall i\in{\cal N}\backslash{\cal N}^l$ for virtual measurement. Virtual measurements are zero power injections of the nodes without any load. These measurements are accurate, so we assign state variables of the nodes without any load zero. The proposed stochastic gradient algorithm is implemented as follows: \begin{subequations}\label{eq:SGD} \begin{align} &p_{i,t+1}=p_{i,t}-\epsilon\Big(\sum_{j\in{\cal M}^v_t}\frac{\partial v_j}{\partial p_i} \frac{(v_{j,t}-\hat{v}_{j,t})}{\sigma^2_{v_j}}+\frac{\big(p_{i,t}-\hat{p}_{i,t}\big)}{\sigma^2_{p_i}}\Big),\nonumber\\ & \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad i\in{\cal N}^l,\\ &q_{i,t+1}=q_{i,t}-\epsilon\Big(\sum_{j\in{\cal M}^v_t}\frac{\partial v_j}{\partial p_i} \frac{(v_{j,t}-\hat{v}_{j,t})}{\sigma^2_{v_j}}+\frac{\big(q_{i,t}-\hat{q}_{i,t} \big)^2}{\sigma^2_{q_i}}\Big),\nonumber\\ & \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad i\in{\cal N}^l,\label{eq:multiq}\\ &(p_{i,t+1},q_{i,t+1}) \in \{0,0\},\qquad \qquad \qquad \forall i\in{\cal N}\backslash{\cal N}^l, \label{eq:multip_vir}\\ &\bm{v}_{t+1}=\bm{g}(\bm{p}_{t+1},\bm{q}_{t+1}),\label{eq:v update} \end{align} \end{subequations} where ${\cal M}^v_t\subseteq {\cal M}^v$ denotes the subset of nodes whose real-time measurements of voltage magnitude are received by the control center at time $t$. There is no explicit expression of function $\bm{g}$. Hence, we estimate the voltage magnitude in \eqref{eq:v update} with the power flow solution calculated by OpenDSS given the updated power injection for each $t$. As a specific case of \eqref{eq:z_update_LPF_SGD}, dynamics~\eqref{eq:SGD} follows the same convergence property as described in Theorem~\ref{the:convergence}. \section{Simulation Results}\label{Simulation} \subsection{Simulation Setup} The numerical performance of the proposed online SGD algorithm is compared with the online GD algorithm \eqref{eq: grad_LPF+Feedback}, denoted by GD, and \eqref{eq: r-t grad_LPF+Feedback}, denoted by GO, on a unbalance three-phase IEEE-123 bus feeder. We use the realistic load and solar irridiance data from feeders in Anatolia, California on a day of August in 2012. The data is of an one-second resolution\cite{Bank13} from 6 a.m. to 6 p.m., amounting to 43,200 successive scenarios; see Fig.~\ref{fig:Real-time PV+Load Data} for the real power injection of PV and load profile of one node. Measurements are obtained by adding Gaussian noise of normal distribution to the true power flow solution solved via OpenDss. We randomly place voltage meters on $12\%$ of all the nodes. The standard deviations of the $29$ voltage measurements are $0.01$ p.u. All the load nodes have pseudo-measurements with $50\%$ error \cite{Yao2019, Marco13}. At each second, only one voltage magnitude and three pairs of power injection measurements are sent to the estimator. All the simulations are conducted on an HP ENVY NOTEBOOK with processor Intel®Core (TM) i7-6500CPU 2.5 GHz, RAM 8.0 GB and 64-bit operating system, running Matlab R2016a on Windows 10 Home Version. \begin{figure}[htbp] \centerline{\includegraphics[width=.5\textwidth]{Real-timePV+LoadData.jpg}} \caption{Real-time PV (upper) and load profile (lower) with 1 second temporal granularity.} \label{fig:Real-time PV+Load Data} \end{figure} \subsection{Numerical Tests} \subsubsection{Tracking the fast changing system states} We present the true voltage magnitude of a randomly selected node and its estimation via the proposed SGD scheme and online GD algorithms at every second in Fig.~\ref{fig:Real-time Voltage Estimation}, where the blue curve represent the true voltage magnitude, while the yellow, purple and red dash curves represent the estimation voltages via GO, GD and SGD algorithms. In the plot, most of the blue curve is covered by the yellow curve, which implies that GO algorithm can track fast changing states very well. The accuracy is due to the complete access to the real-time measurements. The small mismatches between the blue and red curves validate that the SGD algorithm can track the voltage magnitudes accurately in real-time DSSE. \begin{figure}[htbp] \centerline{\includegraphics[width=.52\textwidth]{Real-timeVoltageEstimation+ZoomIn_Profile_thick.png}} \caption{Comparison of the voltage estimation updated by the online stochastic gradient and gradient algorithms.} \label{fig:Real-time Voltage Estimation} \end{figure} \subsubsection{Stability}\label{prove convergence} The real-time average error of the voltage estimation is presented in Fig.~\ref{fig:running ave of Vm error}, where the blue, red and yellow lines represent the voltage estimation errors of SGD, GD and GO algorithms. The average error of voltage estimation for GO is less than that of SGD and GD. In a lot of cases, the averge error of voltage estimation of GD is smaller than SGD as it accesses to all the available real-time measurements at every second with the requirement of synchronizing all the measurement devices. However, the SGD does not need the requirement, and its average error is less than $1\%$ for most of the samples during the $12$-hour interval. \begin{figure}[htbp] \centerline{\includegraphics[width=.5\textwidth]{Real-timeAveErrorofVm.jpg}} \caption{Real-time average error of the voltage estimation for SGD, GD and GO at every second.} \label{fig:running ave of Vm error} \end{figure} \subsubsection{Accuracy and Computation Time} In this subsection, we compare three aspects of the numerical results of SGD, GD and GO as follows: 1) the average computation time, 2) the average estimation error of the voltage magnitude per node, and 3) the average of the maximum estimation error of the voltage magnitude per sample. The comparison is presented in Table~\ref{Comparison btw SGD and GD}. The second row of the table presents the results of SGD. As we can see, the average error per node is $2 e^{-3}$ p.u., and the average maximal error per scenario is $5.3 e^{-3}$ p.u.. Both errors are less than $1\%$, and very close to the errors of GD and GO. The result shows that the proposed SGD-based DSSE algorithm achieves accurate voltage estimation. The average computation time of SGD per iteration is $1.8 e^{-3}$ seconds, much less than $1$ second. Therefore, the accuracy and efficiency of the proposed SGD-based algorithm enables DSSE to handle a system featured with fast changing states with the asynchronous measurements in real-time. \begin{table}[!ht] \begin{center} \caption{Computation Time and Estimation Errors of voltage magnitudes.} \begin{tabular}{c c c c} \dtoprule & {\textbf{Ave. Time (s)}} & {\textbf{Ave. Error (p.u.)}} & {\textbf{Ave. Max. Error (p.u.)}} \\ \hline \textbf{SGD} & $1.80e-03$ & $3.0e-03$ & $6.3e-03$\\ \textbf{GD} & $1.80e-03$ & $1.7e-03$ & $4.3e-03$\\ \textbf{GO} & $0.17$ & $1.1e-03$ & $2.8e-03$\\ \dbottomrule \end{tabular} \label{Comparison btw SGD and GD} \end{center} \end{table} \section{Conclusion}\label{conclusion} We have proposed an SGD-based real-time DSSE algorithm to process data stream of asynchronous measurements. The convergence analysis of the proposed algorithm has been established. The algorithm has been tested in an unbalanced three-phase IEEE-123 bus system under realistic solar and load data to effectively and accurately track fast-changing system states with asynchronous measurements. \nocite{*} \bibliographystyle{IEEEtran} \section{Introduction} The operation of distribution system is becoming challenging with the growing integration of distributed energy resources (DERs). DERs are introducing more intermittency and volatility into distribution networks, resulting in fast changing states. To maintain normal operations in such scenarios, numerous advanced optimization and control algorithms have been designed for the distribution system. However, what has been overlooked is distribution system state estimation (DSSE), without which most of the advanced control strategies cannot be properly deployed in practice. DSSE estimates the states of the distribution network by utilizing network parameters, topology and meter reading. Different from transmission system state estimation (TSSE), DSSE features untransposed multiphase lines of high $r/x$ ratios, unbalaned multiphase loads, much less accurate and asynchronous measurement devices, but more volatile system states due to high penetration of DERs \cite{primadianto2016review}. Therefore, the single phase equivalent model and conventional solution methods used for TSSE cannot produce the most efficient and accurate results for DSSE. There have been a lot of efforts devoted to DSSE. Among the existing work, the most widely used method is to formulate a weighted least squares (WLS) problem for DSSE. Based on the choice of state variables, the WLS-based DSSE methods can be categorized into nodal voltage based, branch current based and power injection based methods. A three-phase DSSE method was early proposed with bus voltage as state variables in \cite{Baran1994}, and developments have been made ever since. The authors in \cite{Lu1995} propose to convert nodal power injection measurements to the current injection measurements. To increase the computation efficiency and accuracy, a decomposition method and a load allocation approach is proposed in \cite{Deng2002} by exploiting the network topology. An augmented nodal analysis formulation is proposed in \cite{Francis2013} to increase numerical robustness. A semi-definite programming approach is proposed in \cite{Yao2019} to model virtual-measurements as equality constraints. The first branch-current based method is proposed in \cite{Baran1995} to reduce computation burden and condition number of the gain matrix. The voltage magnitude measurements are incorporated into the branch-current based approach in \cite{Baran2009}. This method is further enhanced by considering the synchrophasor measurements in \cite{Marco13}. A numerically robust and scalable power injection based method is proposed in \cite{zhou2020} to further increase computation efficiency. Dynamic system state estimation approaches are proposed in \cite{Zhao2017, Filho2009, Song2020} for handling fast time-varying system. However, most existing works assume all the measurement data to be available in time, while in real-time DSSE, data from the heterogeneous and asynchronous measurement devices \cite{Zheng2013,von2014}, like PMU and smart meters, may have largely different sampling rates \cite{Angioni2013,Alimardani2015}. Furthermore, communication loss and delay, as well as bad data discarding, also lead to missing and asynchronicity of measurement data. The resulting DSSE problem is not observable, and the classic DSSE methods that assume synchronous data can not be applied. To solve this issue, authors in \cite{Ali2015} model load variation between two consecutive samples as a random variable following a normal distribution, and decrease measurement weights as time goes by. The authors in \cite{BS2014} assume synchronization errors to follow normal distribution with zero mean so that they can be modeled as measurement errors and states can be estimated via WLS method. In \cite{Guido2019}, outdated estimated states are used as measurements to ensure observability. In this work, we do not make any assumption on the distribution of the load variation or synchronization error. We will formulate the DSSE as a time-varying weighted least squares (WLS) problem and propose to solve it via a stochastic gradient descent algorithm instead of Gauss-Newton (GN) method. The stochastic gradient algorithm can accommodate for asynchronous stream of measurement data and deliver accurate estimation efficiently. Stability of the proposed algorithm theoretically proved and numerically illustrated. The remainder of this paper is organized as follows. In Section~\ref{system model}, we introduce the notation, distribution system modeling, and the formulation of time-varying WLS. We next propose the stochastic gradient descent (SGD) algorithm for solving the real-time DSSE problem and provide the convergence analysis in Section~\ref{SGD}. In Section~\ref{Simulation}, the proposed algorithm is numerically tested on IEEE-123 bus feeder. We conclude the paper in Section~\ref{conclusion}. \section{Distribution System State Estimation}\label{system model} \subsection{Notations} In this paper, we use bold letters to represent matrices, e.g., $\mathbf{A}$, italic bold letters to represent vectors, e.g, $\mathbf{A}$ and $\bm{a}$, and non-bold letters to represent {scalars}, e.g., $A$ and $a$. For matrix $\mathbf{A}$, $\mathbf{A}^{\top}$, $\mathbf{A}^{-1}$ and $\tau (\mathbf{A})$ denote its transpose, inverse and smallest eigenvalue, respectively. $\mathbf{diag}(\bm{a})$ denotes a diagonal matrix with vector $\bm{a}$ as its diagonal. $\mathbb{E}[x]$ denotes the expected value of random variable $x$. $\mathfrak{i}:=\sqrt{-1}$ is used as the imaginary unit. \subsection{Distribution system} We consider a multiphase distribution system denoted by a graph ${\cal G}=\{{\cal V}_0, {\cal E}\}$, where ${\cal V}_0 = \{0\}\cup{\cal V}=\{0\}\cup\{1, 2, ..., N\}$ with bus 0 being the slack bus and the set of ${\cal V}$ collecting the rest buses, and ${\cal E} = \{ (i, j) \subseteq {\cal V}_0 \times {\cal V}_0 \}$ denotes the set of lines between buses. Each bus has up to three available phases. We define each phase of a bus in ${\cal V}$ as a node, and define the set of all the nodes as ${\cal N}:= \{1, ..., n \}$ where $n$ is the total number of nodes in the system. Denote by ${\cal N}^l \subseteq {\cal N}$ the subset of all load nodes. Similar to the buses, a line may have up to three available phases, each defined as a branch. A line with $l$ phases features $l$-by-$l$ admittance and impedance matrices. The admittance and impedance matrix for the line between bus $i$ and $j$ are denoted by $\bm{y}_{ij}$ and $\bm{z}_{ij}=\bm{r}_{ij}+\mathfrak{i}\bm{x}_{ij}$, respectively. Let ${\cal V}_{i}$ denote the set of adjacent buses of bus~$i$ and ${\cal I}_i$ the set of nodes within bus $i$. Then the bus admittance matrix ${\bf Y}$ can be characterized by its submatrix ${\bf Y}({{\cal I}_i,{\cal I}_j})$ corresponding to any $(i,j)\in{\cal E}$ as: \begin{align} {\bf Y}({{\cal I}_i,{\cal I}_j}) =\begin{cases} \bm{0}, &\text{if } j \neq i, \text{and } j \not \in {\cal V}_i, \nonumber\\ -\bm{y}_{ij}, &\text{if } j \in {\cal V}_i, \nonumber\\ \sum_{k \in {\cal V}_i} \bm{y}_{ik}, & i=j. \end{cases} \end{align} Also see \cite{Bazrafshan18} for more details of multiphase distribution system modeling. \subsection{Formulation of DSSE} In DSSE, the measurement model for a distribution system is expressed as follows, \begin{align} \bm{y}=\bm{h}(\bm{z})+\bm{e}, \end{align} where $\bm{y} \in \mathbb{R}^{m}$, $\bm{z} \in \mathbb{R}^{2n}$, $\bm{e}\in \mathbb{R}^{m}$ denote the vector of measurements, state variables. \subsubsection{Measurements} For a distribution system, the measurements usually include virtual-measurements, real-time measurements and pseudo-measurements. The virtual-measurements are referred to the known knowledge of zero-injection nodes without any load or generation. The real-time measurements are sampled by a limited number of phasor measurement units and smart meters. Both virtual-measurements and real-time measurements are assumed to have very small standard deviation \cite{Monticelli85}. Meanwhile, most of the load nodes in the distribution system do not have real-time measurements. To have an observable real-time DSSE problem, pseudo-measurements for load nodes are estimated from historical load data with very large standard deviation \cite{Ghosh1997}. \subsubsection{System States} System states are the set of parameters that can be used to determine all system parameters. In power system, the state variable $\bm{z}$ can be nodal complex voltage \cite{Baran1994}, branch complex current \cite{Baran1995} or nodal complex power injection \cite{zhou2020}. Accordingly, we have nodal-voltage based, branch-current based and power injection based DSSE \cite{Prima2017}. Both the nodal-voltage based and branch-current based DSSE can be formulated in polar and rectangular coordinate, while the power injection based DSSE is formulated in rectangular coordinate. The methods to solve the three categories of DSSE are as follow. Nodal-voltage-based DSSE directly applies the WLS method. Branch-current-based DSSE computes the equivalent current injection and updates residuals before applying WLS method, and updates nodal complex voltage through a forward sweep calculation after the WLS method in each iteration. See \cite{zhou2020} for the details of the algorithm of power injection based DSSE. \subsubsection{Weighted Least Squares} Weighted least squares (WLS) estimator is the most popular one among the existing DSSE methods. Based on the assumption that the measurement errors are independent random variables of normal distribution, WLS estimator can achieve the maximized joint probability distribution, or the weighted sum of squared residuals: \begin{eqnarray}\label{eq:WLS} &\underset{\bm{z}}{\min}& \frac{1}{2}(\bm{y}-\bm{h}(\bm{z}))^{\top}\mathbf{W} (\bm{y}-\bm{h}(\bm{z})), \end{eqnarray} where $\mathbf{W}=\text{diag} \{1/\sigma_1^2,\ldots,1/\sigma_m^2\}\in\mathbb{R}^{m\times m}$ is a diagonal weight matrix with the diagonal elements being the reciprocal of the variance of the corresponding measurement errors, reflecting the accuracy of the associated meters. Therefore, the real-time measurements and virtual measurements are assigned with small variance, while the pseudo-measurements are assigned with large variance. We therefore have the following assumption on observability of \eqref{eq:WLS}. \begin{assumption}\label{observable} The distribution system is fully observable. \end{assumption} Full observability of the distribution system can be achieved by using the power injection pseudo-measurements and virtual measurements. \subsection{Conventional Gauss-Newton Algorithm} To solve for WLS problem~\eqref{eq:WLS}, iterative Gauss-Newton (G-N) algorithm is usually applied based on solving its first-order optimality condition: \begin{align} -\mathbf{H}^{\top}\mathbf{W}\big(\bm{y}-\bm{h}(\bm{z})\big)=\bm{0}_{2n}, \label{FONC} \end{align} where $\mathbf{H} \in \mathbb{R}^{m \times 2n}$ denotes the Jacobian matrix of $\bm{h}(\bm{z})$ with respect to $\bm{z}$. Denote the state at the iteration $k$ by $\bm{z}(k)$ and the first-order Taylor series approximation of \eqref{FONC} around the state $\bm{z}(k)$ yields: \begin{eqnarray}\label{GN algorithm} \bm{z} (k+1)=\bm{z} (k)+\mathbf{G}^{-1}\mathbf{H}^{\top} \mathbf{W} \Big(\bm{y}-\bm{h}\big(\bm{z} (k)\big)\Big) \end{eqnarray} where $\mathbf{G}=\mathbf{H}^{\top}\mathbf{W}\mathbf{H}$ is defined as the gain matrix. $\bm{z} (k)$ is the solution vector at the $k$th iteration. \eqref{GN algorithm} is known as the iterative Gauss-Newton (G-N) algorithm. The algorithm is repeated until the stopping criterion is satisfied. \subsection{Motivation for Real-Time DSSE Development} We have so far discussed about the state estimation based on a single batch of the measurements, i.e., offline DSSE. In real-time operation, however, control center may receive temporal series of snapshots of measurements. To track the system states in real-time, the WLS problem \eqref{eq:WLS} is next reformulated for any time $t$ as: \begin{eqnarray}\label{eq:real-time WLS} &\underset{\bm{z}_t}{\min}& \frac{1}{2}(\bm{y}_t-\bm{h}(\bm{z}_t))^{\top}\mathbf{W}_t (\bm{y}_t-\bm{h}(\bm{z}_t)), \end{eqnarray} where $\bm{y}_t \in \mathbb{R}^{m}$, $\bm{z}_t \in \mathbb{R}^{2n}$, $\mathbf{W}_t\in \mathbb{R}^{m}$ denote the vector of measurements, state variables and weight matrix at time $t$. Similarly, we can implement the G-N algorithm to the real-time WLS problem for each time $t$. However in practice, when faster estimation is desired, we may not be able to finish computing all iterations at time $t$ given limited computation capability. More importantly, we may not obtain the whole batch of measurement $\bm{y}_t$ due to asynchronous measurement and communication delays, rendering the G-N updates slow or even infeasible. To address this issue, we will propose a new real-time DSSE paradigm based on stochastic gradient algorithm. \section{Solve Real-Time DSSE via Stochastic Gradient Descent}\label{SGD} One way to significantly improve the timeliness of the DSSE solvers is to take advantage of the asynchronous measurement data, instead of waiting for the whole batch of measurement data to start computation. However, the asynchronous measurements from heterogeneous measurement devices pose a challenge to the G-N algorithm, because the number of real-time measurements at each interval is less than the number of state variables and thus the G-N algorithm cannot be properly executed. To solve this issue, we propose a real-time SGD algorithm, which does not require the whole batch of measurement data for computation at each iteration, and guarantees provable performance. \subsection{Online Gradient Algorithm} We first propose a gradient algorithm which runs sufficient iterations until convergence for each $t$ to completely solve \eqref{eq:real-time WLS}: \begin{align}\label{eq: grad_LPF+Feedback} \bm{z}_t(k+1)=\bm{z}_{t}(k) - \epsilon \mathbf{H}^{\top} \mathbf{W}_t (\bm{h}(\bm{z}_{t}(k))-\bm{y}_t), \end{align} where $\epsilon$ is a constant stepsize and $\mathbf{H}^{\top} \mathbf{W}_t (\bm{h}(\bm{z}_{t}(k))-\bm{y}_t)$ is the gradient of \eqref{eq:real-time WLS} evaluated at $\bm{z}_{t}(k)$. Such gradient updates can be shown to converge to the solutions of \eqref{eq:real-time WLS} given small enough stepsize $\epsilon$ \cite{zhou2020}. In scenarios where we may only have time to run limited iterations from $t$ to $t+1$, e.g., 1 iteration for each $t$, we can hardly expect \eqref{eq: grad_LPF+Feedback} to converge in time. Therefore, we propose the following online gradient descent method for time slot $t$ with a constant stepsize $\epsilon$: \begin{align}\label{eq: r-t grad_LPF+Feedback} \bm{z}_{t} = \bm{z}_{t-1} - \epsilon \mathbf{H}^{\top} \mathbf{W}_t (\bm{h}(\bm{z}_{t-1})-\bm{y}_{t}). \end{align} Note that at each time $t$, the algorithm is initialized at $\bm{z}_{t-1}$ and the gradient is calculated based on the current measurement $\bm{y}_{t}$. We summarize the online gradient-based DSSE (GD) algorithm in Algorithm~\ref{alg:real-time GD}. \begin{algorithm}[h] \caption{Online Gradient Algorithm for DSSE} \begin{algorithmic}\label{alg:real-time GD} \STATE Estimator runs in real time with a constant stepsize $\eta$:\\ \REPEAT \STATE 1) Receive a whole batch of measurements $\bm{y}_t$.\\ \STATE 2) Update weight matrix $\mathbf{W}_t$ and evaluates measurement function $\bm{h}(\bm{z}_{t-1})$. \STATE 3) Update system states with gradient step \eqref{eq: r-t grad_LPF+Feedback}. \STATE 4) Move on to the next time step $t\leftarrow t+1$.\\ \UNTIL being ended. \end{algorithmic} \end{algorithm} \subsection{Stochastic Gradient Algorithm}\label{propose SGA} The scenario used in Algorithm~\ref{alg:real-time GD} is rather ideal, namely, we have assumed that a whole batch of measurement data can be obtained for gradient update at each time $t$. In practice, however, asynchronous measurement and communication delay and loss prevent us from collecting the entire batch of measurement in time. Assume that we only collect $m_t\leq m$ measurements at time $t$, rendering the standard gradient updates \eqref{eq: r-t grad_LPF+Feedback} incomplete. In order to avoid waiting for the entire batch of measurement to arrive and to provide timely updates of the system states, we propose to use stochastic gradient to update with available incomplete measurement data as follows: \begin{align}\label{eq:z_update_LPF_SGD} \bm{z}_t=\bm{z}_{t-1}-\epsilon \mathbf{H}^s_t(\bm{z}_{t-1})^{\top} \mathbf{W}^s_t (\bm{h}^s_{t}(\bm{z}_{t-1})-\bm{y}_t), \end{align} where $\bm{y}_t \in\mathbb{R}^{m_t}$ is the available measurement vector at time $t$, $\mathbf{W}^s_t \in \mathbb{R}^{m_t \times m_t}$ is the submatrix of the weight matrix corresponding to the available measurement, $\bm{h}^s_t(\bm{z}_{t-1}):\mathbb{R}^{2n}\rightarrow \mathbb{R}^{m_t}$ and $\mathbf{H}^s_t(\bm{z}_{t-1}) \in \mathbb{R}^{m_t \times 2n}$ denote the partial measurement functions and the measurement Jacobian matrix corresponding to the available measurements at time $t$ evaluated at $\bm{z}_{t-1}$. We execute dynamic~\eqref{eq:z_update_LPF_SGD} in real time to generate Algorithm~\ref{alg:r-t SGD}. The algorithm repeats the following two steps after the arrival of $m_t$ measurements. First, the estimator updates measurement Jacobian matrix, weight matrix and evaluates measurement residuals. Second, estimator updates state variables with one SGD step. \begin{algorithm}[h] \caption{Online SGD Algorithm for DSSE} \begin{algorithmic}\label{alg:r-t SGD} \STATE Estimator runs in real-time with a constant stepsize $\eta$:\\ \REPEAT \STATE 1) Receive a batch of measurements $\bm{y}_t$.\\ \STATE 2) Updates Jacobian matrix $\mathbf{H}_t^s $, weight matrix $\mathbf{W}_t^s$ and evaluates measurement function $\bm{h}^s_t(\bm{z}_{t-1})$. \STATE 3) Update system states with stochastic gradient step \eqref{eq:z_update_LPF_SGD} \STATE 4) Move on to the next time step $t\leftarrow t+1$.\\ \UNTIL being ended. \end{algorithmic} \end{algorithm} \subsection{Convergence Analysis}\label{convergence analysis} In this subsection, we will show the convergence of SGD algorithm~\eqref{eq:z_update_LPF_SGD} with a fixed stepsize. Because the (stochastic) gradient used in \eqref{eq:z_update_LPF_SGD} corresponds to a nonconvex optimization problem \eqref{eq:real-time WLS} whose optimality and gradient dynamics are difficult to characterize, for convergence analysis we use the convex counterpart of \eqref{eq:real-time WLS} by replacing the nonlinear function $\bm{h}$ with its linearization $\mathbf{H}$ as follows: \begin{eqnarray}\label{eq:real-time convex WLS} &\underset{\bm{z}_t}{\min}& \frac{1}{2}(\bm{y}_t-\mathbf{H} \cdot \bm{z}_t)^{\top}\mathbf{W}_t (\bm{y}_t-\mathbf{H} \cdot \bm{z}_t). \end{eqnarray} The gradient dynamics for solving \eqref{eq:real-time convex WLS} is written as: \begin{align}\label{eq:z_update_LPF} \bm{z}_t=\bm{z}_{t-1}-\epsilon \mathbf{H}^{\top} \mathbf{W}_t (\mathbf{H}\cdot\bm{z}_{t-1}-\bm{y}_t), \end{align} which can be proved to converge asympototically to the solution of \eqref{eq:real-time convex WLS}. For ease of expression, we use the notations defined in the following table in our proof. \begin{table}[htbp] \normalsize \begin{center} \caption{Nomenclature} \begin{tabular}{l l} \cline{1-2} \hline $f(\bm{z}_t)$ & gradient of \eqref{eq:real-time convex WLS}: $\mathbf{H}^{\top} \mathbf{W}_t (\mathbf{H}\cdot\bm{z}_{t-1}-\bm{y}_t)$;\\ $\tilde{f}(\bm{z}_t)$ & gradient in \eqref{eq: r-t grad_LPF+Feedback}: $\mathbf{H}^{\top} \mathbf{W}_t (\bm{h}(\bm{z}_{t-1})-\bm{y}_{t})$;\\ $f_t(\bm{z}_t;\bm{\xi}_t)$ & stochastic gradient of \eqref{eq:real-time convex WLS}:\\ &$\mathbf{H}^s_t(\bm{z}_{t-1})^{\top} \mathbf{W}^s_t (\mathbf{H}^s_t \cdot\bm{z}_{t-1}-\bm{y}_t)$;\\ $\tilde{f}_t(\bm{z}_t;\bm{\xi}_t)$ & stochastic gradient in \eqref{eq:z_update_LPF_SGD}:\\ &$\mathbf{H}^s_t(\bm{z}_{t-1})^{\top} \mathbf{W}^s_t (\bm{h}^s_{t}(\bm{z}_{t-1})-\bm{y}_t)$;\\ $\bm{z}^*_t$ &optimal solution of \eqref{eq:real-time convex WLS};\\ $\tilde{\bm{z}}^*_t$ & optimal solution of \eqref{eq:real-time WLS}.\\ \hline \end{tabular} \label{NOMENCLATURE} \end{center} \end{table} We proceed with the following reasonable assumptions for analytical characterization. \begin{assumption}\label{A1} The discrepancy between the gradient of \eqref{eq:real-time convex WLS} and the gradient in \eqref{eq: r-t grad_LPF+Feedback} is bounded for any feasible $\bm{z}$. Consequently, we have \begin{eqnarray} \|\tilde{f}(\bm{z};\xi)-f(\bm{z};\xi)\|^2\leq \Delta_1,\ \forall t.\label{eq:delta2} \end{eqnarray} where $f(\bm{z};\xi)$ and $\tilde{f}(\bm{z};\xi)$ denote the stochastic gradients of \eqref{eq:real-time convex WLS} and \eqref{eq:real-time WLS}, respectively. $\xi$ denotes the randomness introduced by the SGD algorithm. \end{assumption} \begin{assumption}\label{A2} The expected value of the squared $L2$ norm for the stochastic gradient is bounded for any feasible $\bm{z}$. As a result, we have \begin{eqnarray} \mathbb{E}[\|f(\bm{z};\xi)\|^2]\leq \sigma_f^2.\label{eq:sigma_g} \end{eqnarray} \end{assumption} \begin{assumption}\label{A3} The difference of the optimal solutions of \eqref{eq:real-time convex WLS} between two consecutive time slots is bounded, \begin{eqnarray} &\|\bm{z}_{t+1}^*-\bm{z}_{t}^*\| \leq \Delta_{\bm{z}}, \forall t.\label{eq:delta1} \end{eqnarray} \end{assumption} \begin{assumption}\label{A4} The discrepancy between $\tilde{\bm{z}}_t^*$, the optimal solution of \eqref{eq:real-time WLS}, and $\bm{z}_t^*$, the optimal solution of \eqref{eq:real-time convex WLS}, is very small. \end{assumption} Under the Assumption~\ref{observable}, the gain matrix $\mathbf{H}^{\top} \mathbf{W}_t \mathbf{H}$ is positive definite given the complete measurements. As the gain matrix is the Hessian matrix of \eqref{eq:real-time convex WLS}, the optimization problem \eqref{eq:real-time convex WLS} is strongly convex. Denotes by $\tau_t$ the smallest eigenvalue of the gain matrix $\mathbf{H}^{\top} \mathbf{W}_t \mathbf{H}$ for notational simplicity, and we have the following lemma. \begin{lemma} For any feasible $\bm{z}_t$ and $\bm{z}'_t$, one has: \begin{align}\label{eq:B1} &\big(f(\bm{z}_t)-f(\bm{z}'_t)\big)^{\top}(\bm{z}_t-\bm{z}'_t) \geq \tau_t \|\bm{z}_t-\bm{z}'_t\|^2\geq \tau_1 \|\bm{z}_t-\bm{z}'_t\|^2, \end{align} where denote by $\tau_1$ the lower bound of the smallest eigenvalue of any gain matrix. \end{lemma} \begin{lemma}[Unbiased Estimation \cite{2018Bottou}]\label{lem:unbiased estimate} Stochastic gradient $f(\bm{z};\xi_t)$ is an unbiased estimate of the full gradient $f(\bm{z})$ given $\{\xi_1, \xi_2, ..., \xi_{t-1}\}$, i.e., \begin{eqnarray}\label{eq:ue} \mathbb{E}[f(\bm{z};\xi_t)|\xi_1, ..., \xi_{t-1}]=f(\bm{z}). \end{eqnarray} \end{lemma} Denote by $\eta$ the constant stepsize of the SGD algorithm, and we have the following theorem. \begin{theorem}[Convergence]\label{the:convergence} Under the Assumptions~\ref{observable}--\ref{A4}, if the constant stepsize satisfies $0<\eta \leq\frac{1}{2 \tau_1}$, then the proposed algorithm achieves: \begin{eqnarray}\label{eq:convergence} \lim_{t \rightarrow \infty}\mathbb{E}[\|\bm{z}_{t}^*-\bm{z}_t\|^2]= \frac{\eta^2 \sigma_f^2+\eta^2 \Delta_1+\Delta_{\bm{z}}}{2\eta \tau_1}, \end{eqnarray} where $\bm{z}_{t}^*$ and $\bm{z}_{t}$ denote the optimal solution of \eqref{eq:real-time convex WLS} and the one obtained via the proposed online SGD algorithm at time $t$. \end{theorem} \begin{proof} From the SGD algorithm, we have \begin{align}\label{derivation1:bound_FbSGDvsNoFbGD} &\|\bm{z}_{t+1}-\bm{z}_{t+1}^*\|^2\nonumber\\ =&\|\bm{z}_{t+1}-\bm{z}_{t}^*-(\bm{z}_{t+1}^*-\bm{z}_{t}^*)\|^2\nonumber\\ \leq&\|\bm{z}_t-\eta \tilde{f}(\bm{z}_t;\xi_t)-\bm{z}_{t}^*-(\bm{z}_{t+1}^*-\bm{z}_{t}^*)\|^2\nonumber\\ \leq& \|\bm{z}_t-\eta \tilde{f}(\bm{z}_t;\xi_t)-\bm{z}_{t}^*\|^2+\|\bm{z}_{t+1}^*-\bm{z}_{t}^*\|^2\nonumber\\ =&\|\bm{z}_t-\bm{z}_{t}^*-\eta f(\bm{z}_t;\xi_t)+\eta f(\bm{z}_t;\xi_t)-\eta \tilde{f}(\bm{z}_t;\xi_t)\|^2\nonumber\\ &+\|\bm{z}_{t+1}^*-\bm{z}_{t}^*\|^2\nonumber\\ \leq& \|\bm{z}_t-\bm{z}_{t}^*-\eta f(\bm{z}_t;\xi_t)\|^2\nonumber\\ +&\eta^2 \| f(\bm{z}_t;\xi_t)- \tilde{f}(\bm{z}_t;\xi_t)\|^2+\|\bm{z}_{t+1}^*-\bm{z}_{t}^*\|^2\nonumber\\ =&\|\bm{z}_t-\bm{z}_{t}^*\|^2+\eta^2 \| f(\bm{z}_t;\xi_t)\|^2\nonumber\\ &-2\eta (\bm{z}_t-\bm{z}_{t}^*)^{\top} f(z_t;\xi_t)\nonumber\\ &+\eta^2 \| f(\bm{z}_t;\xi_t)- \tilde{f}(\bm{z}_t;\xi_t)\|^2+\|\bm{z}_{t+1}^*-\bm{z}_{t}^*\|^2 \end{align} The first inequality comes from the nonexpansiveness of projection operation, the second and the third from the triangle inequality of the norm. Taking expectation on both sides of \eqref{derivation1:bound_FbSGDvsNoFbGD} gives: \begin{align}\label{eq: exp-1} &\mathbb{E}[\|\bm{z}_{t+1} -\bm{z}_{t+1}^*\|^2]\nonumber\\ \leq& \mathbb{E}[\|\bm{z}_t-\bm{z}_{t}^*\|^2]+\eta^2 \mathbb{E}[\| f(\bm{z}_t;\xi_t)\|^2]\nonumber\\ &-2\eta \mathbb{E}[(\bm{z}_t-\bm{z}_{t}^*)^{\top} f(z_t;\xi_t)]\nonumber\\ &+\eta^2 \mathbb{E}[\| f(\bm{z}_t;\xi_t)- \tilde{f}(\bm{z}_t;\xi_t)\|^2]+\|\bm{z}_{t+1}^*-\bm{z}_{t}^*\|^2\nonumber\\ =& \mathbb{E}[\|\bm{z}_t-\bm{z}_{t}^*\|^2]+\eta^2 \sigma_f^2-2\eta \mathbb{E}[(\bm{z}_t-\bm{z}_{t}^*)^{\top} f(z_t))]\nonumber\\ &+\eta^2 \Delta_1^2+ \Delta_{\bm{z}} \end{align} where the first equality comes from \eqref{eq:sigma_g}, \eqref{eq:delta2}, \eqref{eq:delta1}. The third term of RHS of the first equality can be expressed by the unbiased estimate as follows, \begin{align}\label{eq:unbais estimate} & 2\eta \mathbb{E}[(\bm{z}_t-\bm{z}_{t}^*)^{\top} f(z_t,\xi_t)]\nonumber\\ =& 2\eta \mathbb{E}[\mathbb{E}[(\bm{z}_t-\bm{z}_{t}^*)^{\top} f(z_t,\xi_t)|\xi_1, \xi_2, ..., \xi_{t-1}]]\nonumber\\ =& 2\eta \mathbb{E}[(\bm{z}_t-\bm{z}_{t}^*)^{\top} \mathbb{E}[f(z_t,\xi_t)|\xi_1, \xi_2, ..., \xi_{t-1}]]\nonumber\\ =& 2\eta \mathbb{E}[(\bm{z}_t-\bm{z}_{t}^*)^{\top} f(z_t)] \end{align} We substitute RHS of \eqref{eq:unbais estimate} for $2\eta \mathbb{E}[(\bm{z}_t-\bm{z}_{t}^*)^{\top} f(z_t)]$ into \eqref{eq: exp-1} to obtain, \begin{align} &\mathbb{E}[\|\bm{z}_{t+1} -\bm{z}_{t+1}^*\|^2]\nonumber\\ =& \mathbb{E}[\|\bm{z}_t-\bm{z}_{t}^*\|^2]+\eta^2 \sigma_f^2-2\eta \mathbb{E}[(\bm{z}_t-\bm{z}_{t}^*)^{\top} f(z_t))]\nonumber\\ &+\eta^2 \Delta_1^2+ \Delta_{\bm{z}}\nonumber\\ \leq & \mathbb{E}[\|\bm{z}_t-\bm{z}_{t}^*\|^2]+\eta^2 \sigma_f^2-2\eta \tau_1 \mathbb{E}[\|\bm{z}_t-\bm{z}_{t}^*\|^2]\nonumber\\ &+\eta^2 \Delta_1^2+ \Delta_{\bm{z}}\nonumber\\ =& (1-2\eta \tau_1) \mathbb{E}[\|\bm{z}_1-\bm{z}_1^*\|^2] +(\eta^2 \sigma_f^2 +\eta^2 \Delta_1+\Delta_{\bm{z}})\nonumber\\ \leq& (1-2\eta \tau_1)^t \mathbb{E}[\|\bm{z}_1-\bm{z}_1^*\|^2]\nonumber\\ &+\frac{1-(1-2\eta \tau_1)^t}{2\eta \tau_1} (\eta^2 \sigma_f^2 +\eta^2 \Delta_1+\Delta_{\bm{z}}) \end{align} where the first inequality comes from \eqref{eq:B1} and the second inequality is obtained by repeating all the previous steps for $t$ times. For $0<\eta\leq \frac{1}{2\tau_1}$, one has $0 \le 1-2\eta \tau_1<1$, so \eqref{eq:convergence} follows. \end{proof} \subsection{Power Injection Based DSSE}\label{algorithm implementation} The modern distribution system will features a lot of zero injection nodes. The power injection measurements of these nodes are accurate, so their weights will be infinite or set very large values for the nodal-voltage based DSSE method. It brings in numerical issue. To circumvent such a problem, the branch-current based DSSE \cite{Baran1995} and power injection based DSSE \cite{zhou2020} are proposed. Based on the numerical study, both approaches achieve similar estimation accuracy, but the latter approach is more efficient. Therefore, we adopt the formulation of the latter approach in this paper. We select nodal power injection $[\bm{p}^{\top}, \bm{q}^{\top}]^{\top}$ for all nodes as the state variables $\bm{z}$. Denote by $\hat{v}_{i,t}$ voltage magnitude measurement for any node $i$ collected in the set ${\cal M}^v_t$ and by $(\hat{p}_{i,t}, \hat{q}_{i,t})$ load pseudo-measurement for any node $i$ collected in the load set ${\cal N}^l$. Then problem~\eqref{eq:real-time WLS} is reformulated as: \begin{subequations}\label{eq:set} \begin{eqnarray} &\hspace{-9mm}\underset{\bm{p}_t,\bm{q}_t}{\min}&\hspace{-5mm}\sum_{i\in{\cal N}^l}\hspace{-2mm}\Big(\frac{\hspace{-0.1mm}(p_{i,t}-\hat{p}_{i,t})^2}{2\sigma_{p_i}^2}\hspace{-1mm}+\hspace{-1mm}\frac{(q_{i,t}-\hat{q}_{i,t})^2}{2\sigma_{q_i}^2}\hspace{-0.1mm}\Big)\hspace{-1mm}+\hspace{-3mm}\sum_{i\in{\cal M}^v}\hspace{-2mm}\frac{(v_{i,t}-\hat{v}_{i,t})^2}{2\sigma_{v_i}^2},\label{eq:WLSt}\\ &\hspace{-9mm}\text{s.t.}& \hspace{-2mm}\bm{v}_t=\bm{g}(\bm{p}_t,\bm{q}_t),\label{eq:voltaget}\\ &\hspace{-9mm}&\hspace{-2mm} (\bm{p}_t,\bm{q}_t)\in\bm{\Omega}_t,\label{eq:Omegat} \end{eqnarray} \end{subequations} where $\bm{g}$ denotes the nonlinear power flow equations, and $\bm{\Omega}_t =\Cross_{i\in{\cal N}} {\Omega}_{i,t}$ with $\Omega_{i,t}=\mathbb{R}^2, \forall i\in{\cal N}^l$ for pseudo-measurement and $\Omega_{i,t}=\{0,0\},\forall i\in{\cal N}\backslash{\cal N}^l$ for virtual measurement. Virtual measurements are zero power injections of the nodes without any load. These measurements are accurate, so we assign state variables of the nodes without any load zero. The proposed stochastic gradient algorithm is implemented as follows: \begin{subequations}\label{eq:SGD} \begin{align} &p_{i,t+1}=p_{i,t}-\epsilon\Big(\sum_{j\in{\cal M}^v_t}\frac{\partial v_j}{\partial p_i} \frac{(v_{j,t}-\hat{v}_{j,t})}{\sigma^2_{v_j}}+\frac{\big(p_{i,t}-\hat{p}_{i,t}\big)}{\sigma^2_{p_i}}\Big),\nonumber\\ & \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad i\in{\cal N}^l,\\ &q_{i,t+1}=q_{i,t}-\epsilon\Big(\sum_{j\in{\cal M}^v_t}\frac{\partial v_j}{\partial p_i} \frac{(v_{j,t}-\hat{v}_{j,t})}{\sigma^2_{v_j}}+\frac{\big(q_{i,t}-\hat{q}_{i,t} \big)^2}{\sigma^2_{q_i}}\Big),\nonumber\\ & \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad i\in{\cal N}^l,\label{eq:multiq}\\ &(p_{i,t+1},q_{i,t+1}) \in \{0,0\},\qquad \qquad \qquad \forall i\in{\cal N}\backslash{\cal N}^l, \label{eq:multip_vir}\\ &\bm{v}_{t+1}=\bm{g}(\bm{p}_{t+1},\bm{q}_{t+1}),\label{eq:v update} \end{align} \end{subequations} where ${\cal M}^v_t\subseteq {\cal M}^v$ denotes the subset of nodes whose real-time measurements of voltage magnitude are received by the control center at time $t$. There is no explicit expression of function $\bm{g}$. Hence, we estimate the voltage magnitude in \eqref{eq:v update} with the power flow solution calculated by OpenDSS given the updated power injection for each $t$. As a specific case of \eqref{eq:z_update_LPF_SGD}, dynamics~\eqref{eq:SGD} follows the same convergence property as described in Theorem~\ref{the:convergence}. \section{Simulation Results}\label{Simulation} \subsection{Simulation Setup} The numerical performance of the proposed online SGD algorithm is compared with the online GD algorithm \eqref{eq: grad_LPF+Feedback}, denoted by GD, and \eqref{eq: r-t grad_LPF+Feedback}, denoted by GO, on a unbalance three-phase IEEE-123 bus feeder. We use the realistic load and solar irridiance data from feeders in Anatolia, California on a day of August in 2012. The data is of an one-second resolution\cite{Bank13} from 6 a.m. to 6 p.m., amounting to 43,200 successive scenarios; see Fig.~\ref{fig:Real-time PV+Load Data} for the real power injection of PV and load profile of one node. Measurements are obtained by adding Gaussian noise of normal distribution to the true power flow solution solved via OpenDss. We randomly place voltage meters on $12\%$ of all the nodes. The standard deviations of the $29$ voltage measurements are $0.01$ p.u. All the load nodes have pseudo-measurements with $50\%$ error \cite{Yao2019, Marco13}. At each second, only one voltage magnitude and three pairs of power injection measurements are sent to the estimator. All the simulations are conducted on an HP ENVY NOTEBOOK with processor Intel®Core (TM) i7-6500CPU 2.5 GHz, RAM 8.0 GB and 64-bit operating system, running Matlab R2016a on Windows 10 Home Version. \begin{figure}[htbp] \centerline{\includegraphics[width=.5\textwidth]{Real-timePV+LoadData.jpg}} \caption{Real-time PV (upper) and load profile (lower) with 1 second temporal granularity.} \label{fig:Real-time PV+Load Data} \end{figure} \subsection{Numerical Tests} \subsubsection{Tracking the fast changing system states} We present the true voltage magnitude of a randomly selected node and its estimation via the proposed SGD scheme and online GD algorithms at every second in Fig.~\ref{fig:Real-time Voltage Estimation}, where the blue curve represent the true voltage magnitude, while the yellow, purple and red dash curves represent the estimation voltages via GO, GD and SGD algorithms. In the plot, most of the blue curve is covered by the yellow curve, which implies that GO algorithm can track fast changing states very well. The accuracy is due to the complete access to the real-time measurements. The small mismatches between the blue and red curves validate that the SGD algorithm can track the voltage magnitudes accurately in real-time DSSE. \begin{figure}[htbp] \centerline{\includegraphics[width=.52\textwidth]{Real-timeVoltageEstimation+ZoomIn_Profile_thick.png}} \caption{Comparison of the voltage estimation updated by the online stochastic gradient and gradient algorithms.} \label{fig:Real-time Voltage Estimation} \end{figure} \subsubsection{Stability}\label{prove convergence} The real-time average error of the voltage estimation is presented in Fig.~\ref{fig:running ave of Vm error}, where the blue, red and yellow lines represent the voltage estimation errors of SGD, GD and GO algorithms. The average error of voltage estimation for GO is less than that of SGD and GD. In a lot of cases, the averge error of voltage estimation of GD is smaller than SGD as it accesses to all the available real-time measurements at every second with the requirement of synchronizing all the measurement devices. However, the SGD does not need the requirement, and its average error is less than $1\%$ for most of the samples during the $12$-hour interval. \begin{figure}[htbp] \centerline{\includegraphics[width=.5\textwidth]{Real-timeAveErrorofVm.jpg}} \caption{Real-time average error of the voltage estimation for SGD, GD and GO at every second.} \label{fig:running ave of Vm error} \end{figure} \subsubsection{Accuracy and Computation Time} In this subsection, we compare three aspects of the numerical results of SGD, GD and GO as follows: 1) the average computation time, 2) the average estimation error of the voltage magnitude per node, and 3) the average of the maximum estimation error of the voltage magnitude per sample. The comparison is presented in Table~\ref{Comparison btw SGD and GD}. The second row of the table presents the results of SGD. As we can see, the average error per node is $2 e^{-3}$ p.u., and the average maximal error per scenario is $5.3 e^{-3}$ p.u.. Both errors are less than $1\%$, and very close to the errors of GD and GO. The result shows that the proposed SGD-based DSSE algorithm achieves accurate voltage estimation. The average computation time of SGD per iteration is $1.8 e^{-3}$ seconds, much less than $1$ second. Therefore, the accuracy and efficiency of the proposed SGD-based algorithm enables DSSE to handle a system featured with fast changing states with the asynchronous measurements in real-time. \begin{table}[!ht] \begin{center} \caption{Computation Time and Estimation Errors of voltage magnitudes.} \begin{tabular}{c c c c} \dtoprule & {\textbf{Ave. Time (s)}} & {\textbf{Ave. Error (p.u.)}} & {\textbf{Ave. Max. Error (p.u.)}} \\ \hline \textbf{SGD} & $1.80e-03$ & $3.0e-03$ & $6.3e-03$\\ \textbf{GD} & $1.80e-03$ & $1.7e-03$ & $4.3e-03$\\ \textbf{GO} & $0.17$ & $1.1e-03$ & $2.8e-03$\\ \dbottomrule \end{tabular} \label{Comparison btw SGD and GD} \end{center} \end{table} \section{Conclusion}\label{conclusion} We have proposed an SGD-based real-time DSSE algorithm to process data stream of asynchronous measurements. The convergence analysis of the proposed algorithm has been established. The algorithm has been tested in an unbalanced three-phase IEEE-123 bus system under realistic solar and load data to effectively and accurately track fast-changing system states with asynchronous measurements. \nocite{*} \bibliographystyle{IEEEtran}
\section[Matched Uncertainty]{Adaptive Control for Systems with Matched Uncertainty} \begin{frame}[allowframebreaks] \frametitle{Adaptive Control for Systems with Matched Uncertainty} Let's start from a case where the matched uncertainty condition holds: \begin{align} \dot{x} =& f(x)+B(x)(u-\varphi(x,u)^T\theta) \end{align} \begin{itemize} \item Note that $f(x)$ and $B(x)$ can be viewed as a system with a \underline{fixed} nominal parameters $\theta$: $f(x;\theta_n)$ and $B(x;\theta_n)$. \item In this section, we assume we have a controller that stabilizes the system for this \underline{fixed} parameter $\theta_n$ \item Later we construct a controller that also adaptively updates $\theta_n$ in $f(x;\theta_n)$ and $B(x;\theta_n)$ to remove the matched uncertainty condition \end{itemize} Let $u$ be designed as ($M$ is the neural contraction metric for the \underline{fixed} $\theta_n$) \begin{align} u =& -B(x)^TM(x)x+\varphi(x)^T\hat{\theta} \\ \dot{\hat{\theta}} =& -\Gamma \varphi(x)B(x)^TM(x)x. \end{align} Then we have the following combined system ($\tilde{\theta}=\hat{\theta}-\theta$): \begin{align} \frac{d}{dt}\begin{bmatrix}x \\ \tilde{\theta}\end{bmatrix} = \begin{bmatrix}A(x)-B(x)B(x)^TM(x) & B(x)\varphi(x)^T\\ -\Gamma \varphi(x)B(x)^TM(x) & 0\end{bmatrix}\begin{bmatrix}x \\ \tilde{\theta}\end{bmatrix} \end{align} Let $V = \delta q^T\begin{bmatrix}M(x) & 0 \\0 & \Gamma^{-1}\end{bmatrix}\delta q$. Then we have \begin{align} \dot{V} = \begin{bmatrix}x \\ \tilde{\theta}\end{bmatrix}^T\begin{bmatrix}MA+A^TM-MBB^TM & 0 \\0 & 0\end{bmatrix}\begin{bmatrix}x \\ \tilde{\theta}\end{bmatrix} \leq -2 \alpha\begin{bmatrix}x \\ \tilde{\theta}\end{bmatrix}^T\begin{bmatrix}M & 0 \\0 & 0\end{bmatrix}\begin{bmatrix}x \\ \tilde{\theta}\end{bmatrix} \end{align} This implies asymptotic stability. \end{frame} \section[aNCM]{Adaptive NCM} \begin{frame}[allowframebreaks] \frametitle{Adaptive NCM} Consider the following system: \begin{align} \label{adaptive_system} \dot{x}(t) =& f(x,\theta)+B(x,\theta)u \end{align} where $\theta\in\mathbb{R}^{p}$ are unknown system parameters and we estimate $\theta$ by $\hat{\theta}:\mathbb{R}_{\geq0}\to\mathbb{R}^{p}$. \begin{itemize} \item In this section, we try to design an adaptive NCM, which depends on the time varying parameter estimate $\hat{\theta}$ without assuming that it is fixed \end{itemize} Let $B(x,\theta)=[b_1(x,\theta),\cdots,b_m(x,\theta)]$. Suppose that there exist $Y_f(x)$ and $Y_{b_i}(x),\forall i$ s.t.{} \begin{align} \label{linear_adaptive} Y_f(x)\theta =& f(x,\theta) \\ \label{linear_adaptive2} Y_{b_i}(x)\theta =& b_i(x,\theta). \end{align} \begin{itemize} \item Note that the conditions (\ref{linear_adaptive}) and (\ref{linear_adaptive2}) are not strict in a sense that we can always over-parameterize the system \item The adaptive control with the Bregman divergence will give us some insight on the implicit regularization on these parameters, which could circumvent the issue of overfitting \item For example $f(x,\theta) = x_1\theta+x_3^2\theta^2+x_2^3\cos\theta$ can be expressed as \begin{align} f(x,\theta) = [x_1~x_3^2~x_2^3]\begin{bmatrix}\theta_{\max} & 0 & 0\\0 & \theta_{\max}^2 & 0 \\ 0 & 0 & 1\end{bmatrix}\begin{bmatrix}\theta/\theta_{\max}\\\theta^2/\theta_{\max}^2\\ \cos\theta\end{bmatrix} \end{align} so we can use $\bar{\theta} = [\theta/\theta_{\max}~\theta^2/\theta_{\max}^2~\cos\theta]^T$ \end{itemize} Now, (\ref{adaptive_system}) can be rewritten as \begin{align} \dot{x} = f(x,\hat{\theta})+B(x,\hat{\theta})u(x,\hat{\theta})-\left(Y_f(x)+\sum_{i=1}^mY_{b_i}(x)u_i(x,\hat{\theta})\right)\tilde{\theta}. \end{align} Thus we define the adaptation law and controller as follows: \begin{align} \dot{\hat{\theta}} =& (\nabla^2\psi(\hat{\theta}))^{-1}\left(Y_f(x)+\sum_{i=1}^mY_{b_i}(x)u_i(x,\hat{\theta})\right)^T\left(\frac{1}{2}\begin{bmatrix}\frac{\partial M}{\partial x_1}x & \cdots & \frac{\partial M}{\partial x_n}x \end{bmatrix}^T+M(x,\hat{\theta})\right) x \\ u =& -B(x,\hat{\theta})^TM(x,\hat{\theta})x \end{align} where $\psi$ is a given convex function and $M(x,\hat{\theta})$ is the adaptive NCM which satisfies the following constraint for all $x$ and $\hat{\theta}$: \begin{align} &\Xi(x,\hat{\theta})+2\sym(M(x,\hat{\theta})A(x,\hat{\theta}))-2M(x,\hat{\theta})B(x,\hat{\theta})B(x,\hat{\theta})^TM(x,\hat{\theta}) \preceq -2\alpha M(x,\hat{\theta}) \\ &\Xi(x,\hat{\theta}) = \begin{bmatrix}\frac{\partial M}{\partial x_1}x & \cdots & \frac{\partial M}{\partial x_n}x \end{bmatrix}(A(x,\hat{\theta})-B(x,\hat{\theta})B(x,\hat{\theta})^TM(x,\hat{\theta}))+\sum_{i=1}^k\frac{\partial M}{\partial \hat{\theta}_i}\dot{\hat{\theta}}_i \end{align} \begin{itemize} \item Note that we have \begin{align} x^T\dot{M}(x,\hat{\theta})x =& x^T\left(\sum_{i=1}^n\frac{\partial M}{\partial x_i}\dot{x}_i+\sum_{i=1}^k\frac{\partial M}{\partial \hat{\theta}_i}\dot{\hat{\theta}}_i\right)x \\ =& x^T\begin{bmatrix}\frac{\partial M}{\partial x_1}x & \cdots & \frac{\partial M}{\partial x_n}x \end{bmatrix}\dot{x}+x^T\sum_{i=1}^k\frac{\partial M}{\partial \hat{\theta}_i}\dot{\hat{\theta}}_ix \end{align} \item and \begin{align} \dot{x} = (A(x,\hat{\theta})-B(x,\hat{\theta})B(x,\hat{\theta})^TM(x,\hat{\theta}))x-\left(Y_f(x)+\sum_{i=1}^mY_{b_i}(x)u_i(x,\hat{\theta})\right)\tilde{\theta} \end{align} \item which leads to the asymptotic stability \end{itemize} \end{frame} \section[Stability]{Stability Analysis} \begin{frame}[allowframebreaks] \frametitle{Stability Analysis} Let \begin{align} A_{cl}(x,\hat{\theta}) =& A(x,\hat{\theta})-B(x,\hat{\theta})B(x,\hat{\theta})^TM(x,\hat{\theta}) \\ Y(x,\hat{\theta}) =& Y_f(x)+\sum_{i=1}^mY_{b_i}(x)u_i(x,\hat{\theta}) \\ dM_x(x,\hat{\theta}) =& \begin{bmatrix}\frac{\partial M}{\partial x_1}x & \cdots & \frac{\partial M}{\partial x_n}x \end{bmatrix} \\ \Xi(x,\hat{\theta}) =& \sum_{i=1}^ndM_x(x,\hat{\theta})(A(x,\hat{\theta})-B(x,\hat{\theta})B(x,\hat{\theta})^TM(x,\hat{\theta}))+\sum_{i=1}^k\frac{\partial M}{\partial \hat{\theta}_i}\dot{\hat{\theta}}_i \end{align} Then the combined system can be written as \begin{align} \begin{bmatrix}\dot{x} \\ \dot{\tilde{\theta}}\end{bmatrix} = \begin{bmatrix}A_{cl}(x,,\hat{\theta}) & -Y(x,\hat{\theta}) \\(\nabla^2\psi(\hat{\theta}))^{-1}Y(x,\hat{\theta})^T(dM_x(x,\hat{\theta})^T/2+M(x,\hat{\theta})) & 0\end{bmatrix}\begin{bmatrix}x \\ \tilde{\theta}\end{bmatrix}. \end{align} Let $V=x^T M(x,\hat{\theta}) x+2d_{\psi}(\theta\|\hat{\theta})$, where $d_{\psi}(\theta\|\hat{\theta})$ is the Bregman divergence $d_{\psi}(\theta\|\hat{\theta})=\psi(\theta)-\psi(\hat{\theta})+(\hat{\theta}-\theta)^T\nabla\psi(\hat{\theta})$. Then we have \begin{align} \dot{V} =& x^T(\dot{M}(x,\hat{\theta})+2(x,\hat{\theta})MA_{cl}(x,\hat{\theta}))x-2x^TM(x,\hat{\theta})Y(x,\hat{\theta})\tilde{\theta} \\ &+2\tilde{\theta}^T\nabla^2\psi(\hat{\theta})(\nabla^2\psi(\hat{\theta}))^{-1}Y(x,\hat{\theta})^T(dM_x(x,\hat{\theta})/2+M(x,\hat{\theta}))x \\ =&x^T(\dot{M}+2MA_{cl})x+\tilde{\theta}^TY^TdM_x^Tx \end{align} Using $x^T\dot{M}x=x^TdM_x(A_{cl}(x,\hat{\theta})x-Y(x,\hat{\theta})\tilde{\theta})+x^T\sum_{i=1}^k\frac{\partial M}{\partial \hat{\theta}_i}\dot{\hat{\theta}}_ix$, we have \begin{align} x^T(\Xi+2\sym(MA)-2MBB^TM)x \leq -2 \alpha x^TMx \end{align} which implies asymptotic stability. \end{frame} \section[Remarks]{Remarks} \begin{frame}[allowframebreaks] \frametitle{Remarks} \begin{itemize} \item The contraction constraint depends both on $x$ and $\hat{\theta}$, and $\dot{M}$ makes the problem non-convex, here are several ideas \begin{enumerate} \item Use $M(x)$ instead of $M(x,\hat{\theta})$ (conservative) \item Use $M(t)$ when sampling and use $M(x,\theta)$ when modeling by a neural network \item Bound $\frac{\partial M}{\partial x_i}$ and $\frac{\partial M}{\partial \hat{\theta}_i}$ by spectral normalization and solve conservative convex optimization \item Or we could directly model $M$ as a neural net in the first place and learn $M$ by SGD with the contraction constraint \end{enumerate} \item Also, the NCM only approximately satisfy the contraction constraint. Thus, instead of using it as $u = -B^TMx$, use it as a CLF and solve the following QP at current $x$ and $\hat{\theta}$: \begin{align} u =& \text{arg}\min_{u} \|u\|^2 \\ &\text{s.t.{} }x^TdM_x(x,\hat{\theta})(f(x,\hat{\theta})+B(x,\hat{\theta})u)+x^T\sym{}(MA)x+x^TMBu \end{align} \end{itemize} \end{frame} \section[Parameter]{Parameter Convergence} \begin{frame}[allowframebreaks] \frametitle{Parameter Convergence} Let $\theta$ be any parameter and $A=\{\theta |Y(x,x_d,t,\hat{a})\theta=Y(x,x_d,t,\hat{a})a,\forall t\}$. Since we have \begin{align} \frac{d}{dt}d_{\psi}(\theta\|\hat{a}) = (\hat{a}-\theta)^T\nabla^2\psi(\hat{a})(-(\nabla^2\psi(\hat{a}))^{-1}Y^TMe) = (\hat{a}-\theta)^TY^TMe \end{align} integrating this from $0$ to $t$ yields \begin{align} &d_{\psi}(\theta\|\hat{a}(t))-d_{\psi}(\theta\|\hat{a}(0))=\nonumber\\ &\int^t_0(\hat{a}(\tau)-\theta)^TY(x(\tau),x_d(\tau),\tau,\hat{a}(\tau))^TM(x(\tau),x_d(\tau),\tau,\hat{a}(\tau))e(\tau)d\tau. \end{align} Assume that $a^*=\lim_{t\to \infty}\hat{a}(t)\in A$ and $\theta\in A$. Then \begin{align} \label{params_integral} &d_{\psi}(\theta\|a^*)-d_{\psi}(\theta\|\hat{a}(0))=\nonumber\\ &\int^\infty_0(\hat{a}(\tau)-a)^TY(x(\tau),x_d(\tau),\tau,\hat{a}(\tau))^TM(x(\tau),x_d(\tau),\tau,\hat{a}(\tau))e(\tau)d\tau. \end{align} Since the right hand side does not depend on $\theta$, we have \begin{align} a^*=\text{arg}\min_{\theta\in A}d_{\psi}(\theta\|a^*)=\text{arg}\min_{\theta\in A}d_{\psi}(\theta\|\hat{a}(0)) \end{align} When we select $\hat{a}(0)=\text{arg}\min_{b\in \mathbb{R}^p}\psi(b)$ ($\Rightarrow \nabla\psi(\hat{a}(0))=0$ as $\psi$ is convex), we have \begin{align} a^*=\text{arg}\min_{\theta\in A}\psi(\theta). \end{align} \end{frame} \section[Disturbance]{Disturbance Analysis} \begin{frame}[allowframebreaks] \frametitle{Disturbance Analysis} We have \begin{align} \dot{e}=A_{cl}(x,x_d,t,\hat{a})e-Y(x,x_d,t,\hat{a})\tilde{a}. \end{align} Let $R=\Theta(x,x_d,t,\hat{a}) e$ where $\Theta^T\Theta=M$. Then \begin{align} \dot{a}\leq-\alpha R+\|\Theta\|\|Y\|\|\tilde{a}\| \end{align} which implies \begin{align} \|e\| \leq \frac{R(0)}{\sqrt{m}}e^{-\alpha t}+\frac{1}{\alpha}\sqrt{\frac{\overline{m}}{\underline{m}}}\sup_t(\|Y\|\|\tilde{a}\|) \end{align} \end{frame} \end{document} \section[Matched Uncertainty]{Adaptive Control for Systems with Matched Uncertainty} \begin{frame}[allowframebreaks] \frametitle{Adaptive Control for Systems with Matched Uncertainty} Let's start from a case where the matched uncertainty condition holds: \begin{align} \dot{x} =& f(x)+B(x)(u-\varphi(x,u)^T\theta) \end{align} \begin{itemize} \item Note that $f(x)$ and $B(x)$ can be viewed as a system with a \underline{fixed} nominal parameters $\theta$: $f(x;\theta_n)$ and $B(x;\theta_n)$. \item In this section, we assume we have a controller that stabilizes the system for this \underline{fixed} parameter $\theta_n$ \item Later we construct a controller that also adaptively updates $\theta_n$ in $f(x;\theta_n)$ and $B(x;\theta_n)$ to remove the matched uncertainty condition \end{itemize} Let $u$ be designed as ($M$ is the neural contraction metric for the \underline{fixed} $\theta_n$) \begin{align} u =& -B(x)^TM(x)x+\varphi(x)^T\hat{\theta} \\ \dot{\hat{\theta}} =& -\Gamma \varphi(x)B(x)^TM(x)x. \end{align} Then we have the following combined system ($\tilde{\theta}=\hat{\theta}-\theta$): \begin{align} \frac{d}{dt}\begin{bmatrix}x \\ \tilde{\theta}\end{bmatrix} = \begin{bmatrix}A(x)-B(x)B(x)^TM(x) & B(x)\varphi(x)^T\\ -\Gamma \varphi(x)B(x)^TM(x) & 0\end{bmatrix}\begin{bmatrix}x \\ \tilde{\theta}\end{bmatrix} \end{align} Let $V = \delta q^T\begin{bmatrix}M(x) & 0 \\0 & \Gamma^{-1}\end{bmatrix}\delta q$. Then we have \begin{align} \dot{V} = \begin{bmatrix}x \\ \tilde{\theta}\end{bmatrix}^T\begin{bmatrix}MA+A^TM-MBB^TM & 0 \\0 & 0\end{bmatrix}\begin{bmatrix}x \\ \tilde{\theta}\end{bmatrix} \leq -2 \alpha\begin{bmatrix}x \\ \tilde{\theta}\end{bmatrix}^T\begin{bmatrix}M & 0 \\0 & 0\end{bmatrix}\begin{bmatrix}x \\ \tilde{\theta}\end{bmatrix} \end{align} This implies asymptotic stability. \end{frame} \section[aNCM]{Adaptive NCM} \begin{frame}[allowframebreaks] \frametitle{Adaptive NCM} Consider the following system and a controller $u\in\mathbb{R}^m$: \begin{align} \label{adaptive_system} \dot{x}(t) =& f(x(t),t,a)+B(x(t),t,a)u(x(t),x_d(t),t,\hat{a}(t)) \\ \label{adaptive_system_d} \dot{x}_d(t) =& f(x_d(t),t,a)+B(x_d(t),t,a)u_d(x_d(t),t) \\ \label{adaptive_control} u(x(t),x_d(t),t,\hat{a}(t)) =& u_d(x_d,t)-B(x,t)^TM(x,x_d,t,\hat{a}(t))(x(t)-x_d(t)) \end{align} where $a\in\mathbb{R}^{p}$ are unknown system parameters and we estimate $a$ by $\hat{a}:\mathbb{R}_{\geq0}\to\mathbb{R}^{p}$. Suppose that there exist $Y_f(x,x_d,t,a)$ and $Y_B(x,x_d,t,\hat{a})$ s.t.{} \begin{align} Y_f(x,x_d,t)a =& f(x,t,a)+B(x,t,a)u_d(x_d,t) \\ Y_B(x,x_d,t,\hat{a})a =& B(x,t,a)B(x,t,\hat{a})^TM(x,x_d,t,\hat{a})(x-x_d). \end{align} Since (\ref{adaptive_system}) can be rewritten as $\dot{x}(t) = f(x_d,t,a)+B(x_d,t,a)u_d+(Y_f(x,x_d,t)-Y_f(x_d,x_d,t)+Y_B(x,x_d,t,\hat{a}))a$, we have \begin{align} \label{adaptiveY} \dot{x} = f(x_d,t,a)+B(x_d,t,a)u_d+Y(x,x_d,t,\hat{a})\hat{a}-Y(x,x_d,t,\hat{a})\tilde{a} \end{align} where $Y(x,x_d,t,\hat{a})=Y_f(x,x_d,t)-Y_f(x_d,x_d,t)+Y_B(x,x_d,t,\hat{a})$ and $\tilde{a}=\hat{a}-a$. Let $A(x,x_d,t,a)$ be defined as \begin{align} \label{sdcAc} A(x,x_d,t,a) =& \int_0^1\bar{f}_x(c x+(1-c)x_d,t,a)dc \end{align} where $\bar{f}(q,t,a)=f(q,t,a)+B(q,t,a)u_d(x_d,t)$. Note that we have $(Y_f(x,x_d,t)-Y_f(x_d,x_d,t))\hat{a}=A(x,x_d,t,\hat{a})(x-x_d)$. Using (\ref{sdcAc}), (\ref{adaptiveY}) can be expressed as \begin{align} \label{adaptive_system_final} \dot{x} =& f(x_d,t,a)+B(x_d,t,a)u_d-Y(x,x_d,t,\hat{a})\tilde{a} \nonumber \\ &+(A(x,x_d,t,\hat{a})-B(x,t,\hat{a})B(x,t,\hat{a})^TM(x,x_d,t,\hat{a}))(x-x_d) \end{align} Therefore, we define the adaptation law as follows: \begin{align} \label{adaptation_law} \dot{\hat{a}} = \dot{\tilde{a}} = (\nabla^2\psi(\hat{a}))^{-1}Y(x,x_d,t,\hat{a})^TM(x,x_d,t,\hat{a})(x-x_d). \end{align} where $\psi:\mathbb{R}^p\to\mathbb{R}$ is a given convex function. \end{frame} \section[Stability]{Stability Analysis} \begin{frame}[allowframebreaks] \frametitle{Stability Analysis} Consider the combined system of (\ref{adaptive_system_final}) and (\ref{adaptation_law}) as follows \begin{align} \begin{bmatrix}\dot{e} \\ \dot{\tilde{a}}\end{bmatrix} = \begin{bmatrix}A_{cl}(x,x_d,t,\hat{a}) & -Y(x,x_d,t,\hat{a}) \\(\nabla^2\psi(\hat{a}))^{-1}Y(x,x_d,t,\hat{a})^TM(x,x_d,t,\hat{a}) & 0\end{bmatrix}\begin{bmatrix}e \\ \tilde{a}\end{bmatrix} \end{align} where $A_{cl}(x,x_d,t,\hat{a})=A(x,x_d,t,\hat{a})-B(x,t,\hat{a})B(x,t,\hat{a})^TM(x,x_d,t,\hat{a})$. Let $V=e^T M(x,x_d,t,\hat{a}) e+2d_{\psi}(a\|\hat{a})$, where $d_{\psi}(a\|\hat{a})=\psi(a)-\psi(\hat{a})+(\hat{a}-a)^T\nabla\psi(\hat{a})$. Then we have \begin{align} \dot{V} =2e^TMA_{cl}e-2e^TMY\tilde{a}+2\tilde{a}^TY^TMe\leq-2\alpha e^T M e \end{align} which implies asymptotic stability. \end{frame} \section[Parameter]{Parameter Convergence} \begin{frame}[allowframebreaks] \frametitle{Parameter Convergence} Let $\theta$ be any parameter and $A=\{\theta |Y(x,x_d,t,\hat{a})\theta=Y(x,x_d,t,\hat{a})a,\forall t\}$. Since we have \begin{align} \frac{d}{dt}d_{\psi}(\theta\|\hat{a}) = (\hat{a}-\theta)^T\nabla^2\psi(\hat{a})(-(\nabla^2\psi(\hat{a}))^{-1}Y^TMe) = (\hat{a}-\theta)^TY^TMe \end{align} integrating this from $0$ to $t$ yields \begin{align} &d_{\psi}(\theta\|\hat{a}(t))-d_{\psi}(\theta\|\hat{a}(0))=\nonumber\\ &\int^t_0(\hat{a}(\tau)-\theta)^TY(x(\tau),x_d(\tau),\tau,\hat{a}(\tau))^TM(x(\tau),x_d(\tau),\tau,\hat{a}(\tau))e(\tau)d\tau. \end{align} Assume that $a^*=\lim_{t\to \infty}\hat{a}(t)\in A$ and $\theta\in A$. Then \begin{align} \label{params_integral} &d_{\psi}(\theta\|a^*)-d_{\psi}(\theta\|\hat{a}(0))=\nonumber\\ &\int^\infty_0(\hat{a}(\tau)-a)^TY(x(\tau),x_d(\tau),\tau,\hat{a}(\tau))^TM(x(\tau),x_d(\tau),\tau,\hat{a}(\tau))e(\tau)d\tau. \end{align} Since the right hand side does not depend on $\theta$, we have \begin{align} a^*=\text{arg}\min_{\theta\in A}d_{\psi}(\theta\|a^*)=\text{arg}\min_{\theta\in A}d_{\psi}(\theta\|\hat{a}(0)) \end{align} When we select $\hat{a}(0)=\text{arg}\min_{b\in \mathbb{R}^p}\psi(b)$ ($\Rightarrow \nabla\psi(\hat{a}(0))=0$ as $\psi$ is convex), we have \begin{align} a^*=\text{arg}\min_{\theta\in A}\psi(\theta). \end{align} \end{frame} \section[Disturbance]{Disturbance Analysis} \begin{frame}[allowframebreaks] \frametitle{Disturbance Analysis} We have \begin{align} \dot{e}=A_{cl}(x,x_d,t,\hat{a})e-Y(x,x_d,t,\hat{a})\tilde{a}. \end{align} Let $R=\Theta(x,x_d,t,\hat{a}) e$ where $\Theta^T\Theta=M$. Then \begin{align} \dot{a}\leq-\alpha R+\|\Theta\|\|Y\|\|\tilde{a}\| \end{align} which implies \begin{align} \|e\| \leq \frac{R(0)}{\sqrt{m}}e^{-\alpha t}+\frac{1}{\alpha}\sqrt{\frac{\overline{m}}{\underline{m}}}\sup_t(\|Y\|\|\tilde{a}\|) \end{align} \end{frame} \end{document} \section[aNCM1]{Adaptive NCM (case 1)} \begin{frame}[allowframebreaks] \frametitle{Adaptive NCM (case 1)} Consider the following system: \begin{align} \label{adaptive_system} \dot{x}(t) =& f(x,\theta)+B(x,\theta)u \end{align} where $\theta\in\mathbb{R}^{p}$ are unknown system parameters and we estimate $\theta$ by $\hat{\theta}:\mathbb{R}_{\geq0}\to\mathbb{R}^{p}$. \begin{itemize} \item In this section, we try to design an adaptive NCM with a nominal Lyapunov function $V = x^TM(x,\theta)x$ instead of $V = x^TM(x,\hat{\theta})x$ so that we don't have to deal with $\dot{M}(x,\hat{\theta})$ issue \end{itemize} First, let's consider $\dot{V}$ of $V = x^TM(x,\theta)x$, when $u = -B(x,\hat{\theta})^TM(x,\hat{\theta})x$: \begin{align} \dot{V} =& x^T(\dot{M}(x,\theta)+2\sym{}({M}(x,\theta)A(x,\theta))-2M(x,\theta)B(x,\theta)B(x,\hat{\theta})^TM(x,\hat{\theta}))x \nonumber \\ =& x^T(\dot{M}(x,\theta)+2\sym{}({M}(x,\theta)A(x,\theta))-2M(x,\theta)B(x,\theta)B(x,\theta)^TM(x,\theta))x \nonumber \\ &+2x^TM(x,\theta)B(x,\theta)(B(x,\theta)^TM(x,\theta)-B(x,\hat{\theta})^TM(x,\hat{\theta}))x. \end{align} Let's assume that we have $M(x,\theta)$ ($\theta$: fixed) s.t.{} \begin{align} \label{contracting} \dot{M}(x,\theta)+2\sym{}({M}(x,\theta)A(x,\theta))-2M(x,\theta)B(x,\theta)B(x,\theta)^TM(x,\theta) \leq -2\alpha M(x,\theta). \end{align} Then we have \begin{align} \dot{V} \leq& -2\alpha V+2x^TM(x,\theta)B(x,\theta)(B(x,\theta)^TM(x,\theta)-B(x,\hat{\theta})^TM(x,\hat{\theta}))x. \end{align} Ideally, we want to define $Y(x)$ s.t.{} \begin{align} \label{adaptive_condition} -Y(x)(\hat{\theta}-\theta) = M(x,\theta)B(x,\theta)(B(x,\theta)^TM(x,\theta)-B(x,\hat{\theta})^TM(x,\hat{\theta}))x,~\forall x,\theta,\hat{\theta}. \end{align} Then the adaptation law \begin{align} \dot{\tilde{\theta}} = 2\nabla^2(\psi(\hat{\theta}))^{-1}Y(x)^Tx \end{align} will guarantee asymptotic stability of the system trajectories. \begin{itemize} \item However, the condition (\ref{adaptive_condition}) is difficult to hold for all $x,\theta,\hat{\theta}$ \item Let's think about a little bit mild condition.. \end{itemize} \end{frame} \section[aNCM2]{Adaptive NCM (case 2)} \begin{frame}[allowframebreaks] \frametitle{Adaptive NCM (case 2)} Instead of (\ref{adaptive_condition}), let's assume that $\exists Y(x)$ s.t. \begin{align} Y(x)\theta = B(x,\theta)^TM(x,\theta)x. \end{align} Then we have \begin{align} \dot{V} \leq& -2\alpha V-2x^TM(x,\theta)B(x,\theta)Y(x)\tilde{\theta} \\ =& -2\alpha V-2x^TM(x,\hat{\theta})B(x,\hat{\theta})Y(x)\tilde{\theta}+2\tilde{\theta}^TY(x)^TY(x)\tilde{\theta} \end{align} Thus, if $\exists k$ s.t.{} $Y(x)^TY(x) \preceq 2 k I$ and the adaptation law is defined as \begin{align} \dot{\tilde{\theta}} = 2\nabla^2(\psi(\hat{\theta}))^{-1}(Y(x)^TB(x,\hat{\theta})^TM(x,\hat{\theta})x-k\tilde{\theta}) \end{align} then the system is asymptotically stable, but now we have unknown term $\tilde{\theta}$. \begin{itemize} \item We could also think of using the tighter condition of (\ref{contracting}) to remove the $k\tilde{\theta}$ \end{itemize} \end{frame} \section[aNCM3]{Adaptive NCM (case 3)} \begin{frame}[allowframebreaks] \frametitle{Adaptive NCM (case 3)} Instead of (\ref{contracting}), we could assume that $\exists M(x,\theta)$ s.t.{} \begin{align} \label{contracting2} &\dot{M}(x,\theta)+2\sym{}({M}(x,\theta)A(x,\theta))-2M(x,\theta)B(x,\theta)B(x,\theta)^TM(x,\theta) \nonumber \\ &+2\sym{}(M(x,\theta)B(x,\theta)-M(x,\hat{\theta})B(x,\hat{\theta})) \leq -2\alpha M(x,\theta),~\forall x, \theta, \hat{\theta}. \end{align} Now we have both $M(x,\theta)$ and $M(x,\hat{\theta})$, which makes (\ref{contracting2}) difficult to satisfy.. In this case ($Y(x)\theta = B(x,\theta)^TM(x,\theta)x$) \begin{align} \dot{V} \leq -2\alpha V-2x^TM(x,\hat{\theta})B(x,\hat{\theta})Y(x)\tilde{\theta} \end{align} and thus the adaptation law becomes \begin{align} \dot{\tilde{\theta}} = 2\nabla^2(\psi(\hat{\theta}))^{-1}Y(x)^TB(x,\hat{\theta})^TM(x,\hat{\theta})x. \end{align} \end{frame} \end{document} \section{} and \subsection{} commands, these will automatically be printed on this slide as an overview of your presentation \end{frame} \begin{frame} \frametitle{}{\ \Large Section 1: Euler-Lagrangian Systems of Riemannian Manifolds\\ } The aim of Section 1 is to present a short introduction of the underlying characteristics of the particular forms of Lagrangian systems offered in this class. For example, the positive definite inertia matrix and symmetry of the nonlinear systems play a central role in our stability analysis and control synthesis. \end{frame} \include{ELsystem} \include{chap_stability} \begin{frame} \frametitle{}{\ \Large Section 3: Nonlinear Stability and Control Design using Contraction Analysis } \end{frame} \include{contraction} \begin{frame}[allowframebreaks] \frametitle{References} \footnotesize{ \include{biblio} } \end{frame}---------------------------------------------------------------------- \end{document} \chapter{Challenges of Nonlinear Dynamics and Control} \section{Lagrangian Systems}\label{sec:larg_systems} \subsection{Euler-Lagrangian Equations} To derive nonlinear equations of motion for generalized coordinates, $\mathbf{q} \in \mathbb{R}^n$, a method employing the Euler-Lagrangian equations of motion~\cite{Ref:Block,Ref:GeoControl,Ref:Spong_book} is preferred in this class for its simplicity in dealing with complex systems involving multiple dynamics. Another advantage of the Lagrangian approach~\cite{Ref:Murray_Robot} is its invariance with respect to coordinate changes. Let us define $Q$ as a smooth ($C^{\infty}$) \textbf{n-dimensional} configuration manifold of a mechanical system with generalized coordinates $\mathbf{q}\in Q$. Its tangent bundle, $TQ$ is the union of every tangent space $TQ_{\mathbf{q}}$ on $\mathbf{q}$. The cotangent bundle of $Q$ is defined as $T^{\star}Q$. Let $\delta \mathbf{q}$ be the virtual displacement corresponding to the variation of $\mathbf{q}$. In the presence of external forces (e.g. control action by actuators or external disturbances), the Lagrange-D'Alembert principle indicates that \begin{equation}\label{Dalembert} \delta\int^{b}_{a} L(\mathbf{q},\mathbf{\dot{q}})dt+\int^{b}_{a}\mathbf{F}\cdot\delta\mathbf{q}dt=0 \end{equation} where a Lagrangian $L:$ $TQ\rightarrow \mathbb{R}$ is defined as \begin{equation}\label{lagrange_ch2} L(\mathbf{q},\mathbf{\dot{q}})=K(\mathbf{q},\mathbf{\dot{q}})-V(\mathbf{q})=\frac{1}{2}{\mathbf{\dot{q}}}^{T}\mathbf{M}(\mathbf{q})\mathbf{\dot{q}}-V(\mathbf{q}) \end{equation} Notice that the potential energy, $V(\mathbf{q}):$ $Q\rightarrow\mathbb{R}$ is independent of $\mathbf{\dot q}$ whereas the kinetic energy can often be represented in a quadratic form, $K=\frac{1}{2}{\mathbf{\dot{q}}}^{T}\mathbf{M}(\mathbf{q})\mathbf{\dot{q}}$. From (\ref{Dalembert}), the following Euler-Lagrange equations of motion for a mechanical system with a configuration manifold $Q$ can be derived: \begin{equation}\label{lagrange_equation_ch2} \frac{d}{dt}\frac{\partial L(\mathbf{q},\mathbf{\dot{q}})}{\partial \dot{\mathbf{q}}}-\frac{\partial L(\mathbf{q},\mathbf{\dot{q}})}{\partial \mathbf{q}}=\mathbf{F} \end{equation} where $\mathbf{F}:\mathbb{R}\times TQ\rightarrow T^{\star}Q$ is an m-dimensional generalized force or torque vector ($\mathbf{F}\in \mathbb{R}^m$) acting on the system. The dependency on time ($t\in\mathbb{R}$) usually originates from a time-varying desired trajectory. Otherwise, a map of $\mathbf{F}$ is defined by $TQ\rightarrow T^{\star}Q$. If $m=n$ with $\mathbf{q} \in \mathbb{R}^n$, the system is a fully actuated system. However, if $m< n$, the system is an underactuated mechanical system. Sometimes, it is convenient to introduce dissipative nonconservative forces such as mechanical friction and aerodynamic drag: \begin{equation}\label{lagrange_equation_ch2F} \frac{d}{dt}\frac{\partial L(\mathbf{q},\mathbf{\dot{q}})}{\partial \dot{\mathbf{q}}}-\frac{\partial L(\mathbf{q},\mathbf{\dot{q}})}{\partial \mathbf{q}}=\mathbf{F}+\mathbf{B}(\mathbf{q},\mathbf{\dot q}) \end{equation} where $\mathbf{B}(\mathbf{q},\mathbf{\dot q})$ denotes a generalized nonconservative force or torque vector. Sometimes, when some subsystems are quasi-continuous, this dissipation force term depends only on the rate such that the quadratic Rayleigh dissipation function can be defined as follows: \begin{equation} \mathcal{D}=\frac{1}{2}\sum^{n}_{r=1}\sum^{n}_{s=1} d_{rs}\dot{q}_r\dot{q}_s=\mathbf{\dot q}^TD\mathbf{\dot q} \end{equation} where $D$ is generally symmetric positive definite. Then, $\mathbf{B}(\mathbf{q},\mathbf{\dot q})$ in (\ref{lagrange_equation_ch2F}) is obtained by \begin{equation} \mathbf{B}(\mathbf{q},\mathbf{\dot q})=-\frac{\partial \mathcal{D}}{\partial \dot{\mathbf{q}}} \end{equation} \subsection{Lagrangian on Riemannian Manifolds} The representation of the kinetic energy in a quadratic form in (\ref{lagrange_ch2}) warrants a further discussion. Recalling \begin{equation}\label{lagrange_2} K(\mathbf{q},\mathbf{\dot{q}})=\frac{1}{2}{\mathbf{\dot{q}}}^{T}\mathbf{M}(\mathbf{q})\mathbf{\dot{q}}, \end{equation} we can construct a mass/inertia matrix, $\mathbf{M}(\mathbf{q})\in\mathbb{R}^{n\times n}$ from the kinetic energy, $K(\mathbf{q},\mathbf{\dot{q}})$. In a large class of nonlinear systems, the matrix $\mathbf{M}(\mathbf{q})$ is uniformly positive definite (i.e., $\mathbf{M}(\mathbf{q})\geq \alpha \mathbf{I}$, $\alpha>0$). This condition can be proven by contradiction. If there exists $\mathbf{q}$ that yields a zero eigenvalue of $\mathbf{M}(\mathbf{q})$ (hence, not p.d.), the robot asrm could move with nonzero velocity $\dot{\mathbf{q}}$ with zero kinetic energy- an impossibility\!. This p.d. condition of the inertia matrix permits the following definition from geometric control theory~\cite{Ref:Marsden_Manfold,Ref:Block,Ref:GeoControl}. \begin{definition}[Riemannian Manifolds] A differentiable manifold with a positive definite symmetric quadratic form $\langle\cdot, \cdot\rangle$ on every tangent space $TQ_{\mathbf{q}}$ of the configuration variable, $\mathbf{q}$ is called a Riemannian manifold. The quadratic form $\langle\cdot, \cdot\rangle$ is often called a Riemannian metric. \end{definition} As shall be seen later, this Riemannian metric and its matrix representation, $\mathbf{M}(\mathbf{q})$ constructed from the kinetic energy of a nonlinear mechanical system, play a central role in the nonlinear control design and stability analysis offered in this class. Plugging (\ref{lagrange_ch2}) into (\ref{lagrange_equation_ch2}), Euler-Lagrange equations on a Riemannian manifold are obtained: \begin{equation}\label{NL_single_compact_ch2A} \mathbf{M}(\mathbf{q})\mathbf{\ddot{q}}+ \mathbf{\dot{q}}^T\mathbf{\Gamma}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}}+\mathbf{g}(\mathbf{q}) =\mathbf{F} \end{equation} where $\mathbf{g}(\mathbf{q})$ contains a gravity term of a rigid body such that $\frac{\partial \mathbf{V}(\mathbf{q})}{\partial\mathbf{q}}=\mathbf{g}(\mathbf{q})$, and the elements of the $\mathbf{\Gamma}$ matrix are Christoffel symbols~\cite{Ref:Spong_book,Ref:Slotine}: \begin{equation} \label{Christopher} \Gamma_{ijk}=\frac{1}{2}\left(\frac{\partial M_{ij}}{\partial q_k}+{\frac{\partial M_{ik}}{\partial q_j}-\frac{\partial M_{jk}}{\partial q_i}}\right) \end{equation} The quadratic term $\mathbf{\dot{q}}^T\mathbf{\Gamma}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}}$ can be classified into two different types. The terms involving $\dot{q}_i\dot{q}_j$ with $i\neq j$ represent the Coriolis force (torque) whereas the other terms involving ${\dot{q}_i}^2$ correspond to the centrifugal force (torque). It should be emphasized that the definition in (\ref{Christopher}) is one of many possible choices of $\mathbf{\Gamma}$ from the Euler-Lagrangian equations in (\ref{lagrange_equation_ch2}). To show the reason behind this choice, we proceed to illustrate the significance of the relationship between the Riemannian metric and Christoffel symbols. Let us represent an equivalent form to (\ref{NL_single_compact_ch2A}): \begin{equation}\label{NL_single_compact_ch2} \mathbf{M}(\mathbf{q})\mathbf{\ddot{q}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}}+\mathbf{g}(\mathbf{q}) =\mathbf{F} \end{equation} where the $\mathbf{C}$ matrix is defined as \begin{equation} \label{C_selection_ch2} c_{ij}=\frac{1}{2}\sum^{n}_{k=1}\frac{\partial M_{ij}}{\partial q_k}\dot{q_k}+\frac{1}{2}\sum^{n}_{k=1}\left({\frac{\partial M_{ik}}{\partial q_j}-\frac{\partial M_{jk}}{\partial q_i}}\right)\dot{q_k} \end{equation} Then, it is straightforward to show that $(\mathbf{\dot{M}}-2\mathbf{C})$ is skew-symmetric~\cite{Ref:Slotine} resulting in $\mathbf{x}^T(\mathbf{\dot{M}}-2\mathbf{C})\mathbf{x}=0$ for arbitrary $\mathbf{x}\in \mathbb{R}^n$. This skew-symmetric property can be viewed as a matrix expression of energy conservation~\cite{Ref:Slotine}, which is explained in the context of the passivity formalism in Section 3.\ref{sec:Passivity}. For example, let us assume $\mathbf{g}(\mathbf{q})=\mathbf{0}$ and consider the kinetic energy of the robot dynamics (\ref{NL_single_compact_ch2}): $V=\frac{1}{2}\dot{\mathbf{q}}^T \mathbf{M}(\mathbf{q})\dot{\mathbf{q}}$. \begin{equation} \dot{V}=\dot{\mathbf{q}}^T\mathbf{M}(\mathbf{q})\ddot{\mathbf{q}}+\frac{1}{2}\dot{\mathbf{q}}^T \mathbf{\dot{M}}(\mathbf{q})\dot{\mathbf{q}}=\dot{\mathbf{q}}^T(\mathbf{F}+ \frac{1}{2}\mathbf{\dot{M}}\mathbf{\dot{q}}-\mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}})=\dot{\mathbf{q}}^T\mathbf{F} \end{equation} where the LHS is the time-derivative of the kinetic energy and the RHS represents the power input from the actuators. Furthermore, since $\mathbf{M}(\mathbf{q})$ is symmetric, one can find that \begin{equation}\label{M_C_relation} \mathbf{\dot M}(\mathbf{q})=\mathbf{C}(\mathbf{q},\mathbf{\dot{q}})^T+\mathbf{C}(\mathbf{q},\mathbf{\dot{q}}). \end{equation} The property in (\ref{M_C_relation}) is widely exploited for stability analysis and control synthesis. Furthermore, one can derive the Euler-Lagrangian equations in (\ref{NL_single_compact_ch2}) using $\mathbf{\dot M}=\mathbf{C}^T+\mathbf{C}$ without solving (\ref{C_selection_ch2}) to derive the $\mathbf{C}$ matrix. \subsection{Symmetry}\label{sec:SymmetryCH2} In this section, we pay attention to a different notion of symmetry, so-called mechanical symmetry, which makes a connection with the conservation laws. Most mechanical systems, despite being non-symmetric in geometry, possess some symmetry properties. In the context of geometric control theory, mechanical symmetries lead to to reduction of the model complexity~\cite{Ref:Chang,Ref:Oli_Saber}. We start with the definition of mechanical symmetry. \begin{definition}[Symmetry in Mechanics] The Lagrangian $L(\mathbf{q},\mathbf{\dot{q}})=K(\mathbf{q},\mathbf{\dot{q}})-V(\mathbf{q})$ is symmetric with respect to the configuration variable $q_i$ if and only if \begin{equation} \frac{\partial L(\mathbf{q},\mathbf{\dot{q}})}{\partial q_i}=0 \end{equation} where $q_i$ is the $i$-th ($i\in\{1,\dots,n\})$ configuration variable in the vector $\mathbf{q}$. \end{definition} The definition states that the system is symmetric when its Lagrangian is invariant under the group action of $q_i$. We define the $i$-th generalized momentum, $p_i$ as \begin{equation} p_i=\frac{\partial L(\mathbf{q},\mathbf{\dot{q}})}{\partial \dot{q}_i} \end{equation} Then, the unforced Euler-Lagrange equation from (\ref{lagrange_equation_ch2}) reduces to \begin{equation} \frac{d}{dt}p_i-\frac{\partial L}{\partial {q}_i}=0 \end{equation} Consequently, symmetry of a Lagrangian system, $\frac{\partial L}{\partial q_i}=0$, leads to $\frac{d}{dt}p_i=0$. In other words, the $i$-th generalized momentum is conserved, when the system is symmetric with respect to $q_i$. Most mechanical systems possess a relaxed form of symmetry as follows. \begin{definition}[Kinetic Symmetry] A Lagrangian system is kinetically symmetric with respect to a joint variable vector, $\mathbf{q}$ if \begin{equation} \frac{\partial K}{\partial {q}_i}=0. \end{equation} \end{definition} The kinetic symmetry leads to symmetry in mechanics in the absence of a potential field, i.e. $V(\mathbf{q})=0$, which in turn corresponds to the conservation of the momentum of an unforced system. Note that the two-link manipulator robot is kinetic symmetric with respect to the first joint angle $\theta_1$, thereby resulting in an inertia matrix independent of $\theta_1$. This independent variable is often called an \emph{external variable or cyclic~\cite{Ref:Block}}. A dependent variable ($\theta_2$) of a two-link manipulator is called a \emph{shape variable}. Reduction theory for controlled Lagrangian and controlled Hamiltonian systems with symmetry is an active area of research~\cite{Ref:Chang}. For example, a nonlinear control design using a control Lagrangian makes extensive use of the conservation law derived by symmetry. In another example, Olfati-Saber~\cite{Ref:Oli_Saber} developed cascade normal forms for underactuated mechanical systems, based upon the mechanical symmetry introduced in this section. \subsection{Legendre Transformation and Hamiltonian}\label{sec:hamilton} The generalized momentum $\mathbf{p}$ is defined as \begin{equation}\label{Legendre} \mathbf{p}=\frac{\partial L}{\partial \mathbf{\dot{q}}}=\mathbf{M}(\mathbf{q})\mathbf{\dot{q}} \end{equation} This coordinate transformation is referred to as the Legendre transformation~\cite{Ref:Oli_Saber,Ref:Block}. We can re-write (\ref{NL_single_compact_ch2}) using the Legendre transformation in (\ref{Legendre}): \begin{equation}\label{canonicalform} \begin{split} \mathbf{\dot{q}}=\mathbf{M}^{-1}(\mathbf{q})\mathbf{p} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \\ \mathbf{\dot{p}}=\mathbf{C}\left(\mathbf{q},\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}\right)^{T}\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}-\mathbf{g}(\mathbf{q})+\mathbf{F} \end{split} \end{equation} where we used $\mathbf{\dot{M}}=\mathbf{C}+\mathbf{C}^{T}$ from the skew-symmetric property of $\mathbf{\dot{M}}-2\mathbf{C}$. The second-order differential equation in (\ref{NL_single_compact_ch2}) is now in the first-order differential form, which has an advantage in contraction analysis, as shall be seen in the subsequent sections. We can easily verify that (\ref{canonicalform}) corresponds to Hamilton's equations by introducing the Hamiltonian, $H(\mathbf{q},\mathbf{p})$: \begin{equation} \begin{split} H(\mathbf{q},\mathbf{p})=\mathbf{\dot{q}}^{T}\mathbf{p}- L(\mathbf{q},\mathbf{\dot{q}})=\frac{1}{2}{\mathbf{{p}}}^{T}\mathbf{M}^{-1}(\mathbf{q})\mathbf{{p}}+V(\mathbf{q})\\ \mathbf{\dot{q}}=\frac{\partial H(\mathbf{q},\mathbf{p})}{\partial \mathbf{p}}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \\ \mathbf{\dot{p}}=-\frac{\partial H(\mathbf{q},\mathbf{p})}{\partial \mathbf{q}}+\mathbf{F} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \end{split} \end{equation} Since the kinetic energy, $K$ can be written as \begin{equation} K=\frac{1}{2}{\mathbf{\dot{q}}}^{T}\mathbf{M}(\mathbf{q})\mathbf{\dot{q}}=\frac{1}{2}{\mathbf{{p}}}^{T}\mathbf{M}^{-1}(\mathbf{q})\mathbf{{p}}, \end{equation} the Hamiltonian represents the total energy of the system, i.e. $H=K+V$, as opposed to the Lagrangian, $L=K-V$. We will often encounter the closed loop dynamics of the following form: \begin{equation}\label{NL_hamiltonian} \mathbf{M}(\mathbf{q})\mathbf{\dot{s}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{s}+\mathbf{K}\mathbf{s} =\mathbf{u}(t) \end{equation} where $\mathbf{s}(t)$ is the composite variable~\cite{Ref:Slotine}, often introduced in the sliding control literature such that \begin{equation}\label{composite_variable} \mathbf{s}= \mathbf{\dot{q}}-\mathbf{\dot{q}}_d+\mathbf{\Lambda}(\mathbf{{q}}-\mathbf{{q}}_d) \end{equation} where $\mathbf{q}_d$ represents the desired reference trajectory. For the system in (\ref{NL_hamiltonian}), we can employ the following transformation by redefining $\mathbf{p}$: \begin{equation} \mathbf{p}=\mathbf{M}(\mathbf{q})\mathbf{s} \end{equation} Hence, (\ref{NL_hamiltonian}) reduces to the following first-order canonical form: \begin{equation}\label{canonicalform_s} \begin{split} \mathbf{\dot{q}}=-\mathbf{\Lambda}\mathbf{q}+\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}+ \left(\mathbf{\dot{q}}_d+\mathbf{\Lambda}{\mathbf{q}}_d\right)\ \ \ \ \ \ \ \ \ \ \ \ \ \\ \mathbf{\dot{p}}=\Bigl[\mathbf{C}\left(\mathbf{q},\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}\right)^{T}-\mathbf{K}\Bigr]\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}+\mathbf{u}(t) \end{split} \end{equation} A nice thing about the equations, (\ref{canonicalform}) and (\ref{canonicalform_s}), is that the external control input vector, $\mathbf{F}$ is intact via the transformation, thereby facilitating the control design and controllability analysis. \subsection{Zero Riemannian Curvature and Flat Mechanical Systems} If the inertia matrix, $\mathbf{M}(\mathbf{q})$ can be factored as $\mathbf{N}(\mathbf{q})^T\mathbf{N}(\mathbf{q})$, we can derive a transformation that significantly simplifies the robot dynamics. Such a transformation is called a linearizing point transformation~\cite{Ref:Bedrossian} and all point transformations are also canonical transformations~\cite{Ref:Riemann}. In the absence of the potential term $V$ (or canceled by a feedforward term), suppose the inertia matrix $\mathbf{M}(\mathbf{q})$ can be factored into \begin{equation}\label{decomposition} \mathbf{M}(\mathbf{q})=\mathbf{N}^T(\mathbf{q})\mathbf{N}(\mathbf{q}) \end{equation} where $\mathbf{N}(\mathbf{q})$ is integrable. Also consider a canonical transformation by $Q(\mathbf{p},\mathbf{q})$ and $P(\mathbf{p},\mathbf{q})$ by which a system preserves the Hamiltonian structure of the system in (\ref{canonicalform}). \begin{align} dQ&=\frac{\partial Q}{\partial\mathbf{q}}d\mathbf{q}=\mathbf{N}(\mathbf{q})d\mathbf{q}\\ P&=\mathbf{N}(\mathbf{q})\mathbf{\dot q} \end{align} This transformation yields the following Hamiltonian \begin{equation} H=\frac{1}{2}{\mathbf{\dot{q}}}^{T}\mathbf{M}(\mathbf{q})\mathbf{\dot{q}}=\frac{1}{2}{\mathbf{\dot{q}}}^{T}\mathbf{N}^T(\mathbf{q})\mathbf{N}(\mathbf{q})\mathbf{\dot{q}}=\frac{1}{2}P^TP \end{equation} which is independent of $Q$. This simplification leads to the following double integrator system \begin{equation} \begin{split} \dot Q=P \ \ \ \ \ \ \ \ \ \ \\ P={\mathbf{N}(\mathbf{q})}^{-T}\mathbf{F} \end{split} \end{equation} This significantly simplifies the computation of a controller compared to the original feedback linearization (computed torque) control law since it only requires a computation of $\mathbf{N}(\mathbf{q})$. Then, a natural question arises as to the existence of such a decomposition in (\ref{decomposition}). It turns out that there is a sufficient and necessary condition to the existence which relates a Riemannian manifold with a Euclidean manifold. \begin{definition}[Locally Flat Manifold] A linearizing point transformation exists if and only if all elements of the Riemann curvature tensor, $R_{ijkl}$ are identically zero. (See \cite{Ref:Riemann} and \cite{Ref:Bedrossian} for the exact definition of $R_{ijkl}$). Such a Riemannian manifold is called a ``locally flat'' manifold. \end{definition} One trivial example of a ``zero Riemann curvature tensor'' is a system with a constant inertia matrix, thereby eliminating the Christoffel symbols in (\ref{Christopher}) automatically. This in turn makes $\mathbf{C}(\mathbf{q},\mathbf{\dot q})$ vanish as well. \subsection{Nonholonomic Systems and Underactuated Dynamics} Consider a mechanical system of $\mathbf{q}\in \mathbb{R}^n$, subject to the following $p$ constraint equations, linear in the velocity field: \begin{equation}\label{const_eqn} \sum^{n}_{k=1}a^j_k(q_i)\dot{q}_k=0,\ \ \ j=1,\dots,p. \ \ \ \text{Equivalently,}\ \mathbf{A}(\mathbf{q})\mathbf{\dot{q}}=\mathbf{0} \end{equation} where $\mathbf{A}(\mathbf{q})\in \mathbb{R}^{p\times n}$ and $p<n$. \begin{definition}[Nonholonomic Constraints] The constraints in (\ref{const_eqn}) are \textbf{\emph{holonomic}} or \textbf{\emph{integrable}} if there is a real-valued vector function $\mathbf{h}(\mathbf{q})\in\mathbb{R}^p$ such that the constraint can be written as $\mathbf{h}(\mathbf{q})=$constant, or in differentiated form, ($\frac{\partial h_i}{\partial q_i}\dot{q}_i=0$). Thus the configuration of the system is actually constrained to be on a submanifold of the configuration manifold. We can then write Lagrange's equations using coordinates on this submanifold and thus get a system of equations with fewer variables. If no such function $\mathbf{h}$ exists, the constraints are said to be \emph{\textbf{nonintegrable}} or \emph{\textbf{nonholonomic}}. \end{definition} For example, the length constraint on a pendulum is a holonomic constraint. On the other hand, a constraint of rolling without slipping is nonholonomic. In addition, constraints that are independent of time are called \emph{\textbf{scleronomic}}, whereas \textbf{\emph{rheonomic}} indicates constraints depending on time. Using the Lagrange-d'Alembert principle given in (\ref{Dalembert}) together with the nonholonomic velocity constraints of the form in (\ref{const_eqn}), we can derive the following equations of motion: \begin{equation}\label{const_euler_eqn} \begin{split} \mathbf{M}(\mathbf{q})\mathbf{\ddot{q}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}}+\mathbf{g}(\mathbf{q}) =\mathbf{A}(\mathbf{q})^T\mathbf{\lambda}+\mathbf{F}\\ \mathbf{A}(\mathbf{q})\mathbf{\dot{q}}=\mathbf{0} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \end{split} \end{equation} where $\mathbf{\lambda}\in\mathbb{R}^p$ is a vector of Lagrange multipliers. Notice that we now have $2n$ first-order differential equations and $m$ constraint equations for $2n+m$ variables ($\mathbf{q},\mathbf{\dot{q}},\mathbf{\lambda}$). The above constraints are first-order nonholonomic constraints. We also encounter the second-order nonholonomic constraints arising from underactuated control inputs. \begin{definition}[Underactuated Mechanical Systems] A Lagrangian system in (\ref{NL_single_compact_ch2}), which has a fewer number of inputs ($\mathbf{F}\in\mathbb{R}^m$) than the number of degrees-of-freedom, $n$ ($\mathbf{q}\in\mathbb{R}^n$) such that $m<n$, is called an \emph{\textbf{Underactuated}} Lagrangian system. \end{definition} Hence, we can derive a second-order nonholonomic constraint from the unactuated coordinates. For example, if the first coordinate variable $q_1$ out of $\mathbf{q}=\begin{pmatrix}q_1& q_2& \cdots & q_n\end{pmatrix}^T$ is not actuated, the following acceleration constraint equation is obtained: \begin{equation} m_{11}(\mathbf{q})\ddot{q}_1+m_{12}(\mathbf{q})\ddot{q}_2+\dots +m_{1n}(\mathbf{q})\ddot{q}_n+h_1(\mathbf{q},\mathbf{\dot q})=0, \end{equation} which is not integrable. Control of underactuated mechanical systems is an active area of research. \section{Nonlinear Stability Analysis: Lyapunov-based Methods} \begin{frame} \frametitle{}{\ \Large Section 2: Brief Introduction to Nonlinear Stability } This note is intended to be a brief introduction to Lyapunov stability theorems for the purpose of comparison with our main stability tool, contraction theory in Section \ref{sec:ContractionCH2}. A wealth of literature exists for the further treatment of Lyapunov methods. \begin{itemize} \item Khalil, H.K., Nonlinear Systems, 3rd Ed.,Prentice Hall, Upper Saddle River, NJ, 2002. \item Slotine, J.-J.E., and Li, W., Applied Nonlinear Control, Prentice Hall,. New Jersey, 1991. \item Vidyasagar, M., Nonlinear Systems Analysis, 2nd ed., SIAM Classics in Mathematics, SIAM, Philadelphia, 1993. \item Krstic, K., Kanellakopoulos, I., and Kokotovic, P., Nonlinear and Adaptive Control Design, John Wiley and Sons, 1995. \item Sastry, S. S., \emph{Nonlinear Systems: Analysis, Stability, and Control}, Springer-Verlag, 1999. \end{itemize} \end{frame} \subsection{Lyapunov-Based Method}\label{sec:Lyapunov} \begin{frame}[allowframebreaks] For now, we are interested in characterizing the stability of the equilibrium point $\bf{x}=\bf{0}$. Consider a smooth autonomous nonlinear system of $\mathbf{x}\in\mathbb{R}^n$ \begin{equation}\label{xfx_ch2_LL} {\mathbf{\dot x}}=\mathbf{f}(\mathbf{x}) \end{equation} In the sense of Lyapunov, the system in (\ref{xfx_ch2_LL}) is stable if the system trajectory can be kept arbitrarily close to the origin. \begin{definition}[Stability]\label{Def:Stability} \begin{equation} \forall \ \ R>0,\ \ \exists r>0, \|\mathbf{x}(0)\|<r \Rightarrow \ \ \forall \ \ t\geq0,\ \ \|\mathbf{x}(t)\|<R \end{equation} \end{definition} A stronger form of stability is defined as asymptotically stable where the states that started from some initial conditions actually converge to the equilibrium points. \begin{definition}[Asymptotic Stability] \begin{equation} \text{Stable and } \exists r>0, \|\mathbf{x}(0)\|<r \Rightarrow \lim_{t\rightarrow\infty} \mathbf{x}(t)=\bf{0} \end{equation} \end{definition} This asymptotic stability gives rise to the following definition.\end{frame} \begin{frame} \begin{definition}[Region (Domain) of Attraction for Asymptotic Stability] The open, connected, invariant set of all points $\bf{x}$ s.t. the solution $\boldsymbol\phi({\bf x},t)$ of (\ref{xfx_ch2_LL}) given the initial condition ${\bf x}(0)$ is defined for all $t\geq0$ and $\lim_{t\rightarrow\infty}\boldsymbol\phi({\bf x},t)=0$. One conservative estimate of the domain of attraction is $\Omega_c=\{{\bf x}\in \mathbb{R}^n | V({\bf x})\leq c\}$ and we will show $\dot{V}<0$ is required for asymptotic stability later (see Theorem~\ref{Thm:LyapDir}). \end{definition}\begin{figure} \begin{center} \includegraphics[width=0.5\textwidth]{stability.pdf} \caption{Different types of stability}\end{center} \end{figure} When the domain of attraction is all the configuration space in $\mathbb{R}^n$, the system is globally stable. However, this condition of $\mathbf{R}_r=\mathbb{R}^n$ is not sufficient but necessary, as shall be seen in Theorem~\ref{Thm:LyapDir}. \end{frame} \begin{frame} If the convergence rate is determined by an exponential function, then the system is exponentially stable. \begin{definition}[Exponential Stability] \begin{equation}\exists \ \ \alpha>0, \ \lambda>0,\ \ \|{\bf x}(t)\|\leq \alpha\|{\bf x}(t_0)\|e^{-\lambda (t-t_0)},\ \ \forall t\geq t_0\end{equation} in some ball ${\bf B}_r$ around the origin, i.e., $\|{\bf x}\|<r$ \end{definition} \begin{remark} Exponential stability can be global or local with a (local) region of attraction of exponential stability. Note for LTI (linear time-invariant systems), every asymptotically stable equilibrium point is globally exponentially stable. In other words, there exists no difference between asymptotic stability and exponential stability for LTI systems, and every stable point is global. \end{remark} \end{frame} \begin{frame} One easy way of checking the local stability of an equilibrium point $\mathbf{x}_{\star}$ of (\ref{xfx_ch2_LL}) is to check the eigenvalues of the Jacobian of (\ref{xfx_ch2_LL}). \begin{theorem}[Lyapunov Indirect Method] Consider the Jacobian \begin{equation} \mathbf{A}=\frac{\partial \mathbf{f}}{\partial \mathbf{x}}\text{ at } \mathbf{x}_{\star}\ \ \text{from } \mathbf{\dot{x}}=\mathbf{f}(\mathbf{x}) \text{ that satisfies } \mathbf{0}=\mathbf{f}(\mathbf{x}_{\star}) \end{equation} \begin{itemize} \item If $\mathbf{A}$ is Hurwitz (i.e., Re($\lambda_i(\mathbf{A})$)$<0$, $\forall i$), then the equilibrium point $\mathbf{x}_{\star}$ is asymptotically stable (for the actual nonlinear system). \item If $\mathbf{A}$ is NOT Hurwitz (i.e., at least for one eigenvalue, Re($\lambda_i(\mathbf{A})$)$>0$), then the equilibrium point $\mathbf{x}_{\star}$ is unstable (for the actual nonlinear system). \item If $\mathbf{A}$ is marginally stable (all eigenvalues are in the left-half complex plane except for at least one on the $j\omega$ axis (i.e.,Re($\lambda_i(\mathbf{A})$)$=0$), then no conclusion of the stability can be drawn from the Lyapunov indirect method. \end{itemize} \end{theorem} \end{frame} \begin{frame} A fundamental approach of the Lyapunov function is to find a scalar representation of the energy contained in a system. Hence, if one can find that the associated Lyapunov function is decreasing over time, then one can inevitably conclude that the system is stable. \begin{theorem}[Lyapunov Direct Method]\label{Thm:LyapDir} Let $V(\mathbf{x})$ : $\mathbb{R}^n \rightarrow\mathbb{R}_{+}$ be a continuously differentiable \textbf{positive} scalar function. \begin{itemize} \item If such that the following is true in the neighborhood of an equilibrium point ($\mathbf{B}_{r0}$) \begin{equation} \dot V=\frac{\partial V}{\partial \mathbf{x}}\mathbf{f}(\mathbf{x})< 0\ \ \text{(negative definite)} \end{equation} Then, the system is locally asymptotically stable in $\mathbf{B}_{r0}$ \item If $V(\mathbf{x})$ is radially unbounded such that $V\rightarrow\infty$ as $\|x\|\rightarrow\infty$ and $\dot V<0$ in $\mathbb{R}^n$, then the equilibrium is \textbf{globally} asymptotically stable. \item If $\dot V\leq 0$ (i.e., negative semi-definite) locally in $\mathbf{B}_{r0}$ , the equilibrium is just \textbf{stable} according to Definition~\ref{Def:Stability}. \end{itemize} \end{theorem} Such a function, $V$ is called a Lyapunov function. As you might recall from the previous lectures, the storage function in the passivity (or dissipativity) formalism is a generalization of Lyapunov function: $$V(t)-V(0)\leq \int^t_0\sigma(z(t))dt$$. \end{frame} \begin{frame} \begin{figure} \begin{center} \includegraphics[width=0.5\textwidth]{radial.jpg} \caption{The $V$ function should be radially unbounded for global stability.} \end{center} \end{figure} \begin{remark} If we replace the inequality condition with ``$\leq$'', the equilibrium is just stable without asymptotic convergence. In practice, this inequality condition is a stringent requirement for most mechanical systems. For a time-invariant nonlinear system, LaSalle's invariant lemma is exploited to derive asymptotic convergence with a negative semi-definite rate of $V$. \end{remark} \end{frame} \begin{frame} \begin{example}[Lyapunov for a 2nd-order Mechanical System] Consider $\ddot{\theta}+\dot{\theta}+\sin{\theta}=0$. Take $V=(1-\cos\theta)+\dot\theta^2/2$. The time-derivative is found to be only negative \emph{semi-definite} since $\dot{V}=\dot\theta\sin\theta+\dot\theta\ddot\theta=-\dot\theta^2\leq 0$. So by using Theorem~\ref{Thm:LyapDir}, we cannot prove asymptotic stability of the origin unless the following theorem is used. One interesting note: we can conclude asymptotic stability by taking $V=\dot\theta^2/2+(\theta+\dot\theta)^2/2+2(1-\cos\theta)$. \end{example} \begin{example} Consider the linear system $\mathbf{\dot{x}}=\mathbf{Ax}$ and the quadratic Lyapunov function $V=\mathbf{x}^T\mathbf{P}\mathbf{x}$ with $\mathbf{P}>0$. \begin{equation} \dot{V}=\mathbf{\dot{x}}\mathbf{Px}+\mathbf{x}^T\mathbf{P\dot{x}}=-\mathbf{x}^T\mathbf{Qx} \end{equation} Hence, the necessary and sufficient condition of the stric stability of $\mathbf{\dot{x}}=\mathbf{Ax}$ is the unique p.d. solution $\mathbf{P}>0$ exists for the Lyapunov equation $\mathbf{A}^T\mathbf{P}+\mathbf{P}\mathbf{A}=-\mathbf{Q}$ with $\mathbf{Q}>0$. \end{example} \begin{definition}[Invariant Set] Every system (solution) trajectory of the system starting from the invariant set remains in that set for all future time. One example of invariant sets is the domain of attraction. Limit cycles are also invariant sets (recall Poincare-Bendixson theorem).\end{definition} \end{frame}\begin{frame} \begin{theorem}[LaSalle's Invariant Set Theorem] Consider an autonomous system in (\ref{xfx_ch2_LL}). Assume that the region $\mathbf{\Omega}_l$ defined by $V(\mathbf{x})<l$ is bounded, and $\dot V(\mathbf{x})\leq0$ on $\mathbf{\Omega}_l$. Let $\mathbf{R}$ be the set of all points within $\mathbf{\Omega}_l$ where $\dot V(\mathbf{x})=0$, and $\mathbf{M}$ be the largest invariant set in $\mathbf{R}$. Then, every solution $\mathbf{x}(t)$ originating in $\mathbf{\Omega}_l$ tends to $\mathbf{M}$ as $t\rightarrow\infty$. \end{theorem} This invariant set theorem can be conveniently used for a system with a negative semi-definite $\dot V$ to prove its asymptotic stability, however this is restricted to a time-invariant (autonomous) system. A more generalized theory on stability of nonautonomous systems is introduced in the subsequent section. \begin{figure} \begin{center} \includegraphics[width=0.5\textwidth]{invariant.jpg} \caption{LaSalle's invariant set theorem: convergence to the largest invariant set $\mathbf{M}$.} \end{center} \end{figure}\end{frame}\begin{frame} \begin{example}[Nonlinear R-L-C circuit] The second-order system $\ddot{x}+b(\dot{x})+c(x)=0$ with nonlinear functions $\dot{x}b(\dot{x})>0$ for $\dot{x}\neq0$ and $xc(x)>0$ for $x\neq0$. Also, $c(0)=0$ and $b(0)=0$.\\ Take $V=\dot{x}^2/2+\int^x_0c(y)dy$ \begin{equation} \dot{V}=\dot{x}\ddot{x}+c(x)\dot{x}=-\dot{x}b(\dot{x})-\dot{x}c(x)+c(x)\dot{x}=-\dot{x}b(\dot{x})\leq0 \end{equation} which represents the power dissipated in the system. Unfortunately, this $\dot{V}$ is only negative semi-definite. Note $\dot{x}=0$ from $\dot{V}=0$ implies $\ddot{x}=-c(x)$, which is nonzero if $x\neq 0$. Since $\ddot{x}\neq 0$ means the system is not invariant. Hence, $\mathbf{R}$ defined by $\dot{x}=0$ has the largest invariant $\mathbf{M}$, trivially $(x,\dot x)=(0,0)$. By invoking LaSalle's, $(x,\dot{x})$ tends to $\mathbf{M}$, thereby completing the proof of asymptotic stability. \end{example} \begin{example}[PD control of EL systems or robot dynamics] \begin{equation}\label{NL_single_compact} \mathbf{M}(\mathbf{q})\mathbf{\ddot{q}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}}+\mathbf{g}(\mathbf{q}) =\boldsymbol{\tau} \end{equation} Consider the Proportional-Derivative controller $\boldsymbol{\tau}=-\mathbf{K}\tilde{\mathbf{q}}-\mathbf{D}\dot{\mathbf{q}}+\mathbf{g}(\mathbf{q})$ with constant $\mathbf{q}_d$ (i.e., $\mathbf{\dot{q}}_d=0$). Note $\mathbf{g}(\mathbf{q})$ is a feedforward cancellation term. The asymptotic stability of $\tilde{\mathbf{q}}=0$ or $\mathbf{q}\rightarrow \mathbf{q}_d$ as $t\rightarrow \infty$ can be proven by taking $V=(\dot{\mathbf{q}}^T\mathbf{M}(\mathbf{q})\dot{\mathbf{q}}+\tilde{\mathbf{q}}^T\mathbf{K}\tilde{\mathbf{q}})/2$. \end{example}\end{frame}\begin{frame} \begin{figure} \centering \includegraphics[width=0.55\textwidth]{Kravoskii.pdf} \caption{Krasovskii Theorem}\label{Kravoskii} \end{figure}\end{frame} \subsection{Extension of Lyapunov Function to Nonautonomous Systems} Consider a smooth nonlinear time-varying system \begin{equation}\label{xfx_ch2_L} {\mathbf{\dot x}}(t)=\mathbf{f}(\mathbf{x}(t),t) \end{equation} where $\mathbf{x}(t)\in\mathbb{R}^n$, and $\mathbf{f}: \mathbb{R}^n\times\mathbb{R}_{+}\rightarrow\mathbb{R}^n$ The concept of uniform stability is introduced to avoid systems that are less and less stable for larger values of $t_0$. \begin{definition}[Uniform Asymptotic Stability] There exists a ball of attraction $\mathbf{B}_r$, whose radius is independent of $t_0$, s.t. $\mathbf{x}(t)$ given the I.C. in $\mathbf{B}_r$ tends to $\mathbf{0}$ uniformly in $t_0$. By uniform convergence in terms of $t_0$, we mean that for all $R_1$ and $R_2$ satisfying $0<R_2<R_1\leq R_0$, $\exists T(R_1,R_2)>0$, such that, $\forall t_0\geq0$,\\ $\|\mathbf{x}(t_0)\|< R_1$ $\Rightarrow$ $\|\mathbf{x}(t_0)\|< R_2$ $\forall t\geq t_0+T(R_1,R_2)$; i.e., the state trajectory, starting from within a ball $\mathbf{B}_{R_1}$, will converge into a smaller ball $\mathbf{B}_{R_2}$ after some time period $T$ which is independent of $t_0$. \end{definition} \begin{example} $\dot{x}=-x/(1+t)$ is asymptotically stable but not uniformly. Check the solution $x(t)=(1+t_0)/(1+t)x(t_0)$. Intuitively, a large $t_0$ requires a longer time to get close to the origin. \end{example} The Lyapunov's direct method in Theorem \ref{Thm:LyapDir} still holds for a nonautonomous system in (\ref{xfx_ch2_L}). In particular, \textbf{uniform} (asymptotic) stability is achieved under the additional condition that $V$ is \emph{decrescent} (i.e., $\exists$ $V_1(\mathbf{x})>0$, $V(\mathbf{x},t)\geq V_0(\mathbf{x})$, s.t. $V(\mathbf{x},t)\leq V_1(\mathbf{x})$). This condition means that $V(x,t)$ is upper-bounded and lower-bounded by time-invariant positive definite functions $V_0$ and $V_1$. To summarize, we can use Theorem~\ref{MainUniform}. \begin{theorem}[Uniform (Asymptotic or Exponential) Stability]\label{MainUniform} Let $\mathbf{x}=0$ be an equilibrium point of (\ref{xfx_ch2_L}) and $\mathbf{B}_r=:\|\mathbf{x}\|<r$. Let $V$ : $\mathbf{B}_r \times \mathbb{R}_{+}\rightarrow\mathbb{R}_{+}$ be a continuously differentiable function such that $\forall t\geq 0, \ \ \forall \mathbf{x}\in \mathbf{B}_r$ \begin{equation} \dot V=\frac{\partial V}{\partial t}+\frac{\partial V}{\partial \mathbf{x}}\mathbf{f}(\mathbf{x},t)\leq -\gamma_3(\|\mathbf{x}\|) \end{equation} \begin{equation} \gamma_1(\|\mathbf{x}\|)\leq V(\mathbf{x},t)\leq \gamma_2(\|\mathbf{x}\|) \end{equation} Then, the equilibrium point $\mathbf{x}=\mathbf{0}$ is \begin{itemize} \item uniformly stable, if $\gamma_1$ and $\gamma_2$ are class $\mathcal{K}$ functions on $[0,r)$ and $\gamma_3(\cdot)\geq0$ on $[0,r)$; \item uniformly asymptotically stable, if $\gamma_1$, $\gamma_2$, and $\gamma_3$ are class $\mathcal{K}$ functions on $[0,r)$; \item exponentially stabile, if $\gamma_i(\rho)=k_i\rho^\alpha$ on $[0,r)$, $k_i>0, \alpha>0$, $i=1,2,3$; \item globally uniformly stable if $\mathbf{B}_r=\mathbb{R}^n$ and $\gamma_1$ and $\gamma_2$ are class $\mathcal{K}_\infty$ functions, and $\gamma_3(\cdot)\geq0$ on $\mathbb{R}_{+}$; \item globally uniformly asymptotically stable if $\mathbf{B}_r=\mathbb{R}^n$ and $\gamma_1$ and $\gamma_2$ are class $\mathcal{K}_\infty$ functions, and $\gamma_3(\cdot)$ is a class $\mathcal{K}$ function on $\mathbb{R}_{+}$; \item globally exponentially stable, if $\mathbf{B}_r=\mathbb{R}^n$ and $\gamma_i(\rho)=k_i\rho^\alpha$ on $\mathbb{R}_{+}$, $k_i>0, \alpha>0$, $i=1,2,3$. \end{itemize} \end{theorem} \begin{frame} The proof is given as follows. \begin{proof}[Proof of Theorem~\ref{MainUniform}] Since proving the uniform stability (boundednes) of the solution is easily constructed, we present only the proof of uniform asymptotical stability here. By using the inequality, \begin{equation} V\leq \gamma_2(\|\mathbf{x}\|) \Leftrightarrow \gamma_2^{-1}(V)\leq \|\mathbf{x}\| \Leftrightarrow \gamma_3(\gamma_2^{-1}(V))\leq \gamma_3(\|\mathbf{x}\|) \end{equation} \begin{equation} \dot{V}\leq -\gamma_3(\gamma_2^{-1}(V)) \end{equation} Since $\gamma_3(\gamma_2^{-1}(\cdot))$ is a class $\mathcal{K}$ function, $V$ has a unique solution defined as $V(t,\mathbf{x})\leq \sigma(V(t_0,\mathbf{x_0}),t-t_0)$ and $\sigma(\cdot,\cdot)$ is a class $\mathcal{KL}$ function. Hence, we can verify \begin{equation} \|\mathbf{x}(t)\|\leq \gamma_1^{-1}(V(t))\leq \gamma_1^{-1}(\sigma(V(t_0,\mathbf{x}_0),t-t_0))\leq \gamma_1^{-1}(\sigma(\gamma_2(\|\mathbf{x}_0\|),t-t_0)) \end{equation} where the last term can be defined as a class $\mathcal{KL}$ function $\beta(\|\mathbf{x}_0\|,t-t_0)=\gamma_1^{-1}(\sigma(\gamma_2(\|\mathbf{x}_0\|),t-t_0))$. If all the conditions above hold on $\mathbb{R}^n$ and the radially unboundedness of $V$ is satisfied by class $\mathcal{K}_\infty$ functions, then the convergence result is global.\end{proof} \end{frame} \begin{frame} In order to weaken the inequality requirement for asymptotic stability, Barbalat's lemma is introduced. One can be reminded that LaSalle's invariant set theorem is only applicable to autonomous systems, not nonautonomous systems. Before we state the theorem, we review the following \begin{itemize} \item $\dot{V}\rightarrow 0 \nRightarrow$ $V$ converges (has a limit). E.g., $V=\sin{(\log t)}$ and $\dot{V}=\cos{(\log t)}/t\rightarrow 0$ as $t\rightarrow \infty$. \item $V$ converges $\nRightarrow$ $\dot{V}\rightarrow 0 $ e.g., $V(t)=e^{-t}\sin(e^{2t})$ tends to zero but its derivative is unbounded. \item $V$ is lower bounded and decreasing ($\dot{V}\leq 0$), then it converges to a limit. \end{itemize} \begin{theorem}[Barbalat's Lemma]\label{Thm:Barbalat} If the differentiable function, $V(t)$ tends to a finite limit as $t\rightarrow\infty$, and if $\dot V (t)$ is uniformly continuous, then \begin{equation} \lim_{t\rightarrow \infty}\dot V (t)=0 \end{equation} Note that the uniform continuity of $\dot V (t)$ is sufficiently met if $\ddot{V}(t)$ exists and is bounded. \end{theorem}\end{frame} \begin{frame} \begin{figure} \centering \includegraphics[width=0.65\textwidth]{SlotineAndLI137.pdf} \end{figure} \end{frame} \begin{frame} \begin{figure} \centering \includegraphics[width=0.65\textwidth]{SlotineAndLI138.pdf} \end{figure}\end{frame} \begin{frame} \begin{figure} \centering \includegraphics[width=0.65\textwidth]{SlotineAndLI139.pdf} \end{figure}\end{frame} \begin{frame} \begin{figure} \centering \includegraphics[width=0.65\textwidth]{SlotineAndLI140.pdf} \end{figure}\end{frame} \begin{frame} The Lyapunov theorem along with Barbalat's lemma leads to the following powerful theorem: \begin{theorem}[LaSalle-Yoshizawa Lemma] Let $\mathbf{x}=0$ be an equilibrium point of (\ref{xfx_ch2_L}) and suppose $\mathbf{f}$ is locally Lipschitz in $\mathbf{x}$ uniformly in $t$. Let $V$ : $\mathbb{R}^n \times \mathbb{R}_{+}\rightarrow\mathbb{R}_{+}$ be a continuously differentiable function such that \begin{equation} \dot V=\frac{\partial V}{\partial t}+\frac{\partial V}{\partial \mathbf{x}}\mathbf{f}(\mathbf{x},t)\leq -W(\mathbf{x})\leq 0 \end{equation} \begin{equation} \gamma_1(\|\mathbf{x}\|)\leq V(\mathbf{x},t)\leq \gamma_2(\|\mathbf{x}\|) \end{equation} $\forall t \geq0$, $\forall \mathbf{x}\in \mathbb{R}^n$, where $\gamma_1$ and $\gamma_2$ are class $\mathcal{K}_\infty$ functions and $W$ is a continuous function. Then, all solutions of (\ref{xfx_ch2_L}) are globally uniformly bounded and satisfy \begin{equation} \lim_{t\rightarrow\infty}W(\mathbf{x}(t))=0 \end{equation} In addition, if $W(\mathbf{x})$ is positive definite, then the equilibrium $\mathbf{x}=0$ is globally uniformly asymptotically stable. \end{theorem} Often times, the asymptotic convergence of $W(\mathbf{x}(t))$ and $\dot V$ to zero is sufficient to prove the convergence of tracking errors even though the system per se might not be asymptotically stable.\end{frame} \subsection{Exponential Stability (Preview on Contraction Analysis)} \begin{frame} In linear systems, asymptotic stability automatically means global exponential convergence. For a time-varying nonlinear system such as (\ref{xfx_ch2_L}), some additional conditions are required. We can derive the following corollary from Theorem~\ref{MainUniform}. \begin{theorem}[Exponential Stability and Its Converse Theorem]\label{Thm:exponential} Let $\mathbf{x}=0$ be an equilibrium point of (\ref{xfx_ch2_L}) and suppose $\mathbf{f}$ is locally Lipschitz in $\mathbf{x}$ uniformly in $t$. Let $V$ : $\mathbb{R}^n \times \mathbb{R}_{+}\rightarrow\mathbb{R}_{+}$ be a continuously differentiable function such that \begin{equation}\label{Exp1} c_1\|\mathbf{x}\|^\alpha\leq V(\mathbf{x},t)\leq c_2\|\mathbf{x}\|^\alpha \end{equation} \begin{equation}\label{Exp2} \dot V=\frac{\partial V}{\partial t}+\frac{\partial V}{\partial \mathbf{x}}\mathbf{f}(\mathbf{x},t)\leq -c_3\|\mathbf{x}\|^\alpha \end{equation} where $c_1$, $c_2$, and $c_3$ are strictly positive and $\forall t \geq0$. Then, the equilibrium $\mathbf{x}=0$ is exponentially stable. If the above conditions hold globally, then it is globally exponentially stable. The popular choice of $\alpha=2$.\\ Conversely, let us assume that $\mathbf{x}=0$ is exponentially stable of the system $\mathbf{\dot{x}}=\mathbf{f}(\mathbf{x},t)$, then the converse theorem indicates there is a Lyapunov function satisfying (\ref{Exp1}-\ref{Exp2}) the in the appropriate domain (local or global) with $\alpha=2$. Furthermore,$\|\frac{\partial V}{\partial \mathbf{x}}\|\leq c_4\|\mathbf{x}\|$, $c_4>0$. This last condition is useful to analyze the stability of a perturbed system (to be discussed later in detail). \end{theorem} \end{frame} \begin{frame} \textbf{\emph{Proof: }} We can find $\dot{V}\leq -c_3/c_2 V$ by using $-\|x\|^\alpha\leq -V/c_2$. The comparison lemma says $\dot{V}\leq h(t,V)$ implies $V(t,x(t))\leq y(t)$ while $\dot{y}=h(t,y)$ and $y(t_0)=V(t_0,x(t_0)$. Hence, by the comparison lemma \begin{equation} V(t,\mathbf{x}(t))\leq V(t_0,\mathbf{x}(t_0))e^{-c_3/c_2(t-t_0)}\end{equation} \begin{align} \|\mathbf{x}(t)\|\leq (V/c_1)^{1/\alpha}&\leq (V(t_0)e^{-c_3/c_2(t-t_0)}/c_1)^{1/\alpha}\\ &\leq(c_2/c_1)^{1/\alpha}\|\mathbf{x}(t_0)\|e^{-c_3/(c_2\alpha)(t-t_0)}\nonumber \end{align} \qed \begin{remark} Exponential convergence offers numerous advantages. For instance, it provides a stronger form of stability, resulting in more efficient performance than the asymptotic convergence of PD control, particularly for tracking demanding trajectories. In addition, exponential stability is robust with respect to a class of perturbations (read Chapter 9 of Khalil~\cite{Khalil:2002}).\end{remark} In the next section, we introduce contraction theory, which can be efficiently used to prove global exponential \emph{incremental} stability of nonlinear systems.\end{frame} \section{Nonlinear Stability by Contraction Analysis}\label{sec:ContractionCH2} \begin{frame} \begin{itemize} \item Contraction theory provides a systematic method to build arbitrarily complex systems out of simpler elements. \item We also exploit contraction and partial contraction theory~\cite{Ref:contraction3} to prove the stability of multiple coupled nonlinear dynamics. \item Lyapunov's linearization method indicates that the local stability of the nonlinear system can be analyzed using its differential approximation. \item What is new in contraction theory is that a differential stability analysis can be made exact, thereby yielding \textbf{global and exponential convergence} results in nonlinear systems. \end{itemize} A brief review of the results from \cite{Ref:contraction1,Ref:contraction2,Ref:contraction3} along with my own interpretation is presented in this section. Readers are referred to these references for detailed descriptions and proofs on the following theorems.\end{frame} \begin{frame}Note that contraction theory is a generalization of the classical Krasovskii's theorem~\cite{Ref:Slotine}, and that approaches closely related to contraction, although not based on differential analysis, can be traced back to \cite{Hart,Demi} and even to~\cite{Lew}. A recent work~\cite{Rantzer} also independently derived a similar result on the use of the monotonicity of singulary weighted volumes. \begin{theorem}[Sufficient Condition for LTV Stability (cf. contraction analysis)] The linear time-varying system (LTV) $\bf{\dot{x}}=\bf{A}(t)\bf{x}$ is globally exponentially stable ($\bf{x}$ tends to $\bf{0}$ exponentially) if $\exists$ $\beta>0$, $\forall i$, $\forall $ $t\geq 0$, $\lambda_i(\bf{A}(t)+\bf{A}(t)^T)\leq -\beta$. \end{theorem} \textbf{\emph{Proof: }} Take $V=\bf{x}^T\bf{x}$ and compute $\dot{V}$. \begin{theorem}[Krasovskii's Theorem (cf. contraction analysis)] Let $\bf{A}(\bf{x})$ denote the Jacobian of $\bf{f}(\bf{x})$ of the autonomous system $\bf{\dot{x}}=\bf{f}(\bf{x})$. If the matrix $\bf{F}=\bf{A}+\bf{A}^T$ is negative on $\bf{B}_r$, the equilibrium point is asymptotically stable. \emph{Proof:} Use $V(\bf{x})=\bf{f}^T\bf{f}$. \end{theorem} \end{frame} \begin{frame} Before we move onto the details, the key advantages of contraction analysis are summarized as below. \begin{itemize} \item Contraction theory is a differential-based \textbf{incremental stability analysis} of multiple trajectories (as opposed to stability of an equilibrium point). Differential-based analysis is easier for analyzing stability of a networked or combined system (e.g., hierarchical, feedback, or serial combinations). In contrast, passivity-based analysis cannot be applied to a hierarchically-combined system. \item Contraction theory is more generalized. For instance, all examples and theorems in \cite{Rantzer} are for autonomous systems whereas contraction theory can be easily applied to general time-varying systems including systems with time-varying desired trajectories. \item Convergence of contraction theory is stronger: exponential and global. Asymptotic convergence of a PD controller is not enough for tracking demanding time-varying reference inputs of nonlinear systems. \item The proof is intuitive and much simpler. This truly sets contraction analysis aside from other methodologies. For example, one can recall the proof of global and time-varying version of Krasovskii's theorem. \item Contraction theory also permits a non-constant metric and a pure differential coordinate change, which is not explicit in \cite{Rantzer}. This generalization of the metric (generalized Jacobian, not just $\frac{df}{dx}$) is one of the differences with other methodologies.\end{itemize} \end{frame} \subsection{Fundamentals} \begin{frame} Suppose that one can construct a virtual volume out of the given dynamics. Rather than finding a decreasing scalar function by the Lyapunov method, a contracting volume indicates the system is contracting. How can we quantify the contraction rate of the virtual volume constructed from the dynamical system? By computing contraction of two neighboring trajectories in the flow field. Consider a smooth nonlinear system \begin{equation}\label{xfx_ch2} {\mathbf{\dot x}}(t)=\mathbf{f}(\mathbf{x}(t),\mathbf{u}(\mathbf{x},t),t) \end{equation} where $\mathbf{x}(t)\in\mathbb{R}^n$, and $\mathbf{f}: \mathbb{R}^n\times\mathbb{R}^m\times\mathbb{R}_{+}\rightarrow\mathbb{R}^n$. \begin{definition}[Virtual Displacement $\delta \mathbf{x}$]A virtual displacement, $\delta\mathbf{x}$ is defined as an infinitesimal displacement at a fixed time-- a common supposition in the \textbf{calculus of variations}.\end{definition} \begin{figure} \centering \includegraphics[width=0.76\textwidth]{contraction_illustration.PNG} \end{figure} \end{frame} \begin{frame} \begin{theorem}[1st Main Theorem of Contraction Analysis]\label{Thm:contraction} For the system in (\ref{xfx_ch2}), if there exists a uniformly positive definite metric, \begin{equation}\label{metric} \mathbf{M}(\mathbf{x},t)={\mathbf{\Theta}}(\mathbf{x},t)^{T}{\mathbf{\Theta}}(\mathbf{x},t) \end{equation} where $\mathbf{\Theta}$ is some smooth coordinate transformation of the virtual displacement, $\delta\mathbf{z}={\mathbf{\Theta}}\delta\mathbf{x}$, such that the associated generalized Jacobian $\bf F$ is uniformly negative definite, i.e., $\exists \lambda >0$ such that \begin{equation}\label{jacobian_ch2} \mathbf{F}=\left(\mathbf{\dot{\Theta}}{(\mathbf{x},t)}+{\mathbf{\Theta}(\mathbf{x},t)}\frac{\partial \mathbf{f}}{\partial \mathbf{x}}\right){\mathbf{\Theta}(\mathbf{x},t)}^{-1} \le - \lambda {\bf I}, \end{equation} then all system trajectories converge globally to a single trajectory exponentially fast regardless of the initial conditions, with a global exponential convergence rate of the largest eigenvalues of the symmetric part of $\mathbf{F}$. \end{theorem} \begin{definition}[Contracting $\triangleq$ Global Exponential Stability of Solution Trajectories] Such a system satisfying the conditions in Theorem~\ref{Thm:contraction} is said to be contracting.\end{definition} \end{frame} \begin{frame} A sketch of the proof~\cite{Ref:contraction1} is given here. \textbf{\emph{Proof:}} The dynamics of $\delta\mathbf{z}={\mathbf{\Theta}}\delta\mathbf{x}$ are computed as \begin{equation} \frac{d}{dt}\delta\mathbf{z}={\mathbf{\dot \Theta}}\delta\mathbf{x}+{\mathbf{\Theta}}\delta\mathbf{\dot x}=\mathbf{F}\delta\mathbf{z} \end{equation} Hence, the rate of change of squared length, which quantifies the contraction rate of the volume, is represented as \begin{equation} \frac{d}{dt}(\delta \mathbf{z}^T\delta \mathbf{z})=2\delta \mathbf{z}^T\frac{d}{dt}\delta\mathbf{z}=2\delta \mathbf{z}^T\mathbf{F}\delta\mathbf{z}\leq -\lambda \mathbf{z}^T\mathbf{z} \end{equation} Equivalently, we can write \begin{equation} \frac{d}{dt}\|\delta \mathbf{z}\|\leq -\lambda\|\delta \mathbf{z}\| \end{equation} By the comparison lemma (Lemma~\ref{ComparisonLemma}), we can find $\|\delta \mathbf{z}(t)\|\leq \|\delta \mathbf{z}_0\|e^{-\lambda t}$. Hence, any infinitesimal length $\|\delta \mathbf{z}(t)\|$ and $\|\delta \mathbf{x}(t)\|$ tend to zero exponentially fast. By path integration, this immediately imples that the length of any finite path converges to exponentially to zero from any initial conditions. Here we use $\|\cdot\|=\|\cdot\|_2$.\qed \end{frame} \begin{frame} \begin{lemma}[Comparison Lemma~\cite{Khalil:2002}]\label{ComparisonLemma} Consider $\dot{x}=f(x,t)$, $x(t_0)=x_0$, where $f(x,t)$ is continuous in $t$ and locally Lipschitz in $x$, for $\forall t\geq0$ and $x\in J \subset \mathbb{R}$. Let $[t_0,T)$ where $T$ can be $\infty$, denote the maximal interval of existence of the solution $x(t)\in J$. Let $v(t)$ be a continuous function that satisfies $$ D^{+}v(t)\leq f(t,v), \ \ v(t_0)\leq x_0 $$ with $v(t)\in J$ for all $t\in [t_0,T)$. Then, $v(t)\leq x(t),$ $\forall t\in[t_0,T)$. See Khalil~\cite{Khalil:2002} (pages 102-103; pages 350-353) \end{lemma} \begin{remark}No matter where the initial states start in the configuration manifold, they converge to a single trajectory with global and exponential convergence. This convergence result epitomizes the significance of contraction analysis. In the context of fluid dynamics, we can recall Gauss' divergence theorem. Indeed, the divergence of the virtual length vector field, $\text{div}(\frac{d}{dt}\delta\mathbf{z})$ is the trace of $\mathbf{F}$~\cite{Ref:contraction1}.\end{remark}\end{frame} \begin{frame} \begin{corollary}[2nd Main Theorem of Contraction Analysis]\label{Metric_anal} Equivalently, the system is contracting if $\exists \lambda >0$ such that \begin{equation}\label{M_length} \mathbf{\dot{M}}+\left(\frac{\partial \mathbf{f}}{\partial \mathbf{x}}\right)^T\mathbf{{M}}+\mathbf{{M}}\frac{\partial \mathbf{f}}{\partial \mathbf{x}} \le - 2 \lambda {\bf M} \end{equation} \end{corollary} \begin{proof} We can easily find \begin{equation} \frac{d}{dt}\left(\delta\mathbf{x}^T\mathbf{M}\delta\mathbf{x}\right) =\delta\mathbf{x}^T\Bigl(\mathbf{\dot{M}}+(\frac{\partial \mathbf{f}}{\partial \mathbf{x}})^T\mathbf{{M}}+\mathbf{{M}}\frac{\partial \mathbf{f}}{\partial \mathbf{x}}\Bigr)\delta\mathbf{x} \end{equation} Hence, we can conclude that the condition in (\ref{M_length}) leads to exponential convergence of $\delta \mathbf{x}$ to zero. % \end{proof} The symmetric and positive definite Riemannian metric, from the Lagrangian representation of dynamical systems, facilitates the use of such a metric in contraction analysis. It can also be shown that for a contracting autonomous system, of the form ${\mathbf{\dot x}}=\mathbf{f}(\mathbf{x},\mathbf{u}(\mathbf{x}))$, all trajectories converge to an equilibrium point exponentially fast. In essence, contraction analysis implies that stability of nonlinear systems can be analyzed more simply by checking the negative definiteness of a proper matrix, rather than finding some implicit motion integral as in Lyapunov theory.\end{frame} \begin{frame} \begin{example} Check whether $\dot{x}=-x+e^t$ and $\dot{x}=-t(x+x^3)$ are contracting.\end{example} \begin{example}[Gradient system] Consider $\dot{\mathbf{x}}=-\mathrm{grad}(V(\mathbf{x}))$. If $\mathbf{\theta}(t)=\mathbf{I}$, the Jacobian $\mathbf{F}=\frac{\partial{\mathbf{f}}}{\partial{\mathbf{x}}}=-\frac{\partial^2 V}{\partial \mathbf{x}^2}$. Hence, $\mathbf{F}<0$ and the system is contracting if $V$ is a convex function. \end{example} A related example: \begin{example}[Sine function]\label{Example_sine} Consider $\boldsymbol{\dot\theta}=-\mathbf{K}(t)\sin(\boldsymbol\theta)$ on $\boldsymbol{\theta}\in \mathbb{T}^n$, where $\mathbf{K}(t)$ is a diagonal matrix. Following \cite{Ref:contraction1}, consider $\mathbf{\Theta}=\text{diag}\left(\frac{1}{2}\sec^2(\boldsymbol{\theta}/2)\right)$ on $\boldsymbol{\theta}\in(-\pi,\pi)^n$. Then, we can compute the generalized Jacobian $\mathbf{F}=\mathbf{\dot\Theta}\mathbf{\Theta}^{-1} -\mathbf{\Theta} \mathbf{K}\text{diag}(\cos\boldsymbol{\theta})\mathbf{\Theta}^{-1}=-\mathbf{K} $. Hence, for $\mathbf{K}(t)>0$, $\boldsymbol{\theta}$ tends exponentially to zero on $\boldsymbol{\theta}\in(-\pi,\pi)^n$ by Theorem~\ref{Thm:contraction}.\end{example} \end{frame} \begin{frame} \begin{figure} \begin{center} \includegraphics[width=0.7\textwidth]{chaos.jpg} \caption{Lorenz attractor}\label{chaospic} \end{center} \end{figure} \end{frame} \begin{frame} \begin{example}[Chaotic synchronization] Much attention has been devoted to synchronization in chaotic systems. A central characteristic of a chaotic system like the Lorenz Attractor in Figure~\ref{chaospic} is that its long-term behavior is often impossible to predict but its short-term behavior is relatively easy to anticipate, so its immediate propagation can be controlled. In particular, Pecora et al. reported that this phenomenon can be used for communications by means of chaotic synchronization. Recently, Argyris implemented the fist long-distance demonstration of chaotic synchronization using a pair of laser diodes, amplifiers, a mirror and more than 120 kilometers of underground fiber. Consider the Lorenz system \ \ \ \ \ \ \ \ \ \ $\dot{x} \ = \ \sigma \ (y -x)$ \ \ \ \ \ \ \ \ \ \ $\dot{y} \ = \ \rho \ x \ - \ y \ - \ x \ z$ \ \ \ \ \ \ \ \ \ \ $\dot{z} \ = \ - \ \beta \ z \ + \ x \ y$ \noindent with strictly positive constants $\sigma, \rho, \beta $, and, a reduced-order identity observer for this system based on an available measurement of the variable $x$, \ \ \ \ \ \ \ \ \ \ $\dot{\hat y} \ = \ \rho \ x \ - \ {\hat y} \ - \ x \ {\hat z}$ \ \ \ \ \ \ \ \ \ \ $\dot{\hat z} \ = \ - \ \beta \ {\hat z} \ + \ x \ {\hat y}$ The symmetric part of the observer's Jacobian is $ \ - \ {\rm diag}(1, \beta) $, and thus the observer is contracting with an identity metric. Since by construction $({\hat y}, {\hat z}) = (y, z) $ is a particular solution, the estimated state converges exponentially to the actual state. This can also be described as an active-passive decomposition. \end{example} \end{frame} \begin{frame} \begin{remark}[Generalization to Other Norms] Using the same point of view, Theorem~\ref{Thm:contraction} can be applied to other vector norms of $\|\delta \mathbf{z}\|_p$ with $p=1$ or $p=\infty$. \end{remark} \begin{figure} \centering \includegraphics[width=\textwidth]{contraction_theory_10.pdf}\\ \caption{contraction analysis with other norms}\label{Eq:othernorms} \end{figure} \end{frame} \subsection{Path-Length Integral and Robustness Analysis} \begin{frame}Contraction analysis takes a different notion of stability: incremental stability of multiple trajectories. Since contraction means \emph{exponential} convergence, a contracting system exhibits a property of superior robustness. \begin{lemma}[Robust contraction analysis]\label{LM:Robust_contraction_original} Let $P_1(t)$ be a solution of the contracting system (\ref{xfx_ch2}) that satisfies Theorem~\ref{Thm:contraction}, globally exponentially tending to a single trajectory at a contraction rate $\lambda$. (\ref{xfx_ch2}) is now perturbed as \begin{equation}\label{Eq:fxt2-1} \dot{\mathbf{x}} = \mathbf{f}(\mathbf{x},t) + \mathbf{d}(\mathbf{x},t) \end{equation} and $P_2(t)$ denotes a trajectory of (\ref{Eq:fxt2-1}). Then, the smallest path integral (i.e., distance) $$R(t)=\int^{P_2}_{P_1} \|\delta \mathbf{z}(t)\|=\int^{P_2}_{P_1} \|\boldsymbol{\Theta}(\mathbf{x},t)\delta \mathbf{x}(t)\|,\ \ \forall t\geq 0$$ exponentially converges to the following error ball~\cite{Ref:contraction1}, with $\mathbf{\Theta}\mathbf{d}\in \mathcal{L}_\infty$ \begin{equation}\label{Eq:Robust_contraction21} \lim_{t\rightarrow \infty}R(t) \leq \sup_{\mathbf{x},t} \|\mathbf{\Theta(\mathbf{x},t)}\mathbf{d}(\mathbf{x},t)\|/\lambda\end{equation} \end{lemma} \end{frame} \begin{frame}[allowframebreaks] \textbf{\emph{Proof:}} First, consider the distance $R(t)=\int^{P_2}_{P_1} \|\delta \mathbf{z}(t)\|$ between two arbitrary trajectories $P_1$ and $P_2$ of the original unperturbed dynamics $\dot{\mathbf{x}}=\mathbf{f}(\mathbf{x},t)$ (\ref{xfx_ch2}) that is contracting with the metric $\mathbf{M}(x,t)$ with the rate $\lambda$: $$ \dfrac{d\|\delta\mathbf{z}\|}{dt}\leq-\lambda\|\delta\mathbf{z}\| $$ Then, we can verify $$ \dot{R}=\int^{P_2}_{P_1}\dfrac{d\|\delta\mathbf{z}\|}{dt}\leq-\lambda\int^{P_2}_{P_1}\|\delta\mathbf{z}\|\Rightarrow \dot{R}+\lambda R\leq 0\Rightarrow R(t)\leq e^{-\lambda t}R(0) $$ where the last equivalence is obtained by the Comparison Lemma (Lemma~\ref{ComparisonLemma}). As a result, any path integral $R(t)$ between any two arbitrary trajectories of (\ref{xfx_ch2}) tends to zero exponentially fast at the exponential rate $\lambda$. Note that $P_1-P_2=\int^{P_2}_{P_1} \delta \mathbf{x}$ and $\|P_1-P_2\|=\|\int^{P_2}_{P_1} \delta \mathbf{x}\| \leq \int^{P_2}_{P_1} \|\delta \mathbf{x}\|$ and $\sqrt{\lambda_\mathrm{min}(\mathbf{M})}\|P_1-P_2\|\leq\int^{P_2}_{P_1} \|\delta \mathbf{z}\|$. Now consider the smallest path integral $R(t)=\int^{P_2}_{P_1} \|\delta \mathbf{z}(t)\|=\int^{P_2}_{P_1} \|\boldsymbol{\Theta}(\mathbf{x},t)\delta \mathbf{x}(t)\|$ with $P_2$ being a perturbed solution from (\ref{Eq:fxt2-1}). Since $\delta\dot{\mathbf{z}}=\mathbf{F}\delta\mathbf{z}+\mathbf{\Theta}\delta\mathbf{d}$, \begin{align} \dfrac{d}{dt}\delta \mathbf{z}^T\delta \mathbf{z}=2\|\delta \mathbf{z}(t)\|\dfrac{d}{dt}\|\delta \mathbf{z}(t)\|&=2\delta \mathbf{z}^T(\mathbf{F}\delta \mathbf{z}+\mathbf{\Theta}\delta \mathbf{d})\nonumber\\&\leq=-2\lambda \|\delta \mathbf{z}(t)\|^2+2\|\delta \mathbf{z}(t)\|\|\mathbf{\Theta}\delta \mathbf{d}\|\nonumber\\ &\Rightarrow \dfrac{d}{dt}\|\delta \mathbf{z}(t)\|\leq -\lambda \|\delta \mathbf{z}(t)\|+\|\mathbf{\Theta}\delta \mathbf{d}\| \end{align} By applying the path integral between $P_1$ and $P_2$, we can obtain \begin{align} \int^{P_2}_{P_1}\dfrac{d}{dt}\|\delta \mathbf{z}(t)\|&\leq -\lambda \int^{P_2}_{P_1}\|\delta \mathbf{z}(t)\|+\int^{P_2}_{P_1}\|\mathbf{\Theta}\delta \mathbf{d}\|\\ \dot{R}(t)&\leq -\lambda R(t)+ \|\mathbf{\Theta}\mathbf{d}\| \end{align} Then, applying the comparison lemma [Khalil, p.102-103, p.350-353] results in \begin{equation}\label{Eq:Robust_contraction3} R(t) \leq e^{-\lambda t}R(0)+\int^{t}_{0}e^{-\lambda(t-\tau)} \|\mathbf{\Theta}(\mathbf{x},\tau)\mathbf{d}(\mathbf{x},\tau)\| d\tau \end{equation} By taking the supremum of $\|\mathbf{\Theta}\mathbf{d}\|$ out of the integral in~(\ref{Eq:Robust_contraction3}), \begin{align} R(t) &\leq e^{-\lambda t}R(0)+\sup_t{\|\mathbf{\Theta}(\mathbf{x},t)\mathbf{d}(\mathbf{x},t)\|}\int^{t}_{0}e^{-\lambda(t-\tau)} d\tau\nonumber\\ &\leq e^{-\lambda t}R(0)+\sup_t{\|\mathbf{\Theta}(\mathbf{x},t)\mathbf{d}(\mathbf{x},t)\|}\frac{1-e^{-\lambda t}}{\lambda}\nonumber \end{align} which leads to (\ref{Eq:Robust_contraction21}).\qed \end{frame} \subsection{Input Output Stability: Finite-Gain $\mathcal{L}_p$ Stability} \begin{frame}\frametitle{Input Output Stability: Finite-Gain $\mathcal{L}_p$ Stability} This section is based on \cite{Ref:phasesync}. Before stating the next lemma, we define the $\mathcal{L}_p$ norm in the extended space $\mathcal{L}_{pe}$, $p\in [1,\infty]$ as follows \begin{align} &\|(\mathbf{u})_\tau\|_{\mathcal{L}_p}=\left(\int^{\tau}_{0}\|\mathbf{u}(t)\|^p dt\right)^{1/p} <\infty , \ \ p\in[1,\infty) \nonumber\\ &\|(\mathbf{u})_\tau\|_{\mathcal{L}_\infty}=\sup_{t\geq 0}\|(\mathbf{u}(t))_\tau\|<\infty \end{align} where $(\mathbf{u}(t))_\tau$ is a truncation of $\mathbf{u}(t)$, i.e., $(\mathbf{u}(t))_\tau=\mathbf{0}$ for $t\geq \tau$, $\tau\in[0,\infty)$ while $(\mathbf{u}(t))_\tau=\mathbf{u}(t)$ for $0\leq t\leq \tau$. Except for $\mathcal{L}_p$ norms, the symbol $p$ in this paper denotes the total number of EL systems in the network.\end{frame} \begin{lemma}[Robust contraction and link to $\mathcal{L}_p$ stability \& Input-to-State Stability]\label{LM:Robust_contraction} Let $P_1(t)$ be a solution of the contracting system (\ref{xfx_ch2}), globally exponentially tending to a single trajectory at a contraction rate $\lambda$. Equation (\ref{xfx_ch2}) is now perturbed as \begin{equation}\label{Eq:fxt2} \dot{\mathbf{x}} = \mathbf{f}(\mathbf{x},t) + \mathbf{d}(\mathbf{x},t) \end{equation} and $P_2(t)$ denotes a trajectory of (\ref{Eq:fxt2}). Then, the smallest path integral (i.e., distance) $R(t)=\int^{P_2}_{P_1} \|\delta \mathbf{z}(t)\|=\int^{P_2}_{P_1} \|\boldsymbol{\Theta}(\mathbf{x},t)\delta \mathbf{x}(t)\|$, $\forall t\geq 0$ exponentially converges to the following error ball~\cite{Ref:contraction1}, with $\mathbf{\Theta}\mathbf{d}\in \mathcal{L}_\infty$ \begin{equation}\label{Eq:Robust_contraction2} \lim_{t\rightarrow \infty}R(t) \leq \sup_{\mathbf{x},t} \|\mathbf{\Theta(\mathbf{x},t)}\mathbf{d}(\mathbf{x},t)\|/\lambda\end{equation} Furthermore, (\ref{Eq:fxt2}), which is perturbed by $\mathbf{d}(\mathbf{x},t)\in \mathcal{L}_{pe}$, is finite-gain $\mathcal{L}_p$ stable with $p\in [1,\infty]$ for an output function $\mathbf{y}=\mathbf{h}(\mathbf{x},\mathbf{d},t)$ with $\int^{Y_2}_{Y_1}\|\delta \mathbf{y}\|\leq \eta_1 \int^{P_2}_{P_1}\|\delta \mathbf{x}\|+\eta_2\|\mathbf{d}\|$, $\exists $ $\eta_1,\eta_2\geq0$, since \begin{align}\label{Eq:Robust_contractionLp} &\left\|{\left(\int^{Y_2}_{Y_1} \|\delta \mathbf{y}\|\right)_\tau}\right\|_{\mathcal{L}_p} \leq \frac{\eta_1\zeta R(0)}{\sqrt{\lambda_\mathrm{min}(\mathbf{M})}}+(\frac{\eta_1}{\lambda}+{\eta_2})\frac{\|(\mathbf{\Theta}\mathbf{d})_\tau \|_{\mathcal{L}_p}}{\sqrt{\lambda_\mathrm{min}(\mathbf{M})}}, \ \forall \tau\in[0,\infty) \end{align} where $Y_1$ and $Y_2$ denote the output trajectories of the original contracting system (\ref{xfx_ch2}) and its perturbed system (\ref{Eq:fxt2}), respectively. Also, $\zeta=1$ if $p=\infty$ or $\zeta=1/(\lambda p)^{1/p}$ if $p\in[1,\infty)$, and $\lambda_\mathrm{min}(\mathbf{M})$ is defined as $\mathbf{M}(\mathbf{x},t)\geq \lambda_\mathrm{min}(\mathbf{M})\mathbf{I}$, $\forall$ $t\geq 0$. The perturbed system (\ref{Eq:fxt2}) is also input-to-state stable (ISS). \end{lemma} \textbf{\emph{Proof:}} After differentiating $R(t)=\int^{P_2}_{P_1} \|\delta \mathbf{z}(t)\|$, we can obtain $\dot{R}+\lambda R\leq \|\mathbf{\Theta}\mathbf{d}\|$~\cite{Ref:contraction1}. Then, applying the comparison lemma [Khalil, p.102-103, p.350-353] results in \begin{equation}\label{Eq:Robust_contraction3} R(t) \leq e^{-\lambda t}R(0)+\int^{t}_{0}e^{-\lambda(t-\tau)} \|\mathbf{\Theta}(\mathbf{x},\tau)\mathbf{d}(\mathbf{x},\tau)\| d\tau \end{equation} By taking the supremum of $\|\mathbf{\Theta}\mathbf{d}\|$ out of the integral in~(\ref{Eq:Robust_contraction3}), we can derive (\ref{Eq:Robust_contraction2}). In keeping with Corollary 5.1 of [Khalil], (\ref{Eq:Robust_contraction3}) satisfies \begin{align}\label{Eq:Robust_contractionLp2} \|(R)_\tau\|_{\mathcal{L}_p}&\leq R(0)\|(e^{-\lambda t})_\tau\|_{\mathcal{L}_p} +\|e^{-\lambda t}\|_{\mathcal{L}_1} \|(\mathbf{\Theta}\mathbf{d})_\tau \|_{\mathcal{L}_p} \nonumber \\ &\leq R(0)\zeta +\|(\mathbf{\Theta}\mathbf{d})_\tau \|_{\mathcal{L}_p}/\lambda \end{align} Since $\mathbf{M}\succ 0$ uniformly, $\|\mathbf{\Theta}^{-1}\|\leq 1/\sqrt{\lambda_\mathrm{min}(\mathbf{M})}$. Then, (\ref{Eq:Robust_contractionLp}) is obtained by using both (\ref{Eq:Robust_contractionLp2}) and the known bound of $\|\delta \mathbf{y}\|$, thereby yielding a finite $\mathcal{L}_p$ gain independently of $\tau$. Note that if we can further show that $\mathbf{M}(\mathbf{x},t)$ is uniformly upper-bounded, we can use $\|(\mathbf{\Theta}\mathbf{d})_\tau \|_{\mathcal{L}_p}\leq \alpha \|(\mathbf{d})_\tau \|_{\mathcal{L}_p}$, $\exists \alpha>0$. For ISS, we can compute an ultimate bound of $R(t)$, which is true for $t\geq T$, $\exists$ $T$ instead of $t\rightarrow\infty$ as in (\ref{Eq:Robust_contraction2}), since global exponential stability of an unperturbed system results in input-to-state stability (see Lemma 4.6 of [Khalil]).~~~~$\square$ \begin{lemma}[Robust hierarchical connection]\label{LM:Robust_contraction_hierc} The hierarchically combined system of two contracting dynamics with a generalized Jacobian matrix $\left[\begin{smallmatrix}\mathbf{F}_{11} & \mathbf{0}\\ \mathbf{F}_{21} & \mathbf{F}_{22}\end{smallmatrix}\right]$ is assumed to be subject to a perturbed flow field of $[\mathbf{d}_1;\mathbf{d}_2]$. Then, the path length integral $R_i(t)=\int^{P_2}_{P_1}\|\delta \mathbf{z}_i\|$, $i=1,2$ between the original and perturbed dynamics verifies~\cite{Ref:contraction1} \begin{align}\label{Eq:hierclemma} \dot{R}_1+|\lambda_{max}(\mathbf{F}_{11})|{R}_1&\leq\|\boldsymbol{\Theta}_1\mathbf{d}_1\| \\ \dot{R}_2+|\lambda_{max}(\mathbf{F}_{22})| {R}_2&\leq\|\boldsymbol{\Theta}_2\mathbf{d}_2\|+\int^{P_2}_{P_1}\|\mathbf{F}_{21}\|\|\delta \mathbf{z}_1\|\nonumber \end{align} Hence, the error bounds of $R_1(t)$ and $R_2(t)$ can be obtained similar to (\ref{Eq:Robust_contraction2}) and (\ref{Eq:Robust_contraction3}-\ref{Eq:Robust_contractionLp2}) under the assumption of bounded $\|\mathbf{F}_{21}\|$. Also, similar to (\ref{Eq:Robust_contractionLp}), a hierarchical connection for $\mathcal{L}_p$ stability can be established by using \begin{align}\label{Eq:hierclemma2} \|(R_2)_\tau\|_{\mathcal{L}_p} & \leq R_2(0)\zeta_2 +\frac{\bar{\sigma}(\mathbf{F}_{21})}{\lambda_2}R_1(0)\zeta_1 \\ &\ \ +\frac{\|(\mathbf{\Theta}_2\mathbf{d}_2)_\tau \|_{\mathcal{L}_p}}{\lambda_2}+\frac{\bar{\sigma}(\mathbf{F}_{21})}{\lambda_1\lambda_2}\|(\mathbf{\Theta}_1\mathbf{d}_1)_\tau \|_{\mathcal{L}_p}\nonumber \end{align} where $\lambda_i=|\lambda_{max}(\mathbf{F}_{ii})|$ from (\ref{Eq:hierclemma}) and $\bar{\sigma}(\cdot)$ is the largest singular value for all $t\geq0$. Also, $\zeta_i=1$ if $p=\infty$ or $\zeta_i=1/(\lambda_i p)^{1/p}$ if $p\in[1,\infty)$ for $i=1,2$. By recursion, this result can be extended to an arbitrary number of hierarchically combined groups.\end{lemma} \begin{frame} \textbf{\emph{Proof:}} The proof follows from obtaining $\|(R_1)_\tau\|_{\mathcal{L}_p}$ from (\ref{Eq:Robust_contractionLp2}) and recursively obtaining $\|(R_2)_\tau\|_{\mathcal{L}_p}$ from the second equation of (\ref{Eq:hierclemma}).~~~~$\square$ \end{frame} \subsection{Contraction Analysis for Stochastic Nonlinear Dynamics} \begin{remark} This subsection is based on~\cite{Ref:Stochastic}: A. P. Dani, S.-J. Chung, and S. Hutchinson, ``Observer Design for Stochastic Nonlinear Systems via Contraction-based Incremental Stability,'' \emph{IEEE Transactions on Automatic Control}, vol. 60, no. 3, March 2015, pp. 700-714. \end{remark} We present the so-called stochastic contraction lemma that uses a state-dependent metric, thereby generalizing the main result presented in \cite{Pham2009}. The squared virtual displacement between two trajectories of (\ref{xfx_ch2}) with a symmetric, uniformly positive definite metric $M\left(x,t\right)\in\mathbb{R}^{n\times n}$ is given by $\delta x^{T}M\left(x,t\right)\delta x$ (cf. Riemannian metric). Its time derivative is given by \begin{align} \frac{d}{dt}\left(\delta x^{T}M\left(x,t\right)\delta x\right) & =\delta x^{T}\left(\frac{\partial f}{\partial x}^{T}M\left(x,t\right)+\dot{M}\left(x,t\right)+M\left(x,t\right)\frac{\partial f}{\partial x}\right)\delta x. \end{align} If the following inequality is satisfied \begin{equation} \frac{\partial f}{\partial x}^{T}M\left(x,t\right)+\dot{M}\left(x,t\right)+M\left(x,t\right)\frac{\partial f}{\partial x}\leq-2\gamma M\left(x,t\right)\:\forall t,\:\forall x\label{eq:contractionRate-2} \end{equation} for a strictly positive constant $\gamma,$ then the system (\ref{xfx_ch2}) is said to be contracting with the rate $\gamma$ and all the system trajectories exponentially converge to a single trajectory irrespective of the initial conditions (hence, globally exponentially stable). \begin{frame} Consider a stochastically perturbed system of the nominal system (\ref{xfx_ch2}) represented using an Ito stochastic differential equation \begin{equation} dx=f\left(x,t\right)dt+B\left(x,t\right)dW,\qquad x(0)=x_{0}\label{eq:stochastiSys} \end{equation} and the conditions for existence and uniqueness of a solution to (\ref{eq:stochastiSys}) \begin{align} & \exists L_{1}>0,\,\forall t,\,\forall x_{1},x_{2}\in\mathbb{R}^{n}:\nonumber \\ & \left\Vert f(x_{1},t)\!-\! f(x_{2},t)\right\Vert \!+\!\left\Vert B(x_{1},t)\!-\! B(x_{2},t)\right\Vert _{F}\!\leq\! L_{1}\left\Vert x_{1}\!-\! x_{2}\right\Vert \!,\nonumber \\ & \exists L_{2}>0,\,\forall t,\,\forall x_{1}\in\mathbb{R}^{n}:\nonumber \\ & \;\left\Vert f(x_{1},t)\right\Vert ^{2}+\left\Vert B(x_{1},t)\right\Vert _{F}^{2}\leq L_{2}(1+\left\Vert x_{1}\right\Vert ^{2}) \end{align} where $B:\mathbb{R}^{n}\times\mathbb{R}\rightarrow\mathbb{R}^{n\times d}$ is a matrix-valued function, $W\left(t\right)$ is a $d$-dimensional Wiener process, and $x_{0}$ is a random variable independent of $W$. Consider any two systems with trajectories $a(t)$ and $b(t)$ obtained by the same function $f\left(\cdot\right)$ in (\ref{eq:stochastiSys}) but driven by independent Wiener processes $\bar{W}_{1}$ and $\bar{W}_{2}$ \begin{align} dz & =\left(\begin{array}{c} f\left(a,t\right)\\ f\left(b,t\right) \end{array}\right)dt+\left(\begin{array}{cc} B_{1}\left(a,t\right) & 0\\ 0 & B_{2}\left(b,t\right) \end{array}\right)\left(\begin{array}{c} d\bar{W}_{1}\\ d\bar{W}_{2} \end{array}\right)\nonumber \\ & =f_{s}\left(z,t\right)dt+B_{s}\left(z,t\right)d\bar{W}\label{eq:dx} \end{align} where $z\left(t\right)=(a(t)^{T},b(t)^{T})^{T}\in\mathbb{R}^{2n}.$ \end{frame} The following lemma analyzes stochastic incremental stability of the two trajectories $a\left(t\right)$ and $b\left(t\right)$ with respect to each other in the presence of noise where the system without noise $\dot{x}=f(x,t)$ is contracting in a state-dependent metric $M\left(x\left(\mu,t\right),t\right),$ for $\mu\in\left[0,1\right]$. The trajectories of (\ref{eq:stochastiSys}) are parametrized as $x\left(0,t\right)=a$ and $x\left(1,t\right)=b$, and $B_{1}\left(a,t\right)$ and $B_{2}\left(b,t\right)$ are defined as $B\left(x\left(0,t\right),t\right)=B_{1}\left(a,t\right)$, and $B\left(x\left(1,t\right),t\right)=B_{2}\left(b,t\right)$, respectively. \begin{frame} \begin{assumption}$\mathrm{tr}\left(B_{1}\left(a,t\right)^{T}M\left(x\left(a,t\right),t\right)B_{1}\left(a,t\right)\right)\leq C_{1}$,\\ $\mathrm{tr}\left(B_{2}\left(b,t\right)^{T}M\left(x\left(b,t\right),t\right)B_{2}\left(b,t\right)\right)\leq C_{2}$,\\ $\bar{m}_{x}\!=\!\underset{t\geq0,i,j}{\textrm{\ensuremath{\mathrm{sup}}}}\!\left\Vert \left(M_{ij}(x,t)\right)_{x}\right\Vert ,$ and $\bar{m}_{x^{2}}\!=\!\underset{t\geq0,i,j}{\textrm{\ensuremath{\mathrm{sup}}}}\!\left\Vert \partial^{2}\left(M_{ij}(x,t)\right)/\partial x^{2}\right\Vert ,$ where $C_{1},$ $C_{2},$ $\bar{m}_{x}$, and $\bar{m}_{x^{2}}$ are constants.\end{assumption} \begin{assumption}The nominal deterministic system (\ref{xfx_ch2}) is contracting in a metric $M\left(x\left(\mu,t\right),t\right)$ in the sense that (\ref{eq:contractionRate-2}) is satisfied and $M\left(x\left(\mu,t\right),t\right)$ satisfies the bound $\underline{m}\triangleq\underset{t\geq0}{\mbox{\ensuremath{\mathrm{inf}}}}\:\lambda_{\mathrm{min}}M$. The function $f$ and the metric $M$ are the same as in (\ref{xfx_ch2}) and (\ref{eq:contractionRate-2}).\end{assumption} \end{frame} \begin{frame} \begin{lemma}[Stochastic Contraction Lemma] If both assumptions are satisfied then the trajectories $a\left(t\right)$ and $b\left(t\right)$ of (\ref{eq:dx}), whose initial conditions, given by a probability distribution $p\left(a_{0},b_{0}\right)$, are independent of $d\bar{W}_{1}$ and $d\bar{W}_{2}$, satisfy the bound \begin{align} & E\left[\left\Vert a\left(t\right)-b\left(t\right)\right\Vert ^{2}\right]\nonumber \\ & \leq\frac{1}{\underline{m}}\Bigg(\frac{C}{2\gamma_{1}}+E\Bigg[V\left(x\left(0\right),\delta x\left(0\right),0\right)\Bigg]e^{-2\gamma_{1}t}\Bigg)\label{eq:BoundSecondMoment} \end{align} where $\exists\varepsilon>0$ such that $\gamma_{1}\triangleq\gamma-\frac{\left(\beta_{1}^{2}+\beta_{2}^{2}\right)}{2\underline{m}}\left(\varepsilon\bar{m}_{x}+\frac{\bar{m}_{x^{2}}}{2}\right)>0$, $\gamma$ is the contraction rate defined in (\ref{eq:contractionRate-2}), $C=C_{1}+C_{2}+\frac{\bar{m}_{x}}{\varepsilon}\left(\beta_{1}^{2}+\beta_{2}^{2}\right),$ $\beta_{1}=\left\Vert B_{1}\right\Vert _{F}$, $\beta_{2}=\left\Vert B_{2}\right\Vert _{F}$, and $\left[\cdot\right]^{+}=\mathrm{max}\left(0,\cdot\right).$\end{lemma} \begin{proof} Consider the generalized squared length with respect to a Riemannian metric $M\left(x\left(\mu,t\right),t\right)$ defined by $V\left(x,\delta x,t\right)=\intop_{0}^{1}\left(\frac{\partial x}{\partial\mu}\right)^{T}M\left(x\left(\mu,t\right),t\right)\left(\frac{\partial x}{\partial\mu}\right)d\mu$ such that $\underline{m}\left\Vert a-b\right\Vert ^{2}\leq V\left(x,\delta x,t\right)$. See~\cite{Ref:Stochastic} for more details.% \end{proof} \end{frame} \subsection{Partial Contraction and Synchronization} \begin{frame} \begin{theorem}[Partial contraction~\cite{Ref:contraction3}]\label{Thm:partial} Consider a nonlinear system of the form ${\mathbf{ \dot x}}=\mathbf{f}(\mathbf{x},\mathbf{x},t)$ and assume that the auxiliary system ${\mathbf{\dot y}}=\mathbf{f}(\mathbf{y},\mathbf{x},t)$ is contracting with respect to $\mathbf{y}$. If a particular solution of the auxiliary $\mathbf{y}$-system verifies a specific smooth property, then all trajectories of the original x-system verify this property exponentially. The original system is said to be partially contracting. \end{theorem} \begin{proof} If a particular solution of the auxiliary contracting system of $\mathbf{y}$ given as $\dot{\mathbf{y}}=\mathbf{f}(\mathbf{y},\mathbf{x},t)$, verifies a smooth specific property, then all trajectories of the original $\dot{\mathbf{x}}=\mathbf{f}(\mathbf{x},\mathbf{x},t)$ system verify this property exponentially. $\mathbf{y}=\mathbf{x}$ is another solution of the auxiliary system. Consequently, $\mathbf{x}$ verifies this property exponentially fast. \end{proof} This partial contraction analysis can be regarded as a further generalization of contraction theory in Theorem~\ref{Thm:contraction}. This theorem is particularly useful to derive synchronization with an input symmetry. \end{frame} \begin{example}[Stability of Sinc function]\label{ExampleSINC} Example~\ref{Example_sine} can be proven by Theorem~\ref{Thm:partial}. We rewrite the system using a \emph{sinc} function as $$\boldsymbol{\dot\theta}=-\mathbf{K}(t)\text{diag}( \text{sinc}(\boldsymbol{\theta}))\boldsymbol{\theta}$$ where $$\text{diag}( \text{sinc}(\boldsymbol{\theta}))=\text{diag}(\sin(\theta_1)/\theta_1,\cdots,\sin(\theta_n)/\theta_n) .$$ We construct an observer-like system such that $$\mathbf{\dot y}=-\mathbf{K}(t) \text{diag}( \text{sinc}(\boldsymbol{\theta}))\mathbf{y},$$ which has two particular solutions $\mathbf{y}=\boldsymbol{\theta}$ and $\mathbf{y}=\mathbf{0}$. The virtual displacement $\delta \mathbf{y}$ has a time-varying contraction rate $$\mathbf{F}=-\mathbf{K}(t) \text{diag}( \text{sinc}(\boldsymbol\theta(t)))$$, which is now independent of $\mathbf{y}$. Notice $\text{diag}( \text{sinc}(\boldsymbol\theta))>0$ on $\boldsymbol{\theta}\in(-\pi,\pi)^n$, Hence, if $\mathbf{K}(t)>0$, we can conclude that two solutions of $\mathbf{y}$ tend exponentially fast to each other, resulting in $\boldsymbol\theta \rightarrow \mathbf{0}$. The present example shows that a stability analysis via partial contraction can be made much simpler than the original contraction analysis.\end{example} \begin{frame} \begin{theorem}[Synchronization~\cite{Ref:contraction3}]\label{Thm:sync} Consider two coupled systems. If the dynamics equations satisfy \begin{equation} {\mathbf{\dot x}}_1-\mathbf{f}(\mathbf{x}_1,t)={\mathbf{\dot x}}_2-\mathbf{f}(\mathbf{x}_2,t) \end{equation} where the function $\mathbf{f}(\mathbf{x},t)$ is contracting in an input-independent metric, then $\mathbf{x}_1$ and $\mathbf{x}_2$ will converge to each other exponentially, regardless of the initial conditions. Mathematically, stable concurrent synchronization corresponds to convergence to a flow-invariant linear subspace of the global state space\cite{Ref:contraction_sync}. \end{theorem} \begin{proof} Let us define the common input, $\mathbf{g}(\mathbf{x}_1,\mathbf{x}_2,t)$, enforcing the equality of two dynamics equations such that \begin{equation} \begin{split} {\mathbf{\dot x}}_1-\mathbf{f}(\mathbf{x}_1,t)=\mathbf{g}(\mathbf{x}_1,\mathbf{x}_2,t)\\ {\mathbf{\dot x}}_2-\mathbf{f}(\mathbf{x}_2,t)=\mathbf{g}(\mathbf{x}_1,\mathbf{x}_2,t) \end{split} \end{equation} Construct a virtual system of $\mathbf{y}$: \begin{equation} {\mathbf{\dot y}}-\mathbf{f}(\mathbf{y},t)=\mathbf{g}(\mathbf{x}_1,\mathbf{x}_2,t) \end{equation} which has two particular solutions, $\mathbf{x}_1$ and $\mathbf{x}_2$. If the virtual system is contracting, all solutions of $\mathbf{y}$ converge to each other exponentially. As a result, $\mathbf{x}_1$ tends to $\mathbf{x}_2$ exponentially fast. \end{proof} \end{frame} \begin{frame} Notice that the original dynamics per se, with the input $\mathbf{g}(\mathbf{x}_1,\mathbf{x}_2,t)$ might not be contracting. Nevertheless, the system is partially contracting, thereby achieving synchronization. Based upon the results from Theorems \ref{Thm:partial} and \ref{Thm:sync}, the following examples are illustrated in the subsequent sections to shed some light on potential applications of synchronization to nonlinear control. \end{frame} \subsection{Contraction of Combined and Coupled Systems} \begin{frame} The following theorems are used to derive stability and synchronization of coupled dynamics systems. \begin{theorem}[parallel combination]\label{Thm:parallel} Consider two time-varying nonlinear systems, contracting in the same metric function which does not explicitly depend on time such that $\mathbf{M}(\mathbf{x})={\mathbf{\Theta}}(\mathbf{x})^{T}{\mathbf{\Theta}}(\mathbf{x})$ and ${\mathbf{\dot \Theta}}=\frac{\partial \mathbf{\Theta}}{\partial \mathbf{x}}\mathbf{\dot x}$: \begin{equation} \mathbf{\dot x} = \mathbf{f}_i(\mathbf{x},t) \ \ \ \ \,\ i=1,2 \end{equation} Then, any positive superposition with $\alpha_i > 0$ \begin{equation} \mathbf{\dot x} = \alpha_1\mathbf{f}_1(\mathbf{x},t)+\alpha_2\mathbf{f}_2(\mathbf{x},t) \end{equation} is contracting in the same metric. By recursion, this parallel combination can be extended to any number of systems. \end{theorem}\end{frame} \begin{frame} \begin{proof} Since the original dynamics are contracting with a time-independent metric, the generalized Jacobian, $\mathbf{F}$ in (\ref{jacobian_ch2}) becomes \begin{equation} \mathbf{F}=\left(\mathbf{\dot{\Theta}}{(\mathbf{x})}+{\mathbf{\Theta}(\mathbf{x})}\frac{\partial \mathbf{f}_i}{\partial \mathbf{x}}\right){\mathbf{\Theta}(\mathbf{x})}^{-1}=\left(\frac{\partial \mathbf{\Theta}(\mathbf{x})}{\partial \mathbf{x}}\mathbf{f }_i+{\mathbf{\Theta}(\mathbf{x})}\frac{\partial \mathbf{f}_i}{\partial \mathbf{x}}\right){\mathbf{\Theta}(\mathbf{x})}^{-1} \end{equation} Since the individual systems are contracting, \begin{equation} \frac{d}{dt}(\delta \mathbf{z}^T\delta \mathbf{z})=\delta \mathbf{z}^T\left(\frac{\partial \mathbf{\Theta}}{\partial \mathbf{x}}\mathbf{f}_i+{\mathbf{\Theta}}\frac{\partial \mathbf{f}_i}{\partial \mathbf{x}}\right){\mathbf{\Theta}}^{-1}\delta \mathbf{z} \le - 2\lambda_i \delta \mathbf{z}^T\delta \mathbf{z}, \ \ \ \ i=1,2 \end{equation} Hence, the $\delta \mathbf{z}$ dynamics of the combined system result in \begin{align} \frac{d}{dt}(\delta \mathbf{z}^T\delta \mathbf{z})&=\delta \mathbf{z}^T\left(\frac{\partial \mathbf{\Theta}}{\partial \mathbf{x}}(\alpha_1\mathbf{f}_1+\alpha_2\mathbf{f}_2)+{\mathbf{\Theta}}(\alpha_1\frac{\partial \mathbf{f}_1}{\partial \mathbf{x}}+\alpha_2\frac{\partial \mathbf{f}_2}{\partial \mathbf{x}})\right){\mathbf{\Theta}}^{-1}\delta \mathbf{z} \\ &=\alpha_1\delta \mathbf{z}^T\left(\frac{\partial \mathbf{\Theta}}{\partial \mathbf{x}}\mathbf{f}_1+{\mathbf{\Theta}}\frac{\partial \mathbf{f}_1}{\partial \mathbf{x}}\right){\mathbf{\Theta}}^{-1}\delta \mathbf{z}+\alpha_2\delta \mathbf{z}^T\left(\frac{\partial \mathbf{\Theta}}{\partial \mathbf{x}}\mathbf{f}_2+{\mathbf{\Theta}}\frac{\partial \mathbf{f}_2}{\partial \mathbf{x}}\right){\mathbf{\Theta}}^{-1}\delta \mathbf{z}\nonumber \\ &\le - 2(\alpha_1\lambda_1+\alpha_2\lambda_2)\delta \mathbf{z}^T\delta \mathbf{z}\nonumber \end{align} \end{proof} \end{frame} \begin{frame} This parallel combination is extremely important if the system possesses a certain geometrical symmetry. For example, the $\mathbf{M}$ and $\mathbf{C}$ matrices from the Lagrangian equation might satisfy $\mathbf{M_2}=\mathbf{M_{\phi_1}}+\mathbf{M_{\phi_2}}$ and $\mathbf{C_2}=\mathbf{C_{\phi_1}}+\mathbf{C_{\phi_2}}$. This property is extensively exploited later. \begin{theorem}[Hierarchical combination~\cite{Ref:contraction5,Ref:contraction2}]\label{Thm:hierc} Consider two contracting systems, of possibly different dimensions and metrics, and connect them in series, leading to a smooth virtual dynamics of the form \begin{equation} \frac{d}{dt} \begin{pmatrix} \delta\mathbf{z}_1\\ \delta\mathbf{z}_2 \end{pmatrix}= \begin{pmatrix} \mathbf{F}_{11} & \mathbf{0} \\ \mathbf{F}_{21} & \mathbf{F}_{22} \end{pmatrix} \begin{pmatrix} \delta\mathbf{z}_1\\ \delta\mathbf{z}_2 \end{pmatrix} \end{equation} Then the combined system is contracting if $\mathbf{F_{21}}$ is bounded. \end{theorem}\end{frame} \begin{frame} \begin{proof} Intuitively, since $\delta \mathbf{z}_1$ tends to zero, $\delta \mathbf{z}_2$ tends to zero as well for a bounded $\mathbf{F}_{21}$. By using a smooth transformation $\mathbf{\Theta}$: \begin{equation} \mathbf{\Theta}=\begin{pmatrix}\mathbf{I} & \mathbf{0} \\ \mathbf{0} & \epsilon \mathbf{I}\end{pmatrix} \end{equation} Then, the new transformed Jacobian matrix is given as \begin{equation} \mathbf{\Theta}\mathbf{F}\mathbf{\Theta}^{-1}=\begin{pmatrix} \mathbf{F}_{11} & \mathbf{0} \\ \epsilon\mathbf{F}_{21} & \mathbf{F}_{22} \end{pmatrix}, \end{equation} which is negative definite for a sufficiently small $\epsilon >0$. \end{proof} Composite variables, $\mathbf{s}= \mathbf{\dot{q}}-\mathbf{\dot{q}}_d+\mathbf{\Lambda}(\mathbf{{q}}-\mathbf{{q}}_d)$ are an excellent example of a hierarchical combination. Its usage for nonlinear tracking control and robust sliding control shall be discussed in the subsequent sections.\end{frame} \begin{frame} Another interesting combination that occurs in the nonlinear control synthesis is feedback combination. \begin{theorem}[Feedback combination~\cite{Ref:contraction3}]\label{Thm:feedback} The overall dynamics of the generalized virtual displacements might be represented as \begin{equation} \frac{d}{dt} \begin{pmatrix} \delta\mathbf{z}_1\\ \delta\mathbf{z}_2 \end{pmatrix}=\mathbf{F}\begin{pmatrix} \delta\mathbf{z}_1\\ \delta\mathbf{z}_2 \end{pmatrix}= \begin{pmatrix} \mathbf{F_{1}} & \mathbf{G}^T \\ \mathbf{G} & \mathbf{F_{2}} \end{pmatrix} \begin{pmatrix} \delta\mathbf{z}_1\\ \delta\mathbf{z}_2 \end{pmatrix} \end{equation} where $\mathbf{F}_{1}$ and $\mathbf{F}_{2}$ are symmetric negative definite matrices. In order to prove contraction of the combined system, one needs to check if $\mathbf{F}$ is negative definite. From the standard linear algebra~\cite{Ref:HornJohnson}, $\mathbf{F}$ is uniformly negative definite if and only if \begin{equation} \mathbf{F}_{2}< \mathbf{G}^T{\mathbf{F}_{1}}^{-1}\mathbf{G} \end{equation} A sufficient condition for the above inequality can be given as \begin{equation} \lambda(\mathbf{F}_{1})\lambda(\mathbf{F}_{2})>\sigma^2(\mathbf{G}) \end{equation} where $\lambda(\cdot)$ is the contraction rate, which is the absolute value of the largest eigenvalue (least negative) of the contracting system. $\sigma(\cdot)$ denotes the largest singular value. \end{theorem}\end{frame} \begin{frame} It should be noted that the overall contraction rate is no greater than the individual contraction rate of $\mathbf{F}_{1}$ and $\mathbf{F}_{2}$ by the eigenvalue interlacing theorem~\cite{Ref:HornJohnson}. Indeed, one can find the explicit lower bound of the contraction rate as~\cite{Ref:contraction2} \begin{equation} \lambda(\mathbf{F})=\frac{\lambda(\mathbf{F}_{1})+\lambda(\mathbf{F}_{2})}{2}-\sqrt{\left(\frac{\lambda(\mathbf{F}_{1})-\lambda(\mathbf{F}_{2})}{2}\right)^2+\sigma^2(\mathbf{G})} \end{equation} \end{frame} \subsection{High-Order Contraction Theory} \begin{frame} This section presents a new theorem that can be conveniently used to prove contraction of a second-order nonlinear system. Consider the following second-order time-varying nonlinear differential equation \begin{equation}\label{2nd_order} \ddot{x}+a_1(x)\dot{x}+a_2(x,t)=u(t) \end{equation} where $a_1(x)$ is a smooth function of $x$, and $a_2(x,t)$ is a smooth function of $x$ and $t$. \begin{remark} Proving contraction of (\ref{2nd_order}) is difficult, since the original contraction analysis is originally stated for first-order systems. Finding some smooth coordinate transformation of the virtual displacement, $\delta\mathbf{z}={\mathbf{\Theta}}\delta\mathbf{x}$, is the key such that the generalized Jacobian $\bf F$ associated with the augmented system of $(x,\dot x)^T$ is uniformly negative definite. \end{remark} \begin{remark} In general, finding such a transformation, $\mathbf{\Theta}$ is not trivial. Even without the use of contraction theory, proving exponential and global stability of a general time-varying nonlinear second-order system can be a very difficult problem.\end{remark}\end{frame} \begin{frame} We present the main theorem of this section, which provides a sufficient condition for contraction of (\ref{2nd_order}) \begin{theorem}[High-order analysis]\label{theorem1} The nonlinear system in (\ref{2nd_order}) is contracting (all solutions converge to a single trajectory exponentially fast from any initial conditions), if \begin{equation} a_1(x)>0, \ \ \ \ \ \forall x \end{equation} and if \begin{equation} \frac{\partial a_2(x,t)}{\partial x}>0, \ \ \ \frac{d}{dt}\left(\frac{\partial a_2(x,t)}{\partial x}\right)>0\ \ \ \ \ \forall t \end{equation} \end{theorem}\end{frame} \begin{frame}[allowframebreaks] \textbf{\emph{Proof:}} The virtual displacement equation of (\ref{2nd_order}) is \begin{equation}\label{2nd_order_virt} \delta{\ddot{x}}+a_1(x)\delta{\dot{x}}+\left[\dot{a}_1+\frac{\partial a_2(x,t)}{\partial x}\right]\delta{x}=0 \end{equation} Equation (\ref{2nd_order_virt}) can be written as a first-order differential equation by defining the vector state $\mathbf{x}=(x,\dot x)^T$: \begin{align} &\delta\dot{\mathbf{x}}=\frac{\partial \mathbf{f}}{\partial \mathbf{x}}\delta{\mathbf{x}}\\ &\frac{d}{dt}\begin{pmatrix}\delta x\\ \delta \dot x \end{pmatrix}=\begin{bmatrix}0 & 1\\-\left(\dot{a}_1+\frac{\partial a_2}{\partial x}\right)&-a_1\end{bmatrix}\begin{pmatrix}\delta x\\ \delta \dot x \end{pmatrix}\nonumber \end{align} Let us take the following transformation matrix \begin{equation} \mathbf{\Theta}(\mathbf{x},t)=\begin{pmatrix}1&0\\ a_1/\sqrt{\frac{\partial a_2}{\partial x}} &1/\sqrt{\frac{\partial a_2}{\partial x}}\end{pmatrix} \end{equation} It is straightforward to calculate the associated Jacobian as \begin{align}\label{Jacobian} \mathbf{F}&=\left(\mathbf{\dot{\Theta}}{(\mathbf{x},t)}+{\mathbf{\Theta}(\mathbf{x},t)}\frac{\partial \mathbf{f}}{\partial \mathbf{x}}\right){\mathbf{\Theta}(\mathbf{x},t)}^{-1}\\ &=\begin{bmatrix}-a_1(x) & \sqrt{\frac{\partial a_2}{\partial x}}\\-\sqrt{\frac{\partial a_2}{\partial x}} &-\frac{d}{dt}\left(\frac{\partial a_2}{\partial x}\right)/\left(2\frac{\partial a_2}{\partial x}\right)\end{bmatrix}\nonumber \end{align} From the contraction theory, (\ref{2nd_order}) is contracting if the symmetric part of $\mathbf{F}$ is uniformly negative definite, which corresponds to the conditions in Theorem \ref{theorem1}. \qed\end{frame} \begin{frame} We illustrate the use of this theorem in a few examples. \begin{example}[Driven damped Van der Pol oscillator] Consider the following second-order system \begin{equation}\label{vanderpol} \ddot{x}+(\beta+\alpha x^2)\dot{x}+\omega^2 x=u(t) \end{equation} The first condition in Theorem~\ref{theorem1} holds if $a_1(x)=(\beta+\alpha x^2)>0$ uniformly (i.e. $\alpha$ and $\beta$ are strictly positive). Also, note that $\frac{\partial a_2}{\partial x}=\omega^2$. This is a semi-contracting system. Indeed, the generalized Jacobian in (\ref{Jacobian}) yields the same $\mathbf{F}$ as in \cite{Ref:contraction3}.\end{example} \begin{example}[Extension] Suppose that $\omega$ in (\ref{vanderpol}) is now time-varying such that \begin{equation} \ddot{x}+a_1(x)\dot{x}+K_1e^{K_2t}x=u(t) \end{equation} where $a_1(x)>0$, $K_1>0$, and $K_2>0$. The above dynamics is contracting since $\frac{d}{dt}\left(\frac{\partial a_2(x,t)}{\partial x}\right)=K_1K_2 e^{K_2t}>0$. \end{example} \end{frame} \subsection{Tracking Control of Robots and Aerospace Vehicles}\label{Sec:tracking_con_robot} \begin{frame}[allowframebreaks] The dynamics of a robot or a vehicle is given as \begin{equation} \mathbf{M}(\mathbf{q})\mathbf{\ddot{q}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}}+\mathbf{g}(\mathbf{q}) =\mathbf{\tau} \end{equation} \noindent One may consider the following tracking control law~\cite{Ref:Slotine,Ref:contraction_robot} to follow the desired trajectory $\mathbf{{q}}_{d}(t)$ \begin{equation}\label{tracking_controller_proof} \mathbf{\tau}={\mathbf{M}} (\mathbf{q}){\mathbf{\ddot{q}}_{r}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}}){\mathbf{\dot{q}}_{r}}+\mathbf{g}(\mathbf{q}) -\mathbf{K}(\mathbf{\dot{q}}-\mathbf{\dot{q}}_{r}) \end{equation} where $\mathbf{\dot{q}}_{r}=\mathbf{\dot{q}}_{d}-\mathbf{\Lambda}\mathbf{\widetilde{q}}=\mathbf{\dot{q}}_{d}-\mathbf{\Lambda}(\mathbf{q}-\mathbf{q}_{d})$ and positive-definite matrices $\mathbf{K}$ and $\mathbf{\Lambda}$. Note that this tracking control law was first introduced by Slotine and Li~\cite{Ref:Slotine} for the new adaptive control law. Compared to the feedback linearized control law (computed torque control), the equation in (\ref{tracking_controller_proof}) does not cancel the robot dynamics, but it still guarantees exponential tracking convergence at the same rate as an exact cancelation of the feedback linearized control (see the discussion in \cite{Ref:Slotine}). Also, its robustness property is compared with a feedback linearization control law in~\cite{Ref:NonlinearAttitude}. \emph{(\textbf{Observer-like virtual systems})}: The incremental stability concept of Lemma~\ref{Thm:contraction} is useful for analyzing stability of an observer or observer-like system. For example, consider an observer-like virtual system constructed from a closed-loop EL system of $\mathbf{y}$ such as \begin{equation}\label{virtual_tracking_y} \mathbf{\tau}={\mathbf{M}} (\mathbf{q})\mathbf{\dot y}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{y}+\mathbf{g}(\mathbf{q}) -\mathbf{K}(\mathbf{\dot{q}}-\mathbf{y}) \end{equation} This virtual dynamics has two particular solutions, $\mathbf{\dot{q}}$ and $\mathbf{\dot{q}}_{r}$ since both solutions satisfy (\ref{virtual_tracking_y}). \emph{Alternatively}, you can construct an equivalent virtual dynamics \begin{equation}\label{virtual_tracking_y2} {\mathbf{M}} (\mathbf{q})\mathbf{\dot y}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{y}+\mathbf{g}(\mathbf{q}) -\mathbf{K}(\mathbf{\dot{q}}-\mathbf{y}=\mathbf{\tau} \end{equation} which has particular solutions, $\mathbf{s}$ and $\mathbf{0}$. The difference between (\ref{virtual_tracking_y}) and (\ref{virtual_tracking_y2}) is simply whether you focus on the incremental stability between the composite variable $\mathbf{s}$ and $\mathbf{0}$ or the incremental stability between $\mathbf{\dot{q}}$ and $\mathbf{\dot{q}}_r$. The virtual displacement equation of both (\ref{virtual_tracking_y}) and (\ref{virtual_tracking_y2}) becomes \begin{equation}\label{virtual_tracking_y2} {\mathbf{M}} (\mathbf{q})\delta\mathbf{\dot y}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\delta\mathbf{y} +\mathbf{K}\delta\mathbf{y}=\mathbf{0} \end{equation} It is straightforward to find that $\mathbf{K}>0$ needs to hold for exponential convergence to the desired trajectory. The skew-symmetry of $(\mathbf{\dot{M}}-2\mathbf{C})$ results in the following differential length analysis \begin{align} \frac{d}{dt}(\delta\mathbf{y}^T\mathbf{M}(\mathbf{q})\delta\mathbf{y}) &=2 \delta\mathbf{y}^T\mathbf{M}(\mathbf{q})\delta\dot{\mathbf{y}}+\delta\mathbf{y}^T\mathbf{\dot{M}}(\mathbf{q})\delta\mathbf{y} \nonumber \\ &= - 2 \delta\mathbf{y}^T\Bigl(\mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\delta\mathbf{y}+\mathbf{K}\delta\mathbf{y}\Bigr)+\delta\mathbf{y}^T\mathbf{\dot{M}}(\mathbf{q})\delta\mathbf{y}\ \\&= - 2\delta\mathbf{y}^T \mathbf{K} \delta\mathbf{y}\nonumber \end{align} which indicates that the $\mathbf{y}$-system is contracting with $\mathbf{K}>0$. This implies exponential convergence of $\mathbf{\dot{q}}$ to $\mathbf{\dot{q}}_{r}$. In the presence of bounded resultant disturbance $\boldsymbol{d}(t)$, it follows from Lemma \ref{LM:Robust_contraction_original} that: \begin{equation} \lim_{t \rightarrow \infty} \int_{\mathbf{0}}^{\mathbf{s}}\|\delta\mathbf{y}\|=\lim_{t \rightarrow \infty} \int^{\mathbf{\dot{q}}}_{\mathbf{\dot{q}}_{r}}\|\delta\mathbf{y}\|\leq\frac{\lambda_{\max}(\boldsymbol{M}(\mathbf{q}))}{\lambda_{\min}(\boldsymbol{K})\lambda_{\min}(\boldsymbol{M}(\mathbf{q}))}\sup_{t}\|\boldsymbol{d}(t)\| \label{eq:EL_proof1} \end{equation} Hence the dynamics of the closed-loop system is bounded in the presence of bounded resultant disturbance $\boldsymbol{d}$. We now prove that convergence of $\boldsymbol{s} \rightarrow \boldsymbol{0}$ or $\mathbf{\dot{q}}\rightarrow \mathbf{\dot{q}}_{r}$ implies convergence of the system's trajectory to the desired trajectory ($\hat{\boldsymbol{q}} \rightarrow \boldsymbol{q}_d$). It follows from the definition of $\boldsymbol{s}$ and setting $\tilde{\mathbf{q}}=\mathbf{q}_e=\mathbf{q}-\mathbf{q}_d(t)$ that: \begin{align} \mathbf{\dot{q}}-\mathbf{\dot{q}}_d+\boldsymbol{\Lambda}(\mathbf{q}-\mathbf{q}_d)=\mathbf{\dot{q}}_e+\boldsymbol{\Lambda}\mathbf{q}_{e}=\mathbf{s} \end{align} is contracting with an exponential rate of $\lambda_{\min}(\boldsymbol{\Lambda})$ for $\boldsymbol{\Lambda}>0$ if $\boldsymbol{s}=\mathbf{0}$. This is obvious from the linear dynamics form. However, we can also use the virtual dynamics of $\mathbf{\dot{y}}_q+\boldsymbol{\Lambda}\mathbf{y}_q=\mathbf{\dot{q}}_d+\boldsymbol{\Lambda}\mathbf{q}_d$, which has two particular solutions of $\mathbf{y}_q=\mathbf{q}$ and $\mathbf{y}_q=\mathbf{q}_d(t)$. Alternatively, we can use $\mathbf{\dot{y}}_\mathbf{q}+\boldsymbol{\Lambda}\mathbf{y}_q=\mathbf{0}$, which has $\mathbf{y}_q=\mathbf{q}_e$ and $\mathbf{0}$ as its particular solutions. Both forms yield the same dynamics of $\delta \mathbf{y}_q$ that is the infinitesimal displacement at fixed time In summary, if $\boldsymbol{s}=\mathbf{0}$, all solutions of the $\mathbf{y}_q$ virtual dynamics will converge exponentially fast to each other ($\delta \mathbf{y}_q \rightarrow \mathbf{0}$). By using (\ref{eq:EL_proof1}), it follows from Lemma \ref{LM:Robust_contraction_original} and its extension to a hierarchically-combined system (Lemma~\ref{LM:Robust_contraction_hierc}) that: \begin{align} \lim_{t\rightarrow\infty}\int_{\mathbf{q}_d}^{\boldsymbol{q}}\|\delta\mathbf{y}_q\|=\lim_{t\rightarrow\infty}\int_{0}^{\boldsymbol{q}_{e}}\|\delta\mathbf{y}_{q}\| & \leq\frac{1}{\lambda_{\min}(\boldsymbol{\Lambda})}\lim_{t\rightarrow \infty}\int^\mathbf{s}_\mathbf{0}\|\delta\mathbf{y}\| \nonumber \\ & \leq \frac{\lambda_{\max}(\boldsymbol{M}(\mathbf{q}))}{\lambda_{\min}(\boldsymbol{\Lambda})\lambda_{\min}(\boldsymbol{K})\lambda_{\min}(\boldsymbol{M}(\mathbf{q}))}\sup_{t}\|\boldsymbol{d}(t)\| \label{eq:EL_proof2}\end{align} Hence we have shown, by constructing a hierarchically-combined closed-loop system of $\boldsymbol{s}$ and $\boldsymbol{q}_{e}$, that the attitude trajectory $\boldsymbol{q}(t)$ will globally exponentially converge to a bounded error ball around the desired trajectory $\boldsymbol{q}_d (t)$. Specifically, it follows from Lemma \ref{LM:Robust_contraction_original} that this control law is finite-gain $\mathcal{L}_p$ stable and input-to-state stable. Hence the control gains $\boldsymbol{K}$ and $\boldsymbol{\Lambda}$ can be designed such that the desired error bounds are achieved, as shall be seen below. This is a hierarchical combination due to reduction of the system order via introduction of the composite variable, $\mathbf{s}$. Consider the following hierarchical virtual system of $\mathbf{y}_1$ and $\mathbf{y}_2$: \begin{equation}\label{hierc_sys_ch2} \begin{bmatrix}{\mathbf{M}}(\mathbf{q}) & \mathbf{0}\\ \mathbf{0} &{\mathbf{I}}\end{bmatrix}\begin{pmatrix}\mathbf{ \dot y}_1\\\mathbf{ \dot y}_2\end{pmatrix}+\begin{bmatrix}\mathbf{C}(\mathbf{q},\mathbf{\dot{q}})+\mathbf{K} & \mathbf{0}\\ -\mathbf{I} &\mathbf{\Lambda}\end{bmatrix}\begin{pmatrix}\mathbf{ y}_1\\ \mathbf{ y}_2\end{pmatrix}=\begin{pmatrix}\mathbf{ 0}\\ \mathbf{0}\end{pmatrix} \end{equation} This is hierarchically connected since the dynamics of $\mathbf{y}_2$ does not affect those of $\mathbf{y}_1$. It is straightforward to verify that (\ref{hierc_sys_ch2}) has two particular solutions: \begin{equation}\begin{pmatrix}\mathbf{y}_1=\mathbf{s}\\ \mathbf{y}_2=\mathbf{q}-\mathbf{q}_d\end{pmatrix},\ \ \ \ \ \ \begin{pmatrix}\mathbf{y}_1=\mathbf{0}\\ \mathbf{y}_2=\mathbf{0}\end{pmatrix}\end{equation}. \end{frame} \begin{remark}[Proof of Exponential Stability using a Conventional Lyapunov Approach] If we use the original definition of exponential stability using a Lyapunov function (Theorem \ref{Thm:exponential}), we can try $V=\mathbf{s}^T\mathbf{M}(\mathbf{q})\mathbf{s}+\alpha \tilde{\mathbf{q}}^T\tilde{\mathbf{q}}$, which yields the conditions for contraction by Theorem~\ref{Thm:contraction}: $$\alpha\mathbf{I}<4\mathbf{K}\mathbf{\Lambda}$$ or $$\alpha<4\lambda_{min}(\mathbf{K}\mathbf{\Lambda})$$. However, this requires another strong assumption on $\alpha$ to complete the exponential stability of $\|\mathbf{s}\|$ and $\|\mathbf{\tilde{q}}\|$, in order to apply Theorem \ref{Thm:exponential}. Often times, we need to use an ad-hoc Lyapunov function with a cross-term~\cite{Ref:ChungTRO}: $\exists \alpha$, $$V=\mathbf{s}^T\mathbf{M}(\mathbf{q})\mathbf{s}+\tilde{\mathbf{q}}^T\tilde{\mathbf{q}}+\alpha\mathbf{s}^T\mathbf{M}(\mathbf{q})\tilde{\mathbf{q}}.$$ \end{remark} \subsection{Tracking Control of Hamiltonian} \begin{frame}[allowframebreaks] We show an equivalent result from the previous section, using the first order canonical form obtained by the transformation, $\mathbf{p}=\mathbf{M}(\mathbf{q})\mathbf{s}$ in Section~\ref{sec:hamilton}. The closed-loop system with the tracking control law in (\ref{tracking_controller_proof}) is obtained as \begin{equation}\label{NL_hamiltonian2} \mathbf{M}(\mathbf{q})\mathbf{\dot{s}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{s}+\mathbf{K}\mathbf{s} =\mathbf{0} \end{equation} where $\mathbf{s}$ is defined in (\ref{composite_variable}). \noindent Equation (\ref{NL_hamiltonian2}) reduces to the following first-order canonical form: \begin{equation} \begin{split} \mathbf{\dot{p}}=\Bigl[\mathbf{C}\left(\mathbf{q},\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}\right)^{T}-\mathbf{K}\Bigr]\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}\\ \mathbf{\dot{q}}=-\mathbf{\Lambda}\mathbf{q}+\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}+ \left(\mathbf{\dot{q}}_d+\mathbf{\Lambda}{\mathbf{q}}_d\right)\ \ \ \ \end{split} \end{equation} Consider a virtual system, having $\mathbf{y}_1=\mathbf{p},\mathbf{y}_2=\mathbf{q}$ and $\mathbf{y}_1=\mathbf{0},\mathbf{y}_2=\mathbf{q}_d$ as its particular solutions: \begin{equation} \begin{split} \mathbf{\dot{y}}_1=\Bigl[\mathbf{C}\left(\mathbf{q},\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}\right)^{T}-\mathbf{K}\Bigr]\mathbf{M}^{-1}(\mathbf{q})\mathbf{y}_1 \\ \mathbf{\dot{y}}_2=-\mathbf{\Lambda}\mathbf{y}_2+\mathbf{M}^{-1}(\mathbf{q})\mathbf{y}_1+ \left(\mathbf{\dot{q}}_d+\mathbf{\Lambda}{\mathbf{q}}_d\right) \ \ \end{split} \end{equation} which is also a hierarchical combination. This virtual system can be easily shown to be contracting. Similarly to the previous section, the virtual length analysis with respect to the metric, $\mathbf{M}^{-1}(\mathbf{q})>0$ yields \begin{align} &\frac{d}{dt}(\delta{\mathbf{y}_1}^T\mathbf{M}^{-1}(\mathbf{q})\delta\mathbf{y}_1) =2 \delta{\mathbf{y}_1}^T\mathbf{M}^{-1}(\mathbf{q})\delta{\mathbf{\dot y}}_1+{\mathbf{y}_1}^T\mathbf{M}^{-1}(\mathbf{q})(-\mathbf{\dot{M}}(\mathbf{q}))\mathbf{M}^{-1}(\mathbf{q})\delta\mathbf{y}_1 \nonumber \\ &= \delta{\mathbf{y}_1}^T\mathbf{M}^{-1}(\mathbf{q})\Bigl(\mathbf{C}+\mathbf{C}^T-2\mathbf{K}\Bigr)\mathbf{M}^{-1}(\mathbf{q})\delta\mathbf{y}_1-\delta{\mathbf{y}_1}^T\mathbf{M}^{-1}(\mathbf{q})\mathbf{\dot{M}}(\mathbf{q})\mathbf{M}^{-1}(\mathbf{q})\delta\mathbf{y}_1\ \nonumber\\&= - 2\delta{\mathbf{y}_1}^T \mathbf{M}^{-1}(\mathbf{q})\mathbf{K} \mathbf{M}^{-1}(\mathbf{q})\delta\mathbf{y}_1 \end{align} where we used \begin{equation}\frac{d}{dt}\mathbf{M}^{-1}(\mathbf{q})=-\mathbf{M}^{-1}(\mathbf{q})\mathbf{\dot{M}}(\mathbf{q})\mathbf{M}^{-1}(\mathbf{q})\end{equation} This shows that $\mathbf{y}_1$ is contracting with $\mathbf{K}>0$, which in turn corresponds to contraction of $\mathbf{y}_2$ due to the hierarchy. Therefore, all solutions of $\mathbf{y}_1$ and $\mathbf{y}_2$ tend to each other resulting in $\mathbf{q} \rightarrow \mathbf{q}_d$. \end{frame} \subsection{Preview: Passivity Based Analysis}\label{sec:Passivity} \begin{frame} A passive system is one where the energy output of the system is not greater than the energy injected into the system from external sources. Hence, the passivity property makes an essential connection with the energy conservation law. Before we introduce Lyapunov functions to generalize the notion of energy in a dynamical system, particulary in the context of stability theory, we briefly characterize a passive mechanical system in this section. Consider a control affine, smooth nonlinear system with an output $\mathbf{y}\in\mathbb{R}^m$, \begin{align}\label{nonlin_input} {\mathbf{\dot x}}(t)&=\mathbf{f}(\mathbf{x}(t),t)+\mathbf{g}(\mathbf{x}(t),t)\mathbf{u}\\ \mathbf{y}&=\mathbf{h}(\mathbf{x})\nonumber \end{align} where $\mathbf{x}\in \mathbb{R}^n$, $\mathbf{u}\in \mathbb{R}^m$, and $\mathbf{f},\mathbf{g}$ and $\mathbf{h}$ are continuous in $t$ and smooth in $\mathbf{x}$ with $\mathbf{f}(\mathbf{0},t)=\mathbf{0}$ and $\mathbf{h}(\mathbf{0},t)=\mathbf{0}$ for all $t\geq0$. \begin{definition}[Passivity] The nonlinear system in (\ref{nonlin_input}) is said to be passive if there exists a $\mathcal{C}^1$ storage function $V(\mathbf{x},t)\geq0$, $V(\mathbf{0},t)=0$,$\forall t\geq0$ and a function $S(\mathbf{x})\geq0$ such that for $\forall t\geq t_0\geq0$ \begin{equation} V(\mathbf{x}(t),t)-V(x(t_0),t_0)=\int^{t}_{t_0}\mathbf{u}^T(s)\mathbf{y}(s)ds-\int^{t}_{t_0}S(s)ds \end{equation} The system in (\ref{nonlin_input}) is strictly passive for $S(t)>0$ and lossless for $S(t)=0$. Also, if $S(t)=\mathbf{y}^T\rho(\mathbf{y})>0$, the system is output strictly passive, and if $S(t)=\mathbf{u}^T\rho(\mathbf{u})>0$, the system is input strictly passive. \end{definition} \end{frame} Furthermore, $\mathbf{u}^T\mathbf{y}$ can generalized to $\boldsymbol\sigma(\mathbf{u},\mathbf{x})$, called a supply rate and $V$ is called a storage function. Notice that the external power input term is written as $\mathbf{u}^T\mathbf{y}$. We can easily show that a combination of two passive systems is passive, which leads to the ``additive'' property of Lyapunov functions~\cite{Ref:Slotine}. Let us take an example of a mechanical system such as a robotic manipulator: \begin{equation} \mathbf{M}(\mathbf{q})\mathbf{\ddot{q}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}}+\mathbf{g}(\mathbf{q}) =\mathbf{\tau}\label{NL_single_compact2} \end{equation} In the presence of external gravity torques $\mathbf{g}(\mathbf{q})$, the energy conservation law can be written as \begin{equation} \mathbf{\dot{q}}^T(\mathbf{\tau}-\mathbf{g}(\mathbf{q}))=\frac{1}{2}\frac{d}{dt}(\mathbf{\dot{q}}^T\mathbf{M}(\mathbf{q})\mathbf{\dot{q}}) \end{equation} which implies that the mapping $\mathbf{\tau}-\mathbf{g}\rightarrow \mathbf{\dot{q}}$ is passive. By expanding the right-hand side, we can prove that $\mathbf{\dot{q}}^T(\mathbf{\dot M}-2\mathbf{C})\mathbf{\dot{q}}$. In conclusion, a robot's dynamics are passive only with a velocity vector $\mathbf{\dot{q}}$ unless a composite variable structure~\cite{Ref:Slotine} is employed. Passivity is a subject of intense research, with applications to robotics~\cite{Ref:Slotine}, spacecraft control~\cite{Ref:Egeland}, and more recently, teleoperation~\cite{Ref:Spong_tele2} and network synchronization. \begin{example}[Adaptive Control] Robust control and adaptive control are two different approaches to the problem of inherent uncertainty in the nonlinear system: robust control attempts to design a fixed parameter controller that successfully performs in the presence of the worst-case errors in the model, while adaptive control dynamically adjusts its parameters to compensate for the initial model uncertainty or very slowly varying parameters. Hence, adaptive control is a natural choice when only parametric uncertainty exits. However, adaptive controllers do not have long term memory and hence do not "remember" the optimal control parameters corresponding to different configurations of the plant. We consider the following adaptive control law for a Lagrangian system from (\ref{NL_single_compact2}): \begin{equation} \boldsymbol{\tau}=\mathbf{Y}\hat{\mathbf{a}}-\mathbf{K}\mathbf{s}=\mathbf{\hat{M}}(\mathbf{q})\mathbf{\ddot{q}_{r}}+ \mathbf{\hat{C}}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}_{r}}+\mathbf{\hat{g}}(\mathbf{q}) -\mathbf{K}\mathbf{s} \end{equation} where $\mathbf{s}$ denotes the composite variable $\mathbf{s}=\mathbf{\dot q} - \mathbf{\dot{q}}_{r}$, and the parameter estimates are updated to complete the definition of the adaptive control law with a positive definite matrix $\mathbf{\Gamma}$ as follows: \begin{equation}\mathbf{\dot{\hat{a}}}=-\mathbf{\Gamma}\mathbf{Y}^T\mathbf{s}\end{equation} \begin{equation}\mathbf{\dot{\hat{a}}}=-\mathbf{\Gamma}\mathbf{Y}^T\mathbf{s}\end{equation} Then, the asymptotic convergence of the tracking error and parameter estimates can be proven by finding a suitable Lyapunov-like function or using contraction analysis. \end{example} \begin{frame}[allowframebreaks] Consider the closed-loop system with the adaptive control law above: \begin{equation} \begin{bmatrix}\mathbf{M}(\mathbf{q}) & \mathbf{0}\\ \mathbf{0} & \mathbf{\Gamma}^{-1}\end{bmatrix} \begin{pmatrix}\mathbf{\dot s}\\ \mathbf{\dot{\tilde a}}\end{pmatrix}+ \begin{bmatrix}\mathbf{C}(\mathbf{q},\mathbf{\dot{q}})+\mathbf{K}& -\mathbf{Y}\\ \mathbf{Y}^{T}& \mathbf{0} \end{bmatrix}\begin{pmatrix}\mathbf{s}\\ \mathbf{\tilde a}\end{pmatrix}=\begin{pmatrix}\mathbf{0}\\ \mathbf{0}\end{pmatrix}\label{eq:adaptive_closed} \end{equation} where $\mathbf{\hat{a}}$ denotes an estimate, and $\mathbf{\tilde{a}}$ denotes an error of the estimate such that $\mathbf{\tilde{a}}=\mathbf{\hat{a}}-\mathbf{a}$, while $\mathbf{a}$ is a constant vector of the true parameter values. \begin{figure} \begin{center} \includegraphics[width=4in]{passivity.jpg}\\ \caption{Interpretation of adaptive control from a perspective of passivity} \end{center} \end{figure} The above system has a positive semi-definite generalized Jacobian with $\mathbf{K}>0$, thereby resulting in a semi-contracting system~\cite{Ref:contraction1,Ref:contraction4}. Using Barbalat's lemma, the asymptotic convergence of $\mathbf{s}$ can be proven as follows. First, construct a suitable Lyapunov function to find that $\ddot V= -2\mathbf{s}^T\mathbf{K}\mathbf{\dot s}$ and $\dot V$ is uniformly continuous since a bounded $\dot{\mathbf{s}}$ from (\ref{eq:adaptive_closed}) leads to a bounded $\ddot V$. Due to $\dot V \leq 0$, the use of Barbalat's lemma verifies that $\dot V \rightarrow 0$ as $t\rightarrow \infty$. This implies that $\mathbf{s}$ tends to zero asymptotically fast. From the hierarchical combination of the $\mathbf{s}$ variable, this also implies $\mathbf{q}\rightarrow \mathbf{q}_d$. Please note that the convergence of $\mathbf{\hat{a}}$ to the true value $\mathbf{a}$ is NOT proven. It should be noted that the open loop dynamics of a multi-link robot are only passive for $\mathbf{\tau}-\mathbf{g}$ and the joint velocity $\mathbf{\dot q}$. To the contrary, the above adaptation law modifies the closed-loop dynamics such that the mapping $-\mathbf{Y}^T\mathbf{s}\rightarrow \mathbf{\tilde a}$ is passive (i.e., $\mathbf{s}\rightarrow -\mathbf{Y}\mathbf{\tilde a}$ is also a passive mapping. This is reminiscent of the feedback combination of two passive systems. $\dot{V}_1(t)=y_1^Tu_1-g_1(t)$ and $\dot{V}(t)=y_2^Tu_2-g_2(t)$. In a feedback configuration, $u_2=y_1$ and $u_1=-y_2$. Hence, $\dot{V}_1(t)+\dot{V}_2(t)=-(g_1(t)+g_2(t))$. \end{frame} \subsection{Control Laws for Nonlinear Attitude Control \label{sec:Feedback-Control-Laws}} \begin{frame}[allowframebreaks] \begin{remark}[This section is based on~\cite{Ref:NonlinearAttitude}:] S. Bandyopadhyay, S.-J. Chung, and F. Y. Hadaegh,``Nonlinear Attitude Control of Spacecraft with a Large Captured Object,'' \emph{Journal of Guidance, Control, and Dynamics}, vol. 39, no. 4, 2016, pp. 754-769. \end{remark} In this section, we present the new nonlinear attitude tracking control laws that are deemed suitable for satisfying the control problem statement. We first present a novel robust nonlinear tracking control law that guarantees globally exponential convergence of the system's attitude trajectory to the desired attitude trajectory. In order to highlight the advantages of this new control law, we also present several extensions of this attitude tracking control law, like augmenting it with an integral control term and deriving an exponentially-stabilizing tracking control law on SO($3$). Let $\boldsymbol{\omega}\in\mathbb{R}^{3}$ be the angular velocity of the system in the body fixed frame $\mathcal{F}_{B}$ with respect to the inertial frame $\mathcal{F}_{I}$ and expressed in the frame $\mathcal{F}_{B}$. Let $\boldsymbol{u}_c\in\mathbb{R}^{n_t}$ be the control input. The attitude dynamics of the rigid combination is given by: \begin{equation} \boldsymbol{J}\dot{\boldsymbol{\omega}}=\left(\boldsymbol{J}\boldsymbol{\omega}\right)\times\boldsymbol{\omega}+\boldsymbol{u}_c+\boldsymbol{d}_{\textrm{ext}}\thinspace,\label{eq:dynamics} \end{equation} where $\boldsymbol{d}_{\textrm{ext}}$ represents the external torque acting on the system. The attitude kinematics can be written by using quaternions ($\boldsymbol{\beta}_{v}=[\beta_{1},\thinspace\beta_{2},\thinspace\beta_{3}]$), modified Rodrigues parameters (MRP), or rotation matrix on SO$(3)$ : \begin{align} & \boldsymbol{\dot{\beta}}_{v} =\frac{1}{2}(\beta_{4}\boldsymbol{\omega}+\boldsymbol{\beta}_{v}\times\boldsymbol{\omega})\thinspace,\qquad\dot{\beta}_{4}=-\frac{1}{2}\boldsymbol{\beta}_{v}^{T}\boldsymbol{\omega}\thinspace,\label{eq:kinematics_quaternion} \\ & \dot{\boldsymbol{q}}=\boldsymbol{Z}(\boldsymbol{q})\boldsymbol{\omega}\thinspace,\quad\\ &\textrm{where}\quad \boldsymbol{Z}(\boldsymbol{q})=\frac{1}{2}\left[\mathbf{I}\left(\frac{1-\boldsymbol{q}^{T}\boldsymbol{q}}{2}\right)+\boldsymbol{q}\boldsymbol{q}^{T}+\boldsymbol{S}(\boldsymbol{q})\right]\thinspace, \boldsymbol{S}(\boldsymbol{q})=\left[\begin{smallmatrix}0 & -q_{3} & q_{2}\\ q_{3} & 0 & -q_{1}\\ -q_{2} & q_{1} & 0 \end{smallmatrix}\right] \thinspace, \label{eq:MRP_def} \\ & \dot{\boldsymbol{R}}=\boldsymbol{R}\boldsymbol{S}(\boldsymbol{\omega})\thinspace. \label{eq:Rot_mat_kinematics} \end{align} The attitude kinematics equations using Euler angles ($\phi,\thinspace\theta,\thinspace\psi$), classical Rodrigues parameters ($\boldsymbol{\sigma}$), and the first three elements of a quaternion vector ($\boldsymbol{\beta}_v$) can also be written in the form of $\dot{\boldsymbol{q}}=\boldsymbol{Z}(\boldsymbol{q})\boldsymbol{\omega}$ (like (\ref{eq:MRP_def})) with a different definition of $\boldsymbol{Z}(\boldsymbol{q})$. We show later that our proposed nonlinear control law permits the use of any attitude representation. \begin{table} \caption{Properties of Attitude Representations\label{tab:Properties-Attitude-Rep}} \includegraphics[width=\textwidth]{AttitudeTable.PNG} \end{table} \end{frame} \subsubsection{Robust Nonlinear Tracking Control Law with Global Exponential Stability \label{sub:First-Robust-NCL-new}} \begin{frame}[allowframebreaks] The following theorem states the proposed robust nonlinear tracking control law. Note that this control law does not cancel the term $\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\hat{\boldsymbol{\omega}}\right)\hat{\boldsymbol{\omega}}$ exactly, in contrast with most conventional nonlinear tracking control laws using feed-forward cancellation. Although this control law is written for MRP, it can also be used with other attitude representations like Euler angles, classical Rodrigues parameters, and the quaternion vector, by changing the definition of $\boldsymbol{Z}(\boldsymbol{q})$. \begin{theorem}[New Robust Nonlinear Attiude Controller]\label{thm:first_RNTCL} For the given desired attitude trajectory $\boldsymbol{q}_{d}(t)$, and positive definite constant matrices $\boldsymbol{K}_{r}\in\mathbb{R}^{3\times3}$ and $\boldsymbol{\Lambda}_{r}\in\mathbb{R}^{3\times3}$, we define the following control law: \begin{align} & \boldsymbol{u}_c=\skew{4}\hat{\boldsymbol{J}}\dot{\boldsymbol{\omega}}_{r}-\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{r}-\boldsymbol{K}_{r}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r}) \thinspace,\label{eq:first_RNC_MRP}\\ \textrm{where}\quad & \boldsymbol{\omega}_{r}=\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\dot{\boldsymbol{q}}_{d}(t)+\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\boldsymbol{\Lambda}_{r}(\boldsymbol{q}_{d}(t)-\hat{\boldsymbol{q}}) \thinspace.\nonumber \end{align} This control law exponentially stabilizes the closed-loop attitude dynamics with the following properties: \\ (i) In the absence of resultant disturbance torque $\boldsymbol{d}_{\textrm{res},2}$, this control law guarantees global exponential convergence of the system's trajectory to the desired trajectory $\boldsymbol{q}_{d}(t)$. \\ (ii) In the presence of bounded resultant disturbance torque $\boldsymbol{d}_{\textrm{res},2}$, this control law guarantees that the tracking error ($\boldsymbol{q}_{e} = \hat{\boldsymbol{q}}-\boldsymbol{q}_{d}$) globally exponentially converges to the following ball \begin{align} \lim_{t\rightarrow\infty}\int_{0}^{\boldsymbol{q}_{e}}\|\delta\boldsymbol{q}_{e}\|_{2} & \leq\frac{\lambda_{\max}(\boldsymbol{J})}{\lambda_{\min}(\boldsymbol{\Lambda}_{r})\lambda_{\min}(\boldsymbol{K}_{r})\lambda_{\min}(\boldsymbol{J})}\left(\sup_{t}\sigma_{\max}(\boldsymbol{Z}(\hat{\boldsymbol{q}}))\right)\left(\sup_{t}\|\boldsymbol{d}_{\textrm{res},2}\|_{2}\right)\thinspace.\nonumber \end{align} Hence, this control law is finite-gain $\mathcal{L}_p$ stable and input-to-state stable (ISS). \end{theorem}\end{frame} \begin{frame}[allowframebreaks] \textbf{\emph{Proof:}} The closed-loop dynamics, which is obtained by substituting $\boldsymbol{u}_c$ from Eq.~(\ref{eq:first_RNC_MRP}) into Eq.~(\ref{eq:dynamics}), becomes \begin{equation} \boldsymbol{J}\dot{\boldsymbol{\omega}}_{e}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{e}+\boldsymbol{K}_{r}\boldsymbol{\omega}_{e}=\underbrace{\left[\boldsymbol{d}_{\textrm{res}}-\Delta\boldsymbol{J}\dot{\boldsymbol{\omega}}_r+\boldsymbol{S}\left(\Delta\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{r}\right]}_{\boldsymbol{d}_{\textrm{res},2}}\thinspace, \label{eq:proof_step7} \end{equation} where $\boldsymbol{\omega}_e = (\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r})$ and $\boldsymbol{d}_{\textrm{res}} = \boldsymbol{J}\Delta\boldsymbol{\omega}\times\hat{\boldsymbol{\omega}} +\boldsymbol{J}{\boldsymbol{\omega}}\times\Delta\boldsymbol{\omega} -\boldsymbol{J}\Delta\dot{\boldsymbol{\omega}}+\boldsymbol{d}_{\textrm{ext}}$. We first show that the control law indeed globally exponentially stabilizes the closed-loop system without the resultant disturbance $\boldsymbol{d}_{\textrm{res},2}$. The virtual dynamics of $\boldsymbol{y}$, derived from Eq.~(\ref{eq:proof_step7}) without $\boldsymbol{d}_{\textrm{res},2}$, is given as \begin{equation} \boldsymbol{J}\dot{\boldsymbol{y}}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\boldsymbol{y}+\boldsymbol{K}_{r}\boldsymbol{y} = \boldsymbol{0} \thinspace ,\label{Eq:CLeqn} \end{equation} where $\boldsymbol{y}$ has $\boldsymbol{y}=\boldsymbol{\omega}_e$ and $\boldsymbol{y}=\boldsymbol{0}$ as its two particular solutions. After we obtain the dynamics of the infinitesimal displacement at fixed time, $\delta\boldsymbol{y}$ from (\ref{Eq:CLeqn}), we perform the squared-length analysis: \begin{equation} \frac{d}{dt}\left(\delta\boldsymbol{y}^{T}\boldsymbol{J}\delta\boldsymbol{y}\right)=-2\delta\boldsymbol{y}^{T}\boldsymbol{K}_{r}\delta\boldsymbol{y}\leq\frac{-2\lambda_{\min}(\boldsymbol{K}_{r})}{\lambda_{\max}(\boldsymbol{J})}\left(\delta\boldsymbol{y}^{T}\boldsymbol{J}\delta\boldsymbol{y}\right)\thinspace, \end{equation} where we exploited the skew-symmetric property of the matrix $\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)$. Hence, it follows from the contraction analysis (Theorem \ref{Thm:contraction}) that all system trajectories of (\ref{Eq:CLeqn}) converge exponentially fast to a single trajectory (i.e., $\delta\boldsymbol{y} \rightarrow \boldsymbol{0}$ and $\boldsymbol{\omega}_e\rightarrow \boldsymbol{0}$ ) at a rate of $\frac{\lambda_{\min}(\boldsymbol{K}_{r})}{\lambda_{\max}(\boldsymbol{J})}$. In the presence of bounded resultant disturbance $\boldsymbol{d}_{\textrm{res},2}$, it follows from Lemma \ref{LM:Robust_contraction_original} that: \begin{equation} \lim_{t \rightarrow \infty} \int_{0}^{\boldsymbol{\omega}_{e}}\|\delta\boldsymbol{y}\|_{2}\leq\frac{\lambda_{\max}(\boldsymbol{J})}{\lambda_{\min}(\boldsymbol{K}_{r})\lambda_{\min}(\boldsymbol{J})}\sup_{t}\|\boldsymbol{d}_{\textrm{res},2}\|_{2} \label{eq:proof_step9} \end{equation} Hence the dynamics of the closed-loop system is bounded in the presence of bounded resultant disturbance $\boldsymbol{d}_{\textrm{res},2}$. We now prove that convergence of $\boldsymbol{\omega}_{e} \rightarrow \boldsymbol{0}$ implies convergence of the system's trajectory to the desired trajectory ($\hat{\boldsymbol{q}} \rightarrow \boldsymbol{q}_d$). It follows from the definition of $\boldsymbol{\omega}_{r}$ that: \begin{equation} \boldsymbol{\omega}_{e}=\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})(\dot{\hat{\boldsymbol{q}}}-\dot{\boldsymbol{q}}_{d})+\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\boldsymbol{\Lambda}_{r}(\hat{\boldsymbol{q}}-\boldsymbol{q}_{d})=\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})(\dot{\boldsymbol{q}}_{e}+\boldsymbol{\Lambda}_{r}\boldsymbol{q}_{e})\thinspace, \end{equation} where $\boldsymbol{q}_{e} = (\hat{\boldsymbol{q}}-\boldsymbol{q}_{d})$. In the absence of $\boldsymbol{\omega}_{e}$, all system trajectories of $ \delta \boldsymbol{q}_e$ will converge exponentially fast to a single trajectory ($\delta \boldsymbol{q}_e \rightarrow 0$) with a rate of $\lambda_{\min}(\boldsymbol{\Lambda}_{r})$, where the virtual displacement $\delta\boldsymbol{q}_e$ is an infinitesimal displacement at fixed time. In the presence of $\boldsymbol{\omega}_{e}$, it follows from Lemma \ref{LM:Robust_contraction_original} and its extension to a hierarchically-combined system (Lemma~\ref{LM:Robust_contraction_hierc}) that: \begin{align} \lim_{t\rightarrow\infty}\int_{0}^{\boldsymbol{q}_{e}}\|\delta\boldsymbol{q}_{e}\|_{2} & \leq\frac{1}{\lambda_{\min}(\boldsymbol{\Lambda}_{r})}\sup_{t}\|\boldsymbol{Z}(\hat{\boldsymbol{q}})\boldsymbol{\omega}_{e}\|_{2} \nonumber \\ & \leq\frac{\lambda_{\max}(\boldsymbol{J})}{\lambda_{\min}(\boldsymbol{\Lambda}_{r})\lambda_{\min}(\boldsymbol{K}_{r})\lambda_{\min}(\boldsymbol{J})}\left(\sup_{t}\sigma_{\max}(\boldsymbol{Z}(\hat{\boldsymbol{q}}))\right)\left(\sup_{t}\|\boldsymbol{d}_{\textrm{res},2}\|_{2}\right)\thinspace. \end{align} Hence we have shown, by constructing a hierarchically-combined closed-loop system of $\boldsymbol{\omega}_{e}$ and $\boldsymbol{q}_{e}$, that the attitude trajectory $\boldsymbol{q}$ will globally exponentially converge to a bounded error ball around the desired trajectory $\boldsymbol{q}_d (t)$. Moreover, it follows from Lemma \ref{LM:Robust_contraction_original} that this control law is finite-gain $\mathcal{L}_p$ stable and input-to-state stable. Hence the control gains $\boldsymbol{K}_{r}$ and $\boldsymbol{\Lambda}_{r}$ can be designed such that the desired error bounds are achieved. \qed The desired attitude trajectory $\boldsymbol{q}_d (t)$ can be any reference trajectory that we would like the system to track (e.g., motion planning based on optimal control). \end{frame} \subsubsection{Relation to Nonlinear Tracking Control using Euler-Lagrangian Systems \label{sub:EL-Robust-NCL}} In this section, we compare the robust nonlinear tracking control law Eq.~(\ref{eq:first_RNC_MRP}) with the well-known robust nonlinear tracking control for Euler-Lagrangian (EL) systems. We first state the EL system with uncertainty, which is a combined representation of the attitude kinematics and dynamics of the system: \begin{align} & \hat{\boldsymbol{M}}(\hat{\boldsymbol{q}})\ddot{\hat{\boldsymbol{q}}}+\hat{\boldsymbol{C}}(\hat{\boldsymbol{q}},\dot{\hat{\boldsymbol{q}}})\dot{\hat{\boldsymbol{q}}}=\hat{\boldsymbol{\tau}}_{c}+\boldsymbol{\tau}_{\textrm{res}}\thinspace,\label{eq:Lagrangian_formulation-modified}\\ \textrm{where}\quad & \hat{\boldsymbol{\tau}}_{c}=\boldsymbol{Z}^{-T}(\hat{\boldsymbol{q}})\boldsymbol{u}_c \thinspace, \qquad \hat{\boldsymbol{M}}(\hat{\boldsymbol{q}})=\boldsymbol{Z}^{-T}(\hat{\boldsymbol{q}})\skew{4}\hat{\boldsymbol{J}}\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\thinspace, \nonumber \\ & \hat{\boldsymbol{C}}(\hat{\boldsymbol{q}},\dot{\hat{\boldsymbol{q}}})=-\boldsymbol{Z}^{-T}(\hat{\boldsymbol{q}})\skew{4}\hat{\boldsymbol{J}}\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\dot{\boldsymbol{Z}}(\hat{\boldsymbol{q}})\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})-\boldsymbol{Z}^{-T}(\hat{\boldsymbol{q}})\thinspace\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\dot{\hat{\boldsymbol{q}}}\right)\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\thinspace, \nonumber \end{align} and $\boldsymbol{\tau}_{\textrm{res}}$ is the resultant disturbance torque acting on the EL system. Note that $\dot{\hat{\boldsymbol{M}}}(\hat{\boldsymbol{q}})-2\hat{\boldsymbol{C}}(\hat{\boldsymbol{q}},\dot{\hat{\boldsymbol{q}}})$ in Eq.~(\ref{eq:Lagrangian_formulation-modified}) is a skew-symmetric matrix, and this property is essential to the stability proof. We use a slight modification of the original robust nonlinear tracking control law Eq.~(\ref{eq:first_RNC_MRP}), which is given by: \begin{equation} \boldsymbol{u}_c =\skew{4}\hat{\boldsymbol{J}}\dot{\boldsymbol{\omega}}_{r}-\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{r}-\boldsymbol{Z}^{T}(\hat{\boldsymbol{q}}) \boldsymbol{K}_{\ell}\boldsymbol{Z}(\hat{\boldsymbol{q}})(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r})\label{eq:alternate_RNC} \end{equation} where $\boldsymbol{K}_{\ell}\in\mathbb{R}^{3\times3}$ and $\boldsymbol{\Lambda}_{\ell}\in\mathbb{R}^{3\times3}$ are positive definite constant matrices. Substituting $\boldsymbol{\omega}_{r}$ into (\ref{eq:alternate_RNC}), using the identity $\dot{\boldsymbol{Z}}^{-1}(\hat{\boldsymbol{q}})=-\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\dot{\boldsymbol{Z}}(\hat{\boldsymbol{q}})\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})$, and multiplying both sides with $\boldsymbol{Z}^{-T}(\hat{\boldsymbol{q}})$ gives us: \begin{equation} \hat{\boldsymbol{\tau}}_{c}=\hat{\boldsymbol{M}}(\hat{\boldsymbol{q}})\ddot{\boldsymbol{q}}_{r}+\hat{\boldsymbol{C}}(\hat{\boldsymbol{q}},\dot{\hat{\boldsymbol{q}}})\dot{\boldsymbol{q}}_{r}-\boldsymbol{K}_{\ell}(\dot{\hat{\boldsymbol{q}}}-\dot{\boldsymbol{q}}_{r})\thinspace,\label{eq:EL_Robust_nonlinear_control_law} \end{equation} where $\dot{\boldsymbol{q}}_{r}=\dot{\boldsymbol{q}}_{d}(t)+\boldsymbol{\Lambda}_{\ell}(\boldsymbol{q}_{d}(t)-\hat{\boldsymbol{q}})$. \begin{remark}[Advantages of (\ref{eq:first_RNC_MRP}) over the control law for EL systems (\ref{eq:EL_Robust_nonlinear_control_law})] \begin{itemize} \item First, the control law for EL system (\ref{eq:EL_Robust_nonlinear_control_law}) extensively uses the measured attitude $\hat{\boldsymbol{q}}$ and its rate $\dot{\hat{\boldsymbol{q}}}$ but does not explicitly use the measured angular velocity $\hat{\boldsymbol{\omega}}$. Moreover, the matrices $\boldsymbol{Z}(\hat{\boldsymbol{q}})$ and $\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})$, which might be susceptible to large fluctuations due to measurement errors in $\hat{\boldsymbol{q}}$, are used multiple times in Eq.~(\ref{eq:EL_Robust_nonlinear_control_law}). For example, the actual control input $\boldsymbol{u}_c$ depends on the computed control signal $\hat{\boldsymbol{\tau}}_{c}$ in Eq.~(\ref{eq:EL_Robust_nonlinear_control_law}) through the relation $\boldsymbol{u}_c=\boldsymbol{Z}^{T}(\hat{\boldsymbol{q}})\hat{\boldsymbol{\tau}}_{c}$ as shown in Eq.~(\ref{eq:Lagrangian_formulation-modified}). On the other hand, the original control law (\ref{eq:first_RNC_MRP}) directly computes $\boldsymbol{u}_c$. \item Second, the stability proof is constructed using a constant matrix $\boldsymbol{J}$, not the nonlinear matrix $\hat{\boldsymbol{M}}(\hat{\boldsymbol{q}})$, thereby allowing for an integral control formulation. \item Third, in Eqs.~(\ref{eq:alternate_RNC}) and (\ref{eq:EL_Robust_nonlinear_control_law}), the terms $\boldsymbol{Z}^{T}(\hat{\boldsymbol{q}}) \boldsymbol{K}_{\ell}\boldsymbol{Z}(\hat{\boldsymbol{q}})$, $\hat{\boldsymbol{M}}(\hat{\boldsymbol{q}})$, and $\hat{\boldsymbol{C}}(\hat{\boldsymbol{q}},\dot{\hat{\boldsymbol{q}}})$ strongly couple the three axes motions using the highly non-diagonal, non-symmetric matrix $\boldsymbol{Z}(\hat{\boldsymbol{q}})$. This strong coupling of the three-axis rotational motions might be undesirable. For example, initially, there might be an error in only one axis, but this coupling will subsequently introduce errors in all three axes. Depending on the inertia matrix, this strong coupling of three-axis motions can be avoided in the proposed control law Eq.~(\ref{eq:first_RNC_MRP}). \end{itemize} \end{remark} \subsubsection{Robust Nonlinear Tracking Control Law with Integral Control \label{sub:Robust-NCL-MRP-Integral}} \begin{frame}[allowframebreaks] Another benefit of the original robust nonlinear tracking control law Eq.~(\ref{eq:first_RNC_MRP}) is that it can be augmented with an integral control term in a straight-forward manner to eliminate any constant external disturbance while ensuring exponential convergence of the system's attitude trajectory to the desired attitude trajectory. \begin{theorem}[Robust Nonlinear Integral Control]\label{thm:Integral_RNTCL} For the given desired attitude trajectory $\boldsymbol{q}_{d}(t)$, positive definite constant matrices $\boldsymbol{K}_{m}\in\mathbb{R}^{3\times3}$ and $\boldsymbol{\Lambda}_{m}\in\mathbb{R}^{3\times3}$, and (possibly time-varying) uniformly positive definite diagonal matrix $\boldsymbol{K}_{I}(t)\in\mathbb{R}^{3\times3}$, we define the following control law: \begin{align} & \boldsymbol{u}_c =\skew{4}\hat{\boldsymbol{J}}\dot{\boldsymbol{\omega}}_{r}-\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{r}-\boldsymbol{K}_{m}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r}) -\int_{0}^{t} \boldsymbol{K}_{I}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r})dt \thinspace,\label{eq:RNC_Integral_MRP}\\ \textrm{where}\quad & \boldsymbol{\omega}_{r}=\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\dot{\boldsymbol{q}}_{d}(t)+\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\boldsymbol{\Lambda}_{m}(\boldsymbol{q}_{d}(t)-\hat{\boldsymbol{q}}) \thinspace.\nonumber \end{align} This control law has the following properties: \begin{itemize} \item This control law guarantees global exponential convergence of the system's trajectory to $\boldsymbol{q}_{d}(t)$ for any constant external disturbance (constant bias) acting on the system. \item In the presence of time-varying disturbance $\boldsymbol{d}_{\textrm{res},2}$ with a bounded rate $\dot{\boldsymbol{d}}_{\textrm{res},2}$, this control law guarantees that $\boldsymbol{q}(t)$ will globally exponentially converge to an error ball around $\boldsymbol{q}_{d}(t)$, whose size is determined by $\dot{\boldsymbol{d}}_{\textrm{res},2}$ (i.e., finite-gain $\mathcal{L}_p$ stable and ISS with respect to disturbance inputs with bounded rates). \end{itemize}\end{theorem} \end{frame} \begin{frame}[allowframebreaks] \textbf{\emph{Proof:}} The closed-loop dynamics is given by: \begin{equation} \boldsymbol{J}\dot{\boldsymbol{\omega}}_{e}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{e}+\boldsymbol{K}_{m}\boldsymbol{\omega}_{e} + \int_{0}^{t} \boldsymbol{K}_{I} \boldsymbol{\omega}_e dt = \boldsymbol{d}_{\textrm{res},2} \thinspace, \label{eq:proof_step8} \end{equation} where $\boldsymbol{\omega}_e = (\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r})$ and $\boldsymbol{d}_{\textrm{res},2}$ is defined in Eq.~(\ref{eq:proof_step7}). We first show that this control law can eliminate a constant external disturbance, hence replacing $\boldsymbol{d}_{\textrm{res},2}$ in Eq.~(\ref{eq:proof_step8}) with a constant disturbance term $\boldsymbol{d}_{\textrm{const}}$ gives us: \begin{equation} \boldsymbol{J} \dot{\boldsymbol{\omega}}_e - \boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{e} + \boldsymbol{K}_{m} \boldsymbol{\omega}_e + \int_{0}^{t} \boldsymbol{K}_{I} \boldsymbol{\omega}_e dt = \boldsymbol{d}_{\textrm{const}} \thinspace . \label{eq:proof_step2} \end{equation} Differentiating Eq.~(\ref{eq:proof_step2}) with respect to time and setting $\dot{\boldsymbol{d}}_{\textrm{const}}=0$, we get: \begin{equation} \boldsymbol{J}\ddot{\boldsymbol{\omega}}_{e}+\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right)\dot{\boldsymbol{\omega}}_{e}+\left(\boldsymbol{K}_{I}-\boldsymbol{S}\left(\boldsymbol{J}\dot{\hat{\boldsymbol{\omega}}}\right)\right)\boldsymbol{\omega}_{e}=0\thinspace. \label{eq:proof_step3} \end{equation} If we show that Eq.~(\ref{eq:proof_step3}) is contracting, then we prove our claim (i) that the given control law can successfully eliminate any constant external disturbance acting on the system. In order to prove Eq.~(\ref{eq:proof_step3}) is globally exponentially stable, we consider two cases which depend on the time-varying nature of the matrix $\boldsymbol{K}_{I}$. We first consider the case where $\boldsymbol{K}_{I}$ is a constant positive definite diagonal matrix. The matrix $\boldsymbol{K}_{I}$ can be decomposed into $\boldsymbol{K}_{I} = \boldsymbol{K}_{I}^{\frac{1}{2}} \boldsymbol{K}_{I}^{\frac{1}{2}}$, where the matrix $\boldsymbol{K}_{I}^{\frac{1}{2}}$ is also a constant positive definite diagonal matrix. We introduce the term $\boldsymbol{y}_1$, where $\dot{\boldsymbol{y}}_{1}$ is defined as $\dot{\boldsymbol{y}}_{1}= \boldsymbol{K}_{I}^{\frac{1}{2}} \boldsymbol{\omega}_{e}$. Then we can write $\dot{\boldsymbol{\omega}}_e$ as: \begin{equation} \dot{\boldsymbol{\omega}}_{e}=-(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right)\boldsymbol{\omega}_{e} -(\boldsymbol{J})^{-1} \boldsymbol{K}_{I}^{\frac{1}{2}} \boldsymbol{y}_{1}\thinspace. \label{eq:proof_step4} \end{equation} Note that differentiating Eq.~(\ref{eq:proof_step4}) with respect to time and substituting $\dot{\boldsymbol{y}}_{1}$ gives us Eq.~(\ref{eq:proof_step3}). Therefore, these equations can be written in matrix form as: \begin{equation} \begin{bmatrix} \dot{\boldsymbol{\omega}}_{e}\\ \dot{\boldsymbol{y}}_{1} \end{bmatrix}=\left[\begin{smallmatrix} -(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right) & -(\boldsymbol{J})^{-1} \boldsymbol{K}_{I}^{\frac{1}{2}} \\ \boldsymbol{K}_{I}^{\frac{1}{2}} & \boldsymbol{0} \end{smallmatrix}\right] \begin{bmatrix} \boldsymbol{\omega}_{e}\\ \boldsymbol{y}_{1} \end{bmatrix} = \boldsymbol{F} \begin{bmatrix} \boldsymbol{\omega}_{e}\\ \boldsymbol{y}_{1} \end{bmatrix} \thinspace. \label{eq:proof_step5} \end{equation} We define the positive definite matrix $\boldsymbol{\Xi}=\left[\begin{smallmatrix}\boldsymbol{J} & b\mathbf{I}\\ b\mathbf{I} & \mathbf{I}\end{smallmatrix}\right]$, where $b$ is a constant between $0 < b < \lambda_{\max}^{\frac{1}{2}}(\boldsymbol{J})$. The symmetric matrix $(\boldsymbol{\Xi F})_\mathrm{sym} = \frac{1}{2}\left((\boldsymbol{\Xi F})+(\boldsymbol{\Xi F})^{T}\right)$ is given by: \begin{align} (\boldsymbol{\Xi F})_\mathrm{sym} & = - \left[\begin{smallmatrix} \frac{\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T}}{2}-b\boldsymbol{K}_{I}^{\frac{1}{2}} & \frac{b}{2}\left[(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right)\right]^{T}\\ \frac{b}{2}(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right) & \frac{b}{2}\left((\boldsymbol{J})^{-1}\boldsymbol{K}_{I}^{\frac{1}{2}}+\boldsymbol{K}_{I}^{\frac{1}{2}}(\boldsymbol{J})^{-1}\right) \end{smallmatrix}\right] \thinspace . \nonumber \end{align} The sufficient conditions for the matrix $(\boldsymbol{\Xi}\boldsymbol{F})_{\mathrm{sym}}$ to be negative definite are: \begin{align} & -\frac{\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T}}{2}+b\boldsymbol{K}_{I}^{\frac{1}{2}}<0\thinspace, \qquad -\frac{b}{2}\left((\boldsymbol{J})^{-1}\boldsymbol{K}_{I}^{\frac{1}{2}}+\boldsymbol{K}_{I}^{\frac{1}{2}}(\boldsymbol{J})^{-1}\right) <0\thinspace, \label{eq:proof_condition2} \\ & \tfrac{\lambda_{\max}\left(-\frac{\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T}}{2}+b\boldsymbol{K}_{I}^{\frac{1}{2}}\right)\lambda_{\max}\left(-\frac{b}{2}\left((\boldsymbol{J})^{-1}\boldsymbol{K}_{I}^{\frac{1}{2}}+\boldsymbol{K}_{I}^{\frac{1}{2}}(\boldsymbol{J})^{-1}\right)\right)}{\sigma_{\max}^{2}\left(-\frac{b}{2}\left[(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right)\right]^{T}\right)} > 1 \thinspace. \label{eq:proof_condition3} \end{align} Equation~(\ref{eq:proof_condition2}) is satisfied by $0<b<\frac{\lambda_{\min}(\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T})}{2\lambda_{\max}(\boldsymbol{K}_{I}^{\frac{1}{2}})}$. Equation~(\ref{eq:proof_condition3}) is satisfied by $b<b_3$, where $b_3$ is given by: \begin{equation} b_3 = \tfrac{\lambda_{\max}\left(\frac{\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T}}{2}\right)\lambda_{\min}\left((\boldsymbol{J})^{-1}\boldsymbol{K}_{I}^{\frac{1}{2}}+\boldsymbol{K}_{I}^{\frac{1}{2}}(\boldsymbol{J})^{-1}\right)}{\frac{1}{2}\sigma_{\max}^{2}\left[(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right)\right]^{T}+\lambda_{\min}\left(\boldsymbol{K}_{I}^{\frac{1}{2}}\right)\lambda_{\min}\left((\boldsymbol{J})^{-1}\boldsymbol{K}_{I}^{\frac{1}{2}}+\boldsymbol{K}_{I}^{\frac{1}{2}}(\boldsymbol{J})^{-1}\right)} \thinspace. \end{equation} Therefore, the matrix $(\boldsymbol{\Xi F})_\mathrm{sym}$ is negative definite if $b$ is chosen such that $0 <b < \min ( \lambda_{\max}^{\frac{1}{2}}(\boldsymbol{J}),\thinspace \frac{\lambda_{\min}(\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T})}{2\lambda_{\max}(\boldsymbol{K}_{I}^{\frac{1}{2}})}, \thinspace b_{3} ) $. We define the generalized virtual displacement $\delta\boldsymbol{z}=[\delta\boldsymbol{\omega}_{e},\thinspace\delta\boldsymbol{y}_{1}]^{T}$, where $\delta\boldsymbol{\omega}_{e}$ and $\delta\boldsymbol{y}_{1}$ are infinitesimal displacements at fixed time. Therefore, \begin{eqnarray} \frac{d}{dt}\left(\delta\boldsymbol{z}^{T} \boldsymbol{\Xi} \delta\boldsymbol{z}\right)=\delta\boldsymbol{z}^{T} \left( (\boldsymbol{\Xi F}) + (\boldsymbol{\Xi F})^T \right) \delta\boldsymbol{z}\leq 2\lambda_{\max}((\boldsymbol{\Xi F})_\mathrm{sym})\|\delta\boldsymbol{z}\|_{2}^2 \\ \leq \frac{2\lambda_{\max}((\boldsymbol{\Xi F} )_\mathrm{sym})}{\lambda_{\max}(\boldsymbol{\Xi})} \left(\delta\boldsymbol{z}^{T} \boldsymbol{\Xi} \delta\boldsymbol{z}\right) \thinspace. \end{eqnarray} Hence, it follows from the contraction analysis (Theorem~\ref{Thm:contraction}) that all system trajectories converge exponentially fast to a single trajectory ($\delta\boldsymbol{z} \rightarrow 0$ and $\delta\boldsymbol{\omega}_e \rightarrow 0$) at a rate of $\frac{-\lambda_{\max}((\boldsymbol{\Xi F} )_\mathrm{sym})}{\lambda_{\max}(\boldsymbol{\Xi})}$. Moreover, in the presence of bounded time-varying resultant disturbance $\boldsymbol{d}_{\textrm{res},2}$ with bounded $\dot{\boldsymbol{d}}_{\textrm{res},2}$, we get from Lemma~\ref{LM:Robust_contraction_original}: \begin{equation} \lim_{t \rightarrow \infty} \int_{0}^{\boldsymbol{\omega}_{e}}\|\delta\boldsymbol{\omega}_{e}\|_{2}\leq \frac{(b+1) \lambda_{\max}(\boldsymbol{\Xi}) }{-\lambda_{\max}((\boldsymbol{\Xi F} )_\mathrm{sym}) } \left( \sup_t \lambda_{\max}(\boldsymbol{K}_{I}^{-\frac{1}{2}}) \right) \left( \sup_{t}\| \dot{\boldsymbol{d}}_{\textrm{res},2}\|_{2} \right) \thinspace . \end{equation} where $\|\delta\boldsymbol{\omega}_{e}\|_{2}\leq\|\delta\boldsymbol{z}\|_{2}$ and $\lambda_{\min}(\boldsymbol{\Xi})>1$ are used. Also, note that the disturbance term in the righthand side of Eq.~(\ref{eq:proof_step5}) is $(\mathbf{0};-\boldsymbol{K}_{I}^{-\frac{1}{2}}\dot{\boldsymbol{d}}_{\textrm{res},2})$. The fact that convergence of $\boldsymbol{\omega}_{e} \rightarrow \boldsymbol{0}$ implies convergence of the system's trajectory to the desired trajectory ($\hat{\boldsymbol{q}} \rightarrow \boldsymbol{q}_d$) is already presented in the proof of Theorem \ref{thm:first_RNTCL}. This completes the proof. If both $\boldsymbol{K}_{I}$ and $\dot{\boldsymbol{K}}_{I}$ are uniformly positive definite diagonal matrices, there exits a simpler proof, which is presented here. The matrix $\dot{\boldsymbol{K}}_{I}$ can also be decomposed into $\dot{\boldsymbol{K}}_{I} = \dot{\boldsymbol{K}}_{I}^{\frac{1}{2}} \dot{\boldsymbol{K}}_{I}^{\frac{1}{2}}$. We introduce another term $\boldsymbol{y}_2$, where: \begin{equation} \dot{\boldsymbol{y}}_{2}=\boldsymbol{K}_{I}^{\frac{1}{2}} \boldsymbol{\omega}_{e} - \boldsymbol{K}_{I}^{-\frac{1}{2}} \dot{\boldsymbol{K}}_{I}^{\frac{1}{2}} \boldsymbol{y}_{2}\thinspace. \end{equation} Once again, $\dot{\boldsymbol{\omega}}_e$ can be written in a form similar to that of Eq.~(\ref{eq:proof_step4}). The matrix form of these equations is given by: \begin{equation} \begin{bmatrix} \dot{\boldsymbol{\omega}}_{e}\\ \dot{\boldsymbol{y}}_{2} \end{bmatrix}= \left[\begin{smallmatrix} -(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right) & -(\boldsymbol{J})^{-1} \boldsymbol{K}_{I}^{\frac{1}{2}} \\ \boldsymbol{K}_{I}^{\frac{1}{2}} & - \boldsymbol{K}_{I}^{-\frac{1}{2}} \dot{\boldsymbol{K}}_{I}^{\frac{1}{2}} \end{smallmatrix}\right]\begin{bmatrix} \boldsymbol{\omega}_{e}\\ \boldsymbol{y}_{2} \end{bmatrix} = \tilde{\boldsymbol{F}} \begin{bmatrix} \boldsymbol{\omega}_{e}\\ \boldsymbol{y}_{2} \end{bmatrix} \thinspace. \label{eq:proof_step6} \end{equation} Clearly, the symmetric part of the matrix $\boldsymbol{\Xi} \tilde{\boldsymbol{F}}$ is negative definite. Therefore, \begin{align} \frac{d}{dt}\left(\delta\boldsymbol{z}^{T} \boldsymbol{\Xi} \delta\boldsymbol{z}\right)&=\delta\boldsymbol{z}^{T} \left( (\boldsymbol{\Xi}\tilde{\boldsymbol{F}}) + (\boldsymbol{\Xi}\tilde{\boldsymbol{F}})^T \right) \delta\boldsymbol{z}\leq 2\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym})\|\delta\boldsymbol{z}\|_{2}^2\\ &\leq \frac{2\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym})}{\lambda_{\max}(\boldsymbol{J})} \left(\delta\boldsymbol{z}^{T} \boldsymbol{\Xi} \delta\boldsymbol{z}\right) \end{align} where $(\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym}=\frac{(\boldsymbol{\Xi} \tilde{\boldsymbol{F}})+(\boldsymbol{\Xi} \tilde{\boldsymbol{F}})^T}{2}$. Also, $\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym}) < 0$ and is bounded as $\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym}) \leq - \min ( \lambda_{\min}(\boldsymbol{K}_{m}), \inf_{t} ( \lambda_{\min}(\boldsymbol{K}_{I}^{-\frac{1}{2}} \dot{\boldsymbol{K}}_{I}^{\frac{1}{2}}) ) )$. Hence, it follows from the contraction analysis that all system trajectories converge exponentially fast to a single trajectory at a rate of $\frac{-\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym})}{\lambda_{\max}(\boldsymbol{J})}$. Moreover, in the presence of bounded $\boldsymbol{d}_{\textrm{res},2}$ and $\dot{\boldsymbol{d}}_{\textrm{res},2}$, we get from Lemma \ref{LM:Robust_contraction_original} that: \begin{equation} \lim_{t \rightarrow \infty} \int_{0}^{\boldsymbol{\omega}_{e}}\|\delta\boldsymbol{\omega}_{e}\|_{2}\leq \frac{\lambda_{\max}(\boldsymbol{J}) }{-\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym}) } \left( \sup_t \lambda_{\max}(\boldsymbol{K}_{I}^{-\frac{1}{2}}) \right) \left( \sup_{t}\| \dot{\boldsymbol{d}}_{\textrm{res},2}\|_{2} \right) \thinspace . \end{equation} where $\|\delta\boldsymbol{\omega}_{e}\|_{2}\leq\|\delta\boldsymbol{z}\|_{2}$ and $\lambda_{\min}(\boldsymbol{J})>1$ are used. Also, note that the disturbance term in the righthand side of Eq.~(\ref{eq:proof_step6}) is $(\mathbf{0};\boldsymbol{K}_{I}^{-\frac{1}{2}}\dot{\boldsymbol{d}}_{\textrm{res},2})$. \qed \begin{remark} Note that the second block diagonal matrix of the Jacobin $\boldsymbol{F}$ in Eq.~(\ref{eq:proof_step5}) is $\mathbf{0}$, which usually yields a semi-contracting system with global asymptotic stability. For example, $\boldsymbol{F}$ from Eq.~(\ref{eq:proof_step5}) and $\boldsymbol{\Theta}=\left[\begin{smallmatrix}\boldsymbol{J} & \boldsymbol{0}\\ \boldsymbol{0} & \mathbf{I}\end{smallmatrix}\right]$ results in a semi-contracting system due to $\frac{1}{2}\left((\boldsymbol{\Theta F})+(\boldsymbol{\Theta F})^{T}\right)=\left[\begin{smallmatrix} -\boldsymbol{K}_{m} & \boldsymbol{0}\\ \boldsymbol{0} & \boldsymbol{0} \end{smallmatrix}\right]$. Similarly, the following adaptive control law also yields global asymptotic stability. In contrast, Theorem~\ref{thm:Integral_RNTCL} presents a stronger result with global exponential stability. \end{remark} \end{frame} \subsubsection{Nonlinear Adaptive Control\label{sub:Adaptive-NCL}} \begin{remark}[Nonlinear Adaptive Attitude Control] Let the parameter $\hat{\boldsymbol{a}}$ capture the six uncertain terms in the inertia tensor $\boldsymbol{J}$. The resulting adaptive nonlinear tracking control law and the tuning law are given by: \begin{align} \boldsymbol{u}_c = \boldsymbol{Y}\hat{\boldsymbol{a}} -\boldsymbol{K}_{r}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r}) \thinspace, \qquad \dot{\hat{\boldsymbol{a}}} =-\boldsymbol{\Gamma}_{r}\textrm{Proj}\left(\hat{\boldsymbol{a}},\boldsymbol{Y}^{T}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r})\right) \thinspace,\label{eq:RNC_adaptive} \end{align} where $\boldsymbol{Y}\hat{\boldsymbol{a}}=\skew{4}\hat{\boldsymbol{J}}\dot{\boldsymbol{\omega}}_{r}-\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{r}$, $\boldsymbol{\omega}_{r}$ is defined in Eq.~(\ref{eq:first_RNC_MRP}), and $\boldsymbol{\Gamma}_{r}\in\mathbb{R}^{6\times6}$ is a positive-definite diagonal matrix. For some boundary function $f(\boldsymbol{\theta})$ (e.g., $f(\boldsymbol{\theta})=\frac{(\boldsymbol{\theta}^{T}\boldsymbol{\theta}-\theta_{\textrm{max}}^{2})}{\epsilon_{\theta}\theta_{\textrm{max}}^{2}}$ ), the projection operator is given by $ \textrm{Proj}(\boldsymbol{\theta},\boldsymbol{x}) = \boldsymbol{x}-\frac{\nabla f(\boldsymbol{\theta})\nabla f(\boldsymbol{\theta})^{T}}{\|\nabla f(\boldsymbol{\theta})\|^{2}}\boldsymbol{x}f(\boldsymbol{\theta})$ if $f(\boldsymbol{\theta})>0, \thinspace \nabla f(\boldsymbol{\theta})^{T}\boldsymbol{x}>0$; and $\boldsymbol{x}$ otherwise. The proof of global asymptotic stability of using Eq.~(\ref{eq:RNC_adaptive}) for the disturbance-free system is straightforward. The stability result of adaptive control is only globally asymptotic because its closed-loop system of the states $(\boldsymbol{\omega}_{e},\hat{\boldsymbol{a}})^T$ yields a negative semidefinite Jacobian matrix $\left[\begin{smallmatrix}-\boldsymbol{K}_{r} & \mathbf{0}\\ \mathbf{0}& \mathbf{0}\end{smallmatrix}\right]$ (also, see Eq.~(\ref{eq:proof_step5})). However, the use of a projection operator in Eq.~(\ref{eq:RNC_adaptive}) permits Input-to-State Stability (ISS). \end{remark} \subsubsection{Robust Nonlinear Tracking Control Law on SO($3$) \label{sub:Robust-NCL-SO3}} It is shown in Table \ref{tab:Properties-Attitude-Rep} that the rotation matrix ($\boldsymbol{R}\in$ SO($3$)) is a global and unique attitude representation. In this section, we present a variation of Eq.~(\ref{eq:first_RNC_MRP}) that exponentially stabilizes the attitude dynamics from almost all initial conditions on SO($3$), i.e., all initial conditions except for those starting from a two-dimensional subset of SO($3$). Even global asymptotic convergence is not possible for any continuous feedback control law in SO($3$). In this section, we present a novel control law that guarantees exponential convergence to the desired trajectory for almost all initial conditions on SO($3$). Another control law that also guarantees almost-global exponential convergence is presented in~\cite{Ref:Lee12}, but the control law and proof techniques are substantially different from the existing Lyapunov-based approach used in~\cite{Ref:Lee12}. Let $\boldsymbol{R}_{d}(t)\in$ SO($3$) denote the desired attitude trajectory, which is obtained from the desired attitude trajectory $\boldsymbol{q}_{d}(t)$ using the transformations given in Table \ref{tab:Properties-Attitude-Rep}. Let the inverse of the $\boldsymbol{S}(\cdot)$ map be the $\boldsymbol{\vee}(\cdot)$ map, whose input is a skew-symmetric matrix and is defined as $\boldsymbol{\vee} (\boldsymbol{S}(\boldsymbol{\omega})) = \boldsymbol{\omega}$. We now define the following notations:\cite{Ref:Lee12} \begin{align} \boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}} =\frac{1}{2\sqrt{1+\textrm{tr}(\boldsymbol{R}_{d}^{T}\skew{4}\hat{\boldsymbol{R}})}} \left( \boldsymbol{\vee}\left(\boldsymbol{R}_{d}^{T}\skew{4}\hat{\boldsymbol{R}}-\skew{4}\hat{\boldsymbol{R}}^{T}\boldsymbol{R}_{d}\right) \right) \thinspace, \qquad \boldsymbol{e}_{\hat{\boldsymbol{\omega}}} =\hat{\boldsymbol{\omega}}-\skew{4}\hat{\boldsymbol{R}}^{T}\boldsymbol{R}_{d} \left( \boldsymbol{\vee}\left(\boldsymbol{R}_{d}^{T} \dot{\boldsymbol{R}}_{d}\right) \right)\thinspace, \end{align} where $\textrm{tr}(\cdot)$ is the trace of the matrix. Here $\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}$ represents the attitude error vector between the current measured attitude $\skew{4}\hat{\boldsymbol{R}}$ and the desired attitude $\boldsymbol{R}_{d}$. For any $\boldsymbol{R}_{d}^{T}\skew{4}\hat{\boldsymbol{R}}$, its trace is bounded by $-1\leq\textrm{tr}(\boldsymbol{R}_{d}^{T}\skew{4}\hat{\boldsymbol{R}})\leq3$. Hence $\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}$ is not defined only on the two-dimensional subset of SO($3$) where $\textrm{tr}(\boldsymbol{R}_{d}^{T}\skew{4}\hat{\boldsymbol{R}})=-1$, i.e., $\skew{4}\hat{\boldsymbol{R}}=\boldsymbol{R}_{d}\exp(\pm\pi\boldsymbol{S}(\boldsymbol{\kappa}))$, where $\boldsymbol{\kappa}\in\mathbb{S}^{2}$. Finally, we define the matrix $\boldsymbol{E}(\skew{4}\hat{\boldsymbol{R}},\boldsymbol{R}_{d})$ as follows: \begin{equation} \frac{d\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}}{dt}= \left[ \frac{1}{2\sqrt{1+\textrm{tr}(\boldsymbol{R}_{d}^{T}\skew{4}\hat{\boldsymbol{R}})}}\left(\textrm{tr}(\skew{4}\hat{\boldsymbol{R}}^{T}\boldsymbol{R}_{d})\mathbf{I}-\skew{4}\hat{\boldsymbol{R}}^{T}\boldsymbol{R}_{d}+2\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}^{T}\right) \right] \boldsymbol{e}_{\hat{\boldsymbol{\omega}}} = \boldsymbol{E}(\skew{4}\hat{\boldsymbol{R}},\boldsymbol{R}_{d}) \boldsymbol{e}_{\hat{\boldsymbol{\omega}}}\thinspace. \end{equation} \begin{theorem}[Robust Nonlinear Tracking Control Law on SO($3$)]For the desired attitude trajectory $\boldsymbol{R}_{d}(t)\in \mathrm{SO(3)}$ and positive definite matrices $\boldsymbol{K}_{e}\in\mathbb{R}^{3\times3}$ and $\boldsymbol{\Lambda}_{e}\in\mathbb{R}^{3\times3}$, we define the following control law: \begin{align} & \boldsymbol{u}_c=\skew{4}\hat{\boldsymbol{J}}\dot{\boldsymbol{\omega}}_{r}-\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{r}-\boldsymbol{K}_{e}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r})\thinspace,\label{eq:RNC_SO3}\\ \textrm{where}\quad & \boldsymbol{\omega}_{r}=\skew{4}\hat{\boldsymbol{R}}^{T}\boldsymbol{R}_{d} \left( \boldsymbol{\vee}\left(\boldsymbol{R}_{d}^{T} \dot{\boldsymbol{R}}_{d}\right) \right) - \boldsymbol{\Lambda}_{e} \boldsymbol{E}^{T}(\skew{4}\hat{\boldsymbol{R}},\boldsymbol{R}_{d}) \boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}\thinspace.\nonumber \end{align} In the absence of disturbances or uncertainties, this control law guarantees exponential convergence of the system's trajectory $\boldsymbol{R}(t)\in \mathrm{SO(3)}$ to the desired trajectory $\boldsymbol{R}_{d}(t)$ for almost all initial conditions, i.e., all initial conditions that are not on the two-dimensional subset of SO($3$) where $\skew{4}\hat{\boldsymbol{R}}(0)=\boldsymbol{R}_{d}(0)\exp(\pm\pi\boldsymbol{S}(\boldsymbol{\kappa}))$, where $\boldsymbol{\kappa}\in\mathbb{S}^{2}$. Moreover, in the presence of bounded disturbances or uncertainties, this control law guarantees that $\boldsymbol{R}(t)$ will exponentially converge to a bounded error ball around $\boldsymbol{R}_{d}(t)$. \end{theorem} \begin{frame}[allowframebreaks] \textbf{\emph{Proof:}} The closed-loop dynamics obtained by substituting $\boldsymbol{u}_c$ from Eq.~(\ref{eq:RNC_SO3}) into Eq.~(\ref{eq:constraints_case2}) is the same as Eq.~(\ref{eq:proof_step7}) in the proof of Theorem \ref{thm:first_RNTCL}. Hence we can directly conclude from that proof that all system trajectories of $\boldsymbol{\omega}_e$ converge exponentially fast to a single trajectory ($\boldsymbol{\omega}_e \rightarrow 0$) at a rate of $\frac{\lambda_{\min}(\boldsymbol{K}_{e})}{\lambda_{\max}(\boldsymbol{J})}$. Moreover, in the presence of bounded resultant disturbance $\boldsymbol{d}_{\textrm{res},2}$, $\lim_{t \rightarrow \infty} \int_{0}^{\boldsymbol{\omega}_{e}}\|\delta\boldsymbol{y}\|_{2}$ is bounded by Eq.~(\ref{eq:proof_step9}). Now we show that convergence of $\boldsymbol{\omega}_{e}$ implies convergence of the system's trajectory to the desired trajectory ($\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}} \rightarrow 0$). It follows from the definition of $\boldsymbol{\omega}_{r}$ that: \begin{equation} \boldsymbol{\omega}_{e}=\hat{\boldsymbol{\omega}}-\skew{4}\hat{\boldsymbol{R}}^{T}\boldsymbol{R}_{d} \left( \boldsymbol{\vee}\left(\boldsymbol{R}_{d}^{T} \dot{\boldsymbol{R}}_{d}\right) \right) + \boldsymbol{\Lambda}_{e} \boldsymbol{E}^{T} \boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}} = \boldsymbol{E}^{-1}\left(\dot{\boldsymbol{e}}_{\skew{4}\hat{\boldsymbol{R}}} + \boldsymbol{E} \boldsymbol{\Lambda}_{e} \boldsymbol{E}^{T} \boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}\right)\thinspace. \end{equation} In the absence of $\boldsymbol{\omega}_{e}$, all system trajectories of $ \delta \boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}$ will converge exponentially fast to a single trajectory ($\delta \boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}} \rightarrow 0$) with a rate of $\lambda_{\min}(\boldsymbol{E} \boldsymbol{\Lambda}_{e} \boldsymbol{E}^{T})$, where $\boldsymbol{E} \boldsymbol{\Lambda}_{e} \boldsymbol{E}^{T}$ is also a positive definite matrix. In the presence of $\boldsymbol{\omega}_{e}$, it follows from Lemma \ref{lemma:robustness_Lp_stability} that: \begin{align} \lim_{t \rightarrow \infty} \int_{0}^{\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}}\|\delta\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}\|_{2} & \leq\frac{\lambda_{\max}(\boldsymbol{J})}{\lambda_{\min}(\boldsymbol{E} \boldsymbol{\Lambda}_{e} \boldsymbol{E}^{T})\lambda_{\min}(\boldsymbol{K}_{e})\lambda_{\min}(\boldsymbol{J})} \left(\sup_{t}\sigma_{\max}(\boldsymbol{E})\right)\left(\sup_{t}\|\boldsymbol{d}_{\textrm{res},2}\|_{2}\right) \thinspace. \end{align} Note that $\|\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}\|_2 \rightarrow \infty$ if $\skew{4}\hat{\boldsymbol{R}} \rightarrow\boldsymbol{R}_{d}\exp(\pm\pi\boldsymbol{S}(\boldsymbol{\kappa}))$, where $\boldsymbol{\kappa}\in\mathbb{S}^{2}$. On the other hand, for any valid initial condition, $\|\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}\|_2$ is always bounded and exponentially decreasing till it reaches the error ball. This implies that once the system starts from a valid initial condition, it can never go towards the two-dimensional subset of SO($3$) due to exponential convergence. Hence we have shown, using a hierarchical closed-loop system, that the attitude error vector $\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}$ exponentially converges to the error bound for almost all initial conditions (except for those initial conditions in the two-dimensional subset of SO($3$)). \qed\end{frame} \subsection{Nonlinear Position Tracking Controller of Quadcopters}\label{sec:position_cont} \begin{frame}[allowframebreaks]\frametitle{Nonlinear Position Tracking Controller of Quadcopters} The position control law forms the outer-loop, which generates the desired attitude trajectory $\boldsymbol{q}_d(t)$ for the attitude tracking controller presented in Sec.~\ref{sec:att_cont} as a function of the position errors ($\mathbf{x}$-$\mathbf{x}_d$). The desired vehicle trajectory $\mathbf{x}_d$ and the estimated vehicle position $\mathbf{x}$ are computed in the local reference frame (e.g., local obstacle map) that is evolving in the absence of a global map and $\mathbf{x}_d$ is provided by the algorithms presented in Sec.~\ref{S:SATO}. We used Euler angles for $\boldsymbol{q}$ in our experiments. The translational motion along the three axes can be given as \begin{align} m\ddot{x} = \overline{X}, \ m\ddot{y} = \overline{Y}, \ m\ddot{z} = -mg + \overline{Z} \label{Eq:x_ddot} \end{align} where $ \overline{X} =F(\cos\psi\cos\phi\sin\theta + \sin\psi\sin\phi)$, $\overline{Y}=F(\sin\psi\cos\phi\sin\theta - \cos\psi\sin\phi)$, $\overline{Z}=F\cos\phi\cos\theta$, $g$ is the acceleration due to gravity, and $m$ is the mass of the quadrotor. Also, ($\phi$, $\theta$, $\psi$) are the Euler angles of the quadrotor and $F$ is the total force generated by the quadrotor. In order to control the position of the quadrotor, a PID controller to track the desired position trajectory along each of the three axes is sufficient. For example, for the z-axis, $$\overline{Z} = m\left(g + \ddot{z}_d + K_{D_z}(\dot{z}_d - \dot{z}) + K_{P_z}(z_d - z) + K_{I_z}\int(z_d - z)dt\right).$$ The PID controller (with weight cancellation for the z-axis) yields the closed-loop dynamics in linear form, thereby yielding an exact method of computing the gains for global exponential convergence to the desired position trajectory. Since the yaw angle ($\psi$) can be decoupled from the linear motion of the quadrotor, i.e., the quadrotor can yaw while holding its position, a separate PID controller can be applied to control it to the desired yaw angle ($\psi_d$). Hence, the vertical force and desired attitude for any of the nonlinear attitude tracking controller discussed in the previous subsections are given as: {\small \begin{align} F_d = \sqrt{\overline{X}^2 + \overline{Y}^2 + \overline{Z}^2}, ~\phi_d = \sin^{-1}(\frac{\overline{X}\sin\psi_d - \overline{Y}\cos\psi_d}{F_d}), ~\theta_d = \tan^{-1}\left(\frac{\overline{X}\cos\psi_d + \overline{Y}\sin\psi_d}{\overline{Z}}\right)\label{Eq:final_theta} \end{align} } These attitude and desired force commands are then tracked by the inner attitude control loop thus completing the entire control algorithm as shown in Fig. \ref{Fig:control_law}. As a result, the squared values of four motor RPMs $\boldsymbol{n^2}=(n_1^2, n_2^2, n_3^2, n_4^2)^T$ can be computed from \begin{equation} \boldsymbol{n^2} = \boldsymbol{B}^{-1} (F_d,\boldsymbol{u}^T)^T \end{equation} where $F_d$ is the desired force from (\ref{Eq:final_theta}) and the vector $\boldsymbol{u}=(u_x, u_y,u_z)^T$ is the control torque from one of the exponentially-stabilizing attitude control laws given in the previous section. Also, the $4\times4$ matrix $\boldsymbol{B}$ is a function of the thrust ($C_T$) and the power coefficients ($C_P$). \end{frame} \section{Euler-Lagrangian Systems of Riemannian Manifolds}\label{sec:larg_systems} The aim of Section 1 is to present a short introduction of the underlying characteristics of the particular forms of Lagrangian systems offered in this class. For example, the positive definite inertia matrix and symmetry of the nonlinear systems play a central role in our stability analysis and control synthesis. \subsection{Euler-Lagrangian Equations} To derive nonlinear equations of motion for generalized coordinates, $\mathbf{q} \in \mathbb{R}^n$, a method employing the Euler-Lagrangian equations of motion~\cite{Ref:Block,Ref:GeoControl,Ref:Spong_book} is preferred in this class for its simplicity in dealing with complex systems involving multiple dynamics. Another advantage of the Lagrangian approach~\cite{Ref:Murray_Robot} is its invariance with respect to coordinate changes. Let us define $Q$ as a smooth ($C^{\infty}$) \textbf{n-dimensional} configuration manifold of a mechanical system with generalized coordinates $\mathbf{q}\in Q$. Its tangent bundle, $TQ$ is the union of every tangent space $TQ_{\mathbf{q}}$ on $\mathbf{q}$. The cotangent bundle of $Q$ is defined as $T^{\star}Q$. Let $\delta \mathbf{q}$ be the virtual displacement corresponding to the variation of $\mathbf{q}$. In the presence of external forces (e.g. control action by actuators or external disturbances), the Lagrange-D'Alembert principle indicates that \begin{equation}\label{Dalembert} \delta\int^{b}_{a} L(\mathbf{q},\mathbf{\dot{q}})dt+\int^{b}_{a}\mathbf{F}\cdot\delta\mathbf{q}dt=0 \end{equation} where a Lagrangian $L:$ $TQ\rightarrow \mathbb{R}$ is defined as \begin{equation}\label{lagrange_ch2} L(\mathbf{q},\mathbf{\dot{q}})=K(\mathbf{q},\mathbf{\dot{q}})-V(\mathbf{q})=\frac{1}{2}{\mathbf{\dot{q}}}^{T}\mathbf{M}(\mathbf{q})\mathbf{\dot{q}}-V(\mathbf{q}) \end{equation} Notice that the potential energy, $V(\mathbf{q}):$ $Q\rightarrow\mathbb{R}$ is independent of $\mathbf{\dot q}$ whereas the kinetic energy can often be represented in a quadratic form, $K=\frac{1}{2}{\mathbf{\dot{q}}}^{T}\mathbf{M}(\mathbf{q})\mathbf{\dot{q}}$. From (\ref{Dalembert}), the following Euler-Lagrange equations of motion for a mechanical system with a configuration manifold $Q$ can be derived: \begin{equation}\label{lagrange_equation_ch2} \frac{d}{dt}\frac{\partial L(\mathbf{q},\mathbf{\dot{q}})}{\partial \dot{\mathbf{q}}}-\frac{\partial L(\mathbf{q},\mathbf{\dot{q}})}{\partial \mathbf{q}}=\mathbf{F} \end{equation} where $\mathbf{F}:\mathbb{R}\times TQ\rightarrow T^{\star}Q$ is an m-dimensional generalized force or torque vector ($\mathbf{F}\in \mathbb{R}^m$) acting on the system. The dependency on time ($t\in\mathbb{R}$) usually originates from a time-varying desired trajectory. Otherwise, a map of $\mathbf{F}$ is defined by $TQ\rightarrow T^{\star}Q$. If $m=n$ with $\mathbf{q} \in \mathbb{R}^n$, the system is a fully actuated system. However, if $m< n$, the system is an underactuated mechanical system. Sometimes, it is convenient to introduce dissipative nonconservative forces such as mechanical friction and aerodynamic drag: \begin{equation}\label{lagrange_equation_ch2F} \frac{d}{dt}\frac{\partial L(\mathbf{q},\mathbf{\dot{q}})}{\partial \dot{\mathbf{q}}}-\frac{\partial L(\mathbf{q},\mathbf{\dot{q}})}{\partial \mathbf{q}}=\mathbf{F}+\mathbf{B}(\mathbf{q},\mathbf{\dot q}) \end{equation} where $\mathbf{B}(\mathbf{q},\mathbf{\dot q})$ denotes a generalized nonconservative force or torque vector. Sometimes, when some subsystems are quasi-continuous, this dissipation force term depends only on the rate such that the quadratic Rayleigh dissipation function can be defined as follows: \begin{equation} \mathcal{D}=\frac{1}{2}\sum^{n}_{r=1}\sum^{n}_{s=1} d_{rs}\dot{q}_r\dot{q}_s=\mathbf{\dot q}^TD\mathbf{\dot q} \end{equation} where $D$ is generally symmetric positive definite. Then, $\mathbf{B}(\mathbf{q},\mathbf{\dot q})$ in (\ref{lagrange_equation_ch2F}) is obtained by \begin{equation} \mathbf{B}(\mathbf{q},\mathbf{\dot q})=-\frac{\partial \mathcal{D}}{\partial \dot{\mathbf{q}}} \end{equation} \subsection{Lagrangian on Riemannian Manifolds} The representation of the kinetic energy in a quadratic form in (\ref{lagrange_ch2}) warrants a further discussion. Recalling \begin{equation}\label{lagrange_2} K(\mathbf{q},\mathbf{\dot{q}})=\frac{1}{2}{\mathbf{\dot{q}}}^{T}\mathbf{M}(\mathbf{q})\mathbf{\dot{q}}, \end{equation} we can construct a mass/inertia matrix, $\mathbf{M}(\mathbf{q})\in\mathbb{R}^{n\times n}$ from the kinetic energy, $K(\mathbf{q},\mathbf{\dot{q}})$. In a large class of nonlinear systems, the matrix $\mathbf{M}(\mathbf{q})$ is uniformly positive definite (i.e., $\mathbf{M}(\mathbf{q})\geq \alpha \mathbf{I}$, $\alpha>0$). This condition can be proven by contradiction. If there exists $\mathbf{q}$ that yields a zero eigenvalue of $\mathbf{M}(\mathbf{q})$ (hence, not p.d.), the robot asrm could move with nonzero velocity $\dot{\mathbf{q}}$ with zero kinetic energy- an impossibility\!. This p.d. condition of the inertia matrix permits the following definition from geometric control theory~\cite{Ref:Marsden_Manfold,Ref:Block,Ref:GeoControl}. \begin{definition}[Riemannian Manifolds] A differentiable manifold with a positive definite symmetric quadratic form $\langle\cdot, \cdot\rangle$ on every tangent space $TQ_{\mathbf{q}}$ of the configuration variable, $\mathbf{q}$ is called a Riemannian manifold. The quadratic form $\langle\cdot, \cdot\rangle$ is often called a Riemannian metric. \end{definition} As shall be seen later, this Riemannian metric and its matrix representation, $\mathbf{M}(\mathbf{q})$ constructed from the kinetic energy of a nonlinear mechanical system, play a central role in the nonlinear control design and stability analysis offered in this class. Plugging (\ref{lagrange_ch2}) into (\ref{lagrange_equation_ch2}), Euler-Lagrange equations on a Riemannian manifold are obtained: \begin{equation}\label{NL_single_compact_ch2A} \mathbf{M}(\mathbf{q})\mathbf{\ddot{q}}+ \mathbf{\dot{q}}^T\mathbf{\Gamma}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}}+\mathbf{g}(\mathbf{q}) =\mathbf{F} \end{equation} where $\mathbf{g}(\mathbf{q})$ contains a gravity term of a rigid body such that $\frac{\partial \mathbf{V}(\mathbf{q})}{\partial\mathbf{q}}=\mathbf{g}(\mathbf{q})$, and the elements of the $\mathbf{\Gamma}$ matrix are Christoffel symbols~\cite{Ref:Spong_book,Ref:Slotine}: \begin{equation} \label{Christopher} \Gamma_{ijk}=\frac{1}{2}\left(\frac{\partial M_{ij}}{\partial q_k}+{\frac{\partial M_{ik}}{\partial q_j}-\frac{\partial M_{jk}}{\partial q_i}}\right) \end{equation} The quadratic term $\mathbf{\dot{q}}^T\mathbf{\Gamma}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}}$ can be classified into two different types. The terms involving $\dot{q}_i\dot{q}_j$ with $i\neq j$ represent the Coriolis force (torque) whereas the other terms involving ${\dot{q}_i}^2$ correspond to the centrifugal force (torque). It should be emphasized that the definition in (\ref{Christopher}) is one of many possible choices of $\mathbf{\Gamma}$ from the Euler-Lagrangian equations in (\ref{lagrange_equation_ch2}). To show the reason behind this choice, we proceed to illustrate the significance of the relationship between the Riemannian metric and Christoffel symbols. Let us represent an equivalent form to (\ref{NL_single_compact_ch2A}): \begin{equation}\label{NL_single_compact_ch2} \mathbf{M}(\mathbf{q})\mathbf{\ddot{q}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}}+\mathbf{g}(\mathbf{q}) =\mathbf{F} \end{equation} where the $\mathbf{C}$ matrix is defined as \begin{equation} \label{C_selection_ch2} c_{ij}=\frac{1}{2}\sum^{n}_{k=1}\frac{\partial M_{ij}}{\partial q_k}\dot{q_k}+\frac{1}{2}\sum^{n}_{k=1}\left({\frac{\partial M_{ik}}{\partial q_j}-\frac{\partial M_{jk}}{\partial q_i}}\right)\dot{q_k} \end{equation} Then, it is straightforward to show that $(\mathbf{\dot{M}}-2\mathbf{C})$ is skew-symmetric~\cite{Ref:Slotine} resulting in $\mathbf{x}^T(\mathbf{\dot{M}}-2\mathbf{C})\mathbf{x}=0$ for arbitrary $\mathbf{x}\in \mathbb{R}^n$. This skew-symmetric property can be viewed as a matrix expression of energy conservation~\cite{Ref:Slotine}, which is explained in the context of the passivity formalism in Section 3.\ref{sec:Passivity}. For example, let us assume $\mathbf{g}(\mathbf{q})=\mathbf{0}$ and consider the kinetic energy of the robot dynamics (\ref{NL_single_compact_ch2}): $V=\frac{1}{2}\dot{\mathbf{q}}^T \mathbf{M}(\mathbf{q})\dot{\mathbf{q}}$. \begin{align} \dot{V}=&\dot{\mathbf{q}}^T\mathbf{M}(\mathbf{q})\ddot{\mathbf{q}}+\frac{1}{2}\dot{\mathbf{q}}^T \mathbf{\dot{M}}(\mathbf{q})\dot{\mathbf{q}} \\ \nonumber =&\dot{\mathbf{q}}^T(\mathbf{F}+ \frac{1}{2}\mathbf{\dot{M}}\mathbf{\dot{q}}-\mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}})=\dot{\mathbf{q}}^T\mathbf{F} \end{align} where the LHS is the time-derivative of the kinetic energy and the RHS represents the power input from the actuators. Furthermore, since $\mathbf{M}(\mathbf{q})$ is symmetric, one can find that \begin{equation}\label{M_C_relation} \mathbf{\dot M}(\mathbf{q})=\mathbf{C}(\mathbf{q},\mathbf{\dot{q}})^T+\mathbf{C}(\mathbf{q},\mathbf{\dot{q}}). \end{equation} The property in (\ref{M_C_relation}) is widely exploited for stability analysis and control synthesis. Furthermore, one can derive the Euler-Lagrangian equations in (\ref{NL_single_compact_ch2}) using $\mathbf{\dot M}=\mathbf{C}^T+\mathbf{C}$ without solving (\ref{C_selection_ch2}) to derive the $\mathbf{C}$ matrix. \subsection{Symmetry}\label{sec:SymmetryCH2} In this section, we pay attention to a different notion of symmetry, so-called mechanical symmetry, which makes a connection with the conservation laws. Most mechanical systems, despite being non-symmetric in geometry, possess some symmetry properties. In the context of geometric control theory, mechanical symmetries lead to to reduction of the model complexity~\cite{Ref:Chang,Ref:Oli_Saber}. We start with the definition of mechanical symmetry. \begin{definition}[Symmetry in Mechanics] The Lagrangian $L(\mathbf{q},\mathbf{\dot{q}})=K(\mathbf{q},\mathbf{\dot{q}})-V(\mathbf{q})$ is symmetric with respect to the configuration variable $q_i$ if and only if \begin{equation} \frac{\partial L(\mathbf{q},\mathbf{\dot{q}})}{\partial q_i}=0 \end{equation} where $q_i$ is the $i$-th ($i\in\{1,\dots,n\})$ configuration variable in the vector $\mathbf{q}$. \end{definition} The definition states that the system is symmetric when its Lagrangian is invariant under the group action of $q_i$. We define the $i$-th generalized momentum, $p_i$ as \begin{equation} p_i=\frac{\partial L(\mathbf{q},\mathbf{\dot{q}})}{\partial \dot{q}_i} \end{equation} Then, the unforced Euler-Lagrange equation from (\ref{lagrange_equation_ch2}) reduces to \begin{equation} \frac{d}{dt}p_i-\frac{\partial L}{\partial {q}_i}=0 \end{equation} Consequently, symmetry of a Lagrangian system, $\frac{\partial L}{\partial q_i}=0$, leads to $\frac{d}{dt}p_i=0$. In other words, the $i$-th generalized momentum is conserved, when the system is symmetric with respect to $q_i$. Most mechanical systems possess a relaxed form of symmetry as follows. \begin{definition}[Kinetic Symmetry] A Lagrangian system is kinetically symmetric with respect to a joint variable vector, $\mathbf{q}$ if \begin{equation} \frac{\partial K}{\partial {q}_i}=0. \end{equation} \end{definition} The kinetic symmetry leads to symmetry in mechanics in the absence of a potential field, i.e. $V(\mathbf{q})=0$, which in turn corresponds to the conservation of the momentum of an unforced system. Note that the two-link manipulator robot is kinetic symmetric with respect to the first joint angle $\theta_1$, thereby resulting in an inertia matrix independent of $\theta_1$. This independent variable is often called an \emph{external variable or cyclic~\cite{Ref:Block}}. A dependent variable ($\theta_2$) of a two-link manipulator is called a \emph{shape variable}. Reduction theory for controlled Lagrangian and controlled Hamiltonian systems with symmetry is an active area of research~\cite{Ref:Chang}. For example, a nonlinear control design using a control Lagrangian makes extensive use of the conservation law derived by symmetry. In another example, Olfati-Saber~\cite{Ref:Oli_Saber} developed cascade normal forms for underactuated mechanical systems, based upon the mechanical symmetry introduced in this section. \subsection{Legendre Transformation and Hamiltonian}\label{sec:hamilton} The generalized momentum $\mathbf{p}$ is defined as \begin{equation}\label{Legendre} \mathbf{p}=\frac{\partial L}{\partial \mathbf{\dot{q}}}=\mathbf{M}(\mathbf{q})\mathbf{\dot{q}} \end{equation} This coordinate transformation is referred to as the Legendre transformation~\cite{Ref:Oli_Saber,Ref:Block}. We can re-write (\ref{NL_single_compact_ch2}) using the Legendre transformation in (\ref{Legendre}): \begin{equation}\label{canonicalform} \begin{split} \mathbf{\dot{q}}=\mathbf{M}^{-1}(\mathbf{q})\mathbf{p} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \\ \mathbf{\dot{p}}=\mathbf{C}\left(\mathbf{q},\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}\right)^{T}\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}-\mathbf{g}(\mathbf{q})+\mathbf{F} \end{split} \end{equation} where we used $\mathbf{\dot{M}}=\mathbf{C}+\mathbf{C}^{T}$ from the skew-symmetric property of $\mathbf{\dot{M}}-2\mathbf{C}$. The second-order differential equation in (\ref{NL_single_compact_ch2}) is now in the first-order differential form, which has an advantage in contraction analysis, as shall be seen in the subsequent sections. We can easily verify that (\ref{canonicalform}) corresponds to Hamilton's equations by introducing the Hamiltonian, $H(\mathbf{q},\mathbf{p})$: \begin{equation} \begin{split} H(\mathbf{q},\mathbf{p})=\mathbf{\dot{q}}^{T}\mathbf{p}- L(\mathbf{q},\mathbf{\dot{q}})=\frac{1}{2}{\mathbf{{p}}}^{T}\mathbf{M}^{-1}(\mathbf{q})\mathbf{{p}}+V(\mathbf{q})\\ \mathbf{\dot{q}}=\frac{\partial H(\mathbf{q},\mathbf{p})}{\partial \mathbf{p}}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \\ \mathbf{\dot{p}}=-\frac{\partial H(\mathbf{q},\mathbf{p})}{\partial \mathbf{q}}+\mathbf{F} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \end{split} \end{equation} Since the kinetic energy, $K$ can be written as \begin{equation} K=\frac{1}{2}{\mathbf{\dot{q}}}^{T}\mathbf{M}(\mathbf{q})\mathbf{\dot{q}}=\frac{1}{2}{\mathbf{{p}}}^{T}\mathbf{M}^{-1}(\mathbf{q})\mathbf{{p}}, \end{equation} the Hamiltonian represents the total energy of the system, i.e. $H=K+V$, as opposed to the Lagrangian, $L=K-V$. We will often encounter the closed loop dynamics of the following form: \begin{equation}\label{NL_hamiltonian} \mathbf{M}(\mathbf{q})\mathbf{\dot{s}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{s}+\mathbf{K}\mathbf{s} =\mathbf{u}(t) \end{equation} where $\mathbf{s}(t)$ is the composite variable~\cite{Ref:Slotine}, often introduced in the sliding control literature such that \begin{equation}\label{composite_variable} \mathbf{s}= \mathbf{\dot{q}}-\mathbf{\dot{q}}_d+\mathbf{\Lambda}(\mathbf{{q}}-\mathbf{{q}}_d) \end{equation} where $\mathbf{q}_d$ represents the desired reference trajectory. For the system in (\ref{NL_hamiltonian}), we can employ the following transformation by redefining $\mathbf{p}$: \begin{equation} \mathbf{p}=\mathbf{M}(\mathbf{q})\mathbf{s} \end{equation} Hence, (\ref{NL_hamiltonian}) reduces to the following first-order canonical form: \begin{equation}\label{canonicalform_s} \begin{split} \mathbf{\dot{q}}=-\mathbf{\Lambda}\mathbf{q}+\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}+ \left(\mathbf{\dot{q}}_d+\mathbf{\Lambda}{\mathbf{q}}_d\right)\ \ \ \ \ \ \ \ \ \ \ \ \ \\ \mathbf{\dot{p}}=\Bigl[\mathbf{C}\left(\mathbf{q},\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}\right)^{T}-\mathbf{K}\Bigr]\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}+\mathbf{u}(t) \end{split} \end{equation} A nice thing about the equations, (\ref{canonicalform}) and (\ref{canonicalform_s}), is that the external control input vector, $\mathbf{F}$ is intact via the transformation, thereby facilitating the control design and controllability analysis. \subsection{Zero Riemannian Curvature and Flat Mechanical Systems} If the inertia matrix, $\mathbf{M}(\mathbf{q})$ can be factored as $\mathbf{N}(\mathbf{q})^T\mathbf{N}(\mathbf{q})$, we can derive a transformation that significantly simplifies the robot dynamics. Such a transformation is called a linearizing point transformation~\cite{Ref:Bedrossian} and all point transformations are also canonical transformations~\cite{Ref:Riemann}. In the absence of the potential term $V$ (or canceled by a feedforward term), suppose the inertia matrix $\mathbf{M}(\mathbf{q})$ can be factored into \begin{equation}\label{decomposition} \mathbf{M}(\mathbf{q})=\mathbf{N}^T(\mathbf{q})\mathbf{N}(\mathbf{q}) \end{equation} where $\mathbf{N}(\mathbf{q})$ is integrable. Also consider a canonical transformation by $Q(\mathbf{p},\mathbf{q})$ and $P(\mathbf{p},\mathbf{q})$ by which a system preserves the Hamiltonian structure of the system in (\ref{canonicalform}). \begin{align} dQ&=\frac{\partial Q}{\partial\mathbf{q}}d\mathbf{q}=\mathbf{N}(\mathbf{q})d\mathbf{q}\\ P&=\mathbf{N}(\mathbf{q})\mathbf{\dot q} \end{align} This transformation yields the following Hamiltonian \begin{equation} H=\frac{1}{2}{\mathbf{\dot{q}}}^{T}\mathbf{M}(\mathbf{q})\mathbf{\dot{q}}=\frac{1}{2}{\mathbf{\dot{q}}}^{T}\mathbf{N}^T(\mathbf{q})\mathbf{N}(\mathbf{q})\mathbf{\dot{q}}=\frac{1}{2}P^TP \end{equation} which is independent of $Q$. This simplification leads to the following double integrator system \begin{equation} \begin{split} \dot Q=P \ \ \ \ \ \ \ \ \ \ \\ P={\mathbf{N}(\mathbf{q})}^{-T}\mathbf{F} \end{split} \end{equation} This significantly simplifies the computation of a controller compared to the original feedback linearization (computed torque) control law since it only requires a computation of $\mathbf{N}(\mathbf{q})$. Then, a natural question arises as to the existence of such a decomposition in (\ref{decomposition}). It turns out that there is a sufficient and necessary condition to the existence which relates a Riemannian manifold with a Euclidean manifold. \begin{definition}[Locally Flat Manifold] A linearizing point transformation exists if and only if all elements of the Riemann curvature tensor, $R_{ijkl}$ are identically zero. (See \cite{Ref:Riemann} and \cite{Ref:Bedrossian} for the exact definition of $R_{ijkl}$). Such a Riemannian manifold is called a ``locally flat'' manifold. \end{definition} One trivial example of a ``zero Riemann curvature tensor'' is a system with a constant inertia matrix, thereby eliminating the Christoffel symbols in (\ref{Christopher}) automatically. This in turn makes $\mathbf{C}(\mathbf{q},\mathbf{\dot q})$ vanish as well. \subsection{Nonholonomic Systems and Underactuated Dynamics} Consider a mechanical system of $\mathbf{q}\in \mathbb{R}^n$, subject to the following $p$ constraint equations, linear in the velocity field: \begin{equation}\label{const_eqn} \sum^{n}_{k=1}a^j_k(q_i)\dot{q}_k=0,\ \ \ j=1,\dots,p. \ \ \ \text{Equivalently,}\ \mathbf{A}(\mathbf{q})\mathbf{\dot{q}}=\mathbf{0} \end{equation} where $\mathbf{A}(\mathbf{q})\in \mathbb{R}^{p\times n}$ and $p<n$. \begin{definition}[Nonholonomic Constraints] The constraints in (\ref{const_eqn}) are \textbf{\emph{holonomic}} or \textbf{\emph{integrable}} if there is a real-valued vector function $\mathbf{h}(\mathbf{q})\in\mathbb{R}^p$ such that the constraint can be written as $\mathbf{h}(\mathbf{q})=$constant, or in differentiated form, ($\frac{\partial h_i}{\partial q_i}\dot{q}_i=0$). Thus the configuration of the system is actually constrained to be on a submanifold of the configuration manifold. We can then write Lagrange's equations using coordinates on this submanifold and thus get a system of equations with fewer variables. If no such function $\mathbf{h}$ exists, the constraints are said to be \emph{\textbf{nonintegrable}} or \emph{\textbf{nonholonomic}}. \end{definition} For example, the length constraint on a pendulum is a holonomic constraint. On the other hand, a constraint of rolling without slipping is nonholonomic. In addition, constraints that are independent of time are called \emph{\textbf{scleronomic}}, whereas \textbf{\emph{rheonomic}} indicates constraints depending on time. Using the Lagrange-d'Alembert principle given in (\ref{Dalembert}) together with the nonholonomic velocity constraints of the form in (\ref{const_eqn}), we can derive the following equations of motion: \begin{equation}\label{const_euler_eqn} \begin{split} \mathbf{M}(\mathbf{q})\mathbf{\ddot{q}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}}+\mathbf{g}(\mathbf{q}) =\mathbf{A}(\mathbf{q})^T\mathbf{\lambda}+\mathbf{F}\\ \mathbf{A}(\mathbf{q})\mathbf{\dot{q}}=\mathbf{0} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \end{split} \end{equation} where $\mathbf{\lambda}\in\mathbb{R}^p$ is a vector of Lagrange multipliers. Notice that we now have $2n$ first-order differential equations and $m$ constraint equations for $2n+m$ variables ($\mathbf{q},\mathbf{\dot{q}},\mathbf{\lambda}$). The above constraints are first-order nonholonomic constraints. We also encounter the second-order nonholonomic constraints arising from underactuated control inputs. \begin{definition}[Underactuated Mechanical Systems] A Lagrangian system in (\ref{NL_single_compact_ch2}), which has a fewer number of inputs ($\mathbf{F}\in\mathbb{R}^m$) than the number of degrees-of-freedom, $n$ ($\mathbf{q}\in\mathbb{R}^n$) such that $m<n$, is called an \emph{\textbf{Underactuated}} Lagrangian system. \end{definition} Hence, we can derive a second-order nonholonomic constraint from the unactuated coordinates. For example, if the first coordinate variable $q_1$ out of $\mathbf{q}=\begin{pmatrix}q_1& q_2& \cdots & q_n\end{pmatrix}^T$ is not actuated, the following acceleration constraint equation is obtained: \begin{equation} m_{11}(\mathbf{q})\ddot{q}_1+m_{12}(\mathbf{q})\ddot{q}_2+\dots +m_{1n}(\mathbf{q})\ddot{q}_n+h_1(\mathbf{q},\mathbf{\dot q})=0, \end{equation} which is not integrable. Control of underactuated mechanical systems is an active area of research. \section{Nonlinear Stability Analysis: Lyapunov-based Methods} \subsection{Extension of Lyapunov Function to Nonautonomous Systems} Consider a smooth nonlinear time-varying system \begin{equation}\label{xfx_ch2_L} {\mathbf{\dot x}}(t)=\mathbf{f}(\mathbf{x}(t),t) \end{equation} where $\mathbf{x}(t)\in\mathbb{R}^n$, and $\mathbf{f}: \mathbb{R}^n\times\mathbb{R}_{+}\rightarrow\mathbb{R}^n$ The Lyapunov's direct method in Theorem \ref{Thm:LyapDir} still holds for a nonautonomous system in (\ref{xfx_ch2_L}). In particular, \textbf{uniform} (asymptotic) stability is achieved under the additional condition that $V$ is \emph{decrescent} (i.e., $\exists$ $V_1(\mathbf{x})>0$, $V(\mathbf{x},t)\geq V_0(\mathbf{x})$, s.t. $V(\mathbf{x},t)\leq V_1(\mathbf{x})$). This condition means that $V(x,t)$ is upper-bounded and lower-bounded by time-invariant positive definite functions $V_0$ and $V_1$. To summarize, we can use Theorem~\ref{MainUniform}. \begin{theorem}[Uniform (Asymptotic or Exponential) Stability]\label{MainUniform} Let $\mathbf{x}=0$ be an equilibrium point of (\ref{xfx_ch2_L}) and $\mathbf{B}_r=:\|\mathbf{x}\|<r$. Let $V$ : $\mathbf{B}_r \times \mathbb{R}_{+}\rightarrow\mathbb{R}_{+}$ be a continuously differentiable function such that $\forall t\geq 0, \ \ \forall \mathbf{x}\in \mathbf{B}_r$ \begin{equation} \dot V=\frac{\partial V}{\partial t}+\frac{\partial V}{\partial \mathbf{x}}\mathbf{f}(\mathbf{x},t)\leq -\gamma_3(\|\mathbf{x}\|) \end{equation} \begin{equation} \gamma_1(\|\mathbf{x}\|)\leq V(\mathbf{x},t)\leq \gamma_2(\|\mathbf{x}\|) \end{equation} Then, the equilibrium point $\mathbf{x}=\mathbf{0}$ is \begin{itemize} \item uniformly stable, if $\gamma_1$ and $\gamma_2$ are class $\mathcal{K}$ functions on $[0,r)$ and $\gamma_3(\cdot)\geq0$ on $[0,r)$; \item uniformly asymptotically stable, if $\gamma_1$, $\gamma_2$, and $\gamma_3$ are class $\mathcal{K}$ functions on $[0,r)$; \item exponentially stabile, if $\gamma_i(\rho)=k_i\rho^\alpha$ on $[0,r)$, $k_i>0, \alpha>0$, $i=1,2,3$; \item globally uniformly stable if $\mathbf{B}_r=\mathbb{R}^n$ and $\gamma_1$ and $\gamma_2$ are class $\mathcal{K}_\infty$ functions, and $\gamma_3(\cdot)\geq0$ on $\mathbb{R}_{+}$; \item globally uniformly asymptotically stable if $\mathbf{B}_r=\mathbb{R}^n$ and $\gamma_1$ and $\gamma_2$ are class $\mathcal{K}_\infty$ functions, and $\gamma_3(\cdot)$ is a class $\mathcal{K}$ function on $\mathbb{R}_{+}$; \item globally exponentially stable, if $\mathbf{B}_r=\mathbb{R}^n$ and $\gamma_i(\rho)=k_i\rho^\alpha$ on $\mathbb{R}_{+}$, $k_i>0, \alpha>0$, $i=1,2,3$. \end{itemize} \end{theorem} The proof is given as follows. \begin{IEEEproof}[Proof of Theorem~\ref{MainUniform}] Since proving the uniform stability (boundednes) of the solution is easily constructed, we present only the proof of uniform asymptotical stability here. By using the inequality, \begin{equation} V\leq \gamma_2(\|\mathbf{x}\|) \Leftrightarrow \gamma_2^{-1}(V)\leq \|\mathbf{x}\| \Leftrightarrow \gamma_3(\gamma_2^{-1}(V))\leq \gamma_3(\|\mathbf{x}\|) \end{equation} we have that \begin{equation} \dot{V}\leq -\gamma_3(\gamma_2^{-1}(V)) \end{equation} Since $\gamma_3(\gamma_2^{-1}(\cdot))$ is a class $\mathcal{K}$ function, $V$ has a unique solution defined as $V(t,\mathbf{x})\leq \sigma(V(t_0,\mathbf{x_0}),t-t_0)$ and $\sigma(\cdot,\cdot)$ is a class $\mathcal{KL}$ function. Hence, we can verify \begin{align} \|\mathbf{x}(t)\|\leq& \gamma_1^{-1}(V(t))\leq \gamma_1^{-1}(\sigma(V(t_0,\mathbf{x}_0),t-t_0)) \nonumber \\ \leq& \gamma_1^{-1}(\sigma(\gamma_2(\|\mathbf{x}_0\|),t-t_0)) \end{align} where the last term can be defined as a class $\mathcal{KL}$ function $\beta(\|\mathbf{x}_0\|,t-t_0)=\gamma_1^{-1}(\sigma(\gamma_2(\|\mathbf{x}_0\|),t-t_0))$. If all the conditions above hold on $\mathbb{R}^n$ and the radially unboundedness of $V$ is satisfied by class $\mathcal{K}_\infty$ functions, then the convergence result is global.\end{IEEEproof} In order to weaken the inequality requirement for asymptotic stability, Barbalat's lemma is introduced. One can be reminded that LaSalle's invariant set theorem is only applicable to autonomous systems, not nonautonomous systems. \begin{theorem}[Barbalat's Lemma]\label{Thm:Barbalat} If the differentiable function, $V(t)$ tends to a finite limit as $t\rightarrow\infty$, and if $\dot V (t)$ is uniformly continuous, then \begin{equation} \lim_{t\rightarrow \infty}\dot V (t)=0 \end{equation} Note that the uniform continuity of $\dot V (t)$ is sufficiently met if $\ddot{V}(t)$ exists and is bounded. \end{theorem} The Lyapunov theorem along with Barbalat's lemma leads to the following powerful theorem: \begin{theorem}[LaSalle-Yoshizawa Lemma] Let $\mathbf{x}=0$ be an equilibrium point of (\ref{xfx_ch2_L}) and suppose $\mathbf{f}$ is locally Lipschitz in $\mathbf{x}$ uniformly in $t$. Let $V$ : $\mathbb{R}^n \times \mathbb{R}_{+}\rightarrow\mathbb{R}_{+}$ be a continuously differentiable function such that \begin{equation} \dot V=\frac{\partial V}{\partial t}+\frac{\partial V}{\partial \mathbf{x}}\mathbf{f}(\mathbf{x},t)\leq -W(\mathbf{x})\leq 0 \end{equation} \begin{equation} \gamma_1(\|\mathbf{x}\|)\leq V(\mathbf{x},t)\leq \gamma_2(\|\mathbf{x}\|) \end{equation} $\forall t \geq0$, $\forall \mathbf{x}\in \mathbb{R}^n$, where $\gamma_1$ and $\gamma_2$ are class $\mathcal{K}_\infty$ functions and $W$ is a continuous function. Then, all solutions of (\ref{xfx_ch2_L}) are globally uniformly bounded and satisfy \begin{equation} \lim_{t\rightarrow\infty}W(\mathbf{x}(t))=0 \end{equation} In addition, if $W(\mathbf{x})$ is positive definite, then the equilibrium $\mathbf{x}=0$ is globally uniformly asymptotically stable. \end{theorem} Often times, the asymptotic convergence of $W(\mathbf{x}(t))$ and $\dot V$ to zero is sufficient to prove the convergence of tracking errors even though the system per se might not be asymptotically stable. \subsection{Exponential Stability (Preview on Contraction Analysis)} In linear systems, asymptotic stability automatically means global exponential convergence. For a time-varying nonlinear system such as (\ref{xfx_ch2_L}), some additional conditions are required. We can derive the following corollary from Theorem~\ref{MainUniform}. \begin{theorem}[Exponential Stability and Its Converse Theorem]\label{Thm:exponential} Let $\mathbf{x}=0$ be an equilibrium point of (\ref{xfx_ch2_L}) and suppose $\mathbf{f}$ is locally Lipschitz in $\mathbf{x}$ uniformly in $t$. Let $V$ : $\mathbb{R}^n \times \mathbb{R}_{+}\rightarrow\mathbb{R}_{+}$ be a continuously differentiable function such that \begin{equation}\label{Exp1} c_1\|\mathbf{x}\|^\alpha\leq V(\mathbf{x},t)\leq c_2\|\mathbf{x}\|^\alpha \end{equation} \begin{equation}\label{Exp2} \dot V=\frac{\partial V}{\partial t}+\frac{\partial V}{\partial \mathbf{x}}\mathbf{f}(\mathbf{x},t)\leq -c_3\|\mathbf{x}\|^\alpha \end{equation} where $c_1$, $c_2$, and $c_3$ are strictly positive and $\forall t \geq0$. Then, the equilibrium $\mathbf{x}=0$ is exponentially stable. If the above conditions hold globally, then it is globally exponentially stable. The popular choice of $\alpha=2$.\\ Conversely, let us assume that $\mathbf{x}=0$ is exponentially stable of the system $\mathbf{\dot{x}}=\mathbf{f}(\mathbf{x},t)$, then the converse theorem indicates there is a Lyapunov function satisfying (\ref{Exp1}-\ref{Exp2}) the in the appropriate domain (local or global) with $\alpha=2$. Furthermore,$\|\frac{\partial V}{\partial \mathbf{x}}\|\leq c_4\|\mathbf{x}\|$, $c_4>0$. This last condition is useful to analyze the stability of a perturbed system (to be discussed later in detail). \end{theorem} \begin{IEEEproof} We can find $\dot{V}\leq -c_3/c_2 V$ by using $-\|x\|^\alpha\leq -V/c_2$. The comparison lemma says $\dot{V}\leq h(t,V)$ implies $V(t,x(t))\leq y(t)$ while $\dot{y}=h(t,y)$ and $y(t_0)=V(t_0,x(t_0)$. Hence, by the comparison lemma \begin{equation} V(t,\mathbf{x}(t))\leq V(t_0,\mathbf{x}(t_0))e^{-c_3/c_2(t-t_0)}\end{equation} \begin{align} \|\mathbf{x}(t)\|\leq (V/c_1)^{1/\alpha}&\leq (V(t_0)e^{-c_3/c_2(t-t_0)}/c_1)^{1/\alpha}\\ &\leq(c_2/c_1)^{1/\alpha}\|\mathbf{x}(t_0)\|e^{-c_3/(c_2\alpha)(t-t_0)}\nonumber \end{align} \end{IEEEproof} \begin{remark} Exponential convergence offers numerous advantages. For instance, it provides a stronger form of stability, resulting in more efficient performance than the asymptotic convergence of PD control, particularly for tracking demanding trajectories. In addition, exponential stability is robust with respect to a class of perturbations (read Chapter 9 of Khalil~\cite{Khalil:2002}).\end{remark} In the next section, we introduce contraction theory, which can be efficiently used to prove global exponential \emph{incremental} stability of nonlinear systems. \section{Nonlinear Stability and Control Design using Contraction Analysis} \label{sec:ContractionCH2} \begin{itemize} \item Contraction theory provides a systematic method to build arbitrarily complex systems out of simpler elements. \item We also exploit contraction and partial contraction theory~\cite{Ref:contraction3} to prove the stability of multiple coupled nonlinear dynamics. \item Lyapunov's linearization method indicates that the local stability of the nonlinear system can be analyzed using its differential approximation. \item What is new in contraction theory is that a differential stability analysis can be made exact, thereby yielding \textbf{global and exponential convergence} results in nonlinear systems. \end{itemize} A brief review of the results from \cite{Ref:contraction1,Ref:contraction2,Ref:contraction3} along with my own interpretation is presented in this section. Readers are referred to these references for detailed descriptions and proofs on the following theorems. Note that contraction theory is a generalization of the classical Krasovskii's theorem~\cite{Ref:Slotine}, and that approaches closely related to contraction, although not based on differential analysis, can be traced back to \cite{Hart,Demi} and even to~\cite{Lew}. A recent work~\cite{Rantzer} also independently derived a similar result on the use of the monotonicity of singulary weighted volumes. \begin{theorem}[Sufficient Condition for LTV Stability (cf. contraction analysis)] The linear time-varying system (LTV) $\bf{\dot{x}}=\bf{A}(t)\bf{x}$ is globally exponentially stable ($\bf{x}$ tends to $\bf{0}$ exponentially) if $\exists$ $\beta>0$, $\forall i$, $\forall $ $t\geq 0$, $\lambda_i(\bf{A}(t)+\bf{A}(t)^T)\leq -\beta$. \end{theorem} \begin{IEEEproof} Take $V=\bf{x}^T\bf{x}$ and compute $\dot{V}$.\end{IEEEproof} \begin{theorem}[Krasovskii's Theorem (cf. contraction analysis)] Let $\bf{A}(\bf{x})$ denote the Jacobian of $\bf{f}(\bf{x})$ of the autonomous system $\bf{\dot{x}}=\bf{f}(\bf{x})$. If the matrix $\bf{F}=\bf{A}+\bf{A}^T$ is negative on $\bf{B}_r$, the equilibrium point is asymptotically stable. \end{theorem} \begin{IEEEproof} Use $V(\bf{x})=\bf{f}^T\bf{f}$. \end{IEEEproof} Before we move onto the details, the key advantages of contraction analysis are summarized as below. \begin{itemize} \item Contraction theory is a differential-based \textbf{incremental stability analysis} of multiple trajectories (as opposed to stability of an equilibrium point). Differential-based analysis is easier for analyzing stability of a networked or combined system (e.g., hierarchical, feedback, or serial combinations). In contrast, passivity-based analysis cannot be applied to a hierarchically-combined system. \item Contraction theory is more generalized. For instance, all examples and theorems in \cite{Rantzer} are for autonomous systems whereas contraction theory can be easily applied to general time-varying systems including systems with time-varying desired trajectories. \item Convergence of contraction theory is stronger: exponential and global. Asymptotic convergence of a PD controller is not enough for tracking demanding time-varying reference inputs of nonlinear systems. \item The proof is intuitive and much simpler. This truly sets contraction analysis aside from other methodologies. For example, one can recall the proof of global and time-varying version of Krasovskii's theorem. \item Contraction theory also permits a non-constant metric and a pure differential coordinate change, which is not explicit in \cite{Rantzer}. This generalization of the metric (generalized Jacobian, not just $\frac{df}{dx}$) is one of the differences with other methodologies.\end{itemize} \subsection{Fundamentals} Suppose that one can construct a virtual volume out of the given dynamics. Rather than finding a decreasing scalar function by the Lyapunov method, a contracting volume indicates the system is contracting. How can we quantify the contraction rate of the virtual volume constructed from the dynamical system? By computing contraction of two neighboring trajectories in the flow field. Consider a smooth nonlinear system \begin{equation}\label{xfx_ch2} {\mathbf{\dot x}}(t)=\mathbf{f}(\mathbf{x}(t),\mathbf{u}(\mathbf{x},t),t) \end{equation} where $\mathbf{x}(t)\in\mathbb{R}^n$, and $\mathbf{f}: \mathbb{R}^n\times\mathbb{R}^m\times\mathbb{R}_{+}\rightarrow\mathbb{R}^n$. \begin{definition}[Virtual Displacement $\delta \mathbf{x}$]A virtual displacement, $\delta\mathbf{x}$ is defined as an infinitesimal displacement at a fixed time-- a common supposition in the \textbf{calculus of variations}.\end{definition} \begin{figure} \centering \includegraphics[width=85mm]{figures/contraction_illustration.PNG} \caption{Contraction analysis} \end{figure} \begin{theorem}[1st Main Theorem of Contraction Analysis]\label{Thm:contraction} For the system in (\ref{xfx_ch2}), if there exists a uniformly positive definite metric, \begin{equation}\label{metric} \mathbf{M}(\mathbf{x},t)={\mathbf{\Theta}}(\mathbf{x},t)^{T}{\mathbf{\Theta}}(\mathbf{x},t) \end{equation} where $\mathbf{\Theta}$ is some smooth coordinate transformation of the virtual displacement, $\delta\mathbf{z}={\mathbf{\Theta}}\delta\mathbf{x}$, such that the associated generalized Jacobian $\bf F$ is uniformly negative definite, i.e., $\exists \lambda >0$ such that \begin{equation}\label{jacobian_ch2} \mathbf{F}=\left(\mathbf{\dot{\Theta}}{(\mathbf{x},t)}+{\mathbf{\Theta}(\mathbf{x},t)}\frac{\partial \mathbf{f}}{\partial \mathbf{x}}\right){\mathbf{\Theta}(\mathbf{x},t)}^{-1} \le - \lambda {\bf I}, \end{equation} then all system trajectories converge globally to a single trajectory exponentially fast regardless of the initial conditions, with a global exponential convergence rate of the largest eigenvalues of the symmetric part of $\mathbf{F}$. \end{theorem} \begin{definition}[Contracting $\triangleq$ Global Exponential Stability of Solution Trajectories] Such a system satisfying the conditions in Theorem~\ref{Thm:contraction} is said to be contracting.\end{definition} A sketch of the proof~\cite{Ref:contraction1} is given here. \begin{IEEEproof} The dynamics of $\delta\mathbf{z}={\mathbf{\Theta}}\delta\mathbf{x}$ are computed as \begin{equation} \frac{d}{dt}\delta\mathbf{z}={\mathbf{\dot \Theta}}\delta\mathbf{x}+{\mathbf{\Theta}}\delta\mathbf{\dot x}=\mathbf{F}\delta\mathbf{z} \end{equation} Hence, the rate of change of squared length, which quantifies the contraction rate of the volume, is represented as \begin{equation} \frac{d}{dt}(\delta \mathbf{z}^T\delta \mathbf{z})=2\delta \mathbf{z}^T\frac{d}{dt}\delta\mathbf{z}=2\delta \mathbf{z}^T\mathbf{F}\delta\mathbf{z}\leq -\lambda \mathbf{z}^T\mathbf{z} \end{equation} Equivalently, we can write \begin{equation} \frac{d}{dt}\|\delta \mathbf{z}\|\leq -\lambda\|\delta \mathbf{z}\| \end{equation} By the comparison lemma (Lemma~\ref{ComparisonLemma}), we can find $\|\delta \mathbf{z}(t)\|\leq \|\delta \mathbf{z}_0\|e^{-\lambda t}$. Hence, any infinitesimal length $\|\delta \mathbf{z}(t)\|$ and $\|\delta \mathbf{x}(t)\|$ tend to zero exponentially fast. By path integration, this immediately implies that the length of any finite path converges to exponentially to zero from any initial conditions. Here we use $\|\cdot\|=\|\cdot\|_2$. \end{IEEEproof} \begin{lemma}[Comparison Lemma~\cite{Khalil:2002}]\label{ComparisonLemma} Consider $\dot{x}=f(x,t)$, $x(t_0)=x_0$, where $f(x,t)$ is continuous in $t$ and locally Lipschitz in $x$, for $\forall t\geq0$ and $x\in J \subset \mathbb{R}$. Let $[t_0,T)$ where $T$ can be $\infty$, denote the maximal interval of existence of the solution $x(t)\in J$. Let $v(t)$ be a continuous function that satisfies $$ D^{+}v(t)\leq f(t,v), \ \ v(t_0)\leq x_0 $$ with $v(t)\in J$ for all $t\in [t_0,T)$. Then, $v(t)\leq x(t),$ $\forall t\in[t_0,T)$. See Khalil~\cite{Khalil:2002} (pages 102-103; pages 350-353) \end{lemma} \begin{remark}No matter where the initial states start in the configuration manifold, they converge to a single trajectory with global and exponential convergence. This convergence result epitomizes the significance of contraction analysis. In the context of fluid dynamics, we can recall Gauss' divergence theorem. Indeed, the divergence of the virtual length vector field, $\text{div}(\frac{d}{dt}\delta\mathbf{z})$ is the trace of $\mathbf{F}$~\cite{Ref:contraction1}.\end{remark} \begin{corollary}[2nd Main Theorem of Contraction Analysis]\label{Metric_analf} Equivalently, the system is contracting if $\exists \lambda >0$ such that \begin{equation}\label{M_length} \mathbf{\dot{M}}+\left(\frac{\partial \mathbf{f}}{\partial \mathbf{x}}\right)^T\mathbf{{M}}+\mathbf{{M}}\frac{\partial \mathbf{f}}{\partial \mathbf{x}} \le - 2 \lambda {\bf M} \end{equation} \end{corollary} \begin{IEEEproof} We can easily find \begin{equation} \frac{d}{dt}\left(\delta\mathbf{x}^T\mathbf{M}\delta\mathbf{x}\right) =\delta\mathbf{x}^T\Bigl(\mathbf{\dot{M}}+(\frac{\partial \mathbf{f}}{\partial \mathbf{x}})^T\mathbf{{M}}+\mathbf{{M}}\frac{\partial \mathbf{f}}{\partial \mathbf{x}}\Bigr)\delta\mathbf{x} \end{equation} Hence, we can conclude that the condition in (\ref{M_length}) leads to exponential convergence of $\delta \mathbf{x}$ to zero. % \end{IEEEproof} The symmetric and positive definite Riemannian metric, from the Lagrangian representation of dynamical systems, facilitates the use of such a metric in contraction analysis. It can also be shown that for a contracting autonomous system, of the form ${\mathbf{\dot x}}=\mathbf{f}(\mathbf{x},\mathbf{u}(\mathbf{x}))$, all trajectories converge to an equilibrium point exponentially fast. In essence, contraction analysis implies that stability of nonlinear systems can be analyzed more simply by checking the negative definiteness of a proper matrix, rather than finding some implicit motion integral as in Lyapunov theory. \begin{example}[Sine function]\label{Example_sine} Consider $\boldsymbol{\dot\theta}=-\mathbf{K}(t)\sin(\boldsymbol\theta)$ on $\boldsymbol{\theta}\in \mathbb{T}^n$, where $\mathbf{K}(t)$ is a diagonal matrix. Following \cite{Ref:contraction1}, consider $\mathbf{\Theta}=\text{diag}\left(\frac{1}{2}\sec^2(\boldsymbol{\theta}/2)\right)$ on $\boldsymbol{\theta}\in(-\pi,\pi)^n$. Then, we can compute the generalized Jacobian $\mathbf{F}=\mathbf{\dot\Theta}\mathbf{\Theta}^{-1} -\mathbf{\Theta} \mathbf{K}\text{diag}(\cos\boldsymbol{\theta})\mathbf{\Theta}^{-1}=-\mathbf{K} $. Hence, for $\mathbf{K}(t)>0$, $\boldsymbol{\theta}$ tends exponentially to zero on $\boldsymbol{\theta}\in(-\pi,\pi)^n$ by Theorem~\ref{Thm:contraction}.\end{example} \begin{remark}[Generalization to Other Norms] Using the same point of view, Theorem~\ref{Thm:contraction} can be applied to other vector norms of $\|\delta \mathbf{z}\|_p$ with $p=1$ or $p=\infty$. \end{remark} \subsection{Path-Length Integral and Robustness Analysis} Contraction analysis takes a different notion of stability: incremental stability of multiple trajectories. Since contraction means \emph{exponential} convergence, a contracting system exhibits a property of superior robustness. \begin{lemma}[Robust contraction analysis]\label{LM:Robust_contraction_original} Let $P_1(t)$ be a solution of the contracting system (\ref{xfx_ch2}) that satisfies Theorem~\ref{Thm:contraction}, globally exponentially tending to a single trajectory at a contraction rate $\lambda$. (\ref{xfx_ch2}) is now perturbed as \begin{equation}\label{Eq:fxt2-1} \dot{\mathbf{x}} = \mathbf{f}(\mathbf{x},t) + \mathbf{d}(\mathbf{x},t) \end{equation} and $P_2(t)$ denotes a trajectory of (\ref{Eq:fxt2-1}). Then, the smallest path integral (i.e., distance) $$R(t)=\int^{P_2}_{P_1} \|\delta \mathbf{z}(t)\|=\int^{P_2}_{P_1} \|\boldsymbol{\Theta}(\mathbf{x},t)\delta \mathbf{x}(t)\|,\ \ \forall t\geq 0$$ exponentially converges to the following error ball~\cite{Ref:contraction1}, with $\mathbf{\Theta}\mathbf{d}\in \mathcal{L}_\infty$ \begin{equation}\label{Eq:Robust_contraction21} \lim_{t\rightarrow \infty}R(t) \leq \sup_{\mathbf{x},t} \|\mathbf{\Theta(\mathbf{x},t)}\mathbf{d}(\mathbf{x},t)\|/\lambda\end{equation} \end{lemma} \begin{IEEEproof} First, consider the distance $R(t)=\int^{P_2}_{P_1} \|\delta \mathbf{z}(t)\|$ between two arbitrary trajectories $P_1$ and $P_2$ of the original unperturbed dynamics $\dot{\mathbf{x}}=\mathbf{f}(\mathbf{x},t)$ (\ref{xfx_ch2}) that is contracting with the metric $\mathbf{M}(x,t)$ with the rate $\lambda$: $$ \dfrac{d\|\delta\mathbf{z}\|}{dt}\leq-\lambda\|\delta\mathbf{z}\| $$ Then, we can verify \begin{align} &\dot{R}=\int^{P_2}_{P_1}\dfrac{d\|\delta\mathbf{z}\|}{dt}\leq-\lambda\int^{P_2}_{P_1}\|\delta\mathbf{z}\|\Rightarrow \dot{R}+\lambda R\leq 0 \nonumber \\ &\Rightarrow R(t)\leq e^{-\lambda t}R(0) \end{align} where the last equivalence is obtained by the Comparison Lemma (Lemma~\ref{ComparisonLemma}). As a result, any path integral $R(t)$ between any two arbitrary trajectories of (\ref{xfx_ch2}) tends to zero exponentially fast at the exponential rate $\lambda$. Note that $P_1-P_2=\int^{P_2}_{P_1} \delta \mathbf{x}$ and $\|P_1-P_2\|=\|\int^{P_2}_{P_1} \delta \mathbf{x}\| \leq \int^{P_2}_{P_1} \|\delta \mathbf{x}\|$ and $\sqrt{\lambda_\mathrm{min}(\mathbf{M})}\|P_1-P_2\|\leq\int^{P_2}_{P_1} \|\delta \mathbf{z}\|$. Now consider the smallest path integral $R(t)=\int^{P_2}_{P_1} \|\delta \mathbf{z}(t)\|=\int^{P_2}_{P_1} \|\boldsymbol{\Theta}(\mathbf{x},t)\delta \mathbf{x}(t)\|$ with $P_2$ being a perturbed solution from (\ref{Eq:fxt2-1}). Since $\delta\dot{\mathbf{z}}=\mathbf{F}\delta\mathbf{z}+\mathbf{\Theta}\delta\mathbf{d}$, \begin{align} &\dfrac{d}{dt}\delta \mathbf{z}^T\delta \mathbf{z}=2\|\delta \mathbf{z}(t)\|\dfrac{d}{dt}\|\delta \mathbf{z}(t)\|=2\delta \mathbf{z}^T(\mathbf{F}\delta \mathbf{z}+\mathbf{\Theta}\delta \mathbf{d})\nonumber\\&\leq-2\lambda \|\delta \mathbf{z}(t)\|^2+2\|\delta \mathbf{z}(t)\|\|\mathbf{\Theta}\delta \mathbf{d}\|\nonumber\\ &\Rightarrow \dfrac{d}{dt}\|\delta \mathbf{z}(t)\|\leq -\lambda \|\delta \mathbf{z}(t)\|+\|\mathbf{\Theta}\delta \mathbf{d}\| \end{align} By applying the path integral between $P_1$ and $P_2$, we can obtain \begin{align} \int^{P_2}_{P_1}\dfrac{d}{dt}\|\delta \mathbf{z}(t)\|&\leq -\lambda \int^{P_2}_{P_1}\|\delta \mathbf{z}(t)\|+\int^{P_2}_{P_1}\|\mathbf{\Theta}\delta \mathbf{d}\|\\ \dot{R}(t)&\leq -\lambda R(t)+ \|\mathbf{\Theta}\mathbf{d}\| \end{align} Then, applying the comparison lemma [Khalil, p.102-103, p.350-353] results in \begin{equation}\label{Eq:Robust_contraction3} R(t) \leq e^{-\lambda t}R(0)+\int^{t}_{0}e^{-\lambda(t-\tau)} \|\mathbf{\Theta}(\mathbf{x},\tau)\mathbf{d}(\mathbf{x},\tau)\| d\tau \end{equation} By taking the supremum of $\|\mathbf{\Theta}\mathbf{d}\|$ out of the integral in~(\ref{Eq:Robust_contraction3}), \begin{align} R(t) &\leq e^{-\lambda t}R(0)+\sup_t{\|\mathbf{\Theta}(\mathbf{x},t)\mathbf{d}(\mathbf{x},t)\|}\int^{t}_{0}e^{-\lambda(t-\tau)} d\tau\nonumber\\ &\leq e^{-\lambda t}R(0)+\sup_t{\|\mathbf{\Theta}(\mathbf{x},t)\mathbf{d}(\mathbf{x},t)\|}\frac{1-e^{-\lambda t}}{\lambda}\nonumber \end{align} which leads to (\ref{Eq:Robust_contraction21}).\end{IEEEproof} \subsection{Input Output Stability: Finite-Gain $\mathcal{L}_p$ Stability} This section is based on \cite{Ref:phasesync}. Before stating the next lemma, we define the $\mathcal{L}_p$ norm in the extended space $\mathcal{L}_{pe}$, $p\in [1,\infty]$ as follows \begin{align} &\|(\mathbf{u})_\tau\|_{\mathcal{L}_p}=\left(\int^{\tau}_{0}\|\mathbf{u}(t)\|^p dt\right)^{1/p} <\infty , \ \ p\in[1,\infty) \nonumber\\ &\|(\mathbf{u})_\tau\|_{\mathcal{L}_\infty}=\sup_{t\geq 0}\|(\mathbf{u}(t))_\tau\|<\infty \end{align} where $(\mathbf{u}(t))_\tau$ is a truncation of $\mathbf{u}(t)$, i.e., $(\mathbf{u}(t))_\tau=\mathbf{0}$ for $t\geq \tau$, $\tau\in[0,\infty)$ while $(\mathbf{u}(t))_\tau=\mathbf{u}(t)$ for $0\leq t\leq \tau$. Except for $\mathcal{L}_p$ norms, the symbol $p$ in this paper denotes the total number of EL systems in the network. \begin{lemma}[Robust contraction and link to $\mathcal{L}_p$ stability \& Input-to-State Stability]\label{LM:Robust_contraction} Let $P_1(t)$ be a solution of the contracting system (\ref{xfx_ch2}), globally exponentially tending to a single trajectory at a contraction rate $\lambda$. Equation (\ref{xfx_ch2}) is now perturbed as \begin{equation}\label{Eq:fxt2} \dot{\mathbf{x}} = \mathbf{f}(\mathbf{x},t) + \mathbf{d}(\mathbf{x},t) \end{equation} and $P_2(t)$ denotes a trajectory of (\ref{Eq:fxt2}). Then, the smallest path integral (i.e., distance) $R(t)=\int^{P_2}_{P_1} \|\delta \mathbf{z}(t)\|=\int^{P_2}_{P_1} \|\boldsymbol{\Theta}(\mathbf{x},t)\delta \mathbf{x}(t)\|$, $\forall t\geq 0$ exponentially converges to the following error ball~\cite{Ref:contraction1}, with $\mathbf{\Theta}\mathbf{d}\in \mathcal{L}_\infty$ \begin{equation}\label{Eq:Robust_contraction2} \lim_{t\rightarrow \infty}R(t) \leq \sup_{\mathbf{x},t} \|\mathbf{\Theta(\mathbf{x},t)}\mathbf{d}(\mathbf{x},t)\|/\lambda\end{equation} Furthermore, (\ref{Eq:fxt2}), which is perturbed by $\mathbf{d}(\mathbf{x},t)\in \mathcal{L}_{pe}$, is finite-gain $\mathcal{L}_p$ stable with $p\in [1,\infty]$ for an output function $\mathbf{y}=\mathbf{h}(\mathbf{x},\mathbf{d},t)$ with $\int^{Y_2}_{Y_1}\|\delta \mathbf{y}\|\leq \eta_1 \int^{P_2}_{P_1}\|\delta \mathbf{x}\|+\eta_2\|\mathbf{d}\|$, $\exists $ $\eta_1,\eta_2\geq0$, since \begin{align}\label{Eq:Robust_contractionLp} \left\|{\left(\int^{Y_2}_{Y_1} \|\delta \mathbf{y}\|\right)_\tau}\right\|_{\mathcal{L}_p} \leq& (\frac{\eta_1}{\lambda}+{\eta_2})\frac{\|(\mathbf{\Theta}\mathbf{d})_\tau \|_{\mathcal{L}_p}}{\sqrt{\lambda_\mathrm{min}(\mathbf{M})}}, \nonumber \\ &+\frac{\eta_1\zeta R(0)}{\sqrt{\lambda_\mathrm{min}(\mathbf{M})}}, \ \forall \tau\in[0,\infty) \end{align} where $Y_1$ and $Y_2$ denote the output trajectories of the original contracting system (\ref{xfx_ch2}) and its perturbed system (\ref{Eq:fxt2}), respectively. Also, $\zeta=1$ if $p=\infty$ or $\zeta=1/(\lambda p)^{1/p}$ if $p\in[1,\infty)$, and $\lambda_\mathrm{min}(\mathbf{M})$ is defined as $\mathbf{M}(\mathbf{x},t)\geq \lambda_\mathrm{min}(\mathbf{M})\mathbf{I}$, $\forall$ $t\geq 0$. The perturbed system (\ref{Eq:fxt2}) is also input-to-state stable (ISS). \end{lemma} \begin{IEEEproof} After differentiating $R(t)=\int^{P_2}_{P_1} \|\delta \mathbf{z}(t)\|$, we can obtain $\dot{R}+\lambda R\leq \|\mathbf{\Theta}\mathbf{d}\|$~\cite{Ref:contraction1}. Then, applying the comparison lemma [Khalil, p.102-103, p.350-353] results in \begin{equation}\label{Eq:Robust_contraction3b} R(t) \leq e^{-\lambda t}R(0)+\int^{t}_{0}e^{-\lambda(t-\tau)} \|\mathbf{\Theta}(\mathbf{x},\tau)\mathbf{d}(\mathbf{x},\tau)\| d\tau \end{equation} By taking the supremum of $\|\mathbf{\Theta}\mathbf{d}\|$ out of the integral in~(\ref{Eq:Robust_contraction3b}), we can derive (\ref{Eq:Robust_contraction2}). In keeping with Corollary 5.1 of [Khalil], (\ref{Eq:Robust_contraction3b}) satisfies \begin{align}\label{Eq:Robust_contractionLp2} \|(R)_\tau\|_{\mathcal{L}_p}&\leq R(0)\|(e^{-\lambda t})_\tau\|_{\mathcal{L}_p} +\|e^{-\lambda t}\|_{\mathcal{L}_1} \|(\mathbf{\Theta}\mathbf{d})_\tau \|_{\mathcal{L}_p} \nonumber \\ &\leq R(0)\zeta +\|(\mathbf{\Theta}\mathbf{d})_\tau \|_{\mathcal{L}_p}/\lambda \end{align} Since $\mathbf{M}\succ 0$ uniformly, $\|\mathbf{\Theta}^{-1}\|\leq 1/\sqrt{\lambda_\mathrm{min}(\mathbf{M})}$. Then, (\ref{Eq:Robust_contractionLp}) is obtained by using both (\ref{Eq:Robust_contractionLp2}) and the known bound of $\|\delta \mathbf{y}\|$, thereby yielding a finite $\mathcal{L}_p$ gain independently of $\tau$. Note that if we can further show that $\mathbf{M}(\mathbf{x},t)$ is uniformly upper-bounded, we can use $\|(\mathbf{\Theta}\mathbf{d})_\tau \|_{\mathcal{L}_p}\leq \alpha \|(\mathbf{d})_\tau \|_{\mathcal{L}_p}$, $\exists \alpha>0$. For ISS, we can compute an ultimate bound of $R(t)$, which is true for $t\geq T$, $\exists$ $T$ instead of $t\rightarrow\infty$ as in (\ref{Eq:Robust_contraction2}), since global exponential stability of an unperturbed system results in input-to-state stability (see Lemma 4.6 of [Khalil]).~~~~$\square$ \begin{lemma}[Robust hierarchical connection]\label{LM:Robust_contraction_hierc} The hierarchically combined system of two contracting dynamics with a generalized Jacobian matrix $\left[\begin{smallmatrix}\mathbf{F}_{11} & \mathbf{0}\\ \mathbf{F}_{21} & \mathbf{F}_{22}\end{smallmatrix}\right]$ is assumed to be subject to a perturbed flow field of $[\mathbf{d}_1;\mathbf{d}_2]$. Then, the path length integral $R_i(t)=\int^{P_2}_{P_1}\|\delta \mathbf{z}_i\|$, $i=1,2$ between the original and perturbed dynamics verifies~\cite{Ref:contraction1} \begin{align}\label{Eq:hierclemma} \dot{R}_1+|\lambda_{max}(\mathbf{F}_{11})|{R}_1&\leq\|\boldsymbol{\Theta}_1\mathbf{d}_1\| \\ \dot{R}_2+|\lambda_{max}(\mathbf{F}_{22})| {R}_2&\leq\|\boldsymbol{\Theta}_2\mathbf{d}_2\|+\int^{P_2}_{P_1}\|\mathbf{F}_{21}\|\|\delta \mathbf{z}_1\|\nonumber \end{align} Hence, the error bounds of $R_1(t)$ and $R_2(t)$ can be obtained similar to (\ref{Eq:Robust_contraction2}) and (\ref{Eq:Robust_contraction3}-\ref{Eq:Robust_contractionLp2}) under the assumption of bounded $\|\mathbf{F}_{21}\|$. Also, similar to (\ref{Eq:Robust_contractionLp}), a hierarchical connection for $\mathcal{L}_p$ stability can be established by using \begin{align}\label{Eq:hierclemma2} \|(R_2)_\tau\|_{\mathcal{L}_p} & \leq R_2(0)\zeta_2 +\frac{\bar{\sigma}(\mathbf{F}_{21})}{\lambda_2}R_1(0)\zeta_1 \\ &\ \ +\frac{\|(\mathbf{\Theta}_2\mathbf{d}_2)_\tau \|_{\mathcal{L}_p}}{\lambda_2}+\frac{\bar{\sigma}(\mathbf{F}_{21})}{\lambda_1\lambda_2}\|(\mathbf{\Theta}_1\mathbf{d}_1)_\tau \|_{\mathcal{L}_p}\nonumber \end{align} where $\lambda_i=|\lambda_{max}(\mathbf{F}_{ii})|$ from (\ref{Eq:hierclemma}) and $\bar{\sigma}(\cdot)$ is the largest singular value for all $t\geq0$. Also, $\zeta_i=1$ if $p=\infty$ or $\zeta_i=1/(\lambda_i p)^{1/p}$ if $p\in[1,\infty)$ for $i=1,2$. By recursion, this result can be extended to an arbitrary number of hierarchically combined groups.\end{lemma} \begin{IEEEproof} The proof follows from obtaining $\|(R_1)_\tau\|_{\mathcal{L}_p}$ from (\ref{Eq:Robust_contractionLp2}) and recursively obtaining $\|(R_2)_\tau\|_{\mathcal{L}_p}$ from the second equation of (\ref{Eq:hierclemma}).~~~~$\square$ \subsection{Contraction Analysis for Stochastic Nonlinear Dynamics} \begin{remark} This subsection is based on~\cite{Ref:Stochastic}: A. P. Dani, S.-J. Chung, and S. Hutchinson, ``Observer Design for Stochastic Nonlinear Systems via Contraction-based Incremental Stability,'' \emph{IEEE Transactions on Automatic Control}, vol. 60, no. 3, March 2015, pp. 700-714. \end{remark} We present the so-called stochastic contraction lemma that uses a state-dependent metric, thereby generalizing the main result presented in \cite{Pham2009}. The squared virtual displacement between two trajectories of (\ref{xfx_ch2}) with a symmetric, uniformly positive definite metric $M\left(x,t\right)\in\mathbb{R}^{n\times n}$ is given by $\delta x^{T}M\left(x,t\right)\delta x$ (cf. Riemannian metric). Its time derivative is given by \begin{align} &\frac{d}{dt}\left(\delta x^{T}M\left(x,t\right)\delta x\right) \\ & =\delta x^{T}\left(\frac{\partial f}{\partial x}^{T}M\left(x,t\right)+\dot{M}\left(x,t\right)+M\left(x,t\right)\frac{\partial f}{\partial x}\right)\delta x. \nonumber \end{align} If the following inequality is satisfied \begin{equation} \frac{\partial f}{\partial x}^{T}M\left(x,t\right)+\dot{M}\left(x,t\right)+M\left(x,t\right)\frac{\partial f}{\partial x}\leq-2\gamma M\left(x,t\right)\:\forall t,\:\forall x\label{eq:contractionRate-2} \end{equation} for a strictly positive constant $\gamma,$ then the system (\ref{xfx_ch2}) is said to be contracting with the rate $\gamma$ and all the system trajectories exponentially converge to a single trajectory irrespective of the initial conditions (hence, globally exponentially stable). Consider a stochastically perturbed system of the nominal system (\ref{xfx_ch2}) represented using an Ito stochastic differential equation \begin{equation} dx=f\left(x,t\right)dt+B\left(x,t\right)dW,\qquad x(0)=x_{0}\label{eq:stochastiSys} \end{equation} and the conditions for existence and uniqueness of a solution to (\ref{eq:stochastiSys}) \begin{align} & \exists L_{1}>0,\,\forall t,\,\forall x_{1},x_{2}\in\mathbb{R}^{n}:\nonumber \\ & \left\Vert f(x_{1},t)\!-\! f(x_{2},t)\right\Vert \!+\!\left\Vert B(x_{1},t)\!-\! B(x_{2},t)\right\Vert _{F}\!\leq\! L_{1}\left\Vert x_{1}\!-\! x_{2}\right\Vert \!,\nonumber \\ & \exists L_{2}>0,\,\forall t,\,\forall x_{1}\in\mathbb{R}^{n}:\nonumber \\ & \;\left\Vert f(x_{1},t)\right\Vert ^{2}+\left\Vert B(x_{1},t)\right\Vert _{F}^{2}\leq L_{2}(1+\left\Vert x_{1}\right\Vert ^{2}) \end{align} where $B:\mathbb{R}^{n}\times\mathbb{R}\rightarrow\mathbb{R}^{n\times d}$ is a matrix-valued function, $W\left(t\right)$ is a $d$-dimensional Wiener process, and $x_{0}$ is a random variable independent of $W$. Consider any two systems with trajectories $a(t)$ and $b(t)$ obtained by the same function $f\left(\cdot\right)$ in (\ref{eq:stochastiSys}) but driven by independent Wiener processes $\bar{W}_{1}$ and $\bar{W}_{2}$ \begin{align} dz & =\left(\begin{array}{c} f\left(a,t\right)\\ f\left(b,t\right) \end{array}\right)dt+\left(\begin{array}{cc} B_{1}\left(a,t\right) & 0\\ 0 & B_{2}\left(b,t\right) \end{array}\right)\left(\begin{array}{c} d\bar{W}_{1}\\ d\bar{W}_{2} \end{array}\right)\nonumber \\ & =f_{s}\left(z,t\right)dt+B_{s}\left(z,t\right)d\bar{W}\label{eq:dx} \end{align} where $z\left(t\right)=(a(t)^{T},b(t)^{T})^{T}\in\mathbb{R}^{2n}.$ The following lemma analyzes stochastic incremental stability of the two trajectories $a\left(t\right)$ and $b\left(t\right)$ with respect to each other in the presence of noise where the system without noise $\dot{x}=f(x,t)$ is contracting in a state-dependent metric $M\left(x\left(\mu,t\right),t\right),$ for $\mu\in\left[0,1\right]$. The trajectories of (\ref{eq:stochastiSys}) are parametrized as $x\left(0,t\right)=a$ and $x\left(1,t\right)=b$, and $B_{1}\left(a,t\right)$ and $B_{2}\left(b,t\right)$ are defined as $B\left(x\left(0,t\right),t\right)=B_{1}\left(a,t\right)$, and $B\left(x\left(1,t\right),t\right)=B_{2}\left(b,t\right)$, respectively. \begin{assumption}$\mathrm{tr}\left(B_{1}\left(a,t\right)^{T}M\left(x\left(a,t\right),t\right)B_{1}\left(a,t\right)\right)\leq C_{1}$,\\ $\mathrm{tr}\left(B_{2}\left(b,t\right)^{T}M\left(x\left(b,t\right),t\right)B_{2}\left(b,t\right)\right)\leq C_{2}$,\\ $\bar{m}_{x}\!=\!\underset{t\geq0,i,j}{\textrm{\ensuremath{\mathrm{sup}}}}\!\left\Vert \left(M_{ij}(x,t)\right)_{x}\right\Vert ,$ and $\bar{m}_{x^{2}}\!=\!\underset{t\geq0,i,j}{\textrm{\ensuremath{\mathrm{sup}}}}\!\left\Vert \partial^{2}\left(M_{ij}(x,t)\right)/\partial x^{2}\right\Vert ,$ where $C_{1},$ $C_{2},$ $\bar{m}_{x}$, and $\bar{m}_{x^{2}}$ are constants.\end{assumption} \begin{assumption}The nominal deterministic system (\ref{xfx_ch2}) is contracting in a metric $M\left(x\left(\mu,t\right),t\right)$ in the sense that (\ref{eq:contractionRate-2}) is satisfied and $M\left(x\left(\mu,t\right),t\right)$ satisfies the bound $\underline{m}\triangleq\underset{t\geq0}{\mbox{\ensuremath{\mathrm{inf}}}}\:\lambda_{\mathrm{min}}M$. The function $f$ and the metric $M$ are the same as in (\ref{xfx_ch2}) and (\ref{eq:contractionRate-2}).\end{assumption} \begin{lemma}[Stochastic Contraction Lemma] If both assumptions are satisfied then the trajectories $a\left(t\right)$ and $b\left(t\right)$ of (\ref{eq:dx}), whose initial conditions, given by a probability distribution $p\left(a_{0},b_{0}\right)$, are independent of $d\bar{W}_{1}$ and $d\bar{W}_{2}$, satisfy the bound \begin{align} & E\left[\left\Vert a\left(t\right)-b\left(t\right)\right\Vert ^{2}\right]\nonumber \\ & \leq\frac{1}{\underline{m}}\Bigg(\frac{C}{2\gamma_{1}}+E\Bigg[V\left(x\left(0\right),\delta x\left(0\right),0\right)\Bigg]e^{-2\gamma_{1}t}\Bigg)\label{eq:BoundSecondMoment} \end{align} where $\exists\varepsilon>0$ such that $\gamma_{1}\triangleq\gamma-\frac{\left(\beta_{1}^{2}+\beta_{2}^{2}\right)}{2\underline{m}}\left(\varepsilon\bar{m}_{x}+\frac{\bar{m}_{x^{2}}}{2}\right)>0$, $\gamma$ is the contraction rate defined in (\ref{eq:contractionRate-2}), $C=C_{1}+C_{2}+\frac{\bar{m}_{x}}{\varepsilon}\left(\beta_{1}^{2}+\beta_{2}^{2}\right),$ $\beta_{1}=\left\Vert B_{1}\right\Vert _{F}$, $\beta_{2}=\left\Vert B_{2}\right\Vert _{F}$, and $\left[\cdot\right]^{+}=\mathrm{max}\left(0,\cdot\right).$\end{lemma} \begin{IEEEproof} Consider the generalized squared length with respect to a Riemannian metric $M\left(x\left(\mu,t\right),t\right)$ defined by $V\left(x,\delta x,t\right)=\intop_{0}^{1}\left(\frac{\partial x}{\partial\mu}\right)^{T}M\left(x\left(\mu,t\right),t\right)\left(\frac{\partial x}{\partial\mu}\right)d\mu$ such that $\underline{m}\left\Vert a-b\right\Vert ^{2}\leq V\left(x,\delta x,t\right)$. See~\cite{Ref:Stochastic} for more details.% \end{IEEEproof} \subsection{Partial Contraction and Synchronization} \begin{theorem}[Partial contraction~\cite{Ref:contraction3}]\label{Thm:partial} Consider a nonlinear system of the form ${\mathbf{ \dot x}}=\mathbf{f}(\mathbf{x},\mathbf{x},t)$ and assume that the auxiliary system ${\mathbf{\dot y}}=\mathbf{f}(\mathbf{y},\mathbf{x},t)$ is contracting with respect to $\mathbf{y}$. If a particular solution of the auxiliary $\mathbf{y}$-system verifies a specific smooth property, then all trajectories of the original x-system verify this property exponentially. The original system is said to be partially contracting. \end{theorem} \begin{IEEEproof} If a particular solution of the auxiliary contracting system of $\mathbf{y}$ given as $\dot{\mathbf{y}}=\mathbf{f}(\mathbf{y},\mathbf{x},t)$, verifies a smooth specific property, then all trajectories of the original $\dot{\mathbf{x}}=\mathbf{f}(\mathbf{x},\mathbf{x},t)$ system verify this property exponentially. $\mathbf{y}=\mathbf{x}$ is another solution of the auxiliary system. Consequently, $\mathbf{x}$ verifies this property exponentially fast. \end{IEEEproof} This partial contraction analysis can be regarded as a further generalization of contraction theory in Theorem~\ref{Thm:contraction}. This theorem is particularly useful to derive synchronization with an input symmetry. \begin{example}[Stability of Sinc function]\label{ExampleSINC} Example~\ref{Example_sine} can be proven by Theorem~\ref{Thm:partial}. We rewrite the system using a \emph{sinc} function as $$\boldsymbol{\dot\theta}=-\mathbf{K}(t)\text{diag}( \text{sinc}(\boldsymbol{\theta}))\boldsymbol{\theta}$$ where $$\text{diag}( \text{sinc}(\boldsymbol{\theta}))=\text{diag}(\sin(\theta_1)/\theta_1,\cdots,\sin(\theta_n)/\theta_n) .$$ We construct an observer-like system such that $$\mathbf{\dot y}=-\mathbf{K}(t) \text{diag}( \text{sinc}(\boldsymbol{\theta}))\mathbf{y},$$ which has two particular solutions $\mathbf{y}=\boldsymbol{\theta}$ and $\mathbf{y}=\mathbf{0}$. The virtual displacement $\delta \mathbf{y}$ has a time-varying contraction rate $$\mathbf{F}=-\mathbf{K}(t) \text{diag}( \text{sinc}(\boldsymbol\theta(t)))$$, which is now independent of $\mathbf{y}$. Notice $\text{diag}( \text{sinc}(\boldsymbol\theta))>0$ on $\boldsymbol{\theta}\in(-\pi,\pi)^n$, Hence, if $\mathbf{K}(t)>0$, we can conclude that two solutions of $\mathbf{y}$ tend exponentially fast to each other, resulting in $\boldsymbol\theta \rightarrow \mathbf{0}$. The present example shows that a stability analysis via partial contraction can be made much simpler than the original contraction analysis.\end{example} \begin{theorem}[Synchronization~\cite{Ref:contraction3}]\label{Thm:sync} Consider two coupled systems. If the dynamics equations satisfy \begin{equation} {\mathbf{\dot x}}_1-\mathbf{f}(\mathbf{x}_1,t)={\mathbf{\dot x}}_2-\mathbf{f}(\mathbf{x}_2,t) \end{equation} where the function $\mathbf{f}(\mathbf{x},t)$ is contracting in an input-independent metric, then $\mathbf{x}_1$ and $\mathbf{x}_2$ will converge to each other exponentially, regardless of the initial conditions. Mathematically, stable concurrent synchronization corresponds to convergence to a flow-invariant linear subspace of the global state space\cite{Ref:contraction_sync}. \end{theorem} \begin{IEEEproof} Let us define the common input, $\mathbf{g}(\mathbf{x}_1,\mathbf{x}_2,t)$, enforcing the equality of two dynamics equations such that \begin{equation} \begin{split} {\mathbf{\dot x}}_1-\mathbf{f}(\mathbf{x}_1,t)=\mathbf{g}(\mathbf{x}_1,\mathbf{x}_2,t)\\ {\mathbf{\dot x}}_2-\mathbf{f}(\mathbf{x}_2,t)=\mathbf{g}(\mathbf{x}_1,\mathbf{x}_2,t) \end{split} \end{equation} Construct a virtual system of $\mathbf{y}$: \begin{equation} {\mathbf{\dot y}}-\mathbf{f}(\mathbf{y},t)=\mathbf{g}(\mathbf{x}_1,\mathbf{x}_2,t) \end{equation} which has two particular solutions, $\mathbf{x}_1$ and $\mathbf{x}_2$. If the virtual system is contracting, all solutions of $\mathbf{y}$ converge to each other exponentially. As a result, $\mathbf{x}_1$ tends to $\mathbf{x}_2$ exponentially fast. \end{IEEEproof} Notice that the original dynamics per se, with the input $\mathbf{g}(\mathbf{x}_1,\mathbf{x}_2,t)$ might not be contracting. Nevertheless, the system is partially contracting, thereby achieving synchronization. Based upon the results from Theorems \ref{Thm:partial} and \ref{Thm:sync}, the following examples are illustrated in the subsequent sections to shed some light on potential applications of synchronization to nonlinear control. \subsection{Contraction of Combined and Coupled Systems} The following theorems are used to derive stability and synchronization of coupled dynamics systems. \begin{theorem}[parallel combination]\label{Thm:parallel} Consider two time-varying nonlinear systems, contracting in the same metric function which does not explicitly depend on time such that $\mathbf{M}(\mathbf{x})={\mathbf{\Theta}}(\mathbf{x})^{T}{\mathbf{\Theta}}(\mathbf{x})$ and ${\mathbf{\dot \Theta}}=\frac{\partial \mathbf{\Theta}}{\partial \mathbf{x}}\mathbf{\dot x}$: \begin{equation} \mathbf{\dot x} = \mathbf{f}_i(\mathbf{x},t) \ \ \ \ \,\ i=1,2 \end{equation} Then, any positive superposition with $\alpha_i > 0$ \begin{equation} \mathbf{\dot x} = \alpha_1\mathbf{f}_1(\mathbf{x},t)+\alpha_2\mathbf{f}_2(\mathbf{x},t) \end{equation} is contracting in the same metric. By recursion, this parallel combination can be extended to any number of systems. \end{theorem} \begin{IEEEproof} Since the original dynamics are contracting with a time-independent metric, the generalized Jacobian, $\mathbf{F}$ in (\ref{jacobian_ch2}) becomes \begin{align} \mathbf{F}=&\left(\mathbf{\dot{\Theta}}{(\mathbf{x})}+{\mathbf{\Theta}(\mathbf{x})}\frac{\partial \mathbf{f}_i}{\partial \mathbf{x}}\right){\mathbf{\Theta}(\mathbf{x})}^{-1} \nonumber \\ =&\left(\frac{\partial \mathbf{\Theta}(\mathbf{x})}{\partial \mathbf{x}}\mathbf{f }_i+{\mathbf{\Theta}(\mathbf{x})}\frac{\partial \mathbf{f}_i}{\partial \mathbf{x}}\right){\mathbf{\Theta}(\mathbf{x})}^{-1} \end{align} Since the individual systems are contracting, \begin{align} \frac{d}{dt}(\delta \mathbf{z}^T\delta \mathbf{z})=&\delta \mathbf{z}^T\left(\frac{\partial \mathbf{\Theta}}{\partial \mathbf{x}}\mathbf{f}_i+{\mathbf{\Theta}}\frac{\partial \mathbf{f}_i}{\partial \mathbf{x}}\right){\mathbf{\Theta}}^{-1}\delta \mathbf{z} \nonumber \\ \leq& -2\lambda_i \delta \mathbf{z}^T\delta \mathbf{z}, \ \ \ \ i=1,2 \end{align} Hence, the $\delta \mathbf{z}$ dynamics of the combined system result in \begin{align} &\frac{d}{dt}(\delta \mathbf{z}^T\delta \mathbf{z}) \nonumber \\ &=\delta \mathbf{z}^T\left(\frac{\partial \mathbf{\Theta}}{\partial \mathbf{x}}(\alpha_1\mathbf{f}_1+\alpha_2\mathbf{f}_2)+{\mathbf{\Theta}}(\alpha_1\frac{\partial \mathbf{f}_1}{\partial \mathbf{x}}+\alpha_2\frac{\partial \mathbf{f}_2}{\partial \mathbf{x}})\right){\mathbf{\Theta}}^{-1}\delta \mathbf{z} \nonumber \\ &=\sum_{i=1}^2\alpha_i\delta \mathbf{z}^T\left(\frac{\partial \mathbf{\Theta}}{\partial \mathbf{x}}\mathbf{f}_i+{\mathbf{\Theta}}\frac{\partial \mathbf{f}_i}{\partial \mathbf{x}}\right){\mathbf{\Theta}}^{-1}\delta \mathbf{z}\nonumber \\ &\le - 2(\alpha_1\lambda_1+\alpha_2\lambda_2)\delta \mathbf{z}^T\delta \mathbf{z}\nonumber \end{align} \end{IEEEproof} This parallel combination is extremely important if the system possesses a certain geometrical symmetry. For example, the $\mathbf{M}$ and $\mathbf{C}$ matrices from the Lagrangian equation might satisfy $\mathbf{M_2}=\mathbf{M_{\phi_1}}+\mathbf{M_{\phi_2}}$ and $\mathbf{C_2}=\mathbf{C_{\phi_1}}+\mathbf{C_{\phi_2}}$. This property is extensively exploited later. \begin{theorem}[Hierarchical combination~\cite{Ref:contraction5,Ref:contraction2}]\label{Thm:hierc} Consider two contracting systems, of possibly different dimensions and metrics, and connect them in series, leading to a smooth virtual dynamics of the form \begin{equation} \frac{d}{dt} \begin{pmatrix} \delta\mathbf{z}_1\\ \delta\mathbf{z}_2 \end{pmatrix}= \begin{pmatrix} \mathbf{F}_{11} & \mathbf{0} \\ \mathbf{F}_{21} & \mathbf{F}_{22} \end{pmatrix} \begin{pmatrix} \delta\mathbf{z}_1\\ \delta\mathbf{z}_2 \end{pmatrix} \end{equation} Then the combined system is contracting if $\mathbf{F_{21}}$ is bounded. \end{theorem} \begin{IEEEproof} Intuitively, since $\delta \mathbf{z}_1$ tends to zero, $\delta \mathbf{z}_2$ tends to zero as well for a bounded $\mathbf{F}_{21}$. By using a smooth transformation $\mathbf{\Theta}$: \begin{equation} \mathbf{\Theta}=\begin{pmatrix}\mathbf{I} & \mathbf{0} \\ \mathbf{0} & \epsilon \mathbf{I}\end{pmatrix} \end{equation} Then, the new transformed Jacobian matrix is given as \begin{equation} \mathbf{\Theta}\mathbf{F}\mathbf{\Theta}^{-1}=\begin{pmatrix} \mathbf{F}_{11} & \mathbf{0} \\ \epsilon\mathbf{F}_{21} & \mathbf{F}_{22} \end{pmatrix}, \end{equation} which is negative definite for a sufficiently small $\epsilon >0$. \end{IEEEproof} Composite variables, $\mathbf{s}= \mathbf{\dot{q}}-\mathbf{\dot{q}}_d+\mathbf{\Lambda}(\mathbf{{q}}-\mathbf{{q}}_d)$ are an excellent example of a hierarchical combination. Its usage for nonlinear tracking control and robust sliding control shall be discussed in the subsequent sections. Another interesting combination that occurs in the nonlinear control synthesis is feedback combination. \begin{theorem}[Feedback combination~\cite{Ref:contraction3}]\label{Thm:feedback} The overall dynamics of the generalized virtual displacements might be represented as \begin{equation} \frac{d}{dt} \begin{pmatrix} \delta\mathbf{z}_1\\ \delta\mathbf{z}_2 \end{pmatrix}=\mathbf{F}\begin{pmatrix} \delta\mathbf{z}_1\\ \delta\mathbf{z}_2 \end{pmatrix}= \begin{pmatrix} \mathbf{F_{1}} & \mathbf{G}^T \\ \mathbf{G} & \mathbf{F_{2}} \end{pmatrix} \begin{pmatrix} \delta\mathbf{z}_1\\ \delta\mathbf{z}_2 \end{pmatrix} \end{equation} where $\mathbf{F}_{1}$ and $\mathbf{F}_{2}$ are symmetric negative definite matrices. In order to prove contraction of the combined system, one needs to check if $\mathbf{F}$ is negative definite. From the standard linear algebra~\cite{Ref:HornJohnson}, $\mathbf{F}$ is uniformly negative definite if and only if \begin{equation} \mathbf{F}_{2}< \mathbf{G}^T{\mathbf{F}_{1}}^{-1}\mathbf{G} \end{equation} A sufficient condition for the above inequality can be given as \begin{equation} \lambda(\mathbf{F}_{1})\lambda(\mathbf{F}_{2})>\sigma^2(\mathbf{G}) \end{equation} where $\lambda(\cdot)$ is the contraction rate, which is the absolute value of the largest eigenvalue (least negative) of the contracting system. $\sigma(\cdot)$ denotes the largest singular value. \end{theorem} It should be noted that the overall contraction rate is no greater than the individual contraction rate of $\mathbf{F}_{1}$ and $\mathbf{F}_{2}$ by the eigenvalue interlacing theorem~\cite{Ref:HornJohnson}. Indeed, one can find the explicit lower bound of the contraction rate as~\cite{Ref:contraction2} \begin{equation} \lambda(\mathbf{F})=\frac{\lambda(\mathbf{F}_{1})+\lambda(\mathbf{F}_{2})}{2}-\sqrt{\left(\frac{\lambda(\mathbf{F}_{1})-\lambda(\mathbf{F}_{2})}{2}\right)^2+\sigma^2(\mathbf{G})} \end{equation} \subsection{High-Order Contraction Theory} This section presents a new theorem that can be conveniently used to prove contraction of a second-order nonlinear system. Consider the following second-order time-varying nonlinear differential equation \begin{equation}\label{2nd_order} \ddot{x}+a_1(x)\dot{x}+a_2(x,t)=u(t) \end{equation} where $a_1(x)$ is a smooth function of $x$, and $a_2(x,t)$ is a smooth function of $x$ and $t$. \begin{remark} Proving contraction of (\ref{2nd_order}) is difficult, since the original contraction analysis is originally stated for first-order systems. Finding some smooth coordinate transformation of the virtual displacement, $\delta\mathbf{z}={\mathbf{\Theta}}\delta\mathbf{x}$, is the key such that the generalized Jacobian $\bf F$ associated with the augmented system of $(x,\dot x)^T$ is uniformly negative definite. \end{remark} \begin{remark} In general, finding such a transformation, $\mathbf{\Theta}$ is not trivial. Even without the use of contraction theory, proving exponential and global stability of a general time-varying nonlinear second-order system can be a very difficult problem.\end{remark} We present the main theorem of this section, which provides a sufficient condition for contraction of (\ref{2nd_order}) \begin{theorem}[High-order analysis]\label{theorem1} The nonlinear system in (\ref{2nd_order}) is contracting (all solutions converge to a single trajectory exponentially fast from any initial conditions), if \begin{equation} a_1(x)>0, \ \ \ \ \ \forall x \end{equation} and if \begin{equation} \frac{\partial a_2(x,t)}{\partial x}>0, \ \ \ \frac{d}{dt}\left(\frac{\partial a_2(x,t)}{\partial x}\right)>0\ \ \ \ \ \forall t \end{equation} \end{theorem} \begin{IEEEproof} The virtual displacement equation of (\ref{2nd_order}) is \begin{equation}\label{2nd_order_virt} \delta{\ddot{x}}+a_1(x)\delta{\dot{x}}+\left[\dot{a}_1+\frac{\partial a_2(x,t)}{\partial x}\right]\delta{x}=0 \end{equation} Equation (\ref{2nd_order_virt}) can be written as a first-order differential equation by defining the vector state $\mathbf{x}=(x,\dot x)^T$: \begin{align} &\delta\dot{\mathbf{x}}=\frac{\partial \mathbf{f}}{\partial \mathbf{x}}\delta{\mathbf{x}}\\ &\frac{d}{dt}\begin{pmatrix}\delta x\\ \delta \dot x \end{pmatrix}=\begin{bmatrix}0 & 1\\-\left(\dot{a}_1+\frac{\partial a_2}{\partial x}\right)&-a_1\end{bmatrix}\begin{pmatrix}\delta x\\ \delta \dot x \end{pmatrix}\nonumber \end{align} Let us take the following transformation matrix \begin{equation} \mathbf{\Theta}(\mathbf{x},t)=\begin{pmatrix}1&0\\ a_1/\sqrt{\frac{\partial a_2}{\partial x}} &1/\sqrt{\frac{\partial a_2}{\partial x}}\end{pmatrix} \end{equation} It is straightforward to calculate the associated Jacobian as \begin{align}\label{Jacobian} \mathbf{F}&=\left(\mathbf{\dot{\Theta}}{(\mathbf{x},t)}+{\mathbf{\Theta}(\mathbf{x},t)}\frac{\partial \mathbf{f}}{\partial \mathbf{x}}\right){\mathbf{\Theta}(\mathbf{x},t)}^{-1}\\ &=\begin{bmatrix}-a_1(x) & \sqrt{\frac{\partial a_2}{\partial x}}\\-\sqrt{\frac{\partial a_2}{\partial x}} &-\frac{d}{dt}\left(\frac{\partial a_2}{\partial x}\right)/\left(2\frac{\partial a_2}{\partial x}\right)\end{bmatrix}\nonumber \end{align} From the contraction theory, (\ref{2nd_order}) is contracting if the symmetric part of $\mathbf{F}$ is uniformly negative definite, which corresponds to the conditions in Theorem \ref{theorem1}. \end{IEEEproof} We illustrate the use of this theorem in a few examples. \begin{example}[Driven damped Van der Pol oscillator] Consider the following second-order system \begin{equation}\label{vanderpol} \ddot{x}+(\beta+\alpha x^2)\dot{x}+\omega^2 x=u(t) \end{equation} The first condition in Theorem~\ref{theorem1} holds if $a_1(x)=(\beta+\alpha x^2)>0$ uniformly (i.e. $\alpha$ and $\beta$ are strictly positive). Also, note that $\frac{\partial a_2}{\partial x}=\omega^2$. This is a semi-contracting system. Indeed, the generalized Jacobian in (\ref{Jacobian}) yields the same $\mathbf{F}$ as in \cite{Ref:contraction3}.\end{example} \begin{example}[Extension] Suppose that $\omega$ in (\ref{vanderpol}) is now time-varying such that \begin{equation} \ddot{x}+a_1(x)\dot{x}+K_1e^{K_2t}x=u(t) \end{equation} where $a_1(x)>0$, $K_1>0$, and $K_2>0$. The above dynamics is contracting since $\frac{d}{dt}\left(\frac{\partial a_2(x,t)}{\partial x}\right)=K_1K_2 e^{K_2t}>0$. \end{example} \subsection{Tracking Control of Robots and Aerospace Vehicles}\label{Sec:tracking_con_robot} The dynamics of a robot or a vehicle is given as \begin{equation} \mathbf{M}(\mathbf{q})\mathbf{\ddot{q}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}}+\mathbf{g}(\mathbf{q}) =\mathbf{\tau} \end{equation} \noindent One may consider the following tracking control law~\cite{Ref:Slotine,Ref:contraction_robot} to follow the desired trajectory $\mathbf{{q}}_{d}(t)$ \begin{equation}\label{tracking_controller_proof} \mathbf{\tau}={\mathbf{M}} (\mathbf{q}){\mathbf{\ddot{q}}_{r}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}}){\mathbf{\dot{q}}_{r}}+\mathbf{g}(\mathbf{q}) -\mathbf{K}(\mathbf{\dot{q}}-\mathbf{\dot{q}}_{r}) \end{equation} where $\mathbf{\dot{q}}_{r}=\mathbf{\dot{q}}_{d}-\mathbf{\Lambda}\mathbf{\widetilde{q}}=\mathbf{\dot{q}}_{d}-\mathbf{\Lambda}(\mathbf{q}-\mathbf{q}_{d})$ and positive-definite matrices $\mathbf{K}$ and $\mathbf{\Lambda}$. Note that this tracking control law was first introduced by Slotine and Li~\cite{Ref:Slotine} for the new adaptive control law. Compared to the feedback linearized control law (computed torque control), the equation in (\ref{tracking_controller_proof}) does not cancel the robot dynamics, but it still guarantees exponential tracking convergence at the same rate as an exact cancelation of the feedback linearized control (see the discussion in \cite{Ref:Slotine}). Also, its robustness property is compared with a feedback linearization control law in~\cite{Ref:NonlinearAttitude}. \emph{(\textbf{Observer-like virtual systems})}: The incremental stability concept of Lemma~\ref{Thm:contraction} is useful for analyzing stability of an observer or observer-like system. For example, consider an observer-like virtual system constructed from a closed-loop EL system of $\mathbf{y}$ such as \begin{equation}\label{virtual_tracking_y} \mathbf{\tau}={\mathbf{M}} (\mathbf{q})\mathbf{\dot y}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{y}+\mathbf{g}(\mathbf{q}) -\mathbf{K}(\mathbf{\dot{q}}-\mathbf{y}) \end{equation} This virtual dynamics has two particular solutions, $\mathbf{\dot{q}}$ and $\mathbf{\dot{q}}_{r}$ since both solutions satisfy (\ref{virtual_tracking_y}). \emph{Alternatively}, you can construct an equivalent virtual dynamics \begin{equation}\label{virtual_tracking_y2} {\mathbf{M}} (\mathbf{q})\mathbf{\dot y}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{y}+\mathbf{g}(\mathbf{q}) -\mathbf{K}(\mathbf{\dot{q}}-\mathbf{y}=\mathbf{\tau} \end{equation} which has particular solutions, $\mathbf{s}$ and $\mathbf{0}$. The difference between (\ref{virtual_tracking_y}) and (\ref{virtual_tracking_y2}) is simply whether you focus on the incremental stability between the composite variable $\mathbf{s}$ and $\mathbf{0}$ or the incremental stability between $\mathbf{\dot{q}}$ and $\mathbf{\dot{q}}_r$. The virtual displacement equation of both (\ref{virtual_tracking_y}) and (\ref{virtual_tracking_y2}) becomes \begin{equation}\label{dvirtual_tracking_y2} {\mathbf{M}} (\mathbf{q})\delta\mathbf{\dot y}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\delta\mathbf{y} +\mathbf{K}\delta\mathbf{y}=\mathbf{0} \end{equation} It is straightforward to find that $\mathbf{K}>0$ needs to hold for exponential convergence to the desired trajectory. The skew-symmetry of $(\mathbf{\dot{M}}-2\mathbf{C})$ results in the following differential length analysis \begin{align} &\frac{d}{dt}(\delta\mathbf{y}^T\mathbf{M}(\mathbf{q})\delta\mathbf{y}) =2 \delta\mathbf{y}^T\mathbf{M}(\mathbf{q})\delta\dot{\mathbf{y}}+\delta\mathbf{y}^T\mathbf{\dot{M}}(\mathbf{q})\delta\mathbf{y} \nonumber \\ &= - 2 \delta\mathbf{y}^T\Bigl(\mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\delta\mathbf{y}+\mathbf{K}\delta\mathbf{y}\Bigr)+\delta\mathbf{y}^T\mathbf{\dot{M}}(\mathbf{q})\delta\mathbf{y}\ \\&= - 2\delta\mathbf{y}^T \mathbf{K} \delta\mathbf{y}\nonumber \end{align} which indicates that the $\mathbf{y}$-system is contracting with $\mathbf{K}>0$. This implies exponential convergence of $\mathbf{\dot{q}}$ to $\mathbf{\dot{q}}_{r}$. In the presence of bounded resultant disturbance $\boldsymbol{d}(t)$, it follows from Lemma \ref{LM:Robust_contraction_original} that: \begin{align} \label{eq:EL_proof1} \lim_{t \rightarrow \infty} \int_{\mathbf{0}}^{\mathbf{s}}\|\delta\mathbf{y}\|&=\lim_{t \rightarrow \infty} \int^{\mathbf{\dot{q}}}_{\mathbf{\dot{q}}_{r}}\|\delta\mathbf{y}\| \nonumber \\ &\leq\frac{\lambda_{\max}(\boldsymbol{M}(\mathbf{q}))}{\lambda_{\min}(\boldsymbol{K})\lambda_{\min}(\boldsymbol{M}(\mathbf{q}))}\sup_{t}\|\boldsymbol{d}(t)\| \end{align} Hence the dynamics of the closed-loop system is bounded in the presence of bounded resultant disturbance $\boldsymbol{d}$. We now prove that convergence of $\boldsymbol{s} \rightarrow \boldsymbol{0}$ or $\mathbf{\dot{q}}\rightarrow \mathbf{\dot{q}}_{r}$ implies convergence of the system's trajectory to the desired trajectory ($\hat{\boldsymbol{q}} \rightarrow \boldsymbol{q}_d$). It follows from the definition of $\boldsymbol{s}$ and setting $\tilde{\mathbf{q}}=\mathbf{q}_e=\mathbf{q}-\mathbf{q}_d(t)$ that: \begin{align} \mathbf{\dot{q}}-\mathbf{\dot{q}}_d+\boldsymbol{\Lambda}(\mathbf{q}-\mathbf{q}_d)=\mathbf{\dot{q}}_e+\boldsymbol{\Lambda}\mathbf{q}_{e}=\mathbf{s} \end{align} is contracting with an exponential rate of $\lambda_{\min}(\boldsymbol{\Lambda})$ for $\boldsymbol{\Lambda}>0$ if $\boldsymbol{s}=\mathbf{0}$. This is obvious from the linear dynamics form. However, we can also use the virtual dynamics of $\mathbf{\dot{y}}_q+\boldsymbol{\Lambda}\mathbf{y}_q=\mathbf{\dot{q}}_d+\boldsymbol{\Lambda}\mathbf{q}_d$, which has two particular solutions of $\mathbf{y}_q=\mathbf{q}$ and $\mathbf{y}_q=\mathbf{q}_d(t)$. Alternatively, we can use $\mathbf{\dot{y}}_\mathbf{q}+\boldsymbol{\Lambda}\mathbf{y}_q=\mathbf{0}$, which has $\mathbf{y}_q=\mathbf{q}_e$ and $\mathbf{0}$ as its particular solutions. Both forms yield the same dynamics of $\delta \mathbf{y}_q$ that is the infinitesimal displacement at fixed time In summary, if $\boldsymbol{s}=\mathbf{0}$, all solutions of the $\mathbf{y}_q$ virtual dynamics will converge exponentially fast to each other ($\delta \mathbf{y}_q \rightarrow \mathbf{0}$). By using (\ref{eq:EL_proof1}), it follows from Lemma \ref{LM:Robust_contraction_original} and its extension to a hierarchically-combined system (Lemma~\ref{LM:Robust_contraction_hierc}) that: \begin{align} &\lim_{t\rightarrow\infty}\int_{\mathbf{q}_d}^{\boldsymbol{q}}\|\delta\mathbf{y}_q\|=\lim_{t\rightarrow\infty}\int_{0}^{\boldsymbol{q}_{e}}\|\delta\mathbf{y}_{q}\| \leq\frac{1}{\lambda_{\min}(\boldsymbol{\Lambda})}\lim_{t\rightarrow \infty}\int^\mathbf{s}_\mathbf{0}\|\delta\mathbf{y}\| \nonumber \\ & \leq \frac{\lambda_{\max}(\boldsymbol{M}(\mathbf{q}))}{\lambda_{\min}(\boldsymbol{\Lambda})\lambda_{\min}(\boldsymbol{K})\lambda_{\min}(\boldsymbol{M}(\mathbf{q}))}\sup_{t}\|\boldsymbol{d}(t)\| \label{eq:EL_proof2}\end{align} Hence we have shown, by constructing a hierarchically-combined closed-loop system of $\boldsymbol{s}$ and $\boldsymbol{q}_{e}$, that the attitude trajectory $\boldsymbol{q}(t)$ will globally exponentially converge to a bounded error ball around the desired trajectory $\boldsymbol{q}_d (t)$. Specifically, it follows from Lemma \ref{LM:Robust_contraction_original} that this control law is finite-gain $\mathcal{L}_p$ stable and input-to-state stable. Hence the control gains $\boldsymbol{K}$ and $\boldsymbol{\Lambda}$ can be designed such that the desired error bounds are achieved, as shall be seen below. This is a hierarchical combination due to reduction of the system order via introduction of the composite variable, $\mathbf{s}$. Consider the following hierarchical virtual system of $\mathbf{y}_1$ and $\mathbf{y}_2$: \begin{equation}\label{hierc_sys_ch2} \begin{bmatrix}{\mathbf{M}}(\mathbf{q}) & \mathbf{0}\\ \mathbf{0} &{\mathbf{I}}\end{bmatrix}\begin{pmatrix}\mathbf{ \dot y}_1\\\mathbf{ \dot y}_2\end{pmatrix}+\begin{bmatrix}\mathbf{C}(\mathbf{q},\mathbf{\dot{q}})+\mathbf{K} & \mathbf{0}\\ -\mathbf{I} &\mathbf{\Lambda}\end{bmatrix}\begin{pmatrix}\mathbf{ y}_1\\ \mathbf{ y}_2\end{pmatrix}=\begin{pmatrix}\mathbf{ 0}\\ \mathbf{0}\end{pmatrix} \end{equation} This is hierarchically connected since the dynamics of $\mathbf{y}_2$ does not affect those of $\mathbf{y}_1$. It is straightforward to verify that (\ref{hierc_sys_ch2}) has two particular solutions: \begin{equation}\begin{pmatrix}\mathbf{y}_1=\mathbf{s}\\ \mathbf{y}_2=\mathbf{q}-\mathbf{q}_d\end{pmatrix},\ \ \ \ \ \ \begin{pmatrix}\mathbf{y}_1=\mathbf{0}\\ \mathbf{y}_2=\mathbf{0}\end{pmatrix}\end{equation}. \begin{remark}[Proof of Exponential Stability using a Conventional Lyapunov Approach] If we use the original definition of exponential stability using a Lyapunov function (Theorem \ref{Thm:exponential}), we can try $V=\mathbf{s}^T\mathbf{M}(\mathbf{q})\mathbf{s}+\alpha \tilde{\mathbf{q}}^T\tilde{\mathbf{q}}$, which yields the conditions for contraction by Theorem~\ref{Thm:contraction}: $$\alpha\mathbf{I}<4\mathbf{K}\mathbf{\Lambda}$$ or $$\alpha<4\lambda_{min}(\mathbf{K}\mathbf{\Lambda})$$. However, this requires another strong assumption on $\alpha$ to complete the exponential stability of $\|\mathbf{s}\|$ and $\|\mathbf{\tilde{q}}\|$, in order to apply Theorem \ref{Thm:exponential}. Often times, we need to use an ad-hoc Lyapunov function with a cross-term~\cite{Ref:ChungTRO}: $\exists \alpha$, $$V=\mathbf{s}^T\mathbf{M}(\mathbf{q})\mathbf{s}+\tilde{\mathbf{q}}^T\tilde{\mathbf{q}}+\alpha\mathbf{s}^T\mathbf{M}(\mathbf{q})\tilde{\mathbf{q}}.$$ \end{remark} \subsection{Tracking Control of Hamiltonian} We show an equivalent result from the previous section, using the first order canonical form obtained by the transformation, $\mathbf{p}=\mathbf{M}(\mathbf{q})\mathbf{s}$ in Section~\ref{sec:hamilton}. The closed-loop system with the tracking control law in (\ref{tracking_controller_proof}) is obtained as \begin{equation}\label{NL_hamiltonian2} \mathbf{M}(\mathbf{q})\mathbf{\dot{s}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{s}+\mathbf{K}\mathbf{s} =\mathbf{0} \end{equation} where $\mathbf{s}$ is defined in (\ref{composite_variable}). \noindent Equation (\ref{NL_hamiltonian2}) reduces to the following first-order canonical form: \begin{equation} \begin{split} \mathbf{\dot{p}}=\Bigl[\mathbf{C}\left(\mathbf{q},\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}\right)^{T}-\mathbf{K}\Bigr]\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}\\ \mathbf{\dot{q}}=-\mathbf{\Lambda}\mathbf{q}+\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}+ \left(\mathbf{\dot{q}}_d+\mathbf{\Lambda}{\mathbf{q}}_d\right)\ \ \ \ \end{split} \end{equation} Consider a virtual system, having $\mathbf{y}_1=\mathbf{p},\mathbf{y}_2=\mathbf{q}$ and $\mathbf{y}_1=\mathbf{0},\mathbf{y}_2=\mathbf{q}_d$ as its particular solutions: \begin{equation} \begin{split} \mathbf{\dot{y}}_1=\Bigl[\mathbf{C}\left(\mathbf{q},\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}\right)^{T}-\mathbf{K}\Bigr]\mathbf{M}^{-1}(\mathbf{q})\mathbf{y}_1 \\ \mathbf{\dot{y}}_2=-\mathbf{\Lambda}\mathbf{y}_2+\mathbf{M}^{-1}(\mathbf{q})\mathbf{y}_1+ \left(\mathbf{\dot{q}}_d+\mathbf{\Lambda}{\mathbf{q}}_d\right) \ \ \end{split} \end{equation} which is also a hierarchical combination. This virtual system can be easily shown to be contracting. Similarly to the previous section, the virtual length analysis with respect to the metric, $\mathbf{M}^{-1}(\mathbf{q})>0$ yields \begin{align} &\frac{d}{dt}(\delta{\mathbf{y}_1}^T\mathbf{M}^{-1}(\mathbf{q})\delta\mathbf{y}_1) \nonumber \\ =&2 \delta{\mathbf{y}_1}^T\mathbf{M}^{-1}(\mathbf{q})\delta{\mathbf{\dot y}}_1+{\mathbf{y}_1}^T\mathbf{M}^{-1}(\mathbf{q})(-\mathbf{\dot{M}}(\mathbf{q}))\mathbf{M}^{-1}(\mathbf{q})\delta\mathbf{y}_1 \nonumber \\ =& \delta{\mathbf{y}_1}^T\mathbf{M}^{-1}(\mathbf{q})\Bigl(\mathbf{C}+\mathbf{C}^T-2\mathbf{K}\Bigr)\mathbf{M}^{-1}(\mathbf{q})\delta\mathbf{y}_1 \nonumber \\ &-\delta{\mathbf{y}_1}^T\mathbf{M}^{-1}(\mathbf{q})\mathbf{\dot{M}}(\mathbf{q})\mathbf{M}^{-1}(\mathbf{q})\delta\mathbf{y}_1\ \nonumber\\=& - 2\delta{\mathbf{y}_1}^T \mathbf{M}^{-1}(\mathbf{q})\mathbf{K} \mathbf{M}^{-1}(\mathbf{q})\delta\mathbf{y}_1 \end{align} where we used \begin{equation}\frac{d}{dt}\mathbf{M}^{-1}(\mathbf{q})=-\mathbf{M}^{-1}(\mathbf{q})\mathbf{\dot{M}}(\mathbf{q})\mathbf{M}^{-1}(\mathbf{q})\end{equation} This shows that $\mathbf{y}_1$ is contracting with $\mathbf{K}>0$, which in turn corresponds to contraction of $\mathbf{y}_2$ due to the hierarchy. Therefore, all solutions of $\mathbf{y}_1$ and $\mathbf{y}_2$ tend to each other resulting in $\mathbf{q} \rightarrow \mathbf{q}_d$. \subsection{Preview: Passivity Based Analysis}\label{sec:Passivity} A passive system is one where the energy output of the system is not greater than the energy injected into the system from external sources. Hence, the passivity property makes an essential connection with the energy conservation law. Before we introduce Lyapunov functions to generalize the notion of energy in a dynamical system, particulary in the context of stability theory, we briefly characterize a passive mechanical system in this section. Consider a control affine, smooth nonlinear system with an output $\mathbf{y}\in\mathbb{R}^m$, \begin{align}\label{nonlin_input} {\mathbf{\dot x}}(t)&=\mathbf{f}(\mathbf{x}(t),t)+\mathbf{g}(\mathbf{x}(t),t)\mathbf{u}\\ \mathbf{y}&=\mathbf{h}(\mathbf{x})\nonumber \end{align} where $\mathbf{x}\in \mathbb{R}^n$, $\mathbf{u}\in \mathbb{R}^m$, and $\mathbf{f},\mathbf{g}$ and $\mathbf{h}$ are continuous in $t$ and smooth in $\mathbf{x}$ with $\mathbf{f}(\mathbf{0},t)=\mathbf{0}$ and $\mathbf{h}(\mathbf{0},t)=\mathbf{0}$ for all $t\geq0$. \begin{definition}[Passivity] The nonlinear system in (\ref{nonlin_input}) is said to be passive if there exists a $\mathcal{C}^1$ storage function $V(\mathbf{x},t)\geq0$, $V(\mathbf{0},t)=0$,$\forall t\geq0$ and a function $S(\mathbf{x})\geq0$ such that for $\forall t\geq t_0\geq0$ \begin{equation} V(\mathbf{x}(t),t)-V(x(t_0),t_0)=\int^{t}_{t_0}\mathbf{u}^T(s)\mathbf{y}(s)ds-\int^{t}_{t_0}S(s)ds \end{equation} The system in (\ref{nonlin_input}) is strictly passive for $S(t)>0$ and lossless for $S(t)=0$. Also, if $S(t)=\mathbf{y}^T\rho(\mathbf{y})>0$, the system is output strictly passive, and if $S(t)=\mathbf{u}^T\rho(\mathbf{u})>0$, the system is input strictly passive. \end{definition} Furthermore, $\mathbf{u}^T\mathbf{y}$ can generalized to $\boldsymbol\sigma(\mathbf{u},\mathbf{x})$, called a supply rate and $V$ is called a storage function. Notice that the external power input term is written as $\mathbf{u}^T\mathbf{y}$. We can easily show that a combination of two passive systems is passive, which leads to the ``additive'' property of Lyapunov functions~\cite{Ref:Slotine}. Let us take an example of a mechanical system such as a robotic manipulator: \begin{equation} \mathbf{M}(\mathbf{q})\mathbf{\ddot{q}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}}+\mathbf{g}(\mathbf{q}) =\mathbf{\tau}\label{NL_single_compact2} \end{equation} In the presence of external gravity torques $\mathbf{g}(\mathbf{q})$, the energy conservation law can be written as \begin{equation} \mathbf{\dot{q}}^T(\mathbf{\tau}-\mathbf{g}(\mathbf{q}))=\frac{1}{2}\frac{d}{dt}(\mathbf{\dot{q}}^T\mathbf{M}(\mathbf{q})\mathbf{\dot{q}}) \end{equation} which implies that the mapping $\mathbf{\tau}-\mathbf{g}\rightarrow \mathbf{\dot{q}}$ is passive. By expanding the right-hand side, we can prove that $\mathbf{\dot{q}}^T(\mathbf{\dot M}-2\mathbf{C})\mathbf{\dot{q}}$. In conclusion, a robot's dynamics are passive only with a velocity vector $\mathbf{\dot{q}}$ unless a composite variable structure~\cite{Ref:Slotine} is employed. Passivity is a subject of intense research, with applications to robotics~\cite{Ref:Slotine}, spacecraft control~\cite{Ref:Egeland}, and more recently, teleoperation~\cite{Ref:Spong_tele2} and network synchronization. \begin{example}[Adaptive Control] Robust control and adaptive control are two different approaches to the problem of inherent uncertainty in the nonlinear system: robust control attempts to design a fixed parameter controller that successfully performs in the presence of the worst-case errors in the model, while adaptive control dynamically adjusts its parameters to compensate for the initial model uncertainty or very slowly varying parameters. Hence, adaptive control is a natural choice when only parametric uncertainty exits. However, adaptive controllers do not have long term memory and hence do not "remember" the optimal control parameters corresponding to different configurations of the plant. We consider the following adaptive control law for a Lagrangian system from (\ref{NL_single_compact2}): \begin{equation} \boldsymbol{\tau}=\mathbf{Y}\hat{\mathbf{a}}-\mathbf{K}\mathbf{s}=\mathbf{\hat{M}}(\mathbf{q})\mathbf{\ddot{q}_{r}}+ \mathbf{\hat{C}}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}_{r}}+\mathbf{\hat{g}}(\mathbf{q}) -\mathbf{K}\mathbf{s} \end{equation} where $\mathbf{s}$ denotes the composite variable $\mathbf{s}=\mathbf{\dot q} - \mathbf{\dot{q}}_{r}$, and the parameter estimates are updated to complete the definition of the adaptive control law with a positive definite matrix $\mathbf{\Gamma}$ as follows: \begin{equation}\mathbf{\dot{\hat{a}}}=-\mathbf{\Gamma}\mathbf{Y}^T\mathbf{s}\end{equation} \begin{equation}\mathbf{\dot{\hat{a}}}=-\mathbf{\Gamma}\mathbf{Y}^T\mathbf{s}\end{equation} Then, the asymptotic convergence of the tracking error and parameter estimates can be proven by finding a suitable Lyapunov-like function or using contraction analysis. \end{example} Consider the closed-loop system with the adaptive control law above: \begin{equation} \begin{bmatrix}\mathbf{M}(\mathbf{q}) & \mathbf{0}\\ \mathbf{0} & \mathbf{\Gamma}^{-1}\end{bmatrix} \begin{pmatrix}\mathbf{\dot s}\\ \mathbf{\dot{\tilde a}}\end{pmatrix}+ \begin{bmatrix}\mathbf{C}(\mathbf{q},\mathbf{\dot{q}})+\mathbf{K}& -\mathbf{Y}\\ \mathbf{Y}^{T}& \mathbf{0} \end{bmatrix}\begin{pmatrix}\mathbf{s}\\ \mathbf{\tilde a}\end{pmatrix}=\begin{pmatrix}\mathbf{0}\\ \mathbf{0}\end{pmatrix}\label{eq:adaptive_closed} \end{equation} where $\mathbf{\hat{a}}$ denotes an estimate, and $\mathbf{\tilde{a}}$ denotes an error of the estimate such that $\mathbf{\tilde{a}}=\mathbf{\hat{a}}-\mathbf{a}$, while $\mathbf{a}$ is a constant vector of the true parameter values. \begin{figure} \begin{center} \includegraphics[width=85mm]{figures/Passivity.jpg}\\ \caption{Interpretation of adaptive control from a perspective of passivity} \end{center} \end{figure} The above system has a positive semi-definite generalized Jacobian with $\mathbf{K}>0$, thereby resulting in a semi-contracting system~\cite{Ref:contraction1,Ref:contraction4}. Using Barbalat's lemma, the asymptotic convergence of $\mathbf{s}$ can be proven as follows. First, construct a suitable Lyapunov function to find that $\ddot V= -2\mathbf{s}^T\mathbf{K}\mathbf{\dot s}$ and $\dot V$ is uniformly continuous since a bounded $\dot{\mathbf{s}}$ from (\ref{eq:adaptive_closed}) leads to a bounded $\ddot V$. Due to $\dot V \leq 0$, the use of Barbalat's lemma verifies that $\dot V \rightarrow 0$ as $t\rightarrow \infty$. This implies that $\mathbf{s}$ tends to zero asymptotically fast. From the hierarchical combination of the $\mathbf{s}$ variable, this also implies $\mathbf{q}\rightarrow \mathbf{q}_d$. Please note that the convergence of $\mathbf{\hat{a}}$ to the true value $\mathbf{a}$ is NOT proven. It should be noted that the open loop dynamics of a multi-link robot are only passive for $\mathbf{\tau}-\mathbf{g}$ and the joint velocity $\mathbf{\dot q}$. To the contrary, the above adaptation law modifies the closed-loop dynamics such that the mapping $-\mathbf{Y}^T\mathbf{s}\rightarrow \mathbf{\tilde a}$ is passive (i.e., $\mathbf{s}\rightarrow -\mathbf{Y}\mathbf{\tilde a}$ is also a passive mapping. This is reminiscent of the feedback combination of two passive systems. $\dot{V}_1(t)=y_1^Tu_1-g_1(t)$ and $\dot{V}(t)=y_2^Tu_2-g_2(t)$. In a feedback configuration, $u_2=y_1$ and $u_1=-y_2$. Hence, $\dot{V}_1(t)+\dot{V}_2(t)=-(g_1(t)+g_2(t))$. \subsection{Control Laws for Nonlinear Attitude Control \label{sec:att_cont}} \begin{remark}[This section is based on~\cite{Ref:NonlinearAttitude}:] S. Bandyopadhyay, S.-J. Chung, and F. Y. Hadaegh,``Nonlinear Attitude Control of Spacecraft with a Large Captured Object,'' \emph{Journal of Guidance, Control, and Dynamics}, vol. 39, no. 4, 2016, pp. 754-769. \end{remark} In this section, we present the new nonlinear attitude tracking control laws that are deemed suitable for satisfying the control problem statement. We first present a novel robust nonlinear tracking control law that guarantees globally exponential convergence of the system's attitude trajectory to the desired attitude trajectory. In order to highlight the advantages of this new control law, we also present several extensions of this attitude tracking control law, like augmenting it with an integral control term and deriving an exponentially-stabilizing tracking control law on SO($3$). Let $\boldsymbol{\omega}\in\mathbb{R}^{3}$ be the angular velocity of the system in the body fixed frame $\mathcal{F}_{B}$ with respect to the inertial frame $\mathcal{F}_{I}$ and expressed in the frame $\mathcal{F}_{B}$. Let $\boldsymbol{u}_c\in\mathbb{R}^{n_t}$ be the control input. The attitude dynamics of the rigid combination is given by: \begin{equation} \boldsymbol{J}\dot{\boldsymbol{\omega}}=\left(\boldsymbol{J}\boldsymbol{\omega}\right)\times\boldsymbol{\omega}+\boldsymbol{u}_c+\boldsymbol{d}_{\textrm{ext}}\thinspace,\label{eq:dynamics} \end{equation} where $\boldsymbol{d}_{\textrm{ext}}$ represents the external torque acting on the system. The attitude kinematics can be written by using quaternions ($\boldsymbol{\beta}_{v}=[\beta_{1},\thinspace\beta_{2},\thinspace\beta_{3}]$), modified Rodrigues parameters (MRP), or rotation matrix on SO$(3)$ : \begin{align} \boldsymbol{\dot{\beta}}_{v} =&\frac{1}{2}(\beta_{4}\boldsymbol{\omega}+\boldsymbol{\beta}_{v}\times\boldsymbol{\omega}),~~\dot{\beta}_{4}=-\frac{1}{2}\boldsymbol{\beta}_{v}^{T}\boldsymbol{\omega}\thinspace,\label{eq:kinematics_quaternion} \\ \dot{\boldsymbol{q}}=&\boldsymbol{Z}(\boldsymbol{q})\boldsymbol{\omega} \end{align} where \begin{align} \boldsymbol{Z}(\boldsymbol{q})=&\frac{1}{2}\left[\mathbf{I}\left(\frac{1-\boldsymbol{q}^{T}\boldsymbol{q}}{2}\right)+\boldsymbol{q}\boldsymbol{q}^{T}+\boldsymbol{S}(\boldsymbol{q})\right] \nonumber \\ \boldsymbol{S}(\boldsymbol{q})=&\left[\begin{smallmatrix}0 & -q_{3} & q_{2}\\ q_{3} & 0 & -q_{1}\\ -q_{2} & q_{1} & 0 \end{smallmatrix}\right] \thinspace, \label{eq:MRP_def} \\ \dot{\boldsymbol{R}}=&\boldsymbol{R}\boldsymbol{S}(\boldsymbol{\omega})\thinspace. \label{eq:Rot_mat_kinematics} \end{align} where The attitude kinematics equations using Euler angles ($\phi,\thinspace\theta,\thinspace\psi$), classical Rodrigues parameters ($\boldsymbol{\sigma}$), and the first three elements of a quaternion vector ($\boldsymbol{\beta}_v$) can also be written in the form of $\dot{\boldsymbol{q}}=\boldsymbol{Z}(\boldsymbol{q})\boldsymbol{\omega}$ (like (\ref{eq:MRP_def})) with a different definition of $\boldsymbol{Z}(\boldsymbol{q})$. We show later that our proposed nonlinear control law permits the use of any attitude representation. \begin{table*} \caption{Properties of Attitude Representations\label{tab:Properties-Attitude-Rep}} \includegraphics[width=\textwidth]{figures/AttitudeTable.PNG} \end{table*} \subsubsection{Robust Nonlinear Tracking Control Law with Global Exponential Stability \label{sub:First-Robust-NCL-new}} The following theorem states the proposed robust nonlinear tracking control law. Note that this control law does not cancel the term $\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\hat{\boldsymbol{\omega}}\right)\hat{\boldsymbol{\omega}}$ exactly, in contrast with most conventional nonlinear tracking control laws using feed-forward cancellation. Although this control law is written for MRP, it can also be used with other attitude representations like Euler angles, classical Rodrigues parameters, and the quaternion vector, by changing the definition of $\boldsymbol{Z}(\boldsymbol{q})$. \begin{theorem}[New Robust Nonlinear Attiude Controller]\label{thm:first_RNTCL} For the given desired attitude trajectory $\boldsymbol{q}_{d}(t)$, and positive definite constant matrices $\boldsymbol{K}_{r}\in\mathbb{R}^{3\times3}$ and $\boldsymbol{\Lambda}_{r}\in\mathbb{R}^{3\times3}$, we define the following control law: \begin{align} & \boldsymbol{u}_c=\skew{4}\hat{\boldsymbol{J}}\dot{\boldsymbol{\omega}}_{r}-\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{r}-\boldsymbol{K}_{r}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r}) \thinspace,\label{eq:first_RNC_MRP}\\ \textrm{where}\quad & \boldsymbol{\omega}_{r}=\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\dot{\boldsymbol{q}}_{d}(t)+\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\boldsymbol{\Lambda}_{r}(\boldsymbol{q}_{d}(t)-\hat{\boldsymbol{q}}) \thinspace.\nonumber \end{align} This control law exponentially stabilizes the closed-loop attitude dynamics with the following properties: \\ (i) In the absence of resultant disturbance torque $\boldsymbol{d}_{\textrm{res},2}$, this control law guarantees global exponential convergence of the system's trajectory to the desired trajectory $\boldsymbol{q}_{d}(t)$. \\ (ii) In the presence of bounded resultant disturbance torque $\boldsymbol{d}_{\textrm{res},2}$, this control law guarantees that the tracking error ($\boldsymbol{q}_{e} = \hat{\boldsymbol{q}}-\boldsymbol{q}_{d}$) globally exponentially converges to the following ball \begin{align} \lim_{t\rightarrow\infty}\int_{0}^{\boldsymbol{q}_{e}}\|\delta\boldsymbol{q}_{e}\|_{2} & \leq\frac{\lambda_{\max}(\boldsymbol{J})\sup_{t}\sigma_{\max}(\boldsymbol{Z}(\hat{\boldsymbol{q}}))\sup_{t}\|\boldsymbol{d}_{\textrm{res},2}\|_{2}}{\lambda_{\min}(\boldsymbol{\Lambda}_{r})\lambda_{\min}(\boldsymbol{K}_{r})\lambda_{\min}(\boldsymbol{J})}. \end{align} Hence, this control law is finite-gain $\mathcal{L}_p$ stable and input-to-state stable (ISS). \end{theorem} \begin{IEEEproof} The closed-loop dynamics, which is obtained by substituting $\boldsymbol{u}_c$ from Eq.~(\ref{eq:first_RNC_MRP}) into Eq.~(\ref{eq:dynamics}), becomes \begin{equation} \boldsymbol{J}\dot{\boldsymbol{\omega}}_{e}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{e}+\boldsymbol{K}_{r}\boldsymbol{\omega}_{e}=\underbrace{\left[\boldsymbol{d}_{\textrm{res}}-\Delta\boldsymbol{J}\dot{\boldsymbol{\omega}}_r+\boldsymbol{S}\left(\Delta\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{r}\right]}_{\boldsymbol{d}_{\textrm{res},2}}\thinspace, \label{eq:proof_step7} \end{equation} where $\boldsymbol{\omega}_e = (\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r})$ and $\boldsymbol{d}_{\textrm{res}} = \boldsymbol{J}\Delta\boldsymbol{\omega}\times\hat{\boldsymbol{\omega}} +\boldsymbol{J}{\boldsymbol{\omega}}\times\Delta\boldsymbol{\omega} -\boldsymbol{J}\Delta\dot{\boldsymbol{\omega}}+\boldsymbol{d}_{\textrm{ext}}$. We first show that the control law indeed globally exponentially stabilizes the closed-loop system without the resultant disturbance $\boldsymbol{d}_{\textrm{res},2}$. The virtual dynamics of $\boldsymbol{y}$, derived from Eq.~(\ref{eq:proof_step7}) without $\boldsymbol{d}_{\textrm{res},2}$, is given as \begin{equation} \boldsymbol{J}\dot{\boldsymbol{y}}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\boldsymbol{y}+\boldsymbol{K}_{r}\boldsymbol{y} = \boldsymbol{0} \thinspace ,\label{Eq:CLeqn} \end{equation} where $\boldsymbol{y}$ has $\boldsymbol{y}=\boldsymbol{\omega}_e$ and $\boldsymbol{y}=\boldsymbol{0}$ as its two particular solutions. After we obtain the dynamics of the infinitesimal displacement at fixed time, $\delta\boldsymbol{y}$ from (\ref{Eq:CLeqn}), we perform the squared-length analysis: \begin{equation} \frac{d}{dt}\left(\delta\boldsymbol{y}^{T}\boldsymbol{J}\delta\boldsymbol{y}\right)=-2\delta\boldsymbol{y}^{T}\boldsymbol{K}_{r}\delta\boldsymbol{y}\leq\frac{-2\lambda_{\min}(\boldsymbol{K}_{r})}{\lambda_{\max}(\boldsymbol{J})}\left(\delta\boldsymbol{y}^{T}\boldsymbol{J}\delta\boldsymbol{y}\right)\thinspace, \end{equation} where we exploited the skew-symmetric property of the matrix $\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)$. Hence, it follows from the contraction analysis (Theorem \ref{Thm:contraction}) that all system trajectories of (\ref{Eq:CLeqn}) converge exponentially fast to a single trajectory (i.e., $\delta\boldsymbol{y} \rightarrow \boldsymbol{0}$ and $\boldsymbol{\omega}_e\rightarrow \boldsymbol{0}$ ) at a rate of $\frac{\lambda_{\min}(\boldsymbol{K}_{r})}{\lambda_{\max}(\boldsymbol{J})}$. \end{IEEEproof} In the presence of bounded resultant disturbance $\boldsymbol{d}_{\textrm{res},2}$, it follows from Lemma \ref{LM:Robust_contraction_original} that: \begin{equation} \lim_{t \rightarrow \infty} \int_{0}^{\boldsymbol{\omega}_{e}}\|\delta\boldsymbol{y}\|_{2}\leq\frac{\lambda_{\max}(\boldsymbol{J})}{\lambda_{\min}(\boldsymbol{K}_{r})\lambda_{\min}(\boldsymbol{J})}\sup_{t}\|\boldsymbol{d}_{\textrm{res},2}\|_{2} \label{eq:proof_step9} \end{equation} Hence the dynamics of the closed-loop system is bounded in the presence of bounded resultant disturbance $\boldsymbol{d}_{\textrm{res},2}$. We now prove that convergence of $\boldsymbol{\omega}_{e} \rightarrow \boldsymbol{0}$ implies convergence of the system's trajectory to the desired trajectory ($\hat{\boldsymbol{q}} \rightarrow \boldsymbol{q}_d$). It follows from the definition of $\boldsymbol{\omega}_{r}$ that: \begin{align} \boldsymbol{\omega}_{e}=&\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})(\dot{\hat{\boldsymbol{q}}}-\dot{\boldsymbol{q}}_{d})+\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\boldsymbol{\Lambda}_{r}(\hat{\boldsymbol{q}}-\boldsymbol{q}_{d}) \nonumber \\ =&\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})(\dot{\boldsymbol{q}}_{e}+\boldsymbol{\Lambda}_{r}\boldsymbol{q}_{e})\thinspace, \end{align} where $\boldsymbol{q}_{e} = (\hat{\boldsymbol{q}}-\boldsymbol{q}_{d})$. In the absence of $\boldsymbol{\omega}_{e}$, all system trajectories of $ \delta \boldsymbol{q}_e$ will converge exponentially fast to a single trajectory ($\delta \boldsymbol{q}_e \rightarrow 0$) with a rate of $\lambda_{\min}(\boldsymbol{\Lambda}_{r})$, where the virtual displacement $\delta\boldsymbol{q}_e$ is an infinitesimal displacement at fixed time. In the presence of $\boldsymbol{\omega}_{e}$, it follows from Lemma \ref{LM:Robust_contraction_original} and its extension to a hierarchically-combined system (Lemma~\ref{LM:Robust_contraction_hierc}) that: \begin{align} &\lim_{t\rightarrow\infty}\int_{0}^{\boldsymbol{q}_{e}}\|\delta\boldsymbol{q}_{e}\|_{2} \leq\frac{1}{\lambda_{\min}(\boldsymbol{\Lambda}_{r})}\sup_{t}\|\boldsymbol{Z}(\hat{\boldsymbol{q}})\boldsymbol{\omega}_{e}\|_{2} \\ & \leq\frac{\lambda_{\max}(\boldsymbol{J})\sup_{t}\|\boldsymbol{d}_{\textrm{res},2}\|_{2}}{\lambda_{\min}(\boldsymbol{\Lambda}_{r})\lambda_{\min}(\boldsymbol{K}_{r})\lambda_{\min}(\boldsymbol{J})}\left(\sup_{t}\sigma_{\max}(\boldsymbol{Z}(\hat{\boldsymbol{q}}))\right)\thinspace. \nonumber \end{align} Hence we have shown, by constructing a hierarchically-combined closed-loop system of $\boldsymbol{\omega}_{e}$ and $\boldsymbol{q}_{e}$, that the attitude trajectory $\boldsymbol{q}$ will globally exponentially converge to a bounded error ball around the desired trajectory $\boldsymbol{q}_d (t)$. Moreover, it follows from Lemma \ref{LM:Robust_contraction_original} that this control law is finite-gain $\mathcal{L}_p$ stable and input-to-state stable. Hence the control gains $\boldsymbol{K}_{r}$ and $\boldsymbol{\Lambda}_{r}$ can be designed such that the desired error bounds are achieved. \end{IEEEproof} The desired attitude trajectory $\boldsymbol{q}_d (t)$ can be any reference trajectory that we would like the system to track (e.g., motion planning based on optimal control). \subsubsection{Relation to Nonlinear Tracking Control using Euler-Lagrangian Systems \label{sub:EL-Robust-NCL}} In this section, we compare the robust nonlinear tracking control law Eq.~(\ref{eq:first_RNC_MRP}) with the well-known robust nonlinear tracking control for Euler-Lagrangian (EL) systems. We first state the EL system with uncertainty, which is a combined representation of the attitude kinematics and dynamics of the system: \begin{align} & \hat{\boldsymbol{M}}(\hat{\boldsymbol{q}})\ddot{\hat{\boldsymbol{q}}}+\hat{\boldsymbol{C}}(\hat{\boldsymbol{q}},\dot{\hat{\boldsymbol{q}}})\dot{\hat{\boldsymbol{q}}}=\hat{\boldsymbol{\tau}}_{c}+\boldsymbol{\tau}_{\textrm{res}}\thinspace,\label{eq:Lagrangian_formulation-modified} \end{align} where \begin{align} \hat{\boldsymbol{\tau}}_{c}=&\boldsymbol{Z}^{-T}(\hat{\boldsymbol{q}})\boldsymbol{u}_c \\ \hat{\boldsymbol{M}}(\hat{\boldsymbol{q}})=&\boldsymbol{Z}^{-T}(\hat{\boldsymbol{q}})\skew{4}\hat{\boldsymbol{J}}\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}}) \\ \hat{\boldsymbol{C}}(\hat{\boldsymbol{q}},\dot{\hat{\boldsymbol{q}}})=&-\boldsymbol{Z}^{-T}(\hat{\boldsymbol{q}})\skew{4}\hat{\boldsymbol{J}}\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\dot{\boldsymbol{Z}}(\hat{\boldsymbol{q}})\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}}) \nonumber \\ &-\boldsymbol{Z}^{-T}(\hat{\boldsymbol{q}})\thinspace\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\dot{\hat{\boldsymbol{q}}}\right)\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\thinspace \end{align} and $\boldsymbol{\tau}_{\textrm{res}}$ is the resultant disturbance torque acting on the EL system. Note that $\dot{\hat{\boldsymbol{M}}}(\hat{\boldsymbol{q}})-2\hat{\boldsymbol{C}}(\hat{\boldsymbol{q}},\dot{\hat{\boldsymbol{q}}})$ in Eq.~(\ref{eq:Lagrangian_formulation-modified}) is a skew-symmetric matrix, and this property is essential to the stability proof. We use a slight modification of the original robust nonlinear tracking control law Eq.~(\ref{eq:first_RNC_MRP}), which is given by: \begin{equation} \boldsymbol{u}_c =\skew{4}\hat{\boldsymbol{J}}\dot{\boldsymbol{\omega}}_{r}-\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{r}-\boldsymbol{Z}^{T}(\hat{\boldsymbol{q}}) \boldsymbol{K}_{\ell}\boldsymbol{Z}(\hat{\boldsymbol{q}})(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r})\label{eq:alternate_RNC} \end{equation} where $\boldsymbol{K}_{\ell}\in\mathbb{R}^{3\times3}$ and $\boldsymbol{\Lambda}_{\ell}\in\mathbb{R}^{3\times3}$ are positive definite constant matrices. Substituting $\boldsymbol{\omega}_{r}$ into (\ref{eq:alternate_RNC}), using the identity $\dot{\boldsymbol{Z}}^{-1}(\hat{\boldsymbol{q}})=-\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\dot{\boldsymbol{Z}}(\hat{\boldsymbol{q}})\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})$, and multiplying both sides with $\boldsymbol{Z}^{-T}(\hat{\boldsymbol{q}})$ gives us: \begin{equation} \hat{\boldsymbol{\tau}}_{c}=\hat{\boldsymbol{M}}(\hat{\boldsymbol{q}})\ddot{\boldsymbol{q}}_{r}+\hat{\boldsymbol{C}}(\hat{\boldsymbol{q}},\dot{\hat{\boldsymbol{q}}})\dot{\boldsymbol{q}}_{r}-\boldsymbol{K}_{\ell}(\dot{\hat{\boldsymbol{q}}}-\dot{\boldsymbol{q}}_{r})\thinspace,\label{eq:EL_Robust_nonlinear_control_law} \end{equation} where $\dot{\boldsymbol{q}}_{r}=\dot{\boldsymbol{q}}_{d}(t)+\boldsymbol{\Lambda}_{\ell}(\boldsymbol{q}_{d}(t)-\hat{\boldsymbol{q}})$. \begin{remark}[Advantages of (\ref{eq:first_RNC_MRP}) over the control law for EL systems (\ref{eq:EL_Robust_nonlinear_control_law})] \begin{itemize} \item First, the control law for EL system (\ref{eq:EL_Robust_nonlinear_control_law}) extensively uses the measured attitude $\hat{\boldsymbol{q}}$ and its rate $\dot{\hat{\boldsymbol{q}}}$ but does not explicitly use the measured angular velocity $\hat{\boldsymbol{\omega}}$. Moreover, the matrices $\boldsymbol{Z}(\hat{\boldsymbol{q}})$ and $\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})$, which might be susceptible to large fluctuations due to measurement errors in $\hat{\boldsymbol{q}}$, are used multiple times in Eq.~(\ref{eq:EL_Robust_nonlinear_control_law}). For example, the actual control input $\boldsymbol{u}_c$ depends on the computed control signal $\hat{\boldsymbol{\tau}}_{c}$ in Eq.~(\ref{eq:EL_Robust_nonlinear_control_law}) through the relation $\boldsymbol{u}_c=\boldsymbol{Z}^{T}(\hat{\boldsymbol{q}})\hat{\boldsymbol{\tau}}_{c}$ as shown in Eq.~(\ref{eq:Lagrangian_formulation-modified}). On the other hand, the original control law (\ref{eq:first_RNC_MRP}) directly computes $\boldsymbol{u}_c$. \item Second, the stability proof is constructed using a constant matrix $\boldsymbol{J}$, not the nonlinear matrix $\hat{\boldsymbol{M}}(\hat{\boldsymbol{q}})$, thereby allowing for an integral control formulation. \item Third, in Eqs.~(\ref{eq:alternate_RNC}) and (\ref{eq:EL_Robust_nonlinear_control_law}), the terms $\boldsymbol{Z}^{T}(\hat{\boldsymbol{q}}) \boldsymbol{K}_{\ell}\boldsymbol{Z}(\hat{\boldsymbol{q}})$, $\hat{\boldsymbol{M}}(\hat{\boldsymbol{q}})$, and $\hat{\boldsymbol{C}}(\hat{\boldsymbol{q}},\dot{\hat{\boldsymbol{q}}})$ strongly couple the three axes motions using the highly non-diagonal, non-symmetric matrix $\boldsymbol{Z}(\hat{\boldsymbol{q}})$. This strong coupling of the three-axis rotational motions might be undesirable. For example, initially, there might be an error in only one axis, but this coupling will subsequently introduce errors in all three axes. Depending on the inertia matrix, this strong coupling of three-axis motions can be avoided in the proposed control law Eq.~(\ref{eq:first_RNC_MRP}). \end{itemize} \end{remark} \subsubsection{Robust Nonlinear Tracking Control Law with Integral Control \label{sub:Robust-NCL-MRP-Integral}} Another benefit of the original robust nonlinear tracking control law Eq.~(\ref{eq:first_RNC_MRP}) is that it can be augmented with an integral control term in a straight-forward manner to eliminate any constant external disturbance while ensuring exponential convergence of the system's attitude trajectory to the desired attitude trajectory. \begin{theorem}[Robust Nonlinear Integral Control]\label{thm:Integral_RNTCL} For the given desired attitude trajectory $\boldsymbol{q}_{d}(t)$, positive definite constant matrices $\boldsymbol{K}_{m}\in\mathbb{R}^{3\times3}$ and $\boldsymbol{\Lambda}_{m}\in\mathbb{R}^{3\times3}$, and (possibly time-varying) uniformly positive definite diagonal matrix $\boldsymbol{K}_{I}(t)\in\mathbb{R}^{3\times3}$, we define the following control law: \begin{align} \boldsymbol{u}_c =&\skew{4}\hat{\boldsymbol{J}}\dot{\boldsymbol{\omega}}_{r}-\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{r}-\boldsymbol{K}_{m}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r}) \nonumber \\ &-\int_{0}^{t} \boldsymbol{K}_{I}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r})dt \thinspace,\label{eq:RNC_Integral_MRP} \end{align} where \begin{align} \textrm{where}\quad & \boldsymbol{\omega}_{r}=\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\dot{\boldsymbol{q}}_{d}(t)+\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\boldsymbol{\Lambda}_{m}(\boldsymbol{q}_{d}(t)-\hat{\boldsymbol{q}}) \thinspace.\nonumber \end{align} This control law has the following properties: \begin{itemize} \item This control law guarantees global exponential convergence of the system's trajectory to $\boldsymbol{q}_{d}(t)$ for any constant external disturbance (constant bias) acting on the system. \item In the presence of time-varying disturbance $\boldsymbol{d}_{\textrm{res},2}$ with a bounded rate $\dot{\boldsymbol{d}}_{\textrm{res},2}$, this control law guarantees that $\boldsymbol{q}(t)$ will globally exponentially converge to an error ball around $\boldsymbol{q}_{d}(t)$, whose size is determined by $\dot{\boldsymbol{d}}_{\textrm{res},2}$ (i.e., finite-gain $\mathcal{L}_p$ stable and ISS with respect to disturbance inputs with bounded rates). \end{itemize}\end{theorem} \begin{IEEEproof} The closed-loop dynamics is given by: \begin{equation} \boldsymbol{J}\dot{\boldsymbol{\omega}}_{e}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{e}+\boldsymbol{K}_{m}\boldsymbol{\omega}_{e} + \int_{0}^{t} \boldsymbol{K}_{I} \boldsymbol{\omega}_e dt = \boldsymbol{d}_{\textrm{res},2} \thinspace, \label{eq:proof_step8} \end{equation} where $\boldsymbol{\omega}_e = (\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r})$ and $\boldsymbol{d}_{\textrm{res},2}$ is defined in Eq.~(\ref{eq:proof_step7}). We first show that this control law can eliminate a constant external disturbance, hence replacing $\boldsymbol{d}_{\textrm{res},2}$ in Eq.~(\ref{eq:proof_step8}) with a constant disturbance term $\boldsymbol{d}_{\textrm{const}}$ gives us: \begin{equation} \boldsymbol{J} \dot{\boldsymbol{\omega}}_e - \boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{e} + \boldsymbol{K}_{m} \boldsymbol{\omega}_e + \int_{0}^{t} \boldsymbol{K}_{I} \boldsymbol{\omega}_e dt = \boldsymbol{d}_{\textrm{const}} \thinspace . \label{eq:proof_step2} \end{equation} Differentiating Eq.~(\ref{eq:proof_step2}) with respect to time and setting $\dot{\boldsymbol{d}}_{\textrm{const}}=0$, we get: \begin{equation} \boldsymbol{J}\ddot{\boldsymbol{\omega}}_{e}+\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right)\dot{\boldsymbol{\omega}}_{e}+\left(\boldsymbol{K}_{I}-\boldsymbol{S}\left(\boldsymbol{J}\dot{\hat{\boldsymbol{\omega}}}\right)\right)\boldsymbol{\omega}_{e}=0\thinspace. \label{eq:proof_step3} \end{equation} If we show that Eq.~(\ref{eq:proof_step3}) is contracting, then we prove our claim (i) that the given control law can successfully eliminate any constant external disturbance acting on the system. In order to prove Eq.~(\ref{eq:proof_step3}) is globally exponentially stable, we consider two cases which depend on the time-varying nature of the matrix $\boldsymbol{K}_{I}$. We first consider the case where $\boldsymbol{K}_{I}$ is a constant positive definite diagonal matrix. The matrix $\boldsymbol{K}_{I}$ can be decomposed into $\boldsymbol{K}_{I} = \boldsymbol{K}_{I}^{\frac{1}{2}} \boldsymbol{K}_{I}^{\frac{1}{2}}$, where the matrix $\boldsymbol{K}_{I}^{\frac{1}{2}}$ is also a constant positive definite diagonal matrix. We introduce the term $\boldsymbol{y}_1$, where $\dot{\boldsymbol{y}}_{1}$ is defined as $\dot{\boldsymbol{y}}_{1}= \boldsymbol{K}_{I}^{\frac{1}{2}} \boldsymbol{\omega}_{e}$. Then we can write $\dot{\boldsymbol{\omega}}_e$ as: \begin{equation} \dot{\boldsymbol{\omega}}_{e}=-(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right)\boldsymbol{\omega}_{e} -(\boldsymbol{J})^{-1} \boldsymbol{K}_{I}^{\frac{1}{2}} \boldsymbol{y}_{1}\thinspace. \label{eq:proof_step4} \end{equation} Note that differentiating Eq.~(\ref{eq:proof_step4}) with respect to time and substituting $\dot{\boldsymbol{y}}_{1}$ gives us Eq.~(\ref{eq:proof_step3}). Therefore, these equations can be written in matrix form as: \begin{equation} \begin{bmatrix} \dot{\boldsymbol{\omega}}_{e}\\ \dot{\boldsymbol{y}}_{1} \end{bmatrix}=\left[\begin{smallmatrix} -(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right) & -(\boldsymbol{J})^{-1} \boldsymbol{K}_{I}^{\frac{1}{2}} \\ \boldsymbol{K}_{I}^{\frac{1}{2}} & \boldsymbol{0} \end{smallmatrix}\right] \begin{bmatrix} \boldsymbol{\omega}_{e}\\ \boldsymbol{y}_{1} \end{bmatrix} = \boldsymbol{F} \begin{bmatrix} \boldsymbol{\omega}_{e}\\ \boldsymbol{y}_{1} \end{bmatrix} \thinspace. \label{eq:proof_step5} \end{equation} We define the positive definite matrix $\boldsymbol{\Xi}=\left[\begin{smallmatrix}\boldsymbol{J} & b\mathbf{I}\\ b\mathbf{I} & \mathbf{I}\end{smallmatrix}\right]$, where $b$ is a constant between $0 < b < \lambda_{\max}^{\frac{1}{2}}(\boldsymbol{J})$. The symmetric matrix $(\boldsymbol{\Xi F})_\mathrm{sym} = \frac{1}{2}\left((\boldsymbol{\Xi F})+(\boldsymbol{\Xi F})^{T}\right)$ is given by: \begin{align} (\boldsymbol{\Xi F})_\mathrm{sym} & = - \left[\begin{smallmatrix} \frac{\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T}}{2}-b\boldsymbol{K}_{I}^{\frac{1}{2}} & \frac{b}{2}\left[(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right)\right]^{T}\\ \frac{b}{2}(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right) & \frac{b}{2}\left((\boldsymbol{J})^{-1}\boldsymbol{K}_{I}^{\frac{1}{2}}+\boldsymbol{K}_{I}^{\frac{1}{2}}(\boldsymbol{J})^{-1}\right) \end{smallmatrix}\right] \thinspace . \nonumber \end{align} The sufficient conditions for the matrix $(\boldsymbol{\Xi}\boldsymbol{F})_{\mathrm{sym}}$ to be negative definite are: \begin{align} & -\frac{\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T}}{2}+b\boldsymbol{K}_{I}^{\frac{1}{2}}<0\thinspace \\ &-\frac{b}{2}\left((\boldsymbol{J})^{-1}\boldsymbol{K}_{I}^{\frac{1}{2}}+\boldsymbol{K}_{I}^{\frac{1}{2}}(\boldsymbol{J})^{-1}\right) <0\thinspace, \label{eq:proof_condition2} \\ & \tfrac{\lambda_{\max}\left(-\frac{\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T}}{2}+b\boldsymbol{K}_{I}^{\frac{1}{2}}\right)\lambda_{\max}\left(-\frac{b}{2}\left((\boldsymbol{J})^{-1}\boldsymbol{K}_{I}^{\frac{1}{2}}+\boldsymbol{K}_{I}^{\frac{1}{2}}(\boldsymbol{J})^{-1}\right)\right)}{\sigma_{\max}^{2}\left(-\frac{b}{2}\left[(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right)\right]^{T}\right)} > 1 \thinspace. \label{eq:proof_condition3} \end{align} Equation~(\ref{eq:proof_condition2}) is satisfied by $0<b<\frac{\lambda_{\min}(\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T})}{2\lambda_{\max}(\boldsymbol{K}_{I}^{\frac{1}{2}})}$. Equation~(\ref{eq:proof_condition3}) is satisfied by $b<b_3$, where $b_3$ is given by: \begin{equation} b_3 = \frac{\lambda_{\max}\left(\frac{\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T}}{2}\right)\lambda_{\min}\left((\boldsymbol{J})^{-1}\boldsymbol{K}_{I}^{\frac{1}{2}}+\boldsymbol{K}_{I}^{\frac{1}{2}}(\boldsymbol{J})^{-1}\right)}{B_1+B_2} \thinspace. \end{equation} where \begin{align} B_1 =& \frac{1}{2}\sigma_{\max}^{2}\left[(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right)\right]^{T} \\ B_2 =& \lambda_{\min}\left(\boldsymbol{K}_{I}^{\frac{1}{2}}\right)\lambda_{\min}\left((\boldsymbol{J})^{-1}\boldsymbol{K}_{I}^{\frac{1}{2}}+\boldsymbol{K}_{I}^{\frac{1}{2}}(\boldsymbol{J})^{-1}\right). \end{align} Therefore, the matrix $(\boldsymbol{\Xi F})_\mathrm{sym}$ is negative definite if $b$ is chosen such that $0 <b < \min ( \lambda_{\max}^{\frac{1}{2}}(\boldsymbol{J}),\thinspace \frac{\lambda_{\min}(\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T})}{2\lambda_{\max}(\boldsymbol{K}_{I}^{\frac{1}{2}})}, \thinspace b_{3} ) $. We define the generalized virtual displacement $\delta\boldsymbol{z}=[\delta\boldsymbol{\omega}_{e},\thinspace\delta\boldsymbol{y}_{1}]^{T}$, where $\delta\boldsymbol{\omega}_{e}$ and $\delta\boldsymbol{y}_{1}$ are infinitesimal displacements at fixed time. Therefore, \begin{align} &\frac{d}{dt}\left(\delta\boldsymbol{z}^{T} \boldsymbol{\Xi} \delta\boldsymbol{z}\right)=\delta\boldsymbol{z}^{T} \left( (\boldsymbol{\Xi F}) + (\boldsymbol{\Xi F})^T \right) \delta\boldsymbol{z} \\ \leq& 2\lambda_{\max}((\boldsymbol{\Xi F})_\mathrm{sym})\|\delta\boldsymbol{z}\|_{2}^2 \leq \frac{2\lambda_{\max}((\boldsymbol{\Xi F} )_\mathrm{sym})}{\lambda_{\max}(\boldsymbol{\Xi})} \left(\delta\boldsymbol{z}^{T} \boldsymbol{\Xi} \delta\boldsymbol{z}\right) \nonumber. \end{align} Hence, it follows from the contraction analysis (Theorem~\ref{Thm:contraction}) that all system trajectories converge exponentially fast to a single trajectory ($\delta\boldsymbol{z} \rightarrow 0$ and $\delta\boldsymbol{\omega}_e \rightarrow 0$) at a rate of $\frac{-\lambda_{\max}((\boldsymbol{\Xi F} )_\mathrm{sym})}{\lambda_{\max}(\boldsymbol{\Xi})}$. Moreover, in the presence of bounded time-varying resultant disturbance $\boldsymbol{d}_{\textrm{res},2}$ with bounded $\dot{\boldsymbol{d}}_{\textrm{res},2}$, we get from Lemma~\ref{LM:Robust_contraction_original}: \begin{align} &\lim_{t \rightarrow \infty} \int_{0}^{\boldsymbol{\omega}_{e}}\|\delta\boldsymbol{\omega}_{e}\|_{2} \nonumber \\ &\leq \frac{(b+1) \lambda_{\max}(\boldsymbol{\Xi}) \sup_t \lambda_{\max}(\boldsymbol{K}_{I}^{-\frac{1}{2}})\sup_{t}\| \dot{\boldsymbol{d}}_{\textrm{res},2}\|_{2}}{-\lambda_{\max}((\boldsymbol{\Xi F} )_\mathrm{sym}) }. \end{align} where $\|\delta\boldsymbol{\omega}_{e}\|_{2}\leq\|\delta\boldsymbol{z}\|_{2}$ and $\lambda_{\min}(\boldsymbol{\Xi})>1$ are used. Also, note that the disturbance term in the righthand side of Eq.~(\ref{eq:proof_step5}) is $(\mathbf{0};-\boldsymbol{K}_{I}^{-\frac{1}{2}}\dot{\boldsymbol{d}}_{\textrm{res},2})$. The fact that convergence of $\boldsymbol{\omega}_{e} \rightarrow \boldsymbol{0}$ implies convergence of the system's trajectory to the desired trajectory ($\hat{\boldsymbol{q}} \rightarrow \boldsymbol{q}_d$) is already presented in the proof of Theorem \ref{thm:first_RNTCL}. This completes the proof. \end{IEEEproof} If both $\boldsymbol{K}_{I}$ and $\dot{\boldsymbol{K}}_{I}$ are uniformly positive definite diagonal matrices, there exits a simpler proof, which is presented here. The matrix $\dot{\boldsymbol{K}}_{I}$ can also be decomposed into $\dot{\boldsymbol{K}}_{I} = \dot{\boldsymbol{K}}_{I}^{\frac{1}{2}} \dot{\boldsymbol{K}}_{I}^{\frac{1}{2}}$. We introduce another term $\boldsymbol{y}_2$, where: \begin{equation} \dot{\boldsymbol{y}}_{2}=\boldsymbol{K}_{I}^{\frac{1}{2}} \boldsymbol{\omega}_{e} - \boldsymbol{K}_{I}^{-\frac{1}{2}} \dot{\boldsymbol{K}}_{I}^{\frac{1}{2}} \boldsymbol{y}_{2}\thinspace. \end{equation} Once again, $\dot{\boldsymbol{\omega}}_e$ can be written in a form similar to that of Eq.~(\ref{eq:proof_step4}). The matrix form of these equations is given by: \begin{equation} \begin{bmatrix} \dot{\boldsymbol{\omega}}_{e}\\ \dot{\boldsymbol{y}}_{2} \end{bmatrix}= \left[\begin{smallmatrix} -(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right) & -(\boldsymbol{J})^{-1} \boldsymbol{K}_{I}^{\frac{1}{2}} \\ \boldsymbol{K}_{I}^{\frac{1}{2}} & - \boldsymbol{K}_{I}^{-\frac{1}{2}} \dot{\boldsymbol{K}}_{I}^{\frac{1}{2}} \end{smallmatrix}\right]\begin{bmatrix} \boldsymbol{\omega}_{e}\\ \boldsymbol{y}_{2} \end{bmatrix} = \tilde{\boldsymbol{F}} \begin{bmatrix} \boldsymbol{\omega}_{e}\\ \boldsymbol{y}_{2} \end{bmatrix} \thinspace. \label{eq:proof_step6} \end{equation} Clearly, the symmetric part of the matrix $\boldsymbol{\Xi} \tilde{\boldsymbol{F}}$ is negative definite. Therefore, \begin{align} \frac{d}{dt}\left(\delta\boldsymbol{z}^{T} \boldsymbol{\Xi} \delta\boldsymbol{z}\right)&=\delta\boldsymbol{z}^{T} \left( (\boldsymbol{\Xi}\tilde{\boldsymbol{F}}) + (\boldsymbol{\Xi}\tilde{\boldsymbol{F}})^T \right) \delta\boldsymbol{z} \nonumber \\ &\leq 2\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym})\|\delta\boldsymbol{z}\|_{2}^2 \nonumber \\ &\leq \frac{2\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym})}{\lambda_{\max}(\boldsymbol{J})} \left(\delta\boldsymbol{z}^{T} \boldsymbol{\Xi} \delta\boldsymbol{z}\right) \end{align} where $(\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym}=\frac{(\boldsymbol{\Xi} \tilde{\boldsymbol{F}})+(\boldsymbol{\Xi} \tilde{\boldsymbol{F}})^T}{2}$. Also, $\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym}) < 0$ and is bounded as $\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym}) \leq - \min ( \lambda_{\min}(\boldsymbol{K}_{m}), \inf_{t} ( \lambda_{\min}(\boldsymbol{K}_{I}^{-\frac{1}{2}} \dot{\boldsymbol{K}}_{I}^{\frac{1}{2}}) ) )$. Hence, it follows from the contraction analysis that all system trajectories converge exponentially fast to a single trajectory at a rate of $\frac{-\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym})}{\lambda_{\max}(\boldsymbol{J})}$. Moreover, in the presence of bounded $\boldsymbol{d}_{\textrm{res},2}$ and $\dot{\boldsymbol{d}}_{\textrm{res},2}$, we get from Lemma \ref{LM:Robust_contraction_original} that: \begin{align} &\lim_{t \rightarrow \infty} \int_{0}^{\boldsymbol{\omega}_{e}}\|\delta\boldsymbol{\omega}_{e}\|_{2} \nonumber \\ &\leq \frac{\lambda_{\max}(\boldsymbol{J}) \sup_t \lambda_{\max}(\boldsymbol{K}_{I}^{-\frac{1}{2}}) \sup_{t}\| \dot{\boldsymbol{d}}_{\textrm{res},2}\|_{2} }{-\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym}) } \thinspace . \end{align} where $\|\delta\boldsymbol{\omega}_{e}\|_{2}\leq\|\delta\boldsymbol{z}\|_{2}$ and $\lambda_{\min}(\boldsymbol{J})>1$ are used. Also, note that the disturbance term in the righthand side of Eq.~(\ref{eq:proof_step6}) is $(\mathbf{0};\boldsymbol{K}_{I}^{-\frac{1}{2}}\dot{\boldsymbol{d}}_{\textrm{res},2})$. \end{IEEEproof} \begin{remark} Note that the second block diagonal matrix of the Jacobin $\boldsymbol{F}$ in Eq.~(\ref{eq:proof_step5}) is $\mathbf{0}$, which usually yields a semi-contracting system with global asymptotic stability. For example, $\boldsymbol{F}$ from Eq.~(\ref{eq:proof_step5}) and $\boldsymbol{\Theta}=\left[\begin{smallmatrix}\boldsymbol{J} & \boldsymbol{0}\\ \boldsymbol{0} & \mathbf{I}\end{smallmatrix}\right]$ results in a semi-contracting system due to $\frac{1}{2}\left((\boldsymbol{\Theta F})+(\boldsymbol{\Theta F})^{T}\right)=\left[\begin{smallmatrix} -\boldsymbol{K}_{m} & \boldsymbol{0}\\ \boldsymbol{0} & \boldsymbol{0} \end{smallmatrix}\right]$. Similarly, the following adaptive control law also yields global asymptotic stability. In contrast, Theorem~\ref{thm:Integral_RNTCL} presents a stronger result with global exponential stability. \end{remark} \subsubsection{Nonlinear Adaptive Control\label{sub:Adaptive-NCL}} \begin{remark}[Nonlinear Adaptive Attitude Control] Let the parameter $\hat{\boldsymbol{a}}$ capture the six uncertain terms in the inertia tensor $\boldsymbol{J}$. The resulting adaptive nonlinear tracking control law and the tuning law are given by: \begin{align} \boldsymbol{u}_c =& \boldsymbol{Y}\hat{\boldsymbol{a}} -\boldsymbol{K}_{r}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r}) \\ \dot{\hat{\boldsymbol{a}}} =&-\boldsymbol{\Gamma}_{r}\textrm{Proj}\left(\hat{\boldsymbol{a}},\boldsymbol{Y}^{T}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r})\right) \thinspace,\label{eq:RNC_adaptive} \end{align} where $\boldsymbol{Y}\hat{\boldsymbol{a}}=\skew{4}\hat{\boldsymbol{J}}\dot{\boldsymbol{\omega}}_{r}-\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{r}$, $\boldsymbol{\omega}_{r}$ is defined in Eq.~(\ref{eq:first_RNC_MRP}), and $\boldsymbol{\Gamma}_{r}\in\mathbb{R}^{6\times6}$ is a positive-definite diagonal matrix. For some boundary function $f(\boldsymbol{\theta})$ (e.g., $f(\boldsymbol{\theta})=\frac{(\boldsymbol{\theta}^{T}\boldsymbol{\theta}-\theta_{\textrm{max}}^{2})}{\epsilon_{\theta}\theta_{\textrm{max}}^{2}}$ ), the projection operator is given by $ \textrm{Proj}(\boldsymbol{\theta},\boldsymbol{x}) = \boldsymbol{x}-\frac{\nabla f(\boldsymbol{\theta})\nabla f(\boldsymbol{\theta})^{T}}{\|\nabla f(\boldsymbol{\theta})\|^{2}}\boldsymbol{x}f(\boldsymbol{\theta})$ if $f(\boldsymbol{\theta})>0, \thinspace \nabla f(\boldsymbol{\theta})^{T}\boldsymbol{x}>0$; and $\boldsymbol{x}$ otherwise. The proof of global asymptotic stability of using Eq.~(\ref{eq:RNC_adaptive}) for the disturbance-free system is straightforward. The stability result of adaptive control is only globally asymptotic because its closed-loop system of the states $(\boldsymbol{\omega}_{e},\hat{\boldsymbol{a}})^T$ yields a negative semidefinite Jacobian matrix $\left[\begin{smallmatrix}-\boldsymbol{K}_{r} & \mathbf{0}\\ \mathbf{0}& \mathbf{0}\end{smallmatrix}\right]$ (also, see Eq.~(\ref{eq:proof_step5})). However, the use of a projection operator in Eq.~(\ref{eq:RNC_adaptive}) permits Input-to-State Stability (ISS). \end{remark} \subsubsection{Robust Nonlinear Tracking Control Law on SO($3$) \label{sub:Robust-NCL-SO3}} It is shown in Table \ref{tab:Properties-Attitude-Rep} that the rotation matrix ($\boldsymbol{R}\in$ SO($3$)) is a global and unique attitude representation. In this section, we present a variation of Eq.~(\ref{eq:first_RNC_MRP}) that exponentially stabilizes the attitude dynamics from almost all initial conditions on SO($3$), i.e., all initial conditions except for those starting from a two-dimensional subset of SO($3$). Even global asymptotic convergence is not possible for any continuous feedback control law in SO($3$). In this section, we present a novel control law that guarantees exponential convergence to the desired trajectory for almost all initial conditions on SO($3$). Another control law that also guarantees almost-global exponential convergence is presented in~\cite{Ref:Lee12}, but the control law and proof techniques are substantially different from the existing Lyapunov-based approach used in~\cite{Ref:Lee12}. Let $\boldsymbol{R}_{d}(t)\in$ SO($3$) denote the desired attitude trajectory, which is obtained from the desired attitude trajectory $\boldsymbol{q}_{d}(t)$ using the transformations given in Table \ref{tab:Properties-Attitude-Rep}. Let the inverse of the $\boldsymbol{S}(\cdot)$ map be the $\boldsymbol{\vee}(\cdot)$ map, whose input is a skew-symmetric matrix and is defined as $\boldsymbol{\vee} (\boldsymbol{S}(\boldsymbol{\omega})) = \boldsymbol{\omega}$. We now define the following notations \cite{Ref:Lee12}: \begin{align} \boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}} =&\frac{1}{2\sqrt{1+\textrm{tr}(\boldsymbol{R}_{d}^{T}\skew{4}\hat{\boldsymbol{R}})}} \left( \boldsymbol{\vee}\left(\boldsymbol{R}_{d}^{T}\skew{4}\hat{\boldsymbol{R}}-\skew{4}\hat{\boldsymbol{R}}^{T}\boldsymbol{R}_{d}\right) \right) \\ \boldsymbol{e}_{\hat{\boldsymbol{\omega}}} =&\hat{\boldsymbol{\omega}}-\skew{4}\hat{\boldsymbol{R}}^{T}\boldsymbol{R}_{d} \left( \boldsymbol{\vee}\left(\boldsymbol{R}_{d}^{T} \dot{\boldsymbol{R}}_{d}\right) \right)\thinspace, \end{align} where $\textrm{tr}(\cdot)$ is the trace of the matrix. Here $\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}$ represents the attitude error vector between the current measured attitude $\skew{4}\hat{\boldsymbol{R}}$ and the desired attitude $\boldsymbol{R}_{d}$. For any $\boldsymbol{R}_{d}^{T}\skew{4}\hat{\boldsymbol{R}}$, its trace is bounded by $-1\leq\textrm{tr}(\boldsymbol{R}_{d}^{T}\skew{4}\hat{\boldsymbol{R}})\leq3$. Hence $\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}$ is not defined only on the two-dimensional subset of SO($3$) where $\textrm{tr}(\boldsymbol{R}_{d}^{T}\skew{4}\hat{\boldsymbol{R}})=-1$, i.e., $\skew{4}\hat{\boldsymbol{R}}=\boldsymbol{R}_{d}\exp(\pm\pi\boldsymbol{S}(\boldsymbol{\kappa}))$, where $\boldsymbol{\kappa}\in\mathbb{S}^{2}$. Finally, we define the matrix $\boldsymbol{E}(\skew{4}\hat{\boldsymbol{R}},\boldsymbol{R}_{d})$ as follows: \begin{align} \frac{d\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}}{dt}=& \frac{1}{2\sqrt{1+\textrm{tr}(\boldsymbol{R}_{d}^{T}\skew{4}\hat{\boldsymbol{R}})}}\left(\textrm{tr}(\skew{4}\hat{\boldsymbol{R}}^{T}\boldsymbol{R}_{d})\mathbf{I}-\skew{4}\hat{\boldsymbol{R}}^{T}\boldsymbol{R}_{d}+2\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}^{T}\right) \nonumber \\ \boldsymbol{e}_{\hat{\boldsymbol{\omega}}} =& \boldsymbol{E}(\skew{4}\hat{\boldsymbol{R}},\boldsymbol{R}_{d}) \boldsymbol{e}_{\hat{\boldsymbol{\omega}}}\thinspace. \end{align} \begin{theorem}[Robust Nonlinear Tracking Control Law on SO($3$)]For the desired attitude trajectory $\boldsymbol{R}_{d}(t)\in \mathrm{SO(3)}$ and positive definite matrices $\boldsymbol{K}_{e}\in\mathbb{R}^{3\times3}$ and $\boldsymbol{\Lambda}_{e}\in\mathbb{R}^{3\times3}$, we define the following control law: \begin{align} & \boldsymbol{u}_c=\skew{4}\hat{\boldsymbol{J}}\dot{\boldsymbol{\omega}}_{r}-\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{r}-\boldsymbol{K}_{e}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r})\thinspace,\label{eq:RNC_SO3}\\ \textrm{where}\quad & \boldsymbol{\omega}_{r}=\skew{4}\hat{\boldsymbol{R}}^{T}\boldsymbol{R}_{d} \left( \boldsymbol{\vee}\left(\boldsymbol{R}_{d}^{T} \dot{\boldsymbol{R}}_{d}\right) \right) - \boldsymbol{\Lambda}_{e} \boldsymbol{E}^{T}(\skew{4}\hat{\boldsymbol{R}},\boldsymbol{R}_{d}) \boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}\thinspace.\nonumber \end{align} In the absence of disturbances or uncertainties, this control law guarantees exponential convergence of the system's trajectory $\boldsymbol{R}(t)\in \mathrm{SO(3)}$ to the desired trajectory $\boldsymbol{R}_{d}(t)$ for almost all initial conditions, i.e., all initial conditions that are not on the two-dimensional subset of SO($3$) where $\skew{4}\hat{\boldsymbol{R}}(0)=\boldsymbol{R}_{d}(0)\exp(\pm\pi\boldsymbol{S}(\boldsymbol{\kappa}))$, where $\boldsymbol{\kappa}\in\mathbb{S}^{2}$. Moreover, in the presence of bounded disturbances or uncertainties, this control law guarantees that $\boldsymbol{R}(t)$ will exponentially converge to a bounded error ball around $\boldsymbol{R}_{d}(t)$. \end{theorem} \begin{IEEEproof} The closed-loop dynamics obtained by substituting $\boldsymbol{u}_c$ from Eq.~(\ref{eq:RNC_SO3}) into Eq.~(\ref{eq:dynamics}) is the same as Eq.~(\ref{eq:proof_step7}) in the proof of Theorem \ref{thm:first_RNTCL}. Hence we can directly conclude from that proof that all system trajectories of $\boldsymbol{\omega}_e$ converge exponentially fast to a single trajectory ($\boldsymbol{\omega}_e \rightarrow 0$) at a rate of $\frac{\lambda_{\min}(\boldsymbol{K}_{e})}{\lambda_{\max}(\boldsymbol{J})}$. Moreover, in the presence of bounded resultant disturbance $\boldsymbol{d}_{\textrm{res},2}$, $\lim_{t \rightarrow \infty} \int_{0}^{\boldsymbol{\omega}_{e}}\|\delta\boldsymbol{y}\|_{2}$ is bounded by Eq.~(\ref{eq:proof_step9}). Now we show that convergence of $\boldsymbol{\omega}_{e}$ implies convergence of the system's trajectory to the desired trajectory ($\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}} \rightarrow 0$). It follows from the definition of $\boldsymbol{\omega}_{r}$ that: \begin{align} \boldsymbol{\omega}_{e}=&\hat{\boldsymbol{\omega}}-\skew{4}\hat{\boldsymbol{R}}^{T}\boldsymbol{R}_{d} \left( \boldsymbol{\vee}\left(\boldsymbol{R}_{d}^{T} \dot{\boldsymbol{R}}_{d}\right) \right) + \boldsymbol{\Lambda}_{e} \boldsymbol{E}^{T} \boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}} \nonumber \\ =& \boldsymbol{E}^{-1}\left(\dot{\boldsymbol{e}}_{\skew{4}\hat{\boldsymbol{R}}} + \boldsymbol{E} \boldsymbol{\Lambda}_{e} \boldsymbol{E}^{T} \boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}\right)\thinspace. \end{align} In the absence of $\boldsymbol{\omega}_{e}$, all system trajectories of $ \delta \boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}$ will converge exponentially fast to a single trajectory ($\delta \boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}} \rightarrow 0$) with a rate of $\lambda_{\min}(\boldsymbol{E} \boldsymbol{\Lambda}_{e} \boldsymbol{E}^{T})$, where $\boldsymbol{E} \boldsymbol{\Lambda}_{e} \boldsymbol{E}^{T}$ is also a positive definite matrix. In the presence of $\boldsymbol{\omega}_{e}$, it follows from Lemma 4 in \cite{Ref:phasesync} that: \begin{align} \lim_{t \rightarrow \infty} \int_{0}^{\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}}\|\delta\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}\|_{2} & \leq\frac{\lambda_{\max}(\boldsymbol{J})\sup_{t}\sigma_{\max}(\boldsymbol{E})\sup_{t}\|\boldsymbol{d}_{\textrm{res},2}\|_{2}}{\lambda_{\min}(\boldsymbol{E} \boldsymbol{\Lambda}_{e} \boldsymbol{E}^{T})\lambda_{\min}(\boldsymbol{K}_{e})\lambda_{\min}(\boldsymbol{J})}. \end{align} Note that $\|\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}\|_2 \rightarrow \infty$ if $\skew{4}\hat{\boldsymbol{R}} \rightarrow\boldsymbol{R}_{d}\exp(\pm\pi\boldsymbol{S}(\boldsymbol{\kappa}))$, where $\boldsymbol{\kappa}\in\mathbb{S}^{2}$. On the other hand, for any valid initial condition, $\|\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}\|_2$ is always bounded and exponentially decreasing till it reaches the error ball. This implies that once the system starts from a valid initial condition, it can never go towards the two-dimensional subset of SO($3$) due to exponential convergence. Hence we have shown, using a hierarchical closed-loop system, that the attitude error vector $\boldsymbol{e}_{\skew{4}\hat{\boldsymbol{R}}}$ exponentially converges to the error bound for almost all initial conditions (except for those initial conditions in the two-dimensional subset of SO($3$)). \end{IEEEproof} \subsection{Nonlinear Position Tracking Controller of Quadcopters}\label{sec:position_cont} The position control law forms the outer-loop, which generates the desired attitude trajectory $\boldsymbol{q}_d(t)$ for the attitude tracking controller presented in Sec.~\ref{sec:att_cont} as a function of the position errors ($\mathbf{x}$-$\mathbf{x}_d$). The desired vehicle trajectory $\mathbf{x}_d$ and the estimated vehicle position $\mathbf{x}$ are computed in the local reference frame (e.g., local obstacle map) that is evolving in the absence of a global map and $\mathbf{x}_d$ is provided by the algorithms presented in \cite{Ref:sato}. We used Euler angles for $\boldsymbol{q}$ in our experiments. The translational motion along the three axes can be given as \begin{align} m\ddot{x} = \overline{X}, \ m\ddot{y} = \overline{Y}, \ m\ddot{z} = -mg + \overline{Z} \label{Eq:x_ddot} \end{align} where $ \overline{X} =F(\cos\psi\cos\phi\sin\theta + \sin\psi\sin\phi)$, $\overline{Y}=F(\sin\psi\cos\phi\sin\theta - \cos\psi\sin\phi)$, $\overline{Z}=F\cos\phi\cos\theta$, $g$ is the acceleration due to gravity, and $m$ is the mass of the quadrotor. Also, ($\phi$, $\theta$, $\psi$) are the Euler angles of the quadrotor and $F$ is the total force generated by the quadrotor. In order to control the position of the quadrotor, a PID controller to track the desired position trajectory along each of the three axes is sufficient. For example, for the z-axis, $\overline{Z} = m(g + \ddot{z}_d + K_{D_z}(\dot{z}_d - \dot{z}) + K_{P_z}(z_d - z) + K_{I_z}\int(z_d - z)dt).$ The PID controller (with weight cancellation for the z-axis) yields the closed-loop dynamics in linear form, thereby yielding an exact method of computing the gains for global exponential convergence to the desired position trajectory. Since the yaw angle ($\psi$) can be decoupled from the linear motion of the quadrotor, i.e., the quadrotor can yaw while holding its position, a separate PID controller can be applied to control it to the desired yaw angle ($\psi_d$). Hence, the vertical force and desired attitude for any of the nonlinear attitude tracking controller discussed in the previous subsections are given as: {\small \begin{align} &F_d = \sqrt{\overline{X}^2 + \overline{Y}^2 + \overline{Z}^2}, ~\phi_d = \sin^{-1}(\frac{\overline{X}\sin\psi_d - \overline{Y}\cos\psi_d}{F_d}), \nonumber \\ &\theta_d = \tan^{-1}\left(\frac{\overline{X}\cos\psi_d + \overline{Y}\sin\psi_d}{\overline{Z}}\right)\label{Eq:final_theta} \end{align} } These attitude and desired force commands are then tracked by the inner attitude control loop thus completing the entire control algorithm as shown in Fig. 7 of \cite{Ref:sato}. As a result, the squared values of four motor RPMs $\boldsymbol{n^2}=(n_1^2, n_2^2, n_3^2, n_4^2)^T$ can be computed from \begin{equation} \boldsymbol{n^2} = \boldsymbol{B}^{-1} (F_d,\boldsymbol{u}^T)^T \end{equation} where $F_d$ is the desired force from (\ref{Eq:final_theta}) and the vector $\boldsymbol{u}=(u_x, u_y,u_z)^T$ is the control torque from one of the exponentially-stabilizing attitude control laws given in the previous section. Also, the $4\times4$ matrix $\boldsymbol{B}$ is a function of the thrust ($C_T$) and the power coefficients ($C_P$). \section{Convex Properties of Contraction Analysis}\label{sec:convex} Since the differential (virtual) dynamics of $\delta x$ used in contraction analysis is a Linear Time-Varying (LTV) system, global exponential stability can be studied using a quadratic Lyapunov function of $\delta x$, $V=\delta x^T M(x,t)\delta x$~\cite{contraction}, as opposed to the Lyapunov technique where $V$ could be any function of $x$. Therefore, designing $V$ reduces to finding a positive definite metric $M(x,t)$~\cite{AYLWARD20082163},~\cite{ncm}, and this property can be used to derive several computationally-efficient algorithms to design an optimal contraction metric/optimal Lyapunov function for exponential incremental stability analysis of nonlinear systems. The differential nature of contraction analysis also leads to a nonlinear analog to the classical estimation and control duality between the Kalman filter and Linear Quadratic Regulator (LQR) in LTV systems as we will see later on. \subsection{Optimal Contraction Metrics} Consider the following perturbed nonlinear system: \begin{align} \label{nonlin_per} \dot{x}(t) = f(x(t),t)+d(t) \end{align} where $t\in \mathbb{R}_{\geq0}$, $x:\mathbb{R}_{\geq0} \to \mathbb{R}^{n}$, $f:\mathbb{R}^n\times\mathbb{R}_{\geq0} \to \mathbb{R}^{n}$, and $d:\mathbb{R}_{\geq0} \to \mathbb{R}^{n}$ with $\overline{d}=\sup_{t \geq 0}\|d(t)\| < +\infty$. \begin{theorem} \label{RobustCont} Let $x_1(t)$ and $x_2(t)$ be the solution of (\ref{nonlin_per}) with $d(t) = 0$ and $d(t) \neq 0$, respectively. Suppose there exist $M(x,t) = \Theta (x,t)^T\Theta(x,t) \succ 0$, $\lambda > 0$, and $0 < \underline{\omega},\overline{\omega} < \infty$ s.t.{} \begin{align} \label{deterministic_contraction} &\dot{M}(x,t)+\sym{\left(M(x,t)\frac{\partial f(x,t)}{\partial x}\right)} \preceq -2\lambda M(x,t),~\forall x,t \\ \label{Mcon} & \overline{\omega}^{-1}I \preceq M(x,t) \preceq \underline{\omega}^{-1}I,~\forall x,t. \end{align} Then the smallest path integral is exponentially bounded, thereby yielding a bounded tube of states: \begin{align} \label{dist_dist} \int^{x_2}_{x_1}\|\delta x\|-{R(0)}{\sqrt{\overline{\omega}}}e^{-\lambda t} \leq \frac{\overline{d}}{\lambda}\sqrt{\frac{\overline{\omega}}{\underline{\omega}}} \leq \frac{\overline{d}\overline{\omega}}{\lambda\underline{\omega}} \end{align} where $R(t) = \int_{x_1}^{x_2}\|\Theta(x,t) \delta x(t)\|, \forall t$. \end{theorem} \begin{IEEEproof} See the proof of Lemma \ref{LM:Robust_contraction_original}. \end{IEEEproof} By Theorem~\ref{RobustCont}, the problem to minimize an upper bound of the steady-state Euclidean distance between the trajectory $x_1(t)$ of the unperturbed system and $x_2(t)$ of the perturbed system (\ref{nonlin_per}) (i.e.{} (\ref{dist_dist}) as $t\to \infty$) can be formulated as follows: \begin{align} \label{nonlin_opt_ccm} {J}_{NL}^* = \min_{\underline{\omega}>0,\overline{\omega}>0,W \succ 0} \frac{\overline{d}\overline{\omega}}{\lambda\underline{\omega}}\text{ s.t.{} }\text{(\ref{deterministic_contraction}) and (\ref{Mcon})} \end{align} where $W(x,t) = M(x,t)^{-1}$ is used as a decision variable instead of $M(x,t)$. We assume that the contraction rate $\lambda$ and disturbance bound $\overline{d}$ are given in (\ref{nonlin_opt_ccm}) (see Remark~\ref{howtochoselambda} on how to select $\lambda$). We need the following lemma to convexify this nonlinear optimization problem. \begin{lemma} \label{equiv_constraints} The inequalities (\ref{deterministic_contraction}) and (\ref{Mcon}) are equivalent to \begin{align} \label{deterministic_contraction_tilde} &\dot{\tilde{W}}(x,t)-\sym{\left(\frac{\partial f(x,t)}{\partial x}\tilde{W}(x,t)\right)} \succeq 2\lambda \tilde{W}(x,t),~\forall x,t \\ \label{W_tilde} &I \preceq \tilde{W}(x,t) \preceq \chi I,~\forall x,t \end{align} respectively, where $\chi = \overline{\omega}/\underline{\omega}$, $\tilde{W} = \nu W$, and $\nu = 1/\underline{\omega}$. \end{lemma} \begin{IEEEproof} Since $\nu = 1/\underline{\omega} > 0$ and $W(x,t) \succ 0$, multiplying (\ref{deterministic_contraction}) by $\nu$ and then by $W(x,t)$ from both sides preserves matrix definiteness and the resultant inequalities are equivalent to the original ones~\cite[pp. 114]{lmi}. These operations yield (\ref{deterministic_contraction_tilde}). Next, since $M(x,t) \succ 0$, there exists a unique $\mu(x,t) \succ 0$ s.t.{} $M = \mu^2$. Multiplying (\ref{Mcon}) by $\mu^{-1}$ from both sides gives $\underline{\omega}I \preceq W(x,t) \preceq \overline{\omega}I$ as we have $\underline{\omega},\overline{\omega} > 0$ and $(\mu^{-1})^2 = W$. We get (\ref{W_tilde}) by multiplying this inequality by $\nu = 1/\underline{\omega}$. \end{IEEEproof} We are now ready to state and prove our main result on the convex optimization-based sampling. \begin{theorem} \label{conv_equiv_thm} Consider the convex optimization problem: \begin{align} \label{convex_opt_ccm} &{J}_{CV}^* = \min_{\chi \in \mathbb{R},\tilde{W}\succ 0} \frac{\overline{d}\chi}{\lambda} \text{~~s.t.{} (\ref{deterministic_contraction_tilde}) and (\ref{W_tilde})} \end{align} where $\chi$ and $\tilde{W}$ are defined in Lemma~\ref{equiv_constraints}, and $\lambda>0$ and $\overline{d}=\sup_{t \geq 0}\|d(t)\|$ are assumed to be given. Then ${J}_{NL}^*={J}_{CV}^*$. \end{theorem} \begin{IEEEproof} By definition, we have ${\overline{d}\overline{\omega}}/{(\lambda\underline{\omega})}={\overline{d}\chi}/{\lambda}$. Since (\ref{deterministic_contraction}) and (\ref{Mcon}) are equivalent to (\ref{deterministic_contraction_tilde}) and (\ref{W_tilde}) by Lemma~\ref{equiv_constraints}, rewriting the objective in the original problem (\ref{nonlin_opt_ccm}) using this equality completes the proof. \end{IEEEproof} \begin{remark} \label{howtochoselambda} Since (\ref{deterministic_contraction_tilde}) and (\ref{W_tilde}) are independent of $\nu=1/\underline{\omega}$, the choice of $\nu$ does not affect the optimal value of the minimization problem in Theorem~\ref{conv_equiv_thm}. In practice, as we have $\sup_{x,t}\|M(x,t)\|\leq1/\underline{\omega}=\nu$ by (\ref{Mcon}), it can be used as a penalty to optimally adjust the induced 2-norm of estimation and control gains when the problem explicitly depends on $\nu$ (see Sec.~\ref{example} for details). Also, although $\lambda$ is fixed in Theorem~\ref{conv_equiv_thm}, it can be found by a line search in practice. \end{remark} \begin{remark} The problem (\ref{convex_opt_ccm}) can be solved as a finite-dimensional problem by using backward difference approximation or by modeling the metric as a function in a given hypothesis function space. The former approach leads to the concept called Neural Contraction Metrics (NCM), a global representation of optimal contraction metrics sampled offline by using a deep Long Short-Term Memory Recurrent Neural Network (LSTM-RNN). The latter approach includes the use of the sum of squares programming as a tractable framework to construct contraction metrics for dynamics with polynomial vector fields. \end{remark} \subsection{Optimal Estimation and Control using Contraction Metrics} \label{example} This section delineates how to construct an NCM offline and utilize it online for state estimation and feedback control. \subsubsection{Problem Statement} We apply an NCM to the state estimation problem for the following nonlinear system with bounded disturbances: \begin{align} \label{orig_dynamics} \dot{x} = f(x,t)+B(x,t)d_1(t),~y(t) = h(x,t)+G(x,t)d_2(t) \end{align} where $d_1: \mathbb{R}_{\geq 0} \to \mathbb{R}^{k_1}$, $B:\mathbb{R}^n\times\mathbb{R}_{\geq 0} \to \mathbb{R}^{n\times k_1}$, $y: \mathbb{R}_{\geq 0} \to \mathbb{R}^m$, $d_2: \mathbb{R}_{\geq 0} \to \mathbb{R}^{k_2}$, $h:\mathbb{R}^n\times\mathbb{R}_{\geq 0} \to \mathbb{R}^{m}$, and $G:\mathbb{R}^n\times\mathbb{R}_{\geq 0} \to \mathbb{R}^{m\times k_2}$ with $\overline{d}_1 = \sup_t\|d_1(t)\| < +\infty$ and $\overline{d}_2 = \sup_t\|d_2(t)\| < +\infty$. Let $W = M(\hat{x},t)^{-1} \succ 0$, $A(x,t) = (\partial f/\partial x)$, and $C(x,t) = (\partial h/\partial x)$. Let $\hat{x}:\mathbb{R}_{\geq0} \to \mathbb{R}^{n}$. We design an estimator as \begin{align} \label{est_dynamics} &\dot{\hat{x}} = f(\hat{x},t)+M(\hat{x},t)C(\hat{x},t)^T(y-h(\hat{x},t))\\ \label{ekf_con} &\dot{W}+W A(\hat{x},t)+A(\hat{x},t)^TW-2C(\hat{x},t)^TC(\hat{x},t) \preceq -2\lambda W \end{align} where $\lambda > 0$. The virtual system of (\ref{orig_dynamics}) and (\ref{est_dynamics}) is given as \begin{align} \label{detvd} \dot{q} =& f(q,t)+M(\hat{x},t)C(\hat{x},t)^T(h(x,t)-h(q,t))+d_e(q,t) \end{align} where $d_e(q,t)$ is defined as $d_e(x,t) = B(x,t)d_1(t)$ and $d_e(\hat{x},t) = M(\hat{x},t)C(\hat{x},t)^TG(x,t)d_2(t)$. Note that (\ref{detvd}) has $q=x$ and $q=\hat{x}$ as its particular solutions. The differential dynamics of (\ref{detvd}) with $d_e = 0$ is given as \begin{align} \label{detvd_dynamics} \delta \dot{q} =& (A(q,t)-M(\hat{x},t)C(\hat{x},t)^TC(q,t))\delta q. \end{align} \subsubsection{Nonlinear Stability Analysis} We have the following lemma for deriving a condition to guarantee the local contraction of (\ref{detvd}) in Theorem~\ref{est_stability}. \begin{lemma} \label{neighbor_lemma} If (\ref{ekf_con}) holds for $t\geq0$, there exists $r(t) > 0$ s.t.{} \begin{align} \label{ekf_virtual} 2\gamma W+\dot{W}+\sym{}(W A(q,t))-\sym(C(\hat{x},t)^TC(q,t)) \preceq 0 \end{align} for all $q(t)$ with $\|q(t)-\hat{x}(t)\| \leq r(t)$, where $0 < \gamma < \lambda$. \end{lemma} \begin{IEEEproof} See~Lemma 2 of~\cite{6849943} or Theorem 1 of~\cite{observer}. \end{IEEEproof} The following theorem along with this lemma guarantees the exponential stability of the estimator (\ref{est_dynamics}). \begin{theorem} \label{est_stability} Suppose that there exist positive constants $\underline{\omega}$, $\overline{\omega}$, $\overline{b}$, $\bar{c}$, $\bar{g}$, and $\rho$ s.t.{} $\underline{\omega}I \preceq W(\hat{x},t) \preceq \overline{\omega}I$, $\|B(x,t)\| \leq \overline{b}$, $\|C(\hat{x},t)\| \leq \bar{c}$, $\|G(x,t)\| \leq \bar{g}$, and $r(t) \geq \rho,~\forall \hat{x},x,t$, where $r(t)$ is defined in Lemma~\ref{neighbor_lemma}. If (\ref{ekf_con}) holds and $R_e(0)+\overline{D}_e/{\gamma} \leq \sqrt{\underline{\omega}} \rho$, where $R_e(t) = \int_{\hat{x}}^x\|\Theta(\hat{x},t)\delta q(t)\|$ with $W = \Theta^T \Theta$ and $\overline{D}_e = \overline{d}_1\overline{b}\sqrt{\overline{\omega}}+{\overline{d}_2\bar{c}\bar{g}}/{\sqrt{\underline{\omega}}}$, then the distance between the trajectory of (\ref{orig_dynamics}) and (\ref{est_dynamics}) is exponentially bounded as follows: \begin{align} \label{est_ss} \int_{\hat{x}}^x\|\delta q\| \leq \frac{R_e(0)}{\sqrt{\underline{\omega}}}e^{-\gamma t}+ \frac{\overline{d}_1\overline{b}}{\gamma}\chi+\frac{{\overline{d}_2\bar{c}\bar{g}}}{\gamma}\nu \end{align} where $\chi = {\overline{\omega}}/{\underline{\omega}}$, $\nu = {1}/{\underline{\omega}}$, and $0 < \gamma < \lambda$. \end{theorem} \begin{IEEEproof} Using (\ref{detvd_dynamics}), we have $d(\|\Theta \delta q\|^2)/dt = \delta q^T(\dot{W}+\sym(W A(q,t))-\sym(C(\hat{x},t)^TC(q,t)))\delta q$ when $d_e = 0$. This along with (\ref{ekf_virtual}) gives $\dot{R}_e(t) \leq -{\gamma} R_e(t)$ in the region where Lemma~\ref{neighbor_lemma} holds. Thus, using the bound $\|\Theta(\hat{x}(t),t)d_e(q,t)\| \leq \overline{D}_e$, we have $\sqrt{\underline{\omega}}\int_{\hat{x}}^{x}\|\delta q\| \leq {R_e(0)}e^{-\gamma t}+{\overline{D}_e}/\gamma$ by the same proof as for Theorem~\ref{RobustCont}. Rewriting this with $\chi$, $\nu$, and $1 \leq \sqrt{\chi} \leq \chi$ yields (\ref{est_ss}). This also implies that $\sqrt{\underline{\omega}}\|x-\hat{x}\| \leq R_e(0)+\overline{D}_e/{\gamma},~\forall t$. Hence, the sufficient condition for $\|q-\hat{x}\|$ in Lemma~\ref{neighbor_lemma} reduces to the one required in this theorem. \end{IEEEproof} \subsubsection{Convex Optimization-based Sampling (CV-STEM)} We have the following proposition to sample optimal contraction metrics for the NCM-based state estimation. \begin{proposition} \label{est_prop} $M(\hat{x},t)$ that minimizes an upper bound of $\lim_{t\to\infty} \int_{\hat{x}}^x\|\delta q\|$ is found by the convex optimization problem: \begin{align} \label{convex_opt_estimator} &{J}_{CVe}^* = \min_{\nu>0,\chi \in \mathbb{R},\tilde{W} \succ 0} \frac{\overline{d}_1\overline{b}}{\gamma}\chi+\frac{{\overline{d}_2\bar{c}\bar{g}}}{\gamma}\nu\\ &\text{s.t.{}}\text{ $\dot{\tilde{W}}+\tilde{W}A+A^T\tilde{W}-2\nu C^TC \preceq -{2\lambda} \tilde{W}$ and $I \preceq \tilde{W} \preceq \chi I$} \nonumber \end{align} where $\chi = {\overline{\omega}}/{\underline{\omega}}$, $\nu = {1}/{\underline{\omega}}$, $\tilde{W} = \nu W$, and $0 < \gamma < \lambda$. The arguments of $A(\hat{x},t)$, $C(\hat{x},t)$, and $\tilde{W}(\hat{x},t)$ are omitted for notational simplicity. \end{proposition} \begin{IEEEproof} Multiplying (\ref{ekf_con}) and $\underline{\omega}I \preceq W(\hat{x},t) \preceq \overline{\omega}I,~\forall \hat{x},t$ by $\nu$ yields the constraints of (\ref{convex_opt_estimator}). Then applying Theorem~\ref{conv_equiv_thm} with the objective function given in (\ref{est_ss}) of Theorem~\ref{est_stability} as $t \to \infty$ yields (\ref{convex_opt_estimator}). \end{IEEEproof} We have an analogous result for state feedback control. \begin{corollary} \label{con_cor} Consider the following system and a state feedback controller $u(t)$ with the bounded disturbance $d(t)$: \begin{align} \label{control_dynamics} &\dot{x} = f(x,t)+B_1(x,t)u+B_2(x,t)d(t) \\ \label{con_riccati} &\dot{W}-A(x,t)W-W A(x,t)^T+2B_1(x,t)B_1(x,t)^T \succeq 2\lambda W \end{align} where $u = -B_1(x,t)^TM(x,t)x$, $B_1:\mathbb{R}^n\times\mathbb{R}_{\geq0}\to\mathbb{R}^{n\times m}$, $B_2:\mathbb{R}^n\times\mathbb{R}_{\geq0}\to\mathbb{R}^{n\times k}$, $W=M^{-1}\succ 0$, $\lambda>0$, and $A$ is a matrix defined as $A(x,t)x = f(x,t)$, assuming that $f(x,t) = 0$ at $x = 0$ \cite{sddre,CIMEN20083761}. Suppose there exist positive constants $\underline{\omega}$, $\overline{\omega}$, and $\overline{b}_2$ s.t.{} $\underline{\omega}I \preceq W(x,t) \preceq \overline{\omega}I$ and $\|B_2(x,t)\| \leq \overline{b}_2,~\forall x,t$. Then $M(x,t)$ that minimizes an upper bound of $\lim_{t\to\infty} \int_{0}^x\|\delta q\|$ can be found by the following convex optimization problem: \begin{align} \label{convex_opt_controller} &{J}_{CVc}^* = \min_{\nu > 0,\chi \in \mathbb{R},\tilde{W} \succ 0} \frac{\overline{b}_2\overline{d}}{\lambda}\chi+\lambda\nu\\ &\text{s.t.{}}\text{ $-\dot{\tilde{W}}+A\tilde{W}+\tilde{W}A^T-2\nu B_1B_1^T \preceq -{2\lambda}\tilde{W}$ and $I \preceq \tilde{W} \preceq \chi I$} \nonumber \end{align} where $\chi = {\overline{\omega}}/{\underline{\omega}}$, $\nu = {1}/{\underline{\omega}}$, $\tilde{W} = \nu W$, and $\lambda>0$ is a user-defined constant. The arguments of $A(x,t)$, $B_1(x,t)$, and $\tilde{W}(x,t)$ are omitted for notational simplicity. \end{corollary} \begin{IEEEproof} The system with $q=x,0$ as its particular solutions is given by $\dot{q} = (A(x,t)-B_1(x,t)B_1(x,t)^TM(x,t))q+d_c(q,t)$, where $d_c(x,t) = B_2(x,t)d(t)$ and $d_c(0,t) = 0$. Since we have $\|d_c(q,t)\| \leq \overline{b}_2\overline{d}$ and the differential dynamics is \begin{align} \label{differential_con} \delta \dot{q} = (A(x,t)-B_1(x,t)B_1(x,t)^TM(x,t))\delta q \end{align} when $d_c = 0$, we get $\lim_{t\to \infty}\int_{0}^x\|\delta q\| \leq \overline{b}_2\overline{d}\chi/\lambda$ by the same proof as for Theorem~\ref{est_stability} with (\ref{detvd_dynamics}) replaced by (\ref{differential_con}), (\ref{ekf_virtual}) by (\ref{con_riccati}), and $R_e(t)$ by $R_c(t)=\int_{0}^x\|\Theta(x,t )\delta q(t)\|$, where $M = \Theta^T\Theta$. (\ref{convex_opt_controller}) then follows as in the proof of Proposition~\ref{est_prop}, where $\lambda \geq 0$ is for penalizing excessively large control inputs through $\nu \geq \sup_{x,t}\|M(x,t)\|$ (see Remark~\ref{howtochoselambda}). \end{IEEEproof} \subsection{Estimation and Control Duality in contraction Analysis} The similarity of Corollary~\ref{con_cor} to Proposition~\ref{est_prop} stems from the estimation and control duality due to the differential nature of contraction analysis as is evident from (\ref{detvd_dynamics}) and (\ref{differential_con}). Analogously to the discussion of the Kalman filter and LQR duality in LTV systems, this leads to two different interpretations on the weight of $\nu$ (i.e.{} $\overline{d}_2\bar{c}\bar{g}/\gamma$ in (\ref{convex_opt_estimator}) and $\lambda$ in (\ref{convex_opt_controller})). As discussed in Remark~\ref{howtochoselambda}, one way is to see it as a penalty on the induced 2-norm of feedback gains. Since $\overline{d}_2=0$ in (\ref{convex_opt_estimator}) means no noise acts on $y(t)$, it can also be viewed as an indicator of how much we trust the measurement $y(t)$: the larger the weight of $\nu$, the less confident we are in $y(t)$. These agree with our intuition as smaller feedback gains are suitable for measurements with larger uncertainty. \section{Contraction Theory for Learned Models} \label{Sec:datadriven} In recent applications of learning-based and data-driven automatic control frameworks, we often encounter situations where we only have access to a large amount of system trajectory data. This section, therefore, considers the cases where the true underlying dynamical system is poorly modeled or completely unknown, and assumptions in Sec.~\ref{Sec:adaptive} for using learning-based adaptive control techniques are no longer valid. A typical approach is to perform system identification~\cite{neurallander,47710} using trajectory data generated by \eqref{sysIDxd}: \begin{align} \label{sysIDx} \dot{x} =& f_L(x,u(x,t),t) \\ \label{sysIDxd} \dot{x}^* =& f_\mathrm{true}(x^*,u(x^*,t),t) \end{align} where ${x}:\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^n$ is the system state, $u:\mathbb{R}^n\times\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^m$ is the system control input, $f_\mathrm{true}: \mathbb{R}^n\times\mathbb{R}^m\times\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^n$ is a smooth function of the true dynamical system \eqref{sysIDxd}, which is unknown and thus modeled by a learned smooth function $f_L: \mathbb{R}^n\times\mathbb{R}^m\times\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^n$ of \eqref{sysIDx}. If we can learn $f_L$ to render the system \eqref{sysIDx} contracting, contraction theory still allows us to ensure robustness and stability of these systems. \begin{theorem} \label{Thm:NCMstability_modelfree} Let $q(0,t)=\xi_0(t)=x(t)$, $q(1,t)=\xi_1(t)=x^*(t)$, and $\textsl{g}=f_L$ in Theorems~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto} as in Example~\ref{ex:learning_prob3}, and define $\Delta_L$ as \begin{align} \label{Eq:DeltaL_sysID} \Delta_L = f_\mathrm{true}(x^*,u(x^*,t),t)-f_L(x^*,u(x^*,t),t) \end{align} for the learning error condition $\|\Delta_L\|\leq\epsilon_{\ell0}+\epsilon_{\ell1}\|\xi_1-\xi_0\|$ in \eqref{Eq:learning_error}. If the function $f_L$ is learned to satisfy \eqref{Eq:learning_error} with $\epsilon_{\ell1}=0$, i.e.{}, $\|\Delta_L\| \leq \epsilon_{\ell0}$ in some compact set $\mathcal{S}$, and if there exists a contraction metric defined by $M$ bounded as $\underline{m}\mathrm{I}\preceq M \preceq \overline{m}\mathrm{I}$ as in \eqref{Mcon}, which renders \eqref{sysIDx} contracting as in \eqref{eq_MdotContracting} of Theorem~\ref{Thm:contraction} for deterministic systems, i.e.{}, \begin{align} \label{contracting_system_id} \dot{M}+M(\partial f_L/\partial x)+(\partial f_L/\partial x)^{\top}M\preceq-2\alpha M, \end{align} and \eqref{eq_MdotContracting_sto} of Theorem~\ref{Thm:robuststochastic} for stochastic systems, i.e.{}, \begin{align} \label{contracting_system_id_sto} \dot{M}+M(\partial f_L/\partial x)+(\partial f_L/\partial x)^{\top}M\preceq-2\alpha M-\alpha_s\mathrm{I}, \end{align} then we have the following in the compact set $\mathcal{S}$: \begin{align} \label{system_id_bound} \|x(t)-x^*(t)\| \leq \frac{V_{\ell}(0)}{\sqrt{\underline{m}}}e^{-\alpha t}+\frac{\epsilon_{\ell0}}{\alpha}\sqrt{\frac{\overline{m}}{\underline{m}}}(1-e^{-\alpha t}) \end{align} for $x$ and $x^*$ in \eqref{sysIDx} and \eqref{sysIDxd}, where $V_{\ell}=\int^{x}_{x^*}\|\Theta\delta x\|$ as in Theorem~\ref{Thm:path_integral} with $M=\Theta^{\top}\Theta$. Furthermore, the systems \eqref{sysIDx} and \eqref{sysIDxd} are robust against bounded deterministic and stochastic disturbances. \end{theorem} \begin{proof} Let $p_t^* = (x^*,u(x^*(t),t),t)$ for notational simplicity. Since \eqref{sysIDxd} can be written as $\dot{x}^* = f_\mathrm{true}(p_t^*) = f_L(p_t^*)+(f_\mathrm{true}(p_t^*)-f_L(p_t^*))$ (see Example~\ref{ex:learning_prob3}) and $\|\Delta_L\|=\|f_\mathrm{true}(p_t^*)-f_L(p_t^*)\| \leq \epsilon_{\ell0}$, Theorem~\ref{Thm:Robust_contraction_original} holds with $\bar{d}=\epsilon_{\ell0}$ as \eqref{sysIDx} is contracting, resulting in \eqref{system_id_bound}. Also, defining $\Delta_L$ as \eqref{Eq:DeltaL_sysID} in Theorems~\ref{Thm:contraction_learning} and \ref{Thm:contraction_learning_sto} results in robustness of \eqref{sysIDx} and \eqref{sysIDxd} against bounded deterministic and stochastic disturbances due to \eqref{contracting_system_id} and \eqref{contracting_system_id_sto}, respectively. \qed \end{proof} Theorem~\ref{Thm:NCMstability_modelfree} is the theoretical foundation for stability analysis of model-free nonlinear dynamical systems. The bound \eqref{system_id_bound} becomes tighter as we achieve smaller $\epsilon_{\ell0}$ using more training data for verifying $\|\Delta_L\| \leq \epsilon_{\ell0}$ (see Remark~\ref{remark_learning_error}). From here onwards, we utilize contraction theory to provide stability guarantees to such model-free systems, partially enabling the use of the aforementioned model-based techniques. \subsection{Robust Control of Systems Modeled by DNNs} \label{Sec:neurallander} One challenge in applying Theorem~\ref{Thm:NCMstability_modelfree} in practice is to find contraction metrics for the control non-affine nonlinear systems \eqref{sysIDx}. This section delineates one way to construct a contraction metric in Theorem~\ref{Thm:NCMstability_modelfree} for provably-stable feedback control, using the CV-STEM and NCM of Theorems~\ref{Thm:CV-STEM},~\ref{Thm:ccm_cvstem},~\ref{Thm:NCMstability1}, \ref{Thm:NCMstability2}--\ref{Thm:ncm_ccm_clf}, and~\ref{Thm:lagros_stability}, along with the spectrally-normalized DNN of Definition~\ref{Def:SN}. To this end, let us assume that $f_\mathrm{true}$ of the dynamics \eqref{sysIDxd} can be decomposed into a known control-affine part $f(x^*,t)+B(x^*,t)u$ and an unknown control non-affine residual part $r(x^*,u,t)$ as follows: \begin{equation} \label{nonaffine_residual} \dot{x}^* = f_\mathrm{true} = f(x^*,t)+B(x^*,t)(u+r(x^*,u,t)). \end{equation} Ideally, we would like to design $u$ as \begin{align} \label{ideal_nonaffine_u} u = u^*(x,t)-r_L(x,u,t) \end{align} to cancel out the unknown term $r(x,u,t)$ of the dynamical system \eqref{nonaffine_residual} by the model $r_L(x,u,t)$ learned using trajectory data, where $u^*$ is a nominal stabilizing control input for $\dot{x}=f(x,t)+B(x,t)u$ given by, e.g.{}, Theorems~\ref{Thm:CV-STEM} and \ref{Thm:ccm_cvstem}. However, the equation \eqref{ideal_nonaffine_u} depends implicitly on $u$, which brings extra computational burden especially if the learned model $r_L(x,u,t)$ is highly nonlinear as in DNNs. In~\cite{neurallander}, a discrete-time nonlinear controller is proposed to iteratively solve \eqref{ideal_nonaffine_u}. \begin{lemma} \label{Thm:discrete_neurallander} Define a mapping $\mathcal{F}$ as $\mathcal{F}(u) = u^*(x,t)-r_L(x,u,t)$, where $u^*$ and $r_L$ are given in \eqref{ideal_nonaffine_u}. If $r_L$ is Lipschitz in $u$ with a 2-norm Lipschitz constant $L_u < 1$, i.e.{}, $\|r_L(x,u,t)-r_L(x,u',t)\| \leq L_u\|u-u'\|,~\forall u,u'$, then $\mathcal{F}$ is a contraction mapping for fixed $x,t$. Therefore, if $x,t$ are fixed, discrete-time nonlinear control $u_k$ defined as \begin{align} \label{discrete_nonaffine_u} u_k = \mathcal{F}(u_{k-1}) = u^*(x,t)-r_L(x,u_{k-1},t) \end{align} converges to a unique solution $u$ given by $u=\mathcal{F}(u)$. \end{lemma} \begin{proof} Since $r_L$ is Lipschitz, we have that \begin{equation} \|\mathcal{F}(u)-\mathcal{F}(u')\| \leq \|r_L(x,u,t)-r_L(x,u',t)\| \leq L_u\|\Delta u\| \end{equation} where $\Delta u = u-u'$. Thus, the assumption $L_u < 1$ ensures that $\mathcal{F}$ is a contraction mapping for fixed $x,t$~\cite{neurallander}. \qed \end{proof} By applying contraction theory to the discrete-time controller \eqref{discrete_nonaffine_u} of Lemma~\ref{Thm:discrete_neurallander}, we can guarantee the stability of \eqref{nonaffine_residual} if $r_L$ is modeled by a spectrally-normalized DNN of Definition~\ref{Def:SN}. \begin{theorem} \label{Thm:neurallander} Let $x$ be the trajectory of the following ideal system without the unknown part $r$ of the dynamics \eqref{nonaffine_residual}: \begin{align} \label{ideal_trajectory} \dot{x} = f(x,t)+B(x,t)u^*(x,t) \end{align} where $u^*$ is a stabilizing controller that renders \eqref{ideal_trajectory} contracting as in Theorem~\ref{Thm:NCMstability_modelfree} for $M$ which satisfies $\underline{m}\mathrm{I}\preceq M \preceq \overline{m}\mathrm{I}$ of \eqref{Mcon}. Note that such $u^*$ can be designed by using, e.g.{}, Theorems~\ref{Thm:CV-STEM} and \ref{Thm:ccm_cvstem}. Suppose that the true dynamics \eqref{nonaffine_residual} is controlled by \eqref{discrete_nonaffine_u} and \begin{align} \label{disc_assump} \exists \rho \in \mathbb{R}_{\geq 0}\text{ s.t.{} } \|u_k-u_{k-1}\| \leq \rho \|x-x^*\| \end{align} for $x^*$ in \eqref{nonaffine_residual}~\cite{neurallander}. If $\exists\bar{b}\in\mathbb{R}_{\geq 0}$ s.t.{} $\|B(x,t)\|\leq\bar{b}$, and if $r_L$ is modeled by a spectrally-normalized DNN of Definition~\ref{Def:SN} to have \begin{align} \label{learning_residual} \|r_L(x,u,t)-r(x,u,t)\| \leq \epsilon_{\ell} \end{align} for all $x\in\mathcal{S}_s$, $u\in\mathcal{S}_u$, and $t\in\mathcal{S}_t$, where $\mathcal{S}_s\subseteq\mathbb{R}^n$, $\mathcal{S}_u\subseteq\mathbb{R}^m$, and $\mathcal{S}_t\subseteq\mathbb{R}_{\geq 0}$ are some compact sets, then $r_L$ is Lipschitz continuous, and the controller \eqref{discrete_nonaffine_u} applied to \eqref{nonaffine_residual} gives the following bound in the compact set: \begin{align} \label{neural_lander_bound} \|x(t)-x^*(t)\| \leq \frac{V_{\ell}(0)}{\sqrt{\underline{m}}}e^{-\alpha_{\ell}t}+\frac{\bar{b}\epsilon_{\ell}}{\alpha_{\ell}}\sqrt{\frac{\overline{m}}{\underline{m}}}(1-e^{-\alpha_{\ell}t}) \end{align} as long as the Lipschitz constant of $r_L$ is selected to have \begin{align} \label{condition_neuralland} \exists \alpha_{\ell} \in\mathbb{R}_{>0}\text{ s.t.{} }\alpha_{\ell} = \alpha-\bar{b}L_u\rho\sqrt{\overline{m}/\underline{m}} > 0 \end{align} where $V_{\ell}=\int^{x}_{x^*}\|\Theta\delta x\|$ as in Theorem~\ref{Thm:path_integral} with $M=\Theta^{\top}\Theta$. Furthermore, the system \eqref{nonaffine_residual} with the controller \eqref{discrete_nonaffine_u} is robust against deterministic and stochastic disturbances. \end{theorem} \begin{proof} If $r_L$ is modeled by a spectrally-normalized DNN, we can arbitrarily choose its Lipschitz constant $L_u$ by Lemma~\ref{Thm:SNneuralnet}. Applying \eqref{discrete_nonaffine_u} to \eqref{nonaffine_residual} yields \begin{align} \dot{x}^* = f_{cl}(x^*,t)+B(x^*,t)(r(x^*,u_k,t)-r_L(x^*,u_{k-1},t)) \end{align} where $f_{cl}(x^*,t) = f(x^*,t)+B(x^*,t)u^*$. Using the Lipschitz condition on $r_L$ and the learning error assumption \eqref{learning_residual}, we have that \begin{align} \|r(x^*,u_k,t)-r_L(x^*,u_{k-1},t)\| \leq& \epsilon_{\ell}+L_u\|u_k-u_{k-1}\| \\ \leq& \epsilon_{\ell}+L_u\rho\|x-x^*\| \end{align} where \eqref{disc_assump} is used to obtain the second inequality. Since we have $\|B(x,t)\|\leq\bar{b}$ and the closed-loop system $\dot{x} = f_{cl}(x,t)$ is contracting, Theorem~\ref{Thm:contraction_learning} holds with $\epsilon_{\ell0}=\bar{b}\epsilon_{\ell}$ and $\epsilon_{\ell1}=\bar{b}L_u\rho$ as long as we select $L_u$ to satisfy \eqref{condition_neuralland}, resulting in the bound \eqref{neural_lander_bound}. The final robustness statement follows from Theorems~\ref{Thm:contraction_learning} and \ref{Thm:contraction_learning_sto}. \qed \end{proof} Theorem~\ref{Thm:neurallander} implies that the control synthesis algorithms via contraction theory, including robust control of Theorems~\ref{Thm:CV-STEM} and \ref{Thm:ccm_cvstem} (CV-STEM), learning-based robust control of Theorems~\ref{Thm:NCMstability1}, \ref{Thm:NCMstability2}--\ref{Thm:ncm_ccm_clf}, and~\ref{Thm:lagros_stability} (NCM, LAG-ROS), can be enhanced to provide explicit robustness and stability guarantees even for systems partially modeled by DNNs that depend nonlinearly on $u$. \begin{example} \label{ex:neural_lander} Let us consider the following Lagrangian system of Example~\ref{ex:lag_metric} perturbed externally by unknown control non-affine residual disturbance: \begin{align} \label{lagrange_non_affine} &\mathcal{H}(\mathtt{q})\ddot{\mathtt{q}}+\mathcal{C}(\mathtt{q},\dot{\mathtt{q}})\dot{\mathtt{q}}+\mathcal{G}(\mathtt{q})=u+r(x,u) \end{align} where $x=[\mathtt{q}^{\top},\dot{\mathtt{q}}^{\top}]^{\top}$ and the other variables are as given in Example~\ref{ex:lag_metric}. Using the result of Theorem~\ref{Thm:neurallander}, we can design a discrete-time nonlinear controller by augmenting the exponentially stabilizing controller of Example~\ref{ex:lag_metric} with a learned residual part $r_L(x,u)$ as follows: \begin{align} \label{lagrange_non_affine_u} u_k =& -\mathcal{K}(t)(\dot{\mathtt{q}}-\dot{\mathtt{q}}_r)+\mathcal{H}(\mathtt{q})\ddot{\mathtt{q}}_r+\mathcal{C}(\mathtt{q},\dot{\mathtt{q}})\dot{\mathtt{q}}_r+\mathcal{G}(\mathtt{q})\\ &-r_L(x,u_{k-1}) \end{align} where $\dot{\mathtt{q}}_r=\dot{\mathtt{q}}_d(t)-\Lambda(t)(\mathtt{q}-\mathtt{q}_d(t))$, $\mathcal{K}: \mathbb{R}_{\geq 0}\mapsto\mathbb{R}^{n\times n}$, $\Lambda: \mathbb{R}_{\geq 0}\mapsto\mathbb{R}^{n\times n}$, and $(\mathtt{q}_d,\dot{\mathtt{q}}_d)$ is the target trajectory of the state $(\mathtt{q},\dot{\mathtt{q}})$, and $\mathcal{K},\Lambda \succ 0$ are control gain matrices (design parameters). Again, note that $\dot{\mathcal{H}}-2\mathcal{C}$ is skew-symmetric with $\mathcal{H} \succ 0$ by construction. This gives us the following closed-loop virtual system of a smooth path $q(\mu,t)$ parameterized by $\mu \in [0,1]$, which has $q(\mu=0,t)=\dot{\mathtt{q}}_r$ and $q(\mu=1,t)=\dot{\mathtt{q}}$ as its particular solutions as in Example~\ref{ex:lag_metric}, but now with non-zero perturbation due to $r(x,u)$: \begin{align} \label{lagrange_cl_non_affine} &\mathcal{H}(\dot{q}-\ddot{\mathtt{q}}_r)+(\mathcal{C}+\mathcal{K})(q-\dot{\mathtt{q}}_r)=\mu(r(x,u_k)-r_L(x,u_{k-1})).\nonumber \end{align} After some algebra as in the proof of Theorem~\ref{Thm:neurallander}, we can show that \begin{align} \dfrac{d}{dt}\int_0^1\|\Theta\partial_{\mu} q\| \leq& -\left(\frac{k_{\ell}}{h_u}-\frac{L_u\rho}{h_{\ell}}\right)\int_0^1\|\Theta\partial_{\mu} q\|+\frac{\epsilon_{\ell}}{\sqrt{h_{\ell}}} \end{align} where $\mathcal{H}=\Theta^{\top}\Theta$, $h_{\ell}\mathrm{I}\preceq\mathcal{H}\preceq h_u\mathrm{I}$, $k_{\ell}\mathrm{I}\preceq\mathcal{K}$, $\|u_k-u_{k-1}\| \leq \rho\|\dot{\mathtt{q}}-\dot{\mathtt{q}}_r\|$, $\epsilon_{\ell}$ is the learning error of $r_L$, and $L_u$ is the Lipschitz constant of $r_L$ (assuming $r_L$ is modeled by a spectrally-normalized DNN of Definition~\ref{Def:SN}). This indeed indicates that the tracking error of the Lagrangian system \eqref{lagrange_non_affine} is exponentially bounded as proven in Theorem~\ref{Thm:neurallander}. \if0 Since \eqref{lagrange_cl_non_affine} with $r=r_L=0$ is contracting as seen in Example~ Using the fact that $\dot{\mathcal{H}}-2\mathcal{C}$ is skew-symmetric as in \eqref{cont_lagrangian}, and assuming that $r_L$ is modeled by a spectrally-normalized DNN along with the condition $\|u_k-u_{k-1}\| \leq \rho\|s\|$ as in \eqref{disc_assump}, the time derivative of $V_{\mathcal{H}}=\partial_{\mu} q^{\top}H(\mathtt{q})\partial_{\mu} q$ with the virtual system \eqref{lagrange_cl_non_affine} is given as \begin{align} \dot{V}_{\mathcal{H}} =& -2\partial_{\mu} q^{\top}\mathcal{K}\partial_{\mu} q+2\partial_{\mu} q^{\top}H(r(x,u_k)-r_L(x,u_{k-1}) \\ &\leq -\frac{2k_{\ell}}{h_u}V_{\mathcal{H}}+2\sqrt{h_u}\|\Theta\partial_{\mu} q\|(\epsilon_{\ell}+L_u\rho\int_0^1\|\partial_{\mu} q\|)\label{vhdot_lag} \end{align} where $\partial_{\mu} q=\partial q/\partial \mu$, $\mathcal{H}=\Theta^{\top}\Theta$, $\|\mathcal{H}\| \leq h_u$, $\|\mathcal{K}\| \geq k_{\ell}$, $\epsilon_{\ell}$ is the learning error of $r_L$, and $L_u$ is the Lipschitz constant of $r_L$. Since we have $V_{\mathcal{H}}=\|\Theta\partial_{\mu} q\|^2$ and $\dot{V}_{\mathcal{H}} = 2\|\Theta\partial_{\mu} q\|(d\|\Theta\partial_{\mu} q\|/dt)$, \eqref{vhdot_lag} implies \begin{align} \dfrac{d\int_0^1\|\Theta\partial_{\mu} q\|}{dt} =& -\alpha\int_0^1\|\Theta\partial_{\mu} q\|+\sqrt{h_u}(\epsilon_{\ell}+L_u\rho\int_0^1\|\partial_{\mu} q\|) \nonumber \\ \leq& -\left(\alpha-L_u\rho\sqrt{\frac{h_u}{h_{\ell}}}\right)\int_0^1\|\Theta\partial_{\mu} q\|+\sqrt{h_u}\epsilon_{\ell} \end{align} where $\alpha = k_{\ell}/h_u$ and $\|\mathcal{H}\| \geq h_{\ell}$. We can then use Theorem~\ref{Thm:Robust_contraction_hierc} as in Example~\ref{ex:hiera} to show that $(\mathtt{q},\dot{\mathtt{q}})$ converges to $(\mathtt{q}_d,\dot{\mathtt{q}}_d)$. \fi \end{example} In~\cite{neurallander}, the technique in Theorem~\ref{Thm:neurallander} and in Example~\ref{ex:neural_lander} is used to perform precise near-ground trajectory control of multi-rotor drones, by learning complex aerodynamic effects caused by high-order interactions between multi-rotor airflow and the environment. It is demonstrated that it significantly outperforms a baseline nonlinear tracking controller in both landing and cross-table trajectory tracking tasks. Theorem~\ref{Thm:neurallander} enables applying it to general nonlinear systems with state and control dependent uncertainty, as long as we have a nominal exponentially stabilizing controller (which can be designed by Theorems~\ref{Thm:CV-STEM} and~\ref{Thm:ccm_cvstem}, or approximately by Theorems~\ref{Thm:NCMstability1}, \ref{Thm:NCMstability2}--\ref{Thm:ncm_ccm_clf}, and~\ref{Thm:lagros_stability}). \subsection{Learning Contraction Metrics from Trajectory Data} \label{Sec:learning_contractionmetric} This section presents a data-driven method to design contraction metrics for stability guarantees directly from trajectory data, assuming that its underlying dynamical system is completely unknown unlike \eqref{nonaffine_residual}. We specifically consider the situation where the underlying system is given by a continuous-time autonomous system, $\dot{x}=f(x)$ with $f$ being unknown, and the state $x \in \mathbb{R}^n$ being fully observed. Let $\mathcal{S}_s \subseteq \mathbb{R}^n$ be a compact set and $\mathcal{S}_t\subseteq \mathbb{R}_{\geq 0}$ be the maximal interval starting at zero for which a unique solution $\varphi_t(\xi)$ exists for all initial conditions $\xi \in \mathcal{S}_s$ and $t \in \mathcal{S}_t$. Let us also assume access to sampled trajectories generated from random initial conditions. Notations to be used in this section are given in Table~\ref{tab:notations_lmetric}. \begin{table} \caption{Notations in Sec.~\ref{Sec:learning_contractionmetric}~\cite{boffi2020learning}. \label{tab:notations_lmetric}} \footnotesize \begin{center} \renewcommand{\arraystretch}{1.2} \begin{tabular}{ |c|m{6cm}| } \hline $\mathbb{B}^n_2(r)$ & Closed $\ell_2$-ball in $\mathbb{R}^n$ of radius $r$ centered at $0$ \\ \hline $\mathbb{B}^n_2(\xi,r)$ & Closed $\ell_2$-ball in $\mathbb{R}^n$ of radius $r$ centered at $\xi$ \\ \hline $\mathbb{S}^{n-1}$ & Sphere in $\mathbb{R}^n$ \\ \hline $\mu_{\mathrm{Leb}}(\cdot)$ & Lebesgue measure on $\mathbb{R}^n$ \\ \hline $\psi_t(\cdot)$ & Induced flow on prolongated system given as $p(x,\delta x) = (f(x),(\partial f/\partial x)\delta x)^{\top}$ \\ \hline $\theta_t(\delta \xi,\xi)$ &Second element of $\psi_t(\xi,\delta \xi)$ \\ \hline $\zeta_n(r)$ & Haar measure of a spherical cap in $\mathbb{S}^{n-1}$ with arc length $r$ \\ \hline $\nu$ & Uniform probability measure on $\mathcal{S}_s\times \mathbb{S}^{n-1}$ \\ \hline $\mathcal{T}S$ & Tangent bundle of $S = \cup_{t\in \mathcal{S}_t}\varphi_t(\mathcal{S}_s)$ \\ \hline \end{tabular} \end{center} \end{table} The following theorem states that a contraction metric defined by $\mathcal{M}$, learned from trajectory data, indeed guarantees contraction of the unknown underlying dynamical system~\cite{boffi2020learning}. \begin{theorem} \label{data_driven_cont_thm} Suppose that $\mathcal{S}_s \subseteq \mathbb{R}^n$ is full-dimensional, $n \geq 2$, and $\dot{x} = f(x)$ is contracting in a metric defined by a uniformly bounded $M(x)\succ 0$, i.e.{}, \begin{align} \dot{M}+M(\partial f/\partial x)+(\partial f/\partial x)^{\top}M\preceq-2\alpha M \end{align} of \eqref{eq_MdotContracting} and $\underline{m}\mathrm{I}\preceq M \preceq \overline{m}\mathrm{I}$ of \eqref{Mcon} hold for $M$. Suppose also that a matrix-valued function $\mathcal{M}(x)$ with $\mathcal{M}(x)\succeq \underline{m}_L \mathrm{I}$ is learned to satisfy $\nu(Z_b)\leq\epsilon_{\ell}$, where the contraction violation set $Z_b$ for $p(x,\delta x) = (f(x),(\partial f/\partial x)\delta x)^{\top}$ is defined as \begin{align} &Z_b = \{(\xi,\delta\xi)\in \mathcal{S}_s\times\mathbb{S}^{n-1}:\\ &\max_{t\in \mathcal{S}_t}(\nabla \mathcal{V}(\psi_{t}(\xi,\delta \xi))^{\top}p(\psi_{t}(\xi,\delta \xi))-\alpha \mathcal{V}(\psi_t(\xi,\delta \xi)) > 0)\} \end{align} with $\mathcal{V}: \mathcal{T}S \mapsto \mathbb{R}$ being a learned differential Lyapunov function $\mathcal{V}(x,\delta x) = \delta x^{\top}\mathcal{M}(x)\delta x$ for $S = \cup_{t\in \mathcal{S}_t}\varphi_t(\mathcal{S}_s)$. Define $\bar{B}$, $B_H$, $B_{\nabla q}$, and $B_{\nabla \mathcal{V}}$ as \begin{align} &\bar{B}=B_H(B_{\nabla q}+\alpha B_{\nabla \mathcal{V}})(\overline{m}/\underline{m})^{3/2},~B_H = \sup_{x\in S}\left\|{\partial^2f}/{\partial x^2}\right\| \nonumber \\ &B_{\nabla q} = \sup_{x\in S}\|\nabla q(x)\|,~B_{\nabla \mathcal{V}} = \sup_{x\in S}\|\nabla \mathcal{V}(x)\| \end{align} where $q = \nabla \mathcal{V}(x)^{\top} f(x)$. Also, we define $r_{\epsilon_{\ell}}$ and $r_b$ as \begin{align} r_{\epsilon_{\ell}} =& \sup\{r\in\mathbb{R}_{>0}:r^n\zeta_n(r)\leq {\epsilon_{\ell}\mu_{\mathrm{Leb}}(\mathcal{S}_s)}/{\mu_{\mathrm{Leb}}(\mathbb{B}_2^{n}(1))}\} \nonumber \\ r_b =& \sqrt{r_{\epsilon_{\ell}}\bar{B}/(\eta \alpha \underline{m}_L)} \end{align} where $\eta \in (0,1)$. Finally, define $\tilde{X}_t(r_b)$ as \begin{align} \tilde{X}_t(r_b) = \{\xi \in \tilde{X}:\inf_{\delta \xi \in \mathbb{S}^{n-1}} \|\theta_t(\delta \xi,\xi)\| \geq r_b\} \end{align} for $t \in \mathcal{S}_t$, where $\tilde{X} = \{\xi \in \mathcal{S}_s: \mathbb{B}^n_2(\xi,r_{\epsilon_{\ell}}) \subset \mathcal{S}_s\}$. Then the system is contracting in the learned metric defined by $\mathcal{M}(x)$ at the rate $(1-\eta)\alpha$ with $\eta \in (0,1)$, for every $x \in \tilde{S}(r_b) = \cup_{t\in \mathcal{S}_t}\varphi_t(\tilde{X}_t(r_b))$. \end{theorem} \begin{proof} See Theorem~5.2 of~\cite{boffi2020learning}. \qed \end{proof} Agreeing with our intuition, Theorem~\ref{data_driven_cont_thm} ensures that the region $\tilde{S}(r_b)$ where the contraction condition holds becomes larger, as the upper bound $\epsilon_{\ell}$ on $\nu(Z_b)$ for the contraction violation set $Z_b$ becomes smaller, yielding the learned contraction metric of higher quality. In~\cite{boffi2020learning}, it is proven that if the samples are drawn uniformly from $\mathcal{S}_s\times \mathbb{S}^{n-1}$, we have $\epsilon_{\ell} \leq O(k\cdot \text{polylog}(N)/N)$ decay rates for various parametric and nonparametric function classes, where $N$ is the number of sampled trajectories and $k$ is the effective number of parameters of the function class of interest. Such a learned contraction metric can be used in Theorems~\ref{Thm:NCMstability_modelfree} and~\ref{Thm:neurallander} for certifying robustness and stability of model-free systems. \section{Concluding Remarks} \label{Sec:conclusion} The main contribution of this paper is twofold. First, a tutorial overview of contraction theory is presented to generalize and simplify Lyapunov-based stability methods for incremental exponential stability analysis of nonlinear non-autonomous systems. The use of differential dynamics and its similarity to an LTV system allow for LMI and convex optimization formulations that are useful for systematic nonlinear control and estimation synthesis. Second, various methods of machine learning-based control using contraction theory are presented to augment the existing learning frameworks with formal robustness and stability guarantees, extensively using the results of the first part of the paper. Such formal guarantees are essential for their real-world applications but could be difficult to obtain without accounting for a contracting property. It is also emphasized that, especially in situations where ISS and uniform asymptotic stability-based arguments render nonlinear stability analysis unnecessarily complicated, the use of exponential stability and the comparison lemma in contraction theory helps to achieve significant conceptual and methodological simplifications. A connection to the KYP and bounded real lemmas is also shown in the context of contraction-based incremental stability analysis. Considering the promising outcomes on its utilization for model-based learning in Sec.~\ref{Sec:learning_stability}--\ref{Sec:adaptive} and for model-free data-driven learning in Sec.~\ref{Sec:datadriven}, the methods of contraction theory that are surveyed in this paper provide important mathematical tools for formally providing safety and stability guarantees of learning-based and data-driven control, estimation, and motion planning techniques for high-performance robotic and autonomous systems. Examples are elucidated to provide clear guidelines for its use in deep learning-based stability analysis and its associated control design for various nonlinear systems. \section*{Acknowledgments} This work was in part funded by the Jet Propulsion Laboratory, California Institute of Technology, and benefited from discussions with Nick Boffi, Winfried Lohmiller, Brett Lopez, Ian Manchester, Quang Cuong Pham, Sumeet Singh, Stephen Tu, and Patrick Wensing. We also thank Chuchu Fan and Guanya Shi. \section{Introduction} Lyapunov theory is one of the most widely-used approaches to stability analysis of a nonlinear system~\cite{Isidori:1995:NCS:545735,marino1995nonlinear,Khalil:1173048,Vidyasagar,Ref_Slotine,Nijmeijer}, which provides a condition for stability with respect to an equilibrium point, a target trajectory, or an invariant set. Contraction theory~\cite{Ref:contraction1,Ref:contraction4,Ref:contraction5,Ref:contraction2,Ref:contraction3} rewrites suitable Lyapunov stability conditions using a quadratic Lyapunov function of the differential states, defined by a Riemannian contraction metric and its uniformly positive definite matrix, thereby characterizing a necessary and sufficient condition for incremental exponential convergence of the multiple nonlinear system trajectories to one single trajectory. It can be regarded as a generalization of Krasovskii's theorem~\cite[p. 83]{Ref_Slotine} applied to nonlinear incremental stability analysis~\cite{Ref:contraction1,989067}, where the differential formulation permits a pure differential coordinate change with a non-constant metric for simplifying its stability proofs~\cite{Ref:contraction1}. The differential nature of contraction theory implies we can exploit the Linear Time-Varying (LTV) systems-type techniques for nonlinear stability analysis and control/estimation synthesis~\cite{mypaperTAC,ncm,nscm,Ref:Stochastic,mypaper} (see Table~\ref{tab:contraction_summary}). We emphasize that some of these methodological simplifications in contraction theory are accomplished by its extensive use of exponential stability along with the comparison lemma~\cite[pp. 102-103, pp. 350-353]{Khalil:1173048}, in lieu of Input-to-State Stability (ISS) or uniform asymptotic stability which often renders nonlinear stability analysis more involved~\cite{Isidori:1995:NCS:545735,marino1995nonlinear,Khalil:1173048,Vidyasagar,Ref_Slotine,Nijmeijer}. Several studies related to the notion of contraction, although not based on direct differential analysis, can be traced back to~\cite{Hart,Demi,Lew}. The objective of this tutorial paper is to elucidate how contraction theory may be utilized as a method of providing provable incremental exponential robustness and stability guarantees of learning-based and data-driven automatic control techniques. In pursuit of this goal, we also provide an overview of the advantages of contraction theory and present a systematic convex optimization formulation to explicitly construct an optimal contraction metric and a differential Lyapunov function for general nonlinear deterministic and stochastic systems. \begin{table*}[htbp] \caption{Differences between Contraction Theory and Lyapunov Theory. \label{tab:contraction_summary}} \footnotesize \begin{center} \renewcommand{\arraystretch}{1.2} \begin{tabular}{ |l|m{6.6cm}|m{6.6cm}| } \hline & Contraction theory (which constructs positive definite matrix $M(x,t)$ that defines contraction metric) & Lyapunov direct method (which constructs Lyapunov function $V(x,t)$) \\ \hline \hline 1. Lyapunov function & Always quadratic function of differential state $\delta x$ ($V=\delta x^{\top} M(x,t)\delta x$) & Any function of $x$, including $V(x,t)=x^{\top}M(x,t)x$\\ \hline 2. Stability condition & Exponential stability of trajectories including points/invariant sets$^*$ & Asymptotic or exponential stability of points and invariant sets \\ \hline 3. Incremental stability & Incremental stability of trajectories using differential displacements ($\lim_{t\to\infty}\delta x(t)=0$) & Incremental stability via stability of points ($\lim_{t\to\infty}(x(t)-x_d(t))=0$ for given $x_d(t)$) \\ \hline 4. Non-autonomous system & Same theory for autonomous systems & Additional conditions required for non-autonomous stability analysis \\ \hline 5. Robustness analysis \ & Intuitive both for ISS and finite-gain $\mathcal{L}_p$ stability due to extensive use of exponential stability & Same as contraction theory if exponentially stable; more involved if uniformly asymptotically stable \\ \hline 6. Analogy to linear system & LTV-like differential dynamics for global convergence & Indirect methods use linearization for local stability (direct methods use motion integrals) \\ \hline 7. $\mathcal{L}_2$ stability condition & Reduces to LMI conditions in terms of contraction metric defined by positive definite matrix $M$ & Hamilton-Jacobi inequality (PDE) in terms of Lyapunov function $V$~\cite[p. 211]{Khalil:1173048}\\ \hline 8. Modular stability & Differential analysis handles hierarchical, feedback, and parallel combinations~\cite{Ref:contraction2} & Passivity is not intuitive for hierarchical combinations \\ \hline \end{tabular} \end{center} \footnotesize{$^*$A semi-contracting system with a negative semi-definite generalized Jacobian matrix can be used to analyze asymptotic stability (see Sec.~\ref{Sec:adaptive}).} \end{table*} \renewcommand{\arraystretch}{1.0} \subsection{Paper Organization} \label{Sec:organization} This tutorial paper is organized into the following two groups of sections. \subsubsection*{\hyperref[part1NSA]{Part~I: Nonlinear Stability Analysis (Sec.~\ref{sec:ContractionCH2}--\ref{sec:convex})}} In Sec.~\ref{sec:ContractionCH2}, we present fundamental results of contraction theory for nonlinear robustness and stability analysis. Sections~\ref{sec:HinfKYP} and~\ref{sec:convex} consider nonlinear optimal feedback control and estimation problems from the perspective of contraction theory, deriving and delineating a convex optimization-based method for constructing contraction metrics. Section~\ref{sec:HinfKYP} also presents some new results on relating contraction theory to the bounded real lemma~\cite{lmi} and Kalman–Yakubovich–Popov (KYP) lemma~\cite[p. 218]{kypbook}. \subsubsection*{\hyperref[part2LBC]{Part~II: Learning-based Control (Sec.~\ref{Sec:learning_stability}--\ref{Sec:datadriven})}} In Sec.~\ref{Sec:learning_stability}, we derive several theorems which form the basis of learning-based control using contraction theory. Sections~\ref{Sec:ncm} and~\ref{Sec:lagros} present frameworks for learning-based control, estimation, and motion planning via contraction theory using deep neural networks for designing contraction metrics, and Section~\ref{Sec:adaptive} extends these results to parametric uncertain nonlinear systems with adaptive control techniques. In Sec.~\ref{Sec:datadriven}, we propose model-free versions of contraction theory for learning-based and data-driven control. \subsection{Related Work} In the remainder, we give an overview of each section (Sec.~\ref{sec:ContractionCH2}--\ref{Sec:datadriven}) as well as a survey of related work. \subsubsection*{Contraction Theory (Sec.~\ref{sec:ContractionCH2})} \label{sec:contraction_lyapunov} According to contraction theory, all the solution trajectories of a given nonlinear system converge to one single trajectory incrementally and exponentially, regardless of the initial conditions, if the system has a contraction metric and its associated quadratic Lyapunov function of the differential state~\cite{Ref:contraction1} (see $1$--$3$ of Table~\ref{tab:contraction_summary}). This paper primarily considers this generalized notion of stability, called incremental exponential stability, which enables systematic learning-based and data-driven control synthesis with formal robustness and stability guarantees. The purpose of this section is not for proposing that other notions of stability, such as traditional Lyapunov-based stability or incremental asymptotic stability for semi-contraction systems, should be replaced by incremental exponential stability, but for clarifying its advantages to help determine which of these concepts is the best fit when analyzing nonlinear robustness and stability (see Sec.~\ref{sec:ContractionCH2} for the illustrative examples). In keeping with the use of the comparison lemma~\cite[pp. 102-103, pp. 350-353]{Khalil:1173048}, incremental exponential stability naturally holds for non-autonomous nonlinear systems without any additional conditions or modifications unlike Lyapunov techniques (see, e.g.{}, the examples and theorems in~\cite{Rantzer}). Such aspects of contraction theory, including the extensive use of exponential stability, result in intuitive proofs on ISS and finite-gain $\mathcal{L}_p$ stability both for autonomous and non-autonomous nonlinear systems, without resorting to uniform asymptotic stability which makes stability analysis much more involved than necessary~\cite{Isidori:1995:NCS:545735,marino1995nonlinear,Khalil:1173048,Vidyasagar,Ref_Slotine,Nijmeijer}. In particular, perturbed systems with a time-varying target trajectory are non-autonomous, and thus contraction theory allows us to easily obtain an explicit exponential bound on its tracking error~\cite{Ref:contraction1,Ref:phasesync,mypaperTAC,Ref:Stochastic,mypaper}, leveraging incremental stability of the perturbed system trajectories with respect to the target trajectory (see $4$ of Table~\ref{tab:contraction_summary}). Having such analytical bounds on the tracking error is almost essential for the safe and robust implementation of automatic control schemes in real-world scenarios. Contraction theory also simplifies input-output stability analysis, such as $\mathcal{L}_p$ gain analysis of nonlinear systems including the $\mathcal{H}_{\infty}$ nonlinear optimal control problem~\cite{256331,159566,29425,85062,151101,599969,doi:10.1137/S0363012996301336,1259458}. For example, in Lyapunov theory, the problem of finding a suitable Lyapunov function with the smallest $\mathcal{L}_2$ gain boils down to solving a Partial Differential Equation (PDE) called the Hamilton-Jacobi inequality~\cite[p. 211]{Khalil:1173048},~\cite{256331} in terms of its associated Lyapunov function. In essence, since contraction theory utilizes a quadratic Lyapunov function of the differential state for stability analysis, the problem could be solved with a Linear Matrix Inequality (LMI) constraint~\cite{lmi} analogous to the KYP lemma~\cite[p. 218]{kypbook} in LTV systems theory~\cite{mypaperTAC,Ref:Stochastic,mypaper,rccm}, as shall be shown in Sec.~\ref{sec:HinfKYP}--\ref{sec:convex} (see $5$--$7$ of Table~\ref{tab:contraction_summary}). There exist stochastic analogues of these stability results for nonlinear systems with stochastic perturbations~\cite{Pham2009,mypaperTAC,Ref:Stochastic,mypaper,han2021incremental}, as shall be outlined also in this paper. Another notable feature of contraction theory is modularity, which preserves contraction through parallel, feedback, and hierarchical combinations~\cite{Ref:contraction2,Ref:contraction5}, specific time-delayed feedback communications~\cite{1618853}, synchronized coupled oscillations~\cite{Ref:contraction3,Ref:contraction_robot}, and synchronized networks~\cite{Ref:contraction2,Ref:phasesync,Ref:contraction_sync,Ref:contraction_robot,6327337,Ref:phasesync,Ref:ChungTRO}, expanding the results obtainable with the passivity formalism of Lyapunov theory~\cite{passivity},~\cite[p. 227]{Khalil:1173048},~\cite[p. 132]{Ref_Slotine} (see $8$ of Table~\ref{tab:contraction_summary}). Due to all these useful properties, extensions of contraction theory have been considered in many different settings. These include, but are not limited to, stochastic contraction (Gaussian white noise~\cite{Pham2009,mypaperTAC,Ref:Stochastic,mypaper}, Poisson shot noise and L\'{e}vy noise~\cite{han2021incremental}), contraction for discrete and hybrid nonlinear systems~\cite{Ref:contraction1,Ref:contraction_robot,Ref:contraction4,4795665,mypaperTAC,mypaper}, partial contraction~\cite{Ref:contraction3}, transverse contraction~\cite{MANCHESTER201432}, incremental stability analysis of nonlinear estimation (the Extended Kalman Filter (EKF)~\cite{6849943}, nonlinear observers~\cite{zhao2005discrete,Ref:Stochastic}, Simultaneous Localization And Mapping (SLAM)~\cite{doi:10.1177/0278364917710541}), generalized gradient descent based on geodesical convexity~\cite{beyondconvexity}, contraction on Finsler and Riemannian manifolds~\cite{6632882,scrm,SIMPSONPORCO201474}, contraction on Banach and Hilbert spaces for PDEs~\cite{6580717,6161268,pdecontraction}, non-Euclidean contraction~\cite{davydov2021noneuclidean}, contracting learning with piecewise-linear basis functions~\cite{lohmiller2018notes}, incremental quadratic stability analysis~\cite{quad_stability}, contraction after small transients~\cite{MARGALIOT2016178}, immersion and invariance stabilizing controller design~\cite{7581040,1193738}, and Lipschitz-bounded neural networks for robustness and stability guarantees~\cite{neurallander,revay2020lipschitz,revay2021recurrent}. \subsubsection*{Construction of Contraction Metrics (Sec.~\ref{sec:HinfKYP}--\ref{sec:convex})} \label{sec:contraction_search} The benefits of contraction theory reviewed so far naturally lead to a discussion on how to design a contraction metric and corresponding Lyapunov function. There are some cases in which we can analytically find them using special structures of systems in question~\cite{Isidori:1995:NCS:545735,Ref_Slotine,Khalil:1173048}. Among these are Lagrangian systems~\cite[p. 392]{Ref_Slotine}, where one easy choice of positive definite matrices that define a contraction metric is the inertia matrix, or feedback linearizable systems~\cite{532343,Primbs99nonlinearoptimal,1425952,AYLWARD20082163,5443730}, where we could solve the Riccati equation for a contraction metric as in LTV systems. This is also the case in the context of state estimation (e.g.{}, the nonlinear SLAM problem can be reformulated as an LTV estimation problem using virtual synthetic measurements~\cite{doi:10.1177/0278364917710541,Ref:Stochastic}). Once we find a contraction metric and Lyapunov function of a nominal nonlinear system for the sake of stability, they could be used as a Control Lyapunov Function (CLF) to attain stabilizing feedback control~\cite{doi:10.1137/0321028,SONTAG1989117,Khalil:1173048} or could be augmented with an integral control law called adaptive backstepping to recursively design a Lyapunov function for strict- and output-feedback systems~\cite{backstepping,DENG1997143,Deng1999,5160111}. However, deriving an analytical form of contraction metrics for general nonlinear systems is challenging, and thus several search algorithms have been developed for finding them at least numerically using the LMI nature of the contraction condition. The simplest of these techniques is the method of State-Dependent Riccati Equation (SDRE)~\cite{sddre,Banks2007,survey_SDRE}, which uses the State-Dependent Coefficient (SDC) parameterization (also known as extended linearization) of nonlinear systems for feedback control and state estimation synthesis. Motivating optimization-based approaches to design a contraction metric, it is proposed in~\cite{mypaperTAC,Ref:Stochastic,mypaper} that the Hamilton-Jacobi inequality for the finite-gain $\mathcal{L}_2$ stability condition can be expressed as an LMI when contraction theory is equipped with the extended linearity of the SDC formulation. Specifically, in~\cite{mypaperTAC,ncm,nscm,mypaper}, a convex optimization-based framework for robust feedback control and state estimation, named ConVex optimization-based Steady-state Tracking Error Minimization (CV-STEM), is derived to find a contraction metric that minimizes an upper bound of the steady-state distance between perturbed and unperturbed system trajectories. In this context, we could utilize Control Contraction Metrics (CCMs)~\cite{ccm,7989693,47710,WANG201944,vccm,rccm} for extending contraction theory to the systematic design of differential feedback control $\delta u = k(x,\delta x,u,t)$ via convex optimization, achieving greater generality at the expense of computational efficiency in obtaining $u$. Applications of the CCM to estimation, adaptive control, and motion planning are discussed in~\cite{estimation_ccm},~\cite{9109296,lopez2021universal,regretboffi}, and~\cite{7989693,8814758,9303957,L1contraction2,sun2021uncertaintyaware}, respectively, using geodesic distances between trajectories~\cite{scrm}. It is also worth noting that the objective function of CV-STEM has the condition number of a positive definite matrix that defines a contraction metric as one of its arguments, rendering it applicable and effective even to machine learning-based automatic control frameworks as shall be seen in Sec.~\ref{Sec:learning_stability}--\ref{Sec:datadriven}. \subsubsection*{Contraction Theory for Learning-based Control (Sec.~\ref{Sec:learning_stability})} \label{sec:contraction_machine_learning} One drawback of these numerical schemes is that they require solving optimization problems or nonlinear systems of equations at each time instant online, which is not necessarily realistic in practice. In Lyapunov theory, approximating functions in a given hypothesis space has therefore been a standard technique~\cite{664157,JOHANSEN20001617,LyapunovRBF,1184414,spencer18lyapunovnn,NIPS2019_8587,8263816,9115021,9146356,9147615}, where examples of its function classes include piecewise quadratic functions~\cite{664157}, linearly parameterized non-quadratic functions~\cite{JOHANSEN20001617}, a linear combination of radial basis functions~\cite{LyapunovRBF}, Sum-Of-Squares (SOS) functions~\cite{1184414}, and neural networks~\cite{spencer18lyapunovnn,NIPS2019_8587}. In~\cite{AYLWARD20082163,ccm}, the SOS approximation is investigated for the case of contraction theory, showing that the contraction condition can be relaxed to SOS conditions for dynamics with polynomial or rational vector fields. Although computationally tractable, it still has some limitations in that the problem size grows exponentially with the number of variables and basis functions~\cite{sos_dissertation}. Learning-based and data-driven control using contraction theory~\cite{ncm,nscm,ancm,lagros} has been developed to refine these ideas, using the high representational power of DNNs~\cite{neural1,neural2,neural3} and their scalable training realized by stochastic gradient descent~\cite{sgd,beyondconvexity}. The major advantage of using contraction theory for learning-based and data-driven control is that, by regarding its internal learning error as an external disturbance, we can ensure the distance between the target and learned trajectories to be bounded exponentially with time as in the CV-STEM results~\cite{ncm,nscm,ancm,lagros}, with its steady-state upper bound proportional to the learning error. Such robustness and incremental stability guarantees are useful for formally evaluating the performance of machine learning techniques such as reinforcement learning~\cite{sutton,ndp,8593871,NIPS2017_766ebcd5}, imitation learning~\cite{9001182,glas,NIPS2016_cc7e2b87,8578338,7995721}, or neural networks~\cite{neural1,neural2,neural3}. This implies contraction theory could be utilized as a central tool in realizing safe and robust operations of learning-based and data-driven control, estimation, and motion planning schemes in real-world scenarios. We especially focus on the following areas of research. \subsubsection*{Learning-based Robust Control and Estimation (Sec.~\ref{Sec:ncm})} In order to achieve real-time computation of a contraction metric, mathematical models based on a Deep Neural Network (DNN) called a Neural Contraction Metric (NCM)~\cite{ncm} and Neural Stochastic Contraction Metric (NSCM)~\cite{nscm} are derived to compute optimal CV-STEM contraction metrics for nonlinear systems perturbed by deterministic and stochastic disturbances, respectively. It can be proven that the NCM and NSCM still yield robustness and optimality associated with the CV-STEM framework despite having non-zero modeling errors~\cite{cdc_ncm}. These metrics could also be synthesized and learned simultaneously with their feedback control laws directly by DNNs~\cite{chuchu,sun2021uncertaintyaware,cdc_ncm} at the expense of the convex property in the CV-STEM formulation. \subsubsection*{Learning-based Robust Motion Planning (Sec.~\ref{Sec:lagros})} In~\cite{7989693,zhao2021tubecertified}, contraction theory is leveraged to develop a tracking feedback controller with an optimized control invariant tube, solving the problem of robust motion planning under bounded external disturbances. This problem is also considered for systems with changing operating conditions~\cite{8814758} and parametric uncertainty~\cite{9303957,L1contraction2,sun2021uncertaintyaware} for its broader use in practice. As these methods still require online computation of a target trajectory, Learning-based Autonomous Guidance with RObustness and Stability (LAG-ROS)~\cite{lagros} is developed to model such robust control laws including the CV-STEM by a DNN, without explicitly requiring the target or desired trajectory as its input. While this considers motion planning algorithms only implicitly to avoid solving them in real-time, it is shown that contraction theory still allows us to assure a property of robustness against deterministic and stochastic disturbances following the same argument as in the NCM and NSCM work~\cite{lagros}. Note that LAG-ROS using contraction theory is not intended to derive new learning-based motion planning, but rather to augment any existing motion planner with a real-time method of guaranteeing formal incremental robustness and stability, and thus still applicable to other methods such as tube-based robust Model Predictive Control (MPC)~\cite{tube_nmpc,tube_mpc,7989693,10.1007/BFb0109870,zhao2021tubecertified,learningmpc}, its dynamic and adaptive counterparts~\cite{8814758,9303957,L1contraction2,sun2021uncertaintyaware}, and CCM-based learning certified control~\cite{chuchu}. \subsubsection*{Learning-based Adaptive Control (Sec.~\ref{Sec:adaptive})} Adaptive control using contraction theory is studied in~\cite{5160111} for parametric strict-feedback nonlinear systems, and recently generalized to deal with systems with unmatched parametric uncertainty by means of parameter-dependent CCM feedback control~\cite{9109296,lopez2021universal}. This method is further explored to develop an adaptive Neural Contraction Metric (aNCM)~\cite{ancm}, a parameter-dependent DNN model of the adaptive CV-STEM contraction metric. As the name suggests, the aNCM control makes adaptive control of~\cite{9109296,lopez2021universal} implementable in real-time for asymptotic stabilization, while maintaining the learning-based robustness and CV-STEM-type optimality of the NCM. Although it is designed to avoid the computation for evaluating integrals involving geodesics unlike~\cite{9109296,lopez2021universal}, these differential state feedback schemes could still be considered, trading off added computational cost for generality. It is demonstrated in~\cite{ancm} that the aNCM is applicable to many types of systems such as robotics systems~\cite[p. 392]{Ref_Slotine}, spacecraft high-fidelity dynamics~\cite{battin,doi:10.2514/1.55705}, and systems modeled by basis function approximation and DNNs~\cite{Nelles2001,SannerSlotine1992}. Discrete changes could be incorporated in this framework using~\cite{regretboffi,1469901}. \subsubsection*{Contraction Theory for Learned Models (Sec.~\ref{Sec:datadriven})} Recent applications of machine learning often consider challenging scenarios in the field of systems and control theory, where we only have access to system trajectory data generated by unknown underlying dynamics, and the assumptions in the aforementioned adaptive control techniques are no longer valid. For situations where the data is used for system identification of full/residual dynamics~\cite{neurallander,47710} by a spectrally-normalized DNN~\cite{miyato2018spectral}, we can show by contraction theory that the model-based approaches (e.g.{} CV-STEM and NCM) are still utilizable to guarantee robustness against dynamics modeling errors and external disturbances. It is also proposed in~\cite{boffi2020learning} that we could directly learn certificate functions such as contraction metrics and their associated Lyapunov functions using trajectory data. Note that some of the theoretical results on gradient descent algorithms, essential in the field of data-driven machine learning, can be replaced by more general ones based on contraction and geodesical convexity~\cite{beyondconvexity}. \subsection{Notation} \label{notation} For a square matrix $A^{n\times n}$, we use the notation $A \succ 0$, $A \succeq 0$, $A \prec 0$, and $A \preceq 0$ for the positive definite, positive semi-definite, negative definite, negative semi-definite matrices, respectively. The $\mathcal{L}_p$ norm in the extended space $\mathcal{L}_{pe}$~\cite[pp. 196-197]{Khalil:1173048}, $p \in [1,\infty]$, is defined as $\|(y)_{\tau}\|_{\mathcal{L}_p} = \left(\int_0^\tau \|y(t)\|^p\right)^{{1}/{p}} < \infty$ for $p\in[1,\infty)$ and $\|(y)_{\tau}\|_{\mathcal{L}_{\infty}} = \sup_{t\geq 0}\|(y(t))_{\tau}\| < \infty$ for $p =\infty$, where $(y(t))_{\tau}$ is a truncation of $y(t)$, i.e., $(y(t))_{\tau} = 0$ for $t > \tau$ and $(y(t))_{\tau} = y(t)$ for $0 \leq t \leq \tau$ with $\tau \in \mathbb{R}_{\geq 0}$. Furthermore, we use $f_{x} = \partial f/\partial x$, $M_{x_i} = \partial M/\partial x_i$, and $M_{x_ix_j} = \partial^2 M/(\partial x_i\partial x_j)$, where $x_i$ and $x_j$ ate the $i$th and $j$th elements of $x \in \mathbb{R}^n$, for describing partial derivatives in a limited space. The other notations are given in Table~\ref{tab:notations_in_this_paper}. \begin{table} \caption{Notations used in this paper. \label{tab:notations_in_this_paper}} \footnotesize \begin{center} \renewcommand{\arraystretch}{1.2} \begin{tabular}{ |c|m{6.3cm}| } \hline $\|x\|$ & Euclidean norm of $x \in \mathbb{R}^n$ \\ \hline $\delta x$ & Differential displacement of $x \in \mathbb{R}^n$ \\ \hline $\|A\|$ & Induced $2$-norm of $A \in \mathbb{R}^{n\times m}$ \\ \hline $\|A\|_F$ & Frobenius norm of $A \in \mathbb{R}^{n\times m}$ \\ \hline $\sym(A)$ & Symmetric part of $A\in\mathbb{R}^{n\times n}$, i.e.{}, $(A+A^{\top})/2$ \\ \hline $\lambda_{\min}(A)$ & Minimum eigenvalue of $A\in\mathbb{R}^{n\times n}$ \\ \hline $\lambda_{\max}(A)$ & Maximum eigenvalue of $A\in\mathbb{R}^{n\times n}$ \\ \hline $\mathrm{I}$ & Identity matrix of appropriate dimensions \\ \hline $\mathop{\mathbb{E}}$ & Expected value operator \\ \hline $\mathop{\mathbb{P}}$ & Probability measure \\ \hline $\mathbb{R}_{>0}$ & Set of positive reals, i.e.{}, $\{a\in\mathbb{R}|a\in(0,\infty)\}$ \\ \hline $\mathbb{R}_{\geq 0}$ & Set of non-negative reals, i.e.{}, $\{a\in\mathbb{R}|a\in[0,\infty)\}$ \\ \hline \end{tabular} \end{center} \end{table} \part*{\large Part I: Nonlinear Stability Analysis} \label{part1NSA} \section{Contraction Theory} \label{sec:ContractionCH2} We present a brief review of the results from~\cite{Ref:contraction1,Ref:contraction2,Ref:contraction3,Pham2009,Ref:phasesync,mypaperTAC,Ref:Stochastic,mypaper}. They will be extensively used to provide formal robustness and stability guarantees for a variety of systems in the subsequent sections, simplifying and generalizing Lyapunov theory. \subsection{Fundamentals} Consider the following smooth non-autonomous (i.e.{}, time-varying) nonlinear system: \begin{equation} \label{eq:xfx} {{\dot x}}(t)={f}({x}(t),t) \end{equation} where $t \in \mathbb{R}_{\geq 0}$ is time, ${x}:\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^n$ the system state, and ${f}: \mathbb{R}^n\times\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^n$ is a smooth function. Note that the smoothness of $f(x,t)$ guarantees existence and uniqueness of the solution to \eqref{eq:xfx} for a given $x(0)=x_0$ at least locally~\cite[pp. 88-95]{Khalil:1173048}. \begin{definition} A differential displacement, $\delta{x}$, is defined as an infinitesimal displacement at a fixed time as used in the calculus of variation~\cite[p. 107]{citeulike:802300}, and \eqref{eq:xfx} yields the following differential dynamics: \begin{align} \label{eq:original_differential} \delta\dot{x}(t)=\frac{\partial f}{\partial x}({x}(t),t)\delta x(t) \end{align} where $f({x}(t),t)$ is given in \eqref{eq:xfx}. \end{definition} Let us first present a special case of the comparison lemma~\cite[pp. 102-103, pp. 350-353]{Khalil:1173048} to be used extensively throughout this paper. \begin{lemma} \label{Lemma:comparison} Suppose that a continuously differentiable function $v\in\mathbb{R}_{\geq0}\mapsto\mathbb{R}$ satisfies the following differential inequality: \begin{align} \label{cl_ivp} \dot{v}(t) \leq -\gamma v(t)+c,~v(0)=v_0,~\forall t\in\mathbb{R}_{\geq 0} \end{align} where $\gamma \in \mathbb{R}_{>0}$, $c\in\mathbb{R}$, and $v_0\in\mathbb{R}$. Then we have \begin{align} v(t) \leq v_0e^{-\gamma t}+\frac{c}{\gamma}(1-e^{-\gamma t}),~\forall t\in\mathbb{R}_{\geq 0}. \end{align} \end{lemma} \begin{proof} See~\cite[pp. 659-660]{Khalil:1173048}. \qed \end{proof} \subsubsection{Contraction Theory and Contraction Metric} In Lyapunov theory, nonlinear stability of \eqref{eq:xfx} is studied by constructing a Lyapunov function $V(x,t)$, one example of which is $V=x^\top P(x,t)x$. However, finding $V(x,t)$ for general nonlinear systems is challenging as $V(x,t)$ can be any scalar function of $x$ (e.g.{}, a candidate $V(x,t)$ can be obtained by solving a PDE~\cite[p. 211]{Khalil:1173048}). In contrast, as summarized in Table~\ref{tab:contraction_summary}, contraction theory uses a differential Lyapunov function that is always a quadratic function of $\delta x$, i.e.{}, $V(x,\delta x,t)=\delta x^{\top} M(x,t)\delta x$, thereby characterizing a necessary and sufficient condition for incremental exponential convergence of the multiple nonlinear system trajectories to one single trajectory. Thus, the problem of finding $V$ for stability analysis boils down to finding a finite-dimensional positive-definite matrix $M$, as illustrated in Figure~\ref{fig:contraction}~\cite{Ref:contraction1}. These properties to be derived in Theorem~\ref{Thm:contraction}, which hold both for autonomous (i.e.{} time-invariant) and non-autonomous systems, epitomize significant methodological simplifications of stability analysis in contraction theory. \begin{figure}[t] \centering \includegraphics[width=89mm]{figures/contraction_analysis_rev3.pdf} \caption{Lyapunov theory and contraction theory, where $V$ is a Lyapunov function and $\delta z = \Theta (x,t)\delta x$ for $M(x,t)=\Theta(x,t)\Theta(x,t)^{\top}\succ 0$ that defines a contraction metric (see Theorem~\ref{Thm:contraction}).} \label{fig:contraction} \end{figure} \begin{theorem} \label{Thm:contraction} If there exists a uniformly positive definite matrix ${M}({x},t)={{\Theta}}({x},t)^{\top}{{\Theta}}({x},t) \succ 0,~\forall x,t$, where ${\Theta(x,t)}$ defines a smooth coordinate transformation of $\delta x$, i.e.{}, $\delta{z}={\Theta}(x,t)\delta{x}$, s.t.{} either of the following equivalent conditions holds for $\exists \alpha \in \mathbb{R}_{>0}$, $\forall x,t$: \begin{align} &\lambda_{\max}(F(x,t))=\lambda_{\max}\left(\left({\dot{\Theta}}+{{\Theta}}\frac{\partial {f}}{\partial {x}}\right){{\Theta}}^{-1}\right) \leq - \alpha \label{eq_MdotContracting_z} \\ &{\dot{M}}+M\frac{\partial {f}}{\partial {x}}+\frac{\partial {f}}{\partial {x}}^{\top}M \preceq -2\alpha M \label{eq_MdotContracting} \end{align} where the arguments $(x,t)$ of $M(x,t)$ and $\Theta(x,t)$ are omitted for notational simplicity, then all the solution trajectories of \eqref{eq:xfx} converge to a single trajectory exponentially fast regardless of their initial conditions (i.e.{}, contracting, see Definition~\ref{Def:contraction}), with an exponential convergence rate $\alpha$. The converse also holds. \end{theorem} \begin{proof} The proof of this theorem can be found in~\cite{Ref:contraction1}, but here we emphasize the use of the comparison lemma given in Lemma~\ref{Lemma:comparison}. Taking the time-derivative of a differential Lyapunov function of $\delta x$ (or $\delta z$), $V=\delta {z}^{\top}\delta {z}=\delta{x}^{\top}M(x,t)\delta{x}$, using the differential dynamics \eqref{eq:original_differential}, we have \begin{align} \dot{V}(x,\delta x, t)&=2\delta {z}^{\top}{F}\delta{z}=\delta{x}^{\top}\Bigl({\dot{M}}+\frac{\partial {f}}{\partial {x}}^{\top}{{M}}+{{M}}\frac{\partial {f}}{\partial {x}}\Bigr)\delta{x}\nonumber \\ &\leq -2\alpha \delta{z}^{\top}\delta{z} =- 2 \alpha \delta {x}^{\top}{M}({x},t) \delta {x} \end{align} where the conditions \eqref{eq_MdotContracting_z} and \eqref{eq_MdotContracting} are used with the generalized Jacobian $F$ in \eqref{eq_MdotContracting_z} obtained from $\delta \dot{z}=\dot{\Theta}\delta x+ \Theta\delta\dot{x}=F\delta z$. We get $d\|\delta {z}\|/dt \leq -\alpha\|\delta {z}\|$ by $d\|\delta {z}\|^2/dt=2\|\delta {z}\|d\|\delta {z}\|/dt$, which then yields $\|\delta {z}(t)\|\leq \|\delta {z}_0\|e^{-\alpha t}$ by the comparison lemma of Lemma~\ref{Lemma:comparison}. Hence, any infinitesimal length $\|\delta {z}(t)\|$ and $\|\delta {x}(t)\|$, as well as $\delta z$ and $\delta x$, tend to zero exponentially fast. By path integration (see Definition~\ref{Def:incremental} and Theorem~\ref{Thm:path_integral}), this immediately implies that the length of any finite path converges exponentially to zero from any initial conditions. Conversely, consider an exponentially convergent system, which implies the following for $\exists\beta >0$ and $\exists k \geq 1$: \begin{align} \label{converse_exp} \|\delta x(t)\|^2 \leq -k\|\delta x(0)\|^2e^{-2 \beta t} \end{align} and define a matrix-valued function $\Xi(x(t),t)\in\mathbb{R}^{n\times n}$ (not necessarily $\Xi\succ0$) as \begin{align} \label{converse_Meq} \dot{\Xi} = -2\beta \Xi-\Xi\frac{\partial {f}}{\partial {x}}-\frac{\partial {f}}{\partial {x}}^{\top}\Xi,~\Xi(x(0),0) = k\mathrm{I}. \end{align} Note that, for $V=\delta x^{\top}\Xi\delta x$, \eqref{converse_Meq} gives $\dot{V}=-2\beta V$, resulting in $V=-k\|\delta x(0)\|^2e^{-2 \beta t}$. Substituting this into \eqref{converse_exp} yields \begin{align} \label{converse_posdef} \|\delta x(t)\|^2 = \delta x(t)^{\top}\delta x(t)\leq V=\delta x(t)^{\top}\Xi(x(t),t)\delta x(t) \end{align} which indeed implies that $\Xi \succeq \mathrm{I} \succ 0$ as \eqref{converse_posdef} holds for any $\delta x$. Thus, $\Xi$ satisfies the contraction condition \eqref{eq_MdotContracting}, i.e.{}, $\Xi$ defines a contraction metric (see Definition~\ref{Def:contraction})~\cite{Ref:contraction1}. \qed \end{proof} \begin{remark} Since $M$ of Theorem~\ref{Thm:contraction} is positive definite, i.e.{}, $v^{\top}Mv=\|\Theta v\|^2\geq0,~\forall v\in\mathbb{R}^n$, and $\|\Theta v\|^2=0$ if and only if $v=0$, the equation $\Theta v=0$ only has a trivial solution $v=0$. This implies that $\Theta$ is always non-singular (i.e.{}, $\Theta(x,t)^{-1}$ always exists). \end{remark} \begin{definition} \label{Def:incremental} Let $\xi_0(t)$ and $\xi_1(t)$ denote some solution trajectories of \eqref{eq:xfx}. We say that \eqref{eq:xfx} is incrementally exponentially stable if $\exists C,\alpha>0$ s.t.{} the following holds~\cite{989067}: \begin{align} \label{eq:incremental} \|\xi_1(t)-\xi_0(t)\| \leq Ce^{-\alpha t}\|\xi_0(0)-\xi_1(0)\| \end{align} for any $\xi_0(t)$ and $\xi_1(t)$. Note that, since we have $\|\xi_1(t)-\xi_0(t)\|=\|\int_{\xi_0}^{\xi_1}\delta x\|$ (see Theorem~\ref{Thm:path_integral}), Theorem~\ref{Thm:contraction} implies incremental stability of the system \eqref{eq:xfx}. \end{definition} \begin{definition} \label{Def:contraction} The system \eqref{eq:xfx} satisfying the conditions in Theorem~\ref{Thm:contraction} is said to be contracting, and a uniformly positive definite matrix $M$ that satisfies \eqref{eq_MdotContracting} defines a contraction metric. As to be discussed in Theorem~\ref{Thm:path_integral} of Sec.~\ref{sec:robustpath}, a contracting system is incrementally exponentially stable in the sense of Definition~\ref{Def:incremental}. \end{definition} \begin{example} \label{ex:cont_ex1} One of the distinct features of contraction theory in Theorem~\ref{Thm:contraction} is incremental stability with exponential convergence. Consider the example given in~\cite{Ref:contraction6}: \begin{align} \label{ex_eq_incremental} \dfrac{d}{dt}\begin{bmatrix}x_1\\x_2\end{bmatrix} = \begin{bmatrix}-1 & x_1\\-x_1 & -1\end{bmatrix}\begin{bmatrix}x_1\\x_2\end{bmatrix}. \end{align} A Lyapunov function $V = \|x\|^2/2$ for \eqref{ex_eq_incremental}, where $x=[x_1,x_2]^{\top}$, yields $\dot{V} \leq -2V$. Thus, \eqref{ex_eq_incremental} is exponentially stable with respect to $x=0$. The differential dynamics of \eqref{ex_eq_incremental} is given as \begin{align} \label{ex_eq_incremental_diff} \dfrac{d}{dt}\begin{bmatrix}\delta x_1\\\delta x_2\end{bmatrix} = \begin{bmatrix}-1+x_2 & x_1\\-2x_1 & -1\end{bmatrix}\begin{bmatrix}\delta x_1\\\delta x_2\end{bmatrix}. \end{align} and the contraction condition \eqref{eq_MdotContracting} for \eqref{ex_eq_incremental_diff} can no longer be proven by $V=\|\delta x\|^2/2$, due to the lack of the skew-symmetric property of \eqref{ex_eq_incremental} in \eqref{ex_eq_incremental_diff}. This difficulty illustrates the difference between Lyapunov theory and contraction theory, where the former considers stability of \eqref{ex_eq_incremental} with respect to the equilibrium point, while the latter analyzes exponential convergence of any couple of trajectories in \eqref{ex_eq_incremental} with respect to each other (i.e.{}, incremental stability in Definition~\ref{Def:incremental})~\cite{Ref:contraction1,Ref:contraction6}. \end{example} \begin{example} Contraction defined by Theorem~\ref{Thm:contraction} guarantees incremental stability of their solution trajectories but does not require the existence of stable fixed points. Let us consider the following system for $x:\mathbb{R}_{\geq0}\mapsto\mathbb{R}$: \begin{align} \label{easy_example} \dot{x} = -x + e^t. \end{align} Using the constraint \eqref{eq_MdotContracting} of Theorem~\ref{Thm:contraction}, we can easily verify that \eqref{easy_example} is contracting as $M=\mathrm{I}$ defines its contraction metric with the contraction rate $\alpha=1$. However, since \eqref{easy_example} has $x(t) = e^t/2+(x(0)-1/2)e^{-t}$ as its unique solution, it is not stable with respect to any fixed point. \end{example} \begin{example} \label{ex:lyapunov_contraction} Consider a Linear Time-Invariant (LTI) system, $\dot{x} = f(x) = Ax$. Lyapunov theory states that the origin is globally exponentially stable if and only if there exists a constant positive-definite matrix $P\in\mathbb{R}^{n\times n}$ s.t.{}~\cite[pp. 67-68]{lssbook} \begin{align} \label{lin_lyapunov} \exists \epsilon >0\text{ s.t.{} }PA+A^{\top}P \preceq -\epsilon \mathrm{I}. \end{align} Now, let $\overline{p} = \|P\|$. Since $-\mathrm{I} \preceq -P/\overline{p}$, \eqref{lin_lyapunov} implies that $PA+A^{\top}P \leq -(\epsilon/\overline{p})P$, which shows that $M=P$ with $\alpha = \epsilon/(2\overline{p})$ satisfies \eqref{eq_MdotContracting} due to the relation $\partial f/\partial x = A$. The contraction condition \eqref{eq_MdotContracting} can thus be viewed as a generalization of the Lyapunov stability condition \eqref{lin_lyapunov} (see the generalized Krasovskii's theorem~\cite[pp. 83-86]{Ref_Slotine}) in a nonlinear non-autonomous system setting, expressed in the differential formulation that permits a non-constant metric and pure differential coordinate change~\cite{Ref:contraction1}. Furthermore, if $f(x,t)=A(t)x$ and $M=\mathrm{I}$, \eqref{eq_MdotContracting} results in $A(t)+A(t)^{\top} \preceq -2\alpha \mathrm{I}$ (i.e.{}, all the eigenvalues of the symmetric matrix $A(t)+A(t)^{\top}$ remain strictly in the left-half complex plane), which is a known sufficient condition for stability of Linear Time-Varying (LTV) systems~\cite[pp. 114-115]{Ref_Slotine}. \end{example} \begin{example} Most of the learning-based techniques involving neural networks are based on optimizing their hyperparameters by gradient descent~\cite{sgd}. Contraction theory provides a generalized view on the analysis of such continuous-time gradient-based optimization algorithms~\cite{beyondconvexity}. Let us consider a twice differentiable scalar output function $f:\mathbb{R}^n\times\mathbb{R}\mapsto\mathbb{R}$, a matrix-valued function $M:\mathbb{R}^n\mapsto\mathbb{R}^{n\times n}$ with $M(x)\succ0,~\forall x\in\mathbb{R}^n$, and the following natural gradient system~\cite{doi:10.1162/089976698300017746}: \begin{align} \label{eq_natural_grad} \dot{x} = h(x,t) = -M(x)^{-1}\nabla_x f(x,t). \end{align} Then, $f$ is geodesically $\alpha$-strongly convex for each $t$ in the metric defined by $M(x)$ (i.e.{}, $H(x)\succeq \alpha M(x)$ with $H(x)$ being the Riemannian Hessian matrix of $f$ with respect to $M$~\cite{gconvex}), if and only if \eqref{eq_natural_grad} is contracting with rate $\alpha$ in the metric defined by $M$ as in \eqref{eq_MdotContracting} of Theorem~\ref{Thm:contraction}, where $A = {\partial h}/{\partial x}$. More specifically, the Riemannian Hessian verifies $H(x) = -(\dot{M}+MA+A^{\top}M)/2$. See~\cite{beyondconvexity} for details. \end{example} \begin{remark} Theorem~\ref{Thm:contraction} can be applied to other vector norms of $\|\delta {z}\|_p$ with, e.g.{}, $p=1$ or $p=\infty$~\cite{Ref:contraction1}. It can also be shown that for a contracting autonomous system of the form $\dot{x}={f}({x})$, all trajectories converge to an equilibrium point exponentially fast. \end{remark} \subsubsection{Partial Contraction} Although satisfying the condition~\eqref{eq_MdotContracting} of Theorem~\ref{Thm:contraction} guarantees exponential convergence of any couple of trajectories in \eqref{eq:xfx}, proving their incremental stability with respect to a subset of these trajectories possessing a specific property could be sufficient for some cases~\cite{mypaperTAC,ncm,nscm,mypaper}, leading to the concept of partial contraction~\cite{Ref:contraction3}. \begin{theorem} \label{Thm:partial_contraction} Consider the following nonlinear system with the state $x\in\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^n$ and the auxiliary or virtual system with the state $q\in\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^n$: \begin{align} \label{xx_system} \dot{x}(t) =& \textsl{g}(x(t),x(t),t) \\ \label{q_system} \dot{q}(t) =& \textsl{g}(q(t),x(t),t) \end{align} where $\textsl{g}: \mathbb{R}^n\times\mathbb{R}^p\times\mathbb{R}_{\geq 0}\rightarrow\mathbb{R}^n$ is a smooth function. Suppose that \eqref{q_system} is contracting with respect to $q$. If a particular solution of \eqref{q_system} verifies a smooth specific property, then all trajectories of \eqref{xx_system} verify this property exponentially. \end{theorem} \begin{proof} The theorem statement follows from Theorem~\ref{Thm:contraction} and the fact that $q=x$ and a trajectory with the specific property are particular solutions of \eqref{q_system} (see~\cite{Ref:contraction3} for details). \qed \end{proof} The importance of this theorem lies in the fact that we can analyze contraction of some specific parts of the system~\eqref{xx_system} while treating the rest as a function of the time-varying parameter $x(t)$. Strictly speaking, the system \eqref{xx_system} is said to be partially contracting, but we will not distinguish partial contraction from contraction of Definition~\ref{Def:contraction} in this paper for simplicity. Instead, we will use the variable $q$ when referring to partial contraction of Theorem~\ref{Thm:partial_contraction}. Examples of a trajectory with a specific property include the target trajectory $x_d$ of feedback control in \eqref{sdc_dynamicsd}, or the trajectory of actual dynamics $x$ for state estimation in \eqref{sdc_dynamics_est} and \eqref{sdc_dynamics_est_sto} to be discussed in the subsequent sections. Note that contraction can be regarded as a particular case of partial contraction. \begin{example} \label{ex:partial_cont} Let us illustrate the role of partial contraction using the following nonlinear system~\cite{Ref:contraction6}: \begin{align} \dot{x} = -D(x)x+u,~\dot{x}_d = -D(x_d)x_d \end{align} where $x$ is the system state, $x_d$ is the target state, $u$ is the control input designed as $u = -K(x)(x-x_d)+(D(x)-D(x_d))x_d$, and $D(x)+K(x) \succ 0$. We could define a virtual system, which has $q=x$ and $q=x_d$ as its particular solutions, as follows: \begin{align} \label{virtual_simple} \dot{q} = -(D(x)+K(x))(q-x_d)-D(x_d)x_d. \end{align} Since we have $\delta\dot{q} = -(D(x)+K(x))\delta q$ and $D(x)+K(x)\succ0$, \eqref{virtual_simple} is contracting with $M=\mathrm{I}$ in \eqref{eq_MdotContracting}. However, if we consider the following virtual system: \begin{align} \label{virtual_complex} \dot{q} = -(D(q)+K(q))(q-x_d)-D(x_d)x_d \end{align} which also has $q=x$ and $q=x_d$ as its particular solutions, proving contraction is no longer straightforward because of the terms $\partial D/\partial q_i$ and $\partial K/\partial q_i$ in the differential dynamics of \eqref{virtual_complex}. This is due to the fact that, in contrast to \eqref{virtual_simple}, \eqref{virtual_complex} has particular solutions nonlinear in $q$ in addition to $q=x$ and $q=x_d$, and the condition \eqref{eq_MdotContracting} becomes more involved for \eqref{virtual_complex} as it is for guaranteeing exponential convergence of any couple of these particular solution trajectories~\cite{Ref:contraction6}. \end{example} \begin{example} \label{ex:lag_metric} As one of the key applications of partial contraction given in Theorem~\ref{Thm:partial_contraction}, let us consider the following closed-loop Lagrangian system~\cite[p. 392]{Ref_Slotine}: \begin{align} \label{lagrange_partial} &\mathcal{H}(\mathtt{q})\ddot{\mathtt{q}}+\mathcal{C}(\mathtt{q},\dot{\mathtt{q}})\dot{\mathtt{q}}+\mathcal{G}(\mathtt{q})=u(\mathtt{q},\dot{\mathtt{q}},t) \\ \label{lagrange_u} &u(\mathtt{q},\dot{\mathtt{q}},t) = \mathcal{H}(\mathtt{q})\ddot{\mathtt{q}}_r+\mathcal{C}(\mathtt{q},\dot{\mathtt{q}})\dot{\mathtt{q}}_r+\mathcal{G}(\mathtt{q})-\mathcal{K}(t)(\dot{\mathtt{q}}-\dot{\mathtt{q}}_r) \end{align} where $\mathtt{q},\dot{\mathtt{q}}\in\mathbb{R}^n$, $\dot{\mathtt{q}}_r=\dot{\mathtt{q}}_d(t)-\Lambda(t)(\mathtt{q}-\mathtt{q}_d(t))$, $\mathcal{H}: \mathbb{R}^n\mapsto\mathbb{R}^{n\times n}$, $\mathcal{C}: \mathbb{R}^n\times \mathbb{R}^n\mapsto\mathbb{R}^{n\times n}$, $\mathcal{G}: \mathbb{R}^n\mapsto\mathbb{R}^n$, $\mathcal{K}: \mathbb{R}_{\geq 0}\mapsto\mathbb{R}^{n\times n}$, $\Lambda: \mathbb{R}_{\geq 0}\mapsto\mathbb{R}^{n\times n}$, and $(\mathtt{q}_d,\dot{\mathtt{q}}_d)$ is the target trajectory of the state $(\mathtt{q},\dot{\mathtt{q}})$. Note that $\mathcal{K},\Lambda \succ 0$ are control gain matrices (design parameters), and $\dot{\mathcal{H}}-2\mathcal{C}$ is skew-symmetric with $\mathcal{H} \succ 0$ by construction. By comparing with \eqref{lagrange_partial} and \eqref{lagrange_u}, we define the following virtual observer-like system of $q$ (not $\mathtt{q}$) that has $q = \dot{\mathtt{q}}$ and $q = \dot{\mathtt{q}}_r$ as its particular solutions: \begin{align} \label{lagrange_cl} \mathcal{H}(\mathtt{q})\dot{q}+\mathcal{C}(\mathtt{q},\dot{\mathtt{q}}){q} +\mathcal{K}(t)({q}-\dot{\mathtt{q}})+\mathcal{G}(\mathtt{q}) =u(\mathtt{q},\dot{\mathtt{q}},t) \end{align} which gives $\mathcal{H}(\mathtt{q})\delta\dot{q}+(\mathcal{C}(\mathtt{q},\dot{\mathtt{q}})+\mathcal{K}(t))\delta q=0$. We thus have that \begin{align} \label{cont_lagrangian} \dfrac{d}{dt} (\delta q^{\top} \mathcal{H}(\mathtt{q})\delta q) = \delta q^{\top} (\dot{\mathcal{H}}-2\mathcal{C}-2\mathcal{K})\delta q = -2\delta q^{\top}\mathcal{K}\delta q \end{align} where the skew-symmetry of $\dot{\mathcal{H}}-2\mathcal{C}$ is used to obtain the second equality. Since $\mathcal{K}\succ0$, \eqref{cont_lagrangian} indicates that the virtual system \eqref{lagrange_cl} is partially contracting in $q$ with $\mathcal{H}$ defining its contraction metric. Contraction of the full state $(\mathtt{q},\dot{\mathtt{q}})$ will be discussed in Example~\ref{ex:hiera}. Note that if we treat the arguments $(\mathtt{q},\dot{\mathtt{q}})$ of $\mathcal{H}$ and $\mathcal{C}$ also as the virtual state $q$, we end up having additional terms such as $\partial\mathcal{H}/\partial{q_i}$, which makes proving contraction analytically more involved as in Example~\ref{ex:partial_cont}. \end{example} As can be seen from Examples~\ref{ex:partial_cont} and~\ref{ex:lag_metric}, the role of partial contraction in theorem~\ref{Thm:partial_contraction} is to provide some insight on stability even for cases where it is difficult to prove contraction for all solution trajectories as in Theorem~\ref{Thm:contraction}. Although finding a contraction metric analytically for general nonlinear systems is challenging, we will see in Sec.~\ref{sec:HinfKYP} and Sec.~\ref{sec:convex} that the convex nature of the contraction condition \eqref{eq_MdotContracting} helps us find it numerically. \subsection{Path-Length Integral and Robust Incremental Stability Analysis}\label{sec:robustpath} Theorem~\ref{Thm:contraction} can also be proven by using the transformed squared length integrated over two arbitrary solutions of \eqref{eq:xfx}~\cite{Ref:contraction1,Ref:phasesync,mypaperTAC,Ref:Stochastic,mypaper}, which enables formalizing its connection to incremental stability discussed in Definition~\ref{Def:contraction}. Note that the integral forms \eqref{eq_VSL} and \eqref{eq_VL} to be given in Theorem~\ref{Thm:path_integral} are useful for handling perturbed systems with external disturbances as shall be seen in Theorems~\ref{Thm:Robust_contraction_original}--\ref{Thm:discrete_contraction}. \begin{theorem} \label{Thm:path_integral} Let $\xi_0$ and $\xi_1$ be the two arbitrary solutions of \eqref{eq:xfx}, and define the transformed squared length with $M(x,t)$ of Theorem~\ref{Thm:contraction} as follows: \begin{equation}\label{eq_VSL} V_{s\ell}\left(x,\delta x,t\right)=\int^{\xi_1}_{\xi_0} \|\delta z\|^2 =\int_{0}^{1}\frac{\partial x}{\partial\mu}^{\top}M\left(x,t\right)\frac{\partial x}{\partial\mu}d\mu \end{equation} where $x$ is a smooth path parameterized as $x(\mu=0,t)=\xi_0(t)$ and $x(\mu=1,t)=\xi_1(t)$ by $\mu \in [0,1]$. Also, define the path integral with the transformation $\Theta(x,t)$ for $M(x,t) = \Theta(x,t)^{\top}\Theta(x,t)$ as follows: \begin{equation} V_\ell(x,\delta x,t)=\int^{\xi_1}_{\xi_0} \|\delta {z}\|=\int^{\xi_1}_{\xi_0} \|\Theta(x,t)\delta {x}\|. \label{eq_VL} \end{equation} Then \eqref{eq_VSL} and \eqref{eq_VL} are related as \begin{align} \|\xi_1 -\xi_0\|=\left\|\int^{\xi_1}_{\xi_0} \delta {x}\right\|\leq \frac{V_{\ell}}{\sqrt{\underline{m}}} \leq \sqrt{\frac{V_{s\ell}}{\underline{m}}} \label{eq_VL_VSL} \end{align} where $M(x,t)\succeq\underline{m}\mathrm{I},~\forall x,t$ for $\exists\underline{m}\in\mathbb{R}_{>0}$, and Theorem~\ref{Thm:contraction} can also be proven by using \eqref{eq_VSL} and \eqref{eq_VL} as a Lyapunov-like function, resulting in incremental exponential stability of the system \eqref{eq:xfx} (see Definition~\ref{Def:incremental}). Note that the shortest path integral $V_\ell$ of \eqref{eq_VL} with a parameterized state $x$ (i.e.{}, $\inf V_\ell=\sqrt{\inf V_{s\ell}}$) defines the Riemannian distance and the path integral of a minimizing minimizing geodesic~\cite{ccm}. \end{theorem} \begin{proof} Using $M(x,t)\succeq\underline{m}\mathrm{I}$ which gives $\sqrt{\underline{m}}\|\xi_1 -\xi_0\|\leq V_{\ell}$, we have $\|\xi_1 -\xi_0\|=\|\int^{\xi_1}_{\xi_0} \delta {x}\|\leq {V_{\ell}}/{\sqrt{\underline{m}}}$ of \eqref{eq_VL_VSL}. The inequality $V_{\ell} \leq \sqrt{V_{s\ell}}$ of \eqref{eq_VL_VSL} can be proven by applying the Cauchy–Schwarz inequality~\cite[p. 316]{10.5555/2422911} to the functions $\psi_1(\mu)=\|\Theta(x,t)(\partial x/\partial \mu)\|$ and $\psi_2(\mu)=1$ We can also see that computing $\dot{V}_{s\ell}$ of \eqref{eq_VSL} using the differential dynamics of \eqref{eq:original_differential} yields \begin{align} \dot{V}_{s\ell}=\int_{0}^{1}\frac{\partial x}{\partial\mu}^{\top}\left(\dot{M}+M\frac{\partial f}{\partial x}+\frac{\partial f}{\partial x}^{\top}M\right)\frac{\partial x}{\partial\mu}d\mu \end{align} to have $\dot{V}_{s\ell}\leq-2\alpha V_{s\ell}$ and $\dot{V}_{\ell}\leq -\alpha V_{\ell}$ by the contraction conditions \eqref{eq_MdotContracting_z} and \eqref{eq_MdotContracting}. Since these hold for any $\xi_0$ and $\xi_1$, the incremental exponential stability results in Theorem~\ref{Thm:contraction} follow from the comparison lemma of Lemma~\ref{Lemma:comparison} (see also~\cite{mypaperTAC,Ref:Stochastic,mypaper}, and~\cite{ccm,7989693} for the discussion on the geodesic). \qed \end{proof} \subsubsection{Deterministic Perturbation} Let $\xi_0(t)$ be a solution of the system \eqref{eq:xfx}. It is now perturbed as \begin{equation}\label{Eq:fxt2-1} \dot{{x}} = {f}({x},t) + {d}({x},t) \end{equation} and let $\xi_1(t)$ denote a trajectory of \eqref{Eq:fxt2-1}. Then a virtual system of a smooth path $q(\mu,t)$ parameterized by $\mu \in [0,1]$, which has $q(\mu=0,t)=\xi_0$ and $q(\mu=1,t)=\xi_1$ as its particular solutions is given as follows: \begin{align} \label{virtual_d} \dot{q}(\mu,t) = f(q(\mu,t),t)+d_{\mu}(\mu,\xi_1,t) \end{align} where $d_{\mu}(\mu,\xi_1,t) = \mu d(\xi_1,t)$. Since contraction means exponential convergence, a contracting system exhibits a superior property of robustness~\cite{Ref:contraction1,Ref:phasesync}. \begin{theorem} \label{Thm:Robust_contraction_original} If the system~\eqref{eq:xfx} satisfies \eqref{eq_MdotContracting_z} and \eqref{eq_MdotContracting} of Theorem~\ref{Thm:contraction} (i.e.{}, the system \eqref{eq:xfx} is contracting), then the path integral $V_\ell(q,\delta q,t)=\int^{\xi_1}_{\xi_0}\|\Theta(q,t)\delta q\|$ of \eqref{eq_VL}, where $\xi_0$ is a solution of the contracting system \eqref{eq:xfx}, $\xi_1$ is a solution of the perturbed system \eqref{Eq:fxt2-1}, and $q$ is the virtual state of \eqref{virtual_d}, exponentially converges to a bounded error ball as long as ${\Theta}{d}\in \mathcal{L}_\infty$ (i.e.{}, $\sup_{x,t}\|\Theta d\| < \infty$). Specifically, if $\exists \underline{m},\overline{m} \in \mathbb{R}_{>0}$ and $\exists \bar{d}\in\mathbb{R}_{\geq 0}$ s.t.{} $\bar{d}=\sup_{{x},t}\| {d}(x,t)\|$ and \begin{align} \label{Mcon} \underline{m}\mathrm{I} \preceq M(x,t) \preceq \overline{m}\mathrm{I},~\forall x,t \end{align} then we have the following relation: \begin{equation}\label{Eq:Robust_contraction21} \|\xi_1(t)-\xi_0(t)\|\ \leq \frac{V_\ell(0)}{\sqrt{\underline{m}}}e^{-\alpha t}+\frac{\bar{d}}{\alpha}\sqrt{\frac{\overline{m}}{\underline{m}}}(1-e^{-\alpha t}) \end{equation} where $V_\ell(t) = V_\ell(q(t),\delta q(t),t)$ for notational simplicity. \end{theorem} \begin{proof} Using the contraction condition \eqref{eq_MdotContracting}, we have for $M=\Theta^{\top}\Theta$ given in Theorem~\ref{Thm:contraction} that \begin{align} \dfrac{d}{dt}\|\Theta(q,t)\partial_{\mu} q\| =& (2\|\Theta(q,t)\partial_{\mu} q\|)^{-1}\dfrac{d}{dt}\partial_{\mu} q^{\top}M(q,t)\partial_{\mu} q \\ \leq&-\alpha\|\Theta(q,t)\partial_{\mu} q\|+\|\Theta(q,t)\partial_{\mu}d_{\mu}\| \end{align} where $\partial_{\mu} q = {\partial q}/{\partial \mu}$ and $\partial_{\mu} d_{\mu} = {\partial d_{\mu}}/{\partial \mu}=d(\xi_1,t)$. Taking the integral with respect to $\mu$ gives \begin{align} \dfrac{d}{dt}\int_{0}^1\|\Theta\partial_{\mu} q\|d\mu \leq \int_{0}^1-\alpha\|\Theta\partial_{\mu} q\|+\|\Theta d(\xi_1,t)\|d\mu \end{align} which implies $\dot{V}_{\ell}(t) \leq -\alpha V_{\ell}(t)+\sup_{q,\xi_1,t}{\|{\Theta}({q},t)d(\xi_1,t)\|}$ for $V_{\ell}$ in \eqref{eq_VL} of Theorem~\ref{Thm:path_integral}. Thus, applying the comparison lemma (see Lemma~\ref{Lemma:comparison}) results in \begin{align} \label{Eq:Robust_contraction3prev} V_\ell(t) \leq e^{-\alpha t}V_\ell(0)+\sup_{q,\xi_1,t}{\|{\Theta}({q},t)d(\xi_1,t)\|}\frac{1-e^{-\alpha t}}{\alpha }. \end{align} By using $\xi_1 -\xi_0=\int^{\xi_1}_{\xi_0} \delta {x}$ and $\|\xi_1 -\xi_0\|=\|\int^{\xi_1}_{\xi_0} \delta {x}\| \leq \int^{\xi_1}_{\xi_0} \|\delta {x}\| \leq \int^{\xi_1}_{\xi_0} \|\Theta^{-1}\|\|\delta z\| $, we obtain $\sqrt{\inf_t\lambda_\mathrm{min}({M})}\|\xi_1 -\xi_0\|\leq V_\ell= \int^{\xi_1}_{\xi_0} \|\delta {z}\|$, and thus \begin{align} \|\xi_1 -\xi_0\|\ \leq \frac{e^{-\alpha t}V_\ell(0)}{\sqrt{\inf_t\lambda_\mathrm{min}({M})}}+\frac{\sup_{q,\xi_1,t}{\|{\Theta}{d}\|}}{\sqrt{\inf_t\lambda_\mathrm{min}({M})}}\frac{1-e^{-\alpha t}}{\alpha}.\nonumber \end{align} This relation with the bounds on $M$ and $d$ gives \eqref{Eq:Robust_contraction21}. \qed \end{proof} \subsubsection{Stochastic Perturbation} Next, consider the following dynamical system modeled by the It\^{o} stochastic differential equation: \begin{align} \label{stochastic_dynamics} dx = f(x,t)dt + G(x,t)d\mathscr{W}(t) \end{align} where $G:\mathbb{R}^n\times\mathbb{R}_{\geq 0} \to \mathbb{R}^{n\times w}$ is a matrix-valued function and $\mathscr{W}:\mathbb{R}_{\geq 0} \mapsto \mathbb{R}^{w}$ is a $w$-dimensional Wiener process~\cite[p. 100]{arnold_SDE} (see also~\cite[p. xii]{arnold_SDE} for the notations used). For the sake of existence and uniqueness of the solution, we assume in \eqref{stochastic_dynamics} that \begin{align} \exists L \in\mathbb{R}_{\geq 0}\text{ s.t.{} }&\|f(x,t)-f(x',t)\|+\|G(x,t)-G(x',t)\|_F \nonumber\\ &\leq L \|x-x'\|,~\forall t\in\mathbb{R}_{\geq 0},~\forall x,x' \in \mathbb{R}^n\label{stocon1} \\ \exists \bar{L} \in\mathbb{R}_{\geq 0}\text{ s.t.{} }&\|f(x,t)\|^2+\|G(x,t)\|_F^2 \nonumber \\ &\leq \bar{L} (1+\|x\|^2),~\forall t\in\mathbb{R}_{\geq 0},~\forall x \in \mathbb{R}^n.\label{stocon2} \end{align} In order to analyze the incremental stability property of \eqref{stochastic_dynamics} as in Theorem~\ref{Thm:path_integral}, we consider two trajectories $\xi_0(t)$ and $\xi_1(t)$ of stochastic nonlinear systems with Gaussian white noise, driven by two independent Wiener processes $\mathscr{W}_0(t)$ and $\mathscr{W}_1(t)$: \begin{align} \label{eq4} d\xi_i =& f(\xi_i,t) dt + G_i(\xi_i,t) d\mathscr{W}_i(t),~i=0,1. \end{align} One can show that \eqref{stochastic_dynamics} has a unique solution $x(t)$ which is continuous with probability one under the conditions \eqref{stocon1} and \eqref{stocon2} (see~\cite[p. 105]{arnold_SDE} and \cite{Pham2009,Ref:Stochastic}), leading to the following lemma as in the comparison lemma of Lemma~\ref{Lemma:comparison}. \begin{lemma} \label{Lemma:comparison_sto} Suppose that $V_{s\ell}$ of \eqref{eq_VSL} satisfies the following inequality: \begin{align} \label{cl_ivp_sto} \mathscr{L}V_{s\ell} \leq -\gamma V_{s\ell}+c \end{align} where $\gamma \in \mathbb{R}_{>0}$, $c \in \mathbb{R}_{\geq0}$, and $\mathscr{L}$ denotes the infinitesimal differential generator of the It\^{o} process given in~\cite[p. 15]{sto_stability_book}. Then we have the following bound~\cite{Pham2009}: \begin{align} \label{bound_comparison_sto} \mathop{\mathbb{E}}\left[\|\xi_1(t)-\xi_0(t)\|^2\right] \leq \frac{1}{\underline{m}}\left( \mathop{\mathbb{E}}[V_{s\ell}(0)]e^{-\gamma t}+\frac{c}{\gamma}\right) \end{align} where $V_{s\ell}(0) = V_{s\ell}(x(0),\delta x(0),0)$ for $V_{s\ell}$ in \eqref{eq_VSL}, $\underline{m}$ is given in \eqref{Mcon}, $\xi_{0}$ and $\xi_{1}$ are given in \eqref{eq4}, and $\mathop{\mathbb{E}}$ denotes the expected value operator. Furthermore, the probability that $\|\xi_1-\xi_0\|$ is greater than or equal to $\varepsilon\in\mathbb{R}_{> 0}$ is given as \begin{align} \label{bound_comparison_sto_prob} \mathop{\mathbb{P}}\left[\|\xi_1(t)-\xi_0(t)\| \geq \varepsilon\right] \leq \frac{1}{\varepsilon^2\underline{m}}\left( \mathop{\mathbb{E}}[V_{s\ell}(0)]e^{-\gamma t}+\frac{c}{\gamma}\right). \end{align} \end{lemma} \begin{proof} The bound \eqref{bound_comparison_sto} follows from Theorem~2 of~\cite{Pham2009} (see also~\cite{mypaperTAC,Ref:Stochastic,old_observer,doi:10.1137/0305037,mypaper} and~\cite[p. 10]{sto_stability_book} (Dynkin's formula)). The probability tracking error bound \eqref{bound_comparison_sto_prob} then follows from Markov's inequality~\cite[pp. 311-312]{probbook}. \qed \end{proof} \begin{remark} Although Lemma~\ref{Lemma:comparison_sto} considers the second moment of $\|\xi_1(t)-\xi_0(t)\|$, i.e.{}, $\mathbb{E}[\|\xi_1(t)-\xi_0(t)\|^2]$, it can be readily generalized to the $p$-th moment of $\|\xi_1(t)-\xi_0(t)\|$, i.e.{}, $\mathbb{E}[\|\xi_1(t)-\xi_0(t)\|^p]$, applying the Lyapunov-based technique proposed in~\cite{9304491}. \end{remark} A virtual system of a smooth path $q(\mu,t)$ parameterized by $\mu \in [0,1]$, which has $q(\mu=0,t)=\xi_0$ and $q(\mu=1,t)=\xi_1$ of \eqref{eq4} as its particular solutions, is given as follows: \begin{align} \label{virtual_d_sto} dq(\mu,t) = f(q(\mu,t),t)dt+G(\mu,\xi_0,\xi_1,t)d\mathscr{W}(t) \end{align} where $G(\mu,\xi_0,\xi_1,t) = [(1-\mu) G_0(\xi_0,t),\mu G_1(\xi_1,t)]$ and $\mathscr{W} = [\mathscr{W}_0^{\top},\mathscr{W}_1^{\top}]^{\top}$. As a consequence of Lemma~\ref{Lemma:comparison_sto}, showing stochastic incremental stability between $\xi_0$ and $\xi_1$ of \eqref{eq4} reduces to proving the relation \eqref{cl_ivp_sto}, similar to the deterministic case in Theorems~\ref{Thm:contraction} and~\ref{Thm:Robust_contraction_original}. \begin{theorem} \label{Thm:robuststochastic} Suppose that $\exists \bar{g}_{0}\in\mathbb{R}_{\geq 0}$ and $\exists \bar{g}_{1}\in\mathbb{R}_{\geq 0}$ s.t.{} $\sup_{x,t}\|G_1(x,t)\|_F = \bar{g}_0$ and $\sup_{x,t}\|G_1(x,t)\|_F = \bar{g}_1$ in \eqref{eq4}. Suppose also that there exists $M(x,t) \succ 0,~\forall x,t$, s.t.{} $M_{x_i}=\partial M/\partial x_i$ is Lipschitz with respect to $x$ for all $i=1,\cdots,n$, i.e.{}, $\exists L_m \in\mathbb{R}_{\geq 0}$ s.t.{} \begin{align} \label{eq:Mlipschitz} \|M_{x_i}(x,t)-M_{x_i}(x',t)\|\leq L_m\|x-x'\|,~\forall x,x',t,i. \end{align} Also, suppose that $M$ of \eqref{eq:Mlipschitz} satisfies \eqref{Mcon} and \eqref{eq_MdotContracting} with its right-hand side replaced by $-2\alpha M-\alpha_s \mathrm{I}$ for $\alpha_s = L_m(\bar{g}_0^2+\bar{g}_1^2)(\alpha_G+{1}/{2})$, i.e.{}, \begin{align} \label{eq_MdotContracting_sto} {\dot{M}}+M\frac{\partial {f}}{\partial {x}}+\frac{\partial {f}}{\partial {x}}^{\top}M \preceq - 2 \alpha M-\alpha_s\mathrm{I} \end{align} where $\alpha_G\in\mathbb{R}_{>0}$ is an arbitrary constant (see \eqref{Vsl_comp_0}). Then, the following error bound of incremental stability holds: \begin{align} \label{Eq:boundnewsto} \mathop{\mathbb{E}}\left[\|\xi_1(t)-\xi_0(t)\|^2\right] \leq \frac{\mathop{\mathbb{E}}[V_{s\ell}(0)]}{\underline{m}}e^{-2\alpha t}+\frac{C}{2\alpha}\frac{\overline{m}}{\underline{m}} \end{align} where $\xi_0$ and $\xi_1$ are the trajectories given in \eqref{eq4}, $V_{s\ell}(t)=V_{s\ell}(q(t),\delta q(t),t)=\int^{\xi_1}_{\xi_0}\delta q^{\top}M(q,t)\delta q$ is given in \eqref{eq_VSL} with the virtual state $q$ of \eqref{virtual_d_sto}, $\underline{m}$ and $\overline{m}$ are given in \eqref{Mcon}, $C = (\bar{g}_0^2+\bar{g}_1^2)({2}{\alpha_G}^{-1}+1)$, and $\mathop{\mathbb{E}}$ denotes the expected value operator. Furthermore, the probability that $\|\xi_1-\xi_0\|$ is greater than or equal to $\varepsilon\in\mathbb{R}_{> 0}$ is given as \begin{align} \label{Eq:boundnewsto_prob} \mathop{\mathbb{P}}\left[\|\xi_1(t)-\xi_0(t)\|\geq\varepsilon\right] \leq \frac{1}{\varepsilon^2}\left(\frac{\mathop{\mathbb{E}}[V_{s\ell}(0)]}{\underline{m}}e^{-2\alpha t}+\frac{C}{2\alpha}\frac{\overline{m}}{\underline{m}}\right).~~~~~~ \end{align} \end{theorem} \begin{proof} By definition of the infinitesimal differential generator given in Lemma~\ref{Lemma:comparison_sto}~\cite[p. 15]{sto_stability_book}, we have~\cite{mypaperTAC,mypaper} \begin{align} \label{l} \mathscr{L}V_{s\ell} =&\int_{0}^{1} V_t+\sum^n_{i=1}\left(V_{q_i}f_i+V_{\partial_{\mu} q_i}\left(\frac{\partial f}{\partial q}\partial_{\mu} q\right)_i\right) \nonumber \\ &+\frac{1}{2}\sum^n_{i,j=1}\Bigl(V_{q_iq_j}(GG^{\top})_{ij}+2V_{q_i\partial_{\mu} q_j}(G\partial_{\mu} G^{\top})_{ij} \\ & +V_{\partial_{\mu} q_i\partial_{\mu} q_j} (\partial_{\mu} G\partial_{\mu} G^{\top})_{ij} \Bigr) d\mu\label{LV0} \end{align} where $V = \partial_{\mu} q^{\top}M(q,t)\partial_{\mu} q$, $\partial_{\mu} q=\partial q/\partial \mu$, $\partial_{\mu} G=\partial G/\partial \mu$, $V_{p} = \partial V/\partial p$, and $V_{p_1p_2}=\partial^2V/(\partial p_1\partial p_2)$. Since $M_{x_i}$ is Lipschitz as in \eqref{eq:Mlipschitz}, we have $\|M_{x_i x_j}\| \leq L_m$ and $\left\|M_{x_i}\right\| \leq \sqrt{{2L_m}{\overline{m}}}$ using \eqref{Mcon} as derived~\cite{nscm}. Computing $\mathscr{L}V_{s\ell}$ of \eqref{LV0} using these bounds, the bounds of $\|G_{0}\|_F$ and $\|G_{1}\|_F$, and $\partial_{\mu} G=\partial G/\partial \mu = [-G_0,G_1]$ as in \cite{mypaperTAC,mypaper} yields \begin{align} \mathscr{L}V_{s\ell} \leq& \int_0^1\partial_{\mu} q^{\top}(\dot{M}+2\sym(Mf_{x}))\partial_{\mu} qd\mu \\ &+(\bar{g}_0^2+\bar{g}_1^2)(L_m\|\partial_{\mu} q\|^2/2+2\sqrt{{2L_m}{\overline{m}}}\|\partial_{\mu} q\|+\overline{m}) \nonumber \\ \leq& \int_0^1\partial_{\mu}q^{\top}(\dot{M}+2\sym(Mf_{x})+\alpha_s\mathrm{I})\partial_{\mu} qd\mu+{C}{\overline{m}}~~~~~~~~ \label{Vsl_comp_0} \end{align} where $\alpha_s = L_m(\bar{g}_0^2+\bar{g}_1^2)(\alpha_G+{1}/{2})$, $C = (\bar{g}_0^2+\bar{g}_1^2)({2}{\alpha_G}^{-1}+1)$, and the relation $2ab \leq \alpha_G^{-1}a^2+\alpha_G b^2$, which holds for any $a,b\in\mathbb{R}$ and $\alpha_G \in \mathbb{R}_{>0}$, is used with $a = \sqrt{2\overline{m}}$ and $b = \sqrt{L_m}\|\partial_{\mu} x\|$ to get the second inequality. This reduces to $\mathscr{L}V_{s\ell} \leq -2\alpha V_{s\ell}+\underline{m}C$ under the condition \eqref{eq_MdotContracting_sto}, resulting in \eqref{Eq:boundnewsto} and \eqref{Eq:boundnewsto_prob} as a result of \eqref{bound_comparison_sto} and \eqref{bound_comparison_sto_prob} in Lemma~\ref{Lemma:comparison_sto}. \qed \end{proof} \begin{remark} Although we consider the Gaussian white noise stochastic differential equation \eqref{eq4} when referring to stochastic systems in this paper, other types of stochastic noises, including compound Poisson shot noise and bounded-measure L\'{e}vy noise, could be considered as in Theorem~\ref{Thm:robuststochastic} using contraction theory~\cite{han2021incremental}. \end{remark} \subsection{Finite-Gain \texorpdfstring{$\mathcal{L}_p$}{$\mathcal{L}_p$} Stability and Contraction of Hierarchically Combined Systems} Due to the simpler stability analysis of Theorem~\ref{Thm:contraction} when compared with Lyapunov theory, Input-to-State Stability (ISS) and input-output stability in the sense of finite-gain $\mathcal{L}_p$ stability can be easily studied using contraction theory~\cite{Ref:phasesync}. \begin{theorem} \label{Thm:Robust_contraction} If \eqref{Eq:fxt2-1} is perturbed by ${d}({x},t)\in \mathcal{L}_{pe}$ (i.e.{}, $\|(d)_{\tau}\|_{\mathcal{L}_p} < \infty$ for $\tau\in\mathbb{R}_{\geq0}$ and $p\in[1,\infty]$, see Sec.~\ref{notation}) and Theorem~\ref{Thm:contraction} holds, then \eqref{Eq:fxt2-1} is finite-gain $\mathcal{L}_p$ stable with $p\in [1,\infty]$ for an output ${y}={h}({x},{d},t)$ with $\int^{Y_1}_{Y_0}\|\delta {y}\|\leq \eta_0 \int^{\xi_1}_{\xi_0}\|\delta {x}\|+\eta_1\|{d}\|$, $\exists\eta_0,\eta_1\geq0$, i.e.{}, $\forall \tau\in\mathbb{R}_{\geq 0}$~\cite{Ref:phasesync} \begin{equation}\label{Eq:Robust_contractionLp} \left\|{\left(\int^{Y_1}_{Y_0} \|\delta {y}\|\right)_\tau}\right\|_{\mathcal{L}_p} \leq \left(\frac{\eta_0}{\alpha}+{\eta_1}\right)\frac{\|({\Theta}{d})_\tau \|_{\mathcal{L}_p}}{\sqrt{\underline{m}}}+\frac{\eta_0\zeta V_\ell(0)}{\sqrt{\underline{m}}} \end{equation} where $Y_0$ and $Y_1$ denote the output trajectories of the original contracting system \eqref{eq:xfx} and its perturbed system \eqref{Eq:fxt2-1}, respectively, $\underline{m}$ is defined as ${M}({x},t)\succeq \underline{m}{\mathrm{I}}$, $\forall x,t$, as in \eqref{Mcon}, and $V_\ell(0) = V_\ell(x(0),\delta x(0),0)$ for $V_{\ell}$ in \eqref{eq_VL}. Also, $\zeta=1$ if $p=\infty$ and $\zeta=1/(\alpha p)^{1/p}$ if $p\in[1,\infty)$. The perturbed system \eqref{Eq:fxt2-1} also exhibits ISS. \end{theorem} \begin{proof} In keeping with Theorem 5.1 of~\cite{Khalil:1173048}, \eqref{Eq:Robust_contraction3prev} also implies the following relation for $M=\Theta^{\top}\Theta$: \begin{align}\label{Eq:Robust_contractionLp2} \|(V_\ell)_\tau\|_{\mathcal{L}_p}&\leq V_\ell(0)\|(e^{-\alpha t})_\tau\|_{\mathcal{L}_p} +\|e^{-\alpha t}\|_{\mathcal{L}_1} \|({\Theta}{d})_\tau \|_{\mathcal{L}_p} \nonumber \\ &\leq V_\ell(0)\zeta +\|({\Theta}{d})_\tau \|_{\mathcal{L}_p}/\alpha. \end{align} Since we have $\|{\Theta}^{-1}\|\leq 1/\sqrt{\underline{m}}$ for $M=\Theta^{\top}\Theta$, \eqref{Eq:Robust_contractionLp} can be obtained by using both \eqref{Eq:Robust_contractionLp2} and the known bound of $\|\delta {y}\|$, thereby yielding a finite $\mathcal{L}_p$ gain independently of $\tau$. ISS can be guaranteed by Lemma~4.6 of~\cite[p. 176]{Khalil:1173048}, which states that exponential stability of an unperturbed system results in ISS. \qed \end{proof} Theorems~\ref{Thm:contraction}--\ref{Thm:Robust_contraction} are also applicable to the hierarchically combined system of two contracting dynamics due to Theorem~\ref{Thm:Robust_contraction_hierc}~\cite{Ref:contraction2,Ref:contraction5}. \if0 \begin{theorem} \label{Thm:contraction_hierc} Consider the hierarchically combined system of two contracting dynamics with a generalized Jacobian $F = \left[\begin{smallmatrix}{F}_{00} & {0}\\ {F}_{10} & {F}_{11}\end{smallmatrix}\right]$, i.e.{}, ${F}_{00}(x,t) \prec 0$ and ${F}_{11}(x,t) \prec 0$. If ${F}_{10}$ is bounded, the combined system is contracting. \end{theorem} \begin{proof} For a smooth transformation $\Theta = \left[\begin{smallmatrix}\mathrm{I} & 0 \\0 & \epsilon \mathrm{I}\end{smallmatrix}\right]$, the Jacobian matrix in the transformed coordinate is given as \begin{align} \Theta F(x,t) \Theta^{-1} = \begin{bmatrix}F_{00} & 0 \\\epsilon F_{10} & F_{11} \end{bmatrix} \end{align} which is negative definite for a sufficiently small $\epsilon > 0$ as long as $F_{10}$ is bounded. Also, the first part of dynamics is contracting due to $\delta\dot{x}_1=F_{00}\delta x_1$. \qed \end{proof} \fi \begin{theorem} \label{Thm:Robust_contraction_hierc} Consider the following hierarchically combined system of two contracting dynamics: \begin{align} \label{deltaz_hiera} \dfrac{d}{dt}\begin{bmatrix}\delta z_0\\\delta z_1\end{bmatrix}=\begin{bmatrix}{F}_{00} & {0}\\ {F}_{10} & {F}_{11}\end{bmatrix}\begin{bmatrix}\delta z_0\\\delta z_1\end{bmatrix} \end{align} where $F=F_{00}$ and $F=F_{11}$ both satisfy the contraction condition \eqref{eq_MdotContracting_z}, and suppose that it is subject to perturbation $[{d}_0,{d}_1]^{\top}$. Then the path length integral $V_{\ell,i}(t)=\int^{\xi_1}_{\xi_0}\|\delta {z}_i\|$ with $i=0,1$ between the original and perturbed dynamics trajectories, $\xi_0$ and $\xi_1$, respectively, verifies~\cite{Ref:contraction1} \begin{align}\label{Eq:hierclemma} \dot{V}_{\ell,0}+\alpha_0V_{\ell,0}&\leq\|{\Theta}_0{d}_0\| \\ \dot{V}_{\ell,1}+\alpha_1V_{\ell,1}&\leq\|{\Theta}_1{d}_1\|+\int^{\xi_1}_{\xi_0}\|{F}_{10}\|\|\delta {z}_1\| \label{Eq:hierclemmab} \end{align} where $\alpha_i=\sup_{x,t}|\lambda_\mathrm{max}({F}_{ii})|,~i=0,1$. Hence, the error bounds of $V_{\ell,0}(t)$ and $V_{\ell,1}(t)$ can be obtained using Theorem~\ref{Thm:Robust_contraction_original} if $\|{F}_{10}\|$ is bounded. In particular, if $\|{\Theta}_i d_i\|\leq \sqrt{\overline{m}_i}\bar{d}_i$, $i=0,1$, the relations \eqref{Eq:hierclemma} and \eqref{Eq:hierclemmab} yield $V_{\ell,0}(t) \leq V_{\ell,0}(0)e^{-\alpha_0t}+(\sqrt{\overline{m}_0}\bar{d}_0/{\alpha_0})(1-e^{-\alpha_0t})$ as in \eqref{Eq:Robust_contraction21}, and \begin{align} \label{robust_hiera_bound} V_{\ell,1}(t) \leq& V_{\ell,1}(0)e^{-\alpha_1t}+\frac{\sqrt{\overline{m}_1}\bar{d}_1+\bar{f}_{10}\bar{V}_{0}}{\alpha_1}(1-e^{-\alpha_1t})~~~~ \end{align} where $\bar{f}_{10}=\sup_{t\in\mathbb{R}_{\geq 0}}\|{F}_{10}\|$ and $\bar{V}_{0}=V_{\ell,0}(0)+\sqrt{\overline{m}_0}\bar{d}_0/{\alpha_0}$. Also, similar to Theorem~\ref{Thm:Robust_contraction}, we have $\|(V_{\ell,0})_\tau\|_{\mathcal{L}_p} \leq V_{\ell,0}(0)\zeta_0+{\|({\Theta}_0{d}_0)_\tau \|_{\mathcal{L}_p}}/{\alpha_0}$, and thus a hierarchical connection for finite-gain $\mathcal{L}_p$ stability can be established as follows~\cite{Ref:phasesync}: \begin{align} \|(V_{\ell,1})_\tau\|_{\mathcal{L}_p} \leq& V_{\ell,1}(0)\zeta_1 +\frac{\|({\Theta}_1{d}_1)_\tau \|_{\mathcal{L}_p}+\bar{f}_{10}\|(V_{\ell,0})_\tau\|_{\mathcal{L}_p}}{\alpha_1}~~~~\label{Eq:hierclemma2} \end{align} where $\zeta_i=1$ if $p=\infty$ and $\zeta_i=1/(\alpha_i p)^{1/p}$ if $p\in[1,\infty)$ for $i=0,1$. By recursion, this result can be extended to an arbitrary number of hierarchically combined groups. \end{theorem} \begin{proof} Applying the comparison lemma of Lemma~\ref{Lemma:comparison} to \eqref{Eq:hierclemma} and \eqref{Eq:hierclemmab}, which follow from the differenital dynamics \eqref{deltaz_hiera} with the condition \eqref{eq_MdotContracting_z}, we get \eqref{robust_hiera_bound} as in Theorem~\ref{Thm:Robust_contraction_original}. Similarly, \eqref{Eq:hierclemma2} follows from obtaining $\|(V_{\ell,0})_\tau\|_{\mathcal{L}_p}$ by \eqref{Eq:Robust_contractionLp2} using \eqref{Eq:hierclemma}, and then recursively obtaining $\|(V_{\ell,1})_\tau\|_{\mathcal{L}_p}$ using \eqref{Eq:hierclemmab} as in Theorem~\ref{Thm:Robust_contraction}~\cite{Ref:phasesync}. \qed \end{proof} \begin{example} \label{ex:hiera} As demonstrated in Example~\ref{ex:lag_metric}, the Lagrangian virtual system \eqref{lagrange_cl} is contracting with respect to $q$, having $q=\dot{\mathtt{q}}$ and $q = \dot{\mathtt{q}}_r = \dot{\mathtt{q}}_d-\Lambda (\mathtt{q}-\mathtt{q}_d)$ as its particular solutions. Let $q_0=q$ for such $q$. The virtual system of $q_1$ which has $[q_0^{\top},q_1^{\top}]^{\top}=[\dot{\mathtt{q}}^{\top},\mathtt{q}^{\top}]^{\top}$ and $[\dot{\mathtt{q}}_r^{\top},\mathtt{q}_d^{\top}]^{\top}$ as its particular solutions is given as \begin{align} \dot{q}_1 = q_0-\Lambda(q_1-\mathtt{q}) \end{align} resulting in $\delta \dot{q}_1=\mathtt{I}\delta q_0-\Lambda\delta q_1$. Since the virtual system of $q_0$ is contracting as in Example~\ref{ex:lag_metric} and the virtual system $\delta \dot{q}_1=-\Lambda\delta q_1$ is contracting in $q_1$ due to $\Lambda \succ 0$, \eqref{robust_hiera_bound} of Theorem~\ref{Thm:Robust_contraction_hierc} implies that the whole system \eqref{lagrange_partial} for $[q_0^{\top},q_1^{\top}]^{\top}$ is hierarchically contracting and robust against perturbation in the sense of Theorem~\ref{Thm:Robust_contraction_hierc} ($F_{10}=\mathtt{I}$ in this case). Also, see~\cite{Ref:ChungTRO,Ref:phasesync} for the hierarchical multi-timescale separation of tracking and synchronization control for multiple Lagrangian systems. \end{example} \subsection{Contraction Theory for Discrete-time Systems} Let us consider the following nonlinear system with bounded deterministic perturbation $d_k:\mathbb{R}^n\times\mathbb{N}\mapsto\mathbb{R}^n$ with $\bar{d}\in\mathbb{R}_{\geq 0}$ s.t.{} $\bar{d}=\sup_{{x},k}\| {d}_k(x,k)\|$: \begin{align} \label{discrete_system} x(k+1) = f_k(x(k),k)+{d}_k(x(k),k) \end{align} where $k\in\mathbb{N}$, $x:\mathbb{N}\mapsto\mathbb{R}^n$ is the discrete system state, and $f_k:\mathbb{R}^n\times\mathbb{N}\mapsto\mathbb{R}^n$ is a smooth function. Although this tutorial paper focuses mainly on continuous-time nonlinear systems, let us briefly discuss contraction theory for \eqref{discrete_system} to imply that the techniques in the subsequent sections are applicable also to discrete-time nonlinear systems. Let $\xi_{0}(k)$ and $\xi_{1}(k)$ be solution trajectories of \eqref{discrete_system} with $d_k=0$ and $d_k\neq 0$, respectively. Then a virtual system of $q(\mu,k)$ parameterized by $\mu\in[0,1]$, which has $q(\mu=0,k)=\xi_{0}(k)$ and $q_k(\mu=1,k)=\xi_{1}(k)$ as its particular solutions, can be expressed as follows: \begin{align} \label{virtual_system_discrete} q(\mu,k+1) = f_k(q(\mu,k),k)+\mu d_{k}(\xi_1(k),k). \end{align} The discrete version of robust contraction in Theorem~\ref{Thm:Robust_contraction_original} is given in the following theorem. \begin{theorem} \label{Thm:discrete_contraction} Let ${x}(k)=x_k$ and $q(\mu,k)=q_k$ for any $k\in\mathbb{N}$ for simplicity. If there exists a uniformly positive definite matrix ${M}_k({x}_k,k)={{\Theta_k}}({x}_k,k)^{\top}{{\Theta_k}}({x}_k,k) \succ 0,~\forall x_k,k$, where ${\Theta_k}$ defines a smooth coordinate transformation of $\delta x_k$, i.e.{}, $\delta{z}_k={\Theta_k}(x_k,k)\delta{x}_k$, s.t.{} either of the following equivalent conditions holds for $\exists \alpha \in (0,1)$, $\forall x_k,k$: \begin{align} &\left\|{\Theta_{k+1}}({x}_{k+1},k+1)\frac{\partial {f}_k}{\partial {x}_k}{{\Theta_k}({x}_k,k)^{-1}}\right\| \preceq \alpha \label{eq_MdotContracting_discrete_z} \\ &\frac{\partial {f}_k}{\partial {x}_k}^{\top}{{M_{k+1}}({x}_{k+1},k+1)}\frac{\partial {f}_k}{\partial {x}_k} \preceq \alpha^2 {M_k}({x}_{k},k) \label{eq_MdotContracting_discrete} \end{align} then we have the following bound as long as we have $\underline{m}\mathrm{I}\preceq M_x(x_k,k)\preceq \overline{m}\mathrm{I},~\forall x_k,k$, as in \eqref{Mcon}: \begin{align} \label{discrete_bound_disturbance} \|\xi_{1}(k)-\xi_{0}(k)\| \leq \frac{V_{\ell}(0)}{\sqrt{\underline{m}}}\alpha^k+\frac{\bar{d}(1-\alpha^k)}{1-\alpha}\sqrt{\frac{\overline{m}}{\underline{m}}} \end{align} where $V_{\ell}(k)=\int_{\xi_{0}}^{\xi_{1}}\|\Theta_k(q_k,k)\delta q_k\|$ as in \eqref{eq_VL} for the unperturbed trajectory $\xi_{0}$, perturbed trajectory $\xi_1$, and virtual state $q_k=q(k)$ given in \eqref{virtual_system_discrete}. \end{theorem} \begin{proof} If \eqref{eq_MdotContracting_discrete_z} or \eqref{eq_MdotContracting_discrete} holds, we have that \begin{align} &V_{\ell}(k+1) \leq \int^1_0\|\Theta_{k+1}(\partial_{q_k} f_k(q_k,k)\partial_{\mu} q_k+d_k(x_k,k))\|d\mu \\ &\leq \alpha\int^1_0\|\Theta_{k}(q_k,k)\partial_{\mu} q_k\|d\mu+\bar{d}\sqrt{\overline{m}} = \alpha V_{\ell}(k)+\bar{d}\sqrt{\overline{m}} \nonumber \end{align} where $\Theta_{k+1}=\Theta_{k+1}(q_{k+1},k+1)$, $\partial_{q_k} f_k(q_k,k)=\partial f_k/\partial q_k$, and $\partial_{\mu} q_k=\partial q_k/\partial \mu$. Applying this inequality iteratively results in \eqref{discrete_bound_disturbance}. \end{proof} Theorem~\ref{Thm:discrete_contraction} can be used with Theorem~\ref{Thm:Robust_contraction_original} for stability analysis of hybrid nonlinear systems~\cite{Ref:contraction_robot,Ref:contraction4,4795665}, or with Theorem~\ref{Thm:robuststochastic} for stability analysis of discrete-time stochastic nonlinear systems~\cite{mypaperTAC,mypaper,4795665}. For example, it is shown in~\cite{mypaperTAC} that if the time interval in discretizing \eqref{eq:xfx} as \eqref{discrete_system} is sufficiently small, contraction of discrete-time systems with stochastic perturbation reduces to that of continuous-time systems. We finally remark that the steady-state upper bounds of \eqref{Eq:Robust_contraction21} in Theorem~\ref{Thm:Robust_contraction_original}, \eqref{Eq:boundnewsto} in Theorem~\ref{Thm:robuststochastic}, and \eqref{discrete_bound_disturbance} in Theorem~\ref{Thm:discrete_contraction} are all functions of $\overline{m}/\underline{m}$. This property is to be used extensively in Sec.~\ref{sec:convex} for designing a convex optimization-based control and estimation synthesis algorithm via contraction theory. \section{Robust Nonlinear Control and Estimation via Contraction Theory} \label{sec:HinfKYP} As shown in Theorem~\ref{Thm:Robust_contraction_original} for deterministic disturbance and in Theorem~\ref{Thm:robuststochastic} for stochastic disturbance, contraction theory provides explicit bounds on the distance of any couple of perturbed system trajectories. This property is useful in designing robust and optimal feedback controllers for a nonlinear system such as $\mathcal{H}_{\infty}$ control~\cite{Basar1995,256331,159566,29425,85062,151101,599969,1259458,doi:10.1137/S0363012996301336,doi:10.1137/S0363012903423727,rccm}, which attempts to minimize the system $\mathcal{L}_2$ gain for optimal disturbance attenuation. Since most of such feedback control and estimation schemes are based on the assumption that we know a Lyapunov function candidate, this section delineates one approach to solve a nonlinear optimal feedback control problem via contraction theory~\cite{mypaperTAC,mypaper}, thereby proposing one explicit way to construct a Lyapunov function and contraction metric for general nonlinear systems for the sake of robustness. This approach is also utilizable for optimal state estimation problems as shall be seen in Sec.~\ref{sec:convex}. We consider the following smooth nonlinear system, perturbed by bounded deterministic disturbances $d_c(x,t)$ with $\sup_{x,t}\|d_c(x,t)\|=\bar{d}_c\in\mathbb{R}_{\geq 0}$ or by Gaussian white noise $\mathscr{W}(t)$ with $\sup_{x,t}\|G_c(x,t)\|_F = \bar{g}_c\in\mathbb{R}_{\geq 0}$: \begin{align} \label{original_dynamics} \dot{x} &= f(x,t) + B(x,t)u + d_c(x,t) \\ \label{sdc_dynamics} dx &= (f(x,t)+B(x,t)u)dt+G_c(x,t)d\mathscr{W}(t) \\ \label{sdc_dynamicsd} \dot{x}_d &= f(x_d,t)+B(x_d,t)u_d \end{align} where ${x}:\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^n$ is the system state, $u \in \mathbb{R}^m$ is the system control input, ${f}: \mathbb{R}^n\times\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^n$ and $B:\mathbb{R}^n\times\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^{n\times m}$ are known smooth functions, $d_c:\mathbb{R}^n\times\mathbb{R}_{\geq 0} \mapsto \mathbb{R}^{n}$ and $G_c:\mathbb{R}^n\times\mathbb{R}_{\geq 0} \mapsto \mathbb{R}^{n\times w}$ are unknown bounded functions for external disturbances, and $\mathscr{W}:\mathbb{R}_{\geq 0} \mapsto \mathbb{R}^{w}$ is a $w$-dimensional Wiener process. Also, for \eqref{sdc_dynamicsd}, $x_d:\mathbb{R}_{\geq 0} \mapsto \mathbb{R}^{n}$ and $u_d:\mathbb{R}_{\geq 0} \mapsto \mathbb{R}^{m}$ denote the desired target state and control input trajectories, respectively. \begin{remark} We consider control-affine nonlinear systems \eqref{original_dynamics}--\eqref{sdc_dynamicsd} in Sec.~\ref{sec:HinfKYP}, \ref{sec:convex}, and~\ref{Sec:ncm}--\ref{Sec:adaptive}. This is primarily because the controller design techniques for control-affine nonlinear systems are less complicated than those for control non-affine systems (which often result in $u$ given implicitly by $u = k(x,u,t)$~\cite{vccm,WANG201944}), but still utilizable even for the latter, e.g.{}, by treating $\dot{u}$ as another control input (see Example~\ref{ex:nonaffine1}), or by solving the implicit equation $u = k(x,u,t)$ iteratively with a discrete-time controller (see Example~\ref{ex:nonaffine2} and Remark~\ref{remark_nonaffine}). \end{remark} \begin{example} \label{ex:nonaffine1} By using $\dot{u}$ instead of $u$ in \eqref{original_dynamics} and \eqref{sdc_dynamics}, a control non-affine system, $\dot{x}=f(x,u,t)$, can be rewritten as \begin{align} \dfrac{d}{dt}\begin{bmatrix}x\\u\end{bmatrix}=\begin{bmatrix}f(x,u,t)\\0\end{bmatrix}+\begin{bmatrix}0\\\mathrm{I}\end{bmatrix}\dot{u} \end{align} which can be viewed as a control-affine nonlinear system with the state $[x^{\top},u^{\top}]^{\top}$ and control $\dot{u}$. \end{example} \begin{example} \label{ex:nonaffine2} One drawback of the technique in Example~\ref{ex:nonaffine1} is that we have to control $\dot{u}$ instead of $u$, which could be difficult in practice. In this case, we can utilize the following control non-affine nonlinear system decomposed into control-affine and non-affine parts: \begin{align} \dot{x}=f(x,u,t)=f_a(x,t)+B_a(x,t)u+r(x,u,t) \end{align} where $r(x,u,t)=f(x,u,t)-f_a(x,t)-B_a(x,t)u$. The controller $u$ can now be designed implicitly as \begin{align} \label{ex_implicit_u} B_a(x,t)u = B_a(x,t)u^*-r(x,u,t) \end{align} where $u^*$ is a stabilizing controller for the control-affine system $\dot{x}=f_a(x,t)+B_a(x,t)u^*$. Since solving such an implicit equation in \eqref{ex_implicit_u} in real-time could be unrealistic in practice, we will derive a learning-based approach to solve it iteratively for unknown $r(x,u,t)$, without deteriorating its stability performance (see Lemma~\ref{Thm:discrete_neurallander} and Theorem~\ref{Thm:neurallander} of Sec.~\ref{Sec:datadriven}). \end{example} \subsection{Overview of Nonlinear Control and Estimation} \label{Sec:overview} We briefly summarize the advantages and disadvantages of existing nonlinear feedback control and state estimation schemes, so that one can identify which strategy is appropriate for their study and refer to the relevant parts of this tutorial paper. \begin{table*}[htbp] \caption{Comparison between SDC and CCM Formulation (note that $\gamma(\mu=0,t)=x_d$ and $\gamma(\mu=1,t)=x$). \label{tab:sdcccm_summary}} \footnotesize \begin{center} \renewcommand{\arraystretch}{1.2} \begin{tabular}{ |l|l|l| } \hline & SDC formulation (Theorem~\ref{Thm:CV-STEM})~\cite{mypaperTAC,ncm,nscm,Ref:Stochastic,mypaper} & CCM formulation (Theorem~\ref{Thm:ccm_cvstem})~\cite{ccm,7989693} \\ \hline \hline Control law & $u = u_d-K(x,x_d,u_d,t)(x-x_d)$ or $u_d-K(x,t)(x-x_d)$ & $u = u_d+\int_{0}^1k(\gamma(\mu,t),\partial_{\mu}\gamma(\mu,t),u,t)d\mu$ \\ \hline Computation & Evaluates $K$ for given $(x,x_d,u_d,t)$ as in LTV systems & Computes geodesics $\gamma$ for given $(x,x_d,t)$ and integrates $k$ \\ \hline Generality & Captures nonlinearity by (multiple) SDC matrices & Handles general differential dynamics \\ \hline Contraction & Depends on $(x,x_d,u_d,t)$ or $(x,t)$ (partial contraction) & Depends on $(x,t)$ (contraction) \\ \hline \end{tabular} \end{center} \end{table*} \renewcommand{\arraystretch}{1.0} \subsubsection{Systems with Known Lyapunov Functions} As discussed in Sec.~\ref{sec:contraction_search}, there are several nonlinear systems equipped with a known contraction metric/Lyapunov function, such as Lagrangian systems~\cite[p. 392]{Ref_Slotine}, whose inertia matrix $\mathcal{H}(\mathtt{q})$ defines its contraction metric (see Example~\ref{ex:lag_metric}), or the nonlinear SLAM problem~\cite{doi:10.1177/0278364917710541,Ref:Stochastic} with virtual synthetic measurements, which can be reduced to an LTV estimation problem~\cite{doi:10.1177/0278364917710541}. Once we have a contraction metric/Lyapunov function, stabilizing control and estimation laws can be easily derived by using, e.g.{},~\cite{doi:10.1137/0321028,SONTAG1989117,Khalil:1173048}. Thus, those dealing primarily with such nonlinear systems should skip this section and proceed to \hyperref[part2LBC]{Part~II} of this paper (Sec.~\ref{Sec:learning_stability}--\ref{Sec:datadriven}) on learning-based and data-driven control using contraction theory. Note that these known contraction metrics are not necessarily optimal, and the techniques to be derived in Sec.~\ref{sec:HinfKYP} and Sec.~\ref{sec:convex} are for obtaining contraction metrics with an optimal disturbance attenuation property~\cite{mypaperTAC,mypaper}. \subsubsection{Linearization of Nonlinear Systems} \label{Sec:overviewlinear} If a contraction metric of a given nonlinear system is unknown, we could linearize it to apply methodologies inspired by LTV systems theory such as $\mathcal{H}_{\infty}$ control~\cite{29425,85062,151101,599969,doi:10.1137/S0363012996301336,1259458}, iterative Linear Quadratic Regulator (iLQR)~\cite{ilqr,silqr}, or Extended Kalman Filter (EKF). Their stability is typically analyzed by decomposing $f(x,t)$ as $f(x,t) = Ax+(f(x,t)-Ax)$ assuming that the nonlinear part $f(x,t)-Ax$ is bounded, or by finding a local contraction region for the sake of local exponential stability as in~\cite{6849943,ncm}. Since the decomposition $f(x,t) = Ax+(f(x,t)-Ax)$ allows applying the result of Theorem~\ref{Thm:Robust_contraction_original}, we could exploit the techniques in Sec.~\ref{sec:HinfKYP} and Sec.~\ref{sec:convex} for providing formal robustness and optimality guarantees for the LTV systems-type approaches. For systems whose nonlinear part $f(x,t)-Ax$ is not necessarily bounded, Sec.~\ref{Sec:neurallander} elucidates how contraction theory can be used to stabilize them with the learned residual dynamics for control synthesis. \subsubsection{State-Dependent Coefficient (SDC) Formulation} \label{Sec:overviewsdc} It is shown in~\cite{mypaperTAC,Ref:Stochastic,nscm,ncm,mypaper} that the SDC-based control and estimation~\cite{sddre,Banks2007,chang2009exponential,survey_SDRE}, which capture nonlinearity using a state-dependent matrix $A(x,t)$ s.t.{} $f(x,t)=A(x,t)x$ (e.g.{}, we have $A(x,t)=\cos x$ for $f(x,t) = x\cos x$), result in exponential boundedness of system trajectories both for deterministic and stochastic systems due to Theorems~\ref{Thm:Robust_contraction_original} and \ref{Thm:robuststochastic}~\cite{ncm}. Because of the extended linear form of SDC (see Table~\ref{tab:sdcccm_summary}), the results to be presented in Sec.~\ref{sec:HinfKYP}--\ref{sec:convex} based on the SDC formulation are applicable to linearized dynamics that can be viewed as an LTV system with some modifications (see Remark~\ref{remark_other_forms}). This idea is slightly generalized in~\cite{nscm} to explicitly consider incremental stability with respect to a target trajectory (e.g.{}, $x_d$ for control and $x$ for estimation) instead of using $A(x,t)x=f(x,t)$. Let us derive the following lemma for this purpose~\cite{nscm,survey_SDRE,mypaperTAC,Ref:Stochastic,mypaper}. \begin{lemma} \label{sdclemma} Let $f:\mathbb{R}^n\times\mathbb{R}_{\geq0}\mapsto\mathbb{R}^n$ and $B:\mathbb{R}^n\times\mathbb{R}_{\geq0}\mapsto\mathbb{R}^{n\times m}$ be piecewise continuously differentiable functions. Then there exists a matrix-valued function $A:\mathbb{R}^n\times\mathbb{R}^n\times\mathbb{R}^m\times\mathbb{R}_{\geq0}\mapsto\mathbb{R}^{n\times n}$ s.t.{}, $\forall {s}\in\mathbb{R}^n$, $\bar{s}\in\mathbb{R}^n$, $\bar{u}\in\mathbb{R}^m$, and $t\in\mathbb{R}_{\geq0}$, \begin{align} A({s},\bar{s},\bar{u},t)\mathtt{e}=&f({s},t)+B({s},t)\bar{u}-f(\bar{s},t)-B(\bar{s},t)\bar{u} \end{align} where $\mathtt{e} = {s}-\bar{s}$, and one such $A$ is given as follows: \begin{align} \label{sdcAc} A({s},\bar{s},\bar{u},t) =& \int_0^1\frac{\partial \bar{f}}{\partial {s}}(c {s}+(1-c)\bar{s},\bar{u},t)dc \end{align} where $\bar{f}({s},\bar{u},t)=f({s},t)+B({s},t)\bar{u}$. We call $A$ an SDC matrix if it is constructed to satisfy the controllability (or observability for estimation) condition. Also, the choice of $A$ is not unique for $n \geq 2$, where $n$ is the number of states, and the convex combination of such non-unique SDC matrices also verifies extended linerization as follows: \begin{align} &f({s},t)+B({s},t)\bar{u}-f(\bar{s},t)-B(\bar{s},t)\bar{u} \\ &=A(\varrho,{s},\bar{s},\bar{u},t)({s}-\bar{s})=\sum_{i=1}^{s_A}\varrho_iA_i({s},\bar{s},\bar{u},t)({s}-\bar{s}) \label{varrho_def} \end{align} where $\varrho=(\varrho_1,\cdots,\varrho_{s_A})$, $\sum_{i=1}^{s_A}\varrho_i=1,~\varrho_i\geq 0$, and each $A_i$ satisfies the relation $\bar{f}({s},\bar{u},t)-\bar{f}(\bar{s},\bar{u},t)=A_i({s},\bar{s},\bar{u},t)({s}-\bar{s})$. \end{lemma} \begin{proof} The first statement on \eqref{sdcAc} follows from the integral relation given as \begin{align} \int_0^1\frac{d\bar{f}}{dc}(c {s}+(1-c)\bar{s},\bar{u},t)dc=\bar{f}({s},\bar{u},t)-\bar{f}(\bar{s},\bar{u},t) . \end{align} If there are multiple SDC matrices $A_i$, we clearly have $\varrho_iA_i({s},\bar{s},\bar{u},t)({s}-\bar{s}) = \varrho_i(\bar{f}({s},\bar{u},t)-\bar{f}(\bar{s},\bar{u},t)),~\forall i$, and therefore, the relation $\sum_{i=1}^{s_A}\varrho_i=1,~\varrho_i\geq 0$ gives \eqref{varrho_def}. \qed \end{proof} \begin{example} Let us illustrate how Lemma~\ref{sdclemma} can be used in practice taking the following nonlinear system as an example: \begin{align} \label{ex_dynamics} \dot{x} = [x_2, -x_1x_2]^{\top}+[0,\cos x_1]^{\top}u \end{align} where $x = [x_1,x_2]^{\top}$. If we use $({s},\bar{s},\bar{u})=(x,x_d,u_d)$ in Lemma~\ref{sdclemma} for a given target trajectory $(x_d,u_d)$ that satisfies \eqref{ex_dynamics}, evaluating the integral of \eqref{sdcAc} gives \begin{align} \label{Aexample} A_1(x,x_d,u_d,t) = -\begin{bmatrix}0 & 1\\\frac{x_2+x_{2d}}{2}-\frac{u_d(\cos x_1-\cos x_{d1})}{x_1-x_{d1}}&\frac{x_1+x_{1d}}{2}\end{bmatrix}~~~~~~~~ \end{align} due to the relation $\partial \bar{f}/\partial {s} = \left[\begin{smallmatrix}0 & 1\\ -{s}_2 & -{s}_1\end{smallmatrix}\right]+\left[\begin{smallmatrix}0 & 0\\ -u_d\sin {s}_1 & 0\end{smallmatrix}\right]$ for $\bar{f}({s},u_d,t)=f({s},t)+B({s},t)u_d$, where $x_d = [x_{1d},x_{2d}]^{\top}$. Note that we have \begin{align} \frac{(\cos x_1-\cos x_{d1})}{x_1-x_{d1}} = -\sin\left(\frac{x_1+x_{1d}}{2}\right)\sinc\left(\frac{x_1-x_{1d}}{2}\right) \end{align} and thus $A(x,x_d,u_d,t)$ is defined for all $x$, $x_d$, $u_d$, and $t$. The SDC matrix \eqref{Aexample} indeed verifies $A_1(x,x_d,u_d,t)(x-x_d)=\bar{f}(x,t)-\bar{f}(x_d,t)$. We can see that the following is also an SDC matrix of the nonlinear system \eqref{ex_dynamics}: \begin{align} \label{Aexample2} A_2(x,x_d,u_d,t) = -\begin{bmatrix}0 & 1\\x_2-\frac{u_d(\cos x_1-\cos x_{d1})}{x_1-x_{d1}}&x_{1d}\end{bmatrix}. \end{align} Therefore, the convex combination of $A_1$ in \eqref{Aexample} and $A_2$ in \eqref{Aexample2}, $A = \varrho_1A_1+\varrho_2A_2$ with $\varrho_1+\varrho_2=1$, $\varrho_1,\varrho_2 \geq 0$, is also an SDC matrix due to Lemma~\ref{sdclemma}. \end{example} The major advantage of the formalism in Lemma~\ref{sdclemma} lies in its systematic connection to LTV systems based on uniform controllability and observability, adequately accounting for the nonlinear nature of underlying dynamics through $A(\varrho,x,x_d,u_d,t)$ for global stability, as shall be seen in Sec.~\ref{sec:HinfKYP} and Sec.~\ref{sec:convex}. Since $A$ depends also on $(x_d,u_d)$ in this case unlike the original SDC matrix, we could consider contraction metrics using a positive definite matrix $M(x,x_d,u_d,t)$ instead of $M(x,t)$ in Definition~\ref{Def:contraction}, to improve the representation power of $M$ at the expense of computational efficiency. Another interesting point is that the non-uniqueness of $A$ in Lemma~\ref{sdclemma} for $n \geq 2$ creates additional degrees of freedom for selecting the coefficients $\varrho$, which can also be treated as decision variables in constructing optimal contraction metrics as proposed in~\cite{mypaperTAC,Ref:Stochastic,mypaper}. We focus mostly on the generalized SDC formulation in Sec.~\ref{sec:HinfKYP} and Sec.~\ref{sec:convex}, as it yields optimal control and estimation laws with global stability~\cite{nscm} while keeping the analysis simple enough to be understood as in LTV systems theory. \begin{remark} \label{remark_other_forms} This does not mean that contraction theory works only for the SDC parameterized nonlinear systems but implies that it can be used with the other techniques discussed in Sec.~\ref{Sec:overview}. For example, due to the extended linear form given in Table~\ref{tab:sdcccm_summary}, the results to be presented in Sec.~\ref{sec:HinfKYP} and in Sec.~\ref{sec:convex} based on the SDC formulation are applicable to linearized dynamics that can be viewed as an LTV system with some modifications, regarding the dynamics modeling error term as an external disturbance as in Sec.~\ref{Sec:overviewlinear}. Also, the original SDC formulation with respect to a fixed point (e.g.{}, $(s,\bar{s},\bar{u})=(x,0,0)$ in Lemma~\ref{sdclemma}) can still be used to obtain contraction conditions independent of a target trajectory $(x_d,u_d)$ (see Theorem~\ref{Thm:fixed_sdc} for details). \end{remark} \subsubsection{Control Contraction Metric (CCM) Formulation} We could also consider using the partial derivative of $f$ of the dynamical system directly for control synthesis through differential state feedback $\delta u = k(x,\delta x,u,t)$. This idea, formulated as the concept of a CCM~\cite{ccm,7989693,47710,WANG201944,vccm,rccm}, constructs contraction metrics with global stability guarantees independently of target trajectories, achieving greater generality while requiring added computation in evaluating integrals involving minimizing geodesics. Similar to the CCM, we could design a state estimator using a general formulation based on geodesics distances between trajectories~\cite{scrm,estimation_ccm}. These approaches are well compatible with the convex optimization-based schemes in Sec.~\ref{sec:convex}, and hence will be discussed in Sec.~\ref{Sec:ccm}. The differences between the SDC and CCM formulation are summarized in Table~\ref{tab:sdcccm_summary}. Considering such trade-offs would help determine which form of the control law is the best fit when using contraction theory for nonlinear stabilization. \begin{remark} \label{remark_nonaffine} For control non-affine nonlinear systems, we could find $f(x,u,t)-f(x_d,u_d,t)=A(x,x_d,u,u_d,t)(x-x_d)+B(x,x_d,u,u_d,t)(u-u_d)\allowbreak$ by Lemma~\ref{sdclemma} on the SDC formulation and use it in Theorem~\ref{Thm:CV-STEM}, although \eqref{controller} has to be solved implicitly as $B$ depends on $u$ in this case. A similar approach for the CCM formulation can be found in~\cite{vccm,WANG201944}. As discussed in Example~\ref{ex:nonaffine2}, designing such implicit control laws will be discussed in Lemma~\ref{Thm:discrete_neurallander} and Theorem~\ref{Thm:neurallander} of Sec.~\ref{Sec:neurallander}. \end{remark} \subsection{LMI Conditions for Contraction Metrics} We design a nonlinear feedback tracking control law parameterized by a matrix-valued function $M(x,x_d,u_d,t)$ (or $M(x,t)$, see Theorem~\ref{Thm:fixed_sdc}) as follows: \begin{align} \label{controller} u &= u_d-K(x,x_d,u_d,t)(x-x_d) \\ &= u_d-R(x,x_d,u_d,t)^{-1}B(x,t)^{\top}M(x,x_d,u_d,t)(x-x_d) \nonumber \end{align} where $R(x,x_d,u_d,t) \succ 0$ is a weight matrix on the input $u$ and $M(x,x_d,u_d,t) \succ 0$ is a positive definite matrix (which satisfies the matrix inequality constraints for a contraction metric, to be given in Theorem~\ref{Thm:CVSTEM:LMI}). As discussed in Sec.~\ref{Sec:overviewsdc}, the extended linear form of the tracking control \eqref{controller} enables LTV systems-type approaches to Lyapunov function construction, while being general enough to capture the nonlinearity of the underlying dynamics due to Lemma~\ref{u_equivalence_lemma}~\cite{lagros}. \begin{lemma} \label{u_equivalence_lemma} Consider a general feedback controller $u$ defined as $u = k(x,x_d,u_d,t)$ with $k(x_d,x_d,u_d,t)=u_d$, where $k:\mathbb{R}^n\times\mathbb{R}^n\times\mathbb{R}^m\times\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^{m}$. If $k$ is piecewise continuously differentiable, then $\exists K:\mathbb{R}^n\times\mathbb{R}^n\times\mathbb{R}^m\times\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^{m\times n}$ s.t.{} $u = k(x,x_d,u_d,t) = u_d-K(x,x_d,u_d,t)(x-x_d)$. \end{lemma} \begin{proof} Using $k(x_d,x_d,u_d,t)=u_d$, $u$ can be decomposed as $u=u_d+(k(x,x_d,u_d,t)-k(x_d,x_d,u_d,t))$. Since we have $k(x,x_d,u_d,t)-k(x_d,x_d,u_d,t)=\int_0^1(dk(c x+(1-c)x_d,x_d,u_d,t)/dc)dc$, selecting $K$ as \begin{align} K = -\int_0^1\frac{\partial k}{\partial x}(c x+(1-c)x_d,x_d,u_d,t)dc \end{align} gives the desired relation~\cite{lagros}. \qed \end{proof} \begin{remark} \label{u_equivalence_remark} Lemma~\ref{u_equivalence_lemma} implies that designing optimal $k$ of $u = k(x,x_d,u_d,t)$ reduces to designing the optimal gain $K(x,x_d,u_d,t)$ of $u=u_d-K(x,x_d,u_d,t)(x-x_d)$. We could also generalize this idea further using the CCM-based differential feedback controller $\delta u = k(x,\delta x,u,t)$~\cite{ccm,7989693,47710,WANG201944,vccm,rccm} (see Theorem~\ref{Thm:ccm_cvstem}). \end{remark} Substituting \eqref{controller} into \eqref{original_dynamics} and \eqref{sdc_dynamics} yields the following virtual system of a smooth path $q(\mu,t)$, parameterized by $\mu \in [0,1]$ to have $q(0,\mu)=x_d$ and $q(1,t)=x$, for partial contraction in Theorem~\ref{Thm:partial_contraction}: \begin{align} \label{closed_loop_e} \dot{q}(\mu,t) =& \zeta(q(\mu,t),x,x_d,u_d,t)+d(\mu,x,t) \\ \label{closed_loop_e_sto} dq(\mu,t) =& \zeta(q(\mu,t),x,x_d,u_d,t)dt+G(\mu,x,t)d\mathscr{W}(t) \end{align} where $d(\mu,x,t) = \mu d_c(x,t)$, $G(\mu,x,t) = \mu G_c(x,t)$, and $\zeta(q,x,x_d,u_d,t)$ is defined as \begin{align} \zeta =& (A(\varrho,x,x_d,u_d,t)-B(x,t)K(x,x_d,u_d,t))(q-x_d) \\ \label{Eq:virtual_sys_sto} &+f(x_d,t)+B(x_d,t)u_d \end{align} where $A$ is the SDC matrix of Lemma~\ref{sdclemma} with $({s},\bar{s},\bar{u})=(x,x_d,u_d)$. Setting $\mu=1$ in \eqref{closed_loop_e} and \eqref{closed_loop_e_sto} results in \eqref{original_dynamics} and \eqref{sdc_dynamics}, respectively, and setting $\mu=0$ simply results in \eqref{sdc_dynamicsd}. Consequently, both $q=x$ and $q=x_d$ are particular solutions of \eqref{closed_loop_e} and \eqref{closed_loop_e_sto}. If there is no disturbance acting on the dynamics \eqref{original_dynamics} and \eqref{sdc_dynamics}, the differential dynamics of \eqref{closed_loop_e} and \eqref{closed_loop_e_sto} for $\partial_{\mu}q=\partial q/\partial \mu$ is given as \begin{align} \label{eq:differential_dyn_sto} \partial_{\mu}\dot{q}= \left(A(\varrho,x,x_d,u_d,t)-B(x,t)K(x,x_d,u_d,t) \right)\partial_{\mu}q. \end{align} In~\cite{mypaperTAC,nscm,ncm,mypaper}, it is proposed that the contraction conditions of Theorems~\ref{Thm:contraction} and~\ref{Thm:robuststochastic} for the closed-loop dynamics \eqref{closed_loop_e} and \eqref{closed_loop_e_sto} can be expressed as convex constraints as summarized in Theorem~\ref{Thm:CVSTEM:LMI}. \begin{theorem} \label{Thm:CVSTEM:LMI} Let $\beta$ be defined as $\beta = 0$ for deterministic systems \eqref{original_dynamics} and \begin{align} \beta = \alpha_s=L_m\bar{g}_c^2(\alpha_G+{1}/{2}) \end{align} for stochastic systems \eqref{sdc_dynamics}, respectively, where $\bar{g}_c$ is given in \eqref{sdc_dynamics}, $L_m$ is the Lipschitz constant of $\partial M/\partial x_i$ for $M$ of \eqref{controller}, and $\alpha_G\in\mathbb{R}_{>0}$ is an arbitrary constant as in Theorem~\ref{Thm:robuststochastic}. Also, let $W = M(x,x_d,u_d,t)^{-1}$ (or $W=M(x,t)^{-1}$, see Theorem~\ref{Thm:fixed_sdc}), $\bar{W}=\nu W$, and $\nu=\overline{m}$. Then the following three matrix inequalities are equivalent: \begin{align} \label{riccatiFV} &\dot{M}+M\frac{\partial \zeta}{\partial q}+\frac{\partial \zeta}{\partial q}^{\top}M \preceq -2 \alpha M-\beta \mathrm{I},~\forall \mu\in[0,1] \\ \label{riccati} &\dot{M}+2\sym(MA)-2MBR^{-1}B^{\top}M\preceq -2 \alpha M-\beta \mathrm{I} \\ \label{riccatiW} &-\dot{\bar{W}}+2\sym(A\bar{W})-2\nu BR^{-1}B^{\top} \preceq -2\alpha \bar{W}-\frac{\beta}{\nu}\bar{W}^2 \end{align} where $\zeta$ is as defined in \eqref{Eq:virtual_sys_sto}. For stochastic systems with $\beta=\alpha_s>0$, these inequalities are also equivalent to \begin{equation} \begin{bmatrix} -\dot{\bar{W}}+2\sym{}(A\bar{W})-2\nu BR^{-1}B^{\top}+2\alpha \bar{W}& \bar{W} \\ \bar{W} & -\frac{\nu}{\beta}\mathrm{I} \end{bmatrix} \preceq 0.\label{alpha_cond_convex_3} \end{equation} Note that $\nu$ and $\bar{W}$ are required for \eqref{riccatiW} and \eqref{alpha_cond_convex_3} and the arguments $(x,x_d,u_d,t)$ for each matrix are suppressed for notational simplicity. Furthermore, under these equivalent contraction conditions, Theorems~\ref{Thm:Robust_contraction_original} and \ref{Thm:robuststochastic} hold for the virtual systems \eqref{closed_loop_e} and \eqref{closed_loop_e_sto}, respectively. In particular, if $\underline{m}\mathrm{I} \preceq M\preceq \overline{m}\mathrm{I}$ of \eqref{Mcon} holds, or equivalently \begin{align} \label{lambda_con} \mathrm{I} \preceq \bar{W} (x,x_d,u_d,t)\preceq \chi \mathrm{I} \end{align} holds for $\chi=\overline{m}/\underline{m}$, then we have the following bounds: \begin{align} \label{Eq:CVSTEM_control_error_bound} &\|x(t)-x_d(t)\| \leq \frac{V_{\ell}(0)}{\sqrt{\underline{m}}}e^{-\alpha t}+\frac{\bar{d}_c}{\alpha}\sqrt{\chi}(1-e^{-\alpha t}) \\ \label{Eq:CVSTEM_control_error_bound_sto} &\mathop{\mathbb{E}}\left[\|x(t)-x_d(t)\|^2\right] \leq \frac{\mathop{\mathbb{E}}[V_{s\ell}(0)]}{\underline{m}}e^{-2\alpha t}+\frac{C_C}{2\alpha}\chi \end{align} where $V_{s\ell}=\int^x_{x_d}\delta q^{\top}M\delta q$ and $V_{\ell}=\int^x_{x_d}\|\Theta\delta q\|$ are as given in Theorem~\ref{Thm:path_integral} with $M=\Theta^{\top}\Theta$, the disturbance bounds $\bar{d}_c$ and $\bar{g}_c$ are given in \eqref{original_dynamics} and \eqref{sdc_dynamics}, respectively, and $C_C = \bar{g}_c^2({2}{\alpha_G}^{-1}+1)$. Note that for stochastic systems, the probability that $\|x-x_d\|$ is greater than or equal to $\varepsilon\in\mathbb{R}_{> 0}$ is given as \begin{align} \label{Eq:CVSTEM_control_error_bound_sto_prob} \mathop{\mathbb{P}}\left[\|x(t)-x_d(t)\|\geq\varepsilon\right] \leq \frac{1}{\varepsilon^2}\left(\frac{\mathop{\mathbb{E}}[V_{s\ell}(0)]}{\underline{m}}e^{-2\alpha t}+\frac{C_C}{2\alpha}\chi\right).~~~~~~ \end{align} \end{theorem} \begin{proof} Substituting \eqref{Eq:virtual_sys_sto} into \eqref{riccatiFV} gives \eqref{riccati}. Since $\nu > 0$ and $W \succ 0$, multiplying \eqref{riccati} by $\nu$ and then by $W$ from both sides preserves matrix definiteness. Also, the resultant inequalities are equivalent to the original ones~\cite[p. 114]{lmi}. These operations performed on \eqref{riccati} yield \eqref{riccatiW}. If $\beta=\alpha_s>0$ for stochastic systems, applying Schur's complement lemma~\cite[p. 7]{lmi} to \eqref{riccatiW} results in the Linear Matrix Inequality (LMI) constraint \eqref{alpha_cond_convex_3} in terms of $\bar{W}$ and $\nu$. Therefore, \eqref{riccatiFV}--\eqref{alpha_cond_convex_3} are indeed equivalent. Also, since we have $\|\partial_{\mu} d(\mu,x,t)\|\leq\bar{d}_c$ for $d$ in \eqref{closed_loop_e} and $\|\partial_{\mu} G(\mu,x,t)\|_F^2\leq \bar{g}_c^2$ for $G$ in \eqref{closed_loop_e_sto}, the virtual systems in \eqref{closed_loop_e} and \eqref{closed_loop_e_sto} clearly satisfy the conditions of Theorems~\ref{Thm:Robust_contraction_original} and~\ref{Thm:robuststochastic} if it is equipped with \eqref{riccatiFV}, which is equivalent to \eqref{riccati}--\eqref{alpha_cond_convex_3}. This implies the exponential bounds \eqref{Eq:CVSTEM_control_error_bound}--\eqref{Eq:CVSTEM_control_error_bound_sto_prob} rewritten using $\chi=\overline{m}/\underline{m}$, following the proofs of Theorems~\ref{Thm:Robust_contraction_original} and~\ref{Thm:robuststochastic}. \qed \end{proof} Because of the control and estimation duality in differential dynamics similar to that of the Kalman filter and Linear Quadratic Regulator (LQR) in LTV systems, we have an analogous robustness result for the contraction theory-based state estimator as to be derived in Sec.~\ref{Sec:cvstem_estimation}. Although the conditions \eqref{riccatiFV}--\eqref{alpha_cond_convex_3} depend on $(x_d,u_d)$, we could also use the SDC formulation with respect to a fixed point~\cite{mypaperTAC,mypaper} in Lemma~\ref{sdclemma} to make them independent of the target trajectory as in the following theorem. \begin{theorem} \label{Thm:fixed_sdc} Let $(\bar{x},\bar{u})$ be a fixed point selected arbitrarily in $\mathbb{R}^n\times\mathbb{R}^m$, e.g.{}, $(\bar{x},\bar{u})=(0,0)$, and let $A(x,t)$ be an SDC matrix constructed with $({s},\bar{s},\bar{u})=(x,\bar{x},\bar{u})$ in Lemma~\ref{sdclemma}, i.e.{}, \begin{align} \label{fixed_sdc} A(\varrho,x,t)(x-\bar{x})=f(x,t)+B(x,t)\bar{u}-f(\bar{x},t)-B(\bar{x},t)\bar{u}.~~~~ \end{align} Suppose that the contraction metric of Theorem~\ref{Thm:CVSTEM:LMI} is designed by $M(x,t)$ with $A$ of \eqref{fixed_sdc}, independently of the target trajectory $(x_d,u_d)$, and that the systems \eqref{original_dynamics} and \eqref{sdc_dynamics} are controlled by \begin{align} \label{fixed_sdc_control} u=u_d-R(x,t)^{-1}B(x,t)^{\top}M(x,t)(x-x_d) \end{align} with such $M(x,t)$, where $R(x,t)\succ0$ is a weight matrix on $u$. If the function $\phi(x,x_d,u_d,t)=A(\varrho,x,t)(x_d-\bar{x})+B(x,t)(u_d-\bar{u})$ is Lipschitz in $x$ with its Lipschitz constant $\bar{L}$, then Theorem~\ref{Thm:CVSTEM:LMI} still holds with $\alpha$ of the conditions \eqref{riccatiFV}--\eqref{alpha_cond_convex_3} replaced by $\alpha+\bar{L}\sqrt{\overline{m}/\underline{m}}$. The same argument holds for state estimation of Theorem~\ref{Thm:CVSTEM-LMI-est} to be discussed in Sec.~\ref{Sec:cvstem_estimation}. \end{theorem} \begin{proof} The unperturbed virtual system of \eqref{original_dynamics}, \eqref{sdc_dynamics}, and \eqref{sdc_dynamicsd} with $A$ of \eqref{fixed_sdc} and $u$ of \eqref{fixed_sdc_control} is given as follows: \begin{align} \label{virtual_fixed_sdc} &\dot{q} = (A(\varrho,x,t)-B(x,t)K(x,t))(q-x_d)\\ &+A(\varrho,q,t)(x_d-\bar{x})+B(q,t)(u_d-\bar{u})+f(\bar{x},t)+B(\bar{x},t)\bar{u} \end{align} where $K(x,t)=R(x,t)^{-1}B(x,t)^{\top}M(x,t)$. Following the proof of Theorem~\ref{Thm:CVSTEM:LMI}, the computation of $\dot{V}$, where $V=\delta q^{\top} M(x,t)\delta q$, yields an extra term \begin{align} \label{fixed_sdc_extra_term} 2\delta q^{\top}M\frac{\partial\phi}{\partial q}(q,x_d,u_d,t)\delta q \leq 2\bar{L}\sqrt{\frac{\overline{m}}{\underline{m}}}\delta q^{\top} M\delta q \end{align} due to the Lipschitz condition on $\phi$, where $\phi(q,x_d,u_d,t)=A(q,t)(x_d-\bar{x})+B(q,t)(u_d-\bar{u})$. This indeed implies that the system \eqref{virtual_fixed_sdc} is contracting as long as the conditions \eqref{riccatiFV}--\eqref{alpha_cond_convex_3} hold with $\alpha$ replaced by $\alpha+\bar{L}\sqrt{\overline{m}/\underline{m}}$. The last statement on state estimation follows from the nonlinear control and estimation duality to be discussed in Sec.~\ref{Sec:cvstem_estimation}. \end{proof} \begin{remark} \label{remark_fixed_sdc} As demonstrated in~\cite{mypaperTAC}, we could directly use the extra term $2\delta q^{\top}M({\partial\phi}/{\partial q})\delta q$ of \eqref{fixed_sdc_extra_term} in \eqref{riccatiFV}--\eqref{alpha_cond_convex_3} without upper-bounding it, although now the constraints of Theorem~\ref{Thm:fixed_sdc} depend on $(x,q,t)$ instead of $(x,t)$. Also, the following two inequalities given in~\cite{mypaperTAC} with $\bar{\gamma}=\nu \gamma$, $\gamma \in \mathbb{R}_{\geq 0}$: \begin{align} \label{riccati_lmi_con} &-\dot{\bar{W}}+A\bar{W}+\bar{W}A^{\top}+\bar{\gamma} \mathrm{I}-\nu BR^{-1}B^{\top} \preceq 0 \\ &\begin{bmatrix} \bar{\gamma} \mathrm{I}+\nu BR^{-1}B^{\top}-\bar{W}\phi^{\top}-\phi \bar{W}-2\alpha \bar{W}& \bar{W} \\ \bar{W} & \frac{\nu}{2\alpha_s}\mathrm{I} \end{bmatrix} \succeq 0.\nonumber \end{align} are combined as one LMI \eqref{alpha_cond_convex_3} in Theorems~\ref{Thm:CVSTEM:LMI} and~\ref{Thm:fixed_sdc}. \end{remark} \begin{example} \label{ex:hinf_lmi} The inequalities in Theorem~\ref{Thm:CVSTEM:LMI} can be interpreted as in the Riccati inequality in $\mathcal{H}_{\infty}$ control. Consider the following system: \begin{align} \label{ex_hinf_dyn} \dot{x} = Ax+B_uu+B_ww,~z=C_zx \end{align} where $A\in\mathbb{R}^{n\times n}$, $B_u\in\mathbb{R}^{n\times m}$, $B_w\in\mathbb{R}^{n\times w}$, and $C_z\in\mathbb{R}^{o\times n}$ are constant matrices, $w\in\mathbb{R}^w$ is an exogenous input, and $z\in\mathbb{R}^o$ is a system output. As shown in~\cite{256331} and~\cite[p. 109]{lmi}, there exists a state feedback gain $K=R^{-1}B_u^{\top}P$ such that the $\mathcal{L}_2$ gain of the closed-loop system \eqref{ex_hinf_dyn}, $\sup_{\|w\|\neq 0}{\|z\|}/{\|w\|}$, is less than or equal to $\gamma$ if \begin{align} \label{ex_riccati_robust} 2\sym{}(PA)-2PB_uR^{-1}B_u^{\top}P+\frac{PB_wB_w^{\top}P}{\gamma^2}+C_z^{\top}C_z \preceq 0~~~~~~ \end{align} has a solution $P \succ 0$, where $R\succ 0$ is a constant weight matrix on the input $u$. If we select $B_w$ and $C_z$ to have $B_wB_w^{\top}\succeq (P^{-1})^2$ and $C_z^{\top}C_z \succeq 2\alpha P$ for some $\alpha >0$, the contraction condition \eqref{riccati} in Theorem~\ref{Thm:CVSTEM:LMI} can be satisfied with $M=P$, $B = B_u$, and $\beta = 1/\gamma^2$ due to \eqref{ex_riccati_robust}. \end{example} In Sections~\ref{sec:brl_contraction} and~\ref{sec:kyp_contraction}, we will discuss the relationship to input-output stability theory as in Example~\ref{ex:hinf_lmi}, using the results of Theorem~\ref{Thm:CVSTEM:LMI}. \subsection{Bounded Real Lemma in Contraction Theory} \label{sec:brl_contraction} The LMI \eqref{alpha_cond_convex_3} of Theorem~\ref{Thm:CVSTEM:LMI} can be interpreted as the LMI condition for the bounded real lemma~\cite[p. 369]{brlbook}. Let us consider the following Hurwitz linear system with $\varsigma(t)\in \mathcal{L}_{2e}$, (i.e.{}, $\|(\varsigma)_{\tau}\|_{\mathcal{L}_2}<\infty$ for $\tau \in\mathbb{R}_{\geq 0}$, see Sec.~\ref{notation}): \begin{equation} \dot{\kappa}=\mathcal{A}\kappa+\mathcal{B}\varsigma(t), \ \ \upsilon=\mathcal{C}\kappa+\mathcal{D}\varsigma(t).\label{eq:linearsys} \end{equation} Setting $\kappa = \delta q$ and viewing $\varsigma$ as external disturbance, this system can be interpreted as the differential closed-loop dynamics defined earlier in \eqref{eq:differential_dyn_sto}. The bounded real lemma states that this system is $\mathcal{L}_2$ gain stable with its $\mathcal{L}_2$ gain less than or equal to $\gamma$, i.e.{}, $\|(\upsilon)_{\tau}\|_{\mathcal{L}_2}\leq \gamma\|(\varsigma)_{\tau}\|_{\mathcal{L}_2}+const.$, or equivalently, the $\mathcal{H}_{\infty}$ norm of the transfer function of \eqref{eq:linearsys} is less than or equal to $\gamma$, if the following LMI for $\mathcal{P}\succ 0$ holds (see~\cite[p. 369]{brlbook}): \begin{equation} \begin{bmatrix}\dot{\mathcal{P}}+2\sym{}(\mathcal{P}\mathcal{A})+\mathcal{C}^\top\mathcal{C} & \mathcal{P}\mathcal{B}+\mathcal{C}^\top\mathcal{D} \\ \mathcal{B}^\top\mathcal{P}+\mathcal{D}^\top\mathcal{C} & \mathcal{D}^\top\mathcal{D}-\gamma^2\mathrm{I} \end{bmatrix}\preceq 0.\label{eq:BoundedRealLemma} \end{equation} Theorem~\ref{Thm:bounded_real_cvstem} introduces the bounded real lemma in the context of contraction theory. \if0 Also, note that it is \emph{output strictly passive (dissipative)}. This fact can be seen as follows. Using the following relation \begin{align} \label{eq:brl_proof} 0 \geq& \begin{bmatrix}\kappa \\ \varsigma\end{bmatrix}^{\top}\begin{bmatrix}2\sym{}(\mathcal{P}\mathcal{A})+\mathcal{C}^\top\mathcal{C} & \mathcal{P}\mathcal{B}+\mathcal{C}^\top\mathcal{D} \\ \mathcal{B}^\top\mathcal{P}+\mathcal{D}^\top\mathcal{C} & \mathcal{D}^\top\mathcal{D}-\gamma^2\mathrm{I} \end{bmatrix} \begin{bmatrix}\kappa \\ \varsigma\end{bmatrix} \\ =&\dot{V}+\|\upsilon\|^2-\gamma^2 \|\varsigma\|^2\leq 0. \end{align} we have by integration that \begin{align} \label{brl_integration} V(\tau)-V(0) +\int^\tau_0 \|\upsilon(t)\|^2 dt \leq \gamma^2\int^\tau_0 \|\varsigma(t)\|^2 dt \end{align} Since $V(\tau)>0$, this results in $\| \upsilon_\tau\|_{\mathcal{L}_2} \leq \gamma \|\varsigma_\tau\|_{\mathcal{L}_2}+\sqrt{V(0)}$, leading to $\mathcal{L}_2$ gain stability with its $\mathcal{L}_2$ gain less than or equal to $\gamma$. \fi \begin{theorem} \label{Thm:bounded_real_cvstem} Let $\mathcal{A}= A-BR^{-1}B^{\top}M$, $\mathcal{B}=M^{-1}$, $C=\sqrt{2\alpha}\Theta$, and $\mathcal{D}=0$ in \eqref{eq:linearsys}, where $M=\Theta^{\top}\Theta$, and the other variables are as defined in Theorem~\ref{Thm:CVSTEM:LMI}. Then \eqref{eq:BoundedRealLemma} with $\mathcal{P}=M$ and $\gamma=1/\sqrt{\beta}$ is equivalent to \eqref{alpha_cond_convex_3}, and thus \eqref{alpha_cond_convex_3} implies $\mathcal{L}_2$ gain stability of \eqref{eq:linearsys} with its $\mathcal{L}_2$ gain less than or equal to $\gamma$. \end{theorem} \begin{proof} Multiplying \eqref{alpha_cond_convex_3} by $\nu^{-1}$ and then by $\left[\begin{smallmatrix}M & 0\\ 0 & \mathrm{I}\end{smallmatrix}\right]$ from both sides gives the following matrix inequality: \begin{align} \nu\begin{bmatrix} \dot{M}+2\sym{}(M(A-BR^{-1}B^{\top}M))+2\alpha M& \mathrm{I} \\ \mathrm{I} & -\frac{1}{\beta}\mathrm{I} \end{bmatrix} \preceq 0. \nonumber \end{align} This is indeed equivalent to \eqref{eq:BoundedRealLemma} if $\mathcal{A}= A-BR^{-1}B^{\top}M$, $\mathcal{B}=M^{-1}$, $C=\sqrt{2\alpha}\Theta$, $\mathcal{D}=0$, $\mathcal{P}=M$, and $\gamma=1/\sqrt{\beta}$. Now, multiplying \eqref{eq:BoundedRealLemma} by $[\delta q^{\top},\varsigma^{\top}]^{\top}=[\kappa^{\top},\varsigma^{\top}]^{\top}$ for such $(\mathcal{A},\mathcal{B},\mathcal{C},\mathcal{D})$ gives \begin{align} \label{eq:brl_cvstem_1} \kappa^{\top}(\dot{\mathcal{P}}+2\mathcal{P}\mathcal{A}+\mathcal{C}^{\top}\mathcal{C})\kappa+2\kappa^{\top}\mathcal{P}\mathcal{B}\varsigma-\gamma^2\|\varsigma\|^2 \preceq 0 \end{align} resulting in $\dot{V}+\|\upsilon\|^2-\gamma^2\|\varsigma\|^2 \preceq 0$ for $V = \kappa^{\top}\mathcal{P}\kappa = \delta q^{\top}M\delta q$. This implies $\mathcal{L}_2$ gain stability with its $\mathcal{L}_2$ gain less than or equal to $\gamma = 1/\sqrt{\beta}$~\cite[p. 209]{Khalil:1173048}. \qed \end{proof} \subsection{KYP Lemma in Contraction Theory} \label{sec:kyp_contraction} Analogously to Theorem~\ref{Thm:bounded_real_cvstem}, the LMI \eqref{alpha_cond_convex_3} of Theorem~\ref{Thm:CVSTEM:LMI} can be understood using the Kalman-Yakubovich-Popov (KYP) lemma~\cite[p. 218]{kypbook}. Consider the quadratic Lyapunov function $V=\kappa^\top \mathcal{Q} \kappa$ with $\mathcal{Q}\succ 0$, satisfying the following output strict passivity (dissipativity) condition: \begin{equation} \dot{V}- 2 \varsigma^\top \upsilon+ (2/\gamma) \upsilon^\top \upsilon \leq 0\label{eq:VdotKYP} \end{equation} which can be expanded by completing the square to have \begin{align} \dot{V}\leq& -\|\gamma(\varsigma-\upsilon/\gamma)\|^2+\gamma \|\varsigma\|^2-(1/\gamma) \|\upsilon\|^2 \\ \label{kyp_square} \leq& \gamma \|\varsigma\|^2-(1/\gamma) \|\upsilon\|^2. \end{align} This implies that we have $\| (\upsilon)_\tau\|_{\mathcal{L}_2} \leq \gamma \|(\varsigma)_\tau\|_{\mathcal{L}_2}+\sqrt{\gamma V(0)}$ by the comparison lemma~\cite[pp. 102-103, pp. 350-353]{Khalil:1173048}, leading to $\mathcal{L}_2$ gain stability with its $\mathcal{L}_2$ gain less than or equal to $\gamma$~\cite[p. 218]{kypbook}. The condition \eqref{eq:VdotKYP} can be expressed equivalently as an LMI form as follows: \begin{equation} \begin{bmatrix} \dot{\mathcal{Q}}+2\mathrm{sym}(\mathcal{Q}\mathcal{A})+\frac{2\mathcal{C}^\top\mathcal{C}}{\gamma} & \mathcal{Q}\mathcal{B}+\mathcal{C}^\top\left(\frac{2\mathcal{D}}{\gamma}-\mathrm{I}\right) \\ \mathcal{B}^\top\mathcal{Q}+\left(\frac{2\mathcal{D}^\top}{\gamma}-\mathrm{I}\right)\mathcal{C} & -(\mathcal{D}^\top+D)+\frac{2\mathcal{D}^\top\mathcal{D}}{\gamma} \end{bmatrix}\preceq 0\label{eq:KYPLMI} \end{equation} where $\mathcal{A}$, $\mathcal{B}$, $\mathcal{C}$, and $\mathcal{D}$ are as defined in \eqref{eq:linearsys}. \begin{theorem} \label{Thm:kyp_cvstem} If \eqref{eq:KYPLMI} holds, the LMI \eqref{eq:BoundedRealLemma} for the bounded real lemma holds with $\mathcal{P}=\gamma \mathcal{Q}$, i.e.{}, the system \eqref{eq:linearsys} is $\mathcal{L}_2$ gain stable with its $\mathcal{L}_2$ gain less than or equal to $\gamma$. Thus, for systems with $\mathcal{A}$, $\mathcal{B}$, $\mathcal{C}$, and $\mathcal{D}$ defined in Theorem~\ref{Thm:bounded_real_cvstem}, the condition \eqref{eq:KYPLMI} guarantees the contraction condition \eqref{alpha_cond_convex_3} of Theorem~\ref{Thm:CVSTEM:LMI}. \end{theorem} \begin{proof} Writing the inequality in \eqref{kyp_square} in a matrix form, we have that \begin{align*} &\begin{bmatrix} \dot{\mathcal{Q}}+2\mathrm{sym}(\mathcal{Q}\mathcal{A})+\frac{2\mathcal{C}^\top\mathcal{C}}{\gamma} & \mathcal{Q}\mathcal{B}+\mathcal{C}^\top\left(\frac{2\mathcal{D}}{\gamma}-\mathrm{I}\right) \\ \mathcal{B}^\top\mathcal{Q}+\left(\frac{2\mathcal{D}^\top}{\gamma}-\mathrm{I}\right)\mathcal{C} & -(\mathcal{D}^\top+D)+\frac{2\mathcal{D}^\top\mathcal{D}}{\gamma} \end{bmatrix}\\ &\succeq\begin{bmatrix}\dot{\mathcal{Q}}+2\mathrm{sym}(\mathcal{Q}\mathcal{A}) & \mathcal{Q}\mathcal{B} \\ \mathcal{B}^\top\mathcal{Q} & 0\end{bmatrix} +\begin{bmatrix}\frac{\mathcal{C}^\top\mathcal{C}}{\gamma} & \frac{\mathcal{C}^\top\mathcal{D}}{\gamma} \\ \frac{\mathcal{D}^\top\mathcal{C}}{\gamma} & \frac{\mathcal{D}^\top\mathcal{D}}{\gamma} \end{bmatrix} -\begin{bmatrix}0 & 0\\ 0 & \gamma \mathrm{I}\end{bmatrix} \\ & =\begin{bmatrix} \dot{\mathcal{Q}}+2\mathrm{sym}(\mathcal{Q}\mathcal{A})+\frac{\mathcal{C}^\top\mathcal{C}}{\gamma} & \mathcal{Q}\mathcal{B}+\frac{\mathcal{C}^\top\mathcal{D}}{\gamma} \\ \mathcal{B}^\top\mathcal{Q}+\frac{\mathcal{D}^\top\mathcal{C}}{\gamma} & \frac{\mathcal{D}^\top\mathcal{D}}{\gamma}-\gamma \mathrm{I} \end{bmatrix}. \end{align*} Therefore, a necessary condition of \eqref{eq:KYPLMI} reduces to \eqref{eq:BoundedRealLemma} if $\mathcal{Q}=\mathcal{P}/\gamma$. The rest follows from Theorem~\ref{Thm:bounded_real_cvstem}. \qed \end{proof} \begin{example} Theorems~\ref{Thm:bounded_real_cvstem} and~\ref{Thm:kyp_cvstem} imply the following statements. \setlength{\leftmargini}{17pt} \begin{itemize} \setlength{\itemsep}{1pt} \setlength{\parskip}{0pt} \item If \eqref{eq:BoundedRealLemma} holds, the system is finite-gain $\mathcal{L}_2$ stable with $\gamma$ as its $\mathcal{L}_2$ gain. \item If \eqref{eq:KYPLMI} holds, the system is finite-gain $\mathcal{L}_2$ stable with $\gamma$ as its $\mathcal{L}_2$ gain. \item \eqref{eq:VdotKYP} is equivalent to \eqref{eq:KYPLMI}, and to the output strict passivity condition with dissipation $1/\gamma$~\cite[p. 231]{Khalil:1173048}. \item If \eqref{eq:KYPLMI} holds (KYP lemma), \eqref{eq:BoundedRealLemma} holds (bounded real lemma). The converse is not necessarily true. \end{itemize} \end{example} \section{Convex Optimality in Robust Nonlinear Control and Estimation via Contraction Theory} \label{sec:convex} Theorem~\ref{Thm:CVSTEM:LMI} indicates that the problem of finding contraction metrics for general nonlinear systems could be formulated as a convex feasibility problem. This section thus delineates one approach, called the method of ConVex optimization-based Steady-state Tracking Error Minimization (CV-STEM)~\cite{mypaperTAC,ncm,nscm,mypaper}, to optimally design $M$ of Theorem~\ref{Thm:CVSTEM:LMI} that defines a contraction metric and minimizes an upper bound of the steady-state tracking error in Theorem~\ref{Thm:Robust_contraction_original} or in Theorem~\ref{Thm:robuststochastic} via convex optimization. In particular, we present an overview of the SDC- and CCM-based CV-STEM frameworks for provably stable and optimal feedback control and state estimation of nonlinear systems, perturbed by deterministic and stochastic disturbances. It is worth noting that the steady-state bound is expressed as a function of the condition number $\chi=\overline{m}/\underline{m}$ as to be seen in \eqref{stochasticmse_infty} and \eqref{stochasticmse_infty_est}, which renders the CV-STEM applicable and effective even to learning-based and data-driven control frameworks as shall be seen in Sec.~\ref{Sec:learning_stability}. \subsection{CV-STEM Control} \label{Sec:cvstem_control} As a result of Theorems~\ref{Thm:Robust_contraction_original},~\ref{Thm:robuststochastic}, and~\ref{Thm:CVSTEM:LMI}, the control law $u=u_d-K(x-x_d)$ of \eqref{controller} gives a convex steady-state upper bound of the Euclidean distance between the system trajectories, which can be used as an objective function for the CV-STEM control framework in Theorem~\ref{Thm:CV-STEM}~\cite{mypaperTAC,ncm,nscm,mypaper}. \begin{theorem} \label{Thm:CVSTEMobjective} If one of the matrix inequalities of Theorem~\ref{Thm:CVSTEM:LMI} holds, we have the following bound for $\chi={\overline{m}}/{\underline{m}}$: \begin{align} \label{stochasticmse_infty} &\lim_{t \to \infty}\sqrt{\mathop{\mathbb{E}}\left[\|x-x_d\|^2\right]} \leq c_{1}(\alpha,\alpha_G)\sqrt{\chi} \leq c_{1}(\alpha,\alpha_G)\chi \end{align} where $c_{1}(\alpha,\alpha_G)=\bar{d}_c /\alpha$ for deterministic systems and $c_{1}(\alpha,\alpha_G)=\bar{g}_c\sqrt{(2\alpha_G^{-1}+1)/(2\alpha)}$ for stochastic systems, with the variables given in Theorem~\ref{Thm:CVSTEM:LMI}. \end{theorem} \begin{proof} Taking $\lim_{t\to\infty}$ in the exponential tracking error bounds \eqref{Eq:CVSTEM_control_error_bound} and \eqref{Eq:CVSTEM_control_error_bound_sto} of Theorem~\ref{Thm:CVSTEM:LMI} gives the first inequality of \eqref{stochasticmse_infty}. The second inequality follows from the relation $1\leq\sqrt{\overline{m}/\underline{m}}\leq \overline{m}/\underline{m}=\chi$ due to $\underline{m}\leq\overline{m}$. \qed \end{proof} The convex optimization problem of minimizing \eqref{stochasticmse_infty}, subject to the contraction constraint of Theorem~\ref{Thm:CVSTEM:LMI}, is given in Theorem~\ref{Thm:CV-STEM}, thereby introducing the CV-STEM control~\cite{mypaperTAC,ncm,nscm,mypaper} for designing an optimal contraction metric and contracting control policy as depicted in Fig.~\ref{slide2_cvstem}. \begin{theorem} \label{Thm:CV-STEM} Suppose that $\alpha$, $\alpha_G$, $\bar{d}_c$, and $\bar{g}_c$ in \eqref{stochasticmse_infty} and the Lipschitz constant $L_m$ of $\partial M/\partial x_i$ in Theorem~\ref{Thm:CVSTEM:LMI} are given. If the pair $(A,B)$ is uniformly controllable, the non-convex optimization problem of minimizing the upper bound \eqref{stochasticmse_infty} is equivalent to the following convex optimization problem, with the convex contraction constraint \eqref{riccatiW} or \eqref{alpha_cond_convex_3} of Theorem~\ref{Thm:CVSTEM:LMI} and $\mathrm{I}\preceq \bar{W}\preceq\chi\mathrm{I}$ of \eqref{lambda_con}: \begin{align} \label{cvstem_eq} &{J}_{CV}^* = \min_{\nu\in\mathbb{R}_{>0},\chi \in \mathbb{R},\bar{W} \succ 0} c_{1}\chi+c_{2}\nu+c_{3} P(\chi,\nu,\bar{W}) \\ &\text{s.t.{}~~\eqref{riccatiW} and \eqref{lambda_con} for deterministic systems} \nonumber \\ &\text{{\color{white}s.t.{}}~~\eqref{alpha_cond_convex_3} and \eqref{lambda_con} for stochastic systems} \nonumber \end{align} where $W = M(x,x_d,u_d,t)^{-1}$ for Theorem~\ref{Thm:CVSTEM:LMI} or $W=M(x,t)^{-1}$ for Theorem~\ref{Thm:fixed_sdc}, $\bar{W}=\nu W$, $\nu=\overline{m}$, $\chi=\overline{m}/\underline{m}$, $c_0$ is as defined in \eqref{stochasticmse_infty} of Theorem~\ref{Thm:CVSTEMobjective}, $c_1,c_2\in\mathbb{R}_{\geq 0}$, and $P$ is a performance-based convex cost function. The weight $c_1$ for $\nu$ can be viewed as a penalty on the $2$-norm of the feedback control gain $K$ of $u=u_d-K(x-x_d)$ in \eqref{controller}. Using non-zero $c_1$ and $c_2$ thus enables finding contraction metrics optimal in a different sense. Furthermore, the coefficients of the SDC parameterizations $\varrho$ in Lemma~\ref{sdclemma} (i.e.{}, $A = \sum\varrho_iA_i$ in \eqref{varrho_def}) can also be treated as decision variables by convex relaxation, thereby adding a design flexibility to mitigate the effects of external disturbances while verifying the system controllability. \end{theorem} \begin{proof} As proven in Theorems~\ref{Thm:CVSTEM:LMI} and~\ref{Thm:CVSTEMobjective}, $\underline{m}\mathrm{I}\preceq M\preceq\overline{m}\mathrm{I}$ of \eqref{Mcon}, the contraction constraint \eqref{riccatiFV}, and the objective \eqref{stochasticmse_infty} reduce to \eqref{cvstem_eq} with $c_1=0$ and $c_2=0$. Since the resultant constraints are convex and the objective is affine in terms of the decision variables $\nu$, $\chi$, and $\bar{W}$, the problem \eqref{cvstem_eq} is indeed convex. Since we have $\sup_{x,t}\|M\|\leq \overline{m}=\nu$, $c_1$ can be used as a penalty to optimally adjust the induced $2$-norm of the control gain (see Example~\ref{ex:lqrexample}). The SDC coefficients $\varrho$ can also be utilized as decision variables for controllability due to Proposition~1 of~\cite{mypaperTAC}. \qed \end{proof} \begin{example} \label{ex:lqrexample} The weights $c_0$ and $c_1$ of the CV-STEM control of Theorem~\ref{Thm:CV-STEM} establish an analogous trade-off to the case of the LQR with the cost weight matrices of $Q$ for state and $R$ for control, since the upper bound of the steady-state tracking error \eqref{stochasticmse_infty} is proportional to $\chi$, and an upper bound of $\|K\|$ for the control gain $K$ in \eqref{controller}, $u=u_d-K(x-x_d)$, is proportional to $\nu$. In particular~\cite{ncm,nscm}, \setlength{\leftmargini}{17pt} \begin{itemize} \setlength{\itemsep}{1pt} \setlength{\parskip}{0pt} \item if $c_1$ is much greater than $c_0$ in \eqref{cvstem_eq} of Theorem~\ref{Thm:CV-STEM}, we get smaller control effort but with a large steady-state tracking error, and \item if $c_1$ is much smaller than $c_0$ in \eqref{cvstem_eq} of Theorem~\ref{Thm:CV-STEM}, we get a smaller steady-state state tracking error but with larger control effort. \end{itemize} \end{example} This is also because the solution $P\succ0$ of the LQR Riccati equation~\cite[p. 89]{lssbook}, $-\dot{P}=PA+A^{\top}P-PBR^{-1}B^{\top}P+Q$, can be viewed as a positive definite matrix $M$ that defines a contraction metric as discussed in Example~\ref{ex:lyapunov_contraction}. \begin{figure} \centering \includegraphics[width=85mm]{figures/Slide2.pdf} \caption{Block diagram of CV-STEM.} \label{slide2_cvstem} \end{figure} \subsection{CV-STEM Estimation} \label{Sec:cvstem_estimation} We could also design an optimal state estimator analogously to the CV-STEM control of Theorem~\ref{Thm:CV-STEM}, due to the differential nature of contraction theory that enables LTV systems-type approaches to stability analysis. In particular, we exploit the estimation and control duality in differential dynamics similar to that of the Kalman filter and LQR in LTV systems. Let us consider the following smooth nonlinear systems with a measurement $y(t)$, perturbed by deterministic disturbances $d_{e0}(x,t)$ and $d_{e1}(x,t)$ with $\sup_{x,t}\|d_{e0}(x,t)\|=\bar{d}_{e0} \in \mathbb{R}_{\geq 0}$ and $\sup_{x,t}\|d_{e1}(x,t)\|=\bar{d}_{e1} \in \mathbb{R}_{\geq 0}$, or by Gaussian white noise $\mathscr{W}_{0}(t)$ and $\mathscr{W}_{1}(t)$ with $\sup_{x,t}\|G_{e0}(x,t)\|_F = \bar{g}_{e0} \in \mathbb{R}_{\geq 0}$ and $\sup_{x,t}\|G_{e1}(x,t)\|_F = \bar{g}_{e1} \in \mathbb{R}_{\geq 0}$: \begin{align} \label{sdc_dynamics_est} \dot{x} =& f(x,t)+d_{e0}(x,t),~y = h(x,t)+d_{e1}(x,t) \\ \label{sdc_dynamics_est_sto} dx =& f(x,t)dt+G_{e0}d\mathscr{W}_0,~ydt = h(x,t)dt+G_{e1}d\mathscr{W}_1 \end{align} where $t \in \mathbb{R}_{\geq 0}$ is time, ${x}:\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^n$ is the system state, $y:\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^m$ is the system measurement, ${f}: \mathbb{R}^n\times\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^n$ and $h:\mathbb{R}^n\times\mathbb{R}_{\geq 0} \mapsto \mathbb{R}^{m}$ are known smooth functions, $d_{e0}:\mathbb{R}^n\times\mathbb{R}_{\geq 0} \mapsto \mathbb{R}^{n}$, $d_{e1}:\mathbb{R}^n\times\mathbb{R}_{\geq 0} \mapsto \mathbb{R}^{0}$, $G_{e0}:\mathbb{R}^n\times\mathbb{R}_{\geq 0} \mapsto \mathbb{R}^{n\times w_{0}}$, and $G_{e1}:\mathbb{R}^n\times\mathbb{R}_{\geq 0} \mapsto \mathbb{R}^{n\times w_{1}}$ are unknown bounded functions for external disturbances, $\mathscr{W}_{0}:\mathbb{R}_{\geq 0} \mapsto \mathbb{R}^{w_{0}}$ and $\mathscr{W}_{1}:\mathbb{R}_{\geq 0} \mapsto \mathbb{R}^{w_{1}}$ are two independent Wiener processes, and the arguments of $G_{e0}(x,t)$ and $G_{e1}(x,t)$ are suppressed for notational convenience. Let $A(\varrho_a,x,\hat{x},t)$ and $C(\varrho_c,x,\hat{x},t)$ be the SDC matrices given by Lemma~\ref{sdclemma} with $(f,{s},\bar{s},\bar{u})$ replaced by $(f,\hat{x},x,0)$ and $(h,\hat{x},x,0)$, respectively, i.e.{} \begin{align} \label{est_A} A(\varrho_a,x,\hat{x},t)(\hat{x}-x) =& f(\hat{x},t)-f(x,t) \\ \label{est_C} C(\varrho_c,x,\hat{x},t)(\hat{x}-x) =& h(\hat{x},t)-h(x,t). \end{align} We design a nonlinear state estimation law parameterized by a matrix-valued function $M(\hat{x},t)$ as follows: \begin{align} \label{estimator} \dot{\hat{x}} =& f(\hat{x},t)+L(\hat{x},t)(y-h(\hat{x},t)) \\ =& f(\hat{x},t)+M(\hat{x},t)\bar{C}(\varrho_c,\hat{x},t)^{\top}R(\hat{x},t)^{-1}(y-h(\hat{x},t)) \end{align} where $\bar{C}(\varrho_c,\hat{x},t)=C(\varrho_c,\hat{x},\bar{x},t)$ for a fixed trajectory $\bar{x}$ (e.g.{}, $\bar{x}=0$, see Theorem~\ref{Thm:fixed_sdc}), $R(\hat{x},t) \succ 0$ is a weight matrix on the measurement $y$, and $M(\hat{x},t) \succ 0$ is a positive definite matrix (which satisfies the matrix inequality constraint for a contraction metric, to be given in \eqref{convex_constraint_estimator1} of Theorem~\ref{Thm:CV-STEM-estimation}). Note that we could use other forms of estimation laws such as the EKF~\cite{6849943,ncm,Brown:680442}, analytical SLAM~\cite{doi:10.1177/0278364917710541}, or SDC with respect to a fixed point~\cite{Ref:Stochastic,mypaperTAC,mypaper}, depending on the application of interest, which result in a similar stability analysis as in Theorem~\ref{Thm:fixed_sdc}. \subsubsection{Nonlinear Stability Analysis of SDC-based State Estimation using Contraction Theory} Substituting \eqref{estimator} into \eqref{sdc_dynamics_est} and \eqref{sdc_dynamics_est_sto} yields the following virtual system of a smooth path $q(\mu,t)$, parameterized by $\mu \in [0,1]$ to have $q(\mu=0,t)=x$ and $q(\mu=1,t)=\hat{x}$: \begin{align} \label{closed_loop_e_est} \dot{q}(\mu,t) =& \zeta(q(\mu,t),x,\hat{x},t)+d(\mu,x,\hat{x},t) \\ \label{closed_loop_e_est_sto} dq(\mu,t) =& \zeta(q(\mu,t),x,\hat{x},t)dt+G(\mu,x,\hat{x},t)d\mathscr{W}(t) \end{align} where $d(\mu,x,\hat{x},t)=(1-\mu) d_{e0}(x,t)+\mu L(\hat{x},t)d_{e1}(x,t)$, $G(\mu,x,\hat{x},t)=[(1-\mu) G_{e0}(x,t),\mu L(\hat{x},t)G_{e1}(x,t)]$, $\mathscr{W} = [\mathscr{W}_0^{\top},\mathscr{W}_1^{\top}]^{\top}$, and $\zeta(q,x,x_d,u_d,t)$ is defined as \begin{align} \zeta(q,x,\hat{x},t) =& (A(\varrho_a,x,\hat{x},t)-L(\hat{x},t)C(\varrho_c,x,\hat{x},t))(q-x) \\ \label{Eq:virtual_sys_est_sto} &+f(x,t). \end{align} Note that \eqref{Eq:virtual_sys_est_sto} is constructed to contain $q=\hat{x}$ and $q=x$ as its particular solutions of \eqref{closed_loop_e_est} and \eqref{closed_loop_e_est_sto}. If $d=0$ and $\mathscr{W}=0$, the differential dynamics of \eqref{closed_loop_e_est} and \eqref{closed_loop_e_est_sto} for $\partial_{\mu}q=\partial q/\partial \mu$ is given as \begin{align} \label{eq:differential_dyn_est_sto} \partial_{\mu}\dot{q} = \left(A(\varrho_a,x,\hat{x},t)-L(\hat{x},t)C(\varrho_c,x,\hat{x},t) \right)\partial_{\mu}q. \end{align} The similarity between \eqref{eq:differential_dyn_sto} ($\partial_{\mu}\dot{q}= (A-BK)\partial_{\mu}q$) and \eqref{eq:differential_dyn_est_sto} leads to the following theorem~\cite{mypaperTAC,ncm,nscm,mypaper}. Again, note that we could also use the SDC formulation with respect to a fixed point as delineated in Theorem~\ref{Thm:fixed_sdc} and as demonstrated in~\cite{mypaperTAC,Ref:Stochastic,mypaper}. \begin{theorem} \label{Thm:CVSTEM-LMI-est} Suppose $\exists \bar{\rho},\bar{c}\in\mathbb{R}_{\geq0}$ s.t.{} $\|R^{-1}(\hat{x},t)\|\leq\bar{\rho}$, $\|C(\varrho_c,x,\hat{x},t)\|\leq\bar{c},~\forall x,\hat{x},t$. Suppose also that $\underline{m}\mathrm{I}\preceq M \preceq \overline{m} I$ of \eqref{Mcon} holds, or equivalently, $\mathrm{I}\preceq \bar{W} \preceq \chi I$ of \eqref{lambda_con} holds with $W=M(\hat{x},t)^{-1}$, $\bar{W}=\nu W$, $\nu=\overline{m}$, and $\chi=\overline{m}/\underline{m}$. As in Theorem~\ref{Thm:CVSTEM:LMI}, let $\beta$ be defined as $\beta = 0$ for deterministic systems \eqref{sdc_dynamics_est} and \begin{align} \beta =& \alpha_s = \alpha_{e0}+\nu^2\alpha_{e1} \\ =& L_m\bar{g}_{e0}^2(\alpha_G+{1}/{2})/2+\nu^2L_m\bar{\rho}^2\bar{c}^2\bar{g}_{e1}^2(\alpha_G+{1}/{2})/2 \end{align} for stochastic systems \eqref{sdc_dynamics_est_sto}, where $2\alpha_{e0} = L_m\bar{g}_{e0}^2(\alpha_G+{1}/{2})$, $2\alpha_{e1} = L_m\bar{\rho}^2\bar{c}^2\bar{g}_{e1}^2(\alpha_G+{1}/{2})$, $L_m$ is the Lipschitz constant of $\partial W/\partial x_i$, $\bar{g}_{e0}$ and $\bar{g}_{e1}$ are given in \eqref{sdc_dynamics_est_sto}, and $\exists\alpha_G\in\mathbb{R}_{>0}$ is an arbitrary constant as in Theorem~\ref{Thm:robuststochastic}. If $M(\hat{x},t)$ in \eqref{estimator} is constructed to satisfy the following convex constraint for $\exists \alpha \in \mathbb{R}_{>0}$: \begin{equation} \label{convex_constraint_estimator1} \dot{\bar{W}}+2\sym{}(\bar{W}A-\nu \bar{C}^{\top}R^{-1}C)\preceq -2\alpha \bar{W}-\nu\beta \mathrm{I} \end{equation} then Theorems~\ref{Thm:Robust_contraction_original} and \ref{Thm:robuststochastic} hold for the virtual systems \eqref{closed_loop_e_est} and \eqref{closed_loop_e_est_sto}, respectively, i.e.{}, we have the following bounds for $\mathtt{e}=\hat{x}-x$ with $\nu=\overline{m}$ and $\chi=\overline{m}/\underline{m}$: \begin{align} \label{Eq:CVSTEM_estimation_error_bound} &\|\mathtt{e}(t)\| \leq \sqrt{\overline{m}}{V_{\ell}(0)}e^{-\alpha t}+\frac{\bar{d}_{e0}\sqrt{\chi}+\bar{\rho}\bar{c}\bar{d}_{e1}\nu}{\alpha}(1-e^{-\alpha t}) \\ \label{Eq:CVSTEM_estimation_error_bound_sto} &\mathop{\mathbb{E}}\left[\|\mathtt{e}(t)\|^2\right] \leq \overline{m}{\mathop{\mathbb{E}}[V_{s\ell}(0)]}e^{-2\alpha t}+\frac{C_{e0}\chi+C_{e1}\chi\nu^2}{2\alpha} \end{align} where $V_{s\ell}=\int^{\hat{x}}_{x}\delta q^{\top}W\delta q$ and $V_{\ell}=\int^{\hat{x}}_{x}\|\Theta\delta q\|$ are given in Theorem~\ref{Thm:path_integral} with $W=M^{-1}=\Theta^{\top}\Theta$ defining a contraction metric, the disturbance bounds $\bar{d}_{e0}$, $\bar{d}_{e1}$, $\bar{g}_{e0}$, and $\bar{g}_{e1}$ are given in \eqref{sdc_dynamics_est} and \eqref{sdc_dynamics_est_sto}, respectively, $C_{e0} = \bar{g}_{e0}^2({2}{\alpha_G}^{-1}+1)$, and $C_{e1} = \bar{\rho}^2\bar{c}^2\bar{g}_{e1}^2({2}{\alpha_G}^{-1}+1)$. Note that for stochastic systems, the probability that $\|\mathtt{e}\|$ is greater than or equal to $\varepsilon\in\mathbb{R}_{> 0}$ is given as \begin{align} \label{Eq:CVSTEM_estimation_error_bound_sto_prob} \mathop{\mathbb{P}}\left[\|\mathtt{e}(t)\|\geq\varepsilon\right] \leq \frac{1}{\varepsilon^2}\left(\overline{m}{\mathop{\mathbb{E}}[V_{s\ell}(0)]}e^{-2\alpha t}+\frac{C_E}{2\alpha}\right) \end{align} where $C_E=C_{e0}\chi+C_{e1}\chi\nu^2$. \end{theorem} \begin{proof} Theorem~\ref{Thm:CVSTEM:LMI} indicates that \eqref{convex_constraint_estimator1} is equivalent to \begin{equation} \label{constraint_estimator1} \dot{W}+2\sym{}(WA-\bar{C}^{\top}R^{-1}C)\preceq -2\alpha W-\beta \mathrm{I}. \end{equation} Computing the time derivative of a Lyapunov function $V=\partial_{\mu} q^{\top}W\partial_{\mu} q$ with $\partial_{\mu} q=\partial q/\partial \mu$ for the unperturbed virtual dynamics \eqref{eq:differential_dyn_est_sto}, we have using \eqref{constraint_estimator1} that \begin{align} \dot{V}=&\partial_{\mu} q^{\top}W\partial_{\mu} q = \partial_{\mu} q^{\top}(\dot{W}+2WA-2\bar{C}^{\top}R^{-1}C)\partial_{\mu} q \\ \leq& -2\alpha V-\beta\|\partial_{\mu} q\|^2 \end{align} which implies that $W=M^{-1}$ defines a contraction metric. Since we have $\overline{m}^{-1}\mathrm{I}\preceq W \preceq \underline{m}^{-1}\mathrm{I}$, $V\geq\overline{m}^{-1}\|\partial_{\mu} q\|^2$, and \begin{align} \|\Theta(\hat{x},t)\partial_{\mu}d\|\leq& \bar{d}_{e0}/\sqrt{\underline{m}}+\bar{d}_{e1}\bar{\rho}\bar{c}\sqrt{\overline{m}} \nonumber \\ \|\partial_{\mu}G\|_F^2\leq& \bar{g}_{e0}^2+\bar{\rho}^2\bar{c}^2\bar{g}_{e1}^2\overline{m}^2 \nonumber \end{align} for $d$ in \eqref{closed_loop_e_est} and $G$ in \eqref{closed_loop_e_est_sto}, the bounds \eqref{Eq:CVSTEM_estimation_error_bound}--\eqref{Eq:CVSTEM_estimation_error_bound_sto_prob} follow from the proofs of Theorems~\ref{Thm:Robust_contraction_original} and~\ref{Thm:robuststochastic}~\cite{ncm,nscm}. \qed \end{proof} \begin{remark} \label{convex_est_remark} Although \eqref{convex_constraint_estimator1} is not an LMI due to the nonlinear term $-\nu\beta \mathrm{I}$ on its right-hand side for stochastic systems~\eqref{sdc_dynamics_est_sto}, it is a convex constraint as $-\nu \beta = -\nu\alpha_s = -\nu\alpha_{e0}-\nu^3\alpha_{e1}$ is a concave function for $\nu\in\mathbb{R}_{>0}$~\cite{citeulike:163662,nscm}. \end{remark} \subsubsection{CV-STEM Formulation for State Estimation} The estimator \eqref{estimator} gives a convex steady-state upper bound of the Euclidean distance between $x$ and $\hat{x}$ as in Theorem~\ref{Thm:CVSTEMobjective}~\cite{mypaperTAC,ncm,nscm,mypaper}. \begin{theorem} \label{Thm:CV-STEMobjective-est} If \eqref{convex_constraint_estimator1} of Theorem~\ref{Thm:CVSTEM-LMI-est} holds, then we have the following bound: \begin{align} \label{stochasticmse_infty_est} &\lim_{t \to \infty}\sqrt{\mathop{\mathbb{E}}\left[\|\hat{x}-x\|^2\right]} \leq c_0(\alpha,\alpha_G)\chi+c_1(\alpha,\alpha_G)\nu^s \end{align} where $c_0=\bar{d}_{e0}/\alpha$, $c_1=\bar{\rho}\bar{c}\bar{d}_{e1}/\alpha$, $s=1$ for deterministic systems \eqref{closed_loop_e_est}, and $c_0=\sqrt{C_{e0}/(2\alpha)}$, $c_1=C_{e1}/(2\sqrt{2\alpha C_{e0}})$, and $s=2$ for stochastic systems \eqref{closed_loop_e_est_sto}, with $C_{e0}$ and $C_{e0}$ given as $C_{e0} = \bar{g}_{e0}^2(2\alpha_G^{-1}+1)$ and $C_{e1} = \bar{\rho}^2\bar{c}^2\bar{g}_{e1}^2(2\alpha_G^{-1}+1)$. \end{theorem} \begin{proof} The upper bound \eqref{stochasticmse_infty_est} for deterministic systems \eqref{closed_loop_e_est} follows from \eqref{Eq:CVSTEM_estimation_error_bound} with the relation $1\leq\sqrt{\chi}\leq \chi$ due to $\underline{m}\leq\overline{m}$. For stochastic systems, we have using \eqref{Eq:CVSTEM_estimation_error_bound_sto} that \begin{align} C_{e0}\chi+C_{e1}\nu^2\chi \leq C_{e0}(\chi+({C_{e1}}/({2C_{e0}}))\nu^2)^2 \end{align} due to $1\leq\chi\leq \chi^2$ and $\nu \in \mathbb{R}_{>0}$. This gives \eqref{stochasticmse_infty_est} for stochastic systems \eqref{closed_loop_e_est_sto}. \qed \end{proof} Finally, the CV-STEM estimation framework is summarized in Theorem~\ref{Thm:CV-STEM-estimation}~\cite{mypaperTAC,ncm,nscm,mypaper}. \begin{theorem} \label{Thm:CV-STEM-estimation} Suppose that $\alpha$, $\alpha_G$, $\bar{d}_{e0}$, $\bar{d}_{e1}$, $\bar{g}_{e0}$, $\bar{g}_{e1}$, and $L_m$ in \eqref{convex_constraint_estimator1} and \eqref{stochasticmse_infty_est} are given. If the pair $(A,C)$ is uniformly observable, the non-convex optimization problem of minimizing the upper bound \eqref{stochasticmse_infty_est} is equivalent to the following convex optimization problem with the contraction constraint \eqref{convex_constraint_estimator1} and $\mathrm{I}\preceq \bar{W}\preceq\chi\mathrm{I}$ of \eqref{lambda_con}: \begin{align} \label{cvstem_eq_est} &{J}_{CV}^* = \min_{\nu\in\mathbb{R}_{>0},\chi \in \mathbb{R},\bar{W} \succ 0} c_{1}\chi+c_{2}\nu^s+c_{3} P(\chi,\nu,\bar{W}) \\ &\text{s.t.{}~~\eqref{convex_constraint_estimator1} and \eqref{lambda_con}} \end{align} where $c_0$, $c_1$, and $s$ are as defined in \eqref{stochasticmse_infty_est} of Theorem~\ref{Thm:CV-STEMobjective-est}, $c_2\in\mathbb{R}_{\geq 0}$, and $P$ is some performance-based cost function as in Theorem~\ref{Thm:CV-STEM}. The weight $c_1$ for $\nu^s$ indicates how much we trust the measurement $y(t)$. Using non-zero $c_2$ enables finding contraction metrics optimal in a different sense in terms of $P$. Furthermore, the coefficients of the SDC parameterizations $\varrho_a$ and $\varrho_c$ in Lemma~\ref{sdclemma} (i.e.{}, $A = \sum\varrho_{a,i}A_i$ and $C = \sum\varrho_{c,i}C_i$ in \eqref{est_A} and \eqref{est_C}) can also be treated as decision variables by convex relaxation~\cite{Ref:Stochastic}, thereby adding a design flexibility to mitigate the effects of external disturbances while verifying the system observability. \end{theorem} \begin{proof} The proposed optimization problem is convex as its objective and constraints are convex in terms of decision variables $\chi$, $\nu$, and $\bar{W}$ (see Remark~\ref{convex_est_remark}). Also, larger $\bar{d}_{e1}$ and $\bar{g}_{e1}$ in \eqref{sdc_dynamics_est} and \eqref{sdc_dynamics_est_sto} imply larger measurement uncertainty. Thus by definition of $c_1$ in Theorem~\ref{Thm:CV-STEMobjective-est}, the larger the weight of $\nu$, the less confident we are in $y(t)$ (see Example~\ref{ex:kalmanexample}). The last statement on the SDC coefficients for guaranteeing observability follows from Proposition~1 of \cite{Ref:Stochastic} and Proposition~1 of~\cite{mypaperTAC}. \qed \end{proof} \begin{example} \label{ex:kalmanexample} The weights $c_0$ and $c_1$ of the CV-STEM estimation of Theorem~\ref{Thm:CV-STEM-estimation} has an analogous trade-off to the case of the Kalman filter with the process and sensor noise covariance matrices, $Q$ and $P$, respectively, since the term $c_0\chi$ in upper bound of the steady-state tracking error in \eqref{stochasticmse_infty_est} becomes dominant if measurement noise is much smaller than process noise ($\bar{d}_{e0}\gg \bar{d}_{e1}$ or $\bar{g}_{e0}\gg \bar{g}_{e1}$), and the term $c_1\nu^s$ becomes dominant if measurement noise is much greater than process noise ($\bar{d}_{e0}\ll \bar{d}_{e1}$ or $\bar{g}_{e0}\ll \bar{g}_{e1}$). In particular~\cite{ncm,nscm}, \setlength{\leftmargini}{17pt} \begin{itemize} \setlength{\itemsep}{1pt} \setlength{\parskip}{0pt} \item if $c_1$ is much greater than $c_0$, large measurement noise leads to state estimation that responds slowly to unexpected changes in the measurement $y$ (i.e.{} small estimation gain due to $\nu=\overline{m}\geq\|M\|$), and \item if $c_1$ is much smaller than $c_0$, large process noise leads to state estimation that responds fast to changes in the measurement (i.e.{} large $\nu=\overline{m}\geq\|M\|$). \end{itemize} This is also because the solution $Q = P^{-1}\succ0$ of the Kalman filter Riccati equation~\cite[p. 375]{Brown:680442}, $\dot{P}=AP+PA^{\top}-PC^{\top}R^{-1}CP+Q$, can be viewed as a positive definite matrix that defines a contraction metric as discussed in Example~\ref{ex:lyapunov_contraction}. \end{example} \subsection{Control Contraction Metrics (CCMs)} \label{Sec:ccm} As briefly discussed in Remark~\ref{u_equivalence_remark}, the concept of a CCM~\cite{ccm,7989693,47710,WANG201944,vccm,rccm} is introduced to extend contraction theory to design differential feedback control laws for control-affine deterministic nonlinear systems \eqref{original_dynamics}, $\dot{x}=f(x,t)+B(x,t)u$. Let us show that the CCM formulation could also be considered in the CV-STEM control of Theorem~\ref{Thm:CV-STEM}, where similar ideas have been investigated in~\cite{cdc_ncm,7989693,zhao2021tubecertified}. \begin{theorem} \label{Thm:ccm_cvstem} Suppose the CV-STEM control of Theorem~\ref{Thm:CV-STEM} is designed with its contraction condition replaced by the following set of convex constraints along with $\mathrm{I}\preceq \bar{W}\preceq\chi\mathrm{I}$ of \eqref{lambda_con}: \begin{align} &B_{\bot}^{\top} \left( -\frac{\partial \bar{W}}{\partial t}-\partial_f \bar{W} + 2\sym{}\left({\frac{\partial f}{\partial x} \bar{W}}\right) + 2 \alpha \bar{W} \right)B_{\bot} \prec 0\label{ccm_con1}~~~~ \\ &B_{\bot}^{\top} \left( \partial_{b_i} \bar{W} - 2\sym{}\left({\frac{\partial b_i}{\partial x} \bar{W}}\right) \right) B_{\bot} = 0,\forall x,t,i \label{ccm_con2} \end{align} where $B_{\bot}(x,t)$ is a matrix whose columns span the cokernel of $B(x,t)$ defined as $\mathrm{coker}(B)= \{a\in\mathbb{R}^n|B^{\top}a=0\}$ satisfying $B^{\top}B_{\bot} = 0$, $b_i(x,t)$ is the $i$th column of $B(x,t)$, $\bar{W}(x,t)=\nu W(x,t)$, $W(x,t) = M(x,t)^{-1}$ for $M(x,t)$ that defines a contraction metric, $\nu=\overline{m}$, $\chi=\overline{m}/\underline{m}$, and $\partial_{p} F = \sum_{k=1}^n(\partial F/\partial x_k)p_k$ for $p(x,t)\in\mathbb{R}^n$ and $F(x,t) \in \mathbb{R}^{n\times n}$. Then the controlled system \eqref{original_dynamics} with $d_c=0$, i.e.{}, $\dot{x}=f(x,t)+B(x,t)u$, is \setlength{\leftmargini}{17pt} \begin{enumerate}[label=\arabic*)] \setlength{\itemsep}{1pt} \setlength{\parskip}{0pt} \item universally exponentially open-loop controllable \item universally exponentially stabilizable via sampled-data feedback with arbitrary sample times \item universally exponentially stabilizable using continuous feedback defined almost everywhere, and everywhere in a neighborhood of the target trajectory \end{enumerate} all with rate $\alpha$ and overshoot $R = \sqrt{\overline{m}/\underline{m}}$ for $\underline{m}$ and $\overline{m}$ given in $\underline{m}\mathrm{I}\preceq M\preceq\overline{m}\mathrm{I}$ of \eqref{Mcon}. Such a positive definite matrix $M(x,t)$ defines a CCM. Given a CCM, there exists a differential feedback controller $\delta u = k(x,\delta x,u,t)$ that stabilizes the following differential dynamics of \eqref{original_dynamics} with $d_c=0$ along all solutions (i.e.{}, the closed-loop dynamics is contracting as in Definition~\ref{Def:contraction}): \begin{align} \label{ccm_differential_eq} \delta\dot{x} = A(x,u,t)\delta x+B(x,t)\delta u \end{align} where $A=\partial f/\partial x+\sum_{i=1}^m(\partial b_i/\partial x)u_i$ and $\delta u$ is a tangent vector to a smooth path of controls at $u$. Furthermore, it can be computed as follows~\cite{ccm,7989693,rccm}: \begin{align} \label{ccm_controller} u(x(t),t) = u_d+\int_{0}^1k(\gamma(\mu,t),\partial_{\mu}\gamma(\mu,t),u(\gamma(\mu,t),t),t)d\mu~~~~ \end{align} where $\partial_{\mu}\gamma=\partial \gamma/\partial \mu$, $\gamma$ is the minimizing geodesic with $\gamma(0,t) = x_d$ and $\gamma(1,t) = x$ for $\mu\in[0,1]$, $(x_d,u_d)$ is a given target trajectory in $\dot{x}_d=f(x_d,t)+B(x_d,t)u_d$ of \eqref{sdc_dynamicsd}, and the computation of $k$ is given in~\cite{ccm,7989693} (see Remark~\ref{remark_ccm_kgamma}). Furthermore, Theorem~\ref{Thm:Robust_contraction_original} for deterministic disturbance rejection still holds and the CCM controller \eqref{ccm_controller} thus possesses the same sense of oplimality as for the CV-STEM control in Theorem~\ref{Thm:CV-STEM}. \end{theorem} \begin{proof} Since the columns of $B_{\bot}(x,t)$ span the cokernel of $B(x,t)$, the constraints \eqref{ccm_con1} and \eqref{ccm_con2} can be equivalently written as $B_{\bot}(x,t)$ replaced by $a$ in $\mathrm{coker}(B)= \{a\in\mathbb{R}^n|B^{\top}a=0\}$. Let $a=M\delta x=W^{-1}\delta x$. Then multiplying \eqref{ccm_con1} and \eqref{ccm_con2} by $\nu^{-1} >0$ and rewriting them using $a$ yields \begin{align} \label{ccm_condition} \delta x^{\top}MB=0~\Rightarrow~\delta x^{\top}(\dot{M}+2\sym(MA)+2\alpha M)\delta x < 0~~~~~~ \end{align} where $A=\partial f/\partial x+\sum_{i=1}^m(\partial b_i/\partial x)u_i$ for the differential dynamics \eqref{ccm_differential_eq}. The relation \eqref{ccm_condition} states that $\delta x$ orthogonal to the span of actuated directions $b_i$ is naturally contracting, thereby implying the stabilizability of the system \eqref{original_dynamics} with $d_c=0$, i.e.{}, $\dot{x}=f(x,t)+B(x,t)u$. See~\cite{ccm,7989693,rccm} (and~\cite{cdc_ncm} on the CV-STEM formulation) for the rest of the proof. \qed \end{proof} \begin{example} Let us consider a case where $k$ of the differential feedback controller does not depend on $u$, and is defined explicitly by $M(x,t) \succ 0$ as follows~\cite{cdc_ncm}: \begin{align} \label{differential_u} &u = u_d-\int_{x_d}^xR(q,t)^{-1}B(q,t)^{\top}M(q,t)\delta q \end{align} where $R(x,t) \succ 0$ is a given weight matrix and $q$ is a smooth path that connects $x$ to $x_d$. Since \eqref{differential_u} yields $\delta u=-R(x,t)^{-1}B(x,t)^{\top}M(x,t)\delta x$, the contraction conditions \eqref{ccm_con1} and \eqref{ccm_con2} could be simplified as \begin{align} \label{ccm_con1_simple} &-\frac{\partial \bar{W}}{\partial t}-\partial_f \bar{W}+2\sym{}\left(\frac{\partial f}{\partial x}\bar{W}\right)-\nu BR^{-1}B^{\top} \preceq -2\alpha \bar{W} \\ \label{ccm_con2_simple} &-\partial_{b_i}\bar{W}+2\sym{}\left(\frac{\partial b_i}{\partial x}\bar{W}\right) = 0 \end{align} yielding the convex optimization-based control synthesis algorithm of Theorem~\ref{Thm:ccm_cvstem} independently of $(x_d,u_d)$ similar to that of Theorem~\ref{Thm:CV-STEM} (see~\cite{cdc_ncm} for details). \end{example} \begin{example} If $B$ is of the form $[0,\mathrm{I}]^{\top}$ for the zero matrix $0\in\mathbb{R}^{n_1\times m}$ and identity matrix $\mathrm{I}\in\mathbb{R}^{n_2\times m}$ with $n=n_1+n_2$, the condition \eqref{ccm_con2_simple} says that $M$ should not depend on the last $n_2$ state variables~\cite{ccm}. \end{example} \begin{remark} \label{remark_ccm_kgamma} We could consider stochastic perturbation in Theorem~\ref{Thm:ccm_cvstem} using Theorem~\ref{Thm:robuststochastic}, even with the differential control law of the form \eqref{ccm_controller} or \eqref{differential_u} as demonstrated in~\cite{cdc_ncm}. Also, although the relation \eqref{ccm_con2} or \eqref{ccm_con2_simple} is not included as a constraint in Theorem~\ref{Thm:CV-STEM} for simplicity of discussion, the dependence of $\dot{\bar{W}}$ on $u$ in Theorem~\ref{Thm:CV-STEM} can be removed by using it in a similar way to~\cite{cdc_ncm}. As stated in \eqref{ccm_controller}, the computation of the differential feedback gain $k(x,\delta x,u,t)$ and minimizing geodesics $\gamma$ is elaborated in~\cite{ccm,7989693}. For example, if $M$ is state-independent, then geodesics are just straight lines. \end{remark} Let us again emphasize that, as delineated in Sec.~\ref{Sec:overview}, the differences between the SDC- and CCM-based CV-STEM frameworks in Theorems~\ref{Thm:CV-STEM} and~\ref{Thm:ccm_cvstem} arise only from their different form of controllers in $u=u_d-K(x-x_d)$ of \eqref{controller} and $u=u_d+\int^1_0kd\mu$ of \eqref{ccm_controller}, leading to the trade-offs outlined in Table~\ref{tab:sdcccm_summary}. \subsection{Remarks in CV-STEM Implementation} We propose some useful techniques for the practical application of the CV-STEM in Theorems~\ref{Thm:CV-STEM},~\ref{Thm:CV-STEM-estimation}, and~\ref{Thm:ccm_cvstem}. Note that the CV-STEM requires solving a convex optimization problem at each time instant, but its solution can be approximated with formal stability guarantees to enable faster computation using machine learning techniques as shall be seen in Sec.~\ref{Sec:ncm}. \subsubsection{Performance-based Cost Function}\label{sec:ChoiceObJ} Selecting $c_2=0$ in Theorems~\ref{Thm:CV-STEM}, \ref{Thm:CV-STEM-estimation}, and~\ref{Thm:ccm_cvstem} yields a convex objective function that allows for a systematic interpretation of its weights as seen earlier in Examples~\ref{ex:lqrexample} and~\ref{ex:kalmanexample}. One could also select $c_2>0$ to augment the CV-STEM with other control and estimation performances of interest, as long as $P(\nu,\chi,\bar{W})$ in \eqref{cvstem_eq} and \eqref{cvstem_eq_est} is convex. For example, we could consider a steady-state tracking error bound of parametric uncertain systems as $P$, using the adaptive control technique to be discussed in Sec.~\ref{Sec:adaptive}~\cite{ancm}. Such a modification results in a contraction metric optimal in a different sense. \subsubsection{Selecting and Computing CV-STEM Parameters} \label{given_params} The CV-STEM optimization problems derived in Theorems~\ref{Thm:CV-STEM},~\ref{Thm:CV-STEM-estimation}, and~\ref{Thm:ccm_cvstem} are convex if we assume that $\alpha$, $\alpha_G$, and $L_m$ are given. However, these parameters would also affect the optimality of resultant contraction metrics. In~\cite{ncm,nscm,7989693}, a line search algorithm is performed to find optimal $\alpha$ and $\alpha_G$, while the Lipschitz constraint given with $L_m$ is guaranteed by spectrally-normalization~\cite{miyato2018spectral,nscm} as shall be seen in detail in Sec.~\ref{Sec:SN} (see~\cite{revay2020lipschitz,revay2021recurrent} for contraction theory-based techniques for obtaining Lipschitz bounds). Also, the CV-STEM can be formulated as a finite-dimensional problem by using backward difference approximation on $\dot{\bar{W}}$, where we can then use $-\bar{W} \preceq -\mathrm{I}$ to get a sufficient condition of its constraints, or we could alternatively solve it along pre-computed trajectories $\{x(t_i)\}_{i=0}^M$ as in~\cite{ncm}. In Sec.~\ref{Sec:ncm}, we use a parameterized function such as neural networks~\cite{neural1,neural2,neural3} for approximating $M$ to explicitly compute $\dot{M}$. \part*{\large Part II: Learning-based Control} \label{part2LBC} \section{Contraction Theory for Learning-based Control} \label{Sec:learning_stability} Machine learning techniques, e.g.{}, reinforcement learning~\cite{sutton,ndp,8593871,NIPS2017_766ebcd5}, imitation learning~\cite{9001182,glas,NIPS2016_cc7e2b87,8578338,7995721}, and neural networks~\cite{neural1,neural2,neural3}, have gained popularity due to their ability to achieve a large variety of innovative engineering and scientific tasks which have been impossible heretofore. Starting from this section, we will see how contraction theory enhances learning-based and data-driven automatic control frameworks providing them with formal optimality, stability, and robustness guarantees. In particular, we present Theorems~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto} for obtaining robust exponential bounds on trajectory tracking errors of nonlinear systems in the presence of learning errors, whose steady-state terms are again written as a function of the condition number $\chi=\overline{m}/\underline{m}$ of a positive definite matrix $M$ that defines a contraction metric, consistently with the CV-STEM frameworks of Sec.~\ref{sec:convex}. \subsection{Problem Formulation} Let us consider the following virtual nonlinear system as in Theorem~\ref{Thm:partial_contraction}: \begin{align} \label{learning_x} \dot{q}(\mu,t) =& \textsl{g}(q(\mu,t),\varpi,t)+\mu\Delta_L(\varpi,t)+d(\mu,\varpi,t) \end{align} where $\mu\in[0,1]$, $q:[0,1]\times\mathbb{R}_{\geq0}\mapsto\mathbb{R}^n$ is a smooth path of the system states, $\varpi:\mathbb{R}_{\geq0}\mapsto\mathbb{R}^{p}$ is a time-varying parameter, $\textsl{g}:\mathbb{R}^n\times\mathbb{R}^p\times\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^n$ is a known smooth function which renders $\dot{q} = \textsl{g}(q,\varpi,t)$ contracting with respect to $q$, $d:[0,1]\times\mathbb{R}^p\times\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^n$ with $\sup_{\mu,\varpi,t}\|\partial d/\partial \mu\|=\bar{d}\in\mathbb{R}_{\geq 0}$ is unknown external disturbance parameterized by $\mu$ as in Theorem~\ref{Thm:Robust_contraction_original}, and $\Delta_L:\mathbb{R}^p\times\mathbb{R}_{\geq 0}\mapsto\mathbb{R}^n$ is the part to be learned with machine learning-based methodologies such as neural networks~\cite{neural1,neural2,neural3}. We can also formulate this in a stochastic setting as follows: \begin{align} \label{learning_x_sto} d{q}(\mu,t) =& (\textsl{g}(q(\mu,t),\varpi,t)+\mu\Delta_L(\varpi,t))dt+G(\mu,\varpi,t)d\mathscr{W} \end{align} where $\mathscr{W}:\mathbb{R}_{\geq0}\mapsto\mathbb{R}^{w}$ is a Wiener process, and $G:[0,1]\times\mathbb{R}^p\times\mathbb{R}_{\geq 0} \mapsto \mathbb{R}^{n\times w}$ is a matrix-valued function parameterized by $\mu$ with $\sup_{\mu,\varpi,t}\|\partial G/\partial \mu\|_F = \bar{g}\in\mathbb{R}_{\geq 0}$ as in Theorem~\ref{Thm:robuststochastic}. The objective of learning is to find $\Delta_L$ which satisfies the following, assuming that $\varpi\in\mathcal{S}_{\varpi}\subseteq\mathbb{R}^p$ and $t\in\mathcal{S}_t\subseteq\mathbb{R}_{\geq 0}$ for some compact sets $\mathcal{S}_{\varpi}$ and $\mathcal{S}_t$: \begin{align} \label{Eq:learning_error} \|\Delta_L(\varpi,t)\| \leq \epsilon_{\ell0}+\epsilon_{\ell1}\|\xi_1-\xi_0\|,~\forall (\varpi,t) \in \mathcal{S}~~~~ \end{align} where $\mathcal{S}=\mathcal{S}_{\varpi}\times\mathcal{S}_t$, $\xi_0=q(0,t)$ and $\xi_1=q(1,t)$ are particular solutions of \eqref{learning_x} and \eqref{learning_x_sto}, and $\epsilon_{\ell0},\epsilon_{\ell1}\in\mathbb{R}_{\geq 0}$ are given learning errors. Examples~\ref{ex:learning_prob1}--\ref{ex:learning_prob3} illustrate how the problem \eqref{Eq:learning_error} with the nonlinear systems \eqref{learning_x} and \eqref{learning_x_sto} can be used to describe several learning-based and data-driven control problems to be discussed in the subsequent sections, regarding $\varpi$ as $x$, $x_d$, $\hat{x}$, $u_d$, etc. \begin{example}[Tracking control] \label{ex:learning_prob1} Let us consider the problem of learning a computationally-expensive (or unknown) feedback control law $u^*(x,x_d,u_d,t)$ that tracks a target trajectory $(x_d,u_d)$ given by $\dot{x}_d=f(x_d,t)+B(x_d,t)u_d$ as in \eqref{sdc_dynamicsd}, assuming that $f$ and $B$ are known. If the dynamics is perturbed by $d_c(x,t)$ as in \eqref{original_dynamics}, we have that \begin{align} \dot{x} =& f(x,t)+B(x,t)u_L+d_c(x,t) \\ =& f(x,t)+B(x,t)u^*+B(x,t)(u_L-u^*)+d_c(x,t) \end{align} where $u_L(x,x_d,u_d,t)$ denotes a learning-based control law that models $u^*(x,x_d,u_d,t)$. As long as $u^*$ renders the closed-loop dynamics $\dot{x}=f(x,t)+B(x,t)u^*(x,x_d,u_d,t)$ contracting with respect to $x$~\cite{mypaperTAC,ccm,ncm,7989693}, we can define the functions of \eqref{learning_x} as follows: \begin{align} \label{ex_control_l_1} \textsl{g}(q,\varpi,t) =& f(q,t)+B(q,t)u^*(q,x_d,u_d,t) \\ \label{ex_control_l_2} \Delta_L(\varpi,t) =& B(x,t)(u_L(x,x_d,u_d,t)-u^*(x,x_d,u_d,t)) \end{align} with $d(\mu,\varpi,t)=\mu d_c(x,t)$, where $\varpi=[x^{\top},x_d^{\top},u_d^{\top}]^{\top}$ in this case. It can be easily verified that \eqref{learning_x} indeed has $q(\mu=0,t)=x_d$ and $q(\mu=1,t)=x$ as particular solutions if $u^*(x_d,x_d,u_d,t)=u_d$. Similarly, we can use \eqref{learning_x_sto} with $G=\mu G_c(x,t)$ if the dynamics is stochastically perturbed by $G_c(x,t)d\mathscr{W}$ as in \eqref{sdc_dynamics}. The learning objective here is to make $\|u_L(x,x_d,u_d,t)-u^*(x,x_d,u_d,t)\|$ as small as possible, which aligns with the aforementioned objective in \eqref{Eq:learning_error}. Note that if $\|B\|$ is bounded in the compact set $\mathcal{S}$ of \eqref{Eq:learning_error}, we can bound $\|\Delta_L\|$ of \eqref{ex_control_l_2} with $\epsilon_{\ell0}\neq 0$ and $\epsilon_{\ell1}=0$ as to be explained in Remark~\ref{remark_learning_error}. See Theorems~\ref{Thm:NCMstability1}, \ref{Thm:NCMstability2}, and \ref{Thm:lagros_stability} for details. \end{example} \begin{example}[State estimation] \label{ex:learning_prob2} Next, let us consider the problem of learning a computationally-expensive (or unknown) state estimator, approximating its estimation gain $L(\hat{x},t)$ by $L_L(\hat{x},t)$. If there is no disturbance in \eqref{sdc_dynamics_est} and \eqref{sdc_dynamics_est_sto}, we have that \begin{align} \dot{\hat{x}} =& f(\hat{x},t)+L_L(h(x,t)-h(\hat{x},t))= f(\hat{x},t)\\ &+L(h(x,t)-h(\hat{x},t))+(L_L-L)(h(x,t)-h(\hat{x},t)) \end{align} where $\dot{x}=f(x,t)$ is the true system, $y=h(x,t)$ is the measurement, and we assume that $f$ and $h$ are known. If $L$ is designed to render $\dot{q}=f(q,t)+L(\hat{x},t)(h(x,t)-h(q,t))$ contracting with respect to $q$~\cite{ncm,mypaperTAC,Ref:Stochastic,6849943}, we could define the functions of \eqref{learning_x} and \eqref{learning_x_sto} as follows: \begin{align} \label{ex_estimation_l_1} \textsl{g}(q,\varpi,t) =& f(q,t)+L(\hat{x},t)(h(x,t)-h(q,t)) \\ \label{ex_estimation_l_2} \Delta_L(q,\varpi,t) =& (L_L(\hat{x},t)-L(\hat{x},t))(h(x,t)-h(\hat{x},t)) \end{align} where $\varpi=[x^{\top},\hat{x}^{\top}]^{\top}$. It can be seen that \eqref{learning_x} and \eqref{learning_x_sto} with the relations \eqref{ex_estimation_l_1} and \eqref{ex_estimation_l_2} indeed has $q(\mu=0,t)=x$ and $q(\mu=1,t)=\hat{x}$ as its particular solutions when perturbed by deterministic and stochastic disturbances as in \eqref{sdc_dynamics_est} and \eqref{sdc_dynamics_est_sto}, respectively. We can bound $\|\Delta_L\|$ of \eqref{ex_estimation_l_2} in the compact set of \eqref{Eq:learning_error} with $\epsilon_{\ell0}=0$ and $\epsilon_{\ell1}\neq0$ if $h$ is Lipschitz, and with $\epsilon_{\ell0}\neq0$ and $\epsilon_{\ell1}=0$ if $h$ is bounded in $\mathcal{S}$, using the techniques to be discussed in Remark~\ref{remark_learning_error}. See Theorems~\ref{Thm:NCMstability1_est} and~\ref{Thm:NCMstability2} for details. \end{example} \begin{example}[System identification] \label{ex:learning_prob3} We can use the problem \eqref{Eq:learning_error} with the systems \eqref{learning_x} and \eqref{learning_x_sto} also if $f_{\mathrm{true}}$ of the underlying dynamics $\dot{x}^* = f_{\mathrm{true}}(x^*,t)$ is unknown and learned by $\dot{x} = f_L(x,t)$. Since we have \begin{align} \dot{x}^* = f_{\mathrm{true}}(x^*,t) = f_L(x^*,t)+(f_{\mathrm{true}}(x^*,t)-f_L(x,t)) \end{align} we could define $\textsl{g}$ and $\Delta_L$ of \eqref{learning_x} and \eqref{learning_x_sto} as follows, to have $q(\mu=0,t)=x$ and $q(\mu=1,t)=x^*$ as its particular solutions: \begin{align} \label{ex_systemID_l_2} \textsl{g}(q,\varpi,t) = f_L(q,t),~\Delta_L(\varpi,t) = f_{\mathrm{true}}(x^*,t)-f_L(x^*,t)~~~~~ \end{align} where $\varpi=x^*$, as long as $\dot{x} = f_L(x,t)$ is contracting with respect to $x$~\cite{47710,boffi2020learning}. Since $\Delta_L$ of \eqref{ex_systemID_l_2} is the learning error itself, $\|\Delta_L\|$ can be bounded in $\mathcal{S}$ using the techniques of Remark~\ref{remark_learning_error}. See Theorems~\ref{Thm:NCMstability_modelfree} and \ref{Thm:neurallander} for details. \end{example} \begin{remark} \label{remark_learning_error} As seen in Examples~\ref{ex:learning_prob1}--\ref{ex:learning_prob2}, $\Delta_L$ of \eqref{Eq:learning_error} is typically given by a learning error, $\phi(z)-\varphi(z)$, multiplied by a bounded or Lipschitz continuous function, where $z=(\varpi,t)\in\mathcal{S}$ for a compact set $\mathcal{S}$, and $\phi$ is the true computationally-expensive/unknown function to be learned by $\varphi$ as in \eqref{ex_control_l_2}, \eqref{ex_estimation_l_2}, \eqref{ex_systemID_l_2}, etc. Let $\mathcal{T}$ be a set of training data $\{(z_i,\phi(z_i))\}_{i=1}^N$ sampled in $\mathcal{S}$. For systems with the true function $\phi$ and its approximation $\varphi$ being Lipschitz (e.g.{}, by spectral normalization~\cite{miyato2018spectral} to be discussed in Definition~\ref{Def:SN} or by using contraction theory as in~\cite{revay2020lipschitz,revay2021recurrent}), we can analytically find a bound for $\|\phi(z)-\varphi(z)\|$ as follows if target data samples $z$ are in $B(r) = \{z\in\mathcal{S}|\sup_{z'\in\mathcal{T}}\|z-z'\|\leq r\}$ for some $r \in\mathbb{R}_{\geq0}$: \begin{align} \label{marginbound} \sup_{z\in B(r)}\|\phi(z)-\varphi(z)\| \leq \sup_{z'\in \mathcal{T}}\|\phi(z')-\varphi(z')\|+(L_{\phi}+L_{\varphi})r \end{align} where $L_{\phi}$ and $L_{\varphi}$ are the Lipschitz constants of $\phi$ and $\varphi$, respectively. The term $\sup_{z'\in \mathcal{T}}\|\phi(z')-\varphi(z')\|$ can then be bounded by a constant, e.g.{}, by using a deep robust regression model as proven in~\cite{pmlr-v51-chen16d,nnbound} with spectral normalization, under standard training data distribution assumptions. Deep Neural Networks (DNNs) have been shown to generalize well to the set of unseen events that are from almost the same distribution as their training set~\cite{rethinknet,dnnlearn,neurallander,DBLP:conf/uai/DziugaiteR17,NIPS2017_10ce03a1}, and consequently, obtaining a tighter and more general upper bound for the learning error as in \eqref{marginbound} has been an active field of research~\cite{marginbounds1,marginbounds2,nnbound,pmlr-v51-chen16d}. Thus, the condition \eqref{Eq:learning_error} has become a common assumption in analyzing the performance of learning-based and data-driven control techniques~\cite{neurallander,8967820,pmlr-v97-cheng19a,8651519,lagros,ancm,cdc_ncm,swarm1,swarm2}. \end{remark} \subsection{Formal Stability Guarantees via Contraction Theory} One drawback of naively using existing learning-based and data-driven control approaches for the perturbed nonlinear systems \eqref{learning_x} and \eqref{learning_x_sto} without analyzing contraction is that, as shall be seen in the following theorem, we can only guarantee the trajectory error to be bounded by a function that increases exponentially with time. \begin{theorem} \label{Thm:naive_learning} Suppose that $\Delta_L$ of \eqref{learning_x} is learned to satisfy \eqref{Eq:learning_error}, and that $\textsl{g}(q,\varpi,t)$ of \eqref{learning_x} is Lipschitz with respect to $q$ with its 2-norm Lipschitz constant $L_{\textsl{g}}\in\mathbb{R}_{\geq 0}$, i.e.{}, \begin{align} \|\textsl{g}(q,\varpi,t)-\textsl{g}(q',\varpi,t)\| \leq L_{\textsl{g}}\|q-q'\|,~\forall (\varpi,t) \in \mathcal{S} \end{align} where $q,q' \in \mathbb{R}^n$ and $\mathcal{S}$ is the compact set of \eqref{Eq:learning_error}. Then we have the following upper bound for all $(\varpi,t) \in \mathcal{S}$: \begin{align} \label{naive_learning_error} \|\mathtt{e}(t)\| \leq& \|\mathtt{e}(0)\|e^{(L_{\textsl{g}}+\epsilon_{\ell1})t}+\frac{\epsilon_{\ell0}+\bar{d}}{L_{\textsl{g}}+\epsilon_{\ell1}}(e^{(L_{\textsl{g}}+\epsilon_{\ell1})t}-1) \end{align} where $\mathtt{e}(t) = \xi_1(t)-\xi_0(t)$, $\xi_0(t)=q(0,t)$ and $\xi_1(t)=q(1,t)$ for $q$ of \eqref{learning_x}, and $\bar{d}=\sup_{\mu,\varpi,t}\|\partial d/\partial \mu\|$ for $d$ of \eqref{Eq:learning_error}. \end{theorem} \begin{proof} See the Gronwall-Bellman inequality~\cite[p. 651]{Khalil:1173048} and Theorem~3.4 of~\cite[pp. 96-97]{Khalil:1173048}. \qed \end{proof} The bound obtained in Theorem~\ref{Thm:naive_learning} is useful in that it gives mathematical guarantees even for naive learning-based frameworks without a contracting property (e.g.{}, it can be used to prove safety in the learning-based Model Predictive Control (MPC) framework~\cite{learningmpc}). However, the exponential term $e^{(L_{\textsl{g}}+\epsilon_{\ell1})t}$ in \eqref{naive_learning_error} causes the upper bound to diverge, which could result in more conservative automatic control designs than necessary. In contrast, contraction theory gives an upper bound on the trajectory tracking error $\|\mathtt{e}(t)\|$ which is exponentially bounded linearly in the learning error, even under the presence of external disturbances~\cite{ncm,ancm,lagros,cdc_ncm}. \begin{theorem} \label{Thm:contraction_learning} Let us consider the virtual system of a smooth path $q(\mu,t)$ in \eqref{learning_x} and suppose that $\Delta_L$ of \eqref{learning_x} is learned to satisfy \eqref{Eq:learning_error}. If the condition $\underline{m}\mathrm{I}\preceq M\preceq\overline{m}\mathrm{I}$ of \eqref{Mcon} holds and the system \eqref{learning_x} with $\Delta_L=0$ and $d=0$ is contracting, i.e.{}, \begin{align} \dot{M}+M(\partial \textsl{g}/\partial q)+(\partial \textsl{g}/\partial q)^{\top}M \preceq -2\alpha M \end{align} of Theorem~\ref{Thm:contraction} or \ref{Thm:partial_contraction} holds for $M\succ 0$ that defines a contraction metric with the contraction rate $\alpha$, and if the learning error $\epsilon_{\ell1}$ of \eqref{Eq:learning_error} is sufficiently small to satisfy \begin{align} \label{epsilon_ell2_condition} \exists \alpha_{\ell} \in\mathbb{R}_{>0}\text{ s.t.{} }\alpha_{\ell}=\alpha-\epsilon_{\ell1}\sqrt{\overline{m}/\underline{m}} > 0 \end{align} then we have the following bound for all $(\varpi,t) \in \mathcal{S}$: \begin{equation} \label{cont_learning_bound} \|\mathtt{e}(t)\| \leq \frac{V_{\ell}(0)}{\sqrt{\underline{m}}}e^{-\alpha_{\ell} t}+\frac{\epsilon_{\ell0}+\bar{d}}{\alpha_{\ell}}\sqrt{\frac{\overline{m}}{\underline{m}}}(1-e^{-\alpha_{\ell} t}) \end{equation} where $\mathtt{e}(t)=\xi_1(t)-\xi_0(t)$ with $\xi_0(t)=q(0,t)$ and $\xi_1(t)=q(1,t)$ for $q$ of \eqref{learning_x}, $\bar{d}=\sup_{\mu,\varpi,t}\|\partial d/\partial \mu\|$ as in \eqref{learning_x}, $\mathcal{S}$ is the compact set of Theorem~\ref{Thm:naive_learning}, $\epsilon_{\ell0}$ and $\epsilon_{\ell1}$ are the learning errors of \eqref{Eq:learning_error}, and $V_{\ell}(t) = \int_{\xi_0}^{\xi_1} \|\Theta(q(t),t)\delta q(t)\|$ for $M=\Theta^{\top}\Theta$ as in Theorem~\ref{Thm:path_integral}. \end{theorem} \begin{proof} Since \eqref{learning_x} with $\Delta_L=0$ and $d=0$ is contracting and we have that \begin{align} &\|\partial (\Delta_L+d)/\partial \mu\| \leq \epsilon_{\ell0}+\epsilon_{\ell1}\|\xi_1-\xi_0\|+\bar{d} \\ &\leq \epsilon_{\ell0}+\frac{\epsilon_{\ell1}}{\sqrt{\underline{m}}}\int_{\xi_0}^{\xi_1}\|\Theta \delta q\|+\bar{d}=\epsilon_{\ell0}+\frac{\epsilon_{\ell1}}{\sqrt{\underline{m}}}V_{\ell}+\bar{d} \label{lip_learning_error_theta} \end{align} for all $\mu\in[0,1]$ and $(\varpi,t)\in\mathcal{S}$ due to $\sup_{\mu,\varpi,t}\|\partial d/\partial \mu\|=\bar{d}$, the direct application of Theorem~\ref{Thm:Robust_contraction_original} to the system \eqref{learning_x}, along with the condition \eqref{epsilon_ell2_condition}, yields \eqref{cont_learning_bound}. \qed \end{proof} Using Theorem~\ref{Thm:robuststochastic}, we can easily derive a stochastic counterpart of Theorem~\ref{Thm:contraction_learning} for the system \eqref{learning_x_sto}~\cite{nscm,cdc_ncm}. \begin{theorem} \label{Thm:contraction_learning_sto} Consider the virtual system of a smooth path $q(\mu,t)$ in \eqref{learning_x_sto} and suppose $\Delta_L$ of \eqref{learning_x_sto} is learned to satisfy \eqref{Eq:learning_error}. If $\underline{m}\mathrm{I}\preceq M\preceq\overline{m}\mathrm{I}$ of \eqref{Mcon} holds and the system \eqref{learning_x_sto} is contracting, i.e.{}, \begin{align} \dot{M}+M(\partial \textsl{g}/\partial q)+(\partial \textsl{g}/\partial q)^{\top}M \preceq -2\alpha M-\alpha_s \mathrm{I} \end{align} of Theorem~\ref{Thm:robuststochastic} holds, and if the learning error $\epsilon_{\ell1}$ of \eqref{Eq:learning_error} and an arbitrary constant $\alpha_d \in \mathbb{R}_{>0}$ (see \eqref{alpha_d_def}) are selected to satisfy \begin{align} \label{epsilon_ell2_condition_sto} \exists \alpha_{\ell} \in\mathbb{R}_{>0}\text{ s.t.{} }\alpha_{\ell}=\alpha-(\alpha_d/2+\epsilon_{\ell1}\sqrt{\overline{m}/\underline{m}}) > 0 \end{align} then we have the following bound for all $(\varpi,t) \in \mathcal{S}$: \begin{align} \label{cont_learning_bound_sto} \mathop{\mathbb{E}}\left[\|\mathtt{e}(t)\|^2\right] \leq \frac{\mathop{\mathbb{E}}[V_{s\ell}(0)]}{\underline{m}}e^{-2\alpha_{\ell} t}+\frac{C}{2\alpha_{\ell}}\frac{\overline{m}}{\underline{m}} \end{align} where $\mathtt{e}(t)=\xi_1(t)-\xi_0(t)$ with $\xi_0(t)=q(0,t)$ and $\xi_1(t)=q(1,t)$ for $q$ of \eqref{learning_x_sto}, $\mathcal{S}$ is the compact set given in Theorem~\ref{Thm:naive_learning}, $\epsilon_{\ell0}$ and $\epsilon_{\ell1}$ are the learning errors of \eqref{Eq:learning_error}, $V_{s\ell}(t) = \int_{\xi_0}^{\xi_1} \|\Theta(q(t),t)\delta q(t)\|^2$ for $M=\Theta^{\top}\Theta$ as given in Theorem~\ref{Thm:path_integral}, and $C = \bar{g}^2({2}{\alpha_G}^{-1}+1)+\epsilon_{\ell0}^2\alpha_d^{-1}$ for $\bar{g}=\sup_{\mu,\varpi,t}\|\partial G/\partial \mu\|_F$ of \eqref{learning_x_sto} with an arbitrary constant $\alpha_G \in \mathbb{R}_{>0}$ as in Theorem~\ref{Thm:robuststochastic}. Furthermore, the probability that $\|\mathtt{e}\|$ is greater than or equal to $\varepsilon\in\mathbb{R}_{> 0}$ is given as \begin{align} \label{cont_learning_bound_sto_prob} \mathop{\mathbb{P}}\left[\|\mathtt{e}(t)\|\geq\varepsilon\right] \leq \frac{1}{\varepsilon^2}\left(\frac{\mathop{\mathbb{E}}[V_{s\ell}(0)]}{\underline{m}}e^{-2\alpha_{\ell} t}+\frac{C}{2\alpha_{\ell}}\frac{\overline{m}}{\underline{m}}\right). \end{align} \end{theorem} \begin{proof} Computing $\mathscr{L}V_{s\ell}$ with the virtual system \eqref{learning_x_sto} as in the proof of Theorem~\ref{Thm:robuststochastic}, we get an additional term $2\int_{0}^{1}\partial_{\mu} q^{\top}M\Delta_L$. Using the learning error assumption \eqref{Eq:learning_error} to have $\|\Delta_L\| \leq \epsilon_{\ell0}+(\epsilon_{\ell1}/\sqrt{\underline{m}})\int_{0}^{1}\|\Theta \partial_{\mu} q\|d\mu$ as in \eqref{lip_learning_error_theta}, we have that \begin{align} 2\int_{0}^{1}\partial_{\mu} q^{\top}M\Delta_L\leq& 2\sqrt{\overline{m}}V_{\ell}(\epsilon_{\ell0}+(\epsilon_{\ell1}/\sqrt{\underline{m}})V_{\ell}) \\ \leq& \alpha_d^{-1}\epsilon_{\ell0}^2\overline{m}+(\alpha_d+2\epsilon_{\ell1}\sqrt{\overline{m}/\underline{m}}) V_{\ell}^2 \label{alpha_d_def} \end{align} where $V_{\ell}=\int_{0}^{1}\|\Theta \partial_{\mu} q\|d\mu$ as in Theorem~\ref{Thm:path_integral}, and the relation $2ab \leq \alpha_d^{-1}a^2+\alpha_d b^2$, which holds for any $a,b\in\mathbb{R}$ and $\alpha_d \in \mathbb{R}_{>0}$ ($a = \epsilon_{\ell0}\sqrt{\overline{m}}$ and $b = V_{\ell}$ in this case), is used to obtain the second inequality. Since we have $V_{\ell}^2 \leq V_{s\ell}$ as proven in Theorem~\ref{Thm:path_integral}, selecting $\alpha_d$ and $\epsilon_{\ell1}$ sufficiently small to satisfy \eqref{epsilon_ell2_condition_sto} gives the desired relations \eqref{cont_learning_bound_sto} and \eqref{cont_learning_bound_sto_prob} due to Theorem~\ref{Thm:robuststochastic}. \qed \end{proof} As discussed in Theorems~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto}, using contraction theory for learning-based and data-driven control, we can formally guarantee the system trajectories to stay in a tube with an exponentially convergent bounded radius centered around the target trajectory, even with the external disturbances and learning errors $\epsilon_{\ell0}$ and $\epsilon_{\ell1}$. The exponential bounds \eqref{cont_learning_bound}, \eqref{cont_learning_bound_sto}, and \eqref{cont_learning_bound_sto_prob} become tighter as we achieve smaller $\epsilon_{\ell0}$ and $\epsilon_{\ell1}$ using more training data for verifying \eqref{Eq:learning_error} (see Remark~\ref{remark_learning_error}). It is also worth noting that the steady-state bounds of \eqref{cont_learning_bound} and \eqref{cont_learning_bound_sto} are again some functions of the condition number $\chi = \overline{m}/\underline{m}$ as in Theorems~\ref{Thm:CVSTEMobjective} and~\ref{Thm:CV-STEMobjective-est}, which renders the aforementioned CV-STEM approach valid and effective also in the learning-based frameworks. Theorems~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto} play a central role in providing incremental exponential stability guarantees for learning-based and data-driven automatic control to be introduced in Sec.~\ref{Sec:ncm}--\ref{Sec:adaptive}. \subsection{Motivation for Neural Contraction Metrics} The CV-STEM schemes in Theorems~\ref{Thm:CV-STEM},~\ref{Thm:CV-STEM-estimation}, and~\ref{Thm:ccm_cvstem} permit the construction of optimal contraction metrics via convex optimization for synthesizing optimal, provably stable, and robust feedback control and state estimation. It is also shown in Theorems~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto} that these contraction metrics are useful for obtaining stability guarantees for machine learning-based and data-driven control techniques while retaining the CV-STEM-type optimality due to the tracking error bounds \eqref{cont_learning_bound} and \eqref{cont_learning_bound_sto}, which are comparable to those in Theorems~\ref{Thm:CVSTEMobjective} and~\ref{Thm:CV-STEMobjective-est}. However, the CV-STEM requires that a nonlinear system of equations or an optimization problem be solved at each time instant, which is not suitable for systems with limited online computational capacity. The Neural Contraction Metric (NCM) and its extensions~\cite{ncm,nscm,ancm,lagros} have been developed to address such a computational issue by modeling the CV-STEM optimization scheme using a DNN~\cite{neural1,neural2,neural3}, making it implementable in real-time. We will see in the subsequent sections that Theorems~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto} provide one formal approach to prove robustness and stability properties of the NCM methodologies~\cite{cdc_ncm}. \if0 model contraction metrics~\cite{AYLWARD20082163,ccm} for dynamics with polynomial or rational vector fields, reducing the online computational burden. The definition of SOS is given as follows. \begin{definition} \label{Def:sos} A polynomial $p(x_1,\ldots,x_n) = p(x) \in \mathbb{R}$ is called a SOS if there exist polynomials $f_1(x),\ldots,f_m(x) \in \mathbb{R}$ s.t.{} $p(x)=\sum_{i=1}^mf_i^2(x)$. Now consider a symmetric matrix with polynomial entries $S(x) \in \mathbb{R}^{m \times m}$, and let $y=[y_1,\cdots,y_m]^{\top}$ be a vector of new indeterminates. Then $S(x)$ is an SOS matrix if the scalar polynomial $y^{\top}S(x)y$ is an SOS in $\mathbb{R}$. \end{definition} Using SOS matrices of Definition~\ref{Def:sos}, we could relax the contraction conditions to SOS conditions~\cite{sos_dissertation0,GATERMANN200495,AYLWARD20082163}, but its inherent limitation is that the problem size grows exponentially with the number of variables and basis functions~\cite{sos_dissertation}. The Neural Contraction Metric (NCM) and its extensions~\cite{ncm,nscm,ancm} have been developed to address this problem by approximating the CV-STEM solutions by a DNN, without assuming any special structure in the underlying dynamical system. Theorems~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto} can now be utilized for maintaining their formal robustness and stability properties. \fi \section{Learning-based Robust Control and Estimation} \label{Sec:ncm} Let us again consider the systems \eqref{original_dynamics}--\eqref{sdc_dynamicsd} for control, i.e.{}, \begin{align} \label{ncm_original_dynamics} \dot{x} &= f(x,t) + B(x,t)u + d_c(x,t) \\ \label{ncm_sdc_dynamics} dx &= (f(x,t)+B(x,t)u)dt+G_c(x,t)d\mathscr{W}(t) \\ \label{ncm_sdc_dynamicsd} \dot{x}_d &= f(x_d,t)+B(x_d,t)u_d \end{align} with $\sup_{x,t}\|d_c\|=\bar{d}_c\in\mathbb{R}_{\geq0}$ and $\sup_{x,t}\|G_c\|_F = \bar{g}_c\in\mathbb{R}_{\geq0}$, and \eqref{sdc_dynamics_est}--\eqref{sdc_dynamics_est_sto} for estimation, i.e.{}, \begin{align} \label{ncm_sdc_dynamics_est} \dot{x} =& f(x,t)+d_{e0}(x,t),~y = h(x,t)+d_{e1}(x,t) \\ \label{ncm_sdc_dynamics_est_sto} dx =& f(x,t)dt+G_{e0}d\mathscr{W}_0,~ydt = h(x,t)dt+G_{e1}d\mathscr{W}_1 \end{align} with $\sup_{x,t}\|d_{e0}\|=\bar{d}_{e0}\in\mathbb{R}_{\geq0}$, $\sup_{x,t}\|d_{e1}\|=\bar{d}_{e1}\in\mathbb{R}_{\geq0}$, $\sup_{x,t}\|G_{e0}\|_F = \bar{g}_{e0}\in\mathbb{R}_{\geq0}$, and $\sup_{x,t}\|G_{e1}\|_F = \bar{g}_{e1}\in\mathbb{R}_{\geq0}$. The following definitions of a DNN~\cite{neural1,neural2,neural3} and NCM~\cite{ncm,nscm,cdc_ncm} will be utilized extensively hereinafter. \begin{definition} \label{NN_definition} A neural network is a nonlinear mathematical model to approximately represent training samples $\{(x_i,y_i)\}_{i=1}^{N}$ of $y = \phi(x)$ by optimally tuning its hyperparameters $W_{\ell}$, and is given as follows: \begin{align} \label{neuralnet} y_i = \varphi(x_i;W_{\ell}) = T_{L+1}\circ\sigma\circ T_{L}\circ\cdots\circ\sigma\circ T_{1}(x_i) \end{align} where $T_{\ell}(x) = W_{\ell}x$, $\circ$ denotes composition of functions, and $\sigma$ is an activation function (e.g.{} $\sigma(x) = \tanh(x)$, note that $\varphi(x)$ is smooth in this case). We call a neural network that has more than two layers (i.e.{}, $L\geq 2$) a Deep Neural Network (DNN). \end{definition} \begin{definition} \label{Def:NCM} A Neural Contraction Metric (NCM) is a DNN model of a contraction metric given in Theorem~\ref{Thm:contraction}. Its training data could be sampled by solving the CV-STEM presented in Theorem~\ref{Thm:CV-STEM} for control (or Theorem~\ref{Thm:ccm_cvstem} for differential feedback control) and Theorem~\ref{Thm:CV-STEM-estimation} for estimation. The NCM framework is summarized in Fig.~\ref{ncmdrawing}. \end{definition} \begin{remark} \label{remark_NSCM_notation} Although a stochastic version of the NCM is called a Neural Stochastic Contraction Metric (NSCM) in~\cite{nscm}, we also denote it as an NCM in this paper for simplicity of presentation. \end{remark} \begin{figure} \centering \includegraphics[width=88mm]{figures/NCMnew.pdf} \caption{Illustration of NCM ($x$: system state; $M$: positive definite matrix that defines optimal contraction metric; $x_i$ and $M_i$: sampled $x$ and $M$; $\hat{x}$: estimated system state; $y$: measurement; and $u$: system control input). Note that the target trajectory $(x_d,u_d)$ is omitted in the figure fore simplicity.} \label{ncmdrawing} \end{figure} Since the NCM only requires one function evaluation at each time instant to get $M$ that defines a contraction metric, without solving any optimization problems unlike the CV-STEM approaches, it enables real-time optimal feedback control and state estimation in most engineering and scientific applications. \subsection{Stability of NCM-based Control and Estimation} The NCM exhibits superior incremental robustness and stability due to its internal contracting property. \begin{theorem} \label{Thm:NCMstability1} Let $\mathcal{M}$ define the NCM in Definition~\ref{Def:NCM}, and let $u^*=u_d-R^{-1}B^{\top}M(x-x_d)$ for $M$ and $R$ given in Theorem~\ref{Thm:CV-STEM}. Suppose that the systems \eqref{ncm_original_dynamics} and \eqref{ncm_sdc_dynamics} are controlled by $u_L$, which computes the CV-STEM controller $u^*$ of Theorem~\ref{Thm:CV-STEM} replacing $M$ by $\mathcal{M}$, i.e.{}, \begin{align} \label{NCM_controller} u_L=u_d-R(x,x_d,u_d,t)^{-1}B(x,t)^{\top}\mathcal{M}(x,x_d,u_d,t)\mathtt{e} \end{align} for $\mathtt{e}=x-x_d$. Note that we could use the differential feedback control $u=u_d+\int^1_0kd\mu$ of Theorem~\ref{Thm:ccm_cvstem} for $u^*$ and $u_L$. Define $\Delta_L$ of Theorems~\ref{Thm:contraction_learning} and \ref{Thm:contraction_learning_sto} as follows: \begin{align} \label{ncm_DeltaL} \Delta_L(\varpi,t) = B(x,t)(u_L(x,x_d,u_d,t)-u^*(x,x_d,u_d,t)) \end{align} where we use $q(0,t)=\xi_0(t)=x_d(t)$, $q(1,t)=\xi_1(t)=x(t)$, and $\varpi=[x^{\top},x_d^{\top},u_d^{\top}]^{\top}$ in the learning-based control formulation \eqref{learning_x} and \eqref{learning_x_sto}. If the NCM is learned to satisfy the learning error assumptions of Theorems~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto} for $\Delta_L$ given by \eqref{ncm_DeltaL}, then \eqref{cont_learning_bound}, \eqref{cont_learning_bound_sto}, and \eqref{cont_learning_bound_sto_prob} of Theorems~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto} hold as follows: \begin{align} \label{Eq:NCM_control_error_bound} &\|\mathtt{e}(t)\| \leq \frac{V_{\ell}(0)}{\sqrt{\underline{m}}}e^{-\alpha_{\ell} t}+\frac{\epsilon_{\ell0}+\bar{d}_c}{\alpha_{\ell}}\sqrt{\frac{\overline{m}}{\underline{m}}}(1-e^{-\alpha_{\ell} t}) \\ \label{Eq:NCM_control_error_bound_sto} &\mathop{\mathbb{E}}\left[\|\mathtt{e}(t)\|^2\right] \leq \frac{\mathop{\mathbb{E}}[V_{s\ell}(0)]}{\underline{m}}e^{-2\alpha_{\ell} t}+\frac{C_C}{2\alpha_{\ell}}\frac{\overline{m}}{\underline{m}} \\ \label{Eq:NCM_control_error_bound_sto_prob} &\mathop{\mathbb{P}}\left[\|\mathtt{e}(t)\|\geq\varepsilon\right] \leq \frac{1}{\varepsilon^2}\left(\frac{\mathop{\mathbb{E}}[V_{s\ell}(0)]}{\underline{m}}e^{-2\alpha_{\ell} t}+\frac{C_C}{2\alpha_{\ell}}\frac{\overline{m}}{\underline{m}}\right) \end{align} where $\mathtt{e}=x-x_d$, $C_C = \bar{g}_c^2({2}{\alpha_G}^{-1}+1)+\epsilon_{\ell0}^2\alpha_d^{-1}$, the disturbance upper bounds $\bar{d}_c$ and $\bar{g}_c$ are given in \eqref{ncm_original_dynamics} and \eqref{ncm_sdc_dynamics}, respectively, and the other variables are defined in Theorems~\ref{Thm:CV-STEM},~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto}. \end{theorem} \begin{proof} Let $\textsl{g}$ of the virtual systems given in Theorems~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto} be $\textsl{g}=\zeta$, where $\zeta$ is given by \eqref{Eq:virtual_sys_sto} (i.e.{}, $\zeta = (A-BR^{-1}B^{\top}M)(q-x_d)+\dot{x}_d$). By definition of $\Delta_L$, this has $q=x$ and $q=x_d$ as its particular solutions (see Example~\ref{ex:learning_prob1}). As defined in the proof of Theorems~\ref{Thm:CVSTEM:LMI}, we have $d= \mu d_c\text{ and }G = \mu G_c$ for these virtual systems, resulting in the upper bounds of disturbances in the learning-based control formulation \eqref{cont_learning_bound} and \eqref{cont_learning_bound_sto} given as \begin{align} \label{Eq:NCM_control_bound} \text{$\bar{d}=\bar{d}_c$ and $\bar{g}=\bar{g}_c$}. \end{align} Since $M$ and $u^*$ are constructed to render $\dot{q}=\zeta(q,\varpi,t)$ contracting as presented in Theorem~\ref{Thm:CV-STEM}, and we have $\|\Delta_L\| \leq \epsilon_{\ell0}+\epsilon_{\ell1}\|\xi_1-\xi_0\|$ due to the learning assumption \eqref{Eq:learning_error}, Theorem~\ref{Thm:contraction_learning} implies the deterministic bound \eqref{Eq:NCM_control_error_bound} and Theorem~\ref{Thm:contraction_learning_sto} implies the stochastic bounds \eqref{Eq:NCM_control_error_bound_sto} and \eqref{Eq:NCM_control_error_bound_sto_prob}. Note that using the differential feedback control of Theorem~\ref{Thm:ccm_cvstem} as $u^*$ also gives the bounds \eqref{Eq:NCM_control_error_bound}--\eqref{Eq:NCM_control_error_bound_sto_prob} following the same argument~\cite{cdc_ncm}. \qed \end{proof} Due to the estimation and control duality in differential dynamics observed in Sec.~\ref{sec:convex}, we have a similar result to Theorem~\ref{Thm:NCMstability1} for the NCM-based state estimator. \begin{theorem} \label{Thm:NCMstability1_est} Let $\mathcal{M}$ define the NCM in Definition~\ref{Def:NCM}, and let $L(\hat{x},t)=M\bar{C}^{\top}R^{-1}$ for $M$, $\bar{C}$ and $R$ given in Theorem~\ref{Thm:CV-STEM-estimation}. Suppose that the systems \eqref{ncm_sdc_dynamics_est} and \eqref{ncm_sdc_dynamics_est_sto} are estimated with an estimator gain $L_L$, which computes $L$ of the CV-STEM estimator $\dot{\hat{x}} = f(\hat{x},t)+L(\hat{x},t)(y-h(\hat{x},t))$ in Theorem~\ref{Thm:CV-STEM-estimation} replacing $M$ by $\mathcal{M}$, i.e.{}, \begin{align} \label{NCM_estimator} \dot{\hat{x}} =& f(\hat{x},t)+L_L(\hat{x},t)(y-h(\hat{x},t)) \\ =& f(\hat{x},t)+\mathcal{M}(\hat{x},t)\bar{C}(\varrho_c,\hat{x},t)^{\top}R(\hat{x},t)^{-1}(y-h(\hat{x},t)) \end{align} Define $\Delta_L$ of Theorems~\ref{Thm:contraction_learning} and \ref{Thm:contraction_learning_sto} as follows: \begin{align} \label{ncm_DeltaL_est} \Delta_L(\varpi,t) = (L_L(\hat{x},t)-L(\hat{x},t))(h(x,t)-h(\hat{x},t)) \end{align} where we use $q(0,t)=\xi_0(t)=x(t)$, $q(1,t)=\xi_1(t)=\hat{x}(t)$, and $\varpi=[x^{\top},\hat{x}^{\top}]^{\top}$ in the learning-based control formulation \eqref{learning_x} and \eqref{learning_x_sto}. If the NCM is learned to satisfy the learning error assumptions of Theorems~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto} for $\Delta_L$ given by \eqref{ncm_DeltaL_est}, then \eqref{cont_learning_bound}, \eqref{cont_learning_bound_sto}, and \eqref{cont_learning_bound_sto_prob} of Theorems~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto} hold as follows: \begin{align} \label{Eq:NCM_estimation_error_bound} &\|\mathtt{e}(t)\| \leq \sqrt{\overline{m}}{V_{\ell}(0)}e^{-\alpha_{\ell} t}+\frac{\bar{d}_{a}\sqrt{\frac{\overline{m}}{\underline{m}}}+\bar{d}_{b}\overline{m}}{\alpha_{\ell}}(1-e^{-\alpha_{\ell} t})~~~~ \\ \label{Eq:NCM_estimation_error_bound_sto} &\mathop{\mathbb{E}}\left[\|\mathtt{e}(t)\|^2\right] \leq \overline{m}{\mathop{\mathbb{E}}[V_{s\ell}(0)]}e^{-2\alpha_{\ell} t}+\frac{C_E}{2\alpha_{\ell}}\frac{\overline{m}}{\underline{m}} \\ \label{Eq:NCM_estimation_error_bound_sto_prob} &\mathop{\mathbb{P}}\left[\|\mathtt{e}(t)\|\geq\varepsilon\right] \leq \frac{1}{\varepsilon^2}\left(\overline{m}{\mathop{\mathbb{E}}[V_{s\ell}(0)]}e^{-2\alpha_{\ell} t}+\frac{C_E}{2\alpha_{\ell}}\frac{\overline{m}}{\underline{m}}\right) \end{align} where $\mathtt{e}=\hat{x}-x$, $\bar{d}_{a} = \epsilon_{\ell0}+\bar{d}_{e0}$, $\bar{d}_{b}=\bar{\rho}\bar{c}\bar{d}_{e1}$, $C_E = (\bar{g}_{e0}^2+\bar{\rho}^2\bar{c}^2\bar{g}_{e1}^2\overline{m}^2)({2}{\alpha_G}^{-1}+1)+\epsilon_{\ell0}^2\alpha_d^{-1}$, the disturbance upper bounds $\bar{d}_{e0}$ $\bar{d}_{e1}$, $\bar{g}_{e0}$, and $\bar{g}_{e1}$ are given in \eqref{ncm_sdc_dynamics_est} and \eqref{ncm_sdc_dynamics_est_sto}, and the other variables are defined in Theorems~\ref{Thm:CV-STEM-estimation},~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto}. \end{theorem} \begin{proof} Let $\textsl{g}$ of the virtual systems given in Theorems~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto} be $\textsl{g}=\zeta$, where $\zeta$ is given by \eqref{Eq:virtual_sys_est_sto} (i.e.{}, $\zeta = (A-LC)(q-x)+f(x,t)$). By definition of $\Delta_L$, this has $q=\hat{x}$ and $q=x$ as its particular solutions (see Example~\ref{ex:learning_prob2}). As defined in the proof Theorem~~\ref{Thm:CVSTEM-LMI-est}, we have \begin{align} d=&(1-\mu) d_{e0}+\mu L_Ld_{e1}\text{ and }G=[(1-\mu) G_{e0},\mu L_LG_{e1}] \end{align} for these virtual systems, resulting in the upper bounds of external disturbances in the learning-based control formulation \eqref{cont_learning_bound} and \eqref{cont_learning_bound_sto} given as \begin{align} \label{Eq:NCM_estimation_bound} \text{$\bar{d}=\bar{d}_{e0}+\bar{\rho}\bar{c}\bar{d_{e1}}\sqrt{\overline{m}\underline{m}}$ and $\bar{g}=\sqrt{\bar{g}_{e0}^2+\bar{\rho}^2\bar{c}^2\bar{g}_{e1}^2\overline{m}^2}$}. \end{align} Since $W=M^{-1}$ is constructed to render $\dot{q}=\zeta(q,\varpi,t)$ contracting as presented in Theorem~\ref{Thm:CV-STEM-estimation}, and we have $\|\Delta_L\| \leq \epsilon_{\ell0}+\epsilon_{\ell1}\|\xi_1-\xi_0\|$ due to the learning assumption \eqref{Eq:learning_error}, Theorem~\ref{Thm:contraction_learning} implies the bound \eqref{Eq:NCM_estimation_error_bound}, and Theorem~\ref{Thm:contraction_learning_sto} implies the bounds \eqref{Eq:NCM_estimation_error_bound_sto} and \eqref{Eq:NCM_estimation_error_bound_sto_prob}. \qed \end{proof} \begin{remark} As discussed in Examples~\ref{ex:learning_prob1} and~\ref{ex:learning_prob2} and in Remark~\ref{remark_learning_error}, we have $\epsilon_{\ell1}=0$ for the learning error $\epsilon_{\ell1}$ of \eqref{Eq:learning_error} as long as $B$ and $h$ are bounded a compact set by the definition of $\Delta_L$ in \eqref{ncm_DeltaL} and \eqref{ncm_DeltaL_est}. If $h$ and $u^*$ are Lipschitz with respect to $x$ in the compact set, we have non-zero $\epsilon_{\ell1}$ with $\epsilon_{\ell0}=0$ in \eqref{Eq:learning_error} (see Theorem~\ref{Thm:NCMstability2}). \end{remark} Using Theorems~\ref{Thm:NCMstability1} and~\ref{Thm:NCMstability1_est}, we can relate the learning error of the matrix that defines the NCM, $\|\mathcal{M}-M\|$, to the error bounds \eqref{Eq:NCM_control_error_bound}--\eqref{Eq:NCM_control_error_bound_sto_prob} and \eqref{Eq:NCM_estimation_error_bound}--\eqref{Eq:NCM_estimation_error_bound_sto_prob}, if $M$ is given by the CV-STEM of Theorems~\ref{Thm:CV-STEM} and~\ref{Thm:CV-STEM-estimation}. \begin{theorem} \label{Thm:NCMstability2} Let $\mathcal{M}$ define the NCM in Definition~\ref{Def:NCM}, and let $\mathcal{S}_s\subseteq\mathbb{R}^n$, $\mathcal{S}_u\subseteq\mathbb{R}^m$, and $t\in\mathcal{S}_t\subseteq\mathbb{R}_{\geq 0}$ be some compact sets. Suppose that the systems \eqref{ncm_original_dynamics}--\eqref{ncm_sdc_dynamics_est_sto} are controlled by \eqref{NCM_controller} and estimated by \eqref{NCM_estimator}, respectively, as in Theorems~\ref{Thm:NCMstability1} and~\ref{Thm:NCMstability1_est}. Suppose also that $\exists \bar{b},\bar{c},\bar{\rho}\in\mathbb{R}_{\geq 0}$ s.t.{} $\|B(x,t)\|\leq\bar{b}$, $\|C(\varrho_c,x,\hat{x},t)\|\leq\bar{c}$, and $\|R^{-1}\|\leq\bar{\rho},~\forall x,\hat{x}\in\mathcal{S}_s$ and $t\in\mathcal{S}_t$, for $B$ in \eqref{ncm_original_dynamics}, $C$ in Theorem~\ref{Thm:CV-STEM-estimation}, and $R$ in \eqref{NCM_controller} and \eqref{NCM_estimator}. If we have for all $x,x_d,\hat{x}\in\mathcal{S}_s$, $u_d\in\mathcal{S}_u$, and $t\in\mathcal{S}_t$ that \begin{align} \label{Eq:Merror_control} \|\mathcal{M}(x,x_d,u_d,t)-M(x,x_d,u_d,t)\| \leq& \epsilon_{\ell} \text{ for control} \\ \label{Eq:Merror_estimation} \|\mathcal{M}(\hat{x},t)-M(\hat{x},t)\| \leq& \epsilon_{\ell} \text{ for estimation} \end{align} where $M(x,x_d,u_d,t)$ and $M(\hat{x},t)$ (or $M(x,t)$ and $M(\hat{x},t)$, see Theorem~\ref{Thm:fixed_sdc}) are the CV-STEM solutions of Theorems~\ref{Thm:CV-STEM} and \ref{Thm:CV-STEM-estimation} with $\exists\epsilon_{\ell}\in\mathbb{R}_{\geq 0}$ being the learning error, then the bounds \eqref{Eq:NCM_control_error_bound}--\eqref{Eq:NCM_control_error_bound_sto_prob} of Theorem~\ref{Thm:NCMstability1} and \eqref{Eq:NCM_estimation_error_bound}--\eqref{Eq:NCM_estimation_error_bound_sto_prob} of Theorem~\ref{Thm:NCMstability1_est} hold with $\epsilon_{\ell0} = 0$ and $\epsilon_{\ell1} = \bar{\rho}\bar{b}^2\epsilon_{\ell}$ for control, and $\epsilon_{\ell0} = 0$ and $\epsilon_{\ell1} = \bar{\rho}\bar{c}^2\epsilon_{\ell}$ for estimation, as long as $\epsilon_{\ell}$ is sufficiently small to satisfy the conditions \eqref{epsilon_ell2_condition} and \eqref{epsilon_ell2_condition_sto} of Theorems~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto} for deterministic and stochastic systems, respectively. \end{theorem} \begin{proof} For $\Delta_L$ defined in \eqref{ncm_DeltaL} and \eqref{ncm_DeltaL_est} with the controllers and estimators given as $u^*=u_d-R^{-1}B^{\top}M(x-x_d)$, $u_L=u_d-R^{-1}B^{\top}\mathcal{M}(x-x_d)$, $L=MC^{\top}R^{-1}$, and $L_L=\mathcal{M}C^{\top}R^{-1}$, we have the following upper bounds: \begin{align} \label{ncm_DeltaL_bound} \|\Delta_L\| \leq \begin{cases} \bar{\rho}\bar{b}^2\epsilon_{\ell}\|x-x_d\| & (\text{controller}) \\ \bar{\rho}\bar{c}^2\epsilon_{\ell}\|\hat{x}-x\| & (\text{estimator}) \end{cases} \end{align} where the relation $\|h(x,t)-h(\hat{x},t)\| \leq \bar{c}\|\hat{x}-x\|$, which follows from the equality $h(x,t)-h(\hat{x},t)=C(\varrho_c,x,\hat{x},t)(x-\hat{x})$ (see Lemma~\ref{sdclemma}), is used to obtain the second inequality. This implies that we have $\epsilon_{\ell0}=0$ and $\epsilon_{\ell1}=\bar{\rho}\bar{b}^2\epsilon_{\ell}$ for control, and $\epsilon_{\ell0}=0$ and $\epsilon_{\ell1}=\bar{\rho}\bar{c}^2\epsilon_{\ell}$ for estimation in the learning error of \eqref{Eq:learning_error}. The rest follows from Theorems~\ref{Thm:NCMstability1} and~\ref{Thm:NCMstability1_est}. \qed \end{proof} \begin{example} \label{ex:lorenz} The left-hand side of Fig.~\ref{fig:NCMexample} shows the state estimation errors of the following Lorenz oscillator perturbed by process noise $d_0$ and measurement noise $d_1$~\cite{ncm}: \begin{align} \dot{x} =& [\sigma(x_2-x_1),x_1(\rho-x_3)-x_2,x_1 x_2-\beta x_3]^{\top}+d_0(x,t) \\ y =& [1,0,0]x+d_2(x,t) \end{align} where $x = [x_1,x_2,x_3]^{\top}$, $\sigma = 10$, $\beta = 8/3$, and $\rho = 28$. It can be seen that the steady-state estimation errors of the NCM and CV-STEM are below the optimal steady-state upper bound of Theorem~\ref{Thm:CV-STEM-estimation} (dotted line in the left-hand side of Fig.~\ref{fig:NCMexample}) while the EKF has a larger error compared to the other two. In this example, training data is sampled along $100$ trajectories with uniformly distributed initial conditions ($-10 \leq x_i \leq 10,~i = 1,2,3$) using Theorem~\ref{Thm:CV-STEM-estimation}, and then modeled by a DNN as in Definition~\ref{Def:NCM}. Additional implementation and network training details can be found in~\cite{ncm}. \end{example} \begin{example} \label{ex:sc_robust_control} Consider a robust feedback control problem of the planar spacecraft perturbed by deterministic disturbances, the unperturbed dynamics of which is given as follows~\cite{SCsimulator}: \begin{align} \label{eq:sc_dynamics} \left[\begin{smallmatrix}m & 0 & 0 \\ 0 & m & 0 \\ 0 & 0 & I\end{smallmatrix}\right]\ddot{x}=\left[\begin{smallmatrix}\cos\phi & \sin\phi & 0 \\ -\sin\phi & \cos\phi & 0 \\ 0 & 0 & 1\end{smallmatrix}\right]\left[\begin{smallmatrix}-1 & -1 & 0 & 0 & 1 & 1 & 0 & 0 \\0 & 0 & -1 & -1 & 0 & 0 & 1 & 1 \\-\ell & \ell & -b & b & -\ell & \ell & -b & b\end{smallmatrix}\right]u~~~~~~~~~ \end{align} where $x = [p_x,p_y,\phi,\dot{p}_x,\dot{p}_y,\dot{\phi}]^T$ with $p_x$, $p_y$, and $\phi$ being the horizontal coordinate, vertical coordinate, and yaw angle of the spacecraft, respectively, with the other variables defined as $m = \text{mass of spacecraft}$, $I = \text{yaw moment of inertia}$, $u = \text{thruster force vector}$, $\ell=\text{half-depth of spacecraft}$, and $b=\text{half-width of spacecraft}$ (see Fig.~8 of~\cite{SCsimulator} for details). As shown in the right-hand side of Fig.~\ref{fig:NCMexample}, the NCM keeps their trajectories within the bounded error tube of Theorem~\ref{Thm:CV-STEM} (shaded region) around the target trajectory (dotted line) avoiding collision with the circular obstacles, even under the presence of disturbances, whilst requiring much smaller computational cost than the CV-STEM. Data sampling and the NCM training are performed as in Example~\ref{ex:lorenz}~\cite{ncm}. \end{example} \begin{figure} \centering \includegraphics[width=88mm]{figures/NCMtutorial.pdf} \caption{Lorenz oscillator state estimation error smoothed using a $15$-point moving average filter in Example~\ref{ex:lorenz} (left), and spacecraft motion $(p_x,p_y)$ on a planar field in Example~\ref{ex:sc_robust_control} (right).} \label{fig:NCMexample} \end{figure} \begin{remark} We could also simultaneously synthesize a controller $u$ and the NCM, and Theorem~\ref{Thm:NCMstability1} can provide formal robustness and stability guarantees even for such cases~\cite{chuchu,cdc_ncm}. In Sec.~\ref{Sec:lagros}, we generalize the NCM to learn contraction theory-based robust control using a DNN only taking $x$, $t$, and a vector containing local environment information as its inputs, to avoid the online computation of $x_d$ for the sake of automatic guidance and control implementable in real-time. \end{remark} \subsection{NCMs as Lyapunov Functions} We could also utilize the NCM constructed by the CV-STEM contraction metric for designing a Control Lyapunov function (CLF)~\cite{doi:10.1137/0321028,SONTAG1989117,Khalil:1173048}, resulting in a stability result different from Theorems~\ref{Thm:NCMstability1} and~\ref{Thm:NCMstability2}. To this end, let us recall that designing optimal $k$ of $u = k(x,x_d,u_d,t)$ reduces to designing optimal $K(x,x_d,u_d,t)$ of $u=u_d-K(x,x_d,u_d,t)(x-x_d)$ due to Lemma~\ref{u_equivalence_lemma} of Sec.~\ref{sec:HinfKYP}. For such $u$, the virtual system of \eqref{ncm_original_dynamics}/\eqref{ncm_sdc_dynamics} and \eqref{ncm_sdc_dynamicsd} without any perturbation, which has $q=x$ and $q=x_d$ as its particular solutions, is given as follows: \begin{align} \dot{q} =& (A(\varrho,x,x_d,u_d,t)-B(x,t)K(x,x_d,u_d,t))(q-x_d) \nonumber \\ \label{virtual_dynamics_clf} &+f(x_d,t)+B(x_d,t)u_d \end{align} where $A$ is the SDC matrix of the system \eqref{ncm_original_dynamics} given by Lemma~\ref{sdclemma}, i.e.{}, $A(\varrho,x,x_d,u_d,t)(x-x_d) = f(x,t)+B(x,t)u_d-f(x_d,t)-B(x_d,t)u_d$. Using the result of Theorem~\ref{Thm:path_integral}, one of the Lyapunov functions for the virtual system \eqref{virtual_dynamics_clf} with unknown $K$ can be given as the following transformed squared length integrated over $x$ of \eqref{ncm_original_dynamics}/\eqref{ncm_sdc_dynamics} and $x_d$ of \eqref{ncm_sdc_dynamicsd}: \begin{align} \label{eq_ncmclf} V_{\mathrm{NCM}} = \int_{x_d}^{x}\delta q^{\top}\mathcal{M}(x,x_d,u_d,t)\delta q \end{align} where $\mathcal{M}$ defines the NCM of Definition~\ref{Def:NCM} modeling $M$ of the CV-STEM contraction metric in Theorem~\ref{Thm:CV-STEM}. \begin{theorem} \label{Thm:ncm_clf} Suppose \eqref{ncm_original_dynamics} and \eqref{ncm_sdc_dynamics} are controlled by $u = u_d-K^*(x,x_d,u_d,t)\mathtt{e}$, where $\mathtt{e}=x-x_d$, and that $K^*$ is designed by the following convex optimization for given $(x,x_d,u_d,t)$: \begin{align} \label{ncm_robust_control} &(K^*,p^*) = \mathrm{arg}\min_{K\in \mathcal{C}_K,p\in\mathbb{R}}\|K\|^2_F+p^2 \\ &\text{s.t.{} } \int_{x_d}^x\delta q^{\top}(\dot{\mathcal{M}}+2\sym{}(\mathcal{M}A-\mathcal{M}BK))\delta q \\ \label{stability_clf} &\text{\textcolor{white}{s.t.{}} }\leq -2\alpha\int_{x_d}^x\delta q^{\top}( \mathcal{M}+\beta \mathrm{I})\delta q+p \end{align} where $\mathcal{M}$ defines the NCM of Definition~\ref{Def:NCM} that models $M$ of the CV-STEM contraction metric in Theorem~\ref{Thm:CV-STEM} as in \eqref{Eq:Merror_control}, $\mathcal{C}_K$ is a convex set containing admissible $K$, $\alpha$ is the contraction rate, and $\beta$ is as defined in theorem~\ref{Thm:CVSTEM:LMI} (i.e.{}, $\beta=0$ for deterministic systems and $\beta = \alpha_s$ for stochastic systems). Then Theorems~\ref{Thm:Robust_contraction_original} and~\ref{Thm:robuststochastic} still hold for the Lyapunov function defined in \eqref{eq_ncmclf}, yielding the following bounds: \begin{align} \label{Eq_NCM_CLF_bound} &\|\mathtt{e}(t)\|^2 \leq \frac{V_{\mathrm{NCM}}(0)}{\underline{m}}e^{-2\alpha_p t}+\frac{\frac{\bar{p}}{\underline{m}}+\frac{\bar{d}_c^2\overline{m}}{\alpha_d\underline{m}}}{2\alpha_p}(1-e^{-2\alpha_p t}) \\ \label{Eq_NCM_CLF_bound_sto} &\mathop{\mathbb{E}}\left[\|\mathtt{e}(t)\|^2\right] \leq \frac{\mathop{\mathbb{E}}[V_{\mathrm{NCM}}(0)]}{\underline{m}}e^{-2\alpha t}+\frac{C_C\overline{m}+\bar{p}}{2\alpha\underline{m}} \\ \label{Eq_NCM_CLF_bound_sto_prob} &\mathop{\mathbb{P}}\left[\|\mathtt{e}(t)\|\geq\varepsilon\right] \leq \frac{1}{\varepsilon^2}\left(\frac{\mathop{\mathbb{E}}[V_{\mathrm{NCM}}(0)]}{\underline{m}}e^{-2\alpha t}+\frac{C_C\overline{m}+\bar{p}}{2\alpha\underline{m}}\right)~~~~~~~~~~ \end{align} where $\bar{p}=\sup_{x,x_d,u_d,t}p$, $\underline{m}\mathrm{I}\preceq\mathcal{M}\preceq\overline{m}\mathrm{I}$ as in \eqref{Mcon}, $\alpha_d\in\mathbb{R}_{>0}$ is an arbitrary positive constant (see \eqref{Vncm_tochu1}) selected to satisfy $\alpha_p=\alpha-\alpha_d/2>0$, $C_C = \bar{g}_c^2({2}{\alpha_G}^{-1}+1)$, $\alpha_G\in\mathbb{R}_{>0}$ is an arbitrary constant as in Theorem~\ref{Thm:robuststochastic}, $\varepsilon\in\mathbb{R}_{\geq0}$, and the disturbance terms $\bar{d}_c$ and $\bar{g}_c$ are given in \eqref{ncm_original_dynamics} and \eqref{ncm_sdc_dynamics}, respectively. Note that the problem \eqref{ncm_robust_control} is feasible due to the constraint relaxation variable $p$. Furthermore, if $\epsilon_{\ell} = 0$ in \eqref{Eq:Merror_control}, \eqref{ncm_robust_control} with $p=0$ is always feasible, and the optimal feedback gain $K^*$ minimizes its Frobenius norm under the contraction constraint \eqref{stability_clf}. \end{theorem} \begin{proof} Computing $\dot{V}_{\mathrm{NCM}}$ for the deterministic system \eqref{ncm_original_dynamics} along with the virtual dynamics \eqref{virtual_dynamics_clf} and the stability condition \eqref{stability_clf} yields \begin{align} \dot{V}_{\mathrm{NCM}} \leq& -2\alpha V_{\mathrm{NCM}}+\bar{d}_c\sqrt{\overline{m}}\sqrt{V_{\mathrm{NCM}}}+\bar{p} \\ \label{Vncm_tochu1} \leq& -2(\alpha-\alpha_d/2) V_{\mathrm{NCM}}+\bar{d}_c^2\overline{m}/\alpha_d+\bar{p} \end{align} where the relation $2ab \leq \alpha_d^{-1}a^2+\alpha_d b^2$, which holds for any $a,b\in\mathbb{R}$ and $\alpha_d \in \mathbb{R}_{>0}$ ($a = \bar{d}_c\sqrt{\overline{m}}$ and $b = \sqrt{V_{\mathrm{NCM}}}$ in this case), is used to obtain the second inequality. Since we can arbitrarily select $\alpha_d$ to have $\alpha_p=\alpha-\alpha_d/2>0$, \eqref{Vncm_tochu1} gives the exponential bound \eqref{Eq_NCM_CLF_bound} due to the comparison lemma of Lemma~\ref{Lemma:comparison}. Similarly, computing $\mathscr{L}V_{\mathrm{NCM}}$ for the stochastic system \eqref{ncm_sdc_dynamics} yields \begin{align} \mathscr{L}V_{\mathrm{NCM}} \leq& -2\alpha V_{\mathrm{NCM}}+C_c\overline{m}+\bar{p} \end{align} which gives \eqref{Eq_NCM_CLF_bound_sto} and \eqref{Eq_NCM_CLF_bound_sto_prob} due to Lemma~\ref{Lemma:comparison_sto}. If $\epsilon_{\ell} = 0$ in \eqref{Eq:Merror_control}, $K = R^{-1}B^{\top}M$ satisfies \eqref{stability_clf} with $p=0$ as we have $\mathcal{M}=M$ and $M$ defines the contraction metric of Theorem~\ref{Thm:CV-STEM}, which implies that \eqref{ncm_robust_control} with $p=0$ is always feasible. \qed \end{proof} We could also use the CCM-based differential feedback formulation of Theorem~\ref{Thm:ccm_cvstem} in Theorem~\ref{Thm:ncm_clf} (see~\cite{ccm,7989693}). To this end, define $E_{\mathrm{NCM}}$ (Riemannian energy) as follows: \begin{align} \label{riemannian_energy} E = \int^1_0\gamma_{\mu}(\mu,t)^{\top}\mathcal{M}(\gamma(\mu,t),t)\gamma_{\mu}(\mu,t)d\mu \end{align} where $\mathcal{M}$ defines the NCM of Definition~\ref{Def:NCM} that models $M$ of the CCM in Theorem~\ref{Thm:ccm_cvstem}, $\gamma$ is the minimizing geodesic connecting $x(t)=\gamma(1,t)$ of \eqref{ncm_original_dynamics} and $x_d(t)=\gamma(0,t)$ of \eqref{ncm_sdc_dynamicsd} (see Theorem~\ref{Thm:path_integral}), and $\gamma_{\mu}={\partial \gamma}/{\partial \mu}$. \begin{theorem} \label{Thm:ncm_ccm_clf} Suppose $u=u^*$ of \eqref{ncm_original_dynamics} is designed by the following convex optimization for given $(x,x_d,u_d,t)$: \begin{align} \label{eq_ccm_clf} &(u^*,p^*) = \mathrm{arg}\min_{u\in \mathcal{C}_u,p\in\mathbb{R}}\|u-u_d\|^2+p^2 \\ \label{eq_ccm_clf_cond} &\text{s.t.{} }\frac{\partial E}{\partial t}+2\gamma_{\mu}(1,t)^{\top}\mathcal{M}(x,t)(f(x,t)+B(x,t)u) \\ &-2\gamma_{\mu}(0,t)^{\top}\mathcal{M}(x_d,t)(f(x_d,t)+B(x_d,t)u_d) \leq -2\alpha E+p \nonumber \end{align} where $\mathcal{M}$ defines the NCM of Definition~\ref{Def:NCM} that models the CCM of Theorem~\ref{Thm:ccm_cvstem}, and $\mathcal{C}_{u}$ is a convex set containing admissible $u$. Then the bound \eqref{Eq_NCM_CLF_bound} of Theorem~\ref{Thm:ncm_clf} holds. Furthermore, if $\epsilon_{\ell}=0$ for the NCM learning error $\epsilon_{\ell}$ in \eqref{Eq:Merror_control}, then the problem \eqref{eq_ccm_clf} with $p=0$ is always feasible, and $u^*$ minimizes the deviation of $u$ from $u_d$ under the contraction constraint \eqref{eq_ccm_clf_cond}. \end{theorem} \begin{proof} Since the right-hand side of \eqref{eq_ccm_clf_cond} represents $\dot{E}$ of \eqref{riemannian_energy} if $d_c=0$ in \eqref{ncm_original_dynamics}, the comparison lemma of Lemma~\ref{Lemma:comparison} gives \eqref{Eq_NCM_CLF_bound} as in Theorem~\ref{Thm:ncm_clf}. The rest follows from the fact that $u$ of Theorem~\ref{Thm:ccm_cvstem} is a feasible solution of \eqref{eq_ccm_clf} if $p=0$~\cite{ccm,7989693}. \end{proof} \begin{remark} As discussed in Remark~\ref{remark_ccm_kgamma}, Theorem~\ref{Thm:ncm_ccm_clf} can also be formulated in a stochastic setting as in Theorem~\ref{Thm:ncm_clf} using the technique discussed in~\cite{cdc_ncm}. \end{remark} Theorems~\ref{Thm:ncm_clf} and~\ref{Thm:ncm_ccm_clf} provide a perspective on the NCM stability different from Theorems~\ref{Thm:NCMstability1} and~\ref{Thm:NCMstability2} written in terms of the constraint relaxation variable $p$, by directly using the NCM as a contraction metric instead of the CV-STEM contraction metric or the CCM. Since the CLF problems are feasible with $p=0$ when we have zero NCM modeling error, it is implied that the upper bound of $p$ (i.e.{}, $\bar{p}$ in \eqref{Eq_NCM_CLF_bound} and \eqref{Eq_NCM_CLF_bound_sto}) decreases as we achieve a smaller learning error $\epsilon_{\ell}$ using more training data for verifying \eqref{Eq:Merror_control} (see Remark~\ref{remark_learning_error}). This intuition will be formalized later in Theorem~\ref{data_driven_cont_thm} of Sec.~\ref{Sec:datadriven}~\cite{boffi2020learning}. See~\cite{ccm,7989693} for how we compute the minimizing geodesic $\gamma$ and its associated Riemannian energy $E$ in Theorem~\ref{Thm:ncm_ccm_clf}. \begin{example} If $\mathcal{C}_K=\mathbb{R}^{m\times n}$ and $\mathcal{C}_u=\mathbb{R}^{m}$ in \eqref{ncm_robust_control} and \eqref{eq_ccm_clf}, respectively, they can both be expressed as the following quadratic optimization problem: \begin{align} &v^* = \mathrm{arg}\min_{v\in\mathbb{R}^\mathtt{v}} \frac{1}{2}v^{\top}v+c(x,x_d,u_d,t)^{\top}v \\ &\text{s.t.{} } \varphi_0(x,x_d,u_d,t)+\varphi_1(x,x_d,u_d,t)^{\top}v \leq 0 \end{align} by defining ${c}\in\mathbb{R}^{\mathtt{v}}$, $\varphi_0\in\mathbb{R}$, $\varphi_1\in\mathbb{R}^{\mathtt{v}}$, and $v\in\mathbb{R}^\mathtt{v}$ appropriately. Applying the KKT condition~\cite[pp. 243-244]{citeulike:163662} to this problem, we can show that \begin{align} v^* = \begin{cases} -c-\frac{\varphi_0-\varphi_1^{\top}c}{\varphi_1^{\top}\varphi_1}\varphi_1 & \text{if }\varphi_0-\varphi_1^{\top}c > 0 \\ -c & \text{otherwise}. \end{cases} \end{align} This implies that the controller utilizes $u_d$ with the feedback term $(({\varphi_0-\varphi_1^{\top}c})/{\varphi_1^{\top}\varphi_1})\varphi_1$ only if $\dot{x}=f(x,t)+B(x,t)u$ with $u=u_d$ is not contracting, i.e.{}, $\varphi_0-\varphi_1^{\top}c > 0$. \end{example} \begin{example} When $q$ is parameterized linearly by $\mu$ in Theorem~\ref{Thm:ncm_clf}, i.e.{}, $q = \mu x+(1-\mu)x_d$, we have $V_{\mathrm{NCM}}=(x-x_d)^{\top}\mathcal{M}(x-x_d)$ as in the standard Lyapunov function formulation~\cite{doi:10.1137/0321028,SONTAG1989117,Khalil:1173048}. Also, a linear input constraint, $u_{\min} \leq u \leq u_{\max}$ can be implemented by using \begin{align} \mathcal{C}_K =& \{K\in\mathbb{R}^{m\times n}|u_d-u_{\max} \leq K\mathtt{e} \leq u_d-u_{\min}\} \\ \mathcal{C}_u =& \{u\in\mathbb{R}^{m}|u_{\min} \leq u \leq u_{\max}\} \end{align} in \eqref{ncm_robust_control} and \eqref{eq_ccm_clf}, respectively. \end{example} \begin{remark} For the CV-STEM and NCM state estimation in Theorems~\ref{Thm:CV-STEM-estimation}, \ref{Thm:NCMstability1_est}, and \ref{Thm:NCMstability2}, we could design a similar Lyapunov function-based estimation scheme if its contraction constraints of Theorem~\ref{Thm:CV-STEM-estimation} do not explicitly depend on the actual state $x$. This can be achieved by using $A(\varrho_A,\hat{x},t)$ and $C(\varrho_C,\hat{x},t)$ instead of $A(\varrho_A,x,\hat{x},t)$ and $C(\varrho_C,x,\hat{x},t)$ in Theorem~\ref{Thm:CV-STEM-estimation} as in Theorem~\ref{Thm:fixed_sdc}~\cite{Ref:Stochastic}, leading to exponential boundedness of system trajectories as derived in~\cite{mypaperTAC,Ref:Stochastic,mypaper}. \end{remark} \subsection{Remarks in NCM Implementation} \label{Sec:SN} This section briefly summarizes several practical techniques in constructing NCMs using the CV-STEM of Theorems~\ref{Thm:CV-STEM},~\ref{Thm:CV-STEM-estimation}, and~\ref{Thm:ccm_cvstem}. \subsubsection{Neural Network Training} \label{data_preprocessing} We model $M$ of the CV-STEM contraction metric sampled offline by the DNN of Definition~\ref{NN_definition}, optimizing its hyperparameters by stochastic gradient descent~\cite{sgd,beyondconvexity} to satisfy the learning error condition \eqref{Eq:learning_error} (see Remark~\ref{remark_learning_error}). The positive definiteness of $M$ could be exploited to reduce the dimension of the DNN target output due to the following lemma~\cite{ncm}. \begin{lemma} \label{cholesky} A matrix $A \succ 0$ has a unique Cholesky decomposition, i.e.{}, there exists a unique upper triangular matrix $U\in\mathbb{R}^{n\times n}$ with strictly positive diagonal entries s.t.{} $A = U^TU$. \end{lemma} \begin{proof} See~\cite[pp. 441]{10.5555/2422911}. \end{proof} Selecting $\Theta$ of $M=\Theta^{\top}\Theta$ as the unique Cholesky decomposition of $M$ and training the DNN using only the non-zero entries of $\Theta$, we can reduce the dimension of the target output by $n(n-1)/2$ without losing any information on $M$. The pseudocode to obtain NCMs, using this approach depicted in Fig.~\ref{ncmdrawing}, can be found in~\cite{ncm}. Instead of solving the convex optimization in Theorems~\ref{Thm:CV-STEM},~\ref{Thm:CV-STEM-estimation}, and~\ref{Thm:ccm_cvstem} to sample training data, we could also use them directly for training and optimizing the DNN hyperparameters, treating the constraints and the objective functions as the DNN loss functions as demonstrated in~\cite{chuchu}. Although this approach no longer preserves the convexity and can lead only to a sub-optimal solution, this still gives the exponential tracking error bounds as long as we can get sufficiently small $\epsilon_{\ell0}$ and $\epsilon_{\ell1}$ in the learning error assumption \eqref{Eq:learning_error}, as discussed in Theorems~\ref{Thm:contraction_learning},~\ref{Thm:contraction_learning_sto}, and~\ref{Thm:NCMstability1}--\ref{Thm:NCMstability2}. See~\cite{cdc_ncm} for more details on the robustness and stability properties of this approach. \subsubsection{Lipschitz Condition and Spectral Normalization} \label{sec_sn_nscm} Let us first define a spectrally-normalized DNN, a useful mathematical tool designed to overcome the instability of network training by constraining \eqref{neuralnet} of Definition~\ref{NN_definition} to be Lipschitz, i.e.{}, $\exists \ L_{nn} \in\mathbb{R}_{\geq0}$ s.t.{} $\|\varphi(x)-\varphi(x')\| \leq L_{nn}\|x-x'\|,~\forall x,x'$~\cite{miyato2018spectral,neurallander}. \begin{definition} \label{Def:SN} A spectrally-normalized DNN is a DNN of Definition~\ref{NN_definition} with its weights $W_{\ell}$ normalized as $W_{\ell} = (C_{nn}\Omega_{\ell})/\|\Omega_{\ell}\|$, where $C_{nn} \in\mathbb{R}_{\geq0}$ is a given constant. \end{definition} \begin{lemma} \label{Thm:SNneuralnet} A spectrally-normalized DNN given in Definition~\ref{Def:SN} is Lipschitz continuous with its 2-norm Lipschitz constant $C_{nn}^{L+1}L_{\sigma}^L$, where $L_{\sigma}$ is the Lipschitz constant of the activation function $\sigma$ in \eqref{neuralnet}. Also, it is robust to perturbation in its input. \end{lemma} \begin{proof} Let $\|f\|_{\mathrm{Lip}}$ represent the Lipschitz constant of a function $f$ and let $W_{\ell} = (C_{nn}\Omega_{\ell})/\|\Omega_{\ell}\|$. Using the property $\|f_1 \circ f_2\|_{\mathrm{Lip}} \leq \|f_1\|_{\mathrm{Lip}}\|f_2\|_{\mathrm{Lip}}$, we have for a spectrally-normalized DNN in Definition~\ref{Def:SN} that \begin{align} \|\varphi(x;W_{\ell})\| \leq \|\sigma\|_{\mathrm{Lip}}^L\prod_{\ell = 1}^{L+1}\|T_{\ell}\|_{\mathrm{Lip}} = L_{\sigma}^L\prod_{\ell = 1}^{L+1}\|W_{\ell}\| \end{align} where we used the fact that $\|f\|_{\mathrm{Lip}}$ of a differentiable function $f$ is equal to the maximum spectral norm (induced $2$-norm) of its gradient over its domain to obtain the last equality. Since $\|W_{\ell}\|=C_{nn}$ holds, the Lipschitz constant of $\varphi(x_i;W_{\ell})$ is $C_{nn}^{L+1}L_{\sigma}^L$ as desired. Since $\varphi$ is Lipschitz, we have for small perturbation $x_{\epsilon}$ that \begin{align} \|\varphi(x+x_{\epsilon};W_{\ell})-\varphi(x;W_{\ell})\| \leq& C_{nn}^{L+1}L_{\sigma}^L\|(x+x_{\epsilon})-x\| \\ =& C_{nn}^{L+1}L_{\sigma}^L\|x_{\epsilon}\| \end{align} implying robustness to input perturbation. \qed \end{proof} In general, a spectrally-normalized DNN is useful for improving the robustness and generalization properties of DNNs, and for obtaining the learning error bound as in \eqref{Eq:learning_error}, as delineated in Remark~\ref{remark_learning_error}~\cite{miyato2018spectral,marginbounds1,marginbounds2}. Using it for system identification yields a DNN-based nonlinear feedback controller with a formal stability guarantee as shall be seen in Sec.~\ref{Sec:neurallander}. For the NCM framework with stochastic perturbation, we can utilize the spectrally-normalized DNN of Definition~\ref{Def:SN} to guarantee the Lipschitz condition on $\partial M/\partial x_i$, appeared in the stochastic contraction condition of Theorem~\ref{Thm:robuststochastic} (see Proposition~1 of~\cite{nscm}). We could also utilize the technique proposed in~\cite{revay2020lipschitz,revay2021recurrent}, which designs Lipschitz-bounded equilibrium neural networks using contraction theory, for obtaining a result analogous to Lemma~\ref{Thm:SNneuralnet}. The pseudocode for the NCM construction in a stochastic setting can be found in~\cite{nscm}. \if0 \begin{theorem} \label{sn_proposition} Suppose that $\sigma(x) = \tanh(x)$ in \eqref{neuralnet} of Definition~\ref{NN_definition}. Let $\vartheta(x;W_{sn})$ be a DNN \eqref{neuralnet} to model $\theta(x)$ in Sec.~\ref{data_preprocessing}, and $N_{\rm units}$ be the number of neurons in its last layer. Also, let $W_{sn}=\{W_{\ell}\}_{\ell=1}^{L+1}$, where \begin{align} W_{\ell} = \begin{cases} (\Omega_{\ell}/\|\Omega_{\ell}\|)C_{nn} & (1\leq\ell\leq L) \\ \sqrt{\overline{m}}(\Omega_{\ell}/\|\Omega_{\ell}\|)/\sqrt{N_{\rm units}} & (\ell=L+1). \end{cases} \end{align} If $\exists C_{nn},L_{m} \in \mathbb{R}_{\geq 0}$ s.t.{} the following relation holds: \begin{align} 2\left\|\vartheta_{x_i}\right\|\left\|\vartheta_{x_j}\right\|+2\|\vartheta\|\|\vartheta_{x_i x_j}\| \leq L_{m},~\forall i,j,x,\Omega \end{align} where $\vartheta_{x_i}=\partial \vartheta/\partial x_i$, $\vartheta_{x_i x_j}=\partial^2 \vartheta/(\partial x_i\partial x_j)$, and the arguments $(x;W_{sn})$ are omitted for notational simplicity, then we have $\|\mathcal{M}\| \leq \overline{m}$ and $\|\partial^2\mathcal{M}/(\partial x_i\partial x_j)\|\leq L_{m},~\forall x_i,x_j$, where $\mathcal{M}$ defines the NCM of the CV-STEM contraction metric given by $M(x)$ of Definition~\ref{Def:NCM}. The latter inequality implies $\mathcal{M}_{x_i}=\partial M/\partial x_i,~\forall i$ is indeed Lipschitz continuous with 2-norm Lipschitz constant $L_m$. \end{theorem} \begin{proof} See~\cite{nscm}. \qed \end{proof} \fi \begin{figure} \centering \includegraphics[width=35mm]{figures/rocket.pdf} \caption{Rocket model (angle of attack $\varphi$, pitch rate $q$).} \label{rocket_model} \end{figure} \begin{table} \caption{Notations in Example~\ref{ex:rocket}. \label{tab:notations_rocket}} \footnotesize \begin{center} \renewcommand{\arraystretch}{1.2} \begin{tabular}{ |c|l| } \hline $\varphi$ & angle of attack (state variable) \\ \hline $q$ & pitch rate (state variable) \\ \hline $u$ & tail fin deflection (control input) \\ \hline $y$ & measurement \\ \hline $M$ & Mach number \\ \hline $p_0$ & static pressure at 20,000 ft \\ \hline $S$ & reference area \\ \hline $d$ & reference diameter \\ \hline $I_y$ & pitch moment of inertia \\ \hline $g$ & acceleration of gravity \\ \hline $m$ & rocket mass \\ \hline $V$ & rocket speed \\ \hline \end{tabular} \end{center} \end{table} \begin{example} \label{ex:rocket} Let us demonstrate how having the Lipschitz condition on $\partial M/\partial x_i$ in Theorem~\ref{Thm:robuststochastic} would affect the NCM-based control and estimation performance. We consider a rocket autopilot problem perturbed by stochastic disturbances as in~\cite{nscm}, the unperturbed dynamics of which is depicted in Fig.~\ref{rocket_model} and given as follows, assuming that the pitch rate $q$ and specific normal force are available as a measurement via rate gyros and accelerometers~\cite{doi:10.2514/3.20997,doi:10.2514/6.1997-3641}: \begin{align} \label{rocket_eq} \dfrac{d}{dt}\begin{bmatrix}\varphi \\ q\end{bmatrix} =& \begin{bmatrix}\frac{gC(M)\cos(\varphi)\phi_z(\varphi,M)}{mV}+q \\ \frac{C(M)d\phi_m(\varphi)}{I_{y}}\end{bmatrix}+\begin{bmatrix}\frac{gC(M)\bar{d}_n\cos(\varphi)}{mV} \\ \frac{C(M)\bar{d}_m}{I_{y}}\end{bmatrix}u \\ \label{rocket_ms} y =& \begin{bmatrix}q\\\frac{C(M)\phi_z(\varphi,M)}{m}\end{bmatrix}+\begin{bmatrix}0\\\frac{C(M)\bar{d}_n}{m}\end{bmatrix}u \end{align} where $C(M) = p_0M^2S$, $\phi_z(\varphi,M)=0.7(a_n\varphi^3+b_n\varphi|\varphi|+c_n(2+M/3)\varphi)$, $\phi_m(\varphi,M)=0.7(a_m\varphi^3+b_m\varphi|\varphi|-c_m(7-8M/3)\varphi)$, $\bar{d}_n=0.7d_n$, $\bar{d}_m=0.7d_m$, $(a_n,b_n,c_n,d_n)$ and $(a_m,b_m,c_m,d_m)$ are given in~\cite{doi:10.2514/6.1997-3641}, and the notations are defined in Table~\ref{tab:notations_rocket}. Since this example explicitly takes into account stochastic perturbation, the spectrally-normalized DNN of Definition~\ref{Def:SN} is used to guarantee the Lipschitz condition of Theorem~\ref{Thm:robuststochastic} by Lemma~\ref{Thm:SNneuralnet}. Figure~\ref{est_con_sim} shows the state estimation and tracking error performance of each estimator and controller, where the NSCM is the stochastic counterpart of the NCM aforementioned in Remark~\ref{remark_NSCM_notation}. It is demonstrated that the steady-state errors of the NSCM and CV-STEM are indeed smaller than its steady-state upper bounds of Theorems~\ref{Thm:CV-STEM} and~\ref{Thm:CV-STEM-estimation} (solid black line), while the other controllers violate this condition. In particular, the optimal contraction rate of the deterministic NCM for state estimation is turned out to be much larger than the NSCM as it does not account for stochastic perturbation, which makes the NCM trajectory diverge around $t=5.8$ in Fig.~\ref{est_con_sim}. The NSCM circumvents this difficulty by imposing the Lipschitz condition on $\partial M/\partial x_i$ as in Theorem~\ref{Thm:robuststochastic} using spectral normalization of Lemma~\ref{Thm:SNneuralnet}. See~\cite{nscm} for additional details. \end{example} \begin{figure} \centering \includegraphics[width=88mm]{figures/est_and_con.pdf} \caption{Rocket state estimation and tracking errors in Example~\ref{ex:rocket} ($x = [\varphi,q]^T$).} \label{est_con_sim} \end{figure} \section{Learning-based Robust Motion Planning} \label{Sec:lagros} The CV-STEM and NCM are also useful for designing a real-time robust motion planning algorithm for systems perturbed by deterministic and stochastic disturbances as in \eqref{ncm_original_dynamics} and \eqref{ncm_sdc_dynamics}. The purpose of this section is not for proposing a new motion planner to compute $x_d$ and $u_d$ of \eqref{ncm_sdc_dynamicsd}, but for augmenting existing motion planners with real-time learning-based robustness and stability guarantees via contraction theory. \subsection{Overview of Existing Motion Planners} \begin{table*} \caption{Comparison of LAG-ROS~\cite{lagros} with the Learning-based and Robust Tube-based Motion Planners. \label{learning_summary}} \footnotesize \begin{center} \begin{tabular}{|l|l|l|l|} \hline Motion planning scheme & Control policy & State tracking error $\|x-x_d\|$ & Computational load \\ \hline \hline \ref{itemFF} Learning-based & $(o_{\ell},t) \mapsto u_d$ & Increases exponentially (Theorem~\ref{Thm:naive_learning}) & One DNN evaluation \\ \ref{itemMP} Robust tube-based & $(x,x_d,u_d,t) \mapsto u^*$ & Exponentially bounded (Theorems~\ref{Thm:CV-STEM},~\ref{Thm:ccm_cvstem},~\ref{Thm:ncm_clf},~\ref{Thm:ncm_ccm_clf}) & Computation of $(x_d,u_d)$ \\ \ref{itemLAGROS} LAG-ROS & $(x,o_{\ell},t) \mapsto u^*$ & Exponentially bounded (Theorem~\ref{Thm:lagros_stability}) & One DNN evaluation \\ \hline \end{tabular} \end{center} \end{table*} Let us briefly review the following standard motion planning techniques and their limitations: \setlength{\leftmargini}{17pt} \begin{enumerate}[label={\color{caltechgreen}{(\alph*)}}] \setlength{\itemsep}{1pt} \setlength{\parskip}{0pt} \item Learning-based motion planner (see, e.g.{},~\cite{glas,8593871,NIPS2017_766ebcd5,9001182,NIPS2016_cc7e2b87,8578338,7995721}): $(o_{\ell}(x,o_g),t) \mapsto u_d(o_g,t)$, modeled by a DNN, where $o_g\in\mathbb{R}^{g}$ is a vector containing global environment information, and $o_{\ell}:\mathbb{R}^n\times\mathbb{R}^g\mapsto\mathbb{R}^{\ell}$ with $\ell \leq g$ is local environment information extracted from $o_g \in \mathbb{R}^g$~\cite{glas}. \label{itemFF} \item Robust tube-based motion planner (see, e.g.{},~\cite{7989693,10.1007/BFb0109870,tube_mpc,tube_nmpc,doi:10.1177/0278364914528132,9290355,ccm,mypaperTAC,ncm,nscm,chuchu,8814758,9303957,L1contraction2,sun2021uncertaintyaware,mypaper,zhao2021tubecertified}): $(x,x_d,u_d,t) \mapsto u^*$, where $u^*$ is a robust feedback tracking controller given by Theorems~\ref{Thm:CV-STEM},~\ref{Thm:ccm_cvstem},~\ref{Thm:ncm_clf},~or~\ref{Thm:ncm_ccm_clf}.\label{itemMP} \end{enumerate} \begin{figure} \centering \includegraphics[width=85mm]{figures/Slide3.pdf} \caption{Block diagram of tube-based motion planning using contraction theory.} \label{slide3_mp} \end{figure} The robust tube-based motion planner~\ref{itemMP} ensures that the perturbed trajectories $x$ of \eqref{ncm_original_dynamics} and \eqref{ncm_sdc_dynamics} stay in an exponentially bounded error tube around the target trajectory $x_d$ of \eqref{ncm_sdc_dynamicsd}~\cite{ccm,7989693,mypaperTAC,ncm,nscm,chuchu,8814758,9303957,L1contraction2,sun2021uncertaintyaware,mypaper,zhao2021tubecertified} given as in Fig.~\ref{slide3_mp}, using Theorems~\ref{Thm:Robust_contraction_original} and~\ref{Thm:robuststochastic}. However, it requires the online computation of $(x_d,u_d)$ as an input to their control policy given in Theorems~\ref{Thm:CV-STEM},~\ref{Thm:ccm_cvstem},~\ref{Thm:ncm_clf}, and~\ref{Thm:ncm_ccm_clf}, which is not realistic for systems with limited computational resources. The learning-based motion planner~\ref{itemFF} circumvents this issue by modeling the target policy $(o_{\ell},t) \mapsto u_d$ by a DNN. In essence, our approach, to be proposed in Theorem~\ref{Thm:lagros_stability}, is for providing~\ref{itemFF} with the contraction theory-based stability guarantees of~\ref{itemMP}, thereby significantly enhancing the performance of~\ref{itemFF} that only assures the tracking error $\|x-x_d\|$ to be bounded by a function which increases exponentially with time, as derived previously in Theorem~\ref{Thm:naive_learning} of Sec.~\ref{Sec:learning_stability}. \subsection{Stability Guarantees of LAG-ROS} The method of LAG-ROS $-$ for Learning-based Autonomous Guidance with RObustness and Stability guarantees~\cite{lagros}, bridges the gap between~\ref{itemFF} and~\ref{itemMP} by ensuring that the distance between the target and controlled trajectories to be exponentially bounded. \setlength{\leftmargini}{17pt} \begin{enumerate}[label={\color{caltechgreen}{(\alph*)}},start=3] \setlength{\itemsep}{2pt} \setlength{\parskip}{0pt} \item LAG-ROS (see Fig.~\ref{lagrosdrawing} and~\cite{lagros}): $(x,o_{\ell}(x,o_g),t) \mapsto u^*(x,x_d(o_g,t),u_d(o_g,t),t)$, modeled by $u_L$ to be given in Theorem~\ref{Thm:lagros_stability}, where $u^*(x,x_d,u_d,t)$ of \ref{itemMP} is viewed as a function of $(x,o_{\ell},t)$.\label{itemLAGROS} \end{enumerate} Table~\ref{learning_summary} summarizes the differences of the existing motion planners~\ref{itemFF} and~\ref{itemMP} from~\ref{itemLAGROS}, which is defined as follows. \begin{definition} \label{Def:lagros} ~Learning-based Autonomous Guidance with RObustness and Stability guarantees (LAG-ROS) is a DNN model for approximating a function which maps state $x$, local environment information $o_{\ell}$, and time $t$ to an optimal robust feedback control input $u^*$ given by \eqref{controller} of Theorem~\ref{Thm:CV-STEM}, i.e.{}, $u^*=u_d-K(x-x_d)$, or \eqref{ccm_controller} of Theorem~\ref{Thm:ccm_cvstem}, i.e.{}, $u=u_d+\int_{0}^1kd\mu$, where its training data is sampled as explained in Sec.~\ref{sec_robust_sampling} (see Figures~\ref{samplingfig},~\ref{slide4_data}, and~\ref{lagrosdrawing}). \end{definition} The LAG-ROS in Definition~\ref{Def:lagros} achieves online computation of $u$ without solving a motion planning problem, and it still possesses superior robustness and stability properties due to its internal contracting architecture~\cite{lagros}. \begin{theorem} \label{Thm:lagros_stability} Let $u_L=u_L(x,o_{\ell}(x,o_g),t)$ be the LAG-ROS in Definition~\ref{Def:lagros}, and let $u^*$ be given by \eqref{controller} of Theorem~\ref{Thm:CV-STEM}, i.e.{}, $u^*=u_d-K(x-x_d)$, or \eqref{ccm_controller} of Theorem~\ref{Thm:ccm_cvstem}, i.e.{}, $u^*=u_d+\int^1_{0}kd\mu$. Define $\Delta_L$ of Theorems~\ref{Thm:contraction_learning} and \ref{Thm:contraction_learning_sto} as follows: \begin{align} \label{Eq:DeltaL_lagros} \Delta_L = B(u_L(x,o_{\ell}(x,o_g),t)-u^*(x,x_d(o_g,t),u_d(o_g,t),t)) \end{align} where $B=B(x,t)$ is the actuation matrix given in \eqref{ncm_original_dynamics} and \eqref{ncm_sdc_dynamics}. Note that we use $q(0,t)=\xi_0(t)=x_d(o_g,t)$ and $q(1,t)=\xi_1(t)=x(t)$ in the learning-based control formulation of Theorems~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto}. If the LAG-ROS $u_L$ is learned to satisfy \eqref{Eq:learning_error} with $\epsilon_{\ell1}=0$, i.e.{}, $\|\Delta_L\| \leq \epsilon_{\ell0}$ for all $x\in\mathcal{S}_s$, $o_g\in\mathcal{S}_o$, and $t\in\mathcal{S}_t$, where $\mathcal{S}_s\subseteq\mathbb{R}^n$, $\mathcal{S}_o\subseteq\mathbb{R}^{g}$, and $\mathcal{S}_t\subseteq\mathbb{R}_{\geq0}$ are some compact sets, and if the control-affine nonlinear systems \eqref{ncm_original_dynamics} and \eqref{ncm_sdc_dynamics} are controlled by $u=u_L$, then \eqref{cont_learning_bound} of Theorem~\ref{Thm:contraction_learning} and \eqref{cont_learning_bound_sto} of Theorem~\ref{Thm:contraction_learning_sto} hold with $\bar{d}$ and $\bar{g}$ replaced as in \eqref{Eq:NCM_control_bound}, i.e.{}, we have the following for $\mathtt{e}(t)=x(t)-x_d(o_g,t)$: \begin{align} \label{learning_bound_lagros} &\|\mathtt{e}(t)\| \leq \frac{V_{\ell}(0)}{\sqrt{\underline{m}}}e^{-\alpha t}+\frac{\bar{d}_{\epsilon_{\ell}}}{\alpha}\sqrt{\frac{\overline{m}}{\underline{m}}}(1-e^{-\alpha t})=r_{\ell}(t)~~~~~~~~ \\ \label{learning_bound_lagros_sto} &\mathop{\mathbb{E}}\left[\|\mathtt{e}(t)\|^2\right] \leq \frac{\mathop{\mathbb{E}}[V_{s\ell}(0)]}{\underline{m}}e^{-2\alpha t}+\frac{C_{\epsilon_{\ell}}}{2\alpha}\frac{\overline{m}}{\underline{m}}=r_{s\ell}(t) \\ \label{learning_bound_lagros_sto_prob} &\mathop{\mathbb{P}}\left[\|\mathtt{e}(t)\|\geq\varepsilon\right] \leq \frac{1}{\varepsilon^2}\left(\frac{\mathop{\mathbb{E}}[V_{s\ell}(0)]}{\underline{m}}e^{-2\alpha t}+\frac{C_{\epsilon_{\ell}}}{2\alpha}\frac{\overline{m}}{\underline{m}}\right) \end{align} where $x_d=x_d(o_g,t)$ and $u_d=u_d(o_g,t)$ are as given in \eqref{ncm_sdc_dynamicsd}, $\bar{d}_{\epsilon_{\ell}}=\epsilon_{\ell0}+\bar{d}_c$, $C_{\epsilon_{\ell}} = \bar{g}_c^2({2}{\alpha_G}^{-1}+1)+\epsilon_{\ell0}^2\alpha_d^{-1}$, and the other variables are as defined in Theorems~\ref{Thm:contraction_learning} and \ref{Thm:contraction_learning_sto} with the disturbance terms in \eqref{Eq:NCM_control_bound} of Theorem~\ref{Thm:NCMstability1}. \end{theorem} \begin{proof} We have $f(x,t)+B(x,t)u_L=f(x,t)+B(x,t)u^*+B(x,t)(u_L-u^*)$ and $\|\Delta_L\|=\|B(x,t)(u_L-u^*)\| \leq \epsilon_{\ell0}$ by \eqref{Eq:learning_error} with $\epsilon_{\ell1}=0$ for $x_d=x_d(o_g,t)$ and $u_d=u_d(o_g,t)$. Since the virtual system which has $x$ of $\dot{x} = f(x,t)+B(x,t)u^*$ and $x_d$ of \eqref{ncm_sdc_dynamicsd} as its particular solutions is contracting due to Theorems~\ref{Thm:CV-STEM} or~\ref{Thm:ccm_cvstem}, the application of Theorems~\ref{Thm:contraction_learning} and \ref{Thm:contraction_learning_sto} yields the desired relations \eqref{learning_bound_lagros}--\eqref{learning_bound_lagros_sto_prob}. \qed \end{proof} Due to its internal feedback structure, the LAG-ROS achieves exponential boundedness of the trajectory tracking error as in Theorem~\ref{Thm:lagros_stability}, thereby improving the performance of existing learning-based feedforward control laws to model $(o_{\ell},t)\mapsto u_d$ as in~\ref{itemFF}, whose tracking error bound increases exponentially with time as in Theorem~\ref{Thm:naive_learning} (see~\cite{lagros}). This property enables its use in safety-critical guidance and control tasks which we often encounter in modern machine learning applications. \begin{example} \label{ex:cartpole} \begin{figure} \centerline{ \subfloat{\includegraphics[clip, width=25mm]{figures/cartpole.pdf}} \hfil \subfloat{\includegraphics[clip, width=40mm]{figures/cp_dist.pdf}} } \caption{Cart-pole balancing task: $x=[p,\theta,\dot{p},\dot{\theta}]^{\top}$, $x$ and $x_d$ are given in \eqref{ncm_original_dynamics} and \eqref{ncm_sdc_dynamicsd}, \ref{itemFF}--\ref{itemLAGROS} are given in Table~\ref{learning_summary}, and $r_{\ell}$ is given in \eqref{exp_bound_cp}. The shaded area denotes the standard deviation ($+1\sigma$ and $-0.5\sigma$).} \label{lagros_cp_dist_fig} \end{figure} Let us consider the cart-pole balancing task in Fig.~\ref{lagros_cp_dist_fig}, perturbed externally by deterministic perturbation, to demonstrate the differences of \ref{itemFF}--\ref{itemLAGROS} summarized in Table~\ref{learning_summary}. Its dynamical system is given in~\cite{ancm,6313077} with its values defined in~\cite{6313077}. The target trajectories $(x_d,u_d)$ are sampled with the objective function $\int_0^{T}\|u\|^2dt$, and the LAG-ROS of Theorem~\ref{Thm:lagros_stability} is modeled by a DNN independently of the target trajectory as detailed in~\cite{lagros}. The environment information $o_g$ is selected as random initial and target terminal states, and we let $V_{\ell}(0)=0$ and $\epsilon_{\ell0}+\bar{d}_c = 0.75$ in \eqref{learning_bound_lagros} of Theorem~\ref{Thm:lagros_stability}, yielding the following exponential bound: \begin{align} \label{exp_bound_cp} r_{\ell}(t) = \frac{V_{\ell}(0)}{\sqrt{\underline{m}}}+\frac{\bar{d}_{\epsilon_{\ell}}}{\alpha}\sqrt{\frac{\overline{m}}{\underline{m}}}(1-e^{-\alpha t}) = 3.15(1-e^{-0.60 t})~~~~~~ \end{align} where $\bar{d}_{\epsilon_{\ell}}=\epsilon_{\ell0}+\bar{d}_c$. Figure~\ref{lagros_cp_dist_fig} shows the tracking errors of each motion planner averaged over $50$ simulations at each time instant $t$. The LAG-ROS \ref{itemLAGROS} and robust tube-based planner~\ref{itemMP} indeed satisfy the bound \eqref{exp_bound_cp} (dotted black curve) for all $t$ with a small standard deviation $\sigma$, unlike learning-based motion planner~\ref{itemFF} with a diverging bound in Theorem~\ref{Thm:naive_learning} and increasing deviation $\sigma$. This example demonstrates one of the major advantages of contraction theory, which enables such quantitative analysis on robustness and stability of learning-based planners. \end{example} As implied in Example~\ref{ex:cartpole}, the LAG-ROS indeed possesses the robustness and stability guarantees of $u^*$ as proven in Theorem~\ref{Thm:lagros_stability}, unlike~\ref{itemFF}, while retaining significantly lower computational cost than that of~\ref{itemMP}. See~\cite{lagros} for a more detailed discussion of this simulation result. \if0 Also, Table~\ref{lagros_cp_tab} shows the control performance and computational cost of \ref{itemFF}--\ref{itemLAGROS}, which is a good summary of their differences and trade-offs aforementioned in Table~\ref{learning_summary}. Note that the success of the cart-pole balancing task is defined as the situation where the cart reaches a given random target terminal state $x_f$, within a given time horizon, and the success rate is computed as the percentage of successful trials in the total $50$ simulations. \setlength{\leftmargini}{17pt} \begin{itemize} \setlength{\itemsep}{1pt} \setlength{\parskip}{0pt} \item \ref{itemFF} directly approximates $u_d$ of \eqref{ncm_sdc_dynamicsd}, and thus requires lower computational cost $\Delta t=0.03$(s) with a smaller objective value $\int \|u\|^2dt=479$, but robustness is not guaranteed (Theorem~\ref{Thm:naive_learning}) resulting in a $40\%$ success rate. \item \ref{itemMP} computes $u^*$ of Theorem~\ref{Thm:lagros_stability}, and thus possesses robustness as in Fig.~\ref{lagros_cp_dist_fig} resulting in a $100\%$ success rate, but requires larger $\Delta t=0.1$(s) to compute $x_d$. \item \ref{itemLAGROS} approximates $u^*$ independently of $x_d$, and thus possesses robustness of Theorem~\ref{Thm:lagros_stability} as in Fig.~\ref{lagros_cp_dist_fig} resulting in a $100\%$ success rate, even with $\Delta t = 0.03$(s) as small as that of \ref{itemMP}. \end{itemize} \renewcommand{\arraystretch}{1.1} \begin{table} \caption{Control Performances for Cart-Pole Balancing ($\bar{d}_{\epsilon_{\ell}}=0.75$). \\ Note that $\Delta t$ denotes the computational time measured for the Macbook Pro laptop (2.2 GHz Intel Core i7, 16 GB 1600 MHz DDR3 RAM). \label{lagros_cp_tab}} \footnotesize \begin{center} \begin{tabular}{|l|c|c|c|c|} \hline & Success rate (\%) & $\int \|u(t)\|^2dt$ & $\Delta t$ (s) \\ \hline \hline \ref{itemFF} & $40.0$ & $4.79 \times 10^2$ & $3.01\times 10^{-2}$ \\ \ref{itemMP} & $100.0$ & $5.19 \times 10^2$ & $1.00\times 10^{-1}$ \\ \ref{itemLAGROS} & $100.0$ & $5.67 \times 10^2$ & $3.01\times 10^{-2}$ \\ \hline \end{tabular} \end{center} \end{table} \renewcommand{\arraystretch}{1.0} \fi \subsection{Tube-based State Constraint Satisfaction} \label{sec_robust_sampling} We exploit the result of Theorem~\ref{Thm:lagros_stability} in the tube-based motion planning~\cite{7989693} for generating LAG-ROS training data, which satisfies given state constraints even under the existence of the learning error and disturbance of Theorem~\ref{Thm:contraction_learning}. In particular, we sample target trajectories $(x_d,u_d)$ of \eqref{ncm_sdc_dynamicsd} in $\mathcal{S}_s\times\mathcal{S}_u$ of Theorem~\ref{Thm:lagros_stability} by solving the following, assuming the learning error $\epsilon_{\ell0}$ and disturbance upper bound $\bar{d}_c$ of Theorem~\ref{Thm:lagros_stability} are selected \textit{a priori}~\cite{neurallander}: \begin{align} \label{tube_motion_plan} &\min_{\substack{\bar{x}=\bar{x}(o_g,t)\\\bar{u}=\bar{u}(o_g,t)}}~\int_{0}^{T}c_0\|\bar{u}\|^2+c_1P(\bar{x},\bar{u},t)dt \\ &\text{s.t.{} $\dot{\bar{x}} = f(\bar{x},t)+B(\bar{x},t)\bar{u}$, $\bar{x}\in\bar{\mathcal{X}}(o_g,t)$, and $\bar{u} \in\bar{\mathcal{U}}(o_g,t)$} \end{align} where $c_0>0$, $c_1\geq0$, $P(\bar{x},\bar{u},t)$ is some performance-based cost function (e.g.{}, information-based cost~\cite{doi:10.2514/6.2021-1103}), $\bar{\mathcal{X}}$ is robust admissible state space defined as $\bar{\mathcal{X}}(o_g,t)=\{v(t)\in\mathbb{R}^n|\forall \xi(t) \in \{\xi(t)|\|v(t)-\xi(t)\|\leq r_{\ell}(t)\},~\xi(t)\in\mathcal{X}(o_g,t)\}$, $\mathcal{X}(o_g,t)$ is given admissible state space, $r_{\ell}(t)$ is given by \eqref{learning_bound_lagros} of Theorem~\ref{Thm:lagros_stability}, and $\bar{u} \in\bar{\mathcal{U}}(o_g,t)$ is an input constraint. The following theorem shows that the LAG-ROS ensures the perturbed state $x$ of \eqref{ncm_original_dynamics} to satisfy $x \in \mathcal{X}$, due to the contracting property of $u^*$. \begin{lemma} \label{tube_lemma} If the solution of \eqref{tube_motion_plan} gives $(x_d,u_d)$, the LAG-ROS $u_L$ of Theorem~\ref{Thm:lagros_stability} ensures the perturbed solution $x(t)$ of $\dot{x}=f(x,t)+B(x,t)u_L+d_c(x,t)$ in \eqref{ncm_original_dynamics} to stay in the admissible state space $\mathcal{X}(o_g,t)$, i.e.{}, $x(t) \in \mathcal{X}(o_g,t)$, even with the learning error $\epsilon_{\ell0}$ of $u_L$ in Theorem~\ref{Thm:lagros_stability}. \end{lemma} \begin{proof} See~\cite{lagros}. \qed \end{proof} Lemma~\ref{tube_lemma} implies that the perturbed trajectory \eqref{ncm_original_dynamics} controlled by LAG-ROS will not violate the given state constraints as long as $x_d$ is sampled by \eqref{tube_motion_plan}, which helps greatly reduce the need for safety control schemes such as~\cite{8405547}. The localization method in~\cite{glas} allows extracting $o_{\ell}$ of~\ref{itemFF} by $o_g$ of \eqref{tube_motion_plan}, to render LAG-ROS applicable to different environments in a distributed way with a single policy. We therefore sample artificially perturbed states $x$ in the tube $S(x_d(o_g,t)) = \{\xi(t)\in\mathbb{R}^n|\|\xi(t)-x_d(o_g,t)\|\leq r_{\ell}(t)\}$ as depicted in Figures~\ref{samplingfig} and~\ref{slide4_data}~\cite{lagros}. The robust control inputs $u^*$ for training LAG-ROS of Theorem~\ref{Thm:lagros_stability} is then sampled by computing the CV-STEM of Theorem~\ref{Thm:CV-STEM} or Theorem~\ref{Thm:ccm_cvstem}. The LAG-ROS framework is summarized in Fig.~\ref{lagrosdrawing}, and a pseudocode for its offline construction can be found in~\cite{lagros}. \begin{remark} For stochastic systems, we could sample $x$ around $x_d$ using a given probability distribution of the disturbance using \eqref{learning_bound_lagros_sto} and \eqref{learning_bound_lagros_sto_prob} of Theorem~\ref{Thm:lagros_stability}. \end{remark} \begin{figure} \centering \includegraphics[width=70mm]{figures/sample_rev.pdf} \caption{Illustration of state sampling in robust bounded error tube.} \label{samplingfig} \end{figure} \begin{figure} \centering \includegraphics[width=85mm]{figures/Slide4.pdf} \caption{Block diagram of state sampling in robust bounded error tube.} \label{slide4_data} \end{figure} \begin{example} \label{ex:sc_lagros} Let us again consider the spacecraft dynamics of Example~\ref{ex:sc_robust_control}, but now for designing a real-time robust motion planner using the LAG-ROS in a multi-agent setting. In this example, each agent is assumed to have access only to the states of the other agents/obstacles located in a circle with a limited radius, $2.0$m, centered around it. The performance of LAG-ROS is compared with~\ref{itemFF}, \ref{itemMP}, and the following centralized motion planner~\ref{itemC} which is not computable in real-time: \setlength{\leftmargini}{17pt} \begin{enumerate}[label={\color{caltechgreen}{(\alph*)}},start=4] \setlength{\itemsep}{1pt} \setlength{\parskip}{0pt} \item Centralized robust motion planner:\\ $(x,x_d,u_d,t) \mapsto u^*$, offline centralized solution of \ref{itemMP}. \label{itemC} \end{enumerate} The objective function for sampling target trajectories of \eqref{ncm_sdc_dynamicsd} is selected as $\int_0^{T}\|u\|^2dt$ with their target terminal positions $x_f=[p_{xf},p_{yf},0,0]^{\top}$, where $(p_{xf},p_{yf})$ is a random position in $(0,0) \leq (p_{xf},p_{yf}) \leq (5,5)$. For the state constraint satisfaction in Lemma~\ref{tube_lemma}, the following error tube \eqref{learning_bound_lagros}: \begin{align} r_{\ell}(t) = (\bar{d}_{\epsilon_{\ell}}/{\alpha})\sqrt{\chi}(1-e^{-\alpha t}) = 0.125(1-e^{-0.30 t}) \nonumber \end{align} is used with an input constraint $u_i\geq 0,~\forall i$, to avoid collisions with a random number of multiple circular obstacles and of other agents, even under the learning error and disturbances. See~\cite{lagros} for the LAG-ROS training details~\cite{lagros}. Figure~\ref{lagros_sc_fig} shows one example of the trajectories of the motion planners \ref{itemFF}--\ref{itemC} under deterministic external disturbances. It implies the following: \setlength{\leftmargini}{17pt} \begin{itemize} \setlength{\itemsep}{1pt} \setlength{\parskip}{0pt} \item For~\ref{itemFF}, the tracking error accumulates exponentially with time due to the lack of robustness as proven in Theorem~\ref{Thm:naive_learning}. \item \ref{itemMP}~only yields locally optimal $(x_d,u_d)$ of \eqref{ncm_sdc_dynamicsd}, as its time horizon has to be small enough to make the problem solvable online with limited computational capacity, only with local environment information. This renders some agents stuck in local minima as depicted in Fig.~\ref{lagros_sc_fig}. \item LAG-ROS \ref{itemLAGROS} tackles these two problems by providing formal robustness and stability guarantees of Theorem~\ref{Thm:lagros_stability}, whilst implicitly knowing the global solution (only from the local information $o_{\ell}$ as in~\cite{glas}) without computing it online. It indeed satisfies the state constraints due to Lemma~\ref{tube_lemma} as can be seen from Fig.~\ref{lagros_sc_fig}. \end{itemize} See~\cite{lagros} for the in-depth discussion on this simulation result. \begin{figure*} \centering \includegraphics[width=125mm]{figures/sc_obs.pdf} \caption{Trajectories for the learning-based planner~\ref{itemFF}, robust tube-based planner~\ref{itemMP}, LAG-ROS~\ref{itemLAGROS}, and offline centralized solution~\ref{itemC} ($\circ$: start, $\bullet$: goal).} \label{lagros_sc_fig} \end{figure*} \if0 Also, Fig.~\ref{lagros_sc_dist_fig} shows the success rate and control performance of each motion planner, where the success of this task is defined as the situation where the agent reaches a given random target terminal state $x_f$, within a given time horizon avoiding collision, and the success rate is computed as the percentage of successful trials in the total $50$ simulations. It can be seen that the LAG-ROS achieves more than $90$\% success rates for all $\bar{d}_c$, and its objective value remains only $1.64$ times larger than that of the centralized planner~\ref{itemC}, even without computing $(x_d,u_d)$ of \eqref{ncm_sdc_dynamicsd} online. See~\cite{lagros} for the in-depth discussion on these simulation results. \begin{figure} \centering \includegraphics[width=80mm]{figures/sc_obs_dist.pdf} \caption{Control performances versus $\sup_{x,t}\|d_c(x,t)\|$ of \eqref{ncm_original_dynamics} for multi-agent nonlinear motion planning. Note that \ref{itemFF}--\ref{itemC} are as given in Table~\ref{learning_summary}. The shaded area denotes the standard deviation ($\pm10^{-1}\sigma$).} \label{lagros_sc_dist_fig} \end{figure} \fi \end{example} \subsection{Safe Exploration and Learning of Disturbances} All the theorems presented so far assume that the sizes of unknown external disturbances are fixed (i.e.{}, $\bar{d}$ in Theorem~\ref{Thm:Robust_contraction_original} and $(\bar{g}_{0},\bar{g}_1)$ in Theorem~\ref{Thm:robuststochastic} are known and fixed). Since such an assumption could yield conservative state constraints, e.g.{}, in utilizing motion planning of Lemma~\ref{tube_lemma} with the tube of Theorem~\ref{Thm:lagros_stability}, we could consider better estimating the unknown parts, $d(x,t)$ in Theorem~\ref{Thm:Robust_contraction_original} or $G_{0}(x,t)$ and $G_{1}(x,t)$ in Theorem~\ref{Thm:robuststochastic}, also using contraction theory and machine learning. For example, it is demonstrated in~\cite{9290355} that the stochastic bounds of Theorem~\ref{Thm:robuststochastic} can be used to ensure safe exploration and reduction of uncertainty over epochs in learning unknown, control non-affine residual dynamics. Here, its optimal motion plans are designed by solving chance-constrained trajectory optimization and executed using a feedback controller such as Theorem~\ref{Thm:CV-STEM} with a control barrier function-based safety filter~\cite{7040372,8405547}. It is also shown in~\cite{9303957,L1contraction2,sun2021uncertaintyaware} that the state-dependent disturbance $d(x)$ in Theorem~\ref{Thm:robuststochastic} can be learned adaptively with the Gaussian process while ensuring safety. These techniques are based on the robustness and stability properties of contraction theory-based control and estimation schemes, which guarantee their state trajectories to stay in a tube around the target trajectory as in Theorems~\ref{Thm:Robust_contraction_original},~\ref{Thm:robuststochastic},~\ref{Thm:contraction_learning}, and~\ref{Thm:contraction_learning_sto}, and at the same time, enable safely sampling training data for learning the unknown part of the dynamics. Sections~\ref{Sec:adaptive} and~\ref{Sec:datadriven} are for giving an overview of these concepts in the context of contraction theory-based adaptive control~\cite{ancm,lopez2021universal,9109296} and robust control synthesis for learned models~\cite{neurallander,47710,boffi2020learning}. \if0 \subsection{Safety Augmentation in LAG-ROS} Although the LAG-ROS is in itself guarantees exponential boundedness of the tracking error due to Theorem~\ref{Thm:lagros_stability}, it is useful to incorporate a provable safety guarantee into its framework. Note that Theorem~\ref{Thm:lagros_safety} is different from existing MPC frameworks in that we can select its time horizon much smaller for online implementation, as we already know that the LAG-ROS control input $u_L$ yields an approximate solution accounting for long-term optimality and safety, and that applying $u_L$ could be good enough from a safety perspective due to Theorem~\ref{Thm:lagros_stability}~\cite{lagros}. \begin{theorem} \label{Thm:lagros_safety} Let $u_L$ denote the LAG-ROS control input of Definition~\ref{Def:lagros}. Suppose that $f(x,t)+g(x,t)u$ is Lipschitz for constant $u$ with its $2$-norm Lipschitz constant $L_{f}$. The safety-augmented LAG-ROS control input during $t\in[t_i,t_{t+1})$ is given by $u^*_i$ as a result of the following optimization problem, constructed to minimize the deviation of $u^*_i$ from $u_L(t_i)$: \begin{align} \label{lagros_control} &u^*_i,\cdots,u^*_{I_i-1} = {\rm arg}\min_{u_k, \forall k}\sum_{k=i}^{I_i-1}\|u_{k}-u_L(x(t_k),t_k)\|^2 \\ \label{lagros_con1} &\text{s.t.{} $\dot{\bar{x}} = f(\bar{x},t)+B(\bar{x},t)u_k$, $\forall t\in[t_k,t_{k+1})$,} \\ \label{lagros_con2} &\text{{\color{white}s.t.{}} $\bar{x}(t_i) = x(t_i)$, \& $\bar{x}(t_{k+1})\in\bar{\mathcal{X}}_k$, $\forall k = i,\cdots,I_i-1$} \end{align} where $x(t_i)$ is the perturbed solution of \eqref{ncm_original_dynamics} at $t=t_i$, $\bar{\mathcal{X}}_k=\{q\in\mathbb{R}^n|\forall \xi \in \{\xi|\|q-\xi\|\leq(\bar{d}/L_{f})(e^{L_{f}\Delta t_i}-1),~\xi\in\mathcal{X}(t_{k+1})\}$, $\Delta t_i = t_{i+1}-t_i$, $\mathcal{X}$ is safe state space, and $\bar{d} = \sup_{x,t}\|d(x,t)\|$ as in \eqref{ncm_original_dynamics}. If we select $I_i$ sufficiently small to make \eqref{lagros_control} solvable online at $t=t_i$, the LAG-ROS is implementable in real-time and its perturbed solution $x$ of \eqref{ncm_original_dynamics} stays in $\mathcal{X}$ for $t\in[t_i,t_{i+1})$. For stochastic nonlinear systems, rewriting the constraints by chance constraints would give stochastic counterparts of this theorem. \end{theorem} \begin{proof} Integrating \eqref{ncm_original_dynamics} and \eqref{lagros_con1} from $t_i$ to $t$ with the constraint $\bar{x}(t_i) = x(t_i)$ of (\ref{lagros_con2}) yields $\|x(t)-\bar{x}(t)\|\leq(\bar{d}/L_{f})(e^{L_{f}(t-t_i)}-1)$ using the Gronwall-Bellman inequality~\cite[p. 651]{Khalil:1173048} as in the proof of Theorem~\ref{Thm:naive_learning}. Thus, $\bar{x}(t_{i+1})\in\bar{\mathcal{X}}_i$ of \eqref{lagros_con2} implies that $x(t_{i+1})\in\mathcal{X}(t_{i+1})$. Since $|t-t_i|<\Delta t_i$ for $t\in[t_i,t_{i+1})$, $x$ of \eqref{ncm_original_dynamics} stays in $\mathcal{X}$ for $t\in[t_i,t_{i+1})$ as desired. \qed \end{proof} We could use the following corollary for dramatically reducing the computational complexity of Theorem~\ref{Thm:lagros_safety} for real-time implementation. \begin{corollary} \label{Cor:lagros_safety} The optimization problem \eqref{lagros_control} of Theorem~\ref{Thm:lagros_safety} with $I_i=i+1$ is convex/quadratic if the robust safe set $\bar{\mathcal{X}}_i$ of \eqref{lagros_con2} is convex/quadratic. \end{corollary} \begin{proof} See~\cite{lagros}. \qed \end{proof} It is shown in~\cite{lagros} that the LAG-ROS illustrated in Fig.~\ref{lagrosdrawing} outperforms existing state-of-the-art real-time motion planners even in decentralized multi-agent settings with external disturbances, which is primarily due to the provable robustness and stability properties of Theorem~\ref{Thm:lagros_stability}. \begin{remark} The safety augmentation of Theorem~\ref{Thm:lagros_safety} can be replaced by other existing state-of-the-art control techniques for safety-critical systems including~\cite{8405547}, which utilizes control barrier functions for ensuring safety under input disturbances (i.e.{} $\dot{x}=f(x)+B(x)(u+d)$)~\cite{lagros}. Note that input constraints $u\in\mathcal{U}$ can be incorporated in the LAG-ROS framework following the same proof. \end{remark} \fi \if0 \subsection{State Error Bounds During Rollout of Learning-based Control (motion planning)} \label{subsec:state_bounds} Cite [Nakka] The following assumptions are made on the nominal system $\dot{\bar{p}}=f(\bar{p},u)$ to derive the state tracking error bound during rollout. \begin{asmp} \label{asmp:stability} There exists a globally exponentially stable (i.e., finite-gain $\mathcal{L}_p$ stable) tracking control law $u_c = u_c(\bar{p},\bar{p}_{d},\bar{u}_{d})$ for the nominal dynamics $\dot{\bar{p}}= f(\bar{p},u_c)$. The control law $u_c$ satisfies the property $u_{c}(\bar{p}_d,\bar{p}_d,\bar{u}_d) = \bar{u}_d$ for any sampled trajectory $(\bar{p}_{d},\bar{u}_{d})$ from the information trajectory $(x_{i},\bar{u}_{i})$. At any time $t$ the state $\bar{p}$ satisfies the following inequality, when the closed-loop control $u_c$ is applied to the nominal dynamics, \begin{equation*} \scalebox{0.95}{$M(\bar{p},t)\frac{\partial f}{\partial \bar{p}} + \left(\frac{\partial f}{\partial \bar{p}}\right)^\top M(\bar{p},t) + \frac{d}{dt}M(\bar{p},t) \leq - 2 \alpha M(\bar{p},t)$}, \end{equation*} where $f = f(\bar{p},u_c(\bar{p},\bar{p}_d,\bar{u}_d))$, $\alpha>0$, $M(\bar{p},t)$ is a uniformly positive definite matrix with $(\lambda_{\min}(M)\|\bar{p}\|^2 \leq \bar{p}^\top M(\bar{p},t)\bar{p} \leq \lambda_{\max}(M)\|\bar{p}\|^2)$, and $\lambda_{\max}$ and $\lambda_{\min}$ are the maximum and minimum eigenvalues. \end{asmp} \begin{asmp}\label{asmp:bounded_g} The unknown model $g$ satisfies the bound $\|\left(g\left(\bar{p},u_c\right) - g(\bar{p}_d,\bar{u}_d)\right)\|^2_2 \leq c_2$. \end{asmp} \begin{asmp}\label{asmp:bounded_density} The probability density ratio $\tfrac{\rho_{x_i(t)}}{\rho_{x_i(0)}} \leq r$ is bounded, where the functions $\rho_{x_i(0)}$ and $\rho_{x_i(t)}$ are the probability density functions of $x_i$ at time $t=0$ and $t$ respectively. \end{asmp} \begin{theorem}\label{lemma:bound} Given that the estimated model~\eqref{eq:learned_model} satisfies the Assumption~\ref{asmp:learning_bounds}, and the systems~\eqref{eq:dynamics_original} and~\eqref{eq:dynamics_estimated} satisfy Assumptions~\ref{asmp:stability},~\ref{asmp:bounded_g},~\ref{asmp:bounded_density}, if the control $u_{c} = u_{c}(\bar{p},x_i,\bar{u}_i)$ is applied to the system~\eqref{eq:dynamics_original}, then the following condition holds at time $t$ \begin{align} \mathbb{E}_{x_{i}(t)} (\|\bar{p}-x_i\|^2_{2}) & \leq \tfrac{\lambda_{\max}(M)}{2\lambda_{\min}(M) \alpha_{m}} (c_0 + c_1 + c_2) r \label{eq:propagation_error}\\& + \tfrac{\lambda_{\max}(M)r}{\lambda_{\min}(M)} \mathbb{E} \left( \|\bar{p}(0)-x_i(0)\|^2\right) e^{-2\alpha_{m}t}, \nonumber \end{align} where $(x_i,\bar{u}_i)$ is computed from~\eqref{eq:stoptprob_gpc} and $\alpha_{m} = (\alpha - 1)$. The states $\bar{p}\in \mathcal{X}$, and $x_i\in \mathcal{X}$ are feasible trajectories of the deterministic dynamics~\eqref{eq:dynamics_original} and the SDE~\eqref{eq:dynamics_estimated} for the initial conditions $\bar{p}(0) \in \mathcal{X}$ and $x_i(0) \in \mathcal{X}$ respectively at $t\geq t_{0}$. \end{theorem} \begin{proof} See Lemma 2 in~\cite{dani2014observer}. \qed \end{proof} Theorem~\ref{lemma:bound} states that the expected mean squared error $\mathbb{E}(\|\bar{p}-x_i\|^2)$ is bounded by $\tfrac{\lambda_{\max}(M)(c_0 + c_1 + c_2)r}{2\alpha_{m}\lambda_{\min}(M)}$ as $t \to \infty$ when the control law $u_c$ is applied to the dynamics in~\eqref{eq:dynamics_original}. The bounded tracking performance leads to constraint violation \fi \begin{figure*} \centering \includegraphics[width=170mm]{figures/lagros_rev2.pdf} \caption{Detailed block diagram of machine learning-based control using contraction theory, including LAG-ROS, where Fig.~\ref{slide2_cvstem}, Fig.~\ref{slide3_mp}, and Fig.~\ref{slide4_data} are utilized as building blocks.} \label{lagrosdrawing} \end{figure*} \section{Learning-based Adaptive Control} \label{Sec:adaptive} In this section, we consider the following smooth nonlinear system with an uncertain parameter $\theta\in\mathbb{R}^{c}$: \begin{align} \label{adaptive_general} \dot{x} = f(x,\theta)+B(x,\theta)u,~\dot{x}_d = f(x_d,\theta)+B(x_d,\theta)u_d \end{align} where $x$, $u$, $x_d$, and $u_d$ are as defined in \eqref{ncm_original_dynamics} and \eqref{ncm_sdc_dynamicsd}, and ${f}: \mathbb{R}^n\times\mathbb{R}^c\mapsto\mathbb{R}^n$ and $B:\mathbb{R}^n\times\mathbb{R}^c\mapsto\mathbb{R}^{n\times m}$ are known smooth functions with the uncertain parameter $\theta\in\mathbb{R}^{c}$. Due to Theorems~\ref{Thm:Robust_contraction_original} and \ref{Thm:contraction_learning}, we can see that the robust control techniques presented earlier in Theorems~\ref{Thm:CV-STEM},~\ref{Thm:ccm_cvstem},~\ref{Thm:ncm_clf}, and~\ref{Thm:ncm_ccm_clf} are still useful in this case if the modeling errors $\|f(x,\theta)-f(x,\theta_n)\|$ and $\|B(x,\theta)-B(x,\theta_n)\|$ are bounded, where $\theta_n$ is a nominal guess of the true parameter $\theta$. However, there are situations where such assumptions are not necessarily true. We present a method of deep learning-based adaptive control for nonlinear systems with parametric uncertainty, thereby further improving the real-time performance of robust control in Theorems~\ref{Thm:contraction_learning} and~\ref{Thm:contraction_learning_sto} for model-based systems, and Theorems~\ref{Thm:NCMstability_modelfree} and~\ref{Thm:neurallander} for model-free systems. Although we consider continuous-time dynamical systems in this section, discrete-time changes could be incorporated in this framework using~\cite{regretboffi,1469901}. Also, note that the techniques in this section~\cite{ancm} can be used with differential state feedback frameworks~\cite{ccm,7989693,47710,WANG201944,vccm,rccm} as described in Theorem~\ref{Thm:ccm_cvstem}, trading off added computational cost for generality (see Table~\ref{tab:sdcccm_summary} and~\cite{9109296,lopez2021universal}). \subsection{Adaptive Control with CV-STEM and NCM} \label{sec:matched_uncertainty} Let us start with the following simple case. \begin{assumption} \label{Asmp:affine} The matrix $B$ in \eqref{adaptive_general} does not depend on $\theta$, and $\exists \Pi(x) \in \mathbb{R}^{{c}\times n}$ s.t.{} $\Pi(x)^{\top}\vartheta = f(x,\theta_n)-f(x,\theta)$, where $\vartheta=\theta_n-\theta$ and $\theta_n$ is a nominal guess of the uncertain parameter $\theta$. \end{assumption} Under Assumption~\ref{Asmp:affine}, we can write \eqref{adaptive_general} as \begin{align} \label{adaptive_nominal_sys} \dot{x}=f(x,\theta_n)+B(x)u-\Pi(x)^{\top}\vartheta \end{align} leading to the following theorem~\cite{ancm} for the NCM-based adaptive control. Note that we could also use the SDC formulation with respect to a fixed point as delineated in Theorem~\ref{Thm:fixed_sdc}~\cite{mypaperTAC,Ref:Stochastic,mypaper}. \begin{theorem} \label{Thm:adaptive_robust_affine} Suppose that Assumption~\ref{Asmp:affine} holds and let $\mathcal{M}$ defines the NCM of Definition~\ref{Def:NCM}, which models $M$ of the CV-STEM contraction metric in Theorem~\ref{Thm:CV-STEM} for the nominal system \eqref{adaptive_general} with $\theta = \theta_n$, constructed with an additional convex constraint given as $\partial_{b_i(x)}\bar{W}+\partial_{b_i(x_d)}\bar{W}=0$, where $\partial_{b_i(q)}\bar{W}=\sum_{i}(\partial \bar{W}/\partial q_i)b_i(q)$ for $B=[b_1,\cdots,b_m]$ (see~\cite{ccm,9109296}). Suppose also that the matched uncertainty condition~\cite{9109296} holds, i.e.{}, $(\Pi(x)-\Pi(x_d))^{\top}\vartheta \in \textrm{span}(B(x))$ for $\Pi(x)$, and that \eqref{adaptive_general} is controlled by the following adaptive control law: \begin{align} \label{affine_adaptive_u_ncm} u =& u_L+\varphi(x,x_d)^{\top} \hat{\vartheta} \\ \label{affine_adaptation_ncm} \dot{\hat{\vartheta}} =& -\Gamma (\varphi(x,x_d)B(x)^{\top}\mathcal{M}(x,x_d,u_d)(x-x_d)+\sigma \hat{\vartheta}) \end{align} where $u_L$ is given by \eqref{NCM_controller} of Theorem~\ref{Thm:NCMstability2}, i.e.{}, $u_L=u_d-R^{-1}B^{\top}\mathcal{M}(x-x_d)$, $\Gamma \in \mathbb{R}^{{c}\times {c}}$ is a diagonal matrix with positive elements that governs the rate of adaptation, $\sigma \in \mathbb{R}_{\geq 0}$, and $(\Pi(x)-\Pi(x_d))^{\top}\vartheta=B(x)\varphi(x,x_d)^{\top}\vartheta$. If $\exists \underline{\gamma},\overline{\gamma},\bar{b},\bar{\rho},\bar{\phi},\bar{\vartheta} \in \mathbb{R}_{>0}$ s.t.{} $\underline{\gamma} \mathrm{I} \preceq \Gamma \preceq \overline{\gamma}\mathrm{I}$, $\|B(x)\| \leq \bar{b}$, $\|R^{-1}(x,x_d,u_d)\| \leq \bar{\rho}$, $\|\varphi(x,x_d)\| \leq \bar{\phi}$, and $\|\vartheta\| \leq \bar{\vartheta}$, and if $\Gamma$ and $\sigma$ of \eqref{affine_adaptation_ncm} are selected to satisfy the following relation for the learning error $\|\mathcal{M}-M\| \leq \epsilon_{\ell}$ in some compact set $\mathcal{S}$ as in \eqref{Eq:Merror_control} of Theorem~\ref{Thm:NCMstability2}: \begin{align} \label{condition_mNCM} \begin{bmatrix} -2\alpha_{\ell}\underline{m} & \bar{\phi}\bar{b}\epsilon_{\ell} \\ \bar{\phi}\bar{b}\epsilon_{\ell} & -2\sigma \end{bmatrix} \preceq -2 \alpha_{a}\begin{bmatrix} \overline{m} & 0 \\ 0 & 1/\underline{\gamma} \end{bmatrix} \end{align} for $\exists \alpha_{a} \in \mathbb{R}_{>0}$, $\alpha_{\ell}$ given in Theorem~\ref{Thm:NCMstability2}, and $\underline{m}$ and $\overline{m}$ given in $\underline{m}\mathrm{I}\preceq M \preceq \overline{m}\mathrm{I}$ of \eqref{Mcon}, then the system \eqref{adaptive_general} is robust against bounded deterministic and stochastic disturbances with $\sigma\neq0$, and we have the following bound in the compact set $\mathcal{S}$: \begin{align} \label{adaptive_bound_1} \|\mathtt{e}(t)\| \leq (V_{\ell}(0)e^{-\alpha_a t}+\alpha_a^{-1}\sigma\sqrt{\overline{\gamma}}\bar{\vartheta}(1-e^{-\alpha_a t}))/\sqrt{\underline{m}} \end{align} where $\mathtt{e}=x-x_d$, and $V_{\ell}=\int^{\xi_1}_{\xi_0}\|\Theta\delta q\|$ is defined in Theorem~\ref{Thm:path_integral} with $M=\Theta^{\top}\Theta$ replaced by $\mathrm{diag}(M,\Gamma^{-1})$ for $\xi_0=[x_d^{\top},\vartheta^{\top}]^{\top}$ and $\xi_1=[x^{\top},\hat{\vartheta}^{\top}]^{\top}$. Furthermore, if the learning error $\epsilon_{\ell}=0$ (CV-STEM control), \eqref{affine_adaptation_ncm} with $\sigma = 0$ guarantees asymptotic stability of $x$ to $x_d$ in \eqref{adaptive_general}. \end{theorem} \begin{proof} The proof can be found in~\cite{ancm}, but here we emphasize the use of contraction theory. For $u$ given by \eqref{affine_adaptive_u_ncm}, the virtual system of a smooth path $q(\mu,t) = [q_x^{\top},q_{\vartheta}^{\top}]^{\top}$ parameterized by $\mu\in[0,1]$, which has $q(\mu=0,t)=[x_d^{\top},\vartheta^{\top}]^{\top}$ and $q(\mu=1,t) =[x^{\top},\hat{\vartheta}^{\top}]^{\top}$ as its particular solutions, is given as follows: \begin{align} \label{virtual_adaptive} \dot{q} = \begin{bmatrix}\zeta(q_x,x,x_d,u_d)+B\varphi^{\top} q_{\vartheta}-\Pi(x)^{\top}\vartheta \\ -\Gamma(\varphi B^{\top}\mathcal{M}(q_x-x_d)+\sigma(q_{\vartheta}-\vartheta))+d_{q\vartheta}(\mu,\vartheta) \end{bmatrix} \end{align} where $d_{q\vartheta}(\mu,\vartheta) = -\mu\sigma\vartheta$. Note that $\zeta$ is as given in \eqref{Eq:virtual_sys_sto}, i.e.{}, $\zeta = (A-BR^{-1}B^{\top}\mathcal{M})(q_x-x_d)+\dot{x}_d$, where the SDC matrix $A$ is defined as (see Lemma~\ref{sdclemma}) \begin{align} A(x-x_d)=f(x,\theta_n)+B(x)u_d-f(x_d,\theta_n)-B(x_d)u_d. \end{align} The arguments of $A(\varrho,x,x_d,u_d)$, $B(x)$, $\mathcal{M}(x,x_d,u_d)$, and $\varphi(x,x_d)$ are omitted for notational simplicity. Since $\dot{q}_x=\zeta(q_x,x,x_d,u_d,t)$ is contracting due to Theorems~\ref{Thm:CV-STEM} and~\ref{Thm:NCMstability2} with a contraction rate given by $\alpha_{\ell}$ in Theorem~\ref{Thm:NCMstability2}, we have for a Lyapunov function $V = \delta q_x^{\top}M\delta q_x+\delta q_{\vartheta}^{\top}\Gamma^{-1}\delta q_{\vartheta}$ that \begin{align} \dot{V}/2 \leq& -\alpha_{\ell}\delta q_x^{\top}M\delta q_x+\delta q_x^{\top}(M-\mathcal{M})B\varphi^{\top}\delta q_{\vartheta} \\ &-\sigma\|\delta q_{\vartheta}\|^2 +\delta q_{\vartheta}^{\top}\delta d_{q\vartheta}. \label{ncm_adaptive_V_computation} \end{align} Applying \eqref{condition_mNCM} with $\|\mathcal{M}-M\|\leq\epsilon_{\ell}$ of \eqref{Eq:Merror_control}, we get \begin{align} &\dot{V}/2-\delta q_{\vartheta}^{\top}\delta d_{q\vartheta} \leq -(\alpha_{\ell}\underline{m})\|\delta q_x\|^2+\bar{\phi}\bar{b}\epsilon_{\ell}\|\delta q_x\|\|\delta q_{\vartheta}\| \\ &-\sigma\|\delta q_{\vartheta}\|^2 \leq -\alpha_{a}(\overline{m}\|\delta q_x\|^2+\|\delta q_{\vartheta}\|^2/\underline{\gamma}) \leq -\alpha_{a}V. \end{align} Since we have $\|\partial d_{q\vartheta}/\partial \mu\| = \sigma\bar{\vartheta}$, this implies $\dot{V}_{\ell} \leq -\alpha_a V_{\ell}+\sigma\sqrt{\overline{\gamma}}\bar{\vartheta}$, yielding the bound \eqref{adaptive_bound_1} due to Lemma~\ref{Lemma:comparison}~\cite{ancm}. Robustness against deterministic and stochastic disturbances follows from Theorem~\ref{Thm:CVSTEM:LMI} if $\sigma\neq0$. If $\epsilon_{\ell}=0$ and $\sigma = 0$, the relation \eqref{ncm_adaptive_V_computation} reduces to $\dot{V}/2 \leq -\alpha\delta q_x^{\top}M\delta q_x$, which results in asymptotic stability of $x$ to $x_d$ in \eqref{adaptive_general} due to Barbalat's lemma~\cite[p. 323]{Khalil:1173048} as in the proof of Theorem~2 in~\cite{9109296}. \qed \end{proof} \begin{remark} \label{remark_sliding} Although Theorem~\ref{Thm:adaptive_robust_affine} is for the case where $f(x)$ is affine in its parameter, it is also useful for the following types of systems with an uncertain parameter $\theta\in\mathbb{R}^{c}$ and a control input $u$ (see~\cite{ancm}): \begin{align} \label{lagrangian_dynamics} H(x){p}^{(n)}+h(x)+\Pi (x)\theta=u \end{align} where ${p}\in \mathbb{R}^n$, $u\in \mathbb{R}^n$, $h:\mathbb{R}^{n}\mapsto \mathbb{R}^{n}$, $H:\mathbb{R}^{n}\mapsto \mathbb{R}^{n\times n}$, $\Pi:\mathbb{R}^{n}\mapsto \mathbb{R}^{n\times {c}}$, $x=[({p}^{(n-2)})^{\top},\cdots,({p})^{\top}]^{\top}$, and ${p}^{(k)}$ denotes the $k$th time derivative of ${p}$. In particular, adaptive sliding control~\cite{adaptive_sliding} designs $u$ to render the system of the composite variable $s$ given as $s = {p}^{(n-1)}-{p}_r^{(n-1)}$ to be contracting, where ${p}_r^{(n-1)} = p_d^{(n-1)}-\sum_{i=0}^{n-2}\lambda_{i}\mathtt{e}^{(i)}$, $\mathtt{e}=p-p_d$, $p_d$ is a target trajectory, and $\kappa^{n-1}+\lambda_{n-2}\kappa^{n-2}+\cdots+\lambda_0$ is a stable (Hurwitz) polynomial in the Laplace variable $\kappa$ (see Example~\ref{ex:lag_metric}). Since we have $\mathtt{e}^{(n-1)}=s-\sum_{i=0}^{n-2}\lambda_{i}\mathtt{e}^{(i)}$ and the system for $[\mathtt{e}^{(0)},\cdots,\mathtt{e}^{(n-2)}]$ is also contracting if $s=0$ due to the Hurwitz property, the hierarchical combination property~\cite{Ref:contraction2,Ref:contraction5} of contraction in Theorem~\ref{Thm:Robust_contraction_hierc} guarantees $\lim_{t\to\infty}\|p-p_d\| = 0$~\cite[p. 352]{Ref_Slotine} (see Example~\ref{ex:hiera}). \end{remark} \begin{example} \label{ex:lag_adaptive0} Using the technique of Remark~\ref{remark_sliding}, we can construct adaptive control for the Lagrangian system in Example~\ref{ex:lag_metric} as follows: \begin{align} \label{lagrange_partial_adaptive} &\mathcal{H}(\mathtt{q})\ddot{\mathtt{q}}+\mathcal{C}(\mathtt{q},\dot{\mathtt{q}})\dot{\mathtt{q}}+\mathcal{G}(\mathtt{q})=u(\mathtt{q},\dot{\mathtt{q}},t) \\ \label{lagrange_u_adaptive} &u(\mathtt{q},\dot{\mathtt{q}},t) = -\mathcal{K}(t)(\dot{\mathtt{q}}-\dot{\mathtt{q}}_r)+\hat{\mathcal{H}}(\mathtt{q})\ddot{\mathtt{q}}_r+\hat{\mathcal{C}}(\mathtt{q},\dot{\mathtt{q}})\dot{\mathtt{q}}_r+\hat{\mathcal{G}}(\mathtt{q})~~~~~ \end{align} where $\hat{\mathcal{H}}$, $\hat{\mathcal{C}}$, and $\hat{\mathcal{G}}$ are the estimates of $\mathcal{H}$, $\mathcal{C}$, and $\mathcal{G}$, respectively, and the other variables are as defined in Example~\ref{ex:lag_metric}. Suppose that the terms $\mathcal{H}$, $\mathcal{C}$, and $\mathcal{G}$ depend linearly on the unknown parameter vector $\theta$ as follows~\cite[p. 405]{Ref_Slotine}: \begin{align} \label{lagrange_linear_assump} \mathcal{H}(\mathtt{q})\ddot{\mathtt{q}}_r+\mathcal{C}(\mathtt{q},\dot{\mathtt{q}})\dot{\mathtt{q}}_r+\mathcal{G}(\mathtt{q})=Y(\mathtt{q},\dot{\mathtt{q}},\dot{\mathtt{q}}_r,\ddot{\mathtt{q}}_r)\theta. \end{align} Updating the parameter estimate $\hat{\theta}$ using the adaptation law, $\dot{\hat{\theta}} = -\Gamma Y(\mathtt{q},\dot{\mathtt{q}},\dot{\mathtt{q}}_r,\ddot{\mathtt{q}}_r)^{\top}(\dot{\mathtt{q}}-\dot{\mathtt{q}}_r)$, as in \eqref{affine_adaptation_ncm} where $\Gamma \succ 0$, we can define the following virtual system which has $q = \xi_0 = [\dot{\mathtt{q}}_r^{\top},{\theta}^{\top}]^{\top}$ and $q = \xi_1 = [\dot{\mathtt{q}}^{\top},\hat{\theta}^{\top}]^{\top}$ as its particular solutions: \begin{align} \label{lagrange_cl_adaptive} \begin{bmatrix}\mathcal{H} & 0 \\ 0 & \Gamma^{-1}\end{bmatrix}(\dot{q}-\dot{\xi}_0)+\begin{bmatrix}\mathcal{C}+\mathcal{K} & -Y \\ Y^{\top} & 0\end{bmatrix}(q-\xi_0) =0 \end{align} where the relation $u=-\mathcal{K}(t)(\dot{\mathtt{q}}-\dot{\mathtt{q}}_r)+Y(\mathtt{q},\dot{\mathtt{q}},\dot{\mathtt{q}}_r,\ddot{\mathtt{q}}_r)\hat{\theta}$ is used. Thus, for a Lyapunov function $V=\delta q^{\top}\left[\begin{smallmatrix}\mathcal{H} & 0\\ 0 & \Gamma^{-1}\end{smallmatrix}\right]\delta q$, we have that \begin{align} \dot{V} =& \delta q^{\top}\begin{bmatrix}\mathcal{K} & Y \\ -Y^{\top} & 0\end{bmatrix}\delta q= \delta q^{\top}\begin{bmatrix}\mathcal{K} & 0 \\ 0 & 0\end{bmatrix}\delta q \end{align} which results in asymptotic stability of the differential state $\delta q$ (i.e.{}, semi-contraction~\cite{Ref:contraction3}, see also Barbalat's lemma~\cite[p. 405-406]{Ref_Slotine}). \end{example} \subsection{Parameter-Dependent Contraction Metric (aNCM)} \label{Sec:adaptiveNCM} Although Theorem~\ref{Thm:adaptive_robust_affine} utilizes the NCM designed for the nominal system \eqref{adaptive_general} with $\theta = \theta_n$, we could improve its representational power by explicitly taking the parameter estimate $\hat{\theta}$ as one of the NCM arguments~\cite{ancm}, leading to the concept of an adaptive NCM (aNCM). In this section, we consider multiplicatively-separable nonlinear systems given in Assumption~\ref{multiplicative_asmp}, which holds for many types of systems including robotics systems~\cite{Ref_Slotine}, spacecraft high-fidelity dynamics~\cite{battin,doi:10.2514/1.55705}, and systems modeled by basis function approximation and DNNs~\cite{Nelles2001,SannerSlotine1992}. \begin{assumption} \label{multiplicative_asmp} The dynamical system \eqref{adaptive_general} is multiplicatively separable in terms of $x$ and $\theta$, i.e.{}, $\exists$ $Y_f:\mathbb{R}^n\mapsto\mathbb{R}^{n\times {c}_z}$, $Y_{b_i}:\mathbb{R}^n\mapsto\mathbb{R}^{n\times {c}_z}$, and $Z:\mathbb{R}^{c}\mapsto\mathbb{R}^{{c}_z}$ s.t.{} \begin{align} \label{linear_adaptive} Y_f(x)Z(\theta) = f(x,\theta),~Y_{b_i}(x)Z(\theta) = b_i(x,\theta) \end{align} where $B(x,\theta)=[b_1(x,\theta),\cdots,b_m(x,\theta)]$. We could define $\theta$ as $[\theta^{\top},Z(\theta)^{\top}]^{\top}$ so we have $Y_f(q)\theta = f(q,\theta)$ and $Y_{b_i}(q)\theta = b_i(q;\theta)$. Such an over-parameterized system could be regularized using the Bregman divergence as in~\cite{boffi2020implicit} (see Example~\ref{ex:bregman}), and thus we denote $[\theta^{\top},Z(\theta)^{\top}]^{\top}$ as $\theta$ in the subsequent discussion. \end{assumption} Under Assumption~\ref{multiplicative_asmp}, the dynamics for $\mathtt{e}=x-x_d$ of \eqref{adaptive_general} can be expressed as follows: \begin{equation} \label{error_dynamics} \dot{\mathtt{e}} = A(\varrho,x,x_d,u_d,\hat{\theta})\mathtt{e}+B(x,\hat{\theta})(u-u_d)-\tilde{Y}(\hat{\theta}-\theta) \end{equation} where $A$ is the SDC matrix of Lemma~\ref{sdclemma}, $\hat{\theta}$ is the current estimate of $\theta$, and $\tilde{Y}$ is defined as \begin{equation} \label{definition_Y} \tilde{Y} = Y-Y_d= (Y_f(x)+Y_b(x,u))-(Y_f(x_d)+Y_b(x_d,u_d)) \end{equation} where $Y_b(x,u)=\sum_{i=1}^mY_{b_i}(q)u_i$. \begin{definition} \label{Def:aNCM} The adaptive Neural Contraction Metric (aNCM) in Fig.~\ref{ancmdrawing} is a DNN model for the optimal parameter-dependent contraction metric, given by solving the adaptive CV-STEM, i.e.{}, \eqref{cvstem_eq} of Theorem~\ref{Thm:CV-STEM} (or Theorem~\ref{Thm:ccm_cvstem} for differential feedback) with its contraction constraint replaced by the following convex constraint: \begin{align} \label{deterministic_contraction_adaptive_tilde} &-\Xi+2\sym{\left(A\bar{W}\right)}-2\nu BR^{-1}B^{\top} \preceq -2\alpha \bar{W} \end{align} for deterministic systems, and \begin{equation} \label{stochastic_contraction_adaptive_tilde} \begin{bmatrix} -\Xi+2\sym{}(A\bar{W})-2\nu BR^{-1}B^{\top}+2\alpha \bar{W}& \bar{W} \\ \bar{W} & -\frac{\nu}{\alpha_s}\mathrm{I} \end{bmatrix} \preceq 0 \end{equation} for stochastic systems, where $W=M(x,x_d,u_d,\hat{\theta})^{-1}\succ0$ (or $W=M(x,\hat{\theta})^{-1}\succ0$, see Theorem~\ref{Thm:fixed_sdc}), $\bar{W} = \nu W$, $\nu = \overline{m}$, $R=R(x,x_d,u_d)\succ0$ is a weight matrix on $u$, $\Xi=({d}/{dt})|_{\hat{\theta}}{\bar{W}}$ is the time derivative of $\bar{W}$ computed along \eqref{adaptive_general} with $\theta = \hat{\theta}$, $A$ and $B$ are given in \eqref{error_dynamics}, $\alpha$, $\underline{m}$, $\overline{m}$, and $\alpha_s$ are as given in Theorem~\ref{Thm:CV-STEM}, and the arguments $(x,x_d,u_d,\hat{\theta})$ are omitted for notational simplicity. \end{definition} The aNCM given in Definition~\ref{Def:aNCM} has the following stability property along with its optimality due to the CV-STEM of Theorem~\ref{Thm:CV-STEM}~\cite{ancm}. \begin{theorem} \label{adaptiveNCMthm} Suppose that Assumption~\ref{multiplicative_asmp} holds and let $\mathcal{M}$ define the aNCM of Definition~\ref{Def:aNCM}. Suppose also that the true dynamics \eqref{adaptive_general} is controlled by the following adaptive control law: \begin{align} \label{adaptive_general_u} u =& u_d-R(x,x_d,u_d)^{-1}B(x,\hat{\theta})^{\top}\mathcal{M}(x,x_d,u_d,\hat{\theta})\mathtt{e}\\ \label{adaptation_general} \dot{\hat{\theta}} =& \Gamma((Y^{\top}d\mathcal{M}_x+Y_d^{\top}d\mathcal{M}_{x_d}+\tilde{Y}^{\top}\mathcal{M}) \mathtt{e}-\sigma\hat{\theta}) \end{align} where $d\mathcal{M}_q = [({\partial \mathcal{M}}/{\partial q_1})\mathtt{e},\cdots,({\partial \mathcal{M}}/{\partial q_n})\mathtt{e}]^{\top}/2$, $\mathtt{e}=x-x_d$, $\Gamma \succ 0$, $\sigma \in \mathbb{R}_{\geq 0}$, and $Y$, $Y_d$, $\tilde{Y}$ are given in \eqref{definition_Y}. Suppose further that the learning error in $\|\mathcal{M}-M\|\leq\epsilon_{\ell}$ of Theorem~\ref{Thm:NCMstability2} additionally satisfies $\|d\mathcal{M}_{x_d} -dM_{x_d} \| \leq \epsilon_{\ell}$ and $\|d\mathcal{M}_x -dM_x \| \leq \epsilon_{\ell}$ in some compact set $\mathcal{S}$. If $\exists \bar{b},\bar{\rho},\bar{y} \in \mathbb{R}_{>0}$ s.t.{} $\|B(x,\hat{\theta})\| \leq \bar{b}$, $\|R^{-1}(x,x_d,u_d)\| \leq \bar{\rho}$, $\|Y\|\leq \bar{y}$, $\|Y_d\|\leq \bar{y}$, and $\|\tilde{Y}\|\leq \bar{y}$ in \eqref{adaptive_general_u} and \eqref{adaptation_general}, and if $\Gamma$ and $\sigma$ of \eqref{adaptation_general} are selected to satisfy the following as in Theorem~\ref{Thm:adaptive_robust_affine}: \begin{align} \begin{bmatrix} \label{condition_aNCM} -2\alpha_{\ell}\underline{m} & \bar{y}\epsilon_{\ell} \\ \bar{y}\epsilon_{\ell} & -2\sigma \end{bmatrix} \preceq -2 \alpha_{a}\begin{bmatrix} \overline{m} & 0 \\ 0 & 1/\underline{\gamma} \end{bmatrix} \end{align} for $\exists \alpha_a\in\mathbb{R}_{>0}$, $\alpha_{\ell}$ given in Theorem~\ref{Thm:NCMstability2}, and $\underline{m}$ and $\overline{m}$ given in $\underline{m}\mathrm{I}\preceq M \preceq \overline{m}\mathrm{I}$ of \eqref{Mcon}, then the system \eqref{adaptive_general} is robust against bounded deterministic and stochastic disturbances, and we have the exponential bound \eqref{adaptive_bound_1} in the compact set $\mathcal{S}$. Furthermore, if $\epsilon_{\ell}=0$ (adaptive CV-STEM control), \eqref{adaptation_general} with $\sigma = 0$ guarantees asymptotic stability of $x$ to $x_d$ in \eqref{adaptive_general}. \end{theorem} \begin{proof} Replacing the contraction constraints of the CV-STEM in Theorem~\ref{Thm:CV-STEM} by \eqref{deterministic_contraction_adaptive_tilde} and \eqref{stochastic_contraction_adaptive_tilde}, the bound \eqref{adaptive_bound_1} and the asymptotic stability result can be derived as in the proof of Theorem~\ref{Thm:adaptive_robust_affine} (see Theorem~4 and Corollary~2 of~\cite{ancm} for details). Theorems~\ref{Thm:Robust_contraction_original} and \ref{Thm:robuststochastic} guarantee robustness of \eqref{adaptive_general} against bounded deterministic and stochastic disturbances for $\sigma\neq0$. \qed \end{proof} \begin{figure} \centering \includegraphics[width=88mm]{figures/aNcmfig.pdf} \caption{Illustration of aNCM ($M$: positive definite matrix that defines aNCM; $\hat{\theta}$: estimated parameter; $Y$: error signal, see \eqref{definition_Y}; $x$: system state; $u$: system control input; and $(x_d,u_d)$: target state and control input trajectory).} \label{ancmdrawing} \vspace{-1.4em} \end{figure} Let us again emphasize that, by using Theorem~\ref{Thm:ccm_cvstem}, the results of Theorems~\ref{Thm:adaptive_robust_affine} and~\ref{adaptiveNCMthm} can be extended to adaptive control with CCM-based differential feedback~\cite{9109296,lopez2021universal} (see~Table~\ref{tab:sdcccm_summary} for the trade-offs). Since the adaptation laws \eqref{affine_adaptation_ncm} and \eqref{adaptation_general} in Theorems~\ref{Thm:adaptive_robust_affine} and~\ref{adaptiveNCMthm} yield an explicit bound on the steady-state error as in \eqref{adaptive_bound_1}, it could be used as the objective function of the CV-STEM in Theorem~\ref{Thm:CV-STEM}, regarding $\Gamma$ and $\sigma$ as extra decision variables to get $M$ optimal in a sense different from Theorem~\ref{Thm:CV-STEM}. Smaller $\epsilon_{\ell}$ would lead to a weaker condition on them in \eqref{condition_mNCM} and \eqref{condition_aNCM}. Also, the size of $\|\vartheta\| \leq \bar{\vartheta}$ in \eqref{adaptive_bound_1} can be adjusted simply by rescaling it (e.g.{}, $\vartheta\to\theta/\bar{\vartheta}$). However, such a robustness guarantee comes with a drawback of having $\lim_{t\to\infty}\|\hat{\theta}(t)\| = 0$ for $\sigma \neq 0$ in \eqref{affine_adaptation_ncm}, leading to the trade-offs in different types of adaptation laws, some of which are given in Examples~\ref{ex:projection_operator}--\ref{ex:bregman} (see also Remark~\ref{remark_PE_condition}). \begin{example} \label{ex:projection_operator} Let us briefly describe the following projection operator-based adaptation law, again for the Lagrangian system~\eqref{lagrange_partial_adaptive} of Example~\ref{ex:lag_adaptive0} with the unknown parameter vector $\theta$: \begin{align} \label{projection_adaptation} \dot{\hat{\theta}} = \proj{}(\hat{\theta},-\Gamma Y(\mathtt{q},\dot{\mathtt{q}},\dot{\mathtt{q}}_r,\ddot{\mathtt{q}}_r)^{\top}(\dot{\mathtt{q}}-\dot{\mathtt{q}}_r),p) \end{align} where $\proj{}$ is the projection operator and $p$ is a convex boundary function (e.g.{}, $p(\hat{\theta})=(\hat{\theta}^{\top}\hat{\theta}-\theta_{\max}^2)/(\epsilon_{\theta}\theta_{\max}^2)$ for given positive constants $\theta_{\max}$ and $\epsilon_{\theta}$). If $p(\hat{\theta})>0$ and $\nabla p(\hat{\theta})^{\top}\xi > 0$, \begin{align} \label{projection_operator} \proj{}(\hat{\theta},\xi,p)= \xi-({\nabla p(\hat{\theta})\nabla p(\hat{\theta})^{\top}}/{\|\nabla p(\hat{\theta})\|^2})\xi p(\hat{\theta}), \end{align} otherwise, $\proj{}(\hat{\theta},\xi,p)=\xi$. The projection operator has the following useful property which allows bounding the parameter estimate $\hat{\theta}$. \begin{lemma} \label{lemma_projection} If $\hat{\theta}$ is given by \eqref{projection_adaptation} with $\hat{\theta}(0) \in \Omega_{\theta} = \{\theta\in\mathbb{R}^c|p(\theta) \leq 1\}$ for a convex function $p(\theta)$, then $\hat{\theta}(t) \in \Omega_{\theta},~\forall t\geq 0$ (e.g.{}, $\|\hat{\theta}\| \leq \theta_{\max}\sqrt{1+\epsilon_{\theta}}$ if $p(\hat{\theta})=(\hat{\theta}^{\top}\hat{\theta}-\theta_{\max}^2)/(\epsilon_{\theta}\theta_{\max}^2)$). \end{lemma} \begin{proof} See~\cite{lavretsky2012projection}. \qed \end{proof} Since Lemma~\ref{lemma_projection} guarantees the boundedness of $\|\hat{\theta}\|$, the adaptive controller \eqref{lagrange_u_adaptive}, $u=-\mathcal{K}(\dot{\mathtt{q}}-\dot{\mathtt{q}}_r)+Y\theta+Y\tilde{\theta}$, can be viewed as the exponentially stabilizing controller $-\mathcal{K}(\dot{\mathtt{q}}-\dot{\mathtt{q}}_r)+Y\theta$ (see Example~\ref{ex:lag_metric}) plus a bounded external disturbance $Y\tilde{\theta}$, implying robustness due to Theorem~\ref{Thm:Robust_contraction_original}~\cite{1576865,lavretsky2012projection,Ref:phasesync,lopez2021universal}. Let us also remark that, as in Example~\ref{ex:lag_adaptive0}, the projection operator-based adaptation law \eqref{projection_adaptation} still achieves asymptotic stabilization. Applying the control law \eqref{lagrange_u_adaptive} with the adaptation \eqref{projection_adaptation} yields the following virtual system which has $q = \xi_0 = [\dot{\mathtt{q}}_r^{\top},{\theta}^{\top}]^{\top}$ and $q = \xi_1 = [\dot{\mathtt{q}}^{\top},\hat{\theta}^{\top}]^{\top}$ as its particular solutions: \begin{align} \label{lagrange_cl_adaptive_proj} \begin{bmatrix}\mathcal{H} & 0 \\ 0 & \mathrm{I}\end{bmatrix}(\dot{q}-\dot{\xi}_0)+\begin{bmatrix}(\mathcal{C}+\mathcal{K})(q_s-\dot{\mathtt{q}}_r)-Y(q_{\theta}-\theta) \\ \proj{}(\hat{\theta},\Gamma Y^{\top}(q_s-\dot{\mathtt{q}}_r),p)\end{bmatrix} =0 \end{align} where $q = [q_s^{\top},q_{\theta}^{\top}]^{\top}$. Thus, for a Lyapunov function $V_{s\ell}=\frac{1}{2}\int_{\xi_0}^{\xi_1}\delta q^{\top}\left[\begin{smallmatrix}\mathcal{H}(\mathtt{q}) & 0\\ 0 & \Gamma^{-1}\end{smallmatrix}\right]\delta q$, we have that \begin{align} \dot{V}_{s\ell} =& \int_{\xi_0}^{\xi_1}-\delta q_s^{\top}\mathcal{K}\delta q_s+\delta q_{\theta}^{\top}(\proj{}(\hat{\theta},Y^{\top}\delta q_s,p)-Y^{\top}\delta q_s). \nonumber \end{align} Using the convex property of the projection operator, i.e.{}, $\tilde{\theta}^{\top}(\proj{}(\hat{\theta},\xi,p)-\xi) \leq 0$~\cite{1576865,lavretsky2012projection}, this gives $\dot{V}_{s\ell} \leq -\int_{\xi_0}^{\xi_1}\delta q_s^{\top}\mathcal{K}\delta q_s$, which results in asymptotic stability of $\delta q$ due to Barbalat's lemma~\cite[p. 405-406]{Ref_Slotine} as in Example~\ref{ex:lag_adaptive0}. \end{example} \begin{example} \label{ex:adaptation_rate_scale} The dependence on $u$ and $\dot{\hat{\theta}}$ in $(d/dt)|_{\hat{\theta}}M$ can be removed by using $\partial_{b_i(x)}M+\partial_{b_i(x_d)}M=0$ as in Theorem~\ref{Thm:adaptive_robust_affine}, and by using adaptation rate scaling introduced in~\cite{lopez2021universal}. In essence, the latter multiplies the adaptation law \eqref{adaptation_general} by any strictly-increasing and strictly-positive scalar function $v(2\rho)$, and update $\rho$ as \begin{align} \label{rho_adaptation} \dot{\rho} = \frac{1}{2}\frac{v(2\rho)}{v_{\rho}(2\rho)}\sum_{i=1}^{c}\frac{1}{V_{\mathtt{e}}+\eta}\frac{\partial V_{\mathtt{e}}}{\partial \hat{\theta}_i}\dot{\theta_i} \end{align} where $v_{\rho}=\partial v/\partial \rho$, $\eta \in\mathbb{R}_{>0}$, and $V_{\mathtt{e}} = \mathtt{e}^{\top}M(x,x_d,u_d,\hat{\theta})\mathtt{e}$ for $\mathtt{e}=x-x_d$ and $M$ given in Definition~\ref{Def:aNCM}, so the additional term due to \eqref{rho_adaptation} cancels out the term involving $\dot{\hat{\theta}}$ in $(d/dt)|_{\hat{\theta}}\bar{W}$ of \eqref{deterministic_contraction_adaptive_tilde} (see~\cite{lopez2021universal} for details). Its robustness property follows from Theorem~\ref{adaptiveNCMthm} also in this case. \end{example} \begin{example} \label{ex:bregman} Using the Bregman divergence-based adaptation in~\cite{boffi2020implicit}, we could implicitly regularize the parameter estimate $\hat{\theta}$ as follows: \begin{align} \label{implicit_reg} \lim_{t\to\infty}\hat{\theta}=\mathrm{arg}\min_{\vartheta\in A}d_{\psi}(\vartheta\|\theta^*)=\mathrm{arg}\min_{\vartheta\in A}d_{\psi}(\vartheta\|\hat{\theta}(0)) \end{align} where $d_{\psi}$ is the Bregman divergence defined as $d_{\psi}(x\|y)=\psi(x)-\psi(y)-(x-y)^{\top}\nabla\psi(y)$ for a convex function $\psi$, and $\mathcal{A}$ is a set containing only parameters that interpolate the dynamics along the entire trajectory. If $\hat{\theta}(0)=\mathrm{arg}\min_{b\in \mathbb{R}^p}\psi(b)$, we have $\lim_{t\to\infty}\hat{\theta}=\mathrm{arg}\min_{\vartheta\in A}\psi(\vartheta)$, which regularizes $\hat{\theta}$ to converge to a parameter that minimizes $\psi$. For example, using $1$-norm for $\psi$ would impose sparsity on the steady-state parameter estimate $\hat{\theta}$~\cite{boffi2020implicit}. \end{example} These extensions of adaptive control techniques described in Examples~\ref{ex:projection_operator}--\ref{ex:bregman} could be utilized with contraction theory and learning-based control as in Theorems~\ref{Thm:adaptive_robust_affine} and~\ref{adaptiveNCMthm}. \begin{remark} \label{remark_PE_condition} Note that the results presented earlier in this section do not necessarily mean parameter convergence, $\lim_{t\to\infty}\|\tilde{\theta}\|=0$, as the adaptation objective is to drive the tracking error $\|x-x_d\|$ to zero~\cite[p. 331]{Ref_Slotine}, not to find out the true parameter $\theta$ out of the many that achieve perfect tracking. Asymptotic parameter convergence, $\lim_{t\to\infty}\|\tilde{\theta}\|=0$ for $\theta$ of \eqref{adaptive_general} under Assumption~\ref{multiplicative_asmp}, could be guaranteed if there is no disturbance and learning error with $\sigma=0$, and we have $\exists T,\alpha_{PE}\in\mathbb{R}_{>0}\text{ s.t.{} }\int_{t}^{t+T}\tilde{Y}^{\top}\tilde{Y}d\tau \succeq \alpha_{PE}\mathrm{I},~\forall{t}$ for $\tilde{Y}$ given in \eqref{definition_Y} (the persistent excitation condition~\cite[p. 366]{Ref_Slotine}). We could also utilize the Bregman divergence-based adaptation to regularize the behavior of $\lim_{t\to\infty}\|\hat{\theta}\|$ as in Example~\ref{ex:bregman}. \end{remark} \section{Contraction Theory} \label{sec:ContractionCH2} A brief review of the results from \cite{Ref:contraction1,Ref:contraction2,Ref:contraction3} as well as connection to finite-gain $\mathcal{L}_p$ stability~\cite{Ref:phasesync} is presented. \iffalse\begin{theorem}[Sufficient Condition for LTV Stability] The linear time-varying system (LTV) ${\dot{x}}={A}(t){x}$ is globally exponentially stable (${x}$ tends to ${0}$ exponentially) if $\exists$ $\beta>0$, $\forall i$, $\forall $ $t\geq 0$, $\lambda_i({A}(t)+{A}(t)^{\top})\leq -\beta$. \end{theorem} \begin{proof} Take $V={x}^{\top}{x}$ and compute $\dot{V}$. \qed \end{proof} \begin{theorem}[Krasovskii's Theorem] \label{Thm:Krasovskii} Let ${A}({x})$ denote the Jacobian of ${f}({x})$ of the autonomous system ${\dot{x}}={f}({x})$. If the matrix ${F}={A}+{A}^{\top}$ is negative on ${B}_r$, the equilibrium point is asymptotically stable. \end{theorem}\fi \subsection{Fundamentals} Consider a smooth nonlinear non-autonomous system \begin{equation}\label{eq:xfx} {{\dot x}}(t)={f}({x}(t),{u}({x},t),t) \end{equation} where ${x}:\mathbb{R}_{+}\to\mathbb{R}^n$, and ${f}: \mathbb{R}^n\times\mathbb{R}^m\times\mathbb{R}_{+}\rightarrow\mathbb{R}^n$. \begin{definition} A virtual displacement, $\delta{x}$ is defined as an infinitesimal displacement at a fixed time, as used in the calculus of variation; i.e., (\ref{eq:xfx}) yields the differential dynamics $\delta\dot{ x}=\frac{\partial {f}}{\partial {x}}\delta x $.\end{definition} \begin{figure} \centering \includegraphics[width=85mm]{figures/contraction_illustration.PNG} \caption{Contraction analysis} \end{figure} A nonlinear stability of \eqref{eq:xfx} can be studied by constructing a Lyapunov function $V(x,t)$, and one example is $V=x^\top P(t)x$. However, in general Lyapunov theory, $V(x,t)$ can be any scalar nonlinear function of $x$. In contrast, contraction theory uses a differential Lyapunov function that is always a quadratic function of $\delta x$, i.e., $V(x,\delta x)=\delta x M(x,t)\delta x$. As a result, finding the differential Lyapunov function for stability analysis boils down to finding a suitable $M(x,t)$, as illustrated below. \begin{theorem} \label{Thm:contraction} For \eqref{eq:xfx}, if there exists a uniformly positive definite metric, ${M}({x},t)={{\Theta}}({x},t)^{T}{{\Theta}}({x},t)$, where ${\Theta}$ is some smooth coordinate transformation of $\delta x$, $\delta{z}={{\Theta}}\delta{x}$, such that either of the following equivalent conditions holds with $\exists \alpha >0$, $\forall t \geq 0$: \begin{align} F=\left({\dot{\Theta}}{({x},t)}+{{\Theta}({x},t)}\frac{\partial {f}}{\partial {x}}\right){{\Theta}({x},t)}^{-1} &\leq - \alpha { I}, \label{eq:MdotContracting} \\ {\dot{M}(x,t)}+\frac{\partial {f}}{\partial {x}}^{\top}M(x,t)+M(x,t)\frac{\partial {f}}{\partial {x}} &\leq - 2 \alpha M(x,t) \end{align} then all solution trajectories of (\ref{eq:xfx}) converge to a single trajectory exponentially fast regardless of the initial conditions, with a global exponential convergence rate, $\alpha$ (i.e., contracting). \end{theorem} \begin{proof} The proof can be found in~\cite{Ref:contraction1}, but we emphasize he use of the Comparison Lemma~\cite[pp. 211]{Khalil:1173048} to be used in the remainder of the paper. Take the time-derivative of the differential Lyapunov function of $\delta x$ (or $\delta z$), $V=\delta {z}^{\top}\delta {z}=\delta{x}^{\top}M(x,t)\delta{x}$: \begin{align} \dot{V}(x,\delta x, t)&=2\delta {z}^{\top}{F}\delta{z}=\delta{x}^{\top}\Bigl({\dot{M}}+\frac{\partial {f}}{\partial {x}}^{\top}{{M}}+{{M}}\frac{\partial {f}}{\partial {x}}\Bigr)\delta{x}\nonumber \\ &\leq -2\alpha \delta{z}^{\top}\delta{z} =- 2 \alpha \delta {x}^{\top}{M}({x},t) \delta {x} \end{align}where the generalized Jacobian $F$ in (\ref{eq:MdotContracting}) is obtained from $\delta \dot{z}=\dot{\Theta}\delta x+ \Theta\delta\dot{x}=F\delta z$. Due to $\dfrac{d}{dt}\delta {z}^{\top}\delta {z}=2\|\delta {z}\|\dfrac{d}{dt}\|\delta {z}\|$, we obtain $\frac{d}{dt}\|\delta {z}\|\leq -\alpha\|\delta {z}\|$. By the Comparison Lemma, we have $\|\delta {z}(t)\|\leq \|\delta {z}_0\|e^{-\alpha t}$. Hence, any infinitesimal length $\|\delta {z}(t)\|$ and $\|\delta {x}(t)\|$ tend to zero exponentially fast. By path integration, this immediately implies that the length of any finite path converges exponentially to zero from any initial conditions.\qed \end{proof} \begin{definition} Such a system (\ref{eq:xfx}) satisfying the conditions in Theorem~\ref{Thm:contraction} is said to be contracting and its solution trajectories are incrementally stable with global exponential convergence.\end{definition} \begin{remark}No matter where the initial states start in the configuration manifold, they converge to a single trajectory with global and exponential convergence. This convergence result epitomizes the significance of contraction analysis. Also, note that Theorem~\ref{Thm:contraction} can be applied to other vector norms of $\|\delta {z}\|_p$ with $p=1$ or $p=\infty$~\cite{Ref:contraction1}. \end{remark} It can also be shown that for a contracting autonomous system of the form ${{\dot x}}={f}({x},{u}({x}))$, all trajectories converge to an equilibrium point exponentially fast. \textcolor{red}{Rev:In essence, contraction analysis implies that stability of nonlinear systems can be analyzed more simply by checking the negative definiteness of a proper matrix, rather than finding some implicit motion integral as in Lyapunov theory. Compare with Lyapunov. The symmetric and positive definite Riemannian metric, from the Lagrangian representation of dynamical systems, facilitates the use of such a metric in contraction analysis.} \begin{corollary} Theorem~\ref{Thm:contraction} can be equivalently proven using the transformed squared length integrated over two arbitrary solutions of \eqref{eq:xfx}, $\xi_1$ and $\xi_2$, can be used a a differential Lyapunov function using the same $M(x,t)$ \begin{equation}\label{eq:VSL} V_{s\ell}\left(x,\delta x,t\right)=\int^{\xi_2}_{\xi_1} \|\delta z\|^2 =\int_{0}^{1}\left(\frac{\partial x}{\partial\mu}\right)^{T}M\left(x,t\right)\left(\frac{\partial x}{\partial\mu}\right)d\mu \end{equation} It is easy to find the smallest path integral (i.e., distance) with the transformation $\Theta(x,t)$ is related as follows. \begin{equation}V_\ell(t)=\int^{\xi_2}_{\xi_1} \|\Theta(x,t)\delta {x}\|=\int^{\xi_2}_{\xi_1} \|\delta {z}\|\leq \sqrt{V_{s\ell}} \end{equation} such that $\underline{m}\left\Vert \xi_1-\xi_2\right\Vert ^{2}\leq V_{s\ell}\left(x,\delta x,t\right)$, $x(\mu=1,t)=\xi_2(t)$, and $x(\mu=0,t)=\xi_1(t)$. \end{corollary} The integral form is useful to handle a perturbed system with auxiliary disturbances or with a stochastic noise as shall be seen in THEOREM X (e.g., bounded in $\mathcal{L}_2$ or $\mathcal{L}_\infty$.) Mention Soojean's Levy noise case. \subsection{Path-Length Integral and Robustness Analysis} Contraction analysis takes a different notion of stability: incremental stability of multiple trajectories. Since contraction means \emph{exponential} convergence, a contracting system exhibits a property of superior robustness. \begin{theorem}[Deterministic Disturbance] \label{Thm:Robust_contraction_original} \textcolor{blue}{SJC to do: integrate with $d_M$ equation: The geodesic distance between the trajectories of $\dot{x}=f(x,t)$ and $\dot{x}_p=f(x_p,t)+d(x_p,t)$ is \begin{equation} \dfrac{d}{dt}d_M(x_p(t),x(t))\leq -\alpha d_M(x_p(t),x(t))+\|\Theta(x_p,t)d(x_p,t)\| \end{equation} Proof: See~\cite{Ref:contraction1,boffi2020implicit}.\\} Let $\xi_1(t)$ be a solution of the contracting system (\ref{eq:xfx}) that satisfies Theorem~\ref{Thm:contraction}, globally exponentially tending to a single trajectory at a contraction rate $\alpha$. (\ref{eq:xfx}) is now perturbed as \begin{equation}\label{Eq:fxt2-1} \dot{{x}} = {f}({x},t) + {d}({x},t) \end{equation} and $\xi_2(t)$ denotes a trajectory of (\ref{Eq:fxt2-1}). Then, the smallest path integral (i.e., distance) \begin{equation} V_\ell(t)=\int^{\xi_2}_{\xi_1} \|\delta {z}(t)\|=\int^{\xi_2}_{\xi_1} \|{\Theta}({x},t)\delta {x}(t)\|,\ \ \forall t\geq 0 \label{eq:VL} \end{equation}exponentially converges to an error ball with ${\Theta}{d}\in \mathcal{L}_\infty$. Specifically, if $\underline{m}I \preceq M(x,t) \preceq \overline{m}$, $\forall x,t$, \begin{equation}\label{Eq:Robust_contraction21} \|\xi_1-\xi_2\|\ \leq \frac{e^{-\alpha t}V_\ell(0)}{\sqrt{\underline{m}}}+\frac{\sqrt{\overline{m}}\sup_{x,t}{\|{d}({x},t)\|}}{\sqrt{\underline{m}}}\frac{1-e^{-\alpha t}}{\alpha} \end{equation} with \begin{equation} \lim_{t\rightarrow \infty}\|\xi_1(t)-\xi_2(t)\| \leq \sqrt{\frac{\overline{m}}{\underline{m}}}\frac{\sup_{{x},t}\| {d}(x,t)\|}{\alpha} \end{equation} \end{theorem} \begin{proof} Since $\dfrac{d}{dt}\delta {z}^{\top}\delta {z}=2\|\delta {z}(t)\|\dfrac{d}{dt}\|\delta {z}(t)\|=2\delta z (F\delta z+ \Theta \delta z)$, we find $ \dfrac{d}{dt}\|\delta {z}(t)\|\leq -\alpha \|\delta {z}(t)\|+\|{\Theta}\delta {d}\|$. By applying the path integral between $\xi_1$ and $\xi_2$, we can obtain \begin{align}\label{Eq:Robust_contraction3prev} \int^{\xi_2}_{\xi_1}\dfrac{d}{dt}\|\delta {z}(t)\|&\leq -\alpha \int^{\xi_2}_{\xi_1}\|\delta {z}(t)\|+\int^{\xi_2}_{\xi_1}\|{\Theta}\delta {d}\|\\ \dot{V}_\mathrm{L}(t)&\leq -\alpha V_\ell(t)+ \|{\Theta}(x,t){d}(x,t)\| \end{align} Then, applying the comparison lemma [Khalil, p.102-103, p.350-353] and taking the supremum of $\|{\Theta}{d}\|$ out of the convolution integral results in \begin{align} V_\ell(t) \leq e^{-\alpha t}V_\ell(0)+\sup_t{\|{\Theta}({x},t){d}({x},t)\|}\frac{1-e^{-\alpha t}}{\alpha }\nonumber \end{align} By using $\xi_1-\xi_2=\int^{\xi_2}_{\xi_1} \delta {x}$ and $\|\xi_1-\xi_2\|=\|\int^{\xi_2}_{\xi_1} \delta {x}\| \leq \int^{\xi_2}_{\xi_1} \|\delta {x}\| \leq \int^{\xi_2}_{\xi_1} \|\Theta^{-1}\|\|\delta z\| $, we obtain $\sqrt{\inf_t\lambda_\mathrm{min}({M})}\|\xi_1-\xi_2\|\leq V_\ell= \int^{\xi_2}_{\xi_1} \|\delta {z}\|$. \begin{align} \|\xi_1-\xi_2\|\ \leq \frac{e^{-\alpha t}V_\ell(0)}{\sqrt{\inf_t\lambda_\mathrm{min}({M})}}+\frac{\sup_t{\|{\Theta}({x},t){d}({x},t)\|}}{\sqrt{\inf_t\lambda_\mathrm{min}({M})}}\frac{1-e^{-\alpha t}}{\alpha}\nonumber \end{align} which leads to (\ref{Eq:Robust_contraction21}) \qed \end{proof} Now, consider the following two systems with trajectories $\xi_1(t)$ and $\xi_2(t)$ driven by two independent Wiener processes $\mathscr{W}_1(t)$ and $\mathscr{W}_2(t)$: \begin{align} \label{eq4} d\xi =& \begin{bmatrix} f(\xi_1,t) \\ f(\xi_2,t) \end{bmatrix} dt + \begin{bmatrix} G_1(\xi_1,t) & 0 \\0 & G_2(\xi_2,t) \end{bmatrix}\begin{bmatrix} d\mathscr{W}_1 \\ d\mathscr{W}_2 \end{bmatrix} \end{align} where $\xi(t) = [\xi_1(t)^{\top},\xi_2(t)^{\top}]^{\top}\in\mathbb{R}^{2n}$. For stochastic incremental stability between $\xi_1$ and $\xi_2$, we need to use $V_{s\ell}$ from \eqref{eq:VSL} to yield $\mathscr{L}V_{s\ell} \leq -2\gamma_1V_{s\ell}+\underline{m}C_c$ where $\mathscr{L}$ is an infinitesimal differential generator. \begin{theorem}[Stochastic Disturbance]~\cite{Pham2009,mypaperTAC,Ref:Stochastic}. \label{Thm:robuststochastic} If (\ref{eq:MdotContracting}) holds (i.e.{}, the deterministic system (\ref{eq:xfx}) is contracting), then we have \begin{align} \label{Eq:boundnewsto} E\left[\|\xi_1(t)-\xi_2(t)\|^2\right] \leq \frac{C_c}{2\alpha_1}+\frac{E[V_{s\ell}(0)]e^{-2\gamma_1 t}}{\underline{m}}. \end{align} where for a positive constant $\alpha_1 = \alpha-((g_1^2+g_2^2)/2\underline{m})(\varepsilon_c\overline{m}_{x}+\overline{m}_{x^2}/2)$, $\alpha$ is the same contraction rate for the unperturbed system from ~\eqref{eq:MdotContracting}, $\varepsilon>0$ is an arbitrary constant, and $C_c=(\overline{m}/\underline{m}+\overline{m}_{x}/(\varepsilon\underline{m}))(g_1^2+g_2^2)$, $\|G_1(x,t)\|_F \leq g_1$, $\|G_2(x,t)\|_F \leq g_2$, $\|\partial (M_{ij})/\partial x\| \leq \overline{m}_{x}$, and $\left\|{\partial^2(M_{ij})}/{\partial x^2}\right\| \leq \overline{m}_{x^2},~\forall x,t$. Note that $E[\cdot]$ denotes the expected value operator. \end{theorem} \subsection{Input Output Stability: Finite-Gain $\mathcal{L}_p$ Stability} \begin{theorem} \label{Thm:Robust_contraction} If Theorem~\ref{Thm:contraction} holds and (\ref{Eq:fxt2-1}) is perturbed by ${d}({x},t)\in \mathcal{L}_{pe}$, then (\ref{Eq:fxt2-1}) is finite-gain $\mathcal{L}_p$ stable with $p\in [1,\infty]$ for an output function ${y}={h}({x},{d},t)$ with $\int^{Y_2}_{Y_1}\|\delta {y}\|\leq \eta_1 \int^{\xi_2}_{\xi_1}\|\delta {x}\|+\eta_2\|{d}\|$, $\exists $ $\eta_1,\eta_2\geq0$. In other words, $\forall \tau\in[0,\infty)$, \begin{align}\label{Eq:Robust_contractionLp} \left\|{\left(\int^{Y_2}_{Y_1} \|\delta {y}\|\right)_\tau}\right\|_{\mathcal{L}_p} \leq& (\frac{\eta_1}{\alpha}+{\eta_2})\frac{\|({\Theta}{d})_\tau \|_{\mathcal{L}_p}}{\sqrt{\lambda_\mathrm{min}({M})}}+\frac{\eta_1\zeta V_\ell(0)}{\sqrt{\lambda_\mathrm{min}({M})}}, \end{align} where $Y_1$ and $Y_2$ denote the output trajectories of the original contracting system (\ref{eq:xfx}) and its perturbed system (\ref{Eq:fxt2-1}), respectively. Also, $\zeta=1$ if $p=\infty$ or $\zeta=1/(\alpha p)^{1/p}$ if $p\in[1,\infty)$, and $\lambda_\mathrm{min}({M})$ is defined as ${M}({x},t)\geq \lambda_\mathrm{min}({M}){I}$, $\forall$ $t\geq 0$. The perturbed system (\ref{Eq:fxt2-1}) is also input-to-state stable (ISS)~\cite{Ref:phasesync}. \end{theorem} \begin{proof}In keeping with Corollary 5.1 of [Khalil], (\ref{Eq:Robust_contraction3prev}) satisfies \begin{align}\label{Eq:Robust_contractionLp2} \|(V_\ell)_\tau\|_{\mathcal{L}_p}&\leq V_\ell(0)\|(e^{-\alpha t})_\tau\|_{\mathcal{L}_p} +\|e^{-\alpha t}\|_{\mathcal{L}_1} \|({\Theta}{d})_\tau \|_{\mathcal{L}_p} \nonumber \\ &\leq V_\ell(0)\zeta +\|({\Theta}{d})_\tau \|_{\mathcal{L}_p}/\alpha \end{align} Since ${M}\succ 0$ uniformly, $\|{\Theta}^{-1}\|\leq 1/\sqrt{\lambda_\mathrm{min}({M})}$. Then, (\ref{Eq:Robust_contractionLp}) is obtained by using both (\ref{Eq:Robust_contractionLp2}) and the known bound of $\|\delta {y}\|$, thereby yielding a finite $\mathcal{L}_p$ gain independently of $\tau$. Note that if we can further show that ${M}({x},t)$ is uniformly upper-bounded, we can use $\|({\Theta}{d})_\tau \|_{\mathcal{L}_p}\leq \alpha \|({d})_\tau \|_{\mathcal{L}_p}$, $\exists \alpha>0$. For ISS, we can compute an ultimate bound of $V_\ell(t)$, which is true for $t\geq T$, $\exists$ $T$ instead of $t\rightarrow\infty$ as in (\ref{Eq:Robust_contraction21}), since global exponential stability of an unperturbed system results in input-to-state stability (see Lemma 4.6 of~\cite{Khalil:2002}). \qed \end{proof} \begin{theorem \label{Thm:Robust_contraction_hierc} The hierarchically combined system of two contracting dynamics with a generalized Jacobian $\left[\begin{smallmatrix}{F}_{11} & {0}\\ {F}_{21} & {F}_{22}\end{smallmatrix}\right]$ is assumed to be subject to a perturbed flow field of $[{d}_1;{d}_2]$. Then, the path length integral $V_{\mathrm{L},i}(t)=\int^{\xi_2}_{\xi_1}\|\delta {z}_i\|$, $i=1,2$ between the original and perturbed dynamics verifies~\cite{Ref:contraction1} \begin{align}\label{Eq:hierclemma} \dot{V}_{\mathrm{L},1}+|\lambda_\mathrm{max}({F}_{11})|V_{\mathrm{L},1}&\leq\|{\Theta}_1{d}_1\| \\ \dot{V}_{\mathrm{L},2}+|\lambda_\mathrm{max}({F}_{22})| V_{\mathrm{L},2}&\leq\|{\Theta}_2{d}_2\|+\int^{\xi_2}_{\xi_1}\|{F}_{21}\|\|\delta {z}_1\|\nonumber \end{align} Hence, the error bounds of $R_1(t)$ and $R_2(t)$ can be obtained similar to (\ref{Eq:Robust_contraction21}) and (\ref{Eq:Robust_contraction3}-\ref{Eq:Robust_contractionLp2}) under the assumption of bounded $\|{F}_{21}\|$. Also, similar to (\ref{Eq:Robust_contractionLp}), a hierarchical connection for $\mathcal{L}_p$ stability can be established by using \begin{align}\label{Eq:hierclemma2} \|(V_{\mathrm{L},2})_\tau\|_{\mathcal{L}_p} & \leq V_{\mathrm{L},2}(0)\zeta_2 +\frac{\bar{\sigma}({F}_{21})}{\alpha_2}V_{\mathrm{L},1}(0)\zeta_1 \\ &\ \ +\frac{\|({\Theta}_2{d}_2)_\tau \|_{\mathcal{L}_p}}{\alpha_2}+\frac{\bar{\sigma}({F}_{21})}{\alpha_1\alpha_2}\|({\Theta}_1{d}_1)_\tau \|_{\mathcal{L}_p}\nonumber \end{align} where $\alpha_i=|\lambda_\mathrm{max}({F}_{ii})|$ from (\ref{Eq:hierclemma}) and $\bar{\sigma}(\cdot)$ is the largest singular value for all $t\geq0$. Also, $\zeta_i=1$ if $p=\infty$ or $\zeta_i=1/(\lambda_i p)^{1/p}$ if $p\in[1,\infty)$ for $i=1,2$. By recursion, this result can be extended to an arbitrary number of hierarchically combined groups.\end{theorem} \begin{proof} The proof follows from obtaining $\|(V_{\mathrm{L},1})_\tau\|_{\mathcal{L}_p}$ from (\ref{Eq:Robust_contractionLp2}) and recursively obtaining $\|(V_{\mathrm{L},2})_\tau\|_{\mathcal{L}_p}$ from the second equation of (\ref{Eq:hierclemma}). \qed \end{proof} \section{Contraction-based $H_\infty$ Control and KYP Lemma} \subsection{Linear Matrix Inequality Condition for $M(x,t)$} Consider the dynamics either perturbed by a general disturbance $d(t)$~\eqref{original_dynamics} or by Gaussian white noise~\eqref{sdc_dynamics} \begin{align} \label{original_dynamics} \dot{x} &= f(x,t) + B(x,t)u + G_u(x,t)d(x,t) \\ \label{sdc_dynamics} dx &= (f(x,t)+B(x,t)u)dt+G_u(x,t)d\mathscr{W}(t) \\ \label{sdc_dynamicsd} \dot{x}_d &= (f(x_d,t)+B(x_d,t)u_d(x_d,t) \end{align} where $B:\mathbb{R}^n\times\mathbb{R}_{\geq0}\to\mathbb{R}^{n\times m}$, $G_u:\mathbb{R}^n\times\mathbb{R}_{\geq0} \to \mathbb{R}^{n\times d}$, $\mathscr{W}(t)$ is a $d$-dimensional Wiener process, and $d(t)$ is a $d$ dimensional (deterministic) disturbance. Also, for~\eqref{sdc_dynamicsd}, $x_d:\mathbb{R}_{\geq0} \to \mathbb{R}^{n}$ and $u_d:\mathbb{R}^n\times\mathbb{R}_{\geq0} \to \mathbb{R}^{m}$ denote the desired target state and input trajectories, respectively. Consider a convex combination of SDC parameterizations $A_i(x,t)$ so that the pair $(A(\varrho,x,t),B(x,t))$ is uniformly controllable with the coefficients, $\varrho=(\varrho_1,\cdots,\varrho_{s_1})$: \begin{align} f(x,t)=A(\varrho,x,t)x=\sum_{i=1}^{s_1}\varrho_iA_i(x,t)x. \end{align} Then, we can design the nonlinear tracking control law parametrized by the metric $M(x,t)$: \begin{align} u &= -K(x,t)(x-x_d)+u_d \nonumber \\ \label{controller} &= -R(x,t)^{-1}B(x,t)^{\top}M(x,t)(x-x_d)+u_d \end{align} where $R(x,t) \succ 0$ is a weight matrix on the input $u$ and $M(x,t)$ is a positive definite matrix which satisfies the following matrix inequality to be defined in \eqref{riccati}. Substituting (\ref{controller}) into (\ref{original_dynamics}) and subtracting it from (\ref{sdc_dynamicsd}) yields the following virtual dynamics of $y$: \begin{align} \label{closed_loop_e} \dot{y} = f_v(y,t)+G(y,t)d(x,t) \end{align} where $G(e,t) = G_u(x,t)$, and $G(0,t) = 0_{n \times d}$. Hence, $y= e = x-x_d$ holds for the closed-loop system with \begin{align} f_v(y,t) &=\left(A(\varrho,x,t)-B(x,t)K(x,t) \right)y \nonumber\\ &\ \ \ +\Delta A(\varrho,y,t) x_d + \Delta B(y,t) u_d\nonumber\\ \Delta A(\varrho,y,t) &= A(\varrho,y+x_d,t)-A(\varrho,x_d,t) \nonumber \\ \Delta B(y,t) &= B(y+x_d,t)-B(x_d,t). \end{align} Furthermore, setting $y=0$ in~\eqref{closed_loop_e} without the perturbation $d(x,t)$ or $d\mathscr{W}$ (due to $G(0,t)=0$) simply results in \eqref{sdc_dynamicsd}. Consequently, both $y=x-x_d$ and $y=0$ are the particular solutions of \eqref{closed_loop_e}. Then the aim is to prove contraction of \eqref{closed_loop_e} in the sense of Theorem~\ref{Thm:contraction}, which in turn implies exponential convergence of $x\rightarrow x_d$. The differential dynamics of (\ref{closed_loop_e}) using $\delta y$ is given as \begin{align} \delta\dot{y} = \left(A(\varrho,x,t)-B(x,t)K(x,t) \right)\delta y+\phi(\varrho,y,t)\delta y\label{eq:phidef} \end{align} where $\phi(\varrho,y,t) = {\partial \left(\Delta A(\varrho,y,t)x_d + \Delta B(\varrho,y,t)u_d\right)}/{\partial y}$. \begin{align} \dot{V}_{s\ell}=\int (y,\delta y)=\delta y (\dot{M} +2\sym(M(A_{cl}(\rho,e,t)+\phi(\rho,y,t)) \delta y \end{align}$A_{cl}$ not defined. With $M(x,t)^{-1}=W(x,t)$, we introduce additional variables $\chi$ and $\nu$ defined as \begin{align} \label{lambda_con} I \preceq \bar{W} (x,t)\preceq \chi I \end{align} which follows from $\lambda_\mathrm{min}(W)I\leq W\leq \lambda_\mathrm{max}(W)I$ with $\bar{W}=\nu W$, $\nu=1/\lambda_\mathrm{min}(W)=\lambda_\mathrm{max}(M)$, and the condition number $\chi=\kappa(W)=\kappa(\bar{W})=\kappa(M)=\lambda_\max{\bar{W}}$. the contraction metric matrix $M(x,t)$ in~\eqref{controller} (hence $W$ or $\bar{W}$) satisfies the following four equivalent SDRI equations. \begin{theorem}\label{Thm:CVSTEM:LMI} If (\ref{lambda_con}) holds, for either $\gamma > 0$ or $\alpha>0$ given as a design parameter, the following four inequalities (SDRI) are equivalent and Theorems~\ref{Thm:contraction} and \ref{Thm:robuststochastic} hold. \begin{align} & \dot{M}+2\sym(M\frac{\partial f_v(y,t)}{\partial y})+2\alpha_g I\preceq -2 \alpha M, \ \ y\in[0,x-x_d]\label{riccatiFV} \\ &\dot{M}+2\sym(M(A+\phi))-2MBR^{-1}B^{\top}M+2\alpha_g I\preceq -2 \alpha M \label{riccati} \\ &-\dot{\bar{W}}+2\mathrm{sym}\left((A+\phi)\bar{W}\right)-2\nu BR^{-1}B^{\top}+\frac{2\alpha_g}{\nu}\bar{W}^2 \preceq -2\alpha \bar{W}. \label{riccatiW}\\ &\begin{bmatrix} -\dot{\bar{W}}+2\mathrm{sym}\left((A+\phi+\alpha I)\bar{W}\right)-2\nu BR^{-1}B^{\top}& \bar{W} \\ \bar{W} & -\frac{\nu}{2\alpha_g}I \end{bmatrix} \preceq 0.\label{alpha_cond_convex_3} \end{align} where $I \preceq \bar{W} \preceq \chi I$ is required for (\ref{riccatiW},\ref{alpha_cond_convex_3}). Also, the state and time dependencies $(x,t)$ for each matrix and $\phi$, including $A(\varrho,x,t))$, are suppressed for notation simplicity, $2\alpha_g = g_u^2\left(\overline{m}_{x}\varepsilon+\overline{m}_{x^2}/2\right)$ and \textcolor{red}{actually $\phi$ is a function of $y$. We can add $\|M\phi+\phi^\top M\|\leq \gamma_\phi$} Note $\|G_u(x,t)\|_F\leq g_u,~\forall x,t$, $\|\partial(m_{ij})/\partial x\| \leq \overline{m}_{x}$, and $\left\|{\partial^2(m_{ij})}/{\partial x^2}\right\| \leq \overline{m}_{x^2}$ with an arbitrary positive constant $\varepsilon$. \textcolor{blue}{Refer to $\alpha_1$ in Thm.~\ref{Thm:robuststochastic}}. \end{theorem} \begin{proof} Equivalence of \eqref{riccati} and \eqref{riccatiFV} is straightforward and these inequalities satisfies the conditions in Theorems~\ref{Thm:contraction} and \ref{Thm:robuststochastic}. Since $\nu > 0$ and $W(x,t) \succ 0$, multiplying (\ref{riccati}) by $\nu$ and then by $W(x,t)$ from both sides preserves matrix definiteness. Also, the resultant inequalities are equivalent to the original ones~\cite[pp. 114]{lmi}. For the SDRI constraint (\ref{riccati}), these operations yield the desired inequality (\ref{riccati_lmi_con}). Applying Schur's complement lemma~\cite[pp. 7]{lmi} to (\ref{riccatiW}) results in the desired LMI constraint (\ref{alpha_cond_convex_3}). \end{proof} \begin{remark} Using the following two inequalities in~\cite{mypaperTAC} is now relaxed to using only \eqref{alpha_cond_convex_3}. With $\bar{\gamma}=\nu \gamma$, \begin{align} \label{riccati_lmi_con} &-\dot{\bar{W}}+A\bar{W}+\bar{W}A^{\top}+\bar{\gamma} I-\nu BR^{-1}B^{\top} \preceq 0 \label{alpha_cond_convex_2}\\ &\begin{bmatrix} \bar{\gamma} I+\nu BR^{-1}B^{\top}-\bar{W}\phi^{\top}-\phi \bar{W}-2\alpha \bar{W}& \bar{W} \\ \bar{W} & \frac{\nu}{2\alpha_g}I \end{bmatrix} \succeq 0.\nonumber \end{align} \end{remark} \subsection{Bounded Real Lemma and $H_\infty$ Control} Consider the following Hurwitz linear system with $d(t)\in \mathcal{L}_2(0,\tau)$, $\tau \in[0,\infty)$ \begin{equation} \dot{x}=\mathcal{A}x+\mathcal{B}d(t), \ \ y=\mathcal{C}x+\mathcal{D}d(t)\label{eq:linearsys} \end{equation} $\mathcal{L}_2$ gain stability is established by the bounded real lemma as follows \begin{equation} \begin{bmatrix}2\mathrm{sym}(\mathcal{A}^\top \mathcal{P})+\mathcal{C}^\top\mathcal{C} & \mathcal{P}\mathcal{B}+\mathcal{C}^\top\mathcal{D} \\ \mathcal{B}^\top\mathcal{P}+\mathcal{D}^\top\mathcal{C} & \mathcal{D}^\top\mathcal{D}-\gamma^2I \end{bmatrix}\preceq 0\label{eq:BoundedRealLemma} \end{equation} which yields $\|y\|_{\mathcal{L}_2}\leq \gamma\|d\|_{\mathcal{L}_2}$ or the $H_\infty$ norm of the transfer function of \eqref{eq:linearsys} is bounded as $\|H\|_\infty<\gamma$. Also, note that it is \emph{output strictly passive (dissipative)}. \textcolor{Note: to be removed} Assuming $V=x^\top \mathcal{P} x\geq 0$, the equation above is equivalent to \begin{align*} &x^\top(\mathcal{A}^\top \mathcal{P}+ \mathcal{P}\mathcal{A}+\mathcal{C}^\top\mathcal{C})x+2x^\top(\mathcal{P}\mathcal{B}+\mathcal{C}^\top\mathcal{D})d+d^\top(\mathcal{D}^\top\mathcal{D}-\gamma^2I)d \\ &=2x^\top \mathcalP (\mathcal{A}x+\mathcal{B}d)+ \|y\|^2-\gamma^2 \|d\|^2 =\dot{V}+\|y\|^2-\gamma^2 \|d\|^2\leq 0 \end{align*} \begin{align*} V(\tau)-V(0) +\int^\tau_0 \|y(t)\|^2 dt \leq \int^\tau_0 \|d(t)\|^2 dt \\ \int^\tau_0 \|y(t)\|^2 dt \leq \gamma^2 \int^\tau_0 \|d(t)\|^2 dt +V(0)\\ \| y_\tau\|_{\mathcal{L}_2} \leq \gamma \|d_\tau\|_{\mathcal{L}_2}+\sqrt{V(0)} \end{align*} \begin{theorem} \textcolor{blue}{By comparing (\ref{alpha_cond_convex_4}) with (\ref{eq:BoundedRealLemma}), the contracting system (19) that satisfies the LMI, (\ref{alpha_cond_convex_3}) satisfies the bounded real lemma by setting $\mathcal{P}=\bar{W}$, $\mathcal{A}^\top=(A+\phi-\nu BR^{-1}B^{\top} \bar{W}^{-1})$, $\mathcal{B}=I$, $\mathcal{D}=0$, and $\gamma^2=\nu/(2\alpha_g)$, while sufficiently large $\alpha$ with $\alpha \bar{W}\geq \mathcal{C}^\top\mathcal{C}$.} \end{theorem} \subsection{KYP Lemma and Strictly Positive-Real System} Consider the quadratic Lyapunov function $V=x^\top \mathcal{P}_2 x\geq 0$, satisfying the output strict passivity (dissipativity) condition \begin{equation} \dot{V}- 2 d^\top y+ (2/\gamma) y^\top y \leq 0\label{eq:VdotKYP} \end{equation} This equation can be expanded by completing the square \begin{align*} \dot{V}\leq -\gamma(d-y/\gamma)^\top (d-y/\gamma)+\gamma{d^\top d} -(1/\gamma) y^\top y\\ \gamma(V(\tau)-V(0)) +\int^\tau_0 \|y(t)\|^2 dt \leq \gamma^2 \int^\tau_0 \|d(t)\|^2 dt \\ \| y_\tau\|_{\mathcal{L}_2} \leq \gamma \|d_\tau\|_{\mathcal{L}_2}+\sqrt{\gamma V(0)} \end{align*} In order to find the corresponding LMI, (\ref{eq:VdotKYP}) can be written as \begin{align} &\begin{bmatrix} 2\mathrm{sym}(\mathcal{A}^\top \mathcal{P}_2)+2\mathcal{C}^\top\mathcal{C}/\gamma & \mathcal{P}_2\mathcal{B}+\mathcal{C}^\top(2\mathcal{D}/\gamma-I) \\ \mathcal{B}^\top\mathcal{P}_2+(2\mathcal{D}^\top/\gamma-I)\mathcal{C} & -(\mathcal{D}^\top+D)+2\mathcal{D}^\top\mathcal{D}/\gamma \end{bmatrix}\preceq 0\label{eq:KYPLMI} \end{align} which results in the same KYP lemma LMI for a positive real (but not strict PR) system if $1/\gamma=0$. \begin{itemize} \item If LMI~(\ref{eq:BoundedRealLemma}) holds, finite-gain $\mathcal{L}_2$ stable with $\gamma$ as $\mathcal{L}_2$ gain (Done) \item (\ref{eq:VdotKYP}) is equivalent to LMI (\ref{eq:KYPLMI}), equivalent to output strict passive with dissipation $1/\gamma$ and (40). \item If (\ref{eq:VdotKYP}) holds, finite-gain $\mathcal{L}_2$ stable with $\gamma$ as $\mathcal{L}_2$ gain (Done) \item If (\ref{eq:KYPLMI}) holds (output strict passive), (\ref{eq:BoundedRealLemma}) holds (bounded real lemma). The converse is not true (see the proof below) \end{itemize} \begin{align*} &\begin{bmatrix} 2\mathrm{sym}(\mathcal{A}^\top \mathcal{P}_2)+2\mathcal{C}^\top\mathcal{C}/\gamma & \mathcal{P}_2\mathcal{B}+\mathcal{C}^\top(2\mathcal{D}/\gamma-I) \\ \mathcal{B}^\top\mathcal{P}_2+(2\mathcal{D}^\top/\gamma-I)\mathcal{C} & -(\mathcal{D}^\top+D)+2\mathcal{D}^\top\mathcal{D}/\gamma \end{bmatrix}\\ &=\begin{bmatrix}2\mathrm{sym}(\mathcal{A}^\top \mathcal{P}_2) & \mathcal{P}_2\mathcal{B} \\ \mathcal{B}^\top\mathcal{P}_2 & 0\end{bmatrix} +\frac{2}{\gamma}\begin{bmatrix}\mathcal{C}^\top\mathcal{C} & \mathcal{C}^\top\mathcal{D} \\ \mathcal{D}^\top\mathcal{C} & \mathcal{D}^\top\mathcal{D} \end{bmatrix} -\begin{bmatrix}0 & \mathcal{C}^\top \\ \mathcal{C} & \mathcal{D}^\top+D\end{bmatrix} \\ &\succeq\begin{bmatrix}2\mathrm{sym}(\mathcal{A}^\top \mathcal{P}_2) & \mathcal{P}_2\mathcal{B} \\ \mathcal{B}^\top\mathcal{P}_2 & 0\end{bmatrix} +\frac{1}{\gamma}\begin{bmatrix}\mathcal{C}^\top\mathcal{C} & \mathcal{C}^\top\mathcal{D} \\ \mathcal{D}^\top\mathcal{C} & \mathcal{D}^\top\mathcal{D} \end{bmatrix} +\begin{bmatrix}0 & 0\\ 0 & -\gamma I\end{bmatrix} \\ & =\begin{bmatrix} 2\mathrm{sym}(\mathcal{A}^\top \mathcal{P}_2)+\mathcal{C}^\top\mathcal{C}/\gamma & \mathcal{P}_2\mathcal{B}+\mathcal{C}^\top\mathcal{D}/\gamma \\ \mathcal{B}^\top\mathcal{P}_2+\mathcal{D}^\top\mathcal{C}/\gamma & -\gamma I+\mathcal{D}^\top\mathcal{D}/\gamma \end{bmatrix} \end{align*} which is exactly the same as (\ref{eq:BoundedRealLemma}) if you set $\mathcal{P}_2=\mathcal{P}/\gamma$. \subsection{Choice of $A(X,t)$ and Use of $A(x,t)$ vs. $\frac{\delta f(x,t)}{\delta x}$} \textcolor{blue}{To be completed. The advantage of using $A(x)$ instead of $\frac{\delta f(x,t)}{\delta x}$ for its systematic connection to linear state feedback control design based on uniform controllability of $(A,B)$.} In~\cite{nscm}, it is shown that a generalized state-dependent coefficient formulation, i.e.{} $A$ given by $A(x,x_d,t)(x-x_d)=f(x,t)-f(x_d,t)$ instead of $A(x,t)=f(x,t)x$, results in exponential boundedness of the mean squared distance between two system trajectories perturbed by stochastic disturbances even with a target trajectory ($x_d$ for control and $x$ for estimation). [to be revised] \begin{lemma} \label{sdclemma} Suppose that $f(x,t)$ and $B(x,t)$ are continuously differentiable. Then $\exists A(x,x_d,t)$, $\forall x,x_d,u_d,t$ s.t.{} $$A(x,x_d,t)(x-x_d)=f(x,t)-f(x_d,t)+\left(B(x,t)-B(x_d,t)\right)u_d,$$ and one such $A$ is given as follows: \begin{align} \label{sdcAc} A(x,x_d,t) =& \int_0^1\frac{\partial \bar{f}}{\partial x}(c x+(1-c)x_d,t)dc \end{align} where $\bar{f}(q,t)=f(q,t)+B(q,t)u_d(x_d,t)$. We call $A$ an SDC form when it is constructed to satisfy controllability and observability conditions (see Theorem~\ref{nscm_con} and Corollary~\ref{nscm_est}). \end{lemma} \begin{proof} This follows from the integral relation given as $\int_0^1(d\bar{f}(c x+(1-c)x_d,t)/dc)dc=\bar{f}(x,t)-\bar{f}(x_d,t)$. \end{proof} $$A(x,x_d,t)(x-x_d)=f(x,t)-f(x_d,t)+\left(B(x,t)-B(x_d,t)\right)u_d,$$ \import{sections/}{4_ConvexOpt} \iffalse\subsection{Contraction of Combined and Coupled Systems} The following theorems are used to derive stability and synchronization of coupled dynamics systems. \begin{theorem}[parallel combination]\label{Thm:parallel} Consider two time-varying nonlinear systems, contracting in the same metric function which does not explicitly depend on time such that ${M}({x})={{\Theta}}({x})^{T}{{\Theta}}({x})$ and ${{\dot \Theta}}=\frac{\partial {\Theta}}{\partial {x}}{\dot x}$: \begin{equation} {\dot x} = {f}_i({x},t) \ \ \ \ \,\ i=1,2 \end{equation} Then, any positive superposition with $\alpha_i > 0$ \begin{equation} {\dot x} = \alpha_1{f}_1({x},t)+\alpha_2{f}_2({x},t) \end{equation} is contracting in the same metric. By recursion, this parallel combination can be extended to any number of systems. \end{theorem} \begin{proof} Since the original dynamics are contracting with a time-independent metric, the generalized Jacobian, ${F}$ in (\ref{eq:MdotContracting}) becomes \begin{align} {F}=&\left({\dot{\Theta}}{({x})}+{{\Theta}({x})}\frac{\partial {f}_i}{\partial {x}}\right){{\Theta}({x})}^{-1} \nonumber \\ =&\left(\frac{\partial {\Theta}({x})}{\partial {x}}{f }_i+{{\Theta}({x})}\frac{\partial {f}_i}{\partial {x}}\right){{\Theta}({x})}^{-1} \end{align} Since the individual systems are contracting, \begin{align} \frac{d}{dt}(\delta {z}^{\top}\delta {z})=&\delta {z}^{\top}\left(\frac{\partial {\Theta}}{\partial {x}}{f}_i+{{\Theta}}\frac{\partial {f}_i}{\partial {x}}\right){{\Theta}}^{-1}\delta {z} \nonumber \\ \leq& -2\lambda_i \delta {z}^{\top}\delta {z}, \ \ \ \ i=1,2 \end{align} Hence, the $\delta {z}$ dynamics of the combined system result in \begin{align} &\frac{d}{dt}(\delta {z}^{\top}\delta {z}) \nonumber \\ &=\delta {z}^{\top}\left(\frac{\partial {\Theta}}{\partial {x}}(\alpha_1{f}_1+\alpha_2{f}_2)+{{\Theta}}(\alpha_1\frac{\partial {f}_1}{\partial {x}}+\alpha_2\frac{\partial {f}_2}{\partial {x}})\right){{\Theta}}^{-1}\delta {z} \nonumber \\ &=\sum_{i=1}^2\alpha_i\delta {z}^{\top}\left(\frac{\partial {\Theta}}{\partial {x}}{f}_i+{{\Theta}}\frac{\partial {f}_i}{\partial {x}}\right){{\Theta}}^{-1}\delta {z}\nonumber \\ &\le - 2(\alpha_1\lambda_1+\alpha_2\lambda_2)\delta {z}^{\top}\delta {z}\nonumber \end{align} \qed \end{proof} This parallel combination is extremely important if the system possesses a certain geometrical symmetry. For example, the ${M}$ and ${C}$ matrices from the Lagrangian equation might satisfy ${M_2}={M_{\phi_1}}+{M_{\phi_2}}$ and ${C_2}={C_{\phi_1}}+{C_{\phi_2}}$. This property is extensively exploited later. \begin{theorem}[Hierarchical combination~\cite{Ref:contraction5,Ref:contraction2}]\label{Thm:hierc} Consider two contracting systems, of possibly different dimensions and metrics, and connect them in series, leading to a smooth virtual dynamics of the form \begin{equation} \frac{d}{dt} \begin{pmatrix} \delta{z}_1\\ \delta{z}_2 \end{pmatrix}= \begin{pmatrix} {F}_{11} & {0} \\ {F}_{21} & {F}_{22} \end{pmatrix} \begin{pmatrix} \delta{z}_1\\ \delta{z}_2 \end{pmatrix} \end{equation} Then the combined system is contracting if ${F_{21}}$ is bounded. \end{theorem} \begin{proof} Intuitively, since $\delta {z}_1$ tends to zero, $\delta {z}_2$ tends to zero as well for a bounded ${F}_{21}$. By using a smooth transformation ${\Theta}$: \begin{equation} {\Theta}=\begin{pmatrix}{I} & {0} \\ {0} & \varepsilon {I}\end{pmatrix} \end{equation} Then, the new transformed Jacobian matrix is given as \begin{equation} {\Theta}{F}{\Theta}^{-1}=\begin{pmatrix} {F}_{11} & {0} \\ \varepsilon{F}_{21} & {F}_{22} \end{pmatrix}, \end{equation} which is negative definite for a sufficiently small $\varepsilon >0$. \qed \end{proof} Composite variables, ${s}= {\dot{q}}-{\dot{q}}_d+{\Lambda}({{q}}-{{q}}_d)$ are an excellent example of a hierarchical combination. Its usage for nonlinear tracking control and robust sliding control shall be discussed in the subsequent sections. Another interesting combination that occurs in the nonlinear control synthesis is feedback combination. \begin{theorem}[Feedback combination~\cite{Ref:contraction3}]\label{Thm:feedback} The overall dynamics of the generalized virtual displacements might be represented as \begin{equation} \frac{d}{dt} \begin{pmatrix} \delta{z}_1\\ \delta{z}_2 \end{pmatrix}={F}\begin{pmatrix} \delta{z}_1\\ \delta{z}_2 \end{pmatrix}= \begin{pmatrix} {F_{1}} & {G}^{\top} \\ {G} & {F_{2}} \end{pmatrix} \begin{pmatrix} \delta{z}_1\\ \delta{z}_2 \end{pmatrix} \end{equation} where ${F}_{1}$ and ${F}_{2}$ are symmetric negative definite matrices. In order to prove contraction of the combined system, one needs to check if ${F}$ is negative definite. From the standard linear algebra~\cite{Ref:HornJohnson}, ${F}$ is uniformly negative definite if and only if \begin{equation} {F}_{2}< {G}^{\top}{{F}_{1}}^{-1}{G} \end{equation} A sufficient condition for the above inequality can be given as \begin{equation} \lambda({F}_{1})\lambda({F}_{2})>\sigma^2({G}) \end{equation} where $\lambda(\cdot)$ is the contraction rate, which is the absolute value of the largest eigenvalue (least negative) of the contracting system. $\sigma(\cdot)$ denotes the largest singular value. \end{theorem} It should be noted that the overall contraction rate is no greater than the individual contraction rate of ${F}_{1}$ and ${F}_{2}$ by the eigenvalue interlacing theorem~\cite{Ref:HornJohnson}. Indeed, one can find the explicit lower bound of the contraction rate as~\cite{Ref:contraction2} \begin{equation} \lambda({F})=\frac{\lambda({F}_{1})+\lambda({F}_{2})}{2}-\sqrt{\left(\frac{\lambda({F}_{1})-\lambda({F}_{2})}{2}\right)^2+\sigma^2({G})} \end{equation} \subsection{High-Order Contraction for Adaptive and Integral Control} This section presents a new theorem that can be conveniently used to prove contraction of a second-order nonlinear system. Consider the following second-order time-varying nonlinear differential equation \begin{equation}\label{2nd_order} \ddot{x}+a_1(x)\dot{x}+a_2(x,t)=u(t) \end{equation} where $a_1(x)$ is a smooth function of $x$, and $a_2(x,t)$ is a smooth function of $x$ and $t$. \begin{remark} Proving contraction of (\ref{2nd_order}) is difficult, since the original contraction analysis is originally stated for first-order systems. Finding some smooth coordinate transformation of the virtual displacement, $\delta{z}={{\Theta}}\delta{x}$, is the key such that the generalized Jacobian $ F$ associated with the augmented system of $(x,\dot x)^{\top}$ is uniformly negative definite. \end{remark} \begin{remark} In general, finding such a transformation, ${\Theta}$ is not trivial. Even without the use of contraction theory, proving exponential and global stability of a general time-varying nonlinear second-order system can be a very difficult problem.\end{remark} We present the main theorem of this section, which provides a sufficient condition for contraction of (\ref{2nd_order}) \begin{theorem}[High-order analysis]\label{theorem1} The nonlinear system in (\ref{2nd_order}) is contracting (all solutions converge to a single trajectory exponentially fast from any initial conditions), if \begin{equation} a_1(x)>0, \ \ \ \ \ \forall x \end{equation} and if \begin{equation} \frac{\partial a_2(x,t)}{\partial x}>0, \ \ \ \frac{d}{dt}\left(\frac{\partial a_2(x,t)}{\partial x}\right)>0\ \ \ \ \ \forall t \end{equation} \end{theorem} \begin{proof} The virtual displacement equation of (\ref{2nd_order}) is \begin{equation}\label{2nd_order_virt} \delta{\ddot{x}}+a_1(x)\delta{\dot{x}}+\left[\dot{a}_1+\frac{\partial a_2(x,t)}{\partial x}\right]\delta{x}=0 \end{equation} Equation (\ref{2nd_order_virt}) can be written as a first-order differential equation by defining the vector state ${x}=(x,\dot x)^{\top}$: \begin{align} &\delta\dot{{x}}=\frac{\partial {f}}{\partial {x}}\delta{{x}}\\ &\frac{d}{dt}\begin{pmatrix}\delta x\\ \delta \dot x \end{pmatrix}=\begin{bmatrix}0 & 1\\-\left(\dot{a}_1+\frac{\partial a_2}{\partial x}\right)&-a_1\end{bmatrix}\begin{pmatrix}\delta x\\ \delta \dot x \end{pmatrix}\nonumber \end{align} Let us take the following transformation matrix \begin{equation} {\Theta}({x},t)=\begin{pmatrix}1&0\\ a_1/\sqrt{\frac{\partial a_2}{\partial x}} &1/\sqrt{\frac{\partial a_2}{\partial x}}\end{pmatrix} \end{equation} It is straightforward to calculate the associated Jacobian as \begin{align}\label{Jacobian} {F}&=\left({\dot{\Theta}}{({x},t)}+{{\Theta}({x},t)}\frac{\partial {f}}{\partial {x}}\right){{\Theta}({x},t)}^{-1}\\ &=\begin{bmatrix}-a_1(x) & \sqrt{\frac{\partial a_2}{\partial x}}\\-\sqrt{\frac{\partial a_2}{\partial x}} &-\frac{d}{dt}\left(\frac{\partial a_2}{\partial x}\right)/\left(2\frac{\partial a_2}{\partial x}\right)\end{bmatrix}\nonumber \end{align} From the contraction theory, (\ref{2nd_order}) is contracting if the symmetric part of ${F}$ is uniformly negative definite, which corresponds to the conditions in Theorem \ref{theorem1}. \qed \end{proof} \begin{example}[Extension] Suppose that $\omega$ in (\ref{vanderpol}) is now time-varying such that \begin{equation} \ddot{x}+a_1(x)\dot{x}+K_1e^{K_2t}x=u(t) \end{equation} where $a_1(x)>0$, $K_1>0$, and $K_2>0$. The above dynamics is contracting since $\frac{d}{dt}\left(\frac{\partial a_2(x,t)}{\partial x}\right)=K_1K_2 e^{K_2t}>0$. \end{example} \subsection{Tracking Control of Robots and Aerospace Vehicles}\label{Sec:tracking_con_robot} The dynamics of a robot or a vehicle is given as \begin{equation} {M}({q}){\ddot{q}}+ {C}({q},{\dot{q}}){\dot{q}}+{g}({q}) ={\tau} \end{equation} \noindent One may consider the following tracking control law~\cite{Ref:Slotine,Ref:contraction_robot} to follow the desired trajectory ${{q}}_{d}(t)$ \begin{equation}\label{tracking_controller_proof} {\tau}={{M}} ({q}){{\ddot{q}}_{r}}+ {C}({q},{\dot{q}}){{\dot{q}}_{r}}+{g}({q}) -{K}({\dot{q}}-{\dot{q}}_{r}) \end{equation} where ${\dot{q}}_{r}={\dot{q}}_{d}-{\Lambda}{\widetilde{q}}={\dot{q}}_{d}-{\Lambda}({q}-{q}_{d})$ and positive-definite matrices ${K}$ and ${\Lambda}$. Note that this tracking control law was first introduced by Slotine and Li~\cite{Ref:Slotine} for the new adaptive control law. Compared to the feedback linearized control law (computed torque control), the equation in (\ref{tracking_controller_proof}) does not cancel the robot dynamics, but it still guarantees exponential tracking convergence at the same rate as an exact cancelation of the feedback linearized control (see the discussion in \cite{Ref:Slotine}). Also, its robustness property is compared with a feedback linearization control law in~\cite{Ref:NonlinearAttitude}. \emph{(\textbf{Observer-like virtual systems})}: The incremental stability concept of Theorem~\ref{Thm:contraction} is useful for analyzing stability of an observer or observer-like system. For example, consider an observer-like virtual system constructed from a closed-loop EL system of ${y}$ such as \begin{equation}\label{virtual_tracking_y} {\tau}={{M}} ({q}){\dot y}+ {C}({q},{\dot{q}}){y}+{g}({q}) -{K}({\dot{q}}-{y}) \end{equation} This virtual dynamics has two particular solutions, ${\dot{q}}$ and ${\dot{q}}_{r}$ since both solutions satisfy (\ref{virtual_tracking_y}). \emph{Alternatively}, you can construct an equivalent virtual dynamics \begin{equation}\label{virtual_tracking_y2} {{M}} ({q}){\dot y}+ {C}({q},{\dot{q}}){y} +{K}{y}={\tau} \end{equation} which has particular solutions, ${s}$ and ${0}$. The difference between (\ref{virtual_tracking_y}) and (\ref{virtual_tracking_y2}) is simply whether you focus on the incremental stability between the composite variable ${s}$ and ${0}$ or the incremental stability between ${\dot{q}}$ and ${\dot{q}}_r$. The virtual displacement equation of both (\ref{virtual_tracking_y}) and (\ref{virtual_tracking_y2}) becomes \begin{equation}\label{dvirtual_tracking_y2} {{M}} ({q})\delta{\dot y}+ {C}({q},{\dot{q}})\delta{y} +{K}\delta{y}={0} \end{equation} It is straightforward to find that ${K}>0$ needs to hold for exponential convergence to the desired trajectory. The skew-symmetry of $({\dot{M}}-2{C})$ results in the following differential length analysis \begin{align} &\frac{d}{dt}(\delta{y}^{\top}{M}({q})\delta{y}) =2 \delta{y}^{\top}{M}({q})\delta\dot{{y}}+\delta{y}^{\top}{\dot{M}}({q})\delta{y} \nonumber \\ &= - 2 \delta{y}^{\top}\Bigl({C}({q},{\dot{q}})\delta{y}+{K}\delta{y}\Bigr)+\delta{y}^{\top}{\dot{M}}({q})\delta{y}\ \\&= - 2\delta{y}^{\top} {K} \delta{y}\nonumber \end{align} which indicates that the ${y}$-system is contracting with ${K}>0$. This implies exponential convergence of ${\dot{q}}$ to ${\dot{q}}_{r}$. In the presence of bounded resultant disturbance ${d}(t)$, it follows from Theorem~\ref{Thm:Robust_contraction_original} that: \begin{align} \label{eq:EL_proof1} \lim_{t \rightarrow \infty} \int^{{\dot{q}}}_{{\dot{q}}_{r}}\|\delta\mathbf{y}\|\leq\frac{\lambda_{\max}({M}({q}))}{\lambda_{\min}({K})\lambda_{\min}({M}({q}))}\sup_{t}\|{d}(t)\| \end{align} Hence the dynamics of the closed-loop system is bounded in the presence of bounded resultant disturbance ${d}$. We now prove that convergence of ${s} \rightarrow {0}$ or ${\dot{q}}\rightarrow {\dot{q}}_{r}$ implies convergence of the system's trajectory to the desired trajectory ($\hat{{q}} \rightarrow {q}_d$). It follows from the definition of ${s}$ and setting $\tilde{{q}}={q}_e={q}-{q}_d(t)$ that: \begin{align} {\dot{q}}-{\dot{q}}_d+{\Lambda}({q}-{q}_d)={\dot{q}}_e+{\Lambda}{q}_{e}={s} \end{align} is contracting with an exponential rate of $\lambda_{\min}({\Lambda})$ for ${\Lambda}>0$ if ${s}={0}$. This is obvious from the linear dynamics form. However, we can also use the virtual dynamics of ${\dot{y}}_q+{\Lambda}{y}_q={\dot{q}}_d+{\Lambda}{q}_d$, which has two particular solutions of ${y}_q=\mathbf{q}$ and ${y}_q=\mathbf{q}_d(t)$. Alternatively, we can use ${\dot{y}}_{q}+{\Lambda}{y}_q={0}$, which has ${y}_q=\mathbf{q}_e$ and ${0}$ as its particular solutions. Both forms yield the same dynamics of $\delta {y}_q$ that is the infinitesimal displacement at fixed time In summary, if ${s}={0}$, all solutions of the $\mathbf{y}_q$ virtual dynamics will converge exponentially fast to each other ($\delta \mathbf{y}_q \rightarrow {0}$). By using (\ref{eq:EL_proof1}), it follows from Theorem~\ref{Thm:Robust_contraction_original} and its extension to a hierarchically-combined system (Theorem~\ref{Thm:Robust_contraction_hierc}) that: \begin{align} &\lim_{t\rightarrow\infty}\int_{\mathbf{q}_d}^{{q}}\|\delta\mathbf{y}_q\|=\lim_{t\rightarrow\infty}\int_{0}^{{q}_{e}}\|\delta\mathbf{y}_{q}\| \leq\frac{1}{\lambda_{\min}({\Lambda})}\lim_{t\rightarrow \infty}\int^{s}_{0}\|\delta{y}\| \nonumber \\ & \leq \frac{\lambda_{\max}({M}({q}))}{\lambda_{\min}({\Lambda})\lambda_{\min}({K})\lambda_{\min}({M}({q}))}\sup_{t}\|{d}(t)\| \label{eq:EL_proof2}\end{align} Hence we have shown, by constructing a hierarchically-combined closed-loop system of ${s}$ and ${q}_{e}$, that the attitude trajectory ${q}(t)$ will globally exponentially converge to a bounded error ball around the desired trajectory ${q}_d (t)$. Specifically, it follows from Theorem \ref{Thm:Robust_contraction_original} that this control law is finite-gain $\mathcal{L}_p$ stable and input-to-state stable. Hence the control gains ${K}$ and ${\Lambda}$ can be designed such that the desired error bounds are achieved, as shall be seen below. This is a hierarchical combination due to reduction of the system order via introduction of the composite variable, ${s}$. Consider the following hierarchical virtual system of ${y}_1$ and ${y}_2$: \begin{equation}\label{hierc_sys_ch2} \begin{bmatrix}{{M}}({q}) & {0}\\ {0} &{{I}}\end{bmatrix}\begin{pmatrix}{ \dot y}_1\\{ \dot y}_2\end{pmatrix}+\begin{bmatrix}{C}({q},{\dot{q}})+{K} & {0}\\ -{I} &{\Lambda}\end{bmatrix}\begin{pmatrix}{ y}_1\\ { y}_2\end{pmatrix}=\begin{pmatrix}{ 0}\\ {0}\end{pmatrix} \end{equation} This is hierarchically connected since the dynamics of ${y}_2$ does not affect those of ${y}_1$. It is straightforward to verify that (\ref{hierc_sys_ch2}) has two particular solutions: \begin{equation}\begin{pmatrix}{y}_1={s}\\ {y}_2={q}-{q}_d\end{pmatrix},\ \ \ \ \ \ \begin{pmatrix}{y}_1={0}\\ {y}_2={0}\end{pmatrix}\end{equation}. \begin{remark} If we use the original definition of exponential stability using a Lyapunov function (Theorem \ref{Thm:exponential}) {\color{caltechorange}(theorem not defined)}, we can try $V={s}^{\top}{M}({q}){s}+\alpha \tilde{{q}}^{\top}\tilde{{q}}$, which yields the conditions for contraction by Theorem~\ref{Thm:contraction}: $\alpha{I}<4{K}{\Lambda}$ or $\alpha<4\lambda_\mathrm{min}({K}{\Lambda})$. However, this requires another strong assumption on $\alpha$ to complete the exponential stability of $\|{s}\|$ and $\|{\tilde{q}}\|$, in order to apply Theorem \ref{Thm:exponential} {\color{caltechorange}(theorem not defined)}. Often times, we need to use an ad-hoc Lyapunov function with a cross-term~\cite{Ref:ChungTRO}: $\exists \alpha$, $$V={s}^{\top}{M}({q}){s}+\tilde{{q}}^{\top}\tilde{{q}}+\alpha{s}^{\top}{M}({q})\tilde{{q}}.$$ \end{remark} \fi \iffalse \subsection{Tracking Control of Hamiltonian} We show an equivalent result from the previous section, using the first order canonical form obtained by the transformation, ${p}={M}({q}){s}$ in Section~\ref{sec:hamilton}. The closed-loop system with the tracking control law in (\ref{tracking_controller_proof}) is obtained as \begin{equation}\label{NL_hamiltonian2} {M}({q}){\dot{s}}+ {C}({q},{\dot{q}}){s}+{K}{s} ={0} \end{equation} where ${s}$ is defined in (\ref{composite_variable}). \noindent Equation (\ref{NL_hamiltonian2}) reduces to the following first-order canonical form: \begin{equation} \begin{split} {\dot{p}}=\Bigl[{C}\left({q},{M}^{-1}({q}){p}\right)^{T}-{K}\Bigr]{M}^{-1}({q}){p}\\ {\dot{q}}=-{\Lambda}{q}+{M}^{-1}({q}){p}+ \left({\dot{q}}_d+{\Lambda}{{q}}_d\right)\ \ \ \ \end{split} \end{equation} Consider a virtual system, having ${y}_1={p},{y}_2={q}$ and ${y}_1={0},{y}_2={q}_d$ as its particular solutions: \begin{equation} \begin{split} {\dot{y}}_1=\Bigl[{C}\left({q},{M}^{-1}({q}){p}\right)^{T}-{K}\Bigr]{M}^{-1}({q}){y}_1 \\ {\dot{y}}_2=-{\Lambda}{y}_2+{M}^{-1}({q}){y}_1+ \left({\dot{q}}_d+{\Lambda}{{q}}_d\right) \ \ \end{split} \end{equation} which is also a hierarchical combination. This virtual system can be easily shown to be contracting. Similarly to the previous section, the virtual length analysis with respect to the metric, ${M}^{-1}({q})>0$ yields \begin{align} &\frac{d}{dt}(\delta{{y}_1}^{\top}{M}^{-1}({q})\delta{y}_1) \nonumber \\ =&2 \delta{{y}_1}^{\top}{M}^{-1}({q})\delta{{\dot y}}_1+{{y}_1}^{\top}{M}^{-1}({q})(-{\dot{M}}({q})){M}^{-1}({q})\delta{y}_1 \nonumber \\ =& \delta{{y}_1}^{\top}{M}^{-1}({q})\Bigl({C}+{C}^{\top}-2{K}\Bigr){M}^{-1}({q})\delta{y}_1 \nonumber \\ &-\delta{{y}_1}^{\top}{M}^{-1}({q}){\dot{M}}({q}){M}^{-1}({q})\delta{y}_1\ \nonumber\\=& - 2\delta{{y}_1}^{\top} {M}^{-1}({q}){K} {M}^{-1}({q})\delta{y}_1 \end{align} where we used \begin{equation}\frac{d}{dt}{M}^{-1}({q})=-{M}^{-1}({q}){\dot{M}}({q}){M}^{-1}({q})\end{equation} This shows that ${y}_1$ is contracting with ${K}>0$, which in turn corresponds to contraction of ${y}_2$ due to the hierarchy. Therefore, all solutions of ${y}_1$ and ${y}_2$ tend to each other resulting in ${q} \rightarrow {q}_d$. \begin{example} Robust control and adaptive control are two different approaches to the problem of inherent uncertainty in the nonlinear system: robust control attempts to design a fixed parameter controller that successfully performs in the presence of the worst-case errors in the model, while adaptive control dynamically adjusts its parameters to compensate for the initial model uncertainty or very slowly varying parameters. Hence, adaptive control is a natural choice when only parametric uncertainty exits. However, adaptive controllers do not have long term memory and hence do not "remember" the optimal control parameters corresponding to different configurations of the plant. We consider the following adaptive control law for a Lagrangian system from (\ref{NL_single_compact2}): \begin{equation} {\tau}={Y}\hat{{a}}-{K}{s}={\hat{M}}({q}){\ddot{q}_{r}}+ {\hat{C}}({q},{\dot{q}}){\dot{q}_{r}}+{\hat{g}}({q}) -{K}{s} \end{equation} where ${s}$ denotes the composite variable ${s}={\dot q} - {\dot{q}}_{r}$, and the parameter estimates are updated to complete the definition of the adaptive control law with a positive definite matrix ${\Gamma}$ as follows: \begin{equation}{\dot{\hat{a}}}=-{\Gamma}{Y}^{\top}{s}\end{equation} Then, the asymptotic convergence of the tracking error and parameter estimates can be proven by finding a suitable Lyapunov-like function or using contraction analysis. \end{example} Consider the closed-loop system with the adaptive control law above: \begin{equation} \begin{bmatrix}{M}({q}) & {0}\\ {0} & {\Gamma}^{-1}\end{bmatrix} \begin{pmatrix}{\dot s}\\ {\dot{\tilde a}}\end{pmatrix}+ \begin{bmatrix}{C}({q},{\dot{q}})+{K}& -{Y}\\ {Y}^{T}& {0} \end{bmatrix}\begin{pmatrix}{s}\\ {\tilde a}\end{pmatrix}=\begin{pmatrix}{0}\\ {0}\end{pmatrix}\label{eq:adaptive_closed} \end{equation} where ${\hat{a}}$ denotes an estimate, and ${\tilde{a}}$ denotes an error of the estimate such that ${\tilde{a}}={\hat{a}}-{a}$, while ${a}$ is a constant vector of the true parameter values. \begin{figure} \begin{center} \includegraphics[width=85mm]{figures/Passivity.jpg}\\ \caption{Interpretation of adaptive control from a perspective of passivity} \end{center} \end{figure} The above system has a positive semi-definite generalized Jacobian with ${K}>0$, thereby resulting in a semi-contracting system~\cite{Ref:contraction1,Ref:contraction4}. Using Barbalat's lemma, the asymptotic convergence of ${s}$ can be proven as follows. First, construct a suitable Lyapunov function to find that $\ddot V= -2{s}^{\top}{K}{\dot s}$ and $\dot V$ is uniformly continuous since a bounded $\dot{{s}}$ from (\ref{eq:adaptive_closed}) leads to a bounded $\ddot V$. Due to $\dot V \leq 0$, the use of Barbalat's lemma verifies that $\dot V \rightarrow 0$ as $t\rightarrow \infty$. This implies that ${s}$ tends to zero asymptotically fast. From the hierarchical combination of the ${s}$ variable, this also implies ${q}\rightarrow {q}_d$. Please note that the convergence of ${\hat{a}}$ to the true value ${a}$ is NOT proven. It should be noted that the open loop dynamics of a multi-link robot are only passive for ${\tau}-{g}$ and the joint velocity ${\dot q}$. To the contrary, the above adaptation law modifies the closed-loop dynamics such that the mapping $-{Y}^{\top}{s}\rightarrow {\tilde a}$ is passive (i.e., ${s}\rightarrow -{Y}{\tilde a}$ is also a passive mapping. This is reminiscent of the feedback combination of two passive systems. $\dot{V}_1(t)=y_1^{\top}u_1-g_1(t)$ and $\dot{V}(t)=y_2^{\top}u_2-g_2(t)$. In a feedback configuration, $u_2=y_1$ and $u_1=-y_2$. Hence, $\dot{V}_1(t)+\dot{V}_2(t)=-(g_1(t)+g_2(t))$. \subsection{Control Laws for Nonlinear Attitude Control \label{sec:att_cont}} In this section, we present the new nonlinear attitude tracking control laws that are deemed suitable for satisfying the control problem statement. We first present a novel robust nonlinear tracking control law that guarantees globally exponential convergence of the system's attitude trajectory to the desired attitude trajectory. In order to highlight the advantages of this new control law, we also present several extensions of this attitude tracking control law, like augmenting it with an integral control term and deriving an exponentially-stabilizing tracking control law on SO($3$). Let ${\omega}\in\mathbb{R}^{3}$ be the angular velocity of the system in the body fixed frame $\mathcal{F}_{B}$ with respect to the inertial frame $\mathcal{F}_{I}$ and expressed in the frame $\mathcal{F}_{B}$. Let ${u}_c\in\mathbb{R}^{n_t}$ be the control input. The attitude dynamics of the rigid combination is given by: \begin{equation} {J}\dot{{\omega}}=\left({J}{\omega}\right)\times{\omega}+{u}_c+{d}_{\textrm{ext}}\thinspace,\label{eq:dynamics} \end{equation} where ${d}_{\textrm{ext}}$ represents the external torque acting on the system and the attitude kinematics equations using Euler angles ($\phi,\thinspace\theta,\thinspace\psi$), classical Rodrigues parameters (${\sigma}$), and the first three elements of a quaternion vector (${\beta}_v$) can be written in the form of $\dot{{q}}={Z}({q}){\omega}$ (like (\ref{eq:MRP_def})) with a different definition of ${Z}({q})$. \subsubsection{Robust Nonlinear Tracking Control Law with Global Exponential Stability \label{sub:First-Robust-NCL-new}} \begin{theorem}[Robust Nonlinear Attitde Controller]\label{thm:first_RNTCL} For the given desired attitude trajectory ${q}_{d}(t)$, and positive definite constant matrices ${K}_{r}\in\mathbb{R}^{3\times3}$ and ${\Lambda}_{r}\in\mathbb{R}^{3\times3}$, we define the following control law: \begin{align} & {u}_c=\skew{4}\hat{{J}}\dot{{\omega}}_{r}-{S}\left(\skew{4}\hat{{J}}\hat{{\omega}}\right){\omega}_{r}-{K}_{r}(\hat{{\omega}}-{\omega}_{r}) \thinspace,\label{eq:first_RNC_MRP}\\ \textrm{where}\quad & {\omega}_{r}={Z}^{-1}(\hat{{q}})\dot{{q}}_{d}(t)+{Z}^{-1}(\hat{{q}}){\Lambda}_{r}({q}_{d}(t)-\hat{{q}}) \thinspace.\nonumber \end{align} This control law exponentially stabilizes the closed-loop attitude dynamics with the following properties: \\ (i) In the absence of resultant disturbance torque ${d}_{\textrm{res},2}$, this control law guarantees global exponential convergence of the system's trajectory to the desired trajectory ${q}_{d}(t)$. \\ (ii) In the presence of bounded resultant disturbance torque ${d}_{\textrm{res},2}$, this control law guarantees that the tracking error (${q}_{e} = \hat{{q}}-{q}_{d}$) globally exponentially converges to the following ball \begin{align} \lim_{t\rightarrow\infty}\int_{0}^{{q}_{e}}\|\delta{q}_{e}\|_{2} & \leq\frac{\lambda_{\max}({J})\sup_{t}\sigma_{\max}({Z}(\hat{{q}}))\sup_{t}\|{d}_{\textrm{res},2}\|_{2}}{\lambda_{\min}({\Lambda}_{r})\lambda_{\min}({K}_{r})\lambda_{\min}({J})}. \end{align} Hence, this control law is finite-gain $\mathcal{L}_p$ stable and input-to-state stable (ISS). \end{theorem} \begin{proof} The closed-loop dynamics, which is obtained by substituting ${u}_c$ from ~(\ref{eq:first_RNC_MRP}) into ~(\ref{eq:dynamics}), becomes \begin{equation} {J}\dot{{\omega}}_{e}-{S}\left({J}\hat{{\omega}}\right){\omega}_{e}+{K}_{r}{\omega}_{e}=\underbrace{\left[{d}_{\textrm{res}}-\Delta{J}\dot{{\omega}}_r+{S}\left(\Delta{J}\hat{{\omega}}\right){\omega}_{r}\right]}_{{d}_{\textrm{res},2}}\thinspace, \label{eq:proof_step7} \end{equation} where ${\omega}_e = (\hat{{\omega}}-{\omega}_{r})$ and ${d}_{\textrm{res}} = {J}\Delta{\omega}\times\hat{{\omega}} +{J}{{\omega}}\times\Delta{\omega} -{J}\Delta\dot{{\omega}}+{d}_{\textrm{ext}}$. We first show that the control law indeed globally exponentially stabilizes the closed-loop system without the resultant disturbance ${d}_{\textrm{res},2}$. The virtual dynamics of ${y}$, derived from ~(\ref{eq:proof_step7}) without ${d}_{\textrm{res},2}$, is given as \begin{equation} {J}\dot{{y}}-{S}\left({J}\hat{{\omega}}\right){y}+{K}_{r}{y} = {0} \thinspace ,\label{Eq:CLeqn} \end{equation} where ${y}$ has ${y}={\omega}_e$ and ${y}={0}$ as its two particular solutions. After we obtain the dynamics of the infinitesimal displacement at fixed time, $\delta{y}$ from (\ref{Eq:CLeqn}), we perform the squared-length analysis: \begin{equation} \frac{d}{dt}\left(\delta{y}^{T}{J}\delta{y}\right)=-2\delta{y}^{T}{K}_{r}\delta{y}\leq\frac{-2\lambda_{\min}({K}_{r})}{\lambda_{\max}({J})}\left(\delta{y}^{T}{J}\delta{y}\right)\thinspace, \end{equation} where we exploited the skew-symmetric property of the matrix ${S}\left({J}\hat{{\omega}}\right)$. Hence, it follows from the contraction analysis (Theorem \ref{Thm:contraction}) that all system trajectories of (\ref{Eq:CLeqn}) converge exponentially fast to a single trajectory (i.e., $\delta{y} \rightarrow {0}$ and ${\omega}_e\rightarrow {0}$ ) at a rate of $\frac{\lambda_{\min}({K}_{r})}{\lambda_{\max}({J})}$. In the presence of bounded resultant disturbance ${d}_{\textrm{res},2}$, it follows from Theorem~\ref{Thm:Robust_contraction_original} that: \begin{equation} \lim_{t \rightarrow \infty} \int_{0}^{{\omega}_{e}}\|\delta{y}\|_{2}\leq\frac{\lambda_{\max}({J})}{\lambda_{\min}({K}_{r})\lambda_{\min}({J})}\sup_{t}\|{d}_{\textrm{res},2}\|_{2} \label{eq:proof_step9} \end{equation} Hence the dynamics of the closed-loop system is bounded in the presence of bounded resultant disturbance ${d}_{\textrm{res},2}$. We now prove that convergence of ${\omega}_{e} \rightarrow {0}$ implies convergence of the system's trajectory to the desired trajectory ($\hat{{q}} \rightarrow {q}_d$). It follows from the definition of ${\omega}_{r}$ that: \begin{align} {\omega}_{e}=&{Z}^{-1}(\hat{{q}})(\dot{\hat{{q}}}-\dot{{q}}_{d})+{Z}^{-1}(\hat{{q}}){\Lambda}_{r}(\hat{{q}}-{q}_{d}) \nonumber \\ =&{Z}^{-1}(\hat{{q}})(\dot{{q}}_{e}+{\Lambda}_{r}{q}_{e})\thinspace, \end{align} where ${q}_{e} = (\hat{{q}}-{q}_{d})$. In the absence of ${\omega}_{e}$, all system trajectories of $ \delta {q}_e$ will converge exponentially fast to a single trajectory ($\delta {q}_e \rightarrow 0$) with a rate of $\lambda_{\min}({\Lambda}_{r})$, where the virtual displacement $\delta{q}_e$ is an infinitesimal displacement at fixed time. In the presence of ${\omega}_{e}$, it follows from Theorem~\ref{Thm:Robust_contraction_original} and its extension to a hierarchically-combined system (Theorem~\ref{Thm:Robust_contraction_hierc}) that: \begin{align} &\lim_{t\rightarrow\infty}\int_{0}^{{q}_{e}}\|\delta{q}_{e}\|_{2} \leq\frac{1}{\lambda_{\min}({\Lambda}_{r})}\sup_{t}\|{Z}(\hat{{q}}){\omega}_{e}\|_{2} \\ & \leq\frac{\lambda_{\max}({J})\sup_{t}\|{d}_{\textrm{res},2}\|_{2}}{\lambda_{\min}({\Lambda}_{r})\lambda_{\min}({K}_{r})\lambda_{\min}({J})}\left(\sup_{t}\sigma_{\max}({Z}(\hat{{q}}))\right)\thinspace. \nonumber \end{align} Hence we have shown, by constructing a hierarchically-combined closed-loop system of ${\omega}_{e}$ and ${q}_{e}$, that the attitude trajectory ${q}$ will globally exponentially converge to a bounded error ball around the desired trajectory ${q}_d (t)$. Moreover, it follows from Theorem~\ref{Thm:Robust_contraction_original} that this control law is finite-gain $\mathcal{L}_p$ stable and input-to-state stable. Hence the control gains ${K}_{r}$ and ${\Lambda}_{r}$ can be designed such that the desired error bounds are achieved. \qed \end{proof} The desired attitude trajectory ${q}_d (t)$ can be any reference trajectory that we would like the system to track (e.g., motion planning based on optimal control). \subsubsection{Robust Nonlinear Tracking Control Law with Integral Control \label{sub:Robust-NCL-MRP-Integral}} Another benefit of the original robust nonlinear tracking control law ~(\ref{eq:first_RNC_MRP}) is that it can be augmented with an integral control term in a straight-forward manner to eliminate any constant external disturbance while ensuring exponential convergence of the system's attitude trajectory to the desired attitude trajectory. \begin{theorem}[Robust Nonlinear Integral Control]\label{thm:Integral_RNTCL} For the given desired attitude trajectory ${q}_{d}(t)$, positive definite constant matrices ${K}_{m}\in\mathbb{R}^{3\times3}$ and ${\Lambda}_{m}\in\mathbb{R}^{3\times3}$, and (possibly time-varying) uniformly positive definite diagonal matrix ${K}_{I}(t)\in\mathbb{R}^{3\times3}$, we define the following control law: \begin{align} {u}_c =&\skew{4}\hat{{J}}\dot{{\omega}}_{r}-{S}(\skew{4}\hat{{J}}\hat{{\omega}}){\omega}_{r}-{K}_{m}(\hat{{\omega}}-{\omega}_{r}) -\int_{0}^{t} {K}_{I}(\hat{{\omega}}-{\omega}_{r})dt \thinspace,\label{eq:RNC_Integral_MRP} \end{align} where \begin{align} \textrm{where}\quad & {\omega}_{r}={Z}^{-1}(\hat{{q}})\dot{{q}}_{d}(t)+{Z}^{-1}(\hat{{q}}){\Lambda}_{m}({q}_{d}(t)-\hat{{q}}) \thinspace.\nonumber \end{align} This control law has the following properties: \begin{itemize} \item This control law guarantees global exponential convergence of the system's trajectory to ${q}_{d}(t)$ for any constant external disturbance (constant bias) acting on the system. \item In the presence of time-varying disturbance ${d}_{\textrm{res},2}$ with a bounded rate $\dot{{d}}_{\textrm{res},2}$, this control law guarantees that ${q}(t)$ will globally exponentially converge to an error ball around ${q}_{d}(t)$, whose size is determined by $\dot{{d}}_{\textrm{res},2}$ (i.e., finite-gain $\mathcal{L}_p$ stable and ISS with respect to disturbance inputs with bounded rates). \end{itemize}\end{theorem} \begin{proof} The closed-loop dynamics is given by: \begin{equation} {J}\dot{{\omega}}_{e}-{S}\left({J}\hat{{\omega}}\right){\omega}_{e}+{K}_{m}{\omega}_{e} + \int_{0}^{t} {K}_{I} {\omega}_e dt = {d}_{\textrm{res},2} \thinspace, \label{eq:proof_step8} \end{equation} where ${\omega}_e = (\hat{{\omega}}-{\omega}_{r})$ and ${d}_{\textrm{res},2}$ is defined in ~(\ref{eq:proof_step7}). We first show that this control law can eliminate a constant external disturbance, hence replacing ${d}_{\textrm{res},2}$ in ~(\ref{eq:proof_step8}) with a constant disturbance term ${d}_{\textrm{const}}$ gives us: \begin{equation} {J} \dot{{\omega}}_e - {S}\left({J}\hat{{\omega}}\right){\omega}_{e} + {K}_{m} {\omega}_e + \int_{0}^{t} {K}_{I} {\omega}_e dt = {d}_{\textrm{const}} \thinspace . \label{eq:proof_step2} \end{equation} Differentiating ~(\ref{eq:proof_step2}) with respect to $t$ and setting $\dot{{d}}_{\textrm{const}}=0$, we get: \begin{equation} {J}\ddot{{\omega}}_{e}+\left({K}_{m}-{S}\left({J}\hat{{\omega}}\right)\right)\dot{{\omega}}_{e}+\left({K}_{I}-{S}\left({J}\dot{\hat{{\omega}}}\right)\right){\omega}_{e}=0\thinspace. \label{eq:proof_step3} \end{equation} If we show that ~(\ref{eq:proof_step3}) is contracting, then we prove our claim (i) that the given control law can successfully eliminate any constant external disturbance acting on the system. In order to prove ~(\ref{eq:proof_step3}) is globally exponentially stable, we consider two cases which depend on the time-varying nature of the matrix ${K}_{I}$. We first consider the case where ${K}_{I}$ is a constant positive definite diagonal matrix. The matrix ${K}_{I}$ can be decomposed into ${K}_{I} = {K}_{I}^{\frac{1}{2}} {K}_{I}^{\frac{1}{2}}$, where the matrix ${K}_{I}^{\frac{1}{2}}$ is also a constant positive definite diagonal matrix. We introduce the term ${y}_1$, where $\dot{{y}}_{1}$ is defined as $\dot{{y}}_{1}= {K}_{I}^{\frac{1}{2}} {\omega}_{e}$. Then we can write $\dot{{\omega}}_e$ as: \begin{equation} \dot{{\omega}}_{e}=-({J})^{-1}\left({K}_{m}-{S}\left({J}\hat{{\omega}}\right)\right){\omega}_{e} -({J})^{-1} {K}_{I}^{\frac{1}{2}} {y}_{1}\thinspace. \label{eq:proof_step4} \end{equation} Note that differentiating ~(\ref{eq:proof_step4}) with respect to time and substituting $\dot{{y}}_{1}$ gives us ~(\ref{eq:proof_step3}). Therefore, these equations can be written in matrix form as: \begin{equation} \begin{bmatrix} \dot{{\omega}}_{e}\\ \dot{{y}}_{1} \end{bmatrix}=\left[\begin{smallmatrix} -({J})^{-1}\left({K}_{m}-{S}\left({J}\hat{{\omega}}\right)\right) & -({J})^{-1} {K}_{I}^{\frac{1}{2}} \\ {K}_{I}^{\frac{1}{2}} & {0} \end{smallmatrix}\right] \begin{bmatrix} {\omega}_{e}\\ {y}_{1} \end{bmatrix} = {F} \begin{bmatrix} {\omega}_{e}\\ {y}_{1} \end{bmatrix} \thinspace. \label{eq:proof_step5} \end{equation} We define the positive definite matrix ${\Xi}=\left[\begin{smallmatrix}{J} & b{I}\\ b{I} & {I}\end{smallmatrix}\right]$, where $b$ is a constant between $0 < b < \lambda_{\max}^{\frac{1}{2}}({J})$. The symmetric matrix $({\Xi F})_\mathrm{sym} = \frac{1}{2}\left(({\Xi F})+({\Xi F})^{T}\right)$ is given by: \begin{align} ({\Xi F})_\mathrm{sym} & = - \left[\begin{smallmatrix} \frac{{K}_{m}+{K}_{m}^{T}}{2}-b{K}_{I}^{\frac{1}{2}} & \frac{b}{2}\left[({J})^{-1}\left({K}_{m}-{S}\left({J}\hat{{\omega}}\right)\right)\right]^{T}\\ \frac{b}{2}({J})^{-1}\left({K}_{m}-{S}\left({J}\hat{{\omega}}\right)\right) & \frac{b}{2}\left(({J})^{-1}{K}_{I}^{\frac{1}{2}}+{K}_{I}^{\frac{1}{2}}({J})^{-1}\right) \end{smallmatrix}\right] \thinspace . \nonumber \end{align} The sufficient conditions for the matrix $({\Xi}{F})_{\mathrm{sym}}$ to be negative definite are: \begin{align} & -\frac{{K}_{m}+{K}_{m}^{T}}{2}+b{K}_{I}^{\frac{1}{2}}<0\thinspace \\ &-\frac{b}{2}\left(({J})^{-1}{K}_{I}^{\frac{1}{2}}+{K}_{I}^{\frac{1}{2}}({J})^{-1}\right) <0\thinspace, \label{eq:proof_condition2} \\ & \tfrac{\lambda_{\max}\left(-\frac{{K}_{m}+{K}_{m}^{T}}{2}+b{K}_{I}^{\frac{1}{2}}\right)\lambda_{\max}\left(-\frac{b}{2}\left(({J})^{-1}{K}_{I}^{\frac{1}{2}}+{K}_{I}^{\frac{1}{2}}({J})^{-1}\right)\right)}{\sigma_{\max}^{2}\left(-\frac{b}{2}\left[({J})^{-1}\left({K}_{m}-{S}\left({J}\hat{{\omega}}\right)\right)\right]^{T}\right)} > 1 \thinspace. \label{eq:proof_condition3} \end{align} Equation~(\ref{eq:proof_condition2}) is satisfied by $0<b<\frac{\lambda_{\min}({K}_{m}+{K}_{m}^{T})}{2\lambda_{\max}({K}_{I}^{\frac{1}{2}})}$. Equation~(\ref{eq:proof_condition3}) is satisfied by $b<b_3$, where $b_3$ is given by: \begin{equation} b_3 = \frac{\lambda_{\max}\left(\frac{{K}_{m}+{K}_{m}^{T}}{2}\right)\lambda_{\min}\left(({J})^{-1}{K}_{I}^{\frac{1}{2}}+{K}_{I}^{\frac{1}{2}}({J})^{-1}\right)}{B_1+B_2} \thinspace. \end{equation} where \begin{align} B_1 =& \frac{1}{2}\sigma_{\max}^{2}\left[({J})^{-1}\left({K}_{m}-{S}\left({J}\hat{{\omega}}\right)\right)\right]^{T} \\ B_2 =& \lambda_{\min}\left({K}_{I}^{\frac{1}{2}}\right)\lambda_{\min}\left(({J})^{-1}{K}_{I}^{\frac{1}{2}}+{K}_{I}^{\frac{1}{2}}({J})^{-1}\right). \end{align} Therefore, the matrix $({\Xi F})_\mathrm{sym}$ is negative definite if $b$ is chosen such that $0 <b < \min ( \lambda_{\max}^{\frac{1}{2}}({J}),\thinspace \frac{\lambda_{\min}({K}_{m}+{K}_{m}^{T})}{2\lambda_{\max}({K}_{I}^{\frac{1}{2}})}, \thinspace b_{3} ) $. We define the virtual displacement $\delta{z}=[\delta{\omega}_{e},\thinspace\delta{y}_{1}]^{T}$, where $\delta{\omega}_{e}$ and $\delta{y}_{1}$ are infinitesimal displacements at fixed time. Therefore, \begin{align} &\frac{d}{dt}\left(\delta{z}^{T} {\Xi} \delta{z}\right)=\delta{z}^{T} \left( ({\Xi F}) + ({\Xi F})^{\top} \right) \delta{z} \\ \leq& 2\lambda_{\max}(({\Xi F})_\mathrm{sym})\|\delta{z}\|_{2}^2 \leq \frac{2\lambda_{\max}(({\Xi F} )_\mathrm{sym})}{\lambda_{\max}({\Xi})} \left(\delta{z}^{T} {\Xi} \delta{z}\right) \nonumber. \end{align} Hence, it follows from the contraction analysis (Theorem~\ref{Thm:contraction}) that all system trajectories converge exponentially fast to a single trajectory ($\delta{z} \rightarrow 0$ and $\delta{\omega}_e \rightarrow 0$) at a rate of $\frac{-\lambda_{\max}(({\Xi F} )_\mathrm{sym})}{\lambda_{\max}({\Xi})}$. Moreover, in the presence of bounded time-varying disturbance ${d}_{\textrm{res},2}$ with bounded $\dot{{d}}_{\textrm{res},2}$, we get from Theorem~\ref{Thm:Robust_contraction_original}: \begin{align} &\lim_{t \rightarrow \infty} \int_{0}^{{\omega}_{e}}\|\delta{\omega}_{e}\|_{2} \nonumber \\ &\leq \frac{(b+1) \lambda_{\max}({\Xi}) \sup_t \lambda_{\max}({K}_{I}^{-\frac{1}{2}})\sup_{t}\| \dot{{d}}_{\textrm{res},2}\|_{2}}{-\lambda_{\max}(({\Xi F} )_\mathrm{sym}) }. \end{align} where $\|\delta{\omega}_{e}\|_{2}\leq\|\delta{z}\|_{2}$ and $\lambda_{\min}({\Xi})>1$ are used. Also, note that the disturbance term in the righthand side of ~(\ref{eq:proof_step5}) is $({0};-{K}_{I}^{-\frac{1}{2}}\dot{{d}}_{\textrm{res},2})$. The fact that convergence of ${\omega}_{e} \rightarrow {0}$ implies convergence of the system's trajectory to the desired trajectory ($\hat{{q}} \rightarrow {q}_d$) is already presented in the proof of Theorem \ref{thm:first_RNTCL}. This completes the proof. \qed \end{proof} If both ${K}_{I}$ and $\dot{{K}}_{I}$ are uniformly positive definite diagonal matrices, there exits a simpler proof, which is presented here. \begin{proof} The matrix $\dot{{K}}_{I}$ can also be decomposed into $\dot{{K}}_{I} = \dot{{K}}_{I}^{\frac{1}{2}} \dot{{K}}_{I}^{\frac{1}{2}}$. We introduce another term ${y}_2$, where: \begin{equation} \dot{{y}}_{2}={K}_{I}^{\frac{1}{2}} {\omega}_{e} - {K}_{I}^{-\frac{1}{2}} \dot{{K}}_{I}^{\frac{1}{2}} {y}_{2}\thinspace. \end{equation} Once again, $\dot{{\omega}}_e$ can be written in a form similar to that of ~(\ref{eq:proof_step4}). The matrix form of these equations is given by: \begin{equation} \begin{bmatrix} \dot{{\omega}}_{e}\\ \dot{{y}}_{2} \end{bmatrix}= \left[\begin{smallmatrix} -({J})^{-1}\left({K}_{m}-{S}\left({J}\hat{{\omega}}\right)\right) & -({J})^{-1} {K}_{I}^{\frac{1}{2}} \\ {K}_{I}^{\frac{1}{2}} & - {K}_{I}^{-\frac{1}{2}} \dot{{K}}_{I}^{\frac{1}{2}} \end{smallmatrix}\right]\begin{bmatrix} {\omega}_{e}\\ {y}_{2} \end{bmatrix} = \tilde{{F}} \begin{bmatrix} {\omega}_{e}\\ {y}_{2} \end{bmatrix} \thinspace. \label{eq:proof_step6} \end{equation} Clearly, the symmetric part of the matrix ${\Xi} \tilde{{F}}$ is negative definite. Therefore, \begin{align} \frac{d}{dt}\left(\delta{z}^{T} {\Xi} \delta{z}\right)&=\delta{z}^{T} \left( ({\Xi}\tilde{{F}}) + ({\Xi}\tilde{{F}})^{\top} \right) \delta{z} \nonumber \\ &\leq 2\lambda_{\max}(({\Xi} \tilde{{F}})_\mathrm{sym})\|\delta{z}\|_{2}^2 \nonumber \\ &\leq \frac{2\lambda_{\max}(({\Xi} \tilde{{F}})_\mathrm{sym})}{\lambda_{\max}({J})} \left(\delta{z}^{T} {\Xi} \delta{z}\right) \end{align} where $({\Xi} \tilde{{F}})_\mathrm{sym}=\frac{({\Xi} \tilde{{F}})+({\Xi} \tilde{{F}})^{\top}}{2}$. Since $\lambda_{\max}(({\Xi} \tilde{{F}})_\mathrm{sym}) \leq - \min ( \lambda_{\min}({K}_{m}), \inf_{t} ( \lambda_{\min}({K}_{I}^{-\frac{1}{2}} \dot{{K}}_{I}^{\frac{1}{2}}) ) )$, all system trajectories converge exponentially fast to a single trajectory at a rate of $\frac{-\lambda_{\max}(({\Xi} \tilde{{F}})_\mathrm{sym})}{\lambda_{\max}({J})}$. Moreover, in the presence of bounded ${d}_{\textrm{res},2}$ and $\dot{{d}}_{\textrm{res},2}$, we get from Theorem~\ref{Thm:Robust_contraction_original} that: \begin{align} &\lim_{t \rightarrow \infty} \int_{0}^{{\omega}_{e}}\|\delta{\omega}_{e}\|_{2} \nonumber \\ &\leq \frac{\lambda_{\max}({J}) \sup_t \lambda_{\max}({K}_{I}^{-\frac{1}{2}}) \sup_{t}\| \dot{{d}}_{\textrm{res},2}\|_{2} }{-\lambda_{\max}(({\Xi} \tilde{{F}})_\mathrm{sym}) } \thinspace . \end{align} where $\|\delta{\omega}_{e}\|_{2}\leq\|\delta{z}\|_{2}$ and $\lambda_{\min}({J})>1$ are used. Also, note that the disturbance term in the righthand side of ~(\ref{eq:proof_step6}) is $({0};{K}_{I}^{-\frac{1}{2}}\dot{{d}}_{\textrm{res},2})$. \qed \end{proof} \begin{remark} Note that the second block diagonal matrix of the Jacobin ${F}$ in ~(\ref{eq:proof_step5}) is ${0}$, which usually yields a semi-contracting system with global asymptotic stability. For example, ${F}$ from ~(\ref{eq:proof_step5}) and ${\Theta}=\left[\begin{smallmatrix}{J} & {0}\\ {0} & {I}\end{smallmatrix}\right]$ results in a semi-contracting system due to $\frac{1}{2}\left(({\Theta F})+({\Theta F})^{T}\right)=\left[\begin{smallmatrix} -{K}_{m} & {0}\\ {0} & {0} \end{smallmatrix}\right]$. Similarly, the following adaptive control law also yields global asymptotic stability. In contrast, Theorem~\ref{thm:Integral_RNTCL} presents a stronger result with global exponential stability. \end{remark} \fi \section{Convex Properties of Contraction Analysis}\label{sec:convex} We formulate a convex optimization problem to find the optimal contraction metric $M(x,t)$, which greedily minimizes an upper bound of the steady-state mean squared distance in (\ref{Eq:boundnewsto}) of Theorem~\ref{Thm:robuststochastic}. This choice of $M(x,t)$ makes the stabilizing feedback control scheme (\ref{controller}) optimal with respect to the objective functions in the following subsection. \subsection{Overview of CV-STEM Control} \subsubsection{Objective Function} As a result of Theorems~\ref{Thm:robuststochastic} and~\ref{Thm:CVSTEM:LMI}, we obtain the stead-state error of (\ref{Eq:boundnewsto}): \begin{align} \label{stochasticmse_infty} &\lim_{t \to \infty}E\left[\|x_d-x\|^2\right] \leq \frac{C}{2\alpha} = \frac{g_u^2}{2\alpha}\left(\frac{\overline{m}}{\underline{m}}+c_1\frac{1}{\underline{m}}\right) \end{align} where $c_1 = \overline{m}_{x}/\varepsilon$ and $g_1=g_u$ and $g_2=0$ from (\ref{Eq:boundnewsto}). \textcolor{blue}{Refer to (10).} We greedily minimize the current steady-state upper bound (\ref{stochasticmse_infty}) to find an optimal $M(x,t)$ at the current time step. \begin{theorem} \label{convex_equiv} Suppose $\alpha$, $g_u$, and $c_1$ in (\ref{stochasticmse_infty}) are given. Then the non-convex optimization problem of greedily minimizing a steady-state upper bound of $E[\|x-x_d\|^2]$ in (\ref{stochasticmse_infty}) is equivalent to the following convex optimization problem: \begin{align} \label{problem2} &\mathcal{J}_{n2c}^* = \min_{\substack{\bar{\gamma}>0,\nu>0\\\chi\in \mathbb{R},\bar{W}\succ0}}\chi+c_1\frac{\chi^2}{\nu} \text{~~s.t.~(\ref{lambda_con}) and (\ref{alpha_cond_convex_3})} \end{align} \textcolor{blue}{\begin{align} \label{convex_opt_gen} &\mathcal{J}_{cv}^* = \min_{\substack{\bar{\gamma}>0,\nu>0,\tau\in\mathbb{R}\\\chi\in \mathbb{R},\bar{W}\succ0}}\tau \\ &\text{s.t.{} }\text{(\ref{lambda_con}),(\ref{alpha_cond_convex_3}), and } \begin{bmatrix} \tau-\chi & \chi \\ \chi & \frac{\nu}{c_1} \end{bmatrix} \succeq 0. \nonumber \end{align}} \end{theorem} \begin{proof} The RHS of \eqref{stochasticmse_infty} without the coefficient $g_u^2/{(2\alpha)}$ results in \begin{align} &\kappa(W)+c_1\lambda_\mathrm{min}(\bar{W}/\nu) =\kappa(\bar{W})+c_1\kappa(\bar{W})/\nu \\ &\leq {\kappa(\bar{W})}+{c_1}\kappa(\bar{W})^2/\nu \leq {\chi}+{c_1}\frac{\chi^2}{\nu}.\label{eq61} \end{align} where $\kappa(W) = \kappa(\bar{W})$ and $\lambda_{\min}(W) = \lambda_{\min}(\bar{W})/\nu$ are used for the first equality, and (\ref{lambda_con}) expressed as $\lambda_{\min}(\bar{W}) \geq 1$ and $\lambda_{\max}(\bar{W}) \leq \chi$ is used for the second and third inequalities, respectively. \end{proof} \begin{remark} Although (\ref{convex_opt_gen}) is convex, it is infinite dimensional due to $\dot{\bar{W}}$. We could address this issue by computing $\dot{\bar{W}}$ along the trajectory or by approximating the contraction metric as a linear combination of given basis functions~\cite{AYLWARD20082163}. These techniques will be briefly discussed in Sec.~\ref{variations}. \end{remark} The coefficients of the SDC parameterizations $\varrho$ can also be treated as a decision variable as can be seen in the following proposition. \begin{proposition} \label{relaxed_convex} Introducing new variables $\bar{W}_{\varrho_i}\succ 0$ and $\bar{\varrho_i}=\nu{\varrho_i}$ where $\bar{W}_{\varrho_i} = \varrho_i \bar{W}$, the bilinear matrix inequalities (\ref{riccati_lmi_con}) and (\ref{alpha_cond_convex_2}) in terms of $\bar{W}$ and $\varrho$ with $\nu > 0$ can be relaxed as follows [COMBINE TWO]: \begin{align} \label{riccati_lmi_con_rho} -\dot{\bar{W}}+{\displaystyle \sum_{i=1}^{s_1}}A_i\bar{W}_{\varrho_i}+{\displaystyle \sum_{i=1}^{s_1}}\bar{W}_{\varrho_i}A_i^{\top}+\bar{\gamma} I-\nu BR^{-1}B^{\top} \preceq 0 \end{align} and \begin{align} \label{alpha_cond_convex_2_rho} \begin{bmatrix} \bar{\gamma} I+\nu BR^{-1}B^{\top}-\Phi-2\alpha \bar{W}& \bar{W} \\ \bar{W} & \frac{\nu}{2\alpha_g}I \end{bmatrix} \succeq 0. \end{align} where $\Phi$ is given by \begin{align} \Phi =& {\displaystyle \sum_{i=1}^{s_1}}\bar{W}_{\varrho_i}\frac{\partial (\Delta A_ix_d) }{\partial q}^{\top}+{\displaystyle \sum_{i=1}^{s_1}}\frac{\partial (\Delta A_ix_d) }{\partial q} \bar{W}_{\varrho_i} \nonumber \\ &+\bar{W}\frac{\partial (\Delta Bu_d)}{\partial q}^{\top}+\frac{\partial (\Delta Bu_d)}{\partial q}\bar{W} \nonumber \end{align} with $\Delta A(\varrho,x,t) = \sum_{i=1}^{s_1}\varrho_i \Delta A_i(x,t) = \sum_{i=1}^{s_1}\varrho_i (A_i(x,t)-A_i(x_d,t))$. We also need some additional relaxed constraints to ensure controllability and $\bar{W}_{\varrho_i} = \varrho_i \bar{W}$, i.e., \begin{align} \label{last_constraint_con} &\bar{W},\bar{W}_{\varrho_i} \succ 0,~\sum_{i=1}^{s_1}\bar{W}_{\varrho_i}=\bar{W}, ~{\rm sym} \begin{bmatrix} \nu I & \bar{W} \\ \bar{\varrho}_i I & \bar{W}_{\varrho_i} \end{bmatrix} \succeq 0, \\ &\sum_{i=1}^{s_1}\bar{\varrho}_i=\nu,~\bar{\varrho}_i \in [0,\nu],~cc_k(\bar{\varrho},x)\leq0,~\forall i,~\forall k=1,\cdots, n_c \nonumber \end{align} where $cc_k(\bar{\varrho},x)\leq0,~\forall k=1,\cdots, n_c$ denotes convex constraints to maintain the controllability of the pair $(A,B)$. \end{proposition} \begin{proof} The first two inequalities (\ref{riccati_lmi_con_rho}) and (\ref{alpha_cond_convex_2_rho}) follow from the desired equality $\bar{W}_{\varrho_i} = \varrho_i\bar{W}$ and $A(\varrho,x,t)=\sum_{i=1}^{s_1}\varrho_iA_i(x,t)$. See~\cite{observer} for the derivation of (\ref{last_constraint_con}). \end{proof} \emph{Summary of CV-STEM Control Design:}\label{optcon} The CV-STEM control of a class of It\^{o} stochastic nonlinear systems is designed as (\ref{controller}), where the optimal contraction metric $M(x) = \nu \bar{W}(x)^{-1}$ is selected by the convex optimization problem (\ref{convex_opt_gen}) in Theorem~\ref{convex_equiv}. The coefficients of SDC parameterizations $\varrho$ can also be used to preserve controllability by considering the relaxed problem with the constraints (\ref{riccati_lmi_con_rho}), (\ref{alpha_cond_convex_2_rho}), and (\ref{last_constraint_con}) in Proposition~\ref{relaxed_convex}, where the decision variables are $\bar{\gamma} > 0$, $\nu\in\mathbb{R}$, $\tau\in\mathbb{R}$, $\chi\in\mathbb{R}$, $\bar{W} \succ 0$, $\bar{W}_{\varrho_i}\succ 0$, and $\bar{\varrho_i}$. \iffalse The CV-STEM control design provides a convex optimization-based methodology for computing the contraction metric that greedily minimizes an upper bound of the steady-state mean squared tracking error (\ref{stochasticmse}) in Theorem~\ref{thmcontracting}. As proved in Corollary~\ref{robust_coro}, it is also robust against external disturbances and has the $\mathcal{L}_2$ norm bound on the tracking error. In practice, (\ref{convex_opt_gen}) of Theorem~\ref{convex_equiv} can be implemented using computationally-efficient numerical techniques such as the polynomial-time interior point method for convex programming~\cite{lmi, citeulike:163662, Ben-Tal:2001:LMC:502969,5447065} and the SDRI solvers~\cite{1102178,1098829,1100565,1101323,Anderson:1990:OCL:79089}. Although the control parameters are supposed to be updated by (\ref{convex_opt_gen}) at each time instant due to the state-and time-dependent constraints, its sampling period can be relaxed to larger values to allow online implementation of the CV-STEM as shall be seen in Sec.~\ref{simulation}. Further, the controllability constraint can be incorporated into this framework~\cite{observer} as in Proposition~\ref{relaxed_convex}, utilizing non-unique choices of SDC parametrizations. \fi \subsection{CV-STEM Control with Learned $M(x,t)$} Consider the original dynamics (\ref{sdc_dynamics}) with a controller $u \in \mathbb{R}^{m}$ and perturbation $\mathcal{W}(t)$: \begin{theorem} \label{nscm_con} Suppose $\exists M(x,x_d,t)\succ0$ s.t.{} $M_{x_i}$ and $M_{x_{d,i}},~\forall x_i,x_{d,i}$ are Lipschitz with respect to its state with 2-norm Lipschitz constant $L_m$. For the same tracking controller~\eqref{controller}: \begin{align} &\dot{M}+2\sym(MA)-2MBR^{-1}B^TM+2\alpha_{gc}I \preceq -2\alpha M \\ \label{controller_con2} &\overline{\omega}^{-1}I \preceq M(x,x_d,t) \preceq \underline{\omega}^{-1}I,~\forall x,t \end{align} where $\alpha>0$, $2\alpha_{gc} = L_mg_c^2(\varepsilon+{1}/{2})$, $\varepsilon>0$, and $A$ is given by (\ref{sdcAc}) in Lemma~\ref{sdclemma}. If the pair $(A,B)$ is uniformly controllable, we have the following bound for the systems (\ref{sdc_dynamics}) and (\ref{sdc_dynamicsd}): \begin{align} \label{control_ss} E[\|x-x_d\|^2] \leq \frac{g_c^2(2/\varepsilon+1)}{2\alpha}\chi+\overline{\omega}E[V_{s\ell}(0)]e^{-2\alpha t} \end{align} where $V_{s\ell}(x,x_d,\delta q,t)$ from \eqref{eq:VSL} with $M(x,t)$. Further, (\ref{controller}) and (\ref{controller_con2}) are equivalent to the following constraints: \begin{align} \label{convex_constraint_controller1} &\begin{bmatrix} -\dot{\bar{W}}+2\sym{}((A+\alpha I)\bar{W})-2\nu BR^{-1}B^T & \bar{W} \\ \bar{W} & -\frac{\nu}{2\alpha_{gc}}I \end{bmatrix} \preceq 0 \\ \label{convex_constraint_controller2} &I\preceq \bar{W}\preceq \chi I,~\forall x,t. \end{align} which is the same as \eqref{alpha_cond_convex_3} with $\phi=0$ and $R=I$. \end{theorem} The constraints (\ref{convex_constraint_controller1}) and (\ref{convex_constraint_controller2}) follow from the application of Theorem~\ref{Thm:CVSTEM:LMI} to (\ref{controller}) and (\ref{controller_con2}). \begin{remark} For input non-affine nonlinear systems, we can find $f(x,u)-f(x_d,u_d)=A(x,u,t)(x-x_d)+B(x,u,t)(u-u_d)$ by Lemma~\ref{sdclemma} and use it in Theorem~\ref{nscm_con}, although (\ref{controller}) has to be solved implicitly as $B$ depends on $u$ in this case~\cite{vccm,WANG201944}. \end{remark} \if0 \begin{example} \label{sdcex} Let $f(x,t) = [-x_1,-x_2+x_1x_2^2]^T$ and $g(x,t) = [0,x_1^2]^T$. Computing $A(x,t)$ using (\ref{sdcAc}) yields \begin{align} A(x,t) =& \begin{bmatrix}-1 & 0\\a_{21} &a_{22}\end{bmatrix}+ \begin{bmatrix}0 & 0\\x_1+x_{d,1} &0\end{bmatrix}u_d \end{align} where $a_{21} = (x_2^2+x_2 x_{d,2}+x_{d,2}^2)/3$ and $a_{22} = -1+(2x_1x_2+x_1x_{d,2}+x_2 x_{d,1}+2x_{d,1}x_{d,2})/3$. We have indeed $A(x,t)(x-x_d)=\tilde{f}(x,t)$ but note that such $A$ is not unique~\cite{sddre}. \end{example} \fi \subsection{CV-STEM Estimation with Learned $M(x,t)$} Consider the following system and a measurement $y(t)$ with perturbation $\mathcal{W}_{1,2}(t)$: \begin{align} \label{sdc_dynamics_est} dx =& f(x,t)dt+G_e(x,t)d\mathcal{W}_1(t) \\ \label{sdc_measurement} ydt =& h(x,t)dt+D(x,t)d\mathcal{W}_2(t) \end{align} where $h:\mathbb{R}^n\times\mathbb{R}_{\geq0} \to \mathbb{R}^{m}$, $G_e:\mathbb{R}^n\times\mathbb{R}_{\geq0} \to \mathbb{R}^{n\times d_1}$, $D:\mathbb{R}^n\times\mathbb{R}_{\geq0} \to \mathbb{R}^{m\times d_2}$, and $\mathcal{W}_{1,2}(t)$ are two independent Wiener processes. We have an analogous result to Theorem~\ref{nscm_con}. \begin{theorem} \label{nscm_est} Suppose $\exists g_e,\overline{d}\in[0,\infty)$ s.t.{} $\|G_e(x,t)\|_F\leq g_e$ and $\|D(x,t)\|_F\leq \overline{d},~\forall x,t$. Suppose also that $\exists W(\hat{x},t)=M(\hat{x},t)^{-1}\succ 0$ s.t.{} $W_{x_i},~\forall x_i$ is Lipschitz with respect to its state with 2-norm Lipschitz constant $L_m$. Let $\nu=1/\underline{\omega}$ and $x$ be estimated as \begin{align} \label{estimator} &d\hat{x} = f(\hat{x},t)dt+M(\hat{x},t)C_L(\hat{x},t)^T(y-h(\hat{x},t))dt \\ \label{estimator_con1} &\dot{W}+2\sym(W A-C^T_LC)+2\alpha_{ge}I \preceq -2\alpha W \\ \label{estimator_con2} &\underline{\omega}I \preceq W(\hat{x},t) \preceq \overline{\omega}I,~0<\nu\leq\sqrt[3]{\nu_{c}},~\forall x,\hat{x},t \end{align} where $\alpha,\nu_c,\varepsilon >0$, $\alpha_{ge} = \alpha_{e1}+\nu_c\underline{\omega}\alpha_{e2}$, $2\alpha_{e1} = L_mg_e^2(\varepsilon+{1}/{2})$, and $2\alpha_{e2} = L_m\overline{c}^2\overline{d}^2(\varepsilon+{1}/{2})$. Also, $A(x,\hat{x},t)$ and $C(x,\hat{x},t)$ are given by (\ref{sdcAc}) of Lemma~\ref{sdclemma} with $(f,x,x_d,u_d)$ replaced by $(f,\hat{x},x,0)$ and $(h,\hat{x},x,0)$, respectively, and $C_L(\hat{x},t)=C(\hat{x},\hat{x},t)$. If $(A,C)$ is uniformly observable and $\|C(x,\hat{x},t)\|\leq\overline{c},~\forall x,\hat{x},t$, then we have the following bound: \begin{align} \label{estimator_ss} E[\|x-\hat{x}\|^2] \leq \frac{C_e}{2\alpha}\chi+\frac{1}{\underline{\omega}}E[V_{s\ell}(0)]e^{-2\alpha t} \end{align} where $V_{s\ell}$ from \eqref{eq:VSL} with its metric being $W(\hat{x},t)$, $C_e=C_{e1}+C_{e2}\nu^2$, $C_{e1} = g_e^2(2/\varepsilon+1)$, $C_{e2} = \overline{c}^2\overline{d}^2(2/\varepsilon+1)$. Further, (\ref{estimator_con1}) and (\ref{estimator_con2}) are equivalent to the following constraints in terms of $\nu$, $\nu_c$, $\chi$, and $\bar{W} = \nu W$: \begin{align} \label{convex_constraint_estimator1} &\dot{\bar{W}}+2\sym{}(\bar{W}A-\nu C^T_LC)+\nu\alpha_{e1}I +\nu_c\alpha_{e2}I \preceq -2\alpha \bar{W} \\ \label{convex_constraint_estimator2} &I\preceq \bar{W}\preceq \chi I,~0<\nu\leq\sqrt[3]{\nu_{c}},~\forall x,\hat{x},t \end{align} where the arguments are omitted for notational simplicity. \end{theorem} \begin{proof} The differential system of (\ref{sdc_dynamics_est}) and (\ref{estimator}) is given as $dq = f(x,t)+(A(x,\hat{x},t)-M(\hat{x},t)C_L(\hat{x},t)^TC(x,\hat{x},t))(q-x))dt+G(q,t)d\mathcal{W}$, where $G(q,t)$ is defined as $G(q=x,t)=G_e(x,t)$ and $G(q=\hat{x},t)=M(\hat{x},t)C(\hat{x},t)^TD(x,t)$. Viewing $V$, $g_1$, and $g_2$ in Theorem~\ref{sic} as $V = \delta q^T W(\hat{x},t) \delta q$, $g_1 = g_e$, and $g_2 = \overline{c}\overline{d}/\underline{\omega}$, (\ref{estimator_ss}) -- (\ref{convex_constraint_estimator2}) follow as in the proof of Theorem~\ref{nscm_con} due to $\nu^3=\underline{\omega}^{-3}\leq\nu_c$ and the contraction condition (\ref{estimator_con1}). \end{proof} \subsection{Modified CV-STEM Formulation} The following proposition summarizes the mCV-STEM. \begin{proposition} \label{cvstem} The optimal contraction metric $M = W^{-1}$ that minimizes the upper bound of the steady-state mean squared distance ((\ref{control_ss}) of Thm.~\ref{nscm_con} or (\ref{estimator_ss}) of Corr.~\ref{nscm_est} with $t\rightarrow \infty $) of stochastically perturbed system trajectories is found by the following convex optimization problem: \begin{align} \label{cvstem_eq} &{J}_{CV}^* = \min_{\nu>0,\nu_c>0,\chi \in \mathbb{R},\bar{W} \succ 0} c_1\chi+c_2\nu+c_3 P(\nu,\nu_c,\chi,\bar{W}) \\ &\text{s.t.{}~~(\ref{convex_constraint_controller1}) \& (\ref{convex_constraint_controller2}) for control, (\ref{convex_constraint_estimator1}) \& (\ref{convex_constraint_estimator2}) for estimation} \nonumber \end{align} where $c_1,c_2,c_3\in[0,\infty)$ and $P$ is an additional performance-based convex cost (see Sec.~\ref{sec:ChoiceObJ}). The weight of $\nu$, $c_2$, can either be viewed as a penalty on the 2-norm of feedback gains or an indicator of how much we trust the measurement $y(t)$. Note that $\alpha$, $\varepsilon$, and $L_m$ are assumed to be given in (\ref{cvstem_eq}) (see Sec.~\ref{given_params} for how to handle $\dot{\bar{W}}$ preserving convexity). \end{proposition} \begin{proof} For control (\ref{control_ss}), using $c_1=C_c/(2\alpha)$ and $c_2=c_3=0$ gives (\ref{cvstem_eq}). We can set $c_2 > 0$ to penalize excessively large $\|u\|$ through $\nu \geq \sup_{x,t}\|M(x,x_d,t)\|$. For estimation, since we have $\nu>0$ and $1 \leq \chi \leq \chi^3$, (\ref{estimator_ss}) as $t\to \infty$ can be bounded as \begin{align} \label{est_bound_example} \frac{C_{e1}\chi+C_{e2}\chi\nu^2}{2\alpha} \leq \frac{1}{3\sqrt{3C_{e1}}}\left(\frac{\sqrt{3C_{e1}}}{\sqrt[3]{2\alpha}}\chi+\frac{\sqrt{C_{e2}}}{\sqrt[3]{2\alpha}}\nu\right)^3. \end{align} Minimizing the right-hand side of (\ref{est_bound_example}) gives (\ref{cvstem_eq}) with $c_1=\sqrt{3C_{e1}}/\sqrt[3]{2\alpha}$, $c_2=\sqrt{C_{e2}}/\sqrt[3]{2\alpha}$, and $c_3=0$. Finally, since $\overline{d}=0$ in (\ref{sdc_measurement}) means $C_{e2}=0$ and no noise acts on $y$,~$c_2$ also indicates how much we trust the measurement. \end{proof} \subsubsection{Choice of $P(\nu,\nu_c,\chi,\bar{W})$}\label{sec:ChoiceObJ} Selecting $c_3=0$ in Proposition~\ref{cvstem} yields an affine objective function that allows for a straightforward interpretation of its weights. Users could also select $c_3>0$ with other performance-based cost functions $P(\nu,\nu_c,\chi,\bar{W})$ in (\ref{cvstem_eq}) as long as they are convex. For example, an objective function $\sum_{x_i\in S}\|u\|^2=\sum_{x_i\in S}\|-B(x_i,t)^TM(x_i,t)x_i\|^2\leq\sum_{x_i\in S}\|B(x_i,t)\|^2\|x_i\|^2\nu^2$, where $S$ is the state space of interest, gives an optimal contraction metric which minimizes the upper bound of its control effort. \subsubsection{Additional Parameters and $\dot{\bar{W}}$} \label{given_params} We assumed $\alpha$, $\varepsilon$, and $L_m$ are given in Proposition~\ref{cvstem}. For $\alpha$ and $\varepsilon$, we perform a line search to find their optimal values as will be demonstrated in Sec.~\ref{simulation}. For $L_m$, we guess it by a deterministic NCM~\cite{ncm} and guarantee the Lipschitz condition by SN as explained in Sec.~\ref{sec_sn_nscm}. Also, (\ref{cvstem_eq}) can be solved as a finite-dimensional problem by using backward difference approximation on $\dot{\bar{W}}$, where we can then use $-\bar{W} \preceq -I$ to obtain a sufficient condition of its constraints, or solve it along pre-computed trajectories $\{x(t_i)\}_{i=0}^M$~\cite{ncm,doi:10.1162/neco.1997.9.8.1735}. \subsection{CV-STEM for Deterministic Disturbance} \textcolor{red}{This section is already give above. Let's merge.} We apply an NCM to the state estimation problem for the following nonlinear system with bounded disturbances: \begin{align} \label{orig_dynamics} \dot{x} = f(x,t)+B(x,t)d_1(t),~y(t) = h(x,t)+G(x,t)d_2(t) \end{align} where $d_1: \mathbb{R}_{\geq 0} \to \mathbb{R}^{k_1}$, $B:\mathbb{R}^n\times\mathbb{R}_{\geq 0} \to \mathbb{R}^{n\times k_1}$, $y: \mathbb{R}_{\geq 0} \to \mathbb{R}^m$, $d_2: \mathbb{R}_{\geq 0} \to \mathbb{R}^{k_2}$, $h:\mathbb{R}^n\times\mathbb{R}_{\geq 0} \to \mathbb{R}^{m}$, and $G:\mathbb{R}^n\times\mathbb{R}_{\geq 0} \to \mathbb{R}^{m\times k_2}$ with $\overline{d}_1 = \sup_t\|d_1(t)\| < +\infty$ and $\overline{d}_2 = \sup_t\|d_2(t)\| < +\infty$. Let $W = M(\hat{x},t)^{-1} \succ 0$, $A(x,t) = (\partial f/\partial x)$, and $C(x,t) = (\partial h/\partial x)$. Let $\hat{x}:\mathbb{R}_{\geq0} \to \mathbb{R}^{n}$. We design an estimator as \begin{align} \label{est_dynamics} &\dot{\hat{x}} = f(\hat{x},t)+M(\hat{x},t)C(\hat{x},t)^T(y-h(\hat{x},t))\\ \label{ekf_con} &\dot{W}+W A(\hat{x},t)+A(\hat{x},t)^TW-2C(\hat{x},t)^TC(\hat{x},t) \preceq -2\alpha W \end{align} where $\alpha > 0$. The following theorem is used to guarantee the local contraction of (\ref{detvd}) in Theorem~\ref{est_stability}. \begin{theorem} \label{neighbor_lemma} If (\ref{ekf_con}) holds for $t\geq0$, $\exists r(t) > 0$ s.t.{} \begin{align} \label{ekf_virtual} 2\gamma W+\dot{W}+\sym{}(W A(q,t))-\sym(C(\hat{x},t)^TC(q,t)) \preceq 0 \end{align} for all $q(t)$ with $\|q(t)-\hat{x}(t)\| \leq r(t)$, where $0 < \gamma < \alpha$. \end{theorem} \begin{proof} See~Lemma 2 of~\cite{6849943} or Theorem 1 of~\cite{observer}. \end{proof} The following theorem along with this lemma guarantees the exponential stability of the estimator (\ref{est_dynamics}). \begin{theorem} \label{est_stability} Suppose that there exist positive constants $\underline{\omega}$, $\overline{\omega}$, $\overline{b}$, $\bar{c}$, $\bar{g}$, and $\rho$ s.t.{} $\underline{\omega}I \preceq W(\hat{x},t) \preceq \overline{\omega}I$, $\|B(x,t)\| \leq \overline{b}$, $\|C(\hat{x},t)\| \leq \bar{c}$, $\|G(x,t)\| \leq \bar{g}$, and $r(t) \geq \rho,~\forall \hat{x},x,t$, where $r(t)$ is defined in Lemma~\ref{neighbor_lemma}. If (\ref{ekf_con}) holds and $R_e(0)+\overline{D}_e/{\gamma} \leq \sqrt{\underline{\omega}} \rho$, where $R_e(t) = \int_{\hat{x}}^x\|\Theta(\hat{x},t)\delta q(t)\|$ with $W = \Theta^T \Theta$ and $\overline{D}_e = \overline{d}_1\overline{b}\sqrt{\overline{\omega}}+{\overline{d}_2\bar{c}\bar{g}}/{\sqrt{\underline{\omega}}}$, then the distance between the trajectory of (\ref{orig_dynamics}) and (\ref{est_dynamics}) is exponentially bounded as follows: \begin{align} \label{est_ss} \int_{\hat{x}}^x\|\delta q\| \leq \frac{R_e(0)}{\sqrt{\underline{\omega}}}e^{-\gamma t}+ \frac{\overline{d}_1\overline{b}}{\gamma}\chi+\frac{{\overline{d}_2\bar{c}\bar{g}}}{\gamma}\nu \end{align} where $\chi = {\overline{\omega}}/{\underline{\omega}}$, $\nu = {1}/{\underline{\omega}}$, and $0 < \gamma < \alpha$. \end{theorem} \begin{proof} Using (\ref{detvd_dynamics}), we have $d(\|\Theta \delta q\|^2)/dt = \delta q^T(\dot{W}+\sym(W A(q,t))-\sym(C(\hat{x},t)^TC(q,t)))\delta q$ when $d_e = 0$. This along with (\ref{ekf_virtual}) gives $\dot{R}_e(t) \leq -{\gamma} R_e(t)$ in the region where Lemma~\ref{neighbor_lemma} holds. Thus, using the bound $\|\Theta(\hat{x}(t),t)d_e(q,t)\| \leq \overline{D}_e$, we have $\sqrt{\underline{\omega}}\int_{\hat{x}}^{x}\|\delta q\| \leq {R_e(0)}e^{-\gamma t}+{\overline{D}_e}/\gamma$ by the same proof as for Theorem~\ref{RobustCont}. Rewriting this with $\chi$, $\nu$, and $1 \leq \sqrt{\chi} \leq \chi$ yields (\ref{est_ss}). This also implies that $\sqrt{\underline{\omega}}\|x-\hat{x}\| \leq R_e(0)+\overline{D}_e/{\gamma},~\forall t$. Hence, the sufficient condition for $\|q-\hat{x}\|$ in Lemma~\ref{neighbor_lemma} reduces to the one required in this theorem. \end{proof} \subsection{Convex Optimization-based Sampling (CV-STEM)} We have the following proposition to sample optimal contraction metrics for the NCM-based state estimation. \begin{proposition} \label{est_prop} $M(\hat{x},t)$ that minimizes an upper bound of $\lim_{t\to\infty} \int_{\hat{x}}^x\|\delta q\|$ is found by the convex optimization problem: \begin{align} \label{convex_opt_estimator} &{J}_{CVe}^* = \min_{\nu>0,\chi \in \mathbb{R},\bar{W} \succ 0} \frac{\overline{d}_1\overline{b}}{\gamma}\chi+\frac{{\overline{d}_2\bar{c}\bar{g}}}{\gamma}\nu\\ &\text{s.t.{}}\text{ $\dot{\bar{W}}+\bar{W}A+A^T\bar{W}-2\nu C^TC \preceq -{2\alpha} \bar{W}$ \& $I \preceq \bar{W} \preceq \chi I$} \nonumber \end{align} where $0 < \gamma < \alpha$. \end{proposition} We have an analogous result for state feedback control. \begin{corollary} \label{con_cor} Consider the following system and a state feedback controller $u(t)$ with the bounded disturbance $d(t)$: \begin{align} \label{control_dynamics} &\dot{x} = f(x,t)+B_1(x,t)u+B_2(x,t)d(t) \\ \label{con_riccati} &\dot{W}-A(x,t)W-W A(x,t)^T+2B_1(x,t)B_1(x,t)^T \succeq 2\alpha W \end{align} where , $B_1:\mathbb{R}^n\times\mathbb{R}_{\geq0}\to\mathbb{R}^{n\times m}$, $B_2:\mathbb{R}^n\times\mathbb{R}_{\geq0}\to\mathbb{R}^{n\times k}$, and $A$ is a matrix defined as $A(x,t)x = f(x,t)$, assuming that $f(x,t) = 0$ at $x = 0$ \cite{sddre,CIMEN20083761}. Then $M(x,t)$ that minimizes an upper bound of $\lim_{t\to\infty} \int_{0}^x\|\delta q\|$ can be found by the following convex optimization problem: \begin{align} \label{convex_opt_controller} &{J}_{CVc}^* = \min_{\nu > 0,\chi \in \mathbb{R},\bar{W} \succ 0} \frac{\overline{b}_2\overline{d}}{\alpha}\chi+\lambda\nu\\ &\text{s.t.{}}\text{ $-\dot{\bar{W}}+A\bar{W}+\bar{W}A^T-2\nu B_1B_1^T \preceq -{2\alpha}\bar{W}$ and $I \preceq \bar{W} \preceq \chi I$} \nonumber \end{align} where $\|B_2(x,t)\| \leq \overline{b}_2,~\forall x,t$ and $\lambda>0$ is a user-defined constant. The arguments of $A(x,t)$, $B_1(x,t)$, and $\bar{W}(x,t)$ are omitted for notational simplicity. \end{corollary} \begin{proof} The system with $q=x,0$ as its particular solutions is given by $\dot{q} = (A(x,t)-B_1(x,t)B_1(x,t)^TM(x,t))q+d_c(q,t)$, where $d_c(x,t) = B_2(x,t)d(t)$ and $d_c(0,t) = 0$. Since we have $\|d_c(q,t)\| \leq \overline{b}_2\overline{d}$ and the differential dynamics is \begin{align} \label{differential_con} \delta \dot{q} = (A(x,t)-B_1(x,t)B_1(x,t)^TM(x,t))\delta q \end{align} when $d_c = 0$, we get $\lim_{t\to \infty}\int_{0}^x\|\delta q\| \leq \overline{b}_2\overline{d}\chi/\alpha$ by the same proof as for Theorem~\ref{est_stability} with (\ref{detvd_dynamics}) replaced by (\ref{differential_con}), (\ref{ekf_virtual}) by (\ref{con_riccati}), and $R_e(t)$ by $V_\ell=\int_{0}^x\|\Theta(x,t )\delta q(t)\|$ from \eqref{eq:VL}. Equation (\ref{convex_opt_controller}) then follows as in the proof of Proposition~\ref{est_prop}, where $\lambda \geq 0$ is for penalizing excessively large control inputs through $\nu \geq \sup_{x,t}\|M(x,t)\|$. \end{proof} \section{Learning-based Contrtion Theory using Neural Contraction Metric (NCM)} \label{sec_ncm} The CV-STEM frameworks in \textcolor{red}{Theorem 10-13}, Proposition~\ref{cvstem}, Proposition~\ref{est_prop}, and Theorem~\ref{con_cor} enable the construction of optimal contraction metrics via convex optimization for the use of optimal and provably stable state estimation and feedback control. However, solving a nonlinear system of equations or an optimization problem at each time instant is not suitable for systems with limited online computational capacity. The Neural Contraction Metric (NCM)~\cite{ncm} addresses this issue by approximating the optimal solutions by a neural network without assuming any special structure in the underlying dynamical system unlike~\cite{AYLWARD20082163,ccm} \subsection{NCM for Deterministic and Stochastic Systems~\cite{ncm,nscm}} Consider the systems perturbed by bounded disturbances as in (\ref{orig_dynamics}) and (\ref{control_dynamics}). The NCM framework is summarized in the following proposition. \begin{proposition} \label{prop_ncm} Suppose that we have a training dataset, $\{(t_i,x_i,M(x_i,t_i))\}_{i=1}^N$, sampled by solving the CV-STEM convex optimization (\ref{convex_opt_estimator}) for estimation and (\ref{convex_opt_controller}) for control, respectively. The NCM is a neural network model of the function $(x_i,t_i)\mapsto M(x_i,t_i)$, and its estimation and control policies are given by those of Proposition~\ref{est_prop} and Corollary~\ref{con_cor}, respectively. Target trajectories can be incorporated in the NCM control by using the generalized SDC form of Lemma~\ref{sdclemma} (see~\cite{nscm,ancm}). \end{proposition} Analogously to deterministic systems, we can model optimal contraction metrics for stochastic nonlinear systems (\ref{sdc_dynamics}), (\ref{sdc_dynamics_est}), and (\ref{sdc_measurement}). \begin{proposition} \label{prop_nscm} Suppose that we have a training dataset, $\{(t_i,x_i,x_{d,i},M(x_i,x_{d,i},t_i))\}_{i=1}^N$, sampled by solving the mCV-STEM convex optimization (\ref{cvstem_eq}). The Neural Stochastic Contraction Metric (NSCM)~\cite{nscm} is a spectrally normalized neural network model of the function $(t_i,x_i,x_{d,i})\mapsto M(x_i,x_{d,i},t_i)$, and its estimation and control policies are given by those of Proposition~\ref{cvstem}. Spectral normalization guarantees a major assumption in stochastic contraction that the first state-derivatives of the metric are Lipschitz continuous, i.e.{}, $L_m$ of Theorem~\ref{nscm_con} and Theorem~\ref{nscm_est} is bounded. \end{proposition} \begin{proof} See~\cite{nscm}. \end{proof} The general SDC parametrization with a target trajectory (\ref{sdcAc}), which captures nonlinearity through $A(x,x_d,t)$ or through multiple non-unique $A_i$~\cite{Ref:Stochastic}, is utilized in Proposition~\ref{prop_ncm}~and~\ref{prop_nscm}, resulting in global exponential stability if the pair $(A,B)$ of (\ref{sdc_dynamics}) is uniformly controllable/observable~\cite{sddre,Ref:Stochastic}. Note that $x_d$ and $u_d$ can be regarded as extra inputs to the NSCM, but we could use Proposition~\ref{est_prop} and Corollary~\ref{con_cor} as a simpler formulation which guarantees local exponential stability without using a target trajectory. Further extension to control contraction metrics, which use differential state feedback $\delta u = K(x,t) \delta x$~\cite{ccm,7989693,47710,WANG201944,vccm}, could be considered for sampling the metric with global reference-independent stability guarantees, achieving greater generality at the cost of added computation. Similarly, while we construct an estimator with global stability guarantees using the SDC form as in (\ref{estimator}), a more general formulation could utilize geodesics distances between trajectories~\cite{scrm}. The NCM framework is summarized in Fig.~\ref{ncmdrawing}. \begin{figure} \centering \includegraphics[width=75mm]{figures/NCMnew.png} \caption{Illustration of NCM ($M(x,x_d,t)$: optimal contraction metric; $x_i$ and $M_i$: sampled states and contraction metrics; $y(t)$: measurements; $x(t)$, $x_d(t)$, and $\hat{x}(t)$: actual, target, and estimated trajectories, respectively.} \label{ncmdrawing} \end{figure} \subsection{NCM for Parametric Uncertain Nonlinear Systems~\cite{ncm,nscm}} In~\cite{9109296}, it is proposed that the obtained contraction metric can be exploited to estimate unknown system parameters adaptively with rigorous asymptotic stability guarantees. The concept of an adaptive Neural Contraction Metric (aNCM) is proposed in~\cite{ancm} for combining the provably stable adaptive control schemes via contraction theory, with the emerging machine learning-based techniques for broader applicability. The outline of the aNCM is depicted in Fig.~\ref{ancmdrawing}. \begin{figure} \centering \includegraphics[width=80mm]{figures/aNcmfig_TBU.png} \caption{Illustration of aNCM ($M$: aNCM; $\hat{\theta}$: estimated parameter; $Y$: error signal, see (\ref{definition_Y}); $x(t)$ and $x_d(t)$: actual and target state; $u$: control input. {\color{red}UPDATE THEOREM/PROPOSITION}} \label{ancmdrawing} \vspace{-1.4em} \end{figure} We consider the following nonlinear system with an uncertain parameter $\theta\in\mathbb{R}^p$: \begin{align} \label{adaptive_general} \dot{x} = f(x;\theta)+B(x;\theta)u,~\dot{x}_d = f(x_d;\theta)+B(x_d;\theta)u_d. \end{align} In~\cite{ancm}, we assume the following, which holds for many types of systems including robotics systems~\cite{Ref:Slotine}, spacecraft high-fidelity dynamics~\cite{battin,doi:10.2514/1.55705}, systems modeled by basis function approximation, and by neural networks~\cite{Nelles2001,SannerSlotine1992}. \begin{assumption} \label{multiplicative_asmp} The system (\ref{adaptation_general}) is multiplicatively separable in terms of $x$ and $\theta$, i.e.{}, $\exists$ $Y_f:\mathbb{R}^n\mapsto\mathbb{R}^{n\times q_z}$, $Y_{b_i}:\mathbb{R}^n\mapsto\mathbb{R}^{n\times q_z},\forall i$, and $Z:\mathbb{R}^p\mapsto\mathbb{R}^{q_z}$ s.t.{} \begin{align} \label{linear_adaptive} Y_f(x)Z(\theta) = f(x;\theta),~Y_{b_i}(x)Z(\theta) = b_i(x;\theta),~\forall x,\theta \end{align} where $B(x;\theta)=[b_1(x;\theta),\cdots,b_m(x;\theta)]$. \end{assumption} \begin{remark} When Assumption~\ref{multiplicative_asmp} holds, we could always redefine $\theta$ as $[\theta^{\top},Z(\theta)^{\top}]^{\top}$ to have $Y_f(q)\theta = f(q;\theta)$ and $Y_{b_i}(q)\theta = b_i(q;\theta)$. Since we can implicitly regularize such an over-parameterized system using the Bregman divergence as will be seen in Corollary~\ref{implicit_reg_thm}, we denote $[\theta^{\top},Z(\theta)^{\top}]^{\top}$ as $\theta$ in the subsequent discussion. \end{remark} Under Assumption~\ref{multiplicative_asmp} with $\theta$ augmented as $[\theta^{\top},Z(\theta)^{\top}]^{\top}$, the dynamics for $e=x-x_d$ of (\ref{adaptive_general}) is expressed as follows: \begin{align} \label{error_dynamics} \dot{e} =& A(x,x_d;\hat{\theta})e+B(x;\hat{\theta})(u-u_d)-\tilde{Y}(\hat{\theta}-\theta) \\ \label{definition_Y} \tilde{Y} =& Y-Y_d= (Y_f(x)+Y_b(x,u))-(Y_f(x_d)+Y_b(x_d,u_d)) \end{align} where $Y_b(x,u)=\sum_{i=1}^mY_{b_i}(q)u_i$, $A$ is the SDC matrix defined in Lemma~\ref{sdclemma}, and $\hat{\theta}$ is the current estimate of $\theta$. \begin{proposition} \label{adaptiveNCMthm} Suppose that Assumption~\ref{multiplicative_asmp} holds and let $B=B(x;\hat{\theta})$ and $A=A(x,x_d;\hat{\theta})$ be the SDC matrix given in (\ref{error_dynamics}) for notational simplicity. Consider a neural network trained to perfectly model the optimal contraction metric $M(x,x_d,\hat{\theta})=W(x,x_d,\hat{\theta})^{-1}$ (we call such $M$ an adaptive Neural Contraction Metric (aNCM)), given by the following convex optimization problem: \begin{align} \label{convex_opt_ancm} &{J}_{aCV}^* = \min_{\chi \in \mathbb{R},\bar{W}\succ 0} ({\overline{d}\chi}/{\alpha}) \text{~~s.t.{} (\ref{deterministic_contraction_adaptive_tilde}) and (\ref{adaptive_W_tilde})}. \end{align} with the convex constraints (\ref{deterministic_contraction_adaptive_tilde}) and (\ref{adaptive_W_tilde}) given as \begin{align} \label{deterministic_contraction_adaptive_tilde} &-\left.({d}/{dt})\right|_{\hat{\theta}}{\bar{W}}+2\sym{\left(A\bar{W}\right)}-2\nu BR^{-1}B^{\top} \preceq -2\alpha \bar{W} \\ \label{adaptive_W_tilde} &I \preceq \bar{W}(x,x_d,\hat{\theta}) \preceq \chi I,~\forall x,x_d,\hat{\theta} \end{align} where $\alpha,\underline{\omega},\overline{\omega} > 0$, $\chi = \overline{\omega}/\underline{\omega}$, $\bar{W} = \nu W$, $\nu = 1/\underline{\omega}$, $({d}/{dt})|_{\hat{\theta}}{\bar{W}}$ is the time derivative of $\bar{W}$ computed along (\ref{adaptive_general}) with $\theta = \hat{\theta}$, and $R=R(x,x_d)\succ0$ is a given weight matrix on $u$. If the true dynamics (\ref{adaptive_general}) is controlled by \begin{align} \label{adaptive_general_u} u =& u_d-R(x,x_d)^{-1}B(x;\hat{\theta})^{\top}M(x,x_d,\hat{\theta})(x-x_d)\\ \label{adaptation_general} \dot{\hat{\theta}} =& \Gamma(Y^{\top}dM_x+Y_d^{\top}dM_{x_d}+\tilde{Y}^{\top}M) (x-x_d) \end{align} where $dM_q = [({\partial M}/{\partial q_1})e,\cdots,({\partial M}/{\partial q_n})e]^{\top}/2$, $e=x-x_d$, $\Gamma \succ 0$, and $Y$, $Y_d$, $\tilde{Y}$ are as defined in (\ref{definition_Y}), and if there exists a bounded and Lipschitz function $\gamma(x,x_d)>0$ which satisfies (\ref{deterministic_contraction_adaptive_tilde}) with equality when $\alpha$ is replaced by $\gamma(x,x_d)$, then $e$ of (\ref{error_dynamics}) asymptotically converges to $0$. Also, when $\theta$ in (\ref{adaptive_general}) is given, the Euclidean distance between $x_d$ and $x$ perturbed by bounded disturbances is exponentially bounded, and the metric $M$ minimizes its steady-state upper bound. \end{proposition} \begin{proof} See~\cite{ancm}. \end{proof} \begin{remark} An important feature of the aNCM is its applicability to provably stable adaptive control of systems modeled by neural networks and basis function approximation~\cite{Nelles2001,SannerSlotine1992} as shown in~\cite{ancm}. \end{remark} \subsection{Neural Contraction Metrics as Lyapunov Functions} Since the NCM and CV-STEM provide explicit ways to construct a differential Lyapunov function $V = \delta x^{\top}M(x,x_d,t)\delta x$ for provably stable feedback control and estimation of nonlinear systems with external disturbances, which is challenging in general, existing optimal robust control techniques can be designed by using it as a Control Lyapunov Function (CLF)~\cite{doi:10.1137/0321028,SONTAG1989117,Khalil:1173048}. The following lemma is useful for this purpose. \begin{lemma} \label{u_equivalence_lemma} Consider a general feedback controller $u$ defined as $u = k(x,x_d,t)$ with $k(x_d,x_d,t)=u_d(x_d,t)$, where $k:\mathbb{R}^n\times\mathbb{R}^n\times\mathbb{R}_{\geq0}\mapsto\mathbb{R}^{m}$. If $k$ is piecewise continuously differentiable, then $\exists K:\mathbb{R}^n\times\mathbb{R}^n\times\mathbb{R}_{\geq0}\mapsto\mathbb{R}^{m\times n}$ s.t.{} $u = k(x_d,x_d,t) = u_d(x_d,t)+K(x,x_d,t)(x-x_d)$. \end{lemma} \begin{proof} We have $u=u_d+(k(x,x_d,t)-k(x_d,x_d,t))$ due to $k(x_d,x_d,t)=u_d(x_d,t)$. Since $k(x,x_d,t)-k(x_d,x_d,t)=\int_0^1(dk(c x+(1-c)x_d,x_d,t)/dc)dc$, choosing $K$ as $\int_0^1(\partial k(c x+(1-c)x_d,x_d,t)/\partial x)dc$ gives the desired relation~\cite{lagros}. \end{proof} Lemma~\ref{u_equivalence_lemma} implies that designing optimal $k$ of $u = k(x,x_d,t)$ reduces to designing optimal $K(x,x_d,t)$ of $u=u_d(x_d,t)-K(x,x_d,t)(x-x_d)$. For such $u$, the virtual system of (\ref{control_dynamics}), which has $y=x,x_d$ as its particular solutions, is given as follows: \begin{align} \label{virtual_dynamics} \dot{y} = \dot{x}_d+(A(x,x_d,t)+B(x,t)K(x,x_d,t))(y-x_d)+d_e(y,t) \end{align} where $A$ is the State-Dependent Coefficient (SDC) form of the dynamical system (\ref{control_dynamics}) given by Lemma~\ref{sdclemma}, i.e.{}, $A(x,x_d,t)(x-x_d) = f(x,t)+B(x,t)u_d-f(x_d,t)-B(x_d,t)u_d$, and $d_e$ satisfies $d_e(x,t)=d(y,t)$ and $d(x_d,t)=0$. \begin{proposition} \label{ncm_clf_thm} Suppose that $f$ and $B$ are piecewise continuously differentiable, and let $B=B(x,t)$ and $A=A(x,x_d,t)$ in (\ref{virtual_dynamics}) for notational simplicity. Consider the NCM given in Proposition~\ref{prop_ncm}. Suppose also that the dynamics (\ref{control_dynamics}) is controlled by $u = u_d+K^*(x,x_d,t)e$, where $e=x-x_d$ and $K^*$ is given by the following convex optimization-based controller for $(x,x_d,t)$: \begin{align} \label{ncm_robust_control} &K^* = \text{arg}\min_{K\in \mathbb{R}^{m\times n}}\|u-u_d\|^2 = \text{arg}\min_{K\in \mathbb{R}^{m\times n}}\|K(x,x_d,t)e\|^2 \\ \label{stability_clf} &\text{s.t.{} } \dot{M}+2\sym{}(MA+MK(x,x_d,t)) \leq -2\alpha M. \end{align} Then (\ref{ncm_robust_control}) is always feasible, i.e.{}, $V=\delta y^{\top}M\delta y$ is a CLF for $y$ in (\ref{virtual_dynamics}), and minimizes the deviation of $u$ from $u_d$ under the stability constraint (\ref{stability_clf}). Furthermore, we have that \begin{align} \label{dist_dist} \|x(t)-x_d(t)\| \leq {\mathcal{R}(0)}{\sqrt{\overline{\omega}}}e^{-\alpha t}+\frac{\overline{d}}{\alpha}\sqrt{\frac{\overline{\omega}}{\underline{\omega}}} =R_{\rm NCM}(t) \end{align} where $\mathcal{R}(t)=\int^{x}_{x_d}\|\Theta(x(t),x_d(t),t) \delta y(t)\|$ for $M=\Theta^{\top}\Theta$. The metric $M$ minimizes the steady-state upper bound of (\ref{dist_dist}), and we call (\ref{ncm_robust_control}) the NCM-CLF control. \end{proposition} \begin{proof} See~\cite{lagros}. \end{proof} \subsection{NCM for Robust and Safe Online Motion Planning~\cite{lagros}} The NCM is also useful for designing a real-time robust motion planning algorithm for safety-critical nonlinear systems perturbed by bounded disturbances as in (\ref{control_dynamics}), utilizing the bounded error tube given by (\ref{dist_dist}) of Proposition~\ref{ncm_clf_thm}. This idea is further explored to propose Learning-based Autonomous Guidance with Robustness, Optimality, and Safety guarantees (LAG-ROS)~\cite{lagros} described in Fig.~\ref{lagrosdrawing}. \begin{figure} \centering \includegraphics[width=85mm]{figures/ncmmpcfig.png} \caption{Illustration of Learning-based Autonomous Guidance with Robustness, Optimality, and Safety guarantees (LAG-ROS)~\cite{lagros,learningmpc}.} \label{lagrosdrawing} \end{figure} \subsection{Sampling of Expert Demonstrations} \label{sec_robust_sampling} We generate expert demonstration data using existing centralized motion planners including the one we use in this work~\cite{tube_nmpc,doi:10.2514/1.G000218,doi:10.1177/0278364914528132}. When the dynamics is perturbed by $d(x,t)$ as in (\ref{control_dynamics}), it can be shown that the NCM-CLF control (\ref{ncm_robust_control}) of Proposition~\ref{ncm_clf_thm} ensures that the perturbed solution $x$ stays within the admissible state space when the target trajectories are sampled explicitly considering the bounded error tube given by (\ref{dist_dist})~\cite{lagros}. Therefore, we sample artificially perturbed states $x$ in the tube $\mathcal{B}(x_d)$ given as $\mathcal{B}(x_d) = \{\xi\in\mathbb{R}^n|\|\xi-x_d\|\leq\lim_{t\to\infty}R_{\rm NCM}(t)\}$ as depicted in Fig.~\ref{samplingfig}, assuming $x_d(0)=x(0)$. The robust control inputs $u$ for imitation learning is then sampled by (\ref{ncm_robust_control}). \begin{figure} \centering \includegraphics[width=80mm]{figures/sample.png} \caption{Illustration of state sampling in robust bounded error tube.} \label{samplingfig} \end{figure} \subsection{Imitation Learning and Guaranteed Safety} The contraction theorey-based imitation learning of the robust and optimal feedback motion planner in the following proposition. \begin{proposition} \label{ncm_clf_prop} The imitation learning-based NCM-CLF control of Theorem~\ref{ncm_clf_thm} is a neural network model for approximating state-robust control input training data $\{(x,u)\}$, sampled based on Sec.~\ref{sec_robust_sampling} (see Fig.~\ref{lagrosdrawing} and Fig.~\ref{samplingfig}). \end{proposition} Another component we add to the imitation learning-based NCM-CLF control law of Proposition~\ref{ncm_clf_prop} is a provable safety guarantee even for systems perturbed by bounded disturbances (\ref{control_dynamics}), summarized in Proposition~\ref{tube_motion_plan}. The key difference of this approach from existing MPC frameworks is that we can select its time horizon much smaller for online implementation depending on the relative degree of safety constraints (see Corollary~\ref{lagros_cor}), as it attempts to find $u$ that minimizes the deviation from the learning-based robust and optimal controller $u_L$ of Proposition~\ref{ncm_clf_prop}, $\int \|u-u_L\|^2 dt$, instead of $\int \|u\|^2 dt$, along with hard safety constraints. \begin{proposition} \label{lagros_prop} Let $u_L$ denote the learning-based NCM-CLF control of Proposition~\ref{ncm_clf_prop}, $u = u_d+K^*(x,x_d,t)e$, approximately modeled by a neural network. The LAG-ROS control input during $t\in[t_i,t_{t+1})$ is given by $u^*_i$ as a result of the following optimization problem, constructed to minimize the deviation of $u^*_i$ from $u_L(t_i)$: \begin{align} \label{lagros_control} &u^*_i,u^*_{i+1},\cdots,u^*_{I_i-1} = \text{arg}\min_{u_k \in \mathbb{R}^{m},\forall k}\sum_{k=i}^{I_i-1}\|u_{k}-u_L(t_k)\|^2 \\ \label{lagros_con1} &\text{s.t.{} $\dot{\bar{x}} = f(\bar{x},t)+B(\bar{x},t)u_k$, $\forall t\in[t_k,t_{k+1})$,} \\ \label{lagros_con2} &\text{{\color{white}s.t.{}} $\bar{x}(t_i) = x(t_i)$, and $\bar{x}(t_{k+1})\in\bar{\mathcal{X}}_k$, $\forall k = i,\cdots,I_i-1$} \end{align} where $x(t_i)$ is the perturbed solution of (\ref{control_dynamics}) observed at $t=t_i$, $\bar{\mathcal{X}}_k=\{q\in\mathbb{R}^n|\forall \xi \in \{\xi|\|q-\xi\|\leq\overline{d}\Delta t_i,~\xi\in\mathcal{X}(t_{k+1})\}$, $\Delta t_i = t_{i+1}-t_i$, $\mathcal{X}$ is admissible safe state space, and $\overline{d} = \sup_{x,t}\|d(x,t)\|$ as defined in (\ref{control_dynamics}). If $I_i$ is selected small enough to make (\ref{lagros_control}) solvable online at $t=t_i$, the LAG-ROS is implementable in real-time and its perturbed solution $x$ governed by (\ref{control_dynamics}) stays in $\mathcal{X}$ for $t\in[t_i,t_{i+1})$. \end{proposition} \begin{proof} See~\cite{lagros}. \end{proof} The following corollary is useful for dramatically reducing computational complexity of Proposition~\ref{lagros_prop} for real-time implementation. \begin{corollary} \label{lagros_cor} The optimization problem (\ref{lagros_control}) of Proposition~\ref{lagros_prop} with $I_i=i+1$ is convex/quadratic if the robust safe set $\bar{\mathcal{X}}_i$ of (\ref{lagros_con2}) is convex/quadratic. \end{corollary} \begin{proof} See~\cite{lagros}. \end{proof} It is shown in~\cite{lagros} that the LAG-ROS illustrated in Fig.~\ref{lagrosdrawing} outperforms existing state-of-the-art real-time motion planners even in decentralized multi-agent settings with external disturbances. \section{Contraction Theory for Data-Driven Learning} \subsection{Nonlinear Adaptive Control and Composite Adaptation\label{sub:Adaptive-NCL}} It is known that adaptive control can be interpreted as an integral control scheme. Hence, the stability characteristic of an adaptive control version of the proposed ~(\ref{eq:first_RNC_MRP}) is similar to that of the integral control in Section~\ref{sub:Robust-NCL-MRP-Integral}. Let the parameter $\hat{{a}}$ capture the six uncertain terms in the inertia tensor ${J}$. The resulting adaptive nonlinear tracking control law and the tuning law are given by: \begin{align} {u}_c =& {Y}\hat{{a}} -{K}_{r}(\hat{{\omega}}-{\omega}_{r}) \\ \dot{\hat{{a}}} =&-{\Gamma}_{r}\textrm{Proj}\left(\hat{{a}},{Y}^{T}(\hat{{\omega}}-{\omega}_{r})\right) \thinspace,\label{eq:RNC_adaptive} \end{align} where ${Y}\hat{{a}}=\skew{4}\hat{{J}}\dot{{\omega}}_{r}-{S}\left(\skew{4}\hat{{J}}\hat{{\omega}}\right){\omega}_{r}$, ${\omega}_{r}$ is defined in ~(\ref{eq:first_RNC_MRP}), and ${\Gamma}_{r}\in\mathbb{R}^{6\times6}$ is a positive-definite diagonal matrix. For some boundary function $f({\theta})$ (e.g., $f({\theta})=\frac{({\theta}^{T}{\theta}-\theta_{\textrm{max}}^{2})}{\varepsilon_{\theta}\theta_{\textrm{max}}^{2}}$ ), the projection operator is given by $ \textrm{Proj}({\theta},{x}) = {x}-\frac{\nabla f({\theta})\nabla f({\theta})^{T}}{\|\nabla f({\theta})\|^{2}}{x}f({\theta})$ if $f({\theta})>0, \thinspace \nabla f({\theta})^{T}{x}>0$; and ${x}$ otherwise. The proof of global asymptotic stability of using ~(\ref{eq:RNC_adaptive}) for the disturbance-free system is straightforward. The stability result of adaptive control is only globally asymptotic because its closed-loop system of the states $({\omega}_{e},\hat{{a}})^{\top}$ yields a negative semidefinite Jacobian matrix $\left[\begin{smallmatrix}-{K}_{r} & {0}\\ {0}& {0}\end{smallmatrix}\right]$ (also, see ~(\ref{eq:proof_step5})). However, the use of a projection operator in ~(\ref{eq:RNC_adaptive}) permits Input-to-State Stability (ISS). \subsubsection{Contraction Metrics for Adaptive Control} Consider the following parametric uncertain system: \begin{align} \dot{x} = f(x)-\Delta(x)^T\theta+B(x)u \end{align} Assuming that the matched uncertainty condition, where we have $\Delta(x)^T\theta=B(x)\varphi(x)^T\theta$, an adaptive control law with a contraction metric $M(x)$ is designed as follows: \begin{align} \label{adaptive_ccm} u =& u_n+\varphi(x)^T\hat{\theta} \\ \label{adaptation_law} \dot{\hat{\theta}} =& -\Gamma \varphi(x)B(x)^TM(\gamma(1))\gamma_s(1). \end{align} where $u_n$ is a nominal controller constructed by a CCM, $\hat{\theta}$ is the current parameter estimate, $\gamma(s)$ is a minimizing geodesic, and $\Gamma \in \mathbb{R}^{p\times p}$ is a diagonal matrix with all positive elements that governs the rate of adaptation uncertainty. This controller renders the closed-loop system asymptotically stable~\cite{9109296}. The NCM approach, which will be discussed in Sec.~\ref{sec_ncm}, could also be used to construct the nominal controller in (\ref{adaptive_ccm}) by treating $\theta$ as another input to the neural network and sampling them in a given parameter range of interest~\cite{ancm}. This method is called an adaptive Neural Contraction Metric (aNCM), and is applicable to multiplicatively separable systems in terms of its state $x$ and unknown parameters $\theta$, i.e.{}, $f(x,\theta) = Y(x)^{\top}Z(\theta)$. It is shown in~\cite{ancm} that the aNCM can also be used for dynamical systems modeled by a neural network for asymptotic stabilization. We remark that the adaptation law (\ref{adaptation_law}) can be generalized to $\allowbreak\dot{\hat{\theta}}=-(\nabla^2\psi(\hat{\theta}))^{-1} \varphi(x)B(x)^TM(x)x$ with $\psi$ being a given convex function, thereby achieving implicit regularization on the estimated parameters $\hat{\theta}$~\cite{boffi2020implicit}. \subsection{Contraction Theory and Gradient Descent Algorithms} Contraction theory has also been shown to provide a generalized view for the analysis of continuous time gradient-based optimization algorithms, thanks to the following theorem. \begin{theorem} Consider a twice differentiable scalar output function $f:\mathbb{R}^n\times\mathbb{R}\to\mathbb{R}$, a symmetric positive definite metric $f:\mathbb{R}^n\to\mathbb{R}^{n\times n}$, and the natural gradient system~\cite{doi:10.1162/089976698300017746} \begin{align} \label{eq_natural_grad} \dot{x} = h (x,t) = -M(x)^{-1}\nabla_x f(x,t). \end{align} Then, $f$ is geodesically $\alpha$-strongly convex in the metric $M$ for each $t$~\cite{gconvex}, if and only if (\ref{eq_natural_grad}) is contracting with rate $\alpha$ in the metric $M$. More specifically, the Riemannian Hessian verifies $H = -\frac{1}{2}(MA+A^{\top}M+\dot{M})$ where $A = \frac{\partial h}{\partial x}$. \end{theorem} \begin{proof} See~\cite{beyondconvexity}. \qed \end{proof} It is demonstrated also in~\cite{beyondconvexity} that if (\ref{eq_natural_grad}) is semi-contracting in some metric and one trajectory of the system is known to be bounded, then (a) $f$ has at least one stationary point, (b) any local minimum of $f$ is a global minimum, (c) all global minima of $f$ are path-connected, and (d) all trajectories asymptotically converge to a global minimum of $f$. in the case of a time-invariant objective, most elementary results on gradient descent based on convexity can be replaced by much more general results based on contraction. In the case of a time-invariant objective, these facts implies that gradient descent converges to a unique equilibrium if its dynamics are contracting in any metric, with convexity of the cost corresponding to the special case of contraction in the identity metric. \subsection{Learning Contraction Metrics from Trajectory Data} All of the approaches introduced earlier are for the case where we have a known dynamical system model $f(x,t)$, but we sometimes need a way to handle situations where we have large amount of system trajectory data with unknown underlying dynamics, especially in recent learning-based control settings. Specifically, let us assume that the underlying system is given by a continuous-time autonomous system, $\dot{x}=f(x)$, where $f$ is continuous, unknown, and the state $x \in \mathbb{R}^n$ is fully observed. Let $X \subseteq \mathbb{R}^n$ be a compact set and $T\subseteq \mathbb{R}_{+}$ be the maximal interval starting at zero for which a unique solution $\varphi_t(\xi)$ exists for all initial conditions $\xi \in X$ and $t \in T$. We assume access to sample trajectories generated from random initial conditions. Contraction theory is able to handle such challenging scenarios with the help of the following theorem. In Theorem~\ref{data_driven_cont_thm}, we use the following notations: $\mathbb{B}^n_2(r)$, the closed $\ell_2$-ball in $\mathbb{R}^n$ of radius $r$ centered at $0$; $\mathbb{B}^n_2(\xi,r)$, the closed $\ell_2$-ball in $\mathbb{R}^n$ of radius $r$ centered at $\xi$; $\mathbb{S}^{p-1}$, the sphere in $\mathbb{R}^n$; $\mu_{\rm Leb}(\cdot)$, the Lebesgue measure on $\mathbb{R}^n$; $\psi_t(\cdot)$, the induced flow on the prolongated system, $g(x,\delta x) = (f(x),\frac{\partial f}{\partial x}(x)\delta x)^{\top}$; $\theta_t(\delta \xi,\xi)$, the second element of $\psi_t(\xi,\delta \xi)$; $\zeta_n(r)$, the Haar measure of a spherical cap in $\mathbb{S}^{n-1}$ with arc length $r$; $\nu$, the uniform probability measure on $X\times \mathbb{S}^{n-1}$; and $\mathcal{T}S$, the tangent bundle of $S = \cup_{t\in T}\varphi_t(X)$. \begin{theorem} \label{data_driven_cont_thm} Fix an $\eta \in (0,1)$. Suppose that $X \in \mathbb{R}^n$ is full-dimensional, $n \geq 2$, and $\dot{x} = f(x)$ be contracting in the uniformly bounded positive definite metric $M^*(x)$, i.e.{}, $mI \preceq M^*(x) \preceq LI$, with rate $\lambda > 0$. Suppose also that $\nu(Z_b)\leq\varepsilon$ for $Z_b = \{(\xi,\delta\xi)\in X\times\mathbb{S}^{n-1}:\max_{\tau\in T}\nabla V(\psi_{\tau}(\xi,\delta \xi))^{\top}g(\psi_{\tau}(\xi,\delta \xi)) > \lambda V(\psi_t(\xi,\delta \xi))\}$. Let $V: \mathcal{T}S \mapsto \mathbb{R}$ be a learned differential Lyapunov function of the form $V(x,\delta x) = \delta x^{\top}M(x)\delta x$, where $M(x)$ is a positive definite matrix function with $M(x)\succeq \mu I$, and define the constant $\bar{B}=B_H(B_{\nabla q}+\lambda B_{\nabla V})(L/m)^{3/2}$, with $B_H = \sup_{x\in S}\left\|\frac{\partial^2f}{\partial x^2}\right\|$, $B_{\nabla q} = \sup_{x\in S}\|\nabla q(x)\|$, and $B_{\nabla V} = \sup_{x\in S}\|\nabla V(x)\|$, for the function $q(x) = \nabla V(x)^{\top} f(x)$. Also, define $r(\varepsilon) = \sup\{r>0:r^n\zeta_n(r)\leq\frac{\varepsilon\mu_{\rm Leb}(X)}{\mu_{\rm Leb}(\mathbb{B}_2^{n}(1))}\}$, and let the radius $r_b = \sqrt{\allowbreak r(\varepsilon)\bar{B}/(\eta \lambda \mu)}$. Finally, define the sets $\tilde{X}_t(r_b) = \{\xi \in \tilde{X}:\inf_{\delta \xi \in \mathbb{S}^{n-1}} \|\theta_t(\delta \xi,\xi)\| \geq r_b\}$ for $t \in T$, with $\tilde{X} = \{\xi \in X: \mathbb{B}^n_2(\xi,r(\varepsilon)) \subset X\}$. Then the system is contracting in the metric $M(x)$ at the rate $(1-\eta)\lambda$ for every $x \in \tilde{S}(r_b) = \cup_{t\in T}\varphi_t(\tilde{X}_t(r_b))$. \end{theorem} \begin{proof} See~\cite{boffi2020learning}. \qed \end{proof} Theorem~\ref{data_driven_cont_thm} states that the contraction condition (\ref{M_length}) is satisfied for the learned Lyapunov function $V(x,\delta x) = \delta x^{\top}M(x)\delta x$ for all $x \in \tilde{S}(r_b)$, and that the quality of $V$ increases as the measure of the violation set $X_b$ decreases, since we have $r_b \to 0$ as $\varepsilon\to0$. In~\cite{boffi2020learning}, it is proved that we have $\varepsilon \leq O(k\cdot \text{polylog}(N)/N)$ decay rates for various parametric and nonparametric function classes, where $N$ is the number of sampled trajectories and $k$ is the effective number of parameters of the function class of interest, when the samples are drawn uniformly from $X\times \mathbb{S}^{p-1}$. \if0 Although it is ideal to use a larger number of basis functions seeking for a more optimal solution in the SOS and CCM frameworks, their downside is that the problem size grows exponentially with the number of variables and basis functions~\cite{sos_dissertation}. A Neural Contraction Metric (NCM) in~\cite{ncm}, a deep learning-based design framework for provably-stable robust estimation and control for nonlinear systems given as $\dot{x}(t) = f(x(t),t)+d(t)$, where $\overline{d}=\sup_{t \geq 0}\|d(t)\| < +\infty$, is presented to overcome this issue. For feedback control synthesis, it samples the optimal metric by the following convex optimization problem. \begin{proposition} \label{cvstem_control} Suppose a feedback controller $u$ for a given desired state and input pair $(x_d,u_d)$ is designed as follows: \begin{align} u = -B(x,t)^TM(x,x_d,t)(x-x_d)+u_d. \end{align} Suppose also that the uniformly bounded contraction metric $\overline{\omega}^{-1}I\preceq M(x,x_d,t)\preceq \underline{\omega}^{-1}I$ is given by solving the following optimization problem: \begin{align} \label{convex_opt_ncm} &{J}_{CV}^* = \min_{\chi \in \mathbb{R},\bar{W}\succ 0} \frac{\overline{d}\chi}{\lambda} \text{ subject to} \\ &-\dot{\bar{W}}+A\bar{W}+\bar{W}A^T-B^TB \preceq -2\lambda \bar{W} \\ &I \preceq \bar{W}(x,t) \preceq \chi I,~\forall x,t. \end{align} where $\nu = 1/\underline{\omega}$, $\chi=\overline{\omega}/\underline{\omega}$, $\bar{W} = \nu M(x,x_d,t)^{-1}$, and $A$ is a matrix which satisfies $A(x,x_d,t)(x-x_d) = f(x,t)+B(x,t)u_d-f(x_d,t)-B(x_d,t)u_d$. Then the Euclidean distance between perturbed and unperturbed system trajectories is exponentially bounded, and (\ref{convex_opt_ncm}) finds the optimal $M(x,t)$ which minimizes an upper bound of its steady-state bound. Note that $\lambda$ and $\overline{d}$ are assumed to be given and that the optimal Lyapunov function can be constructed as $V = \delta x^T M(x,t) \delta x = \nu \delta x^T \bar{W}(x,t)^{-1} \delta x$. \end{proposition} \begin{proof} See Lemma~\ref{LM:Robust_contraction_original} and \cite{mypaperTAC,ncm}. \end{proof} \begin{remark} The matrix $A$ in Proposition~\ref{cvstem_control} defined as $A(x,x_d,t)(x-x_d) = f(x,t)+B(x,t)u_d-f(x_d,t)-B(x_d,t)u_d$ is a generalized form of the State-Dependent Coefficient (SDC) parameterization, and can always be selected based on the line integral of the Jacobian of $f(x,t) +B(x,t)ud$, as long as $f$ and $B$ are continuously differentiable~\cite{nscm}. \end{remark} The NCM is a neural network model for approximating the optimal contraction metric given by (\ref{convex_opt_ncm}). Utilizing a duality between estimation and control in the differential dynamics~\cite{ncm}, its optimal estimation policy can be designed as $\dot{\hat{x}} = f(\hat{x},t)+M(\hat{x},t)C(\hat{x},t)^T(y-h(\hat{x},t))$ analogously to the control synthesis in Proposition~\ref{cvstem_control}. \subsubsection{Neural Contraction Metrics for Stochastic Nonlinear Systems} As discussed earlier in Lemma~\ref{sc_lemma}, contraction theory is useful even for stability analysis of stochastic nonlinear systems~\cite{4806161,scrm,Ref:Stochastic}. In~\cite{Ref:Stochastic}, a computationally efficient estimation synthesis algorithm for stochastic nonlinear systems is proposed by utilizing the convex properties of contraction analysis. Solving a convex program at each time instant allows us to guarantee exponential boundedness of the mean squared distance between the estimated and actual trajectories. This approach is further explored to design a stochastic contraction metric for feedback control, where the metric is found via convex optimization to minimize a steady-state upper bound of the mean squared tracking error~\cite{mypaperTAC}. Computationally efficient as these techniques are, solving an optimization problem at each time instant is not suitable for systems with limited online computational power. We thus presented a Neural Stochastic Contraction Metric (NSCM), a learning-based framework for provably-stable robust control and estimation for a class of stochastic nonlinear systems based robust control and estimation framework outlined in Fig.~\ref{ncmdrawing}. It uses a neural network as a model for an optimal contraction metric sampled by the convex optimization, where the spectral normalization technique is utilized in the NSCM training to validate a major assumption in stochastic contraction that the first state-derivatives of the metric are Lipschitz continuous. \fi \subsection{State Error Bounds During Rollout of Learning-based Control (motion planning)} \label{subsec:state_bounds} Cite [Nakka] The following assumptions are made on the nominal system $\dot{\bar{p}}=f(\bar{p},u)$ to derive the state tracking error bound during rollout. \begin{asmp} \label{asmp:stability} There exists a globally exponentially stable (i.e., finite-gain $\mathcal{L}_p$ stable) tracking control law $u_c = u_c(\bar{p},\bar{p}_{d},\bar{u}_{d})$ for the nominal dynamics $\dot{\bar{p}}= f(\bar{p},u_c)$. The control law $u_c$ satisfies the property $u_{c}(\bar{p}_d,\bar{p}_d,\bar{u}_d) = \bar{u}_d$ for any sampled trajectory $(\bar{p}_{d},\bar{u}_{d})$ from the information trajectory $(x_{i},\bar{u}_{i})$. At any time $t$ the state $\bar{p}$ satisfies the following inequality, when the closed-loop control $u_c$ is applied to the nominal dynamics, \begin{equation*} \scalebox{0.95}{$M(\bar{p},t)\frac{\partial f}{\partial \bar{p}} + \left(\frac{\partial f}{\partial \bar{p}}\right)^\top M(\bar{p},t) + \frac{d}{dt}M(\bar{p},t) \leq - 2 \alpha M(\bar{p},t)$}, \end{equation*} where $f = f(\bar{p},u_c(\bar{p},\bar{p}_d,\bar{u}_d))$, $\alpha>0$, $M(\bar{p},t)$ is a uniformly positive definite matrix with $(\lambda_{\min}(M)\|\bar{p}\|^2 \leq \bar{p}^\top M(\bar{p},t)\bar{p} \leq \lambda_{\max}(M)\|\bar{p}\|^2)$, and $\lambda_{\max}$ and $\lambda_{\min}$ are the maximum and minimum eigenvalues. \end{asmp} \begin{asmp}\label{asmp:bounded_g} The unknown model $g$ satisfies the bound $\|\left(g\left(\bar{p},u_c\right) - g(\bar{p}_d,\bar{u}_d)\right)\|^2_2 \leq c_3$. \end{asmp} \begin{asmp}\label{asmp:bounded_density} The probability density ratio $\tfrac{\rho_{x_i(t)}}{\rho_{x_i(0)}} \leq r$ is bounded, where the functions $\rho_{x_i(0)}$ and $\rho_{x_i(t)}$ are the probability density functions of $x_i$ at time $t=0$ and $t$ respectively. \end{asmp} \begin{lemma}\label{lemma:bound} Given that the estimated model~\eqref{eq:learned_model} satisfies the Assumption~\ref{asmp:learning_bounds}, and the systems~(\ref{eq:dynamics_original}) and~\eqref{eq:dynamics_estimated} satisfy Assumptions~\ref{asmp:stability},~\ref{asmp:bounded_g},~\ref{asmp:bounded_density}, if the control $u_{c} = u_{c}(\bar{p},x_i,\bar{u}_i)$ is applied to the system~\eqref{eq:dynamics_original}, then the following condition holds at time $t$ \begin{align} \mathbb{E}_{x_{i}(t)} (\|\bar{p}-x_i\|^2_{2}) & \leq \tfrac{\lambda_{\max}(M)}{2\lambda_{\min}(M) \alpha_{m}} (c_1 + c_2 + c_3) r \label{eq:propagation_error}\\& + \tfrac{\lambda_{\max}(M)r}{\lambda_{\min}(M)} \mathbb{E} \left( \|\bar{p}(0)-x_i(0)\|^2\right) e^{-2\alpha_{m}t}, \nonumber \end{align} where $(x_i,\bar{u}_i)$ is computed from~\eqref{eq:stoptprob_gpc} and $\alpha_{m} = (\alpha - 1)$. The states $\bar{p}\in \mathcal{X}$, and $x_i\in \mathcal{X}$ are feasible trajectories of the deterministic dynamics~(\ref{eq:dynamics_original}) and the SDE~(\ref{eq:dynamics_estimated}) for the initial conditions $\bar{p}(0) \in \mathcal{X}$ and $x_i(0) \in \mathcal{X}$ respectively at $t\geq t_{0}$. \end{lemma} \begin{proof} See Lemma 2 in~\cite{dani2014observer}.\end{proof} Lemma~\ref{lemma:bound} states that the expected mean squared error $\mathbb{E}(\|\bar{p}-x_i\|^2)$ is bounded by $\tfrac{\lambda_{\max}(M)(c_1 + c_2 + c_3)r}{2\alpha_{m}\lambda_{\min}(M)}$ as $t \to \infty$ when the control law $u_c$ is applied to the dynamics in~\eqref{eq:dynamics_original}. The bounded tracking performance leads to constraint violation \subsection{Stability of Learning-based Additive Model} Example of Neural Lander [Cite] \subsubsection{Spectral Normalization} Spectral normalization stabilizes DNN training by constraining the Lipschitz constant of the objective function. Spectrally normalized DNNs have also been shown to generalize well \cite{bartlett2017spectrally}, which is an indication of stability in machine learning. Mathematically, the Lipschitz constant of a function $\|f\|_{\text{Lip}}$ is defined as the smallest value such that \[\forall \, \B{x}, \B{x}':\ \|f(\B{x})-f(\B{x}')\|_2/\|\B{x}-\B{x}'\|_2\leq \|f\|_{\text{Lip}}.\] It is known that the Lipschitz constant of a general differentiable function $f$ is the maximum spectral norm (maximum singular value) of its gradient over its domain $\|f\|_{\text{Lip}}= \sup_{\B{x}}\sigma(\nabla f(\B{x}))$. The ReLU DNN in \eqref{eq:relu} is a composition of functions. Thus we can bound the Lipschitz constant of the network by constraining the spectral norm of each layer $g^l(\B{x})=\phi(W^l \B{x})$. Therefore, for a linear map $g(\B{x})=W\B{x}$, the spectral norm of each layer is given by $\|g\|_{\text{Lip}}=\sup_{\B{x}}\sigma(\nabla g(\B{x}))=\sup_{\B{x}}\sigma(W)=\sigma(W)$. Using the fact that the Lipschitz norm of ReLU activation function $\phi(\cdot)$ is equal to 1, with the inequality $\|g_1\circ g_2\|_{\text{Lip}}\leq\|g_1\|_{\text{Lip}}\cdot\|g_2\|_{\text{Lip}}$, we can find the following bound on $\|f\|_{\text{Lip}}$: \begin{equation} \|f\|_{\text{Lip}}\leq\|g^{L+1}\|_{\text{Lip}}\cdot\|\phi\|_{\text{Lip}}\cdots\|g^1\|_{\text{Lip}}=\prod_{l=1}^{L+1}\sigma(W^l). \label{eq:upper_bound} \end{equation} In practice, we can apply spectral normalization to the weight matrices in each layer during training as follows: \begin{equation} \bar{W} = W / \sigma(W)\cdot \gamma^{\frac{1}{L+1}}, \label{eq:sn} \end{equation} where $\gamma$ is the intended Lipschitz constant for the DNN. The following lemma bounds the Lipschitz constant of a ReLU DNN with spectral normalization. \begin{lemma}For a multi-layer ReLU network $f(\B{x},\bm\theta)$, defined in~\eqref{eq:relu} without an activation function on the output layer. Using spectral normalization, the Lipschitz constant of the entire network satisfies: \begin{equation*} \lVert f(\B{x}, \bar{\bm{\theta}}) \rVert_{\text{Lip}}\leq \gamma, \label{eq:nn_lip} \end{equation*} with spectrally-normalized parameters $\bar{\bm{\theta}}={\bar{W} ^1,\cdots,\bar{W} ^{L+1}}$. \label{lemma:sn} \end{lemma} \begin{proof} As in \eqref{eq:upper_bound}, the Lipschitz constant can be written as a composition of spectral norms over all layers. The proof follows from the spectral norms constrained as in \eqref{eq:sn}. \end{proof} \subsection{Control Allocation as Contraction Mapping} We first show that the control input $\B{u}_k$ converges to the solution of~\eqref{eq:control_nonaffine} when all states are fixed. \begin{lemma} \label{thm:lem1} Define mapping $\B{u}_{k} = \mathcal{F}(\B{u}_{k-1})$ based on~\eqref{eq:discrete_control} and fix all current states: \begin{equation} \mathcal{F}(\B{u}) = B_0^{-1} \begin{bmatrix} \left(\bar{\B{f}}_d - \hat{\B{f}}_a(\bm{\zeta},\B{u})\right) \cdot \hat{k}\\ \bm{\tau}_d \end{bmatrix}. \label{eq:contraction_map} \end{equation} If $\hat{\B{f}}_a(\bm{\zeta},\B{u})$ is $L_a$-Lipschitz continuous, and $\sigma(B_0^{-1})\cdot L_a < 1$; then $\mathcal{F}(\cdot)$ is a contraction mapping, and $\B{u}_k$ converges to unique solution of $\B{u}^{*} = \mathcal{F}(\B{u}^{*})$. \end{lemma} \begin{proof} $\forall\,\B{u}_1, \B{u}_2 \in \mathcal{U}$ with $\mathcal{U}$ being a compact set of feasible control inputs; and given fixed states as $\bar{\B{f}}_d$, $\bm{\tau}_d$ and $\hat{k}$, then: \begin{align*} \lVert\mathcal{F}(\B{u}_1) - \mathcal{F}(\B{u}_2) \rVert_2 &=\left\lVert B_0^{-1} \left(\hat{\B{f}}_a(\bm{\zeta},\bm{u}_1) - \hat{\B{f}}_a(\bm{\zeta},\bm{u}_2)\right) \right\rVert_2 \\ &\leq \sigma(B_0^{-1}) \cdot L_a \left\lVert \B{u}_1 - \B{u}_2\right\rVert_2. \end{align*} Thus, $\exists \ \alpha < 1, \text{s.t} \ \lVert\mathcal{F}(\B{u}_1) - \mathcal{F}(\B{u}_2) \rVert_2 < \alpha \left\lVert \B{u}_1 - \B{u}_2\right\rVert_2$. Hence, $\mathcal{F}(\cdot)$ is a contraction mapping. \end{proof} \subsection{Stability of Learning-based Nonlinear Controller} Before continuing to prove the stability of the full system, we make the following assumptions. \begin{assumption} The desired states along the position trajectory $\B{p}_d(t)$, $\dot{\B{p}}_d(t)$, and $\ddot{\B{p}}_d(t)$ are bounded. \end{assumption} \begin{assumption} One-step difference of control signal satisfies $\left\lVert \B{u}_k - \B{u}_{k-1}\right\rVert \leq \rho \left\lVert \B{s} \right\rVert$ with a small positive $\rho$. \end{assumption} Here we provide the intuition behind this assumption. From~\eqref{eq:contraction_map}, we can derive the following approximate relation with $\Delta(\cdot)_k = \lVert (\cdot)_{k} - (\cdot)_{k-1}\rVert$: \begin{align*} \Delta u_k &\leq \sigma(B_0^{-1})\big(L_a \Delta u_{k-1} + L_a \Delta \zeta_k \\ & \qquad + m \Delta \dot{v}_{r,k} + \lambda_{\max}(K_v)\Delta s_{k} + \Delta \tau_{d,k} \big). \end{align*} Because update rate of attitude controller ($ > \SI{100}{Hz}$) and motor speed control ($ > \SI{5}{kHz}$) are much higher than that of the position controller ($ \approx \SI{10}{Hz}$), in practice, we can safely neglect $\Delta s_k$, $\Delta \dot{v}_{r,k}$, and $\Delta \zeta_k$ in one update~(Theorem 11.1~\cite{khalil2002nonlinear}). Furthermore, $\Delta \tau_{d,k}$ can be limited internally by the attitude controller. It leads to: \begin{equation*} \Delta u_k \leq \sigma(B_0^{-1})\big(L_a \Delta u_{k-1} + c \big), \end{equation*} with $c$ being a small constant and $\sigma(B_0^{-1})\cdot L_a < 1$ from Lemma.~\ref{thm:lem1}, we can deduce that $\Delta u$ rapidly converges to a small ultimate bound between each position controller update. \begin{assumption} The learning error of $\hat{\B{f}}_a(\bm{\zeta},\B{u})$ over the compact sets $\bm{\zeta} \in \mathcal{Z}$, $\B{u} \in \mathcal{U}$ is upper bounded by $\epsilon_m = \sup_{\bm{\zeta} \in \mathcal{Z}, \B{u} \in \mathcal{U}}\lVert \bm{\epsilon}(\bm{\zeta}, \B{u})\rVert$, where $\bm{\epsilon}(\bm{\zeta}, \B{u})=\B{f}_a(\bm{\zeta}, \B{u})-\hat{\B{f}}_a(\bm{\zeta}, \B{u})$. \end{assumption} DNNs have been shown to generalize well to the set of unseen events that are from almost the same distribution as training set~\cite{zhang2016understanding,he2016deep}. This empirical observation is also theoretically studied in order to shed more light toward an understanding of the complexity of these models~\cite{neyshabur2017pac,bartlett2017spectrally,dziugaite2017computing,neyshabur2017exploring}. Based on the above assumptions, we can now present our overall stability and robustness result. \begin{theorem} Under Assumptions 1-3, for a time-varying $\B{p}_d(t)$, the controller defined in~\eqref{eq:pos_control,eq:discrete_control} with $\lambda_{\min}(K_v)>L_a\rho$ achieves exponential convergence of composite variable $\B{s}$ to error ball $\lim_{t\rightarrow\infty}\|\B{s}(t)\|=\epsilon_m/\left(\lambda_{\min}(K_v) - L_a \rho\right)$ with rate $(\left(\lambda_{\min}(K_v) - L_a \rho\right)/m$. And $\tilde{\B{p}}$ exponentially converges to error ball \begin{equation} \lim_{t\rightarrow\infty}\|\tilde{\B{p}}(t)\|=\frac{\epsilon_m}{\lambda_\mathrm{min}(\Lambda)(\lambda_{\min}(K_v) - L_a \rho)} \label{eq:perrorinfty} \end{equation} with rate $\lambda_{\min}(\Lambda)$. \end{theorem} \begin{proof} We begin the proof by selecting a Lyapunov function as $\mathcal{V(\B{s})} = \frac{1}{2}m\lVert \B{s}\rVert ^2$, then by applying the controller~\eqref{eq:pos_control}, we get the time-derivative of $\mathcal{V}$: \begin{align*} \dot{\mathcal{V}} &= \B{s}^\top \big(-K_v \B{s} + \hat{\B{f}}_a(\bm{\zeta}_k, \B{u}_k) - \hat{\B{f}}_a(\bm{\zeta}_k,\B{u}_{k-1}) + \bm{\epsilon}(\bm{\zeta}_k, \B{u}_k) \big) \\ &\leq -\B{s}^\top K_v \B{s} + \lVert \B{s}\rVert(\lVert \hat{\B{f}}_a(\bm{\zeta}_k, \B{u}_k) - \hat{\B{f}}_a(\bm{\zeta}_k,\B{u}_{k-1}) \rVert + \epsilon_m) \end{align*} Let $\lambda =\lambda_{\min}(K_v)$ denote the minimum eigenvalue of the positive-definite matrix $K_v$. By applying the Lipschitz property of $\hat{\B{f}}_a$~\eqref{lemma:sn} and Assumption 2, we obtain \begin{align*} \dot{\mathcal{V}} \leq -\frac{2\left(\lambda\!-\!L_a\rho\right)}{m}\mathcal{V} + \sqrt{\frac{2\mathcal{V}}{m}} \epsilon_m \end{align*} Using the Comparison Lemma\cite{khalil2002nonlinear}, we define $\mathcal{W}(t) = \sqrt{\mathcal{V}(t)}= \sqrt{m/2}\lVert\B{s}\rVert$ and $\dot{\mathcal{W}} = \dot{\mathcal{V}}/\left(2\sqrt{\mathcal{V}}\right)$ to obtain \begin{align*} \left\lVert\B{s}(t)\right\rVert &\leq \left\lVert\B{s}(t_0)\right\rVert \exp\left(-\frac{\lambda-L_a\rho}{m}(t-t_0)\right) + \frac{\epsilon_m}{\lambda-L_a\rho} \end{align*} It can be shown that this leads to finite-gain $\mathcal{L}_p$ stability and input-to-state stability (ISS)~\cite{chung2013phase}. Furthermore, the hierarchical combination between $\B{s}$ and $\tilde{\B{p}}$ in \eqref{eq:composite} results in $\lim_{t\rightarrow\infty}\|\tilde{\B{p}}(t)\|=\lim_{t\rightarrow\infty}\|\B{s}(t)\|/\lambda_{\min}(\Lambda)$, yielding (\ref{eq:perrorinfty}). \end{proof} \section{[To be revised] Numerical Search for Contraction Metrics for Control Design} \label{sec:computation} We saw that contraction analysis has several theoretical advantages over the Lyapunov stability analysis as it allows us to characterize exponential stability of nonlinear systems necessarily and sufficiently~\cite{Ref:contraction1}. Although there is no analytical scheme for finding a contraction metric in (\ref{M_length}) for general nonlinear systems, there are several computationally tractable algorithms to find it numerically for the use of stability analysis and control synthesis. These techniques utilize the differential nature of contraction theory, where global exponential stability can be studied by a quadratic Lyapunov function of the differential state $\allowbreak \delta x$, given by $\allowbreak V=\delta x^T M(x,t)\delta x$, as opposed to the Lyapunov technique where $V$ could be any function of $x$. This Linear Time-Varying (LTV) system-like characteristic reduces the problem of finding a Lyapunov function to the problem of finding a contraction metric $\allowbreak M(x,t)$ without loss of generality, thereby yielding several convex optimization-based search algorithms as shall be summarized in this section~\cite{ccm,7989693,mypaperTAC,ncm,nscm}. \subsection{Contraction Metrics and Sum of Squares (SOS) Programming} A multivariate polynomial $p(x_1,\ldots,x_n) = p(x) \in \mathbb{R}[x]$ is called a sum of squares (SOS) if there exist polynomials $f_1(x),\ldots,f_m(x) \in \mathbb{R}[x]$ s.t.{} $p(x)=\sum_{i=1}^mf_i^2(x)$. We have an analogous definition for the matrices as follows. \begin{definition} Consider a symmetric matrix with polynomial entries $S(x) \in \mathbb{R}^{m \times m}[x]$, and let $y=[y_1,\cdots,y_m]^T$ be a vector of new indeterminates. Then $S(x)$ is an SOS matrix if the scalar polynomial $y^TS(x)y$ is an SOS in $\mathbb{R}[x,y]$. \end{definition} \begin{definition} A matrix $S(x)$ is strictly SOS if $\exists\varepsilon>0$ s.t.{} $S(x)-\varepsilon I$ is an SOS matrix. \end{definition} For systems with polynomial or rational dynamics, positive semi-definiteness conditions for contraction metrics (i.e.{} $M\succ 0$ and (\ref{M_length})) can be relaxed to sum of squares (SOS) conditions~\cite{sos_dissertation0,GATERMANN200495,AYLWARD20082163}. In particular, it is shown in~\cite{AYLWARD20082163} that existence of a strictly SOS matrix $M(x)$ and strictly SOS matrix $-R(X)=-(({\partial f}/{\partial x})^TM+M({\partial f}/{\partial x})+\dot{M}+2\lambda M)$ is a sufficient condition for global contraction with a convergence rate $\lambda$ of an autonomous system with polynomial dynamics. This SOS feasibility problem can be solved by specifying the degree of the polynomials in the contraction metric, and by writing an affine parameterization of the symmetric matrices of that degree. \subsection{Control Contraction Metric (CCM)} The concept of control contraction metrics (CCMs)~\cite{ccm,7989693,47710,WANG201944,vccm} is introduced to extend contraction theory to feedback control synthesis of input affine nonlinear systems $\dot{x}=f(x,t)+B(x,t)u$, where $x:\mathbb{R}^+\to\mathbb{R}^n$ and $u:\mathbb{R}^+\to\mathbb{R}^m$ are state and control, respectively. To this end, let $b_i$ be the $i$th column of $B$ and consider the following system and its differential dynamics: \begin{align} \label{ccm_dynamics} \dot{x} =& f(x,t)+B(x,t)u \\ \label{ccm_differential_dynamics} \delta\dot{x} =& A(x,u,t)\delta x+B(x,t)\delta u \end{align} where $A=\partial f/\partial x+\sum_{i=1}^m(\partial b_i/\partial x)u_i$. The CCM is defined by the following theorem. \begin{theorem} \label{ccm_thm} If there exists a uniformly bounded metric $\allowbreak M(x,t)$, i.e.{}, $\allowbreak \underline{m} I \preceq M(x, t) \preceq \overline{m} I$, and satisfies \begin{align} \label{ccm_condition} \delta x^TMB=0~\Rightarrow~\delta x^T(\dot{M}+\sym(MA)+2\lambda M)\delta x < 0 \end{align} for all $\delta_x \neq 0,x,u,t$, then the system (\ref{ccm_dynamics}) is 1) universally exponentially open-loop controllable; 2) universally exponentially stabilizable via sampled-data feedback with arbitrary sample times; and 3) universally exponentially stabilizable via continuous feedback defined almost everywhere, and everywhere in a neighborhood of the target trajectory; all with rate $\lambda$ and overshoot $R = (\overline{m}/\underline{m})^{1/2}$. Such a metric $M(x,t)$ is called a CCM. \end{theorem} In~\cite{ccm}, it is shown that there exists a differential feedback controller $\delta u = k_{\delta}(x,\delta x,u,t)$ given a CCM in Theorem~\ref{ccm_thm}. The following proposition gives a convex programming-based explicit construction of $\delta u$ for practical applications under slightly stronger conditions. \begin{proposition} \label{ccm_strict} Let $u$ be a feedback controller designed as $\delta u = K(x,t)\delta x=\frac{1}{2}\rho (x,t)B(x,t)^TM(x,t)\delta x$, where $\rho (x,t)$ is a scalar multiplier. Then $W(x,t) = M(x,t)^{-1}$ and $\rho (x,t)$ which render the system (\ref{ccm_dynamics}) contracting with a convergence rate $\lambda$ are given by the following set of convex constraints: \begin{align} \label{ccm_con1} &-\frac{\partial W}{\partial t}-\partial_f W+\frac{\partial f}{\partial x}W+W\frac{\partial f}{\partial x}^T-\rho BB^T \preceq -2\lambda W \\ \label{ccm_con2} &\partial_{b_i}W-\frac{\partial b_i}{\partial x}W-W\frac{\partial b_i}{\partial x}^T = 0,~\forall i. \end{align} \end{proposition} \begin{proof} Multiplying both sides of (\ref{ccm_con1}) and (\ref{ccm_con2}) by $M(x,t)$ yields equivalent constraints $\frac{\partial M}{\partial t}-\partial_f M+M\frac{\partial f}{\partial x}+\frac{\partial f}{\partial x}^TM-\rho MBB^TM \preceq -2\lambda M$ and $\partial_{b_i}W-W\frac{\partial b_i}{\partial x}-\frac{\partial b_i}{\partial x}^TW = 0$. These constraints along with a Lyapunov function $V = \delta M(x,t) \delta x$ result in contraction of a convergence rate $\lambda$ as in Corollary~\ref{Metric_analf}. \end{proof} The convex feasibility problem in Proposition~\ref{ccm_strict} is then solved by a finite basis approximation of a contraction metric (e.g.{}, polynomials up to some order). For systems perturbed by bounded disturbances, the CCM framework helps generate a robust motion plans by providing us with a fixed-size tube that the state is guaranteed to remain within while a given desired trajectory via convex optimization~\cite{7989693}. \section{Contraction Theory} \label{sec:ContractionCH2} A brief review of the results from \cite{Ref:contraction1,Ref:contraction2,Ref:contraction3} is presented in this section. Contraction analysis is based on the differential dynamics of a given nonlinear system, where we have the following theorem. \textcolor{blue}{will just mention relationships with LTV stability and Kravoskil's theorems, KYP Lemma} \iffalse\begin{theorem}[Sufficient Condition for LTV Stability] The linear time-varying system (LTV) $\bf{\dot{x}}=\bf{A}(t)\bf{x}$ is globally exponentially stable ($\bf{x}$ tends to $\bf{0}$ exponentially) if $\exists$ $\beta>0$, $\forall i$, $\forall $ $t\geq 0$, $\lambda_i(\bf{A}(t)+\bf{A}(t)^T)\leq -\beta$. \end{theorem} \begin{proof} Take $V=\bf{x}^T\bf{x}$ and compute $\dot{V}$.\end{proof} What is new in contraction theory is that its differential nature leads to a necessary and sufficient condition for global and exponential convergence results in nonlinear systems. Note that contraction theory is a generalization of the classical Krasovskii's theorem~\cite{Ref:Slotine} (Theorem~\ref{Thm:Krasovskii}), and that approaches closely related to contraction, although not based on differential analysis, can be traced back to \cite{Hart,Demi} and even to~\cite{Lew}. \begin{theorem}[Krasovskii's Theorem] \label{Thm:Krasovskii} Let $\bf{A}(\bf{x})$ denote the Jacobian of $\bf{f}(\bf{x})$ of the autonomous system $\bf{\dot{x}}=\bf{f}(\bf{x})$. If the matrix $\bf{F}=\bf{A}+\bf{A}^T$ is negative on $\bf{B}_r$, the equilibrium point is asymptotically stable. \end{theorem}\fi A recent work~\cite{Rantzer} also independently derived a similar result on the use of the monotonicity of singulary weighted volumes. We also exploit contraction and partial contraction theory~\cite{Ref:contraction3} to prove the stability of multiple coupled nonlinear dynamics. \textcolor{blue}{SJC add: compare with Lyapunov theory. $(V(x,t)$ could be any scalar function of $x$, while contraction theory always uses a quadratic function of $\delta x$: $\delta x^T M(x,t)\delta x$} Contraction theory is a differential-based \textbf{incremental stability analysis} of multiple trajectories (as opposed to stability of an equilibrium point). Differential-based analysis is easier for analyzing stability of a networked or combined system (e.g., hierarchical, feedback, or serial combinations). In contrast, passivity-based analysis cannot be applied to a hierarchically-combined system. Contraction theory is more generalized. For instance, all examples and theorems in \cite{Rantzer} are for autonomous systems whereas contraction theory can be easily applied to general time-varying systems including systems with time-varying desired trajectories. Convergence of contraction theory is stronger: exponential and global. Asymptotic convergence of a PD controller is not enough for tracking demanding time-varying reference inputs of nonlinear systems. The proof is intuitive and much simpler. This truly sets contraction analysis aside from other methodologies. For example, one can recall the proof of global and time-varying version of Krasovskii's theorem. Contraction theory also permits a non-constant metric and a pure differential coordinate change. This generalization of the metric (generalized Jacobian, not just $\frac{df}{dx}$) is one of the differences with other methodologies. \subsection{Fundamentals} Suppose that one can construct a virtual volume out of the given dynamics. Rather than finding a decreasing scalar function by the Lyapunov method, a contracting volume indicates the system is contracting. How can we quantify the contraction rate of the virtual volume constructed from the dynamical system? By computing contraction of two neighboring trajectories in the flow field. Consider a smooth nonlinear system \begin{equation}\label{xfx_ch2} {\mathbf{\dot x}}(t)=\mathbf{f}(\mathbf{x}(t),\mathbf{u}(\mathbf{x},t),t) \end{equation} where $\mathbf{x}(t)\in\mathbb{R}^n$, and $\mathbf{f}: \mathbb{R}^n\times\mathbb{R}^m\times\mathbb{R}_{+}\rightarrow\mathbb{R}^n$. \begin{definition}[Virtual Displacement $\delta \mathbf{x}$]A virtual displacement, $\delta\mathbf{x}$ is defined as an infinitesimal displacement at a fixed time-- a common supposition in the \textbf{calculus of variations}.\end{definition} \begin{figure} \centering \includegraphics[width=85mm]{figures/contraction_illustration.PNG} \caption{Contraction analysis} \end{figure} \begin{theorem}[1st Main Theorem of Contraction Analysis]\label{Thm:contraction} For the system in (\ref{xfx_ch2}), if there exists a uniformly positive definite metric, \begin{equation}\label{metric} \mathbf{M}(\mathbf{x},t)={\mathbf{\Theta}}(\mathbf{x},t)^{T}{\mathbf{\Theta}}(\mathbf{x},t) \end{equation} where $\mathbf{\Theta}$ is some smooth coordinate transformation of the virtual displacement, $\delta\mathbf{z}={\mathbf{\Theta}}\delta\mathbf{x}$, such that the associated generalized Jacobian $\bf F$ is uniformly negative definite, i.e., $\exists \lambda >0$ such that \begin{equation}\label{jacobian_ch2} \mathbf{F}=\left(\mathbf{\dot{\Theta}}{(\mathbf{x},t)}+{\mathbf{\Theta}(\mathbf{x},t)}\frac{\partial \mathbf{f}}{\partial \mathbf{x}}\right){\mathbf{\Theta}(\mathbf{x},t)}^{-1} \le - \lambda {\bf I}, \end{equation} then all system trajectories converge globally to a single trajectory exponentially fast regardless of the initial conditions, with a global exponential convergence rate of the largest eigenvalues of the symmetric part of $\mathbf{F}$. \end{theorem} \begin{definition}[Contracting Systems] Such a system satisfying the conditions in Theorem~\ref{Thm:contraction} is said to be contracting.\end{definition} A sketch of the proof~\cite{Ref:contraction1} is given here. \begin{proof} The dynamics of $\delta\mathbf{z}={\mathbf{\Theta}}\delta\mathbf{x}$ are computed as \begin{equation} \frac{d}{dt}\delta\mathbf{z}={\mathbf{\dot \Theta}}\delta\mathbf{x}+{\mathbf{\Theta}}\delta\mathbf{\dot x}=\mathbf{F}\delta\mathbf{z} \end{equation} Hence, the rate of change of squared length, which quantifies the contraction rate of the volume, is represented as \begin{equation} \frac{d}{dt}(\delta \mathbf{z}^T\delta \mathbf{z})=2\delta \mathbf{z}^T\frac{d}{dt}\delta\mathbf{z}=2\delta \mathbf{z}^T\mathbf{F}\delta\mathbf{z}\leq -\lambda \mathbf{z}^T\mathbf{z} \end{equation} Equivalently, we can write \begin{equation} \frac{d}{dt}\|\delta \mathbf{z}\|\leq -\lambda\|\delta \mathbf{z}\| \end{equation} By the comparison lemma~\cite[pp. 211]{Khalil:1173048}, we can find $\|\delta \mathbf{z}(t)\|\leq \|\delta \mathbf{z}_0\|e^{-\lambda t}$. Hence, any infinitesimal length $\|\delta \mathbf{z}(t)\|$ and $\|\delta \mathbf{x}(t)\|$ tend to zero exponentially fast. By path integration, this immediately implies that the length of any finite path converges to exponentially to zero from any initial conditions. Here we use $\|\cdot\|=\|\cdot\|_2$. \end{proof} \begin{remark}No matter where the initial states start in the configuration manifold, they converge to a single trajectory with global and exponential convergence. This convergence result epitomizes the significance of contraction analysis. In the context of fluid dynamics, we can recall Gauss' divergence theorem. Indeed, the divergence of the virtual length vector field, $\text{div}(\frac{d}{dt}\delta\mathbf{z})$ is the trace of $\mathbf{F}$~\cite{Ref:contraction1}.\end{remark} \begin{corollary}[2nd Main Theorem of Contraction Analysis]\label{Metric_analf} Equivalently, the system is contracting if $\exists \lambda >0$ such that \begin{equation}\label{M_length} \mathbf{\dot{M}}+\left(\frac{\partial \mathbf{f}}{\partial \mathbf{x}}\right)^T\mathbf{{M}}+\mathbf{{M}}\frac{\partial \mathbf{f}}{\partial \mathbf{x}} \le - 2 \lambda {\bf M} \end{equation} \end{corollary} \begin{proof} We can easily find \begin{equation} \frac{d}{dt}\left(\delta\mathbf{x}^T\mathbf{M}\delta\mathbf{x}\right) =\delta\mathbf{x}^T\Bigl(\mathbf{\dot{M}}+(\frac{\partial \mathbf{f}}{\partial \mathbf{x}})^T\mathbf{{M}}+\mathbf{{M}}\frac{\partial \mathbf{f}}{\partial \mathbf{x}}\Bigr)\delta\mathbf{x} \end{equation} Hence, we can conclude that the condition in (\ref{M_length}) leads to exponential convergence of $\delta \mathbf{x}$ to zero. % \end{proof} The symmetric and positive definite Riemannian metric, from the Lagrangian representation of dynamical systems, facilitates the use of such a metric in contraction analysis. It can also be shown that for a contracting autonomous system, of the form ${\mathbf{\dot x}}=\mathbf{f}(\mathbf{x},\mathbf{u}(\mathbf{x}))$, all trajectories converge to an equilibrium point exponentially fast. In essence, contraction analysis implies that stability of nonlinear systems can be analyzed more simply by checking the negative definiteness of a proper matrix, rather than finding some implicit motion integral as in Lyapunov theory. \begin{remark}[Generalization to Other Norms] Using the same point of view, Theorem~\ref{Thm:contraction} can be applied to other vector norms of $\|\delta \mathbf{z}\|_p$ with $p=1$ or $p=\infty$. \end{remark} \subsection{Path-Length Integral and Robustness Analysis} Contraction analysis takes a different notion of stability: incremental stability of multiple trajectories. Since contraction means \emph{exponential} convergence, a contracting system exhibits a property of superior robustness. \begin{lemma}[Robust contraction analysis]\label{LM:Robust_contraction_original} Let $P_1(t)$ be a solution of the contracting system (\ref{xfx_ch2}) that satisfies Theorem~\ref{Thm:contraction}, globally exponentially tending to a single trajectory at a contraction rate $\lambda$. (\ref{xfx_ch2}) is now perturbed as \begin{equation}\label{Eq:fxt2-1} \dot{\mathbf{x}} = \mathbf{f}(\mathbf{x},t) + \mathbf{d}(\mathbf{x},t) \end{equation} and $P_2(t)$ denotes a trajectory of (\ref{Eq:fxt2-1}). Then, the smallest path integral (i.e., distance) $$R(t)=\int^{P_2}_{P_1} \|\delta \mathbf{z}(t)\|=\int^{P_2}_{P_1} \|\boldsymbol{\Theta}(\mathbf{x},t)\delta \mathbf{x}(t)\|,\ \ \forall t\geq 0$$ exponentially converges to the following error ball~\cite{Ref:contraction1}, with $\mathbf{\Theta}\mathbf{d}\in \mathcal{L}_\infty$ \begin{equation}\label{Eq:Robust_contraction21} \lim_{t\rightarrow \infty}R(t) \leq \sup_{\mathbf{x},t} \|\mathbf{\Theta(\mathbf{x},t)}\mathbf{d}(\mathbf{x},t)\|/\lambda\end{equation} \end{lemma} \begin{proof} First, consider the distance $R(t)=\int^{P_2}_{P_1} \|\delta \mathbf{z}(t)\|$ between two arbitrary trajectories $P_1$ and $P_2$ of the original unperturbed dynamics $\dot{\mathbf{x}}=\mathbf{f}(\mathbf{x},t)$ (\ref{xfx_ch2}) that is contracting with the metric $\mathbf{M}(x,t)$ with the rate $\lambda$: $$ \dfrac{d\|\delta\mathbf{z}\|}{dt}\leq-\lambda\|\delta\mathbf{z}\| $$ Then, we can verify \begin{align} &\dot{R}=\int^{P_2}_{P_1}\dfrac{d\|\delta\mathbf{z}\|}{dt}\leq-\lambda\int^{P_2}_{P_1}\|\delta\mathbf{z}\|\Rightarrow \dot{R}+\lambda R\leq 0 \nonumber \\ &\Rightarrow R(t)\leq e^{-\lambda t}R(0) \end{align} where the last equivalence is obtained by the comparison lemma~\cite[pp. 211]{Khalil:1173048}. As a result, any path integral $R(t)$ between any two arbitrary trajectories of (\ref{xfx_ch2}) tends to zero exponentially fast at the exponential rate $\lambda$. Note that $P_1-P_2=\int^{P_2}_{P_1} \delta \mathbf{x}$ and $\|P_1-P_2\|=\|\int^{P_2}_{P_1} \delta \mathbf{x}\| \leq \int^{P_2}_{P_1} \|\delta \mathbf{x}\|$ and $\sqrt{\lambda_\mathrm{min}(\mathbf{M})}\|P_1-P_2\|\leq\int^{P_2}_{P_1} \|\delta \mathbf{z}\|$. Now consider the smallest path integral $R(t)=\int^{P_2}_{P_1} \|\delta \mathbf{z}(t)\|=\int^{P_2}_{P_1} \|\boldsymbol{\Theta}(\mathbf{x},t)\delta \mathbf{x}(t)\|$ with $P_2$ being a perturbed solution from (\ref{Eq:fxt2-1}). Since $\delta\dot{\mathbf{z}}=\mathbf{F}\delta\mathbf{z}+\mathbf{\Theta}\delta\mathbf{d}$, \begin{align} &\dfrac{d}{dt}\delta \mathbf{z}^T\delta \mathbf{z}=2\|\delta \mathbf{z}(t)\|\dfrac{d}{dt}\|\delta \mathbf{z}(t)\|=2\delta \mathbf{z}^T(\mathbf{F}\delta \mathbf{z}+\mathbf{\Theta}\delta \mathbf{d})\nonumber\\&\leq-2\lambda \|\delta \mathbf{z}(t)\|^2+2\|\delta \mathbf{z}(t)\|\|\mathbf{\Theta}\delta \mathbf{d}\|\nonumber\\ &\Rightarrow \dfrac{d}{dt}\|\delta \mathbf{z}(t)\|\leq -\lambda \|\delta \mathbf{z}(t)\|+\|\mathbf{\Theta}\delta \mathbf{d}\| \end{align} By applying the path integral between $P_1$ and $P_2$, we can obtain \begin{align} \int^{P_2}_{P_1}\dfrac{d}{dt}\|\delta \mathbf{z}(t)\|&\leq -\lambda \int^{P_2}_{P_1}\|\delta \mathbf{z}(t)\|+\int^{P_2}_{P_1}\|\mathbf{\Theta}\delta \mathbf{d}\|\\ \dot{R}(t)&\leq -\lambda R(t)+ \|\mathbf{\Theta}\mathbf{d}\| \end{align} Then, applying the comparison lemma [Khalil, p.102-103, p.350-353] results in \begin{equation}\label{Eq:Robust_contraction3} R(t) \leq e^{-\lambda t}R(0)+\int^{t}_{0}e^{-\lambda(t-\tau)} \|\mathbf{\Theta}(\mathbf{x},\tau)\mathbf{d}(\mathbf{x},\tau)\| d\tau \end{equation} By taking the supremum of $\|\mathbf{\Theta}\mathbf{d}\|$ out of the integral in~(\ref{Eq:Robust_contraction3}), \begin{align} R(t) &\leq e^{-\lambda t}R(0)+\sup_t{\|\mathbf{\Theta}(\mathbf{x},t)\mathbf{d}(\mathbf{x},t)\|}\int^{t}_{0}e^{-\lambda(t-\tau)} d\tau\nonumber\\ &\leq e^{-\lambda t}R(0)+\sup_t{\|\mathbf{\Theta}(\mathbf{x},t)\mathbf{d}(\mathbf{x},t)\|}\frac{1-e^{-\lambda t}}{\lambda}\nonumber \end{align} which leads to (\ref{Eq:Robust_contraction21}).\end{proof} \subsection{Input Output Stability: Finite-Gain $\mathcal{L}_p$ Stability} This section is based on \cite{Ref:phasesync}. Before stating the next lemma, we define the $\mathcal{L}_p$ norm in the extended space $\mathcal{L}_{pe}$, $p\in [1,\infty]$ as follows \begin{align} &\|(\mathbf{u})_\tau\|_{\mathcal{L}_p}=\left(\int^{\tau}_{0}\|\mathbf{u}(t)\|^p dt\right)^{1/p} <\infty , \ \ p\in[1,\infty) \nonumber\\ &\|(\mathbf{u})_\tau\|_{\mathcal{L}_\infty}=\sup_{t\geq 0}\|(\mathbf{u}(t))_\tau\|<\infty \end{align} where $(\mathbf{u}(t))_\tau$ is a truncation of $\mathbf{u}(t)$, i.e., $(\mathbf{u}(t))_\tau=\mathbf{0}$ for $t\geq \tau$, $\tau\in[0,\infty)$ while $(\mathbf{u}(t))_\tau=\mathbf{u}(t)$ for $0\leq t\leq \tau$. Except for $\mathcal{L}_p$ norms, the symbol $p$ in this paper denotes the total number of EL systems in the network. \begin{lemma}[Robust contractio ]\label{LM:Robust_contraction} Let $P_1(t)$ be a solution of the contracting system (\ref{xfx_ch2}), globally exponentially tending to a single trajectory at a contraction rate $\lambda$. Equation (\ref{xfx_ch2}) is now perturbed as \begin{equation}\label{Eq:fxt2} \dot{\mathbf{x}} = \mathbf{f}(\mathbf{x},t) + \mathbf{d}(\mathbf{x},t) \end{equation} and $P_2(t)$ denotes a trajectory of (\ref{Eq:fxt2}). Then, the smallest path integral (i.e., distance) $R(t)=\int^{P_2}_{P_1} \|\delta \mathbf{z}(t)\|=\int^{P_2}_{P_1} \|\boldsymbol{\Theta}(\mathbf{x},t)\delta \mathbf{x}(t)\|$, $\forall t\geq 0$ exponentially converges to the following error ball~\cite{Ref:contraction1}, with $\mathbf{\Theta}\mathbf{d}\in \mathcal{L}_\infty$ \begin{equation}\label{Eq:Robust_contraction2} \lim_{t\rightarrow \infty}R(t) \leq \sup_{\mathbf{x},t} \|\mathbf{\Theta(\mathbf{x},t)}\mathbf{d}(\mathbf{x},t)\|/\lambda\end{equation} Furthermore, (\ref{Eq:fxt2}), which is perturbed by $\mathbf{d}(\mathbf{x},t)\in \mathcal{L}_{pe}$, is finite-gain $\mathcal{L}_p$ stable with $p\in [1,\infty]$ for an output function $\mathbf{y}=\mathbf{h}(\mathbf{x},\mathbf{d},t)$ with $\int^{Y_2}_{Y_1}\|\delta \mathbf{y}\|\leq \eta_1 \int^{P_2}_{P_1}\|\delta \mathbf{x}\|+\eta_2\|\mathbf{d}\|$, $\exists $ $\eta_1,\eta_2\geq0$, since \begin{align}\label{Eq:Robust_contractionLp} \left\|{\left(\int^{Y_2}_{Y_1} \|\delta \mathbf{y}\|\right)_\tau}\right\|_{\mathcal{L}_p} \leq& (\frac{\eta_1}{\lambda}+{\eta_2})\frac{\|(\mathbf{\Theta}\mathbf{d})_\tau \|_{\mathcal{L}_p}}{\sqrt{\lambda_\mathrm{min}(\mathbf{M})}}+\frac{\eta_1\zeta R(0)}{\sqrt{\lambda_\mathrm{min}(\mathbf{M})}}, \ \forall \tau\in[0,\infty) \end{align} where $Y_1$ and $Y_2$ denote the output trajectories of the original contracting system (\ref{xfx_ch2}) and its perturbed system (\ref{Eq:fxt2}), respectively. Also, $\zeta=1$ if $p=\infty$ or $\zeta=1/(\lambda p)^{1/p}$ if $p\in[1,\infty)$, and $\lambda_\mathrm{min}(\mathbf{M})$ is defined as $\mathbf{M}(\mathbf{x},t)\geq \lambda_\mathrm{min}(\mathbf{M})\mathbf{I}$, $\forall$ $t\geq 0$. The perturbed system (\ref{Eq:fxt2}) is also input-to-state stable (ISS). \end{lemma} \begin{proof} After differentiating $R(t)=\int^{P_2}_{P_1} \|\delta \mathbf{z}(t)\|$, we can obtain $\dot{R}+\lambda R\leq \|\mathbf{\Theta}\mathbf{d}\|$~\cite{Ref:contraction1}. Then, applying the comparison lemma [Khalil, p.102-103, p.350-353] results in \begin{equation}\label{Eq:Robust_contraction3b} R(t) \leq e^{-\lambda t}R(0)+\int^{t}_{0}e^{-\lambda(t-\tau)} \|\mathbf{\Theta}(\mathbf{x},\tau)\mathbf{d}(\mathbf{x},\tau)\| d\tau \end{equation} By taking the supremum of $\|\mathbf{\Theta}\mathbf{d}\|$ out of the integral in~(\ref{Eq:Robust_contraction3b}), we can derive (\ref{Eq:Robust_contraction2}). In keeping with Corollary 5.1 of [Khalil], (\ref{Eq:Robust_contraction3b}) satisfies \begin{align}\label{Eq:Robust_contractionLp2} \|(R)_\tau\|_{\mathcal{L}_p}&\leq R(0)\|(e^{-\lambda t})_\tau\|_{\mathcal{L}_p} +\|e^{-\lambda t}\|_{\mathcal{L}_1} \|(\mathbf{\Theta}\mathbf{d})_\tau \|_{\mathcal{L}_p} \nonumber \\ &\leq R(0)\zeta +\|(\mathbf{\Theta}\mathbf{d})_\tau \|_{\mathcal{L}_p}/\lambda \end{align} Since $\mathbf{M}\succ 0$ uniformly, $\|\mathbf{\Theta}^{-1}\|\leq 1/\sqrt{\lambda_\mathrm{min}(\mathbf{M})}$. Then, (\ref{Eq:Robust_contractionLp}) is obtained by using both (\ref{Eq:Robust_contractionLp2}) and the known bound of $\|\delta \mathbf{y}\|$, thereby yielding a finite $\mathcal{L}_p$ gain independently of $\tau$. Note that if we can further show that $\mathbf{M}(\mathbf{x},t)$ is uniformly upper-bounded, we can use $\|(\mathbf{\Theta}\mathbf{d})_\tau \|_{\mathcal{L}_p}\leq \alpha \|(\mathbf{d})_\tau \|_{\mathcal{L}_p}$, $\exists \alpha>0$. For ISS, we can compute an ultimate bound of $R(t)$, which is true for $t\geq T$, $\exists$ $T$ instead of $t\rightarrow\infty$ as in (\ref{Eq:Robust_contraction2}), since global exponential stability of an unperturbed system results in input-to-state stability (see Lemma 4.6 of [Khalil]).\end{proof} \begin{lemma}[Robust hierarchical connection]\label{LM:Robust_contraction_hierc} The hierarchically combined system of two contracting dynamics with a generalized Jacobian matrix $\left[\begin{smallmatrix}\mathbf{F}_{11} & \mathbf{0}\\ \mathbf{F}_{21} & \mathbf{F}_{22}\end{smallmatrix}\right]$ is assumed to be subject to a perturbed flow field of $[\mathbf{d}_1;\mathbf{d}_2]$. Then, the path length integral $R_i(t)=\int^{P_2}_{P_1}\|\delta \mathbf{z}_i\|$, $i=1,2$ between the original and perturbed dynamics verifies~\cite{Ref:contraction1} \begin{align}\label{Eq:hierclemma} \dot{R}_1+|\lambda_{max}(\mathbf{F}_{11})|{R}_1&\leq\|\boldsymbol{\Theta}_1\mathbf{d}_1\| \\ \dot{R}_2+|\lambda_{max}(\mathbf{F}_{22})| {R}_2&\leq\|\boldsymbol{\Theta}_2\mathbf{d}_2\|+\int^{P_2}_{P_1}\|\mathbf{F}_{21}\|\|\delta \mathbf{z}_1\|\nonumber \end{align} Hence, the error bounds of $R_1(t)$ and $R_2(t)$ can be obtained similar to (\ref{Eq:Robust_contraction2}) and (\ref{Eq:Robust_contraction3}-\ref{Eq:Robust_contractionLp2}) under the assumption of bounded $\|\mathbf{F}_{21}\|$. Also, similar to (\ref{Eq:Robust_contractionLp}), a hierarchical connection for $\mathcal{L}_p$ stability can be established by using \begin{align}\label{Eq:hierclemma2} \|(R_2)_\tau\|_{\mathcal{L}_p} & \leq R_2(0)\zeta_2 +\frac{\bar{\sigma}(\mathbf{F}_{21})}{\lambda_2}R_1(0)\zeta_1 \\ &\ \ +\frac{\|(\mathbf{\Theta}_2\mathbf{d}_2)_\tau \|_{\mathcal{L}_p}}{\lambda_2}+\frac{\bar{\sigma}(\mathbf{F}_{21})}{\lambda_1\lambda_2}\|(\mathbf{\Theta}_1\mathbf{d}_1)_\tau \|_{\mathcal{L}_p}\nonumber \end{align} where $\lambda_i=|\lambda_{max}(\mathbf{F}_{ii})|$ from (\ref{Eq:hierclemma}) and $\bar{\sigma}(\cdot)$ is the largest singular value for all $t\geq0$. Also, $\zeta_i=1$ if $p=\infty$ or $\zeta_i=1/(\lambda_i p)^{1/p}$ if $p\in[1,\infty)$ for $i=1,2$. By recursion, this result can be extended to an arbitrary number of hierarchically combined groups.\end{lemma} \begin{proof} The proof follows from obtaining $\|(R_1)_\tau\|_{\mathcal{L}_p}$ from (\ref{Eq:Robust_contractionLp2}) and recursively obtaining $\|(R_2)_\tau\|_{\mathcal{L}_p}$ from the second equation of (\ref{Eq:hierclemma}). \end{proof} \subsection{Contraction Analysis for Stochastic Nonlinear Dynamics} Consider a stochastically perturbed system of the nominal system (\ref{xfx_ch2}) represented using an Ito stochastic differential equation \begin{equation} dx=f\left(x,t\right)dt+B\left(x,t\right)dW,\qquad x(0)=x_{0}\label{eq:stochastiSys} \end{equation} and the conditions for existence and uniqueness of a solution to (\ref{eq:stochastiSys}) \begin{align} & \exists L_{1}>0,\,\forall t,\,\forall x_{1},x_{2}\in\mathbb{R}^{n}:\nonumber \\ & \left\Vert f(x_{1},t)\!-\! f(x_{2},t)\right\Vert \!+\!\left\Vert B(x_{1},t)\!-\! B(x_{2},t)\right\Vert _{F}\!\leq\! L_{1}\left\Vert x_{1}\!-\! x_{2}\right\Vert \!,\nonumber \\ & \exists L_{2}>0,\,\forall t,\,\forall x_{1}\in\mathbb{R}^{n}:\nonumber \\ & \;\left\Vert f(x_{1},t)\right\Vert ^{2}+\left\Vert B(x_{1},t)\right\Vert _{F}^{2}\leq L_{2}(1+\left\Vert x_{1}\right\Vert ^{2}) \end{align} where $B:\mathbb{R}^{n}\times\mathbb{R}\rightarrow\mathbb{R}^{n\times d}$ is a matrix-valued function, $W\left(t\right)$ is a $d$-dimensional Wiener process, and $x_{0}$ is a random variable independent of $W$. Consider any two systems with trajectories $a(t)$ and $b(t)$ obtained by the same function $f\left(\cdot\right)$ in (\ref{eq:stochastiSys}) but driven by independent Wiener processes $\bar{W}_{1}$ and $\bar{W}_{2}$ \begin{align} dz & =\left(\begin{array}{c} f\left(a,t\right)\\ f\left(b,t\right) \end{array}\right)dt+\left(\begin{array}{cc} B_{1}\left(a,t\right) & 0\\ 0 & B_{2}\left(b,t\right) \end{array}\right)\left(\begin{array}{c} d\bar{W}_{1}\\ d\bar{W}_{2} \end{array}\right)\nonumber \\ & =f_{s}\left(z,t\right)dt+B_{s}\left(z,t\right)d\bar{W}\label{eq:dx} \end{align} where $z\left(t\right)=(a(t)^{T},b(t)^{T})^{T}\in\mathbb{R}^{2n}.$ The following lemma analyzes stochastic incremental stability of the two trajectories $a\left(t\right)$ and $b\left(t\right)$ with respect to each other in the presence of noise where the system without noise $\dot{x}=f(x,t)$ is contracting in a state-dependent metric $M\left(x\left(\mu,t\right),t\right),$ for $\mu\in\left[0,1\right]$. The trajectories of (\ref{eq:stochastiSys}) are parametrized as $x\left(0,t\right)=a$ and $x\left(1,t\right)=b$, and $B_{1}\left(a,t\right)$ and $B_{2}\left(b,t\right)$ are defined as $B\left(x\left(0,t\right),t\right)=B_{1}\left(a,t\right)$, and $B\left(x\left(1,t\right),t\right)=B_{2}\left(b,t\right)$, respectively. \begin{assumption}$\mathrm{tr}\left(B_{1}\left(a,t\right)^{T}M\left(x\left(a,t\right),t\right)B_{1}\left(a,t\right)\right)\leq C_{1}$,\\ $\mathrm{tr}\left(B_{2}\left(b,t\right)^{T}M\left(x\left(b,t\right),t\right)B_{2}\left(b,t\right)\right)\leq C_{2}$,\\ $\bar{m}_{x}\!=\!\underset{t\geq0,i,j}{\textrm{\ensuremath{\mathrm{sup}}}}\!\left\Vert \left(M_{ij}(x,t)\right)_{x}\right\Vert ,$ and $\bar{m}_{x^{2}}\!=\!\underset{t\geq0,i,j}{\textrm{\ensuremath{\mathrm{sup}}}}\!\left\Vert \partial^{2}\left(M_{ij}(x,t)\right)/\partial x^{2}\right\Vert ,$ where $C_{1},$ $C_{2},$ $\bar{m}_{x}$, and $\bar{m}_{x^{2}}$ are constants.\end{assumption} \begin{assumption}The nominal deterministic system (\ref{xfx_ch2}) is contracting in a metric $M\left(x\left(\mu,t\right),t\right)$ in the sense that (\ref{eq:contractionRate-2}) is satisfied and $M\left(x\left(\mu,t\right),t\right)$ satisfies the bound $\underline{m}\triangleq\underset{t\geq0}{\mbox{\ensuremath{\mathrm{inf}}}}\:\lambda_{\mathrm{min}}M$. The function $f$ and the metric $M$ are the same as in (\ref{xfx_ch2}) and (\ref{eq:contractionRate-2}).\end{assumption} \begin{lemma}[Stochastic Contraction Lemma] \label{sc_lemma} If both assumptions are satisfied then the trajectories $a\left(t\right)$ and $b\left(t\right)$ of (\ref{eq:dx}), whose initial conditions, given by a probability distribution $p\left(a_{0},b_{0}\right)$, are independent of $d\bar{W}_{1}$ and $d\bar{W}_{2}$, satisfy the bound \begin{align} & E\left[\left\Vert a\left(t\right)-b\left(t\right)\right\Vert ^{2}\right]\nonumber \\ & \leq\frac{1}{\underline{m}}\Bigg(\frac{C}{2\gamma_{1}}+E\Bigg[V\left(x\left(0\right),\delta x\left(0\right),0\right)\Bigg]e^{-2\gamma_{1}t}\Bigg)\label{eq:BoundSecondMoment} \end{align} where $\exists\varepsilon>0$ such that $\gamma_{1}\triangleq\gamma-\frac{\left(\beta_{1}^{2}+\beta_{2}^{2}\right)}{2\underline{m}}\left(\varepsilon\bar{m}_{x}+\frac{\bar{m}_{x^{2}}}{2}\right)>0$, $\gamma$ is the contraction rate defined in (\ref{eq:contractionRate-2}), $C=C_{1}+C_{2}+\frac{\bar{m}_{x}}{\varepsilon}\left(\beta_{1}^{2}+\beta_{2}^{2}\right),$ $\beta_{1}=\left\Vert B_{1}\right\Vert _{F}$, $\beta_{2}=\left\Vert B_{2}\right\Vert _{F}$, and $\left[\cdot\right]^{+}=\mathrm{max}\left(0,\cdot\right).$\end{lemma} \begin{proof} Consider the generalized squared length with respect to a Riemannian metric $M\left(x\left(\mu,t\right),t\right)$ defined by $V\left(x,\delta x,t\right)=\intop_{0}^{1}\left(\frac{\partial x}{\partial\mu}\right)^{T}M\left(x\left(\mu,t\right),t\right)\left(\frac{\partial x}{\partial\mu}\right)d\mu$ such that $\underline{m}\left\Vert a-b\right\Vert ^{2}\leq V\left(x,\delta x,t\right)$. See~\cite{Ref:Stochastic} for more details.% \end{proof} \subsection{Partial Contraction and Synchronization} \begin{theorem}[Partial contraction~\cite{Ref:contraction3}]\label{Thm:partial} Consider a nonlinear system of the form ${\mathbf{ \dot x}}=\mathbf{f}(\mathbf{x},\mathbf{x},t)$ and assume that the auxiliary system ${\mathbf{\dot y}}=\mathbf{f}(\mathbf{y},\mathbf{x},t)$ is contracting with respect to $\mathbf{y}$. If a particular solution of the auxiliary $\mathbf{y}$-system verifies a specific smooth property, then all trajectories of the original x-system verify this property exponentially. The original system is said to be partially contracting. \end{theorem} \begin{proof} If a particular solution of the auxiliary contracting system of $\mathbf{y}$ given as $\dot{\mathbf{y}}=\mathbf{f}(\mathbf{y},\mathbf{x},t)$, verifies a smooth specific property, then all trajectories of the original $\dot{\mathbf{x}}=\mathbf{f}(\mathbf{x},\mathbf{x},t)$ system verify this property exponentially. $\mathbf{y}=\mathbf{x}$ is another solution of the auxiliary system. Consequently, $\mathbf{x}$ verifies this property exponentially fast. \end{proof} This partial contraction analysis can be regarded as a further generalization of contraction theory in Theorem~\ref{Thm:contraction}. This theorem is particularly useful to derive synchronization with an input symmetry. \begin{theorem}[Synchronization~\cite{Ref:contraction3}]\label{Thm:sync} Consider two coupled systems. If the dynamics equations satisfy \begin{equation} {\mathbf{\dot x}}_1-\mathbf{f}(\mathbf{x}_1,t)={\mathbf{\dot x}}_2-\mathbf{f}(\mathbf{x}_2,t) \end{equation} where the function $\mathbf{f}(\mathbf{x},t)$ is contracting in an input-independent metric, then $\mathbf{x}_1$ and $\mathbf{x}_2$ will converge to each other exponentially, regardless of the initial conditions. Mathematically, stable concurrent synchronization corresponds to convergence to a flow-invariant linear subspace of the global state space\cite{Ref:contraction_sync}. \end{theorem} \begin{proof} Let us define the common input, $\mathbf{g}(\mathbf{x}_1,\mathbf{x}_2,t)$, enforcing the equality of two dynamics equations such that \begin{equation} \begin{split} {\mathbf{\dot x}}_1-\mathbf{f}(\mathbf{x}_1,t)=\mathbf{g}(\mathbf{x}_1,\mathbf{x}_2,t)\\ {\mathbf{\dot x}}_2-\mathbf{f}(\mathbf{x}_2,t)=\mathbf{g}(\mathbf{x}_1,\mathbf{x}_2,t) \end{split} \end{equation} Construct a virtual system of $\mathbf{y}$: \begin{equation} {\mathbf{\dot y}}-\mathbf{f}(\mathbf{y},t)=\mathbf{g}(\mathbf{x}_1,\mathbf{x}_2,t) \end{equation} which has two particular solutions, $\mathbf{x}_1$ and $\mathbf{x}_2$. If the virtual system is contracting, all solutions of $\mathbf{y}$ converge to each other exponentially. As a result, $\mathbf{x}_1$ tends to $\mathbf{x}_2$ exponentially fast. \end{proof} Notice that the original dynamics per se, with the input $\mathbf{g}(\mathbf{x}_1,\mathbf{x}_2,t)$ might not be contracting. Nevertheless, the system is partially contracting, thereby achieving synchronization. Based upon the results from Theorems \ref{Thm:partial} and \ref{Thm:sync}, the following examples are illustrated in the subsequent sections to shed some light on potential applications of synchronization to nonlinear control. \iffalse\subsection{Contraction of Combined and Coupled Systems} The following theorems are used to derive stability and synchronization of coupled dynamics systems. \begin{theorem}[parallel combination]\label{Thm:parallel} Consider two time-varying nonlinear systems, contracting in the same metric function which does not explicitly depend on time such that $\mathbf{M}(\mathbf{x})={\mathbf{\Theta}}(\mathbf{x})^{T}{\mathbf{\Theta}}(\mathbf{x})$ and ${\mathbf{\dot \Theta}}=\frac{\partial \mathbf{\Theta}}{\partial \mathbf{x}}\mathbf{\dot x}$: \begin{equation} \mathbf{\dot x} = \mathbf{f}_i(\mathbf{x},t) \ \ \ \ \,\ i=1,2 \end{equation} Then, any positive superposition with $\alpha_i > 0$ \begin{equation} \mathbf{\dot x} = \alpha_1\mathbf{f}_1(\mathbf{x},t)+\alpha_2\mathbf{f}_2(\mathbf{x},t) \end{equation} is contracting in the same metric. By recursion, this parallel combination can be extended to any number of systems. \end{theorem} \begin{proof} Since the original dynamics are contracting with a time-independent metric, the generalized Jacobian, $\mathbf{F}$ in (\ref{jacobian_ch2}) becomes \begin{align} \mathbf{F}=&\left(\mathbf{\dot{\Theta}}{(\mathbf{x})}+{\mathbf{\Theta}(\mathbf{x})}\frac{\partial \mathbf{f}_i}{\partial \mathbf{x}}\right){\mathbf{\Theta}(\mathbf{x})}^{-1} \nonumber \\ =&\left(\frac{\partial \mathbf{\Theta}(\mathbf{x})}{\partial \mathbf{x}}\mathbf{f }_i+{\mathbf{\Theta}(\mathbf{x})}\frac{\partial \mathbf{f}_i}{\partial \mathbf{x}}\right){\mathbf{\Theta}(\mathbf{x})}^{-1} \end{align} Since the individual systems are contracting, \begin{align} \frac{d}{dt}(\delta \mathbf{z}^T\delta \mathbf{z})=&\delta \mathbf{z}^T\left(\frac{\partial \mathbf{\Theta}}{\partial \mathbf{x}}\mathbf{f}_i+{\mathbf{\Theta}}\frac{\partial \mathbf{f}_i}{\partial \mathbf{x}}\right){\mathbf{\Theta}}^{-1}\delta \mathbf{z} \nonumber \\ \leq& -2\lambda_i \delta \mathbf{z}^T\delta \mathbf{z}, \ \ \ \ i=1,2 \end{align} Hence, the $\delta \mathbf{z}$ dynamics of the combined system result in \begin{align} &\frac{d}{dt}(\delta \mathbf{z}^T\delta \mathbf{z}) \nonumber \\ &=\delta \mathbf{z}^T\left(\frac{\partial \mathbf{\Theta}}{\partial \mathbf{x}}(\alpha_1\mathbf{f}_1+\alpha_2\mathbf{f}_2)+{\mathbf{\Theta}}(\alpha_1\frac{\partial \mathbf{f}_1}{\partial \mathbf{x}}+\alpha_2\frac{\partial \mathbf{f}_2}{\partial \mathbf{x}})\right){\mathbf{\Theta}}^{-1}\delta \mathbf{z} \nonumber \\ &=\sum_{i=1}^2\alpha_i\delta \mathbf{z}^T\left(\frac{\partial \mathbf{\Theta}}{\partial \mathbf{x}}\mathbf{f}_i+{\mathbf{\Theta}}\frac{\partial \mathbf{f}_i}{\partial \mathbf{x}}\right){\mathbf{\Theta}}^{-1}\delta \mathbf{z}\nonumber \\ &\le - 2(\alpha_1\lambda_1+\alpha_2\lambda_2)\delta \mathbf{z}^T\delta \mathbf{z}\nonumber \end{align} \end{proof} This parallel combination is extremely important if the system possesses a certain geometrical symmetry. For example, the $\mathbf{M}$ and $\mathbf{C}$ matrices from the Lagrangian equation might satisfy $\mathbf{M_2}=\mathbf{M_{\phi_1}}+\mathbf{M_{\phi_2}}$ and $\mathbf{C_2}=\mathbf{C_{\phi_1}}+\mathbf{C_{\phi_2}}$. This property is extensively exploited later. \begin{theorem}[Hierarchical combination~\cite{Ref:contraction5,Ref:contraction2}]\label{Thm:hierc} Consider two contracting systems, of possibly different dimensions and metrics, and connect them in series, leading to a smooth virtual dynamics of the form \begin{equation} \frac{d}{dt} \begin{pmatrix} \delta\mathbf{z}_1\\ \delta\mathbf{z}_2 \end{pmatrix}= \begin{pmatrix} \mathbf{F}_{11} & \mathbf{0} \\ \mathbf{F}_{21} & \mathbf{F}_{22} \end{pmatrix} \begin{pmatrix} \delta\mathbf{z}_1\\ \delta\mathbf{z}_2 \end{pmatrix} \end{equation} Then the combined system is contracting if $\mathbf{F_{21}}$ is bounded. \end{theorem} \begin{proof} Intuitively, since $\delta \mathbf{z}_1$ tends to zero, $\delta \mathbf{z}_2$ tends to zero as well for a bounded $\mathbf{F}_{21}$. By using a smooth transformation $\mathbf{\Theta}$: \begin{equation} \mathbf{\Theta}=\begin{pmatrix}\mathbf{I} & \mathbf{0} \\ \mathbf{0} & \epsilon \mathbf{I}\end{pmatrix} \end{equation} Then, the new transformed Jacobian matrix is given as \begin{equation} \mathbf{\Theta}\mathbf{F}\mathbf{\Theta}^{-1}=\begin{pmatrix} \mathbf{F}_{11} & \mathbf{0} \\ \epsilon\mathbf{F}_{21} & \mathbf{F}_{22} \end{pmatrix}, \end{equation} which is negative definite for a sufficiently small $\epsilon >0$. \end{proof} Composite variables, $\mathbf{s}= \mathbf{\dot{q}}-\mathbf{\dot{q}}_d+\mathbf{\Lambda}(\mathbf{{q}}-\mathbf{{q}}_d)$ are an excellent example of a hierarchical combination. Its usage for nonlinear tracking control and robust sliding control shall be discussed in the subsequent sections. Another interesting combination that occurs in the nonlinear control synthesis is feedback combination. \begin{theorem}[Feedback combination~\cite{Ref:contraction3}]\label{Thm:feedback} The overall dynamics of the generalized virtual displacements might be represented as \begin{equation} \frac{d}{dt} \begin{pmatrix} \delta\mathbf{z}_1\\ \delta\mathbf{z}_2 \end{pmatrix}=\mathbf{F}\begin{pmatrix} \delta\mathbf{z}_1\\ \delta\mathbf{z}_2 \end{pmatrix}= \begin{pmatrix} \mathbf{F_{1}} & \mathbf{G}^T \\ \mathbf{G} & \mathbf{F_{2}} \end{pmatrix} \begin{pmatrix} \delta\mathbf{z}_1\\ \delta\mathbf{z}_2 \end{pmatrix} \end{equation} where $\mathbf{F}_{1}$ and $\mathbf{F}_{2}$ are symmetric negative definite matrices. In order to prove contraction of the combined system, one needs to check if $\mathbf{F}$ is negative definite. From the standard linear algebra~\cite{Ref:HornJohnson}, $\mathbf{F}$ is uniformly negative definite if and only if \begin{equation} \mathbf{F}_{2}< \mathbf{G}^T{\mathbf{F}_{1}}^{-1}\mathbf{G} \end{equation} A sufficient condition for the above inequality can be given as \begin{equation} \lambda(\mathbf{F}_{1})\lambda(\mathbf{F}_{2})>\sigma^2(\mathbf{G}) \end{equation} where $\lambda(\cdot)$ is the contraction rate, which is the absolute value of the largest eigenvalue (least negative) of the contracting system. $\sigma(\cdot)$ denotes the largest singular value. \end{theorem} It should be noted that the overall contraction rate is no greater than the individual contraction rate of $\mathbf{F}_{1}$ and $\mathbf{F}_{2}$ by the eigenvalue interlacing theorem~\cite{Ref:HornJohnson}. Indeed, one can find the explicit lower bound of the contraction rate as~\cite{Ref:contraction2} \begin{equation} \lambda(\mathbf{F})=\frac{\lambda(\mathbf{F}_{1})+\lambda(\mathbf{F}_{2})}{2}-\sqrt{\left(\frac{\lambda(\mathbf{F}_{1})-\lambda(\mathbf{F}_{2})}{2}\right)^2+\sigma^2(\mathbf{G})} \end{equation} \subsection{High-Order Contraction for Adaptive and Integral Control} This section presents a new theorem that can be conveniently used to prove contraction of a second-order nonlinear system. Consider the following second-order time-varying nonlinear differential equation \begin{equation}\label{2nd_order} \ddot{x}+a_1(x)\dot{x}+a_2(x,t)=u(t) \end{equation} where $a_1(x)$ is a smooth function of $x$, and $a_2(x,t)$ is a smooth function of $x$ and $t$. \begin{remark} Proving contraction of (\ref{2nd_order}) is difficult, since the original contraction analysis is originally stated for first-order systems. Finding some smooth coordinate transformation of the virtual displacement, $\delta\mathbf{z}={\mathbf{\Theta}}\delta\mathbf{x}$, is the key such that the generalized Jacobian $\bf F$ associated with the augmented system of $(x,\dot x)^T$ is uniformly negative definite. \end{remark} \begin{remark} In general, finding such a transformation, $\mathbf{\Theta}$ is not trivial. Even without the use of contraction theory, proving exponential and global stability of a general time-varying nonlinear second-order system can be a very difficult problem.\end{remark} We present the main theorem of this section, which provides a sufficient condition for contraction of (\ref{2nd_order}) \begin{theorem}[High-order analysis]\label{theorem1} The nonlinear system in (\ref{2nd_order}) is contracting (all solutions converge to a single trajectory exponentially fast from any initial conditions), if \begin{equation} a_1(x)>0, \ \ \ \ \ \forall x \end{equation} and if \begin{equation} \frac{\partial a_2(x,t)}{\partial x}>0, \ \ \ \frac{d}{dt}\left(\frac{\partial a_2(x,t)}{\partial x}\right)>0\ \ \ \ \ \forall t \end{equation} \end{theorem} \begin{proof} The virtual displacement equation of (\ref{2nd_order}) is \begin{equation}\label{2nd_order_virt} \delta{\ddot{x}}+a_1(x)\delta{\dot{x}}+\left[\dot{a}_1+\frac{\partial a_2(x,t)}{\partial x}\right]\delta{x}=0 \end{equation} Equation (\ref{2nd_order_virt}) can be written as a first-order differential equation by defining the vector state $\mathbf{x}=(x,\dot x)^T$: \begin{align} &\delta\dot{\mathbf{x}}=\frac{\partial \mathbf{f}}{\partial \mathbf{x}}\delta{\mathbf{x}}\\ &\frac{d}{dt}\begin{pmatrix}\delta x\\ \delta \dot x \end{pmatrix}=\begin{bmatrix}0 & 1\\-\left(\dot{a}_1+\frac{\partial a_2}{\partial x}\right)&-a_1\end{bmatrix}\begin{pmatrix}\delta x\\ \delta \dot x \end{pmatrix}\nonumber \end{align} Let us take the following transformation matrix \begin{equation} \mathbf{\Theta}(\mathbf{x},t)=\begin{pmatrix}1&0\\ a_1/\sqrt{\frac{\partial a_2}{\partial x}} &1/\sqrt{\frac{\partial a_2}{\partial x}}\end{pmatrix} \end{equation} It is straightforward to calculate the associated Jacobian as \begin{align}\label{Jacobian} \mathbf{F}&=\left(\mathbf{\dot{\Theta}}{(\mathbf{x},t)}+{\mathbf{\Theta}(\mathbf{x},t)}\frac{\partial \mathbf{f}}{\partial \mathbf{x}}\right){\mathbf{\Theta}(\mathbf{x},t)}^{-1}\\ &=\begin{bmatrix}-a_1(x) & \sqrt{\frac{\partial a_2}{\partial x}}\\-\sqrt{\frac{\partial a_2}{\partial x}} &-\frac{d}{dt}\left(\frac{\partial a_2}{\partial x}\right)/\left(2\frac{\partial a_2}{\partial x}\right)\end{bmatrix}\nonumber \end{align} From the contraction theory, (\ref{2nd_order}) is contracting if the symmetric part of $\mathbf{F}$ is uniformly negative definite, which corresponds to the conditions in Theorem \ref{theorem1}. \end{proof} \begin{example}[Extension] Suppose that $\omega$ in (\ref{vanderpol}) is now time-varying such that \begin{equation} \ddot{x}+a_1(x)\dot{x}+K_1e^{K_2t}x=u(t) \end{equation} where $a_1(x)>0$, $K_1>0$, and $K_2>0$. The above dynamics is contracting since $\frac{d}{dt}\left(\frac{\partial a_2(x,t)}{\partial x}\right)=K_1K_2 e^{K_2t}>0$. \end{example} \fi \subsection{Tracking Control of Robots and Aerospace Vehicles}\label{Sec:tracking_con_robot} The dynamics of a robot or a vehicle is given as \begin{equation} \mathbf{M}(\mathbf{q})\mathbf{\ddot{q}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}}+\mathbf{g}(\mathbf{q}) =\mathbf{\tau} \end{equation} \noindent One may consider the following tracking control law~\cite{Ref:Slotine,Ref:contraction_robot} to follow the desired trajectory $\mathbf{{q}}_{d}(t)$ \begin{equation}\label{tracking_controller_proof} \mathbf{\tau}={\mathbf{M}} (\mathbf{q}){\mathbf{\ddot{q}}_{r}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}}){\mathbf{\dot{q}}_{r}}+\mathbf{g}(\mathbf{q}) -\mathbf{K}(\mathbf{\dot{q}}-\mathbf{\dot{q}}_{r}) \end{equation} where $\mathbf{\dot{q}}_{r}=\mathbf{\dot{q}}_{d}-\mathbf{\Lambda}\mathbf{\widetilde{q}}=\mathbf{\dot{q}}_{d}-\mathbf{\Lambda}(\mathbf{q}-\mathbf{q}_{d})$ and positive-definite matrices $\mathbf{K}$ and $\mathbf{\Lambda}$. Note that this tracking control law was first introduced by Slotine and Li~\cite{Ref:Slotine} for the new adaptive control law. Compared to the feedback linearized control law (computed torque control), the equation in (\ref{tracking_controller_proof}) does not cancel the robot dynamics, but it still guarantees exponential tracking convergence at the same rate as an exact cancelation of the feedback linearized control (see the discussion in \cite{Ref:Slotine}). Also, its robustness property is compared with a feedback linearization control law in~\cite{Ref:NonlinearAttitude}. \emph{(\textbf{Observer-like virtual systems})}: The incremental stability concept of Lemma~\ref{Thm:contraction} is useful for analyzing stability of an observer or observer-like system. For example, consider an observer-like virtual system constructed from a closed-loop EL system of $\mathbf{y}$ such as \begin{equation}\label{virtual_tracking_y} \mathbf{\tau}={\mathbf{M}} (\mathbf{q})\mathbf{\dot y}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{y}+\mathbf{g}(\mathbf{q}) -\mathbf{K}(\mathbf{\dot{q}}-\mathbf{y}) \end{equation} This virtual dynamics has two particular solutions, $\mathbf{\dot{q}}$ and $\mathbf{\dot{q}}_{r}$ since both solutions satisfy (\ref{virtual_tracking_y}). \emph{Alternatively}, you can construct an equivalent virtual dynamics \begin{equation}\label{virtual_tracking_y2} {\mathbf{M}} (\mathbf{q})\mathbf{\dot y}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{y} +\mathbf{K}\mathbf{y})=\mathbf{\tau} \end{equation} which has particular solutions, $\mathbf{s}$ and $\mathbf{0}$. The difference between (\ref{virtual_tracking_y}) and (\ref{virtual_tracking_y2}) is simply whether you focus on the incremental stability between the composite variable $\mathbf{s}$ and $\mathbf{0}$ or the incremental stability between $\mathbf{\dot{q}}$ and $\mathbf{\dot{q}}_r$. The virtual displacement equation of both (\ref{virtual_tracking_y}) and (\ref{virtual_tracking_y2}) becomes \begin{equation}\label{dvirtual_tracking_y2} {\mathbf{M}} (\mathbf{q})\delta\mathbf{\dot y}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\delta\mathbf{y} +\mathbf{K}\delta\mathbf{y}=\mathbf{0} \end{equation} It is straightforward to find that $\mathbf{K}>0$ needs to hold for exponential convergence to the desired trajectory. The skew-symmetry of $(\mathbf{\dot{M}}-2\mathbf{C})$ results in the following differential length analysis \begin{align} &\frac{d}{dt}(\delta\mathbf{y}^T\mathbf{M}(\mathbf{q})\delta\mathbf{y}) =2 \delta\mathbf{y}^T\mathbf{M}(\mathbf{q})\delta\dot{\mathbf{y}}+\delta\mathbf{y}^T\mathbf{\dot{M}}(\mathbf{q})\delta\mathbf{y} \nonumber \\ &= - 2 \delta\mathbf{y}^T\Bigl(\mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\delta\mathbf{y}+\mathbf{K}\delta\mathbf{y}\Bigr)+\delta\mathbf{y}^T\mathbf{\dot{M}}(\mathbf{q})\delta\mathbf{y}\ \\&= - 2\delta\mathbf{y}^T \mathbf{K} \delta\mathbf{y}\nonumber \end{align} which indicates that the $\mathbf{y}$-system is contracting with $\mathbf{K}>0$. This implies exponential convergence of $\mathbf{\dot{q}}$ to $\mathbf{\dot{q}}_{r}$. In the presence of bounded resultant disturbance $\boldsymbol{d}(t)$, it follows from Lemma~\ref{LM:Robust_contraction_original} that: \begin{align} \label{eq:EL_proof1} \lim_{t \rightarrow \infty} \int_{\mathbf{0}}^{\mathbf{s}}\|\delta\mathbf{y}\|&=\lim_{t \rightarrow \infty} \int^{\mathbf{\dot{q}}}_{\mathbf{\dot{q}}_{r}}\|\delta\mathbf{y}\|\leq\frac{\lambda_{\max}(\boldsymbol{M}(\mathbf{q}))}{\lambda_{\min}(\boldsymbol{K})\lambda_{\min}(\boldsymbol{M}(\mathbf{q}))}\sup_{t}\|\boldsymbol{d}(t)\| \end{align} Hence the dynamics of the closed-loop system is bounded in the presence of bounded resultant disturbance $\boldsymbol{d}$. We now prove that convergence of $\boldsymbol{s} \rightarrow \boldsymbol{0}$ or $\mathbf{\dot{q}}\rightarrow \mathbf{\dot{q}}_{r}$ implies convergence of the system's trajectory to the desired trajectory ($\hat{\boldsymbol{q}} \rightarrow \boldsymbol{q}_d$). It follows from the definition of $\boldsymbol{s}$ and setting $\tilde{\mathbf{q}}=\mathbf{q}_e=\mathbf{q}-\mathbf{q}_d(t)$ that: \begin{align} \mathbf{\dot{q}}-\mathbf{\dot{q}}_d+\boldsymbol{\Lambda}(\mathbf{q}-\mathbf{q}_d)=\mathbf{\dot{q}}_e+\boldsymbol{\Lambda}\mathbf{q}_{e}=\mathbf{s} \end{align} is contracting with an exponential rate of $\lambda_{\min}(\boldsymbol{\Lambda})$ for $\boldsymbol{\Lambda}>0$ if $\boldsymbol{s}=\mathbf{0}$. This is obvious from the linear dynamics form. However, we can also use the virtual dynamics of $\mathbf{\dot{y}}_q+\boldsymbol{\Lambda}\mathbf{y}_q=\mathbf{\dot{q}}_d+\boldsymbol{\Lambda}\mathbf{q}_d$, which has two particular solutions of $\mathbf{y}_q=\mathbf{q}$ and $\mathbf{y}_q=\mathbf{q}_d(t)$. Alternatively, we can use $\mathbf{\dot{y}}_\mathbf{q}+\boldsymbol{\Lambda}\mathbf{y}_q=\mathbf{0}$, which has $\mathbf{y}_q=\mathbf{q}_e$ and $\mathbf{0}$ as its particular solutions. Both forms yield the same dynamics of $\delta \mathbf{y}_q$ that is the infinitesimal displacement at fixed time In summary, if $\boldsymbol{s}=\mathbf{0}$, all solutions of the $\mathbf{y}_q$ virtual dynamics will converge exponentially fast to each other ($\delta \mathbf{y}_q \rightarrow \mathbf{0}$). By using (\ref{eq:EL_proof1}), it follows from Lemma \ref{LM:Robust_contraction_original} and its extension to a hierarchically-combined system (Lemma~\ref{LM:Robust_contraction_hierc}) that: \begin{align} &\lim_{t\rightarrow\infty}\int_{\mathbf{q}_d}^{\boldsymbol{q}}\|\delta\mathbf{y}_q\|=\lim_{t\rightarrow\infty}\int_{0}^{\boldsymbol{q}_{e}}\|\delta\mathbf{y}_{q}\| \leq\frac{1}{\lambda_{\min}(\boldsymbol{\Lambda})}\lim_{t\rightarrow \infty}\int^\mathbf{s}_\mathbf{0}\|\delta\mathbf{y}\| \nonumber \\ & \leq \frac{\lambda_{\max}(\boldsymbol{M}(\mathbf{q}))}{\lambda_{\min}(\boldsymbol{\Lambda})\lambda_{\min}(\boldsymbol{K})\lambda_{\min}(\boldsymbol{M}(\mathbf{q}))}\sup_{t}\|\boldsymbol{d}(t)\| \label{eq:EL_proof2}\end{align} Hence we have shown, by constructing a hierarchically-combined closed-loop system of $\boldsymbol{s}$ and $\boldsymbol{q}_{e}$, that the attitude trajectory $\boldsymbol{q}(t)$ will globally exponentially converge to a bounded error ball around the desired trajectory $\boldsymbol{q}_d (t)$. Specifically, it follows from Lemma \ref{LM:Robust_contraction_original} that this control law is finite-gain $\mathcal{L}_p$ stable and input-to-state stable. Hence the control gains $\boldsymbol{K}$ and $\boldsymbol{\Lambda}$ can be designed such that the desired error bounds are achieved, as shall be seen below. This is a hierarchical combination due to reduction of the system order via introduction of the composite variable, $\mathbf{s}$. Consider the following hierarchical virtual system of $\mathbf{y}_1$ and $\mathbf{y}_2$: \begin{equation}\label{hierc_sys_ch2} \begin{bmatrix}{\mathbf{M}}(\mathbf{q}) & \mathbf{0}\\ \mathbf{0} &{\mathbf{I}}\end{bmatrix}\begin{pmatrix}\mathbf{ \dot y}_1\\\mathbf{ \dot y}_2\end{pmatrix}+\begin{bmatrix}\mathbf{C}(\mathbf{q},\mathbf{\dot{q}})+\mathbf{K} & \mathbf{0}\\ -\mathbf{I} &\mathbf{\Lambda}\end{bmatrix}\begin{pmatrix}\mathbf{ y}_1\\ \mathbf{ y}_2\end{pmatrix}=\begin{pmatrix}\mathbf{ 0}\\ \mathbf{0}\end{pmatrix} \end{equation} This is hierarchically connected since the dynamics of $\mathbf{y}_2$ does not affect those of $\mathbf{y}_1$. It is straightforward to verify that (\ref{hierc_sys_ch2}) has two particular solutions: \begin{equation}\begin{pmatrix}\mathbf{y}_1=\mathbf{s}\\ \mathbf{y}_2=\mathbf{q}-\mathbf{q}_d\end{pmatrix},\ \ \ \ \ \ \begin{pmatrix}\mathbf{y}_1=\mathbf{0}\\ \mathbf{y}_2=\mathbf{0}\end{pmatrix}\end{equation}. \begin{remark}[Proof of Exponential Stability using a Conventional Lyapunov Approach] If we use the original definition of exponential stability using a Lyapunov function (Theorem \ref{Thm:exponential}) {\color{caltechorange}(theorem not defined)}, we can try $V=\mathbf{s}^T\mathbf{M}(\mathbf{q})\mathbf{s}+\alpha \tilde{\mathbf{q}}^T\tilde{\mathbf{q}}$, which yields the conditions for contraction by Theorem~\ref{Thm:contraction}: $\alpha\mathbf{I}<4\mathbf{K}\mathbf{\Lambda}$ or $\alpha<4\lambda_{min}(\mathbf{K}\mathbf{\Lambda})$. However, this requires another strong assumption on $\alpha$ to complete the exponential stability of $\|\mathbf{s}\|$ and $\|\mathbf{\tilde{q}}\|$, in order to apply Theorem \ref{Thm:exponential} {\color{caltechorange}(theorem not defined)}. Often times, we need to use an ad-hoc Lyapunov function with a cross-term~\cite{Ref:ChungTRO}: $\exists \alpha$, $$V=\mathbf{s}^T\mathbf{M}(\mathbf{q})\mathbf{s}+\tilde{\mathbf{q}}^T\tilde{\mathbf{q}}+\alpha\mathbf{s}^T\mathbf{M}(\mathbf{q})\tilde{\mathbf{q}}.$$ \end{remark} \iffalse\subsection{Tracking Control of Hamiltonian} We show an equivalent result from the previous section, using the first order canonical form obtained by the transformation, $\mathbf{p}=\mathbf{M}(\mathbf{q})\mathbf{s}$ in Section~\ref{sec:hamilton}. The closed-loop system with the tracking control law in (\ref{tracking_controller_proof}) is obtained as \begin{equation}\label{NL_hamiltonian2} \mathbf{M}(\mathbf{q})\mathbf{\dot{s}}+ \mathbf{C}(\mathbf{q},\mathbf{\dot{q}})\mathbf{s}+\mathbf{K}\mathbf{s} =\mathbf{0} \end{equation} where $\mathbf{s}$ is defined in (\ref{composite_variable}). \noindent Equation (\ref{NL_hamiltonian2}) reduces to the following first-order canonical form: \begin{equation} \begin{split} \mathbf{\dot{p}}=\Bigl[\mathbf{C}\left(\mathbf{q},\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}\right)^{T}-\mathbf{K}\Bigr]\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}\\ \mathbf{\dot{q}}=-\mathbf{\Lambda}\mathbf{q}+\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}+ \left(\mathbf{\dot{q}}_d+\mathbf{\Lambda}{\mathbf{q}}_d\right)\ \ \ \ \end{split} \end{equation} Consider a virtual system, having $\mathbf{y}_1=\mathbf{p},\mathbf{y}_2=\mathbf{q}$ and $\mathbf{y}_1=\mathbf{0},\mathbf{y}_2=\mathbf{q}_d$ as its particular solutions: \begin{equation} \begin{split} \mathbf{\dot{y}}_1=\Bigl[\mathbf{C}\left(\mathbf{q},\mathbf{M}^{-1}(\mathbf{q})\mathbf{p}\right)^{T}-\mathbf{K}\Bigr]\mathbf{M}^{-1}(\mathbf{q})\mathbf{y}_1 \\ \mathbf{\dot{y}}_2=-\mathbf{\Lambda}\mathbf{y}_2+\mathbf{M}^{-1}(\mathbf{q})\mathbf{y}_1+ \left(\mathbf{\dot{q}}_d+\mathbf{\Lambda}{\mathbf{q}}_d\right) \ \ \end{split} \end{equation} which is also a hierarchical combination. This virtual system can be easily shown to be contracting. Similarly to the previous section, the virtual length analysis with respect to the metric, $\mathbf{M}^{-1}(\mathbf{q})>0$ yields \begin{align} &\frac{d}{dt}(\delta{\mathbf{y}_1}^T\mathbf{M}^{-1}(\mathbf{q})\delta\mathbf{y}_1) \nonumber \\ =&2 \delta{\mathbf{y}_1}^T\mathbf{M}^{-1}(\mathbf{q})\delta{\mathbf{\dot y}}_1+{\mathbf{y}_1}^T\mathbf{M}^{-1}(\mathbf{q})(-\mathbf{\dot{M}}(\mathbf{q}))\mathbf{M}^{-1}(\mathbf{q})\delta\mathbf{y}_1 \nonumber \\ =& \delta{\mathbf{y}_1}^T\mathbf{M}^{-1}(\mathbf{q})\Bigl(\mathbf{C}+\mathbf{C}^T-2\mathbf{K}\Bigr)\mathbf{M}^{-1}(\mathbf{q})\delta\mathbf{y}_1 \nonumber \\ &-\delta{\mathbf{y}_1}^T\mathbf{M}^{-1}(\mathbf{q})\mathbf{\dot{M}}(\mathbf{q})\mathbf{M}^{-1}(\mathbf{q})\delta\mathbf{y}_1\ \nonumber\\=& - 2\delta{\mathbf{y}_1}^T \mathbf{M}^{-1}(\mathbf{q})\mathbf{K} \mathbf{M}^{-1}(\mathbf{q})\delta\mathbf{y}_1 \end{align} where we used \begin{equation}\frac{d}{dt}\mathbf{M}^{-1}(\mathbf{q})=-\mathbf{M}^{-1}(\mathbf{q})\mathbf{\dot{M}}(\mathbf{q})\mathbf{M}^{-1}(\mathbf{q})\end{equation} This shows that $\mathbf{y}_1$ is contracting with $\mathbf{K}>0$, which in turn corresponds to contraction of $\mathbf{y}_2$ due to the hierarchy. Therefore, all solutions of $\mathbf{y}_1$ and $\mathbf{y}_2$ tend to each other resulting in $\mathbf{q} \rightarrow \mathbf{q}_d$. \fi \begin{example}[Adaptive Control] Robust control and adaptive control are two different approaches to the problem of inherent uncertainty in the nonlinear system: robust control attempts to design a fixed parameter controller that successfully performs in the presence of the worst-case errors in the model, while adaptive control dynamically adjusts its parameters to compensate for the initial model uncertainty or very slowly varying parameters. Hence, adaptive control is a natural choice when only parametric uncertainty exits. However, adaptive controllers do not have long term memory and hence do not "remember" the optimal control parameters corresponding to different configurations of the plant. We consider the following adaptive control law for a Lagrangian system from (\ref{NL_single_compact2}): \begin{equation} \boldsymbol{\tau}=\mathbf{Y}\hat{\mathbf{a}}-\mathbf{K}\mathbf{s}=\mathbf{\hat{M}}(\mathbf{q})\mathbf{\ddot{q}_{r}}+ \mathbf{\hat{C}}(\mathbf{q},\mathbf{\dot{q}})\mathbf{\dot{q}_{r}}+\mathbf{\hat{g}}(\mathbf{q}) -\mathbf{K}\mathbf{s} \end{equation} where $\mathbf{s}$ denotes the composite variable $\mathbf{s}=\mathbf{\dot q} - \mathbf{\dot{q}}_{r}$, and the parameter estimates are updated to complete the definition of the adaptive control law with a positive definite matrix $\mathbf{\Gamma}$ as follows: \begin{equation}\mathbf{\dot{\hat{a}}}=-\mathbf{\Gamma}\mathbf{Y}^T\mathbf{s}\end{equation} Then, the asymptotic convergence of the tracking error and parameter estimates can be proven by finding a suitable Lyapunov-like function or using contraction analysis. \end{example} Consider the closed-loop system with the adaptive control law above: \begin{equation} \begin{bmatrix}\mathbf{M}(\mathbf{q}) & \mathbf{0}\\ \mathbf{0} & \mathbf{\Gamma}^{-1}\end{bmatrix} \begin{pmatrix}\mathbf{\dot s}\\ \mathbf{\dot{\tilde a}}\end{pmatrix}+ \begin{bmatrix}\mathbf{C}(\mathbf{q},\mathbf{\dot{q}})+\mathbf{K}& -\mathbf{Y}\\ \mathbf{Y}^{T}& \mathbf{0} \end{bmatrix}\begin{pmatrix}\mathbf{s}\\ \mathbf{\tilde a}\end{pmatrix}=\begin{pmatrix}\mathbf{0}\\ \mathbf{0}\end{pmatrix}\label{eq:adaptive_closed} \end{equation} where $\mathbf{\hat{a}}$ denotes an estimate, and $\mathbf{\tilde{a}}$ denotes an error of the estimate such that $\mathbf{\tilde{a}}=\mathbf{\hat{a}}-\mathbf{a}$, while $\mathbf{a}$ is a constant vector of the true parameter values. \begin{figure} \begin{center} \includegraphics[width=85mm]{figures/Passivity.jpg}\\ \caption{Interpretation of adaptive control from a perspective of passivity} \end{center} \end{figure} The above system has a positive semi-definite generalized Jacobian with $\mathbf{K}>0$, thereby resulting in a semi-contracting system~\cite{Ref:contraction1,Ref:contraction4}. Using Barbalat's lemma, the asymptotic convergence of $\mathbf{s}$ can be proven as follows. First, construct a suitable Lyapunov function to find that $\ddot V= -2\mathbf{s}^T\mathbf{K}\mathbf{\dot s}$ and $\dot V$ is uniformly continuous since a bounded $\dot{\mathbf{s}}$ from (\ref{eq:adaptive_closed}) leads to a bounded $\ddot V$. Due to $\dot V \leq 0$, the use of Barbalat's lemma verifies that $\dot V \rightarrow 0$ as $t\rightarrow \infty$. This implies that $\mathbf{s}$ tends to zero asymptotically fast. From the hierarchical combination of the $\mathbf{s}$ variable, this also implies $\mathbf{q}\rightarrow \mathbf{q}_d$. Please note that the convergence of $\mathbf{\hat{a}}$ to the true value $\mathbf{a}$ is NOT proven. It should be noted that the open loop dynamics of a multi-link robot are only passive for $\mathbf{\tau}-\mathbf{g}$ and the joint velocity $\mathbf{\dot q}$. To the contrary, the above adaptation law modifies the closed-loop dynamics such that the mapping $-\mathbf{Y}^T\mathbf{s}\rightarrow \mathbf{\tilde a}$ is passive (i.e., $\mathbf{s}\rightarrow -\mathbf{Y}\mathbf{\tilde a}$ is also a passive mapping. This is reminiscent of the feedback combination of two passive systems. $\dot{V}_1(t)=y_1^Tu_1-g_1(t)$ and $\dot{V}(t)=y_2^Tu_2-g_2(t)$. In a feedback configuration, $u_2=y_1$ and $u_1=-y_2$. Hence, $\dot{V}_1(t)+\dot{V}_2(t)=-(g_1(t)+g_2(t))$. \subsection{Control Laws for Nonlinear Attitude Control \label{sec:att_cont}} In this section, we present the new nonlinear attitude tracking control laws that are deemed suitable for satisfying the control problem statement. We first present a novel robust nonlinear tracking control law that guarantees globally exponential convergence of the system's attitude trajectory to the desired attitude trajectory. In order to highlight the advantages of this new control law, we also present several extensions of this attitude tracking control law, like augmenting it with an integral control term and deriving an exponentially-stabilizing tracking control law on SO($3$). Let $\boldsymbol{\omega}\in\mathbb{R}^{3}$ be the angular velocity of the system in the body fixed frame $\mathcal{F}_{B}$ with respect to the inertial frame $\mathcal{F}_{I}$ and expressed in the frame $\mathcal{F}_{B}$. Let $\boldsymbol{u}_c\in\mathbb{R}^{n_t}$ be the control input. The attitude dynamics of the rigid combination is given by: \begin{equation} \boldsymbol{J}\dot{\boldsymbol{\omega}}=\left(\boldsymbol{J}\boldsymbol{\omega}\right)\times\boldsymbol{\omega}+\boldsymbol{u}_c+\boldsymbol{d}_{\textrm{ext}}\thinspace,\label{eq:dynamics} \end{equation} where $\boldsymbol{d}_{\textrm{ext}}$ represents the external torque acting on the system. The attitude kinematics can be written by using quaternions ($\boldsymbol{\beta}_{v}=[\beta_{1},\thinspace\beta_{2},\thinspace\beta_{3}]$), modified Rodrigues parameters (MRP), or rotation matrix on SO$(3)$ : \begin{align} \boldsymbol{\dot{\beta}}_{v} =&\frac{1}{2}(\beta_{4}\boldsymbol{\omega}+\boldsymbol{\beta}_{v}\times\boldsymbol{\omega}),~~\dot{\beta}_{4}=-\frac{1}{2}\boldsymbol{\beta}_{v}^{T}\boldsymbol{\omega}\thinspace,\label{eq:kinematics_quaternion} \\ \dot{\boldsymbol{q}}=&\boldsymbol{Z}(\boldsymbol{q})\boldsymbol{\omega} \end{align} where The attitude kinematics equations using Euler angles ($\phi,\thinspace\theta,\thinspace\psi$), classical Rodrigues parameters ($\boldsymbol{\sigma}$), and the first three elements of a quaternion vector ($\boldsymbol{\beta}_v$) can also be written in the form of $\dot{\boldsymbol{q}}=\boldsymbol{Z}(\boldsymbol{q})\boldsymbol{\omega}$ (like (\ref{eq:MRP_def})) with a different definition of $\boldsymbol{Z}(\boldsymbol{q})$. \subsubsection{Robust Nonlinear Tracking Control Law with Global Exponential Stability \label{sub:First-Robust-NCL-new}} The following theorem states the proposed robust nonlinear tracking control law. Note that this control law does not cancel the term $\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\hat{\boldsymbol{\omega}}\right)\hat{\boldsymbol{\omega}}$ exactly, in contrast with most conventional nonlinear tracking control laws using feed-forward cancellation. Although this control law is written for MRP, it can also be used with other attitude representations like Euler angles, classical Rodrigues parameters, and the quaternion vector, by changing the definition of $\boldsymbol{Z}(\boldsymbol{q})$. \begin{theorem}[Robust Nonlinear Attiude Controller]\label{thm:first_RNTCL} For the given desired attitude trajectory $\boldsymbol{q}_{d}(t)$, and positive definite constant matrices $\boldsymbol{K}_{r}\in\mathbb{R}^{3\times3}$ and $\boldsymbol{\Lambda}_{r}\in\mathbb{R}^{3\times3}$, we define the following control law: \begin{align} & \boldsymbol{u}_c=\skew{4}\hat{\boldsymbol{J}}\dot{\boldsymbol{\omega}}_{r}-\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{r}-\boldsymbol{K}_{r}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r}) \thinspace,\label{eq:first_RNC_MRP}\\ \textrm{where}\quad & \boldsymbol{\omega}_{r}=\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\dot{\boldsymbol{q}}_{d}(t)+\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\boldsymbol{\Lambda}_{r}(\boldsymbol{q}_{d}(t)-\hat{\boldsymbol{q}}) \thinspace.\nonumber \end{align} This control law exponentially stabilizes the closed-loop attitude dynamics with the following properties: \\ (i) In the absence of resultant disturbance torque $\boldsymbol{d}_{\textrm{res},2}$, this control law guarantees global exponential convergence of the system's trajectory to the desired trajectory $\boldsymbol{q}_{d}(t)$. \\ (ii) In the presence of bounded resultant disturbance torque $\boldsymbol{d}_{\textrm{res},2}$, this control law guarantees that the tracking error ($\boldsymbol{q}_{e} = \hat{\boldsymbol{q}}-\boldsymbol{q}_{d}$) globally exponentially converges to the following ball \begin{align} \lim_{t\rightarrow\infty}\int_{0}^{\boldsymbol{q}_{e}}\|\delta\boldsymbol{q}_{e}\|_{2} & \leq\frac{\lambda_{\max}(\boldsymbol{J})\sup_{t}\sigma_{\max}(\boldsymbol{Z}(\hat{\boldsymbol{q}}))\sup_{t}\|\boldsymbol{d}_{\textrm{res},2}\|_{2}}{\lambda_{\min}(\boldsymbol{\Lambda}_{r})\lambda_{\min}(\boldsymbol{K}_{r})\lambda_{\min}(\boldsymbol{J})}. \end{align} Hence, this control law is finite-gain $\mathcal{L}_p$ stable and input-to-state stable (ISS). \end{theorem} \begin{proof} The closed-loop dynamics, which is obtained by substituting $\boldsymbol{u}_c$ from ~(\ref{eq:first_RNC_MRP}) into ~(\ref{eq:dynamics}), becomes \begin{equation} \boldsymbol{J}\dot{\boldsymbol{\omega}}_{e}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{e}+\boldsymbol{K}_{r}\boldsymbol{\omega}_{e}=\underbrace{\left[\boldsymbol{d}_{\textrm{res}}-\Delta\boldsymbol{J}\dot{\boldsymbol{\omega}}_r+\boldsymbol{S}\left(\Delta\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{r}\right]}_{\boldsymbol{d}_{\textrm{res},2}}\thinspace, \label{eq:proof_step7} \end{equation} where $\boldsymbol{\omega}_e = (\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r})$ and $\boldsymbol{d}_{\textrm{res}} = \boldsymbol{J}\Delta\boldsymbol{\omega}\times\hat{\boldsymbol{\omega}} +\boldsymbol{J}{\boldsymbol{\omega}}\times\Delta\boldsymbol{\omega} -\boldsymbol{J}\Delta\dot{\boldsymbol{\omega}}+\boldsymbol{d}_{\textrm{ext}}$. We first show that the control law indeed globally exponentially stabilizes the closed-loop system without the resultant disturbance $\boldsymbol{d}_{\textrm{res},2}$. The virtual dynamics of $\boldsymbol{y}$, derived from ~(\ref{eq:proof_step7}) without $\boldsymbol{d}_{\textrm{res},2}$, is given as \begin{equation} \boldsymbol{J}\dot{\boldsymbol{y}}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\boldsymbol{y}+\boldsymbol{K}_{r}\boldsymbol{y} = \boldsymbol{0} \thinspace ,\label{Eq:CLeqn} \end{equation} where $\boldsymbol{y}$ has $\boldsymbol{y}=\boldsymbol{\omega}_e$ and $\boldsymbol{y}=\boldsymbol{0}$ as its two particular solutions. After we obtain the dynamics of the infinitesimal displacement at fixed time, $\delta\boldsymbol{y}$ from (\ref{Eq:CLeqn}), we perform the squared-length analysis: \begin{equation} \frac{d}{dt}\left(\delta\boldsymbol{y}^{T}\boldsymbol{J}\delta\boldsymbol{y}\right)=-2\delta\boldsymbol{y}^{T}\boldsymbol{K}_{r}\delta\boldsymbol{y}\leq\frac{-2\lambda_{\min}(\boldsymbol{K}_{r})}{\lambda_{\max}(\boldsymbol{J})}\left(\delta\boldsymbol{y}^{T}\boldsymbol{J}\delta\boldsymbol{y}\right)\thinspace, \end{equation} where we exploited the skew-symmetric property of the matrix $\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)$. Hence, it follows from the contraction analysis (Theorem \ref{Thm:contraction}) that all system trajectories of (\ref{Eq:CLeqn}) converge exponentially fast to a single trajectory (i.e., $\delta\boldsymbol{y} \rightarrow \boldsymbol{0}$ and $\boldsymbol{\omega}_e\rightarrow \boldsymbol{0}$ ) at a rate of $\frac{\lambda_{\min}(\boldsymbol{K}_{r})}{\lambda_{\max}(\boldsymbol{J})}$. In the presence of bounded resultant disturbance $\boldsymbol{d}_{\textrm{res},2}$, it follows from Lemma \ref{LM:Robust_contraction_original} that: \begin{equation} \lim_{t \rightarrow \infty} \int_{0}^{\boldsymbol{\omega}_{e}}\|\delta\boldsymbol{y}\|_{2}\leq\frac{\lambda_{\max}(\boldsymbol{J})}{\lambda_{\min}(\boldsymbol{K}_{r})\lambda_{\min}(\boldsymbol{J})}\sup_{t}\|\boldsymbol{d}_{\textrm{res},2}\|_{2} \label{eq:proof_step9} \end{equation} Hence the dynamics of the closed-loop system is bounded in the presence of bounded resultant disturbance $\boldsymbol{d}_{\textrm{res},2}$. We now prove that convergence of $\boldsymbol{\omega}_{e} \rightarrow \boldsymbol{0}$ implies convergence of the system's trajectory to the desired trajectory ($\hat{\boldsymbol{q}} \rightarrow \boldsymbol{q}_d$). It follows from the definition of $\boldsymbol{\omega}_{r}$ that: \begin{align} \boldsymbol{\omega}_{e}=&\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})(\dot{\hat{\boldsymbol{q}}}-\dot{\boldsymbol{q}}_{d})+\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\boldsymbol{\Lambda}_{r}(\hat{\boldsymbol{q}}-\boldsymbol{q}_{d}) \nonumber \\ =&\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})(\dot{\boldsymbol{q}}_{e}+\boldsymbol{\Lambda}_{r}\boldsymbol{q}_{e})\thinspace, \end{align} where $\boldsymbol{q}_{e} = (\hat{\boldsymbol{q}}-\boldsymbol{q}_{d})$. In the absence of $\boldsymbol{\omega}_{e}$, all system trajectories of $ \delta \boldsymbol{q}_e$ will converge exponentially fast to a single trajectory ($\delta \boldsymbol{q}_e \rightarrow 0$) with a rate of $\lambda_{\min}(\boldsymbol{\Lambda}_{r})$, where the virtual displacement $\delta\boldsymbol{q}_e$ is an infinitesimal displacement at fixed time. In the presence of $\boldsymbol{\omega}_{e}$, it follows from Lemma \ref{LM:Robust_contraction_original} and its extension to a hierarchically-combined system (Lemma~\ref{LM:Robust_contraction_hierc}) that: \begin{align} &\lim_{t\rightarrow\infty}\int_{0}^{\boldsymbol{q}_{e}}\|\delta\boldsymbol{q}_{e}\|_{2} \leq\frac{1}{\lambda_{\min}(\boldsymbol{\Lambda}_{r})}\sup_{t}\|\boldsymbol{Z}(\hat{\boldsymbol{q}})\boldsymbol{\omega}_{e}\|_{2} \\ & \leq\frac{\lambda_{\max}(\boldsymbol{J})\sup_{t}\|\boldsymbol{d}_{\textrm{res},2}\|_{2}}{\lambda_{\min}(\boldsymbol{\Lambda}_{r})\lambda_{\min}(\boldsymbol{K}_{r})\lambda_{\min}(\boldsymbol{J})}\left(\sup_{t}\sigma_{\max}(\boldsymbol{Z}(\hat{\boldsymbol{q}}))\right)\thinspace. \nonumber \end{align} Hence we have shown, by constructing a hierarchically-combined closed-loop system of $\boldsymbol{\omega}_{e}$ and $\boldsymbol{q}_{e}$, that the attitude trajectory $\boldsymbol{q}$ will globally exponentially converge to a bounded error ball around the desired trajectory $\boldsymbol{q}_d (t)$. Moreover, it follows from Lemma \ref{LM:Robust_contraction_original} that this control law is finite-gain $\mathcal{L}_p$ stable and input-to-state stable. Hence the control gains $\boldsymbol{K}_{r}$ and $\boldsymbol{\Lambda}_{r}$ can be designed such that the desired error bounds are achieved. \end{proof} The desired attitude trajectory $\boldsymbol{q}_d (t)$ can be any reference trajectory that we would like the system to track (e.g., motion planning based on optimal control). \subsubsection{Robust Nonlinear Tracking Control Law with Integral Control \label{sub:Robust-NCL-MRP-Integral}} Another benefit of the original robust nonlinear tracking control law ~(\ref{eq:first_RNC_MRP}) is that it can be augmented with an integral control term in a straight-forward manner to eliminate any constant external disturbance while ensuring exponential convergence of the system's attitude trajectory to the desired attitude trajectory. \begin{theorem}[Robust Nonlinear Integral Control]\label{thm:Integral_RNTCL} For the given desired attitude trajectory $\boldsymbol{q}_{d}(t)$, positive definite constant matrices $\boldsymbol{K}_{m}\in\mathbb{R}^{3\times3}$ and $\boldsymbol{\Lambda}_{m}\in\mathbb{R}^{3\times3}$, and (possibly time-varying) uniformly positive definite diagonal matrix $\boldsymbol{K}_{I}(t)\in\mathbb{R}^{3\times3}$, we define the following control law: \begin{align} \boldsymbol{u}_c =&\skew{4}\hat{\boldsymbol{J}}\dot{\boldsymbol{\omega}}_{r}-\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{r}-\boldsymbol{K}_{m}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r}) -\int_{0}^{t} \boldsymbol{K}_{I}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r})dt \thinspace,\label{eq:RNC_Integral_MRP} \end{align} where \begin{align} \textrm{where}\quad & \boldsymbol{\omega}_{r}=\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\dot{\boldsymbol{q}}_{d}(t)+\boldsymbol{Z}^{-1}(\hat{\boldsymbol{q}})\boldsymbol{\Lambda}_{m}(\boldsymbol{q}_{d}(t)-\hat{\boldsymbol{q}}) \thinspace.\nonumber \end{align} This control law has the following properties: \begin{itemize} \item This control law guarantees global exponential convergence of the system's trajectory to $\boldsymbol{q}_{d}(t)$ for any constant external disturbance (constant bias) acting on the system. \item In the presence of time-varying disturbance $\boldsymbol{d}_{\textrm{res},2}$ with a bounded rate $\dot{\boldsymbol{d}}_{\textrm{res},2}$, this control law guarantees that $\boldsymbol{q}(t)$ will globally exponentially converge to an error ball around $\boldsymbol{q}_{d}(t)$, whose size is determined by $\dot{\boldsymbol{d}}_{\textrm{res},2}$ (i.e., finite-gain $\mathcal{L}_p$ stable and ISS with respect to disturbance inputs with bounded rates). \end{itemize}\end{theorem} \begin{proof} The closed-loop dynamics is given by: \begin{equation} \boldsymbol{J}\dot{\boldsymbol{\omega}}_{e}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{e}+\boldsymbol{K}_{m}\boldsymbol{\omega}_{e} + \int_{0}^{t} \boldsymbol{K}_{I} \boldsymbol{\omega}_e dt = \boldsymbol{d}_{\textrm{res},2} \thinspace, \label{eq:proof_step8} \end{equation} where $\boldsymbol{\omega}_e = (\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r})$ and $\boldsymbol{d}_{\textrm{res},2}$ is defined in ~(\ref{eq:proof_step7}). We first show that this control law can eliminate a constant external disturbance, hence replacing $\boldsymbol{d}_{\textrm{res},2}$ in ~(\ref{eq:proof_step8}) with a constant disturbance term $\boldsymbol{d}_{\textrm{const}}$ gives us: \begin{equation} \boldsymbol{J} \dot{\boldsymbol{\omega}}_e - \boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{e} + \boldsymbol{K}_{m} \boldsymbol{\omega}_e + \int_{0}^{t} \boldsymbol{K}_{I} \boldsymbol{\omega}_e dt = \boldsymbol{d}_{\textrm{const}} \thinspace . \label{eq:proof_step2} \end{equation} Differentiating ~(\ref{eq:proof_step2}) with respect to time and setting $\dot{\boldsymbol{d}}_{\textrm{const}}=0$, we get: \begin{equation} \boldsymbol{J}\ddot{\boldsymbol{\omega}}_{e}+\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right)\dot{\boldsymbol{\omega}}_{e}+\left(\boldsymbol{K}_{I}-\boldsymbol{S}\left(\boldsymbol{J}\dot{\hat{\boldsymbol{\omega}}}\right)\right)\boldsymbol{\omega}_{e}=0\thinspace. \label{eq:proof_step3} \end{equation} If we show that ~(\ref{eq:proof_step3}) is contracting, then we prove our claim (i) that the given control law can successfully eliminate any constant external disturbance acting on the system. In order to prove ~(\ref{eq:proof_step3}) is globally exponentially stable, we consider two cases which depend on the time-varying nature of the matrix $\boldsymbol{K}_{I}$. We first consider the case where $\boldsymbol{K}_{I}$ is a constant positive definite diagonal matrix. The matrix $\boldsymbol{K}_{I}$ can be decomposed into $\boldsymbol{K}_{I} = \boldsymbol{K}_{I}^{\frac{1}{2}} \boldsymbol{K}_{I}^{\frac{1}{2}}$, where the matrix $\boldsymbol{K}_{I}^{\frac{1}{2}}$ is also a constant positive definite diagonal matrix. We introduce the term $\boldsymbol{y}_1$, where $\dot{\boldsymbol{y}}_{1}$ is defined as $\dot{\boldsymbol{y}}_{1}= \boldsymbol{K}_{I}^{\frac{1}{2}} \boldsymbol{\omega}_{e}$. Then we can write $\dot{\boldsymbol{\omega}}_e$ as: \begin{equation} \dot{\boldsymbol{\omega}}_{e}=-(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right)\boldsymbol{\omega}_{e} -(\boldsymbol{J})^{-1} \boldsymbol{K}_{I}^{\frac{1}{2}} \boldsymbol{y}_{1}\thinspace. \label{eq:proof_step4} \end{equation} Note that differentiating ~(\ref{eq:proof_step4}) with respect to time and substituting $\dot{\boldsymbol{y}}_{1}$ gives us ~(\ref{eq:proof_step3}). Therefore, these equations can be written in matrix form as: \begin{equation} \begin{bmatrix} \dot{\boldsymbol{\omega}}_{e}\\ \dot{\boldsymbol{y}}_{1} \end{bmatrix}=\left[\begin{smallmatrix} -(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right) & -(\boldsymbol{J})^{-1} \boldsymbol{K}_{I}^{\frac{1}{2}} \\ \boldsymbol{K}_{I}^{\frac{1}{2}} & \boldsymbol{0} \end{smallmatrix}\right] \begin{bmatrix} \boldsymbol{\omega}_{e}\\ \boldsymbol{y}_{1} \end{bmatrix} = \boldsymbol{F} \begin{bmatrix} \boldsymbol{\omega}_{e}\\ \boldsymbol{y}_{1} \end{bmatrix} \thinspace. \label{eq:proof_step5} \end{equation} We define the positive definite matrix $\boldsymbol{\Xi}=\left[\begin{smallmatrix}\boldsymbol{J} & b\mathbf{I}\\ b\mathbf{I} & \mathbf{I}\end{smallmatrix}\right]$, where $b$ is a constant between $0 < b < \lambda_{\max}^{\frac{1}{2}}(\boldsymbol{J})$. The symmetric matrix $(\boldsymbol{\Xi F})_\mathrm{sym} = \frac{1}{2}\left((\boldsymbol{\Xi F})+(\boldsymbol{\Xi F})^{T}\right)$ is given by: \begin{align} (\boldsymbol{\Xi F})_\mathrm{sym} & = - \left[\begin{smallmatrix} \frac{\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T}}{2}-b\boldsymbol{K}_{I}^{\frac{1}{2}} & \frac{b}{2}\left[(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right)\right]^{T}\\ \frac{b}{2}(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right) & \frac{b}{2}\left((\boldsymbol{J})^{-1}\boldsymbol{K}_{I}^{\frac{1}{2}}+\boldsymbol{K}_{I}^{\frac{1}{2}}(\boldsymbol{J})^{-1}\right) \end{smallmatrix}\right] \thinspace . \nonumber \end{align} The sufficient conditions for the matrix $(\boldsymbol{\Xi}\boldsymbol{F})_{\mathrm{sym}}$ to be negative definite are: \begin{align} & -\frac{\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T}}{2}+b\boldsymbol{K}_{I}^{\frac{1}{2}}<0\thinspace \\ &-\frac{b}{2}\left((\boldsymbol{J})^{-1}\boldsymbol{K}_{I}^{\frac{1}{2}}+\boldsymbol{K}_{I}^{\frac{1}{2}}(\boldsymbol{J})^{-1}\right) <0\thinspace, \label{eq:proof_condition2} \\ & \tfrac{\lambda_{\max}\left(-\frac{\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T}}{2}+b\boldsymbol{K}_{I}^{\frac{1}{2}}\right)\lambda_{\max}\left(-\frac{b}{2}\left((\boldsymbol{J})^{-1}\boldsymbol{K}_{I}^{\frac{1}{2}}+\boldsymbol{K}_{I}^{\frac{1}{2}}(\boldsymbol{J})^{-1}\right)\right)}{\sigma_{\max}^{2}\left(-\frac{b}{2}\left[(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right)\right]^{T}\right)} > 1 \thinspace. \label{eq:proof_condition3} \end{align} Equation~(\ref{eq:proof_condition2}) is satisfied by $0<b<\frac{\lambda_{\min}(\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T})}{2\lambda_{\max}(\boldsymbol{K}_{I}^{\frac{1}{2}})}$. Equation~(\ref{eq:proof_condition3}) is satisfied by $b<b_3$, where $b_3$ is given by: \begin{equation} b_3 = \frac{\lambda_{\max}\left(\frac{\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T}}{2}\right)\lambda_{\min}\left((\boldsymbol{J})^{-1}\boldsymbol{K}_{I}^{\frac{1}{2}}+\boldsymbol{K}_{I}^{\frac{1}{2}}(\boldsymbol{J})^{-1}\right)}{B_1+B_2} \thinspace. \end{equation} where \begin{align} B_1 =& \frac{1}{2}\sigma_{\max}^{2}\left[(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right)\right]^{T} \\ B_2 =& \lambda_{\min}\left(\boldsymbol{K}_{I}^{\frac{1}{2}}\right)\lambda_{\min}\left((\boldsymbol{J})^{-1}\boldsymbol{K}_{I}^{\frac{1}{2}}+\boldsymbol{K}_{I}^{\frac{1}{2}}(\boldsymbol{J})^{-1}\right). \end{align} Therefore, the matrix $(\boldsymbol{\Xi F})_\mathrm{sym}$ is negative definite if $b$ is chosen such that $0 <b < \min ( \lambda_{\max}^{\frac{1}{2}}(\boldsymbol{J}),\thinspace \frac{\lambda_{\min}(\boldsymbol{K}_{m}+\boldsymbol{K}_{m}^{T})}{2\lambda_{\max}(\boldsymbol{K}_{I}^{\frac{1}{2}})}, \thinspace b_{3} ) $. We define the generalized virtual displacement $\delta\boldsymbol{z}=[\delta\boldsymbol{\omega}_{e},\thinspace\delta\boldsymbol{y}_{1}]^{T}$, where $\delta\boldsymbol{\omega}_{e}$ and $\delta\boldsymbol{y}_{1}$ are infinitesimal displacements at fixed time. Therefore, \begin{align} &\frac{d}{dt}\left(\delta\boldsymbol{z}^{T} \boldsymbol{\Xi} \delta\boldsymbol{z}\right)=\delta\boldsymbol{z}^{T} \left( (\boldsymbol{\Xi F}) + (\boldsymbol{\Xi F})^T \right) \delta\boldsymbol{z} \\ \leq& 2\lambda_{\max}((\boldsymbol{\Xi F})_\mathrm{sym})\|\delta\boldsymbol{z}\|_{2}^2 \leq \frac{2\lambda_{\max}((\boldsymbol{\Xi F} )_\mathrm{sym})}{\lambda_{\max}(\boldsymbol{\Xi})} \left(\delta\boldsymbol{z}^{T} \boldsymbol{\Xi} \delta\boldsymbol{z}\right) \nonumber. \end{align} Hence, it follows from the contraction analysis (Theorem~\ref{Thm:contraction}) that all system trajectories converge exponentially fast to a single trajectory ($\delta\boldsymbol{z} \rightarrow 0$ and $\delta\boldsymbol{\omega}_e \rightarrow 0$) at a rate of $\frac{-\lambda_{\max}((\boldsymbol{\Xi F} )_\mathrm{sym})}{\lambda_{\max}(\boldsymbol{\Xi})}$. Moreover, in the presence of bounded time-varying resultant disturbance $\boldsymbol{d}_{\textrm{res},2}$ with bounded $\dot{\boldsymbol{d}}_{\textrm{res},2}$, we get from Lemma~\ref{LM:Robust_contraction_original}: \begin{align} &\lim_{t \rightarrow \infty} \int_{0}^{\boldsymbol{\omega}_{e}}\|\delta\boldsymbol{\omega}_{e}\|_{2} \nonumber \\ &\leq \frac{(b+1) \lambda_{\max}(\boldsymbol{\Xi}) \sup_t \lambda_{\max}(\boldsymbol{K}_{I}^{-\frac{1}{2}})\sup_{t}\| \dot{\boldsymbol{d}}_{\textrm{res},2}\|_{2}}{-\lambda_{\max}((\boldsymbol{\Xi F} )_\mathrm{sym}) }. \end{align} where $\|\delta\boldsymbol{\omega}_{e}\|_{2}\leq\|\delta\boldsymbol{z}\|_{2}$ and $\lambda_{\min}(\boldsymbol{\Xi})>1$ are used. Also, note that the disturbance term in the righthand side of ~(\ref{eq:proof_step5}) is $(\mathbf{0};-\boldsymbol{K}_{I}^{-\frac{1}{2}}\dot{\boldsymbol{d}}_{\textrm{res},2})$. The fact that convergence of $\boldsymbol{\omega}_{e} \rightarrow \boldsymbol{0}$ implies convergence of the system's trajectory to the desired trajectory ($\hat{\boldsymbol{q}} \rightarrow \boldsymbol{q}_d$) is already presented in the proof of Theorem \ref{thm:first_RNTCL}. This completes the proof. \end{proof} If both $\boldsymbol{K}_{I}$ and $\dot{\boldsymbol{K}}_{I}$ are uniformly positive definite diagonal matrices, there exits a simpler proof, which is presented here. \begin{proof} The matrix $\dot{\boldsymbol{K}}_{I}$ can also be decomposed into $\dot{\boldsymbol{K}}_{I} = \dot{\boldsymbol{K}}_{I}^{\frac{1}{2}} \dot{\boldsymbol{K}}_{I}^{\frac{1}{2}}$. We introduce another term $\boldsymbol{y}_2$, where: \begin{equation} \dot{\boldsymbol{y}}_{2}=\boldsymbol{K}_{I}^{\frac{1}{2}} \boldsymbol{\omega}_{e} - \boldsymbol{K}_{I}^{-\frac{1}{2}} \dot{\boldsymbol{K}}_{I}^{\frac{1}{2}} \boldsymbol{y}_{2}\thinspace. \end{equation} Once again, $\dot{\boldsymbol{\omega}}_e$ can be written in a form similar to that of ~(\ref{eq:proof_step4}). The matrix form of these equations is given by: \begin{equation} \begin{bmatrix} \dot{\boldsymbol{\omega}}_{e}\\ \dot{\boldsymbol{y}}_{2} \end{bmatrix}= \left[\begin{smallmatrix} -(\boldsymbol{J})^{-1}\left(\boldsymbol{K}_{m}-\boldsymbol{S}\left(\boldsymbol{J}\hat{\boldsymbol{\omega}}\right)\right) & -(\boldsymbol{J})^{-1} \boldsymbol{K}_{I}^{\frac{1}{2}} \\ \boldsymbol{K}_{I}^{\frac{1}{2}} & - \boldsymbol{K}_{I}^{-\frac{1}{2}} \dot{\boldsymbol{K}}_{I}^{\frac{1}{2}} \end{smallmatrix}\right]\begin{bmatrix} \boldsymbol{\omega}_{e}\\ \boldsymbol{y}_{2} \end{bmatrix} = \tilde{\boldsymbol{F}} \begin{bmatrix} \boldsymbol{\omega}_{e}\\ \boldsymbol{y}_{2} \end{bmatrix} \thinspace. \label{eq:proof_step6} \end{equation} Clearly, the symmetric part of the matrix $\boldsymbol{\Xi} \tilde{\boldsymbol{F}}$ is negative definite. Therefore, \begin{align} \frac{d}{dt}\left(\delta\boldsymbol{z}^{T} \boldsymbol{\Xi} \delta\boldsymbol{z}\right)&=\delta\boldsymbol{z}^{T} \left( (\boldsymbol{\Xi}\tilde{\boldsymbol{F}}) + (\boldsymbol{\Xi}\tilde{\boldsymbol{F}})^T \right) \delta\boldsymbol{z} \nonumber \\ &\leq 2\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym})\|\delta\boldsymbol{z}\|_{2}^2 \nonumber \\ &\leq \frac{2\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym})}{\lambda_{\max}(\boldsymbol{J})} \left(\delta\boldsymbol{z}^{T} \boldsymbol{\Xi} \delta\boldsymbol{z}\right) \end{align} where $(\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym}=\frac{(\boldsymbol{\Xi} \tilde{\boldsymbol{F}})+(\boldsymbol{\Xi} \tilde{\boldsymbol{F}})^T}{2}$. Also, $\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym}) < 0$ and is bounded as $\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym}) \leq - \min ( \lambda_{\min}(\boldsymbol{K}_{m}), \inf_{t} ( \lambda_{\min}(\boldsymbol{K}_{I}^{-\frac{1}{2}} \dot{\boldsymbol{K}}_{I}^{\frac{1}{2}}) ) )$. Hence, it follows from the contraction analysis that all system trajectories converge exponentially fast to a single trajectory at a rate of $\frac{-\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym})}{\lambda_{\max}(\boldsymbol{J})}$. Moreover, in the presence of bounded $\boldsymbol{d}_{\textrm{res},2}$ and $\dot{\boldsymbol{d}}_{\textrm{res},2}$, we get from Lemma \ref{LM:Robust_contraction_original} that: \begin{align} &\lim_{t \rightarrow \infty} \int_{0}^{\boldsymbol{\omega}_{e}}\|\delta\boldsymbol{\omega}_{e}\|_{2} \nonumber \\ &\leq \frac{\lambda_{\max}(\boldsymbol{J}) \sup_t \lambda_{\max}(\boldsymbol{K}_{I}^{-\frac{1}{2}}) \sup_{t}\| \dot{\boldsymbol{d}}_{\textrm{res},2}\|_{2} }{-\lambda_{\max}((\boldsymbol{\Xi} \tilde{\boldsymbol{F}})_\mathrm{sym}) } \thinspace . \end{align} where $\|\delta\boldsymbol{\omega}_{e}\|_{2}\leq\|\delta\boldsymbol{z}\|_{2}$ and $\lambda_{\min}(\boldsymbol{J})>1$ are used. Also, note that the disturbance term in the righthand side of ~(\ref{eq:proof_step6}) is $(\mathbf{0};\boldsymbol{K}_{I}^{-\frac{1}{2}}\dot{\boldsymbol{d}}_{\textrm{res},2})$. \end{proof} \begin{remark} Note that the second block diagonal matrix of the Jacobin $\boldsymbol{F}$ in ~(\ref{eq:proof_step5}) is $\mathbf{0}$, which usually yields a semi-contracting system with global asymptotic stability. For example, $\boldsymbol{F}$ from ~(\ref{eq:proof_step5}) and $\boldsymbol{\Theta}=\left[\begin{smallmatrix}\boldsymbol{J} & \boldsymbol{0}\\ \boldsymbol{0} & \mathbf{I}\end{smallmatrix}\right]$ results in a semi-contracting system due to $\frac{1}{2}\left((\boldsymbol{\Theta F})+(\boldsymbol{\Theta F})^{T}\right)=\left[\begin{smallmatrix} -\boldsymbol{K}_{m} & \boldsymbol{0}\\ \boldsymbol{0} & \boldsymbol{0} \end{smallmatrix}\right]$. Similarly, the following adaptive control law also yields global asymptotic stability. In contrast, Theorem~\ref{thm:Integral_RNTCL} presents a stronger result with global exponential stability. \end{remark} \subsubsection{Nonlinear Adaptive Control\label{sub:Adaptive-NCL}} It is known that adaptive control can be interpreted as an integral control scheme. Hence, the stability characteristic of an adaptive control version of the proposed ~(\ref{eq:first_RNC_MRP}) is similar to that of the integral control in Section~\ref{sub:Robust-NCL-MRP-Integral}. Let the parameter $\hat{\boldsymbol{a}}$ capture the six uncertain terms in the inertia tensor $\boldsymbol{J}$. The resulting adaptive nonlinear tracking control law and the tuning law are given by: \begin{align} \boldsymbol{u}_c =& \boldsymbol{Y}\hat{\boldsymbol{a}} -\boldsymbol{K}_{r}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r}) \\ \dot{\hat{\boldsymbol{a}}} =&-\boldsymbol{\Gamma}_{r}\textrm{Proj}\left(\hat{\boldsymbol{a}},\boldsymbol{Y}^{T}(\hat{\boldsymbol{\omega}}-\boldsymbol{\omega}_{r})\right) \thinspace,\label{eq:RNC_adaptive} \end{align} where $\boldsymbol{Y}\hat{\boldsymbol{a}}=\skew{4}\hat{\boldsymbol{J}}\dot{\boldsymbol{\omega}}_{r}-\boldsymbol{S}\left(\skew{4}\hat{\boldsymbol{J}}\hat{\boldsymbol{\omega}}\right)\boldsymbol{\omega}_{r}$, $\boldsymbol{\omega}_{r}$ is defined in ~(\ref{eq:first_RNC_MRP}), and $\boldsymbol{\Gamma}_{r}\in\mathbb{R}^{6\times6}$ is a positive-definite diagonal matrix. For some boundary function $f(\boldsymbol{\theta})$ (e.g., $f(\boldsymbol{\theta})=\frac{(\boldsymbol{\theta}^{T}\boldsymbol{\theta}-\theta_{\textrm{max}}^{2})}{\epsilon_{\theta}\theta_{\textrm{max}}^{2}}$ ), the projection operator is given by $ \textrm{Proj}(\boldsymbol{\theta},\boldsymbol{x}) = \boldsymbol{x}-\frac{\nabla f(\boldsymbol{\theta})\nabla f(\boldsymbol{\theta})^{T}}{\|\nabla f(\boldsymbol{\theta})\|^{2}}\boldsymbol{x}f(\boldsymbol{\theta})$ if $f(\boldsymbol{\theta})>0, \thinspace \nabla f(\boldsymbol{\theta})^{T}\boldsymbol{x}>0$; and $\boldsymbol{x}$ otherwise. The proof of global asymptotic stability of using ~(\ref{eq:RNC_adaptive}) for the disturbance-free system is straightforward. The stability result of adaptive control is only globally asymptotic because its closed-loop system of the states $(\boldsymbol{\omega}_{e},\hat{\boldsymbol{a}})^T$ yields a negative semidefinite Jacobian matrix $\left[\begin{smallmatrix}-\boldsymbol{K}_{r} & \mathbf{0}\\ \mathbf{0}& \mathbf{0}\end{smallmatrix}\right]$ (also, see ~(\ref{eq:proof_step5})). However, the use of a projection operator in ~(\ref{eq:RNC_adaptive}) permits Input-to-State Stability (ISS). \subsection{Neural Contraction Metrics as Lyapunov Functions} Since the NCM for feedback control \eqref{controller} can be viewed as a CLF, solving the CLF Quadratic Program (CLFQP) at each time instant for deterministic systems leads to a different perspective on stability of the NCM control. \begin{theorem} \label{Thm:NCMCLF} Let $B=B(x,t)$ and $A=A(\varrho_A,x,x_d,t)$ in \eqref{varrho_def} for notational simplicity. Suppose that the dynamics \eqref{sdc_dynamics} is controlled by $u^*$, where $u^*$ is the solution of the following convex optimization problem for $(x,x_d,t)$: \begin{align} \label{ncm_robust_control0} &\min_{u\in \mathbb{R}^{m}, p \in \mathbb{R}}\|u-u_d\|^2+p^2 \\ \label{stability_clf} &\text{s.t.{} } e^{\top}(\dot{\hat{M}}+2\sym{}(\hat{M}A+\hat{M}K(x,x_d,t)))e \\ &\text{\color{white}s.t.{} } \leq -2\alpha e^{\top}\hat{M}e+p. \end{align} where $\hat{M}$ is the control NCM of Definition~\ref{Def:NCM}, $\beta$ is as defined in Theorem~\ref{Thm:CVSTEM:LMI}, and $e=x-x_d$. Then the problem \eqref{ncm_robust_control0} to minimize the deviation of $u$ from $u_d$ under the stability constraint \eqref{stability_clf} is always feasible, i.e.{} Theorem~\ref{Thm:Robust_contraction_original} holds for the virtual system \eqref{closed_loop_e} with an additional steady-state error term $\sup_{x,x_d,t}|p|/(2\alpha)$. Furthermore, when the NCM perfectly models the CV-STEM solution of Theorem~\ref{Thm:CV-STEM}, \eqref{ncm_robust_control0} with $p=0$ is feasible. \end{theorem} \begin{proof} Computing $\dot{V}$ for $V=e^{\top}\hat{M}e$ yields $\dot{V} \leq -2\alpha V+p$ for systems without any perturbation. Thus, the comparison lemma~\cite[pp. 211]{Khalil:1173048} gives exponential boundedness of $\|x-x_d\|$ as in \eqref{Eq:Robust_contraction21} of Theorem~\ref{Thm:Robust_contraction_original}, with an additional steady-state error term $\sup_{x,x_d,t}|p|/(2\alpha)$. Also, when the NCM perfectly models the CV-STEM solution of Theorem~\ref{Thm:CV-STEM}, the controller \eqref{controller} is feasible for \eqref{ncm_robust_control0} by construction. Therefore, the problem with $p=0$ in \eqref{ncm_robust_control0} is feasible in this case. \end{proof} Since stochastic contraction originates from the differential system given as \eqref{closed_loop_e_sto}, it is natural to consider the differential Lyapunov function $\delta q^{\top}M\delta q$ as a CLF unlike Theorem~\ref{Thm:NCMCLF}. Let us recall that designing optimal $k$ of $u = k(x,x_d,t)$ reduces to designing optimal $K(x,x_d,t)$ of $u=u_d(x_d,t)+K(x,x_d,t)(x-x_d)$ due to Lemma~\ref{u_equivalence_lemma} of Sec.~\ref{sec:HinfKYP}. For such $u$, the virtual system of \eqref{original_dynamics} and \eqref{sdc_dynamicsd} without any perturbation, which has $q=x,x_d$ as its particular solutions, is given as follows: \begin{align} \label{virtual_dynamics_clf} \dot{q} = \dot{x}_d+(A(\varrho_A,x_d,t)+B(x,t)K(x,x_d,t))(q-x_d) \end{align} where $A$ is the State-Dependent Coefficient (SDC) form of the dynamical system \eqref{original_dynamics} given by Lemma~\ref{sdclemma}, i.e.{}, $A(x,x_d,t)(x-x_d) = f(x,t)+B(x,t)u_d-f(x_d,t)-B(x_d,t)u_d$. \begin{theorem} \label{ncm_clf_thm} Consider the NCM in Definition~\ref{Def:NCM} which perfectly models the CV-STEM of Theorem~\ref{Thm:CV-STEM}. Suppose that $f$ and $B$ are piecewise continuously differentiable, and let $B=B(x,t)$ and $A=A(\varrho_A,x,x_d,t)$ in \eqref{virtual_dynamics_clf} for notational simplicity. Suppose also that the dynamics \eqref{control_dynamics} is controlled by $u = u_d+K^*(x,x_d,t)e$, where $e=x-x_d$ and $K^*$ is given by the following convex optimization-based controller for $(x,x_d,t)$: \begin{align} \label{ncm_robust_control} &K^* = {\rm arg}\min_{K\in \mathbb{R}^{m\times n}}\|u-u_d\|^2 = {\rm arg}\min_{K\in \mathbb{R}^{m\times n}}\|K(x,x_d,t)e\|^2 \\ \label{stability_clf} &\text{s.t.{} } \dot{M}+2\sym{}(MA+MK(x,x_d,t)) \leq -2\alpha M+\beta I \end{align} where $M$ is the perfectly-modeled NCM and $\beta$ is as defined in theorem~\ref{Thm:CVSTEM:LMI}. Then \eqref{ncm_robust_control} is always feasible, i.e.{}, Theorems~\ref{Thm:Robust_contraction_original}~and~\ref{Thm:robuststochastic} hold for the differential CLF $V=\delta q^{\top}M\delta q$ for $q$ in \eqref{virtual_dynamics_clf}, and $K^*$ minimizes the deviation of $u$ from $u_d$ under the stability constraint \eqref{stability_clf}. \end{theorem} \begin{proof} Computing $\dot{V}$ for $V=\delta q^{\top}M\delta q$ and $\mathscr{L}V_{s\ell}$ for $V_{s\ell}$ of \eqref{eq:VSL} along with \eqref{virtual_dynamics_clf} gives the exponential boundedness results of Theorems~\ref{Thm:Robust_contraction_original}~and~\ref{Thm:robuststochastic} (see~\cite{lagros}). Also, since $K = -R^{-1}B^{\top}M$ is a feasible solution to \eqref{ncm_robust_control} for a perfectly-modeled NCM due to Theorem~\ref{Thm:CV-STEM}, \eqref{ncm_robust_control} is always feasible. \qed \end{proof} \begin{remark} For the CV-STEM and NCM state estimation in Theorems~\ref{Thm:CV-STEM-estimation} and \ref{Thm:NCMstability}, we could exploit a similar CLF-based estimation scheme when its contraction constraints of Theorem~\ref{Thm:CV-STEM-estimation} do not explicitly depend on the actual state $x$. This can be achieved by using $A(\varrho_A,\hat{x},t)$ and $C(\varrho_C,\hat{x},t)$ instead of $A(\varrho_A,x,\hat{x},t)$ and $C(\varrho_C,x,\hat{x},t)$ in \eqref{convex_constraint_estimator1} as in~\cite{Ref:Stochastic}, leading to local stability results. \end{remark} \subsection{Contraction Theory and Gradient Descent} Most of the learning-based and data-driven techniques involving neural networks are based on optimizing their hyperparameters by gradient descent. In fact, contraction theory provides a generalized view on the analysis of such continuous-time gradient-based optimization algorithms as a result of the following theorem~\cite{beyondconvexity}. \begin{theorem} \label{Thm:beyondconvexity} Consider a twice differentiable scalar output function $f:\mathbb{R}^n\times\mathbb{R}\mapsto\mathbb{R}$, a matrix-valued function $M:\mathbb{R}^n\mapsto\mathbb{R}^{n\times n}$ with $M(x)\succ0,~\forall x\in\mathbb{R}^n$, and the following natural gradient system~\cite{doi:10.1162/089976698300017746}: \begin{align} \label{eq_natural_grad} \dot{x} = h(x,t) = -M(x)^{-1}\nabla_x f(x,t). \end{align} Then, $f$ is geodesically $\alpha$-strongly convex for each $t$ in the metric defined by $M(x)$ (i.e.{}, $H(x)\succeq \alpha M(x)$ with $H(x)$ being the Riemannian Hessian matrix of $f$ with respect to $M$~\cite{gconvex}), if and only if \eqref{eq_natural_grad} is contracting with rate $\alpha$ in the metric defined by $M$, {\color{caltechgreen}i.e.{}, \begin{align} \dot{M}+MA+A^{\top}M \preceq -2\alpha M \end{align} as introduced in \eqref{eq_MdotContracting} of Theorem~\ref{Thm:contraction}, where $A = {\partial h}/{\partial x}$.} More specifically, the Riemannian Hessian verifies $H(x) = -(\dot{M}+MA+A^{\top}M)/2$. In particular, $f$ is $\alpha$-strongly convex, i.e.{}, $\nabla^2f(x) \succeq \alpha \mathrm{I}$, if and only if \eqref{eq_natural_grad} is contracting with rate $\alpha$ in the metric $\mathrm{I}$. \end{theorem} \begin{proof} See Theorem 1 of~\cite{beyondconvexity}. \qed \end{proof} It is also shown in Proposition 3 of~\cite{beyondconvexity} that if \eqref{eq_natural_grad} is semi-contracting in some metric and one of the system trajectories is known to be bounded, then \setlength{\leftmargini}{17pt} \begin{enumerate}[label=\arabic*)] \setlength{\itemsep}{1pt} \setlength{\parskip}{0pt} \item $f$ has at least one stationary point. \item any local minimum of $f$ is a global minimum. \item all global minima of $f$ are path-connected. \item all trajectories asymptotically converge to a global minimum of $f$. \end{enumerate} which implies that most theoretical results of gradient descent algorithms based on convexity can be replaced by more general ones based on contraction and geodesical convexity of Theorem~\ref{Thm:beyondconvexity}. For example, as described in Theorem~\ref{Thm:beyondconvexity}, gradient descent converges to a unique equilibrium if its dynamics are contracting in any metric, with the convexity of the cost corresponding to the special case of contraction in the identity metric. \fi \section{Learning-based Adaptive Control} \label{Sec:adaptive} \textcolor{red}{SJC to do: connection to learning and hierarchical connections} In this section, we consider the following nonlinear system with an uncertain parameter $\theta\in\mathbb{R}^{c}$: \begin{align} \label{adaptive_general} \dot{x} = f(x,\theta)+B(x,\theta)u,~\dot{x}_d = f(x_d,\theta)+B(x_d,\theta)u_d \end{align} where $x$, $u$, $f$, and $B$ are as defined in \eqref{original_dynamics} and \eqref{sdc_dynamicsd}. Due to Theorems~\ref{Thm:Robust_contraction_original} and \ref{Thm:contraction_learning}, we can see that the robust control techniques presented earlier (\eqref{controller} of Theorem~\ref{Thm:CV-STEM}, $u$ of Theorem~\ref{Thm:ccm_cvstem}, or \eqref{ncm_robust_control} of Theorem~\ref{Thm:ncm_clf}) are still useful in this case if the modeling errors $\|f(x,\theta)-f(x,\theta_n)\|$ and $\|B(x,\theta)-B(x,\theta_n)\|$ are bounded, where $\theta_n$ is a nominal guess of the true parameter $\theta$. However, there are situations where such assumptions are not necessarily true. The section aims to further improve the performance of robust control by adaptively updating the estimate of $\theta$, thereby enabling nonlinear stabilization of these general parametric uncertain systems. In fact, learning-based adaptive control to be introduced in Theorem~\ref{adaptiveNCMthm} is not intended to supersede but to be utilized on top of existing robust control techniques, including Theorems~\ref{Thm:NCMstability_modelfree} and \ref{Thm:neurallander} for model-free systems, and Theorems~\ref{Thm:NCMstability1}, \ref{Thm:NCMstability2}, \ref{Thm:ncm_clf}, and \ref{Thm:lagros_stability} for model-based systems, for the sake of their real-time implementation. Although we consider a continuous-time dynamical systems in this section, discrete changes could be incorporated in this framework, e.g.{}, using adaptive control schemes for switched systems~\cite{1469901}. Also, as shall be shown in Theorem~\ref{ccm_adaptive_affine_thm}, the techniques introduced in~\cite{ancm} and in this section can be used with differential state feedback frameworks~\cite{ccm,7989693,47710,WANG201944,vccm,rccm}, trading off added computational cost for generality (see Table~\ref{tab:sdcccm_summary}). \if0 As an illustrative example, let us consider the spacecraft attitude dynamics, $J(\theta)\dot{\omega}=(J(\theta)\omega)\times \omega+B u$, which has uncertainty in its inertial tensor $J$, where $\omega\in\mathbb{R}^3$ is the angular velocity and $\theta\in\mathbb{R}^6$ is the uncertain parameter. Note that we know $\theta$ acts affinely on the dynamics, i.e.{}, $\exists Y$ s.t.{} $Y \theta = (J(\theta)\omega_r)\times \omega_r$ for a reference signal $\omega_r$~\cite{Ref:NonlinearAttitude}. Adaptive control for this system is given by the following integral control scheme: \begin{align} u =& -{K}_{r}(\omega-{\omega}_{r})+{Y}\hat{\theta} \label{eq:RNC_adaptive_con} \\ \dot{\hat{\theta}} =&-{\Gamma}_{r}\textrm{Proj}(\hat{\theta},{Y}^{T}(\omega-{\omega}_{r})) \label{eq:RNC_adaptive} \end{align} where $K_{r},{\Gamma}_{r}\succ 0$ and $\textrm{Proj}({c},{c'}) = {c'}-(\nabla \varphi({c})\nabla \varphi({c})^{T}/\|\nabla \varphi({c})\|^{2}){c'}\varphi({c})$ if $\varphi({c}),\nabla \varphi({c})^{T}{c'}>0$, and $\textrm{Proj}({c},{c'})={c'}$ otherwise, for some boundary function $\varphi({c})$ (e.g., $\varphi({c})=({c}^{T}{c}-c_{\textrm{max}}^{2})/(\varepsilon_{c}c_{\textrm{max}}^{2})$ with $\varepsilon_{c} > 0$). The controller \eqref{eq:RNC_adaptive_con} can be viewed as a nominal stabilizing controller $-{K}_{r}(\omega-{\omega}_{r})$ augmented with ${Y}\hat{\theta}$ to account for parametric uncertainty. It can be shown that the closed-loop system with \eqref{eq:RNC_adaptive_con} and \eqref{eq:RNC_adaptive} is asymptotically stable by using a Lyapunov function of the form $V=(\omega-\omega_r)^{\top}J(\omega-\omega_r)+(\hat{\theta}-\theta)^{\top}\Gamma_r^{-1}(\hat{\theta}-\theta)$, which implies that $\text{diag}(J,\Gamma_r^{-1})$ is a contraction metric for this system. We remark that the stability is globally asymptotic as its closed-loop system of the states $[(\omega-\omega_r)^{\top},(\hat{\theta}-\theta)^{\top}]^{\top}$ yields a negative semi-definite Jacobian matrix $\left[\begin{smallmatrix}-{K}_{r} & {0}\\ {0}& {0}\end{smallmatrix}\right]$ in general for any Lagrangian systems~\cite[pp. 392]{Ref:Slotine}, although the use of a projection operator in~\eqref{eq:RNC_adaptive} leads to ISS. \fi \subsection{Adaptive Control with CV-STEM and NCM} \label{sec:matched_uncertainty} Let us start from the case where we can augment nominal robust control of Theorems~\ref{Thm:CV-STEM}, \ref{Thm:ccm_cvstem}, or \ref{Thm:ncm_clf} with contraction theory-based adaptive control techniques~\cite{9109296,lopez2021universal,ancm}. In this section, we assume the following. \begin{assumption} \label{Asmp:affine} The actuation matrix $B$ in \eqref{adaptive_general} does not depend on $\theta$, and $\exists \Delta(x) \in \mathbb{R}^{{c}\times n}$ s.t.{} $\Delta(x)^{\top}\vartheta = f(x,\theta_n)-f(x,\theta)$, where $\vartheta=\theta_n-\theta$ and $\theta_n$ is a nominal guess of the uncertain parameter $\theta$. \end{assumption} Under Assumption~\ref{Asmp:affine}, we can write \eqref{adaptive_general} as $\dot{x}=f(x,\theta_n)+B(x)u-\Delta(x)^{\top}\vartheta$, leading to the following theorem~\cite{ancm}. \begin{theorem} \label{adaptive_affine_thm} Suppose that Assumption~\ref{Asmp:affine} holds and that $M$ of Theorem~\ref{Thm:CV-STEM} for the nominal system \eqref{adaptive_general} with $\theta$ replaced by $\theta_n$ is constructed with an additional convex constraint, $\partial_{b_i(x)}\bar{W}+\partial_{b_i(x_d)}\bar{W}=0$, where $\partial_{b_i(q)}\bar{W}=\sum_{i}(\partial \bar{W}/\partial q_i)b_i(q)$ for $B=[b_1,\cdots,b_m]$~\cite{ccm,9109296}. If the matched uncertainty condition holds, i.e.{} $(\Delta(x)-\Delta(x_d))^{\top}\vartheta \in \textrm{span}(B(x))$ for $\Delta(x)$, then the following adaptive control law guarantees asymptotic stability of \eqref{adaptive_general}: \begin{align} \label{affine_adaptive_u} u =& u_{\mathrm{cvstem}}+\varphi(x,x_d)^{\top} \hat{\vartheta} \\ \label{affine_adaptation} \dot{\hat{\vartheta}} =& -\Gamma \varphi(x,x_d)B(x)^{\top}M(x,x_d)(x-x_d) \end{align} where $u_{\rm cvstem}$ is given by \eqref{controller} of Theorem~\ref{Thm:CV-STEM} for the nominal system \eqref{adaptive_general} with $\theta=\theta_n$, $\Gamma \in \mathbb{R}^{{c}\times {c}}$ is a diagonal matrix with positive elements that governs the rate of adaptation, and $(\Delta(x)-\Delta(x_d))^{\top}\vartheta=B(x)\varphi(x,x_d)^{\top}\vartheta$. \end{theorem} \begin{proof} For $u$ given by \eqref{affine_adaptive_u}, the virtual system which has $q = [q_x^{\top},q_{\vartheta}^{\top}]^{\top}=[x^{\top},\hat{\vartheta}^{\top}]^{\top}$ and $[q_x^{\top},q_{\vartheta}^{\top}]^{\top}=[x_d^{\top},\vartheta^{\top}]^{\top}$ as its particular solutions are given as follows: \begin{align} \label{virtual_adaptive} \dot{q} = \begin{bmatrix}\zeta(q_x,t)+B(x)\varphi(x,x_d)^{\top} q_{\vartheta}-\Delta(x)^{\top}\vartheta \\ -\Gamma \varphi(x,x_d)B(x)^{\top}M(x,x_d)(q_x-x_d) \end{bmatrix} \end{align} where $\zeta$ is as given in \eqref{Eq:virtual_sys_sto}. Since $\dot{q}_x=\zeta(q_x,t)$ is contracting due to Theorem~\ref{Thm:CV-STEM}, we have for a Lyapunov function $V = \delta q_x^{\top}M\delta q_x+\delta q_{\vartheta}^{\top}\Gamma^{-1}\delta q_{\vartheta}$ that \begin{equation} \dot{V}\leq -2\alpha \delta q_x^{\top}M\delta q_x+2\delta q_x^{\top}MB\varphi^{\top}\delta q_{\vartheta}-2\delta q_{\vartheta}^{\top} \varphi B^{\top}M\delta q_x \end{equation} which implies $\dot{V}\leq -2\alpha \delta q_x^{\top}M\delta q_x$ due to $M=M^{\top}$. The rest follows from Theorem 2 of~\cite{ancm}. \qed \end{proof} Theorem~\ref{adaptive_affine_thm} can be generalized to the differential feedback control framework of Theorem~\ref{Thm:ccm_cvstem} as follows~\cite{9109296}. \begin{theorem} \label{ccm_adaptive_affine_thm} Suppose that Assumption~\ref{Asmp:affine} holds and that the contraction metric $M$ given by Theorem~\ref{Thm:ccm_cvstem} for the nominal system \eqref{adaptive_general} with $\theta$ replaced by $\theta_n$. If the matched uncertainty condition holds, i.e.{} $\Delta(x)^{\top}\vartheta \in \textrm{span}(B(x))$, then the following adaptive control law guarantees asymptotic stability of \eqref{adaptive_general}: \begin{align} \label{adaptive_ccm} u =& u_{\rm ccm}+\varphi(x)^T\hat{\vartheta} \\ \label{adaptation_law} \dot{\hat{\vartheta}} =& -\Gamma \varphi(x)B(x)^TM(\gamma(1))\gamma_s(1). \end{align} where $u_{\rm ccm}$ is given by $u$ of Theorem~\ref{Thm:ccm_cvstem} for the nominal system \eqref{adaptive_general} with $\theta_n$, $\gamma(s)$ is a minimizing geodesic, $\Gamma \in \mathbb{R}^{{c}\times {c}}$ is a diagonal matrix with positive elements that governs the rate of adaptation, and $\Delta(x)^{\top}\vartheta=B(x)\varphi(x)^{\top}\vartheta$. \end{theorem} \begin{proof} Since $u = u_{\rm ccm}$ renders the nominal system \eqref{adaptive_general} with $\theta_n$ contracting as proved in Theorem~\ref{Thm:ccm_cvstem}, an analogous analysis to the proof of Theorem~\ref{adaptive_affine_thm} with the virtual system as in \eqref{virtual_adaptive} gives the desired result (see~\cite{9109296} for details). \qed \end{proof} Since the stability results of Theorems~\ref{adaptive_affine_thm} and \ref{ccm_adaptive_affine_thm} are based on contraction theory, robustness properties could also be easily incorporated using Theorem~\ref{Thm:Robust_contraction_original}. This fact allows using the NCM of Definition~\ref{Def:NCM} for adaptive control~\cite{ancm}. \begin{theorem} \label{Thm:adaptive_robust_affine} Suppose that Assumption~\ref{Asmp:affine} holds and let $\mathcal{M}$ be the NCM of Definition~\ref{Def:NCM}, which models the contraction metric $M$ of Theorem~\ref{adaptive_affine_thm}. Suppose also that the matched uncertainty condition~\cite{9109296} holds and that \eqref{adaptive_general} is controlled by the following adaptive control law: \begin{align} \label{affine_adaptive_u_ncm} u =& u_{\mathrm{ncm}}+\varphi(x,x_d)^{\top} \hat{\vartheta} \\ \label{affine_adaptation_ncm} \dot{\hat{\vartheta}} =& -\Gamma (\varphi(x,x_d)B(x)^{\top}\mathcal{M}(x,x_d)(x-x_d)+\sigma \hat{\vartheta}) \end{align} where $u_{\mathrm{ncm}}$ is given by \eqref{controller} with $M$ replaced by $\mathcal{M}$, and the other variables are as defined in \eqref{affine_adaptive_u} and \eqref{affine_adaptation}. If $\exists \underline{\gamma},\overline{\gamma},\bar{b},\bar{\rho},\bar{\phi},\bar{\theta} \in (0,\infty)$ s.t.{} $\underline{\gamma} I_p \preceq \Gamma \preceq \overline{\gamma}I_p$, $\|B(x)\| \leq \bar{b}$, $\|R^{-1}(x,x_d)\| \leq \bar{\rho}$, $\|\varphi(x,x_d)\| \leq \bar{\phi},\forall x,x_d$, and $\|\vartheta\| \leq \bar{\vartheta}$, and if $\Gamma$ and $\sigma$ of \eqref{affine_adaptation_ncm} are selected to satisfy the following relation for the learning error $\|\mathcal{M}-M\| \leq \epsilon_{\ell}$ of Theorem~\ref{Thm:NCMstability2}: \begin{align} \label{condition_mNCM} \begin{bmatrix} -2\alpha_{\mathrm{NCM}}\underline{m} & \bar{\phi}\bar{b}\epsilon_{\ell} \\ \bar{\phi}\bar{b}\epsilon_{\ell} & -2\sigma \end{bmatrix} \preceq -2 \alpha_{a}\begin{bmatrix} \overline{m} & 0 \\ 0 & 1/\underline{\gamma} \end{bmatrix} \end{align} for $\exists \alpha_{a} \in (0,\infty)$, where $\alpha_{\mathrm{NCM}}$ is given in \eqref{alpha_ncm_control}, and $\underline{m}$ and $\overline{m}$ are given in \eqref{Mcon}, we have the following bound: \begin{align} \label{adaptive_bound_1} \|\mathtt{e}(t)\| \leq (V_{\ell}(0)e^{-\alpha_a t}+\alpha_a^{-1}\bar{d}_{a}(1-e^{-\alpha_a t}))/\sqrt{\underline{m}} \end{align} where $\mathtt{e}=x-x_d$, $V_{\ell}$ is defined in \eqref{eq:VL} with $M$ replaced by $\mathrm{diag}(M,\Gamma^{-1})$ for $\xi_1=[x^{\top},\hat{\vartheta}^{\top}]^{\top}$ and $\xi_2=[x_d^{\top},\vartheta^{\top}]^{\top}$, and $\bar{d}_{a} = \sigma\sqrt{\overline{\gamma}}\bar{\vartheta}$. \end{theorem} \begin{proof} The virtual system of $q_x$ remains the same as \eqref{virtual_adaptive} with $M=\mathcal{M}$, and that of $q_{\vartheta}$ can now be expressed as \begin{align} \dot{q}_{\vartheta}=-\Gamma (\varphi B^{\top}\mathcal{M}(q_x-x_d)+\sigma(q_{\vartheta}-\vartheta)+d_q(\mu,\vartheta)) \end{align} where $d_q(\mu,\vartheta) = -\mu\sigma\vartheta$ for $q(\mu = 1,t) = [x^{\top},\hat{\vartheta}^{\top}]^{\top}$ and $q(\mu=0,t)=[x_d^{\top},\vartheta^{\top}]^{\top}$ with $\mu\in[0,1]$. Thus, following the proof of Theorem~\ref{adaptive_affine_thm} along with the result of Theorem~\ref{Thm:NCMstability2} yields \begin{align} \dot{V}/2 \leq& -\alpha_{\rm NCM}\delta q_x^{\top}M\delta q_x+\delta q_x^{\top}(M-\mathcal{M})B\varphi^{\top}\delta q_{\vartheta} \\ &-\sigma\|\delta q_{\vartheta}\|^2+\delta q_{\vartheta}^{\top}\delta d_{q} \nonumber \end{align} where $V = \delta q_x^{\top}M\delta q_x+\delta q_{\vartheta}^{\top}\Gamma^{-1}\delta q_{\vartheta}$. Applying $\|\mathcal{M}-M\| \leq \epsilon_{\ell}$ and \eqref{condition_mNCM}, we get \begin{align} &\dot{V}/2-\delta q_{\vartheta}^{\top}\delta d_{q} \leq -(\alpha_{\mathrm{NCM}}\underline{m})\|\delta q_x\|^2+\bar{\phi}\bar{b}\epsilon_{\ell}\|\delta q_x\|\|\delta q_{\vartheta}\| \\ &-\sigma\|\delta q_{\vartheta}\|^2 \leq -\alpha_{a}(\|\delta q_x\|^2/\underline{\omega}+\|\delta q_{\vartheta}\|^2/\underline{\gamma}) \leq -\alpha_{a}V. \end{align} Since we have $\|\partial d_q/\partial \mu\| = \sigma\bar{\vartheta}$, this implies $\dot{V}_{\ell} \leq -\alpha_a V_{\ell}+\bar{d}_a$ for $V_{\ell}$ and $\bar{d}_a$ given in \eqref{adaptive_bound_1}. The rest follows from Theorem~\ref{Thm:Robust_contraction_original}~\cite{ancm}. \qed \end{proof} Since the adaptation law \eqref{affine_adaptation_ncm} yields an explicit bound on the steady-state error as in \eqref{adaptive_bound_1}, it could be used as the objective function of the CV-STEM in \eqref{cvstem_eq}, regarding $\Gamma$ and $\sigma$ as decision variables, to get $M$ optimal in a sense different from Theorem~\ref{Thm:CV-STEM}. Smaller $\epsilon_{\ell}$ would lead to a weaker condition on them in \eqref{condition_mNCM}. Also, the size of $\|\vartheta\| \leq \bar{\vartheta}$ in \eqref{adaptive_bound_1} can be adjusted simply by rescaling it (e.g.{}, $\vartheta\to\theta/\bar{\vartheta}$). However, one drawback is that we have $\lim_{t\to\infty}\|\hat{\theta}(t)\| = 0$, leading to the trade-offs in different types of adaptation laws summarized in Table~\ref{tab:adaptation_summary}. \begin{table*}[htbp] \caption{Different types of adaptation laws. \label{tab:adaptation_summary}} \footnotesize \begin{center} \renewcommand{\arraystretch}{1.2} \begin{tabular}{ |l|l|l| } \hline & Stability and robustness & Property of $\hat{\vartheta}(t)$ \\ \hline \hline Standard adaptation~\eqref{affine_adaptation} & Asymptotically stable and not robust & None \\ \hline Sigma modification~\eqref{affine_adaptation_ncm} & Exponentially bounded and robust & $\lim_{t\infty}\|\hat{\theta}(t)\|=0$ \\ \hline \eqref{affine_adaptation} with projection operator~\cite{1576865} & Asymptotically stable and robust & Bounded \\ \hline \end{tabular} \end{center} \end{table*} \renewcommand{\arraystretch}{1.0} \begin{remark} Although Theorems~\ref{adaptive_affine_thm}--\ref{Thm:adaptive_robust_affine} are for the case where $f(x)$ is affine in its parameter, they are also useful for the following types of systems, e.g.{}, Lagrangian systems in robotics~\cite[pp. 392]{Ref:Slotine}, with an uncertain parameter $\theta\in\mathbb{R}^{c}$ and a control input $u$: \begin{align} \label{lagrangian_dynamics} H(x){p}^{(n)}+h(x)+\Delta (x)\theta=u \end{align} where ${p}\in \mathbb{R}^n$, $u\in \mathbb{R}^n$, $h:\mathbb{R}^{n}\mapsto \mathbb{R}^{n}$, $H:\mathbb{R}^{n}\mapsto \mathbb{R}^{n\times n}$, $\Delta:\mathbb{R}^{n}\mapsto \mathbb{R}^{n\times {c}}$, $x=[({p}^{(n-2)})^{\top},\cdots,({p})^{\top}]^{\top}$, and ${p}^{(k)}$ denotes the $k$th time derivative of ${p}$. In particular, adaptive sliding control~\cite{adaptive_sliding} designs $u$ as follows: \begin{align} \label{sliding_control} u = u^*-H(x){p}_r^{(n)}+\Delta (x)\hat{\theta} \end{align} resulting in the closed-loop dynamics \begin{align} \label{lagrangian_dynamics_closed} H(x)\dot{s}+h(x)+\Delta (x)\tilde{\theta}=u^* \end{align} where $s = {p}^{(n-1)}-{p}_r^{(n-1)}$, ${p}_r^{(n-1)} = p_d^{(n-1)}-\lambda_{n-2}\mathtt{e}^{(n-2)}-\cdots-\lambda_0\mathtt{e}$, $\mathtt{e}=p-p_d$, $p_d$ is a target trajectory, and $\kappa^{n-1}+\lambda_{n-2}\kappa^{n-2}+\cdots+\lambda_0$ is a stable (Hurwitz) polynomial in the Laplace variable $\kappa$. Designing $u^*$ as $u^*=-Ks,~K\succ 0$ with an appropriate adaptation law renders $s \to 0$, and the hierarchical combination property~\cite{Ref:contraction2,Ref:contraction5} of contraction guarantees $q\to q_d$~\cite[pp. 352]{Ref:Slotine} due to the Hurwitz property. Analogously, we could design $u^*$ of \eqref{sliding_control} using the contraction theory-based control of Theorems~\ref{Thm:CV-STEM} and \ref{Thm:ccm_cvstem}, i.e.{}, $u_{\rm cvstem}$ and $u_{\rm ccm}$ of Theorems~\ref{adaptive_affine_thm} and \ref{ccm_adaptive_affine_thm}, to asymptotically stabilize \eqref{lagrangian_dynamics_closed} with the CV-STEM optimality~\cite{ancm}. \end{remark} \if0 \begin{theorem} Suppose that $H(x)$ is non-singular for all $x$, and let $M(x)$ be the CV-STEM contraction metric for the virtual dynamical system $\dot{q}=-H(x)^{-1}h(x)-H(x)^{-1}K(x)q$, which has $q=s,0$ as its particular solutions when \eqref{lagrangian_dynamics} is controlled by \eqref{sliding_control} with $u^*=-K(x)s$ for $K$ in \eqref{controller}. Suppose also that $M$ satisfies $\partial_{b_i(x)}M=0$ for $\partial_{v(q)}M=\sum_{i}(\partial M/\partial q_i)v_i$ and $B(x)=H(x)^{-1}=[b_1,\cdots,b_m]$ as in Theorems~\ref{adaptive_affine_thm} and \ref{ccm_adaptive_affine_thm}. If we design $u$ of \eqref{sliding_control} using the CV-STEM control $u^*=-K(x)s$ with the following adaptation law: \begin{align} \label{sliding_adaptation} \dot{\hat{\theta}} = -\Gamma\Delta (s)^{\top}H(s)^{-\top}s \end{align} then $s$ of (\ref{lagrangian_dynamics}) asymptotically converges to $0$, and thus $p$ of \eqref{lagrangian_dynamics} converges to $p_d$. \end{theorem} \begin{proof} For $u$ given by \eqref{sliding_control} with the CV-STEM $u^*$ and adaptation \eqref{sliding_adaptation}, the virtual system which has $q = [q_x^{\top},q_{\theta}^{\top}]^{\top}=[s,\hat{\theta}^{\top}]^{\top}$ and $[q_x^{\top},q_{\vartheta}^{\top}]^{\top}=[0^{\top},\theta^{\top}]^{\top}$ as its particular solutions are given as follows: \begin{align} \label{virtual_adaptive} \dot{q} = \begin{bmatrix}-H(x)^{-1}h(x)-H(x)^{-1}K(x)q_x+H(s)^{-1}\Delta (x)(q_{\vartheta}-\theta) \\ -\Gamma\Delta (s)^{\top}H(s)^{-\top}q_x \end{bmatrix} \end{align} \end{proof} In particular, the contraction theory-based frameworks, equipped with the concept of adaptive sliding control~\cite{adaptive_sliding}, can be used for asymptotic stabilization of \eqref{lagrangian_dynamics} to its target trajectory $p_d \mathbb{R}^n$ due to the following theorem~\cite{ancm}. \begin{theorem} Suppose that $H(x)$ is non-singular for all $x$. Let $s = {p}^{(n-1)}-{p}_r^{(n-1)}$, ${p}_r^{(n-1)} = p_d^{(n-1)}-\lambda_{n-2}\mathtt{e}^{(n-2)}-\cdots-\lambda_0\mathtt{e}$, $\mathtt{e}=p-p_d$, $\kappa^{n-1}+\lambda_{n-2}\kappa^{n-2}+\cdots+\lambda_0$ is a stable (Hurwitz) polynomial in hte Laplace variable $\kappa$, and $M(x)$ be the CV-STEM contraction metric for the virtual dynamical system $\dot{q}=-H(x)^{-1}h(x)+H(x)^{-1}K(x)q$, where $y=$ given by Theorem~\ref{Thm:CV-STEM} which satisfies $\partial_{b_i(x)}M=0$ for $\partial_{v(q)}M=\sum_{i}(\partial M/\partial q_i)v_i$ and $B(x)=H(x)^{-1}=[b_1,\cdots,b_m]$. If we design $u$ as \begin{align} \label{lagrange_control} u = u_{\rm cvstem}+\Delta (x)\hat{\theta},~\dot{\hat{\theta}} = -\Gamma\Delta (s)^{\top}H(s)^{-\top}Ms \end{align} where $R(s)\succ0$ is a given weight matrix on $\tau$, and if there exists a bounded and Lipschitz function $\gamma(x,x_d)>0$ which satisfies (\ref{deterministic_contraction_tilde}) with equality when $\alpha$ is replaced by $\gamma(x,x_d)$, then $s$ of (\ref{lagrangian_dynamics}) asymptotically converges to $0$. \end{theorem} \begin{align} u = u_{\rm cvstem}+H(x){p}_r^{(n)}+\Delta (x)\hat{\theta}, \end{align} where $R(s)\succ0$ is a given weight matrix on $\tau$, As an illustrative example, let us consider the following nonlinear system~\cite[pp. 350]{Ref:Slotine}: where $H:\mathbb{R}^n\mapsto \mathbb{R}^{n \times n}$, $s$. We can show that the following based on the concept of adaptive sliding control~\cite{adaptive_sliding} We have thus far examined the case where $f(x)$ is affine in its parameter, but the techniques discussed above is also useful for the following types of systems, e.g.{} Lagrangian systems in robotics~\cite[pp. 392]{Ref:Slotine}, with an uncertain parameter $\theta\in\mathbb{R}^{(c)}$ and a control input $u$: \begin{align} \label{lagrangian_dynamics} H(x){p}^{(n)}+h(x)+\Delta (x)\theta=u,~\dot{\hat{\theta}} = -\Gamma\Delta (s)^{\top}H(s)^{-\top}Ms \end{align} where ${p}\in \mathbb{R}^n$, $u\in \mathbb{R}^n$, $h:\mathbb{R}^{n}\mapsto \mathbb{R}^{n}$, $H:\mathbb{R}^{n}\mapsto \mathbb{R}^{n\times n}$, $\Delta:\mathbb{R}^{n}\mapsto \mathbb{R}^{n\times {c}}$, $x=[{p}^{(n-2)}^{\top},\cdots,{p}]^{\top}$, and ${p}^{(k)}$ denotes the $k$th time derivative of ${p}$. The contraction theory-based frameworks, equipped with the concept of adaptive sliding control~\cite{adaptive_sliding}, can be used for asymptotic stabilization of \eqref{lagrangian_dynamics} to its target trajectory $p_d \mathbb{R}^n$ due to the following theorem~\cite{ancm}. \begin{theorem} Suppose that $H(x)$ is non-singular for all $x$. Let $M(x)$ be the CV-STEM contraction metric for the dynamical system $\dot{x}=-H(x)^{-1}h(x)+H(x)^{-1}u$ given by Theorem~\ref{Thm:CV-STEM} which satisfies $\partial_{b_i(x)}M=0$ for $\partial_{v(q)}M=\sum_{i}(\partial M/\partial q_i)v_i$ and $B(x)=H(x)^{-1}=[b_1,\cdots,b_m]$. If we design $u$ as \begin{align} \label{lagrange_control} u = u_{\rm cvstem}+\Delta (x)\hat{\theta},~\dot{\hat{\theta}} = -\Gamma\Delta (s)^{\top}H(s)^{-\top}Ms \end{align} where $R(s)\succ0$ is a given weight matrix on $\tau$, and if there exists a bounded and Lipschitz function $\gamma(x,x_d)>0$ which satisfies (\ref{deterministic_contraction_tilde}) with equality when $\alpha$ is replaced by $\gamma(x,x_d)$, then $s$ of (\ref{lagrangian_dynamics}) asymptotically converges to $0$. \end{theorem} and $H(s)$ is non-singular for all $x$. We often encounter the problem of designing a controller with an asymptotic convergence guarantee, $s\to0$, one example of which is the tracking control of Lagrangian systems~\cite{Slotine:1228283}. The \fi \subsection{Parameter-Dependent Contraction Metrics (aNCM)} \label{Sec:adaptiveNCM} In~\cite{ancm}, it is shown that the NCM and CV-STEM can also be applied to adaptive control of systems with multiplicatively-separable parameter uncertainty in terms of the state $x$ and unknown parameter $\theta$, i.e.{}, $f(x,\theta) = Y(x)^{\top}Z(\theta)$. In this context, the concept of an adaptive NCM (aNCM), outlined in Fig.~\ref{ancmdrawing}, is introduced to combine the provably-stable adaptive control schemes via contraction theory in Theorems~\ref{adaptive_affine_thm} and \ref{ccm_adaptive_affine_thm}, with the machine learning-based techniques in Theorems~\ref{Thm:NCMstability1} and \ref{Thm:NCMstability2} for real-time implementability. Unline NCMs, the aNCM is parameter-dependent to explicitly consider parametric uncertainty of \eqref{adaptive_general}, and thus is applicable even to provably stable adaptive control of systems modeled by neural networks and basis function approximation~\cite{Nelles2001,SannerSlotine1992} as shown in~\cite{ancm}. Note that a similar adaptive control scheme can be designed for differential feedback control due to Theorems~\ref{Thm:ccm_cvstem} and \ref{ccm_adaptive_affine_thm} as proposed in~\cite{9109296}. \begin{figure} \centering \includegraphics[width=88mm]{figures/aNcmfig.png} \caption{Illustration of aNCM ($M$: aNCM; $\hat{\theta}$: estimated parameter; $Y$: error signal, see \eqref{definition_Y}; $x(t)$ and $x_d(t)$: actual and target state; $u$: control input.} \label{ancmdrawing} \vspace{-1.4em} \end{figure} In this section, we assume the following, which is more general than Assumption~\ref{Asmp:affine}, and holds for many types of systems including robotics systems~\cite{Ref:Slotine}, spacecraft high-fidelity dynamics~\cite{battin,doi:10.2514/1.55705}, systems modeled by basis function approximation, and by neural networks~\cite{Nelles2001,SannerSlotine1992}. \begin{assumption} \label{multiplicative_asmp} The system \eqref{adaptation_general} is multiplicatively separable in terms of $x$ and $\theta$, i.e.{}, $\exists$ $Y_f:\mathbb{R}^n\mapsto\mathbb{R}^{n\times {c}_z}$, $Y_{b_i}:\mathbb{R}^n\mapsto\mathbb{R}^{n\times {c}_z},\forall i$, and $Z:\mathbb{R}^{c}\mapsto\mathbb{R}^{{c}_z}$ s.t.{} \begin{align} \label{linear_adaptive} Y_f(x)Z(\theta) = f(x,\theta),~Y_{b_i}(x)Z(\theta) = b_i(x,\theta),~\forall x,\theta \end{align} where $B(x,\theta)=[b_1(x,\theta),\cdots,b_m(x,\theta)]$. \end{assumption} \begin{remark} \label{remark:augmentation} Under Assumption~\ref{multiplicative_asmp}, we could define $\theta$ as $[\theta^{\top},Z(\theta)^{\top}]^{\top}$ so that $Y_f(q)\theta = f(q,\theta)$ and $Y_{b_i}(q)\theta = b_i(q;\theta)$. Such an over-parameterized system could be always implicitly regularized using the Bregman divergence~\cite{boffi2020implicit,ancm}, and thus we denote $[\theta^{\top},Z(\theta)^{\top}]^{\top}$ as $\theta$ in the subsequent discussion. \end{remark} For $\theta$ augmented as $[\theta^{\top},Z(\theta)^{\top}]^{\top}$ as explained in Remark~\ref{remark:augmentation} and Assumption~\ref{multiplicative_asmp}, the dynamics for $\mathtt{e}=x-x_d$ of \eqref{adaptive_general} can be expressed as follows: \begin{equation} \label{error_dynamics} \dot{\mathtt{e}} = A(\varrho_A,x,x_d,\hat{\theta})\mathtt{e}+B(x;\hat{\theta})(u-u_d)-\tilde{Y}(\hat{\theta}-\theta) \end{equation} where $A$ is the SDC matrix of Lemma~\ref{sdclemma}, $\hat{\theta}$ is the current estimate of $\theta$, and $\tilde{Y}$ is defined as \begin{equation} \label{definition_Y} \tilde{Y} = Y-Y_d= (Y_f(x)+Y_b(x,u))-(Y_f(x_d)+Y_b(x_d,u_d)) \end{equation} where $Y_b(x,u)=\sum_{i=1}^mY_{b_i}(q)u_i$. \begin{definition} \label{Def:aNCM} Let $B=B(x,\hat{\theta})$ and $A=A(\varrho_A,x,x_d,\hat{\theta})$ be the SDC matrix given in \eqref{error_dynamics} for notational simplicity. The adaptive Neural Contraction Metric (aNCM) is a neural network model of the optimal parameter-dependent contraction metrics, sampled by solving the adaptive CV-STEM, i.e.{}, \eqref{cvstem_eq} of Theorem~\ref{Thm:CV-STEM} (or Theorem~\ref{Thm:ccm_cvstem} for differential feedback) with its constraints replaced by the following: \begin{align} \label{adaptive_W_tilde} &I \preceq \bar{W}(x,x_d,\hat{\theta}) \preceq \chi I,~\forall x,x_d,\hat{\theta} \\ \label{deterministic_contraction_adaptive_tilde} &-\left.({d}/{dt})\right|_{\hat{\theta}}{\bar{W}}+2\sym{\left(A\bar{W}\right)}-2\nu BR^{-1}B^{\top} \preceq -2\alpha \bar{W} \end{align} where $\alpha,\underline{m},\overline{m} \in (0,\infty)$, $\chi = \overline{m}/\underline{m}$, $\bar{W} = \nu W$, $\nu = \overline{m}$, $R=R(x,x_d)\succ0$ is a given weight matrix on $u$, and $({d}/{dt})|_{\hat{\theta}}{\bar{W}}$ is the time derivative of $\bar{W}$ computed along \eqref{adaptive_general} with $\theta = \hat{\theta}$. \end{definition} The aNCM given in Definition~\ref{Def:aNCM} has the following stability property along with its optimality due to the CV-STEM of Theorem~\ref{Thm:CV-STEM}~\cite{ancm}. \begin{theorem} \label{adaptiveNCMthm} Suppose Assumption~\ref{multiplicative_asmp} holds and that we have the optimal parameter-dependent contraction metric $M(x,x_d,\hat{\theta})=W(x,x_d,\hat{\theta})^{-1}$ given by the adaptive CV-STEM of Definition~\ref{Def:aNCM}. If we control the true dynamics \eqref{adaptive_general} by \begin{align} \label{adaptive_general_u} u =& u_d-R(x,x_d)^{-1}B(x;\hat{\theta})^{\top}M(x,x_d,\hat{\theta})(x-x_d)\\ \label{adaptation_general} \dot{\hat{\theta}} =& \Gamma(Y^{\top}dM_x+Y_d^{\top}dM_{x_d}+\tilde{Y}^{\top}M) (x-x_d) \end{align} where $dM_q = [({\partial M}/{\partial q_1})\mathtt{e},\cdots,({\partial M}/{\partial q_n})\mathtt{e}]^{\top}/2$, $\mathtt{e}=x-x_d$, $\Gamma \succ 0$, and $Y$, $Y_d$, $\tilde{Y}$ are as defined in \eqref{definition_Y}, then $\mathtt{e}$ of \eqref{error_dynamics} asymptotically converges to $0$. Furthermore, when the aNCM of Definition~\ref{Def:aNCM} has a modeling error $\epsilon_{\ell}$ and the adaptation law \eqref{adaptation_general} is augmented with $-\Gamma \sigma \hat{\theta}$ as in Theorem~\ref{Thm:adaptive_robust_affine}, Theorems~\ref{Thm:NCMstability1} and \ref{Thm:NCMstability2} hold also for the aNCM control. Note that using the stochastic contraction condition \eqref{eq:MdotContracting_sto} for \eqref{deterministic_contraction_adaptive_tilde} results in robustness against stochastic disturbances as in Theorems~\ref{Thm:NCMstability1} and \ref{Thm:NCMstability2}. \end{theorem} \begin{proof} Replacing the constraints of \eqref{cvstem_eq} by \eqref{adaptive_W_tilde} and \eqref{deterministic_contraction_adaptive_tilde}, asymptotic stability can be shown as in the proof of Theorem~\ref{adaptive_affine_thm} (see~\cite{ancm} for details). Also, adding $-\Gamma \sigma \hat{\theta}$ to the adaptation law \eqref{adaptation_general} results in exponential boundedness of the tracking error as shown in Theorem~\ref{Thm:adaptive_robust_affine} (or in Theorem~4 of~\cite{ancm}). Therefore, the aNCM also possesses robustness against the learning error $\epsilon_{\ell}$ as proved in Theorems~\ref{Thm:NCMstability1} and~\ref{Thm:NCMstability2}. \qed \end{proof} An important feature of the aNCM is again its applicability to real-time and provably stable adaptive control of a wide range of systems, including those modeled by neural networks and basis function approximation~\cite{Nelles2001,SannerSlotine1992} as shown and demonstrated in~\cite{ancm}. \begin{remark} The internal CV-STEM-based robust control architecture in the aNCM can be generalized to CCM-based differential feedback control schemes using parameter-dependent CCMs~\cite{9109296,lopez2021universal}. Furthermore, the dependence on $u$ and $\dot{\hat{\theta}}$ in $(d/dt)|_{\hat{\theta}}M$ can be removed by using $\partial_{b_i(x)}M+\partial_{b_i(x_d)}M=0$ as in Theorem~\ref{adaptive_affine_thm} and by using adaptation rate scaling introduced in~\cite{lopez2021universal}. In essence, it multiplies the adaptation law \eqref{adaptation_general} by any strictly-increasing and strictly-positive scalar function $v(2\rho)$, and update $\rho$ as \begin{align} \label{rho_adaptation} \dot{\rho} = \frac{1}{2}\frac{v(2\rho)}{v_{\rho}(2\rho)}\sum_{i=1}^{c}\frac{1}{V_{\mathtt{e}}+\eta}\frac{\partial V_{\mathtt{e}}}{\partial \hat{\theta}_i}\dot{\theta_i} \end{align} where $v_{\rho}=\partial v/\partial \rho$, $\eta \in(0,\infty)$, and $V_{\mathtt{e}} = \mathtt{e}^{\top}M(x,x_d,\hat{\theta})\mathtt{e}$ for $M$ of Definition~\ref{Def:aNCM}, so the additional term due to \eqref{rho_adaptation} cancels out the term involving $\dot{\hat{\theta}}$ in $(d/dt)|_{\hat{\theta}}\bar{W}$ of \eqref{deterministic_contraction_adaptive_tilde} (see~\cite{lopez2021universal} for details). Its robustness property follows from Theorem~\ref{adaptiveNCMthm} also in this case. \end{remark}
\section{Methods} \acknowledgments \input{paper-template.acknowledgments} \input{paper-template.biblio} \clearpage \newwrite\tempfile \immediate\openout\tempfile=startsupp.txt \immediate\write\tempfile{\thepage} \immediate\closeout\tempfile \renewcommand{\thefigure}{S\arabic{figure}} \renewcommand{\thetable}{S\arabic{table}} \setcounter{figure}{0} \setcounter{table}{0} \input{paper-template.supplementary} \end{document} \section{Introduction} \label{sec:introduction} Large-scale analysis of user-generated text has been instrumental in understanding recent political campaigns and movements, from the Arab Spring~\cite{howard_opening_2011,wolfsfeld_social_2013} to the Black Lives Matter protests~\cite{wu_say_2021}. Complementing traditional survey based approaches, social media has also shown promise as a medium for gauging public sentiment. Unlike surveys, however, where questions are carefully constructed so that the answers can be directly interpreted, extracting sentiment from large-scale unstructured text requires automated interpretation. The field of sentiment analysis in natural language processing (NLP) developed in response to this need, not just in politics but in other areas as well. Retailers have used sentiment analysis techniques to analyze product reviews and provide a better experience for its users~\cite{fang_sentiment_2015,shivaprasad_sentiment_2017}. Sentiment analysis has also been applied to financial markets, where the opinion of market participants plays an important role in future prices~\cite{smailovic_predictive_2013,pagolu_sentiment_2016,mishev_evaluation_2020}. Understanding public opinion also matters in public health, as in the case of addressing perceptions of vaccines~\cite{raghupathi_studying_2020,klimiuk_vaccine_2021}, and predicting signals of depression in self-expressed social media posts~\cite{wang_depression_2013,coppersmith_quantifying_2014,reece_forecasting_2017,stupinski_quantifying_2021}. Studies on sentiment in social media can be broadly divided into two groups: one where the emphasis is on identifying the sentiment of a particular statement, and another that focuses on obtaining a collective measure of sentiment. In this work, we deal with the latter, where we are interested in the general sentiment associated with a particular topic rather than the emotional state expressed by a particular individual. This paradigm of studying collective sentiment has been used to monitor general sentiment on Twitter, and has been validated by cross-referencing changes in measured sentiment with high-profile events, such as election results, terrorist activities, holidays and even birthdays of popular artists~\cite{dodds_temporal_2011}. For example, holidays such as Christmas, New Year, Fourth of July and Thanksgiving correspond to spikes in happiness, while mass shootings in the United States, the fire at Notre Dame cathedral, the murder of George Floyd and the storming of the US Capitol coincide with a marked decrease in happiness on Twitter. In contrast to this approach, which looks at social media posts as a bag of words, we look at it as a collection of tweets that are in turn related by their use of specific words. In particular, do certain words go together, and if so, what is the sentiment profile of these groups of words, and what do they say about the sentiment profile of the tweets themselves? We want to know if this approach will provide a more nuanced picture of collective sentiment that is missed by a simple aggregation. One way to infer collective sentiment or meaning from text is through lexicons, where a subset of words is compiled, either through expert curation or by frequency of use, to provide a representative sample of the corpus. Sentiment scores are then assigned to each word, usually by human annotators. One such lexicon is the labMT dataset used in the Hedonometer~\cite{dodds_temporal_2011,dodds_human_2015}, which contains happiness scores from human annotators for more than 10,000 words. The word list was later expanded~\cite{alshaabi_augmenting_2021} to extrapolate happiness scores for any unscored word using a word embedding model. Aside from happiness scores, semantic differentials have also been used to quantitatively capture meanings of words. The valence-arousal-dominance (VAD) semantic differentials have been commonly used since its inception, and a number of studies have focused on creating large-scale VAD lexicons~\cite{bradley_affective_1999,warriner_norms_2013,mohammad_obtaining_2018}. Other examples of sentiment lexicons include SentiWordNet~\cite{baccianella_sentiwordnet_2010} and LIWC~\cite{pennebaker_development_2015}. In contrast to lexicon scores, co-occurrence models infer the meaning of a word using the surrounding context, i.e., the adjacent words that occur proximate to the anchor word in real-world corpora. These models output word embeddings, which are high-dimensional vectors that represent a word's meaning. Examples of such models are Word2Vec~\cite{mikolov_distributed_2013}, GloVe~\cite{pennington_glove_2014}, and FastText~\cite{bojanowski_enriching_2017,joulin_bag_2017}. Although these word embeddings perform well in complex tasks such as machine translation and language detection, the meaning is abstracted in several dimensions and is thus less interpretable than the scores provided by lexicons. A study by \citet{hollis_principals_2016} examined whether the 300 dimensions of Word2Vec corresponds to any of the well-known semantic and lexical variables, including valence, arousal and dominance. However, they found that no single dimension corresponded to a particular semantic or lexical variable, although the principal components that contributed the most to the variance were found to be correlated to some semantic and lexical variables. This is particularly interesting as Word2Vec was not developed using these semantic and lexical concepts, but nevertheless captures aspects of them in the embedding. Conversely, context is not used to obtain lexicon scores; human annotators are presented with words and are asked to score them in the desired scale. The interplay between sentiment scores and co-occurrence patterns in words has mostly been viewed from a predictive standpoint, i.e., whether sentiment scores can be predicted using word co-occurrence. Early work predicted sentiment polarity (positive or negative)~\cite{turney_unsupervised_2002,turney_measuring_2003}, while later models predicted valence, arousal, and dominance using latent semantic analysis~\cite{bestgen_checking_2012}, pointwise mutual information~\cite{recchia_reproducing_2015} and co-occurrence models such as HiDEx~\cite{shaoul_word_2006,westbury_avoid_2015} and Word2Vec~\cite{hollis_extrapolating_2017}. Recently, Alshaabi et al~\cite{alshaabi_augmenting_2021} used FastText word embeddings and the transformer model DistilBERT~\cite{sanh_distilbert_2019}, both pre-trained on large-scale, general corpora, to predict happiness scores for out-of-vocabulary words. While prediction success implies the existence of a relationship between word co-occurrence and lexicon scores, we are not aware of any study that delves deeper into the details of this relationship. In particular, given a corpus, how are the sentiment scores of co-occurring words related? And can the co-occurrence structure of words be used to uncover mixed sentiments in a corpus that would be missed by an aggregate measure, such as the average happiness score? We explore these questions in the context of tweets, which because of character count limitations (140 before 2018, and 280 thereafter) generally contain words that are related by a single theme. Rather than using techniques resulting in word embeddings that abstract words into non-interpretable vectors, we retain the nature of the word itself and instead use tools from network science to analyze the word co-occurrence structure in the corpus. Although NLP has leaned more towards probabilistic models and neural networks, network science has nevertheless found a wide range of applications in computational linguistics~\cite{ferrer_i_cancho_patterns_2004,liu_language_2013,cong_approaching_2014,al_rozz_characterization_2017,wang_learning_2017,chen_how_2018,jiang_does_2019}. In fact, some techniques commonly used in NLP, such as latent Dirichlet allocation, have been shown to parallel network science techniques~\cite{gerlach_network_2018}. By constructing word co-occurrence networks, where the words are nodes in a network, the sentiment scores are node properties, and the edges in the network represent the co-occurrence structure, we can see more directly how co-occurrence and sentiment are related. Specifically, each node in the network represents a word found in a tweet. As a tweet contains words that are related to each other, each tweet corresponds to a connected subgraph, where each word appearing in the tweet is connected to every other word appearing in the same tweet. We superpose the subgraphs for each tweet in the corpus to form the full word co-occurrence network, with the edge weights corresponding to the number of tweets in which two words co-occur together. The degree and strength of a node tell us how often a word co-occurs with others, while the weight of an edge indicates how often any two words co-occur. We then analyze the context-dependent network structure and its relation to the context-independent word lexicon scores, in particular the happiness scores from both the labMT dataset and the predictive model in~\cite{alshaabi_augmenting_2021}. We look at the network from three perspectives: node-centric, edge-centric, and community-centric. In the node-centric perspective, we examine if there is a relationship between node characteristics, such as degree and node strength, and the happiness scores. In the edge-centric perspective, we consider pairs of words and their respective scores. Lastly, in the community-centric approach, we use network backboning and community detection techniques to obtain groups of related words within the network, and explore the relationship of scores within each group to scores across groups. As we are interested in whether we can uncover mixed sentiments in corpora, we focus on political tweets, where polarization in stance is common. Stance is distinct from sentiment, in that it reflects the opinion (``favor'', ``against'', or ``neither'') towards a target~\cite{kucuk_stance_2020}. Regardless, sentiment has been shown to be important, though not sufficient, to predict stance~\cite{mohammad_stance_2016}. Thus, by combining tweets using hashtags that are from opposite stances, we are likely to get tweets with opposing sentiments. Further, within each stance, we will also likely encounter a minority of tweets with a sentiment opposite to that expected, e.g., an ``against'' stance tweet may have a positive sentiment towards the target's opponent. We also examine whether these cases will be picked up by our analysis. As the political situations associated with these tweets are likely to be reported in the news, we can use domain knowledge to check the validity of our results. We detail the selection of tweets and the method of our analysis in Section~\ref{sec:method}. In Section~\ref{sec:results}, we present our findings regarding the relationship between the co-occurrence network structure and happiness scores at the node-centric, edge-centric, and community-centric levels. We summarize our results in Section~\ref{sec:conclusion} and present avenues for future work. \section{Methodology} \label{sec:method} \subsection{The tweets} \label{subsec:method-tweets} For our analysis, we consider a collection of tweets relating to Hillary Clinton's presidential bid, in particular, tweets with any of the following anchors, \texttt{\#imwithher} or \texttt{\#crookedhillary} (case-insensitive). Both anchors were mostly used in 2016 during the US presidential election season, where \texttt{\#imwithher} is associated with being in favor of Hillary Clinton and \texttt{\#crookedhillary} associated with being against her. Using Twitter's Decahose API, we take a random 10\% of the tweets matching these hashtags during the 1-week period of election season when the anchors were most popular, respectively. These periods were November 1-8 for \texttt{\#imwithher} and October 7-14 for \texttt{\#crookedhillary}, both in 2016~\cite{alshaabi_storywrangler_2021}. We acknowledge that although these stance association assumptions are general, they are not universal, and each hashtag may be used for the opposite stance. We also investigate whether such cases can be uncovered using our analysis. We then sampled the tweets so that we get balanced classes, with each hashtag getting 7222 unique original tweets (no retweets, quote tweets, or duplicates). We also note that we found an obvious case of systematic hashtag hijacking with content unrelated to Hillary Clinton and removed the corresponding tweets before sampling (see the Supplementary Information for details). The tweets containing \texttt{\#imwithher} are labeled as ``favor'' tweets, while the ones containing \texttt{\#crookedhillary} are labeled as ``against'' tweets. These labels correspond to the general stance associated with each anchor hashtag. The aggregated set of tweets is denoted by the label ``all''. \subsection{Happiness scores} \label{subsec:method-scores} For the word ratings, we consider the Language Assessment by Mechanical Turk (labMT) dataset that contains scores for happiness~\cite{dodds_temporal_2011,dodds_human_2015} for more than 10,000 words. The list was compiled from the most frequently appearing words in more contemporary sources such as Twitter, Google Books, the New York Times and music lyrics. Human annotators were asked to score a word using a scale of 1--9, with 1 being the least happy and 9 being the happiest, and 5 being neutral. The means of the measurements as well as their standard deviations are reported in the dataset. To get the happiness scores for words not present in the labMT dataset, we use deep learning models trained on the labMT dataset to extrapolate happiness scores for words and n-grams~\cite{alshaabi_augmenting_2021}. The first proposed model, namely the token model, breaks up the input into character-level $n$-grams and uses subword embeddings to estimate their happiness, while the second model uses dictionary definitions to gauge happiness scores. The predictive scoring models have been found to be reliable, making predictions well within the range of scores that are obtained from different human annotators. Although the dictionary model provides better performance for words in the dictionary, the token model performs almost as well with lower computation cost and gives more reliable results for words that are not in dictionaries but are made up of component subwords, such as hashtags. We use the token model to infer the happiness scores for the words in the network that are not in the original labMT dataset, allowing us to compare the effect of the choice of words to evaluate the network structure. To further improve accuracy, we use the expanded form of the most commonly used acronyms in the corpora examined (Table~\ref{tab:acronyms}) as an input to the predictive scoring model to obtain their respective scores. \begin{table} \caption{\textbf{Acronyms and their full versions.} Acronyms in the corpus with high word counts are scored using their full versions in the predictive scoring model using tokens~\cite{alshaabi_augmenting_2021}. The model breaks the input token into character-level $n$-grams, so there is no need to add whitespaces here.} \label{tab:acronyms} {% \begin{tabular}{ll} \textit{Acronym in tweet} & \textit{Model input} \\ \hline maga & makeamericagreatagain \\ msm & mainstreammedia \\ tcot & topconservativesontwitter \\ potus & presidentoftheunitedstates \end{tabular}% } \end{table} \subsection{Generating the co-occurrence network} \label{subsec:method-network_build} We parse each tweet as follows. As the writing style on Twitter involves a liberal use of hashtags, we disregard the hashtag symbol in each tweet. Each tweet is then converted into lower case and parsed by splitting each string into a set of words separated by whitespaces, while preserving contractions, punctuation, handles, hashtags, dates and links (see~\cite{alshaabi_storywrangler_2021} for more information). For simplicity, we further exclude punctuation marks, and undo contractions, as shown in Table~\ref{tab:contractions}. Twitter handles (1-grams beginning with a ``@''), 1-grams with numbers, and URL links were also removed, as well as the anchor terms \texttt{\#crookedhillary} and \texttt{\#imwithher} in order to eliminate community structure associated with the choice of these hashtags. In our preliminary analysis, we find that the names of Hillary Clinton and her opponent, Donald Trump, also effectively served as anchor words, masking finer structure in the network. We thus also remove the terms ``hillary'', ``clinton'', ``hillaryclinton'', ``trump'', ``donald'', and ``donaldtrump''. We then obtain counts for the words used in the tweets (the document-term matrix) using the Python package \texttt{scikit-learn}~\cite{pedregosa_scikit-learn_2011}. In case a word appears multiple times inside a single tweet, it is only counted once in generating the network; however, the original word counts are also recorded. We finally obtain the adjacency matrix that is used to generate the undirected word co-occurrence network by taking the dot product of the document-term matrix (where each word is only counted once in a tweet) and its transpose, setting the diagonal elements to zero. In the resulting network, each node is a word occurring in the set of tweets. An edge between two nodes indicates that the two nodes occur together in some tweets, and the edge weights tells us how many tweets the two connected nodes occur together. We construct a separate network for each set of tweets (e.g., for the Hillary Clinton tweet corpus, we create a separate network for the ``favor'', ``against'', and ``all'' tweets). \begin{table*}[] \caption{\textbf{Contractions and equivalents.} Some contractions in tweets were converted to equivalent strings. In case of ambiguity, the contraction is converted to a blank space.} \label{tab:contractions} {% \begin{tabular}{lll} \textit{Contractions} & \textit{Converted to} & \textit{Remarks} \\ \hline n't & \textless{}space\textgreater{}not & \\ 's & \textless{}space\textgreater{} & either ``is" or possessive marker \\ 'm & \textless{}space\textgreater{} & ``am"; for consistency, since ``'s" is converted to a space \\ 'd & \textless{}space\textgreater{} & either ``had" or ``would" \\ 're & \textless{}space\textgreater{} & ``are"; for consistency, since ``'s" is converted to a space \\ 've & \textless{}space\textgreater{}have & \\ 'll & \textless{}space\textgreater{}will & \end{tabular}% } \end{table*} \subsection{Network characterization} \label{subsec:method-network-characterization} We look at the basic properties of the network, such as the node strength, degree and edge weight distribution, and examine how these are related to the scores of the node. To determine if the results we observe are due to the happiness scores or to the network structure, we compare our results with a number of null models, where we modify either the network structure or the scores of the words. These include: \paragraph{Configuration model} The network is randomly rewired using the node strength sequence to roughly preserve the node strength distribution; self-loops are discarded, and parallel unweighted edges connecting two nodes are combined to form a weighted edge~\cite{serrano_weighted_2005} \paragraph{Erdos-Renyi model} An Erdos-Renyi network is constructed with the probability $p$ of an edge occurring set to be $E_\mathrm{obs} / E_\mathrm{max}$, where $E_\mathrm{obs}$ is the number of observed (unweighted) edges and $E_\mathrm{max}$ is the total number of possible (unweighted) edges. The edge weights are assigned by drawing with replacement from the distribution of edge weights in the original graph. \paragraph{Shuffled score model} The network is kept as is, but the scores are reshuffled among the nodes. \paragraph{Uniform score model} The network is kept as is, but the scores of the nodes are sampled from a uniform distribution from 1 to 9 (the prescribed range of happiness scores in labMT). \subsection{Community detection and network backboning} \label{subsec:method-community} To explore whether clusters in the co-occurrence network are also related to sentiment scores, we perform community detection on the co-occurrence network. However, because the resulting co-occurrence networks have words that occur very frequently (such as the words ``is'' and ``the'') and also many words that are used together in only a few tweets, we find that performing community detection on the full set of words resulted in communities that were dominated by function words and did not correspond to any discernible theme. We thus need to trim down the network to expose a more robust underlying structure. To do this, we use \textit{network backboning} techniques, which remove edges that are likely to occur at random. In particular, we apply the disparity filter~\cite{serrano_extracting_2009} and the noise-corrected model~\cite{coscia_network_2017} using the implementation given by \citet{coscia_network_2017}. Compared to other recent network backboning methods~\cite{grady_robust_2012,slater_two-stage_2009}, the disparity filter and the noise-corrected model allow for tunable parameters and provide a theoretical foundation to address noisy edge weights. The disparity filter looks at each node and the normalized weights of the $k$ edges connecting it to its neighbors. These weights are compared to a null model, where the interval $[0,1]$ is subdivided by $k-1$ points uniformly distributed along it. The lengths of each segment would represent the expected values for the $k$ normalized weights, and the probability of each edge having a weight compatible with this null model is calculated, corresponding to a p-value. Those edges compatible with the null model at a preset statistical significance level $\alpha$ are removed from the backbone. The noise-corrected model is similar, but looks at a node pair rather than a node in constructing a null model. In the noise-corrected model, the edge weight distribution is assumed to be binomial, and a preset threshold analogous to the p-value decides which edges to keep in the backbone. In most real-world networks, hubs are considered crucial to the structure and dynamics; transportation and friendship networks are notable examples where this holds. Similarly, edges that have high weights are also considered important and will not be eliminated by network backboning algorithms. However, in our word co-occurrence networks, this is not necessarily so. For example, consider the words ``is'' and ``the'', two of the network nodes with the highest degrees, which are also connected by an edge with one of the highest weights. As both are important components in constructing English sentences, this prominence is not unexpected. However, in terms of characterizing the meaning of a corpus, neither of these words is useful. Backboning of the word co-occurrence network requires removing these hubs as well. A tricky complication is that not all hubs are function words. For example, for the Hillary Clinton corpus, there are also words such as ``vote'' or ``maga'' that are relevant to the meaning of the corpus, but are similar to the function words ``is'' and ``the'' in that they are high-degree nodes that are connected by a high-weight edge. To differentiate between these two types of high-degree nodes, we create a list of words that are frequently used among several corpora. One option is to use the list of stop words included in the Python natural language toolkit (NLTK)~\cite{loper_nltk_2002}, which includes pronouns, prepositions, articles, and other function words. This gives us 180 words (including the preposition ``us'' which we added, as we saw it remained a prominent pronoun in the corpus after our analysis), some of which include the list of contractions we removed in parsing. Another option is to use the most commonly seen words on Twitter, which are less likely to have relevant meaning in reference to the anchored set. Using Storywrangler~\cite{alshaabi_storywrangler_2021}, we identify the top 400 case-sensitive 1-grams for 100 randomly chosen days from 2010/01/01 to 2015/12/31 (prior to the period corresponding to our corpus tweets) and take the intersection of these 100 lists. The resulting words frequently occur on Twitter, indicating that they are not likely to hold much distinctive meaning. After removing punctuation marks, digits and symbols, and case-insensitive duplicates from this list, we get 194 commonly used words on Twitter. We then take the intersection of this list with the top 200 words in the network with the highest degrees. The final list, which depends on the corpus, is the resulting list of stop words. Both the NLTK and the top Twitter 1-gram method give similar results. For brevity, we present the results obtained using the Twitter 1-gram method. A table containing the words removed using this method is included in the Supplementary Information. We perform network backboning in two passes. We first eliminate the words that are likely to hold less distinctive meaning using the top ranked words on general Twitter. This is equivalent to disregarding stop words in parsing, where the stop words are based on general Twitter and are only removed if they serve as hubs in the network. We then remove irrelevant edges using the disparity filter or the noise-corrected model. With these steps, both the most irrelevant and the most connected words are removed to obtain the network backbone, which is in turn used for further analysis. We then perform community detection on the network backbone. Although an overlapping community detection algorithm is the natural choice for this task, we found that using hierarchical link clustering~\cite{ahn_link_2010} gives clusters with overlapping themes. We present instead the results obtained using the Louvain algorithm~\cite{blondel_fast_2008}, a widely used greedy optimization method that assigns each node to a community and returns the partitioning that maximizes the graph's modularity. Surprisingly, despite the limitation that the communities must be disjoint, it gives the word co-occurrence network an interpretable community structure. Each community is then analyzed in terms of the words it contains and the corresponding word scores. With a non-overlapping community detection algorithm, since a word only appears once in every community, the score contributions of a particular word to the community and to the unpartitioned network can also be easily interpreted. \section{results} \label{sec:results} We begin by presenting the basic characteristics of the corpora, such as the degree, count, and score distributions. We then look at how node-centric properties, such as the node strength and degree, relate with word scores, and how the scores of the words connected by each edge are related. \subsection{Network characteristics} \begin{table*}[!tp] \caption{\textbf{Number of tweets, nodes, node strengths, degree and the size of connected components for tweets.}} \centering \label{tab:anchored_tweets_describe} {% \begin{tabularx}{\textwidth}{l CCCCr} \multicolumn{1}{c}{\textit{Anchors}} & \multicolumn{1}{c}{$N_\mathrm{tweets}$} & \multicolumn{1}{c}{$N_\mathrm{nodes}$} & \multicolumn{1}{c}{\textit{Total edge weight}} & \multicolumn{1}{c}{\textit{Number of edges}} & \multicolumn{1}{c}{\textit{Component sizes}} \\ \hline \#imwithher & 7222 & 6085 & 408303 & 186688 & (6080, 1$\times$5) \\ \#crookedhillary & 7222 & 9912 & 489294 & 264226 & (9898, 3, 3, 1$\times$8) \\ \#imwithher OR \#crookedhillary & 14444 & 12023 & 897597 & 405448 & (12005, 3, 3, 1$\times$12) \end{tabularx}% } \end{table*} The number of nodes, edges, and tweets for each set of anchored tweets are given in Table~\ref{tab:anchored_tweets_describe}. The distributions for the node strengths, node degrees and edge weights, as well as the word counts (the number of times a word appears in the corpus) and the tweet counts (the number of tweets a word is in), are shown in Figure~\ref{fig:hclinton_degree_count_dist}. The tweet and word counts display a heavy-tailed distribution, as expected~\cite{ryland_williams_zipfs_2015,williams_text_2015}, while the tail of the degree and node strength distributions follow a power law with similar exponents. Because the tweets are short and words are not often repeated in each tweet, the construction of the co-occurrence network creates a high correlation between the degree of a node and the corresponding word count. However, even if many words are usually mentioned in very few tweets, they will co-occur with other words and will have degrees higher than 1. This is consistent with the distribution of the number of nodes extracted per tweet (insets of Figure~\ref{fig:hclinton_degree_count_dist}) and explains the dip in the probability density for the degree distribution below the value of 10, while the probability densities for the word and tweet counts are monotonic. We also note that for the vast majority of nodes, the degree is the same as the node strength. The network also has mild degree disassortativity and low node strength disassortativity (Table~\ref{tab:hclinton_assortativity}). \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{Fig1.png} \caption{\textbf{Word co-occurrence network statistics.} The plots show the degree, word count, tweet count, and edge weight distribution for the word co-occurrence networks corresponding to the tweets in favor of and against Hillary Clinton, as well as the combination of these two corpora. The inset shows the number of tweets with a given number of words, or equivalently, the histogram of the sizes of subgraphs, with each subgraph corresponding to a single tweet. The peak of this histogram at around 10 words per tweet explains the dip found in the probability distributions for node strength and degree.} \label{fig:hclinton_degree_count_dist} \end{figure*} \begin{table*}[] \caption{Assortativity coefficients} \centering \label{tab:hclinton_assortativity} {% \begin{tabularx}{\textwidth}{l CCCCC} & & & \multicolumn{2}{c} {Happiness} \\ \multicolumn{1}{c}{\textit{Anchors}} & \multicolumn{1}{c}{Strength} & \multicolumn{1}{c}{Degree} & \multicolumn{1}{c}{Weighted} & \multicolumn{1}{c}{Unweighted} \\ \hline \#imwithher & -0.189 & -0.278 & 0.022 & 0.031 \\ \#crookedhillary & -0.175 & -0.254 & 0.006 & 0.008 \\ \#imwithher OR \#crookedhillary & -0.166 & -0.261 & 0.022 & 0.024 \end{tabularx}% } \end{table*} \subsection{Happiness scores and word counts} \label{subsec:happiness-scores-word-counts} To differentiate the contributions of frequent and rare words as well as positive, neutral and negative words, we construct a 2D histogram for the word counts vs. the happiness scores of the words in each corpus (Figure~\ref{fig:hclinton_scorecontrib_count_dist_v2}a). Words close to the prescribed neutral score $h=5$ are dominant in each corpus, especially among frequently used words. The average happiness score per corpus, computed by weighting the score of each word by its word count, is given in the annotations above the plots. To see which score ranges influence the average score the most, we construct a 2D histogram where each word is weighted by its contribution to the average happiness score. In Figure~\ref{fig:hclinton_scorecontrib_count_dist_v2}b, each word $w$ is given the weight \begin{equation} h_{\Delta, w} = (h_w - 5) * N_w / \sum_{w^{\prime}}{N_{w^{\prime}}} \label{eq:score_contrib} \end{equation} \noindent where $h_w$ is the happiness score of word $w$ and $N_w$ is the number of times the word appears in the corpus. Although neutral words are not expected to contribute much to this deviation, there are a few words with happiness scores $h\in(5,6)$ that raise the average happiness significantly, consistent with the observed positivity bias in language~\cite{dodds_human_2015,aithal_positivity_2021}. The average happiness scores in these corpora, however, are lower than those generally obtained with the entire Twitter Decahose dataset, which is also observed in other subsets containing political tweets~\cite{cody_public_2016}. We also note that while low-count words do not individually contribute much to the average happiness score, their ubiquity in the corpus increases their combined influence. As expected, those with higher word counts have higher values of $h_{\Delta, w}$. \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{Fig2.png} \caption{\textbf{Distribution of words and their contributions to the deviation from neutrality in terms of their word counts and happiness scores.} (a) The 2D histogram for word count vs. happiness score, with the corresponding marginal distributions shown (note that each word has a weight of 1 in the marginal distribution). (b) A 2D histogram of the contributions of words in word count-happiness space to the deviation from neutrality, $h_{\Delta, w} = (h_w - 5) * N_w / \sum_{w^{\prime}}{N_{w^{\prime}}}$, where $h_w$ is the word's happiness score of word and $N_w$ is the number of times the word appears in the corpus. The marginal distributions are also included. Vertical lines at $h=5$ are added to guide the eye. } \label{fig:hclinton_scorecontrib_count_dist_v2} \end{figure*} \subsection{Network structure and happiness scores} \label{subsec:results-network_structure_and_happiness} We now look at how the happiness scores and the network structure are related. We begin by looking at the relationship between a node's degree and node strength to its score, and then that of an edge and the scores of the nodes it connects. \subsubsection{Node degree, node strength and happiness scores} A 2D histogram showing the distribution of words in node strength-score space is given in Figure~\ref{fig:hclinton_score_degree_dist_v2}. The dominance of neutral words for all values of node strengths and degrees is evident. Comparing these results to the null models (Figures~\ref{fig:hclinton_score_degree_dist_v2_configmodel}-\ref{fig:hclinton_score_degree_dist_v2_uniform}), we find that neither shuffling the scores nor changing the network structure results in a different profile, while keeping the network and using a uniform distribution for the scores changes the result substantially. Thus, this relationship between the node's score and its degree and strength is mostly due to the dominance of neutral words in the score distribution and not the structure of co-occurrence of words in the corpus. \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{Fig3.png} \caption{\textbf{Node characterization by node strength, degree, and happiness scores.} 2D histograms for both the (a) node strength and (b) degree vs. happiness score. Note the dominance of nodes in the neutral range, with the happiness score close to $h=5$.} \label{fig:hclinton_score_degree_dist_v2} \end{figure*} \subsubsection{Happiness scores of connected words} We now look at the property of each edge, in particular the scores of connected nodes and their edge weights. Figure~\ref{fig:hclinton_scorepair_happiness_heatmap_v2} shows the profile of the scores of connected nodes in the network. We see that words of any score tend to be connected to words with happiness scores $h\in[4.5, 6.5)$. Whereas words in this region tend to co-occur with words of similar scores, words with more extreme scores do not exhibit such homophily. This is consistent with the low assortativity coefficients obtained for the happiness scores (Table~\ref{tab:hclinton_assortativity}) computed using both the weighted and unweighted versions of the network. Comparing these results with null models (Figures~\ref{fig:hclinton_scorepair_happiness_heatmap_v2_configmodel}-\ref{fig:hclinton_scorepair_happiness_heatmap_v2_uniform}), we find that rewiring the network and shuffling the scores give similar profiles, while keeping the network but using a uniform distribution changes the profile drastically. Thus, this homophily among neutral words is mainly due to the abundance of neutral words in the corpus and not the co-occurrence network structure. \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{Fig4.png} \caption{\textbf{Happiness scores for each pair of connected nodes.} Each pair of nodes is weighted by the weight of the edge connecting them. We made the histogram to be symmetric about the 45$\degree$ line so that one can analyze it from either the horizontal or vertical direction.} \label{fig:hclinton_scorepair_happiness_heatmap_v2} \end{figure*} \subsection{Network backboning} \label{subsec:results-network_backboning} We saw in Section~\ref{subsec:results-network_structure_and_happiness} that the network itself plays a smaller role than the score distribution, both from a node-centric perspective (score, degree, and node strength), and a edge-centric perspective (score difference and edge weights). In particular, the dominance of neutral words in the corpus makes it more likely that any two connected words are close to neutral and thus have similar scores. Previous work has observed this dominance of neutrality in text corpora which tends to reduce the signal in differences in sentiment across time~\cite{dodds_temporal_2011}. This issue was previously addressed by using a manually tuned filter to remove neutral words while still capturing time series correlations~\cite{dodds_temporal_2011}; two commonly used filters exclude words with scores between 4.5 and 5.5 or 4 and 6 before taking the average of the happiness scores (weighted by word count) of the remaining words in the corpus. Although the removal of neutral words may be sufficient in obtaining an average happiness score for a given corpus, this may not be the best approach when the aim is to explore the relationship between network structure and scores, as removing neutral words in performing network analysis begs the question by presupposing the existence of this relationship. Further, as neutral words form a big chunk of the network regardless of node degree, node strength or edge weight, disregarding them will remove possibly influential nodes that may help us understand hidden substructures in the network, such as opposing sentiments within the corpus, that would not be visible if we look at just the weighted average of the happiness scores. Some context-relevant words (e.g., ``vote'') may also be neutral, and the removal of these words may make it more difficult to interpret the co-occurrence network structure. We want to see if we can obtain useful word sentiment information from the network structure without resorting to score cutoffs. Network backboning uncovers relevant structure in a network by removing edges that are likely to be spurious connections. If the pruning of these edges results in the isolation of nodes, one can consider these isolated nodes to be less relevant to the network structure than the ones that remain in the backbone. As discussed in Section~\ref{subsec:method-community}, we perform network backboning in two steps. To remove the nodes which are not likely to hold much meaning, we remove the most common words on Twitter from the network if they are also frequently occurring in the corpus, which is equivalent to parsing the original tweets with these words as stop words. We then use the disparity filter or the noise-corrected model to remove low-weight edges. We find that the noise-corrected model removes few edges from the network despite setting the significance level to be very low; in contrast, the disparity filter removes both edges and nodes at a wide range of thresholds. This is unsurprising, as the noise-corrected model gives a higher importance to edges that connect low-degree nodes compared to the disparity filter and is known to be the less restrictive algorithm of the two. In the following discussion, we only consider results obtained using the disparity filter. The disparity filter only begins to take out edges at threshold values $\alpha<0.5$, with a sharp drop in the number of nodes and edges beginning at $\alpha=0.3$. Although similar communities are found for $\alpha=0.3$ up to the most restrictive value $\alpha=0.05$, we find that $\alpha=0.05$ removes all edges with a weight of 1, and consequently produces fewer irrelevant words. We thus present the results corresponding to $\alpha=0.05$ in the rest of the manuscript. More details regarding the differences between different values of $\alpha$ are found in the Supplementary Information. Depending on the corpus, the edges that are removed at $\alpha=0.05$ are not random (Figure~\ref{fig:hclinton_scorepair_by_threshold}). In the ``favor'' corpus, the vast majority of edges connecting negative words to other negative words have been removed, as well as edges that connect extremely positive words. In contrast, the removal of edges in the ``against'' corpus does not have a clear dependence on the scores. In all corpora, the dominance of neutral-neutral connections still holds, albeit at a tighter range. Figure~\ref{fig:hclinton_backbone_scorecontrib_dist_v2} shows the histogram of the contribution to the deviation from neutrality of each word, $h_{\Delta,w}$ for $\alpha=0.05$, the most restrictive of the values tested. Compared to the complete network (Figure~\ref{fig:hclinton_scorecontrib_count_dist_v2}), the ``favor'' corpus lost a significant number of words with happiness scores below $h=5$. On the contrary, the ``against'' corpus did not lose as many negative words, although many positive words remained. There is also a clearer difference in the score profiles of the ``favor'' and ``against'' backbone networks, and this was attained not through the use of score cutoffs but by using the co-occurrence network structure itself. Aside from this, there are now fewer words in the backbone that have low word counts, increasing the overall influence of non-neutral words that occur with higher frequency. The ``all'' corpus, being a combination of the two, has similarities to both. To see if we can extract the properties of the ``favor'' and ``against'' stances in the ``all'' corpus, we turn to community detection. \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{Fig5.png} \caption{\textbf{Distribution of words and their contributions to the deviation from neutrality in terms of their word counts and happiness scores after network backboning.} A 2D histogram of (a) the word counts and (b) the deviation from neutrality $h_{\Delta,w}$ of the words for each network backbone at $\alpha=0.05$.} \label{fig:hclinton_backbone_scorecontrib_dist_v2} \end{figure*} \subsection{Community detection and characterization} \label{subsec:results-community} We have seen that by removing commonly used words on Twitter, a number of high-degree neutral words were removed, increasing the proportion of positive and negative words in the corpus. Using the disparity filter further removed low-weight edges. With more restrictive thresholds, edges connecting negative words to other negative words are removed in the ``favor'' corpus, while no distinct patterns are seen in the ``against'' and ``all'' corpora. Whereas negative words were removed from both the ``favor'' and ``against'' corpora, the ``favor'' corpus lost more negative words, resulting in an amplified difference between the average happiness score of the two corpora. We now investigate whether there is meaningful community structure in the co-occurrence network, and whether this structure can be used to uncover and isolate mixed sentiments in the corpora, particularly in the ``all'' corpus where we expect opposing sentiments to exist. We find that different values of the disparity filter threshold $\alpha$ all give consistent communities that fit a given theme, with more restrictive values of $\alpha$ keeping the communities that can be attributable to known events and reducing the number of communities with words that are less coherent. The following results were obtained using the Louvain algorithm on the backbone derived using $\alpha=0.05$. \subsubsection{Characterizing communities} \label{subsubsec:results-community-wordcloud} Figures~\ref{fig:hclinton_wordbar_FAVOR} to~\ref{fig:hclinton_wordbar_ALL} show the words with the highest word counts in each of the biggest communities (note that for the backbone network, the degree is no longer necessarily correlated with the word counts), their contributions to the deviation from normality of the average score of the community, and their word counts in the corpus. We see that the biggest communities consist of related words and form a consistent narrative. In the ``favor'' corpus (Figure~\ref{fig:hclinton_wordbar_FAVOR}), we see that the communities A and B are about the elections; D relates to being a woman president. We note that despite (or rather, due to) ``nasty woman'' being a term used by Donald Trump to denigrate Hillary Clinton, the phrase has been used as a rallying cry by feminists to support Clinton~\cite{gray_how_2016}, so it is not a surprise to find it with words that are likely to favor her. On the other hand, Community E is a community with Donald Trump's ``MAGA'' slogan (short for ``Make America Great Again''). As expected, it also contains other words and hashtags that relate to scandals concerning Hillary Clinton, but the corresponding word counts are less than those in the biggest communities A and B. Community C contains words that are related to the Democratic party, with the word ``white'' likely often used in the context of both the ``White House'' and the Black Lives Matter movement. In each of the larger communities (except for community E), the most frequently occurring words are the words that we expect to be associated with a favorable stance towards Hillary Clinton. The smaller communities contain words that do not necessarily conform to a theme, although we note that there are a number of isolated communities that contain infrequently used words. Examples of these are: ``louis'' and ``ck'' (Louis C.K. is a comedian); ``west'' and ``coast'' (West Coast is used to refer to the west coast of the United States); and ``lady'' and ``gaga'' (Lady Gaga is a singer). Overall, the consistency of our results with the expectations from our domain knowledge supports the validity of the backboning and community detection algorithms used. Similar patterns can be found in the ``against'' corpus (Figure~\ref{fig:hclinton_wordbar_AGAINST}). The biggest community, A, is characterized by words that are for voting Trump rather than Clinton (``maga'', ``vote'', ``trumptrain'') and also include hashtags that are against Hillary such as ``neverhillary'', ``hillaryforprison'', and ``lockherup''). Community B contains words relating to scandals against Hillary Clinton (``wikileaks'', ``emails'', ``benghazi'', ``collusion'', ``podesta''), while community D contains the words ``bill'', ``women'', and ``rapist'', which are likely related to rape allegations against Hillary Clinton's husband Bill Clinton. Some smaller communities have words that are related to a theme, such as community G (``msm'', ``media'', and ``debates'') and community H (``cnn'', ``video'', and ``caught'' as well as ``anderson'', ``cooper'', ``msnbc'') , but there are also words in these communities that are not related. In the combined corpus (Figure~\ref{fig:hclinton_wordbar_ALL}), we see communities similar to the dominant ones in the ``favor'' and ``against'' corpora. Community A is about voting, community B contains words that are either against Hillary or for Donald Trump, community C contains words relating to scandals involving Hillary Clinton, and community D contains words that relate to the rape allegations against Bill Clinton. Some themes in smaller communities also exist. In community G, we see words relating to other Democrats and the Black Lives Matter movement, while community H contains words about the media (``cnn'', ``msnbc'', as well as ``nbc'', ``foxnews'', ``anderson'', ``cooper'', ``bernie'' and ``sanders'', referring to Bernie Sanders who was Hillary Clinton's main opponent in the Democrat primaries). \begin{figure*}[ht!] \centering \includegraphics[width=.82\textwidth]{Fig6.png} \caption{\textbf{Word bars obtained for the top 9 communities with the most number of nodes for the ``FAVOR'' tweets.} The shaded bars give the deviation from normality ($h^{C}_{\Delta,w}$, top x-axis) as computed by Equation~\ref{eq:score_contrib} for the community. The unfilled bars give the relative frequency of the word compared to the sum of all the counts of the words in the backbone $B$ ($N_w/\sum_{w\in B}N_w$, bottom x-axis). Note that the bottom x-axis is symmetric about 0 to always make the unfilled bars appear directly below the shaded bars. The number of nodes and the average scores for each community are given above each plot.} \label{fig:hclinton_wordbar_FAVOR} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=.82\textwidth]{Fig7.png} \caption{\textbf{Word bars obtained for the top 9 communities with the most number of nodes for the ``AGAINST'' tweets.} The shaded bars give the deviation from normality ($h^{C}_{\Delta,w}$, top x-axis) as computed by Equation~\ref{eq:score_contrib} for the community. The unfilled bars give the relative frequency of the word compared to the sum of all the counts of the words in the backbone $B$ ($N_w/\sum_{w\in B}N_w$, bottom x-axis). Note that the bottom x-axis is symmetric about 0 to always make the unfilled bars appear directly below the shaded bars. The number of nodes and the average scores for each community are given above each plot.} \label{fig:hclinton_wordbar_AGAINST} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=.82\textwidth]{Fig8.png} \caption{\textbf{Word bars obtained for the top 9 communities with the most number of nodes for the ``ALL'' tweets.} The shaded bars give the deviation from normality ($h^{C}_{\Delta,w}$, top x-axis) as computed by Equation~\ref{eq:score_contrib} for the community. The unfilled bars give the relative frequency of the word compared to the sum of all the counts of the words in the backbone $B$ ($N_w/\sum_{w\in B}N_w$, bottom x-axis). Note that the bottom x-axis is symmetric about 0 to always make the unfilled bars appear directly below the shaded bars. The number of nodes and the average scores for each community are given above each plot.} \label{fig:hclinton_wordbar_ALL} \end{figure*} \subsubsection{Communities and scores} \label{subsubsec:results-community-scores} We have shown how disjoint communities in the network correspond to certain themes, with themes that are for or against Hillary Clinton clearly separated in the different corpora. We now explore whether communities of different themes differ in terms of the scores of the words they contain. The biggest communities in ``favor'' corpus are dominated by positive contributions from normality (Figure~\ref{fig:hclinton_comm_scorecontrib_FAVOR}, while notable negative words include ``nasty'' (community D), ``wikileaks'' (community E), and ``rape'' (community I). As discussed earlier, the word ``nasty'' (in the context of ``nasty woman''), though inherently negative, has been used by supporters of Hillary Clinton. Closer examination of tweets reveal that although the hashtag ``\#imwithher'' is known mainly to express opinions favorable to Hillary Clinton, it is also hijacked by those who express negative opinions about her, and we find that community detection on the backbone of the co-occurrence network was able to isolate these negative themes. The biggest community (community A) in the ``against'' corpus is characterized by words of support for Donald Trump, primarily by the acronym ``maga'' (``make America great again''), Donald Trump's slogan in the 2016 elections (Figure~\ref{fig:hclinton_comm_scorecontrib_AGAINST}. Community B contains words relating to the scandals involving Hillary Clinton (``wikileaks''). It also contains ``emails'' which has a positive score in the labMT dataset, despite it having a negative connotation in the context of the 2016 US presidential elections. Community C has the negative words ``lies'', ``lying'', and ``jail'', but also the positive words ``love'' and ``great''. We note that although ``love'' and ``great'' are some of the most commonly used words on Twitter, they are not as frequently used in this corpus and were therefore not filtered out. Closer examination of the raw tweets show that these positive words are used in a negative or sarcastic sense against Hillary Clinton. Community D has an extremely low negative score due to the words associated with ``rape''. The word ``bill'', which was mostly used in the context of ``Bill Clinton'', has a score of 3.64, as it was probably interpreted by the labMT respondents to mean ``invoice'', as in ``medical bill'' or ``electric bill''. Regardless, even if ``bill'' were not scored, we see that the words in community D were mainly negative, consistent with its association with ``rape''. A notable exception is the word ``women'', which has a happiness score of 7.12, even though it is used often with the word ``rape'' in this context. The biggest community (community A) in the combination of the two corpora (``all'') is mainly positive (Figure~\ref{fig:hclinton_comm_scorecontrib_ALL}, which is consistent with the fact that the most frequently used words in this community are in support of Hillary Clinton. Community B has a fair share of negative words that are used against Hillary Clinton (``lies'', ``corrupt'', ``criminal'') but are also used with Trump's slogan ``maga'', which carries a positive score. Community C, being about particular scandals such as ``wikileaks'', has fewer negative words. Further, some words that are used in a negative sense in this context are in general either positive or neutral words (``emails'', ``spiritcooking''). Community D contains many negative words associated with ``rape'', but also positive words such as ``women'', which in turn commonly occurs with ``nasty'' (in the context of ``nasty women''). Communities E and F both have dominant negative words, but the words in these communities do not share coherent themes. \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{Fig9.png} \caption{\textbf{Score contributions in communities for the ``FAVOR'' corpus.} A 2D histogram of the score contributions of words as a function of their scores and word counts for the 9 biggest communities in the ``FAVOR'' corpus. The average happiness score and number of nodes for each community is given above each plot.} \label{fig:hclinton_comm_scorecontrib_FAVOR} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{Fig10.png} \caption{\textbf{Score contributions in communities for the ``AGAINST'' corpus.}A 2D histogram of the score contributions of words as a function of their scores and word counts for the 9 biggest communities in the ``AGAINST'' corpus. The average happiness score for each community is given above each plot.} \label{fig:hclinton_comm_scorecontrib_AGAINST} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{Fig11.png} \caption{\textbf{Score contributions in communities for the ``ALL'' corpus.} A 2D histogram of the score contributions of words as a function of their scores and word counts for the 9 biggest communities in the ``ALL'' corpus. The average happiness score for each community is given above each plot.} \label{fig:hclinton_comm_scorecontrib_ALL} \end{figure*} Figure~\ref{fig:hclinton_comm_scores} shows the average happiness scores weighted by the word count for each community with at least 15 nodes. For comparison, we also include the average scores per community obtained if the scores were shuffled across the unfiltered network, but the network structure (and thus the communities) were retained. In the shuffled version, the range of the community scores are similar across stances, which is not the case in the original network, indicating that the score profiles found for the communities are not random. We also include in the figure the average happiness scores computed if no network backboning was implemented, but if words close to neutral ($4<h<6$) were disregarded, as is customary in studies using happiness scores~\cite{dodds_temporal_2011,dodds_human_2015}. While removing these words increases the scores across all corpora, reflecting the dominance of positive words in text~\cite{dodds_human_2015}, network backboning only increased the scores in the ``favor'' corpus and not in the ``against'' corpus, resulting in a moderate increase in the ``all'' corpus compared to the average happiness score derived from the complete network. \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{Fig12.png} \caption{\textbf{Average happiness scores for each community.} The average happiness scores weighted by the word count for each community for communities with at least 15 words are shown in the plot. The set of communities on the left is for the original backboned network, while the one on the right is for the same network but with the scores shuffled among the nodes. Whereas the ``favor'', ``against'', and ``all'' communities in the original backboned network show different ranges, the shuffled score version gives similar ranges for the communities in the three corpora, indicating that the score profiles found in communities are not random. The dashed line is the average happiness of all the words in the backbone, the dotted line is the average happiness of all the words in the raw network, and the dash-dot line gives the average happiness of the raw network if nodes with scores in the range (4,6) are excluded. The size of each symbol is proportional to the total word counts of all the words in that community; note that with the backboning this is no longer necessarily correlated with the degree. The colors indicate the community labels; smaller communities than A-I are all labeled ``other''.} \label{fig:hclinton_comm_scores} \end{figure*} \FloatBarrier \section{Discussion and summary} \label{sec:conclusion} From the word co-occurrence network, we examined how the co-occurrence structure of words in political tweets is related to the word happiness scores. In particular, we looked at three corpora that relate to the American politician Hillary Clinton: one collected using the hashtag ``\#imwithher'', which is associated with being in favor of Clinton; another collected using the hashtag ``\#crookedhillary'', which is associated with being against her; and a combination of both corpora. The degree, node strength, word count and tweet count distributions are all heavy-tailed, consistent with what is expected from Zipf's law ~\cite{ryland_williams_zipfs_2015,williams_text_2015}. Although it is expected that neutral words would dominate the corpus without any backboning or filtering, we find little assortative mixing outside the neutral range. Contrary to our expectation, while positive or negative words are more likely to co-occur with neutral words, positive or negative words are not more likely to co-occur with words of similar polarity. A clear demonstration of this is the use of the hashtag ``\#maga'', which on its own exhibits a highly positive sentiment. However, as a slogan for Donald Trump, it is also used together with words with a negative sentiment against Hillary Clinton. Further, we compared the score profiles with null models that change the network structure or the scores, and find that network structure plays a much smaller role in the score profile than the score distribution. Given that several words in the corpus do not occur frequently, we extracted a more robust network structure using network backboning. We implemented it in two passes, first by removing frequently occurring words on Twitter, and second, by using the disparity filter to remove edges between words that co-occur less frequently. Performing community detection on the resulting backbone results in well-defined communities that correspond to themes in favor or against the target (Hillary Clinton), even for the ``favor'' or ``against'' corpora that lean more towards only one stance. Effectively, the Louvain algorithm, a non-overlapping community detection model, functions like a topic model when applied to the word co-occurrence network when co-occurrence is taken at a tweet level. The average happiness scores of the communities also correspond to the theme that they are associated with. Communities dominated by words in favor of Hillary Clinton tend to be have higher happiness scores, while those dominated by words against her tend to have lower happiness scores. A few context-specific words whose scores do not reflect their meaning are ``nastywoman'', ``nasty'', and the name ``bill'', but even if these words are disregarded, we still see similar behavior for the rest of the words in their communities. We also note that both positive and negative words are present in each community. Notably, even in the most negative communities in the ``against'' corpus, we find positive words, reaffirming the positivity bias of human language~\cite{dodds_human_2015} found even in negative statements~\cite{aithal_positivity_2021}. In summary, we found that raw co-occurrence networks in tweets are dominated by neutral words as well as connections between them, and no score homophily is observed. Network backboning reduces the influence of neutral words, but does not uncover assortative mixing. However, when split into communities, the average happiness score of the community corresponds with the theme. Further, opposing themes are found, not just when the opposing tweets are equal in number (as in the ``all'' corpus), but also when an opposing theme is in the minority. This indicates that the word co-occurrence network with backboning and community detection can be used to detect the presence of opposing sentiments within a corpus. We have only tested our methods on political tweets, and also for a limited subset. Because generating the word co-occurrence network does not involve any filters, applying our analysis to a larger dataset, such as an entire day's worth of tweets or a more popular anchor such as all tweets mentioning the words ``Trump" or ``BTS", which have extremely high word counts on Twitter~\cite{dodds_fame_2021}, would be computationally expensive. Implementing a suitable filter in the network generation step may be necessary and is an avenue for future work. We would also like to expand our work in the future to analyze and compare tweets from different domains, as well as include higher order n-grams in our analysis. \FloatBarrier \section*{Supplementary Material} \subsection{Removing hashtag hijacking} When we performed community detection on all the tweets, we found a community with words unrelated to Hillary Clinton or the elections, such as ``santa'' and ``christmas''. Upon checking the raw tweets with these words, we found that they all contained the hashtag \texttt{\#smptweettest}. All tweets with this hashtag were removed in the dataset analyzed in the manuscript. \subsection{Most frequently used words removed in network backboning} Table~\ref{tab:removed_words} shows the words removed in the initial backboning step by comparing the words that consistently made it to the top 400 1-grams in Twitter for 100 random days and the top 200 case-insensitive 1-grams in each of the ``favor'', ``against'', and ``all'' corpora. \input{supplementary_word_table} \newpage \subsection{Comparison with null models} We include here the histograms (Figures~\ref{fig:hclinton_scorecontrib_count_dist_v2_configmodel}-\ref{fig:hclinton_scorepair_happiness_heatmap_v2_uniform}) corresponding to Figures~\ref{fig:hclinton_scorecontrib_count_dist_v2}-\ref{fig:hclinton_scorepair_happiness_heatmap_v2} for the null models using the configuration network model, the Erdos-Renyi model, the shuffled score model, and the uniform score model (Section~\ref{subsec:method-network-characterization}). \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{figures_supp/HClintonDecahose_modify=network_configmodel_scorecontrib_count_heatmap_marginal_score=happiness_v2_v3.png} \caption{(a) The 2D histogram for word count vs. happiness score, with the corresponding marginal distributions shown (note that each word has a weight of 1) for the \textbf{configuration model}. (b) A 2D histogram of the contributions of words in word count-happiness space to the deviation from neutrality, $h_{\Delta, w} = (h_w - 5) * N_w / \sum_{w^{\prime}}{N_{w^{\prime}}}$, where $h_w$ is the word's happiness score of word and $N_w$ is the number of times the word appears in the corpus. The marginal distributions are also included. Vertical lines at $h=5$ are added to guide the eye. } \label{fig:hclinton_scorecontrib_count_dist_v2_configmodel} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{figures_supp/HClintonDecahose_modify=network_ERauto_scorecontrib_count_heatmap_marginal_score=happiness_v2_v3.png} \caption{(a) The 2D histogram for word count vs. happiness score, with the corresponding marginal distributions shown (note that each word has a weight of 1) for the \textbf{Erdos-Renyi null model}. (b) A 2D histogram of the contributions of words in word count-happiness space to the deviation from neutrality, $h_{\Delta, w} = (h_w - 5) * N_w / \sum_{w^{\prime}}{N_{w^{\prime}}}$, where $h_w$ is the word's happiness score of word and $N_w$ is the number of times the word appears in the corpus. The marginal distributions are also included. Vertical lines at $h=5$ are added to guide the eye. } \label{fig:hclinton_scorecontrib_count_dist_v2_ERauto} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{figures_supp/HClintonDecahose_modify=score_internalshuffle_scorecontrib_count_heatmap_marginal_score=happiness_v2_v3.png} \caption{(a) The 2D histogram for word count vs. happiness score, with the corresponding marginal distributions shown (note that each word has a weight of 1) for the \textbf{shuffled score model}. (b) A 2D histogram of the contributions of words in word count-happiness space to the deviation from neutrality, $h_{\Delta, w} = (h_w - 5) * N_w / \sum_{w^{\prime}}{N_{w^{\prime}}}$, where $h_w$ is the word's happiness score of word and $N_w$ is the number of times the word appears in the corpus. The marginal distributions are also included. Vertical lines at $h=5$ are added to guide the eye. } \label{fig:hclinton_scorecontrib_count_dist_v2_internalshuffle} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{figures_supp/HClintonDecahose_modify=score_uniform_scorecontrib_count_heatmap_marginal_score=happiness_v2_v3.png} \caption{(a) The 2D histogram for word count vs. happiness score, with the corresponding marginal distributions shown (note that each word has a weight of 1) for the \textbf{uniform score model}. (b) A 2D histogram of the contributions of words in word count-happiness space to the deviation from neutrality, $h_{\Delta, w} = (h_w - 5) * N_w / \sum_{w^{\prime}}{N_{w^{\prime}}}$, where $h_w$ is the word's happiness score of word and $N_w$ is the number of times the word appears in the corpus. The marginal distributions are also included. Vertical lines at $h=5$ are added to guide the eye. } \label{fig:hclinton_scorecontrib_count_dist_v2_uniform} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{figures_supp/HClintonDecahose_modify=network_configmodel_score_degree_heatmap_marginal_score=happiness_v2_v3.png} \caption{2D histograms for both the node strengths (top row) and degree (bottom row) vs. happiness scores for the \textbf{configuration model}.} \label{fig:hclinton_score_degree_dist_v2_configmodel} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{figures_supp/HClintonDecahose_modify=network_ERauto_score_degree_heatmap_marginal_score=happiness_v2_v3.png} \caption{2D histograms for both the node strengths (top row) and degree (bottom row) vs. happiness scores for the \textbf{Erdos-Renyi null model}.} \label{fig:hclinton_score_degree_dist_v2_ERauto} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{figures_supp/HClintonDecahose_modify=score_internalshuffle_score_degree_heatmap_marginal_score=happiness_v2_v3.png} \caption{2D histograms for both the node strengths (top row) and degree (bottom row) vs. happiness scores for the \textbf{shuffled score model}.} \label{fig:hclinton_score_degree_dist_v2_internalshuffle} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{figures_supp/HClintonDecahose_modify=score_uniform_score_degree_heatmap_marginal_score=happiness_v2_v3.png} \caption{2D histograms for both the node strengths (top row) and degree (bottom row) vs. happiness scores for the \textbf{uniform score model}.} \label{fig:hclinton_score_degree_dist_v2_uniform} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{figures_supp/HClintonDecahose_modify=network_configmodel_scorepair_heatmap_score=happiness_weight=weight_v2.png} \caption{The happiness scores of each pair of nodes for the \textbf{configuration model} are plotted in this 2D histogram. Each pair of nodes is weighted by the weight of the edge connecting them. We made the histogram to be symmetric about the 45$\degree$ line so that one can analyze it from either the horizontal or vertical direction.} \label{fig:hclinton_scorepair_happiness_heatmap_v2_configmodel} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{figures_supp/HClintonDecahose_modify=network_ERauto_scorepair_heatmap_score=happiness_weight=weight_v2.png} \caption{The happiness scores of each pair of nodes for the \textbf{Erdos-Renyi null model} are plotted in this 2D histogram. Each pair of nodes is weighted by the weight of the edge connecting them. We made the histogram to be symmetric about the 45$\degree$ line so that one can analyze it from either the horizontal or vertical direction.} \label{fig:hclinton_scorepair_happiness_heatmap_v2_ERauto} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{figures_supp/HClintonDecahose_modify=score_internalshuffle_scorepair_heatmap_score=happiness_weight=weight_v2.png} \caption{The happiness scores of each pair of nodes for the \textbf{shuffled score model} are plotted in this 2D histogram. Each pair of nodes is weighted by the weight of the edge connecting them. We made the histogram to be symmetric about the 45$\degree$ line so that one can analyze it from either the horizontal or vertical direction.} \label{fig:hclinton_scorepair_happiness_heatmap_v2_internalshuffle} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{figures_supp/HClintonDecahose_modify=score_uniform_scorepair_heatmap_score=happiness_weight=weight_v2.png} \caption{The happiness scores of each pair of nodes for the \textbf{uniform score model} are plotted in this 2D histogram. Each pair of nodes is weighted by the weight of the edge connecting them. We made the histogram to be symmetric about the 45$\degree$ line so that one can analyze it from either the horizontal or vertical direction.} \label{fig:hclinton_scorepair_happiness_heatmap_v2_uniform} \end{figure*} \FloatBarrier \subsection{Disparity filter} Figure~\ref{fig:hclinton_graphprop_by_threshold} shows how the size and order of the backbone vary depending on the significance level $\alpha$ chosen after removing the most commonly used words and applying the disparity filter, with $\alpha=1$ corresponding to the network without the most common words on Twitter and the values on the y-axis corresponding to the complete network from which neither the most common words on Twitter nor any likely spurious edges were removed. The removal of words from Twitter eliminated several edges from the network, but few edges are removed by the disparity filter until the threshold value reaches $\alpha=0.4$. As the value of $\alpha$ decreases, more edges are eliminated, but this also means more nodes are likely to be removed from the backbone. As a result, the number of components does not change monotonically with $\alpha$ (Figure~\ref{fig:hclinton_components_by_threshold}). Note that since the disparity filter removes isolated nodes, there is a huge drop in the number of components from $\alpha=1$ to $\alpha=0.9$ even if the number of nodes does not change much. The giant component is also by far the largest of all the components, as can be deduced in the plot of the fraction $n_2 / n$, where $n$ is the number of nodes in the entire network and $n_2$ is the number of nodes in the second largest component (Figure~\ref{fig:hclinton_components_by_threshold}). The resulting score distributions, however, are very similar regardless of the threshold (Figure~\ref{fig:hclinton_scoredist_by_threshold}). As the most commonly used words on Twitter are also mostly neutral, removing these manually from the network increases the relative frequency of positive and negative words compared to the original network. Note that this change is due to the removal of the most commonly used words on Twitter; the disparity filter itself only minimally alters the score distribution except for low values of $\alpha$, where a slight decrease in the relative frequency of negative words in the ``favor'' corpus is observed. This implies that in terms of the criteria set by the disparity filter, the relevance of nodes does not depend much on their happiness scores, as both neutral and non-neutral words get filtered out. As the disparity filter becomes more restrictive, it removes more edges and alters the degree distribution (Figure~\ref{fig:hclinton_edgeweight_degree_dist_by_threshold}), reducing the peak from around $k=10$ to around $k=1$. The filter also disproportionately targets edges with lower weights. Whereas the maximum degrees and edge weights remain similar across different values of $\alpha$, edges with weights close to 1 have been completely eliminated with $\alpha=0.05$. \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{figures_supp/HClintonDecahose_bbmode=0_bb=DF_nlarg=200_maxrank=400_combinedprop_by_threshold.png} \caption{Graph (a) order, (b) size and (c) average happiness score weighted by word count as a function of the threshold used in the disparity filter. $\alpha=1$ indicates that the top words from Twitter were removed, but the disparity filter was not applied, while the points on the y-axis correspond to the values from the complete network without any backboning.} \label{fig:hclinton_graphprop_by_threshold} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=0.8\textwidth]{figures_supp/HClintonDecahose_bbmode=0_bb=DF_nlarg=200_maxrank=400_componentinfo_by_threshold.png} \caption{Number of connected components and relative size of the second-largest component to the largest component for all thresholds.} \label{fig:hclinton_components_by_threshold} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{figures_supp/combined_score_dist_thresholds=0.9,0.4,0.3,0.05.png} \caption{Relative frequencies of happiness scores in the backbone for significance levels $\alpha=0.9, 0.4, 0.3, 0.05$. Curves marked ``orig'' refer to the original network, while those marked ``bb'' refer to the backbone. The suffix ``\_weighted'' indicates that the words are weighted by their word counts.} \label{fig:hclinton_scoredist_by_threshold} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{figures_supp/combined_edgeweight_degree_thresholds=0.9,0.4,0.3,0.05.png} \caption{The distributions of the node degrees, node strengths, and edge weights for significance levels $\alpha=0.9, 0.4, 0.3, 0.05$.} \label{fig:hclinton_edgeweight_degree_dist_by_threshold} \end{figure*} \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{figures_supp/combined_scorepair_thresholds=0.9,0.4,0.3,0.05.png} \caption{2D histogram of scores of connected nodes weighted by the edge weights for significance levels $\alpha=0.9, 0.4, 0.3, 0.05$. Note that the heat map is made to be symmetric about the 45$\degree$ line so it can be analyzed from either the horizontal or vertical direction.} \label{fig:hclinton_scorepair_by_threshold} \end{figure*}
\section{Introduction} \label{sec:Introduction} LDA \cite{blei2003latent} is a hierarchical Bayesian model that is most commonly known for its ability to extract latent semantic topics from text corpora. It can also be thought of as the categorical/discrete analog of Bayesian principal component analysis (PCA) \cite{buntine2002variational} and can be used to extract latent aspects from collections of discrete data \cite{blei2003latent}. It finds application in fields such as medicine \cite{backenroth2017fun, pritchard2000inference}, computer vision \cite{fei2005bayesian, sivic2005discovering, wang2008spatial} and finance \cite{feuerriegel2018investor, shirota2014extraction}. In non-text specific applications, it is commonly referred to as grade of membership \cite{woodbury1982new} or aspect modeling \cite{minka2002expectation}. In LDA the required posterior distribution is intractable (i.e., one cannot apply exact inference to calculate it) and therefore a variety of approximate inference techniques can be employed \cite{blei2003latent}. For most text topic modeling problems the traditional approximate inference techniques are sufficient. However, in many cases where less data is available (due to smaller collections and/or collections where document size is small) or where there is large topic overlap (these make for more difficult inference) alternative approaches are favored \cite{phan2008learning,hong2010empirical,ramage2010characterizing,jin2011transferring}. The phenomenal increase in social media usage, typified by digital microblogging platforms such as Twitter \cite{weng2010twitterrank, ramage2010characterizing}, has called attention to the need for addressing problems associated with the semantic analysis of text corpora involving short texts \cite{hong2010empirical, basave2014automatic, nugroho2015incorporating}. The difficulties inherent in the extraction of topic information from very short texts \cite{phan2008learning,mehrotra2013improving,yan2013biterm} are partly due to the small number of words remaining after the removal of stop words \cite{hong2010empirical,albakour2013sparsity}. On average, the number of words per tweet, even before data cleaning, is between 8 and 16 words \cite{jabeur2012uprising, celikyilmaz2010probabilistic}. One way of artificially increasing document length is to pool documents into longer pseudodocuments. This can be achieved by employing automatic strategies \cite{quan2015short}; by combining documents from the same author \cite{hong2010empirical, weng2010twitterrank}, by making use of temporal information \cite{mehrotra2013improving}, or by merging documents based on hashtags \cite{mehrotra2013improving,jin2011transferring}. These methods can be applied only if the relevant information is available and sufficient \cite{sokolova2016topic, ramage2010characterizing}. Another approach to improve LDA performance in the presence of minimal data is to extend the graphical model itself to include additional information such as temporal \cite{wang2006topics} or author \cite{rosen2004author} information. For small corpora (not necessarily consisting of documents containing short texts), a way to further improve performance is to apply transfer learning \cite{phan2008learning,hong2010empirical, jin2011transferring}; word-topic distributions are learnt from a large, universal corpus \cite{phan2008learning, jin2011transferring}, following which they are updated by applying LDA to the smaller corpus. However, due to limited general universal corpora for certain non-text applications as well as for niche context specific text corpora (legal and financial for example), results can be less than optimal. In this article, we present our general approach to improving LDA accuracy on small data sets by using an alternative approximate inference technique. By modifying the inference only, we allow other strategies such as pooling or transfer learning to be applied additionally where the data set allows. \section{Variational inference} Variational inference (VI) is an approximate inference technique that directly optimizes the accuracy of an approximate posterior distribution \cite{winn2004variational} that is parameterized by free variational parameters \cite{blei2017variational}. In VI, we choose a restricted family of distributions $q(\bm{h})$ (with $\bm{h}$ the variational parameters) and then find the member of this family (by finding the setting of the parameters) for which a divergence measure is minimized -- this changes an inference problem into an optimization problem \cite{blei2017variational}. Variational Bayes (VB), the original inference technique used in LDA \cite{blei2003latent}, is a framework that can be used to find $q(\bm{h})$ in an iterative expectation maximization like manner \cite{attias2000variational} once the variational equations have been derived. An alternative to deriving these equations for each model and then using VB for the optimization, is to use variational message passing (VMP) \cite{winn2004variational, winn2005variational}. The success of VB as an an approximate inference technique for LDA has resulted in its widespread use for topic modeling by machine learning practitioners \cite{foulds2013stochastic}, two of the main Python implementations being Gensim \cite{rehurek2010software} and Scikit-learn \cite{pedregosa2011scikit}. However, when working with small text corpora, or performing aspect modeling on small non-text data sets, the quality of extracted aspects can be low \cite{hong2010empirical, yan2013biterm}. In this article we do not alter the LDA graphical model, nor do we use document pooling or transfer learning, but instead we present method that employs the full joint distributions arising from the graphical description of the standard LDA model. In our approach, we use a variational alternative to VB that is based on Loopy Belief update (LBU) \cite{koller2009probabilistic}[p364-366], also known as the Lauritzen-Spiegelhalter variant \cite{lauritzen1988local} of the Sum-Product algorithm \cite{heskes2003stable}. LBU is a message passing algorithm that has been shown to be variational in nature \cite{koller2009probabilistic} and differs from LBP in the manner that over-counting is handled (instead of excluding reverse direction messages when calculating an outgoing message, we perform message cancelling when updating the target factor. We utilize LBU directly where possible, and where approximate messages are required, we derive update equations by using a sampling approach (which turns out to have strong similarities with the VMP approximate messages). ALBU is, to our knowledge, a novel novel algorithm for LDA since the only similar approach to Loopy Belief propagation (LBP) for LDA that we are aware of is a collapsed Loopy Belief implementation by Zeng \cite{zeng2012topic, zeng2012learning} where a Sum-Sum approximate of the Sum-Product algorithm \cite{zeng2012learning} is used. Due to the collapsed nature of the graphical model, the update equations differ significantly and the complexity of updating the Dirichlet distributions disappears. Other collapsed algorithms such as CVB \cite{teh2007collapsed} and CVBO \cite{asuncion2009smoothing} have shown to outperform VB but we do not attempt currently attempt to compare our work to these collapsed algorithms. To compare our implementation with VB, we use an open source VB implementation, Gensim \cite{rehurek2010software}. We also benchmark our algorithm against collapsed Gibbs sampling to give an indication of its performance (using the standard Python lda package from PyPi \cite{pypi}) since is shown to be more effective than VB in extracting topics correctly \cite{teh2007collapsed, zeng2012learning}, especially in the presence of little data. \section{The ALBU algorithm} \label{sec:emdw} In the following section we present the approximate LBU (ALBU) LDA algorithm. We first define the graph and then present the factor updates. \subsection{Notation and graphical representation of LDA} Because LDA was popularized in the context of text topic modeling \cite{blei2003latent}, the terminology for describing the algorithm is often linked to the terminology used in this field. We are using simulated data and are therefore not bound by terminology from particular fields. For readability, however, we give preference to the traditional terminology used in text topic modeling: when applied to a corpus, LDA extracts topic-document Dirichlet distributions and word-topic Dirichlet distributions. \begin{figure}[ht] \vskip 0.2in \begin{center} \centerline{\includegraphics[width=0.6\columnwidth]{images/bn2.pdf}} \caption{Plate model of LDA system as a Bayes net.\label{fig:bn}} \end{center} \vskip -0.2in \end{figure} \begin{figure}[ht] \vskip 0.2in \begin{center} \centerline{\includegraphics[width=0.6\columnwidth]{images/cg2.pdf}} \caption{Plate model of LDA system as a factor graph. Variable nodes are given the name of their respective random variables and factor nodes are denoted by an $f$ and identified by the variable to the left of the conditioning bar on initialization, for example $f_{\theta_m} = p(\bm{\theta}_{m}|\bm{\alpha}_{m})$.\label{fig:bncg}} \end{center} \vskip -0.2in \end{figure} LDA was originally depicted \cite{blei2003latent} in the Bayes net plate model format shown in Fig.~\ref{fig:bn}. The $n$'th word in document $m$ is $W_{m,n}$ and depends on the (latent) topic $Z_{m,n}$ present in the document, which, in its turn selects a distribution from the set of Dirichlets $\bm{\Phi} \equiv \{\bm{\phi}_1\ldots \bm{\phi}_{K}\}$ which describes the words present in each topic. \begin{figure}[ht] \vskip 0.2in \begin{center} \centerline{\includegraphics[width=0.7\columnwidth]{images/unrolledFactor.pdf}} \caption{Unrolled factor graph representation of LDA for a two document corpus with two words per document. A single \textit{branch} is highlighted (where $m =1$ and $n = 2$). \label{fig:LDA_branch_hilight} } \end{center} \vskip -0.2in \end{figure} In Fig.~\ref{fig:bncg}, we show the factor graph representation of LDA where factors are named based on the random variables which are initially to the left of the conditioning bar. Figure \ref{fig:LDA_branch_hilight} shows an unrolled factor graph for a corpus containing two documents, two words per document and three topics. When we describe the algorithm below, we refer to one \textit{branch} of the LDA graph; this relates to one specific word, $n$, in a single specific document, $m$. The branch where $m =1$ and $n = 2$ is highlighted in Figure \ref{fig:LDA_branch_hilight}. \subsection{Description of the ALBU LDA algorithm} We first present our approach to the Bayesian parameter updating procedure for LDA, defining our notation for the hyperparameters, prior distributions and posterior distributions. Thereafter, using notation from Fig.~\ref{fig:LDA_branch_hilight}, we start at the word-topic Dirichlet distributions and present the factor update equations towards the topic-document Dirichlet distributions (forward sweep). After updating these Dirichlet distributions (by means of an approximation that is based on sampling) we present the update equations in the reverse direction (backward sweep). \subsubsection{General Algorithm for Bayesian parameter updating procedure for LDA} The hyperparameters are typically chosen (as described in Section 4) to be values between 0 and 1 to favor sparse distributions; $\bm{\beta}_1$ up to $\bm{\beta}_{K}$ are the parameters of the prior Dirichlet word-topic distributions and $\bm{\alpha}_1$ up to $\bm{\alpha}_{M}$ correspondingly are the parameters of the prior Dirichlet topic-document distributions. The message passing procedure will update these prior Dirichlet distributions to the posterior distributions (during each epoch) which will simply result in an update to the Dirichlet parameters. We will use $\bm{\beta}'$ and $\bm{\alpha}'$ values respectively to denote these updated parameters. During each epoch, the two internal distributions in each branch ($f_{Z_{m,n}}$ and $f_{W_{m,n}}$) operate on the latest posterior Dirichlet estimates -- with a small correction to prevent over-counting due to its own contribution to the posterior during the previous epoch. This is standard message passing protocol \cite{heskes2003stable, lauritzen1988local} and is implemented by subtracting its own increment to the posterior counts from the previous round of message passing. It is important to note that although we are presenting these equations in a factor graph form, our implementation uses a cluster graph architecture. Most readers will be familiar with the Sum-Product algorithm for factor graphs. We are using a slightly modified version of this (Loopy Belief Update) as described by Lauritzen-Spiegelhalter \cite{lauritzen1988local} where reverse direction messages are not excluded from the current message calculation, but rather cancelled. When referring to parameters post adjustment (the corrected values), $\bm{\beta}^{''}$ and $\bm{\alpha}^{''}$ will be used. These internal distributions, in turn, update the posterior Dirichlet distributions. This process iterates until a convergence criterion is met. We can now define the initial factors in a specific branch: \begin{itemize} \item Topic-Document Dirichlet factors, $f_{\theta_m}$, have an initial belief of \\ $p(\bm{\theta}_m; \alpha_{m,1},..., \alpha_{m, K}) = p(\bm{\theta}_m;\bm{\alpha}_m)$. \item Topic-Document Polya factors, $f_{Z_{m,n}}$, initially have a belief of $p(Z_{m,n};\bm{\theta}_m)$. \item Word-topic conditional Polya factors, $f_{W_{m,n}}$, initially have a factor belief of $p(W_{m,n}|Z_{m,n},\bm{\Phi})$. \item Word-topic Dirichlet set factors, $f_{\Phi}$, have an initial factor belief of $p(\bm{\phi}_1, ...,\bm{\phi}_{K};\bm{\beta}_1, ...,\bm{\beta}_{K} ) = p(\bm{\Phi};\bm{B})$. \end{itemize} \subsubsection{Forward sweep of ALBU LDA} During the forward sweep of each epoch, each word-topic Dirichlet factor node updates its respective word-topic Dirichlet variable node (initially, in the first epoch, this posterior Dirichlet is the same as the prior Dirichlet, parameterized by $\bm{\beta}^{'} = \bm{\beta}$). The Dirichlet variable node then sends a message to its respective conditional word-topic Polya factor node, $f_{W_{m,n}}$. Initially this factor node contains a conditional distribution which is defined as a categorical distribution for each topic, $p(W_{m,n}|\bm{\phi}_{k}, Z_{m,n}=k) =\prod_v\phi_{k,v}^{[W_{m,n}=v]}$. For each topic, we multiply this categorical distribution with the incoming message from the corresponding word-topic Dirichlet. The word-topic variable node (posterior Dirichlet) is defined as, \begin{equation} V_{\phi_k}^{\text{post}}=\mathsf{Dir}(\bm{\phi}_{k};\bm{\beta}^{'}_{k}) = \frac{\Gamma(\sum_{v}\beta^{'}_{k,v})}{\prod_v\Gamma(\beta^{'}_{k,v})} \prod_{v}\phi_{k,v}^{\beta^{'}_{k,v}-1}, \label{eq:twvn} \end{equation} To update the conditional word-topic Polya distributions, we correct for the contribution of the message sent in the reverse direction by using adjusted $\bm{\beta}^{''}$ Dirichlet parameters (these adjusted values are calculated by summing and subtracting $\beta$ parameters as the multiplications and divisions involve Dirichlet and Polya distributions). To get an update for the full posterior joint distribution at the factor node, $f_{W_{m,n}}$, we also need to multiply in the message from the variable node, $V_{Z_{m,n}}$. This message, $p(Z_{m,n};\bm{\alpha}^{''}_{m,n})$, is parameterized by adjusted $\bm{\alpha}^{''}_{m,n}$ topic-document Dirichlet parameters (due to message cancelling) for each word $n$ in each document $m$ and is derived in the backward sweep (Eq.~\ref{eq:pol_to_cpol}). The current posterior at $f_{W_{m,n}} = p(W_{m,n},Z_{m,n},\bm{\Phi};\bm{\alpha}'',\bm{B}'')$, and can be written as, \begin{equation} f_{W_{m,n}}= \left\{ \begin{array}{lr} p(Z_{m,n}=1)\frac{\Gamma(\sum_v\beta^{}_{1,v})}{\prod_{v}\Gamma(\beta^{}_{k,v})}\prod_v\phi_{1,v}^{[W_{m,n}=v]+\beta^{}_{1,v}-1} \\[1mm] \vdots &\\ [1mm] p(Z_{m,n}=K)\frac{\Gamma(\sum_v\beta^{}_{K,v})}{\prod_{v}\Gamma(\beta^{}_{k,v})}\prod_v\phi_{K,v}^{[W_{m,n}=v]+\beta^{}_{K,v}-1}. \end{array} \right.\label{eq:condpolyalda} \end{equation} Note that the hyperparameters are unique for each branch (for specific ${m}$ and ${n}$) due to message refinement but we do not indicate this in the subscripts (for $\beta_{k,v}$ this would be $\beta_{v,Z_{\mathsf{m},\mathsf{n}}={k}}$) to avoid unnecessary notational complexity. To update the topic-document Polya we use Equation \ref{eq:condpolyalda}. In LDA, the word is observed and this simplifies our update (for a single topic, $\mathsf{k}$) as follows, \begin{align} \Tilde{\mu}_{f_{W_{m,n}|Z_{{m},{n}}=\mathsf{k}}\xrightarrow{}{Z_{m,n}}} &= \frac{p(Z_{m,n}=\mathsf{k})\Gamma(\sum_v\beta_{v,Z_{{m},{n}}=\mathsf{k}}) }{\prod_{v}\Gamma(\beta_{v,Z_{{m},{n}}=\mathsf{k}}-1)}\int_{\bm{\phi}_{\mathsf{k}}} \phi_{\mathsf{v},Z_{{m},{n}}=\mathsf{k}}^{[W_{{m},{n}}=\mathsf{v}]+\beta_{\mathsf{v},Z_{{m},{n}}=\mathsf{k}}-1}d \bm{\phi}_{\mathsf{k}}\notag\\ &= \frac{p(Z_{m,n}=\mathsf{k})\Gamma(\sum_v\beta_{v,Z_{{m},{n}}=\mathsf{k}}) }{\prod_{v}\Gamma(\beta_{v,Z_{{m},{n}}=\mathsf{k}}-1)} \int_{\bm{\phi}_{\mathsf{k}}} \phi_{\mathsf{v},Z_{{m},{n}}=\mathsf{k}}^{\beta_{\mathsf{v},Z_{{m},{n}}=\mathsf{k}}}d \bm{\phi}_{\mathsf{k}} \notag\\ &= p_{\mathsf{k},\mathsf{v},m,n} \frac{\beta_{\mathsf{v},Z_{{m},{n}}=\mathsf{k}}}{\sum_v\beta_{v,Z_{{m},{n}}=\mathsf{k}}}. \label{eq:marg_theta_cpolrev} \end{align} where $p_{\mathsf{k},\mathsf{v},{m},{n}}$ are the current topic proportions for each observed word and topic (per branch) such that $p_{\mathsf{k},\mathsf{v},{m},{n}} = p(Z_{m,n}=\mathsf{k})$. Equation \ref{eq:marg_theta_cpolrev}, however, is un-normalized (as indicated by the $\Tilde{.}$ ) and has a volume of $\text{vol}_{\mathsf{v},\mathsf{k}} = Z$. We need to normalize the messages for each topic by multiplying each $\Tilde{\mu}_{f_{W_{m,n}|Z_{{m},{n}}=\mathsf{k}}\xrightarrow{}{Z_{m,n}}}$ by a normalizing constant to give, \begin{align} \mu_{f_{W_{m,n}|Z_{{m},{n}}=\mathsf{k}}\xrightarrow{}{Z_{m,n}}} &= \frac{1}{Z}p_{\mathsf{k},\mathsf{v},{m},{n}} \frac{\beta^{''}_{\mathsf{v},Z_{{m},{n}}=\mathsf{k}}}{\sum_v\beta^{''}_{v,Z_{{m},{n}}=\mathsf{k}}}. \label{eq:marg_theta_cpol} \end{align} We can now update each of the topic-document Polya factors (defined in Equation \ref{eq:fz}) by multiplying in the message contributions of each topic from its relevant conditional word-topic Polya distribution (after applying message cancelling). We can now update the topic-document Dirichlet distributions with our latest belief about $\bm{\theta}_{m}$ for each branch. To calculate the message from $f_{Z_{m,n}}$ to ${\theta_{m}}$, the contribution of $Z_{m,n}$ needs to be marginalized out. This results the following function, \begin{align} \mu_{f_{Z_{m,n}}\xrightarrow{}{\theta_{m}}} &=\sum_{Z_{m,n}} p(Z_{m,n},\bm{\theta}_{m};\bm{\alpha}^{}_{m,n})\notag\\ &= \left(\frac{\Gamma(\sum_k\alpha^{}_{m,n,k})}{\prod_k\Gamma(\alpha^{}_{m,n,k})}\prod_k\theta_{m,k}^{\alpha^{}_{m,n,k}-1}\right)\left(\frac{\sum_k\alpha^{}_{m,n,k}\sum_kp_{m,n,k}\theta_{m,k}}{\sum_kp_{m,n,k}\alpha^{}_{m,n,k}}\right), \label{eq:dirich_true_msglda} \end{align} which is unfortunately not conjugate to a Dirichlet distribution. We know how to update the Dirichlet posterior if we observe values for $Z$ -- simply increment the count of the corresponding $\bm{\alpha}^{}_{m}$ values. Because $Z$ is latent, however, the best we can do is to use the topic proportions to scale the respective $\bm{\alpha}^{}_{m}$ values before adding this scaled fractional count to the current $\bm{\alpha}^{}_{m}$. We validate this by sampling a large number of $Z$ values and averaging the counts. When doing this, the relative proportions are consistent with this fractional count approach and results in the update, \begin{equation} \alpha^{'}_{m,k} = \sum_n\frac{p^{''}_{m,n,k}\alpha^{''}_{m,n,k}}{\sum_i p^{''}_{m,n,i}\alpha^{''}_{m,n,i}} + \alpha_{m,k},\label{eq:approxmessage} \end{equation} where $\bm{\alpha}^{''}_{m}$ are obtained by cancelling out the message in the reverse direction. It is interesting to note that this update equation is consistent with the message update that is obtained by using variational message passing (in the special case where the message does not use the expectation of the natural parameters but rather the true full distribution). This is not too surprising since the Sum-Product algorithm (as well as LBU) is variational in nature. Equation \ref{eq:approxmessage} updates $\bm{\alpha}^{'}_{m}$ which can then be inserted the document topic Dirichlet to arrive at the posterior (for that epoch), \begin{equation} f^{\text{post}}_{\theta_m} = \mathsf{Dir}(\bm{\theta}_{m};\bm{\alpha}^{'}_{m}) = \frac{\Gamma(\sum_k\alpha^{'}_{m,k})}{\prod_k\Gamma(\alpha^{'}_{m,k})} \prod_{k}\theta_{m,k}^{\alpha^{'}_{m,k}-1}. \end{equation} \subsubsection{Backward sweep} In the first iteration, the posterior $\bm{\alpha}^{'}$ values are the same as the prior values. These are used to update the topic-document categorical distributions after adjusting for over-counting (because the reverse messages in the initial epoch are uninformative, we have $\bm{\alpha}^{''} = \bm{\alpha}^{'}$ in the first epoch) resulting in, \begin{equation} f_{Z_{m,n}} =\frac{\Gamma(\sum_k\alpha^{''}_{m,n,k})}{\prod_{k}\Gamma(\alpha^{''}_{m,n,k})} \prod_{k}\theta_{m,k}^{\mathbb{[}Z_{m,n}=k\mathbb{]}+\alpha^{''}_{m,n,k}-1} \label{eq:fz}. \end{equation} To calculate the message to be sent to $f_{W_{m,n}}$ from the left, we need to integrate out $\bm{\theta}_{m}$, giving, \begin{equation} p(Z_{m,n}=k;\bm{\alpha}^{''}_m) = \frac{\alpha^{''}_{m,n,k}}{\sum_k\alpha^{''}_{m,n,k}}, \label{eq:pol_to_cpol} \end{equation} which is unique for each branch due to the message cancelling adjustment to the hyperparameters. We can now update Equation \ref{eq:condpolyalda} with the latest version of $p(Z_{m,n}=k;\bm{\alpha}^{''}_m)$ from Equation \ref{eq:pol_to_cpol}. To complete our reverse sweep we observe $W_{m,n} = \mathsf{v}$ and calculate the the latest topic proportions from Equation \ref{eq:condpolyalda} (for each topic, $\mathsf{k}$), \begin{align} \Tilde{\mu}_{f_{W_{m,n}|Z_{{m},{n}}=\mathsf{k}}\xrightarrow{}{Z_{m,n}}} &= p_{\mathsf{k},\mathsf{v},{m},{n}} \frac{\beta_{\mathsf{v},Z_{{m},{n}}=\mathsf{k}}}{\sum_v\beta_{v,Z_{{m},{n}}=\mathsf{k}}}. \label{eq:marg_theta_cpolrev2} \end{align} We can now update the topic proportions for each word within each word-topic Dirichlet (after adjusting for over-counting). At the word-topic Dirichlet variable nodes, these proportions are simply added as partial counts to the corresponding Dirichlet distribution's prior values to give the latest updated posterior Dirichlet parameters from all branches within the document, \begin{equation} \beta^{'}_{\mathsf{k},\mathsf{v}} = \sum_m\sum_n\frac{p'_{\mathsf{k},\mathsf{v},{m},{n}}}{\sum_k p_{\mathsf{k},\mathsf{v},{m},{n}}} + \beta_{\mathsf{k},\mathsf{v}}, \end{equation} which are used to update the respective posterior word-topic Dirichlet Distributions given in Eq.~\ref{eq:twvn}. It is important to note here that each $p_{\mathsf{k},\mathsf{v},{m},{n}}$ contains both updated and adjusted $\alpha$ and $\beta$ hyperparameters. Note also that unlike when the topic-document Dirichlet distributions are updated, there is no approximation in this Dirichlet update. This message differs from the VMP message in that the VMP message here is independent of the $\beta$ hyperparameters. In this section we have given the update equations for the ALBU algorithm. From an implementation point of view, by inspecting the equations, it is clear that all updates are simply subtraction, multiplication and division of vectors. Also, unlike VMP and VB, no complex functions such as the Digamma functions are used, allowing for an improved execution time. Zeng also notes this advantage in his collapsed Sum-Sum LDA algorithm \cite{zeng2012learning}. We will now present the evaluation process that we employed to test our implemented algorithm. \section{Our testing methodology} We compare the performance of three algorithms, namely ALBU, collapsed Gibbs sampling and VB. Four text corpora are used for this comparison and are all considered small (they contain few terms per document and also contain a relatively small number of documents). Because the ground truth distributions are not known, we also include two simulated data sets where 20 corpora are generated for each data set. We then use the ground truth distributions from which the corpora are generated to more accurately evaluate these algorithms. \subsection{Metric selection} In supervised learning models, the ability of a trained model to predict a target variable is evaluated using a test set. Evaluating the performance of unsupervised learning algorithms such as LDA \cite{mcauliffe2008supervised}, is less straightforward and a measure of success needs to be defined. Held-out perplexity \cite{chang2009reading} has been the most popular evaluation metric for topic models. However, a large-scale human topic labeling study by Chang et al. \cite{chang2009reading} demonstrated that low held-out perplexity is often poorly correlated with interpretable latent spaces. Coherence on the other hand, has been shown to be highly correlated with human interpretability of topics \cite{roder2015exploring}. In a comprehensive study of multiple coherence measures \cite{roder2015exploring}, the $C_{\mathsf{V}}$ coherence score had the highest correlation with human topic ratings. This measure is a combination of three measures: the indirect cosine measure, the Boolean sliding window and the normalized point-wise mutual information score, $C_{\mathsf{V}}$, which performed almost as well as the $C_{\mathsf{V}}$ score. Other well-known coherence measures evaluated in their analysis include, in order of performance are $C_{\mathsf{UCI}}$ and $C_{\mathsf{UMass}}$ \cite{roder2015exploring}. We therefore use the $C_{\mathsf{V}}$ score and the simpler $C_{\mathsf{NPMI}}$ score to evaluate the topic modeling of the text corpora. Using these measures in conjunction with one another allows for selection of topics where both scores indicate good performance. There are cases where only one metric performs well and the other does not, this usually indicates performance that is not as good as the higher scoring metric leads one to believe. The evaluation metrics mentioned above are not without drawbacks. Coherence measures take only the top words per topic into account, and not the full distributions over topics. Consequently, much detail of the learnt distributions is discarded. Perplexity may also not give sufficiently fine-grained resolution: Minka and Lafferty \cite{minka2002expectation} address similar concerns. They demonstrate that held-out word perplexity for two different models can be almost identical but when inspected (using simulated data where the word-topic and topic-document distributions are known), large performance differences are seen \cite{minka2002expectation}. To evaluate our algorithm based on a more fine-grained metric, we implement a corpus simulation system in which the topic-document and word-topic distributions are known. A distance measure (forward Kullback-Liebler divergence (KLD)) is then used to compare the learnt distributions with the true distributions. The word-topic and topic-document distributions are Dirichlet distributions. One can easily calculate the forward KLD between two Dirichlet distributions. Unfortunately, the Gensim implementation (to evaluate the VB algorithm) allows access only to the mean of these Dirichlet distributions, not to the distributions themselves. In LDA the mean of these distributions is, in fact, the probability of finding a word in a topic. We therefore calculate the forward KLD between the actual mean word-topic distributions, $p$, and approximate mean word-topic distribution, $q$ for each topic: \begin{equation} \bm{KL}(p\parallel q) = \sum_i p_i \ln{\frac{p_i}{q_i}} \end{equation} The average KLD over all topics is taken to be the error for each model. \subsection{Text Corpora} To evaluate the algorithms on text corpora, three text sources are chosen, namely (1) a selection of 20000 Covid-related tweets, (2) \textit{Covid Tweets}, the Bible verses from key parts of the new testament, \textit{Bible Verses}, and (3) the widely used 20 Newsgroups corpus, \textit{20 Newsgroups}. Each can be considered a small corpus, in terms of both the number of documents they contain and the text lengths of each document. \begin{figure} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\linewidth]{images/doc_length_covid.png} \caption{Document length for the Covid Tweets. Because the original texts (tweets) are so short, very few words remain in each document after preprocessing. Documents with fewer than 4 words are excluded from the analysis. \label{doclengthcovid}} \end{subfigure} \hfill \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\linewidth]{images/ARTfreq20newssmall.png} \caption{Document length for the 6 Newsgroups corpus. We cut off the plot at 500 documents because only very few documents had lengths between 500 and 3400. The distribution for the 20 Newsgroups corpus is similar. \label{fig:ARTfreq20newssmall}} \end{subfigure} \caption{Frequency of document lengths for the Covid and 6 Newsgroup corpora. Statistics of the document lengths for the corpora can be seen in Table \ref{table:priors}.\label{fig:freq}} \end{figure} \begin{figure} \begin{subfigure}{0.48\textwidth} \centering \includegraphics[width=\linewidth]{images/wordcloud_covid.png} \caption{Wordcloud for Covid Tweets corpus. The token \textit{covid} has been removed since it is present in every tweet. The \textit{coronavirus} token has been retained in the corpus. .\label{fig:wca2}} \end{subfigure} \hfill \begin{subfigure}{0.48\textwidth} \centering \includegraphics[width=\linewidth]{images/wcmore.png} \caption{Wordcloud for Bible verses from the Gosples, Acts and the Epistles - books that are known to have overlapping themes. \label{fig:wcmored}} \end{subfigure} \caption{Word clouds are based on the frequency of individual words occurring in the corpus. In (a) we show the Covid Tweets corpus and (b) the Bible verses corpus.\label{fig:wccov}} \end{figure} In all of the text corpora we remove all characters that are not in the English alphabet. Standard text processing techniques are then applied such as lemmatisation and stopword removal. We also remove some specific additional stopwords for each corpus, such as \textit{corona} from \textit{Covid Tweets} because this is the word used to identify the selection of tweets. Documents shorter than 4 tokens in length after initial preprocessing are discarded. Because we do not know the true number of topics for any of these corpora, we create a fourth corpus which is simply a small subset of the 20 Newsgroups corpus, \textit{6 Newsgroups}, where we select only $6$ of the $20$ newsgroups and aim to identify these newsgroups as topics. The newsgroup names of these $6$ newsgroups are \textit{recmotorcycles}, \textit{comp.graphics}, \textit{sci.med}, \textit{sci.space}, \textit{talk.politics.mideast} and \textit{talk.religion.misc}. To make the problem harder for the algorithms to solve, we also limit the number of documents per topic to 50, leaving us with a very small corpus containing only 300 documents. A summary of the corpus statistics can be seen in Table ~\ref{table:priors}. \begin{table} \small \caption{Table showing text corpus statistics and $\alpha$ and $\beta$ values chosen for evaluation.} \label{table:priors} \begin{tabular}{ccccc} \toprule & Covid Tweets & Bible Verses & 20 Newsgroups & 6 Newsgroups \\ \midrule Number of documents & $18951$ & $7554$ & $300$ & $6996$ \\ Vocabulary size & $7785$ & $2627$ & $18035$ & $5631$ \\ Total topics & $8-13$ & $9-16$ & $11-21$ & $6$ \\ Document length range & $4-16$ & $4-26$ & $4-4537$ & $4-4537$ \\ Mean document length & $8$ & $8$ & $21$ & $17$ \\ Coherence window & $15$ & $15$ & $50$ & $15$ \\ $\alpha$ & $0.1$ & $0.1$ & $0.1$ & $0.5$ \\ $\beta$ & $0.1$ & $0.1$ & $0.1$ & $0.5$ \\ \bottomrule \end{tabular} \end{table} \begin{figure} \begin{subfigure}{0.48\textwidth} \centering \includegraphics[width=\linewidth]{images/wordcloud20.png} \caption{Wordcloud for 20 Newsgroups corpus. We see that \textit{people} and \textit{one} are two of the most common words. There are many general words not obviously relating to a specific topic, except possibly \textit{armenian}, which belongs primarily to the \textit{talk.politics.mideast} group.\label{fig:wca}} \end{subfigure} \hfill \begin{subfigure}{0.48\textwidth} \centering \includegraphics[width=\linewidth]{images/ARTsmall20cloud.png} \caption{Wordcloud for 6 Newsgroups corpus. Here some of the 6 newsgroups are clearly represented by the most frequent words such as \textit{space} from \textit{sci.space}, \textit{image} and \textit{file} from \textit{comp.graphics} and \textit{armenian} from \textit{talk.politics.mideast}. \label{fig:wcs}} \end{subfigure} \caption{Word clouds are based on the frequency of individual words occurring in a corpus. In (a) we show the full 20 Newsgroups corpus and in (b) the smaller corpus using only 6 of the newsgroups.\label{fig:wc20}} \end{figure} \subsection{Simulated corpora} The corpus is generated as follows: (a) generate word-topic distributions, (b) generate topic-document distribution, (c) for each document, repeatedly choose a topic from its topic-document distribution, and then a word from this word-topic distribution until the document is populated with the required number of words. \begin{figure} \begin{subfigure}{0.32\textwidth} \centering \includegraphics[width=\linewidth]{images/mini200.png} \caption{Extracted word-topic distributions for a corpus containing 200 documents ($M = 200$) in the smaller simulated data set. The 7th topic is the stop words topic and contains words that are found in all documents. } \end{subfigure} \hfill \begin{subfigure}{0.32\textwidth} \centering \includegraphics[width=\linewidth]{images/mini50002.png} \caption{True word-topic distributions for a corpus containing 5000 documents ($M = 5000$) from the same data set as (a). It is evident that because there are more samples, the underlying word-topic distributions are learnt more exactly.} \end{subfigure} \hfill \begin{subfigure}{0.32\textwidth} \centering \includegraphics[width=\linewidth]{images/mix200.png} \caption{Shuffled true word-topic distributions for the corpus shown in (a). This simply illustrates that no reliance can be placed on the sequence of words within a topic or the fact that adjacent topics are significantly more likely to share words.} \end{subfigure} \caption{In (a) we present the word-topic distributions extracted from a corpus from the smaller simulated data set where $M = 200$, in (b), a corpus from the same data set where $M = 5000$ and in (c) a shuffled version of (a) to show that the sequential nature of words in topics is simply so that one can easily evaluate performance by visually inspecting the approximate versus actual distributions.\label{fig:mini1}} \end{figure} To the topics mentioned above, we add an additional topic, non-overlapping with the others, but occurring in all documents. The addition of these function (or stop) words makes the task of learning the word-topic and topic-document distributions significantly more challenging. This is one of the challenges when applying LDA to text corpora and it is typically handled by applying preprocessing techniques before running LDA (such as removing stop words or using the TF-IDF) \cite{wallach2009rethinking} or by post-processing (removing context-free words after extracting topics \cite{minka2002expectation}). By including these function words, we aim to make our simulations more difficult and realistic. An added benefit of using simulated data is that we can visualise the performance by using words to be numbers and assigning the word-topic probabilities in such a way that when ordered sequentially, the topics can be visually inspected. This can be seen in Fig.~\ref{fig:mini1}. It is important to note that each time we chose documents based on corpus settings (such as number of documents per topic, words per document, vocabulary length, etc.) one can sample as many corpora as one likes from a single setting. The more are present documents per corpus, the greater the similarity between generated corpora, and the easier for LDA to learn the underlying distributions. We utilize two simulated data sets (using 2 unique sets of corpus settings as shown in table \ref{table:simulated}) each consisting of 20 groups of corpora. These corpora are small by real-word text topic extraction standards, but this does not make them easier for LDA to learn; smaller data sets contain less information and consequently inference regarding the underlying generating distribution is more difficult. The parameters of the smaller data set was inspired by a real data set in the education domain. The larger data set is created with the aim of being a more difficult problem to solve given the higher number of topics per document ($6$ topics), with documents nevertheless being relatively short ($120$ words). \begin{table} \caption{Table showing simulated corpus statistics as well as chosen $\alpha$ and $\beta$ values for algorithms evaluation.} \label{table:simulated} \begin{tabular}{ccccc} \toprule & Smaller Simulated & Bigger Simulated \\ \midrule Number of documents & $50, 100, 200, 300,500,5000$ & $100,200,300,500$ \\ Vocabulary size & $100$ & $500$ \\ Topics per document & $3$ & $6$ \\ Total topics & $7$ & $10$ \\ Document length & $100$ & $120$ \\ Coherence window & $15$ & $10$ \\ $\alpha$ & $0.5$ & $0.1$ \\ $\beta$ & $0.5$ & $0.1$ \\ \bottomrule \end{tabular} \end{table} \subsection{Hyperparameter selection} \begin{figure}[ht] \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\linewidth]{images/ARTalbuHyperCV.png} \caption{$C_{\mathsf{V}}$ scores over different hyperparameters for the Covid Tweets corpus.\label{fig:ARTalbuHyperCV}} \end{subfigure} \hfill \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\linewidth]{images/ARTalbuHyperNPMI.png} \caption{$C_{\mathsf{NPMI}}$ scores over different hyperparameters for the Covid Tweets corpus. \label{fig:ARTalbuHyperNPMI}} \end{subfigure} \caption{Hyperparameter selection based on Coherence for the Covid corpus. Both scores are taken into account to select the hyperparameters to use for algorithm evaluation for each corpus. In this case $\alpha = \beta = 0.1$ is the best setting. \label{fig:ARTalbuHyper}} \end{figure} Standard practice has been to choose the same hyperparameter settings over all data sets and algorithms, popular choices being $\alpha = \beta = 0.1$ \cite{mukherjee2009relative} and $\alpha = \beta = 0.01$ \cite{zeng2012learning}. It has recently been shown that this is not optimal since the choice of the hyperparameters for the topic-document and word-topic Dirichlet priors has an impact on LDA performance \cite{asuncion2009smoothing}. An alternative is to learn the hyperparameter values based on a subset of the data, as described by Minka \cite{minka2002expectation, minka2000estimating}. Asunction et al. \cite{asuncion2009smoothing}, shows that using a grid search over a range of hyperparameters for each algorithm over the entire data set allows for an even better choice in hyperparameters, should the computational cost be worth it. We choose a list of standard hyperparameter settings and evaluate their performance based on coherence metrics. An example of this is shown in Figure \ref{fig:ARTalbuHyper}. The final hyperparameters choices for each data set can be seen in Tables \ref{table:priors} and \ref{table:simulated}. \subsection{Epochs and iterations} Based on initial convergence tests, we fix the number of epochs for both ALBU and VB to 150 epochs for the text data sets. For the simulated data sets (where our results show the deviation from ground truth), we reduce the epochs to 70 for the smaller data set and increase the epochs to 200 for the 100 documents corpus for ALBU (based on results shown in Figure \ref{fig:ARTalbuHyperep}). For VB we use 150 epochs for all runs. Performance is significantly worse at 70 epochs for VB even on the smaller data set but shows no improvement at 200 epochs for either data set. \begin{figure}[ht] \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\linewidth]{images/ArtHypeconvergenceSmall.png} \caption{KLD convergence over different hyperparameters for a selection of corpora in the small simulated data set.\label{fig:epARTalbuHyperCV}} \end{subfigure} \hfill \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\linewidth]{images/ARTConvperdoc.png} \caption{KLD convergence over different numbers of documents for a selection of corpora in the bigger simulated data set. \label{fig:epARTalbuHyperNPMI}} \end{subfigure} \caption{Epoch selection of simulated data based on KLD for ALBU. Algorithms converge at different rates based on hyperparameter settings as well as corpus settings such as number of documents, number of topics per document etc. \label{fig:ARTalbuHyperep}} \end{figure} For collapsed Gibbs sampling, 5000 samples are used after an initial 2000 iterations with rather poor results. This is significantly more than the 2000 samples than recommended in the Python package PyPi \cite{pypi} and 1000 as used by Zeng et al \cite{zeng2012learning}. We test VB and ALBU only once per topic number on the text data sets, because the results for consecutive iterations are virtually identical. In the case of the collapsed Gibbs sampling algorithm, however, the results vary (sometimes considerably) between iterations. We therefore follow the practice of Zeng et al. \cite{zeng2012learning} by performing multiple iterations per number of topics, and computing the average coherence value over these iterations. For each simulated data set, we generate 20 corpora for each $M$ (number of documents). We refer to each repetition as a \textit{run}. In each run, topics are extracted by each algorithm, which are then compared to the true topics. For the text data sets the $C_{\mathsf{V}}$ (a) and $C_{\mathsf{NPMI}}$ coherence scores are calculated for each topic within a topic range of $K = 4$ to $K = 16$ for the $\textit{Covid Tweets}$ and $\textit{Bible Verse}$ corpora, $K = 2$ to $K = 25$ for the $\textit{20 Newsgroups}$ corpus, and $K = 2$ to $K = 10$ for the $\textit{6 Newsgroups}$ corpus. \section{Results} \label{sec:results} In this section we first analyse the coherence results for the text corpora and then present the results for the simulated corpora. We utilise both coherence scores to select the best topic count range and then select a specific $K = k$ (number of topics) to inspect. Coherence measures have been shown to correlate with human topic interpretability. However, the best way of evaluating the intelligibility of and consistency within individual topics is by visual inspection. For the \textit{Covid Tweets} and \textit{Bible Verses} corpora we aim to extract as few topics as possible out of the usable range. For the \textit{6 Newsgroups} corpus, we choose 6 topics since we want to determine how well the original newsgroup themes can be extracted. For the \textit{20 Newsgroups} data set we choose 13 topics (we see that many of the 20 newsgroups have common themes can are extracted as coherent topics). \subsection{Covid Tweets and Bible Verses} Tweets are short messages that are posted by users on the Twitter platform and are typically only a sentence or two in length. The bible is divided into book types, books, chapters and verses. Verses are very short in length (similar to tweets). There is need in theology to find verses that cover the same topic. We select a group of similar biblical book and use each verse as a document in the corpus. We used this corpus because of its very short documents and limited vocabulary which make it difficult for algorithms to extract coherent topics. We expect coherence values to be low for such short documents (tweets and bible verses), especially with such small corpora because there is less information available from which to learn interpretable topics. \begin{figure}[ht] \begin{subfigure}{0.49\textwidth} \includegraphics[width=\linewidth]{images/ARTbibleCV.png} \caption{All three topics prefer topics from $9$ to $16$ in this metric with ALBU and Gibbs outperforming VB over the full range.\label{ARTbibleCV}} \end{subfigure} \hfill \begin{subfigure}{0.49\textwidth} \includegraphics[width=\linewidth]{images/ARTbibleNPMI.png} \caption{ALBU clearly prefers $9$ and $16$ topics while Gibbs is stable over range from $11$ to $15$. \label{fig:ARTbibleNPMI}} \end{subfigure} \caption{Coherence scores for the Bible verses corpus. We show the $C_{\mathsf{V}}$ scores in (a) and $C_{\mathsf{NPMI}}$ scores in (b). In both cases ALBU extracts topics best at $9$ and $16$ topics, while Gibbs prefers $10$ to $15$ topics. VB struggles to extract coherent topics.\label{fig:ARTbible}} \end{figure} From Figure \ref{fig:ARTbible} and Figure \ref{fig:ARTcovid} we can see that VB performs more poorly than do the ALBU and Gibbs sampling algorithms -- this is especially evident where the NPMI Metric is used to evaluate topic coherence. Visual examination of both of Figure \ref{fig:ARTcovid}'s plots indicates that the greatest number of topics extracted by ALBU occurs where there are from $9$ to $16$ topics, while the Gibbs sampling algorithm performs best at $10$ to $1$ topics. In the case of VB, coherence scores are consistently lower for most topic numbers. Indeed, in this analysis VB struggles to extract coherent topics. Because all of the verses in the corpus are focused on similar topics, we aim to extract as few topics as possible, while maintaining acceptable topic coherence. The topics extracted by ALBU at $K = 9$ are the most coherent; confirmed by coherence scores Figure \ref{fig:ARTbible}) as well as by inspection of the top $10$ words extracted per topic. In collapsed Gibbs sampling, when visually inspecting the topics, we see some duplication; for example, two topics contain the words \textit{God}, \textit{Christ} and \textit{Lord} and two additional topics contain the words\textit{God} and \textit{father}. ALBU extracts these as only two unique topics -- a more useful result. \begin{figure}[ht] \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\linewidth]{images/ARTcovidCV.png} \caption{ALBU outperforms the others at all topic numbers except for Gibbs at $11$ and $16$ topics.\label{ARTcovidCV}} \end{subfigure} \hfill \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\linewidth]{images/ARTcovidNPMI.png} \caption{VB only extracts somewhat coherent topics at $K = 7$. \label{fig:ARTcovidNPMI}} \end{subfigure} \caption{Coherence scores for the Covid corpus. We show the $C_{\mathsf{V}}$ score in (a) and $C_{\mathsf{NMPI}}$ in (b). We can see that ALBU extracts topics well at $7$ and $16$ topics while Gibbs prefers $10$ to $15$ topics. VB struggles to extract coherent topics except for at $K = 7$.\label{fig:ARTcovid}} \end{figure} For the Covid corpus we choose $K = 8$ for ALBU and $K = 9$ for the collapsed Gibbs sampling algorithm. By inspecting $6$ of the $8$ Covid topics extracted by ALBU in Table \ref{table:albuCOVID}, we see coherent, relevant topics such as mask wearing and testing. The extracted topics by collapsed Gibbs sampling are very similar to these especially with $K = 9$. VB extracts significantly fewer coherent topics; for example, two of the topics relate to both Donald Trump and children (\textit{Trump}, \textit{school}, and \textit{America} were top words in the one, and \textit{realdonaldtrump}, \textit{American} and \textit{school} in another topic). We see a similar trend for the Bible Verses topics over the three algorithms. \begin{table}[ht] \tiny \caption{Top 15 words in 6 of the topics extracted from the Covid tweets corpus where $K = 8$ for ALBU.} \label{table:albuCOVID} \centering \resizebox{0.9\textwidth}{!}{% \begin{tabular}{ccccccc} \toprule masks & children & cases & trump & spread & testing \\ \midrule mask & like & case & trump & help & test\\ people & get & new & realdonaldtrump & health & positive\\ face & school & death & via & spread & hospital\\ make & back & total & american & risk & patient\\ wear & know & day & every & even & testing\\ home & want & india & give & symptom & tested\\ safe & would & number & sign & daily & need\\ life & going & report & support & earth & say\\ keep & see & today & month & self & minister\\ stay & still & last & change & slow & chief\\ social & think & positive & worker & community & pradesh\\ one & thing & reported & government & identify & doctor\\ wearing &kid & update & need & sooner & govt\\ everyone & one & hour & million & long & care\\ please & look & confirmed & america & impact & police\\ \bottomrule \end{tabular}} \end{table} \subsection{Newsgroup corpora} We choose $K = 13$ since all three algorithms perform well for this number of topics with $C_{\mathsf{V}}$ scores of $0.54$ for both Gibbs and VB and of $0.55$ for ALBU (Figure \ref{fig:ART20newsCVa}). The $C_{\mathsf{NPMI}}$ score shows that Gibbs performs better than does VB and that ALBU outperforms both (Figure \ref{fig:ART20newsNPMIb}). Inspection of the actual words within the topics (Table \ref{table:20news}) extracted by ALBU, indicates that this is a sensible result. Many of the topics can be directly mapped to a specific newsgroup, as can be seen in Table \ref{table:20news} where $6$ of the $13$ topics are shown. However, some topics contain words that seem to come from multiple newsgroups. This is to be expected, since some of the newsgroups address similar subjects. For example, the topic to which we have assigned the label \textit{hardware} contains words that are predominantly occur in two of the newsgroups, namely \textit{comp.sys.ibm.pc.hardware} and \textit{comp.sys.mac.hardware}. This is the case with a number of the topics, and it is therefore and it is therefore not surprising that the most coherent topics extracted from the \textit{20 Newsgroups} corpus should occur at the settings of $K = 13$ to $K = 20$. \begin{figure}[ht] \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\linewidth]{images/ART20newsCV.pdf} \caption{$C_{\mathsf{v}}$ scores for the three algorithms are similar for $K = 13$ which indicates that this is a good number of topics to inspect. The best score of topics over all algorithms over all $K$ is Gibbs at $K = 20$.\label{fig:ART20newsCVa}} \end{subfigure} \hfill \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\linewidth]{images/ART20newsNPMI.pdf} \caption{$C_{\mathsf{NPMI}}$ scores indicate that ALBU extracts topics better than the other algorithms with an exception of $K = 20$ where Gibbs performs best. The best score of topics over all algorithms over all $K$ is ALBU at $K = 13$. \label{fig:ART20newsNPMIb}} \end{subfigure} \caption{Coherence scores for 20 Newsgroups. For both coherence metrics ALBU and Gibbs perform similarly with ALBU being marginally better at extracting topics. While still achieving reasonably good $C_{v}$ scores VB does significantly worse than the other two for $K > 14$.} \end{figure} \begin{table}[ht] \tiny \caption{Top 10 words in 6 of the topics extracted from the 20 Newsgroup text corpus where $K = 13$ for ALBU. We assign a topic category to each topic based on themes captured by most of these top ranking words. Some are mixtures of newsgroups such as \textit{comp.sys.ibm.pc.hardware} \textit{comp.sys.mac.hardware} which we have called \textit{hardware}.} \label{table:20news} \centering \resizebox{\textwidth}{!}{% \begin{tabular}{ccccccc} \toprule hardware & politics.mideast & religion.misc & sci.med & sci.space & talk.politics.guns\\ \midrule drive & armenian & god & drug & space & gun\\ card & people & one & health & system & law\\ one & said & would & medical & nasa & right\\ use & turkish & one & one & launch & people\\ problem & jew & christian & doctor & satellite & state\\ scsi & one & jesus & use & water & would\\ system & israel & say & disease & may & file\\ disk & israeli & think & food & earth & government\\ bit & nazi & believe & patient & mission & weapon\\ work & woman & bible & day & technology & crime\\ \bottomrule \end{tabular}} \end{table} Inspection of the top 10 words per topic for $K = 13$, reveals that the three algorithms yield similar results for many of the topics. The differences between Gibbs and ALBU do not seem semantically significant but for VB there are topics that could be considered incongruent mixtures of topics. For example VB extracts a topic which seems to be a mixture of \textit{talk.politics.guns} and \textit{rec.motorcycles} since it contains words like gun, firearm, weapon and handgun as well as bike motorcycle and ride. It is important to note that although the top 10 words are very similar for most of the extracted topics (especially for Gibbs and ALBU), we use a coherence window of 50 which takes more of the words into account and this is why there are differences in the coherence values, even when the top 10 words per topic are almost identical. \begin{figure} \caption{Coherence scores for the 6 Newsgroups corpus. In both (a) $C_{\mathsf{V}}$ scores and (b) $C_{\mathsf{NPMI}}$ scores we see that ALBU extracts topics well at $K = 6$. } \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\linewidth]{images/ART20newsSmallCV.png} \caption{Gibbs shows on average higher $C_{\mathsf{V}}$ scores than the other two algorithms except for at $K = 6$. VB does significantly worse that the other two except for at $K = 10$.\label{ART20newsSmallCV}} \end{subfigure} \hfill \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\linewidth]{images/ART20newsSmalnpmi.png} \caption{ALBU shows on average the highest $C_{\mathsf{NPMI}}$ score. Take note that the $C_{\mathsf{NPMI}}$ scores are below 0 for all algorithms over the whole topic range except for ALBU at $K = 6$. \label{fig:ART20newsSmalnpmi}} \end{subfigure} \end{figure} \begin{table}[ht] \tiny \caption{Top 10 words in the 5 best topics extracted from the 6 Newsgroup text corpus where $K = 6$ for ALBU. We assign a topic category to each topic based on themes captured by most of these top ranking words.} \label{table:6news1} \centering \resizebox{\textwidth}{!}{% \begin{tabular}{ccccccc} \toprule comp.graphics & politics.mideast & religion.misc & sci.space & 'rec.motorcycles' / stop words\\ \midrule file & armenian & one & space & would\\ image & jew & people & nasa & bike\\ bit & people & god & year & like\\ one & turkish & would & shuttle & one\\ use & israel & know & group & people\\ also & one & say & list & get\\ system & would & make & post & think\\ program & israeli & good & news & could\\ exercise & case & think & sci & time\\ help & year & bible & launch & food\\ \bottomrule \end{tabular}} \end{table} \begin{table}[ht] \tiny \caption{Top 10 words in the 5 best topics extracted from the 6 Newsgroup text corpus where $K = 6$ for VB. We assign a topic category to each topic based on themes captured by most of these top ranking words. We can see that two of the topics both capture information from the \textit{politics.mideast} newsgroup. The same applies for \textit{comp.graphics}. Also we can see that there are some words that do not belong in the topic (shown in bold).} \label{table:6news2} \centering \resizebox{\textwidth}{!}{% \begin{tabular}{ccccccc} \toprule comp.graphics & politics.mideast & religion.misc & comp.graphics/space & politics.mideast/sci.med\\ \midrule file & armenian & jew & \textbf{space} & bullock\\ image & people & jesus & image & israel\\ bit & one & one & data & israeli\\ one & would & bible & file & one\\ use & turkish & god & available & police\\ also & year & say & system & said\\ system & muslim & know & program & would\\ program & armenia & would & ftp & \textbf{candida}\\ exercise & could & christian & also & time\\ help & azerbaijan & case & edu & san\\ \bottomrule \end{tabular}} \end{table} For the \textit{6 Newsgroup} corpus the coherence values are significantly lower (since this is a significantly harder problem with only $50$ documents per newsgroup). ALBU and Gibbs again perform significantly better than does VB based on coherence measures. This agrees with actual topics extracted and shown in table Table \ref{table:6news1} and \ref{table:6news2}. We can see that for ALBU each topic can be mostly matched to a newsgroup topic (shown in the heading of each column) where VB's topics can contain words relating to multiple newsgroup topics. For example the word with the highest probability in the topic we call \textit{comp.graphics/space} is space while the remaining 9 words all support the computer graphics topic. Also we see two of the topics are duplicated (\textit{comp.graphics} and \textit{politics.mideast}). \subsection{Simulated corpus results} We first inspect the results visually for a single corpus and show the learnt distributions in Figure \ref{fig:smaller100}. By looking at the second topic we can see that Gibbs learns this topic slightly worse than ALBU and this is reflected in the higher average KLD ($0.11$ compared to $0.14$). VB makes mistakes with several of the topics, resulting in a KLD of $0.3$. If we compare this with Figure \ref{fig:ARTsmallSimlda} at 100 documents, we can see that these results are typical for all the corpora in this category, but do vary somewhat especially for VB. \begin{figure}[ht] \begin{subfigure}{0.32\textwidth} \centering \includegraphics[width=\linewidth]{images/1ALBU100smaller011.pdf} \caption{ALBU on the smaller simulated data set with an average KLD of $0.11$. } \end{subfigure} \hfill \begin{subfigure}{0.32\textwidth} \centering \includegraphics[width=\linewidth]{images/1gibbs100smaller014.pdf} \caption{Collapsed Gibbs sampling on the smaller simulated data set with an average KLD of $0.14$. } \end{subfigure} \hfill \begin{subfigure}{0.32\textwidth} \centering \includegraphics[width=\linewidth]{images/VB100smaller03.pdf} \caption{VB on the smaller simulated data set with an average KLD of $0.3$.} \end{subfigure} \caption{Plot comparing true topics (shown in red), with approximate topics (coloured) for (a) ALBU and (b) Gibbs and (c) VB on the smaller data set (100 documents).\label{fig:smaller100}} \end{figure} Looking now one of the corpora containing 500 documents (Figure \ref{fig:smaller500}) we see that for Gibbs the topics have been learnt reasonably well except for the 6th topic which seems to have been assigned a lower weight for many of the most probably words, this weight is then assigned to words belonging in the 7th topic. The performance of VB for this corpus is very similar to ALBU (a) but topic 6 shows marginally worse performance than ALBU but better than Gibbs (b). This higlights that when we have sufficient data (on an easy enough problem) the inference method becomes less important. This is confirmed by looking again at \ref{fig:ARTsmallSimlda} but for 500 documents, we see that ALBU is clearly the best performer followed closely by VB and then Gibbs. The inferior performance by Gibbs in this case could mean that the algorithm needed even longer chains in this case to converge sufficiently each time. \begin{figure} \begin{subfigure}{0.32\textwidth} \includegraphics[width=\linewidth]{images/2ALBU500smaller005.pdf} \caption{ALBU on the smaller simulated data set with an average KLD of $0.05$. Note how low the probabilities of the words in other optics are for the 7th topic.} \end{subfigure} \hfill \begin{subfigure}{0.32\textwidth} \includegraphics[width=\linewidth]{images/2gibbs500smaller007.pdf} \caption{Collapsed Gibbs sampling on the smaller simulated data set with an average KLD of $0.07$. Performance good except for topic 5 (brown).} \end{subfigure} \hfill \begin{subfigure}{0.32\textwidth} \includegraphics[width=\linewidth]{images/2VB500smaller007.pdf} \caption{VB on the smaller simulated data set with an average KLD of $0.07$. Performance for topic 5 better than (b) but marginally worse than (a). } \end{subfigure} \caption{Plot comparing true topics (shown in red), with approximate topics (coloured) for (a) ALBU and (b) Gibbs and (c) VB on the smaller data set for 500 documents.\label{fig:smaller500}} \end{figure} In summary, looking at \ref{fig:ARTsmallSimlda}, we see that for few documents VB struggles to learn the distributions but as the number of topics increases it manages to outperform Gibbs (given the chain length) but not ALBU. This can be seen by looking at the distributions themselves and by looking at average KLD values over multiple iterations. For the bigger data set we inspect the results of one of the corpora containing 100 documents in Figure \ref{fig:bigger100} and one containing 500 documents Figure \ref{fig:bigger500}. We can see that in both figures ALBU performs best and has lowest KLD values. Gibbs performs more similarly to ALBU than VB for 100 documents but for 500 documents still does not completely learn the distributions correctly (as well as ALBU does). VB struggles to learn the distributions correctly for 100 documents but by 500 manages to learn the distributions mostly correctly (almost as well as the other two algorithms). Note that in Figure \ref{fig:bigger500} some topics are assigned weight in places where only other topics exist (note the yellow topic that should only have weight in the place of topic 10 but also has some weight in topic 8). In Figure \ref{fig:ARTbiggerSimlda} we see the results for the bigger data set for all corpora. It is evident that VB struggles to learn the distribution especially for corpora with fewer documents. Gibbs and ALBU perform similarly but it seems that ALBU is more likely to learn the distributions correctly. This is a harder problem to solve than the smaller data set since there are many more topics per document which means that there is more topic overlap. By taking both data sets into account it is clear that ALBU is more consistent in learning the true distributions. \begin{figure} \begin{subfigure}{0.32\textwidth} \centering \includegraphics[width=\linewidth]{images/4ALBUbigger024.pdf} \caption{ALBU on the smaller simulated data set with an average KLD of $0.24$. Note how well the 10th topic is learnt.} \end{subfigure} \hfill \begin{subfigure}{0.32\textwidth} \centering \includegraphics[width=\linewidth]{images/Gibbsbigger100032.pdf} \caption{Collapsed Gibbs sampling on the smaller simulated data set with an average KLD of $0.32$. Performance good except for 10th topic.} \end{subfigure} \hfill \begin{subfigure}{0.32\textwidth} \centering \includegraphics[width=\linewidth]{images/VBbigger100-034.pdf} \caption{VB with an average KLD of $0.34$. The 9th and 10th topics missing and topics 2 and 7 are captured by two topics each. } \end{subfigure} \caption{Plot comparing true topics (shown in red), with approximate topics (coloured) for (a) ALBU and (b) Gibbs and (c) VB on the smaller data set for 100 documents.\label{fig:bigger100}} \end{figure} \begin{figure} \begin{subfigure}{0.32\textwidth} \includegraphics[width=\linewidth]{images/ALBUbigger500008.png} \caption{ALBU on the smaller simulated data set with an average KLD of $0.08$. Note how low the probabilities of the words in other optics are for the 10th topic.} \end{subfigure} \hfill \begin{subfigure}{0.32\textwidth} \includegraphics[width=\linewidth]{images/2Gibbsbigger500-012.png} \caption{Collapsed Gibbs sampling on the smaller simulated data set with an average KLD of $0.12$. Performance good except for the 3rd topic (green).} \end{subfigure} \hfill \begin{subfigure}{0.32\textwidth} \includegraphics[width=\linewidth]{images/VBbigger500018.pdf} \caption{VB on the smaller simulated data set with an average KLD of $0.18$. Performance good except for 2nd (orange) and 10th (yellow) topics. } \end{subfigure} \caption{Plot comparing true topics (shown in red), with approximate topics (coloured) for (a) ALBU and (b) Gibbs and (c) VB on the bigger data set for 500 documents.\label{fig:bigger500}} \end{figure} \begin{figure} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\linewidth]{images/ARTsmallSimlda.png} \caption{ALBU shows best performance over all numbers of documents. For under 200 documents, VB performs very poorly but from 300 documents it performs almost as well as ALBU adn overtakes Gibbs in performance.\label{fig:ARTsmallSimlda}} \end{subfigure} \hfill \begin{subfigure}{0.46\textwidth} \centering \includegraphics[width=\linewidth]{images/ARTbiggerSimlda.png} \caption{ALBU shows best performance over all numbers of documents closely followed by Gibbs for this bigger, more difficult, data set. VB struggles to learn the distributions well over all number of documents.\label{fig:ARTbiggerSimlda}} \end{subfigure} \caption{Boxplot showing the average KLD values for the three algorithms as the number of documents per run settings increase for (a) the small and (b) the bigger data sets. KLD is computed over all topics for 20 runs.\label{fig:ARTSimlda}} \end{figure} \section{Discussion and Conclusion} Variational Bayes, the standard approximate inference algorithm for LDA, performs well at aspect identification when applied to large corpora of documents but when applied to smaller domain-specific data sets, performance can be poor. In this article we present an alternative approximate technique, based on Loopy Belief update (LBU) for LDA that is more suited to small or difficult data sets because more information is retained (we do not use expectations but rather full distributions). We test our ALBU implementation against the Python Gensim VB implementation on a number of difficult data sets. We benchmark these results by including the standard collapsed Gibbs sampling algorithm (allowing an extended period for convergence). The performance for ALBU is significantly better than that of VB and comparable to that of Gibbs but at a lower computational cost. We further explore the performance of these algorithms on simulated corpora where we clearly see ALBU's superior performance. Our results confirm that ALBU shows similar performance to collapsed Gibbs sampling but with more consistent results (we do not need to wait as long for convergence). The aim of this article, however, is to compare inference methods on the full LDA graphical model (not the collapsed version of the model). We suspect that the performance of ALBU is very similar to that of Collapsed Variational Bayes 0 order approximation (CVBO) \cite{asuncion2009smoothing} and this could present interesting further work. Since VB is the algorithmic equivalent of VMP, we can compare ALBU to VMP as they are both message passing algorithms. There are three main differences between the VMP and ALBU approaches. Firstly, VMP does not cancel out reverse-direction messages \cite{winn2004variational} secondly, we use full distribution where possible and do not explicitly use expected values; finally, our approximation to and from the conditional word-topic Dirichlet distributions differs form the VMP approximation (even if expected values are not used in the VMP message update). We believe that the combination of these three effects is the reason why ALBU outperforms VB and that the main performance enhancement comes from using full distributions and not conditional ones (where only expectations are passed on as messages). An added advantage is that our updates are simple and do not require the use of Digamma functions. The findings in this article indicate that although we live in a word where large volumes of data are available for model training and inference, using fully Bayesian principles can provide improved performance when problems get hard (without significant extra complexity). Based on our findings we invite others to apply the principles that we have used in ALBU to other similar graphical models with Dirichlet-Categorical relationships. \bibliographystyle{unsrtnat}
\section{Introduction} A tremendous amount of recent excitement has centered upon interacting periodically-driven (Floquet) ``phases of matter''~\cite{potter2016classification,khemani2016phase,else2016floquet,yao2017discrete,zhang2017observation,choi2017observation,else2020discrete}. While discussed as non-equilibrium phases, thus far attention has largely focused on two scenarios which are non-equilibrium only in a rather restricted sense. First, there are quantum ``many-body-localized'' (MBL) Floquet phases~\cite{nandkishore2015many,ponte2015many,khemani2016phase,else2016floquet,yao2017discrete,abanin2019colloquium,kjall2014many}. Because the ergodicity breaking of MBL is sufficient to prevent the periodic drive from heating the system to infinite temperature, the system does not need to be coupled to a dissipative bath (e.g., the dynamics are driven, but purely unitary)~\cite{bukov2015universal,abanin2016theory,weidinger2017floquet}. In this case, the eigenstates of the Floquet evolution have area-law entanglement, which allows much of the physics to be mapped to more familiar questions of order in quantum ground states~\cite{huse2013localization,chandran2014many,bahri2015localization,potirniche2017floquet}. Second, there are ``prethermal'' Floquet phases which heat only exponentially slowly due to (for example) a mismatch between the driving frequency and the natural frequencies of the undriven system~\cite{abanin2015exponentially,else2017prethermal,zeng2017prethermal,mori2018floquet,machado2019exponentially,machado2020long,kyprianidis2021observation,Ye2021Floquet,pizzi2021classical,else2020long}. During the exponentially long time-scale before heating, these systems can exhibit behavior which is analogous to order in finite temperature equilibrium phases~\cite{else2017prethermal,machado2020long,Ye2021Floquet,pizzi2021classical}. However, prethermal Floquet phases are not ``true'' phases in the strict sense because they are distinguished from disordered behavior via crossovers, rather than sharp transitions~\cite{else2020discrete}. \begin{figure} \centering \includegraphics[width=2.7in]{Fig1.pdf} \caption{(a,b) Schematic of the translation between the discrete state space of a cellular automata and the continuous state space of a Hamiltonian model. (c) Time crystalline order parameter (e.g.~stroboscopic magnetization) as a function of the error probability. The phase transition from a discrete time crystal to the disordered phase is shown for both a Floquet Langevin simulation of the $\pi$-Toom model with pinning potential $v=50,100$, as well as for a direct implementation of the probabilistic cellular automata. \label{Hmodel_schematic_state} } \end{figure} Perhaps the most paradigmatic example of a Floquet phase of matter is the so-called discrete time-crystal (DTC)---starting from a generic initial state, at long times the DTC relaxes into a steady state with a temporal periodicity which is a multiple of the drive's~\cite{khemani2016phase,else2016floquet,yao2017discrete}. This behavior is stable to small perturbations of the dynamics that respect the underlying time-translation symmetry of the drive, and thus, is ``rigid'' in the usual sense that a phase of matter is. Similar behavior has been studied in the non-linear dynamics community as either ``subharmonic entrainment'' or ``asymptotic periodicity''~\cite{lasota1984asymptotic,losson1995phase,losson1996thermodynamic,gielis2000coupled,parlitz1997subharmonic}; for a discussion of how this earlier work differs from results in the quantum many-body context, we refer the reader to~\cite{yao2020classical,else2020discrete,khemani2019brief}. It is natural to ask if ``true'' time-crystals exist beyond MBL. Without MBL to prevent heating, stabilizing time crystalline order presumably require coupling to a dissipative bath. Combining periodic driving and a dissipative bath introduces the full complexity of non-equilibrium dynamics. Thinking microscopically, classical driven dissipative systems are described by Hamiltonian dynamics coupled to a finite-temperature Langevin bath, or in the quantum case, periodically driven Lindbladian evolution. A key feature of both these contexts is that if the bath is dissipative, at finite temperature it should also come with noise due to the fluctuation-dissipation theorem; at zero temperature, where there is damping but no noise, many-body time-crystals can occur rather trivially by analogy to the ``period doubling'' of coupled iterated logistic maps~\cite{kaneko1984period,kapral1985pattern,bunimovich1988spacetime,kaneko1992overview,kaneko1987transition}. The key question we will focus on is the following: Can true time-crystals exist in a periodically driven system of locally interacting particles coupled to an equilibrium bath at finite temperature? In this work, we argue in the affirmative: finite-temperature time-crystals, with an \emph{infinite} auto-correlation time, can exist even in translation-invariant arrays of classical non-linear oscillators interacting only with their nearest-neighbors. % % % To do so, we leverage non-trivial results in the field of probabilistic cellular automata (PCA)~\cite{von1968general,wolfram1983statistical}. A PCA is a deterministic cellular automata (CA) perturbed by stochastic errors, mimicking the effect of finite temperature, making it a ``stripped-down'' model of finite-temperature non-equilibrium dynamics. We first use the results of G{\'a}cs (1D)~\cite{gacs2001reliable,gray2001reader} and Toom (2D)~\cite{toom1980stable,bennett1985role,makowiec1999stationary} to show that local PCAs can exhibit time-crystalline behavior stable to arbitrary small perturbations. Unlike MBL or prethermal time crystals, such time-crystalline order is ``absolutely stable'', in the sense that it remains robust \emph{even} in the presence of perturbations that break the discrete time-translation symmetry of the periodic drive. However, one may wonder whether this result extends to the physical setting of interest --- classical Langevin dynamics --- which is constrained, for example, by symplectic structure and the fluctuation-dissipation theorem. To this end, we show how classical Langevin dynamics can be used to ``simulate'' any PCA, and further provide numerical evidence that the errors due to Langevin noise are of a type covered by G{\'a}cs' and Toom's mathematical results. Applying this to a 2D array of locally interacting mechanical oscillators, Langevin simulations reveal a finite-temperature phase transition between a discrete time-crystal and a disordered phase. \section{Time-crystals in a PCA: the $\pi$-Toom and $\pi$-G{\'a}cs models} We begin by reviewing the definition of a PCA, and explain how the results of G{\'a}cs and Toom imply the existence of time-crystals in this setting~\cite{toom1980stable,gacs2001reliable,grinstein2004can, gray2001reader}. As in a CA, the state of a PCA is given by a spin configuration $\{\eta(x)\}$, where $x \in \Lambda$ labels sites in a regular lattice $\Lambda$ and each $\eta(x)$ takes values in a set $\mathcal{S} = \{1, 2, \cdots, d\}$. In a CA, the dynamics are governed by a deterministic transition rule~\cite{ulam1952random,neumann1966theory}, \begin{align} \{ \eta(\bm{x}, t+1) \} &= \mathcal{T}[ \{\eta(\bm{x}, t) \}] \end{align} [Fig.~\ref{Hmodel_schematic}(a)]. In a PCA, the spins instead evolve under a Markov process described by the transition matrix $M_{ \eta \to \eta' }$, which characterizes the \emph{probability} to evolve from configuration $\eta$ to $\eta'$~\cite{toom1974nonergodic,dawson1977stable,gacs1986reliable}. $M$ should be local in the sense that the update distribution of a spin depends only on the state of its nearest neighbors, or more generally, on some finite range ``neighborhood'' $ \mathcal{N}$. A particularly natural class of PCAs arise by starting with a deterministic CA and perturbing it with an ``error rate'' $\epsilon$. More concretely, at each step, the spins first follow the rule $\mathcal{T}$, and then with a probability bounded by $\epsilon$ they randomly flip to a different state. One can think of the resulting Markov process as a perturbation to the deterministic one, $M = \mathcal{T} + \epsilon \, \Delta M$, where $\Delta M$ determines the precise error distribution. The mathematical results we will describe can in fact account for even more general (non-Markovian) error models, as we will describe shortly~\cite{gacs2001reliable, gacs2021new}. A deterministic CA (with ${\cal S}=\{-1,1\}$) can trivially realize a time-crystal: for example, the rule $1 \leftrightarrow -1$. In fact, since CA are capable of universal classical computation, they can realize any dynamical phenomena which can be programmed on a computer~\cite{codd2014cellular}. Whether a PCA can realize a stable time-crystal is significantly more subtle. The long-time dynamics of a PCA are described by the stationary probability distributions $\mathcal{P}[\eta]$ of $M$, e.g., $M \mathcal{P}[\eta] = \mathcal{P}[\eta]$. We say $M$ exhibits an $n$-fold subharmonic response if there are $n > 1$ distinct distributions, $\mathcal{P}_i[\eta]$, such that $M \mathcal{P}_i[\eta] = \mathcal{P}_{i+1}[\eta]$, with $\mathcal{P}_{n} = \mathcal{P}_{0}$. This simply formalizes the notion of long-time oscillations: at long times a generic initial state will relax into to a non-uniform convex combination $\sum_i p_i \mathcal{P}_i$ which is stationary under $M^n$, but not $M$. Such behavior has also been referred to as asymptotic periodicity~\cite{lasota1984asymptotic}. A time crystal is then defined to be a local PCA with a \emph{stable} $n$-fold subharmonic response: for sufficiently small but arbitrary local perturbations $\Delta M$, $M + \Delta M$ should retain its $n$-fold subharmonic response. This motivates the following sharp question: Do PCA time crystals exist~\cite{Bennett1990Stability}? If we perturb the CA rule, $1 \leftrightarrow -1$, with random errors at rate $\epsilon$, it is not a time-crystal: over a time-scale $\sim 1/\epsilon$, each spin will forget its initial state and relax to the maximally mixed distribution. % One could try and fix this by adding some local interactions: for example, each site transitions to state $\eta$ if a majority of its neighbors are in the state $-\eta$. While this simple ``error-correction'' procedure can increase the relaxation time relative to $\sim 1/\epsilon$, it is known that the relaxation time remains finite \cite{gray2001reader}. A more sophisticated approach is required. \emph{Ergodicity breaking in a PCA}---One prerequisite for a time-crystal is ergodicity breaking. A PCA is ``ergodic'' if it has a unique stationary distribution, so that at long times the state is independent of the initial spin configuration. A time-crystal necessarily breaks ergodicity because $M^n$ has $n$ stationary distributions, so the system remembers which of the $n$ states in the orbit it is in. \begin{figure} \centering \includegraphics[width=0.495\textwidth]{fig2_gacs_v3.pdf} \caption{Schematic depicting the translation between a cellular automata step and the corresponding Hamiltonian simulation step. (a) Shows a single step of a one dimensional version of the ``$\pi$-Toom'' rule, which consists of a majority vote and a bit flip. (b) In the Hamiltonian setting, we consider two sets of oscillators, A (blue) and B (red). The corresponding Hamiltonian simulation proceeds in two steps. First, there is a ``relaxation'' step followed by local interactions which implement the ``majority vote''. In this second step, the B oscillators are fixed, while the state of the A oscillators is updated. (c) Trajectory $q_{A/B}(t)$ during an error correction step of the Toom model for a $32\times 32$ lattice with $v=50$ and $T=2$. The vertical dashed lines divide time into four steps as described in the text; an error of the form $q\sim-1$ gets corrected to be $q\sim 1$. \label{Hmodel_schematic} } \end{figure} Ergodicity-breaking PCAs were first proved to exist in 2D by Toom~\cite{toom1974nonergodic,toom1980stable}, and much later in 1D by G{\'a}cs~\cite{gacs2001reliable}. Since stable ergodicity breaking is impossible in a zero dimensional model with a finite state space~\cite{ perron1907theorie,frobenius1912matrizen}, the results of Toom and G{\'a}cs necessarily require interactions and dimension $D \geq 1$ (to take the thermodynamic limit). We discuss Toom's model first because of its simplicity. The Toom model is a 2D CA with a binary state space, ${\cal S}=\{-1,1\}$, and a ``majority vote'' transition rule in the Northern-Eastern-Center (NEC) neighborhood ${\cal N}=\{(1,0),(0,1),(0,0)\}$ (the $(\Delta x_i, \Delta y_i) \in \mathcal{N}$ denote the relative locations of the cells in the neighborhood). Namely, the new state of cell $\bm{x}$ is determined by the majority value of the three NEC neighbors, $\bm{x}+{\cal N}$. Crucially, in this model, it was proven that there are two ``phases'' (i.e.~stationary distributions), corresponding to states ``all $+1$'' and ``all $-1$'', which are stable against arbitrary stochastic perturbations below a critical error rate $\epsilon$. The origin of this stability can be intuitively understood: without any errors, the NEC majority vote eliminates any finite island of errors in a short time; as long as the error rate $\epsilon$ is small enough, the system can eliminate an island before another equally large island appears~\cite{bennett1985role,makowiec1999stationary, gacs2021new}. We emphasize that the coexistence of two stable phases in the Toom model is of a much \emph{stronger} nature than the coexistence of equilibrium phases (i.e.~all up and all down) in, for example, the 2D Ising model; this is because the coexistence in the Toom model is stable even if the errors are \emph{biased}. For example, while the deterministic Toom CA happens to have a transition rule with an Ising symmetry, one can perturb using two different error rates, $\epsilon_1 < \epsilon_{-1}$, for states to flip to $\pm 1$, respectively. Despite this bias, at long times, two separate stationary distributions $\mathcal{P}_+, \mathcal{P}_-$ persist. This is in contrast to equilibrium systems (i.e.~the 2D Ising model), where coexistence is always fine-tuned, either via a symmetry, or by tuning to the boundary of a first order phase transition. With Toom having done the hard part, a simple modification we call the ``$\pi$-Toom'' model turns his construction into a time-crystal: instead of an NEC majority vote, we take as our rule the NEC anti-majority vote. Or equivalently, we consider the model in which we interleave a spin flip, $1 \leftrightarrow -1$, between each Toom step. Because Toom has proved that his construction can successfully ``error-correct'' against minority islands, one can immediately conclude the $\pi$-Toom model is a period-doubled time-crystal below a critical error rate $\epsilon$, even if the noise breaks the Ising symmetry. Above this error rate, there is a transition into a disordered phase, analogous to the ergodicity-breaking phase transition of the Toom model. We will numerically confirm this transition exists in the $\pi$-Toom model in Section~\ref{pitoom_DTC}. We note that the potential for the Toom rule to stabilize periodic behavior in PCAs was pointed out well before the recent interest in time-crystals~\cite{Bennett1990Stability, gielis2000coupled}. \emph{Time crystalline order in a 1D PCA}---As with conventional phases of matter, the possibility of a stable, discrete time crystal depends on spatial dimension. Thus, it is natural and interesting to ask if a PCA time-crystal can also exist in 1D. Note that in the quantum case, while the 1D MBL discrete time crystal is fairly well established~\cite{khemani2016phase,else2016floquet,yao2017discrete,randall2021observation,mi2021observation}, the stability of MBL in 2D, and hence the existence of a 2D MBL DTC phase, remains controversial~\cite{de2017stability,crowley2020avalanche}. Unfortunately, Toom's route to stability cannot be generalized to 1D. Since each island of errors is only separated by two domain walls in one dimension, locally one cannot efficiently tell which side corresponds to the error and which side to the correct region. This intuition is not specific to the Toom model, and in fact for many decades it was conjectured that all 1D, finite-range and finite-state PCAs were generically ergodic, i.e.~the so-called ``positive-rates conjecture''~\cite{gray2001reader}. Surprisingly, in 1998, this longstanding conjecture was proven incorrect by G{\'a}cs~\cite{gacs2001reliable}. G{\'a}cs constructed a 1D translation invariant PCA, with nearest neighbor interactions, with the following remarkable property: on a chain of length $L$, the dynamics exhibit $2^L$ stable stationary measures (intuitively, one can think of these as fixed points) in the limit $L \to \infty$; said another way, G{\'a}cs' PCA can ``remember'' one bit per unit length! Each cell/site of the PCA has a large state space, likely somewhere between $2^{24}$ and $2^{400}$~\cite{gray2001reader,gacs2001reliable}. Roughly speaking, each cell contains one bit that it is trying to remember, and the remaining 399 bits (taking e.g.~the $2^{400}$ state space) are involved in a highly collective error correction protocol. As in the Toom model, the stochastic errors can be biased so long as they remain below some finite threshold, above which a dynamical phase transition will restore ergodicity. Even more remarkably, not only is the G{\'a}cs model an error-corrected memory, it can execute Turing-complete operations on the protected state space. In other words, his construction demonstrates that a \emph{stochastic} 1D PCA can be used to simulate a deterministic CA, and hence error-corrected classical computing is possible in 1D. This immediately implies the existence of the ``$\pi$-G{\'a}cs time crystal:'' In particular, one can simply use the G{\'a}cs construction to emulate a CA with the rule: $1 \leftrightarrow -1$. His mathematical results then imply that this is an absolutely stable discrete time crystal, with infinitely long-lived temporal order as $L \to \infty$. G{\'a}cs' result (and Toom's) is mathematically rigorous, and as such, there are assumptions about the error model, which we outline here~\cite{toom1980stable, gacs2001reliable, gacs2021new}. Since the PCA is viewed as a perturbation to a CA rule $\mathcal{T}$, given a particular spatio-temporal history $\eta(\bm{x}, t)$, we say an ``error'' $E_u$ occurred at space-time point $u$ if it didn't follow the update rule $\mathcal{T}$; instead, the state of $u$ is chosen according to some noise distribution. $E_{u_1} \wedge E_{u_2}$ then denotes the situation where errors have occurred at both $u_1$ and $u_2$. G{\'a}cs only requires that the probability that errors (of any type) occurring at $k$ space-time points $\{u_{\ell} \}$ satisfy the bound $P_{\wedge_{\ell=1}^k E_{u_\ell}} \le \epsilon^k$ for some constant $\epsilon$ \cite{gacs2001reliable}. The G{\'a}cs model is non-ergodic below a finite critical $\epsilon$, \emph{irrespective} of the further details of $P_{\wedge^k_\ell E_{u_\ell}}$. Thus, G{\'a}cs' error model is extremely general --- it does not even require that the errors come from a Markov process. To understand why most physical systems would naturally satisfy this bound, one can expand G{\'a}cs' error condition using the chain rule for conditional probabilities, $P_{X \wedge Y} = P_{X|Y} P_Y$, which yields \begin{align} P_{\wedge_{\ell=1}^k E_{u_\ell}}=\prod_{\ell=1}^k P_{E_\ell|E_{\ell-1}\cdots E_1}\le \epsilon^k. \label{error_condition} \end{align} Thus, a sufficient condition is simply to require that each $P_{E_\ell|E_{\ell-1}\cdots E_1}\le \epsilon$; if we choose $\ell$ to be ordered in time, this will be satisfied if the probability for an error to occur at $\ell$, conditioned on all of the past errors, is below some constant $\epsilon$. This will \emph{always} be the case for a Markov model of the form, $M = \mathcal{T} + \epsilon \Delta M$, for arbitrary (local) entries $|\Delta M_{\eta \to \eta'}| < 1$. Thus, the ``stability to errors'' of the G{\'a}cs model can be understood, more generally, as the stability to local perturbations. \section{Translating a PCA into Floquet-Langevin Dynamics} Our goal in this section is to bridge the gap between the preceding results from theoretical computer science and systems more familiar to many-body physics. Specifically, we aim to map the $\pi$-Toom and $\pi$-G{\'a}cs models to a classical Floquet Hamiltonian coupled to a Langevin bath which instantaneously satisfies detailed balance. A well-known mapping from $D$-dimensional CA to $D+1$-dimensional \emph{equilibrium} models was studied in the 1980s~\cite{bennett1985role,enting1977crystal,Domany1984}; however, these mappings introduce an extra spatial dimension corresponding to the history of the CA. Thus, time-translation breaking in the original CA does not actually give rise to time-crystalline order in the resulting Hamiltonian. So here we take a different approach. We should say at the outset that there is nothing particularly special about our strategy, and other proposals may work equally well. In fact the problem can be understood as a constrained instance of the well-studied ``embedding problem:'' we aim to realize a discrete-time Markov process (the PCA) via the stroboscopic dynamics of a continuous time Monte Carlo chain (CTMC) satisfying local detailed balance (LDB)~\cite{privault2013understanding, lencastre2016empirical, wolpert2019stochastic}. The dynamics we consider take the general Langevin form, \begin{align} \dot{q}_i &= \partial_{p_i} H( \{p, q \}; t) \nonumber \\ \dot{p}_i &= -\partial_{q_i} H(\{p, q \}; t) + R_i(t) - \gamma p_i \nonumber \\ \langle R_i(t)& R_j(t') \rangle_{\textrm{noise}} = 2 \gamma T \delta_{ij} \delta(t - t'), \label{Langevin_dynamics} \end{align} \noindent where $(q_i, p_i)$ are the conjugate variables of a mechanical oscillator at site $i$. As depicted in Fig.~\ref{Hmodel_schematic_state}(a,b), roughly speaking we will encode the discrete state of the CA spin, $\eta_i$, as the integer part of the position, $\eta_i = \floor*{q_i}$. The Hamiltonian will take the familiar form $H(t) = \sum_i \frac{p^2_i}{2 m} + U(\{q\}, t)$, with $U(t)$ engineered so that one Floquet cycle, $H(t + \tau) = H(t)$, will enact one cycle of the CA update $\mathcal{T}$. In order to satisfy the fluctuation-dissipation theorem at each instant in time, $R_i(t)$ is a stochastic force whose variance is proportional to the friction coefficient $\gamma$ and the temperature $T$. This stochastic force will sometimes lead to ``errors'' in the Hamiltonian simulation of the CA, making it effectively a PCA. Let us begin by defining the precise mapping between the state $s$ of a single spin in the CA and the phase space $(q, p)$ of a single oscillator. Each spin takes on values within the discrete state space $\mathcal{S}$, while the oscillators take on continuous values, $q \in \mathbb{R}$. To map from the CA to the oscillator ($Q: \mathcal{S} \to \mathbb{R}$), we use $Q(s) = s$~[Fig.~\ref{Hmodel_schematic_state}(a)]. To map from the oscillator to the CA ($S: \mathbb{R} \to \mathcal{S}$), we use the following prescription: given a position $q$, the corresponding state $S(q) = s$ is given by the closest $Q(s)$ such that $S\left(q\right)=\arg\min_s |Q\left(s\right)-q|$~[Fig.~\ref{Hmodel_schematic_state}(b)]. We note that the oscillator-to-CA mapping is many-to-one; indeed, it is completely independent of the momentum $p$. \begin{figure*} \centering \includegraphics[width=0.8\textwidth]{dtc_pitoom_v2.pdf} \caption{Floquet Langevin simulation of the $\pi$-Toom model for a two dimensional lattice of size $32\times 32$, with $v=50$. For each panel, the inset depicts the initial configuration (for both $A$ and $B$ oscillators), where red indicates $q=+1$ and blue indicates $q=-1$. (a) For a uniform initial state, at low temperatures, the time crystalline order parameter remains finite at late times. At high temperatures, the time crystal quickly melts into a disordered phase. (b) For an initial state with a central island of errors (i.e.~oscillators in $q=-1$), at low temperatures, the Floquet Langevin dynamics ``error correct'' and the time crystalline order grows toward a plateau at late times. At high temperatures, the time crystal again melts into a disordered phase. (c) For an initial state with stripes of errors, one sees the same qualitative behavior as in panel (b). As expected, near the transition (data set with $v/T=15.75$), it becomes difficult to tell whether the time crystalline order will eventually decay or plateau to a finite value. \label{dtc_toom_dynamics} } \end{figure*} When building Hamiltonian dynamics that simulate the CA, we encounter a challenge. Unlike the discrete time evolution of the CA, where the update of the global state is immediate, in a continuous-time Hamiltonian system, one needs a way to ``store'' the previous global state throughout the update cycle. This is essential in order to give the dynamics enough time to identify what the new state of the system should be. To solve this issue, we promote each CA cell at position $\bm{x}$ to \emph{two} oscillators ($A$ and $B$) with coordinates $(q_{\bm{x}}^A,p^A_{\bm{x}})$, and $(q_{\bm{x}}^B,p^B_{\bm{x}})$. At each step, we will view one set of oscillators (say $A$) as the ``memory'', while the other set ($B$) will undergo evolution to the new state $B = \mathcal{T}(A)$, driven by $U(t)$. We then exchange the role of $A$ and $B$ and repeat. In a sense, our protocol condenses the extra history dimension of the equilibrium construction~\cite{bennett1985role,enting1977crystal,Domany1984} to a constant overhead in the state-space size. Interestingly, it was recently shown that such ancillary ``hidden'' degrees of freedom are necessary in any CTMC realization of a sufficiently non-trivial discrete-time Markov chain, including the ``bit-flip'' process (e.g. a time-crystal)~\cite{wolpert2019stochastic}. Within this protocol, one Floquet cycle ($A \to B \to A$) can actually execute \emph{two} CA steps. However, when considering discrete time-crystals, where we want the Floquet period to enact a single CA step, one can always make one of the steps equivalent to either the ``do-nothing'' ($\mathcal{I}$) or Toom CAs. This would result in an interleaving of the form: $(\mathcal{I} \mathcal{T}) ( \mathcal{I} \mathcal{T}) \cdots$. \emph{Building the Floquet dynamics}---We now turn to building the Floquet dynamics, which simulate the transition rules of the cellular automata. We begin with the oscillators at site $\bm{x}$ in the state $(q^{A/B}_{\bm x}, p^{A/B}_{\bm x}) = \Big(Q\big(\eta(\bm{x},t)\big), 0\Big)$. From there, the dynamics evolve via a 4-step process. \vspace{2mm} \textbf{Step 1: Relaxation.} The goal of the first step is to leverage dissipation in order to reduce fluctuations in the system. In particular, we envision turning on a one-body potential, $V_{\textrm{pin}}(q)$, which has a local minimum at $Q(s)$ for all $s\in{\cal S}$. At sufficiently low temperatures, the dissipative dynamics [Eqn.~\ref{Langevin_dynamics}] will relax the oscillator's positions, $q_{\bm x}$, toward valid values of $Q(s)$ with low momenta (with fluctuations of order the equipartition scale $\sim k_B T$). The precise form of $V_{\textrm{pin}}$ is not important; however, for concreteness we will utilize \begin{align} V_{\textrm{pin}}(q) = v_{\textrm{pin}} \prod_{s \in \mathcal{S}} (Q(s) - q)^2 \end{align} where the overall magnitude of the pinning potential is set by $v_{\textrm{pin}}$. \vspace{2mm} \textbf{Step 2: Fix A move B.} As illustrated in Fig.~\ref{Hmodel_schematic}, the second step of the Floquet dynamics implements the cellular automata transition $B = \mathcal{T}(A)$. We will keep $q^A$ fixed using the pinning potential, $V_{\textrm{pin}}$. For the $B$ oscillators, however, we turn off $V_{\textrm{pin}}$, and turn on an interaction $V_I$ between $q^A$ and $q^B$. This interaction is engineered such that each $q_{\bm x}^B$ sees only a single potential minimum corresponding to the desired CA update rule; in general, this will depend on the state of the $A$ oscillators in the associated neighborhood, $\{q_{\bm{x}+{\cal N}}^A\}$. Defining the location of this minimum to be $\widetilde{{\cal T}}(\{q_{\bm{x}+{\cal N}}^A\})$, we can then specify an interaction of the form: \begin{align} V_{I}(\{q^A_{\bm{x}+{\cal N}}\}, q^B_{\bm x}) = \frac{v_I}{2} \left( \widetilde{{\cal T}}(\{q^A_{\bm{x}+{\cal N}}\}) - q^B_{\bm x}\right)^2, \label{VI_implementation} \end{align} where the interaction strength is characterized by $v_I$. This is a highly non-linear but local interaction between each $q^B_{\bm x}$ and a finite set of $A$ oscillators, $\{ q^A_{ {\bm x} + \mathcal{N}} \}$, within the neighborhood, $\mathcal{N}$. In particular, as shown in Fig.~\ref{Hmodel_schematic}(b), for the example of $\widetilde{{\cal T}}$ being an ``anti-majority vote'', the interaction would correspond to an $|\mathcal{N}|+1$ body coupling~\footnote{Naively, one could set $\tilde{{\cal T}}(\{q_{\bm{x}+{\cal N}}^A\}) = Q\Big({\cal T}\big( S(q_{\bm{x} + {\cal N}}^A)\big)\Big)$. However, the discontinuities in $S(q)$, and hence $V_I$, lead to isolated points with infinite force, which makes any analysis or numerical simulation significantly more troublesome. To remedy this, we smooth the interaction using an interpolation as detailed in Appendix~\ref{appendix}.}. \vspace{2mm} \textbf{Step 3: Relaxation.} In the third step, we turn off the interaction, $V_I$, while ramping up the pinning potential, $V_{\textrm{pin}}$. As in the first step, dissipation relaxes and pins the positions of the oscillators. \vspace{2mm} \textbf{Step 4: Fix B move A.} In the final step, we implement ``$A = \mathcal{T}(B)$'' by repeating step two with the role of $A$ and $B$ reversed. \vspace{2mm} After these four steps, our Floquet dynamics have implemented two steps of the cellular automata update rule, $\cal T$. This block naturally forms a single period of the Floquet drive, which can then be repeated. As aforementioned, one can also replace the transition $\mathcal{T}$ in step two with the ``do-nothing'' CA rule if one wants to implement only a single CA update, $\mathcal{T}$, per Floquet cycle. We now have all of the ingredients to explicitly define our Langevin dynamics, governed by: \begin{equation} H\left(t\right)=\sum_{\bm{x}}\frac{{p^A_{\bm{x}}}^2}{2m}+ \frac{{p^B_{\bm{x}}}^2}{2m}+U\left(t,\{q^A_{\bm{x}}, q^B_{\bm{x}}\}\right), \end{equation} where the potential $U(t, \{q^A_{\bm{x}}, q^B_{\bm{x}}\})$ has a Floquet period of $\tau=4$: \begin{align} &U\left(t,\{q^A_k, q^B_k\}\right)= \nonumber \\ &\left\{ \begin{array}{ll} \sum_{\bm{x}} V_{\textrm{pin}}(q^A_{\bm{x}})+V_{\textrm{pin}}(q^B_{\bm{x}}) & \mbox{if $\mod(\lfloor t\rfloor,4)=0,2$};\\ \sum_{\bm{x}} V_{\textrm{pin}}(q^A_{\bm{x}})+ V_I\left(q^A_{\bm{x}+{\cal N}},q^B_{\bm{x}}\right) & \mbox{if $\mod(\lfloor t\rfloor,4)=1$};\\ \sum_{\bm{x}} V_I\left(q^B_{\bm{x}+{\cal N}},q^A_{\bm{x}}\right) + V_{\textrm{pin}}(q^B_{\bm{x}}) & \mbox{if $\mod(\lfloor t\rfloor,4)=3$}. \end{array} \right. \label{Vt} \end{align} Without loss of generality, we set the mass, $m=1/2$, in the remaining discussions. \section{Discrete Time-Crystal in the $\pi$-Toom model} \label{pitoom_DTC} Within the PCA setting, the $\pi$-Toom model (an anti-majority vote in the NEC neighborhood) is a discrete time-crystal, and in the preceding section, we have described a procedure for ``simulating'' this model using continuous-time Floquet-Langevin dynamics. At zero temperature, $T=0$, where the dynamics are damped and deterministic, our protocol will faithfully simulate the $\pi$-Toom model, as long as the friction coefficient is chosen ``correctly'' relative to $v_{I}$, $v_{\textrm{pin}}$ and the Floquet period. More precisely, one should choose $\gamma$ to ensure that the oscillators' relaxation occurs on a time-scale that is short relative to the Floquet period. The possible flaw at finite temperature is that the errors due to Langevin noise (e.g.~thermally activated escape out of the pinning potentials) may not satisfy the requirements of the G{\'a}cs and Toom error models. Even though Langevin noise is Markovian, the effective error model for our simulated PCA dynamics is not because the oscillator-to-CA mapping is many-to-one and thus, the system possesses some extra memory. The worry is that there may then be ``avalanches'' of errors; for example, if an oscillator makes an error during one step, it \emph{could} be more likely for it to make another error in a subsequent step. Such correlations are harmless so long as they satisfy the bound in Eqn.~\ref{error_condition}. \begin{figure}[t] \includegraphics[width=3.4in]{4_FM.pdf} \caption{ Error probability $P_E$ versus the ratio of the pinning potential to the temperature, $v/T$, in simulations of (\textbf{a}) the do-nothing ($\mathcal{I}$) and Toom CAs. The dashed-red line indicates the equilibrium estimate of Eqn.~\eqref{pe_equi}. (\textbf{b}) The $\pi$-Toom CA. While $P_E$ apparently depends on the simulated CA, as $v$ increases the $\pi$-Toom error rate converges toward the Toom error rate. In all cases, we find an exponential decay in the error rate as a function of $v/T$. Data are obtained from a a $32\times 32$ system by averaging over 25 Floquet cycles after an initial evolution of 200 Floquet cycles. \label{PE_benchmark}} \end{figure} We will return to a detailed analysis of error correlations in Sec.~\ref{sec:langevin_errors}, but let us begin by numerically exploring time crystalline order in a Floquet-Langevin simulation of the $\pi$-Toom model. Consider a binary CA on a two dimensional square lattice, with state-space ${\cal S}=\{-1,1\}$, and a CA-to-oscillator mapping, $Q(s) = s$, as previously discussed. We take the pinning potential to be: $V_{\textrm{pin}}(q)= v_{\textrm{pin}} (q-1)^2 (q+1)^2+ F q$, where $F=10^{-4}$ breaks the accidental Ising symmetry of the $\pi$-Toom model. % Parameterizing the magnitude of the interaction strength and the pinning potential as $v_{\textrm{pin}}=4v_I=v$, we numerically solve the Floquet-Langevin dynamics [Eqn.~\eqref{Langevin_dynamics}] via a first-order Euler-stepper. The noise term, $R_i(t)$, is implemented via random momentum kicks with variance $2\eta T dt$, where $dt$ is chosen to ensure that the relative momentum change within each step is small. Finally, $\gamma$ is chosen such that the dynamics are tuned to critical damping relative to both $V_{\textrm{pin}}$ and $V_{I}$. \begin{figure}[t] \includegraphics[width=0.4\textwidth]{Fig5_Coarse_T5.pdf} \caption{ Cumulants, $\langle N^n_V \rangle_c$, of the error distribution from a Floquet Langevin simulation of the $\pi$-Toom model for $L \times L\times L$ space-time volumes. The dashed curves are fits to $\langle N^n_V \rangle_c / L^3 = c_n - b_n L^{-\eta_n}$. We find $\eta > 0$ (Table~\ref{tab:fits}), indicating convergence to a finite $c_n$. Each data point was estimated from the statistics of $3000$ independent Langevin trajectories ($T=5.17, v=100$), with $1000$ $L \times L\times L$ blocks sampled from each trajectory. \label{Density_L} } \end{figure} In order to ensure that a single Floquet period implements only one $\pi$-Toom update, we utilize the following interleaving strategy: in step two, we choose $\widetilde{\mathcal{T}}$ to be the Toom update rule, while in step four, we choose $\widetilde{\mathcal{T}}$ to be the $\pi$-Toom update rule. % We probe the resulting dynamics by measuring the average ``magnetization'', $\braket{M_A}\equiv \frac{1}{N} \sum_k {\rm sign}(q_k^A)$, where $N$ is the system size. % Time crystalline order corresponds to stable period-doubling of the magnetization and manifests as a late-time plateau in the order parameter: $(-1)^{\lfloor t/\tau \rfloor} \braket{M_A}$. To investigate the emergence of DTC order, we compute the Floquet-Langevin dynamics starting from three distinct initial states: (i) a uniform input state with all oscillators in $q=+1$ [Fig.~\ref{dtc_toom_dynamics}(a)], (ii) a state which contains an island of $q=-1$ oscillators in the center [Fig.~\ref{dtc_toom_dynamics}(b)], and (iii) a state which consists of diagonal stripes of $q=-1$ oscillators [Fig.~\ref{dtc_toom_dynamics}(c)]~\footnote{Note that for perfect stripes, even the deterministic Toom model cannot not correct it. However, there are a measure zero set of such fine-tuned initial conditions.}. % In the language of the $\pi$-Toom PCA, for each of these initial states, one can think of the oscillators with $q=-1$ as ``errors'', which will either be ``corrected'' by our Floquet Langevin dynamics (for sufficiently low bath temperatures) or not. For the uniform initial state [Fig.~\ref{dtc_toom_dynamics}(a)], the DTC order parameter, $(-1)^{\lfloor t/\tau \rfloor} \braket{M_A}$, begins at unity for all temperatures. At high temperatures, the order parameter quickly decays to zero, indicating that the Floquet Langevin dynamics drive the system toward the disordered phase. On the other hand, for sufficiently low temperatures, the time crystalline order evolves toward a finite plateau value at late-times, indicative of a DTC. In Fig.~\ref{dtc_toom_dynamics}(b), we show the analogous dynamics starting from an initial state with a central island of errors. For low temperatures, the Floquet Langevin dynamics correct these errors and the DTC order parameter grows, with the system approaching a time crystalline state. Again, above a critical temperature, time crystalline order ``melts'' and the stroboscopic magnetization decays to zero. Finally, Fig.~\ref{dtc_toom_dynamics}(c) depicts the dynamics starting from a striped error configuration; the qualitative features are identical to Fig.~\ref{dtc_toom_dynamics}(b), although the competition between the DTC phase and the disordered phase is more apparent at intermediate temperatures. % In order to characterize the phase transition between the time crystal and the disordered phase as a function of temperature, we compute the late time Floquet Langevin dynamics up to time-scale, $t \sim 10^4$, starting from a uniform initial state. We define the plateau value of the DTC order parameter as the late-time average of the stroboscopic magnetization, $\overline{(-1)^{\lfloor t/\tau \rfloor} \braket{M_A}}$; in particular, we average $(-1)^{\lfloor t/\tau \rfloor} \braket{M_A}$ starting at $t=3000$ for $\sim 500$ Floquet cycles and $\sim 50$ noise realizations. One can immediately observe the DTC phase transition by plotting the time-crystalline order parameter, $\overline{(-1)^{\lfloor t/\tau \rfloor} \braket{M_A}}$, versus $T$. However, in order to compare our Floquet Langevin simulation with a direct implementation of the $\pi$-Toom PCA, we first translate the temperature, $T$, to an effective error rate $P_E$ (per space-time cell). To do so, for each temperature, we examine the ensemble of all simulated Langevin trajectories and count the number of errors under the continuous to discrete mapping $S$; this allows us to empirically determine the error rate, $P_E(T)$. % As shown in Fig.~\ref{Hmodel_schematic_state}(c), the time crystalline order parameter exhibits a sharp phase transition as a function of $P_E$. \begin{table}[t] \begin{tabular}{ c |c c c } $n$ & $c_n$ & $b_n$ & $\eta_n$ \\ \hline 1 & 0.048 & 0 & --- \\ \hline 2 & 0.052 & 0.007 & 0.60 \\ \hline 3 & 0.067 & 0.026 & 0.46\\ \hline 4 & 0.088 & 0.060 & 0.90 \end{tabular} \caption{Fitting parameters for the dashed curves in Fig.~\ref{Density_L}. } \label{tab:fits} \end{table} Although there is clearly a phase transition, the question remains: How accurate is the Floquet-Langevin simulation of the $\pi$-Toom model? To answer this question, we directly implement the $\pi$-Toom PCA, assuming an error rate $P_E$ (associated with the transition for each space-time point) with no correlations in space or time. As depicted in Fig.~\ref{Hmodel_schematic_state}(c), the functional form and location of the DTC phase transition are in excellent agreement between our Floquet Langevin simulation and the $\pi$-Toom PCA (with improving agreement for larger pinning potential, $v$). However, some discrepancy can be seen near the transition, where there is a residual dependence on the pinning potential even as $P_E(T)$ is held fixed. As we will see, this discrepancy arises because the Floquet-Langevin errors are spatio-temporally \emph{correlated}. In order to claim that Toom and G{\'a}cs' rigorous PCA results apply to our Floquet Langevin simulation in the thermodynamic limit, a more careful analysis of these error correlations is needed---a task to which we now turn. \section{The nature of errors in Floquet-Langevin dynamics} \label{sec:langevin_errors} Due to the presence of a finite temperature bath, the Floquet-Langevin simulation of the $\pi$-Toom model is intrinsically noisy. Large thermal fluctuations can lead to an ``error'' in the subsequent state $\tilde{\eta}({\bm x},t)$ relative to the noiseless transition ${\cal T}\big(\tilde{\eta}({\bm x}+{\cal N},t-1)\big)$. Fortunately, our overall goal is to simulate the noisy PCA version of the $\pi$-Toom model. However, even then, the distribution of errors arising from the Floquet-Langevin dynamics need not (a priori) be consistent with the error model considered in the context of e.g. G{\'a}cs' and Toom's mathematical results on stability. To this end, we now characterize the nature of errors in our Floquet-Langevin simulation. Our goal is to obtain numerical evidence that: (1) the errors arising from the Floquet-Langevin dynamics satisfy the condition in Eqn.~\ref{error_condition} for some constant $\epsilon(T)$ and (2) the error bound $\epsilon(T)$ can be made arbitrarily small as $T \to 0$, to ensure the error threshold for Toom or G{\'a}cs' results can be obtained. To begin, we first examine the temperature dependence of the error \emph{rate} per space-time cell $P_E = \langle E_x \rangle$, where $E_x = 0/1$ is the indicator function for an error at $x$, and show that $P_E(T)$ decays exponentially as $T \to 0$. Note that due to the spatio-temporal correlation of errors, the error rate is not the same as the error bound, $P_E \neq \epsilon$, but $P_E$ will nevertheless play an important roll in the analysis. In Fig.~\ref{PE_benchmark}a, we show the empirically measured error rate $P_E(T)$ as a function of $v/T$ for two simulated PCAs which are usually static: the ``do-nothing'' CA $\mathcal{I}$ and the Toom CA. We find $P_E$ decays exponentially in $v/T$, suggesting that the errors arise from activated tunneling over the $V_{\textrm{pin}}, V_I$ barriers. For the parameters studied here, we expect the dominant error source arises from the transition between the ``Fix A (B) move B (A)'' step and the relaxation step enforced by $V_I$. To predict the rate of such errors, suppose that the interaction potential is driving an oscillator to the state $q=-1$, so that $V_I(q)=\frac{v_I}{2} (q+1)^2$. When the dynamics switch to the pinning potential $V_{\textrm{pin}}(q)$, an error will occur if the oscillator has a position $q \in [0,\infty)$. Assuming the system reaches local equilibrium with respect to $V_I$, the probability of this error can be estimated from the Boltzmann distribution as: \begin{eqnarray} P_E\left (\frac{v_I}{T} \right) \equiv \frac{\int_0^\infty e^{-V_I(q)/T}}{\int_{-\infty}^\infty e^{-V_I(q)/T}}=\frac{1}{2}{\rm Erfc}\left (\sqrt{\frac{v_I}{2T}} \right), \label{pe_equi} \end{eqnarray} which asymptotically gives exponential decay $P_E \sim e^{-v_I / 2 T}$. In Fig.~\ref{PE_benchmark}a, we show that this prediction (dashed red line) gives good agreement with the observed decay. In Fig.~\ref{PE_benchmark}b, we examine $P_E(T)$ for the $\pi-$Toom CA, which involves considerable motion during each cycle. For small $v_I$, the $\pi-$Toom CA error rate is higher than the Toom CA, suggesting that non-equilibrium effects beyond the estimate of Eqn.~\eqref{pe_equi} are important. As $v$ increases, the $\pi$-Toom error rate approaches that of the static CA. Regardless, in all cases we find that decreasing the temperature leads to an exponential decay in $P_E$, implying that for strong potentials and low temperatures, arbitrarily small $P_E$ can be obtained. \begin{figure} \centering \includegraphics[width=3.3in]{Fig3.pdf} \caption{Connected two-point correlations of the errors. (a) Depicts the propagation of errors in real space for $v=100$ and $T=5.17$. The connected correlation, $\langle E_1 E_2\rangle_c / P_E$, for different time separations $\Delta t$ is shown as a function of the spatial separations. The color map range is rescaled by 1.0, 0.025, 0.004 for the left, middle and right panels respectively. (b) Depicts the connected correlations for different cuts along space (top and bottom) and different temperatures (left and right). \label{fig:piToom_Error_Corr} } \end{figure} We now turn to the crucial issue of spatio-temporal correlations. Consider an arbitrary space-time volume $V$ containing $|V|$ points. Letting $P(N_V)$ denotes the probability that $N_V$ errors occur in the volume $V$, we aim to provide empirical evidence that there is a constant $\epsilon$ such that $P(N_V = |V|) \leq \epsilon^{|V|}$ for all $V$. However, measuring $P(N_V = |V|)$ directly is difficult because for large $|V|$ such ``large deviations''~\cite{deuschel2001large,varadhan1984large,den2008large,touchette2011basic} are too rare to collect statistics. To make progress, we will instead relate $P(N_V = |V|)$ to the connected $n$-point functions of the errors, which are feasible to estimate for low enough $n$. Roughly speaking, if the connected $n$-point functions decay fast enough, the desired bound will be satisfied. To do so, we consider the scaled cumulant generating function (SCGF) $\lambda_V(k)$ defined by $\langle e^{k N_V} \rangle = e^{|V| \lambda_V(k)}$. The SCGF upper bounds $P(N_V = |V|) \leq e^{ - |V|(k - \lambda_V(k))}$ for any choice of $k \geq 0$. The error bound can then be defined by a min-max principle \begin{align} \ln(1/\epsilon) = \min_V \max_{k \geq 0} (k - \lambda_V(k)). \end{align} The Taylor series of the SCGF gives the $n$-th cumulants of $N_V$, $\lambda_V(k)= |V|^{-1} \sum_{n=1}^\infty \langle N_V^n \rangle_c \frac{k^n}{n!}$. The cumulants are in turn related to the connected correlations, e.g., $\langle N_V^2 \rangle_c =\sum_{x, y \in V} \langle E_x E_y \rangle_c$. If the correlations decay, we expect the cumulants to scale as $\langle N_V^n \rangle_c = |V| c_n(V)$, where $c_n(V)$ depends on the geometry of $V$ but does not grow with $|V|$ (in particular, $c_1(V) = P_E$). Let us suppose that their growth is upper bounded by a constant $c_n \equiv \max_V c_n(V)$. Furthermore, suppose that the resulting $c_n$ grow slower than $n!$, so that we obtain a bound $\lambda_V(k) \leq \lambda(k) \equiv \sum_{n=1}^\infty c_n \frac{ k^n}{n!}$ for all $k \geq 0$. It would then follow that $\ln(1/\epsilon) = \max_{k \geq 0} (k - \lambda(k))$. Since $\lambda(0) = 0$ and $\lambda'(k) = P_E < 1$, the maximal value is positive and finite, ensuring Eqn.~\eqref{error_condition} is satisfied for some $\epsilon < 1$. Our goal, then, is to provide empirical evidence that $\langle N^n_V \rangle_c $ does not grow faster than $|V|$ or $n!$. Rather than enumerating over all $V$, we restrict our attention to space-time boxes of dimension $|V| = L \times L \times L$ (note that such compact volumes are the most likely to show violations, as they contain the most correlations). In Fig.~\ref{Density_L}, we show the estimated cumulants of our Floquet Langevin simulation of the $\pi$-Toom model for $L = 2 - 32$. They converge to a finite $c_n$ with a power law correction in $1/L$. While it is difficult to estimate the cumulants beyond $n>3$, from the available data the $n!$ bound on $c_n$ is safely satisfied. It is interesting to note that the errors are power-law correlated and non-Gaussian. In Fig.~\ref{fig:piToom_Error_Corr}, we present data on the two-point correlations $\langle E_{\Delta t, \Delta x, \Delta y} E_{0, 0, 0} \rangle_c$ of the $\pi$-Toom simulation. We see that an initial error causes an increased likelihood for errors at nearby space-time points, with correlations which propagate outward in a anisotropic manner consistent with Toom's NEC-rule. While it is again difficult to obtain estimates for large spatio-temporal separations, if we indulge in fitting three points to a line, the decay is consistent with a power-law, in agreement with the power-law convergence of the cumulants $\langle N^n \rangle_c$. Finally, we turn to whether the error bound $\epsilon(T) \to 0$ as $T \to 0$. One sufficient condition is the existence of a $T$-independent, continuous, and strictly increasing function $\Lambda(k)$ such that $\lambda(k) \leq P_E(T) \Lambda(k)$ for all $k, T \geq 0$, with $\Lambda(0) = 0$. To see why, note the min-max principle gives \begin{align} \log\left (1/ \epsilon(T) \right) \geq \max_{k\geq 0} \left(t - P_E(T) \Lambda(k) \right). \label{eq:epsT_bound} \end{align} Since $\Lambda$ is invertible on $\mathbb{R}^+$, we may define $k_\ast(P_E) = \Lambda^{-1}(1 / P_E)$. Eqn.~\eqref{eq:epsT_bound} then provides the bound $\log(1/ \epsilon(T)) \geq k_\ast(P_E(T)) - 1$. Finally, note $\lim_{P_E \to 0} k_\ast(P_E) = \infty$, because the inverse of a strictly increasing function is itself strictly increasing. Thus, the existence of such a $\Lambda(k)$, combined with our earlier evidence that $\lim_{T \to 0} P_E(T) = 0$, would imply $\lim_{T \to 0} \epsilon(T) = 0$. To verify the existence of such a $\Lambda(k)$, it would be sufficient to show that the scaled cumulants are bounded as $c_n(T) \leq P_E(T) C_n $, with $C_n$ growing slower than $n!$, so that $\Lambda(k)$ has an infinite radius of convergence (Poisson statistics corresponds to $C_n = 1$, $\Lambda(k) = e^k$). However, due to the small statistics, numerically estimating $c_n$ at low temperatures is extremely demanding. A preliminary comparison of $T = 5.17, 11.94$ (see appendix~\ref{appendix}) finds $c_2(T) / P_E(T) = 1.24$ at $T = 11.94$, while $c_2(T) / P_E(T) = 1.08$ at $T = 5.17$, consistent with an approach to $C_2 \sim 1$, but a comprehensive investigation remains a work in progress. In summary, despite errors which are power-law correlated and non-Gaussian, we find compelling evidence that Langevin-Floquet dynamics can simulate a PCA with an error bound $\epsilon(T)$ that satisfies Eq.~\eqref{error_condition}, so that Toom and G\'acs' results may be applied to this setting. Of course we cannot rule out that for some anomalously large volume $|V|$, cumulant order $n$, or inverse temperature $1/T$, the observed behavior will change course and violate the bound---a caveat common to any numerical finite-scaling approach. Obtaining a rigorous proof of this bound thus remains an interesting future direction. \section{Discussion and Outlook} There is a long history of understanding computation as a fundamentally physical process, and the subsequent constraints which arise from thermodynamics: ``Computers may be thought of as engines for transforming free energy into waste heat and mathematical work''~\cite{landauer1961irreversibility, bennett1982thermodynamics, wolpert2019stochastic}. In this point of view, a time-crystal can be understood as a physical realization of the second-simplest possible computer program: a global \textsf{NOT}-gate. By demanding that the program execute perfectly despite faulty (noisy) gates, and when restricting to physical implementations that rely only on local interactions, the execution of such a program can be understood as a non-equilibrium ``phase of matter,'' and the error threshold as a non-equilibrium phase transition into a time-crystalline phase. It is interesting to speculate about extensions of this approach to the quantum setting, where a discrete-time Markov process is promoted to a quantum channel, and the Langevin bath to a Lindbladian. On the one hand, any classical Markov process, such as the Toom or G\'acs PCA, can be realized as a quantum channel which dephases and acts diagonally on populations. When assessing stability in the quantum setting, however, it remains to be shown that the ergodicity breaking is robust to imperfect dephasing. On the other hand, error-corrected quantum computing can be realized as a purely local autonomous process in the thermodynamic limit~\cite{harrington2004analysis, dauphinais2017fault} and by analogy to the discussion above, one may realize a time-crystal by running the program ``\textsf{NOT}'' on an error-corrected quantum computer. In this sense, the existence of time-crystals in open systems is an elementary application of deeper results regarding the physical possibility of error-correction in autonomous, locally interacting systems. \emph{Acknowledgements}---We are greatly indebted to conversations with P. G\'acs for generously explaining various details of his work, C. Maes for pointing us to the literature on coupled map lattices, and C. Nayak and L. Balents for collaborations on related work. MPZ is indebted to conversations with D. Huse during the initiation of this work. This work is supported in part by the Army Research Office (Grant No. W911NF2110262), the DARPA DRINQS program (Grant No. D18AC00033), the A. P. Sloan foundation, the David and Lucile Packard foundation, and the W. M. Keck Foundation.
\section{Introduction} Deep learning models and algorithms are often built for specific tasks and the samples (usually) follow a certain distribution. Specifically, the source-domain/training samples and target-domain/testing samples are drawn from the same distribution. However, these data sets are often collected at different sources and exhibit substantial heterogeneity, and thus the samples may follow closely related but different distributions in real-world applications. Therefore, robust and efficient training of deep neural networks using such data sets is theoretically important and practically relevant in deep learning research. Meta-learning provides an unique paradigm to overcome this challenge \cite{munkhdalai2017meta, finn2017model,li2018learning, rusu2018meta, yao2021improving, balaji2018metareg}. Meta-learning is known as \emph{learning-to-learn} which aims to gain the capability of quickly learning unseen tasks from the experience of learning episodes that covers the distribution of relevant tasks. In a multiple-task scenario, given a family of tasks, meta-learning has been proven as a useful tool for extracting task-agnostic knowledge and improve the learning performance of new tasks from that family \cite{thrun1998learning, hospedales2021meta}. Most of the modern approaches of meta-learning are focus on \emph{domain adaptation}, where the target domain information is available in meta-training, but this setting is still too ideal to apply in practice. Recently the study on \emph{domain generalization (DG)} has attracted much attention. DG allows the training model to learn representations from several related source domains and gain adequate generalization ability for unseen test distributions. However, DG techniques for image reconstruction are rarely explored in solving inverse problems. Leveraging large-scale heterogeneous MRI data to overcome inflated prediction performance caused by small-scale clinic datasets is of great interest for more precise, predictable, and powerful health care. For the sack of reducing scan time and improve diagnostic accuracy of MRI, the data are often acquired by using different under-sampling patterns (e.g., Cartesian mask, Radial mask, Poisson mask), under-sampling ratios, and different settings of the parameters resulting in different contrast (e.g., T1-weighted, T2-weighted, proton-density (PD), and Flair). Hence the public data are heterogeneous. This work aims at developing a generalizable MRI reconstruction method in the meta-learning framework that can leverage large-scale heterogeneous datasets to reconstruct MR images with the available small-scale dataset from specific setting of the scan. In this work, we propose a meta-learning-based model for solving the MRI image reconstructions problem by leveraging diverse/heterogeneous dataset. % Data acquisition in compressed sensing MRI (CS-MRI) with k-space (Fourier space) undersampling can be formulated as follows % \begin{equation}\label{MRI} \mathbf{y} = \mathbf{P} \mathcal{F} \mathbf{x} + \mathbf{n}, \end{equation} where $ \mathbf{y} \in \mathbb{C}^p$ is the measured k-space data with total of $p$ sampled data points, $ \mathbf{x} \in \mathbb{C}^{N\times 1}$ is unknown MR image with $N$ pixels to be reconstructed, $ \mathcal{F} \in \mathbb{C}^{N \times N}$ is the 2D discrete Fourier transform (DFT) matrix, and $ \mathbf{P} \in \mathbb{R}^{p \times N}$ $(p< N)$ is the binary matrix representing the sampling mask in k-space. Reconstruction of $\mathbf{x}$ from (noisy) undersampled data $\mathbf{y}$ is an ill-posed problem. % An effective strategy to elevate the ill-posedness issue is to incorporate prior information by adding a regularization term. In light of the substantial success of deep learning and the massive amount of training data available nowadays, we propose to learn the regularization term and then solve $\mathbf{x}$ from the following unconstrained optimization problem % \begin{equation}\label{csmodel} \bar{\mathbf{x}} = \argmin_{\mathbf{x}} \frac{1}{2} \| \mathbf{P} \mathcal{F} \mathbf{x} - \mathbf{y} \|^2 + R(\mathbf{x}; \Theta), \end{equation} % where $\|\cdot\|$ is the standard 2-norm of vectors, the first term in the objective function in \eqref{csmodel} is data fidelity term that ensures consistency between the reconstructed $ \mathbf{x}$ and the measured data $\mathbf{y}$, and the second term $ R(\mathbf{x}; \Theta)$ is the regularization term that introduces prior knowledge to the image to be reconstructed and represented by a convolutional neural network (CNN) with parameters $\Theta$ that learned from training data. % We will discuss in details how this regularization is formed in Sections \ref{sec:Method} and \ref{sec:Implementation}. In this paper, we first introduce a nonconvex and nonsmooth learnable optimization algorithm (LOA) with rigorous convergence guarantees. Then we construct a deep reconstruction network by following the LOA exactly. This approach is inspired by the work \cite{chen2020learnable}, but the LOA developed in this work is different from the one in \cite{chen2020learnable}. Furthermore, we propose a novel MRI reconstruction model \eqref{our_model} with a regularization term for multi-task adaptation, which consists of a task-invariant regularization and a task-specific hyperparameter. The former extracts common prior information of images from different tasks, which learns task-invariant parameters $\theta$. The latter exploits the proper task-specific parameters (also called meta-knowledge) $\omega_i$ for each individual task $i$. % The purpose is to increase the generalization ability of the learned regularization, so that the trained LOA-induced deep reconstruction network can perform well on both seen and unseen tasks. % To train the network we split the training data into two parts: training and validation, and introduce a bilevel optimization model for learning network parameters. The lower-level optimization learns the task-invariant parameters $\theta$ of the feature encoder with fixed task-specific parameters $\omega_i$ on the training dataset, and the upper-level optimizes the task-specific parameters on the validation dataset. The well-trained network of seen tasks can be applied to the unseen tasks with determined $\theta$. This adaptation only needs a few iterations to update $\omega_i$ with a small number of training samples of unseen tasks. As demonstrated by our numerical experiments in Section \ref{experiments}, our proposed framework yields much improved image qualities using diverse data sets of various undersampling trajectories and ratios for MRI image reconstruction. % The underpinning theory is that an effective regularization can integrate common feature and prior information from a variety of training samples from diverse data sets, but they need to be properly weighted in the reconstruction of the image under specific sample distribution (i.e., undersampling trajectory and ratios). Our contributions can be summarized as follows: \begin{enumerate}[leftmargin=*] % \item LOA inspired network architecture. Our network architecture exactly follows a proposed LOA of guaranteed convergence. So the network is interpretable, parameter-efficient, stable, and generates high-quality reconstructions after proper training. \item Design of Regularization. Unlike the existing meta-learning methods, the proposed approach of network training can learn adaptive regularizer from diverse data sets. % Our adaptive regularizer consists of the task-invariant portion and the task-specific portion. The task-invariant portion aims at exploiting the common features and shared information across all involved tasks, whereas the task-specific parameters only learn the regularization weight to properly balance the data fidelity and learned regularization in individual tasks. \item A novel bilevel network training algorithm for improving generalizability. We utilize train data and validation data for training the designed network, which follows a bilevel optimization algorithm that is trained from a heterogeneous dataset. The lower-level determines the optimal task-invariant parameters for any fixed task-specific parameters, and the upper-level optimizes the task-specific parameters on validation data so that the task-invariant parameter can be adapted to different tasks. \item Better generalization and faster adaption. On reconstructing the under-sampled MRIs with various scanning trajectories, the network after meta-training can be directly applied to reconstruct the images sampled on multiple seen trajectories and can achieve quick adaption to the new unseen trajectories sampling patterns. \end{enumerate} The remainder of the paper is organized as follows. In Section \ref{related_work}, we introduce some related work for both optimization-based meta-learning and deep unrolled networks for MRI reconstructions. We sketch our meta-learning model and the neural network in Section \ref{sec:Method} and describe the implementation details in Section \ref{sec:Implementation}. Section \ref{experiments} introduces the reconstruction results. Section \ref{conclusion} concludes the paper. \section{Related work}\label{related_work} \iffalse \subsection{Background of Meta-learning} In conventional supervised machine learning, the training data is given as a set of pairs of inputs and outputs $ \mathcal{D} = \{ (\mathbf{y}_m, \hat{\mathbf{x}}_m )\}_{m=1}^{\mathcal{M}}$, and we want to train the prediction model $ \phi_{\theta}$ which is parameterized by $ \theta \in \Theta$ and maps inputs $ \mathbf{y}_m \in \mathcal{Y} $ to their corresponding outputs $\hat{\mathbf{x}}_m \in \mathcal{X} $. The parameters $\theta$ is learned by minimizing a predefined loss function $ L : \mathcal{X} \times \mathcal{X} \to\mathbb{R} $, which measures the discrepancy between the output $ F_{\theta}(\mathbf{y}_m)$ and the reference $\hat{\mathbf{x}}_m$, here we denote \begin{equation} \ell( \theta; \mathcal{D}) := \sum_{m = 1}^{\mathcal{M}}L( F_{\theta}(\mathbf{y}_m), \hat{\mathbf{x}}_m ). \end{equation} The goal of the conventional supervised learning is to find optimal parameters $ \hat{\theta}$ such that \begin{equation} \hat{\theta} = \argmin_{\theta} \ell( \theta; \mathcal{D}). \end{equation} In the supervised meta-learning, \emph{meta-knowledge} $ \omega$ is introduced to provide guidance of "how to learn" and improve the generalizability to learn new task by learning an algorithm for general tasks. Pre-specified assumptions such as learning-rate, initial parameters and choices of optimizer can vary in meta-learning \cite{huisman2021survey}. The goal is to find the optimal meta-knowledge $ \omega$ over a distribution of tasks $ p(\mathcal{T})$, and $ \omega$ also known as \emph{cross-task} knowledge \cite{hospedales2021meta}. The general setting can be separated as meta-training, meta-validation and meta-testing, each of these stages associates with disjoint sets of tasks. We denote $ \mathcal{T}_i = ( \mathcal{D}^{tr}_{\tau_i}, \mathcal{D}^{val}_{\tau_i}, \mathcal{D}^{test}_{\tau_i}) , \mathcal{T}_i \sim p(\mathcal{T})$, and meta-training stage uses dataset $ \{ ( \mathcal{D}^{tr}_{\tau_i}, \mathcal{D}^{val}_{\tau_i}) \}^P_{i=1}$ with $P$ tasks where each task has training set and validation set. The meta-testing stage or evaluation stage uses dataset with $Q $ tasks $ \{ ( \mathcal{D}^{tr}_{\tau_i}, \mathcal{D}^{test}_{\tau_i}) \}^Q_{i=1}$, at which point the model is allowed to update parameters for individual task on training set and then the model performance can be evaluated on the testing set after task-specific parameter updating. The meta-training process can be cast as a bilevel optimization problem: \begin{subequations}\label{meta-bilevel} \begin{align} \hat{\omega} = & \argmin_{\omega} \sum^{P}_{i=1} \ell_{\tau_i} ( \theta_i(\omega), \omega; \mathcal{D}^{val}_{\tau_i}) \label{outer}\\ s.t. \ \ \theta_i(\omega) = & \argmin_{\theta} \ell_{\tau_i}(\theta, \omega; \mathcal{D}^{tr}_{\tau_i}), \label{inner} \end{align} \end{subequations} where $\ell_{\tau_i}$ is the task-aware loss function associated with task $\tau_i$. \eqref{inner} is \emph{inner/lower/base} level optimization that solves for specific parameter for each individual task from its corresponding training set with the task-specific parameter $\omega$ fixed. \eqref{outer} is \emph{outer/upper/meta} level optimization that learns hyper-parameter $\omega$ by minimizing the validation loss. \fi Meta-learning methods have in recent years yielded impressive results in various fields with different techniques, and plays a different roles in different communities, it has a very broad definition and perspective in the literature \cite{hospedales2021meta}. Several survey papers \cite{ hospedales2021meta, huisman2021survey} have a detailed introduction of this development. Three categories of meta-learning techniques are commonly grouped \cite{yao2020automated, lee2018gradient, huisman2021survey} as metric-based methods \cite{koch2015siamese, vinyals2016matching, snell2017prototypical}, model-based methods \cite{mishra2017simple, ravi2016optimization, qiao2018few, graves2014neural}, and optimization-based methods \cite{finn2017model, rajeswaran2019meta, li2017meta}, which are often cast as a bi-level optimization problem and exhibits relatively better generalizability on wider task distributions. We mainly focus on optimization-based meta-learning in this paper. \subsection{ Optimization-based approaches}\label{l2l} In the context of optimization-based meta-learning, a popular strategy is gradient descent based inner optimization \cite{finn2017model,antoniou2018train,rajeswaran2019meta,li2017meta,nichol2018first,finn2019online,grant2018recasting,finn2018probabilistic,yoon2018bayesian}. The optimization problem is often cast as a bilevel learning, where the outer level (upper/leader level) optimization is solved subject to the optimality of inner level (lower/follower level) optimization so that the optimized model can generalize well on the new data. The inner level encounters new tasks and tries to learn the associated features quickly from the training observations, the outer level accumulates task-specific meta-knowledge across previous tasks and the meta-learner provides support for the inner level so that it can quickly adapt to new tasks. e.g. the Model-Agnostic Meta-Learning (MAML) \cite{finn2017model} aims at searching for an adaptive initialization of the network parameters for new tasks with only a few steps that updates in the inner level. In recent years, a large number of followup works of MAML proposed to improve generalization using similar strategy \cite{lee2018gradient, rusu2018meta, finn2018probabilistic, grant2018recasting, nichol2018first, vuorio2019multimodal, yao2019hierarchically,yin2020metalearning}. Deep bilevel learning \cite{jenni2018deep} seeks to obtain better generalization that trained on one task and generalize well on another task. Their model is to optimize a regularized loss function to find network parameters from training set and identify hyperparameters so that the network performs well on validation dataset. When the unseen tasks lie in inconsistent domains with the meta-training tasks, as revealed in \cite{chen19closerfewshot}, the generalization behavior of the meta-learner will be compromised. This phenomenon partially arises from the meta-overfitting on the already seen meta-training tasks, which is identified as memorization problem in \cite{yin2020metalearning}. A meta-regularizer forked with information theory is proposed in \cite{yin2020metalearning} to handle the memorization problem by regulating the information dependency during the task adaption. MetaReg \cite{balaji2018metareg} decouples the entire network into the feature network and task network, where the meta-regularization term is only applied to the task network. They first update the parameters of the task network with meta-train set to get the domain-aligned task network, then update the parameters of meta-regularization term on meta-test set to learn the cross-domain generalization. Different from MetaReg, Feature-Critic Networks \cite{li2019feature} exploits the meta-regularization term to pursue a domain-invariant feature extraction network. The meta-regularization is designed as a feature-critic network that takes the extracted feature as input. The parameters of the feature extraction network are updated by minimizing the new meta-regularized loss. The auxiliary parameters in the feature-critic network are learned by maximizing the performance gain over the non-meta case. % To effectively evaluate the performance of the meta-learner, several new benchmarks \cite{Rebuffi17,48798,yu2020meta} were developed under more realistic settings operate well on diverse visual domains. As mentioned in \cite{48798}, the generalization to unseen tasks within multimodal or heterogeneous datasets remains as a challenge to the existing meta-learning methods. The aforementioned methods pursue domain generalization for the classification networks that learned regularization function to learn cross-domain generalization. Our proposed method is aiming for solving the inverse problem and we construct an adaptive regularization that not only learns the universal parameters among tasks, but also the task-aware parameters. The designated adaptive regularizer assists the generalization ability of the deep model so that the well-trained model could be able to perform well on a heterogeneous datasets of both seen or unseen tasks. \subsection{MRI reconstruction models and algorithms} MRI reconstruction is generally formulated as a variation model in the format of \eqref{csmodel}, which is a data fidelity term plus a regularization term. Traditional methods employ handcrafted regularization terms such as total variation (TV), and the solution algorithm follows a theoretical justification. However, it is hard to tune the associated parameter (often require hundreds even thousands of iterations to converge) to capture subtle details and satisfy clinic diagnostic quality. Deep learning based model leverages large dataset and further explore the potential improvement of reconstruction performance comparing to traditional methods and has successful applications in clinic field \cite{lundervold2019overview, liang2020deep, sandino2020compressed, mccann2017convolutional, zhou2020review, singha2021deep, chandra2021deep, ahishakiye2021survey}. % However, training generic deep neural networks (DNNs) may prone to over-fitting when data is scarce as we mentioned in the beginning. Also, the deep network structure behaves like a black box without mathematical interpretation. To improve the interpretability of the relation between the topology of the deep model and reconstruction results, a new emerging class of deep learning-based methods is known as \emph{learnable optimization algorithms} (LOA) attracts attention in the literature \cite{liu2020deep, liang2020deep}. LOA was proposed to map existing optimization algorithms to structured networks where each phase of the networks correspond to one iteration of an optimization algorithm or replace some ingredients such as proximal operator \cite{cheng2019model,bian2020deep}, matrix transformations \cite{yang2018admm, hammernik2018learning, zhang2018ista}, non-linear operators \cite{yang2018admm, hammernik2018learning}, and denoiser/regularizer \cite{aggarwal2018modl, schlemper2017deep} etc., by CNNs to avoid difficulty for solving non-smooth non-convex problems. Different from the current LOA approach for image reconstruction that simply imitates the algorithm iterations without any convergence justification or just replaces some hardly solvable components with sub-networks, our proposed LOA-induced network inherits the convergence property of the proposed Algorithm \ref{alg:lda}, where we provide convergence analysis in Appendix \ref{convergence}. The proposed network retains the interpretability of the variational model, parameter efficiency and contributes to better generalization. \section{Proposed Method}\label{sec:Method} \subsection{LOA-induced reconstruction network} \label{network} Our deep algorithmic unrolling reconstruction network represented as $F_{\Theta}$ where $\Theta$ denotes the set of all learnable parameters in the model. Motivated by the variational model, for an input partial k-space data $\mathbf{y}$ in $\mathcal{D}_{\tau_i}$, we desire the network output $F_{\Theta}(\mathbf{y})$ to be an optimizer of the following minimization problem as \eqref{model}. We use "$\approx$" since in practice we only do finite-step optimization algorithm to approximate the optimizer \begin{equation}\label{model} F_{\Theta}(\mathbf{y}) \approx \argmin_{\mathbf{x}} \big\{ \phi_{\Theta}(\mathbf{x}, \mathbf{y}) := f(\mathbf{x}, \mathbf{y}) + R(\mathbf{x}; \Theta) \big\}, \end{equation} where $f$ is the data fidelity term that usually takes the form $f(\mathbf{x}, \mathbf{y}) = \frac{1}{2} \| \mathbf{P} \mathcal{F} \mathbf{x} - \mathbf{y} \|^2$ in standard MRI setting, where $\mathcal{F}$ and $\mathbf{P}$ represent the Fourier transform and the binary under-sampling mask for k-space trajectory respectively. % However, we remark that our approach can be directly applied to a much broader class of image reconstruction problems as long as $f$ is continuously differentiable with Lipschitz continuous gradient. In this section, we introduce a learned optimization algorithm (LOA) for solving \eqref{model}, where the network parameters $\Theta$ are learned and fixed. Since $\Theta$ are fixed in \eqref{model}, we will omit them in the derivation of the LOA below and write $R(\mathbf{x}; \Theta)$ as $R(\mathbf{x})$ for notation simplicity. Then we generate a multi-phase network induced by the proposed LOA, i.e. the network architecture follows the algorithm exactly such that one phase of the network is just one iteration of the LOA. In our implementation, to incorporate sparsity along with the learned features, we parameterize the function $R (\mathbf{x})= \kappa \cdot r(\mathbf{x})$, where $\kappa>0$ is a weight parameter that needs be chosen properly depending on the specific task (e.g., noise level, undersampling ratio, etc.), and $r$ is a regularizer parameterized as a (composition of) neural networks and can be adapted to a broad range of imaging applications. In this work, we parameterize $r$ as the composition of the $l_{2,1}$ norm and a learnable feature extraction operator $\mathbf{g}_j(\mathbf{x})$. That is, we set $r$ in \eqref{model} to be % \begin{equation}\label{eq:r} r(\mathbf{x}) := \|\mathbf{g}_j(\mathbf{x})\|_{2,1} = \sum_{j = 1}^{m} \|\mathbf{g}_{j}(\mathbf{x})\|. \end{equation} % Here $\mathbf{g}_j(\cdot)=\mathbf{g}_j(\cdot;\theta)$ is parametrized as a convolutional neural network (CNN) where $\theta$ is the learned and fixed network parameter in $r(\cdot;\theta)$ as mentioned above. We also consider $\kappa$ to be learned and fixed as $\theta$ for now, and will discuss how to learn both of them in the next subsection. % We use smooth activation function in $\mathbf{g}$ formulate in \eqref{eq:sigma} which renders $\mathbf{g}$ a smooth but nonconvex function. Due to the nonsmooth $\|\cdot\|_{2,1}$, $r$ is therefore a nonsmooth nonconvex function. Since the minimization problem in \eqref{model} is nonconvex and nonsmooth, we need to derive an efficient LOA to solve it. This solver will be termed as $F_{\Theta}(\mathbf{y})$. % Here we first consider smoothing the $ l_{2,1}$ norm that for any fixed $\mathbf{g}(\mathbf{x})$: \begin{equation}\label{eq:l21} r_{\varepsilon} (\mathbf{x}) = \sum\nolimits^m_{j=1} \sqrt{\| \mathbf{g}_{j} (\mathbf{x}) \|^2 + \varepsilon^2} -\varepsilon. \end{equation} We denote $R_{\varepsilon} = \kappa \cdot r_{\varepsilon}$. % The LOA derived here is inspired by the proximal gradient descent algorithm and iterates the following steps to solve the smoothed problem: \begin{subequations}\label{prox} \begin{align} \mathbf{z}_{t+1} & = \mathbf{x}_{t} - \alpha_t \nabla f(\mathbf{x}_{t}) \label{prox_u}\\ \mathbf{x}_{t+1} & = \prox_{\alpha_t R_{\varepsilon_{t}} } (\mathbf{z}_{t+1} ), \label{prox_sub} \end{align} \end{subequations} where $\varepsilon_{t}$ denotes the smoothing parameter $\varepsilon$ at the specific iteration $t$, and proximal operator is defined as $ \prox_{\alpha g}(\mathbf{b}) := \argmin_{\mathbf{x}} \left\| \mathbf{x}-\mathbf{b} \right\| + \alpha g(\mathbf{x})$ in \eqref{prox_sub}. A quick observation from \eqref{eq:l21} is that $R_{\varepsilon} \rightarrow R$ as $\varepsilon$ diminishes, so later we will intentionally push $\varepsilon_{t} \rightarrow 0$ at Line 16 in Algorithm \ref{alg:lda}. Then one can readily show that $ R_{\varepsilon}(x) \le R(x) \le R_{\varepsilon}(x) + \varepsilon$ for all $x$ and $\varepsilon > 0$. From Algorithm \ref{alg:lda}, line 16 will automatically reduce $\varepsilon$ and the iterates will converge to the solution of the original nonsmooth nonconvex problem \eqref{model}, a rigorous sense will be made precisely in the convergence analysis in Appendix \ref{convergence}. Since $R_{\varepsilon_{t}}$ is a complex function involving a deep neural network, its proximal operator does not have close-form and cannot be computed easily in the subproblem in \eqref{prox_sub}. % To overcome this difficulty, we consider to approximate $R_{\varepsilon_{t}}$ by \begin{subequations} \begin{align} \hat{R}_{\varepsilon_{t}} (\mathbf{z}_{t+1}) & = R_{\varepsilon_{t}}(\mathbf{z}_{t+1}) + \nonumber \langle \nabla R_{\varepsilon_{t}}(\mathbf{z}_{t+1}), \mathbf{x}-\mathbf{z}_{t+1} \rangle + \frac{1}{\beta_t} \norm{\mathbf{x}-\mathbf{z}_{t+1}}^2. \label{eq:u} \end{align} \end{subequations} Then we update $ \mathbf{u}_{t+1} = \prox_{\alpha_t \hat{R}_{\varepsilon_{t}} } (\mathbf{z}_{t+1} )$ to replace \eqref{prox_sub}, therefore we obtain \begin{equation}\label{ut+1} \mathbf{u}_{t+1} = \mathbf{z}_{t+1} - \tau_t \nabla R_{\varepsilon_{t}}(\mathbf{z}_{t+1}), \text{ where } \tau_t = \frac{\alpha_t \beta_t}{\alpha_t + \beta_t}. \end{equation} % In order to guarantee the convergence of the algorithm, we introduce the standard gradient descent of $\phi_{\varepsilon_{t}} $ (where $\phi_{\varepsilon_{t}} := f + R_{\varepsilon_{t}}$) at $ \mathbf{x}$: \begin{equation}\label{grad_dst} \mathbf{v}_{t+1} = \argmin_{\mathbf{x}} \langle \nabla f(\mathbf{x}_{t}), \mathbf{x} - \mathbf{x}_{t} \rangle + \langle \nabla R_{\varepsilon}(\mathbf{x}_{t}) , \mathbf{x} - \mathbf{x}_{t} \rangle + \frac{1}{2 \alpha_t} \| \mathbf{x} - \mathbf{x}_{t} \|^2, \end{equation} which yields \begin{equation}\label{vt+1} \mathbf{v}_{t+1} =\mathbf{x}_{t} - \alpha_t \nabla \phi_{\varepsilon_{t}}(\mathbf{x}_{t}) , \end{equation} to serve as a safeguard for the convergence. % Specifically, we set $\mathbf{x}_{t+1} = \mathbf{u}_{t+1}$ if $\phi_{\varepsilon_{t}}(\mathbf{u}_{t+1}) \le \phi_{\varepsilon_{t}}(\mathbf{v}_{t+1})$; otherwise we set $\mathbf{x}_{t+1} = \mathbf{v}_{t+1}$. Then we repeat this process. Our algorithm is summarized in Algorithm \ref{alg:lda}. The prior term with unknown parameters has the exact residual update itself which makes the training process more fluent \cite{he2016deep}. The condition checking in Line 5 is introduced to make sure that it is in the energy descending direction. Once the condition in Line 5 fails, it comes to $\mathbf{v}_{t+1}$ and the line search in Line 12 guarantees the appropriate step size can be achieved within finite steps to make the function value decrease. From Line 3 to Line 14, we can regard that it solves a problem of minimizing $\phi_{\varepsilon_t}$ with $\varepsilon_{t}$ fixed. Line 15 is to update the value of $\varepsilon_{t}$ depending on a reduction criterion. The detailed analysis of this mechanism and in-depth convergence justification is shown in Appendix \ref{convergence}. The corresponding unrolling network exactly follows the Algorithm \ref{alg:lda}, thus shares the same convergence property. Compared to LDA \cite{chen2020learnable} computes both candidates $\mathbf{u}_{t+1}$, $\mathbf{v}_{t+1}$ at every iteration and then chooses the one that achieves a smaller function value, we propose the criteria above in Line 5 for updating $\mathbf{x}_{t+1}$, which potentially saves extra computational time for calculating the candidate $\mathbf{v}_{t+1}$ and potentially mitigates the frequent alternations between the two candidates. Besides, the smoothing method proposed in this work is more straightforward than smoothing in dual space \cite{chen2020learnable} whereas still keeping provable convergence as shown in Theorem \ref{theorem a6}. The proposed LOA-induced network is a multi-phase network whose architecture exactly follows the proposed LOA \ref{alg:lda} in the way that each phase corresponding to one iteration of the algorithm with shared parameters. These unknown parameters are trained by the method in the next section. \begin{algorithm}[t] \caption{Algorithmic Unrolling Method with Provable Convergence} \label{alg:lda} \begin{algorithmic}[1] \STATE \textbf{Input:} Initial $\mathbf{x}_0$, $0<\rho, \gamma<1$, and $\varepsilon_0$, $a, \sigma >0$. Max total phases $T$ or tolerance $\epsilon_{\mathrm{tol}}>0$. \FOR{$t=0,1,2,\dots,T-1$} \STATE $\mathbf{z}_{t+1} = \mathbf{x}_{t} - \alpha_{t} \nabla f(\mathbf{x}_{t})$ \STATE $\mathbf{u}_{t+1} = \mathbf{z}_{t+1} - \tau_t \nabla R_{\varepsilon_{t}} (\mathbf{z}_{t+1})$, \IF{ $\| \nabla \phi_{\varepsilon_{t}} (\mathbf{x}_{t}) \| \leq a \| \mathbf{u}_{t+1} - \mathbf{x}_{t} \| \ \mbox{and} \ \phi_{\varepsilon_{t}}(\mathbf{u}_{t+1}) - \phi_{\varepsilon_{t}}(\mathbf{x}_{t}) \leq - \frac{1}{a}\| \mathbf{u}_{t+1} - \mathbf{x}_{t} \|^2 $ holds} \STATE set $\mathbf{x}_{t+1} = \mathbf{u}_{t+1}$, \ELSE \STATE $\mathbf{v}_{t+1} = \mathbf{x}_{t} - \alpha_{t} \nabla \phi_{\varepsilon_{t}}(\mathbf{x}_{t})$, \label{marker} \IF{ $ \phi_{\varepsilon_{t}}(\mathbf{v}_{t+1}) - \phi_{\varepsilon_{t}}(\mathbf{x}_{t}) \le - \frac{1}{a} \| \mathbf{v}_{t+1} - \mathbf{x}_{t}\|^2$ holds} \STATE set $\mathbf{x}_{t+1} = \mathbf{v}_{t+1}$, \ELSE \STATE update $\alpha_{t} \leftarrow \rho \alpha_{t}$, then \textbf{go to}~\ref{marker}, \ENDIF \ENDIF \STATE \textbf{if} $\|\nabla \phi_{\varepsilon_{t}}(\mathbf{x}_{t+1})\| < \sigma \gamma {\varepsilon_{t}}$, set $\varepsilon_{t+1}= \gamma {\varepsilon_{t}}$; \textbf{otherwise}, set $\varepsilon_{t+1}={\varepsilon_{t}}$. \STATE \textbf{if} $\sigma {\varepsilon_{t}} < \epsilon_{\mathrm{tol}}$, terminate. \ENDFOR \STATE \textbf{Output:} $\mathbf{x}_T$. \end{algorithmic} \end{algorithm} \subsection{Bilevel optimization algorithm for network training} In this section, we consider the parameter training problem of the LOA-induced network. Specifically, we develop a bilevel optimization algorithm for training our network parameters $ \Theta$ from diverse data sets. As shown in Section \ref{network}, we design $R (\mathbf{x};\Theta)= \kappa \cdot r(\mathbf{x};\Theta)$, where $r$ is going to be learned to capture the intrinsic property of the underlying common features across all different tasks. % To account for the large variations in the diverse training/validation data sets, we introduce a task-specific parameter $\omega_i$ to approximate the proper $\kappa$ for the $i$th task. Specifically, for the $i$th task, the weight $\kappa$ is set to $\sigma(\omega_i) \in (0, 1)$, where $\sigma(\cdot)$ is the sigmoid function. Therefore, $\kappa = \sigma(\omega_i)$ finds the proper weight of $r$ for the $i$-th task according to its specific sampling ratio or pattern. % The parameters $\omega_i$ are to be optimized in conjunction with $\Theta$ through the hyperparameter tuning process below. % Suppose that we are given $\mathcal{M}$ data pairs $\{(\mathbf{y}_m, \hat{\mathbf{x}}_m) \}_{m = 1} ^{\mathcal{M}}$ for the use of training and validation where $\mathbf{y}_m$ is the observation, which is partial k-space data in our setting, and $\hat{\mathbf{x}}_m$ is the corresponding ground truth image. The data pairs are then sampled into $\mathcal{N}$ tasks $\{ \mathcal{D}_{\tau_i} \}_{i = 1} ^ {\mathcal{N}}$, where each $\mathcal{D}_{\tau_i}$ represents the collection of data pairs in the specific task $\tau_i$. In each task $\tau_i$, we further divide the data into the task-specific training set $\mathcal{D}^{tr}_{\tau_i}$ and validation set $\mathcal{D}^{val}_{\tau_i}$. Architecture of our base network exactly follows the LOA \ref{alg:lda} developed in previous section with learnable parameters $\theta$ and a task-specific parameter $\omega_i$ for the $i$th task. More precisely, for one data sample denoted by $(\mathbf{y}^{(i)}_{j},\hat{\mathbf{x}}^{(i)}_{j})$ in task $\tau_i$ with index $j$, we propose the algorithmic unrolling network for task $\tau_i$ as \begin{equation}\label{our_model} F_{\theta,\omega_i}(\mathbf{y}^{(i)}_{j}) \approx \argmin_{\mathbf{x}} f(\mathbf{x}, \mathbf{y}^{(i)}_{j}) + \sigma(\omega_i) r(\mathbf{x};\theta), \end{equation} $\theta$ denotes the learnable common parameters across different tasks with task-invariant representation whereas $\omega_i$ is a task-specific parameter for task $\tau_i$. Here $\omega_i \in \mathbb{R}$ and $\sigma$ is the sigmoid function such that $\sigma(\omega_i) \in (0,1)$. The weight $\sigma(\omega_i)$ represents the weight of $r$ associated with the specific task $\tau_i$. We denote $\omega$ to be the set $\{\omega_i\} _ {i = 1} ^ {\mathcal{N}}$. The detailed architecture of this network is illustrated in Section \ref{network}. We define the task-specific loss \begin{equation}\label{loss_sum} \ell_{\tau_i}(\theta, \omega_i ; \mathcal{D}_{\tau_i}) = \sum _ {j=1}^{ |\mathcal{D}_{\tau_i}|} \ell \big( F_{\theta,\omega_i}(\mathbf{y}^{(i)}_{j}), \hat{\mathbf{x}}^{(i)}_{j} \big), \end{equation} % where $|\mathcal{D}_{\tau_i}|$ represents the cardinality of $\mathcal{D}_{\tau_i}$ and \begin{equation}\label{loss} \ell \big( F_{\theta,\omega_i}(\mathbf{y}^{(i)}_{j}), \hat{\mathbf{x}}^{(i)}_{j} \big) := \frac{1}{2} \|F_{\theta,\omega_i}(\mathbf{y}^{(i)}_{j}) - \hat{\mathbf{x}}^{(i)}_{j}\|^2. \end{equation} For the sake of preventing the proposed model from overfitting the training data, we introduce a novel learning framework by formulating the network training as a bilevel optimization problem to learn $\omega$ and $\theta $ in \eqref{our_model} as \begin{subequations} \label{eq:bi-level} \begin{align} \min_{ \theta, \ \omega = \omega_{i \in 1:\mathcal{N}}} \quad & \sum^{\mathcal{N}}_{i=1} \ell _{\tau_i}( \theta (\omega) , \omega_i ; \mathcal{D}^{val}_{\tau_i}) \\ \mbox{s.t.}\quad \quad & \theta(\omega) = \argmin_{\theta} \sum^{\mathcal{N}}_{i=1} \ell_{\tau_i} ( \theta , \omega_i ; \mathcal{D}^{tr}_{\tau_i}). \end{align} \end{subequations} % In \eqref{eq:bi-level}, the lower-level optimization learns the task-invariant parameters $\theta$ of the feature encoder with fixed task-specific parameter $\omega_i$ on the training dataset, and the upper-level adjusts the task-specific parameters $\{\omega_i\}$ so that the task-invariant parameters $\theta$ can perform robustly on validation dataset as well. % For simplicity, we omit the summation and redefine $\mathcal{L}(\theta, \omega ; \mathcal{D}) := \sum^{\mathcal{N}}_{i=1}\ell _{\tau_i}(\theta, \omega ; \mathcal{D})$, then briefly rewrite \eqref{eq:bi-level} as \begin{equation} \min_{ \theta, \omega} \mathcal{L}( \theta(\omega), \omega ; \mathcal{D}^{val}) \ \ \ \ \ \mbox{s.t.} \ \ \theta(\omega) = \argmin_{\theta}\mathcal{L}( \theta, \omega ; \mathcal{D}^{tr}). \label{simplified bi-level} \end{equation} Then we relax \eqref{simplified bi-level} into a single-level constrained optimization where the lower-level problem is replaced with its first-order necessary condition following \cite{mehra2019penalty}: % \begin{equation} \min_{ \theta, \omega} \mathcal{L}( \theta, \omega ; \mathcal{D}^{val}) \ \ \ \ \ \mbox{s.t.} \ \ \nabla_{\theta} \mathcal{L}( \theta, \omega ; \mathcal{D}^{tr}) = 0. \label{simplified bi-level-1} \end{equation} % which can be further approximated by an unconstrained problem by a penalty term as \begin{equation} \min_{ \theta, \omega} \big\{ \widetilde{\mathcal{L}}( \theta, \omega ; \mathcal{D}^{tr}, \mathcal{D}^{val}) := \mathcal{L}( \theta, \omega ; \mathcal{D}^{val}) + \frac{\lambda}{2} \| \nabla_{\theta} \mathcal{L}( \theta, \omega ; \mathcal{D}^{tr}) \|^2 \big\}. \label{simplified bi-level-2} \end{equation} We adopt the stochastic gradients of the loss functions on mini-batch data sets in each iteration. % In our model, we need to include the data pairs of multiple tasks in one batch, therefore we propose the cross-task mini-batches when training. At each training iteration, we randomly sample the training data pairs $\mathcal{B}^{tr}_{\tau_i} = \{(\mathbf{y}^{(i)}_{j}, \hat{\mathbf{x}}^{(i)}_{j}) \in \mathcal{D}^{tr}_{\tau_i} \}_{j = 1}^{\mathcal{J}^{tr}}$ and the validation pairs $\mathcal{B}^{val}_{\tau_i} = \{(\mathbf{y}^{(i)}_{j}, \hat{\mathbf{x}}^{(i)}_{j}) \in \mathcal{D}^{val}_{\tau_i} \}_{j = 1}^{\mathcal{J}^{val}}$ on each task $\tau_i$. Then the overall training and validation mini-batchs $\mathcal{B}^{tr}$ and $\mathcal{B}^{val}$ used in every training iteration is composed of the sampled data pairs from the entire set of tasks, i.e. $\mathcal{B}^{tr} = \bigcup_{i = 1}^{\mathcal{N}} \{\mathcal{B}^{tr}_{\tau_i}\}$ and $\mathcal{B}^{val} = \bigcup_{i = 1}^{\mathcal{N}} \{\mathcal{B}^{val}_{\tau_i}\}$. Thus in each iteration, we have $\mathcal{N} \cdot \mathcal{J}^{tr}$ and $\mathcal{N} \cdot \mathcal{J}^{val}$ data pairs used for training and validation respectively. To solve the minimization problem \eqref{simplified bi-level-2}, we utilize the stochastic mini-batch alternating direction method summarized in Algorithm \ref{penelty_method} which is modified from \cite{mehra2019penalty}. % In Algorithm \ref{penelty_method}, the parameter $\delta_{tol}$ is to control the accuracy, the algorithm will terminate when $\delta \le \delta_{tol}$. In addition, $\lambda$ is the weight for the second constraint term of \eqref{simplified bi-level-2}, in the beginning, we set $\lambda$ to be small so as to achieve a quick starting convergence then gradually increase its value to emphasize the constraint. \begin{algorithm} \caption{Stochastic mini-batch alternating direction penalty method}\label{alg:model} \begin{algorithmic}[1] \STATE \textbf{Initialize} $ \theta$, $ {\omega}$, $\delta$, $\lambda$ and $\nu_\delta \in(0, 1)$, \ $\nu_\lambda > 1$. \WHILE{$\delta > \delta_{tol}$} \STATE Sample cross-task training batch $\mathcal{B}^{tr} = \bigcup_{i = 1}^{\mathcal{N}} \{(\mathbf{y}^{(i)}_{j}, \hat{\mathbf{x}}^{(i)}_{j}) \in \mathcal{D}^{tr}_{\tau_i} \}_{j = 1 : \mathcal{J}^{tr}}$ \STATE Sample cross-task validation batch $\mathcal{B}^{val} = \bigcup_{i = 1}^{\mathcal{N}} \{(\mathbf{y}^{(i)}_{j}, \hat{\mathbf{x}}^{(i)}_{j}) \in \mathcal{D}^{val}_{\tau_i} \}_{j = 1 : \mathcal{J}^{val}}$ \WHILE{$\|\nabla_{\theta}\widetilde{\mathcal{L}}( \theta, \omega ; \mathcal{B}^{tr}, \mathcal{B}^{val})\|^2 + \| \nabla_{\omega}\widetilde{\mathcal{L}}( \theta, \omega ; \mathcal{B}^{tr}, \mathcal{B}^{val})\| ^2 > \delta$} \FOR{$k=1,2,\dots,K$ (inner loop)} \STATE $ \theta \leftarrow \theta - \rho_{\theta}^k \nabla_{\theta}\widetilde{\mathcal{L}}( \theta, \omega ; \mathcal{B}^{tr}, \mathcal{B}^{val})$ \ENDFOR \STATE $ \omega \leftarrow \omega - \rho_{\omega} \nabla_{\omega}\widetilde{\mathcal{L}}( \theta, \omega ; \mathcal{B}^{tr}, \mathcal{B}^{val})$ \ENDWHILE \STATE \textbf{update} $\delta \leftarrow \nu_\delta \delta$, $\ \lambda \leftarrow \nu_\lambda \lambda$ \ENDWHILE \STATE \textbf{output:} $\theta, {\omega}$. \end{algorithmic} \label{penelty_method} \end{algorithm} \section{Implementation} \label{sec:Implementation} \subsection{Feature extraction operator} We set the feature extraction operator $\mathbf{g}$ to a vanilla $l$-layer CNN with the componentwise nonlinear activation function $\varphi$ and no bias, as follows: % \begin{equation}\label{eq:g} \mathbf{g}(x) = \mathbf{w}_l * \varphi \cdots \ \varphi ( \mathbf{w}_3 * \varphi ( \mathbf{w} _2 * \varphi ( \mathbf{w} _1 * x ))), \end{equation} % where $\{\mathbf{w} _q \}_{q = 1}^{l}$ denote the convolution weights consisting of $d$ kernels with identical spatial kernel size, and $*$ denotes the convolution operation. % Here $\varphi$ is constructed to be the smoothed rectified linear unit as defined below \begin{equation}\label{eq:sigma} \varphi (x) = \begin{cases} 0, & \mbox{if} \ x \leq -\delta, \\ \frac{1}{4\delta} x^2 + \frac{1}{2} x + \frac{\delta}{4}, & \mbox{if} \ -\delta < x < \delta, \\ x, & \mbox{if} \ x \geq \delta, \end{cases} \end{equation} % where the prefixed parameter $\delta$ is set to be $0.001$ in our experiment. The default configuration of the feature extraction operator is set as follows: the feature extraction operator $\mathbf{g}$ consists of $l=3$ convolution layers and all convolutions are with $4$ kernels of spatial size $3 \times 3$. \subsection{Setups} \label{Task-specific network pre-training} As our method introduces an algorithmic unrolling network, there exists a one-to-one correspondence between the algorithm iterations and the neural network phases (or blocks). Each phase of the forward propagation can be viewed as one algorithm iteration, which motivates us to imitate the iterating of the optimization algorithm and use a stair training strategy \cite{chen2020learnable}. At the first stage, we start training the network parameters using 1 phase, then after the the loss converges, we add more phases (1 phase each time) then continue the training process. We repeat this procedure and stop it until the loss does not decrease any more when we add more blocks. We minimize the loss for $100$ epochs/iterations each time using the SGD-based optimizer Adam \cite{kingma2014adam} with $\beta_1 = 0.9$, $\beta_2 = 0.999$ and initial learning rate set to $10^{-3}$ as well as the mini-batch size $8$. The Xavier Initializer \cite{Glorot10understandingthe} is used to initialize the weights of all convolutions. The initial smoothing parameter $\varepsilon_0$ is set to be $0.001$ then learned together with other network parameters. The input $\mathbf{x}_0$ of the unrolling network is obtained by Zero-filling strategy\cite{bernstein2001effect}. The deep unrolling network was implemented using the Tensorflow toolbox \cite{tensorflow2015-whitepaper} in Python programming language. Our code will be publicly shared depending on acceptance. \section{Numerical Experiments}\label{experiments} \subsection{Dataset} To validate the performance of the proposed method, the data we used are from Multimodal Brain Tumor Segmentation Challenge 2018 \cite{menze2014multimodal}, in which the training dataset contains four modalities ($T1, T1_{c}, T2$ and $FLAIR$) scanned from 285 patients, and the validation dataset contains images from 66 patients, each with volume size $ 240 \times 240 \times 155$. Each modality consists of two types of gliomas: 75 volumes of low-grade gliomas (LGG) and 210 volumes of high-grade gliomas (HGG). Our implementation interested in HGG MRI in two modalities: T1 and T2 images, and we choose 30 patients from each modality in the training dataset for training our network. In the validation dataset, we randomly picked 15 patients as our validation data, and 6 patients in the training dataset as testing data which are are distinct from our training set and validation set. We cropped the 2D image size to be $ 160 \times 180$ in the center region and picked adjacent $10$ slices in the center of each volume, which results in a total of $300$ images as our training data, $150$ images in our validation data, and a total of $60$ images as testing data. The number of data mentioned here is the amount of a single task, but since we employ multi-tasks training, the total number of images in each dataset should multiply the number of tasks. For each 2D slice, we normalize the spatial intensity by dividing the maximum pixel value. \subsection{Experiment settings and Comparison results} All the experiments are implemented on a Windows workstation with Intel Core i9 CPU at 3.3GHz and an Nvidia GTX-1080Ti GPU with 11GB of graphics card memory via TensorFlow \cite{abadi2016tensorflow}. The parameters in the proposed network are initialized by using Xavier initialization \cite{glorot2010understanding}. We trained the meta-learning network with four tasks synergistically associated with four different CS ratios: 10\%, 20\%, 30\%, and 40\%, and test the well-trained model on the testing dataset with the same masks of these four ratios. We have 300 training data for each CS ratio, which amount to total of 1200 images in the training dataset. The results for $T1$ and $T2$ MR reconstructions are shown in Tables \ref{results_same_ratio_t1} and \ref{results_same_ratio_t2} respectively. The associated reconstructed images are displayed in Figures \ref{figure_same_ratio_t1} and \ref{figure_same_ratio_t2}. We also test the well-trained meta-learning model on unseen tasks with radio masks for skewed ratios: 15\%, 25\%, 35\%, and random Cartesian masks with ratios 10\%, 20\%, 30\% and 40\%. The task-specific parameter for the unseen tasks are retrained for different masks with different sampling ratios individually with fixed task-invariant parameters $\theta$. In this experiments, we only need to learn $ \omega_i$ for three skewed CS ratios with radio mask and four regular CS ratios with Cartesian masks. The experimental training proceed on less data and iterations, where we performed on 100 MR images with 50 epochs. For example, for reconstructing MR images with CS ratio 15\% radio mask, we fix the parameter $\theta$ and retrain the task-specific parameter $\omega$ on 100 raw data with 50 epochs, then test with renewed $\omega$ on our testing data set with raw measurement that sampled from radio mask with CS ratio 15\%. The results associated with radio masks are shown in Table \ref{results_dif_ratio_t1} and \ref{results_dif_ratio_t2}, Figure \ref{figure_dif_ratio_t1} and \ref{figure_dif_ratio_t2} for $T1$ and $T2$ images respectively. The results associated with Cartesian masks are list in Table \ref{results_same_ratio_t2_cts} and reconstructed images are displayed in Figure \ref{figure_same_ratio_t2_cts}. We compared proposed meta-learning method with conventional supervised learning, which was trained with one task at each time, and only learns task-invariant parameter $\theta$ without task-specific parameter $ \omega_i$. The forward network of conventional learning unrolls Algorithm \ref{alg:lda} with 11 phases which is the same as meta-learning. We merged training set and validation set which result in $450$ images for training the conventional supervised learning. The training batch size was set as 25 and applied total of 2000 epochs, while in meta-learning we applied 100 epochs with batch size 8. Same testing set was used in both meta-learning and conventional learning to evaluate the performance these two methods. We made comparisons between meta-learning and the conventional network on these seven different CS ratios (10\%, 20\%, 30\%, 40\%, 15\%, 25\%, and 35\%) in terms of two types of random under-sampling patterns: radio mask and Cartesian mask. The parameters for both meta-learning and conventional learning networks are trained via Adam optimizer \cite{kingma2014adam}, and they both learn the forward unrolled task-invariant parameter $\theta$. Network training of conventional method uses the same network configuration as meta-learning network in terms of the number of convolutions, depth and size of CNN kernels, phase numbers and parameter initializer, etc. % The major difference in the training process between these two methods is that meta-learning is proceed on multi-tasks by leveraging task-specific parameter $\omega_i$ that learned from Algorithm \ref{alg:model} and the common feature among tasks are learned from the feed forward network that unrolls Algorithm \ref{alg:lda}, while conventional learning solve for task specific problem by simply unrolls forward network via Algorithm \ref{alg:lda} where both training and testing are implemented on the same task. To investigate the generalizability of meta-learning, we test the well-trained meta-learning model on MR images in different distributions in terms of two types of sampling masks with various trajectories. Training and testing of conventional learning are applied with the same CS ratios, that is, if the conventional method trained on CS ratio 10\% then will be tested on a dataset with CS ratio 10\%, etc. Because of the nature of MR images are represented as complex-value, we applied complex convolutions \cite{WANG2020136} for each CNN, that is, every kernel consists real part and imaginary part. Total of 11 phases are achieved if we set the termination condition $\epsilon_{\mathrm{tol}} = 1\times 10^{-5}$ and the parameters of each phase are shared except for the step sizes. Three convolutions are used in $\mathbf{g}$, each convolution contains 4 filters with spatial kernel size $ 3\times3$. We set $\nu_\delta =0.95 $ and the parameter $\delta$ in Algorithm \ref{alg:model} was initialized as $\delta_0 =1 \times 10^{-3}$ stopped at value $\delta_{tol} = 4.35 \times 10 ^ {-6}$, and we set total of 100 epochs. For training conventional method we set 2000 epochs with same number of phase, convolutions and kernel sizes as meta-learning. Initial $\lambda$ was set as $1 \times 10^{-5} $ and $ \nu_\lambda = 1.001$. We evaluate our reconstruction results on testing data sets using three metrics: PSNR, structural similarity (SSIM) \cite{wang2004image} and normalized mean squared error NMSE. The following formulations compute the PSNR, SSIM and NMSE between reconstructed image $ \mathbf{x}$ and ground truth $\hat{\mathbf{x}}$. % \begin{equation} PSNR = 20\log_{10} \big( \max(\abs{\hat{\mathbf{x}}}) \big/ \frac{1}{N}\| \hat{\mathbf{x}} - \mathbf{x} \|^2 \big), \end{equation} where $N$ is the total number of pixels of ground truth. % \begin{equation} SSIM = \frac{(2\mu_{\mathbf{x}} \mu_{\hat{\mathbf{x}}} + C_1)(2\sigma_{\mathbf{x} \hat{\mathbf{x}}} + C_2)}{(\mu_{\mathbf{x}}^2 + \mu_{\hat{\mathbf{x}}}^2+C_1)( \sigma_{\mathbf{x}}^2 + \sigma_{\hat{\mathbf{x}}}^2 + C_2)}, \end{equation} where $\mu_{\mathbf{x}}, \mu_{\hat{\mathbf{x}}}$ represent local means, $\sigma_{\mathbf{x}}, \sigma_{\hat{\mathbf{x}}}$ denote standard deviations and $\sigma_{\mathbf{x} \hat{\mathbf{x}}} $ covariance between $\mathbf{x}$ and $\hat{\mathbf{x}} $, $ C_1 = (k_1 L)^2, C_2 = (k_2 L)^2$ are two constants which avoid zero denominator, and $ k_1 =0.01, k_2 =0.03$. $L$ is the largest pixel value of MR image. % \begin{equation} NMSE(\mathbf{x},\hat{\mathbf{x}})= \frac{\| \mathbf{x}-\hat{\mathbf{x}}\|_2^2}{\| \mathbf{x}\|_2^2} . \end{equation} \subsection{Quantitative and Qualitative Comparisons at different trajectories in radio mask} We evaluate the performance of well-trained Meta-learning and conventional learning. Table \ref{results_same_ratio_t1}, \ref{results_same_ratio_t2} and \ref{results_same_ratio_t2_cts} report the quantitative results of averaged numerical performance with standard deviations and associated descaled task specific meta-knowledge $ \sigma(\omega_i)$. From the experiments that implemented with radio masks, we observe that the average PSNR value of Meta-learning has improved 1.54 dB in T1 brain image among all the four CS ratios comparing to conventional method, and for T2 brain image, Meta-learning improved 1.46 dB in PSNR. Since the general setting of Meta-learning aims to take advantage of the information provided from each individual task, each task associate with an individual sampling mask that may have complemented sampled points, the performance of the reconstruction from each task benefits from other tasks. Smaller CS ratios will inhibit the reconstruction accuracy, due to the sparse undersampled trajectory in raw measurement, while Meta-learning exhibits the favorable potential ability to solve this issue even in the situation of insufficient amount of training data. In general supervised learning, training data need to be in the same or similar distribution, heterogeneous data exhibits different structure variations of features which hinders CNNs to extract features efficiently. In our experiments, raw measurements sampled from different ratios of compressed sensing display different levels of incompleteness, these undersampled measurements do not fall in the same distribution but they are related. Different sampling masks are shown at the bottom of Figure \ref{figure_same_ratio_t1} and \ref{figure_dif_ratio_t1} may have complemented sampled points, in the sense that some of the points which $40\%$ sampling ratio mask does not sample have been captured by other masks. In our experiment, different sampling masks provide their own information from their sampled points so that four reconstruction tasks help each other to achieve an efficient performance. Therefore, it explains the reason that Meta-learning is still superior to conventional learning when the sampling ratio is large. Meta-learning expands a new paradigm for supervised learning, the purpose is to quickly learn multiple tasks. Meta-learning only needs to learn task-invariant parameters one time for the common feature that can be shared with four different tasks, and each $ \sigma(\omega_i)$ provides the task-specific weighting parameters which give the guidance as "learning to learn". Comparing to conventional learning, which needs to be trained four times with four different masks since the task-invariant parameter cannot be generalized to other tasks, which is time-intensive. From Table \ref{results_same_ratio_t1} and \ref{results_same_ratio_t2}, we observe that small CS ratio needs higher value of $\sigma(\omega_i) $. In fact, in our model \eqref{model} the task-specific parameters behave as weighted constraints for task-specific regularizers, and the tables indicate that lower CS ratios require larger weights to apply on the regularization. Qualitative comparison between conventional and Meta-learning methods are shown in Figure \ref{figure_same_ratio_t1} and \ref{figure_same_ratio_t2}, which display the reconstructed MR images of the same slice for T1 and T2 respectively, we label the zoomed-in details of HGG in the red boxes. We observe the evidence that conventional learning is more blurry and lost sharp edges, especially in lower CS ratios. From the point-wise error map, we find meta-learning has the ability to reduce noises especially in some detailed and complicated regions comparing to conventional learning. \subsection{Quantitative and Qualitative Comparisons at skewed trajectories in different sampling patterns} In this section, we test the generalizability of the proposed model that tests on unseen tasks. We fix the well-trained task-invariant parameter $\theta$ and only train $\omega_i$ for sampling ratios 15\%, 25\% and 35\% with radio masks and sampling ratios 10\%, 20\%, 30\% and 40\% with Cartesian masks. In this experiment, we only used 100 training data for each CS ratio and apply a total of 50 epochs. The averaged evaluation values and standard deviations are listed in Table \ref{results_dif_ratio_t1} and \ref{results_dif_ratio_t2} for reconstructed T1 and T2 brain images respectively that proceed with radio masks, and Table \ref{results_same_ratio_t2_cts} shows the qualitative performance for reconstructed T2 brain image that applied random Cartesian sampling masks. In T1 image reconstruction results, meta-learning improved 1.6921 dB in PSNR for 15\% CS ratio, 1.6608 dB for 25\% CS ratio, and 0.5764 dB for 35\% comparing to the conventional method, which in the tendency that the level of reconstruction quality for lower CS ratios improved more than higher CS ratios. A similar trend happens in T2 reconstruction results with different sampling masks. The qualitative comparisons are illustrated in Figure \ref{figure_dif_ratio_t1}, \ref{figure_dif_ratio_t2} and \ref{figure_same_ratio_t2_cts} for T1 and T2 images tested in skewed CS ratios in radio masks, and T2 images tested in Cartesian masks with regular CS ratios respectively. % In the experiments that conducted with radio masks, meta-learning is superior to conventional learning especially at CS ratio 15\%, one can observe that the detailed region in red boxes keeps edges and is more close to the true image, while conventional method reconstructions are hazier and lost details in some complicated tissue. The point-wise error map also indicates that Meta-learning has the ability to suppress noises. Training with Cartesian masks is more difficult than radio masks, especially for conventional learning where the network is not very deep since the network only applied three convolutions each with four kernels. Table \ref{results_same_ratio_t2_cts} indicates that the average performance of meta-learning improved about 1.87 dB comparing to conventional methods with T2 brain images. These results further demonstrate that meta-learning has the benefit of parameter efficiency, the performance is much better than conventional learning even if we apply a shallow network with small size of training data. The numeric experimental results discussed above intimates that Meta-learning is capable of fast adaption to new tasks and has more robust generalizability for a broad range of tasks with heterogeneous diverse data. Meta-learning can be considered as an efficient technique for solving difficult tasks by leveraging the features extracted from easier tasks. \begin{specialtable}[htb] \caption{ Quantitative evaluations of the reconstructions on T1 brain image associated with various sampling ratios of \textbf{radial} masks. \label{results_same_ratio_t1}} \addtolength{\tabcolsep}{-2pt} \begin{tabular}{cccccc} \toprule \textbf{CS Ratio} & \textbf{Methods} & \textbf{PSNR} & \textbf{SSIM} & \textbf{NMSE} & $ \sigma(\omega_i)$\\ \midrule 10\% & Conventional & 21.7570 $\pm$ 1.0677 & 0.5550 $\pm$ 0.0412 & 0.0259 $\pm$ 0.0082 & \\ & Meta-learning & 23.2672 $\pm$ 1.1229 & 0.6101 $\pm$ 0.0436 & 0.0184 $\pm$ 0.0067 & 0.9218\\ \midrule 20\% & Conventional & 26.6202 $\pm$ 1.1662 & 0.6821 $\pm$ 0.0397 & 0.0910 $\pm$ 0.0169 & \\ & Meta-learning & 28.2944 $\pm$ 1.2119 & 0.7640 $\pm$ 0.0377 & 0.0058 $\pm$ 0.0022 & 0.7756\\ \midrule 30\% & Conventional & 29.5034 $\pm$ 1.4446 & 0.7557 $\pm$ 0.0408 & 0.0657 $\pm$ 0.0143 & \\ & Meta-learning & 31.1417 $\pm$ 1.5866 & 0.8363 $\pm$ 0.0385 & 0.0031 $\pm$ 0.0014 & 0.6501\\ \midrule 40\% & Conventional & 31.4672 $\pm$ 1.6390 & 0.8111 $\pm$ 0.0422 & 0.0029 $\pm$ 0.0014 & \\ & Meta-learning & 32.8238 $\pm$ 1.7039 & 0.8659 $\pm$ 0.0370 & 0.0022 $\pm$ 0.0010 & 0.6447\\ \bottomrule \end{tabular} \end{specialtable} \begin{specialtable}[htb] \caption{Quantitative evaluations of the reconstructions on T1 brain image associated with various sampling ratios of \textbf{radial} masks. Meta-learning was trained with CS ratio 10\%, 20\%, 30\% and 40\% and test with skewed ratios 15\%, 25\% and 35\%. Conventional method performed regular training and testing on same CS ratios 15\%, 25\% and 35\%. \label{results_dif_ratio_t1}} \addtolength{\tabcolsep}{-2pt} \begin{tabular}{cccccc} \toprule \textbf{CS Ratio} & \textbf{Metods} & \textbf{PSNR} & \textbf{SSIM} & \textbf{NMSE} & $ \sigma(\omega_i)$ \\ \midrule 15\% & Conventional & 24.6573 $\pm$ 1.0244 & 0.6339 $\pm$ 0.0382 & 0.1136 $\pm$ 0.0186 &\\ & Meta-learning & 26.3494 $\pm$ 1.0102 & 0.7088 $\pm$ 0.0352 & 0.0090 $\pm$ 0.0030 & 0.9429\\ \midrule 25\% & Conventional & 28.4156 $\pm$ 1.2361 & 0.7533 $\pm$ 0.0368 & 0.0741 $\pm$ 0.0141 & \\ & Meta-learning & 30.0764 $\pm$ 1.4645 & 0.8135 $\pm$ 0.0380 & 0.0040 $\pm$ 0.0017 & 0.8482\\ \midrule 35\% & Conventional & 31.5320 $\pm$ 1.5242 & 0.7923 $\pm$ 0.0420 & 0.0521 $\pm$ 0.0119 &\\ & Meta-learning & 32.1084 $\pm$ 1.6481 & 0.8553 $\pm$ 0.0379 & 0.0025 $\pm$ 0.0011 & 0.6552\\ \bottomrule \end{tabular} \end{specialtable} \begin{specialtable}[H] \caption{Quantitative evaluations of the reconstructions on T2 brain image associated with various sampling ratios of \textbf{radial} masks. \label{results_same_ratio_t2}} \addtolength{\tabcolsep}{-2pt} \begin{tabular}{cccccc} \toprule \textbf{CS Ratio} & \textbf{Metods} & \textbf{PSNR} & \textbf{SSIM} & \textbf{NMSE} & $ \sigma(\omega_i)$\\ \midrule 10\% & Conventional & 23.0706 $\pm$ 1.2469 & 0.5963 $\pm$ 0.0349 & 0.2158 $\pm$ 0.0347 &\\ & Meta-learning & 24.0842 $\pm$ 1.3863 & 0.6187 $\pm$ 0.0380 & 0.0112 $\pm$ 0.0117 & 0.9013 \\ \midrule 20\% & Conventional & 27.0437 $\pm$ 1.0613 & 0.6867 $\pm$ 0.0261 & 0.1364 $\pm$ 0.0213 & \\ & Meta-learning & 28.9118 $\pm$ 1.0717 & 0.7843 $\pm$ 0.0240 & 0.0122 $\pm$ 0.0030 & 0.8742\\ \midrule 30\% & Conventional & 29.5533 $\pm$ 1.0927 & 0.7565 $\pm$ 0.0265 & 0.1023 $\pm$ 0.0166 & \\ & Meta-learning & 31.4096 $\pm$ 0.9814 & 0.8488 $\pm$ 0.0217 & 0.0069 $\pm$ 0.0019 & 0.8029\\ \midrule 40\% & Conventional & 32.0153 $\pm$ 0.9402 & 0.8139 $\pm$ 0.0238 & 0.0770 $\pm$ 0.0128 & \\ & Meta-learning & 33.1114 $\pm$ 1.0189 & 0.8802 $\pm$ 0.0210 & 0.0047 $\pm$ 0.0015 & 0.7151\\ \bottomrule \end{tabular} \end{specialtable} \begin{specialtable}[H] \caption{Quantitative evaluations of the reconstructions on T2 brain image associated with various sampling ratios of \textbf{radial} masks. Meta-learning was trained with CS ratio 10\%, 20\%, 30\% and 40\% and test with 15\%, 25\% and 35\%. Conventional method performed regular training and testing on same CS ratios 15\%, 25\% and 35\%. \label{results_dif_ratio_t2}} \addtolength{\tabcolsep}{-2pt} \begin{tabular}{cccccc} \toprule \textbf{CS Ratio} & \textbf{Metods} & \textbf{PSNR} & \textbf{SSIM} & \textbf{NMSE} & $ \sigma(\omega_i)$ \\ \midrule 15\% & Conventional & 24.8921 $\pm$ 1.2356 & 0.6259 $\pm$ 0.0285 & 0.1749 $\pm$ 0.0280 & \\ & Meta-learning & 26.7031 $\pm$ 1.2553 & 0.7104 $\pm$ 0.0318 & 0.0205 $\pm$ 0.0052 & 0.9532\\ \midrule 25\% & Conventional & 29.0545 $\pm$ 1.1980 & 0.7945 $\pm$ 0.0292 & 0.1083 $\pm$ 0.0173 & \\ & Meta-learning & 30.0698 $\pm$ 0.9969 & 0.8164 $\pm$ 0.0235 & 0.0093 $\pm$ 0.0022 & 0.8595\\ \midrule 35\% & Conventional & 31.5201 $\pm$ 1.0021 & 0.7978 $\pm$ 0.0236 & 0.0815 $\pm$ 0.0129 & \\ & Meta-learning & 32.0683 $\pm$ 0.9204 & 0.8615 $\pm$ 0.0209 & 0.0059 $\pm$ 0.0014 & 0.7388\\ \bottomrule \end{tabular} \end{specialtable} \begin{specialtable}[H] \caption{Quantitative evaluations of the reconstructions on T2 brain image associated with various sampling ratios of random \textbf{Cartesian} masks. \label{results_same_ratio_t2_cts}} \addtolength{\tabcolsep}{-2pt} \begin{tabular}{cccccc} \toprule \textbf{CS Ratio} & \textbf{Metods} & \textbf{PSNR} & \textbf{SSIM} & \textbf{NMSE} & $ \sigma(\omega_i)$\\ \midrule 10\% & Conventional & 20.8867 $\pm$ 1.2999 & 0.5082 $\pm$ 0.0475 & 0.0796 $\pm$ 0.0242 &\\ & Meta-learning & 22.0434 $\pm$ 1.3555 & 0.6279 $\pm$ 0.0444 & 0.0611 $\pm$ 0.0188 & 0.9361 \\ \midrule 20\% & Conventional & 22.7954 $\pm$ 1.2819 & 0.6057 $\pm$ 0.0412 & 0.0513 $\pm$ 0.0157 & \\ & Meta-learning & 24.7162 $\pm$ 1.3919 & 0.6971 $\pm$ 0.0380 & 0.0329 $\pm$ 0.0101 & 0.8320\\ \midrule 30\% & Conventional & 24.2170 $\pm$ 1.2396 & 0.6537 $\pm$ 0.0360 & 0.0371 $\pm$ 0.0117 & \\ & Meta-learning & 26.4537 $\pm$ 1.3471 & 0.7353 $\pm$ 0.0340 & 0.0221 $\pm$ 0.0068 & 0.6771\\ \midrule 40\% & Conventional & 25.3668 $\pm$ 1.3279 & 0.6991 $\pm$ 0.0288 & 0.1657 $\pm$ 0.0265 & \\ & Meta-learning & 27.5367 $\pm$ 1.4107 & 0.7726 $\pm$ 0.0297 & 0.0171 $\pm$ 0.0050 & 0.6498\\ \bottomrule \end{tabular} \end{specialtable} \begin{figure}[H] \centering \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_result.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_10_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_20_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_30_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_40_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/target_t1.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_result.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_10_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_20_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_30_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_40_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_10_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_20_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_30_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_40_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_true_t1.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_10_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_20_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_30_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_40_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_error.pdf} \includegraphics[width=0.18\linewidth]{fig/error_10_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/error_20_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/error_30_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/error_40_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/colorbar.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_error.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_10_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_20_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_30_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_40_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/masks.pdf} \includegraphics[width=0.18\linewidth]{fig/mask10_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask20_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask30_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask40_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf} \caption{The pictures (from top to bottom) display the reconstruction results, zoomed in details, pointwise errors with colorbar and associated \textbf{radio} masks for meta-learning and conventional learning with four different CS ratios 10\%, 20\%, 30\%, 40\%(from left to right). The most top right one is ground truth fully-sampled image. } \label{figure_same_ratio_t1} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_result.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_15_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_25_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_35_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/target_t1_31.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_result.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_15_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_25_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_35_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_15_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_25_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_35_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_true_t1_31.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_15_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_25_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_35_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_error.pdf} \includegraphics[width=0.18\linewidth]{fig/error_15_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/error_25_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/error_35_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/colorbar.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_error.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_15_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_25_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_35_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/masks.pdf} \includegraphics[width=0.18\linewidth]{fig/mask15_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask25_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask35_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf} \caption{The pictures (from top to bottom) display the T1 Brain image reconstruction results, zoomed in details, pointwise errors with colorbar and associated \textbf{radio} masks for meta-learning and conventional learning. Meta-learning was trained with CS ratios 10\%, 20\%, 30\% 40\% and test with three different CS ratios 15\%, 25\% and 35\%(from left to right). Conventional learning was trained and test with same CS ratios 15\%, 25\% and 35\%. The most top right one is ground truth fully-sampled image.} \label{figure_dif_ratio_t1} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_result.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_10_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_20_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_30_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_40_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/target_t2.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_result.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_10_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_20_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_30_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_40_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_10_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_20_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_30_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_40_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_true_t2.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_10_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_20_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_30_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_40_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_error.pdf} \includegraphics[width=0.18\linewidth]{fig/error_10_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/error_20_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/error_30_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/error_40_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/colorbar.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_error.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_10_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_20_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_30_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_40_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/masks.pdf} \includegraphics[width=0.18\linewidth]{fig/mask10_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask20_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask30_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask40_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf} \caption{The pictures (from top to bottom) display the T2 Brain image reconstruction results, zoomed in details, pointwise errors with colorbar and associated \textbf{radio} masks for both these two compared methods with four different CS ratios 10\%, 20\%, 30\%, 40\%(from left to right). The most top right one is ground truth fully-sampled image. } \label{figure_same_ratio_t2} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_result.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_15_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_25_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_35_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/target_t2_31.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_result.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_15_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_25_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_35_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_15_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_25_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_35_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_true_t2_31.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_15_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_25_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_35_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_error.pdf} \includegraphics[width=0.18\linewidth]{fig/error_15_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/error_25_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/error_35_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/colorbar.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_error.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_15_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_25_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_35_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/masks.pdf} \includegraphics[width=0.18\linewidth]{fig/mask15_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask25_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask35_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf} \caption{The pictures (from top to bottom) display the T2 Brain image reconstruction results, zoomed in details, pointwise errors with colorbar and associated \textbf{radio} masks for meta-learning and conventional learning. Meta-learning was trained with CS ratios 10\%, 20\%, 30\% 40\% and test with three different CS ratios 15\%, 25\% and 35\%(from left to right). Conventional learning was trained and test with same CS ratios 15\%, 25\% and 35\%. The most top right one is ground truth fully-sampled image. } \label{figure_dif_ratio_t2} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_result.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_10_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_20_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_30_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_40_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/target_t2_cts.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_result.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_10_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_20_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_30_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_40_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_10_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_20_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_30_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_40_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_true_t2_cts.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_10_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_20_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_30_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_40_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_error.pdf} \includegraphics[width=0.18\linewidth]{fig/error_10_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/error_20_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/error_30_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/error_40_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/colorbar_cts.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_error.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_10_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_20_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_30_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_40_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/masks.pdf} \includegraphics[width=0.18\linewidth]{fig/mask10_cartesian.pdf} \includegraphics[width=0.18\linewidth]{fig/mask20_cartesian.pdf} \includegraphics[width=0.18\linewidth]{fig/mask30_cartesian.pdf} \includegraphics[width=0.18\linewidth]{fig/mask40_cartesian.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf} \caption{The pictures (from top to bottom) display the T2 Brain image reconstruction results, zoomed in details, pointwise errors with colorbar and associated \textbf{Cartesian} masks for both these two compared methods with four different CS ratios 10\%, 20\%, 30\%, 40\%(from left to right). The most top right one is ground truth fully-sampled image. } \label{figure_same_ratio_t2_cts} \end{figure} \iffalse \begin{figure}[H] \centering \includegraphics[width=0.32\linewidth]{fig/meta_feature.pdf} \includegraphics[width=0.32\linewidth]{fig/adam_feature.pdf} \includegraphics[width=0.32\linewidth]{fig/true_feature.pdf} \caption{Features (from left to right) of meta-learning and conventional learning, the last image is the original reference image.} \label{feature} \end{figure} \fi \subsection{Future work and open challenges} Deep optimization-based meta-learning techniques have shown great generalizability but there are several open challenges that can be discussed and can potentially be addressed in future work. A major issue is the memorization problem since the base learner needs to be optimized for a large number of phases and the training algorithm contains multiple gradient steps, computation cost is very expensive in terms of time and memory costs. In addition to reconstruct MRI through different trajectories, another potential application for medical imaging could be multi-modality reconstruction and synthesis. Capturing images of anatomy with multi-modality acquisitions enhances the diagnostic information, and could be cast as a multi-task problem and benefit from meta-learning. \section{Conclusions}\label{conclusion} In this paper, we put forward a novel deep model for MRI reconstructions via meta-learning. The proposed method has the ability to solve multi-tasks synergistically and the well-trained model could generalize well to new tasks. Our baseline network is constructed by unfolds an LOA, which inherits convergence property, improves the interpretability, and promotes parameter efficiency of the designed network structure. The designated adaptive regularizer consists task-invariant learner and a task-specific meta-knowledge. Network training follows a bilevel optimization algorithm that minimizes task-specific parameter $\omega$ in the upper level on validation data and minimizes task-invariant parameters $\theta$ on training data with fixed $\omega$. The proposed approach is the first model for solving the inverse problem by applying meta-training on the adaptive regularization in the variational model. We consider recovering undersampled raw data across different sampling trajectories with various sampling patterns as different tasks. Extensive numerical experiments on various MRI datasets demonstrate that the proposed method generalizes well at various sampling trajectories and is capable of fast adaption to the unseen trajectories and sampling patterns. The reconstructed images achieve higher quality comparing to conventional supervised learning for both seen and unseen k-space trajectory cases. \section{Introduction} Deep learning models and algorithms are often built for specific tasks and the samples (usually) follow a certain distribution. Specifically, the source-domain/training samples and target-domain/testing samples are drawn from the same distribution. However, these data sets are often collected at different sources and exhibit substantial heterogeneity, and thus the samples may follow closely related but different distributions in real-world applications. Therefore, robust and efficient training of deep neural networks using such data sets is theoretically important and practically relevant in deep learning research. Meta-learning provides an unique paradigm to overcome this challenge \cite{munkhdalai2017meta, finn2017model,li2018learning, rusu2018meta, yao2021improving, balaji2018metareg}. Meta-learning is known as \emph{learning-to-learn} which aims to gain the capability of quickly learning unseen tasks from the experience of learning episodes that covers the distribution of relevant tasks. In a multiple-task scenario, given a family of tasks, meta-learning has been proven as a useful tool for extracting task-agnostic knowledge and improve the learning performance of new tasks from that family \cite{thrun1998learning, hospedales2021meta}. Most of the modern approaches of meta-learning are focus on \emph{domain adaptation}, where the target domain information is available in meta-training, but this setting is still too ideal to apply in practice. Recently the study on \emph{domain generalization (DG)} has attracted much attention. DG allows the training model to learn representations from several related source domains and gain adequate generalization ability for unseen test distributions. However, DG techniques for image reconstruction are rarely explored in solving inverse problems. Leveraging large-scale heterogeneous MRI data to overcome inflated prediction performance caused by small-scale clinic datasets is of great interest for more precise, predictable, and powerful health care. For the sack of reducing scan time and improve diagnostic accuracy of MRI, the data are often acquired by using different under-sampling patterns (e.g., Cartesian mask, Radial mask, Poisson mask), under-sampling ratios, and different settings of the parameters resulting in different contrast (e.g., T1-weighted, T2-weighted, proton-density (PD), and Flair). Hence the public data are heterogeneous. This work aims at developing a generalizable MRI reconstruction method in the meta-learning framework that can leverage large-scale heterogeneous datasets to reconstruct MR images with the available small-scale dataset from specific setting of the scan. In this work, we propose a meta-learning-based model for solving the MRI image reconstructions problem by leveraging diverse/heterogeneous dataset. Data acquisition in compressed sensing MRI (CS-MRI) with k-space (Fourier space) undersampling can be formulated as follows \begin{equation}\label{MRI} \mathbf{y} = \mathbf{P} \mathcal{F} \mathbf{x} + \mathbf{n}, \end{equation} where $ \mathbf{y} \in \mathbb{C}^p$ is the measured k-space data with total of $p$ sampled data points, $ \mathbf{x} \in \mathbb{C}^{N\times 1}$ is unknown MR image with $N$ pixels to be reconstructed, $ \mathcal{F} \in \mathbb{C}^{N \times N}$ is the 2D discrete Fourier transform (DFT) matrix, and $ \mathbf{P} \in \mathbb{R}^{p \times N}$ $(p< N)$ is the binary matrix representing the sampling mask in k-space. Reconstruction of $\mathbf{x}$ from (noisy) undersampled data $\mathbf{y}$ is an ill-posed problem. An effective strategy to elevate the ill-posedness issue is to incorporate prior information by adding a regularization term. In light of the substantial success of deep learning and the massive amount of training data available nowadays, we propose to learn the regularization term and then solve $\mathbf{x}$ from the following unconstrained optimization problem \begin{equation}\label{csmodel} \bar{\mathbf{x}} = \argmin_{\mathbf{x}} \frac{1}{2} \| \mathbf{P} \mathcal{F} \mathbf{x} - \mathbf{y} \|^2 + R(\mathbf{x}; \Theta), \end{equation} where $\|\cdot\|$ is the standard 2-norm of vectors, the first term in the objective function in \eqref{csmodel} is data fidelity term that ensures consistency between the reconstructed $ \mathbf{x}$ and the measured data $\mathbf{y}$, and the second term $ R(\mathbf{x}; \Theta)$ is the regularization term that introduces prior knowledge to the image to be reconstructed and represented by a convolutional neural network (CNN) with parameters $\Theta$ that learned from training data. We will discuss in details how this regularization is formed in Sections \ref{sec:Method} and \ref{sec:Implementation}. In this paper, we first introduce a nonconvex and nonsmooth learnable optimization algorithm (LOA) with rigorous convergence guarantees. Then we construct a deep reconstruction network by following the LOA exactly. This approach is inspired by the work \cite{chen2020learnable}, but the LOA developed in this work is different from the one in \cite{chen2020learnable}. Furthermore, we propose a novel MRI reconstruction model \eqref{our_model} with a regularization term for multi-task adaptation, which consists of a task-invariant regularization and a task-specific hyperparameter. The former extracts common prior information of images from different tasks, which learns task-invariant parameters $\theta$. The latter exploits the proper task-specific parameters (also called meta-knowledge) $\omega_i$ for each individual task $i$. The purpose is to increase the generalization ability of the learned regularization, so that the trained LOA-induced deep reconstruction network can perform well on both seen and unseen tasks. To train the network we split the training data into two parts: training and validation, and introduce a bilevel optimization model for learning network parameters. The lower-level optimization learns the task-invariant parameters $\theta$ of the feature encoder with fixed task-specific parameters $\omega_i$ on the training dataset, and the upper-level optimizes the task-specific parameters on the validation dataset. The well-trained network of seen tasks can be applied to the unseen tasks with determined $\theta$. This adaptation only needs a few iterations to update $\omega_i$ with a small number of training samples of unseen tasks. As demonstrated by our numerical experiments in Section \ref{experiments}, our proposed framework yields much improved image qualities using diverse data sets of various undersampling trajectories and ratios for MRI image reconstruction. The underpinning theory is that an effective regularization can integrate common feature and prior information from a variety of training samples from diverse data sets, but they need to be properly weighted in the reconstruction of the image under specific sample distribution (i.e., undersampling trajectory and ratios). % Our contributions can be summarized as follows: \begin{enumerate}[leftmargin=*] \item LOA inspired network architecture. Our network architecture exactly follows a proposed LOA of guaranteed convergence. So the network is interpretable, parameter-efficient, stable, and generates high-quality reconstructions after proper training. \item Design of Regularization. Unlike the existing meta-learning methods, the proposed approach of network training can learn adaptive regularizer from diverse data sets. Our adaptive regularizer consists of the task-invariant portion and the task-specific portion. The task-invariant portion aims at exploiting the common features and shared information across all involved tasks, whereas the task-specific parameters only learn the regularization weight to properly balance the data fidelity and learned regularization in individual tasks. \item A novel bilevel network training algorithm for improving generalizability. We utilize train data and validation data for training the designed network, which follows a bilevel optimization algorithm that is trained from a heterogeneous dataset. The lower-level determines the optimal task-invariant parameters for any fixed task-specific parameters, and the upper-level optimizes the task-specific parameters on validation data so that the task-invariant parameter can be adapted to different tasks. \item Better generalization and faster adaption. On reconstructing the under-sampled MRIs with various scanning trajectories, the network after meta-training can be directly applied to reconstruct the images sampled on multiple seen trajectories and can achieve quick adaption to the new unseen trajectories sampling patterns. \end{enumerate} The remainder of the paper is organized as follows. In Section \ref{related_work}, we introduce some related work for both optimization-based meta-learning and deep unrolled networks for MRI reconstructions. We sketch our meta-learning model and the neural network in Section \ref{sec:Method} and describe the implementation details in Section \ref{sec:Implementation}. Section \ref{experiments} introduces the reconstruction results. Section \ref{conclusion} concludes the paper. \section{Related work}\label{related_work} Meta-learning methods have in recent years yielded impressive results in various fields with different techniques, and plays a different roles in different communities, it has a very broad definition and perspective in the literature \cite{hospedales2021meta}. Several survey papers \cite{ hospedales2021meta, huisman2021survey} have a detailed introduction of this development. Three categories of meta-learning techniques are commonly grouped \cite{yao2020automated, lee2018gradient, huisman2021survey} as metric-based methods \cite{koch2015siamese, vinyals2016matching, snell2017prototypical}, model-based methods \cite{mishra2017simple, ravi2016optimization, qiao2018few, graves2014neural}, and optimization-based methods \cite{finn2017model, rajeswaran2019meta, li2017meta}, which are often cast as a bi-level optimization problem and exhibits relatively better generalizability on wider task distributions. We mainly focus on optimization-based meta-learning in this paper. \subsection{ Optimization-based approaches}\label{l2l} In the context of optimization-based meta-learning, a popular strategy is gradient descent based inner optimization \cite{finn2017model,antoniou2018train,rajeswaran2019meta,li2017meta,nichol2018first,finn2019online,grant2018recasting,finn2018probabilistic,yoon2018bayesian}. The optimization problem is often cast as a bilevel learning, where the outer level (upper/leader level) optimization is solved subject to the optimality of inner level (lower/follower level) optimization so that the optimized model can generalize well on the new data. The inner level encounters new tasks and tries to learn the associated features quickly from the training observations, the outer level accumulates task-specific meta-knowledge across previous tasks and the meta-learner provides support for the inner level so that it can quickly adapt to new tasks. e.g. the Model-Agnostic Meta-Learning (MAML) \cite{finn2017model} aims at searching for an adaptive initialization of the network parameters for new tasks with only a few steps that updates in the inner level. In recent years, a large number of followup works of MAML proposed to improve generalization using similar strategy \cite{lee2018gradient, rusu2018meta, finn2018probabilistic, grant2018recasting, nichol2018first, vuorio2019multimodal, yao2019hierarchically,yin2020metalearning}. Deep bilevel learning \cite{jenni2018deep} seeks to obtain better generalization that trained on one task and generalize well on another task. Their model is to optimize a regularized loss function to find network parameters from training set and identify hyperparameters so that the network performs well on validation dataset. When the unseen tasks lie in inconsistent domains with the meta-training tasks, as revealed in \cite{chen19closerfewshot}, the generalization behavior of the meta-learner will be compromised. This phenomenon partially arises from the meta-overfitting on the already seen meta-training tasks, which is identified as memorization problem in \cite{yin2020metalearning}. A meta-regularizer forked with information theory is proposed in \cite{yin2020metalearning} to handle the memorization problem by regulating the information dependency during the task adaption. MetaReg \cite{balaji2018metareg} decouples the entire network into the feature network and task network, where the meta-regularization term is only applied to the task network. They first update the parameters of the task network with meta-train set to get the domain-aligned task network, then update the parameters of meta-regularization term on meta-test set to learn the cross-domain generalization. Different from MetaReg, Feature-Critic Networks \cite{li2019feature} exploits the meta-regularization term to pursue a domain-invariant feature extraction network. The meta-regularization is designed as a feature-critic network that takes the extracted feature as input. The parameters of the feature extraction network are updated by minimizing the new meta-regularized loss. The auxiliary parameters in the feature-critic network are learned by maximizing the performance gain over the non-meta case. To effectively evaluate the performance of the meta-learner, several new benchmarks \cite{Rebuffi17,48798,yu2020meta} were developed under more realistic settings operate well on diverse visual domains. As mentioned in \cite{48798}, the generalization to unseen tasks within multimodal or heterogeneous datasets remains as a challenge to the existing meta-learning methods. The aforementioned methods pursue domain generalization for the classification networks that learned regularization function to learn cross-domain generalization. Our proposed method is aiming for solving the inverse problem and we construct an adaptive regularization that not only learns the universal parameters among tasks, but also the task-aware parameters. The designated adaptive regularizer assists the generalization ability of the deep model so that the well-trained model could be able to perform well on a heterogeneous datasets of both seen or unseen tasks. \subsection{MRI reconstruction models and algorithms} MRI reconstruction is generally formulated as a variation model in the format of \eqref{csmodel}, which is a data fidelity term plus a regularization term. Traditional methods employ handcrafted regularization terms such as total variation (TV), and the solution algorithm follows a theoretical justification. However, it is hard to tune the associated parameter (often require hundreds even thousands of iterations to converge) to capture subtle details and satisfy clinic diagnostic quality. Deep learning based model leverages large dataset and further explore the potential improvement of reconstruction performance comparing to traditional methods and has successful applications in clinic field \cite{lundervold2019overview, liang2020deep, sandino2020compressed, mccann2017convolutional, zhou2020review, singha2021deep, chandra2021deep, ahishakiye2021survey}. However, training generic deep neural networks (DNNs) may prone to over-fitting when data is scarce as we mentioned in the beginning. Also, the deep network structure behaves like a black box without mathematical interpretation. To improve the interpretability of the relation between the topology of the deep model and reconstruction results, a new emerging class of deep learning-based methods is known as \emph{learnable optimization algorithms} (LOA) attracts attention in the literature \cite{liu2020deep, liang2020deep}. LOA was proposed to map existing optimization algorithms to structured networks where each phase of the networks correspond to one iteration of an optimization algorithm or replace some ingredients such as proximal operator \cite{cheng2019model,bian2020deep}, matrix transformations \cite{yang2018admm, hammernik2018learning, zhang2018ista}, non-linear operators \cite{yang2018admm, hammernik2018learning}, and denoiser/regularizer \cite{aggarwal2018modl, schlemper2017deep} etc., by CNNs to avoid difficulty for solving non-smooth non-convex problems. Different from the current LOA approach for image reconstruction that simply imitates the algorithm iterations without any convergence justification or just replaces some hardly solvable components with sub-networks, our proposed LOA-induced network inherits the convergence property of the proposed Algorithm \ref{alg:lda}, where we provide convergence analysis in Appendix \ref{convergence}. The proposed network retains the interpretability of the variational model, parameter efficiency and contributes to better generalization. \section{Proposed Method}\label{sec:Method} \subsection{LOA-induced reconstruction network} \label{network} Our deep algorithmic unrolling reconstruction network represented as $F_{\Theta}$ where $\Theta$ denotes the set of all learnable parameters in the model. Motivated by the variational model, for an input partial k-space data $\mathbf{y}$ in $\mathcal{D}_{\tau_i}$, we desire the network output $F_{\Theta}(\mathbf{y})$ to be an optimizer of the following minimization problem as \eqref{model}. We use "$\approx$" since in practice we only do finite-step optimization algorithm to approximate the optimizer \begin{equation}\label{model} F_{\Theta}(\mathbf{y}) \approx \argmin_{\mathbf{x}} \big\{ \phi_{\Theta}(\mathbf{x}, \mathbf{y}) := f(\mathbf{x}, \mathbf{y}) + R(\mathbf{x}; \Theta) \big\}, \end{equation} where $f$ is the data fidelity term that usually takes the form $f(\mathbf{x}, \mathbf{y}) = \frac{1}{2} \| \mathbf{P} \mathcal{F} \mathbf{x} - \mathbf{y} \|^2$ in standard MRI setting, where $\mathcal{F}$ and $\mathbf{P}$ represent the Fourier transform and the binary under-sampling mask for k-space trajectory respectively. However, we remark that our approach can be directly applied to a much broader class of image reconstruction problems as long as $f$ is continuously differentiable with Lipschitz continuous gradient. In this section, we introduce a learned optimization algorithm (LOA) for solving \eqref{model}, where the network parameters $\Theta$ are learned and fixed. Since $\Theta$ are fixed in \eqref{model}, we will omit them in the derivation of the LOA below and write $R(\mathbf{x}; \Theta)$ as $R(\mathbf{x})$ for notation simplicity. Then we generate a multi-phase network induced by the proposed LOA, i.e. the network architecture follows the algorithm exactly such that one phase of the network is just one iteration of the LOA. In our implementation, to incorporate sparsity along with the learned features, we parameterize the function $R (\mathbf{x})= \kappa \cdot r(\mathbf{x})$, where $\kappa>0$ is a weight parameter that needs be chosen properly depending on the specific task (e.g., noise level, undersampling ratio, etc.), and $r$ is a regularizer parameterized as a (composition of) neural networks and can be adapted to a broad range of imaging applications. In this work, we parameterize $r$ as the composition of the $l_{2,1}$ norm and a learnable feature extraction operator $\mathbf{g}_j(\mathbf{x})$. That is, we set $r$ in \eqref{model} to be \begin{equation}\label{eq:r} r(\mathbf{x}) := \|\mathbf{g}_j(\mathbf{x})\|_{2,1} = \sum_{j = 1}^{m} \|\mathbf{g}_{j}(\mathbf{x})\|. \end{equation} Here $\mathbf{g}_j(\cdot)=\mathbf{g}_j(\cdot;\theta)$ is parametrized as a convolutional neural network (CNN) where $\theta$ is the learned and fixed network parameter in $r(\cdot;\theta)$ as mentioned above. We also consider $\kappa$ to be learned and fixed as $\theta$ for now, and will discuss how to learn both of them in the next subsection. We use smooth activation function in $\mathbf{g}$ formulate in \eqref{eq:sigma} which renders $\mathbf{g}$ a smooth but nonconvex function. Due to the nonsmooth $\|\cdot\|_{2,1}$, $r$ is therefore a nonsmooth nonconvex function. Since the minimization problem in \eqref{model} is nonconvex and nonsmooth, we need to derive an efficient LOA to solve it. This solver will be termed as $F_{\Theta}(\mathbf{y})$. Here we first consider smoothing the $ l_{2,1}$ norm that for any fixed $\mathbf{g}(\mathbf{x})$: \begin{equation}\label{eq:l21} r_{\varepsilon} (\mathbf{x}) = \sum\nolimits^m_{j=1} \sqrt{\| \mathbf{g}_{j} (\mathbf{x}) \|^2 + \varepsilon^2} -\varepsilon. \end{equation} We denote $R_{\varepsilon} = \kappa \cdot r_{\varepsilon}$. The LOA derived here is inspired by the proximal gradient descent algorithm and iterates the following steps to solve the smoothed problem: \begin{subequations}\label{prox} \begin{align} \mathbf{z}_{t+1} & = \mathbf{x}_{t} - \alpha_t \nabla f(\mathbf{x}_{t}) \label{prox_u}\\ \mathbf{x}_{t+1} & = \prox_{\alpha_t R_{\varepsilon_{t}} } (\mathbf{z}_{t+1} ), \label{prox_sub} \end{align} \end{subequations} where $\varepsilon_{t}$ denotes the smoothing parameter $\varepsilon$ at the specific iteration $t$, and proximal operator is defined as $ \prox_{\alpha g}(\mathbf{b}) := \argmin_{\mathbf{x}} \left\| \mathbf{x}-\mathbf{b} \right\| + \alpha g(\mathbf{x})$ in \eqref{prox_sub}. A quick observation from \eqref{eq:l21} is that $R_{\varepsilon} \rightarrow R$ as $\varepsilon$ diminishes, so later we will intentionally push $\varepsilon_{t} \rightarrow 0$ at Line 16 in Algorithm \ref{alg:lda}. Then one can readily show that $ R_{\varepsilon}(x) \le R(x) \le R_{\varepsilon}(x) + \varepsilon$ for all $x$ and $\varepsilon > 0$. From Algorithm \ref{alg:lda}, line 16 will automatically reduce $\varepsilon$ and the iterates will converge to the solution of the original nonsmooth nonconvex problem \eqref{model}, a rigorous sense will be made precisely in the convergence analysis in Appendix \ref{convergence}. Since $R_{\varepsilon_{t}}$ is a complex function involving a deep neural network, its proximal operator does not have close-form and cannot be computed easily in the subproblem in \eqref{prox_sub}. To overcome this difficulty, we consider to approximate $R_{\varepsilon_{t}}$ by \begin{subequations} \begin{align} \hat{R}_{\varepsilon_{t}} (\mathbf{z}_{t+1}) & = R_{\varepsilon_{t}}(\mathbf{z}_{t+1}) + \nonumber \langle \nabla R_{\varepsilon_{t}}(\mathbf{z}_{t+1}), \mathbf{x}-\mathbf{z}_{t+1} \rangle + \frac{1}{\beta_t} \norm{\mathbf{x}-\mathbf{z}_{t+1}}^2. \label{eq:u} \end{align} \end{subequations} Then we update $ \mathbf{u}_{t+1} = \prox_{\alpha_t \hat{R}_{\varepsilon_{t}} } (\mathbf{z}_{t+1} )$ to replace \eqref{prox_sub}, therefore we obtain \begin{equation}\label{ut+1} \mathbf{u}_{t+1} = \mathbf{z}_{t+1} - \tau_t \nabla R_{\varepsilon_{t}}(\mathbf{z}_{t+1}), \text{ where } \tau_t = \frac{\alpha_t \beta_t}{\alpha_t + \beta_t}. \end{equation} In order to guarantee the convergence of the algorithm, we introduce the standard gradient descent of $\phi_{\varepsilon_{t}} $ (where $\phi_{\varepsilon_{t}} := f + R_{\varepsilon_{t}}$) at $ \mathbf{x}$: \begin{equation}\label{grad_dst} \mathbf{v}_{t+1} = \argmin_{\mathbf{x}} \langle \nabla f(\mathbf{x}_{t}), \mathbf{x} - \mathbf{x}_{t} \rangle + \langle \nabla R_{\varepsilon}(\mathbf{x}_{t}) , \mathbf{x} - \mathbf{x}_{t} \rangle + \frac{1}{2 \alpha_t} \| \mathbf{x} - \mathbf{x}_{t} \|^2, \end{equation} which yields \begin{equation}\label{vt+1} \mathbf{v}_{t+1} =\mathbf{x}_{t} - \alpha_t \nabla \phi_{\varepsilon_{t}}(\mathbf{x}_{t}) , \end{equation} to serve as a safeguard for the convergence. Specifically, we set $\mathbf{x}_{t+1} = \mathbf{u}_{t+1}$ if $\phi_{\varepsilon_{t}}(\mathbf{u}_{t+1}) \le \phi_{\varepsilon_{t}}(\mathbf{v}_{t+1})$; otherwise we set $\mathbf{x}_{t+1} = \mathbf{v}_{t+1}$. Then we repeat this process. Our algorithm is summarized in Algorithm \ref{alg:lda}. The prior term with unknown parameters has the exact residual update itself which makes the training process more fluent \cite{he2016deep}. The condition checking in Line 5 is introduced to make sure that it is in the energy descending direction. Once the condition in Line 5 fails, it comes to $\mathbf{v}_{t+1}$ and the line search in Line 12 guarantees the appropriate step size can be achieved within finite steps to make the function value decrease. From Line 3 to Line 14, we can regard that it solves a problem of minimizing $\phi_{\varepsilon_t}$ with $\varepsilon_{t}$ fixed. Line 15 is to update the value of $\varepsilon_{t}$ depending on a reduction criterion. The detailed analysis of this mechanism and in-depth convergence justification is shown in Appendix \ref{convergence}. The corresponding unrolling network exactly follows the Algorithm \ref{alg:lda}, thus shares the same convergence property. Compared to LDA \cite{chen2020learnable} computes both candidates $\mathbf{u}_{t+1}$, $\mathbf{v}_{t+1}$ at every iteration and then chooses the one that achieves a smaller function value, we propose the criteria above in Line 5 for updating $\mathbf{x}_{t+1}$, which potentially saves extra computational time for calculating the candidate $\mathbf{v}_{t+1}$ and potentially mitigates the frequent alternations between the two candidates. Besides, the smoothing method proposed in this work is more straightforward than smoothing in dual space \cite{chen2020learnable} whereas still keeping provable convergence as shown in Theorem \ref{theorem a6}. The proposed LOA-induced network is a multi-phase network whose architecture exactly follows the proposed LOA \ref{alg:lda} in the way that each phase corresponding to one iteration of the algorithm with shared parameters. These unknown parameters are trained by the method in the next section. \begin{algorithm}[t] \caption{Algorithmic Unrolling Method with Provable Convergence} \label{alg:lda} \begin{algorithmic}[1] \STATE \textbf{Input:} Initial $\mathbf{x}_0$, $0<\rho, \gamma<1$, and $\varepsilon_0$, $a, \sigma >0$. Max total phases $T$ or tolerance $\epsilon_{\mathrm{tol}}>0$. \FOR{$t=0,1,2,\dots,T-1$} \STATE $\mathbf{z}_{t+1} = \mathbf{x}_{t} - \alpha_{t} \nabla f(\mathbf{x}_{t})$ \STATE $\mathbf{u}_{t+1} = \mathbf{z}_{t+1} - \tau_t \nabla R_{\varepsilon_{t}} (\mathbf{z}_{t+1})$, \IF{ $\| \nabla \phi_{\varepsilon_{t}} (\mathbf{x}_{t}) \| \leq a \| \mathbf{u}_{t+1} - \mathbf{x}_{t} \| \ \mbox{and} \ \phi_{\varepsilon_{t}}(\mathbf{u}_{t+1}) - \phi_{\varepsilon_{t}}(\mathbf{x}_{t}) \leq - \frac{1}{a}\| \mathbf{u}_{t+1} - \mathbf{x}_{t} \|^2 $ holds} \STATE set $\mathbf{x}_{t+1} = \mathbf{u}_{t+1}$, \ELSE \STATE $\mathbf{v}_{t+1} = \mathbf{x}_{t} - \alpha_{t} \nabla \phi_{\varepsilon_{t}}(\mathbf{x}_{t})$, \label{marker} \IF{ $ \phi_{\varepsilon_{t}}(\mathbf{v}_{t+1}) - \phi_{\varepsilon_{t}}(\mathbf{x}_{t}) \le - \frac{1}{a} \| \mathbf{v}_{t+1} - \mathbf{x}_{t}\|^2$ holds} \STATE set $\mathbf{x}_{t+1} = \mathbf{v}_{t+1}$, \ELSE \STATE update $\alpha_{t} \leftarrow \rho \alpha_{t}$, then \textbf{go to}~\ref{marker}, \ENDIF \ENDIF \STATE \textbf{if} $\|\nabla \phi_{\varepsilon_{t}}(\mathbf{x}_{t+1})\| < \sigma \gamma {\varepsilon_{t}}$, set $\varepsilon_{t+1}= \gamma {\varepsilon_{t}}$; \textbf{otherwise}, set $\varepsilon_{t+1}={\varepsilon_{t}}$. \STATE \textbf{if} $\sigma {\varepsilon_{t}} < \epsilon_{\mathrm{tol}}$, terminate. \ENDFOR \STATE \textbf{Output:} $\mathbf{x}_T$. \end{algorithmic} \end{algorithm} \subsection{Bilevel optimization algorithm for network training} In this section, we consider the parameter training problem of the LOA-induced network. Specifically, we develop a bilevel optimization algorithm for training our network parameters $ \Theta$ from diverse data sets. As shown in Section \ref{network}, we design $R (\mathbf{x};\Theta)= \kappa \cdot r(\mathbf{x};\Theta)$, where $r$ is going to be learned to capture the intrinsic property of the underlying common features across all different tasks. To account for the large variations in the diverse training/validation data sets, we introduce a task-specific parameter $\omega_i$ to approximate the proper $\kappa$ for the $i$th task. Specifically, for the $i$th task, the weight $\kappa$ is set to $\sigma(\omega_i) \in (0, 1)$, where $\sigma(\cdot)$ is the sigmoid function. Therefore, $\kappa = \sigma(\omega_i)$ finds the proper weight of $r$ for the $i$-th task according to its specific sampling ratio or pattern. The parameters $\omega_i$ are to be optimized in conjunction with $\Theta$ through the hyperparameter tuning process below. Suppose that we are given $\mathcal{M}$ data pairs $\{(\mathbf{y}_m, \hat{\mathbf{x}}_m) \}_{m = 1} ^{\mathcal{M}}$ for the use of training and validation where $\mathbf{y}_m$ is the observation, which is partial k-space data in our setting, and $\hat{\mathbf{x}}_m$ is the corresponding ground truth image. The data pairs are then sampled into $\mathcal{N}$ tasks $\{ \mathcal{D}_{\tau_i} \}_{i = 1} ^ {\mathcal{N}}$, where each $\mathcal{D}_{\tau_i}$ represents the collection of data pairs in the specific task $\tau_i$. In each task $\tau_i$, we further divide the data into the task-specific training set $\mathcal{D}^{tr}_{\tau_i}$ and validation set $\mathcal{D}^{val}_{\tau_i}$. Architecture of our base network exactly follows the LOA \ref{alg:lda} developed in previous section with learnable parameters $\theta$ and a task-specific parameter $\omega_i$ for the $i$th task. More precisely, for one data sample denoted by $(\mathbf{y}^{(i)}_{j},\hat{\mathbf{x}}^{(i)}_{j})$ in task $\tau_i$ with index $j$, we propose the algorithmic unrolling network for task $\tau_i$ as \begin{equation}\label{our_model} F_{\theta,\omega_i}(\mathbf{y}^{(i)}_{j}) \approx \argmin_{\mathbf{x}} f(\mathbf{x}, \mathbf{y}^{(i)}_{j}) + \sigma(\omega_i) r(\mathbf{x};\theta), \end{equation} $\theta$ denotes the learnable common parameters across different tasks with task-invariant representation whereas $\omega_i$ is a task-specific parameter for task $\tau_i$. Here $\omega_i \in \mathbb{R}$ and $\sigma$ is the sigmoid function such that $\sigma(\omega_i) \in (0,1)$. The weight $\sigma(\omega_i)$ represents the weight of $r$ associated with the specific task $\tau_i$. We denote $\omega$ to be the set $\{\omega_i\} _ {i = 1} ^ {\mathcal{N}}$. The detailed architecture of this network is illustrated in Section \ref{network}. We define the task-specific loss \begin{equation}\label{loss_sum} \ell_{\tau_i}(\theta, \omega_i ; \mathcal{D}_{\tau_i}) = \sum _ {j=1}^{ |\mathcal{D}_{\tau_i}|} \ell \big( F_{\theta,\omega_i}(\mathbf{y}^{(i)}_{j}), \hat{\mathbf{x}}^{(i)}_{j} \big), \end{equation} where $|\mathcal{D}_{\tau_i}|$ represents the cardinality of $\mathcal{D}_{\tau_i}$ and \begin{equation}\label{loss} \ell \big( F_{\theta,\omega_i}(\mathbf{y}^{(i)}_{j}), \hat{\mathbf{x}}^{(i)}_{j} \big) := \frac{1}{2} \|F_{\theta,\omega_i}(\mathbf{y}^{(i)}_{j}) - \hat{\mathbf{x}}^{(i)}_{j}\|^2. \end{equation} For the sake of preventing the proposed model from overfitting the training data, we introduce a novel learning framework by formulating the network training as a bilevel optimization problem to learn $\omega$ and $\theta $ in \eqref{our_model} as \begin{subequations} \label{eq:bi-level} \begin{align} \min_{ \theta, \ \omega = \omega_{i \in 1:\mathcal{N}}} \quad & \sum^{\mathcal{N}}_{i=1} \ell _{\tau_i}( \theta (\omega) , \omega_i ; \mathcal{D}^{val}_{\tau_i}) \\ \mbox{s.t.}\quad \quad & \theta(\omega) = \argmin_{\theta} \sum^{\mathcal{N}}_{i=1} \ell_{\tau_i} ( \theta , \omega_i ; \mathcal{D}^{tr}_{\tau_i}). \end{align} \end{subequations} In \eqref{eq:bi-level}, the lower-level optimization learns the task-invariant parameters $\theta$ of the feature encoder with fixed task-specific parameter $\omega_i$ on the training dataset, and the upper-level adjusts the task-specific parameters $\{\omega_i\}$ so that the task-invariant parameters $\theta$ can perform robustly on validation dataset as well. For simplicity, we omit the summation and redefine $\mathcal{L}(\theta, \omega ; \mathcal{D}) := \sum^{\mathcal{N}}_{i=1}\ell _{\tau_i}(\theta, \omega ; \mathcal{D})$, then briefly rewrite \eqref{eq:bi-level} as \begin{equation} \min_{ \theta, \omega} \mathcal{L}( \theta(\omega), \omega ; \mathcal{D}^{val}) \ \ \ \ \ \mbox{s.t.} \ \ \theta(\omega) = \argmin_{\theta}\mathcal{L}( \theta, \omega ; \mathcal{D}^{tr}). \label{simplified bi-level} \end{equation} Then we relax \eqref{simplified bi-level} into a single-level constrained optimization where the lower-level problem is replaced with its first-order necessary condition following \cite{mehra2019penalty}: \begin{equation} \min_{ \theta, \omega} \mathcal{L}( \theta, \omega ; \mathcal{D}^{val}) \ \ \ \ \ \mbox{s.t.} \ \ \nabla_{\theta} \mathcal{L}( \theta, \omega ; \mathcal{D}^{tr}) = 0. \label{simplified bi-level-1} \end{equation} which can be further approximated by an unconstrained problem by a penalty term as \begin{equation} \min_{ \theta, \omega} \big\{ \widetilde{\mathcal{L}}( \theta, \omega ; \mathcal{D}^{tr}, \mathcal{D}^{val}) := \mathcal{L}( \theta, \omega ; \mathcal{D}^{val}) + \frac{\lambda}{2} \| \nabla_{\theta} \mathcal{L}( \theta, \omega ; \mathcal{D}^{tr}) \|^2 \big\}. \label{simplified bi-level-2} \end{equation} We adopt the stochastic gradients of the loss functions on mini-batch data sets in each iteration. In our model, we need to include the data pairs of multiple tasks in one batch, therefore we propose the cross-task mini-batches when training. At each training iteration, we randomly sample the training data pairs $\mathcal{B}^{tr}_{\tau_i} = \{(\mathbf{y}^{(i)}_{j}, \hat{\mathbf{x}}^{(i)}_{j}) \in \mathcal{D}^{tr}_{\tau_i} \}_{j = 1}^{\mathcal{J}^{tr}}$ and the validation pairs $\mathcal{B}^{val}_{\tau_i} = \{(\mathbf{y}^{(i)}_{j}, \hat{\mathbf{x}}^{(i)}_{j}) \in \mathcal{D}^{val}_{\tau_i} \}_{j = 1}^{\mathcal{J}^{val}}$ on each task $\tau_i$. Then the overall training and validation mini-batchs $\mathcal{B}^{tr}$ and $\mathcal{B}^{val}$ used in every training iteration is composed of the sampled data pairs from the entire set of tasks, i.e. $\mathcal{B}^{tr} = \bigcup_{i = 1}^{\mathcal{N}} \{\mathcal{B}^{tr}_{\tau_i}\}$ and $\mathcal{B}^{val} = \bigcup_{i = 1}^{\mathcal{N}} \{\mathcal{B}^{val}_{\tau_i}\}$. Thus in each iteration, we have $\mathcal{N} \cdot \mathcal{J}^{tr}$ and $\mathcal{N} \cdot \mathcal{J}^{val}$ data pairs used for training and validation respectively. To solve the minimization problem \eqref{simplified bi-level-2}, we utilize the stochastic mini-batch alternating direction method summarized in Algorithm \ref{penelty_method} which is modified from \cite{mehra2019penalty}. In Algorithm \ref{penelty_method}, the parameter $\delta_{tol}$ is to control the accuracy, the algorithm will terminate when $\delta \le \delta_{tol}$. In addition, $\lambda$ is the weight for the second constraint term of \eqref{simplified bi-level-2}, in the beginning, we set $\lambda$ to be small so as to achieve a quick starting convergence then gradually increase its value to emphasize the constraint. \begin{algorithm} \caption{Stochastic mini-batch alternating direction penalty method}\label{alg:model} \begin{algorithmic}[1] \STATE \textbf{Initialize} $ \theta$, $ {\omega}$, $\delta$, $\lambda$ and $\nu_\delta \in(0, 1)$, \ $\nu_\lambda > 1$. \WHILE{$\delta > \delta_{tol}$} \STATE Sample cross-task training batch $\mathcal{B}^{tr} = \bigcup_{i = 1}^{\mathcal{N}} \{(\mathbf{y}^{(i)}_{j}, \hat{\mathbf{x}}^{(i)}_{j}) \in \mathcal{D}^{tr}_{\tau_i} \}_{j = 1 : \mathcal{J}^{tr}}$ \STATE Sample cross-task validation batch $\mathcal{B}^{val} = \bigcup_{i = 1}^{\mathcal{N}} \{(\mathbf{y}^{(i)}_{j}, \hat{\mathbf{x}}^{(i)}_{j}) \in \mathcal{D}^{val}_{\tau_i} \}_{j = 1 : \mathcal{J}^{val}}$ \WHILE{$\|\nabla_{\theta}\widetilde{\mathcal{L}}( \theta, \omega ; \mathcal{B}^{tr}, \mathcal{B}^{val})\|^2 + \| \nabla_{\omega}\widetilde{\mathcal{L}}( \theta, \omega ; \mathcal{B}^{tr}, \mathcal{B}^{val})\| ^2 > \delta$} \FOR{$k=1,2,\dots,K$ (inner loop)} \STATE $ \theta \leftarrow \theta - \rho_{\theta}^k \nabla_{\theta}\widetilde{\mathcal{L}}( \theta, \omega ; \mathcal{B}^{tr}, \mathcal{B}^{val})$ \ENDFOR \STATE $ \omega \leftarrow \omega - \rho_{\omega} \nabla_{\omega}\widetilde{\mathcal{L}}( \theta, \omega ; \mathcal{B}^{tr}, \mathcal{B}^{val})$ \ENDWHILE \STATE \textbf{update} $\delta \leftarrow \nu_\delta \delta$, $\ \lambda \leftarrow \nu_\lambda \lambda$ \ENDWHILE \STATE \textbf{output:} $\theta, {\omega}$. \end{algorithmic} \label{penelty_method} \end{algorithm} \section{Implementation} \label{sec:Implementation} \subsection{Feature extraction operator} We set the feature extraction operator $\mathbf{g}$ to a vanilla $l$-layer CNN with the componentwise nonlinear activation function $\varphi$ and no bias, as follows: \begin{equation}\label{eq:g} \mathbf{g}(x) = \mathbf{w}_l * \varphi \cdots \ \varphi ( \mathbf{w}_3 * \varphi ( \mathbf{w} _2 * \varphi ( \mathbf{w} _1 * x ))), \end{equation} where $\{\mathbf{w} _q \}_{q = 1}^{l}$ denote the convolution weights consisting of $d$ kernels with identical spatial kernel size, and $*$ denotes the convolution operation. Here $\varphi$ is constructed to be the smoothed rectified linear unit as defined below \begin{equation}\label{eq:sigma} \varphi (x) = \begin{cases} 0, & \mbox{if} \ x \leq -\delta, \\ \frac{1}{4\delta} x^2 + \frac{1}{2} x + \frac{\delta}{4}, & \mbox{if} \ -\delta < x < \delta, \\ x, & \mbox{if} \ x \geq \delta, \end{cases} \end{equation} where the prefixed parameter $\delta$ is set to be $0.001$ in our experiment. The default configuration of the feature extraction operator is set as follows: the feature extraction operator $\mathbf{g}$ consists of $l=3$ convolution layers and all convolutions are with $4$ kernels of spatial size $3 \times 3$. \subsection{Setups} \label{Task-specific network pre-training} As our method introduces an algorithmic unrolling network, there exists a one-to-one correspondence between the algorithm iterations and the neural network phases (or blocks). Each phase of the forward propagation can be viewed as one algorithm iteration, which motivates us to imitate the iterating of the optimization algorithm and use a stair training strategy \cite{chen2020learnable}. At the first stage, we start training the network parameters using 1 phase, then after the the loss converges, we add more phases (1 phase each time) then continue the training process. We repeat this procedure and stop it until the loss does not decrease any more when we add more blocks. We minimize the loss for $100$ epochs/iterations each time using the SGD-based optimizer Adam \cite{kingma2014adam} with $\beta_1 = 0.9$, $\beta_2 = 0.999$ and initial learning rate set to $10^{-3}$ as well as the mini-batch size $8$. The Xavier Initializer \cite{Glorot10understandingthe} is used to initialize the weights of all convolutions. The initial smoothing parameter $\varepsilon_0$ is set to be $0.001$ then learned together with other network parameters. The input $\mathbf{x}_0$ of the unrolling network is obtained by Zero-filling strategy\cite{bernstein2001effect}. The deep unrolling network was implemented using the Tensorflow toolbox \cite{tensorflow2015-whitepaper} in Python programming language. Our code will be publicly shared depending on acceptance. \section{Numerical Experiments}\label{experiments} \subsection{Dataset} To validate the performance of the proposed method, the data we used are from Multimodal Brain Tumor Segmentation Challenge 2018 \cite{menze2014multimodal}, in which the training dataset contains four modalities ($T1, T1_{c}, T2$ and $FLAIR$) scanned from 285 patients, and the validation dataset contains images from 66 patients, each with volume size $ 240 \times 240 \times 155$. Each modality consists of two types of gliomas: 75 volumes of low-grade gliomas (LGG) and 210 volumes of high-grade gliomas (HGG). Our implementation interested in HGG MRI in two modalities: T1 and T2 images, and we choose 30 patients from each modality in the training dataset for training our network. In the validation dataset, we randomly picked 15 patients as our validation data, and 6 patients in the training dataset as testing data which are are distinct from our training set and validation set. We cropped the 2D image size to be $ 160 \times 180$ in the center region and picked adjacent $10$ slices in the center of each volume, which results in a total of $300$ images as our training data, $150$ images in our validation data, and a total of $60$ images as testing data. The number of data mentioned here is the amount of a single task, but since we employ multi-tasks training, the total number of images in each dataset should multiply the number of tasks. For each 2D slice, we normalize the spatial intensity by dividing the maximum pixel value. \subsection{Experiment settings and Comparison results} All the experiments are implemented on a Windows workstation with Intel Core i9 CPU at 3.3GHz and an Nvidia GTX-1080Ti GPU with 11GB of graphics card memory via TensorFlow \cite{abadi2016tensorflow}. The parameters in the proposed network are initialized by using Xavier initialization \cite{glorot2010understanding}. We trained the meta-learning network with four tasks synergistically associated with four different CS ratios: 10\%, 20\%, 30\%, and 40\%, and test the well-trained model on the testing dataset with the same masks of these four ratios. We have 300 training data for each CS ratio, which amount to total of 1200 images in the training dataset. The results for $T1$ and $T2$ MR reconstructions are shown in Tables \ref{results_same_ratio_t1} and \ref{results_same_ratio_t2} respectively. The associated reconstructed images are displayed in Figures \ref{figure_same_ratio_t1} and \ref{figure_same_ratio_t2}. We also test the well-trained meta-learning model on unseen tasks with radio masks for skewed ratios: 15\%, 25\%, 35\%, and random Cartesian masks with ratios 10\%, 20\%, 30\% and 40\%. The task-specific parameter for the unseen tasks are retrained for different masks with different sampling ratios individually with fixed task-invariant parameters $\theta$. In this experiments, we only need to learn $ \omega_i$ for three skewed CS ratios with radio mask and four regular CS ratios with Cartesian masks. The experimental training proceed on less data and iterations, where we performed on 100 MR images with 50 epochs. For example, for reconstructing MR images with CS ratio 15\% radio mask, we fix the parameter $\theta$ and retrain the task-specific parameter $\omega$ on 100 raw data with 50 epochs, then test with renewed $\omega$ on our testing data set with raw measurement that sampled from radio mask with CS ratio 15\%. The results associated with radio masks are shown in Table \ref{results_dif_ratio_t1} and \ref{results_dif_ratio_t2}, Figure \ref{figure_dif_ratio_t1} and \ref{figure_dif_ratio_t2} for $T1$ and $T2$ images respectively. The results associated with Cartesian masks are list in Table \ref{results_same_ratio_t2_cts} and reconstructed images are displayed in Figure \ref{figure_same_ratio_t2_cts}. We compared proposed meta-learning method with conventional supervised learning, which was trained with one task at each time, and only learns task-invariant parameter $\theta$ without task-specific parameter $ \omega_i$. The forward network of conventional learning unrolls Algorithm \ref{alg:lda} with 11 phases which is the same as meta-learning. We merged training set and validation set which result in $450$ images for training the conventional supervised learning. The training batch size was set as 25 and applied total of 2000 epochs, while in meta-learning we applied 100 epochs with batch size 8. Same testing set was used in both meta-learning and conventional learning to evaluate the performance these two methods. We made comparisons between meta-learning and the conventional network on these seven different CS ratios (10\%, 20\%, 30\%, 40\%, 15\%, 25\%, and 35\%) in terms of two types of random under-sampling patterns: radio mask and Cartesian mask. The parameters for both meta-learning and conventional learning networks are trained via Adam optimizer \cite{kingma2014adam}, and they both learn the forward unrolled task-invariant parameter $\theta$. Network training of conventional method uses the same network configuration as meta-learning network in terms of the number of convolutions, depth and size of CNN kernels, phase numbers and parameter initializer, etc. The major difference in the training process between these two methods is that meta-learning is proceed on multi-tasks by leveraging task-specific parameter $\omega_i$ that learned from Algorithm \ref{alg:model} and the common feature among tasks are learned from the feed forward network that unrolls Algorithm \ref{alg:lda}, while conventional learning solve for task specific problem by simply unrolls forward network via Algorithm \ref{alg:lda} where both training and testing are implemented on the same task. To investigate the generalizability of meta-learning, we test the well-trained meta-learning model on MR images in different distributions in terms of two types of sampling masks with various trajectories. Training and testing of conventional learning are applied with the same CS ratios, that is, if the conventional method trained on CS ratio 10\% then will be tested on a dataset with CS ratio 10\%, etc. Because of the nature of MR images are represented as complex-value, we applied complex convolutions \cite{WANG2020136} for each CNN, that is, every kernel consists real part and imaginary part. Total of 11 phases are achieved if we set the termination condition $\epsilon_{\mathrm{tol}} = 1\times 10^{-5}$ and the parameters of each phase are shared except for the step sizes. Three convolutions are used in $\mathbf{g}$, each convolution contains 4 filters with spatial kernel size $ 3\times3$. We set $\nu_\delta =0.95 $ and the parameter $\delta$ in Algorithm \ref{alg:model} was initialized as $\delta_0 =1 \times 10^{-3}$ stopped at value $\delta_{tol} = 4.35 \times 10 ^ {-6}$, and we set total of 100 epochs. For training conventional method we set 2000 epochs with same number of phase, convolutions and kernel sizes as meta-learning. Initial $\lambda$ was set as $1 \times 10^{-5} $ and $ \nu_\lambda = 1.001$. We evaluate our reconstruction results on testing data sets using three metrics: PSNR, structural similarity (SSIM) \cite{wang2004image} and normalized mean squared error NMSE. The following formulations compute the PSNR, SSIM and NMSE between reconstructed image $ \mathbf{x}$ and ground truth $\hat{\mathbf{x}}$. \begin{equation} PSNR = 20\log_{10} \big( \max(\abs{\hat{\mathbf{x}}}) \big/ \frac{1}{N}\| \hat{\mathbf{x}} - \mathbf{x} \|^2 \big), \end{equation} where $N$ is the total number of pixels of ground truth. \begin{equation} SSIM = \frac{(2\mu_{\mathbf{x}} \mu_{\hat{\mathbf{x}}} + C_1)(2\sigma_{\mathbf{x} \hat{\mathbf{x}}} + C_2)}{(\mu_{\mathbf{x}}^2 + \mu_{\hat{\mathbf{x}}}^2+C_1)( \sigma_{\mathbf{x}}^2 + \sigma_{\hat{\mathbf{x}}}^2 + C_2)}, \end{equation} where $\mu_{\mathbf{x}}, \mu_{\hat{\mathbf{x}}}$ represent local means, $\sigma_{\mathbf{x}}, \sigma_{\hat{\mathbf{x}}}$ denote standard deviations and $\sigma_{\mathbf{x} \hat{\mathbf{x}}} $ covariance between $\mathbf{x}$ and $\hat{\mathbf{x}} $, $ C_1 = (k_1 L)^2, C_2 = (k_2 L)^2$ are two constants which avoid zero denominator, and $ k_1 =0.01, k_2 =0.03$. $L$ is the largest pixel value of MR image. \begin{equation} NMSE(\mathbf{x},\hat{\mathbf{x}})= \frac{\| \mathbf{x}-\hat{\mathbf{x}}\|_2^2}{\| \mathbf{x}\|_2^2} . \end{equation} \subsection{Quantitative and Qualitative Comparisons at different trajectories in radio mask} We evaluate the performance of well-trained Meta-learning and conventional learning. Table \ref{results_same_ratio_t1}, \ref{results_same_ratio_t2} and \ref{results_same_ratio_t2_cts} report the quantitative results of averaged numerical performance with standard deviations and associated descaled task specific meta-knowledge $ \sigma(\omega_i)$. From the experiments that implemented with radio masks, we observe that the average PSNR value of Meta-learning has improved 1.54 dB in T1 brain image among all the four CS ratios comparing to conventional method, and for T2 brain image, Meta-learning improved 1.46 dB in PSNR. Since the general setting of Meta-learning aims to take advantage of the information provided from each individual task, each task associate with an individual sampling mask that may have complemented sampled points, the performance of the reconstruction from each task benefits from other tasks. Smaller CS ratios will inhibit the reconstruction accuracy, due to the sparse undersampled trajectory in raw measurement, while Meta-learning exhibits the favorable potential ability to solve this issue even in the situation of insufficient amount of training data. In general supervised learning, training data need to be in the same or similar distribution, heterogeneous data exhibits different structure variations of features which hinders CNNs to extract features efficiently. In our experiments, raw measurements sampled from different ratios of compressed sensing display different levels of incompleteness, these undersampled measurements do not fall in the same distribution but they are related. Different sampling masks are shown at the bottom of Figure \ref{figure_same_ratio_t1} and \ref{figure_dif_ratio_t1} may have complemented sampled points, in the sense that some of the points which $40\%$ sampling ratio mask does not sample have been captured by other masks. In our experiment, different sampling masks provide their own information from their sampled points so that four reconstruction tasks help each other to achieve an efficient performance. Therefore, it explains the reason that Meta-learning is still superior to conventional learning when the sampling ratio is large. Meta-learning expands a new paradigm for supervised learning, the purpose is to quickly learn multiple tasks. Meta-learning only needs to learn task-invariant parameters one time for the common feature that can be shared with four different tasks, and each $ \sigma(\omega_i)$ provides the task-specific weighting parameters which give the guidance as "learning to learn". Comparing to conventional learning, which needs to be trained four times with four different masks since the task-invariant parameter cannot be generalized to other tasks, which is time-intensive. From Table \ref{results_same_ratio_t1} and \ref{results_same_ratio_t2}, we observe that small CS ratio needs higher value of $\sigma(\omega_i) $. In fact, in our model \eqref{model} the task-specific parameters behave as weighted constraints for task-specific regularizers, and the tables indicate that lower CS ratios require larger weights to apply on the regularization. Qualitative comparison between conventional and Meta-learning methods are shown in Figure \ref{figure_same_ratio_t1} and \ref{figure_same_ratio_t2}, which display the reconstructed MR images of the same slice for T1 and T2 respectively, we label the zoomed-in details of HGG in the red boxes. We observe the evidence that conventional learning is more blurry and lost sharp edges, especially in lower CS ratios. From the point-wise error map, we find meta-learning has the ability to reduce noises especially in some detailed and complicated regions comparing to conventional learning. \subsection{Quantitative and Qualitative Comparisons at skewed trajectories in different sampling patterns} In this section, we test the generalizability of the proposed model that tests on unseen tasks. We fix the well-trained task-invariant parameter $\theta$ and only train $\omega_i$ for sampling ratios 15\%, 25\% and 35\% with radio masks and sampling ratios 10\%, 20\%, 30\% and 40\% with Cartesian masks. In this experiment, we only used 100 training data for each CS ratio and apply a total of 50 epochs. The averaged evaluation values and standard deviations are listed in Table \ref{results_dif_ratio_t1} and \ref{results_dif_ratio_t2} for reconstructed T1 and T2 brain images respectively that proceed with radio masks, and Table \ref{results_same_ratio_t2_cts} shows the qualitative performance for reconstructed T2 brain image that applied random Cartesian sampling masks. In T1 image reconstruction results, meta-learning improved 1.6921 dB in PSNR for 15\% CS ratio, 1.6608 dB for 25\% CS ratio, and 0.5764 dB for 35\% comparing to the conventional method, which in the tendency that the level of reconstruction quality for lower CS ratios improved more than higher CS ratios. A similar trend happens in T2 reconstruction results with different sampling masks. The qualitative comparisons are illustrated in Figure \ref{figure_dif_ratio_t1}, \ref{figure_dif_ratio_t2} and \ref{figure_same_ratio_t2_cts} for T1 and T2 images tested in skewed CS ratios in radio masks, and T2 images tested in Cartesian masks with regular CS ratios respectively. In the experiments that conducted with radio masks, meta-learning is superior to conventional learning especially at CS ratio 15\%, one can observe that the detailed region in red boxes keeps edges and is more close to the true image, while conventional method reconstructions are hazier and lost details in some complicated tissue. The point-wise error map also indicates that Meta-learning has the ability to suppress noises. Training with Cartesian masks is more difficult than radio masks, especially for conventional learning where the network is not very deep since the network only applied three convolutions each with four kernels. Table \ref{results_same_ratio_t2_cts} indicates that the average performance of meta-learning improved about 1.87 dB comparing to conventional methods with T2 brain images. These results further demonstrate that meta-learning has the benefit of parameter efficiency, the performance is much better than conventional learning even if we apply a shallow network with small size of training data. The numeric experimental results discussed above intimates that Meta-learning is capable of fast adaption to new tasks and has more robust generalizability for a broad range of tasks with heterogeneous diverse data. Meta-learning can be considered as an efficient technique for solving difficult tasks by leveraging the features extracted from easier tasks. \begin{specialtable}[htb] \caption{ Quantitative evaluations of the reconstructions on T1 brain image associated with various sampling ratios of \textbf{radial} masks. \label{results_same_ratio_t1}} \addtolength{\tabcolsep}{-2pt} \begin{tabular}{cccccc} \toprule \textbf{CS Ratio} & \textbf{Methods} & \textbf{PSNR} & \textbf{SSIM} & \textbf{NMSE} & $ \sigma(\omega_i)$\\ \midrule 10\% & Conventional & 21.7570 $\pm$ 1.0677 & 0.5550 $\pm$ 0.0412 & 0.0259 $\pm$ 0.0082 & \\ & Meta-learning & 23.2672 $\pm$ 1.1229 & 0.6101 $\pm$ 0.0436 & 0.0184 $\pm$ 0.0067 & 0.9218\\ \midrule 20\% & Conventional & 26.6202 $\pm$ 1.1662 & 0.6821 $\pm$ 0.0397 & 0.0910 $\pm$ 0.0169 & \\ & Meta-learning & 28.2944 $\pm$ 1.2119 & 0.7640 $\pm$ 0.0377 & 0.0058 $\pm$ 0.0022 & 0.7756\\ \midrule 30\% & Conventional & 29.5034 $\pm$ 1.4446 & 0.7557 $\pm$ 0.0408 & 0.0657 $\pm$ 0.0143 & \\ & Meta-learning & 31.1417 $\pm$ 1.5866 & 0.8363 $\pm$ 0.0385 & 0.0031 $\pm$ 0.0014 & 0.6501\\ \midrule 40\% & Conventional & 31.4672 $\pm$ 1.6390 & 0.8111 $\pm$ 0.0422 & 0.0029 $\pm$ 0.0014 & \\ & Meta-learning & 32.8238 $\pm$ 1.7039 & 0.8659 $\pm$ 0.0370 & 0.0022 $\pm$ 0.0010 & 0.6447\\ \bottomrule \end{tabular} \end{specialtable} \begin{specialtable}[htb] \caption{Quantitative evaluations of the reconstructions on T1 brain image associated with various sampling ratios of \textbf{radial} masks. Meta-learning was trained with CS ratio 10\%, 20\%, 30\% and 40\% and test with skewed ratios 15\%, 25\% and 35\%. Conventional method performed regular training and testing on same CS ratios 15\%, 25\% and 35\%. \label{results_dif_ratio_t1}} \addtolength{\tabcolsep}{-2pt} \begin{tabular}{cccccc} \toprule \textbf{CS Ratio} & \textbf{Metods} & \textbf{PSNR} & \textbf{SSIM} & \textbf{NMSE} & $ \sigma(\omega_i)$ \\ \midrule 15\% & Conventional & 24.6573 $\pm$ 1.0244 & 0.6339 $\pm$ 0.0382 & 0.1136 $\pm$ 0.0186 &\\ & Meta-learning & 26.3494 $\pm$ 1.0102 & 0.7088 $\pm$ 0.0352 & 0.0090 $\pm$ 0.0030 & 0.9429\\ \midrule 25\% & Conventional & 28.4156 $\pm$ 1.2361 & 0.7533 $\pm$ 0.0368 & 0.0741 $\pm$ 0.0141 & \\ & Meta-learning & 30.0764 $\pm$ 1.4645 & 0.8135 $\pm$ 0.0380 & 0.0040 $\pm$ 0.0017 & 0.8482\\ \midrule 35\% & Conventional & 31.5320 $\pm$ 1.5242 & 0.7923 $\pm$ 0.0420 & 0.0521 $\pm$ 0.0119 &\\ & Meta-learning & 32.1084 $\pm$ 1.6481 & 0.8553 $\pm$ 0.0379 & 0.0025 $\pm$ 0.0011 & 0.6552\\ \bottomrule \end{tabular} \end{specialtable} \begin{specialtable}[H] \caption{Quantitative evaluations of the reconstructions on T2 brain image associated with various sampling ratios of \textbf{radial} masks. \label{results_same_ratio_t2}} \addtolength{\tabcolsep}{-2pt} \begin{tabular}{cccccc} \toprule \textbf{CS Ratio} & \textbf{Metods} & \textbf{PSNR} & \textbf{SSIM} & \textbf{NMSE} & $ \sigma(\omega_i)$\\ \midrule 10\% & Conventional & 23.0706 $\pm$ 1.2469 & 0.5963 $\pm$ 0.0349 & 0.2158 $\pm$ 0.0347 &\\ & Meta-learning & 24.0842 $\pm$ 1.3863 & 0.6187 $\pm$ 0.0380 & 0.0112 $\pm$ 0.0117 & 0.9013 \\ \midrule 20\% & Conventional & 27.0437 $\pm$ 1.0613 & 0.6867 $\pm$ 0.0261 & 0.1364 $\pm$ 0.0213 & \\ & Meta-learning & 28.9118 $\pm$ 1.0717 & 0.7843 $\pm$ 0.0240 & 0.0122 $\pm$ 0.0030 & 0.8742\\ \midrule 30\% & Conventional & 29.5533 $\pm$ 1.0927 & 0.7565 $\pm$ 0.0265 & 0.1023 $\pm$ 0.0166 & \\ & Meta-learning & 31.4096 $\pm$ 0.9814 & 0.8488 $\pm$ 0.0217 & 0.0069 $\pm$ 0.0019 & 0.8029\\ \midrule 40\% & Conventional & 32.0153 $\pm$ 0.9402 & 0.8139 $\pm$ 0.0238 & 0.0770 $\pm$ 0.0128 & \\ & Meta-learning & 33.1114 $\pm$ 1.0189 & 0.8802 $\pm$ 0.0210 & 0.0047 $\pm$ 0.0015 & 0.7151\\ \bottomrule \end{tabular} \end{specialtable} \begin{specialtable}[H] \caption{Quantitative evaluations of the reconstructions on T2 brain image associated with various sampling ratios of \textbf{radial} masks. Meta-learning was trained with CS ratio 10\%, 20\%, 30\% and 40\% and test with 15\%, 25\% and 35\%. Conventional method performed regular training and testing on same CS ratios 15\%, 25\% and 35\%. \label{results_dif_ratio_t2}} \addtolength{\tabcolsep}{-2pt} \begin{tabular}{cccccc} \toprule \textbf{CS Ratio} & \textbf{Metods} & \textbf{PSNR} & \textbf{SSIM} & \textbf{NMSE} & $ \sigma(\omega_i)$ \\ \midrule 15\% & Conventional & 24.8921 $\pm$ 1.2356 & 0.6259 $\pm$ 0.0285 & 0.1749 $\pm$ 0.0280 & \\ & Meta-learning & 26.7031 $\pm$ 1.2553 & 0.7104 $\pm$ 0.0318 & 0.0205 $\pm$ 0.0052 & 0.9532\\ \midrule 25\% & Conventional & 29.0545 $\pm$ 1.1980 & 0.7945 $\pm$ 0.0292 & 0.1083 $\pm$ 0.0173 & \\ & Meta-learning & 30.0698 $\pm$ 0.9969 & 0.8164 $\pm$ 0.0235 & 0.0093 $\pm$ 0.0022 & 0.8595\\ \midrule 35\% & Conventional & 31.5201 $\pm$ 1.0021 & 0.7978 $\pm$ 0.0236 & 0.0815 $\pm$ 0.0129 & \\ & Meta-learning & 32.0683 $\pm$ 0.9204 & 0.8615 $\pm$ 0.0209 & 0.0059 $\pm$ 0.0014 & 0.7388\\ \bottomrule \end{tabular} \end{specialtable} \begin{specialtable}[H] \caption{Quantitative evaluations of the reconstructions on T2 brain image associated with various sampling ratios of random \textbf{Cartesian} masks. \label{results_same_ratio_t2_cts}} \addtolength{\tabcolsep}{-2pt} \begin{tabular}{cccccc} \toprule \textbf{CS Ratio} & \textbf{Metods} & \textbf{PSNR} & \textbf{SSIM} & \textbf{NMSE} & $ \sigma(\omega_i)$\\ \midrule 10\% & Conventional & 20.8867 $\pm$ 1.2999 & 0.5082 $\pm$ 0.0475 & 0.0796 $\pm$ 0.0242 &\\ & Meta-learning & 22.0434 $\pm$ 1.3555 & 0.6279 $\pm$ 0.0444 & 0.0611 $\pm$ 0.0188 & 0.9361 \\ \midrule 20\% & Conventional & 22.7954 $\pm$ 1.2819 & 0.6057 $\pm$ 0.0412 & 0.0513 $\pm$ 0.0157 & \\ & Meta-learning & 24.7162 $\pm$ 1.3919 & 0.6971 $\pm$ 0.0380 & 0.0329 $\pm$ 0.0101 & 0.8320\\ \midrule 30\% & Conventional & 24.2170 $\pm$ 1.2396 & 0.6537 $\pm$ 0.0360 & 0.0371 $\pm$ 0.0117 & \\ & Meta-learning & 26.4537 $\pm$ 1.3471 & 0.7353 $\pm$ 0.0340 & 0.0221 $\pm$ 0.0068 & 0.6771\\ \midrule 40\% & Conventional & 25.3668 $\pm$ 1.3279 & 0.6991 $\pm$ 0.0288 & 0.1657 $\pm$ 0.0265 & \\ & Meta-learning & 27.5367 $\pm$ 1.4107 & 0.7726 $\pm$ 0.0297 & 0.0171 $\pm$ 0.0050 & 0.6498\\ \bottomrule \end{tabular} \end{specialtable} \begin{figure}[H] \centering \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_result.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_10_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_20_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_30_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_40_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/target_t1.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_result.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_10_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_20_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_30_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_40_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_10_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_20_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_30_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_40_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_true_t1.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_10_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_20_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_30_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_40_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_error.pdf} \includegraphics[width=0.18\linewidth]{fig/error_10_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/error_20_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/error_30_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/error_40_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/colorbar.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_error.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_10_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_20_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_30_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_40_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/masks.pdf} \includegraphics[width=0.18\linewidth]{fig/mask10_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask20_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask30_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask40_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf} \caption{The pictures (from top to bottom) display the reconstruction results, zoomed in details, pointwise errors with colorbar and associated \textbf{radio} masks for meta-learning and conventional learning with four different CS ratios 10\%, 20\%, 30\%, 40\%(from left to right). The most top right one is ground truth fully-sampled image. } \label{figure_same_ratio_t1} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_result.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_15_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_25_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_35_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/target_t1_31.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_result.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_15_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_25_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_35_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_15_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_25_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_35_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_true_t1_31.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_15_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_25_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_35_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_error.pdf} \includegraphics[width=0.18\linewidth]{fig/error_15_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/error_25_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/error_35_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/colorbar.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_error.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_15_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_25_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_35_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/masks.pdf} \includegraphics[width=0.18\linewidth]{fig/mask15_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask25_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask35_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf} \caption{The pictures (from top to bottom) display the T1 Brain image reconstruction results, zoomed in details, pointwise errors with colorbar and associated \textbf{radio} masks for meta-learning and conventional learning. Meta-learning was trained with CS ratios 10\%, 20\%, 30\% 40\% and test with three different CS ratios 15\%, 25\% and 35\%(from left to right). Conventional learning was trained and test with same CS ratios 15\%, 25\% and 35\%. The most top right one is ground truth fully-sampled image.} \label{figure_dif_ratio_t1} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_result.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_10_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_20_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_30_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_40_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/target_t2.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_result.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_10_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_20_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_30_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_40_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_10_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_20_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_30_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_40_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_true_t2.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_10_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_20_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_30_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_40_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_error.pdf} \includegraphics[width=0.18\linewidth]{fig/error_10_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/error_20_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/error_30_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/error_40_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/colorbar.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_error.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_10_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_20_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_30_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_40_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/masks.pdf} \includegraphics[width=0.18\linewidth]{fig/mask10_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask20_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask30_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask40_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf} \caption{The pictures (from top to bottom) display the T2 Brain image reconstruction results, zoomed in details, pointwise errors with colorbar and associated \textbf{radio} masks for both these two compared methods with four different CS ratios 10\%, 20\%, 30\%, 40\%(from left to right). The most top right one is ground truth fully-sampled image. } \label{figure_same_ratio_t2} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_result.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_15_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_25_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_35_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/target_t2_31.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_result.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_15_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_25_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_35_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_15_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_25_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_35_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_true_t2_31.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_15_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_25_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_35_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_error.pdf} \includegraphics[width=0.18\linewidth]{fig/error_15_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/error_25_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/error_35_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/colorbar.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_error.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_15_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_25_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_35_t2.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/masks.pdf} \includegraphics[width=0.18\linewidth]{fig/mask15_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask25_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/mask35_t1.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf} \caption{The pictures (from top to bottom) display the T2 Brain image reconstruction results, zoomed in details, pointwise errors with colorbar and associated \textbf{radio} masks for meta-learning and conventional learning. Meta-learning was trained with CS ratios 10\%, 20\%, 30\% 40\% and test with three different CS ratios 15\%, 25\% and 35\%(from left to right). Conventional learning was trained and test with same CS ratios 15\%, 25\% and 35\%. The most top right one is ground truth fully-sampled image. } \label{figure_dif_ratio_t2} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_result.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_10_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_20_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_30_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/rec_40_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/target_t2_cts.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_result.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_10_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_20_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_30_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_rec_40_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_10_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_20_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_30_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_40_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/detail_true_t2_cts.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_detail.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_10_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_20_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_30_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_detail_40_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/meta_error.pdf} \includegraphics[width=0.18\linewidth]{fig/error_10_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/error_20_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/error_30_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/error_40_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/colorbar_cts.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/conventional_error.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_10_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_20_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_30_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/adam_error_40_t2_cts.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf}\\ \includegraphics[width=0.2\linewidth, angle=90]{fig/masks.pdf} \includegraphics[width=0.18\linewidth]{fig/mask10_cartesian.pdf} \includegraphics[width=0.18\linewidth]{fig/mask20_cartesian.pdf} \includegraphics[width=0.18\linewidth]{fig/mask30_cartesian.pdf} \includegraphics[width=0.18\linewidth]{fig/mask40_cartesian.pdf} \includegraphics[width=0.18\linewidth]{fig/white.pdf} \caption{The pictures (from top to bottom) display the T2 Brain image reconstruction results, zoomed in details, pointwise errors with colorbar and associated \textbf{Cartesian} masks for both these two compared methods with four different CS ratios 10\%, 20\%, 30\%, 40\%(from left to right). The most top right one is ground truth fully-sampled image. } \label{figure_same_ratio_t2_cts} \end{figure} \iffalse \begin{figure}[H] \centering \includegraphics[width=0.32\linewidth]{fig/meta_feature.pdf} \includegraphics[width=0.32\linewidth]{fig/adam_feature.pdf} \includegraphics[width=0.32\linewidth]{fig/true_feature.pdf} \caption{Features (from left to right) of meta-learning and conventional learning, the last image is the original reference image.} \label{feature} \end{figure} \fi \subsection{Future work and open challenges} Deep optimization-based meta-learning techniques have shown great generalizability but there are several open challenges that can be discussed and can potentially be addressed in future work. A major issue is the memorization problem since the base learner needs to be optimized for a large number of phases and the training algorithm contains multiple gradient steps, computation cost is very expensive in terms of time and memory costs. In addition to reconstruct MRI through different trajectories, another potential application for medical imaging could be multi-modality reconstruction and synthesis. Capturing images of anatomy with multi-modality acquisitions enhances the diagnostic information, and could be cast as a multi-task problem and benefit from meta-learning. \section{Conclusions}\label{conclusion} In this paper, we put forward a novel deep model for MRI reconstructions via meta-learning. The proposed method has the ability to solve multi-tasks synergistically and the well-trained model could generalize well to new tasks. Our baseline network is constructed by unfolds an LOA, which inherits convergence property, improves the interpretability, and promotes parameter efficiency of the designed network structure. The designated adaptive regularizer consists task-invariant learner and a task-specific meta-knowledge. Network training follows a bilevel optimization algorithm that minimizes task-specific parameter $\omega$ in the upper level on validation data and minimizes task-invariant parameters $\theta$ on training data with fixed $\omega$. The proposed approach is the first model for solving the inverse problem by applying meta-training on the adaptive regularization in the variational model. We consider recovering undersampled raw data across different sampling trajectories with various sampling patterns as different tasks. Extensive numerical experiments on various MRI datasets demonstrate that the proposed method generalizes well at various sampling trajectories and is capable of fast adaption to the unseen trajectories and sampling patterns. The reconstructed images achieve higher quality comparing to conventional supervised learning for both seen and unseen k-space trajectory cases.
\section{Introduction} \label{sec:introdcution} The good properties of word embeddings \cite{word2vec,glove} have inspired the development of various methods \cite{sentencebert, gem, infersent, skipthought, quickthought, short-text-embedding} for sentence embeddings which represent short text or sentences, i.e., sequences of words and symbols, as dense numerical vectors. Many downstream natural language processing (NLP) applications such as semantic textual similarity (STS) \cite{sentencebert}, sentiment analysis \cite{evaluation-sentence-embeddings}, service recommendation \cite{improved-weighted-removal}, and relation extraction \cite{sentence-embedding-alignment} have utilized sentence embeddings for improving their performance. However, relatively little is understood about the latent structure of sentence embeddings. There are two main reasons. First, sentences have variable lengths, composed of innumerable combinations of individual words with ambiguous boundaries. Second, there are a variety of sentence embedding methods guided by different principles. In particular, sentence embedding methods range from simple word embedding aggregation to sophisticated deep encoder-decoder neural networks \cite{infersent}. More recent techniques include transformer-based BERT-like models \cite{sentencebert}. Consequently, the resultant sentence embedding vectors encode different types of information for different purposes. \begin{figure*}[!th] \centering \subfloat[Embeddings of the Original Sentences]{ \includegraphics[width=0.5\linewidth]{figures/sBERT_sentences_NYT_test.pdf} \label{fig:sBERT-sentence} } \subfloat[Embeddings of the Spanning Sub-Sentences]{ \includegraphics[width=0.5\linewidth]{figures/sBERT_span_NYT_test.pdf} \label{fig:sBERT-span} } \caption{A 2-D visualization of the embeddings generated by SentenceBERT on the test set of the NYT dataset. The shapes represent the embeddings of sentences in (a) and sub-sentences in (b). Different shapes correspond to different relations used to label the sentences and sub-sentences. A cluster of the same shapes indicates the embeddings of the sentences and sub-sentences expressing the same relation are located close to each other. The clearer boundaries between the clusters of shapes in (b) indicate a better clusterability than the embeddings in (a) in terms of relation labels. } \label{fig:sBERT-sentence-span} \end{figure*} Past effort has been made to explore properties of sentence embeddings. The work in \cite{fine-grained-sentence-embeddings} evaluates the predictive ability of sentence embeddings through predictive tasks. Another work in \cite{sentence-analogies} performs a sentence analogy task by evaluating the degree to which lexical analogies are reflected in sentence embeddings. A significant issue in the current studies is that the sentences are mostly simple sentences. \emph{It remains to be answered whether lengths and structures of sentences have any impacts on the topology of sentence embedding spaces.} In this paper, we explore the latent structure of the embedding spaces of complex sentences and their sub-sentences with regard to capturing semantic regularities. We leverage the widely-used dataset for the study of relation extraction \cite{RiedelYM10,cotype,cnn-pcnn-att}. The dataset was constructed by distantly aligning relations in Freebase \cite{freebase} with sentences from the New York Times (NYT) corpus of years 2005-2006. Each sentence in the dataset is labeled by a semantic relation between two entity mentions in the sentence. The data set is well-suited for our study because we can use the entity mentions as anchors to study the embeddings of various sub-sentences. We collect a set of representative sentence embedding methods and apply these methods to the original NYT sentences and various sub-sentences containing the entity mentions. Our goal is to examine whether the embeddings of (sub-)sentences expressing the same semantic relation cluster together. If the clustering signal in the latent structure is strong, unsupervised methods can recognize relations by simply measuring the distances between embedding vectors, which will greatly reduce the bottleneck of collecting labeled training data. The work we present in this paper shows some methods generate more clusterable embeddings than others. The sentence structures also have effects on the clusterability of resultant embeddings. As an illustration, Figure \ref{fig:sBERT-sentence-span} shows a 2-D visualization of the embedding spaces generated by the SentenceBERT method on the test set of the NYT dataset. The embedding space of the span sub-sentences in Figure \ref{fig:sBERT-sentence-span}(b) has better clustering structures than that of the original sentences in Figure \ref{fig:sBERT-sentence-span}(a). For reproducibility, all the data and code of the study in this paper are put in a public repository\footnote{\label{repository}https://github.com/sent-subsent-embs/clustering-network-analysis}. The rest of the paper is structured as follows. Section \ref{sec:related-work} discusses related work. Section \ref{sec:background} describes the technical background of the sentence embedding methods. Section \ref{sec:sentence-sub-sentence} presents the methods for extracting sub-sentences. Section \ref{sec:analytic-design} describes the analytic methods and experimental process. Section \ref{sec:experimental-results} presents the experimental results. Section \ref{sec:discussion} discusses the study. Finally, Section \ref{sec:conclusion} concludes the paper. \section{Related Work} \label{sec:related-work} There is an extensive body of research on exploring properties of word embeddings \cite{levy-goldberg-2014-linguistic,word2vec,graph-based-exploration}. The work in \cite{graph-based-exploration} applied graph theoretic tools on the semantic networks induced by word embeddings. The study demonstrated that network analysis on word embeddings could draw interesting structures about semantic similarity between words. In contrast, exploring the properties of sentence embeddings has been much more limited. A common approach is to compare the performance of sentence embeddings in various downstream NLP tasks as in \cite{fine-grained-sentence-embeddings}. The first task of SemEval 2014 \cite{semeval2014, semeval2014-svm} applied and evaluated sentence embeddings in a semantic relatedness task. The authors in \cite{white-how-well2015} evaluated sentence embeddings using a semantic classification task. The RepEval 2017 Shared Task \cite{repEval2017-multi-genre, repEval2017-LCT} compared seven sentence embedding methods on shared sentence entailment task. The work in \cite{evaluation-sentence-embeddings} performed a comprehensive evaluation of sentence embedding methods using a wide variety of downstream and linguistic feature probing tasks. Another work \cite{comparative-sentence-embedding-paraphrasing} evaluated several sentence embedding methods, including BERT, InferSent, semantic nets and corpus statistics (SNCS), and Skipthought, by performing a paraphrasing task. All the work attempted to discover the relationships between the geometric structures of embedding spaces and NLP applications. Our work is closely related to the study of sentence analogy in \cite{sentence-analogies}. Differing from the work, our work evaluates and explores the clustering properies of sentence embeddings with regard to expressing semantic relations between entities. More importantly, our work explores the latent structures of the embeddings of complex sentences and their sub-sentences. \section{Sentence Embedding Methods} \label{sec:background} In this study, we select a set of representative methods that can be classified into 3 categories: \emph{word-embedding-aggregation} approach, \emph{from-scratch-sentence-embedding} approach, and \emph{pre-trained-fine-tune} approach. The classification is based on the guiding principles and algorithms employed by the methods. Here, we briefly describes the technical details of the methods in each category. The public repository contains all implementation code and pointers to the original sources. \noindent \textbf{Category 1: word-embedding-aggregation}:\\ \emph{Method 1. GloVe-Mean \cite{fasttext}}: GloVe-Mean takes the arithmetic average of the word embeddings in a sentence as the sentence embedding. As its name indicates, GloVe-Mean uses the pre-trained word embeddings generated by the GloVe method \cite{glove}. Let $s=\{w_{1}, w_{2}, ..., w_{n}\}$ be a sentence consisting of a sequence of words, $w_{1}$, $w_{2}$, ..., $w_{n}$. Let $\mathbf{v}(w_{i})\in \mathbb{R}^d$ be the $d$-dimensional embedding vector of a word $w_{i}$. The GloVe-Mean generates the embedding vector $\mathbf{v}(s)\in \mathbb{R}^d$ for the sentence $s$ as: \[ \mathbf{v}(s) = \frac{{\sum}_{i=1}^{n} \mathbf{v}(w_{i})}{n} \] GloVe-Mean is one of the simplest ways to convert the embeddings of a sequence of words to a single sentence embedding. In our study, we use our own home-grown code for GloVe-Mean. \noindent \emph{Method 2. GloVe-DCT \cite{discretecosine}}: GloVe-Mean treats the words in a sentence as in a bag, ignoring their ordering. To address this, GloVe-DCT stacks individual GloVe word vectors $\mathbf{v}(w_{1})$, $\mathbf{v}(w_{2})$,... , $\mathbf{v}(w_{n})$ into a $n\times d$ matrix. It then applies a discrete cosine transformation (DCT) on the columns. Given a vector of real numbers $c_0, \ldots , c_N$, DCT calculates a sequence of coefficients as follows: \begin{center} $$coef[0] = \sqrt{\frac{1}{N}}\sum_{n=0}^N c_n$$ \end{center} and \begin{center} $$coef[k] = \sqrt{\frac{2}{N}}\sum_{n=0}^N c_n \cos \frac{\pi}{N} (n + \frac{1}{2})k$$ \end{center} The choice of $k$ typically ranges from 1 to 6, where a choice of zero is essentially similar to GloVe-Mean. To get a fixed-length and consistent sentence vector, GloVe-DCT extracts and concatenates the first $K$ DCT coefficients and discards higher-order coefficients. The size of sentence embeddings is $Kd$. In our study, we use our own home-grown code for GloVe-DCT. \noindent \emph{Method 3. GloVe-GEM \cite{gem}}: For a sentence $s=\{w_{1}, w_{2}, ..., w_{n}\}$, GloVe-GEM takes the word embeddings $\{\mathbf{v}(w_{i})\in \mathbb{R}^d, i = 1..n\}$ as input. It generates the sentence embedding $\mathbf{v}(s)$ by a weighted sum \[ \mathbf{v}(s) = \sum_{i=1}^{n} \alpha_{i} \mathbf{v}(w_{i}) \quad\mathrm{s.t.}\quad \alpha_{i} = \alpha_{n}+\alpha_{s}+\alpha_{u} \] where the weights $\alpha_{i}, i=1..n$ come from three scores: a novelty score $\alpha_{n}$, a significance score $\alpha_{s}$, and a corpus-wise uniqueness score $\alpha_{u}$. To compute the three scores, GloVe-GEM applies the Gram-Schmidt Process (also known as QR factorization) to the context matrices of the words in the sentence. For each word, its context matrix is made up with the word embeddings in its surrounding context. The method then builds an orthogonal basis of the context matrix. The scores of the word are computed based on principled measures using the bases. Finally, GloVe-GEM removes the sentence-dependent principle components from the weighted sum. In our study, we use our own home-grown code for GloVe-GEM too. \noindent \textbf{Category 2: from-scratch-sentence-embedding}: \\ \emph{Method 4. Skipthought \cite{skipthought}}: Inspired by the skip-gram model of word2vec, Skipthought generates sentence embeddings via the task of predicting neighboring sentences. Skipthought depends on a training corpus of contiguous text. It thus uses a large collection of novels, the BookCorpus unlabeled dataset, for training its model. The model is in the encoder-decoder framework. An encoder maps words to a sentence vector and a decoder is used to generate the surrounding sentences. Several choices of encoder-decoder pairs have been explored, including ConvNet-RNN, RNN-RNN, and LSTM-LSTM. In our study, we use the open source implementation of Skipthought\footnote{https://github.com/ryankiros/skip-thoughts}. \noindent \emph{Method 5. Quickthought \cite{quickthought}}: Quickthought also uses the unlabeled BookCorpus for training its model. Instead of reconstructing the surface form of the input sentence or its neighbors, Quickthought uses the embedding of the current sentence to predict the embeddings of neighboring sentences. In particular, given a sentence, Quickthought's model chooses the correct target sentence from a set of candidate sentences. The model achieves this by replacing the generative objectives with a discriminative approximation. In our study, we use the open source implementation of Quickthought\footnote{https://github.com/lajanugen/S2V}. \noindent \emph{Method 6. InferSentV1 and Method 7. InferSentV2 \cite{infersent}}: InferSent uses a three-way classifier to predict the degree of sentence similarity (similar, not similar, neutral). It builds a bi-directional LSTM model pre-trained on natural language inference (NLI) tasks. InferSent comes in two flavors, a V1 model using the pre-trained GloVe vectors and a V2 model using the pre-trained FastText \cite{fasttext} vectors. Individually, we refer to them as \emph{InferSentV1} and \emph{InferSentV2}. In our study, we use the open source implementation of InferSent\footnote{https://github.com/facebookresearch/InferSent}. \noindent \emph{Method 8. LASER \cite{laser}}: LASER trains a Bi-directional LSTM model on a massive scale, multilingual corpus. It uses parallel sentences accross 93 input languages. LASER is able to focus on mapping semantically similar sentences to close areas of the embedding space. It allows the model to focus more on meaning and less on syntactic features. Each layer of the LASER model is 512 dimensional. By concatenating both the forward and backward representations, LASER generates a final sentence embedding of dimension 1024. In our study, we use the open source implementation of LASER\footnote{https://github.com/facebookresearch/LASER}. \noindent \textbf{Category 3: pre-trained-fine-tune}:\\ \emph{Method 9. SentenceBERT \cite{sentencebert}}: BERT \cite{bert} like pre-trained language models have helped many NLP tasks achieve state-of-the-art results. One issue of BERT is that it does not directly generate sentence embeddings. SentenceBERT \cite{sentencebert} is a modification of the pre-trained BERT network. It uses siamese and triplet network structures to derive semantically meaningful sentence embeddings. Specifically, SentenceBERT derives a fixed sized sentence embedding by adding a pooling operation to the output of BERT / RoBERTa. The network structure depends on the available training data. A variety of structures and objective functions are tested, including {\emph{Classification Objective Function}, {\emph{Regression Objective Function}, and {\emph{Triplet Objective Function}. In our study, we use the open source implementation of SentenceBERT\footnote{https://github.com/UKPLab/sentence-transformers}. In particular, we use the base model ``bert-base-nli-mean-tokens"\footnote{https://huggingface.co/sentence-transformers/bert-base-nli-mean-tokens}. The model computes the mean of all output vectors of the BERT. \section{Sentence and Sub-Sentence} \label{sec:sentence-sub-sentence} Sentence segmentation \cite{effective-semi-supervised-sentence-segmentation} is a non-trivial NLP task that aims to divide text into meaningful component sentences. Automatic sentence segmentation typically divides text based on syntactic structures such as punctuation. The resultant sentences often express multiple ideas with variable lengths. In this study, we examine the strengths and weaknesses of different methods for encoding all valid (sub-)sentences for relation extraction. The validity of a (sub-)sentence means the (sub-)sentence must cover the identified entity mentions. An entity mention is defined as a span of tokens in a sentence. The following sentence is an example in the NYT dataset. We refer to the sentence as $S1$: \\ $S1$: ``{\tt But that spasm of irritation by a master intimidator was minor compared with what Bobby Fischer, the erratic former world chess champion, dished out in March at a news conference in \underline{Reykjavik}, \underline{Iceland}.}''\\ The sentence is labeled with the \entity{`contains'} relation between two geographical locations. The two underlined spans, {\tt \underline{Reykjavik}} and {\tt \underline{Iceland}}, are identified as the two entity mentions representing two locations. There are simple sentences such as "{\tt \underline{Rechard Levine} was born in \underline{Manhattan}.}" It is labeled with the relation \entity{`place\_of\_birth'} between the two underlined entity mentions. There are also compound-complex sentences consisting of multiple independent and dependent clauses. The NYT data set contains 372,853 sentences. Out of them, 111,610 sentences are labeled with 24 relations defined in FreeBase \cite{freebase}. For the labeled sentences, the longest sentence has 265 words, while the shortest sentence has 4 words. The mean length is 39 words. Since we will extract \emph{valid} sub-sentences to compare to the original sentences, we aimed to make sure that the original sentences are statistically long enough such that the extracted \emph{valid} sub-sentences are significantly different from the original ones. To this extent, we extracted sub-sentences consisting of the sequence of tokens between the two entity mentions (including the two mentions.) We call such a sub-sentence \emph{span}. Examining the lengths of spans, we find the longest span has 99 words, while the shortest span has 2 words. The mean length of spans is 11 words. The standard deviation of the sentence lengths is 15 words while the standard deviation of the span lengths is 9 words. The dataset allows us to conduct the study on examining the embedding spaces of sentences and \emph{valid} sub-sentences with significantly different lengths. \begin{table*}[!th] \begin{center} \begin{tabular}{|l | l|} \hline \textbf{Method Name} & \textbf{Definition} \\ \hline $X_{0}$:\textbf{span}: & \emph{extracts the sub-sentence starting from the first mention and ending at the second mention.}\\ \hline $X_{1}$:\textbf{spanBA1}: & \emph{extracts the sub-sentence extending 1 token before the \textbf{span} and 1 word after the \textbf{span}.}\\ $X_{2}$:\textbf{spanBA2}: & \emph{extracts the sub-sentence extending 2 tokens before the \textbf{span} and 2 words after the \textbf{span}.}\\ ... & ... ...\\ $X_{10}$:\textbf{spanBA10}: & \emph{extracts the sub-sentence extending 10 tokens before the \textbf{span} and 10 words after the \textbf{span}.}\\ $X_{15}$:\textbf{spanBA15}: & \emph{extracts the sub-sentence extending 15 tokens before the \textbf{span} and 15 word after the \textbf{span}.}\\ $X_{20}$:\textbf{spanBA20}: & \emph{extracts the sub-sentence extending 20 tokens before the \textbf{span} and 20 words after the \textbf{span}.}\\ \hline $Y_{1}$:\textbf{surroundings1}: & \emph{extracts the concatenation of the sub-sentences each of which containing 1 token} \emph{surrounding a mention.}\\ $Y_{2}$:\textbf{surroundings2}: & \emph{extracts the concatenation of the sub-sentences each of which containing 2 tokens} \emph{surrounding a mention.}\\ ... & ... ...\\ $Y_{10}$:\textbf{surroundings10}: & \emph{extracts the concatenation of the sub-sentences each of which containing 10 tokens} \emph{surrounding a mention.}\\ $Y_{15}$:\textbf{surroundings15}: & \emph{extracts the concatenation of the sub-sentences each of which containing 15 tokens} \emph{surrounding a mention.}\\ $Y_{20}$:\textbf{surroundings20}: & \emph{extracts the concatenation of the sub-sentences each of which containing 20 tokens} \emph{surrounding a mention.}\\ \hline \end{tabular} \end{center} \caption{\label{tab:sub-sentence-extraction} Sub-Sentence Extraction Methods} \end{table*} \comment{ Intuitively, a longer sentence describes multiple meanings corresponding to multiple semantic relations. A similar issue called polysemy already exists in words. It has always been unclear how to interpret the embedding when the word in question is polysemous, that is, has multiple senses \cite{arora-polysemy}. When a long sentence is encoded as a vector, it is even harder to make sense of it. The issue of polysemous words in NLP relies upon WordNet, a hand-constructed repository of word senses and their interrelationships. Unfortunately, there is no hope to develop such a repository for sentences. For the problem of applying embeddings for relation extraction, an idea is to encode only necessary parts of a sentence. However, it is unclear what constitutes ``necessary parts'', and how the embedding methods will interact with sub-sentences. In this study, we take a first step to initially answer the questions.} TABLE \ref{tab:sub-sentence-extraction} summarizes the extraction methods. Since all valid sub-sentences must contain the identified entity mentions, the extractions anchor on the entity mentions. We also apply extraction of sub-sentences up to length 40, based on the average NYT sentence length of 39 tokens. Starting with the entity mentions, the first method, $X_{0}$:\textbf{span}, extracts the sub-sentence spanning from the first entity mention to the second entity mention. The second method, $X_{1}$:\textbf{spanBA1}, extracts the sub-sentence extending the span with one token before and after the entity mentions. Likewise, $X_{i}$:\textbf{spanBA$i$}, for $i=2...20$, extend the span with $i$ tokens before and after the entity mentions. For instance, from the example sentence $S1$, $X_{0}$:\textbf{span} extracts ``{\tt \underline{Reykjavik}, \underline{Iceland}}", $X_{1}$:\textbf{spanBA1} extracts ``{\tt in \underline{Reykjavik}, \underline{Iceland} .}", $X_{2}$:\textbf{spanBA2} extracts ``{\tt conference in \underline{Reykjavik}, \underline{Iceland} .}", and so on. The next group of methods, $Y_{j}$:\textbf{surroundings$j$}, for $j=1...20$, extract the entity mentions and $j$ tokens surrounding the entity mentions. The method $Y_{j}$:\textbf{surroundings$j$} differs from $X_{i}$:\textbf{spanBA$i$} in that $Y_{j}$:\textbf{surroundings$j$} starts from entity mentions and extends on both sides of each mention, while $X_{i}$:\textbf{spanBA$i$} starts from a span and extends on both sides of the span. The method $Y_{j}$:\textbf{surroundings$j$} may extract discontinuous chunks from a sentence if the two mentions are located far way from each other in the sentence, and will concatenate the discontinuous chunks as a single sub-sentence. Finally, the methods extract all valid sub-sentences up to length around 40, though the sub-sentences may have duplicates extracted from short original sentences. \section{Analytic Design and Experimental Process} \label{sec:analytic-design} There are 9 embedding methods, and 42 sets of original sentences, spans, spanBA1-20, and surroundings1-20. We conduct clustering and network analyses on $9\times 42=378$ embedding spaces generated by the combinations of embedding and sub-sentence extraction methods. \subsection{Clustering Analysis} \label{sec:clustering-analysis} Clustering analysis \cite{interpretability-refinement-clustering} evaluates the extent to which the sentences expressing the same relations are located in the same partitions. The analysis encompasses two main tasks \cite{data-mining-textbook}: (1) \emph{clustering tendency} assesses whether it is suitable to apply clustering on the embedding spaces in first place, and (2) \emph{clustering evaluation} seeks to assess the goodness or quality of the clustering given data labels. \textbf{Clustering Tendency:} The metric we implemented for clustering tendency is \emph{Spatial Histogram (SpatHist)} \cite{data-mining-textbook,cluster-theory, clusterability}. Given a dataset $D$ with $d$ dimensions, we create $b$ equi-width bins along each dimension, and count how many points lie in each of the $b^{d}$ $d$-dimensional cell. We can obtain the empirical joint probability mass function (EPMF) of $D$ based on the binned data. Next, we generate $t$ random samples, each comprising $n$ uniformly generated points within the same $d$-dimensional space as the input data $D$. We can compute the EPMF for each sample too. Finally, we can measure how much the EPMF of the input data $D$ differs from the EPMF of each random sample using the Kullback-Leibler (KL) divergence which is non-negative. The KL divergence is zero when the input data behaves the same as the random sample. The SpatHist is the average of $t$ KL divergences between $D$ and the $t$ random samples. The larger the SpatHist is, the more clusterable the data should be. \textbf{Clustering Evaluation.} Given a dataset $D$ with partitions $P=\{P_{1}, ..., P_{m}\}$ each of which has a label, a metric of clustering evaluation measures the extent to which points from the same partition appear in the same cluster, and the extent to which points from different partitions are grouped in different clusters. The higher the metric value is, the better the quality of the clustering. For example, \emph{homogeneity} \cite{clustering-homogeneity} quantifies the extent to which a cluster contains entities from only one partition. Suppose the data $D$ is clustered into $k$ groups $C=\{C_{1}, C_{2}, ..., C_{k}\}$. Let $N_{ij}$ be the number of members in group $C_{i}$ with partition label $j$. The homogeneity of the clustering is defined in terms of entropy as: $h=1-\frac{H(C|P)}{H(P)}$, where $H(C|P)$ is the conditional entropy of the clustering $C$ given the partition $P$ and $H(P)$ is the entropy of the original data partitioning. Other metrics apply the same principle but use different ways to measure cluster memberships. We tested the following metrics: \emph{purity, fMeasure, Rand Index, homogeneity, mutual information, completeness, vMeasure,} and \emph{Fowlkes-Mallows measure}\footnote{https://scikit-learn.org/stable/modules/classes.html\#module-sklearn.metrics.cluster}. For all the metrics, the higher the value is, the better the clustering quality. Our experiments show that these metrics are consistent in terms of measuring the quality of clustering, though they may be at different value scales. \subsection{Network Analysis} \label{subsec:network-analysis} For a set of sentence embeddings, we build a Sentence Embedding Similarity Graph (SESG) based on the Euclidean distances between embedding vectors. Given a set of sentences $\mathcal{S} =\{S_{1}, S_{2}, ..., S_{p}\}$, let $\mathbf{W}=\{\mathbf{v}(S_{1}), \mathbf{v}(S_{2}), ..., \mathbf{v}(S_{p})\}$ be the set of sentence embeddings. We build the SESG graph corresponding to the sentence embeddings as follows. Let $G=(V, E)$ be the SESG grpah, where $V=\{v_{1}, v_{2}, ...., v_{n}\}$ is the set of vertices, and $E=\{e_{1}, e_{2}, ..., e_{m}\}$ is the set of edges. Initially, the graph $G$ is empty. For a pair of embeddings $\mathbf{v}(S_{i}), \mathbf{v}(S_{j})\in \mathbf{W}$, we add two vertices $v_{i}, v_{j}\in V$ and an edge $e_{k}=(v_{i}, v_{j})\in E$ between them, if the distance between the embeddings of corresponding sentences is smaller than a threshold, i.e., $||\mathbf{v}(S_{i})-\mathbf{v}(S_{j})|| < thresh$. In this study, we choose the threshold as the \emph{mean Euclidean distance} between the embedding vectors of the sentences that are labeled with the same relations. It should be noted that by cutting off pairs of sentences with larger distances, not every sentence will have a corresponding vertex in the SESG graph. \subsection{Experimental Process} \label{sec:experimental-process} Each embedding spaces has 111,160 embedding vectors. We ran the experiments in multiple local and remote compute instances, including 2 local machines each with 16G RAM, 2 virtual machines each with 32G RAM and 8 vCPU in an on-premises cloud, and a Google Colab Pro account. We ran the network analyses using Apache Spark on a Databricks cluster with 8 worker nodes of Amazon m4.large instance. The sentences in the NYT dataset are labeled by 24 Freebase relations. The sentences labeled with the same relation are considered in the same cluster. To recover the 24 clusters, we apply the K-Means implementation in Scikit-Learn package with $n\_clusters=24$ and other options with the default values. For clustering tendency, we use 500 random samples to average KL divergences for the final SpatHist values. The dimensions of embeddings generated by the 9 embedding methods range from 300 to 4096. The main limitation of the spatial histogram is when we bin each dimension to create cells for computing the EPMF, the number of cells is exponentially large and most of the cells will be empty. To mitigate the problem, we apply a PCA ($n\_component = 2$) dimensionality reduction on embedding vectors before we compute the KL divergences. \begin{figure}[!th] \centering \includegraphics[width=1\linewidth]{figures/all-spatHist.pdf} \caption{Clustering tendency analysis: Each line represents an embedding method. The x-axis lists the sets of sentences and sub-sentences used to generate the embeddings. The y-axis indicates the values of the metrics (spatial histogram) measuring the clusterability of the embeddings. The higher the y values, the more clusterable the embeddings corresponding to the sets of sentences and sub-sentences on the x-axis. } \label{fig:all-clustering-tendency} \end{figure} \begin{figure*}[!th] \centering \includegraphics[width=1\linewidth]{figures/all_homogeneity.pdf} \caption{Clustering evaluation analysis: This figure illustrates the clustering evaluation results measured by the \emph{homogeneity score} metric. It shows the embeddings of the span sub-sentences are more clusterable than that of the original sentences. All metrics demonstrated the same property on different types of sub-sentences. The entire data are available in the github repository. } \label{fig:clustering-validation-all} \end{figure*} \section{Experimental Results} \label{sec:experimental-results} \subsection{Clustering Tendency} Figure \ref{fig:all-clustering-tendency} shows the results of clustering tendency analysis for the embedding spaces. Each value of the metric (spatial histogram) is computed by averaging 500 KL divergences. Their standard deviations are between $[0.005, 0.2]$ with a mean $0.02$. Here are some observations: \begin{itemize} \item GloVe-GEM generates the most clusterable embeddings on the original sentences and spans with up to 5 extra tokens. The clusterability of the embeddings generated by GloVe-GEM is better than most of the other methods. \item Skipthought generates the most clusterable embeddings on the sub-sentences based on the tokens surrounding entity mentions. \item SentenceBERT and Quickthought generate more clusterable embeddings on spans than on original sentences (the lower-left corner area on the figure). \end{itemize} \subsection{Clustering Evaluation} Figure \ref{fig:clustering-validation-all} illustrates the clustering evaluation results measured by the \emph{homogeneity score} metric for the embedding spaces of sentences and spans. It shows the embeddings of the span sub-sentences are more clusterable than that of the original sentences. All metrics demonstrated the same property on different types of sub-sentences. Looking into the entire data set, we have the following key observations: \begin{itemize} \item Quickthought, GloVe-DCT, GloVe-GEM, and Skip-thought generate the embeddings with better clustering quality on spans than on all other types of sentences. \item SentenceBERT, InferSentV1, InferSentV2, and LASER generate the embeddings with better clustering quality on surroundings1 than on all other types of sentences. \item All of the embeddings generated by the methods from the original sentences are of low clustering quality. Some of them are with the worst clustering quality. \end{itemize} \begin{figure*}[!ht] \centering \subfloat[\entity{A Small Neighborhood of two hubs in GEM-Sentence}]{ \includegraphics[width=0.5\linewidth]{figures/graph_44557_5508.pdf} } \subfloat[\entity{A Small Neighbordhood of two hubs in GEM-span}]{ \includegraphics[width=0.5\linewidth]{figures/graph_39803_40558.pdf} } \caption{Visualization of small neighborhood graphs. The vertices correspond to the embeddings of sentences in (a) and sub-sentences in (b). Each vertex is labeled by the relation which is used to label the sentences and sub-sentences. Each neighborhood graph is built around two hubs, i.e., nodes with the highest degree. According to the construction of SESG graph, a hub is close to its neighbors. If the neighbors are also close to each other, we should see dense connection in the neighborhood. The denser the neighborhood graph, the better the clusterability of the embeddings.} \label{fig:lcc-highest-degree-graph} \end{figure*} \subsection{Network Analysis} The potential size of a Sentence Embedding Similarity Graph (SESG) is astronomically large. The number of undirected pairs of sentences is about $111610^2/2 \approx 6.228\times10^{9}$. It is infeasible to analyze the SESG graphs for all sets of (sub-)sentences. Because GloVe-GEM has the best performance shown by the clustering analyses, we choose the embeddings generated by GloVe-GEM on the original sentences and spans. We call these two representative SESG graphs \entity{GEM-sentence} and \entity{GEM-span}, respectively. Our primary goal is to enrich the findings of clustering analysis through a more focused case study. The final \entity{GEM-sentence} graph has 94,473 vertices and about $87$ million edges, and the final \entity{GEM-span} graph has 91,318 vertices and about $104$ million edges. The first observation is that the SESG graph built on span embeddings has more similar pairs than the graph built on sentence embeddings. We measures the density of a graph by the ratio $\frac{number\_of\_edges}{number\_of\_total\_possible\_edges}$. The density of \entity{GEM-span} is 25\% more than the density of \entity{GEM-sentence}. The first network analysis is on degree distributions. In both graphs, the degree distributions display a heavy tail. However, there are 543 vertices in \entity{GEM-span} having the highest degree (=31620), while there are only 25 vertices in \entity{GEM-sentence} having degrees greater than 31620. It indicates the similarity space of sentences is dominated by a few sentences. We randomly picked up two sentences with the highest degrees. They are ``{\tt Of Bronxvill, New York.}" and ``{\tt Of Plandome, New York.}" \emph{Both sentences closely mirror our definition of a span.} The second analysis is about connected components. Both \entity{GEM-sentence} and \entity{GEM-span} have a large connected component (CC) with 60\% of vertices and more than 99\% of edges. About 40\% of their vertices fall into other 12,400 in \entity{GEM-sentence} and 11,500 in \entity{GEM-span} smaller connected components. The density of the largest CC in \entity{GEM-span} is 35\% more than the density of the largest CC in \entity{GEM-sentence}. \emph{Connected component density increases in comparison to the whole graph.} The third analysis is aimed at the diameter of connected components. It is infeasible to compute the shortest paths between all pairs of vertices in these big graphs ($\sim 10^9$). We randomly select 0.1\% of the vertices and compute the shortest paths. The longest distance is 8. However, in the random sets from both graphs, more than 87\% of the distances are shorter than 3. \emph{SESG graphs exhibit small world behavior.} The fourth analysis focuses on the relation distributions in the largest CC. There are 24 relations in the NYT dataset. About 48\% of the sentences are labeled as the \entity{`contains'} relation between two geographical locations. In the largest CC of \entity{GEM-sentence}, 50\% of the vertices corresponding to \entity{`contains'}. In the largest CC of \entity{GEM-span}, 55\% of the vertices corresponding to \entity{'contains'}. \emph{This shows that $X_{0}$:\textbf{span} improves the quality of the largest cluster of the embeddings.} Finally, we visualize small neighborhoods of the vertices with highest degree in Figure \ref{fig:lcc-highest-degree-graph}. From each graph, we randomly select two vertices (the big dots) with the highest degree. For each selected vertex, we randomly choose about 20 neighbors. The density of \emph{the small neighborhood graph from \entity{GEM-span} in Figure \ref{fig:lcc-highest-degree-graph} (b) is 16\%, while the density of the small neighborhood graph from \entity{GEM-sentence} in Figure \ref{fig:lcc-highest-degree-graph} (a)} is 10\%. The former is denser than the latter one. \section{Discussion} \label{sec:discussion} We are motivated by the application of recognizing semantic relations between two entities in a textural sentence. Therefore, using the widely-used data set for relation extraction research in the literature is well-suited for our purpose. Given a set of embedding vectors as a metric space, the distance between any two members, which are usually called points, characterizes the geometric structures of the space. Our analytical methods, specifically clustering and network analyses based on pair-wise distances, reveal a diversity of underlying geometric structures. Unlike word embedding methods, sentence embedding methods are guided by different underlying principles. However, experimental results show the guiding principles may or may not converge on generating embeddings with similar properties. For example, the embedding spaces generated by SentenceBERT and Quickthought on spans or short segments containing two entity mentions are more clusterable than on the original sentences. It is interesting to note that SentenceBERT and Quickthought share little in terms of their modeling and training processes. It is important to note, however, that both Quickthought and Skipthought share the same principle that uses embeddings to predict the neighboring sentences. But the embedding spaces generated by them exhibit different geometric structures. The values of the clusterability metric in Figure \ref{fig:all-clustering-tendency} indicate that the methods GloVe-GEM, Skipthought, and GloVe-DCT are the candidates for generating embeddings with better clustering properties in real-world applications. \section{Conclusion} \label{sec:conclusion} In this study, we investigate the clusterability of embedding spaces generated by various sentence embedding methods on sentences and different sub-sentences. The primary motivation of the study is that more clusterable embeddings with better clustering quality capture more syntactic and semantic regularities. As a result, downstream NLP applications such as relation extraction would benefit from the embeddings with better clustering quality. We conduct a set of comprehensive clustering and network analyses on the embeddings generated by 9 main embedding methods. The results show that the method GloVe-GEM stands out when applied to the original sentences and spans up to a certain length. Other methods have different strengths on different types of sub-sentences. In most cases, the embeddings generated from the original sentences are of low clustering quality. It signifies the impacts of sentence structures on the quality of embeddings when used by downstream applications. The outcomes of our analysis can be used to aid and direct future sentence embedding models and applications, for example, combining the strengths of different embedding methods. \section*{Acknowledgment} This work is supported in part by the USA NSF grant NSF-OAC 1940239.
\section{Introduction}\label{intro} The inflationary scenario is one of the most compelling paradigms evoked to address the inherent shortcomings of the standard model of the Universe. The framework not only addresses the inconsistencies associated with the standard cosmological model but has also proven to be one of the most promising answers to address the generation of cosmological perturbations, which evolve later as large scale structures and gravitational waves. The paradigm is supported by observations of the cosmic microwave background (CMB), such as Planck, WMAP etc.~\cite{ade2016planck,aghanim2018planck,hinshaw2013nine}. In the standard set up of inflation, a massive scalar field slowly rolling in the flat direction of its potential, induces (quasi)exponential cosmic expansion~\cite{Kazanas:1980tx,Guth:1980zm,Starobinsky:1980te, linde,shinji-rev}. In this standard scenario, inflaton is treated as a very weakly coupled field and thus the temperature remains negligible throughout inflation, mandating an additional epoch of reheating at the end of inflation, where the inflaton starts to oscillate at the bottom of the potential and decays at the end of inflation. This standard inflationary scenario with zero temperature is therefore termed as `cold inflation' (CI). Though the standard single field CI is phenomenologically very successful in its predictions for observables in CMB, the recently proposed swampland conjectures (SC), which are based on the idea that the stable de-Sitter (dS) vacuum is quite difficult to construct in the quantum theory of gravity \cite{obied,kallosh,agrawal}, puts it in trouble. Furthermore, these conjectures impose formidable conditions that necessitate a little drift off the standard cold inflationary framework without altering the success story of the paradigm. One can satisfy SC by either choosing to work in the Braneworld scenario~\cite{mrg1,brahma1} or by choosing the framework of `warm inflation (WI)' \cite{suratna,berera,dimop-owen,shojai}. The basic idea of the WI scenario is that the inflaton field has non-negligible couplings with the pre-existing matter fields such as radiation during inflation\cite{berera,branden,hall-moss}. Due to the presence of such couplings, the inflaton can dissipate during the process of inflation until the end of inflation characterised by either the slow-roll parameter(s) exceeding unity, or the radiation energy density($\rho_{R}$) becoming dominant over the vacuum energy density($\rho_{V}$). Due to the inherent construction of WI, the temperature during inflation can no longer be neglected. Thus along with the quantum fluctuations of the inflaton field, in the WI scenario, one needs to consider the existence and effect of the thermal fluctuations as well \cite{oliviera,graham}. If inflation ends by $\rho_{R}$ dominating over $\rho_{V}$, it could end the accelerated expansion naturally~\cite{cerezo,berera2}. In addition to resolving theoretical problems mentioned above, the WI model resurrects the inflationary potentials which are otherwise ruled out in a CI paradigm~\cite{panotopoulos,bartrum,bastero-gil,arya2}. One of the persistent and interesting questions in cosmology is the exact mechanism of the generation of baryon asymmetry in the early Universe that would result in a prediction matching the observed value of the baryon asymmetry at present, $\eta _F \equiv \frac{n_b-n_{\bar{b}}}{s}\sim 10^{-10}$. The presence of couplings of the inflaton with other relativistic fields motivates us to look for particular interactions that can lead to spontaneous baryogenesis even during inflation and soon thereafter. Hence, given a particular model of WI and well-motivated baryon number violating interactions present during inflation, successful production of the observed baryon asymmetry would lead to constraints and better understanding of such a WI scenario. Another mystery in contemporary cosmology is the nature of the dark energy that governs the acceleration of the Universe at the present epoch. One of the well-inspired models of dark energy is the quintessence, where a scalar field rolling down a plateau potential drives the acceleration today. This motivates one to look for models of quintessential inflation, where the inflaton does not decay completely after inflation, but survives till the present epoch to account for late time acceleration, remaining invisible for most of the post inflationary history of the Universe from the end of inflation till the present epoch. The residual scalar field, however, can be put to use for generation of the baryon asymmetry in the early Universe during inflation and in the subsequent radiation/kinetic dominated era assuming its interaction with a non-conserved baryonic current, $\hat{\rm a}$ {\it la} spontaneous baryogenesis. In this paper, we shall study spontaneous baryogenesis in the paradigm of warm quintessential inflation using a generalized exponential potential. We invoke coupling of the scalar field to massive neutrino matter for realising the exit from scaling regime to late-time acceleration. The rest of the paper is organised as follows. In the section \ref{wi1}, we will make a brief review of the WI dynamics and the analysis of the inflationary parameters. In section \ref{sbar}, we have discussed spontaneous baryogenesis and the corresponding analysis in our case. Then in section~\ref{lt}, we have discussed the late time implications of our model in details. Finally, the conclusions are drawn in section~\ref{conc}. \section{ Warm inflation}\label{wi1} \subsection{The model and evolution equations} In the WI scenario, there is a continuous dissipation of energy from the inflaton field to the radiation bath, characterised by the dissipation coefficient $\Upsilon$, which, in general, depends on the temperature $T$ of the radiation bath and the inflaton field $\phi$. Such a dissipation offers additional friction to the field $\phi$, slowing it down even further than that of a CI scenario with slow roll. Therefore, the energy scale at which the relevant cosmological scales exit the inflationary horizon correspond to a lower energy scale in WI as compared to a CI scenarios with the same inflation potential $V(\phi)$. This leads to a smaller value of the observable tensor-to-scalar ratio $r$ in WI, which can lead to the rejuvenation of many large field models of inflation (e.g. $V(\phi)\propto~\phi ^4$), that are refuted by CMB data in CI. The equations governing the dynamics of WI are: \begin{eqnarray} \label{phid} &\ddot{\phi}+3(1+Q)H\dot{\phi}+V_{,\phi}=0,\\ &\dot{\rho}_R+4H\rho _R= 3HQ\dot{\phi}^2. \end{eqnarray} Here, $Q\equiv \frac{\Upsilon}{3H}$, $\rho _R$ is the radiation energy density, and $V_{,\phi}\equiv \frac{dV}{d\phi}$. The Hubble parameter $H$ is given by the Friedmann equation: \begin{equation} \label{Hub1} H^2 =\frac{1}{3M_\mathrm{Pl} ^2}\bigg(V(\phi)+ \frac{\dot{\phi}^2}{2}+\rho _R \bigg), \end{equation} where $M_\mathrm{Pl} = 2.38\times 10^{18}$ GeV is the reduced Planck mass. Typically, one assumes the slow-roll condition to be valid throughout inflation, for which Eqs.~(\ref{phid})-~(\ref{Hub1}) can be further simplified. However, in a generic case, particularly when the energy budget near the end of inflation is important, the full equations should be considered for the evolution of $\phi$ and $\rho_R$. In terms of the number of e-folds $N$ from some fiducial pivot scale ($dN=Hdt$), these Eqs. can be written as: \begin{eqnarray} \label{phiN} &\phi ''+\bigg(3(1+Q)+\frac{H'}{H}\bigg)\phi '+\frac{V_{,\phi}}{H^2}=0,\\ \label{rhoN} &\rho _R'+4\rho _R = 3Q\phi '^2H^2, \end{eqnarray} and \begin{equation} H^2=\frac{V(\phi)+\rho _R}{3M_\mathrm{Pl} ^2 -\phi '^2/2}, \label{HubN} \end{equation} where primes denote derivatives with respect to the number of e-folds $N$. Thus, the dynamics of WI has two inputs: the inflaton potential $V(\phi)$ and the dissipation coefficient $\Upsilon (T,\phi)$. The exact functional form of $\Upsilon$ depends on the microphysics of the interactions of $\phi$ with the fields in the radiation bath~\cite{Berera:2008ar,Bastero-Gil:2019gao,Bastero-Gil:2010dgy,Bastero-Gil:2012akf,Bastero-Gil:2016qru}. The functional forms of $\Upsilon$ that are allowed by different types of such interactions are $\Upsilon \propto T^3/\phi ^2$, $\Upsilon \propto T$, and $\Upsilon \propto M^2/T $ ($M$ is a mass scale in the model). Thus, a generic form can be defined as: \begin{equation} \Upsilon = CT^c\phi ^p M^{1-c-p} \label{Upsgen} \end{equation} \\ \indent In this work, we focused on quintessential warm inflation, where the same inflaton field $\phi$ leads to dark energy in late time. Such a scenario can be motivated by only a few forms of the potential $V(\phi)$. Ref.~\cite{Peebles:1998qn} explored a scenario where $V(\phi)\sim \lambda (\phi ^4 +M^4)$ leads to chaotic inflation and $V(\phi) \sim \lambda/(\phi ^4 +M^4)$ leads to late time quintessence\footnote{This model has been studied in the WI setup in Ref.~\cite{Dimopoulos:2019gpz}.} and these two parts of the potential are connected by a kinetic energy dominated phase, where the inflaton $\phi$ runs quickly toward the scaling regime. On the other hand, a more concrete form: \begin{equation} V(\phi)=V_0^4 \exp \bigg(-\alpha \bigg(\frac{\phi}{M_\mathrm{Pl}}\bigg)^n \bigg), \label{pot} \end{equation} explored in Refs.~\cite{Geng:2015fla,Geng:2017mic,Ahmad:2019jbm} can also lead to inflation in the early Universe and acceleration at late times, and this motivates us to consider the potential in Eq.~(\ref{pot} )in this work. This potential has been studied in the context of WI in Ref.~\cite{Lima:2019yyv}, under slow roll assumptions. Since the dissipative coupling of radiation with $\phi$ is only important at very early times and should not disturb the late time consequences for the model in Eq.~(\ref{pot}), we expect the form of $\Upsilon$ to be such that $Q$ is negligible soon after the end of inflation. It can be shown~\cite{Lima:2019yyv} that such a requirement leads to the choice of $c>2$ in Eq.~\eqref{Upsgen}. This motivates us to choose a dissipation coefficient that is cubic in the temperature: \begin{equation} \Upsilon = C_{\phi}\frac{T^3}{\phi ^2}. \label{ups} \end{equation} \begin{figure}[b] \begin{center} \includegraphics[width=0.75\textwidth]{SRparams_1609.pdf} \caption{{\small Evolution of the slow roll parameters with the number of e-folds. In this analysis, we track $\epsilon _H$ to determine the end of inflation.}}\label{srplots} \end{center} \end{figure} Therefore, $Q=C_{\phi}\frac{T^3}{3H\phi ^2}$ and the full evolution equation for $Q$ is: \begin{equation} \frac{Q'}{Q}=-2\frac{\phi '}{\phi}-\frac{H'}{H}-3+\frac{9Q\phi '^2 H^2}{4\rho _R}. \label{QN} \end{equation} Given the values of the model parameters, $\alpha $, $n$, $V_0$, and the initial conditions for $\phi$, $\phi '$, $Q$, $\rho _R$, we can solve Eqs.~(\ref{phiN}),~(\ref{rhoN}),~(\ref{HubN}),~(\ref{QN}) to arrive at the complete inflationary evolution. The evolution of the temperature $T$ during WI can be tracked using $T=\bigg(\frac{\rho _R}{(\pi ^2/30)g_*}\bigg)^{1/4}$, where $g_*$ is the number of relativistic degrees of freedom in the thermal bath. This analysis leads us to precise conditions at the onset of the post-inflationary epoch. \subsection{Parameters for successful inflation} The Hubble slow-roll parameters are defined as: \begin{eqnarray} \epsilon _H&=& -\frac{H'}{H},\\ \eta _H &=& \epsilon _H - \frac{\epsilon '_H}{2\epsilon _H}, \label{SRH} \end{eqnarray} whereas, the potential slow-roll parameters are: \begin{eqnarray} \epsilon _V &=& \frac{M_\mathrm{Pl} ^2}{2}\bigg (\frac{V_{,\phi}}{V}\bigg )^2, \\ \eta _V &=& M_\mathrm{Pl} ^2 \frac{V_{,\phi \phi}}{V}. \end{eqnarray} However, in a WI setup, successful slow roll evolution requires $\epsilon _V/(1+Q), \eta _V/(1+Q) \ll 1$. We have considered: $V_0 = 2.24\times 10^{15}$ GeV, $\alpha = 0.05$ and $n=3$ and the following initial conditions: $\phi _{\rm ini}= 0.107 M_\mathrm{Pl}$, $\phi '_{\rm ini} = 1.72\times 10^{-3} M_\mathrm{Pl}$, $Q_{\rm ini}=3.20\times 10^{-6}$, and $\rho _{R, {\rm ini}}^{1/4}=2.88\times 10^{12} $ GeV. Solving Eq.s~\ref{phiN},\ref{rhoN},~\ref{HubN},~\ref{QN}, we found that inflation ends when the kinetic energy comes to dominate the potential energy (slow roll violation), $\sim 62.8$ e-folds after the pivot scale leaves the horizon. This can be seen from the evolution of the slow-roll parameters plotted in Fig.~\ref{srplots}, where $\epsilon _H >1$ at $N=62.8$. It is evident from Fig.~\ref{srplots} that the inflaton follows exact slow-roll evolution for most of the inflationary epoch, apart from the last $\sim 10$ e-folds where $\epsilon _H$ and $\eta _H$ deviate considerably from $\frac{\epsilon _V}{1+Q}$ and $\frac{\eta _V}{1+Q}$ respectively. The inflationary observables are found to be consistent with CMB constraints from Planck 2018: the pivot scale amplitude of the scalar power spectrum: $\log (A_s\times 10^{10})=3.03$, scalar spectral index $n_s = 0.962$, tensor-to-scalar ratio $r = 2.36\times 10^{-5}$. \begin{figure} \begin{center} \includegraphics[width=0.9\textwidth]{inflation_rho_all_z_1609.pdf} \caption{{\small Evolution of the inflaton potential $V _{\phi}$ (solid black), radiation energy density $\rho_{\rm R}$ (solid red) and kinetic energy density $\rho_{\rm K}$ (solid blue) (all normalised with $V_0^4$) with the number of e-folds. The evolution of the $3H^2/V_0^4$ is also shown in dashed grey curve. The inset shows crossover of energy densities near the end of inflation.}}\label{energyplots} \end{center} \end{figure} The evolution of energy densities for the entire duration and close to the end of inflation are shown in Fig.~\ref{energyplots}. Evidently, after the end of inflation, the kinetic energy dominates the energy budget for $\sim 1.2$ e-folds, after which radiation domination begins. \section{Spontaneous Baryogenesis} \label{sbar} \subsection{The model} As we discussed in the introduction, the scalar field in this warm quintessential inflationary scenario survives after inflation. It goes through a very short kinetic epoch\footnote{This is contrary to the long kinetic epoch in quintessential CI with such a potential, which leads to interesting conclusions for baryogenesis and relic gravitational waves~\cite{Ahmad:2019jbm}. The kinetic epoch for the WI scenario here with the same potential is small because there is nonzero radiation energy density at the end of inflation here. In fact, we found $\rho_R\sim 0.1 V(\phi )$ at the end of inflation.} followed by a radiation dominated epoch. We imagine that the relevant interaction originates from a theory with a $U(1)$ symmetry, generated by some baryonic charge for the scalar field. Spontaneous breaking of a symmetry leads to non-conservation of the baryonic current~\cite{Cohen:1988kt}. In general, this kind of scenario involves derivative coupling of the scalar field with baryonic current in an effective field theory scenario with a cut-off characteristic scale for the $U(1)$ symmetry. The effective Lagrangian can be written as~\cite{Dolgov:1997qr,DeSimone:2016ofp, Ahmad:2019jbm, DeFelice:2002ir} \begin{eqnarray} \mathcal{L}_{\rm eff}= \frac{\lambda '}{M}\partial _{\mu}\phi J^{\mu}, \label{Leff} \, , \end{eqnarray} where $\lambda'$ is the coupling to baryonic charge, $M$ is the cut-off for the effective theory and $J^\mu$ is the non-conserved baryonic current. For a homogeneous FLRW Universe, Eq. (\ref{Leff}) takes the form, \begin{eqnarray} \mathcal{L}_{\rm eff}= \frac{\lambda '}{M}\dot\phi \Delta n \label{Leff1}\, , \end{eqnarray} where, $J^0=\Delta n =n_b-n_{\bar{b}}$ is the net baryon number density. It has been argued \cite{Cohen:1988kt} that the coefficient of $\Delta n=n_b-n_{\bar{b}}$ in this case, shifts the energy of baryons and anti-baryon relative to each other, so $ \frac{\lambda'}{M}\dot \phi$ can be interpreted as an effective chemical potential for baryon numbers if $\dot \phi$ varies slowly. Then in thermal equilibrium, in the presence of $B$ violating interactions, \begin{eqnarray} \label{deln} \Delta n= n_b -n_{\bar{b}}= \frac{1}{6} \bar{g} \frac{\lambda'}{M}\dot{\phi} T^2~, \end{eqnarray} where $\bar{g}$ is the internal degrees of freedom for baryons. More recently it has been argued \cite{Arbuzova:2016spc,Dasgupta:2018eha} that the chemical potential of $\dot{\phi}$ is not correct. However, a net baryon asymmetry is generated~$(\propto \frac{\lambda'}{M}\dot \phi T^2)$ in such scenario with an $\mathcal{O}(1)$ proportionality constant that depends on the model and the interaction of the baryons. Therefore, we use the expression given in Eq.~(\ref{deln}) as an approximate expression for baryon asymmetry generated in thermal equilibrium in the presence of slowly varying $\dot{\phi}$. \iffalse \begin{eqnarray} \Delta n(\xi;T)= \bar{g}\int \frac{d^3p}{(2\pi)^3}\left[ f(E, \mu )-f(E, -\mu)\right]\, , \end{eqnarray} where $\bar g$ is the internal degrees of freedom for baryonic current, $f(E, \mu)$ is the Fermi- Dirac distribution function at temperature $T$ and $\xi\equiv \frac{\mu}{T}$. Upto the first order in $\xi$, we have \begin{eqnarray} \Delta n(\mu, T)= \frac{1 }{6} \bar{g} T^3 \xi + \mathcal{O} (\xi^2)\simeq \frac{\lambda' \bar{g}}{6 M} T^2 \dot \phi . \end{eqnarray}. \fi The baryon production freezes when the process of non-conservation of baryon current falls out of equilibrium compared to the Hubble expansion. If the freeze-out occurs at temperature $T_F$, we have the freeze-out condition ($\Gamma_B (T_F)\approx H (T_F)$). Beyond this time, interaction rate $\Gamma_B$( for baryon number violating process) can no longer cope with the Hubble expansion of the Universe ($\Gamma_B< H$). Now in thermal equilibrium, the entropy density is given by \begin{eqnarray} s= \frac{2 \pi^2}{45} g_{*,s} T^3 \, , \end{eqnarray} where $g_{*,s}\simeq g_*$ is the entropy degrees of freedom at temperature $T$. Thus the baryon to entropy ratio at decoupling/freeze-out is given by \begin{eqnarray} \eta _F \equiv \frac{\Delta n}{s}\vert _{T=T_F} = 0.38 \lambda ' \frac{\bar{g}}{g_*}\frac{\dot{\phi}(T_F)}{M T_F}\, . \label{etaf} \end{eqnarray} It is evident from Eq. (\ref{etaf}) that the freeze-out value of baryon number depends on the time derivative of the scalar field at freeze-out temperature $T_F$, i.e. $\dot{\phi}(T_F)$, which depends on the model of inflation under consideration and $T_F$ depends on the exact $B$ violating process. \begin{figure}[h] \begin{center} \includegraphics[width=14cm, height=6cm]{GamH_2909.pdf} \caption{{\small Freeze out of the baryon number violating process is shown for $M_{\chi}=6\times 10^{14}$ GeV (solid green) and $M_{\chi}=3\times 10^{14}$ (dashed green). The positions of freeze out in these two cases is shown in solid and dashed grey vertical lines respectively. The solid blue and solid red vertical lines correspond to the onset of kinetic energy domination and radiation domination respectively.}}\label{gammaBLplot} \end{center} \end{figure} The baryon number violating process is beyond the domain of the standard model of particle physics. However, this can be realized in the standard model through non-renormalizable operators with a cut-off scale that violates the anomaly free combination $B-L$. To this effect, we consider the following $4-$fermi interaction \begin{eqnarray} \mathcal{L}_{B-L}=\frac{\tilde{g}}{M_{\chi}^2}\psi _1\psi _2\bar{\psi}_3\bar{\psi}_4 \label{fourfermiint}\, , \end{eqnarray} where, $\psi_i$ are the fermions and $\tilde{g}$ is the coupling constant obtained after integrating out the $B-L$ violating effects of particle of mass $M_{\chi}$. The rate of the process for $T< M_\chi$ is given by \cite{Kolb:1990vq} \begin{equation} \Gamma _{B-L}(T)=\frac{\tilde{g}^2}{M_{\chi}^4}T^5, \label{gambl} \end{equation} This process freezes out at the temperature $T_F$ such that $\Gamma _{B-L}(T_F)=H(T_F)$. \subsection{Analysis} For our analysis, we obtain the freeze-out condition for two values of $M_\chi$ namely, $M_{\chi , 1}=6\times 10^{14}$ GeV and $M_{\chi , 2}=3\times 10^{14}$ GeV for $\tilde{g}=0.5$. From Eq.~\ref{gambl}, we found that for $M_{\chi , 1} $ the freeze-out happens during the kinetic energy dominated epoch, 1.14 e-folds after the end of inflation; whereas for $M_{\chi , 2}$ freeze-out takes place during the radiation dominated epoch, 2.31 e-folds after the end of inflation (see Fig.~\ref{gammaBLplot}). The freeze-out temperature and Hubble parameter at freeze-out in these two cases are $T_{F,1}= 10^{14}$ GeV, $H(T_{F,1})=6\times 10^{10}$ GeV and $T_{F,2}=4\times 10^{13}$ GeV, $H(T_{F,2})=4\times 10^9$ GeV respectively. Using the values $\bar{g}=2$, $\lambda '=10^{-5}$ and $M=10V_0$, we find $\eta _{F,1} = 4\times 10^{-9}$ and $\eta _{F,2} = 4\times 10^{-10}$ respectively for the two values of $M_{\chi}$ quoted above. We note that $\eta _{F,2}$ is in the right ballpark of the observed baryon asymmetry, however, $\eta _{F,1}$ is also viable, assuming that there can be late time entropy production before nucleosynthesis, which can further reduce $\eta _{F,1}$ to bring it inside the observationally allowed window. \begin{figure}[tbph] \begin{center} $% \begin{array}{c@{\hspace{.1in}}cc} \includegraphics[width=3.5 in, height=3.5 in]{Pic0.pdf} & % \includegraphics[width=3.5 in, height=3.5 in]{Pic1.pdf} \\% \mbox (a) & \mbox (b) &% \end{array}% $% \end{center} \begin{center} $% \begin{array}{c@{\hspace{.1in}}cc} \includegraphics[width=3.5 in, height=3.5 in]{Pic2.pdf} & % \includegraphics[width=3.5 in, height=3.5 in]{Pic3.pdf} \\ \mbox (c) & \mbox (d)% \end{array}% $% \end{center} \caption{{\small Figures shows the qualitative behaviour of evolution of $\rho_\phi$ versus the scale factor on the log scale for a steep potential $V(\phi)$. The dotted line corresponds to the background (radiation/matter) energy density $\rho_b$. After the overshoot of $\rho_\phi$, field freezes on its potential due to Hubble damping. After the recovery from freezing, field evolution crucially depends upon the nature of steepness. (a) In case of the exponential, field catches up with the background and tracks it for ever. Fig.(b) corresponds to the potential less steep than the exponential function. Fig.(c) exhibits the general feature of scalar field dynamics for a scalar field potential steeper than the exponential potential. Fig.(d) shows evolution of $\rho_\phi$ for the generalized exponential potential (\ref{pot}) which dynamically mimics the exponential behaviour asymptotically. }} \label{evolution} \end{figure} \begin{figure} \begin{center} \includegraphics[width=0.75\textwidth]{Pic4.pdf} \caption{{\small Qualitative picture of the effective potential (\ref{veffnu}). Dark dashed line is the original runaway potential (\ref{pot}); dotted line corresponds to $\hat{\rho_\nu} A(\phi)$. The effective potential has a minimum .}} \label{effpot} \end{center} \end{figure} \section{Late Time Cosmology} \label{lt} \subsection{Basics} In the preceding sections, we have demonstrated that the WI scenario under consideration \cite{Lima:2019yyv,suratna} successfully accounts for the observed baryon asymmetry of the Universe via spontaneous baryogenesis. In what follows we shall focus on the late time behaviour of the field $\phi$ and its role for dark energy. The choice of the potential in Eq. \eqref{pot} was made keeping in mind both the early and the late time evolution. The natural requirement of the post-inflationary field dynamics is that the field does not interfere with the thermal history, a la nucleosynthesis, and the late time evolution is free from initial conditions. The first condition requires a steep field potential, whereas the second asks for a particular type of steepness. In this case, the field is dominant at early post inflationary stages for a very short period of kinetic domination, then the field energy density ($\rho_\phi$), undershoots the background (radiation/matter) pushing the scalar field to freezing regime due to Hubble damping such that $\rho_\phi=const$ and $\phi$ freezes on its potential. Field evolution commences again as the background energy density becomes comparable to $\rho_\phi$. Hereafter, the deciding role is played by the nature of steepness of the field potential. If $n=1$ in Eq.~\eqref{pot} (standard exponential potential), $\rho_\phi$ mimics the background (radiation/matter) dubbed scaling behaviour, see Fig.\ref{evolution}(a). However, in this case, the field potential is less steep than the exponential one (inverse power-law behavior), $\rho_\phi$ gradually approaches the background and finally overtakes it (Fig.\ref{evolution}(b)). On the other hand, if the potential is steeper than the standard exponential ($n>1$), the field energy density would evolve away from the background, pushing the field into the freezing regime again, after the recovery from which, the similar behavior repeats, see Fig.\ref{evolution}(c). This is a general feature of scalar field evolution with potential steeper than the exponential in the FLRW space time. In fact, the post inflationary behaviour of scalar field dynamics is controlled by a field construct, $\Gamma=V_{,\phi\phi} V/ V^2_{, \phi }$, which is 1 for exponential potential, giving rise to constant slope of the potential which is a necessary criteria for scaling solution. Unfortunately, standard exponential potential is not suitable to inflation but the generalized exponential is. It is interesting to emphasize that the class of potentials \eqref{pot} dynamically mimic the exponential behaviour in the asymptotic regime, namely $\Gamma \to 1$, for large values of the field giving rise to a scaling solution which is an attractor of the dynamics\cite{Skugoreva:2019blk}. In this case, the field ultimately comes on the track of the background, see Fig.\ref{evolution}(d). Since the scaling solution is decelerating, we need a mechanism for late time exit from it to acceleration. The simplest way out is provided by adding a cosmological constant to \eqref{pot} or if we want equation of state parameter different from minus one, we can add another exponential piece, $ \exp(-\lambda \phi/M_P), \lambda <\sqrt{2}$ to the original potential such that its impact is felt only at late times. The latter, however, requires enormous amount of fine tuning. Another exit mechanism is provided by the coupling of the field to cold matter~\cite{Lima:2019yyv} which induces a minimum in the potential where the field could settle giving rise to de Sitter solution, which, however, could spoil the matter regime if it happens at earlier times. Again it requires huge amount of fine tuning to ensure that the field recovers from freezing only at late times and then evolves around the minimum. This problem can be circumvented by invoking a coupling of massive neutrino matter to the scalar field. By virtue of the tiny neutrino masses $\mathcal{O}(10^{-2})$ eV, they are relativistic at early times and their coupling to the field vanishes identically (coupling is proportional to the trace of energy momentum tensor of the massive neutrino matter). However, the coupling builds up dynamically at late times as the neutrinos turn non-relativistic, and this induces a minimum in the runaway potential \eqref{pot}, see Fig.\ref{effpot}. In this case, as demonstrated below, the scale of dark energy gets automatically connected to neutrino mass and the needful can be done without resorting to much fine tuning\cite{Geng:2015fla}. The coupling to massive neutrino matter in Einstein frame can be induced by considering the following action\footnote{After the inflation, the coupling of the radiation bath with the scalar field become ineffective, as $Q$ drops very sharply and has no role in latter dynamics (see Fig.~\ref{Qplot}). So to incorporate the neutrino effect we have the action for nonminimal coupling (see \cite{Geng:2015fla} and references therein),}, \begin{figure} \begin{center} \includegraphics[width=0.65\textwidth]{Qplot_1609.pdf} \caption{{\small Evolution of $Q$ with the number of e-folds is plotted in black solid curve, where the solid blue and solid red vertical lines correspond to the onset of kinetic energy domination and radiation domination respectively.}}\label{Qplot} \end{center} \end{figure} \begin{eqnarray} \mathcal{S}=\int d^4x \sqrt{-g}\left[ \frac{M_\mathrm{Pl}^2}{2}R -\frac{1}{2} \partial_\mu \phi \partial^\mu \phi -V(\phi)\right]+ \mathcal{S}_m +\mathcal{S}_r +\mathcal{S}_\nu \left( A^2(\phi) g_{\alpha\beta}, \Psi\nu\right)\, , \label{eq:action1} \label{nuaction} \end{eqnarray} where, $\mathcal{S}_m$ , $\mathcal{S}_r$ and $\mathcal{S}_\nu $ are action for matter part, radiation part and neutrino part respectively. Action \eqref{nuaction} implies direct coupling of field $\phi$ with massive neutrino matter which is reflected in the field evolution equation as well as in the continuity equation for neutrino matter~\cite{DeFelice:2010aj}, \begin{eqnarray} \label{frwconsnu} && \dot\rho_\nu+3H(\rho_\nu+p_\nu)=\frac{A_{,\phi}}{A}\dot\phi(-\rho_\nu+3p_\nu)\equiv \frac{A_{,\phi}}{A}\dot\phi \rho_\nu(3w_\nu-1)\\ && \ddot\phi+3H\dot\phi+V_{,\phi}=\frac{A_{,\phi}}{A}(-\rho_\nu+3p_\nu) \equiv \frac{A_{,\phi}}{A}\rho(3 w_\nu-1), \label{frwfdeqnu} \end{eqnarray} where $w_\nu$ denotes the equation of state parameter for massive neutrino matter. Eqs. (\ref{frwconsnu}) and (\ref{frwfdeqnu}) are obtained by varying the action (\ref{eq:action1}) with respect to $g_{\mu\nu}$). During most of the expansion history, neutrino matter behaves like radiation and their coupling to $\phi$ ($\propto T_\nu=-\rho_\nu+3p_\nu $) vanishes identically; only at late times when neutrinos turn non-relativistic, $w_\nu$ gradually changes from $1/3$ to zero and the coupling picks up non-zero values. We use the following ansatz \cite{Geng:2015fla, Hossain:2014xha} for the neutrino equation of state parameter, \begin{eqnarray} w_\nu (z)= \frac{1}{6}\Bigg\{1+ \tanh\left[\frac{\ln{1+z}-z_{\rm eq}}{z_{\rm dur}}\right]\Bigg\}\, \label{eq: wnu} \end{eqnarray} which interpolates between $1/3$ and $0$; here $z_{\rm eq}$ and $z_{\rm dur}$ are two parameters that determine respectively where and how fast the transition of neutrinos from radiation-like to cold matter like-behavior occur. Also the choice of the transition red-shift, $z_{\rm eq}$ near the matter-radtion equality is reasonable. \begin{figure}[htbp] \begin{center} \includegraphics[width=0.8\textwidth]{rhoall_late_2909.pdf} \caption{{\small Evolution of the energy densities of matter (green), radiation (red), scalar field (black) and massive neutrinos (magenta), as a function of the redshift, in the case of the nonminimally coupled scenario, for $\alpha \gamma = 720$, $z_{\rm eq} = 2.54$ and $z_{\rm dur} = 2.93$ with the initial condition $\rho _{\nu}=10^{-22}\rho _{\rm cr}$ at the end of inflation. Inset shows the oscillations in $\rho _{\nu}$ and scaling behaviour of $\rho _{\phi}$ near the present time.}}\label{rhoall_late} \end{center} \end{figure} As neutrinos turn non-relativistic around the present epoch, massive neutrino matter mimics cold matter ($w_\nu$ gradually vanishes). Assuming $w_\nu=0$, it is convenient to work in terms of $\hat\rho_\nu=A^{-1} \rho_\nu$ which conserves in the Einstein frame, \begin{equation} \dot{\hat\rho}_\nu+3H\hat\rho_\nu=0 \, , \label{wnu1} \end{equation} and the field evolution in the approximation under consideration acquires the following form, \begin{equation} \ddot\phi+3H\dot\phi=-V_{,\phi}-A_{,\phi}\hat\rho_\nu , \label{frwfeqd} \end{equation} which implies effective potential for $\phi$\, , \begin{eqnarray} V_{\rm eff}=V(\phi)+A(\phi)\hat{\rho}_\nu \end{eqnarray} \label{frwfeq}\, . Eq. (\ref{frwfeq}) tells us that, in this case, the effect of coupling is incorporated solely in the effective potential which might be used for rough estimates. It should be noted that in case of coupling to standard cold matter, Eqs. (\ref{wnu1}) and (\ref{frwfeq}) are exact in the matter dominated regime. In case of coupling to massive neutrino matter, these equations are approximate as $\omega_\nu$ is evolving, and for detailed investigations, one should use the set of coupled equations (\ref{frwconsnu}) and (\ref{frwfdeqnu}). Using a specific form of the conformal coupling, we have $A(\phi)=e^{\alpha \gamma \phi/M_\mathrm{Pl}}$ so that \begin{equation} V_{\rm eff} \simeq V(\phi) + \hat{\rho}_{\nu} e^{\alpha \gamma \frac{\phi}{M_\mathrm{Pl}}}; ~\hat{\rho}_\nu=\rho_\nu e^{-\alpha \gamma \phi/M_\mathrm{Pl}} \label{veffnu} \end{equation} We can estimate $V^{\rm min}_{\rm eff}$ to be identified with the dark energy density at the present epoch. For the sake of analytical illustration, we consider the case of $n=1$ in $V(\phi)$, \begin{equation} \phi_{\rm min}=\log \bigg(\frac{V_0}{\gamma\hat{\rho}_\nu}\bigg) ^{1/\alpha(1+\gamma)} \Rightarrow V_{\rm eff}^{\rm min} =\gamma \rho_{\nu {\rm min}}\left( 1+1/\gamma\right), \end{equation} which for a large value of $\gamma$ can be comparable to $\rho_{cr}^0$, the critical energy density for today, \begin{eqnarray} V^{\rm min}_{\rm eff}\simeq \gamma \Omega_{\nu 0}\rho_{cr}^0 \sim \rho_{cr}^0 \Rightarrow \gamma\sim 1/\Omega_{\nu}^0;~~(\Omega_\nu^{0}=0.02 (m_\nu/1eV)) \end{eqnarray} where we identified $\rho_{\nu {\rm min}}$ with $\rho_{\nu}^0$. The rough estimate tells us that $\gamma>>1$ and that not much tuning is required to reconcile $V^{\rm min}_{\rm eff}$ with the dark energy density today. The fixed point for the field dominated solution corresponds to $\omega_\phi^0=-\gamma/(1+\gamma)$ which mimics dark energy for large value of $\gamma$. Obviously, the coupling in Eq.~(\ref{frwconsnu}), $A_{,\phi}/A(\phi)=\alpha\gamma$ is large in this case which turns out to be true for $n>1$ also, in Eq.~(\ref{pot}). Indeed, $\alpha=0.05$ and $n=3$, the values we have chosen are consistent with observational constraints related to inflationary epoch~\cite{aghanim2018planck} in case of generalized exponential potential. Secondly, numerical investigations of post-inflationary dynamics reveal that the consistency with late time cosmic acceleration implies that $ \gamma\simeq 15000$, therefore the coupling is large in the general case also. This explains why the effective potential picture is not exact in case of the coupling to the massive neutrino matter and in this case one needs to deal with the full coupled dynamical system. \subsection{Analysis} The post-inflationary history of Universe is depicted in Fig.\ref{rhoall_late} which shows the evolution of $\rho_\phi$, $\rho_R$, $\rho_m$ and $\rho_\nu$ versus the scale factor on the log scale, where $\rho _{\rm cr}^0$ is the critical energy density at present. The initial conditions for the late time evolution are taken from the onset of kinetic energy domination (KD), which are obtained from the inflationary evolution: $\phi_{\rm ini}^{\rm PI} = \phi \vert _{\rm KD} = 4.14 M_\mathrm{Pl} $ and $\dot{\phi}_{\rm ini}^{\rm PI} = \dot{\phi} \vert _{\rm KD} = 2.04\times 10^{-7} M_\mathrm{Pl} ^2$, where `PI' signifies that these are post-inflationary initial conditions. At the end of inflation, $\rho_\phi$ and $\rho_r$ are within the same order of magnitude ($\frac{\rho_\phi}{\rho_R} \gtrsim 1$) in contrast to the cold inflation where $\frac{ \rho_{\phi}}{\rho_R}\vert _{\rm end}>>1$. Consequently, in the present context, the overshoot of $\rho_\phi$ is small and the freezing regime is short. Soon after the recovery from freezing, the scalar field catches up with the background\footnote{With specific initial conditions, we have in the model after inflation, the ups and down in $\rho_\phi$ shown in Fig.\ref{evolution} are not visible here. } and tracks it till it reaches the minimum of the effective potential where it oscillates and fast approaches the de Sitter state. The evolution of $\rho_\nu$ exhibits an interesting behaviour, especially at late times. Since neutrino matter is relativistic at early stages, $\rho_\nu$ tracks $\rho_R$ for most of the history, only at late stages when neutrinos gradually turn non-relativistic ($\omega_\nu\to 0$), the energy density starts increasing, takes over radiation and becomes constant as the de Sitter regime is reached, see Fig.\ref{rhoall_late}. Indeed, despite the presence of the coupling, $(\rho_\phi+\rho_\nu )$ is conserved and since $\Omega_\nu \omega_\nu<<1$ at the de Sitter, one concludes that $\rho_\nu$ also approaches a constant value around the present epoch. \begin{figure}[t] \begin{center} \includegraphics[width=0.75\textwidth]{wall_late_1609.pdf} \caption{{\small Evolution of the scalar-field equation-of-state parameters in the case of the nonnminimally coupled scalar field with neutrino is shown for $\alpha \gamma = 720$, $z_{\rm eq} = 2.54$ and $z_{\rm dur} = 2.93$ with the initial condition $\rho _{\nu}=10^{-22}\rho _{\rm cr}$ at the end of inflation.}}\label{wall_late} \end{center} \end{figure} \section{Conclusions} \label{conc} In today's era of precision cosmology, theoretically motivated models of the primordial Universe (e.g. models of inflation ) are continuously put to test with the cosmological data. On the other hand, state-of-the-art observational surveys of CMB, large scale structures, gravitational waves and several stellar objects are conferring with exquisite theoretical models to answer some of the persistent questions in contemporary cosmology. In this work, we have constructed a viable warm inflationary scenario, which (i) explains the observed baryon asymmetry via the mechanism of spontaneous baryogenesis during the last few e-folds of inflation and for a short duration thereafter; and (ii) explains late time acceleration using the same scalar field. All through the primordial, post-inflationary and late Universe evolution of our setup, one can identify specific points of high phenomenological relevance:(I) inflationary pivot point ($N=0$); (II) freeze-out of the B-L violating interaction ($T=T_F$); and (III) present epoch ($z=0$). The warm quintessential inflation scenario with late-time non-standard neutrino coupling considered here is subject to several constraints and insights implemented by the observational quantities at these points of evolution. (I) The model of quintessential inflation in the warm setup has the following set of parameters: $n$, $\alpha$ and $V_0$. CMB surveys, such as Planck, constrain the amplitude and scale dependence of scalar and tensor perturbations at the time when a pivot scale $k=0.002$ Mpc$^{-1}$ leaves the inflationary horizon. As explained in the Analysis of Section~\ref{wi1}, with $n=3$, $\alpha = 0.05 $, we could achieve the scalar spectral index $n_s=0.962$ and tensor-to-scalar ratio $r=2.36\times 10^{-5}$, which are within the confidence limit given by Planck 2018: $n_s=0.9649\pm 0.0042$ ($68\%$ confidence limit for the data combination Planck TT,TE,EE +lowE+lensing) and $r < 0.056 $ ($95\%$ confidence limit for the data combination Planck TT,TE,EE +lowE+lensing+BK15). $V_0=2.24\times 10^{15}$ GeV is fixed with $\log (A_s\times 10^{10})=3.03$, which is within $1\sigma$ confidence limit of the observed amplitude $\log (A_s\times 10^{10})=3.044\pm 0.014$ ($68\%$ confidence limit for the data combination Planck TT,TE,EE +lowE+lensing).\\ \begin{figure} \begin{center} \includegraphics[width=0.75\textwidth]{GW_2809.pdf} \caption{{\small Energy density of the gravitational wave spectrum. Sensitivities of present observations and proposed sensitivities of the future detectors are also shown.}}\label{GW} \end{center} \end{figure} (II) In the particular scenario under consideration, the WI paradigm comes to an end when the kinetic energy $\rho _K$ of the inflaton dominates over the potential energy, i.e., the energy hierarchy is $\rho_K>V(\phi)>\rho_R$ and $\epsilon_H=1$. Interestingly, the kinetic energy dominated epoch lasts for a very short period of time ($\sim 1.2$ e-folds) after which radiation domination begins. Thus, the post-inflationary evolution here is very close to the standard evolution. But, since the scalar field takes part in the B-L violating interactions, spontaneous baryogenesis takes place during the end of inflation and freezes out in the post-inflation regime, as is evident from the evolution of $\Gamma _{B-L}$ and $H$ in Fig.~\ref{gammaBLplot}. The parameters that predict the theoretical value for $\eta _F$ are $\lambda '$ and $M$ associated with the coupling of the baryon current to $\dot{\phi}$ in Eq.~\eqref{Leff}, and on $\tilde{g}$, $M_{\chi}$ associated with the $B-L$ violating effective interaction as in Eqs.~\eqref{fourfermiint} and~\eqref{gambl}. The value $\tilde{g}=0.5$ is taken for a standard coupling and $M_{\chi}$ is the characteristic scale of the interaction. The two values of $M_{\chi}$ are chosen such that $M_{\chi}>T_{\rm end}$. Therefore, the $B-L$ violating effective interaction in Eq.~\eqref{fourfermiint} is valid during inflation. $M=10V_0$ is chosen judiciously so that the derivative coupling associated with a spontaneously broken symmetry is valid at the inflationary scale $V_0$. The extremely short kinetic domination epoch along with very small value of the tensor-to-scalar ratio during inflation amount to very feeble relic gravitational waves (GW)$\Omega _{\rm GW}h^2\sim \mathcal{O}(10^{-19})$, which grows for a very small window in frequencies around $f\sim \mathcal{O}(10^8)$ Hz, which can be seen in Fig.~\ref{GW} (see Appendix I for details). (III) Since the scalar field in this case is quintessential in nature with a nonstandard steep potential ($n=3$), the discussion in Sec.~\ref{lt} clarifies that the energy density of the field, $\rho _{\phi}$ tracks the background energy density from the end of kinetic domination until when the coupling with massive neutrinos given in Eqs.~\eqref{frwconsnu} and~\eqref{frwfdeqnu} becomes relevant at late times (see Fig.~\ref{rhoall_late}). As the neutrinos gradually become non-relativistic over a duration of e-folds $z_{\rm dur}$, the coupling to the scalar field velocity $\dot{\phi}$ makes $\rho _{\nu}$ to grow, and eventually settle at a constant value. This behavior of $\rho _{\nu}$ at late times is tracked by $\rho _{\phi}$, which therefore dominates the late-time energy density with $\rho _{\phi}\simeq const.$. The relevant coupling between the scalar field and neutrino sector here is controlled by the parameter $\gamma$ explicitly, and implicitly by $z_{\rm eq}$ and $z_{\rm dur}$. The value $\alpha \gamma =720$ considered here is large, which is explained as a requirement in Sec.~\ref{lt}. The initial conditions for $\phi$ evolutions at late times is obtained from the early Universe evolution, since the initial time for studying the late time cosmology is taken to be at the onset of kinetic domination. The initial neutrino energy density $\rho _{\nu}$ acts as a normalising factor to achieve the correct current densities $\rho _{\nu}^0$ and $\rho _{\phi}^0$. In this work, we have achieved the goal to successfully explain observational signatures of inflation, baryon asymmetry and dark energy density with a model of warm quintessential inflation. Previous well-motivated attempts in baryogenesis from warm inflation were made in Ref.~\cite{branden} with a large-field potential $V(\phi)=\frac{1}{2}m^2\phi ^2$ and in Ref.~\cite{Bastero-Gil:2011clw} via a two-stage mechanism. However, these works did not incorporate quintessence dark energy. On the other hand, quintessential inflation has been studied in the WI paradigm in references~\cite{Lima:2019yyv,Dimopoulos:2019gpz,Rezazadeh:2015dia} for different potentials. Our work attempts to combine these two approaches and successfully leads to a model which is consistent with the spectrum of primordial density perturbations, baryon asymmetry and present day acceleration as determined from observations. \section*{Acknowledgement} S.~Bhattacharya is supported by the National Postdoctoral Fellowship of the Science and Engineering Research Board (SERB), Department of Science and Technology (DST), Government of India (GOI). Work of MRG is supported by Department of Science and Technology(DST), Government of India under the Grant Agreement number IF18-PH-228 (INSPIRE Faculty Award) and partially by Science and Engineering Research Board (SERB), DST, Government of India under the Grant Agreement number CRG/2020/004347 (Core Research Grant). MS is partially supported by the Ministry of Education and Science of the Republic of Kazakhstan, Grant No. 0118RK00935 and by NASI-Senior Scientist Platinum Jubilee Fellowship (2021). The authors sincerely thank Prof. Mar Bastero-Gil and Prof. Rudnei Ramos for useful discussions regarding this work. MRG wants to thank Amogh K. Rai for help during the draft formatting. NJ is thank-full to Richa Arya, Wali Hossain and Arvind Mishra for fruitful discussions. \section*{Appendix I: Relic Gravitational Waves} \label{appendI} Gravitational Waves (GWs) originate during inflation from the metric perturbations of the perturbed spatially flat FLRW Universe $ds^2= -dt^2 +a(t)^2\left( \delta_{ij} +h_{ij}\right) dx^i dx^j$, where the tensor perturbations $h_{ij}$ are transverse ($ \partial_i h_{ij}=0 $) and trace-less condition ($h_{ii}=0$). The GW spectrum is defined as \\ \begin{eqnarray} \Omega_ {GW}(k, \tau)\equiv \frac{1}{\rho_{\rm cr} (\tau)}\frac{d \rho_{\rm GW}}{d\ln k}\, , \label{omegagw1} \end{eqnarray} where $\rho_{\rm GW}$ is the gravitational wave energy density and $\tau $ is the conformal time. Eq. \eqref{omegagw1} can be written for today as \cite{Ahmad:2019jbm, Figueroa:2018twl} \begin{eqnarray} \Omega_{\rm GW,0}=\frac{1}{12}\left( \frac{k^2}{H_0^2 a_0^2}\right) \Delta_T^2 (k) T^2 (k,\tau)\, , \end{eqnarray} where $\Delta_T^2 (k)= \left. \frac{2}{\pi^2} \frac{H_{\rm inf}^2}{M_\mathrm{Pl}^2}\right |_{k=aH}$ is the primordial tensor power spectrum at horizon crossing of the mode $k$ during inflation and $T^2 (k,\eta)$ is the transfer function. The transfer function describes the gradual evolution of GWs from the point of horizon entry of a mode $k$ in the post-inflationary Universe until the time $\tau$ of observation. The transfer function today ($\tau = \tau _0$) is given as \cite{Kuroyanagi:2008ye,Boyle:2005se,Watanabe:2006qe} \begin{eqnarray} T^2(k)\approx \frac{1}{2} \frac{a_{\rm hc}^2}{a_0^2}\, , \label{TansferK} \end{eqnarray} where the subscript $ ``0"$ denotes present time and $``\rm hc"$ represents horizon crossing after inflation. The GW spectrum today for modes entering at different post-inflationary epochs of kinetic domination (KD), radiation domination (RD) and matter domination (MD) can be written as \cite{Ahmad:2019jbm, Figueroa:2018twl}: \begin{eqnarray} \label{omgwrd} \Omega_{\rm GW}^{\rm RD, 0}(k)&=& \frac{1}{6 \pi^2} \Omega_{\rm R}^0 \frac{H_{\rm inf} ^2}{M_\mathrm{Pl}^2}\left(\frac{g_{*}(a_k)}{g_{*0}}\right) \left(\frac{g_{*,s}(a_k)}{g_{*,s0}}\right)^{-4/3}~ ~ {\rm for}(k_{\rm RM}<k<k_{\rm KR})\\ \label{omgwkd} \Omega_{\rm GW}^{\rm KD, 0}(k)&=& \tilde{\Gamma}(\alpha _w) \Omega_{\rm GW}^{\rm RD, 0} \frac{a_kH_k}{a_{\rm KR}H_{\rm KR}}~ ~ ~ ~ ~ ~ ~ ~ {\rm for}(k > k_{\rm KR})\\ \label{omgwmd} \Omega_{\rm GW}^{\rm MD, 0}(k)&=& \frac{1}{6 \pi^2} \Omega_{\rm m}^0 \frac{H_{\rm inf} ^2}{M_\mathrm{Pl}^2}~ \frac{H_0^2}{a_k^2H_k^2} ~ ~ ~ ~ ~ ~ ~ ~{\rm for}(k < k_{\rm RM}). \end{eqnarray} Here, the subscript `$k$' signifies quantities computed at the horizon entry of the mode $k=a_kH_k$, the subscript `KR' signifies quantities evaluated at the transition from KD to RD, `RM' implies the mode at matter-radiation equality. $\Omega _R^0$ and $\Omega _m^0$ are the dimensionless energy densities for radiation and matter at present. The quantity $\tilde{\Gamma}(\alpha _w)\equiv \bigg( \frac{\Gamma (\alpha _w +1/2)}{\Gamma (3/2)}\bigg)^2\frac{1}{2^{2-\alpha _w}\alpha _w ^{2\alpha _w}}\sim \mathcal{O}(1)$ is introduced for gradual transition from KD to RD epoch~\cite{Figueroa:2018twl}, where $\alpha _w\equiv\frac{2}{1+3w}\vert_{w=1}=1/2$. The Hubble parameter after inflation is always computed here using \begin{equation} 3H^2M_\mathrm{Pl} ^2 = \rho _{\phi} + \rho _R + \rho _m + \rho _{\nu}, \end{equation} where each of the quantities are discussed in Sec.s~\ref{wi1},~\ref{sbar} and~\ref{lt}, and evaluated throughout cosmological evolution. It is evident from the Eqs.~\eqref{omgwrd},~\eqref{omgwkd} and~\eqref{omgwmd} that for a nearly constant $H_{\rm inf}$, as is the case in this work, the GW energy spectrum for RD is nearly constant for the range $k_{\rm RM} - k_{\rm KR}$, whereas the GW spectrum has a blue-tilt for the modes entering in the KD epoch and a red-tilt for the modes entering in the MD epoch(A detailed study of the GW production in case of warm inflation can be found in the references~\cite{mrgsarma, mbggw}). The full spectrum is shown in Fig.~\ref{GW}, where the frequencies are calculated as $f=2\pi k$ and the sensitivity curves for present and upcoming observations are also shown\footnote{Plotted using \href{gwplotter}{http://gwplotter.com/} based on Ref.~\cite{Moore:2014lga}.}. We find that the full GW spectrum for the scenario considered in this work stays much smaller than the present and future observational sensitivity curves owing to the small value of the tensor-to-scalar ratio $r\sim \mathcal{O}(10^{-5})$ at the pivot scale, since $\Delta _T^2\equiv r\Delta _S^2 = \frac{2}{\pi ^2}\frac{H_{\rm inf}^2}{M_\mathrm{Pl}^2}$, where $\Delta _S^2$ is the inflationary scalar power spectrum.
\section{Introduction} Machine learning techniques are increasingly being used to make consequential decisions in the real world \citep{KonigCausal2021}. At the same time, research has shown machine learning algorithms are capable of learning unethical biases \citep{CaliskanSemantics2017}. These two trends have lead researchers to begin to examine machine learning techniques that are intelligible to the human decision makers that are using them, so they can ensure decisions are made in a fair way. Counterfactual explanations are a popular approach to intelligible machine learning \citep{VermaCounter2020}. The general approach to these explanations is coming up with a systematic way to determine how a machine learning algorithm would have behaved given a different input. A virtue of this type of explanation is that it allows people who have received a negative evaluation by an algorithm to understand what a successful applicant would look like. Algorithmic recourse is an extension of counterfactual explanations that seeks to make action recommendations that would allow an applicant to improve their negative evaluation. One approach to algorithmic recourse is using nearest counterfactual explanations, which involves finding the closest example that would have produced the desirable outcome and recommending making changes to the feature vector to make it resemble the nearest counterfactual example. This is often set up as the optimization problem (1) below \citep{KarimiRecourse2021}. \begin{align} &\delta^{*} \: \epsilon \: \underset{\delta}{ \text{argmin}} \: cost({\delta}; x^F) \\ & s.t. \nonumber \\ & h(x^{CFE}) > t, \nonumber \\ & x^{CFE} = x^{F} + \delta, \nonumber \\ & x^{CFE} \: \epsilon \: P, \nonumber \\ & \delta \: \epsilon \: F, \nonumber \\ \nonumber \end{align} The intuition behind the optimization is that we are tying to recommend the lowest cost action, $\delta^{*}$, that if it were taken would cause the agent's current feature values to shift to a point where the outcome of the machine learning model would be beyond some threshold, t. The cost function for an agent taking an action $\delta$ while at a current feature value $x^F$ is given by $cost({\delta}; x^F)$. The value of the agent's features after taking action $\delta^{*}$ is denoted by the counterfactual explanation feature vector, $x^{CFE}$. The value of the machine learning model at some feature vector $x$ is given by $h(x)$. An agent often has only a limited number of actions it can take. For example, it may not be feasible for a loan applicant to increase their savings by more than $10\%$ to change a model's outcome from likely default to unlikely default. The set of feasible actions are denoted by the set $F$. $P$ is a related set that denotes the set of all feature vectors that are actually possible for an agent to achieve. For example, this set will not contain any feature vectors whereby the agent has a different height. \section{Single vs multi-agent recourse} Frequently implicit in the literature on nearest counterfactual explanations and algorithmic recourse is the assumption that we only need to take into account the effect an agent's actions have on their own model evaluation \citep{KarimiSurvey2020}. In the real world, a benevolent decision making entity would likely be concerned with the effects of an agent's actions on all of the agents it's advising. In strategic environments, an individual's utility often depends on its own actions and the actions of other agents. Therefore, recommended actions that are are optimal from an individual agent's perspective may not be optimal when considered from a multi-agent perspective. The following example, based on the classic strategic game the prisoner's dilemma, is illustrative of the problems that can arise when using recourse techniques based on a single-agent perspective. Assume an entity is advising two agents on how to reduce their current prison sentence. Each agent has the option to collaborate with the police and betray the other agent or remain silent and refuse to collaborate. The sentence reductions for each agent are a function of both their own action and the action of the other agent and are given by table 1. Assume the entity has models $h_{1}$ and $h_{2}$ that perfectly predict the payoffs given in the table below for agents one and two respectively. \begin{table}[h!] \begin{center} \caption{\label{tab:table 1} Payoff matrix for prisoner's dilemma example.} \renewcommand\arraystretch{1.3} \begin{tabular}{cccc} \mcc{} & \mcc{Agent 2} \\ \cline{2-4} & & Betray (1) & Silent (0) \\ \cline{2-4} \multirow{2}{*}{Agent 1} & Betray (1) & 3.5,3.5 & 10,1 \\ \cline{2-4} & Silent (0) & 1,10 & 5,5 \\ \cline{2-4} \end{tabular} \end{center} \end{table} Assume that agent one comes to the entity and notes it's current sentence reduction is given by $h_{1}(x^{F} = [0, 1]) = 1$ years. $P = \{[0, 0], [1, 0], [0, 1], [1, 1]\}$ and $F = \{[1, 0], [0,0]\}$. In this example, the optimal recourse according to the nearest counterfactual explanation is $\delta^{*} = [1, 0]$. The new predicted payoff for agent one is $h_{1}([1, 1]) = 3.5$. The goal of recourse for that agent has been achieved. There are two additional facts to note. $h_{2}$ has gone from 10 to 3.5 on the new input $x^ {CFE} = [1,1]$. Furthermore, $h_{1}(x^{CFE}) + h_{2}(x^ {CFE}) = 7 < h_{1}(x^{F}) + h_{2}(x^{F}) = 11$. The algorithmic recourse recommendation has made agent two worse off and decreased the sum of benefits to both agents. Now consider the alternate case where agent one comes to the entity and notes it's current sentence reduction is given by $h_{1}(x^{F} = [0, 0]) = 5$ The recourse recommendation that improves agent one's outcome is $\delta^{*} = [1, 0]$ As before, this recommendation makes agent two worse off. Unlike the previous case, the amount it makes agent agent one better off is greater than the amount it makes agent two worse off, so the group is better off. The above examples illustrates inherent trade-offs that must be considered when making recourse recommendations in strategic situations where an agent's outcome depends on her actions and those of other agents. An ethically ideal recommended action would improve the prediction of the agent being advised (principle agent), not worsen the prediction for any other agent, and increase the sum of the predictions for all of the agents. The latter two properties are known in game theory as Pareto efficiency and social welfare efficiency \citep{TadelisGame2013}. When considering the single agent environment, any action that achieves one must trivially satisfy all three. However, when there are at least two agents, an action that achieves one goal can fail to achieve one or both of the other two. Our work is not the first to examine recourse from a multi-agent perspective. \citet{RawalBeyond2020} propose a framework for multi-agent recourse but do not incorporate causal relationships between features when making recommendations. Furthermore, although they take into account that recourse recommendations might perform differently for different subgroups , they don't address the idea that an agent acting on a recommendation might affect another agent's model outcome. \section{Counterfactual identification} In order to make a multi-agent recourse recommendation, the effect of the recommendation on the predictions for all the agents must be known. Causal and counterfactual knowledge of this kind can be encoded as a structural causal model M and a corresponding causal graph $G_{M}$\citep{PearlCause2009}. M = <F, X, U> is a three tuple of endogenous variables X, exogenous variables U, and a set of structural equations $F = \{f_{1},..., f_{|X|}\}$ that determine how values are assigned to the endogenous variables. In the directed causal graph $G_{M}$, there is a node for every exogenous and endogenous variable. An edge connects a node $n_{i}$ to $n_{j}$ if and only if the variable corresponding to no $n_{i}$ appears as an argument in the function $f_{j}$ which assigns values to the variable corresponding to $n_{j}$. Counterfactual statements can be represented using do-operations of the form $do(X_{i} := k)$. A do-operation transforms M to $M_{A}$ by assigning k to $X_{i}$ instead of assigning it the value of $f_{i}$. The corresponding causal graph $G_{M_{A}}$ is identical to G but with the incoming edges to the node corresponding to $X_{i}$ removed. Recommended actions can be interpreted as a set of do-interventions $A = do(\{X_{i} := a_{i}\}_{i \epsilon I})$. Assuming no hidden confounders and an invertible F, any X can be uniquely determined given any U and vice versa. Hence any structural counterfactual query can be computed in the following way $x^{SCF} = F_{A}( F^{-1}(x^{F}))$ \citep{KarimiRecourse2021}. The prisoner's dilemma example can be stated as the following structural causal model. $M = <F, X, U>$ where $X = \{h_{1}, h_{2}\}$, $U = \{x_{1}, x_{2} \}$, $F= \{ f_{1}, f_{2}\}$, and \[ f_{i}(x_{i}, x_{j})= \begin{cases} 1 & \text{if} \: x_i = 0, x_j = 1 \\ 3.5 & \text{if} \: x_i = 1, x_j = 1 \\ 5 & \text{if} \: x_i = 0, x_j = 0 \\ 10 & \text{if} \: x_i = 1, x_j = 0 \\ \end{cases} \] The corresponding causal graph $G_{M}$ is depicted in figure 1. \begin{center} \begin{tikzpicture}[main/.style = {draw, circle}, node distance=4cm] \node[main] (1) {$x_1$}; \node[main] (2) [right of=1] {$x_2$}; \node[main] (3) [ below of =1] {$h_1$}; \node[main] (4) [ below of =2] {$h_2$}; \draw[->] (1) -- (3); \draw[->] (1) -- (4); \draw[->] (2) -- (3); \draw[->] (2) -- (4); \end{tikzpicture} \end{center} \begin{figure} \begin{center} \caption{\label{fig:figure 1}Figure 1: The causal graph corresponding to the prisoner's dilemma example.} \end{center} \end{figure} Learning causal graphs from data is currently an open area of research \citep{DemlStructure2018}. Although progress has been made in recent years, the difficulty of learning a causal graph or structural causal model from data is a serious limitation on any approach to recourse, such as ours, that assumes this knowledge. \section{Problem reformulation} Below we present three different algorithmic recourse optimization problems: single agent efficient, social welfare efficient, and Pareto efficient. Each problems corresponds to a different desirable ethical property that the recommendation should have. \subsection{Single agent efficient recourse} \citet{KarimiRecourse2021} showed that incorporating causal models was necessary for making accurate recourse commendations in the case of single agent recommendations. They restate the problem of making recourse recommendations as one of making minimal interventions as follows. \begin{align} & a^{*} \: \epsilon \: \underset{a \epsilon A}{ \text{argmin}} \: cost_{i}(a; x^F) \\ & s.t. \nonumber \\ & h_{i}(x^{SCF, a}) \geq t, \nonumber \\ & x^{SCF, a} = F_{a}(F^{-1}(x^F)), \nonumber \\ & x^{SCF, a} \: \epsilon \: P, \nonumber \\ \nonumber \end{align} The intuition behind the problem is that we are trying to recommend an action a that minimizes agent i's cost function while meeting a set of constraints that ensure action a changes the feature vector to one that causes the model predicting agent i's outcome, $h_{i}$, to exceed some threshold, t. The new feature vector is the structural counterfactual outcome and denoted $ x^{SCF}$. As before, $P$ is set of plausible actions. This is the correct statement of the problem when the goal is to maximize the outcome for the principle agent. \subsection{Social welfare efficient recourse} In the case that the entity wants to recommend an action that increases the sum of the predictions for the N-agents it advises, the following is the correct optimization problem. \begin{align} & a^{*} \: \epsilon \: \underset{a \epsilon A}{ \text{argmin}} \: cost_{i}(a; x^F) \\ & s.t. \nonumber \\ & \sum_{j=1}^N h_{j}(x^{SCF}) > \sum_{j=1}^N h_{j}(x^{F}) , \nonumber \\ & x^{CFE, a} = F_{a}(F^{-1}(x^F)), \nonumber \\ & x^{CFE, a} \: \epsilon \: P_{i}, \nonumber \\ \nonumber \end{align} An alternate variation is one where the sum of the predictions isn't decreasing and first constraint isn't strict. \subsection{Pareto efficient Recourse} In the case that the entity wants to recommend an action that makes none of the N agents the entity advises worse off, the following is the correct optimization problem. \begin{align} & a^{*} \: \epsilon \: \underset{a \epsilon A}{ \text{argmin}} \: cost_{i}(a; x^F) \\ & s.t. \nonumber \\ & \forall j \: \epsilon \: N, h_{j}(x^{SCF}) \geq h_{j}(x^{F}) , \nonumber \\ & x^{CFE, a} = F_{a}(F^{-1}(x^F)), \nonumber \\ & x^{CFE} \: \epsilon \: P_{i}, \nonumber \\ \nonumber \end{align} The inequality constraints from 2-4 can be combined. For example, an institution might find it ethically desirable to recommend actions that make agent i strictly better off but make no other agent worse off or the group no worse off. \section{Experimental results} We tested the effects of our multi-agent optimization using experimental data from \citet{BoCoop2005}. B\'o ran an experiment testing players' strategies in a simulation of an iterated prisoner's dilemma with infinite rounds. The iterated prisoner's dilemma is a multi-round variant of the prisoner's dilemma whereby a player's outcome is the sum of their outcomes in the individual rounds of the game. In his experiment, he split players into a test and control group. The test group, designed to simulate infinite play, would have each game consist of an initial round and then an unknown number of additional rounds where each additional round had a probability $\delta$ of occurring. $\delta$ was set to 0, 1/2, or 3/4. The corresponding control group players played a fixed number of games. The fixed number was set to either 1 game if it was a control for $\delta = 0$ , 2 games for $\delta = 1/2$, or 4 games for $\delta = 3/4$, thus ensuring the control and test group played the same number of games on average. Test games with $\delta$ equal to 0 and control games with one round are equivalent to the single round prisoner's dilemma from section 2. 3294 games met one these criterion. Participants were paid an amount proportional to the number of the points they won in the game. Two different pay-off matrices were used during the game and are displayed below. \begin{table}[hbt!] \begin{center} \caption{\label{tab:table 2} First payoff matrix used in experiments from \citet{BoCoop2005}.} \renewcommand\arraystretch{1.3} \begin{tabular}{cccc} \mcc{} & \mcc{Agent 2} \\ \cline{2-4} & & Betray (1) & Silent (0) \\ \cline{2-4} \multirow{2}{*}{Agent 1} & Betray (1) & 35,35 & 100,10 \\ \cline{2-4} & Silent (0) & 10,100 & 65,65 \\ \cline{2-4} \end{tabular} \end{center} \end{table} \begin{table} \begin{center} \caption{\label{tab:table 3} Second payoff matrix used in experiments from \citet{BoCoop2005}.} \renewcommand\arraystretch{1.3} \begin{tabular}{cccc} \mcc{} & \mcc{Agent 2} \\ \cline{2-4} & & Betray (1) & Silent (0) \\ \cline{2-4} \multirow{2}{*}{Agent 1} & Betray (1) & 45,45 & 100,10 \\ \cline{2-4} & Silent (0) & 10,100 & 75,75 \\ \cline{2-4} \end{tabular} \end{center} \end{table} We examined the effects of recommendations made using single-agent optimization constrains. Of the recommendations made for the 3294 single-round prisoner's dilemma games, 434 recommendations resulted in an improvement for the principle agent as well as both a loss in social welfare and a violation of Pareto efficiency. No recommendations resulted in either social welfare or the opposing player improving. When either Pareto efficient or social welfare efficient constraints were added or just Pareto efficient constraints were considered alone, no recommendations were made at all because no action can improve the principle agent while improving social welfare or not harming the other player. Therefore, optimization setups from our framework would have prevented significant third party harm when compared with single agent recourse recommendations. When recommendations were made with just social welfare constraints, 2860 recommendations resulted in both an increase in social welfare and a decrease in the principle agent's welfare. None of the recommendations resulted in an increase in the principle agent's welfare. This result highlights a pressing ethical dilemma that previous work using the single agent framework obscured, whether or not to advise the principle agent to do something that makes it worse off because it makes the group better off. It is important that the artificial intelligence community develops a consensus on how to handle dilemmas such as this. \section{Discussion and future work} As machine learning models become increasingly important to organizational decision making, the need for realistically understanding the effects of those decisions will grow. Furthermore, the demand will grow to ensure machine learning powered decision making takes into account its effects on all stakeholders. Pareto superior and social welfare efficient constraints when making recourse recommendations are a step towards this inclusive style of machine learning based decision making. This paper provided both theoretical and empirical support for the argument that an inherent trade off exists between making recourse recommendations that are good for the group and recommendations that are good for the principle agent. In the future, comparing how these different approaches to recourse recommendations perform on additional real world data sets could demonstrate concrete benefits to this line of research. For example, companies such as Apple, Google, and Waze offer GPS services make route recommendations to many drivers simultaneously. The time it takes a driver to reach its destination is in part a function of the other drivers on the road. It is established that certain network configurations can result in a prisoner's dilemma whereby individual drivers taking the fastest route makes all of the drivers worse off \citep{NisanAlg2007}. There is evidence that this phenomenon is currently contributing to traffic congestion in the real world \citep{CabannesImpact2018}. A GPS application making recommendations in a traffic network may have to choose between making recommendations that are single agent optimal, social welfare efficient, or Pareto efficient. To the best of the authors' knowledge, no major GPS company has addressed this problem in the literature or otherwise. Our work can have an immediate impact on real world recourse problems such as this. Finally, other ethical constraints in addition to Pareto efficiency and social welfare efficiency should be explored. \bibliographystyle{unsrtnat}
\section{Introduction} \label{sec:intro} Neutron star low-mass X-ray binaries (LMXBs) contain a neutron star primary accreting through a disk from a $\lesssim 1 M_\odot$ secondary, which can be a low-mass main sequence star, an evolved star, or a degenerate star such as a white dwarf. Neutron star LMXBs are enormously overabundant (by a factor of $\sim 100$) in globular clusters, where they form dynamically due to the high stellar densities (e.g., \citealt{Clark75,Katz75,Ivanova08}). The observed neutron star LMXBs in Galactic globular clusters include both persistent and transient sources \citep{Bahramian14,vandenBerg20}. The former are always X-ray luminous ($L_X \gtrsim 10^{35}$ erg s$^{-1}$), due to their high companion mass transfer rates, which keep the disk consistently in a hot, ionized state. The transient sources tend to have lower mass transfer rates from the secondary. This leads to the standard accretion disk ionization instability in which the disk alternates between a cool state with little accretion onto the neutron star (``quiescence") and a hot ``outbursting" state with substantial accretion \citep{Smak84,vanParadijs96,Lasota01}. Since neutron stars have surfaces, it should be possible to trace the details of the accretion flow from the secondary to the disk, and thence as material accretes onto the neutron star, with some being ejected in an outflow or jet. X-ray observations primarily probe the inner regions of the accretion flow as well as the neutron star surface, while radio continuum data trace synchrotron emission associated with the outflow/jet. Although extensive radio and X-ray observations have been made to constrain jet and accretion disk properties of all accreting compact objects (e.g., \citealt{Merloni03,Migliari06,Gallo18,Coppejans20,vandenEijnden21}), existing studies are biased towards black holes. Newly discovered transient X-ray sources in the field that can be accurately classified tend to be black holes rather than neutron stars, as black holes are on average brighter in the X-ray and far more radio-loud than neutron stars at nearly all accretion rates (e.g., \citealt{Corbel00,Migliari06,Tudor17,Gallo18}), with the caveat that some black holes and neutron stars deviate from this typical behavior (e.g., \citealt{Coriat11,Migliari11,Rushton16,Tudor17, Russell18, vandenEijnden18, Gusinskaia20b}). Despite the challenge, radio continuum studies of neutron stars are needed: there is a broad range of physical properties that are likely to affect the outflows/jets from these sources (such as their spin frequencies and surface magnetic field strengths), and there is strong observational evidence that accreting neutron stars show a greater variety of radio properties than accreting black holes (e.g., \citealt{Migliari11,Tudor17,Gusinskaia17,vandenEijnden21}). One difficulty in studying field LMXBs is that their distances are generally unknown or poorly constrained \citep{Jonker04}, limiting the ability to draw accurate conclusions about the physics of the accretion. For example, distances inferred from X-ray bursts can have substantial systematic uncertainties (e.g., \citealt{Galloway08b}), and some ultracompact neutron star LMXBs do not show X-ray bursts at all. This issue is ameliorated in globular clusters, which have well-determined distances as well as a substantial population of neutron star LMXBs. Here we present a radio and X-ray study of a sample of neutron star X-ray binary systems in Galactic globular clusters, focusing on eight luminous systems. In Section 2, we discuss the sample and observations. We use radio data from the Karl G. Jansky Very Large Array (VLA) or Australia Telescope Compact Array (ATCA) and we use X-ray data from {Swift/X-Ray Telescope} (Swift/XRT) and the {Chandra X-ray Telescope} ({Chandra}). In Section 3, we consider the results from individual sources. We present discussion and a summary in Sections 4 and 5, respectively. \section{Observational Data} \subsection{Our Sample} Our sample includes all of the luminous ($L_X > 10^{34}$ erg s$^{-1}$) persistent LMXBs from the MAVERIC (Milky Way ATCA and VLA Exploration of Radio-sources in Clusters) radio continuum survey of 50 Galactic globular clusters (\citealt{Tremou18,Shishkovsky20}, Tudor et al.~2021, in prep). This survey includes all of the nearest ($\lesssim$ 9 kpc) massive ($\gtrsim 10^5$ M$_{\odot}$) clusters. The persistent LMXBs included in this study are: 4U 1746--37 (NGC 6441); 4U 1820--30 (NGC 6624); XB 1832--330 (NGC 6652); X1850--087 (NGC 6712); and AC 211 and M15 X-2 (M15). These represent 6 of the 8 persistent globular cluster sources known, excluding only 4U 0513--40 (NGC 1851; \citealt{Zurek09}) and 4U 1722--30 (Terzan 2; \citealt{intZand07}) as their host clusters are not in MAVERIC and have no deep ATCA or VLA data. To this initial sample we also add two other luminous transient sources. The first is GRS 1747--312 (Terzan 6), which shows approximately biannual outbursts \citep{Pavlinsky94,intZand03a}. The other is M15 X-3, an X-ray transient with limited existing studies of its radio properties \citep{Heinke09b,Strader12b} and one of two globular cluster LMXBs that has been observed at $L_X \sim 10^{34}$ erg s$^{-1}$ over timescales of years (the other is N6652B; \citealt{Paduano21}). Other known bright X-ray transients in globular clusters were either not in outburst during our observations or were not in the original MAVERIC data release. For all sources we assume the cluster distances from \citet{Tremou18}. \subsection{Radio Observations} The radio continuum data used in this paper come primarily, though not entirely, from the MAVERIC survey. Observations for the survey were obtained with ATCA or the VLA, depending on the declination of the source. Three clusters in this paper have ATCA data: NGC 6441, NGC 6624, and Terzan 6. The ATCA observations are discussed in detail in \citet{Tremou18} and Tudor et al.~(2021, in prep). In brief, for each of these clusters, the observations were made in April 2015 in the extended 6 km configuration. Data were taken in two basebands centered at 5.5 and 9.0 GHz, each with 2 GHz of bandwidth. These data were flagged and calibrated in Miriad \citep{Sault95} and imaged in CASA (Common Astronomy Software Applications; \citealt{McMullin07}), resulting in median synthesized beams of $\sim2$--$3\arcsec$, depending on frequency. Four of the clusters we study in this work have VLA data: M15, NGC 6652, NGC 6712, and Terzan 6 (which also has ATCA data). M15 was observed in 2011 during an brightening/flaring event of M15 X-2, prior to the official start of MAVERIC but with similar observing frequencies and depth. The M15 data were calibrated and imaged in AIPS (Astronomical Image Processing System; \citealt{Greisen03}) and CASA. Additional data reduction details for M15 can be found in \citet{Strader12}. NGC 6712 was observed as part of the initial MAVERIC VLA program in 2014, with deep C band observations imaged at central frequencies of 5.0 and 7.4 GHz, and calibrated and imaged in AIPS \citep{Shishkovsky20}. The 2018 Terzan 6 data were obtained as part of the final tranche of MAVERIC VLA observations (program 18A-081, PI: Shishkovsky). These observations were made from 2018 March 25 to June 3 in five separate 1 or 2-hr blocks observed when the VLA was in its most extended A configuration. Data were taken in two 2 GHz basebands with 3-bit receivers, with central frequencies of 5.0 and 7.1 GHz after flagging. These data were calibrated and imaged in AIPS, resulting in a typical synthesized beam of $\sim 1.1\arcsec \times 0.4\arcsec$. Finally, NGC 6652 was observed in May 2017 as part of a MAVERIC follow-up program to study the transitional millisecond pulsar candidate N6652B with joint {Chandra} and VLA data (program SI0399, PI: Tudor; see \citealt{Paduano21} for the analysis of N6652B). The VLA observations consist of a single $\sim 2.5$ hr block in C configuration at X band, using 3-bit receivers and two 2 GHz basebands centered at 9.0 and 11.0 GHz. The data were flagged, calibrated, and imaged in CASA. The synthesized beam at the average frequency of 10 GHz was $5.3\arcsec \times 2.1\arcsec$. The observation times and 5.0 GHz flux densities (or upper limits) for all sources with accompanying X-ray measurements are listed in Table \ref{tab:quasisim}, and each source is discussed in detail in Section 3. For the ATCA observations, which are centered at 5.5 GHz rather than 5.0 GHz, we infer the 5.0 GHz density from the 5.5 GHz flux density and the the measured (or assumed) spectral index between 5.5 and 9.0 GHz. We give the details of the calculation for each source in the appropriate subsection. All radio flux densities were measured by fitting the appropriate point source models to the individual images. Unless otherwise stated, the radio continuum flux density measurements list $1\sigma$ uncertainties (including a minimum 1\% systematic uncertainty), and upper limits are given at the $3\sigma$ level, where $\sigma$ for the upper limits is measured as the root mean square noise in the local region around the source. Radio spectral indices or limits were determined using the Bayesian fitting method described in \citet{Shishkovsky20}. Representative radio continuum images for each source are shown in the Appendix in Figures \ref{fig:fim1} and \ref{fig:fim2}. \subsection{X-ray Observations} A key aspect of the MAVERIC survey was obtaining X-ray observations close in time to at least one radio observing block for each cluster, allowing for close-to-simultaneous radio and X-ray measurements for more luminous sources. For clarity, we define ``strictly simultaneous" measurements to be those for which the X-ray and radio data at least partially overlap in time (typically the radio observations last longer). We take ``quasi-simultaneous" observations to be those without overlapping data, but with an offset between the X-ray and radio data of $\lesssim 2$ d. The simultaneous X-ray measurements for most globular clusters in this paper come from Swift/XRT, excepting M15 and NGC 6652, which are from {Chandra}. {Chandra} can resolve individual sources even in dense clusters. By contrast, individual sources are not typically well-resolved in Swift/XRT data, but all of the targets in our observations are sufficiently X-ray luminous that they dominate the cluster emission, and hence any Swift/XRT counts can be ascribed to the targets of interest. We analyzed all Swift/XRT\ \citep{Gehrels04, Burrows05} and Chandra\ observations of our sample that were taken close to (or simultaneously with) radio observations of these targets. These observations are listed in Table \ref{tab:quasisim}. The Swift/XRT observations were all made in Photon Counting mode. Unless otherwise stated, all reported X-ray fluxes and luminosities are in the 1--10 keV band, and all X-ray parameter uncertainties are at the 90\% confidence level. All Swift/XRT\ observations were reduced and analyzed using \textsc{Heasoft}\footnote{\url{https://heasarc.gsfc.nasa.gov/docs/software/lheasoft/}} \citep[version 6.25,][]{HEASARC14}. We reprocessed XRT data using \texttt{xrtpipeline}, and extracted spectra with \texttt{xselect}, following standard procedures.\footnote{ \url{https://www.swift.ac.uk/analysis/xrt/}} For observations where the observed source count rate was high enough to cause pileup, we followed the recommended methods to estimate and exclude the piled up region.\footnote{\url{https://www.swift.ac.uk/analysis/xrt/pileup.php}} We also reduced and analyzed the Chandra\ data fitting our simultaneity criteria using \textsc{CIAO} 4.10 with CalDB 4.7.4 \citep{Fruscione06}. These data include Chandra/ACIS-S data for NGC 6652 (Obs. ID 18987) and Chandra/HRC data for M15 (Obs. ID 13420). NGC 6652 is the host cluster to XB~1832--330. Observed with a subarray on the ACIS-S S3 chip, XB~1832--330 is likely piled up in this observation. We extracted spectra from the source point spread function and modeled the pileup using the model produced by \citet{Davis01}. For this model we froze the frame time to 0.4s (based on the subarray mode used), the maximum number of photons considered for pileup in a single frame (\texttt{max\_ph}) to 5, grade correction to 1, pileup PSF fraction to 0.95, and left grade migration ($\alpha$) variable. To complement this analysis, we also modeled the faint, un-piled up readout streak from XB 1832--330 that is also present in this observation. This streak has a relatively low signal-to-noise ratio and so does not offer a precise independent spectral constraint. Nonetheless, analysis of the streak gave a consistent result. This source is discussed in more detail in Section 3.3. \begin{figure*}[!ht] \centering \includegraphics[width=1.0\textwidth]{figures/piss_and_vinegar.pdf} \caption{ Radio luminosity (at 5.0 GHz) vs.~X-ray luminosity (1--10 keV) for accreting black hole and neutron star low-mass X-ray binaries, adapted from the compilation of \citet{Bahramian18}. Only sources with simultaneous or quasi-simultaneous data are plotted. The globular cluster sources from this paper are represented as large crosses (the letter ``X"); those with multiple points are sources with more than one quasi-simultaneous data point. For clarity, we have also labeled the points for GRS 1747--312 (in Terzan 6) with numbers, denoting the first (1: 2015 April 18), second (2: 018 March 25), and third (3: 2018 April 30) quasi-simultaneous epochs for this source. The radio flux densities and X-ray fluxes from Table \ref{tab:quasisim} have been converted to luminosities using the cluster distances from \citet{Tremou18}. Dark green circles show quiescent/hard state black holes. Quiescent/hard state neutron stars are shown as blue squares, with additional data points from Aql X-1 \citep{Gusinskaia20a}, and soft sources shown as orange pluses from \citep{Ludlam19}. Pink stars are accreting millisecond X-ray pulsars and light green triangles are transitional millisecond X-ray pulsars. The dashed gray line shows the best-fit relation ($L_R \propto L_X^{0.61}$) for black holes from \citet{Gallo06} and solid blue line represents a proposed correlation ($L_R \propto L_X^{0.44}$) for hard-state neutron stars from \citet{Gallo18}.} \label{fig:f1} \end{figure*} For the analysis of the Chandra/HRC data of M15, after standard reprocessing, we estimated count rates and background for each of the three sources, then determined the X-ray fluxes using the model of \citet{White01} (for AC 211 and M15 X-2) or \citet{Arnason15} (for M15 X-3). These data are discussed in more detail in Section 3.6. We used \textsc{Xspec} \citep{Arnaud96}, with \citet{Verner96} photoelectric cross section and \citet{Wilms00} abundances for spectral analysis. In cases where the number of extracted source events were more than 100, we binned the spectra to have at least 20 counts per bin and used $\chi^2$ statistics for fitting. In other cases, we binned the spectra to have at least 1 count per bin, and used w-statistics as implemented in \textsc{Xspec}.\footnote{\url{https://heasarc.gsfc.nasa.gov/xanadu/xspec/manual/XSappendixStatistics.html}} The X-ray data used in this paper primarily plays a supporting role to help contextualize the radio observations. Therefore, we do not attempt comprehensive fitting of X-ray models, but instead choose the simplest model(s) that allow us to characterize the flux and spectral state. For some sources, the X-ray flux is low enough that only a simple absorbed power-law or blackbody fit is possible. For other, typically more luminous sources, more complex models such as {\tt Nthcomp} (a thermal comptonized continuum with blackbody seed photons) or composite models are justified and provide good fits. In making these choices we are guided by both the quality of the data and by previous work on these sources. For some of the brighter sources, data from MAXI (all using the Gas Slit Camera; GSC) and Swift/Burst Alert Telescope (BAT) are used to contextualize the Swift/XRT or Chandra data, providing additional constraints on the spectral state or luminosity of the source. \subsection{New HST Optical Positions} To ensure high-fidelity astrometric matching between the X-ray binaries and the radio continuum observations, we determined more precise positions of most of the sources in our sample using new Hubble Space Telescope (HST)/WFC3 observations. For all of M15, NGC 6441, NGC 6624, NGC 6652, and NGC 6712, there are ultraviolet ($F275W$) data that clearly show the sources in question and for which we calculate new positions. The exceptions are AC 211 in M15, which has a precise position from very long baseline interferometry \citep{Kirsten14}, and Terzan 6, which has no ultraviolet data (and indeed the optical counterpart to GRS 1747--312 is unknown). The position of GRS 1747--312 is discussed in more detail in Section 3.5. For all HST data, we used a large number of stars detected by HST and in Gaia DR2 \citep{Gaia18} for the ICRS astrometric solutions, finding rms values in the range of 8 to 15 mas per coordinate. We assign conservative uncertainties of 0.02\arcsec\ per coordinate to our final positions, which are listed in Table 1. These are more accurate and precise than existing X-ray positions, and are ideal for use in this paper and for future work. Note that we have made the small necessary adjustments to put the literature positions on ICRS for consistency. \section{Results for Individual Sources} \subsection{4U 1820--30 in NGC 6624} 4U 1820--30 is a persistent ultracompact binary with a period of 0.0079 d ($\sim 11.4$ min; \citealt{Stella87}). The short period and high mean X-ray luminosity of the system are consistent with a low-mass ($\sim 0.07 M_{\odot}$) He white dwarf donor \citep{Rappaport87}. The accretor is a neutron star that shows frequent X-ray bursts (e.g., \citealt{NICER19}). While the orbital X-ray variations are of low amplitude ($\lesssim 3$\%), the binary is also observed to have strong X-ray luminosity variations with a superorbital period of $\sim 171 $ d \citep{Priedhorsky84,Zdziarski07}. This superorbital period is typically explained as being due to orbital dynamics in a hierarchical triple (e.g., \citealt{Chou01b,Prodan12}), such that the binary has an as-yet undetected outer companion. Here we report strictly simultaneous ATCA (radio) and Swift (X-ray) observations of 4U 1820--30 on 2015 April 24--25. We infer a 5.0 GHz flux density of $241.0\pm5.1$ $\mu$Jy based on the measured 5.5 and 9.0 GHz values, and there is an excellent astrometric match (separation of only 16 mas) between the HST optical and ATCA radio positions of 4U 1820--30 \citep{Tremou18}. The radio spectral slope is $\alpha = -0.26\pm0.05$ for an assumed power law with $S_{\nu} \propto \nu^{\alpha}$ where $S_{\nu}$ is the radio flux density at frequency $\nu$ and $\alpha$ is the spectral index (this convention is used throughout this work). The simultaneous Swift/XRT X-ray observations give an unabsorbed 1--10 keV flux of $(1.5\pm0.1) \times 10^{-9}$ erg s$^{-1}$ cm$^{-2}$ when fit by an absorbed {\tt Nthcomp} model. This model is a substantially better fit ($\chi^2$/d.o.f. = 55/40 $\sim 1.4$) than a simple absorbed power law ($\chi^2$/d.o.f. = 118/59 $\sim 2.0$). The respective photon indices for these fits are $\Gamma \sim 1.6$ and $\Gamma \sim 1.3$. In Figure \ref{fig:4u1820} we show the MAXI (4--10 keV) and Swift/BAT (15--50 keV) X-ray light curves for several hundred days around our simultaneous observations. By serendipity, our data were taken nearly perfectly at an unusually low minimum of the superorbital light curve, which corresponds to local maximum of the hardness of the system. Together these measurements strongly suggest that 4U 1820--30 was in the ``island" state of this atoll neutron star LMXB, which is the lowest and hardest state observed for 4U 1820--30 \citep{Bloser00}. These strictly simultaneous observations place 4U 1820--30 well in the midst of the typical neutron star radio emission observed for sources in the hard/island state at $L_X \sim 10^{37}$ erg s$^{-1}$ (Figure \ref{fig:f1}). \begin{figure*}[!th] \centering \includegraphics[width=1.0\textwidth]{figures/lc_4U_1820-30.pdf} \caption{2014 April to 2015 October X-ray light curve of 4U 1820--30 from MAXI (4--10 keV; top) and Swift/BAT (15--50 keV; middle), with hardness ratio in the bottom panel. The epochs of our strictly simultaneous 2015 April Swift/XRT and ATCA data (thick vertical salmon line for radio, short black line for X-ray) as well as the previously published 2014 July quasi-simultaneous radio/X-ray observations (thin vertical salmon line for radio, short black line for X-ray) are also plotted. The new simultaneous data from 2015 April occur during a local minimum in the MAXI flux and a local maximum in the hardness ratio, implying that the system was in the hard island state.} \label{fig:4u1820} \end{figure*} Two previous works also placed 4U 1820--30 on the radio/X-ray correlation, though in the more luminous soft (``banana") state. \citet{diaztrigo2017} presented the 2014 radio continuum detection of 4U 1820--30 with ATCA ($236\pm27 \mu$Jy at 5.5 GHz) and ALMA ($400\pm20 \mu$Jy at 300 GHz; 10 days before the ATCA data). In these 2014 ATCA data, 4U 1820--30 was not detected at 9.0 GHz, with an upper limit of $\lesssim 200 \mu$Jy, implying $\alpha \lesssim -0.34$. We infer a 5.0 GHz flux density of $241\pm28$ $\mu$Jy at this epoch by assuming $\alpha = -0.5$. It is possible that in the soft state 4U 1820--30 sometimes has a steeper radio spectrum than this \citep{Russell21}, but none of our results depend on the precise value assumed. In Swift/XRT observations obtained two days after the ATCA data, 4U 1820--30 is luminous with $L_X \sim 8 \times 10^{37}$ erg s$^{-1}$. These quasi-simultaneous radio/X-ray observations are also plotted in Figure \ref{fig:f1}. The inferred 5.0 GHz flux density was identical to that in the 2015 data, but at an X-ray luminosity a factor of $\sim 6$ higher, where it is in a location typical of soft accreting neutron stars. \citet{Migliari04} presented earlier quasi-simultaneous data in a comparable soft state, finding the radio flux density was about a factor of $\sim 2$ lower than in the \citet{diaztrigo2017} data. We do not include these earlier data in this paper since the system was only significantly detected in an average of seven epochs, and not in any individual epoch \citep{Migliari04}, due to the lower sensitivity of ATCA prior to its backend upgrade in 2010. \subsection{X1850--087 in NGC\,6712} X1850--087 was an early discovery of a persistent luminous X-ray source in a Galactic globular cluster \citep{Sewardetal1976}, with a typical $L_X \sim 10^{36}$ erg s$^{-1}$ (Figure \ref{fig:f2}). The source shows Type I X-ray bursts \citep{Zand19}, proving a neutron star primary. X1850--087 is a likely ultracompact binary with a suspected 0.014 d (20.6 min) orbital period, derived from an HST ultraviolet time series \citep{Homer96}. \begin{figure*}[!th] \centering \includegraphics[width=1.0\textwidth]{figures/712_all_lc2_ver2_update.pdf} \caption{Long-term X-ray light curve of X1850--087 (top) with radio flux densities (bottom). The three separate panels show different time ranges observed with different X-ray instruments: Ginga (blue); {RXTE} (magenta); MAXI (orange), all plotted as 1--10 keV luminosities. Salmon vertical lines correspond to radio detections and grey dashed lines to radio upper limits.} \label{fig:f2} \end{figure*} \subsubsection{2014 Quasi-simultaneous VLA and Swift Data} We obtained VLA observations of NGC 6712 over seven epochs, each of duration 1 or 2 hr, in April and May 2014 shown in Table \ref{tab:lrlx}. X1850--087 is strongly variable in the radio over this timespan, with a mixture of tight upper limits and clear detections. First we discuss our quasi-simultaneous VLA and Swift radio and X-ray observations, with the VLA data obtained on 2014 April 5 and the X-ray data on 2014 April 6. The source is not detected with the VLA at either 5.0 or 7.4 GHz during these observations, with $3\sigma$ upper limits of $< 12.9 \, \mu$Jy and $< 12.3 \, \mu$Jy, respectively. Averaging the subbands gives a $3\sigma$ upper limit of $< 9.0 \, \mu$Jy at an average frequency of 6.2 GHz. The quasi-simultaneous Swift/XRT X-ray observations are well-fit by an absorbed power-law with $\Gamma = 2.30\pm0.13$, giving an unabsorbed flux of $(1.6\pm0.1) \times 10^{-10}$ erg s$^{-1}$ cm$^{-2}$. This flux corresponds to an X-ray luminosity of $1.2 \times 10^{36}$ erg s$^{-1}$. We note that a photon index of $\Gamma \sim 2.3$ is atypically soft at this X-ray luminosity \citep{Wijnands15}, perhaps suggesting that the true spectrum is instead a composite that has contributions from both a power law and a thermal disk spectrum. Unfortunately, the quality of the Swift data are not high enough to distinguish between this hypothesis and the simpler single power law. If we try such a two-component fit with the photon index fixed to $\Gamma = 1.7$, both the fit quality and inferred flux are essentially identical, indicating that the presence of a two-component X-ray spectrum is plausible, but unproven. If indeed X1850--087 is in the hard state, then Figure \ref{fig:f1} shows that this source has the most stringent quasi-simultaneous 3$\sigma$ radio continuum upper limit ($L_R \sim 3 \times 10^{28}$ erg s$^{-1}$) for a hard state neutron star LMXB at $L_X \gtrsim 10^{36}$ erg s$^{-1}$. While X1850--087 is only marginally detected in daily MAXI (4--10 keV) and Swift/BAT (15--50 keV) observations in this time frame, binned light curves do show detections (Figure \ref{fig:panel3}). These light curves show that there is no meaningful variability in the flux or hardness of X1850--087 in the data surrounding the 2014 April 5--6 radio and X-ray observations, suggesting the quasi-simultaneous Swift/XRT data are representative. We also delve into the 2014 April 5 radio non-detection by imaging the data in individual 10-min scans, averaging together both basebands in the $uv$ plane. The source was undetected in all the individual scans, with a typical per-scan rms of about 9 $\mu$Jy (and hence a per-scan $3\sigma$ limit of $\lesssim 27 \mu$Jy). We conclude that the limit in the entire 2 hr block is representative and that the binary is indeed not detected in these radio continuum data at this time. \subsubsection{2014 May Data: Detections and Variability} In contrast to the strong radio upper limit in 2014 April, X1850--087 is clearly detected in several other radio observations in 2014 May at $> 10\sigma$ significance (Table \ref{tab:x1850}). Of the six VLA epochs obtained during May 2014, in five of these X1850--087 has a flux density $>100$ $\mu$Jy. In one epoch (2014 May 13), X1850--087 is again not detected (with a formal $3\sigma$ upper limit of $< 9.5 \mu$Jy at a combined average frequency of 6.2 GHz), but is well-detected in bracketing observations on May 9 and May 18. This demonstrates that the radio flux density of X1850--087 is changing by at least a factor of $\sim 20$ in just a few days. While there is no Swift/XRT X-ray coverage of these 2014 May epochs, the binned MAXI and Swift/BAT light curves indicate that an X-ray brightening and a transition to a softer state occurred around the time of these 2014 May VLA observations (Figure \ref{fig:panel3}). Hence, one interpretation of the overall higher radio flux density from 2014 May 5--9 and May 18--20 is that it is associated with this transition, perhaps due to the launching of discrete ejecta. A challenge to this simple interpretation is the non-detection on May 13, which would require a separate transition to the baseline fainter harder state (or perhaps an intermediate hard state) between May 9 and 13 and a re-flaring to a softer higher state by May 18. As we lack daily Swift/XRT data during this period we cannot definitively rule out this possibility, but it is not supported by the binned MAXI and Swift/BAT light curves, and would also represent phenomenology not previously observed in the {Rossi X-ray Timing Explorer (RXTE)} light curve for the source (see next subsection). Absent this fast flaring behavior, we know of no straightforward explanation for such dramatic variability on these timescales in an ultracompact system, which are much longer than the 0.014 d (20.6 min) orbital period but much shorter than, for example, the $\gtrsim 100$ d superorbital periods observed in some other ultracompact systems such as 4U 1820--30 (Section 3.1). In the May 13 radio data for X1850--087, as in the April 5 data, the source is not detected in 10-min individual scans during the 2 hour observation block. This is consistent with the idea that any orbital variations---which ought to be averaged out over individual blocks that represent $\sim 6$ orbital periods---are not the primary cause of the variability of X1850--087. We also imaged the individual scans for the observing blocks adjacent to the May 13 block in which the source was not detected. Each of these is a 1-hr block with five 8-min scans on source. On May 9, there is no evidence for significant variation among the scans. On May 18, X1850--087 is brighter in the last two scans than the first three at a formal level of about $3.5\sigma$ (5.0 GHz flux density of $235\pm17 \mu$Jy in the last two, compared to $168\pm9 \mu$Jy in the first three). Given its marginal significance, we do not attach too much import to the change, but if it were a real increase in the flux density, it could be short-term variability due to a recent jet ejection event. We report spectral indices in Table \ref{tab:x1850} for our 2014 May observations of X1850--087. The spectral index ranged from inverted (brighter at higher frequencies) to flat, varying on short timescales: between May 5 and May 8 the source changed from an inverted spectral index ($\alpha = +0.50\pm0.15$) to a flatter value ($\alpha = -0.13\pm0.11$), then quickly back to inverted ($\alpha = 0.46\pm0.13$) on May 9, just one day later. The detection on May 18 was likewise flat, with $\alpha = +0.06\pm0.13$. We also calculated the per-scan spectral indices on May 18, finding a mean value of $\alpha=-0.04\pm0.20$ for the three early scans and $\alpha =+0.30\pm0.16$ for the two final scans. This could be consistent with a transition to more inverted emission during the putative flux density increase at the end of the May 18 observing block, though the evidence for a spectral index change is not formally significant. We discuss possible interpretations of the spectral index variations between different epochs in Section 4.2.3. \subsubsection{Other Radio and X-ray Data} To improve the time baseline in the radio, we also make use of archival VLA data for X1850--087, reducing all of the C band data taken in the high-resolution (A or B) VLA configurations. This resulted in three additional epochs, all at 4.9 GHz, spanning 1989--1998 (Table \ref{tab:x1850}). In 1989 February and 1991 December, X1850--087 was clearly detected, with flux densities consistent with our 2014 detections. In 1998 September, the source was not detected, but the 3$\sigma$ upper limit ($<135 \mu$Jy) is not particularly constraining as to whether order-of-magnitude variability was present in these older data. \begin{figure}[!t] \centering \includegraphics[width=0.5\textwidth]{figures/n6712_recent.pdf} \caption{2014 X-ray light curve of X1850--087 (top) with radio flux densities (bottom). Both MAXI (4--10 keV) and Swift/BAT (15--50 keV) X-ray light curves are shown. As in Figure \ref{fig:f2}, salmon vertical lines correspond to radio detections and grey dashed lines correspond to radio upper limits.} \label{fig:panel3} \end{figure} Some previous papers on the 1989 February radio detection have claimed that X1850--087 is spatially resolved in these data \citep{Lehtoetal1990,Machinetal1990}, which if true would have important implications for its interpretation. In our re-reduction of these data, given the moderate signal-to-noise of the source, we find that either a point source or extended morphology offer reasonable fits. In our substantially deeper 2014 detections while the VLA was in its highest resolution A configuration, we find that in all epochs the morphology of X1850--087 is consistent with a point source. There is at least partial X-ray data at these earlier epochs to contextualize these radio detections and limits. A Ginga/ASM (1--20 keV) light curve is available from 1987 March to 1991 October, and while it does not have spectral information, this X-ray light curve shows only modest variability (Figure \ref{fig:f2}). Two epochs of Ginga/LAC data in this time interval, from 1989 April and 1990 Sep, suggest an unabsorbed 1--10 keV luminosity of $L_X \sim 1.8 \times 10^{36}$ erg s$^{-1}$ \citep{Kitamotoetal1992}, consistent with the Swift/XRT data from 2014. {RXTE}/ASM (1--10 keV) offers a well-sampled light curve of X1850--087 from 1995 to 2012, with evidence for a number of distinct episodes of brightening on typical timescales of weeks to months, as well as lower-level variability. In the vicinity of the 1998 September radio upper limit, the source has an X-ray flux typical of the long-term value \citep{Cartwright13}. The most notable feature of the long-term X-ray light curve of X1850--087 is that it spends a relatively short amount of time in obvious bright states. As a rough estimate, we use the {RXTE}/ASM light curve, which has the best sampling and decent sensitivity of the long-term light curves. If we make a somewhat arbitrary designation that the source is in a bright state if the X-ray luminosity is $\gtrsim 3 \times 10^{36}$ erg s$^{-1}$, then it spends only $\sim 6\%$ in such bright states (see also \citealt{Cartwright13}). This percentage increases to $\sim 15\%$ if a more conservative luminosity of $\gtrsim 2 \times 10^{36}$ is used, though Figure \ref{fig:f2} shows that this value would likely also encompass periods of typical persistent activity outside of a bright state. Hence the long-term X-ray light curve shows that it is unlikely that two random radio continuum observations in 1989 and 1991 would have been taken during this uncommon flaring/bright state purely by chance. Overall, we conclude that a straightforward flaring/state transition model for the dramatic radio variability of X1850--087 cannot be firmly ruled out. However, such an scenario also does not readily explain the data. \subsection{XB1832--330 in NGC\,6652} XB1832--330 is a persistent X-ray source first associated with the globular cluster NGC 6652 in 1990 \citep{Predehl91} and with evidence for Type I X-ray bursts \citep{intZand98,Mukai00}. Based on its X-ray spectrum and the lack of a bright optical counterpart, it was long argued to be an ultracompact LMXB (e.g., \citealt{Heinke01,Parmar01}). However, \citet{Engel12} used Gemini optical photometry to argue for an orbital period of $0.0895\pm0.0001$ d (2.15 hr), suggesting instead a low-mass main sequence donor. \begin{figure*}[!th] \centering \includegraphics[width=1.0\textwidth]{figures/lc_4U_1746-370.pdf} \caption{Long-term X-ray light curve of 4U 1746--37 from MAXI (4--10 keV; top) and Swift/BAT (15--50 keV; middle), with hardness ratio in the bottom panel. The epoch of our quasi-simultaneous 2015 April Swift/XRT and ATCA data (thick vertical salmon line for radio, short black line for X-ray) are marked.} \label{fig:4u1746} \end{figure*} Here we report a $3\sigma$ VLA radio upper limit of $< 6.6 \mu$Jy at 10 GHz on 2017 May 22. While we have strictly simultaneous {Chandra}/ACIS-S observations, these are piled up and had to be specially fit (as described in Section 2.3). An absorbed {\tt Nthcomp} model provides a good fit ($\chi^2$/dof = 199/186 $\sim 1.07$) with an unabsorbed X-ray flux of $(1.9\pm0.1) \times 10^{-11}$ erg s$^{-1}$ cm$^{-2}$. The system was in the hard state with $\Gamma = 1.62\pm0.14$. The X-ray flux reported above corresponds to a luminosity of $L_X \sim 2\times10^{35}$ erg s$^{-1}$. This value is somewhat fainter than that reported for the 2011 {Chandra} observations of \citet{Stacey12}, and much lower than the $L_X \gtrsim 10^{36}$ erg s$^{-1}$ that the source showed when observed from 1990 through 2010 (e.g., \citealt{Predehl91,Parmar01,Sidoli08,Cartwright13}). {RXTE}/PCA Bulge Scan data\footnote{\url{https://asd.gsfc.nasa.gov/Craig.Markwardt//galscan/html/R_1832-330.html}} suggests that a transition to a fainter state occurred beginning around 2011 February. There is some evidence from {HEAO-1} observations that in the late 1970s the luminosity was closer to $\sim 10^{35}$ erg s$^{-1}$ \citep{Hertz85}, implying that similar persistent luminosity changes have occurred in the past. Our deep radio upper limit at $L_X \sim 2\times10^{35}$ erg s$^{-1}$ puts XB1832--330 among the sources with the most constraining simultaneous radio data at these ``low" persistent emission levels. \subsection{4U 1746--37 in NGC\,6441} 4U 1746--37 is a persistent atoll X-ray source in NGC 6441, with an orbital period of 0.215 d (5.14 hr) as inferred from {RXTE} X-ray dips \citep{Balucinskachurchetal2004}. The radio data implicitly average over several orbital periods, though the dips have maximal X-ray amplitudes of $\sim 25\%$. The dipping nature of the source suggests an inclination $\gtrsim 60^{\circ}$, possibly as high as $\sim 75-80^{\circ}$. We report a $3\sigma$ ATCA 5.5 GHz radio upper limit of $< 13.7 \mu$Jy on 2015 April 14/15. Quasi-simultaneous Swift X-ray observations on 2015 April 13 are best-fit by a composite {\tt Nthcomp}+{\tt diskbb} model, yielding an unabsorbed X-ray flux of $(8.6\pm2.0) \times 10^{-10}$ erg s$^{-1}$ cm$^{-2}$. This spectrum and flux are consistent with that of the soft/banana-like state in which 4U 1746--37 spends most of its time (e.g., \citealt{Jonker00,Munoz14}). The Swift/BAT and MAXI X-ray light curves around the time of the X-ray and radio observations (Figure \ref{fig:4u1746}) are noisy, requiring coarse 10-day binning, and somewhat difficult to interpret. The single MAXI bin closest in time to the radio observation has a low flux, and combined with the Swift/BAT detection in the corresponding bin, this could suggest the system was in an intermediate hard state. On the other hand, the Swift/BAT flux was no higher than any surrounding bin, and on average the source is in a relatively soft state around this time. Hence we proceed assuming that the system is indeed in the soft/banana state at the time of our radio data. While 4U 1746--37 shows both bursts and flares, the quasi-simultaneous 2015 April Swift/XRT flux corresponds to an X-ray luminosity of $\sim 2 \times 10^{37}$ erg s$^{-1}$, consistent with a typical non-bursting value for the source (e.g., \citealt{Christian1997}). The non-detection of this source in radio continuum emission is notable: it has one of the most constraining radio upper limits for a soft state neutron star at $L_X > 10^{37}$ erg s$^{-1}$ (Figure \ref{fig:f1}), suggesting either relatively faint radio emission from 4U 1746--37 in this soft state or perhaps the quenching of its jet. \subsection{GRS 1747--312 in Terzan 6} \subsubsection{Radio and X-ray Measurements} GRS 1747--312 is a transient LMXB first observed in 1990 by Granat \citep{Pavlinsky94}. The compact object is a neutron star that shows Type I X-ray bursts \citep{intZand03b}. Observations of X-ray eclipses have allowed the determination of a precise orbital period of 12.360 hr \citep{intZand03a}. GRS 1747--312 has unusually frequent outbursts, clustering with a recurrence time around 4.5 months, though some outbursts occur much more quickly or slowly than this typical value. While the optical companion is unknown---due primarily to the high optical extinction toward Terzan 6---the relatively long orbital period and fast recurrence time suggest a somewhat high mass transfer rate from a subgiant donor \citep{intZand03a}. Here we report three quasi-simultaneous (within $\sim 1$ d) epochs of radio and X-ray observations of GRS 1747--312. The ephemerides of the X-ray eclipses are known with sufficient precision \citep{intZand03a} that we can determine with certainty that none of the X-ray data discussed below occur during eclipses. For one of the five VLA epochs (2018 June 3), and for the ATCA observations, there is a partial overlap with the predicted eclipse times. The radio emission at these frequencies (5/7 GHz for VLA; 5.5/9 GHz for ATCA) is unlikely to be eclipsed even during X-ray eclipses \citep{Maccarone20}, and in any case only a small amount---about 13\% of the 2018 June 3 VLA epoch and $\lesssim 4\%$ of the ATCA data---was taken during a predicted eclipse, so does not affect our results or conclusions. In ATCA observations that began 2015 April 17 (labeled as 1 in Figure \ref{fig:f1}), the binary is well-detected with 5.5 and 9.0 GHz flux densities of $213.3\pm5.1 \, \mu$Jy and $172.4\pm5.2 \, \mu$Jy, respectively, implying a radio spectral index $\alpha =$ --$0.43\pm0.08$. We use this well-measured spectral slope to infer a 5.0 GHz flux density of $221.1\pm6.4 \, \mu$Jy. The data quality of all three Swift/XRT observations discussed in this section (including the quasi-simultaneous one obtained on 2015 April 16) is relatively low, and fitting an absorbed power-law to these X-ray data gives a strong degeneracy between $\Gamma$ and $N_H$. The presence of variable dips for this source means that a constant $N_H$ cannot necessarily be assumed. Therefore we have taken the approach of fitting two models to each of the Swift/XRT observations: one with fixed $\Gamma$ and free $N_H$, and the other with both $\Gamma$ and $N_H$ fixed, the latter to the estimated foreground of $1.4 \times 10^{22}$ cm$^{-2}$. Motivated by the typical photon indices for low-mass X-ray binaries at these X-ray luminosities and the spectral fitting results of \citep{Vats18} for the source in quiescence, for the models with $\Gamma$ fixed, we assume $\Gamma = 1.7$. For the 2015 April 16 Swift/XRT data, the free $N_H$ fit has $N_H = 7.8^{+6.4}_{-4.0} \times 10^{22}$ cm$^{-2}$ and an unabsorbed X-ray flux of $5.3^{+4.0}_{-2.4} \times 10^{-12}$ erg s$^{-1}$ cm$^{-2}$, corresponding to $L_X = 2.9^{+2.2}_{-1.3} \times 10^{34}$ erg s$^{-1}$ at the assumed distance of 6.8 kpc. For the fit with both $N_H$ and $\Gamma$ fixed, we find an unabsorbed flux of $2.1^{+1.0}_{-0.8} \times 10^{-12}$ erg s$^{-1}$ cm$^{-2}$ ($L_X = 1.2^{+0.5}_{-0.4} \times 10^{34}$ erg s$^{-1}$). These two flux estimates are consistent within the uncertainties; we plot the former (free $N_H$) fit in Figure \ref{fig:f1}, but none of our conclusions depend on this choice. At this first quasi-simultaneous epoch, GRS 1747--312 is the most radio-luminous neutron star LMXB ever observed at X-ray luminosities $< 10^{35}$ erg s$^{-1}$, with a 5.0 GHz radio luminosity of $(6.1\pm0.2) \times 10^{28}$ erg s$^{-1}$. It sits near the upper envelope of the well-defined black hole radio/X-ray correlation (Figure \ref{fig:f1}). Two VLA epochs in 2018 were obtained quasi-simultaneously with additional Swift/XRT data. On 2018 March 25 (labeled as 2 in Figure \ref{fig:f1}), GRS 1747--312 is not detected with the VLA at either 5.0 or 7.1 GHz, with $3\sigma$ upper limits of $< 12.9 \, \mu$Jy and $< 11.7 \, \mu$Jy respectively. We fit the Swift/XRT observations on 2018 March 26 using the two models discussed above: $\Gamma = 1.7$ and $N_H$ free, or $\Gamma = 1.7$ and $N_H = 1.4 \times 10^{22}$ cm$^{-2}$. For the former model we find $N_H = 3.6^{+4.2}_{-2.1} \times 10^{23}$ cm$^{-2}$ and an unabsorbed X-ray flux of $8.0^{+13.6}_{-4.8} \times 10^{-12}$ erg s$^{-1}$ cm$^{-2}$, equivalent to $L_X = 4.4^{+7.5}_{-2.6} \times 10^{34}$ erg$^{-1}$. For the fixed $N_H$ model, the unabsorbed flux is $1.0^{+0.6}_{-0.4} \times 10^{-12}$ erg s$^{-1}$ ($L_X = 5.5^{+3.3}_{-2.4} \times 10^{33}$ erg$^{-1}$). For this observation, the X-ray fluxes from the two models are not quite consistent within the uncertainties. We conservatively plot the free $N_H$ fit in Figure \ref{fig:f1}, but again none of our conclusions depend on the precise X-ray luminosity plotted for this radio upper limit. GRS 1747--312 is again detected in the radio on 2018 April 30 (labeled as 3 in Figure \ref{fig:f1}) with 5.0 and 7.1 GHz flux densities of $26.9\pm4.3 \, \mu$Jy and $32.1\pm4.1 \, \mu$Jy respectively, and a measured spectral index of $\alpha=+0.51\pm0.57$. In quasi-simultaneous Swift/XRT data from 2018 May 1, it is marginally detected, with an unabsorbed X-ray flux from the free $N_H$ model of $0.9^{+1.1}_{-0.6} \times 10^{-12}$ erg s$^{-1}$ cm$^{-2}$ ($N_H = 0.5^{+1.8}_{-0.5} \times 10^{22}$ cm$^{-2}$) and a fixed $N_H$ flux of $(1.3^{+1.2}_{-0.8}) \times 10^{-12}$ erg s$^{-1}$ cm$^{-2}$. Since the former fit yields an $N_H$ below the expected foreground, for this epoch we use the fixed $N_H$ result in Figure \ref{fig:f1}, again emphasizing that this choice does not affect any of our conclusions. This gives $L_X = 7.1^{+6.4}_{-4.4} \times 10^{33}$ erg s$^{-1}$. The VLA non-detection in March 2018 is more typical of the upper limits or detections for neutron star LXMBs at $L_X$ of $\sim 5\times 10^{33}$ to $5\times 10^{34}$ erg s$^{-1}$. However, the VLA detection about a month later (2018 April 30), at a fainter X-ray and radio luminosity than the bright 2015 detection, again approaches the regime more typically occupied by black hole LMXBs. In subsequent VLA epochs, taken from 2018 May 21 to June 3, the source is well-detected at a comparable radio luminosity to the first VLA detection (Table \ref{table:grstable}), also showing modest (less than a factor of $\sim 2$) variability. We have no simultaneous X-ray data at these latter radio epochs. We stack the four detected VLA epochs in the $uv$ plane to get our best estimate of the VLA source position (Table \ref{table:grstable}). The spectral index in the stack is $\alpha=-0.51\pm0.28$, entirely consistent with the ATCA value. This suggest a similar origin for the radio continuum emission in both datasets, despite a factor of $\sim 6$ drop in radio luminosity. As we discuss below for AC 211 in M15 (Section 3.6.1), given the high orbital inclination of GRS 1747--312, it is possible that its unabsorbed X-ray luminosity is being underestimated, which might make GRS 1747--312 somewhat less of an outlier in the radio/X-ray correlation. Mitigating against this possibility is that for GRS 1747--312 the central accretor is visible (unlike the case for AC 211), implying less ``extra" obscuration for GRS 1747--312, if any. \subsubsection{Are We Sure We are Detecting GRS 1747--312?} It is worth considering whether we are sure that the radio and X-ray fluxes indeed reflect those of GRS 1747--312. The source was not in X-ray outburst during any of our observations, and the X-ray data were taken outside of eclipse. While no other luminous X-ray sources are definitively known in Terzan 6, there are some puzzling observations that could be consistent with the existence of sources other than GRS 1747--312. In a 2009 {Suzaku} observation, \citet{Saji16} observe a single source with $L_X \sim 6 \times 10^{34}$ erg s$^{-1}$, but see no evidence for an eclipse at the predicted time for GRS 1747--312, leading them to argue that this X-ray emission might arise from a different source. Only a single X-ray source is evident in our Swift/XRT images of Terzan 6, and its position is consistent with the {Chandra}/HRC position of GRS 1747--312 \citep{intZand03b}. But the Swift position is at best only constrained at the level of $\sim 2$--3\arcsec, so this association is not definitive in the dense environment of a globular cluster. The position of the counterpart radio source in our ATCA and VLA observations is much better constrained. Since this source shows radio variability, has a radio spectral slope consistent with a LMXB, and already has a relatively high ratio of radio to X-ray luminosity, it seems fair to assert that this radio emission indeed arises from the same source as in the quasi-simultaneous Swift/XRT observations. The ATCA and VLA positions of the source can be found in Table \ref{table:grstable}, where we have conservatively assumed the $1\sigma$ uncertainties to be 10\% of the beam. The ATCA and VLA positions are entirely consistent with each other, and the VLA position is about 0.7\arcsec\ from the best-fit {Chandra}/HRC position\footnote{This is not due to the proper motion of Terzan 6, which only implies a change of about 0.1\arcsec\ per coordinate between the X-ray epoch 2000 and and radio epochs of 2015--2018 \citep {Vasiliev19}.}. This X-ray position has a formal 95\% uncertainty of 0.4\arcsec\ \citep{intZand03b} based on an astrometric solution from three X-ray sources in the field. Hence, formally our radio continuum position is inconsistent with the {Chandra} one. Since absolute astrometry with {Chandra} is challenging, it seems plausible that the uncertainty is slightly underestimated, which could reconcile the positions. A piece of evidence in favor of this argument is that neither the {Chandra}/HRC position of GRS 1747--312 nor our radio position are right at the center of the cluster: rather, they are northwest of the center in an HST/WFC3 F110W image (corrected to ICRS using Gaia DR2 stars), perhaps $\sim 1.4$--2\arcsec\ from the center and approaching the edge of the core. While it is possible that there are two unrelated X-ray binaries only $0.7\arcsec$ from each other but offset from the cluster center, an unrelated binary could plausibly be located anywhere in the core. Finally, an {XMM} observation of Terzan 6 taken when GRS 1747--312 was not in outburst showed evidence for a single X-ray source with $L_X \sim 10^{33}$ erg s$^{-1}$ (assuming our distance of 6.8 kpc). A spectral fit to this source required a two-component model with both a neutron star atmosphere and a hard power law, consistent with ongoing low-level accretion onto a neutron star \citep{Vats18}. This X-ray luminosity is well below that of our Swift/XRT observations, which range from $L_X \sim 7\times 10^{33}$ to $4\times 10^{34}$ erg s$^{-1}$. Hence, to explain our Swift/XRT data, a non-GRS 1747--312 source would need to have a typical luminosity (in both 2015 and 2018) around $L_X \sim 10^{34}$ erg s$^{-1}$. Being in neither quiescence nor full outburst, such luminosities are quite unusual for LMXBs, but are not unexpected for GRS 1747--312 given its very frequent outbursts. A hypothetical non-GRS 1747--312 source would also need to be X-ray and radio variable, as well as being very close to the position of GRS 1747--312. This verges on implausibility, and the most parsimonious explanation---pending, of course, additional X-ray and radio data---is that the only X-ray binary clearly detected thus far in Terzan 6 is indeed GRS 1747--312. \subsection{Sources in M15: AC 211, X-2, and X-3} Here we discuss the persistent sources AC 211 and M15 X-2 together with the very faint X-ray transient M15 X-3, since all the analysis comes from identical datasets. All the radio flux densities for our VLA data can be found in Table \ref{tab:m15}. \subsubsection{AC 211} AC 211 (X2127+119) is an LMXB with a 17.1 hr period \citep{Ilovaisky93}. It is one of the most famous accretion disk corona sources, where an edge-on inclination leads to the outer disk blocking the view of the central accretion flow, and only scattered emission is observed. The compact object is generally assumed to be a neutron star but due to the obscuration this has not been confirmed, since the normal identification tools (e.g., Type I X-ray bursts) cannot be used. AC 211 is a variable source that shows eclipses and flares (e.g., \citealt{Hannikainen05}), with milliarcsecond-scale radio outflows or ejection events observed during outbursts \citep{Kirsten14}. AC 211 is detected in all five epochs of radio continuum imaging in 2011 (see Table \ref{tab:m15}) and is strongly variable, with its 5.0 GHz flux density ranging from 271 $\mu$Jy to 794 $\mu$Jy on timescales as short as a few days. Radio eclipses, while a priori unlikely at these frequencies \citep{Maccarone20}, are one possible explanation for this variability. Unfortunately, the existing ephemerides \citep{Ioannou03} extrapolated to the epoch of observation are not of sufficient precision, with a $1\sigma$ uncertainty of 0.23 d. While the absolute phase cannot be ascertained, the better-determined relative phases of the three low flux density epochs ($< 300 \mu$Jy) also do not line up, with a spread of $\phi = 0.35$ in the mid-exposure times. Hence, if radio eclipses are the main explanation for the variability, they would need to last for longer than a third of the orbit, which is quite unlikely. Improved ephemerides would allow a test of this scenario. In the single quasi-simultaneous epoch, we find an unabsorbed {Chandra}/HRC X-ray flux of $(4.5\pm0.1) \times 10^{-10}$ erg s$^{-1}$ cm$^{-2}$ (using the parameters of the power-law model of \citealt{White01}), equivalent to $(5.7\pm0.1) \times 10^{36}$ erg s$^{-1}$, and a 5.0 GHz radio flux density of $292.0\pm6.3$ $\mu$Jy. This places it among the more radio-luminous neutron star LMXBs. At the higher, non-simultaneous value of 794 $\mu$Jy, the radio luminosity is a factor of 2.7 higher and hence more typical of stellar-mass black holes than neutron stars, though this higher radio flux density could be associated with a flare rather than steady emission. It is worth noting that the X-ray luminosity measurement is almost certainly an underestimate, given the obscuration that prevents us from seeing the central source; the true $L_X$ could be at least an order of magnitude higher than we estimate. We indicate this in Figure \ref{fig:f1} by plotting the $L_X$ measurement as a lower limit. Nonetheless, even at a much higher value of $L_X$, AC 211 would still be the among the most radio-luminous accreting neutron stars observed, especially in the latter non-simultaneous epoch. One possible explanation is that AC 211 has an intrinsic $L_X$ that is around two orders of magnitude higher than observed and is a ``Z source" accreting near the Eddington luminosity. The nearest and best-studied member of this class, Sco X-1, shows rapid variations in radio flux density and spectral index that are somewhat similar to those that we observe in AC 211 \citep{Hjellming90,Fomalont01}. Another, speculative possibility is that AC 211 contains a black hole rather than a neutron star, which could potentially explain its radio loud nature. This is statistically unlikely, and evidence from optical spectroscopy tends to favor a neutron star primary \citep{vanZyl04a,vanZyl04b}, but this prospect cannot be definitively ruled out. \subsubsection{M15 X-2} \citet{White01} used {Chandra} data to solve the mystery of why the obscured source AC 211 occasionally showed X-ray bursts that ought not to have been visible: these bursts are associated with a very nearby (separated by $< 3\arcsec$) luminous LMXB, M15 X-2. \citet{White01} found an ultraviolet-bright counterpart to M15 X-2 with a 23-min periodicity identified with the orbital period \citep{Dieball05}, showing that M15 X-2 is an ultracompact X-ray binary---one of only 4 confirmed persistent ultracompact systems known among Galactic globular clusters. M15 X-2 had bright flaring events in both 2011 and 2013 \citep{Sivakoff11,Pooley13}, with X-ray bursts detected during both events \citep{Negoro16}. The 2011 flare is the one covered by the same five epochs of VLA data as for AC 211. M15 X-2 was strongly variable during this event (see Table \ref{tab:m15}), dropping from a 5.0 GHz flux density $\sim 150$ to $64 \mu$Jy from 2011 May 22 to May 26, then back up to $205.0\pm6.3 \mu$Jy on 2011 May 30. When re-visited in late August 2011, only upper limits were found, equivalent to a $3\sigma$ upper limit of $< 12.7 \mu$Jy at 5.0 GHz if both non-detection epochs are combined. This radio time series clearly shows that the data from 2011 May 30 reflect an elevated level of radio emission during the brightening event. These data share the same quasi-simultaneous {Chandra}/HRC dataset used for AC 211. At this epoch the unabsorbed {Chandra} flux was $(9.46\pm0.03) \times 10^{-10}$ erg s$^{-1}$ cm$^{-2}$ (using the power-law model of \citealt{White01}), equivalent to $L_X = 1.2 \times 10^{37}$ erg s$^{-1}$. The radio/X-ray luminosity ratio on 2011 May 30 for M15 X-2 is high, close to the upper envelope of other accreting neutron star binaries observed at this X-ray luminosity. We note that since these {Chandra} data were obtained with HRC, no spectral information was available to assess the state of M15 X-2 at this epoch. Instead, we analyze a Swift/XRT observation from 2011 May 30 which is strictly simultaneous with this VLA epoch. The Swift data has lower spatial resolution than {Chandra} and hence also includes AC 211. Since the count rate of AC 211 in the {Chandra}/HRC data is about 10\% of that of M15 X-2, it makes a small but non-negligible contribution to the Swift/XRT spectrum. Using this relative count rate and the power-law spectral model of \citet{White01} for AC 211, we fit a combination of AC 211 and M15 X-2 to the Swift spectrum. We find that M15 X-2 is well-fit by a composite disk ({\tt diskbb}) + power-law model ($\Gamma = 1.6\pm0.1)$ with an unabsorbed X-ray flux of $(1.04\pm0.04) \times 10^{-9}$ erg s$^{-1}$ ($L_X = 1.3\times10^{37}$ erg s$^{-1}$). About three quarters of the flux in this band is contributed by the power-law, suggesting that M15 X-2 is closer to the hard state than the soft state at the time of the radio observations that are plotted in Figure \ref{fig:f1}. The radio spectral index on 2011 May 30 was $\alpha = -0.02\pm0.12$, consistent with the presence of a compact jet at this epoch (see additional discussion in Section 4.2.1). \begin{figure}[!t] \centering \includegraphics[width=0.5\textwidth]{figures/lc_M_15_ver3.pdf} \caption{2011--2014 X-ray light curve of M15 (including flux from both AC 211 and M15 X-2) from MAXI (4--10 keV; top) and Swift/BAT (15--50 keV; middle), with hardness ratio in the bottom panel. The 2011 and 2013 flaring events are evidence. The epoch of our simultaneous 2011 May 30 VLA and Swift/XRT data is marked with a thick vertical salmon line. For reference, the second grouping of VLA data (2011 Aug 21/22) is marked with a dashed vertical yellow line; there are no simultaneous Chandra data for these epochs.} \label{fig:m15} \end{figure} For additional context, Figure \ref{fig:m15} shows the 2011--2014 MAXI and Swift/BAT X-ray light curves for M15. The 2011 and 2013 M15 X-2 flaring events are clearly visible in the MAXI X-ray light curve. The BAT data are noisy even when heavily binned, and AC 211 likely makes a substantial or even dominant contribution to the hard X-ray flux at all epochs, making it difficult to quantitatively interpret the plotted hardness ratio. Given the results of the Swift/XRT spectral analysis above, and that the 2011 May 30 radio data were obtained on the rise to peak, a reasonable interpretation is that these data were taken during a transition from a hard state to a softer one, with the jet not yet quenched. \subsubsection{M15 X-3} M15 X-3 is a so-called ``very faint X-ray transient", peaking at $\sim 10^{34}$ erg s$^{-1}$ \citep{Arnason15} rather than the value $\gtrsim 10^{36}$ erg s$^{-1}$ typical of LMXB transients. Even though it belongs to a different class than the other sources discussed in this paper, we include it for completeness given our use of deep radio continuum data for M15. \citet{Arnason15} show that the secondary of M15 X-3 is likely a low-mass main sequence star but generally find no obvious explanation for the unusually faint X-ray outbursts, settling on propeller-mode accretion onto a rapidly rotating neutron star as perhaps the most likely explanation. They also consider the possibility that M15 X-3 could belong to the unusual class of ``transitional millisecond pulsars", which show flat-spectrum radio emission in their sub-luminous accretion disk states. The detection of flat-spectrum radio emission would be suggestive evidence that M15 X-3 could belong to this subclass of millisecond pulsars. We report a $3\sigma$ 5.0 GHz radio upper limit of $< 16.1$ $\mu$Jy on 2011 May 30, somewhat deeper than previously published radio continuum upper limits \citep{Heinke09b}. Quasi-simultaneous {Chandra} X-ray observations on 2011 May 31 yield an unabsorbed X-ray flux of $(3.5^{+1.4}_{-0.8}) \times 10^{-13}$ erg s$^{-1}$ cm$^{-2}$ \citep{Arnason15}, equivalent to $\sim 4\times 10^{33}$ erg s$^{-1}$ at the distance of M15. Our quasi-simultaneous radio upper limit of $< 16.1$ $\mu$Jy is $\lesssim 10^{28}$ erg s$^{-1}$ at 5.0 GHz, which is not very constraining in the context of the known transitional millisecond pulsars or candidates, being comparable only to the detected radio emission in 3FGL J0427.9--6704 \citep{Li20}. If we assume the system stayed in a similar state for the longer period of 2011 May 22 to 2011 August 22, we can use the deeper, non-simultaneous radio data from \citet{Strader12b} to set a $3\sigma$ upper limit of $< 6.3$ $\mu$Jy ($\lesssim 4 \times 10^{27}$ erg s$^{-1}$ at 5.0 GHz). This limit is closer to the radio flux density observed for the transitional millisecond pulsar XSS J12270--4859 \citep{Hill11} but a factor of a few higher than that seen for the original transitional system PSR J1023+0038 \citep{Deller15}. We conclude the existing radio data cannot strongly constrain whether M15 X-3 exhibits transitional millisecond pulsar-like radio properties, but that somewhat deeper data---perhaps challenging to obtain before the ngVLA era---would be interesting and useful. \section{Discussion} \subsection{X-ray and Radio Luminosity: More Scatter Than Relation} It is well-established that many black hole LMXBs accreting in the low/hard state (below a few percent of the Eddington rate; \citealt{Maccarone03}) show a consistent relationship between their luminosities in the X-ray ($L_X$) and the radio ($L_R$) close to $L_R \propto L_X^{0.6-0.7}$ (e.g., \citealt{Hannikainen98,Gallo03,Corbel13,Gallo18}, see also Figure \ref{fig:f1}). Not all black holes follow this relation. Some sit on steeper relations, which could be viewed as either being ``radiatively efficient" or with suppressed radio emission (e.g., \citealt{Coriat11,Ratti12,Huang14,Plotkin17,Carotenuto21,vandenEijnden21}). \citet{Migliari06} collected the limited extant radio and X-ray measurements of neutron star X-ray binaries, suggesting that they typically produced jets, but (i) were fainter in the radio than black holes at the same $L_X$, and (ii) possibly followed a steeper radio/X-ray correlation than did black holes. Subsequent studies emerged slowly, since transient neutron star LMXBs often change states quickly and are intrinsically faint. However, newly available facilities in the last decade have allowed for more successful X-ray and radio follow-up of neutron star LMXBs, especially in the more poorly studied regime $L_X < 10^{36}$ erg s$^{-1}$. To the extent that there is a unifying conclusion from these studies, it is that neutron star LMXBs show an enormous variety of behaviors \citep{Tudor17,vandenEijnden21}. While it is possible to fit a mean radio/X-ray correlation to the hard state accreting neutron stars, which appears to have a slope similar to that for black holes but with a lower normalization (\citealt{Gallo18}, see also Figure \ref{fig:f1}), individual systems deviate from this mean relation to a much greater degree than for black holes. Some systems, such as the accreting millisecond pulsar IGR J16597--3704 and the ultracompact system 4U 1543--624, are much fainter in the radio than predicted from this mean relation \citep{Tetarenko18,Ludlam19}. Others, such as the accreting millisecond pulsar IGR J17591--2342, are likely as radio-loud as accreting black holes over some range in X-ray luminosity, perhaps reaching down to $L_X \sim 4\times 10^{35}$--$10^{36}$ erg s$^{-1}$ \citep{Russell18,Gusinskaia20b}. The deviations occur not only in normalization but in slope: there is good evidence that in at least in some systems, the radio emission becomes much fainter, or is quenched entirely, at $L_X \lesssim 10^{36}$ erg s$^{-1}$ \citep{Gusinskaia17,Gusinskaia20a}. The results from this current paper, combining persistent systems with the outbursting binary GRS 1747--312, provide strong support for this picture of a broad range of behaviors for different neutron star LMXBs. Since these systems are all located in Galactic globular clusters, they also add the crucial element of known distances, which allows firm luminosity measurements that are lacking for many of the field systems. Perhaps the only hard/island state accreting neutron star in our sample that that sits close to the mean radio/X-ray relation is the ultracompact 4U 1820--30, which does so at $L_X \sim 10^{37}$ erg s$^{-1}$ in Figure \ref{fig:f1}. M15 X-2 (also an ultracompact) appears to have similar radio/X-ray properties to 4U 1820--30 at this epoch, but the situation is slightly more complex, as the M15 X-2 observations may have occurred while the binary was transitioning to a softer state (Section 3.6.2). GRS 1747--312 is a spectacular outlier. In the 2015 quasi-simultaneous radio/X-ray epoch, it is the most radio-luminous neutron star LMXB ever observed at $L_X < 10^{35}$ erg s$^{-1}$, sitting near the upper envelope of the black hole radio/X-ray correlation (Figure \ref{fig:f1}). In a subsequent quasi-simultaneous epoch in 2018, it has the lowest $L_X$ detection of radio emission for any ``normal" neutron star LMXB (i.e., excluding the transitional millisecond pulsars), again sitting close to the black hole radio/X-ray correlation. It shows substantial radio and X-ray variability between different epochs. In a third quasi-simultaneous epoch, it is not detected in the radio, suggesting at least a factor of 15 variability in the radio at these $L_X$ of a few $\times 10^{34}$ erg s$^{-1}$. As discussed below in Section 4.2.3, the radio variability and radio spectral index do not support the idea that the radio emission in GRS 1747--312 originates in a steady compact jet, and another physical mechanism is more likely. XB 1832--330 is a persistent X-ray source, and its deep radio upper limit at $L_X \sim 2\times10^{35}$ is among the most constraining observed at this $L_X$, comparable to that seen in Aql X-1 during its fading after an outburst \citep{Gusinskaia20a}. As in Aql X-1, the XB 1832--330 data are consistent either with a steep radio/X-ray correlation for this binary or with a quenching of the jet at this luminosity. X1850--087 is another system in our sample with a deep constraining radio upper limit in the hard state at a relatively high $L_X \sim 10^{36}$ erg s$^{-1}$, but these data may have been taken near the start of an outburst, making their interpretation more challenging; we defer further discussion of this system to Section 4.2.3. As an accretion disk corona source, the radio properties of AC 211 in M15 are also not straightforward to interpret, but if it is an accreting neutron star, it is rather radio-loud compared to other systems at this $L_X$. One potential explanation, discussed in Section 3.6.1, is that its luminosity is actually near the Eddington limit and its radio/X-ray properties are akin to Z sources such as Sco X-1. Another, less likely possibility is that AC 211 instead contains a black hole, but this is both a priori unlikely and difficult to prove. A number of recent papers have tried to determine whether there is a simple explanation for the wide variation in radio properties of neutron stars, but have found that the most likely potential explanations, such as the spin rate or magnetic field of the neutron star, cannot readily account for the observed differences \citep{Migliari11,Tetarenko18,Tudor17,vandenEijnden21}. These globular cluster neutron star LMXBs stress this point even further by widening the range of observed behaviors. All of the hard state radio/X-ray measurements here are for ``normal" persistent or transient neutron stars; none of these systems are known to be accreting millisecond X-ray pulsars, which are suspected (but not proven) to have higher magnetic fields than other neutron star LMXBs \citep{Patruno21}. Hence these data are consistent with the idea that magnetic field strength is not the primary determinant of radio-loudness for accreting neutron stars. \begin{figure*} \includegraphics[width=1.0\textwidth]{figures/more_piss_and_vinegar_real.pdf} \caption{The relationship between radio spectral index and radio luminosity at 5.0 GHz. Filled markers have an associated quasi-simultaneous X-ray observation, while unfilled markers do not. The size of the marker indicates an estimate of the X-ray luminosity: small points $10^{33} \leq L_X \leq 10^{35}$ erg s$^{-1}$ , medium points $10^{35} \leq L_X \leq 10^{37}$ erg s$^{-1}$, and the largest points $L_X > 10^{37}$ erg s$^{-1}$. The upside down triangle represents a spectral index upper limit for one epoch of 4U 1820--30. Steady compact jets are expected to consistently show flat to mildly inverted spectral indices ($0 \lesssim \alpha \lesssim +0.5$). Strongly inverted spectral indices ($\alpha \gtrsim +0.5$) reflect more optically thick synchrotron emission, while more negative spectral indices (typically $-0.8 \lesssim \alpha \lesssim -0.4$) represent partially or entirely optically thin synchrotron. As discussed in the text, there may be a weak trend for more negative spectral index at the highest radio luminosity, but this is primarily driven by AC 211.} \label{fig:f5} \end{figure*} \subsection{Spectral Indices} The radio emission of neutron star LMXBs is thought to be non-thermal synchrotron radiation. Over some range of frequencies, synchrotron radiation is expected to emit as a power law, with $S_{\nu} \propto \nu^\alpha$. The expected value of the spectral index depends on the origin of the synchrotron emission. Within the jet paradigm, flat ($\alpha \sim 0$) to inverted ($\alpha \gtrsim 0$) spectra are generally associated with an optically thick, steady, compact jet in the low/hard X-ray state \citep{Blandford79, Fender01}. Steeper ($\alpha \lesssim 0$) spectra suggest less optically thick emission, with $\alpha \sim -0.4$ to --0.8 expected for optically thin synchrotron, as might arise from the ejection of discrete jet blobs during hard to soft X-ray state transitions often observed in black hole LMXBs (e.g., \citealt{MillerJones12}). Only a handful of neutron star LMXBs have published high-quality estimates of the radio spectral index in the low/hard state, typically at $L_X \gtrsim 10^{36}$ erg s$^{-1}$. These are mostly consistent with the flat to inverted spectral index expected for an optically-thick compact jet \citep{Migliari10,MillerJones10,TetarenkoA16,Gusinskaia17,vandenEijnden18}. Possible exceptions are SAX J1808.4--3658, which had a mildly negative mean spectral index ($\alpha = -0.24\pm0.10$) at $L_X \sim 10^{36}$ erg s$^{-1}$ during its 2015 outburst \citep{Tudor17}, and IGR J17591--2342, which showed marginal evidence for evolution from a flat/inverted to slightly negative spectral index over the course of an outburst, declining from $L_X \sim 2\times 10^{36}$ to $\sim 4\times 10^{35}$ erg s$^{-1}$ \citep{Gusinskaia20b}. For the four IGR J17591--2342 radio measurements during the fading part of the outburst, the mean spectral index was $\alpha = -0.35\pm0.11$, compared to a mean spectral index of $\alpha = +0.17\pm0.09$ for the three radio measurements during the initial radio-bright stage of the outburst. In this paper we have presented spectral index measurements for five globular cluster binaries, most with multiple measurements, representing a substantial increase in neutron star LMXBs with well-measured radio spectral indices. \subsubsection{4U1820--30 and M15 X-2} For the 2015 ATCA observation of 4U 1820--30 we find $\alpha = -0.26\pm0.05$ in the hard state at $L_X \sim 10^{37}$ erg s$^{-1}$. This well-measured spectral index has a slightly steep value, which could suggest it is partially optically thin at these frequencies. In addition, the 5.0 GHz radio flux density is essentially identical to that observed with ATCA in 2014 when 4U1820--30 was in a brighter ($L_X \sim 8 \times 10^{37}$ erg s$^{-1}$) soft state \citep{diaztrigo2017}. We note that when the present paper was close to submission, a new paper appeared with a comprehensive analysis of new and archival radio continuum and X-ray observations of 4U 1820--30 \citep{Russell21}. Their results are consistent with, but more extensive than, the spectral index analysis in our paper, and suggest a transition from flat-spectrum steady compact jet emission in the low (island) state to steeper, possibly transient emission from jet ejecta in the high (banana) state. The radio spectral index measurements for M15 X-2 all come from its X-ray brightening event in May 2011. While we do not have X-ray spectral information for the first radio epoch, the radio continuum measurements are consistent with the likely initial presence of a discrete optically thick synchrotron blob ($\alpha = +0.90\pm0.17$) which then fades before recovering in radio luminosity to a flat spectrum ($\alpha = -0.02\pm0.12$) consistent with a compact jet at $L_X \sim 10^{37}$ erg s$^{-1}$. As discussed in Section 3.6.2, at this latter epoch the system is consistent either being in a hard state or in a transition from a hard state to a soft state on the rise to the peak of the brightening event. We cannot definitively decide between these possibilities with these data: there is no evidence for the jet being quenched in the May 30 VLA observation. Overall, in May 2011 M15 X-2 shows ``classic" radio behavior for LMXB in the initial stages of an X-ray flare/outburst. \subsubsection{AC 211: A Candidate Z Source} The spectral index data for AC 211 are from the same dataset as M15 X-2. However, the AC 211 data not well-explained by a standard hard/island state accreting neutron star model. In the first two observations (2011 May 22 and 26) the source shows a flat spectral index, consistent with a jet, while its radio luminosity increased by a factor of $\sim 3$ between the first and second epochs. On 2011 May 30 (four days later), a steeper spectrum is observed ($\alpha = -0.55\pm0.10$) despite little change in the 5.0 GHz flux density. The next radio data available are three months later, on 2011 August 21, with both the spectrum and flux matching the previous epoch. But only one day later (2011 August 22) the 5.0 GHz flux doubles while the spectrum remains steep. To summarize, AC 211 shows substantial variation in both its radio luminosity and spectral index, but with no clear correlation between these. Previously published observations of AC 211 also show evidence for variability. A pre-upgrade VLA image of M15 found a 1.4 GHz source with a flux density of $\sim 1.8$ mJy at a position consistent with AC 211 \citep{Kulkarni90}; this measurement is roughly consistent with the brightest 5.0 GHz flux density we see, assuming an $\alpha=-0.7$ spectral index. However, very long baseline imaging finds a typical flux density of around 200 $\mu$Jy at 1.6 GHz \citep{Kirsten14}, which would be more consistent with a flat spectral index and a fainter overall flux level. An interpretation of AC 211 as a Z source accreting at close to the Eddington limit would give a straightforward explanation for the variability in the radio flux density and spectral index as due to discrete cases of jet ejection events (e.g., \citealt{Hjellming90, Fomalont01}). This interpretation appears to offer a more plausible explanation for the high radio luminosity of AC 211 than the speculative idea that the primary is a black hole. \subsubsection{The Weirdos: X1850--087 and GRS 1747--312} For X1850--087 the interpretation of its spectral indices are mixed together with our interpretation of its fast radio variability, which is somewhat confusing (Section 3.2). The strongly inverted to flat spectral indices observed from 2014 May 5--9 appear to coincide with an X-ray flare, so can be explained as transient optically thick synchrotron emission. However, the source is undetected in the radio on 2014 May 13 before becoming bright again, with a flat to inverted spectral index, on May 18--20. Since the system was not detected in the radio in an apparently normal hard state ($L_X \sim 10^{36}$ erg s$^{-1}$) on 2014 April 5, one possibility is that this system has no jet in the hard state at this $L_X$, and that it transitioned to the hard (or intermediate hard) state by May 13, before undergoing a fast reflare by May 18 associated with partially optically thick synchrotron emission. This scenario is not generally consistent with previous observations of X1850--087 in the X-ray and radio (Section 3.2) but cannot be ruled out either. The level of X-ray variability observed in X1850--087 and other persistent ultracompact LMXBs is already challenging to explain (e.g., \citealt{intZand07,Maccarone10,Cartwright13}), and these new radio results are intriguing, highlighting the need for more coordinated radio and X-ray observations of this source. The final source with spectral index measurements is GRS 1747--312. It was well-detected in many radio epochs, despite being relatively faint with $L_X \sim 7\times10^{33}$ to $4\times10^{34}$ erg s$^{-1}$. At the first (and radio-brightest) epoch in 2015, sitting at the upper edge of the black hole radio/X-ray correlation, it had $\alpha = -0.43\pm0.08$ in ATCA data, more consistent with optically thin synchrotron than the flat/inverted emission associated with a steady jet. In an average of the 2018 VLA detections, it was fainter, with a mean $\alpha = -0.51\pm0.29$, consistent with the previous ATCA epoch. However, the range of values measured in the individual epochs was enormous ($-1.77\pm0.56$ to $+0.53\pm0.50$) and consistent with an intrinsic spread in the spectral indices, though this cannot be proven with these data due to the large uncertainties on the individual measurements. The radio spectral indices and extreme radio variability are not consistent with expectations for a steady compact jet. One possibility is that the radio emission is associated with individual luminous discrete ejecta events; in principle it might be possible to image the brightest events with very long baseline interferometry. Other explanations may also be feasible. For example, the transitional millisecond pulsar PSR J1023+0038 is radio-loud in quiescence with a variable spectral index that changes on short timescales, though it is not as radio-loud as GRS 1747--312, and typically has a flatter/inverted spectral index \citep{Deller15}. For PSR J1023+0038, the radio emission likely comes from non-steady synchrotron bubbles created near the interface between the inner disk and the neutron star \citep{Bogdanov18}. PSR J1023+0038 is not alone: other confirmed and candidate transitional systems show luminous radio emission in their sub-luminous disk states \citep{Hill11,Jaodand19,Li20}. It is not clear whether the same physical mechanism powers the radio emission in all of these systems, and a more ``standard" propeller mechanism, producing a radio outflow, could instead be at play in a subset of them---or in GRS 1747--312. \subsubsection{Spectral Index and Radio Luminosity} In Figure \ref{fig:f5}, we show the spectral index of our sources as a function of their 5.0 GHz radio luminosity. More sources are plotted here than in Figure \ref{fig:f1}, since we do not require a simultaneous X-ray measurement to plot them here. Epochs with only radio upper limits are not plotted, since these have no spectral index measurements or constraints. As discussed for the individual sources above, there is no clear, strong relationship between radio luminosity and spectral index for individual sources or for the sample as a whole. There may be weak evidence for a change at the highest radio luminosities: those with $L_R > 10^{29}$ erg s$^{-1}$ have a mean $\alpha = -0.39 \pm 0.02$, while those below this radio luminosity have a mean $\alpha = +0.01 \pm 0.04$. However, this result is not very robust as it is dominated by the unusual source AC 211 at high luminosities. We also do not see evidence that the relationship between radio luminosity and spectral index varies substantially as a function of broad bins of X-ray luminosity. However, this is also not straightforward to interpret, since we do not have simultaneous X-ray data (and hence proper spectral classification) for each measurement. \section{Summary} In this paper, we used X-ray and radio data to investigate the relationship between the accretion flow and jet/outflow in six persistently accreting neutron star LMXBs and two other transient sources in Galactic globular clusters. These data represent the largest sample of quasi-simultaneous radio and X-ray observations of persistently accreting neutron star LMXBs in the low/hard state. The location of these sources in the standard radio/X-ray diagram for accreting compact objects broadly follows the results from previous studies of neutron star LMXBs, but with greater extremes of luminous radio emission and constraining upper limits. From the current sample alone there is no evidence for a well-defined correlation between X-ray and radio emission for neutron star LMXBs, but instead a large scatter in properties at all observed $L_X$ values. Nearly all of the sources in our sample with multiple measurements of their radio properties show unusual variability in both their luminosity and radio spectral index. This highlights the need for additional, high-cadence simultaneous radio and X-ray observations of neutron stars, even in nominally persistent systems, to make progress in understanding jets/outflows from accreting neutron stars. \section{Acknowledgements} We would like to acknowledge the thoughtful comments of an anonymous referee that substantially improved the paper. TP dedicates this paper to the essential workers and cleaning staff at Michigan State and other institutions around the world, whose labor provided us with crucial resources and a space where astrophysical research can thrive during the time of COVID-19. We acknowledge support from NSF grant AST-1308124 and NASA grants NNX16AN73G, Chandra-GO7-18032A, Chandra-GO8-19122X, and 80NSSC21K0628. TP is funded by the NSF Graduate Research Fellowship (DGE 1848739). JS acknowledges support from the Packard Foundation. COH is supported by NSERC Discovery Grant RGPIN-2016-04602. GRS is supported by NSERC Discovery Grants RGPIN-2016-06569 and RGPIN-2021-04001. The National Radio Astronomy Observatory is a facility of the National Science Foundation operated under cooperative agreement by Associated Universities, Inc. The Australia Telescope Compact Array is part of the Australia Telescope National Facility which is funded by the Australian Government for operation as a National Facility managed by CSIRO. The scientific results reported in this article are partially based on on observations made by the Chandra X-ray Observatory. This work made use of data supplied by the UK Swift Science Data Centre at the University of Leicester. This research has made use of data and software provided by the High Energy Astrophysics Science Archive Research Center (HEASARC), which is a service of the Astrophysics Science Division at NASA/GSFC and the High Energy Astrophysics Division of the Smithsonian Astrophysical Observatory.\\ \noindent \textit{Facilities}: VLA, ATCA, Swift/XRT, Chandra \noindent \textit{Software}: Astropy \citep{Robitaille13}, AIPS \citep{Greisen03}, \textsc{CASA} \citep{McMullin07}, \textsc{CIAO} \citep{Fruscione06}, \textsc{Heasoft} \citep{HEASARC14} Matplotlib \citep{Hunter07}, Miriad \citep{Sault95}, NumPy \citep{harris20}, pandas \citep{Mckinney10}, \textsc{Xspec} \citep{Arnaud96}
\section{Introduction} Policy gradient-based methods for reinforcement learning have enjoyed great success in recent years. The stability and reliability of these methods is typically improved by controlling the size of policy updates, using either a ``trust region'' (TRPO) or a surrogate objective (PPO) \citep{trpo, ppo}. The usual justification for this is that we cannot trust updates that take us too far from the policy used to collect experience, called the \textit{behavior policy}. In this work we identify a subtle flaw with this: the behavior policy is irrelevant to the justification. Instead, what matters is that we control \textit{how fast} the policy is updated, or put another way, that we approximate the natural policy gradient \citep{naturalpg}. Our key insight is that the ``old'' policy in these methods serves two independent purposes. The first purpose is for off-policy corrections, via importance sampling, for which the old policy must be the behavior policy. The second purpose is to control the size of policy updates, for which the old policy can be any recent policy, which we call the \textit{proximal policy}. It does not matter whether the proximal policy is also the behavior policy; it only matters \textit{how old} the proximal policy is. We demonstrate this by running PPO with stale data collected using a policy from multiple iterations ago, which causes performance to quickly degrade unless the proximal policy is decoupled from the behavior policy. Our insight allows us to make PPO \textit{batch size-invariant}, meaning that when the batch size is changed, we can preserve behavior, as a function of the number of examples processed, by changing other hyperparameters (as long as the batch size is not too large). We achieve this by using an exponentially-weighted moving average (EWMA) of the policy network's weights as the network for the proximal policy. Batch size-invariance has been studied many times before (see Section \ref{invariancesgd}), sometimes under the name ``perfect scaling''. It is of practical benefit when we wish to increase the batch size to reduce gradient variance, but computational resources such as GPU memory do not allow this. In such a situation, we can instead adjust other hyperparameters formulaically, thereby spreading out the increased computational load over time. The remainder of the paper is structured as follows. \begin{itemize} \item In Section \ref{decouple}, we explain the difference between the proximal and behavior policies, and show how to decouple them in PPO's objectives. \item In Section \ref{invariance}, we explain the concept of batch size-invariance, and how it applies to SGD and Adam \citep{adam}. \item In Section \ref{ewma}, we introduce PPO-EWMA and PPG-EWMA, variants of PPO and PPG \citep{ppg} that make use of our decoupled objectives, and show how to make them batch size-invariant at small batch sizes. \item In Section \ref{experiments}, we provide experimental evidence for our central claims: that decoupling the proximal policy from the behavior policy is safe and useful, and that this allows us to achieve batch size-invariant policy optimization. \item Finally, in Section \ref{discussion}, we discuss the theoretical and practical implications of our results. \end{itemize} \section{Decoupled policy objectives}\label{decouple} In this section we explain the difference between the proximal and behavior policies, and introduce new versions of PPO's objectives in which they have been decoupled. PPO alternates between sampling data through interaction with the environment, and optimizing a surrogate objective. The policy used for sampling is denoted $\pi_{\theta_{\mathrm{old}}}$, and is used by the objective in two different ways. This is easiest to see with the KL penalized objective \citep[equation (8)]{ppo}: \[L^{\mathrm{KLPEN}}\left(\theta\right):=\hat{\mathbb E}_t\left[\frac{\pi_\theta\left(a_t\mid s_t\right)}{\pi_{\theta_{\mathrm{old}}}\left(a_t\mid s_t\right)}\hat A_t-\beta\operatorname{KL}\left[\pi_{\theta_{\mathrm{old}}}\left(\cdot\mid s_t\right),\pi_\theta\left(\cdot\mid s_t\right)\right]\right].\] The first use of $\pi_{\theta_{\mathrm{old}}}$ in this expression is as part of an importance sampling ratio. In order for the policy gradient estimate to be unbiased, this policy needs to be the one that was used for sampling, so we call this the \textit{behavior policy} $\pi_{\theta_{\mathrm{behav}}}$. The second use of $\pi_{\theta_{\mathrm{old}}}$ is as a recent target to pull the current policy towards, so we call this the \textit{proximal policy} $\pi_{\theta_{\mathrm{prox}}}$. Our key insight is that \textbf{the proximal policy need not equal the behavior policy}. As we will show experimentally, it matters \textit{how old} the proximal policy is, but it does not matter whether or not the proximal policy was used for sampling. We therefore define the \textit{decoupled KL penalized objective} \[\boxed{L^{\mathrm{KLPEN}}_{\color{red}\mathrm{decoupled}}\left(\theta\right):=\hat{\mathbb E}_t\left[\frac{\pi_\theta\left(a_t\mid s_t\right)}{\pi_{\theta_{\color{red}\mathrm{behav}}}\left(a_t\mid s_t\right)}\hat A_t-\beta\operatorname{KL}\left[\pi_{\theta_{\color{red}\mathrm{prox}}}\left(\cdot\mid s_t\right),\pi_\theta\left(\cdot\mid s_t\right)\right]\right]},\] where $\pi_{\theta_{\mathrm{behav}}}$ is the policy used for sampling, and $\pi_{\theta_{\mathrm{prox}}}$ is a recent policy yet to be specified. It is less obvious how to decouple the clipped PPO objective, because $\pi_{\theta_{\mathrm{old}}}$ only appears once in that expression \citep[equation (7)]{ppo}: \[L^{\mathrm{CLIP}}\left(\theta\right):=\hat{\mathbb E}_t\left[\min\left(r_t\left(\theta\right)\hat A_t,\operatorname{clip}\left(r_t\left(\theta\right),1-\epsilon,1+\epsilon\right)\hat A_t\right)\right],\] where $r_t\left(\theta\right):=\frac{\pi_\theta\left(a_t\mid s_t\right)}{\pi_{\theta_{\mathrm{old}}}\left(a_t\mid s_t\right)}$. However, we can rewrite this objective as \[L^{\mathrm{CLIP}}\left(\theta\right)=\hat{\mathbb E}_t\left[\frac 1{\pi_{\theta_{\mathrm{old}}}}\min\left(\pi_\theta\hat A_t,\operatorname{clip}\left(\pi_\theta,\left(1-\epsilon\right)\pi_{\theta_{\mathrm{old}}},\left(1+\epsilon\right)\pi_{\theta_{\mathrm{old}}}\right)\hat A_t\right)\right]\] (omitting the policy arguments $\left(a_t\mid s_t\right)$ for brevity). Now the first use of $\pi_{\theta_{\mathrm{old}}}$ is as part of an importance sampling ratio, for which we must use the behavior policy, and the second and third uses are in applying the implicit KL penalty, for which we can use the proximal policy. We therefore define the \textit{decoupled clipped objective} \[\boxed{L^{\mathrm{CLIP}}_{\color{red}\mathrm{decoupled}}\left(\theta\right):=\hat{\mathbb E}_t\left[{\color{red}\frac{\pi_{\theta_{\color{red}\mathrm{prox}}}\left(a_t\mid s_t\right)}{\pi_{\theta_{\color{red}\mathrm{behav}}}\left(a_t\mid s_t\right)}}\min\left(r_t\left(\theta\right)\hat A_t,\operatorname{clip}\left(r_t\left(\theta\right),1-\epsilon,1+\epsilon\right)\hat A_t\right)\right]},\] where $\boxed{r_t\left(\theta\right):=\frac{\pi_\theta\left(a_t\mid s_t\right)}{\pi_{\theta_{\color{red}\mathrm{prox}}}\left(a_t\mid s_t\right)}}$. As a sanity check, note that if we set the KL penalty coefficient $\beta=0$ or the clipping parameter $\epsilon=\infty$, then the dependence on the proximal policy disappears, and we recover the vanilla (importance-sampled) policy gradient objective \citep[equation (6)]{ppo}. \section{Batch size-invariance}\label{invariance} We say an algorithm is \textit{batch size-invariant} to mean that when the batch size is changed, the original behavior can be approximately recovered by adjusting other hyperparameters to compensate. Here we consider behavior as a function of the total number of examples processed, so another way to put this is that doubling the batch size halves the number of steps needed. \citet{dahlscaling} and \citet{nqm} refer to this as ``perfect scaling''. We treat batch size-invariance as a descriptive property that can hold to some degree, rather than as a binary property. In practice, the original behavior can never be recovered perfectly, and the extent to which it can be recovered depends on both how much and the direction in which the batch size is changed. \subsection{Batch size-invariance for stochastic gradient descent}\label{invariancesgd} Stochastic gradient descent (SGD) is batch size-invariant, up until the batch size approaches some critical batch size. This is the batch size at which the gradient has a signal-to-noise ratio of around 1. At smaller batch sizes than this, changes to the batch size can be compensated for by a directly proportional adjustment to the learning rate. This core observation has been many times before \citep{mandtsgd, goyalimagenet, smithle, chardinbatchsize, mabatchsize, dahlscaling, criticalbatchsize}. Here we sketch the explanation for this provided by previous work. A more thorough discussion of previous work can be found in Appendix \ref{previousinvariance}. Consider running SGD on a loss function $L\left(\theta;x\right)$ of a parameter vector $\theta$ and a data point $x$. Two steps with batch size $n$ and learning rate $\alpha$ corresponds to the update rule \[\theta_{t+2}=\theta_t-\frac\alpha n\sum_{x\in B_t}\nabla_\theta L\left(\theta_t;x\right)-\frac\alpha n\sum_{x\in B_{t+1}}\nabla_\theta L\left(\theta_{\color{red}t+1};x\right),\] where $B_t$ and $B_{t+1}$ are the next two batches of size $n$. On the other hand, a single step with batch size $2n$ and learning rate $2\alpha$ corresponds to the update rule \[\theta_{t+2}=\theta_t-\frac{2\alpha}{2n}\sum_{x\in B_t\cup B_{t+1}}\nabla_\theta L\left(\theta_{\color{red}t};x\right).\] These update rules are very similar, the only difference being whether the gradient for $B_{t+1}$ is evaluated at $\theta_t$ or $\theta_{t+1}$. If the batch size is small compared to the critical batch size, then the difference between $\theta_t$ and $\theta_{t+1}$ is mostly noise, and moreover this noise is small compared to the total noise accumulated by $\theta_t$ over previous updates. Hence the two update rules behave very similarly. A good mental model of SGD in this small-batch regime is of the parameter vector making small, mostly random steps around the loss landscape. Over many steps, the noise is canceled out and the parameter vector gradually moves in the direction of steepest descent. But a single additional step makes almost no difference to gradient evaluations. In more formal terms, SGD is numerically integrating a stochastic differential equation (SDE). Changing the learning rate in proportion the batch size leaves the SDE unchanged, and only affects the step size of the numerical integration. Once the step size is small enough, the discretization error is dominated by the noise, and so the step size stops mattering. \subsection{Batch size-invariance for Adam} Adam \citep{adam} is a popular variant of SGD, and is also batch size-invariant until the batch size approaches a critical batch size (which may be different to the critical batch size for SGD) \citep{nqm}. To compensate for the batch size being divided by $c$, one must make the following adjustments \citep{chardinbatchsize}: \begin{itemize} \item Divide the step size $\alpha$ by $\sqrt c$. \item (Raise the exponential decay rates $\beta_1$ and $\beta_2$ to the power of $\nicefrac{1}{c}$.) \end{itemize} The second adjustment is much less important in practice, since Adam is fairly robust to the $\beta_1$ and $\beta_2$ hyperparameters (hence it has been parenthesized). Note also that $\beta_1$ also affects the relationship between the current policy and the proximal policy in policy optimization. For simplicity, we omitted this adjustment in our experiments. The first adjustment should be contrasted with the linear learning rate adjustment for vanilla SGD. The reason for the difference is that Adam divides the gradient by a running estimate of the root mean square gradient. If the batch size is small compared to the critical batch size, then the gradient is mostly noise, and so the root mean square gradient is just the gradient standard deviation, which is inversely proportional to the square root of the batch size. Hence Adam is effectively dividing the learning rate by $\sqrt c$ automatically, and so the step size $\alpha$ only needs to be adjusted by an additional $\sqrt c$ to effectively divide the learning rate by $c$ overall. (This ignores Adam's $\epsilon$ hyperparameter, which is usually negligible, but is sometimes used to interpolate between Adam and momentum SGD.) Empirical support for the Adam square root step size rule is discussed in Appendix \ref{linearlr}. \subsection{Batch size-invariance for policy optimization} In policy optimization algorithms like PPO, there are two different batch sizes: the number of environment steps in each gradient step, which we call the \textit{optimization batch size}, and the number of environment steps in each alternation between sampling and optimization, which we call the \textit{iteration batch size}. When we say that such an algorithm is batch size-invariant, we mean that changes to both batch sizes \textit{by the same factor simultaneously} can be compensated for. The motivation for this definition is that this is the effect of changing the degree of data-parallelism. PPO is automatically \textit{optimization} batch size-invariant, as long as the optimization algorithm it uses (such as SGD or Adam) is as well. In the next section, we show how to make it \textit{iteration} batch size-invariant, and therefore batch size-invariant outright. \section{PPO-EWMA and PPG-EWMA}\label{ewma} We now introduce a simple modification that can be made to any PPO-based algorithm: \begin{itemize} \item Maintain an exponentially-weighted moving average (EWMA) of the policy network, updating it after every policy gradient step using some decay rate $\beta_{\mathrm{prox}}$. \item Use this as the network for the proximal policy in one of the decoupled policy objectives. \end{itemize} This allows us to independently control the age of the proximal policy by adjusting $\beta_{\mathrm{prox}}$. We refer to this modification using the -EWMA suffix. Thus from PPO we obtain PPO-EWMA, and from Phasic Policy Gradient (PPG) \citep{ppg} we obtain PPG-EWMA. Pseudocode for PPO-EWMA may be found in Appendix \ref{pseudocode}, and code may be found at \url{https://github.com/openai/ppo-ewma}. To see how this modification helps us to achieve batch size-invariance, note that the main effect of changing the iteration batch size in PPO is to change the age of the behavior and proximal policies (which are coupled). The age of the behavior policy affects how on-policy the data is, but this does not matter much, as long as it is not too large. However, the age of the proximal policy affects the strength of the KL penalty (or the implicit KL penalty in the case of the clipped objective), which influences how fast the policy can change. We therefore need to maintain the age of the proximal policy as the iteration batch size is changed, which is what our modification enables. More specifically, to achieve batch size-invariance for PPO- and PPG-EWMA, we make the following adjustments to compensate for the optimization and iteration batch sizes being divided by $c$: \begin{itemize} \item Adjust the optimization hyperparameters as described in the previous section, i.e., divide the vanilla SGD learning rate by $c$ or the Adam step size by $\sqrt c$. (We use Adam.) \item Multiply $\frac 1{1-\beta_{\mathrm{prox}}}-1$ by $c$. (This expression is the center of mass of the proximal policy EWMA, measured in gradient steps.) This adjustment is what keeps the age of the proximal policy constant, measured in environment steps. \item If using advantage normalization, multiply the number of iterations used to estimate the advantage mean variance by $c$. (In practice, we use EWMAs to estimate the mean and variance, and multiply their effective sample sizes by $c$.\footnote{The effective sample size, sometimes called the span, of an EWMA with decay rate $\beta$ is equal to $\frac 2{1-\beta}-1$.}) This prevents the standard errors of these estimates becoming too large. \item For PPG, multiply the number of policy iterations per phase $N_\pi$ by $c$. (We use PPG.) \end{itemize} For these adjustments to work, we require that the optimization batch size is sufficiently small. We also require that the number of policy epochs (denoted $E$ in PPO or $E_\pi$ in PPG) is 1. This is because when the iteration batch size is very small, using multiple policy epochs essentially amounts to training on the same data multiple times in a row, which is redundant (modulo changing the learning rate). Our batch size-invariance experiments therefore use PPG-EWMA, where $E_\pi=1$ is the default. Note that PPG has a third batch size: the number of environment steps in each alternation between phases, which we call the \textit{phase batch size}. The effect of our adjustment to $N_\pi$ is to simply hold the phase batch size constant, thereby preserving the dynamics of the policy and auxiliary phases. \section{Experiments}\label{experiments} To validate our analysis, we ran several experiments on Procgen Benchmark \citep{procgen}, which we found to serve as a useful testbed due to the difficulty and diversity of the environments. Hyperparameters for all of our experiments can be found in Appendix \ref{hyperparameters}. \subsection{Artificial staleness} To investigate our decoupled policy objectives, we introduced artificial staleness. By this we mean that once data has been sampled through interacting with the environment, it is not immediately used for optimization, but is instead placed in a buffer to be used a fixed number of steps later. Despite being artificial, similar staleness is often encountered in asynchronous training setups, where it is known to cause problems for on-policy algorithms like PPO \citep{dota}. We measure staleness in iterations, with one iteration being a single alternation between sampling and optimization. With artificial staleness, the original PPO objectives are underspecified, since there are two natural choices for $\pi_{\theta_{\mathrm{old}}}$: the policy immediately preceding the current iteration, denoted $\pi_{\theta_{\mathrm{recent}}}$, and the behavior policy $\pi_{\theta_{\mathrm{behav}}}$. However, the decoupled objectives allow us to take the proximal policy $\pi_{\theta_{\mathrm{prox}}}$ to be the recent policy, while continuing to use the behavior policy for importance sampling. This allows the KL penalty (or clipping) to have a consistent effect in terms of controlling how fast the policy changes, while avoiding harmful bias from incorrect importance sampling. In our experiments, we compare the decoupled objective to both choices for the original objective. Our results are shown in Figure \ref{stalenessfigure}. With both choices for the original objective, even a small amount of staleness hurts performance. However, with the decoupled objective, performance is robust to a surprising amount of staleness, with minimal degradation until a staleness of around 8 iterations (over 500,000 environment steps). This demonstrates that the decoupling the proximal policy from the behavior policy is safe and useful. \begin{figure} \centerline{\scalebox{.75}{\input{figures/staleness.pgf}}} \begin{changemargin}{-.15in}{-.6in} \begin{subfigure}[t]{.31\linewidth} (a) Using the recent policy for importance sampling introduces bias that makes training highly unstable for even small amounts of staleness. \end{subfigure} \hspace{.02\linewidth} \begin{subfigure}[t]{.31\linewidth} (b) The decoupled objective allows the correct importance sampling ratio to be used while maintaining the age of the proximal policy, preventing performance from degrading much until the data is very stale. \end{subfigure} \hspace{.02\linewidth} \begin{subfigure}[t]{.31\linewidth} (c) Using the behavior policy to control the size of policy updates holds back learning unnecessarily for small amounts of staleness, but the additional stability is helpful for very stale data. \end{subfigure} \end{changemargin} \caption{PPO with artificial staleness, averaged over all 16 Procgen environments. One iteration corresponds to $65,536$ environment steps with our hyperparameters. Mean and standard deviation over 4 seeds shown.} \label{stalenessfigure} \end{figure} \subsection{Batch size-invariance} We tested our method of achieving batch size-invariance for PPG-EWMA described in Section \ref{ewma}. Since the optimization batch size is required to be sufficiently small, we started from our default batch size, which uses 256 parallel copies of the environment, and reduced it by factors of 4 until we were running just a single parallel copy of the environment. Full results of our experiments on each of the individual environments can be found in Appendix \ref{resultsbyenvbatchsizeinvariance}, while a summary is shown in Figure \ref{batchsizeinvariancefigure}. We were able to achieve complete batch size-invariance (with essentially indistinguishable learning curves at every batch size) in around half of the environments, and near-complete invariance in every environment except Heist. We are not sure why we were not able to achieve complete batch size-invariance in some of the environments. One possible reason is that we did not adjust the Adam $\beta_1$ and $\beta_2$ hyperparameters, although we did not find the adjustment proposed in Section \ref{invariance} to noticeably help. We leave further analysis of this to future work. \begin{figure} \centerline{\scalebox{.75}{\input{figures/batch_size_invariance.pgf}}} \caption{PPG-EWMA at different batch sizes, with hyperparameters adjusted so as to achieve near-complete batch size-invariance, averaged over all 16 Procgen environments. For reference, we also show PPG (at the default batch size) with the KL penalty coefficient ($\beta$ in the $L^{\mathrm{KLPEN}}$ policy objective) reduced to $\nicefrac{1}{256}$, which serves as an approximate lower bound on PPG's performance with a KL penalty that is too weak. On the right we show ablations with all but one of the adjustments. Mean and standard deviation over 3 seeds shown.} \label{batchsizeinvariancefigure} \end{figure} We conducted ablations in which all but one of the adjustments was removed, the results of which are also summarized in Figure \ref{batchsizeinvariancefigure}. By far the most important adjustment is the Adam step size adjustment, without which training becomes highly unstable at the smallest batch sizes. Next most important is the advantage normalization adjustment, which does not matter much in many environments, but matters a lot at the smallest batch sizes in environments for which the advantage standard deviation estimates are particularly noisy. The adjustment to the EWMA is actually the least important, because PPG is relatively robust to changes to the KL penalty, but it is still required to achieve complete batch size-invariance in most of the environments. We did not run an ablation for the adjustment to the PPG hyperparameter $N_\pi$, but can infer from \citet[Figure 5]{ppg} that it comes immediately after the Adam step size adjustment in importance. \subsection{EWMA comparison} Finally, we tested the outright benefit of the EWMA modification by doing a head-to-head comparison of PPO against PPO-EWMA and of PPG against PPG-EWMA. Our results are shown in Figure \ref{headtoheadfigure}. \begin{figure} \centerline{\scalebox{.75}{\input{figures/head_to_head.pgf}}} \caption{Performance of all 4 algorithms on Procgen. Mean and standard deviation over 4 seeds shown.} \label{headtoheadfigure} \end{figure} We found the EWMA to give a small but consistent benefit across environments to both PPO and PPG. We believe that this is the result of the EWMA reducing the variance of the proximal policy. Further evidence that the variance of the proximal policy matters is discussed in Appendix \ref{betaprox}. Note that this benefit comes at the cost of additional memory to store the weights of the EWMA network, and an additional forward pass of the EWMA network for each policy gradient step. With our hyperparameters, this increases the computational cost of PPO by 30\% and of PPG by 2.3\%, not including the cost of stepping the environment.\footnote{These costs are calculated as follows. PPO has 1 forward-only and 3 forward-backward passes per environment step, to which PPO-EWMA adds 3 forward-only passes. PPG has 1 forward-only and 7 forward-backward passes of both networks per environment step, to which PPG-EWMA adds 1 forward-only pass of the policy network. A forward-backward pass has 3 times the cost of a forward-only pass.} \footnote{In practice, including the time taken to step the environment, the EWMA increased wall-clock time by 19\% for PPO and by 3\% for PPG, but our PPG-EWMA implementation included an additional unnecessary forward pass of an EWMA of the value network.} \section{Discussion}\label{discussion} \subsection{PPO as a natural policy gradient method} Our experiments provide strong empirical support that decoupling the proximal policy from the behavior policy is safe and useful: it can be used to make more efficient use of stale data, to achieve batch size-invariance, and to slightly improve sample efficiency outright. This implies that the usual justification for PPO's surrogate objectives, that they approximate trust region methods, is subtly flawed: it does not matter how far from the behavior policy we move per se, only that we stay close to \textit{some} recent policy, or in other words, that we do not move too fast. We speculate that updates should \textit{efficiently} improve performance relative to how much the policy is changed, similarly to natural policy gradient methods \citep{naturalpg}. This conflicts with the results of \citet{trpo}, which found constraining updates relative to the behavior policy to be beneficial. With the benefit of hindsight, we believe that at that time, constraint methods had hyperparameters that were easier to tune, but that with the advent of PPO's clipped objective and various normalization schemes, this tends to no longer be the case. \subsection{Practical advice for policy optimization at small batch sizes} When solving challenging problems using reinforcement learning, it is often beneficial to increase the batch size to reduce gradient variance. But this is often prohibited by computational resources such as GPU memory, especially with the trend of increasingly large models. The benefit of batch size-invariance is that we can instead train for longer while adjusting other hyperparameters. However, when working in a new domain, we may not know which hyperparameters would have worked well at larger batch sizes. We therefore attempt to distill our findings into practical advice for getting policy optimization to work well in a new domain at small batch sizes. Our advice, much of which is already folklore, is as follows: \begin{itemize} \item By far the most important hyperparameter to tune is the learning rate (or Adam step size). Once it has been tuned for a certain batch size, it can be adjusted formulaically for use at other batch sizes using the rules given in Section \ref{invariance}, as long as the batch size remains small. \item Consider setting the number of policy epochs ($E$ in PPO or $E_\pi$ in PPG) to 1, at least initially. This is the easiest way to maintain stability even if not enough ratios are being clipped. Furthermore, multiple policy epochs are less likely to be beneficial when the iteration batch size is small. \item If using clipping, monitor the fraction of ratios clipped. If it is much less than 1\%, then it is probably beneficial to increase the iteration batch size\footnote{The iteration batch size can be increased without changing the sampling or optimization batch size by simultaneously increasing the number of timesteps per rollout ($T$) and the number of minibatches per epoch. However, $T$ also affects the amount of bootstrapping performed, and so the GAE bootstrapping parameter ($\lambda$) may also need to be adjusted to compensate.}, or to use PPO-EWMA with a high $\beta_{\mathrm{prox}}$. If it is much more than 10\% with 1 policy epoch or 20\% with multiple policy epochs, then this is often a sign that the learning rate is too high. \item If using advantage normalization, monitor the advantage standard deviation estimates. If estimates oscillate by a factor of 10 or more, then it is probably beneficial to perform normalization using data from more iterations. \end{itemize} \section{Conclusion} Policy optimization algorithms such as PPO typically control the size of policy updates using a recent policy we call the proximal policy. We have shown that this policy can be safely decoupled from the behavior policy, which is used to collect experience. We introduced PPO-EWMA and PPG-EWMA, variants of PPO and PPG in which the proximal policy is an exponentially-weighted moving average of the current policy. These variants allow stale data to be used more efficiently, and are slightly more sample efficient outright. Finally, we showed how to make these algorithms batch size-invariant, meaning that when the batch size is changed, we can preserve behavior, as a function of the number of examples processed, by changing other hyperparameters (as long as the batch size is not too large). We discussed our findings, which have both theoretical and practical implications for policy optimization. \section{Acknowledgments} We thank David Farhi and Chris Hardin for helpful discussions and comments. \bibliographystyle{abbrvnat}
\section{Kitaev's formula and traces of certain commutators} In a finite dimensional Hilbert space $\mathcal H$, the determinantal formula \begin{equation}\label{eq:Det} \det\pa{ABA^{-1}B^{-1}}=1 \end{equation} holds for any invertible operators $A,B\in\mathcal L(\mathcal H)$. Its naive generalization to the infinite dimensional case (via the Fredholm extension, see e.g., \cite[Sections 3]{S} for a background and basic properties) fails. A simple counterexample can be constructed using the Helton-Howe-Pincus formula, \cite{E}: Let $C$ and $D$ be bounded operators on a Hilbert space $\mathcal H$ such that $[C,D]\in \mathcal S_1$ (the Schatten trace class), where $[C,D]=CD-DC$ stands for the commutator of $C$ and $D$. Then $\mathrm{e}^C\mathrm{e}^D\mathrm{e}^{-C-D}=I+S$, where $I$ denotes the identity map and $S\in\mathcal S_1$. In particular, the Fredholm operator below is well defined and satisfies \begin{equation}\label{eq:PIN}\det\pa{\mathrm{e}^C\mathrm{e}^D\mathrm{e}^{-C-D}}=\mathrm{e}^{\frac12\mathrm{tr}[C,D]}.\end{equation} Thus ${\mathrm{e}^C\mathrm{e}^D\mathrm{e}^{-C}\mathrm{e}^{-D}}-I\in \mathcal S_1$ and using a basic property of the Fredholm determinant \begin{equation}\label{eq:Pinc} \det{\pa{\mathrm{e}^C\mathrm{e}^D\mathrm{e}^{-C}\mathrm{e}^{-D}}}=\det{\pa{\mathrm{e}^C\mathrm{e}^D\mathrm{e}^{-C-D}}}\det{\pa{\mathrm{e}^{C+D}\mathrm{e}^{-C}\mathrm{e}^{-D}}}=\mathrm{e}^{\mathrm{tr}[C,D]}\end{equation} for such operators $C$ and $D$. Let $R,L$ denote the forward and backward shift operators on $\ell^2(\mathbb N)$ (with respect to the standard basis $\set{e_n}$), and let $z\in\mathbb C$. Then, the operators $A= \mathrm{e}^{zR}$, $B=\mathrm{e}^{L}$ are bounded and invertible, and moreover $[R,L]=P_1$, the orthogonal projection onto ${\rm Span}(e_1)$. Hence, \eqref{eq:Pinc} implies that $ABA^{-1}B^{-1}-I\in\mathcal S_1$ and \[\det\pa{ABA^{-1}B^{-1}}=\mathrm{e}^z,\] i.e., the expression on the left hand side can take any non-zero complex value. It is therefore an interesting question to determine under which conditions \eqref{eq:Det} actually holds. Another motivation to study this object comes from physics, where it can be linked to the quantization of transport in quantum systems, \cite{K}. Indeed, if both \eqref{eq:Det} and \eqref{eq:Pinc} hold, one can deduce the quantization of $\mathrm{tr}[C,D]$, i.e., $\mathrm{tr}[C,D]\in2\pi i{\mathbb Z}$. Kitaev observed via a formal computation that, if a pair of unitaries $U_1=\mathrm{e}^{iC}$, $U_2=\mathrm{e}^{iD}$ with bounded self-adjoint operators $C,D$ satisfy $(U_1-1)(U_2-1),(U_2-1)(U_1-1)\in\mathcal S_1$, then \eqref{eq:Det} holds, implying the quantization for the case $[C,D]\in\mathcal S_1$. This suggest the following \begin{conj}\label{conj} Suppose that \begin{enumerate} \item $A,B\in {\mathcal L}({\mathcal H})$ are invertible; \item $(A-I)(B-I),(B-I)(A-I)\in \mathcal S_1$. \end{enumerate} Then \eqref{eq:Det} holds. \end{conj} While we don't know how to prove Conjecture \ref{conj}, the purpose of this Note is to present an elementary derivation of the following weaker result. \begin{thm}\label{thm:main} Assume in addition to {\rm(i)-(ii)} that \begin{enumerate} \item[\rm{(iii)}] $(A^*-I)(B-I),(B-I)(A^*-I)\in \mathcal S_1$. \end{enumerate} Then, \eqref{eq:Det} holds. \end{thm} Let us stress that the condition \rm{(iii)} is not a necessary, but only a sufficient condition. This can be seen from \begin{prop}\label{lem3} Let $C$ be a quasinilpotent operator and $D$ bounded, such that \begin{equation}\label{Kcond}\pa{\mathrm{e}^{C}-I}\pa{\mathrm{e}^{D}-I},\pa{\mathrm{e}^{D}-I}\pa{\mathrm{e}^{C}-I}\in\mathcal S^1.\end{equation} Then \[\det\pa{\mathrm{e}^C\mathrm{e}^{D}\mathrm{e}^{-C}\mathrm{e}^{-D}}=1.\] \end{prop} We next note that if $A$ (or $B$) is normal, then \rm{(ii)} is equivalent to \rm{(iii)}, so in this case Conjecture \ref{conj} becomes a theorem, confirming Kitaev's formal observation. In fact, the proofs of Theorem \ref{thm:main} and Propositon \ref{lem3} can be combined to show that Conjecture \ref{conj} is satisfied for the so-called spectral operators, introduced by Dunford, \cite{D}. As we have already mentioned, \eqref{eq:Pinc} immediately implies \begin{cor}\label{cor} If $C,D\in\mathcal L(\mathcal H)$ satisfy \eqref{Kcond} and $[C,D]\in\mathcal S^1$, then $\mathrm{tr}[C,D]\in 2\pi {\mathbb Z}$. \end{cor} One can of course suspect, based on the vanishment of the trace of the commutator in the finite dimensional case, that in fact the only allowed value for $\mathrm{tr}[C,D]$ in the statement above is zero. To this end, we construct \begin{ex}\label{ex} There exist self-adjoint operators $C,D$ satisfying the assumptions of Corollary \ref{cor} such that $\mathrm{tr}[C,D]=4\pi i $. Specifically, let $C=f(x):= 2\pi i \frac{x}{\langle x\rangle}$ where $\langle x\rangle=(1+x^2)^{1/2}$ and let $D=f(p)$, where $x$ and $p=i\frac d{dx}$ are the position and momentum operators on $L(\mathbb R)$, see \cite[Section 4]{S} for details (we note that here $f(p)$ is understood as a convolution operator, see \cite[Theorem IX.29]{RS}). Then \eqref{Kcond} is satisfied, $[C,D]\in\mathcal S^1$, and $\mathrm{tr}[C,D]=4\pi i$. \end{ex} Since $U^k-I=(U-I)\sum_{j=0}^{k-1}U^j$ for any unitary $U$ and any $k\in{\mathbb Z}$, one deduces from this example that there are operators $C,D$ satisfying Corollary \ref{cor} above such that $\mathrm{tr}[C,D]=4k\pi i $ for {\it any} $k\in{\mathbb Z}$. \section{Proofs} \begin{proof}[Proof of Theorem \ref{thm:main}] \begin{lemma}\label{lem:SVD} Assume that the assumptions of Theorem \ref{thm:main} hold. Let $A=U|A|$ be the polar decomposition for $A$. Then $U$ is in fact a unitary operator, $|A|$ is invertible, there are $C,D$ that are normal and bounded such that $|A|=\mathrm{e}^{C}$, $U=\mathrm{e}^{D}$, and we have \begin{equation}\label{eq:SVD} \pa{\mathrm{e}^{C}-I}(B-I),(B-1)\pa{\mathrm{e}^{C}-I},\pa{\mathrm{e}^{D}-I}(B-I),(B-I)\pa{\mathrm{e}^{D}-I} \in \mathcal S_1. \end{equation} In addition, the formula \begin{equation}\label{eq:prod} \det\pa{ABA^{-1}B^{-1}}=\det\pa{\mathrm{e}^{C}B\mathrm{e}^{-C}B^{-1}}\det\pa{\mathrm{e}^{D}B\mathrm{e}^{-D}B^{-1}} \end{equation} holds. \end{lemma} \begin{proof} The fact that $U$ and $|A|$ are invertible (and consequently have exponential representation in terms of normal operators) follows directly from the invertibility of $A$, so we only need to establish \eqref{eq:SVD}--\eqref{eq:prod}. To this end, we note that \[(A^*A-I)(B-I)=(A^*+I)(A-I)(B-I)-(A-I)(B-I)+(A^*-I)(B-I) \in \mathcal S_1\] by {\rm(ii-iii)}. Hence \[(|A|-I)(B-I)=(|A|+I)^{-1}(A^*A-I)(B-I)\in \mathcal S_1\] as well. An identical argument yields the inclusion $(B-I)(|A|-I)\in \mathcal S_1$. We also have \begin{multline*} (B-I)(U-I)=(B-I)(A-|A|)|A|^{-1}\\ =(B-I)(A-I)|A|^{-1}-(B-I)(|A|-I)|A|^{-1}\in \mathcal S_1. \end{multline*} Finally, we have \begin{multline*} (U-I)(B-I)=(A-|A|)|A|^{-1}(B-I)=(A-|A|)(B-I)+(A-|A|)(|A|^{-1}-I)(B-I)\\=(A-I)(B-I)-(|A|-I)(B-I)-(A-|A|)|A|^{-1}(|A|-I)(B-I)\in \mathcal S_1, \end{multline*} so we established \eqref{eq:SVD}. The relation \eqref{eq:prod} follows from the fact that $|A|B|A|^{-1}B^{-1}=I+K$, $BU^*B^{-1}U=I+M$ with $K,M\in \mathcal S_1$ by \begin{equation}\label{eq:comform} ABA^{-1}B^{-1}=I+[A,B]A^{-1}B^{-1} \end{equation} and \eqref{eq:SVD}, the representation \[ABA^{-1}B^{-1}=U\pa{|A|B|A|^{-1}B^{-1}}\pa{BU^*B^{-1}U}U^*,\] as well as the basic properties of the Fredholm determinant. \end{proof} Applying Lemma \ref{lem:SVD} twice, we see that the statement of Theorem \ref{thm:main} follows from \begin{prop}\label{thm} Let $A,B$ be bounded normal operators in $\mathcal H$ that satisfy \[\pa{\mathrm{e}^{A}-I}\pa{\mathrm{e}^{B}-I},\pa{\mathrm{e}^{B}-I}\pa{\mathrm{e}^{A}-I}\in\mathcal S_1.\] Then \[\det\pa{\mathrm{e}^{A}\mathrm{e}^{B}\mathrm{e}^{-A}\mathrm{e}^{-B}}=1.\] \end{prop} \end{proof} \begin{proof}[Proof of Proposition \ref{thm}] We will use the following: \begin{lemma}\label{lem2} Let $B,D$ be a pair of bounded operators on $\mathcal H$ that satisfy \[D\pa{\mathrm{e}^{B}-I},\pa{\mathrm{e}^{B}-I}D\in\mathcal S_1.\] Then \[\det\pa{\mathrm{e}^{D}\mathrm{e}^{B}\mathrm{e}^{-D}\mathrm{e}^{-B}}=1.\] \end{lemma} \begin{proof} Using \eqref{eq:Pinc}, we have \[\det\pa{\mathrm{e}^{D}\mathrm{e}^{B}\mathrm{e}^{-D}\mathrm{e}^{-B}}=\det\pa{\mathrm{e}^{- \mathrm{e}^{B}D\mathrm{e}^{-B}}\,\mathrm{e}^{D}\mathrm{e}^{ \pa{\mathrm{e}^{B}D\mathrm{e}^{-B}-D}}}\det\pa{\mathrm{e}^{- \pa{\mathrm{e}^{B}D\mathrm{e}^{-B}-D}}}, \] where both determinants are well-defined. We now use \eqref{eq:PIN} to evaluate the first determinator on the right hand side: \[\det\pa{\mathrm{e}^{- \mathrm{e}^{B}D\mathrm{e}^{-B}}\,\mathrm{e}^{D}\mathrm{e}^{\pa{\mathrm{e}^{B}D\mathrm{e}^{-B}-D}}}=\exp\pa{-\mathrm{tr}\left[\mathrm{e}^{B}D\mathrm{e}^{-B},D\right]}=1,\] since \[\mathrm{tr}\left[\mathrm{e}^{B}D\mathrm{e}^{-B},D\right]=\mathrm{tr}\left[\mathrm{e}^{B}D\mathrm{e}^{-B}-D,D\right]=0,\] where in the last step we used $\mathrm{e}^{B}D\mathrm{e}^{-B}-D=[\mathrm{e}^{B}-I,D]\mathrm{e}^{-B}\in \mathcal S_1$. We note that \begin{equation}\label{eq:inv} \begin{aligned} \mathrm{tr}\pa{\mathrm{e}^{B}D\mathrm{e}^{-B}-D}&=\mathrm{tr}\pa{\mathrm{e}^{B}-I}D\mathrm{e}^{-B}+\mathrm{tr} D\pa{\mathrm{e}^{-B}-I} \\ &=\mathrm{tr} \pa{I-\mathrm{e}^{-B}}D+\mathrm{tr} D\pa{\mathrm{e}^{-B}-I}=0, \end{aligned} \end{equation} where in the last step we have used Lidskii's theorem. Using $\det\pa{\mathrm{e}^E}=\mathrm{e}^{\mathrm{tr} E}$ for $E\in\mathcal S^1$ and \eqref{eq:inv}, we get \[\det\pa{\mathrm{e}^{- \pa{\mathrm{e}^{B}D\mathrm{e}^{-B}-D}}}=1.\] \end{proof} The assertion of Proposition \ref{thm} now follows from \begin{lemma}\label{lem1} Let $A,B$ be bounded normal operators in $\mathcal H$ that satisfy \[\pa{\mathrm{e}^{A}-I}\pa{\mathrm{e}^{B}-I},\pa{\mathrm{e}^{B}-I}\pa{\mathrm{e}^{A}-I}\in\mathcal S^1.\] Then, $\det\pa{\mathrm{e}^{A}\mathrm{e}^{B}\mathrm{e}^{-A}\mathrm{e}^{-B}}=1$. \end{lemma} \end{proof} \begin{proof}[Proof of Lemma \ref{lem1}] Let $P$ be the spectral projection $\chi_{2\pi i {\mathbb Z}}(A)$, where $\chi_W$ stands for the indicator of a set $W$. Then, $\det\pa{\mathrm{e}^{AP}\mathrm{e}^{B}\mathrm{e}^{-AP}\mathrm{e}^{-B}}$ is well-defined. Indeed, \begin{equation}\label{eq:trclP} \pa{\mathrm{e}^{AP}-I}\pa{\mathrm{e}^{B}-I}=P\pa{\mathrm{e}^{A}-I}\pa{\mathrm{e}^{B}-I}\in\mathcal S^1, \end{equation} which (together with its counterpart when two operators are switched) implies \[\left[\mathrm{e}^{AP},\mathrm{e}^{B}\right]=\left[P\pa{\mathrm{e}^{A}-I},\pa{\mathrm{e}^{B}-I}\right]\in\mathcal S^1.\] Let $\Delta\in(0,1/2]$, let $W=\set{x\in\mathbb C:\ \mathrm{dist}\pa{x,2\pi i {\mathbb Z}}\ge\Delta}$, and let $Q_\Delta=\chi_W(A)$, and let $P_\Delta=I-Q_\Delta$. We first observe that since $\mathrm{e}^{A}-I$ is invertible on $Range\pa{Q_\Delta}$, we have \[Q_\Delta\pa{\mathrm{e}^{B}-I}=\pa{\pa{\mathrm{e}^{A}-I}^{-1}Q_\Delta}\pa{\mathrm{e}^{A}-I}\pa{\mathrm{e}^{B}-I}\in\mathcal S^1,\] and similarly \[\pa{\mathrm{e}^{B}-I}Q_\Delta\in\mathcal S^1.\] Thus, by Lemma \ref{lem2} we deduce \begin{equation}\label{eq:Pinc1}\det\pa{\mathrm{e}^{AQ_\Delta}\mathrm{e}^{B}\mathrm{e}^{-AQ_\Delta}\mathrm{e}^{-B}}=1. \end{equation} Next, we note that \[\left[\mathrm{e}^{AP_\Delta},\mathrm{e}^{B}\right]=\left[P_\Delta\pa{\mathrm{e}^{A}-I},\pa{\mathrm{e}^{B}-I}\right]\underset{\Delta\to0}{\to} \left[P\pa{\mathrm{e}^{A}-I},\pa{\mathrm{e}^{B}-I}\right]=\left[\mathrm{e}^{AP},\mathrm{e}^{B}\right],\] where the convergence is in the trace norm sense (this follows from $SOT-\lim P_\Delta=P$ and the assumption of the lemma). This implies \begin{equation}\label{eq:Pinc2} \det\pa{\mathrm{e}^{AP_\Delta}\mathrm{e}^{B}\mathrm{e}^{-AP_\Delta}\mathrm{e}^{-B}}=\det\pa{I+\left[\mathrm{e}^{AP_\Delta},\mathrm{e}^{B}\right]\mathrm{e}^{-AP_\Delta}\mathrm{e}^{-B}} \to\det\pa{\mathrm{e}^{AP}\mathrm{e}^{B}\mathrm{e}^{-AP}\mathrm{e}^{-B}} \end{equation} as $\Delta\to0$. We now can combine \eqref{eq:Pinc1} and \eqref{eq:Pinc2} to get \begin{multline}\label{eq:Pinc3} \det\pa{\mathrm{e}^A\mathrm{e}^{B}\mathrm{e}^{-A}\mathrm{e}^{-B}} =\det\pa{\mathrm{e}^{AP_\Delta}\mathrm{e}^{B}\mathrm{e}^{-AP_\Delta}\mathrm{e}^{-B}}\det\pa{\mathrm{e}^{B}\mathrm{e}^{-AQ_\Delta}\mathrm{e}^{-B}\mathrm{e}^{AQ_\Delta}}\\ \underset{\Delta\to0}{\to} \det\pa{\mathrm{e}^{AP}\mathrm{e}^{B}\mathrm{e}^{-AP}\mathrm{e}^{-B}}=1, \end{multline} where the last step follows from $\mathrm{e}^{AP}=I$ for a normal operator $A$. \end{proof} \begin{proof}[Proof of Proposition \ref{lem3}] The statement follows from \begin{equation}\label{eq:trcl} A\pa{\mathrm{e}^{B}-I},\pa{\mathrm{e}^{B}-I}A\in\mathcal S^1 \end{equation} and Lemma \ref{lem2}. To show \eqref{eq:trcl}, we observe that, denoting \[D:=\sum_{k=0}^\infty\frac{A^k}{(k+1)},\] we have $\mathrm{e}^{A}-I=DA$. Hence, \eqref{eq:trcl} will follow provided that $D$ is invertible, as \[A\pa{\mathrm{e}^{B}-I}=D^{-1}\pa{\mathrm{e}^{A}-I}\pa{\mathrm{e}^{B}-I}. \] To prove that $D$ is invertible, it suffices to show that $D-I$ is a (quasi)nilpotent operator. To this end, we can bound \[\norm{\pa{I-D}^n}\le\norm{A^n}\norm{E}^n,\quad E=\sum_{k=0}^\infty\frac{A^k}{(k+2)!}.\] We have \[\norm{E}\le \sum_{k=0}^\infty\frac{\norm{A}^k}{(k+2)!}\le \mathrm{e}^{\norm{A}},\] so \[\norm{\pa{I-D}^n}^{1/n}\le\norm{A^n}^{1/n}\mathrm{e}^{\norm{A}}\to0\mbox{ as } n\to\infty,\] so $D-I$ is indeed (quasi)nilpotent, and we are done. \end{proof} \begin{ex} Let $C=D=ML$, where $L$ is the backward shift operator on $\ell^2(\mathbb N)$, and $M$ is a multiplication operator on the same space defined by \[Me_n=\begin{cases}\frac1{\sqrt n} e_n& n\in2\mathbb N\\ 0 & n\in2\mathbb N-1\end{cases}.\] Then, \eqref{eq:Det} holds trivially for $A=\mathrm{e}^C$, $B=\mathrm{e}^D$ as $C,D$ commute. We also note that $C^2=0$ (so $C$ is nilpotent) and $\mathrm{e}^C-I=C$ (so \eqref{Kcond} holds as well). However, $\pa{\mathrm{e}^C-I}\pa{\mathrm{e}^{C^*}-I}=CC^*=M^2\notin\mathcal S_1$, so (iii) in Theorem \ref{thm:main} is not satisfied. \end{ex} \begin{proof}[Verification of Example \ref{ex}] We fist note that the conditions \eqref{Kcond} are satisfied by \cite[Theorem XI.21]{RS1} since there exists a $C>0$ such that \[\abs{\mathrm{e}^{{f(x)}}-1}\langle x\rangle^2\le C.\] We will use the integral representation \[2\pi\frac1{\langle p\rangle}=\int_0^\infty \frac{dt}{p^2+1+t^2},\] which implies \[ \begin{aligned} [C,D] [C,D]&=[C,p]\frac{2\pi i}{\langle p\rangle}+p\left[C,\frac{2\pi i}{\langle p\rangle}\right]\\ &=-f'(x)\frac{2\pi}{\langle p\rangle}+\int_0^\infty \frac{1}{p^2+1+t^2}\pa{f'(x)p+pf'(x)}\frac{1}{p^2+1+t^2}dt.\end{aligned}\] Now, the integral term can be written as \[\int_0^\infty f'(x)\frac{2p^2}{\pa{p^2+1+t^2}^2}dt-p\int_0^\infty \pa{\left[f'(x),\frac{1}{p^2+1+t^2}\right]\frac{p}{p^2+1+t^2}-h.c.}dt.\] We note that the integrand in the second term has a trace norm decaying faster than $\frac{1}{t^2+1}$ in $t$, in particular this term is trace class, see, e.g., \cite[Section 4]{S} for the trace class properties of the products of functions $F(x)G(p)$. Hence, we get \[[C,D]=-f'(x)\int_0^\infty \pa{\frac{1}{p^2+1+t^2}-\frac{2p^2}{\pa{p^2+1+t^2}^2}}dt + \mathcal T=if'(x)f'(p)+ \mathcal T,\] where $ \mathcal T$ is a trace class operator. Since $f'(x)=\frac{2\pi i}{\langle x\rangle^3}$, we see that $f'(x)f'(p)\in\mathcal L^1$, so $[C,D]\in\mathcal S^1$ as well. In fact, $\mathrm{tr}{\mathcal T}=0$ (this term originates from the commutator of $f'(x)$ with a function of $p$ that decays in $p$ sufficiently fast), so \[\mathrm{tr}{[C,D]}=i\mathrm{tr}{ f'(x)f'(p)}=-2\pi \pa{\int_{\mathbb R} f'}^2=-4\pi i,\] where in the second step we have used the fact that $f'(p)$ is a convolution operator, \[(f'(p)\phi)(x)=(2\pi)^{-1/2}\int \check{(f')}(x-y)\phi(y)dy,\quad \check{(f')}(x):=(2\pi)^{-1/2}\int \mathrm{e}^{ixp}{(f')}(p)dp,\] see \cite[Theorem IX.29]{RS}. \end{proof}
\section{}\label{} \section{Introduction} Hamiltonian Monte Carlo (HMC), including auto-tuned extensions like the no U-turn sampler (NUTS), have become the de facto standard for high performance sampling of high-dimensional, differentiable distributions \citep{Duane1987, neal11, NUTS}. One reason for this is that HMC scales much better with dimension than other Markov chain Monte Carlo (MCMC) methods such as random-walk Metropolis or Gibbs sampling. HMC's scalability derives from its ability to move large distances by approximating the Hamiltonian flow defined by the gradient of a distribution's log density function \citep{betancourt2017conceptual}. As a result, HMC is believed to require $\mathcal{O}(d^{5/4})$ iterations to generate an independent sample in $d$ dimensions as compared to the $\mathcal{O}(d^2)$ samples required with random-walk Metropolis or Gibbs sampling \citep{neal11}. The actual efficiency also depends strongly on geometric features of the density being sampled, particularly issues of high correlation between coordinates (leading to {\em stiffness}, i.e., ill-conditioning of the local curvature Hessian), and of spatially varying curvature (which defeats the use of global preconditioning to counteract stiffness). One of the most common pathologies plaguing these algorithms is the multiscale geometry of the posterior distributions \citep{Betancourt13, Pourzanjani19}: when the curvature of the log density varies spatially over a large dynamic range, small HMC time steps are needed for numerical stability in the high-curvature regions, preventing the use of the larger time steps needed for efficient sampling in smoother regions. This geometry arises naturally in hierarchical models that provide a population model for a group of effects in order to support regularization and partial pooling. However since all the contributions at the bottom of the hierarchy depend on the common global parameter, a small change in these high level parameters can induces large changes in the conditional density of the effects. Consequently, when the data are sparse and inference is sensitive to the priors on these parameters, the posterior density of these models looks like a ``funnel'' with a region of high density but low volume (``neck'') widening to a region of low density and high volume (``mouth''). We show a two-dimensional example of this distribution in Figure \ref{fig:funnel}. In the right panel of the same figure, we show the dramatic variations in condition number as the log scale parameter moves along the funnel. Sampling this distribution is challenging because the mouth and the neck of the funnel contain equal probability mass and so any sampling algorithm needs to handle these variations in curvature. \begin{figure}[t!] \centering \includegraphics[width = 0.8\textwidth]{figs2/condition-number.pdf} \vspace{-20pt} \caption{Neal's funnel. (Left) Natural log density of the two-dimensional funnel (Equation~\ref{eq:funnel}) showing a region of high density but low volume (``neck'', $\beta<0$) to the left of a region of low density and high volume (``mouth'', $\beta>0$). (Right) Condition number of the inverse Hessian as a function of the log scale parameter $\beta$, along the slice $\alpha=0$. } \label{fig:funnel} \end{figure} A standard option for managing varying curvature is to use Hessian information. This has led to the development of Riemannian HMC \citep{girolami2011riemann}, which follows a Riemannian metric based on the posterior curvature. However, this is prohibitively expensive in high dimensions because it requires a positive-definite matrix at each point and many posteriors do not have positive-define Hessians. One way to do this is to have an explicit form of the Fisher information matrix \citep{girolami2011riemann} or to use a conditioning operator like SoftAbs \citep{betancourt2013general}. An alternative way to deal with high curvature is to approximate the Hamiltonian flow with an implicit symplectic integrator, which is able to naturally adjust stepping in different regions of phase space \citep{Pourzanjani19, brofos2021}. Even simple implicit integration schemes like implicit midpoint are costly and present an algorithmic challenge for efficient and stable line search. Ultimately, we believe it will be necessary to combine implicit integration and delayed rejection to achieve greater robustness in the face of even more challenging posterior sampling problems. In this work, we develop an alternate approach inspired by the use of \textit{delayed rejection} (DR) methods to sample multiscale posterior distributions. Recall that a high rejection rate increases autocorrelation of the Markov chain, reducing sampling efficiency. Whenever a rejection would occur in the Metropolis algorithm, DR methods do additional work, which can even exploit knowledge of the first rejection, to make a new proposal with a higher chance of acceptance \citep{haario2006dram}. Since such new (possibly expensive) proposals are mostly made only when the standard proposal is poor, efficiency can be increased. Although well studied in the context of random walk Metropolis-Hastings sampling \citep{Mirathesis, Tierney99, Green01, haario2006dram}, there has been relatively little work done with these approaches for Hamiltonian Monte Carlo samplers \citep{Sohl-Dickstein14, Campos15}. Previous approaches employing DR with HMC extend the same trajectory upon rejection so as to balance the additional cost by making larger jumps in the state space \citep{Sohl-Dickstein14,Campos15}. However, this approach is not helpful if the chains are stuck in a region of high curvature where instability causes a high rejection rate. In such cases, as with delayed rejection in random-walk Metropolis \citep{Green01,haario2006dram}, it is more productive instead to change the proposal parameters with the goal of increasing the chance of acceptance. In this work, we use this idea, building upon the original idea of delayed rejection \citep{Tierney99, Green01} to develop delayed rejection HMC (DRHMC). Upon a rejection, DRHMC makes one or more subsequent proposals with smaller step sizes, with the aim that these are more likely to give stable leapfrog integration than their rejected predecessors. The result is a form of adaptivity with respect to step size, a very successful idea in numerical integration more generally.\footnote{In the general delayed rejection method, the second and subsequent proposals may depend on the earlier proposals \citep{Green01}.} In the rest of this paper, we begin by reviewing, in a mathematically rigorous yet accessible fashion, Metropolis Hastings, HMC, and delayed rejection methods in Section \ref{sec:background}. With these tools, we then derive DRHMC in section \ref{sec:DRHMC} for one or more proposals. We show that DRHMC obeys detailed balance, discuss the cost of delayed proposals and outline probabilistic alternatives to reduce the cost of delayed rejection approaches. Then in section \ref{sec:experiments}, we consider some toy models as well as actual data models, and show that DRHMC can provide significant speed-ups as compared to traditional HMC in sampling tough multiscale distributions. We also show that in cases with no such pathologies, probabilistic DRHMC is no more expensive than HMC, thus suggesting its use as a robust alternative. We conclude with discussion in section \ref{sec:discussion}. Two short appendices contain proofs needed in the main text. \section{Metropolis-Hastings, delayed rejection, deterministic maps, and HMC} \label{sec:background} In this section we recap background material that is not easy to find gathered in an accessible format. While being somewhat tutorial in nature, this also sets up essential notation for the coming presentation of DRHMC. We include a proof, avoiding technical measure theory notation, that HMC samples the correct target distribution, since in the literature this is usually presented either heuristically \citep{mackayerice,neal11,Sohl-Dickstein14,betancourt2017conceptual}, or rigorously but in highly abstract terms \citep{Andrieu20}. In general we use $x\in S$ to denote the state in a continuous state space $S$, which can be taken as $\mathbb{R}^n$. (When we specialize later to HMC for sampling a target density over $\mathbb{R}^d$, we will set $S=\mathbb{R}^{2d}$.) The goal of random-walk Metropolis, as with any MCMC method \citep{mackayerice,geyer11}, is to sample from a target probability density function (pdf) $\pi$ over $S$. We assume that $\pi$ is absolutely continuous (AC), meaning that it can be represented by a nonnegative function. We assume the usual normalization $\int \pi(x) \, \textrm{d}x = 1$ (although all MCMC methods discussed can handle unnormalized $\pi$). Unless indicated, all integrals are over $S$. A Markov chain is defined by its {\em transition kernel} $k(x,y)$, which gives the probability density function of transitioning to the next state $y$, conditioned on the current state $x$. The normalization is thus \begin{equation} \int k(x,y) \, \textrm{d}y = 1, \qquad \forall x\in S~. \label{knrm} \end{equation} More formally, the transition kernel is a {\em measure} that depends on the parameter $x$, and only when this measure is AC can it be written as a kernel function $k(x,y)$. We refer the reader to \citep{steinanal,hunteranal,Billingsley,Andrieu20} for background on measure theory. We will need to handle non-AC cases, but only for measures that can be described using Dirac delta distributions, so will avoid technical language. A necessary condition for MCMC to sample the correct pdf $\pi$ is its invariance under the transition operator\footnote{Note that the operator acts from the right, the opposite convention from integral equations.}, \begin{equation} \int \pi(x) \, k(x,y) \, \textrm{d}x = \pi(y)~, \qquad \forall y\in S~. \qquad \mbox{(Invariance)} \label{eq:inv} \end{equation} One way to ensure invariance is to construct kernels which maintain {\em detailed balance} (DB, also called ``reversibility''), meaning \begin{equation} \pi(x) k(x,y) = \pi(y) k(y,x)~. \qquad \mbox{(DB)} \label{eq:db} \end{equation} For AC kernels this simply means that the two sides are equal for almost all $x,y\in S$. For non-AC kernels the two sides may not be defined (e.g., infinite) for pairs $(x,y)$ of interest, and one should interpret the left and right sides (once multiplied by $\, \textrm{d}x\textrm{d}y$) as measures over the Cartesian (tensor) product space $S\times S$ (see, e.g., \cite[Ch.~18]{Billingsley}). Then \eqref{eq:db} should be interpreted as the left and right side being equal as product measures, which means the {\em weak} sense \begin{equation} \int_A \int_B \pi(x) k(x,y) \, \textrm{d}x \, \textrm{d}y = \int_A \int_B \pi(y) k(y,x) \, \textrm{d}x \, \textrm{d}y~, \qquad \mbox{ for all (measurable) subsets } A,B \subset S. \label{eq:dbm} \end{equation} For ease of reading we will write statements of the form \eqref{eq:db} about kernels over $(x,y)$ that represent product measures, with the understanding that they should be interpreted as in \eqref{eq:dbm}. Finally, we recall the crucial fact that detailed balance implies invariance, which follows by substituting \eqref{eq:db} into \eqref{eq:inv} then using \eqref{knrm}. \footnote{A sketch of the proof using the weak sense \eqref{eq:dbm} would be: choose $A=S$, swap the order of integration as justified by Fubini's theorem, and use \eqref{knrm}, leaving a weak statement of \eqref{eq:inv} for all $B\subset S$.} \subsection{Metropolis-Hastings} \label{s:mh} The MH algorithm involves a {\em proposal} kernel $q(x,y)$ which gives, for each starting state $x$, the (normalized) pdf over proposed states $y$. For now we will assume that $q(x,\cdot)$ is AC for each $x\in S$. The proposal is accepted with some $x$- and $y$-dependent probability $\alpha(x,y)$, in which case the next state is $y$, otherwise the next state remains as $x$. Thus the transition kernel $k(x,y)$ defining the resulting Markov chain is, for each $x$, a mixture of the pdf $q(x,y)$ and the (rejected) point mass at $y=x$, \begin{equation} k(x,y) = q(x,y)\alpha(x,y) + \delta_x(y) r(x)~, \label{eq:mhker} \end{equation} where $r(x)$ is the probability of rejection. Here $\delta$ is the Dirac delta distribution defined in Euclidean space by $\delta(x) = 0$, $\forall x\neq 0$, and $\int \delta(x) \, \textrm{d}x = 1$, and we use the notation $\delta_x(y) = \delta(x-y)$. Since the second term in \eqref{eq:mhker} is $x\leftrightarrow y$ symmetric whatever the form of $r(x)$, then for detailed balance \eqref{eq:db} to hold, we only need the condition on the first term \begin{equation} \pi(x) q(x,y) \alpha(x,y) = \pi(y) q(y,x) \alpha(y,x)~. \label{eq:alrat} \end{equation} In the case where $q$ is not AC, then \eqref{eq:alrat} should be taken in the sense of equality of product measures described above. If $q$ is AC and everywhere positive then the standard MH acceptance formula \begin{equation} \alpha(x,y) = \min\left(\frac{\pi(y) q(y,x)}{\pi(x) q(x,y)}, 1 \right) \label{eq:al} \end{equation} is the most efficient% \footnote{Here we mean efficiency in the sense that any other has higher probability of rejection. This is simply because, for each $x,y\in S$, either $\alpha(x,y)$ or $\alpha(y,x)$ is 1, the largest allowed value for a probability.} choice of $\alpha$ that satisfies \eqref{eq:alrat}. \subsection{Delayed rejection for Metropolis-Hastings} \label{s:dr} Here we summarize standard delayed rejection as introduced in \citep{Mirathesis,Tierney99,Green01}. The idea is make a second proposal with kernel $q_2(x,s,y)$ to $y$ if the first proposal $q_1(x,s)$ from $x$ to $s$ is rejected (see Fig.~\ref{f:dr}(a)). Note that $q_2$ may depend on both the current state $x$ and the rejected state $s$. The transition kernel analogous to \eqref{eq:mhker} must account for three possible ways to end up at state $y$: i) acceptance of $q_1(x,y)$, for which one uses the usual MH probability $\alpha_1(x,y)$ obeying detailed balance \eqref{eq:alrat}; ii) acceptance of the second proposal, which occurs with some new probability $\alpha_2(x,s,y)$; and iii) rejection of this second proposal. For cases ii) and iii) one must marginalize over all possible rejected first tries $s$. Thus the transition kernel is \begin{equation} k(x,y) = q_1(x,y)\alpha_1(x,y) + \int q_1(x,s) [1-\alpha_1(x,s)][q_2(x,s,y)\alpha_2(x,s,y) + r_2(x,s)\delta_x(y)] ds ~, \label{eq:dr} \end{equation} where $r_2$ is the probability of rejection of the second proposal\footnote{As before, its form will be irrelevant because it lies on the diagonal $x=y$, so will not affect DB.}. The factors $q_1(x,s) [1-\alpha_1(x,s)]$ in the integrand are the probabilities of making the first proposal ($q_1$) then rejecting it ($1-\alpha_1$). The goal is then to choose $\alpha_2(x,s,y)$ such that DB is satisfied for the kernel $k$ given by \eqref{eq:dr}. We have already established that this holds for the first term and the $r_2$ term, which leaves only the middle $q_2$ term. Substituting this middle term into the DB condition \eqref{eq:alrat} gives \bea \int \pi(x) q_1(x,s) [1-\alpha_1(x,s)]q_2(x,s,y)\alpha_2(x,s,y) \, ds \;\; = \nonumber \\ \qquad \int \pi(y) q_1(y,s') [1-\alpha_1(y,s')]q_2(y,s',x)\alpha_2(y,s',x)\, ds' \label{eq:dbmhdr} \end{eqnarray} where $s$ and $s'$ are (unrelated) dummy integration variables. As before, if $q_2(x,s,\cdot)$ is AC, then this condition must hold for almost all $x,y\in S$. As most clearly explained by Mira \cite[Sec.~5.2]{Mirathesis}, one way (but not the only way) to enforce this condition is simply to {\em set the integrands equal}.\footnote{Alternatively, one can assume that there exists a differentiable and invertible mapping from $(x, s, y)$ to $(y, s', x)$, and apply a change of variables to identify a more generic acceptance equation that is not constrained to follow the same path via $s$ from $y$ to $x$, as in \citep{Green01}. } This gives \begin{equation} \pi(x) q_1(x,s) [1-\alpha_1(x,s)]q_2(x,s,y)\alpha_2(x,s,y) = \pi(y) q_1(y,s) [1-\alpha_1(y,s)]q_2(y,s,x)\alpha_2(y,s,x), \label{eq:al2rat} \end{equation} which now must hold for (almost) all $x,y,s\in S$. Then, again assuming AC proposal pdfs with everywhere positive densities, the acceptance probability for the second proposal that maintains DB with the least rejection is \citep{Tierney99} \begin{equation} \alpha_2(x,s,y) = \min\left( \frac{\pi(y) q_2(y,s,x) q_1(y,s) [1-\alpha_1(y,s)]} {\pi(x) q_2(x,s,y) q_1(x,s) [1-\alpha_1(x,s)]} ,1 \right)~, \label{eq:almhdr} \end{equation} Note that when we propose delayed rejection for maps coming from HMC in the next section, we will not be able to use this method of Mira and Tierney, and will need to return to the general integral condition \eqref{eq:dbmhdr}. For a MH proposal, as compared to Eq. \ref{eq:al}, this acceptance probability has an extra factor $\frac{q_1(y,s) [1-\alpha_1(y,s)]}{q_1(x, s)[1-\alpha_1(x, s)]}$ which balances the probability of the first proposal being rejected at $y$ and $x$ respectively. \subsection{MH with deterministic proposals given by maps} Metropolis-Hastings is usually presented assuming absolutely continuous proposal densities, so that equation \eqref{eq:al} may be formulated. However, HMC involves MH proposals that are given by deterministic maps, which are not AC, rendering \eqref{eq:al} meaningless in this setting. Thus, in this section we derive rigorously the condition on the acceptance probability guaranteeing detailed balance, for the relevant class of maps. By a map we mean a smooth function $F: S\to S$, which thus takes each state $x$ to its image state $y=F(x)$. The corresponding proposal kernel is \begin{equation} q_F(x,y) = \delta(y - F(x))~, \label{eq:propmap} \end{equation} which simply places the entire unit point mass at the point $y=F(x)$, hence is deterministic. We will need the following two definitions. \begin{dfn}[Involution] A map $F:S\to S$ is an involution if $F^{-1} = F$ as maps, that is, $F^2=I$ where $I$ is the identity map. \end{dfn} \begin{dfn}[Volume-preserving] A map $F:S\to S$ is volume (Lebesgue measure) preserving if $$ \int_B \, \mathrm{d}x = \int_{F(B)} \, \mathrm{d}x~,\qquad \mbox{ for all (measurable) subsets } B \subset S~, $$ where $F(B):=\{F(x): \, x\in B\}$ denotes the image of the set $B$. \end{dfn} If $DF(x) \in \mathbb{R}^{n\times n}$ is the Jacobian derivative matrix with elements $(DF(x))_{ij} = \partial F_i(x) / \partial x_j $, $i,j = 1,\dots, n$, then it is a standard result that volume preservation is equivalent to $|\det DF(x)| = 1$ for all $x\in S$, i.e., a unit Jacobian determinant everywhere. (See, e.g., \cite[Thm.~17.2]{Billingsley}.) If MH is performed using deterministic proposals coming from maps that are in both of the above special categories, then there is a particularly simple condition that the acceptance probability should obey for DB to hold, as follows. A simple proof is provided in Appendix \ref{app:deterministic}. \begin{lem}[MH using a deterministic volume-preserving involution] Let $\pi$ be an AC target density. Let $F$ be a volume-preserving involution. Then MH with the deterministic proposal kernel $q_F$ given by \eqref{eq:propmap}, with acceptance probability $\alpha$ obeying \begin{equation} \pi(x) \alpha(x,y) = \pi(y) \alpha(y,x) \qquad \forall x,y \in S \label{eq:alrats} \end{equation} has detailed balance with respect to $\pi$, and therefore has $\pi$ as an invariant density. \label{lem:map} \end{lem} The key point here is that the formula \eqref{eq:alrats} for the acceptance probability does not depend on the function $F$ at all, just on the ratio of target densities. We have not found this well explained in the literature. This will allow us in the following sections to place HMC, and our proposed DRHMC method, on a rigorous footing. \begin{figure}[t] \includegraphics[width=\textwidth]{figs2/hmc.pdf} \caption{Overview of HMC, sketched in $d=1$ dimensions. (a) shows the target density $\tilde\pi(q)$ (bottom), the associated potential $U(q)$ (middle), and the resulting contours in 2D phase space $(q,p)$ of the Hamiltonian $H$ given by \eqref{H}. Each leapfrog step $L$ moves approximately along such a contour. For step 2 of HMC, the proposal move $F=L_\varepsilon^nP$ is sketched, for $n=3$, where $P$ is the momentum flip. (b) shows the $p$ randomization (Gibbs move) in step 1 of HMC (red shows density of the kernel living on the $d$-dimensional slice $q = $ constant). (c) shows the composition of steps 1 and 2, comprising one HMC iteration (again red shows the resulting Markov kernel density, which lives on the union of a curved $d$-dimensional manifold and a constant-$q$ slice). }\label{f:hmc} \end{figure} \subsection{Classical Hamiltonian Monte Carlo} \label{s:hmc} As our final piece of background, we review the Hamiltonian Monte Carlo (HMC) algorithm \citep{neal11}. We change the notation in this and the next section to overload $q$, with $q\in \mathbb{R}^d$ now denoting the parameter vector of interest that is to be sampled.% \footnote{Here we are following standard notation; we do not expect confusion to arise between $q$ as parameters, vs $q(\cdot, \cdot)$ as proposal function, since the latter is always written as a function of {\em two} state points.} The target pdf, which we call $\tilde\pi$, is assumed to be continuous and differentiable. To draw samples $q$ from $\tilde\pi(q)$, HMC reinterprets the parameters of interest as a position vector with associated potential energy function $U(q) = -\log \pi(q)$, and simulates a Markov chain by approximating the following Hamiltonian dynamics. One introduces an auxiliary momentum vector $p\in \mathbb{R}^d$, which contributes a kinetic energy term $K(p) = \frac{1}{2}p^T M^{-1}p$, where $M$ is some symmetric positive definite mass matrix that we take as fixed. Then the Hamiltonian $H:\mathbb{R}^{2d} \to \mathbb{R}$ is the total energy function for the state $x := (q,p)$, \begin{equation} H(x) = H(q,p) = U(q) + \frac{1}{2}p^T M^{-1} p~. \label{H} \end{equation} The state space $S = \mathbb{R}^{2d}$ is called {\em phase space}; see Fig.~\ref{f:hmc}(a) for an illustration. Given initial data $x(0) = (q(0),p(0))$, the evolution of this physical system with respect to time $t$ is the first-order ODE system called Hamilton's equations, \begin{equation} \left\{\begin{array}{lllll}\dot q &=& \nabla_p H(q(t),p(t)) &=& M^{-1} p(t) \\ \dot p &=& -\nabla_q H(q(t),p(t)) &=& -\nabla U(q(t)) \end{array}\right. \label{flow} \end{equation} where $\cdot = d/dt$ indicates the time derivative. Intuitively, this motion is that of a point-mass ``rolling around'' in the potential well $U$, in the absence of friction. The force vector $-\nabla U$ attracts the ball so that it accelerates towards low-potential (high-probability) regions. HMC generates samples $x$ from the Gibbs pdf (also known as the Boltzmann or canonical distribution from statistical mechanics) defined by $H$, namely \begin{equation} \pi(x) := Z^{-1} e^{-H(x)} = Z^{-1} e^{-U(q)} e^{-\mbox{\small $\frac{1}{2}$} p^T M^{-1} p} = Z^{-1} \tilde\pi(q) e^{-\mbox{\small $\frac{1}{2}$} p^T M^{-1} p}~, \label{eq:Gibbs} \end{equation} where $Z=\int_{\mathbb{R}^{2d}} H(x) \, \textrm{d}x = (2\pi)^{d/2}\sqrt{\det M}$ is the normalizing constant. Note that, since $H$ was the sum of potential and kinetic terms, $q$ and $p$ are independent, with the $q$-marginal of $\pi(x)$ being the target density $\tilde\pi(q)$. Thus, given samples $x^{(i)}$ from $\pi$, by extracting their first $d$ coordinates one obtains samples from $\tilde\pi$. HMC uses as its main step an MH step using a proposal from a particular deterministic map $F$, which happens to approximate Hamiltonian dynamics over a certain length of time $T$ followed by a negation of the momentum. The key property of this map---guaranteeing that is has the correct invariant distribution $\pi$---will be that it is a volume-preserving involution; the ancillary fact that it is an approximation to Hamiltonian dynamics is only relevant for creating a high {\em mixing rate} without excessive rejection in the MH acceptance step. However, the exact dynamics is restricted to a level set (energy shell) $H(q, p) = \textrm{constant}$ \cite[(2.13)]{neal11}, and staying permanently on this level set would {\em not} sample \eqref{eq:Gibbs} correctly. Thus, HMC alternates these Metropolis steps with a Gibbs sampling step that draws a fresh $p \sim \mathcal{N}(0, M)$. This Gibbs update preserves the stationary distribution because the $p$ and $q$ terms factor in \eqref{eq:Gibbs}. Because the Metropolis and Gibbs updates both preserve the stationary distribution, so does their composition, which may be viewed as a single update in a Markov chain. Let $L_\varepsilon$ be the map that performs one leapfrog (Verlet) step with time step $\varepsilon>0$. Precisely, its action $(q',p') = L_\varepsilon(q,p)$ is computed by the three sequential substeps, \begin{align} \bar{p} &\leftarrow\; p - \frac{\varepsilon}{2} \nabla U(q)~,\nonumber \\ q' &\leftarrow\; q + \varepsilon M^{-1} \bar{p}~, \ \textrm{then} \nonumber \\ p' &\leftarrow\; \bar{p} - \frac{\varepsilon}{2} \nabla U(q') ~. \label{Leps} \end{align} The composition of $n = T/\varepsilon$ such leapfrog steps is a ${\mathcal O}(\varepsilon^2)$-accurate approximation to the exact dynamics \eqref{flow} evolved to time $T$ (e.g. see \citep{neal11} for a derivation of the order of accuracy). This composition is a volume-preserving involution, but does not conserve $H$ exactly. Also we will need the ``momentum flip'' operator $P$ defined by $P(q,p) = (q,-p)$. With these defined, a {\em single HMC iteration} from the current state $x^{(i)}:=(q^{(i)},p^{(i)})$ comprises the two sequential steps: \begin{description} \item[Step 1. Gibbs sampling:] Resample the momentum $p^{(i)}$ from its Gaussian marginal distribution $p \sim \mathcal{N}(0, M)$, without changing $q^{(i)}$.\footnote{We use $\mathcal{N}(\mu, \Sigma)$ for normal distributions with location $\mu$ and covariance matrix $\Sigma$ and in the univariate case, $\mathcal{N}(\mu, \sigma^2)$ where $\sigma^2$ is the variance parameter.} This randomization step is shown as $R$ in Fig.~\ref{f:hmc}(b). (Note that there exist variants using partial randomization that we will not explore here \citep{neal11,Sohl-Dickstein14}.) \item[Step 2. Metropolis update:] Perform a Metropolis update on $x^{(i)}$, using a deterministic map $F = L_\varepsilon^n P$ (here we compose operators to the right, so that $P$ is the final operator), where $n$ is a predetermined number of steps, $\varepsilon>0$ is a time step, and $L_\varepsilon$ and $P$ are the maps defined above. The proposal approximates Hamiltonian dynamics for time $T=n\varepsilon$, followed by a $p$ flip, as sketched in Fig.~\ref{f:hmc}. Here, writing $x=x^{(i)}$ as the current state and $y=F(x)$ as the proposal, the step is accepted with probability $$ \alpha(x,y) = \min\left(\frac{\pi(y)}{\pi(x)}, 1\right) ~, $$ being the most efficient rule satisfying \eqref{eq:alrats}. Upon acceptance $x^{(i+1)} \leftarrow y$, else $x^{(i+1)} \leftarrow x^{(i)}$. \end{description} After each such iteration, $i$ is incremented, resulting in a Markov chain $\{x^{(i)}\}_{i=0,1,\dots}$ from which expectations under $\tilde\pi$ may be estimated in the usual fashion \citep{geyer11}. The following mathematical result, while covered recently using much more technical notation \citep{Andrieu20}, has a simple proof that we give in Appendix \ref{app:hmcproof}. \begin{thm}[HMC has the correct invariant pdf] Let $\tilde\pi$ be a continuous, differentiable, positive pdf over $\mathbb{R}^d$, with associated Gibbs pdf $\pi$ over $\mathbb{R}^{2d}$ given by \eqref{eq:Gibbs}. The Markov chain with HMC update, given by the composition of steps 1 (Gibbs) and 2 (MH) defined above, has $\pi$ as an invariant pdf. \label{thm:hmc} \end{thm} In short, the proof is that step 1 (Gibbs) and step 2 (MH) each independently preserve $\pi$ as an invariant pdf, thus so does their composition. In particular for step 2 this hinges on Lemma~\ref{lem:map} applied to $F=L_\varepsilon^n P$; its approximation of Hamiltonian dynamics is irrelevant for the proof. It is also a common misunderstanding that their composition (the HMC iteration) obeys detailed balance: although steps 1 and 2 separately do, their composition in general does not. It is worth pointing out that while first-order leapfrog integration ($L$) of Hamilton's equations is the most commonly used proposal in HMC, it is not the only choice. The leapfrog integrator itself can be extended to higher orders \citep{creutz1989higher,yoshida1990construction}. Neal points out that a modified Euler step is valid \citep{neal11}, and recent works have proposed using other maps, such as implicit integrators \citep{Pourzanjani19,brofos2021evaluating} for multiscale distributions or generalizing HMC with neural networks \citep{Levy17}. However, a lesson of the above is that approximating Hamiltonian dynamics is not necessary to have the correct invariant pdf; it is merely a convenient way to propose long-distance moves with high acceptance rates. \begin{figure}[t!] \centering \includegraphics[width=0.9\textwidth]{figs2/ghost.pdf} \\ $\alpha_1(x,s)=\min\bigl( 1,\frac{\pi(s)}{\pi(x)} \bigr), \;\; \alpha_2(x,s,y)=\min\bigl( 1,\frac{\pi(s)}{\pi(x)}\frac{1-\alpha_1(y,g)}{1-\alpha_1(x,s)} \bigr); \hfill \mbox{for $\alpha_3(x,s_1,s_2,y)$ see \eqref{eq:alhmcdr2}} $ \caption{Sketch of states (in the augmented state space $\mathbb{R}^{2d}$) involved in delayed rejection HMC. In this sketch, the locations are chosen purely to aid visualisation. (a) Basic 2-stage scheme with proposal maps $F_1$ and $F_2$, each of which is a certain number of leapfrog steps followed by a momentum-flip, hence an involution (see Section~\ref{sec:DRHMC}). The first map $F_1$ generates a proposal $s = F_1(x)$, which is accepted with probability $\alpha_1(x, s)$. If the first proposal is rejected, the second proposal $y = F_2(x)$ is accepted with probability $\alpha_2(x, s, y)$. The target density at the ``ghost'' $g=F_1(F_2(x))$ is also needed. (b) 3-stage scheme, involving a third proposal map $F_3$ (see Section~\ref{sec:higherorder}). The target density must be evaluated at $2^3=8$ states, four of which are ghosts (shown by open circles). } \label{f:dr} \end{figure} \section{Delayed rejection for HMC} \label{sec:DRHMC} Finally we have all the tools to combine delayed rejection (DR) with HMC. We call the resulting algorithm DRHMC. As with classical HMC, we work with the extended state $x=(q,p)$ to sample from the desired distribution $\tilde\pi(q)$, which is the marginal of $\pi(x)$, the resulting Gibbs pdf \eqref{eq:Gibbs} over the extended state. As in Section~\ref{s:dr} we use $s$ to represent intermediate proposals in DR that have been rejected, and $y$ will always represent the most recent proposal, i.e. the proposal made in the current DR stage. We keep the Gibbs step unchanged and apply DR only to the Metropolis step. Consider $F_1 = L_\varepsilon^n P$, a deterministic proposal map for some time step $\varepsilon$ and number of leapfrogs $n$. The first acceptance probability remains the same as in classical HMC: $\alpha_1(x,s) = \min \left[ \pi(s)/\pi(x), 1 \right]$. If this first proposal with kernel $q_1(x,s) = \delta(s-F_1(x))$ gets rejected, this suggests a possibility that $\pi(s)/\pi(x)$ is much less than 1, indicating very poor approximate energy conservation so that $\varepsilon$ was too large for stable integration. This motivates a second proposal via a mapping $F_2$ which uses a smaller $\varepsilon$. The resulting second kernel is $q_2(x,s,y) = \delta(y-F_2(x))$, which is independent of $s$. We now derive the detailed balance condition for $\alpha_2$ in a general setting. We assume only that the maps $F_1$ and $F_2$ are volume-preserving involutions, which is satisfied for HMC maps as discussed in the previous section. For the second proposal, recall the general detailed balance condition \eqref{eq:dbmhdr} for delayed rejection. Substituting the above deterministic $q_1$ and $q_2$ kernels into this gives \bea \int_S \pi(x) \delta\big(s - F_1(x)\big) \, [1-\alpha_1(x,s)]\delta\big(y - F_2(x)\big)\alpha_2(x,s,y) \mathrm{d}s \; = \quad\quad && \nonumber \\ \int_S \pi(y) \delta\big(s' - F_1(y)\big) [1-\alpha_1(y,s')]\delta\big(x - F_2(y)\big)\alpha_2(y,s',x) \mathrm{d}s' \,. &&\nonumber \end{eqnarray} However simply setting the integrands equal, as done by Mira and Tierney to get \eqref{eq:al2rat}, fails here since the LHS delta selects $s=F_1(x)$ and the RHS delta selects $s'=F_1(y)$, but $F_1$ is injective so $s=s'$ could only hold if $x=y$. Instead one {\em evaluates} the two integrals to get $$ \pi(x)[1-\alpha_1(x,F_1(x))]\delta(y-F_2(x)) \alpha_2(x,F_1(x),y) \; = \; \pi(y)[1-\alpha_1(y,F_1(y))]\delta(x-F_2(y)) \alpha_2(y,F_1(y),x) ~, $$ which must hold as kernels over $(x,y)$. Yet since $F_2=F_2^{-1}$, the two delta distributions are the same, so equality holds as singular measures living on the manifold $y=F_2(x)$ if $\alpha_2$ satisfies \begin{equation} \pi(x)[1-\alpha_1(x,F_1(x))]\alpha_2(x,F_1(x),y) \; = \; \pi(y)[1-\alpha_1(y,F_1(y))]\alpha_2(y,F_1(y),x) ~, \quad \mbox{ for }\; y=F_2(x)~. \label{eq:alrathmcdr} \end{equation} To maximize the acceptance rate while obeying this constraint we set \begin{equation} \alpha_2(x,F_1(x),y) \;=\; \min\!\left(1, \frac{\pi(y)}{\pi(x)} \frac{1-\alpha_1\big(y,F_1(y)\big)}{1-\alpha_1\big(x,F_1(x)\big)} \right) ~, \quad \mbox{ for }\; y=F_2(x)~. \label{eq:alhmcdr} \end{equation} Since all proposals are deterministic in DRHMC, it is now useful to simplify notation by folding the known image points into the acceptance probabilities, \bea \widetilde\al_1(x) &:=& \alpha_1(x,F_1(x)) \label{ta1} \\ \widetilde\al_2(x) &:=& \alpha_2(x,F_1(x),F_2(x)) \label{ta2} \end{eqnarray} This allows us to write the second acceptance probability obeying detailed balance as \begin{equation} \widetilde\al_2(x) \;=\; \min\!\left(1, \frac{\pi(F_2(x))}{\pi(x)} \, \frac{1-\widetilde\al_1(F_2(x))}{1-\widetilde\al_1(x)} \right)~. \label{eq:talhmcdr} \end{equation} Note that this is the same as the acceptance relation \eqref{eq:almhdr} from plain DR in the Metropolis case, but setting all the proposal densities $q$ to unity. However, we emphasise that its derivation is quite different, requiring care with deterministic maps, and relying on them being volume-preserving involutions. In addition to the initial point of the trajectory $x$ and the two proposals $F_1(x)$ and $F_2(x)$, this rule demands, via $\widetilde\al_1(F_2(x))$, the pdf at a fourth state $g=F_1(F_2(x))$. This is the first proposal that would have been made in a hypothetical chain, had we started the chain in the reverse direction i.e. starting from $y$ to go to $x$. Hence we call it a \textit{ghost preimage} of the second proposal. See Fig.~\ref{f:dr}(a). While it is never proposed in the forward direction, maintaining DB requires us to evaluate the density at this point. Finally, we describe the form of the new proposals that we test. We consider delayed rejections which reduce the step size of the leapfrog integrator by a constant {\em adaptivity factor} $a>1$ but maintain the same trajectory length or time of integration ($T$). Hence we will propose $F_2 = L_{\varepsilon/a}^{an} P$. In Section~\ref{sec:experiments} we will show that this allows us to explore regions in the phase space that otherwise face persistent rejections with classical HMC. This completes the simplest form of DRHMC; however, we find that the higher-order proposals described next can also help. \subsection{Higher order proposals} \label{sec:higherorder} The previous section focused on making a second proposal when the first proposal in HMC gets rejected. The same formalism can be extended to allow a third proposal upon rejection of the second, a fourth upon rejection of the third, and so on. In this section, we explicitly derive the acceptance probability for the third proposal in DRHMC and give a general recursive relation for $k^{th}$~proposal. Mira \citep{Mirathesis} presents similar acceptance probabilities for higher-order delayed proposals in the Metropolis-Hastings case. We also discuss the growth of the cost with number of proposals, since this determines the trade-off with increased acceptance rate of DRHMC. If we reject the first two proposals starting from a state $x\in S$, namely $s_1=F_1(x)$ and $s_2=F_2(x)$, we make a third proposal via a map $F_3$. The resulting proposal kernel is $q_3(x,s_1,s_2,y) = \delta(y-F_3(x))$. In this case, the transition kernel analogous to \eqref{eq:dr} must account for four possible ways to end up at a state $y$: accepting the i) first, ii) second or the iii) third proposal with their respective acceptance probabilities or iv) rejecting all and maintaining the current state. We have established the acceptance probabilities of case i) and ii) in the previous section. For cases iii) and iv), the transition kernel must now marginalize over all possible rejected first and second proposals $s_1, \, s_2$, \bea k(x,y) &=& q_1(x,y)\, \alpha_1(x,y) \\ &&\null + \int q_1(x,s_1) \, [1-\alpha_1(x,s_1)] \, q_2(x,s_1,y) \, \alpha_2(x,s_1,y) \, \textrm{d}s \\ &&\null + \int q_1(x,s_1) \, q_2(x,s_1,s_2) \, [1-\alpha_1(x,s_1)] \, [1-\alpha_2(x,s_1,s_2)] \\ \null && \null \qquad \quad \null \times \left[q_3(x,s_1,s_2, y)\,\alpha_3(x,s_1,s_2,y) + r_3(x) \, \delta_x(y) \right] \, \textrm{d}s_1 \, \textrm{d}s_2, \label{eq:dr2} \end{eqnarray} where $r_3$ is the probability of rejecting the 3rd proposal. As we saw in the previous section, since the first and second proposals are independent of the third proposal, their acceptance probabilities $\alpha_1$ and $\alpha_2$ are given by \eqref{eq:alrat} and \eqref{eq:alrathmcdr} respectively and hence the first two terms of Eq. \eqref{eq:dr2} will maintain DB. As with $r_2$, since $r_3$ also lies on the diagonal, it will also maintain DB regardless of its form. Thus to maintain detailed balance for the third proposal, we only need the condition on $\alpha_3$, \begin{align} \int_S \int_{S} & \pi(x) \delta\big(s_1 - F_1(x)\big) [1-\widetilde\al_1(x)] \delta\big(s_2 - F_2(x)\big)[1-\widetilde\al_2(x)] \delta\big(y - F_3(x)\big)\widetilde\al_3(x)\mathrm{d}s_1 \mathrm{d}s_2 = \nonumber \\ &\int_S \int_{S} \pi(y) \delta\big(s_1' - F_1(y)\big) [1-\widetilde\al_1(y)] \delta\big(s'_2 - F_2(y)\big)[1-\widetilde\al_2(y)] \delta\big(x - F_3(y)\big) \widetilde\al_3(y)\mathrm{d}s'_1 \mathrm{d}s'_2 \end{align} where we have simplified the notation for acceptance probability via $\widetilde\al_3(x) := \alpha_3(x,F_1(x),F_2(x),F_3(x))$. Then following the same steps as in the derivation of $\widetilde\al_2$ and evaluating the two integrals allows us to write the the 3rd acceptance probability as \begin{equation} \widetilde\al_3(x) = \min\left[ \frac{\pi(y) [1-\widetilde\al_1(y)] [1-\widetilde\al_2(y)]}{\pi(x) [1-\widetilde\al_1(x)] [1-\widetilde\al_2(x)]} , 1 \right]~. \label{eq:alhmcdr2} \end{equation} Continuing in this way, one can write down a recursive relation for the acceptance probability of the $k${th} proposal obeying detailed balance, \begin{equation} \widetilde\al_{k}(x) = \min\left[ \frac{\pi (y) \prod_{i=1}^{k-1}[1-\widetilde\al_i(y)]}{{\pi(x) \prod_{i=1}^{k-1}[1-\widetilde\al_i(x)]}}, 1 \right]~, \end{equation} where $y = F_k(x)$, and $\widetilde\al_{k}(x) := \alpha_{k}(x, F_1(x),...,F_{k}(x))$ is the notational shorthand. \subsubsection{Growth in cost with respect to the number of proposals} It can be tempting to keep making successively higher order proposals to increase the acceptance rate, however it is important to be mindful of their increasing cost. Thus we explicitly write down the full-form of $\widetilde\al_1$ and $\widetilde\al_2$ in the acceptance probability for the third proposal again to see the various ghost preimages that need to be evaluated. Recall that \begin{equation} \widetilde\al_2(x) = \min\left[ \frac{\pi(F_2(x)) [1-\widetilde\al_1(F_2(x)))]}{{\pi(x) [1-\widetilde\al_1(x)]}}, 1 \right] \nonumber \end{equation} where \begin{equation} \widetilde\al_1(x) = \min\left[ \frac{\pi(F_1(x))}{{\pi(x)}}, 1 \right]~. \nonumber \end{equation} Substituting these forms in \eqref{eq:alhmcdr2} we see that the denominator involves estimating the density at points $x$, $F_1(x)$, $F_2(x)$ and $F_1(F_2(x))$ while the numerator requires the density at $F_3(x)$, $F_1(F_3(x))$, $F_2(F_3(x))$, and $F_1(F_2(F_3(x)))$. Of these $2^3=8$ points, only $F_1(x)$, $F_2(x)$ and $F_3(x)$ are proposals made in DRHMC and the remaining states are the various ghost preimages that need to be evaluated to maintain detailed balance. Their form is sketched in Fig.~\ref{f:dr}(b). Evaluating the acceptance conditions for the $k$th proposal requires $2^k$ log density evaluations. In our algorithm, computation is dominated by the number of gradient evaluations.\footnote{With automatic differentiation, the log density evaluations come for free with the gradient calculations.} Despite this apparent exponential growth in cost, the cost of DRHMC is only a {\em constant} factor larger than classical HMC run at the locally optimal step size. For instance, consider a DRHMC setup where the first proposal is $F_1$ with $n$ leapfrog steps of size $\varepsilon$, i.e., a trajectory time of $T=n\varepsilon$, and a sequence of step sizes $\varepsilon/a, \varepsilon/a^2, \dots$ for subsequent higher order proposals upon rejection. Let $k$ be the smallest integer such that $\varepsilon/a^{k-1}$ gives stable leapfrog integration. Then even for this optimal step size, classical HMC would need at least $a^{k-2}n$ steps. On the other hand for DRHMC, since $\varepsilon$ is greater than the largest stable step size for this trajectory, this first proposal will very likely be rejected due to instability giving very poor $H$ conservation and hence a tiny acceptance ratio. Our proposed higher-order DRHMC scheme then makes proposals with aforementioned sequence of step sizes $\varepsilon/a, \varepsilon/a^2, \dots$, so that the first that is likely to be accepted is the $k$th with step size $\varepsilon/a^{k-1}$. The total number of leapfrog steps needed up to (and including) a $k$th order DRHMC proposal is $2^{k-1}n + 2^{k-2} an + \dots + a^{k-1} n$, where the first term is for the $F_1$ maps, the second for the $F_2$ maps, etc. (See Fig.~\ref{f:dr}(b) for the $k=3$ case.) This sum is $nka^{k-1}$ for $a=2$, or ${\mathcal O}(a^{k-1}n)$ for $a>2$. Thus for $a=2$, the DRHMC cost is only ${\mathcal O}(ak)$ more than HMC with the optimal step size, and for $a>2$, the DRHMC cost is ${\mathcal O}(a)$ (independent of $k$) more than HMC. Thus we may summarize as follows. \begin{rmk} Although $k$th-order DRHMC has a cost per proposal that grows exponentially in $k$, the cost is only a constant factor more expensive than classical HMC proposals made with the ``correct'' (largest stable) step size. \label{r:kcost} \end{rmk} \subsection{Probabilistic Delayed Rejection} \label{sec:probdrhmc} One way to reduce the average cost per iteration for DRHMC is to make the delayed rejections probabilistic and dependent on where we are in the distribution. To motivate how this can be helpful, consider a case when the cost of secondary proposal is much higher than the first proposal and even though the first proposal function is well tuned for most of the state space, there are certain hard regions which can only be sampled by the second proposal. In this scenario, while we need DR to correctly sample the full distribution, we do not need it throughout the phase space. Every time we make a secondary proposal upon getting a rejection in the good regions, we might not be trading excess cost with higher acceptance rate effectively. Thus instead of making the second and subsequent proposal mandatory upon a rejection, we would like to make them probabilistic such that we make a second proposal with probability $p_2(x, s)< 1$. This modifies the second proposal kernel to $q_2(x,s,y) = p_2(x, s) \delta(y-F_2(x, s))$. As was the case for the second proposal map $F_2$, this probability can also be informed by the previously rejected proposals in the same trajectory. One can follow the steps from the previous section to maintain detailed balance and show that this modifies the acceptance probability as \begin{equation} \widetilde\al_2(x) = \min\left[ \frac{\pi(y) [1-\widetilde\al_1(y)] p_2\big(y, F_1(y)\big)}{\pi(x) [1-\widetilde\al_1(x)] p_2\big(x, F_1(x)\big)} , 1 \right] \label{eq:alhmcdrp} \end{equation} Returning to the scenario outlined above, we see that one way to avoid secondary proposals in good regions is to construct a proposal probability that makes it less likely for a secondary proposal if the first proposal was rejected on random chance despite having high acceptance probability. On the other hand, if the first proposal was rejected strongly, which might indicate that we are in a bad region of the state space for the first proposal, we make it more likely to make a subsequent proposal with a new function. A simple heuristic proposal probability to achieve this is \begin{equation} p_{j+1}(x, s_j) = 1 - \alpha(x, s_j), \label{eq:drprob} \end{equation} where $s_j$ is the $j^{th}$ proposal made from the current position $x$, and $\alpha(s_j)$ is the acceptance probability of the last proposal. Ideally however one would choose the proposal probability $p_{j+1}$ to maximize expected squared jump distance over effort for the next proposal. Detailed balance is maintained by including this factor $p_{j+1}$ in the acceptance condition $\alpha_{j+1}$ for the $j+1^{th}$ proposal along the lines of Eq. \ref{eq:alhmcdrp}. In the experiments section, we will show how probabilistic delayed rejection can preserve the efficiency of basic HMC for simple distributions where HMC is effective. \section{Experiments} \label{sec:experiments} In this section, we compare the performance of delayed rejection HMC (DRHMC) to that of standard HMC. \subsection{Setup} \label{sec:setup} Given a current state $x$, HMC makes a proposal $y=F_1(x)$ where $F_1 = L_\varepsilon^n P$ is the deterministic mapping that integrates Hamiltonian dynamics with leapfrog integration for $n$ steps and step size $\varepsilon$. In DRHMC, we consider the first proposal to be the same as in HMC. Upon rejection of the first proposal, we make $k-1$ subsequent proposals. For each of these, we reduce the step size by a fixed factor $a>1$ while increasing the number of steps in proportion, to maintain a constant integration time. This corresponds to a deterministic mapping, \[ F_k(x) = L_{\varepsilon a^{-(k-1)}}^{na^{k-1}} P(x). \] For every experiment and configuration, we run 50 chains with 1000 iterations for burn-in followed by 20,000 sampling iterations. \subsubsection{Choice of parameters} HMC has three tuning parameters, the step size $\varepsilon$, the number of leapfrog steps $n$, and the mass matrix $M$. The total integration time is $T = n\varepsilon$. We use Stan \citep{Stan} to tune the reference values of these parameters using the following two steps. \begin{enumerate} \item We use the no-U-turn sampler (NUTS) \citep{NUTS} to select the integration time $T$. NUTS is an adaptive algorithm that automatically stops every leapfrog trajectory when it starts to double back and retrace its steps and biases draws along the trajectory to later in the trajectory in an attempt to maximize expected squared jump distance. Therefore, NUTS does not require tuning for $T$ during the warm-up phase. Following \citep{Wu2018}, we choose time of integration $T$ to be the 90th percentile of the trajectories followed by NUTS.\footnote{Unlike \citep{Wu2018}, we do not jitter the number of leapfrog steps.} \item After fixing $T$, we re-run Stan with HMC to estimate the optimal step size $\varepsilon_{\mathrm{f}}$ and a diagonal mass metric, $M$. \end{enumerate} In addition to the HMC tuning parameters for integration time and step size, DRHMC has tuning parameters $k$ for the total number of of subsequent proposals made and $a$ for the divisor by which step size is reduced for every subsequent proposal. To develop an understanding of how these parameters impact the performance of DRHMC, we report results for the grid of configurations with $k \in \{2, 3, 4\}$ and $a \in \{2, 5, 10\}$. With its ability to reduce step sizes in subsequent proposals, DRHMC is more robust to the initial tuning of step size. To demonstrate this, we evaluate HMC and RHMC with fixed and initial step sizes at, above and below the adapted step size, $\varepsilon_0 = 0.5 \varepsilon_{\mathrm{f}},\, \varepsilon_{\mathrm{f}}, 2\, \varepsilon_{\mathrm{f}}, 5\, \varepsilon_{\mathrm{f}}$. \subsubsection{Metric of comparison} To measure sampling performance, we report the umber of log density and gradient evaluations required per effective draw, that is, \begin{equation} \mathcal{C} = \frac{N_{\textrm{evals}}}{\mathrm{ESS}}, \label{eq:cost} \end{equation} where $N_{\textrm{evals}}$ is the total number of log density and gradient evaluations in the Markov chain, and $\mathrm{ESS}$ is the effective sample size for a parameter estimate extracted from the chain. Log density and gradient evaluations dominate the cost of HMC, allowing us to ignore other implementation details. Thus $\mathcal{C}$ is the inverse of efficiency; smaller $\mathcal{C}$ is better. Its value will depend on the expectation being evaluated, so we report results for posterior means of parameters $\theta$ and their squares $\theta^2$, the latter of which measures performance in estimating variance. If $\rho_t \in (-1, 1)$ is the autocorrelation of a quantity in the Markov chain at lag $t$, the effective sample size is \begin{equation} \mathrm{ESS} = \frac{N}{1 + 2 \sum_{t = 1}^{\infty} \rho_t}\ , \label{eq:essr} \end{equation} where $N$ is the total number of iterations \citep{geyer11}. Standard errors for estimating parameters are then derived from the MCMC central limit theorem as as \[ \textrm{se} = \textrm{sd} / \sqrt{\textrm{ESS}}\ , \] where $\textrm{sd}$ is posterior standard deviation. The central limit theorem states that as effective sample size grows, errors approach a normal distribution, \[ \widehat{\theta} - \theta \sim \mathcal{N}(0, \textrm{se}^2)\ . \] This is usually a reasonable approximation even for modest effective sample sizes. Alternatively, if we know the true posterior mean value $\theta$, we can run independent Markov chains and calculate errors $\widehat{\theta} - \theta$. The sample standard deviation of the errors can be used to estimate $\textrm{se}$, from which we can back out effective sample size as \[ \textrm{ESS} = \left(\frac{\textrm{sd}}{\textrm{se}}\right)^2. \] In the following experiments, depending on whether we have access to the true parameter distributions, we will show results in terms of cost per effective sample calculated by autocorrelation length ($\mathcal{C}_{r}$) or estimated through errors in cases where posterior means and variances are known ($\mathcal{C}_c$). In experiments with more than one parameter being sampled, we will show the cost for the parameter that mixes the slowest in the sense of having the lowest effective sample size. We run multiple Markov chains and measure per-chain variation in cost by applying the bootstrap technique across chains. \subsection{Neal's funnel} \begin{figure}[t!] \includegraphics[width = \textwidth]{figs2/figure1.pdf} \vspace{-20pt} \caption{Difficulty of sampling Neal's funnel in $d=20$ dimensions. (Left) The marginal for $\beta$, which is $\mathcal{N}(0, 3^2)$ as shown in gray, when the funnel is sampled with NUTS (default settings and HMC for different step sizes. (Right) The fraction of accepted and rejected proposals for HMC as a function of $\beta$ for different step sizes. All runs are done for 50000 samples and histograms are generated with bin-width of 0.1.}\label{fig:funnelhmc} \end{figure} We begin our experiments with the problem of sampling Neal's funnel, upon which we touched in the introduction. In $d$ dimensions, given a variance $\sigma^2$, we are interested in sampling $q=\{\beta, \alpha_2, \ldots, \alpha_d\}$ from Neal's funnel distribution \citep{Neal2000}, which is defined by \begin{align} \beta &\sim \mathcal{N}(0, \sigma^2) \nonumber \\ \alpha_i &\sim \mathcal{N}(0, e^{\beta}), \quad i = 2, 3, \dots, d, \label{eq:funnel} \end{align} where as usual we use $\mathcal{N}(\mu,\sigma^2)$ to denote a normal pdf with mean $\mu$ and variance $\sigma^2$. The resulting target pdf is $$ \pi(\beta, \alpha_2, \dots, \alpha_d) = \mathcal{N}(\beta \mid 0, \sigma^2) \prod_{i = 2}^d \mathcal{N}(\alpha_i \mid 0, \exp(\beta)). $$ Following Neal we set $\sigma=3$. This distribution has equal probability mass in the regions $\beta<0$ and $\beta>0$. However the distribution has a wide range of length scales due to the curvature changing as $\beta$ ranges from large to small values (see Fig.~\ref{fig:funnel}). This makes it challenging to sample the funnel efficiently with a constant step size. We can illustrate this with the help of Figure \ref{fig:funnelhmc}, which shows the empirical marginal of parameter $\beta$ when sampling the funnel in $d=20$ dimensions with NUTS and HMC for different settings. The correct marginal for $\beta$ is $\mathcal{N}(0, 3^2)$ which means that about $\sim 5\%$ of samples should lie at $\beta<-5$. However even for $\epsilon_0=0.2$, there are no samples in this regime. For NUTS, to push to $\beta<-5$, the step size had to be reduced such that $99\%$ of all proposals are accepted, as compared to $80\%$ default value of Stan and $65\%$ fraction considered optimal for normal distributions in HMC \citep{beskos2013optimal}. To explore beyond the $3\sigma$ region, as required to get the right results for modest tail statistics, we need to reduce the step size further to $\varepsilon=0.01$. The extremely small step size necessary to explore the neck of the funnel is very inefficient for exploring the mouth of the funnel. As $\beta$ grows, the marginal $p(\alpha)$ approaches a lognormal distribution with $\sigma = 3$, and thus has long tails. The expected value of $\alpha^2$ is on the order of $10^2$, whereas the expectation of $\alpha^4$ is on the order of $10^8$. Due to the scale of the mouth of the funnel, the optimal step size is much larger than $\varepsilon=0.01$ required to sample the neck of the funnel. Figure~\ref{fig:funnelhmc} provides an illustration of how well HMC can cover the mouth and neck of the funnel based on step size (left panel), as well as a comparison of the densities of accepted and rejected proposals for various step sizes (right panel). All of the step sizes are able to sample the mouth of the funnel, however inefficiently, but in the neck of the funnel, acceptance rate dwindles to a sharp cutoff below which HMC is unable to sample. To sample the tails of $\beta < 3 \cdot \textrm{sd}[\beta]$, we need to reduce step size even further below $\varepsilon=0.01$. \begin{figure}[t!] \centering \includegraphics[width = 0.9\textwidth]{figs2/figure2.pdf} \vspace{-10pt} \caption{DRHMC for Neal's funnel in 20 dimensions. (Left) The marginal for $\beta$ sampled by NUTS, HMC and DRHMC with initial step size $\varepsilon_0=0.2$ and second proposal with step size reduced by factors a=2, 5, 10. (Right) The fraction of accepted and rejected proposals for HMC as a function of $\beta$ in different stages of DRHMC when first step size $\epsilon_0=0.2$ and step size is reduced by factor $a=2$ at every stage. All runs are done for 50000 samples and histograms are generated with bin-width of 0.1. } \label{fig:funneldhmc} \end{figure} Figure \ref{fig:funneldhmc} shows how DRHMC can mitigate the sharp cutoff in the neck of the funnel by reducing step size as needed. The left plot shows the marginal density $p(\beta)$ sampled with NUTS and HMC for step size $\varepsilon_0=0.1$, as well as one-retry DRHMC with different stepsize reduction factors, $a$. When the second proposal step size is reduced by factor of 10, DRHMC is able to sample $\beta$ to $\pm 3\sigma$. The right panel shows the density of rejections and acceptances for the first, second, and third proposals of DRHMC with a larger step size ($e_0 = 0.2$), but allowing multiply retries with a reduction of $a = 2$. With the possiblity of three proposals, an initial step size of $e_0 = 0.2$ is also able to sample $\beta$ to $\pm 3\sigma$. \begin{figure}[t!] \centering \includegraphics[width = 0.7\textwidth]{figs2/figure3v2_lp30_ol1.pdf} \vspace{-10pt} \caption{Efficiency of DRHMC for Neal's funnel. These plots show the ratio of cost per effective sample of $\beta$ for DRHMC vs HMC when sampling Neal's funnel for different dimensions ($d = 5, 20, 50, 100$). ESS for the cost is estimated using standard error with reference samples (Eq.~\ref{eq:essr}). Black points and horizontal dotted black lines show the reference ratio (=1 for HMC with $\varepsilon=0.01$). Different colors show the cost for DRHMC with different first step sizes $\varepsilon_0$; smaller is better. Different shapes correspond to different configurations (number of proposals $k$ and reduction factor $a$). We show only configurations with $\varepsilon_{\mathrm{min}} \leq 0.01$. Error-bars are estimated by bootstrapping over chains. } \label{fig:funnelcost} \end{figure} Figure \ref{fig:funnelcost} illustrates the efficiency gain of DRHMC over HMC for Neal's funnel. We show the cost per effective sample of $\beta$ for funnels of dimensions $d= 5, 10, 20, 100$. $\textrm{ESS}_r$ can be biased to the high side because it only depends on the autocorrelation length of the chain and not that it is sampling the correct stationary distribution. Thus we use square errors to estimate effective sample size ($\mathrm{ESS}_c$). This requires reference samples from the distribution, which are simple to generate independently using a non-centered parameterization of the funnel \citep{Betancourt13}. Figure \ref{fig:funnelcost} shows that DRHMC is consistently a factor of 4 more efficient than HMC in terms of log density and gradient evaluations required for a given effective sample size; in some configurations the advantage is as much as a factor of 8. We restrict attention to configurations for which HMC is able to sample $\beta$ to plus or minus three standard deviations (i.e., $\epsilon \leq 0.1$). For all configurations, we applied Kolmogorov–Smirnov (KS) tests to the body and tails of the distributions to ensure we are sampling the correct distribution. \subsection{Eight schools model} One of the motivating applications for Bayesian hierarchical modeling was a meta-analysis of the effects of a test preparation intervention on students in eight schools \citep{Rubin81}. The data consists of the differences in pre-test and post-test scores, which are reported as an average $y_n$ and standard deviation $\sigma_n$ for each school $n$. The hierarchical model uses parameters $\theta_n$ for the efficacy in each school and assigns them a hierarchical normal prior with unknown location $\mu$ and scale $\tau$. The generative model is as follows \citep{gelman2013bda}.\footnote{The positive half-Cauchy distribution uses a location-scale parameterization whereas the normal uses a location-variance parameterization.} \[ \mu \sim \mathcal{N}(0,5^2), \qquad \tau \sim \mathrm{Cauchy}_+(0,5), \] \[ \theta_n \sim \mathcal{N}(\mu, \tau^2), \ \textrm{and} \] \[ y_n \sim \mathcal{N}(\theta_n,\sigma_n^2). \] The hyperparameter $\mu$ represents the average treatment effect across schools and $\tau$ the scale of variation of effects among schools. As $\tau \rightarrow \infty$, the model approaches no pooling, i.e., each of the school treatment effects is estimated independently. As $\tau \rightarrow 0$, the model approaches complete pooling, i.e., all of the school treatment effects are the same. For small values of $\tau$, the school-level effects $\theta_n$ are squeezed together; for large values, they are allowed to vary widely. This yields a multiscale, funnel-like geometry in the $\tau$ and $\theta$ parameters, where we would expect delayed rejection to improve the performance of baseline HMC. Figure~\ref{fig:eightschool} evaluates several configurations of the DRHMC algorithm as applied to the eight schools problem (see \ref{sec:setup}), plotting the cost of each configuration using the standard error method ($\mathcal{C}_c$) for the slowest mixing parameter. We use the reference samples provided by the \texttt{posteriordb} database\footnote{\url{https://github.com/stan-dev/posteriordb}} to estimate the mean and variance of the parameters as needed to calculate error-based effective sample size ($\textrm{ESS}_c$). The best DRHMC configuration improves over the best HMC configuration by a factor of three for estimating the parameter mean. Different configurations for HMC perform the best for the first and second moment, with the cost of second moment estimation by DRHMC being on par with that of HMC. \begin{figure}[t!] \includegraphics[width = \textwidth]{figs2/essbootstrap1_8school.pdf} \vspace{-10pt} \caption{Cost per effective sample for HMC and DRHMC for the eight schools model. The two panels show the cost for the slowest dimension for the first ($\theta$) and second ($\theta^2$) moments respectively. The cost for HMC is shown in black points, as estimated by using the standard error method for ESS. Different configurations for DRHMC are shown in different colors (reduction factor, $a$) and shapes (number of proposals, $k$). Different step sizes are separated by vertical dashed black lines. Dotted horizontal black line shows the cost for the reference configuration (as fit by Stan) of HMC.} \label{fig:eightschool} \end{figure} \subsection{Gull's lighthouse} Challenging posterior geometries arise even in simple two dimensional problems if the data is not very informative. For example, consider estimating the direction of flashes emanating from a coastal lighthouse \cite[p.~59]{Gulls88}. Assume the lighthouse is at position $x_0$ along a straight coast at distance $y$ into the sea. Its light is spinning and emits a series of collimated flashes at random intervals which are then detected, each at a single point on the coastline. Given N$_f$ flashes recorded at the positions $x_i, \, i=1,\dots,\mathrm{N}_f$, we perform a Bayesian estimation of the position of the lighthouse ($x_0, y$). The lighthouse flashes in a random direction $\theta$, relative to vertical, drawn from a uniform distribution on $(-\pi/2,\pi/2)$. Such a flash will be observed at location $x_i$ on the coast, where $\theta = \arctan((x_i - x_0)/y)$. Applying a change of variables, the likelihood of observing a flash is \begin{eqnarray*} p(x_i \mid x_0, y) & = & \frac{y}{\pi (y^2 + (x_i-x_0)^2)} \\[4pt] & = & \textrm{Cauchy}(x_i \mid x_0, y). \end{eqnarray*} With improper uniform priors on $x_0$ and $y$, and the assumption that the flashes are independent, the posterior is proportional to the product of observation likelihoods, \[ p(x_0, y \mid \{x_i\}) \ \propto \ \prod_i \textrm{Cauchy}(x_i \mid x_0, y). \] In Figure \ref{fig:gulls}, we show the cost $\mathcal{C}_r$ for the case with $N_f=3$ flashes observed at $x_i = 0.9,\, 1.2,\, 1.21$, for both the parameters $x_0$ and $y$. We estimate ESS by measuring autocorrelation length of the chains since there are no reference samples available for this model. For estimating $y$, whose effective sample size is an order of magnitude lower than that of $x_0$ with HMC, DRHMC is a factor of five more efficient; there are no gains in sampling the parameter $x_0$ that mixes well with HMC. \begin{figure}[t!] \includegraphics[width = \textwidth]{figs2/essbootstrap1_gulls.pdf} \vspace{-10pt} \caption{Cost per effective sample for HMC and DRHMC for Gull's lighthouse model. The two panels show the cost for the two dimensions of the model. Symbol legends are the same as in Figure \ref{fig:eightschool}. ESS is estimated by measuring autocorrelation length of the chains. } \label{fig:gulls} \end{figure} \subsection{Gaussian Mixture Model} Mixture models present problems for samplers with fixed step sizes when the mixture components are of different scales. Multimodal distributions whose components have varying geometries also defeat global tuning for HMC. HMC relies on tuning these parameters before sampling (for example, Stan first runs a warmup phase that performs adaptation before sampling begins). As in other intrinsically multiscale problems, DRHMC has the potential to outperform baseline HMC by using different proposal scales in different regions of the state space. To simulate the situation arising with multivariate posteriors, we consider a univariate Gaussian mixture with equal mixing weights on the components. We take fairly separated locations $\mu_i$ that still allow mixing. The scales $\sigma_i$ then vary by an order of magnitude. The model pdf is \begin{equation} p(\theta) = \sum_{i=1, 2}\phi_i \cdot \mathcal{N}(\theta \mid \mu_i, \sigma_i^2), \end{equation} where we fix \[ \phi_1= 0.5, \phi_2 = 0.5 \quad \mu_1 = 0, \mu_2 = 3, \ \textrm{and} \quad \sigma_1 = 0.1, \sigma_2 = 1. \] Our goal is then to sample the univariate parameter $\theta \in \mathbb{R}$. We choose this simple problem for illustration because sampling mixtures only becomes more challenging in higher dimensions with differently conditioned components, in situations where the modes are either more widely separated or more highly overlapping, or when the weights of the components are highly skewed. The optimal step size for the components is directly proportional to the component's scale, which varies by an order of magnitude. Figure~\ref{fig:gaussmix} shows that the best DRHMC configurations can be twice as efficient as HMC. This gap can be made arbitrarily wide by increasing the number of dimensions and the difference in scales between the modes. \begin{figure}[t!] \includegraphics[width = \textwidth]{figs2/essbootstrap1_gaussmix.pdf} \vspace{-10pt} \caption{Cost per effective sample for HMC and DRHMC for the Gaussian mixture model with components varying in scale by a factor of ten. The two panels show the cost for estimating the mean of $\theta$ and $\theta^2$, the second of which determines variance. Symbol legends are the same as in Figure \ref{fig:eightschool}. ESS is estimated with the standard error method after generating reference samples from the Gaussian mixture model.}\label{fig:gaussmix} \end{figure} \subsection{Stochastic volatility model} \begin{figure}[t!] \subfloat[Delayed Rejection]{\includegraphics[width = \textwidth]{figs2/essbootstrap1_stochv.pdf}} \vspace{-10pt} \subfloat[Probabilistic Delayed Rejection]{\includegraphics[width = \textwidth]{figs2/essbootstrap3_stochv.pdf}} \vspace{-10pt} \caption{Cost per effective sample for HMC and (a, top) DRHMC and (b, bottom) Probabilisitic DRHMC for Stochastic Volatility model. The two panels show the cost for the slowest dimension for first ($\theta$) and second ($\theta^2$) moments respectively. Symbol legends are the same as in Figure \ref{fig:eightschool}. } \label{fig:stochvcost} \end{figure} Finally we consider an example that does not suffer from the pathology of multiscale distributions, but is still challenging due to high dimensionality and correlated parameters. Stochastic volatility models \citep{Kim98} seek to model the volatility (i.e., variance) of a return on a financial asset, such as an option to buy a security. This changing volatility is modeled as a latent stochastic process in discrete time. Given the mean corrected returns $y_t$ on an underlying asset at $T$ equally spaced time points as input data, we are interested in estimating the latent parameter $h_t$ for the log volatility, mean $\mu$ and variance $\sigma$ of log volatility, as well as the persistence of the volatility $\phi$. Thus the parameter vector is $q=\{\mu, \sigma, \phi, h_{t=1,...,T}\}$, with \begin{align} \phi \sim \mathrm{uniform}(-1,1); \, \, \quad \sigma &\sim \mathrm{Cauchy}(0,5); \quad \mu \sim \mathrm{Cauchy}(0,10) \nonumber \\ h_1 \sim \mathcal{N}\Big(\mu, \frac{\sigma^2}{{1 - \phi^2}}\Big); \quad h_t &\sim \mathcal{N}\big(\mu + \phi (h_{t - 1} - \mu), \sigma^2\big), \quad t = 2,3,\dots,T \nonumber \\ y_t &\sim \mathcal{N}\big(0, \mathrm{e}^{h_t}\big), \quad t = 1,2,\dots, T. \nonumber \end{align} The posterior exhibits varying curvature due to the hierarchical prior on the volatility parameters, which reinforces the natural correlation among the volatility estimates due to their sequencing in time. Figure \ref{fig:stochvcost}(a) shows that the the additional computational cost of DRHMC ends up making it more costly per effective sample than HMC. The cost of DRHMC is high her because the original step size is optimal, so that retrying with a lower step size only doubles computational costs. To close the gap with fixed step size HMC when scales do not vary, we introduce a probabilistic modification of DRHMC that only retries when the previous proposal had a high probability of being rejected. Specifically, We consider a scheme in which subsequent proposals are made with probability \[ p(x, s_j) = 1 - \alpha(s_j), \] where $s_j$ is the previous proposal made from $x$ and $\alpha(s_j)$ is its acceptance probability. Figure \ref{fig:stochvcost}(b) shows how retrying with a probability equal to the original failure chance avoids needless step size reduction, allowing DRHMC now to exceed slightly the efficiency of HMC. \section{Discussion} \label{sec:discussion} We introduced a novel application of delayed rejection to Hamiltonian Monte Carlo (HMC) sampling in which subsequent proposals are made for the same integration time at a reduced step size. We showed that in multiscale posteriors such as mixture models or hierarchical models, delayed rejection can boost performance by a factor of five or more. We provided a proof that even if the initial step size is chosen to be too large, delayed rejection introduces at most a factor of two additional cost over choosing the optimal baseline step size. We also proved, in an accessible fashion avoiding measure theory, detailed balance for both classical Hamiltonian Monte Carlo and our new proposal. In cases where the target density is not multiscale, we introduced a novel form of delayed rejection where retries are only attempted when the previous proposal had a high chance of failure. Unlike the case for HMC, which will fail with potentially hard to diagnose biases, DRHMC with probabilistic retries is robust to the initial choice of step size, thus reducing overall costs when tuning step size is expensive. In realistic problems, we often do not know if our target distribution suffers from multiscale or varying geometry pathologies as in the cases we considered. For example, varying amounts of data and varying noise ratios in the data can dramatically change the posterior geometry, changing roughly normal posteriors into funnels or vice-versa, depending on the model parameterization \citep{papaspiliopoulos2007general,Betancourt13}. Reducing the step size is not the only way of constructing delayed proposals. Another approach would be to replace the leapfrog integrator altogether for retries, for example with an implicit symplectic integrator \citep{Pourzanjani19}. Such integrators may additionally be able to deal with stiffness arising from high correlation. Delayed rejection HMC could also be combined with other improvements to HMC, e.g. ensemble preconditioning \citep{Matthews16}, Riemannian HMC \citep{Betancourt13}, and manifold HMC \citep{Au20}. \bibliographystyle{ba}
\section{Touch in visualization research} An additional motivation for this study is to break ground in a largely unexplored area of visualization and physicalization research: the role of touch for making sense of data representations. Research in psychology offers many starting points: people learn to interpret charts by tracing them with their fingers even if they don’t offer tactile features \cite{agostinho2015}, touching objects often supports learning and memorizing their features better than just observing them \cite{novak2020,hutmacher2018}. Tactile stimulation is used extensively in the Montessori pedagogy; letters cut from sandpaper help children to learn the alphabet with multiple sensory modalities \cite{novak2020}. Also data physicalization research has shown that the ability to touch a tangible data object improves its understanding \cite{jansen2013}. So far, however, the visualization discipline has largely overlooked the touch modality. Some data physicalization researchers have used haptic feedback to represent data, though often this involves single-channel touch information such as temperature or vibration \cite{hogan2013,brueckner2018}. Research on the design of tactile graphics and data visualizations for the visually impaired has led to many new insights \cite{edman1992,engel2021}, though these results may not generalize to the larger population, since reading tactile charts requires specialized skills that individuals without visual impairments typically do not acquire. \section{Human touch behaviors and object qualities} Attempts at generalization are limited by the finding that touch behaviors are individual-specific. “Need for touch” (NFT) scales are one way to capture and characterize these behaviors along two dimensions: \textit{instrumental NFT} and \textit{autotelic NFT} \cite{peck2003}. People high in instrumental NFT use touch to gather information and make judgments about objects. Those high in autotelic NFT are hedonically motivated to touch objects and enjoy the sensory and exploratory aspects of touch \cite{peck2003}. Research using images of objects has shown broad human preferences for touch related to qualities of the target object. Rough surfaces are often perceived as less touchable — for example, glass is preferred to concrete — though very smooth surfaces may also be perceived as less touchable \cite{klatzky2011}. Very simple and very complex object shapes are often perceived as less touchable \cite{klatzky2011}, as well as less aesthetically pleasing \cite{spehar2003universal}. Stroking touch behaviors are particularly related to the perceived touchability of objects and texture appears to be a primary driver of these behaviors \cite{klatzky2011}. \section{Interpretation of traces} Our tracer substance generates persistent marks that offer a compelling record of the user’s interaction with the object — a form of autographic visualization \cite{offenhuber2019}. Beyond the basic question of where the object is touched, the traces offer clues about the quality of touch: which parts of the hand are used, the intensity of touch, whether fingers are moved across the surface. As unobtrusive measures, traces can offer a rich and multi-faceted picture and can be interpreted from many different angles \cite{webb1979}. Webb differentiates between traces of erosion and of accretion \cite{webb1966}, which are also popular design metaphors in HCI and visualization, to convey ideas of temporality and accumulation \cite{huron2013,hill1992}. In the context of our study, these correspond to the subtractive and additive methods. We used our method to capture touch and trace gestures on art objects, in a controlled setting. To help us begin interpreting the meaning behind these touches, we also recorded videos of the interaction and conducted semi-structured interviews. Our goal is to provide tools to explore the semantics of touch. \section{Methods and study design} These experiments were designed to test the use of our subtractive and additive fluorescent imaging methods to capture the many ways art objects are touched. To simulate the museum experience, the objects were set out on a table for display. The observers were free to touch the objects as they chose, not driven by a specific task. \subsection{Stimuli} We selected five objects for study, which are shown in the first row of \autoref{fig:teaser}. These included a simulated landscape, two abstract non-representational objects, and two representational objects. In the order shown in \autoref{fig:teaser} from left to right, the objects were: \begin{enumerate} \item “\textbf{Gauss}” Gaussian surface sculpture created by overlaying four positive and negative Gaussian functions. A rectangular object milled from medium density fiber (MDF) board, and coated with a semi-rigid, white opaque layer of epoxy resin, which appears smooth, although imperfections of the coating are visible and tangible. \item “\textbf{Skull}” Novelty glass decanter that contains multiple contours representing features of the human skull with a bottle neck and a cork on top. It is a smooth and transparent glass object that was filled with black lentils to increase visual contrast. \item “\textbf{David}” Classic bust, inspired by Michelangelo’s David. This reproduction is made from thin resin and has a rough surface. \item “\textbf{Spike}” Spherical ceramic object covered with rounded 1-inch high convex spikes. Its smooth mirror surface appears to be made from metal, but is actually a ceramic glazing. \item “\textbf{Dog}” Novelty bank reproduction of the famous balloon dogs created by Jeff Koons. This reproduction is a hollow ceramic object with double curved surfaces and smooth black glazing, with a coin slot and removable plastic stopper. \end{enumerate} \begin{figure} \centering \includegraphics[width=\linewidth]{figures/fig3sub.png} \caption{Touch patterns on art objects using the subtractive method. } \label{fig:sub} \end{figure} \subsection{Experimental Design} Data were collected in a blocked design, with different observers serving in the additive and subtractive conditions. For both conditions, the five objects were arrayed on a table, in varying orders. In the subtractive condition, the \textit{GloGerm} powder was suspended in alcohol and air-brushed onto the object. This produced a nearly-invisible layer of fluorescent particles. In the additive condition, the fluorescent powder was applied to the observers' hands before touching the objects. In both conditions, the observer was instructed to examine the objects, and to feel free to touch them however they wanted. After each session, we photographed the objects under ultraviolet light, from multiple directions, to capture an objective measure of their touch patterns (\autoref{fig:teaser}). To capture the subjective experience of our observers, we video recorded their movements. We used the video to better understand observers' exploration process, to contextualize the photographed touch outcomes with the touch behaviors, and to capture incidental comments as they conducted the task. At the end of each session, we conducted a semi-structured interview, where we asked the observer what the experience was like for them, which objects were their favorite, and if the objects felt as they expected. The fluorescent material was removed from the objects between sessions. Three subjects participated in the subtractive condition, two identifying as male, one identifying as female. Four subjects, all identifying as female, participated in the additive condition. Experiments took place in July 2021. Participants were in their 20s and 30s. \section{Results} \subsection{Fluorescent Images of Observer Touches} The subtraction and addition of the fluorescent powder provided an objective measure of where the objects were touched, which we captured by photographing the objects under ultraviolet light. \autoref{fig:add} shows results from four subjects using the additive method. \autoref{fig:sub} shows the results from four subjects using the subtractive method. Both methods produced reliable results and demonstrated touches and gestures made by a single finger, multiple fingers, and the whole hand. Both methods produced clear results when viewed under the ultraviolet light by the human eye. The photographic images produced when the fluorescing material was applied to the object (additive method) were more effective in capturing these touch patterns. In the additive method, more fluorescing material was present, producing higher contrast photographs. In the subtractive method, less powder was used and in some cases residual powder remained on the objects after cleanings which reduced the contrast of the images. \subsection{Types of Touches} For each observer, we examined the photographic images of their touch patterns and compared these with the video recordings of their touching behavior. For both methods, we observed individual regions where the powder had been deposited or removed, which we identified as touches or path tracing by a single finger. Figure \ref{fig:gauss} shows a clear pattern of complex tracings on and around the peaks of Gauss. We also observed whole-hand grasping patterns, where the imprint of several fingers was captured. Figure \ref{fig:dog} shows how the legs and tail of Dog were grasped. Large regions where the material was either added or removed indicated places where the shape or curvature of the object was examined. \begin{figure}[b] \centering \includegraphics[width=\linewidth]{figures/S171_27_gauss_s.jpg} \caption{Subject 171, subtractive traces on the object "Gauss." } \label{fig:gauss} \end{figure} \subsection{Relating Touch Images to Touching Behaviors} To understand images of touch patterns more fully, we compared them to the touching behaviors captured in the video. In the videos, we observed (1) one finger or multi-finger pointing and stroking gestures, including path tracing, (2) whole hand stroking gestures, including feeling textures and contours, (3) multi-finger grasping gestures, including pinching objects to rotate them while they remain on the table, (4) whole hand grasping gestures, including holding, lifting, and enveloping objects in one or two hands. These touch patterns revealed a wide range of different exploratory strategies. We observed that for most objects, the first step for all participants was to lift the object. When lifting objects, some participants used one hand and turned the object around to look at it from all sides. Others lifted it with two hands and rotated it in their palms to change orientation. They cupped or grasped particular parts of the object, and when they explored a specific region, they used the thumbs and the sides of their fingers for tracing, not just the fingertips. We made some preliminary observations on the types of touches used on various objects. We noticed that Gauss was not lifted as frequently as the other objects and that it elicited more tracing behaviors, especially on the peaks and concavities. Participants used their fingers to trace paths and points of interest, used multiple fingers along curved surfaces, and also used their whole hand to trace over the object. Many observers grasped the tail or nose of Dog with their whole hand and often lifted it, using these areas as handles. Spike was often held in one hand with the fingers between the spikes and Skull was often held in two hands. The miniature David attracted fewer touches than the other objects. \begin{figure} \centering \includegraphics[width=\linewidth]{figures/S147_22_dog_a.JPG} \caption{Subject 147, additive traces on the object Dog. } \label{fig:dog} \end{figure} \subsection{Additive versus Subtractive} The additive and the subtractive methods have their advantages for different objects and for emphasizing different aspects of the interaction. The traces captured by the subtractive method had high precision, but tended to be light and sometimes hard to capture photographically (see \autoref{fig:sub}). The associated videos show that the subjects were more tentative in exploring objects that were prepared in this way. This was unexpected: with the powder almost invisible, the subtractive method was less intrusive. The additive method produced more robust, higher-contrast traces. The participants had to dip their hands into the powder, which was initially unpleasant for some, but once that hurdle was overcome, their touches were less tentative than with the subtractive method. Both methods produced artifacts that limit their applicability. In case of the subtractive method, it can be difficult to create an even powder coating, and uneven areas can be confused with traces. For the additive method, it makes a difference whether participants thoroughly cover their entire hands in powder. \subsection{Tracing and Grasping} The majority of the impressions we captured reflected overall holding, moving, and turning the object with the whole hand. Gauss elicited the most targeted touches and tracing gestures, perhaps because it was heavier, and more awkward to pick up. Many single-finger traces on Gauss were reminiscent of visual scan paths, captured by eye tracking, and to how visually impaired people are trained to explore tactile information. We also observed multiple-finger traces along contours and whole-hand impressions. We observed an interesting interplay between visual inspection, kinesthetic examination (such as shaking the object), and tactile exploration. Many senses are used at the same time and support each other. With regard to tactile exploration, we also observed an interplay between the interrelated tasks of holding and supporting the object and exploring its surface. To explore tactile features, the participants not only used their fingertips, but also their thumbs, the sides of their fingers, their palms, and the whole hand. \subsection{Individual Differences Between Observers} All observers, in both conditions, touched all the objects. However, individuals varied in their approach. Participants split their time differently between the objects and occasionally touched the objects in a different order than was suggested by their linear arrangement on the table. Some participants spent more time touching objects while others spent more time observing them visually. We observed differences in the style of touching. Some observers were tentative in their touches, others were enthusiastic and autotelic (S147), taking aesthetic pleasure in the touch process. Some seemed analytical, tracing contours of the object (S171), others seemed to explore and caress the objects with painterly gestures (S193) and others simply picked them up, turned them around and moved on. Gauss produced the greatest variation in responses between observers. \subsection{Participant Observations} The participants commented on their experience during and after interacting with the objects. For some objects, they mentioned that touching gave them information that conflicted with their visual understanding. The apparently metallic, but actually ceramic, material of Spike was surprising (S132) and Dog was described as heavier than expected (S193). Curiosity about the material and particular features of the objects were cited as motivating their touch (S133). Some participants noted a change in interest in a particular object after touching it, finding it better than expected (S133). Another observer found the indentations of Gauss and the smooth surface of Dog to be attractive and appreciated how easy it was to handle Dog (S169). One participant expressed discomfort touching Spike because it was unclear how to hold it. Participants also talked about their past experience in interacting with the objects; for example, one participant with a physics background mimicked the path of a marble on Gauss (S171) and another mentioned disliking an object because of bad memories of drawing classes (S147). Subject differed in their appreciation of the powder. At least one participant enjoyed dipping their hands into the tracer substance, remarking that the powder made their hands less sweaty and gave them more confidence in judging the object materials (S193). A few people used sound to explore the objects. One remarked, “I knock it because I want to distinguish are they all made by the same material. I can distinguish those by the sound” (S193). Others were observed tapping or shaking the objects. \section{Discussion} Figure \ref{fig:auto} shows sculptures from around the world that attract human touch. Over the decades, people have been drawn to touch a nose, a shoe, or another feature. These autotelic touches have been captured by the gradual polishing of the bronze or the gradual smoothing of the stone. Our experiments aim to develop a method that likewise captures where and how we touch art objects, but on a much shorter time scale. In our method, microscopic fluorescent particles are either added or removed from the surface when touched. Viewing these additions or subtractions under ultraviolet light provides a clear record of where the object was touched. Using this method, we were able to capture and record different types of touch. In some cases, we were able to distinguish which part of the hand created the mark, and whether the object was actively explored or just held. Despite the limited number of participants, the collected data show a surprisingly rich variety of tactile interactions with the objects. We also created video recordings of our observers' touch behaviors, as a first step toward interpreting the meaning of these touches. We found that our observers not only touched the objects, traced paths on their surfaces, caressed their contours and pinched their peaks, they often picked them up, rotated, and explored them. In all cases, our method captured the touch behavior, but interpreting this behavior is quite complex. Different objects elicited different touch behaviors, specific features of the object elicited different touch behaviors, and individuals displayed different touch styles. \subsection{Touching Physical Objects} We noticed that participants were more interested in exploring the larger, heavier objects, Gauss and Dog, than the smaller, lighter ones. In the videos, it seemed that the smaller objects were treated like items in a gift shop. They were picked up and examined, often cursorily, and sometimes only visually, and didn't attract the variety of traces and strokes the more substantial objects received. Gauss elicited more exploratory and differentiated touches. The limbs of Dog were large enough to fit perfectly into the palm of the adult hand and seemed to invite this kind of grasping. While large-scale sculptures, such as the Juliette in Verona and Michelangelo's David, encourage touch, it seems that their small-scale replicas may not be as compelling. For example, our observers showed particularly little interest in the head of David replica, which was quite small, and made of a very light resin. In the future, we would like to explore how scale affects how an object is touched. Variations in how participants touch particular objects may be partially caused by other object qualities. We saw that single finger or whole hand tracing gestures were common on Gauss, which aligns with Klatzky et al's finding that smooth objects with medium complexity are most inviting to touch, especially with stroking gestures \cite{klatzky2013,klatzky2011}. Perhaps it wasn't the size of the David sculpture that reduced its attraction, but its complexity or rougher surface. However, Klatzky's results were obtained by subjects viewing pictures of objects. Future work could repeat those experiments with real-world objects combined with our method for recording touch behavior. This method could also be used to explore the affordances of objects more systematically, for example, whether objects that seem graspable are in fact grasped more often. Also, our objects were all static and stationary. This technique could be very useful to study how people interact with composite objects with visible joints or parts that can be moved or dismantled. It would also be interesting to further explore the tactile appreciation of artworks. Having a lightweight non-invasive method could provide insights into how the physical characteristics of a sculpture or art object encourages different types of touches, how the conceptual meaning of the piece changes those touch patterns, and how characteristics of the people who touch them play in this equation. \subsection{Documentation of the Traces} Although we were able to capture touch impressions photographically, improvements in our method may yield better results. We found that seeing and interpreting touch traces was much easier when actively inspecting the objects under ultraviolet light than when viewing the photographic images. This may be because viewing a three-dimensional object directly provides more information than we can capture in two-dimensional images of three-dimensional objects. We also found that many precautions were required to carefully calibrate the contrast of the traces against the background and minimize specular reflections in the photographs. \subsection{Implications for Visualization} Data visualization research is intimately connected with the study of visual perception. Visualization design is both guided and constrained by what our visual system can discriminate and recognize, and consequently many researchers engage in experimental studies of perception. Data physicalization extends data representations into physical space and consequently requires the study of tactile and multi-sensory perception. At the moment, research here remains limited and many data physicalizations are designed for visual consumption. In some cases, this makes sense as many visualizations can be readily translated into objects. However, vision and touch provide different channels of information. Methods that allow us to learn more about how we acquire and process information through touch, and how we use touch to analyze and explore physical data representations, can provide deep insight into these processes. The capacity to touch could also be important for interaction research, such as understanding the interaction with building maps or architectural models that are sometimes used as navigational aids in complex interior environments. It could also be useful to study the process of skill acquisition for using manual tools and interacting with unfamiliar interfaces. Future variations of this method, using different tracer powders for different users, could be useful for studying the collaborative exploration of objects. While we opted for a more structured environment, our approach is extensible to other real-world environments where the response is not constrained, allowing behavioral experiments in the wild. \begin{figure} \centering \includegraphics[width=\linewidth]{figures/touch_around_the_world.jpg} \caption{Examples of autotelic responses, where we are drawn to touch art objects from around the world. } \label{fig:auto} \end{figure} \section{Conclusion} We have demonstrated a novel technique that can be used to visualize how people touch art objects. Both the additive and subtractive methods captured the observers' touches. In these experiments, the additive method seemed to encourage more expressive gestures and resulted in higher contrast images; the subtractive method allowed us to capture more nuanced touches and gestures. The two methods, thus, might be best tuned for different touch tasks. For example, if the goal is to capture the emotional response to sculptures, the additive method may be better suited; if the goal is to capture gestures for exploring the fine-structure of a 3-D visualization of scalar data, the subtractive method might be more appropriate. The ability to reliably capture touch behavior can be used in a wide range of different application areas. It can support perceptual research aimed at understanding how touch patterns depend on object characteristics, such as roughness and complexity. It could also be used as a tool for data physicalization, for example, to measure how tactile exploration varies depending on the task, or to support research in embodied cognition, and in other domains where knowing where and how people touch objects can inform our understanding of the thought processes underlying these touches. Being able to reliably measure where and how people use touch is a key first step toward addressing the semantics and intent behind touch gestures. In this experiment, video recording the observers while they touched the art objects and capturing verbal feedback on their interactions provided some preliminary insight. We think this is an important research direction, which can open the door to understanding touch behavior and its role in cognitive processing. \acknowledgments{We thank the organizers of the 2018 Dagstuhl workshop on Data Physicalization for launching this dialog between the authors, the Northeastern University College of Arts, Media and Design Cluster Collaborative Seed Grant and the Summer Student Support Grant, and Patrick Kana for fabrication support. Thanks to Gordon Rogowitz for his photograph of The Goddess Apsaras in Figure 6. } \bibliographystyle{abbrv-doi}
\subsection{Evaluation metrics} We calculate SHD at CPDAG level. Specifically, SHD is computed between the learned CPDAG$(\hat{G})$ and ground truth CPDAG$(G)$, i.e., the smallest number of edge additions, deletions, direction reversals and type changes (directed vs. undirected) to convert the output CPDAG to ground truth CPDAG. As is shown in Table~\ref{table:metrics}, SHD is equal to the sum of the number of \xmark s in the table. \begin{table}[htbp] \scriptsize \caption{SHD calculation details.} \label{table:metrics} \begin{center} \begin{tabular}{|c|c|c|c|c|} \hline \multirow{2}{*}{\makecell{in result CPDAG→\\in truth CPDAG↓}} & \multicolumn{2}{c|}{iden (directed)} & \multirow{2}{*}{\makecell{uniden\\(undirected)}} & \multirow{2}{*}{\makecell{missing in\\skeleton}} \\ \cline{2-3} & right & wrong & & \\ \hline iden & \cmark \circled{1} & \xmark \circled{2} & \xmark\circled{3} & \xmark\circled{4} \\ \hline uniden & \multicolumn{2}{c|}{\xmark\circled{5}} & \cmark \circled{6} & \xmark\circled{7} \\ \hline nonexist & \multicolumn{2}{c|}{\xmark\circled{8}} & \xmark\circled{9} & \cmark \circled{10} \\ \hline \end{tabular} \end{center} \end{table} F1-score is then calculated based on the identifiable edges of CPDAG$(\hat{G})$ and CPDAG$(G)$, where the accuracy (precision) is equal to True Positive Rate (TPR) and the recall (recall) is equal to 1 - False Discovery Rate (FDR). Details about the specific calculation can also refer to Table~\ref{table:metrics}: $$\text{precision=TPR}=\frac{\circled{1}}{\circled{1}+\circled{2}+\circled{3}+\circled{4}},$$ $$\text{recall=1-FDR}=\frac{\circled{1}}{\circled{1}+\circled{2}+\circled{5}+\circled{8}},$$ \subsection{Full result of Table~\ref{table:accuracy}: End-to-end comparison} Here we report full results including other 5 smallest and trivial datasets. Note that 1) All F1-score degrade into 0. on sachs dataset, because that sachs has no identifiable edges. 2) The rank(SHD) row is also re-calculated over full datasets. \input{tab/accuracy_full} \subsection{Predicates in Table~\ref{table:reliability}: Reliability} Table~\ref{table:reliability} shows the performance of 4 weak discriminative predicates and 4 strong discriminative predicates. Specifically, the four strong predicates are respectively 1) $t\sim U[0,1],\ \textsc{olp}(T, \mathcal{S})\geq t$; 2) $\textsc{olp}(T, \mathcal{S})==0$; 3) $\textsc{olp}(T, \mathcal{S})==0$ and $\{X\sim Y\vert \mathcal{S}\cup T\}>0$; 4) $\{X\sim Y\vert \mathcal{S}\vee T\}>0$. The four weak predicates are respectively 1) $\{PC_X\sim PC_Y\vert T\}>0$; 2) $\{PC_X\sim PC_Y\vert \mathcal{S}\vee T\}>0$; 3) $\{X\sim Y\vert PC_T\}==0$; 4) $\{X\sim Y\vert \mathcal{S} \vee \mathcal{PC}_T\}>0$. \subsection{Details of Table~\ref{table:transferability}: Transferability} \input{tab/transferability} To evaluate ML4C's transferability across different domains, we train on dataset generated using one configuration, and test on another. By default the configuration is that: \#nodes=50, sparsity=\#edges/\#nodes=1.5, generating model=ER, and sample size=10000. We conduct controlled trials on the four configuration domains listed above (shown as the four big bars of Table~\ref{table:transferability}). When we test transferability over one domain (e.g., the first bar, \#nodes), then \#nodes is set from 4 options (10, 50, 100, 1k), and $4\times 4=16$ pairs of train-test experiments are conducted. For each experiment, 50 graphs are synthesized for training and another 5 graphs for test. Except for the target domain (\#nodes), all the other domains use the default configuration. The result SHD and F1-score are reported as mean value and standard deviation over the five test graphs.% \subsection{Proof of Proposition \ref{prop:iden_rand_guess}} \IDENRANDGUESS* We take learning target as the orientation of an edge as an example, so we are analyzing the performance of a binary classifier against random guessing. The conclusion can be easily extended to general case. Denote random guessing as a degenerated estimator $r(X)\equiv 0.5$, which indicates the probability of label = 1 is always 0.5, regardless of any input. Denote the joint probability distribution of $X$ and $Y$ as $\mathbb{P}$ and the space of all joint probability distribution is $\mathcal{P}$, then we aim to prove the following statement which is in an adversarial setting:$$r=\argmin_{f \in \mathcal C}\mathop{\sup }_{\mathbb{P} \in \mathcal{P}}E_{ \left( X,Y \right) \sim \mathbb{P}} \left[ -Y\log f \left( X \right) - \left( 1-Y \right) \log \left( 1-f \left( X \right) \right) \right]$$The expectation is the standard binary cross entropy loss; we are allowed to enumerate every possible joint probability distribution in $\mathcal{P}$ because the learning target is non-identifiable. $\mathcal{C}$ is the space of all possible binary classifiers. \vspace{-1em} \begin{proof} Given any binary classifier $f$, we partition the space of $X$ by $A$, $B$ and $C$ where $A=\{x\vert f(x)>0.5\}$, $B=\{x\vert f(x)<0.5\}$, $C=\{x\vert f(x)=0.5\}$. Then we construct the following joint probability distribution $P^{\ast}$: $$P^{\ast} \left( X,Y \right) = \left\{ \begin{matrix} P^{\ast} \left( Y=0 \vert X=x \right) =1 \ \text{if} \ x \in A\\ P^{\ast} \left( Y=1 \vert X=x \right) =1 \ \text{if} \ x \in B\\ \text{arbitrary} \ \text{if} \ x \in C\\ \end{matrix} \right\}$$ Then it is easy to see that \( E_{ \left( X,Y \right) \sim P^{\ast}} \left[ -Y\log f \left( X \right) - \left( 1-Y \right) \log \left( 1-f \left( X \right) \right) \right] \geq 1 \). Note that \( E \left[ -Y\log r \left( X \right) - \left( 1-Y \right) \log \left( 1-r \left( X \right) \right) \right] \equiv 1 \) , thus \( r \) achieves minimum worse-case loss. \end{proof} \subsection{Proof of Proposition \ref{prop:perfect_classifier}} \PERFECTCLASSIFIER* \vspace{-1em} \begin{proof} Classical constraint-based methods consist of three steps: skeleton identification, v-structure identification, and further edge orientation by applying Meek rules~\citep{yu2016review}. It has been proved in PC~\citep{PC} that when learning from a canonical dataset, if both the identified skeleton and v-structures are correct, then the learned CPDAG is correct. ML4C follows the three steps, with the correct skeleton is given as input, and ML4C-Learner is responsible for v-structure identification. Thus, assuming ML4C-Learner is a perfect classifier (i.e., correctly identifies all v-structures) implies that ML4C outputs correct CPDAG. \end{proof} \subsection{Proof of Lemma \ref{lem:sepsets_nonempty}} \SEPSETSNONEMPTY* \vspace{-1em} \begin{proof} According to Lemma 3.3.9 of ~\citep{spirtes2000causation}, in a directed acyclic graph $G$, if $X$ is not a descendant of $Y$, and $X$ and $Y$ are not adjacent, then $X$ and $Y$ are d-separated by \textbf{Parents}$(Y)$. Given an UT $\langle X,T,Y \rangle$, $X$ and $Y$ are not adjacent. Either $X$ is not a descendant of $Y$, or $Y$ is not a descendant of $X$, otherwise a loop will be introduced. Thus there either exists \textbf{Parents}$(X) \equiv PC_X\cup T$, or \textbf{Parents}$(Y) \equiv PC_Y\cup T$, which belongs to $\mathcal{S}$. Thus $\mathcal{S}$ is non-empty. \end{proof} \subsection{Proof of Lemma \ref{lem:existence_of_weak_discriminative_predicate}} \WEAKEXISTS* \vspace{-1em} \begin{proof} For a canonical dataset with infinite samples, \begin{enumerate} \item \textbf{$\left\{ X \sim Y \vert T \right\} >0$}: \begin{inparaenum}[1)]\item $\langle X,T,Y \rangle$ is a v-structure $\Rightarrow$ $T$ is a collider $\Rightarrow$ $T$ unblocks $X$ and $Y$ through path $X-T-Y$ $\Rightarrow$ $\left\{ X \sim Y \vert T \right\} >0$ holds $\textsc{true}$. \item if $\langle X,T,Y \rangle$ is not a v-structure, then $\left\{ X \sim Y \vert T \right\} >0$ can be $\textsc{true}$ or $\textsc{false}$. e.g., it is $\textsc{false}$ for $X\rightarrow T \rightarrow Y$ (no more paths connect $X$ and $Y$), but if there exists another node $X\rightarrow T^{'} \rightarrow Y$, it is evaluated $\textsc{true}$. \end{inparaenum} Therefore, it satisfies criterion ii) of definition \ref{def:weak_strong_discriminative_predicate}, but not i) hence it is a weak discriminative predicate. \item \textbf{$\left\{ X \sim Y \vert \mathcal{PC}_{T} \right\} =0$}: \begin{inparaenum}[1)]\item $\langle X,T,Y \rangle$ is not a v-structure $\Rightarrow$ $T$ is a non-collider $\Rightarrow$ $\forall pc_t\in \mathcal{PC}_{T}$, there exists a path $X-T-Y$ from $X$ to $Y$, where $T$ is the only node on path, $T$ is a non-collider, and $T\notin \{pc_t\}$ $\Rightarrow$ $pc_t$ does not block the path $\Rightarrow$ $\{ X \sim Y \vert \mathcal{PC}_{T} \} =0$ always holds $\textsc{false}$. \item if $\langle X,T,Y \rangle$ is a v-structure, then $\left\{ X \sim Y \vert \mathcal{PC}_{T} \right\} =0$ can be $\textsc{true}$ or $\textsc{false}$. \end{inparaenum} Therefore, it satisfies criterion i) but not ii) hence it's a weak discriminative predicate. \item \textbf{$\left\{ PC_{X} \sim PC_{Y} \vert \mathcal{S} \cup T \right\} >0$}: \begin{inparaenum}[1)]\item $\langle X,T,Y \rangle$ is a v-structure $\Rightarrow$ $T$ is a collider $\Rightarrow$ $\forall pc_x\in PC_{X}, pc_y\in PC_{Y}, S\in\mathcal{S}$, $S\cup T$ unblock $pc_x$ and $pc_y$ through path $pc_x-X-T-Y-pc_y$ $\Rightarrow$ $\left\{ pc_x \sim pc_y \vert S \cup T \right\} >0$ always hold $\textsc{true}$. \item if $\langle X,T,Y \rangle$ is not a v-structure then it can be $\textsc{true}$ or $\textsc{false}$. \end{inparaenum} Therefore, it satisfies criterion ii) but not i) hence it's a weak discriminative predicate. \end{enumerate} \end{proof} \subsection{Proof of Lemma \ref{lem:existence_of_strong_discriminative_predicate}} \STRONGEXISTS* \vspace{-1em} \begin{proof} First, it is known that the following three algorithms are sound and complete for a canonical dataset with infinite samples: CPC~\citep{ramsey2012conservative}, MPC~\citep{colombo2014order} and GLL-MB~\citep{aliferis2010local}. Below we translate each predicate and then show that these predicates are equivalent to the criterion to identify v-structures in CPC~\citep{ramsey2012conservative}, MPC~\citep{colombo2014order} and GLL-MB~\citep{aliferis2010local} respectively. \begin{enumerate} \item Predicate $\textsc{olp}(T,\mathcal{S})=0\Longleftrightarrow \forall S\in\mathcal{S} , T\notin S$, which states that predicate is $\textsc{true}$ if and only if $T$ is not in any d-separation set of $X$ and $Y$. This is exactly the criterion of CPC for identifying v-structures~\citep{ramsey2012conservative}. \item Predicate $\textsc{olp}(T,\mathcal{S})<0.5$ indicates that only if more than half of the d-separation sets do not contain $T$, then the UT is oriented as a v-structure. This is called majority-rule PC algorithm MPC~\citep{colombo2014order} for v-structure identification. \item Predicate $\textsc{olp}(T,\mathcal{S})<1\wedge\min\{X\sim Y\vert T\cup \mathcal{S}\}>0 \Rightarrow \exists S \in \mathcal{S}, T\notin S$ and $X$ and $Y$ are dependent when conditioning on $T\cup S$, which is the criterion used for GLL-MB~\citep{aliferis2010local} to identify v-structures. \end{enumerate} \end{proof} \subsection{Proof of Theorem \ref{thrm:tend_perfect}} \TENDPERFECT* \vspace{-1em} \begin{proof} According to Lemma \ref{lem:existence_of_strong_discriminative_predicate}, there exists strong discriminative predicate $P$ which achieves zero loss given a canonical dataset and sufficient samples. Thus, when adequate ML model is chosen, ML4C-Learner can achieve no worse performance than $P$ (e.g., we can set the parameters of ML4C-Learner so that it approximates predicate $P$ initially, and then apply standard gradient descent procedure). By considering proposition \ref{prop:perfect_classifier}, we complete the proof. \end{proof} \subsection{URLs of all competitors} We use open-source codes of other algorithms for evaluation. For Jarfo, RCC, NCC, GES, GS(Grow-Shrink), and CDS, we use the API provided by Causal Discovery Toolbox~\citep{kalainathan2019causal}: \url{https://github.com/FenTechSolutions/CausalDiscoveryToolbox}. For HC(Hill-Climbing) we use pgmpy \url{https://github.com/pgmpy/pgmpy} with BDeu score. For PC we use the official R package pcalg \url{https://cran.r-project.org/web/packages/pcalg}. For Conservative-PC and Majority-rule PC, we slightly modify the source code of pcalg to enable a faster run on large scale datasets. GLL-MB is also implemented based on pcalg. \subsection{Algorithms starting from data: DAG-GNN/BLIP/GOBNILP} \subsubsection{Code URL} \begin{enumerate} \item GOBNILP: \url{https://bitbucket.org/jamescussens/pygobnilp/}. \item BLIP: \url{https://cran.r-project.org/web/packages/r.blip/}. \item DAG-GNN: We use a repository with a standard and clean version of the DAG-GNN algorithm, which is well maintained and can be found at \url{https://github.com/ronikobrosly/DAG_from_GNN/} . \end{enumerate} \subsubsection{Hyper-parameter settings} \begin{enumerate} \item Time limit: The running time of all programs is limited to 24 hours. \item Max-in-degree: The max-in-degree threshold for BILP is set to 6. The max-in-degree threshold for GOBNILP is set to 3. \item Configurations of DAG-GNN are as follows. Epochs=300, batch size=100, learning rate=3e-3, graph threshold=0.3. Graph threshold is a threshold for weighted adjacency matrix (i.e., any weights $> -0.3$ and $< 0.3$ means the two variables are not adjacent). \end{enumerate} \subsubsection{Verifying the results of DAG-GNN} To make sure DAG-GNN is correctly executed, we have carefully experiment DAG-GNN from the following two aspects: \paragraph{Reproducing the results of paper~\citep{yu2019dag}} We take the child dataset as an example to test the reproducibility, because the data set has been reported by ~\citep{yu2019dag}. \begin{table}[h] \small \caption{Reproducing results for child} \label{reprochild} \begin{center} \begin{tabular}{c c c} \toprule & groundtruth & child \\ \midrule BIC & -1.23e+4 & -1.36e+4 \\ \bottomrule \end{tabular} \end{center} \vspace{-1em} \end{table} As can be seen from Table~\ref{reprochild}, the BIC scores are similar to the results reported in the original paper (child: -1.38e+4). That is to say, the results in Yu et al.’s paper are reproduced by us. \paragraph{Different graph thresholds} The following are the BIC scores on the data sets of alarm and water with different graph thresholds. \begin{table}[h] \scriptsize \setlength{\tabcolsep}{5pt} \caption{Results with different graph thresholds} \label{graphthresholds} \begin{center} \begin{tabular}{c c c c c c c} \toprule & Groundtruth & 0.1 & 0.2 & 0.3 & 0.4 & 0.5 \\ \midrule alarm & -1.08e+5 & -1.90e+5 & -1.44e+5 & -1.59e+5 & -1.77e+5 & -1.91e+5\\ water & -1.35e+5 & -1.32e+5 & -1.37e+5 & -1.44e+5 & -1.53e+5 & -1.62e+5 \\ \bottomrule \end{tabular} \end{center} \vspace{-1em} \end{table} The graph threshold recommended by \citep{yu2019dag} is 0.3. It can be seen that the performance is stable when the threshold is around 0.3. We have verified that there are similar conclusions on other data sets. Therefore 0.3 should be a reasonable threshold. \subsection{Calculating conditional dependencies} There are several ways to measure the conditional dependence, such as p-value by testing of conditional independence, or conditional mutual information~\citep{cover1999elements}. For categorical variables, a good choice is $G^2$ test~\citep{agresti2003categorical}. In our implementation, we adopt an approximate version of $G^2$ statistic, and use p-value to measure the conditional dependence. Moreover, considering p-value can easily vanish due to numerical precision in 64-bit computers. Therefore, we use a transformation of p-value to avoid the issue, as additional quantity to measure conditional dependency. We first define complementary error function as$$g \left( z \right) =1-\frac{2}{\sqrt[]{ \pi }} \int _{0}^{z}e^{-t^{2}}\mathrm{d}t,$$ and we use quantity $z$ by inverse of $g$: $$z=g^{-1}(x).$$ Given a p-value $x$, we use $g^{-1}$ as a non-linear transformation to obtain a better re-scaled quantity to measure conditional dependency. Intuitively, $z$ can be viewed as $z$-sigma for a standard normal distribution, e.g., if p-value is 0.05, then $z=2$, since 2-sigma indicates probability of values that lie within 2-sigma interval in a normal distribution is 0.95. \subsection{ML4C Training and inference details} \subsubsection{Data synthesis details} \textbf{Graph structure:} We adopt the Erd\H{o}s-R\'{e}nyi (ER) model~\citep{erdos1959on} and the Scale-Free (SF) model~\citep{albert2002statistical}, which are two commonly used model for graph synthesis. We categorize the scale of the graph (number of nodes $d$) into four classes: small, medium, large, and very large, corresponding to $d$ being uniformly sampled from intervals $[10,20]$, $[21,50]$, $[51,100]$, and $[101,1000]$, respectively. Given the number of nodes $d$, the sparsity of the graph (defined as the ratio of the average number of edges to the number of nodes, i.e., the average in-degree of all nodes) is randomly sampled from a uniform distribution $[1.2, 1.7]$. Given the number of nodes and the expected number of edges, the graph skeleton is generated accordingly by the two random graph models. Then the skeleton is randomly oriented to a DAG by upper triangular permutation. \noindent\textbf{Conditional probability table:} Now we illustrate how we come up with Conditional Probability Table (CPT) for each node. In accordance with the topological ordering of the graph, each node is first assigned its cardinality, which is randomly sampled from a truncated normal distribution $\mathcal{N}(\mu=2, \sigma=\frac{1.5}{m}, \min=2)$, where $m$ denotes the maximum number of peers of the node (i.e. $\max\{ \text{in-degree of the effect nodes of this node}\}$). This regularization is designed to make the forward sampling process faster and prevent some certain nodes with many cause nodes from getting stuck. Since the number of different conditions to be enumerated is exponential ($\Pi_{c \in \text{ causes}}{\text{cardinality}_c}$), node with a larger maximum peers number tends to have smaller cardinality. Next, we enumerate each of its unique conditions (given by combinations of its cause nodes' cardinalities) and randomly generate its probability distribution at each condition. The probability distribution is sampled from a Dirichlet distribution with parameter $\alpha\sim U[0.1, 1.0]$ and grid number as this code's cardinality. \noindent\textbf{Training data:} Having CPT specification of each node, a sample of 10k rows of observations is obtained for each graph according to the standard Bayesian network forward sampling. This generates a total dataset of 4 scales $\times$ 2 graph models $\times$ 50 graphs for each class = 400 unique graphs and the corresponding sampled data. Different SCL algorithms are then further used to extract the required features corresponding to the respective learning targets, e.g., all edges of all graphs for pairwise SCL algorithms. For our ML4C learning targets, all UTs are extracted from graphs, consisting of a total of 97,010 V-structures (label=1) and 195,691 non-V-structures (label=0). \noindent\textbf{Kernel mean embedding:} Dimensionality of feature vector is 755. Specifically, to represent each extended conditional dependency $D=\mathbf{A}\sim\mathbf{B}\vert \mathcal{Z}$ (i.e., a set of scalars with varied set size, line 190), we use standard kernel mean embedding technique in \citep{smola2007hilbert} to obtain the embedded vector $ \frac { 1} { | D | } \sum _ { z \in D } \left( \cos \left( \left\langle w _ { j } , z \right\rangle + b _ { j } \right) \right) _ { j = 1 } ^ { m } \in \mathbb { R } ^ { m }$. Here m=15, which means embedding dimensionality for each extended conditional dependency is 15. We also include 5 additional statistics (max, min, mean, std, and set size). Besides, we use both p-value and severity to quantify each extended conditional dependency separately. Of the 4 bivariable $\times$ 5 conditional = 20 pairs, only one $(X;Y|T)$ is unitary (i.e., it is a single scalar), so we apply embedding to the rest 19 pairs. In addition, entanglement is considered in terms of 5 scaling and 7 overlap coefficients. Thus, the total dimensionality of feature vector is 755 = 5 (scaling) + 7 (overlaps) + 2 * 1 (unitary) + [1 (set size) + 2 * 4 (mean/std/max/min) + 2 * 15 (embedding dimensionality)] * 19 (pairs). See our code for more details at implementation level (Tools/Utility.py L61, BayesianNetwork/CITester.py L104, Experiments/GenerateFeatures.py L121). \subsubsection{XGBoost hyper-parameter settings} We use `xgb.XGBClassifier()', the Python API provided by XGBoost~\citep{chen2016xgboost}, to implement the binary classifier ML4C-Learner. All hyper-parameters are set as default. We set the threshold value $T$ = 0.1. \subsection{Post processing} Although ML4C-Learner achieves high accuracy on classifying UTs into v-structures or non-v-structures (UT-F1 = 0.9, as shown in Table~\ref{table:accuracy}), it is still possible to have conflicts among the detected v-structures. We adopt a straightforward heuristic to resolve conflicts: suppose we have two conflict v-structures $A \rightarrow B \leftarrow C$ and $B \rightarrow C \leftarrow D$, we discard the one with lower probability score (by ML4C-Learner). We continue such pairwise conflict resolving until no more conflicts exist. We use the left v-structures to construct the partial DAG (bottom-right of Figure~\ref{fig:two_phase_workflow}(b)). Pseudo-code is shown in Algorithm~\ref{alg:conflict}. \begin{algorithm} [htbp] \caption{Conflict resolving} \label{alg:conflict} \SetKwFor{For}{for}{do}{} \SetKwFor{If}{if}{then}{} \SetKwInOut{Input}{input} \SetKwInOut{Output}{output} \Input{ v-structure candidates $VC=\{v_1, \cdots, v_p\}$,\\ score querier $s: v_i \rightarrow s_i$, returning $v_i$'s probability score\\ } \Output{ Final v-structure candidates $FV$, which is self-consistent. } \textbf{Initialize:} removing v-structure set $RV$.\\ \For{ $v_i \in VC $}{ $s_i\leftarrow s(v_i)$\\ flag$\leftarrow\textsc{false}$\\ \For{ $v_j\in VC$ }{ $s_j\leftarrow s(v_j)$\\ \If{$v_i$\normalfont{ conflicts with }$v_j$ \textbf{and} $s_i<s_j$}{ flag$\leftarrow\textsc{true}$\\ \textbf{break} } } \If{\normalfont{flag}}{ SV $\leftarrow$ SV$\cup\{v_i\}$ } } FV$\leftarrow$VC$\backslash$RV. \end{algorithm} \subsection{Reproducibility} Our performance result is highly reproducible. Our classifier is a vanilla XBGoost classifier with fixed hyper-parameters, thus its output is fully deterministic given a specific input. Our featurization follows deterministic process, as depicted in~\cref{sec:featurization}. The only uncertainty comes from kernel mean embedding, where we follow standard approach without any modification. We observed that its impact on perturbation of result is negligible. Please check our code for details of reproducibility. In Table~\ref{table:accuracy}, we report the SHD/F1 based on one normal run. In Table~\ref{table:accuracy_full}, we list the average performance with standard deviation based on 5 runs. The result is highly stable. \section{Introduction} \label{sec:introduction} \vspace{0em} \input{sec/1_introduction} \vspace{0em} \vspace{-1em} \section{Related Work} \label{sec:related_work} \vspace{0em} \input{sec/2_related_work} \vspace{0em} \section{Background} \label{sec:background} \vspace{0em} \input{sec/3_background} \vspace{0em} \section{Approach} \label{sec:approach} \vspace{0em} \input{sec/4_approach} \vspace{0em} \section{Evaluation} \label{sec:evaluation} \vspace{0em} \input{sec/5_evaluation} \vspace{0em} \section{Conclusion and Future Work} \label{sec:conclusion} \vspace{0em} \input{sec/6_conclusion} \small \bibliographystyle{plainnat} \subsection{Overview} \label{sec:overview} The core of ML4C is a binary classifier called ML4C-Learner, which takes the orientation of a UT as its learning target, i.e., it classifies whether an input UT $\langle X,T,Y \rangle$ is a v-structure (orientation: $X \rightarrow T \leftarrow Y$) or not (orientation remains unknown). Figure \ref{fig:two_phase_workflow}(b) depicts the overall workflow of ML4C, which is composed of ML4C-Learner with other important inductive biases. Starting from an input dataset $D_{i}$ with corresponding skeleton $E_{i}$, we first obtain all the UTs from $E_{i}$. Featurization is then conducted to represent each UT as an embedded vector, which is further fed into ML4C-Learner. In the inference stage, we obtain all the v-structures which are classified by ML4C-Learner and reconstruct a partial DAG and then, a CPDAG is output by applying Meek rules on the partial DAG. In the training stage, the label of each UT is obtained by querying from ground truth DAG $G_{i}$. We collect labeled data from multiple datasets in ML4C's training set. \begin{restatable}{proposition}{PERFECTCLASSIFIER} \label{prop:perfect_classifier} If ML4C-Learner is a perfect classifier, then ML4C outputs correct CPDAG of a canonical dataset (i.e., ML4C is perfect). \end{restatable} The proof of~\cref{prop:perfect_classifier} is straightforward, since ML4C's workflow (Fig~\ref{fig:two_phase_workflow}(b)) follows standard of constraint-based methods, only by using ML4C-Learner as a novel v-structure identification logic. This statement emphasizes the importance of making ML4C-Learner accurate, which is the goal that the subsequent sections are going to achieve. By Markov completeness, the set of v-structures is invariant across all Markov equivalent DAGs for a canonical dataset, and it can fully recover the CPDAG, provided that the skeleton is given. Thus, besides its dedicated role in phase 2, ML4C-Learner also facilitates learning task in phase 1 since an identifiable UT implies that it is a v-structure (up to the partial DAG before applying Meek rules). \subsection{Featurization} \label{sec:featurization} We propose a principled method for ML4C-Learner's featurization. We further prove that ML4C-Learner is asymptotically perfect. \noindent\textbf{Design Principles}: Our key aspect of featurization is to broaden focus from a specific UT $\langle X,T,Y \rangle$ to its \textit{vicinity} and seeking conditional \textit{dependencies} and structural \textit{entanglement} within the vicinity, to reveal reliable and robust asymmetry to distinguish v-structure and non-v-structure UTs. Specifically, conditional dependencies are the key materials for traditional causal learning methods (e.g., conditional independences for constraint-based methods), and structural entanglement are also relevant to identifiability. \noindent$\bullet$ \textbf{\textit{Dependencies within Vicinity}} \noindent\textbf{Conditional dependency}: Denoted as $ X \sim Y \vert \mathbf{Z} $ , which is a non-negative scalar that measures the dependence between two random variables $X$ and $Y$ given variable set $\mathbf{Z}$. Operationally, $ X \sim Y \vert \mathbf{Z} $ is composed of two parts, bivariable $ X \sim Y $, and conditional $\mathbf{Z}$. We further extend the definition to allow a set of variables in bivariable, and an ensemble (i.e., a set of set) as conditional: \noindent\textbf{Extended conditional dependency}: Denoted as $\mathbb{A} \sim \mathbf{B} \vert \mathcal{Z}$$:= \{ X \sim Y \vert \mathbf{Z}:$$X \in \mathbb{A},Y \in \mathbf{B},\mathbf{Z} \in \mathcal{Z} \} $, where $\mathbb{A}$ and $\mathbf{B}$ are set of variables, and $\mathcal{Z}$ is an ensemble. Thus, extended conditional dependency is a set of scalars. Within the vicinity of $\langle X,T,Y \rangle$, we start from measuring dependencies between $\left\{ X, PC_{X} \right\}$ and $\left\{ Y, PC_{Y} \right\}$ by conditioning on $\left\{ T, PC_{T} \right\}$. Intuitively, if $\langle X,T,Y \rangle$ is a v-structure, conditioning on $T$ or $T$'s descendants tends to strengthen the dependency between $PC_X$ and $PC_Y$ since the paths passing $X-T-Y$ are unblocked; otherwise, conditioning on $T$ tends to weaken the dependency between $PC_X$ and $PC_Y$ because $T$ blocks the paths passing $X-T-Y$. Therefore, such conditional dependencies reflect potential asymmetry to distinguish v-structure and non-v-structure. Formally, \begin{definition}[Domain of bivariable] \label{def:domain_of_bivariable} Denoted as $ \mathbb{B}:= \left\{ X, PC_{X} \right\} \times \left\{ Y, PC_{Y} \right\} \equiv \left\{ X \sim Y,X \sim PC_{Y},PC_{X} \sim Y,PC_{X} \sim PC_{Y} \right\}$, here symbol $\times$ is Cartesian product. \end{definition} \begin{definition}[Sepsets] \label{def:sepsets} Denoted as $\mathcal{S}:=\left\{ S:X\bot Y \vert S, S \subset PC_{X} \cup T, \text{or} S \subset PC_{Y} \cup T \right\}$. \normalfont{Under faithfulness assumption, sepsets $\mathcal{S}$ is an ensemble where each item is a subset of variables within the vicinity that d-separates $X$ and $Y$.} \end{definition} \begin{definition}[Domain of conditional] \label{def:domain_of_conditional} Denoted as $\mathbb{C}:= \left\{ \varnothing ,T,\mathcal{PC}_{T} \right\} \vee \left\{ \varnothing ,S \right\} \equiv \left\{ \varnothing ,T,\mathcal{PC}_{T},\mathcal{S},\mathcal{S} \vee T,\mathcal{S} \vee \mathcal{PC}_{T} \right\}$, where $\mathcal{PC}_{T}:= \left\{ \left\{ I \right\} : I \in PC_{T} \right\}$ which is an ensemble version of $PC_{T}$, and $\mathcal{S} \vee \mathcal{PC}_{T}:= \left\{ S \cup I:S \in \mathcal{S},I \in \mathcal{PC}_{T} \right\}$. Here symbol $\vee$ is element-wise union. \end{definition} We exploit the extended conditional dependencies from $\mathbb{B} \times \mathbb{C}$, i.e., we pick a bivariable from $\mathbb{B}$ and a conditional from $\mathbb{C}$, and calculate the extended conditional dependency. There are in total $\vert \mathbb{B} \vert \times \vert \mathbb{C} \vert =24$ extended conditional dependencies. \begin{restatable}{lemma}{SEPSETSNONEMPTY} \label{lem:sepsets_nonempty} Sepsets $\mathcal{S}$ of any UT of a canonical dataset is non-empty. \end{restatable} \vspace{-0.5em} \begin{restatable}{remark}{SEPSETSSCOPE} \label{rem:sepsets_scope} We intend to restrict the sepsets within the vicinity of $\langle X,T,Y \rangle$. Lemma \ref{lem:sepsets_nonempty} shows the existence of such d-separation sets within vicinity. Furthermore, searching for all d-separation sets is highly time-consuming, thus the computational cost can also be saved drastically. \end{restatable} \noindent$\bullet$ \textbf{\textit{Entanglement within Vicinity}} Structural entanglement reflects complex structure within the vicinity of $\langle X,T,Y \rangle$. Variables $X$, $Y$ and $T$ can mutually share common neighbors, and their neighbors may also overlap with sepsets $\mathcal{S}$. We call such overlaps structural entanglement. Intuitively, entanglement reflects the structure of vicinity which also relates to the effectiveness of identifying a UT to be v-structure. Therefore, structural entanglement is an important aspect for featurization. Specifically, we exploit the overlap coefficient ~\citep{vijaymeena2016similarity} to measure the entanglement: \begin{definition}[Overlap coefficient] \label{def:overlap_coefficient} $\textsc{olp} \left( \mathbb{A},\mathbf{B} \right):=\vert \mathbb{A} \cap \mathbf{B} \vert / \min \left( \vert \mathbb{A} \vert , \vert \mathbf{B} \vert \right)$, where $\mathbb{A}$ and $\mathbf{B}$ are two sets of variables. \normalfont{We extend this formula to support ensemble as input:} \end{definition} \vspace{-1em} \noindent\textbf{(Extended) Overlap coefficient}: $\textsc{olp} \left( \mathbb{A},\mathcal{S} \right) := \sum _{i=1}^{ \vert \mathcal{S} \vert }\textsc{olp} \left( \mathbb{A}, S_{i} \right) / \vert \mathcal{S} \vert $. Naturally, we consider the entanglement in terms of overlap coefficient on each pair of items in domain $\left\{ PC_{X},PC_{Y},PC_{T},\mathcal{S} \right\}$. Thus, use 7 scalars (including $\textsc{olp} \left( \{T\},\mathcal{S} \right)$) to represent the entanglement within vicinity of a UT. \noindent$\bullet$ \textbf{\textit{Embedding}} We aim to represent the dependencies and entanglement by a feature vector with fixed dimensionality, which can be used to train ML4C-Learner. Regarding each extended conditional dependency $\mathbb{A} \sim \mathbf{B} \vert \mathcal{Z}:\mathbb{A} \sim \mathbf{B} \in \mathbb{B},\mathcal{Z} \in \mathbb{C}$, it consists of a set of scalars with varied set size across UTs, we adopt the kernel mean embedding technique in~\citep{smola2007hilbert} to represent each $\mathbb{A} \sim \mathbf{B} \vert \mathcal{Z}$ as a vector with fixed dimensionality. We further modify the embedding algorithm by adding $\min \left\{ \mathbb{A} \sim \mathbf{B} \vert \mathcal{Z} \right\}$ and $\max \left\{ \mathbb{A} \sim \mathbf{B} \vert \mathcal{Z} \right\}$ as two additional features. We directly use the 7 scalars to represent structural entanglement without further transformation. We concatenate all the embedded vectors to form the final feature vector, as input for ML4C-Learner. Further details are available at Appendix. \subsection{Learnability} \label{sec:learnability} We have presented ML4C's featurization and started seeing that conditional dependencies and structural entanglement have potential to reveal asymmetry to distinguish v-structure and non-v-structure UTs. Now we provide rigorous analysis to show that, for a canonical dataset with sufficient samples, ML4C-Learner tends to a perfect classifier. We first propose a surrogate object called discriminative predicate: \begin{definition}[Discriminative predicate] \label{def:discriminative_predicate} A discriminative predicate is a binary predicate function with domain as ML4C's feature set. \normalfont{A discriminative predicate can be viewed as a special classifier with pre-specified form of mechanism (i.e., not learned from data).} \end{definition} \begin{definition}[Weak / Strong discriminative predicate] \label{def:weak_strong_discriminative_predicate} Whenever a discriminative predicate takes the feature vector of a UT as input, a weak discriminative predicate satisfies one of the following two criteria; a strong discriminative predicate satisfies both: \begin{inparaenum}[i)]\item it is evaluated to $\textsc{true}$ if the UT is a v-structure; \item it is evaluated to $\textsc{false}$ if the UT is not a v-structure.\end{inparaenum} \end{definition} By definition, a weak discriminative predicate exhibits discriminative power since it is evaluated false implies the UT is a non-v-structure (or true implies v-structure). A strong discriminative predicate can be viewed as a perfect classifier. Denote $\left\{ \mathbb{A} \sim \mathbf{B} \vert \mathcal{Z} \right\} > \delta :=X \sim Y \vert \mathbf{Z}> \delta : \forall X \in \mathbb{A},Y \in \mathbf{B},\mathbf{Z} \in \mathcal{Z}$, then we have: \begin{restatable}[Existence of weak discriminative predicate]{lemma}{WEAKEXISTS} \label{lem:existence_of_weak_discriminative_predicate} For a canonical dataset with infinite samples, the following are three weak discriminative predicates: \begin{inparaenum}[i)]\item $\left\{ X \sim Y \vert T \right\} >0$, \item $\left\{ X \sim Y \vert \mathcal{PC}_{T} \right\} =0$ , \item $\left\{ PC_{X} \sim PC_{Y} \vert \mathcal{S} \cup T \right\} >0$.\end{inparaenum} \end{restatable} Take $\left\{ X \sim Y \vert T \right\} >0$ as an example, $\langle X,T,Y \rangle$ is a v-structure $\Rightarrow$ $T$ is a collider $\Rightarrow$ $T$ unblocks $X$ and $Y$ through path $X-T-Y$ $\Rightarrow$ $\left\{ X \sim Y \vert T \right\} >0$ $\Rightarrow$ $\min\left\{ X \sim Y \vert T \right\} >0$, where $\min\left\{ X \sim Y \vert T \right\}$ is a feature of ML4C-Learner. \begin{restatable}[Existence of strong discriminative predicate]{lemma}{STRONGEXISTS} \label{lem:existence_of_strong_discriminative_predicate} For a canonical dataset with infinite samples, the following are three strong discriminative predicates: \begin{inparaenum}[i)]\item $\textsc{olp}(T,\mathcal{S})=0$, \item $\textsc{olp}(T,\mathcal{S})<0.5$, \item $\textsc{olp}(T,\mathcal{S})<1\wedge\min \left\{ X \sim Y \vert T \cup S \right\} >0$.\end{inparaenum} \end{restatable} \noindent\textbf{CPC/MPC/GLL-MB as special cases of ML4C-Learner}: Predicate $\textsc{olp} \left( T,\mathcal{S} \right) =0 \Longleftrightarrow \forall S \in \mathcal{S}, T \notin S$, which states that the predicate is $\textsc{true}$ if $T$ is not in any d-separation set of $X$ and $Y$. Having correct skeleton provided, this is the criterion of Conservative PC algorithm (CPC)~\citep{ramsey2012conservative} for identifying v-structures. Thus, CPC can be viewed as a special case of ML4C by replacing ML4C-Learner with such a pre-specified logic; $\textsc{olp} \left( T,\mathcal{S} \right) <0.5$ indicates that if more than half of the d-separation sets do not contain $T$, then the UT is oriented as a v-structure, which is called majority rule PC algorithm (MPC)~\citep{colombo2014stable}; predicate $\textsc{olp} \left( T,\mathcal{S} \right) <1 \wedge \min \left\{ X \sim Y \vert T \cup \mathcal{S} \right\} >0 \Rightarrow \exists S \in \mathcal{S}, T \notin S$ and $X$ and $Y$ are dependent when conditioning on $T \cup S$, which is used for GLL-MB~\citep{aliferis2010local} to more securely identify v-structures. These predicates are with suboptimal performance because only a small portion of features are exploited and the overall loss function of training data is disregarded, thus in practice when an appropriate machine learning model is adopted, ML4C-Learner achieves better performance. \begin{restatable}{theorem}{TENDPERFECT} \label{thrm:tend_perfect} ML4C-Learner tends to a perfect classifier on classifying a canonical dataset with sufficient samples. \end{restatable} \subsection{Basic Notations} \label{sec:background_basic_notations} A discrete dataset $D_i$ consists of $n_i$ records and $d_i$ categorical columns, which represents $n_i$ instances drawn i.i.d. from $d_i$ discrete variables $X_{1},X_{2}, \cdots ,X_{d_{i}}$ by a joint probability distribution $P_i$, which is entailed by an underlying data generating process, denoted as DAG $G_i$. \noindent\textbf{Markov factorization property}: Given a joint probability distribution $P$ and a DAG $G$, $P$ is said to satisfy Markov factorization property w.r.t. $G$ if $P:=P \left( X_{1},X_{2}, \cdots ,X_{d} \right) = \prod_{i=1}^{d}P \left( X_{i} \vert \text{pa}_{i}^{G} \right)$, where $ \text{pa}_{i}^{G} $ is the parent set of $ X_{i} $ in $ G $. \noindent\textbf{Markov assumption}: $P$ is said to satisfy Markov assumption (or Markovian) w.r.t. a DAG $G$ if $X\bot_{G}Y \vert Z \Rightarrow X\bot Y \vert Z$. Here $\bot_{G}$ denotes d-separation, and $\bot$ denotes statistical independence. Markov assumption indicates that any d-separation in graph $G$ implies conditional independence in distribution $P$. Markov assumption is equivalent to Markov factorization property~\citep{lauritzen1996graphical}. \noindent\textbf{Faithfulness}: Distribution $P$ is faithful w.r.t. a DAG $G$ if $X\bot Y \vert Z \Rightarrow X\bot_{G}Y \vert Z$. \noindent\textbf{Canonical dataset}: We say a discrete dataset $D$ is canonical if its underlying probability distribution $P$ is Markovian and faithful w.r.t. some DAG $G$. \subsection{Causal Structure Identifiability} \label{sec:background_causal_structure_identifiability} Identifiability discusses which parts of the causal structure can in principle be inferred from the distribution. Below we present the established theory of identifiability on discrete data~\cite{meek2013strong}. \noindent\textbf{Causal sufficiency}: There are no latent common causes of any of the variables in the graph. \begin{definition}[Markov equivalence] \label{def:markov_equivalence} Two graphs are Markov equivalent if and only if they have same skeleton and same v-structures. A Markov equivalence class can be represented by a CPDAG having both directed and undirected edges. A CPDAG can be derived from a DAG $G$, denoted as CPDAG$(G)$. \normalfont{The theorem of Markov completeness in ~\citep{meek2013strong} states that, under causal sufficiency, we can only identify a causal graph up to its Markov equivalence class on canonical data. Therefore, the (non-)identifiable causal relations are the (un)directed edges in the CPDAG. Formally,} \end{definition} \begin{definition}[Identifiability] \label{def:identifiability} Assuming $P$ is Markovian and faithful w.r.t. a DAG $G$ and causal sufficiency, then each (un)directed edge in CPDAG$(G)$ indicates (non-)identifiable causal relation. \end{definition} \vspace{-0.5em} \subsection{ML4C Related Notations} \label{sec:ml4c_related_notations} \begin{definition}[Skeleton] \label{def:skeleton} A skeleton $E$ defined over distribution $P \left( X_{1},X_{2}, \cdots ,X_{d} \right)$ is an undirected graph such that there is an edge between $X_i$ and $X_j$ if and only if $X_i$ and $X_j$ are always dependent, i.e., $\nexists Z \subseteq \left\{ X_{1},X_{2}, \cdots ,X_{d} \right\} ~s.t.~X_{i}\bot X_{j} \vert Z $. \normalfont{Skeleton is a statistical concept, which can be obtained prior to facilitating various downstream tasks. Recently, there have been some novel skeleton learning algorithms such as ~\citep{ding2020reliable}. In particular, skeleton can be used for causal learning: theorem in ~\citep{spirtes2000causation} states that if distribution $P$ is Markovian and faithful w.r.t. a DAG $G$, then skeleton $E$ is the same as the undirected graph of $G$. Thus, skeleton could have causal semantic when certain assumptions are imposed.} \end{definition} \begin{definition}[UT] \label{def:ut} A triple of variables $\langle X,T,Y \rangle$ in a skeleton is an unshielded triple, or short for UT, if $X$ and $Y$ are adjacent to $T$ but are not adjacent to each other. $\langle X,T,Y \rangle$ can be further oriented to become a v-structure $X \rightarrow T \leftarrow Y$, in which $T$ is called the collider. \end{definition} \begin{definition}[PC] \label{def:pc} Denote the set of parents and children of $X$ in a skeleton as $PC_X$, in other words, $PC_X$ are the neighbors of $X$ in the skeleton. For convenience, if we discuss $PC_X$ in the context of a UT $\langle X,T,Y \rangle$, we intentionally mean the set of parents and children of $X$ but exclude $T$. \end{definition} \begin{definition}[Vicinity] \label{def:vicinity} We define the vicinity of a UT $\langle X,T,Y \rangle$ as $ V_{ \langle X,T,Y \rangle }:= \{ X,T,Y \} \cup PC_{X} \cup PC_{Y} \cup PC_{T} $. Vicinity is a generalized version of PC, i.e., the neighbors of $\{ X,T,Y \}$ in the skeleton. \end{definition} \noindent\textbf{ML4C's training set}: The training set is a collection of discrete datasets $D_{1}, \cdots ,D_{n}$, where each dataset $D_i$ is associated with a ground truth DAG $G_i$, such that $D_i$ is sampled from $G_i$. $G_i$ derives labels (depends on the chosen learning target), thus $\left\{ D_{i},G_{i} \right\}_{i\in\{1,\cdots,n\}}$ form ML4C's training set. We can sample graphs from DAG space and generate corresponding datasets, thus obtaining training set in our problem is straightforward.
\section{Introduction} Minimizing mean response time of jobs in a preemptive single-server queue is a fundamental scheduling problem. If the scheduler knows each job's size,\footnote{A job's size is its processing time.} then the optimal policy is \emph{Shortest Remaining Processing Time} (SRPT), which always serves the job of least remaining size: least size minus time served so far. However, in practical queueing systems, it is rare that the scheduler knows the exact job size, which is required for SRPT. Instead, it may be that the scheduler has only an \emph{estimated size} for each job. In settings where the scheduler knows only job size estimates, rather than true sizes, how should one schedule to minimize mean response time? We study this question in a stochastic online setting, namely an M/G/1 queue,\footnote{% The M/G/1 is a queueing model with Poisson arrivals and i.i.d. job sizes. We define the M/G/1 formally in \cref{sec:model}.} in which jobs arrive randomly over time. We use $T$ to denote the distribution of response time, and we seek policies which achieve strong guarantees on $\E{T}$, the mean response time. We seek simple policies that do not depend on detailed knowledge of the distributions of true or estimated job sizes. While some simple heuristics have been proposed in prior work, no performance guarantees have been proven for these policies. We evaluate each scheduling policy by its \emph{approximation ratio}, which we define to be the ratio between its mean response time and that of Shortest Remaining Processing Time (SRPT), the optimal policy when true sizes are known. In the context of online algorithms with predictions \cite{DBLP:journals/jacm/LykourisV21,DBLP:books/cu/20/MitzenmacherV20}, there are two key goals for a policy: ``consistency'', which requires near-optimal performance under low error, and ``robustness'', which requires bounded approximation ratio under arbitrary error. Unfortunately, as we explain in \cref{sec:gittins_bound}, robustness is provably unachievable in this context. Instead, we focus on a more appropriate guarantee, which we call ``graceful degredation'', which requires that the performance degrades smoothly and slowly as error increases. We focus on the setting of multiplicative errors: We assume that a job of true size~$s$ has estimated size in the interval $[\beta s, \alpha s]$ for some $\alpha \geq \beta > 0$. We refer to this assumption by saying the jobs have $(\beta,\alpha)$-bounded estimates. (Here $\beta$ stands for ''below'' and $\alpha$ is ''above.'') In this context, a policy~$\pi$ is consistent if in the limit as $\alpha, \beta \to 1$, $\E{T_\pi} \to \E{T_\mathrm{SRPT}}$. Graceful degradation requires that for any $\alpha, \beta$, $\E{T_\pi} \le C\frac{\alpha}{\beta} \E{T_\mathrm{SRPT}}$, for some constant~$C$. In trying to achieve consistency and graceful degradation, a first policy one might consider is the \emph{SRPT with Estimates} (SRPT-E) policy, which always serves the job of least estimated size minus time served so far. Unfortunately, in \cref{thm:srpt-e_result}, we prove that SRPT-E can have infinite approximation ratio for any $\beta < 1$, so it has neither consistency nor graceful degradation. In this work, we present the first policy which provably has both consistency and graceful degradation: the \emph{SRPT with Bounce} (SRPT-B) policy, defined in \cref{sec:model}. We also study the \emph{Preemptive Shortest Job First with Estimates} (PSJF-E), for which we prove even better graceful degradation guarantees, and consistency guarantees relative to the perfect-information PSJF policy. That is, we also show $\E{T_\mathrm{PSJF\mathhyphen E}} \to \E{T_\mathrm{PSJF}}$ as $\alpha, \beta \to 1$. Specifically, SRPT-B's approximation ratio is at most $3.5\alpha/\beta$ and approaches~$1$ uniformly as $\alpha$ and~$\beta$ approach~$1$, PSFJ-E's approximation ratio is at most~$1.5\alpha/\beta$. \subsection{Related Work} Policies for ordering jobs according to their service time have been studied extensively in single queues. For example, the text \citep{harchol-balter_performance_2013} provides an excellent introduction to the analysis of standard approaches such as shortest job first (SJF), PSJF, and SRPT in the single queue setting. Settings where estimates or predictions of service times, such as one might obtain from machine learning algorithms, have been much less studied. The work closest to ours is that of Wierman and Nuyens \citep{wierman_scheduling_2008}. They study policies that they dub $\epsilon$-SMART policies. Such policies include variations of SRPT and PSJF with inexact job sizes, and they bound the performance of such policies based on how inexact the estimates can be \cite{wierman_scheduling_2008}. However, their results only apply to two simpler types of error: addditive error, where the estimate of a job of size $s$ is within $[s-\sigma, s+\sigma]$; and speedup error, where the estimate is updated as the job runs, and the estimate of a job of remaining size $r$ is within $[(1-\sigma)r, (1+\sigma)r]$. In contrast, we primarily focus on the more realistic setting of multiplicative error. Their results on mean response time demonstrate only graceful degradation, are restricted to the setting of speedup error, and require additional assumptions on the job size distribution. While it is not our primary focus, we also discuss using the techniques in this paper to achieve consistency and graceful degradation results in the speedup-error setting in \cref{sec:srpt-se} and \cref{sec:continuous-estimate}. Such results would not require additional assumptions on the job size distribution. Dell'Amico, Carra, and Michiardi empirically study scheduling policies for queueing systems with estimated sizes \citep{dellamico_psbs_2016}; Dell'Amico and Mitzenmacher also perform an empirical study of scheduling policies with estimated sizes, but in the context of multiple queues using the power of two choices \citep{mitzenmacher_supermarket_2020}. Mitzenmacher provides formulas for the mean response time for M/G/1 queues under scheduling policies where service times are predicted rather than known exactly according to a stochastic model, including for our SRPT-E and PSJF-E policies \cite{mitzenmacher_scheduling_2020}.\footnote{In \cite{mitzenmacher_scheduling_2020} the schemes using predictions are referred to as SPRPT (shortest predicted remaining processing time), and PSPFJ; there does not seem to be a consistent nomenclature for policies with predictions/estimates, and we hope our labeling is more readily understood.} In later work Mitzenmacher studies similar models where only a single bit of prediction-based advice is given, and also studies single-bit advice in the mean-field setting under the power of two choices \cite{doi:10.1137/1.9781611976830.1}. In the setting of scheduling with predictions for finite collections of jobs, combinations of shortest predicted job first and round robin that yield good performance in terms of the competitive ratio were studied by \cite{purohit_improving_2018}. For the online scheduling problem of weighted mean response time on a single machine with a finite arrival sequence, \citep{azar_flow_2021} consider what we would refer to as $(1,\mu)$-bounded jobs where $\mu$ is known, and give algorithms that are competitive up to a logarithmic factor in the maximum ratios of the processing times, densities, and weights. For unweighted mean response time, they prove a variant of graceful degradation: if job size estimates have a multiplicative error of at most $\mu$, they prove a $O(\mu^2)$ competitive ratio bound. In contrast, our graceful degradation bounds are linear in $\mu = \frac{\alpha}{\beta}$, and do not depend on knowledge of $\alpha$ or $\beta$. \section{Model and Preliminaries} \label{sec:model} We now define our model and provide basic notation and definitions. Further definitions and background results appear in \cref{sec:background}. We consider a stochastic scheduling setting called the M/G/1 queue with job size estimates. The ``M'' in ``M/G/1'' refers to the assumption that jobs arrive according to a Poisson process (that is, with exponentially distributed interarrival times) with rate $\lambda$. The ``G'' in ``M/G/1'' refers to the assumption that job sizes are sampled i.i.d. from a general distribution. We additionally assume that each job $j$ has a size $s_j$ and an estimated size $z_j$, where the pair $(s_j, z_j)$ is sampled i.i.d. from some joint distribution $(S, Z)$. We assume $(S, Z)$ is a continuous distribution with joint density function $f_{S, Z}(s, z)$. We write $f_S(s)$ and $f_Z(z)$ for the marginal densities of $S$ and~$Z$, respectively. Regardless of scheduling policy, the fraction of time the server is busy, also known as the load, is fixed. We denote load by $\rho$, and note that $\rho = \lambda \E{S}$. We assume that $\rho < 1$, to ensure that the server completes jobs faster than they arrive in the long run. The ``1'' in ``M/G/1'' refers to there being a single server. We focus on the setting of multiplicatively-bounded size estimates: \begin{definition} Size estimates are $(\beta, \alpha)$-bounded for some constants $0 < \beta \le \alpha$ if for all jobs $j$, \begin{align*} z_j \in [\beta s_j, \alpha s_j]. \end{align*} \end{definition} Mnemonically, $\beta$ is the bound below, and $\alpha$ is the bound above. \begin{definition} \label{def:state} The \emph{state} of job~$j$ is the triple $x_j = (s_j, z_j, a_j)$ consisting of \begin{itemize} \item its \emph{(true) size}~$s_j$, which is the amount of time it must be served to complete; \item its \emph{estimated size}~$z_j$, which is revealed when the job arrives and is guaranteed to be in the interval $[\beta s_j, \alpha s_j]$; and \item its \emph{age}~$a_j$, the amount of service the it has received so far. \end{itemize} Job $j$ completes once $a_j = s_j$. \end{definition} \begin{figure} \centering \begin{subfigure}[b]{0.5\linewidth} \centering \input{figures/rank_srpt} \caption{Shortest Remaining Processing Time (SRPT)} \label{fig:rank:srpt} \end{subfigure}\hfill\begin{subfigure}[b]{0.5\linewidth} \centering \input{figures/rank_psjf} \caption{Preemptive Shortest Job First (PSJF)} \label{fig:rank:psjf} \end{subfigure}\\[1em]\begin{subfigure}[b]{0.5\linewidth} \centering \input{figures/rank_srpt-e} \caption{SRPT with Estimates (SRPT-E)} \label{fig:rank:srpt-e} \end{subfigure}\hfill\begin{subfigure}[b]{0.5\linewidth} \centering \input{figures/rank_psjf-e} \caption{PSJF with Estimates (PSJF-E)} \label{fig:rank:psjf-e} \end{subfigure}\\[1em]\begin{subfigure}[b]{0.5\linewidth} \centering \input{figures/rank_srpt-b} \caption{SRPT with Bounce (SRPT-B)} \label{fig:rank:srpt-b} \end{subfigure}\hfill\begin{subfigure}[b]{0.5\linewidth} \centering \input{figures/rank_srpt-se} \caption{SRPT with Scaling Estimates (SRPT-SE)} \label{fig:rank:srpt-se} \end{subfigure} \caption{Rank Functions of Size-Estimate-Based Policies} \label{fig:rank} \end{figure} We now formally define the scheduling policies we consider. \begin{definition} \label{def:policy} We consider six scheduling policies in this work. We define each policy~$\pi$ by a \emph{rank function}, denoted $\rank{\pi}(x)$ or $\rank{\pi}(s, z, a)$ assigning a \emph{rank}, or priority, to a job based on its state $x = (s, z, a)$. The scheduler always serves whichever job has the least rank.\footnote{% We tiebreak arbitrarily. Given our continuous job-size assumption and our specific policies, ties happen with probability zero. See \cref{sec:ties} for details.} The policies, which we illustrate in \cref{fig:rank}, are the following: {\setlength{\jot}{0em} \begin{alignat*}{3} & \text{\emph{Shortest Remaining Processing Time} (SRPT)} \qquad & & \rank{\mathrm{SRPT}}(s, z, a) & &= s - a, \\ & \text{\emph{Preemptive Shortest Job First} (PSJF)} \qquad & & \rank{\mathrm{PSJF}}(s, z, a) & &= s, \\ & \text{\emph{SRPT with Estimates} (SRPT-E)} \qquad & & \rank{\mathrm{SRPT\mathhyphen E}}(s, z, a) & &= z - a, \\ & \text{\emph{PSJF with Estimates} (PSJF-E)} \qquad & & \rank{\mathrm{PSJF\mathhyphen E}}(s, z, a) & &= z, \\ & \text{\emph{SRPT with Bounce} (SRPT-B)} \qquad & & \rank{\mathrm{SRPT\mathhyphen B}}(s, z, a) & &= \min\{|z - a|, z\}, \\ & \text{\emph{SRPT with Scaling Estimates} (SRPT-SE)} \qquad & & \rank{\mathrm{SRPT\mathhyphen SE}}(s, z, a) & &= z/s \cdot (s - a). \end{alignat*}} \end{definition} For SRPT, shown in \cref{fig:rank:srpt} the rank of a job is the {\em remaining size} $s-a$, while for SRPT-E, shown in \cref{fig:rank:srpt-e}, the rank is the {\em estimated remaining size} $z-a$, using the estimate in place of the true size. (Note the rank for SRPT-E can be negative.) Similarly, PSJF-E's rank function $z$ uses the estimate where PSJF uses the true size $s$ for its rank, as shown in \cref{fig:rank:psjf, fig:rank:psjf-e}. For SRPT-B, shown in \cref{fig:rank:srpt-b}, the rank is given by $\min\{|z-a|,z\}$. SRPT-B's rank is identical to SRPT-E's rank for ages $a \in [0, z]$, but rises back to $z$ for larger $a$, yielding the bounce and thus the name SRPT with Bounce. As a theoretical tool, we will also consider SRPT with Scaling Estimates, or SRPT-SE, shown in \cref{fig:rank:srpt-se}, for which the rank function is $z/s \cdot (s-a)$, a horizontally stretched version of SRPT-E. Note that SRPT-SE is not implementable in our model, as the scheduler does not have access to the true size~$s$. \section{Description of Main Results} \label{sec:results} As discussed in the introduction, our goal is to derive the first provably consistent and gracefully-degrading policies in the size-estimate setting. In the setting of $(\beta, \alpha)$-bounded size estimates, consistency requires that in the $\beta, \alpha \to 1$ limit, the policy achieves optimal mean response time, matching that of SRPT, the optimal known-size policy. ``Graceful degradation'' requires that a policy's mean response is bounded relative to that of SRPT and the $\alpha$ and $\beta$ values: \begin{align*} \E{T_\pi} \le C \frac{\alpha}{\beta} \E{T_\mathrm{SRPT}}, \end{align*} for some constant~$C$. Robustness, in the sense of achieving constant approximation ratio for arbitrary errors, is not possible in this setting, as we discuss in \cref{sec:gittins_bound}. First, we show that consistency and graceful degradation are not straightforward to achieve. Our first result shows that simply using SRPT-E (SRPT with Estimates), a natural method studied previously \citep{mitzenmacher_scheduling_2020}, yields mean response times that cannot be bounded within a constant factor of SRPT in the worst case, even with $(\beta, \alpha)$-bounded size estimates. \begin{restatable*:theorem}[Performance of SRPT-E] \label{thm:srpt-e_result} Consider the M/G/1 with $(\beta, \alpha)$-bounded size estimates. \begin{enumerate:theorem} \item For any size distribution~$S$, there exists a joint distribution $(S, Z)$ of true and estimated sizes such that the mean response time of SRPT-E is bounded below by \begin{equation*} \E{T_\mathrm{SRPT\mathhyphen E}} \geq \frac{\lambda(1 - \beta)^2}{2} \E{S^2}, \end{equation*} \item The approximation ratio of SRPT-E may be arbitrarily large or infinite whenever $\beta < 1$. \end{enumerate:theorem} \end{restatable*:theorem} We consider a novel variation of SRPT, SRPT with Bounce (SRPT-B), and prove it is consistent and gracefully-degrading, without knowledge of $\alpha$ and $\beta$. This is the first proof of a policy satisfying these criteria. Here, as $\alpha$ and $\beta$ approach 1, SRPT-B approaches the performance of SRPT, and it achieves a suitable finite approximation ratio for all $\alpha$ and $\beta$. Formally, we prove the following: \begin{restatable*:theorem}[Performance of SRPT-B] \label{thm:srpt-b_result} Consider the M/G/1 with $(\beta, \alpha)$-bounded size estimates. \begin{enumerate:theorem} \item \label{thm:srpt-b_result:bound} The mean response time of SRPT-B is bounded above by \begin{equation*} \E{T_\mathrm{SRPT\mathhyphen B}} \leq \frac{\alpha}{\beta}\E{T_\mathrm{SRPT}} + \gp*{\frac{3}{2}\alpha \1(\beta < 1) + 1} \min\curlgp*{1, \max\curlgp[\Big]{1 - \frac{1}{\alpha}, \frac{1}{\beta} - 1}} \gp*{\frac{1}{\rho} \ln\frac{1}{1 - \rho} - 1} \E{S}. \end{equation*} \item \label{thm:srpt-b_result:graceful} The approximation ratio of SRPT-B is at most~$3.5 \alpha/\beta$. \item As $\alpha$ and~$\beta$ converge to~$1$, the approximation ratio of SRPT-B converges to~$1$. This convergence is uniform in the arrival rate and the joint distribution of true and estimated sizes. \end{enumerate:theorem} \end{restatable*:theorem} The bound in \cref{thm:srpt-b_result:bound} is a compromise between simplicity and tightness. It turns out that capping the rank function of SRPT-B at $z$ is critical (see \cref{rmk:bounce_limit}). Otherwise, as explained in \cref{sec:SRPT-B-without-cap}, the approximation ratio could be arbitrarily poor when $\beta < 1/2$. Finally, we consider PSJF-E, which we bound relative to PSJF. We prove PSJF-E is consistent relative to PSJF, achieving a mean response time ratio of~$\alpha/\beta$. While this is a weaker consistency result than that of SRPT-B, PSJF often performs within a few percent of SRPT in practice, making the result nearly as strong. In the worst case, PSJF's mean response time is within a factor of~$1.5$ of SRPT's \citep{wierman_nearly_2005}, so PSJF-E is within a factor of $1.5 \alpha/\beta$ of optimal. This is a stronger graceful-degradation bound than we obtained for SRPT-B. \begin{restatable*:theorem}[Performance of PSJF-E] \label{thm:psjf-e_result} Consider the M/G/1 with $(\beta, \alpha)$-bounded size estimates. \begin{enumerate:theorem} \item The mean response time of PSJF-E is bounded above by \begin{equation*} \E{T_\mathrm{PSJF\mathhyphen E}} \leq \frac{\alpha}{\beta} \E{T_\mathrm{PSJF}}. \end{equation*} \item The approximation ratio of PSJF-E is at most $1.5 \alpha/\beta$. \end{enumerate:theorem} \end{restatable*:theorem} One can view our PSJF-E result as bounding what \citet{mitzenmacher_scheduling_2020} dubs the ``price of misprediction'' of PSJF-E. An algorithm's price of misprediction is its performance ratio relative not to the optimal algorithm, in this case SRPT, but relative to a version of the algorithm that has perfect information, in this case PSJF. \subsection{Discussion of Our Results} In the wider context of online algorithms with predictions, the three goals discussed in this paper can be stated more generally: \begin{description} \item[Consistency:] In the limit as the prediction quality becomes perfect, the performance should approach that of the optimal algorithm with perfect information. For instance, one might try to achieve $A$-consistency \citep{DBLP:journals/jacm/LykourisV21}, which requires that the competitive ratio is bounded by $A$ as the error in the predictions goes to 0. \item[Robustness:] In the limit as the prediction quality becomes arbitrarily poor, the performance should be comparable to that of the optimal algorithm in with perfect information. For instance, one might try to achieve $B$-robustness \citep{DBLP:journals/jacm/LykourisV21}, which requires that the competitive ratio is bounded by $B$ under arbitrarily poor predictions. \item[Graceful Degradation:] As the prediction quality worsens from perfect to worthless, the performance should degrade smoothly and slowly. For instance, one might try to achieve $C$-graceful degradation, which requires that the competitive ratio is bounded by $C$ times some measure of the estimate quality. \end{description} Looked at in this framework, we prove that SRPT-B is $1$-consistent and has $3.5$-graceful degradation, where $\alpha/\beta$ is our measure of estimate quality for $(\beta,\alpha)$-bounded size estimates. We also prove that PSJF-E is $1.5$ consistent and has $1.5$-graceful degradation, where the factor of $1.5$ comes from the maximum gap between PSJF and SRPT. While we do not have robustness results for these algorithms, that is because in the context of scheduling in the M/G/1, the robustness property is provably unachievable. In particular, no online policy without prediction information can achieve a constant approximation ratio against SRPT, as discussed in \cref{sec:gittins_bound}. We feel our emphasis on graceful degradation is a key contribution of our work that may apply to many other algorithms-with-predictions problems. While consistency and robustness are well-known goals in the literature, the graceful degradation goal has received less focus. However, we argue that graceful degradation is \emph{extremely important}. Real applications often have high-quality but imperfect predictions, which is the regime where performance is bounded by a graceful degradation result. The extreme cases of perfect or worthless estimates may come up less in practice. To adapt the notion of robustness to the setting of M/G/1 scheduling, one possible method would be to compare an algorithm against the optimal blind policy, which knows the job size distribution, but not the job sizes. This policy is known, and is called the Gittins index policy \citep{gittins_bandit_1979}. We discuss this policy in \cref{sec:gittins_bound}. This method of comparing against the optimal blind policy might be applicable to other algorithms-with-predictions problems. \section{Proof Overview} \label{sec:proof_overview} We now explain the main ideas we use to prove our main results. We focus on our analysis of SRPT-B (the most complex result), but we briefly comment on how the same ideas apply to analyzing SRPT-E (see \cref{rmk:srpt-e_idea}) and PSJF-E (see \cref{rmk:psjf-e_idea}). Our overall approach to comparing SRPT-B to SRPT is to compare each to a third policy, namely SRPT-SE. This approach proved useful because SRPT-SE's rank function has similarities with both SRPT's and SRPT-B's. \begin{itemize} \item Under both SRPT-SE and SRPT, a job's rank at every age is within a constant factor of its remaining size. \item Under both SRPT-SE and SRPT-B, a job's initial rank is its estimated size, and a job's rank never exceeds its initial rank. \end{itemize} In the remainder of this section, we explain how the above properties help us compare SRPT-SE to each of SRPT and SRPT-B. Interestingly, the two comparisons make use of two very different methods of analyzing mean response time. \subsection{Comparing SRPT-SE to SRPT} \label{sec:proof_overview:work_integral} SRPT minimizes mean response by prioritizing jobs by remaining size \citep{schrage_proof_1968}. SRPT-SE almost prioritizes jobs by remaining size, but it can make an error whenever two jobs' remaining sizes are within a constant factor of each other. The specific factor is $\alpha/\beta$: if job~$1$ has remaining size~$r_1$ and job~$2$ has greater remaining size $r_2 > r_1$, then SRPT will always serve job~$1$, but SRPT-SE might serve job~$2$ if $\beta r_2 \leq \alpha r_1$. Intuitively, one might hope that because SRPT-SE only makes constant-factor errors when prioritizing jobs, its mean response time should suffer by only a constant factor. We show that this indeed is the case, and that the constant factor is the same. Specifically, \cref{thm:srpt-se_result} states \begin{equation} \label{eq:srpt-se_result_informal} \E{T_\mathrm{SRPT\mathhyphen SE}} \leq \frac{\alpha}{\beta} \E{T_\mathrm{SRPT}}. \end{equation} In order to show~\cref{eq:srpt-se_result_informal}, we use a very recently developed formula for mean response time \citep{scully_gittins_2020}. At a high level, the formula expresses a policy's mean response time in terms of an integral of various types of work. We first describe the formula (see \cref{sec:proof_overview:work_integral:formula}) and then describe how we apply it to proving~\cref{eq:srpt-se_result_informal} (see \cref{sec:proof_overview:work_integral:application}) \subsubsection{Mean Response Time as a Work Integral} \label{sec:proof_overview:work_integral:formula} Define the \emph{$(\mathsf{remsize} \leq r)$-work} of a system to be the total remaining size of the jobs in the system that have remaining size $r$ or less, as illustrated in \cref{fig:remsize_leq_r-work}. \Citet[Theorem~6.3]{scully_gittins_2020} show that we can write the mean response time of any policy~$\pi$ in terms of the mean amount of $(\mathsf{remsize} \leq r)$-work in the system: \begin{equation} \label{eq:work_integral_informal} \E{T_\pi} = \frac{1}{\lambda} \int_0^\infty \frac{\E{\text{$(\mathsf{remsize} \leq r)$-work under~$\pi$}}}{r^2} \d{r}. \end{equation} See \cref{def:phi-work, def:shorthand} for a formal definition of $(\mathsf{remsize} \leq r)$-work and \cref{thm:response_time_work_integral} for a formal statement of~\cref{eq:work_integral_informal}. \begin{figure} \centering \captionsetup{aboveskip=0.25em} \input{figures/remsize_leq_r-work} \caption{Example of $(\mathsf{remsize} \leq r)$-Work} \label{fig:remsize_leq_r-work} \end{figure} \subsubsection{Comparing SRPT-SE's and SRPT's Work Integrals} \label{sec:proof_overview:work_integral:application} With \cref{eq:work_integral_informal} in hand, to compare the mean response times of SRPT-SE and SRPT, it suffices to compare their amounts of $(\mathsf{remsize} \leq r)$-work. In the proof of \cref{thm:srpt-se_result}, we show \begin{equation} \label{eq:srpt-se_key_step} \E{\text{$(\mathsf{remsize} \leq r)$-work under SRPT-SE}} \leq \E[\bigg]{\text{$\gp[\bigg]{\mathsf{remsize} \leq \frac{\alpha}{\beta} r}$-work under SRPT}}. \end{equation} Combining \cref{eq:work_integral_informal, eq:srpt-se_key_step} and using a change of variables implies~\cref{eq:srpt-se_result_informal}. The intuition behind \cref{eq:srpt-se_key_step} is as follows. Because SRPT always serves the job of least remaining size, it satisfies the following guarantee: \begin{quote} Whenever the system has nonzero $(\mathsf{remsize} \leq r)$-work, SRPT serves a job of remaining size $r$ or less, thus decreasing the amount of $(\mathsf{remsize} \leq r)$-work. \end{quote} This guarantee implies that SRPT minimizes mean $(\mathsf{remsize} \leq r)$-work among all scheduling policies. In contrast, SRPT-SE satisfies a weaker guarantee: \begin{quote} Whenever the system has nonzero $(\mathsf{remsize} \leq r)$-work, SRPT-SE serves a job of remaining size $\alpha/\beta \cdot r$ or less, thus decreasing the amount of $(\mathsf{remsize} \leq \alpha/\beta \cdot r)$-work. \end{quote} Roughly speaking, this means that whenever the system's $(\mathsf{remsize} \leq r)$-work is nonzero, SRPT-SE reduces $(\mathsf{remsize} \leq \alpha/\beta \cdot r)$-work just as efficiently as SRPT does, suggesting a relationship like \cref{eq:srpt-se_key_step} might hold. The main technical challenge in proving \cref{eq:srpt-se_key_step} is formalizing the above intuition. The key ingredient turns out to be introducing a new variant of $(\mathsf{remsize} \leq r)$-work. The new variant, called \emph{$(\mathsf{remsize \mathhyphen e} \leq r)$-work} (see \cref{def:phi-work, def:shorthand}), uses scaled estimated remaining size instead of true remaining size. This new variant is important because SRPT-SE always serves the job of least scaled estimated remaining size, so it satisfies the following guarantee: \begin{quote} Whenever the system has nonzero $(\mathsf{remsize \mathhyphen e} \leq r)$-work, SRPT-SE serves a job of scaled estimated remaining size $r$ or less, thus decreasing the amount of $(\mathsf{remsize \mathhyphen e} \leq r)$-work. \end{quote} This guarantee implies that, analogously to SRPT minimizing mean $(\mathsf{remsize} \leq r)$-work, SRPT-SE minimizes mean $(\mathsf{remsize \mathhyphen e} \leq r)$-work (see \cref{thm:soap_match_minimizes_work}). \begin{remark} \label{rmk:psjf-e_idea} The proof of \cref{thm:psjf-e_result}, which compares PSJF-E to PSJF, follows a similar strategy to the comparison of SRPT-SE to SRPT outlined above. However, the details are significantly more complicated. The main obstacle is that while \cref{eq:work_integral_informal} uses remaining size, PSJF-E and PSJF prioritize jobs by \emph{original} estimated and true size, respectively. We overcome this obstacle by introducing several more new variants of $(\mathsf{remsize} \leq r)$-work. \end{remark} \subsection{Comparing SRPT-B to SRPT-SE} \label{sec:proof_overview:soap} Our approach to comparing SRPT-B to SRPT-SE looks very different from our approach to comparing SRPT-SE to SRPT. In particular, we use a different method of characterizing each policy's mean response time. The method, often called the ``tagged-job method'', has been used since the early days of M/G/1 scheduling theory to analyze a variety of policies, including SRPT \citep{schrage_queue_1966}. Recently, \citet{scully_soap_2018} generalized the tagged-job method to \emph{all} policies in which a job's rank varies as a function of its age, including all of the policies we study (see \cref{def:policy}). Below, we outline how the tagged-job method of \citet{scully_soap_2018} applies to SRPT-B and SRPT-SE. At a high level, the tagged-job method works by following a single ``tagged'' job on its journey through the system. The tagged job's response time is a random variable with several sources of randomness: \begin{itemize} \item the random true size~$S$ and estimated size~$Z$ of the tagged job, \item the random state of the system at the moment the tagged job arrives, and \item the random arrivals that occur after the tagged job. \end{itemize} One can show that the expected response time of the tagged job, where the expectation is taken over all of the above sources of randomness, is indeed the system's mean response time \citep{harchol-balter_performance_2013}. To compute the tagged job's expected response time, we first condition on its true and estimated sizes. Specifically, let the random variable $T_\pi(s, z)$ denote the response time of the tagged job under policy~$\pi$ given that it has true size $S = s$ and estimated size $Z = z$. We will find $\E{T_\pi(s, z)}$, from which mean response time follows by integrating over $s$ and~$z$: \begin{equation} \label{eq:tagged_to_mean} \E{T_\pi} = \int_0^\infty \mkern-6mu\int_0^\infty \E{T_\pi(s, z)} f_{S, Z}(s, z) \d{s} \d{z}. \end{equation} To analyze the tagged job's response time~$T_\pi(s, z)$, we split it into two parts: \begin{description} \item[Waiting time:] the amount of time between the tagged job's arrival and the moment the tagged job first receives service, denoted~$T^{\mathsf{wait}}_\pi(s, z)$. \item[Residence time:] the amount of time between the tagged job first receives service and the tagged job's completion, denoted~$T^{\mathsf{res}}_\pi(s, z)$. \end{description} We illustrate waiting time and residence time in \cref{fig:waiting_residence}. We define mean waiting and residence times $\E{T^{\mathsf{wait}}_\pi}$ and $\E{T^{\mathsf{res}}_\pi}$ analogously to~\cref{eq:tagged_to_mean}. \begin{figure} \centering \captionsetup{aboveskip=0.25em} \input{figures/waiting_residence} \caption{Response Time${} = {}$Waiting Time${} + {}$Residence Time} \label{fig:waiting_residence} \end{figure} To compare SRPT-B to SRPT-SE, we separately compare the two policies' waiting times (see \cref{sec:proof_overview:soap:waiting, thm:srpt-b_waiting}) and residence times (see \cref{sec:proof_overview:soap:residence, thm:srpt-b_residence}). At a high level, because SRPT-B and SRPT-SE have similar enough rank functions, we are able to show that SRPT-B's waiting and residence times are not too much larger than SRPT-SE's. \subsubsection{Comparing Waiting Times} \label{sec:proof_overview:soap:waiting} Consider a tagged job of estimated size~$z$. Under both SRPT-B and SRPT-SE, the tagged job's initial rank is~$z$. The tagged job's waiting time therefore lasts until any other jobs that remain in the system have rank greater than~$z$, at which point the tagged job, having better rank than all other jobs in the system, is served for the first time. Therefore, the tagged job's waiting time depends on how long each \emph{other} job spends with rank $z$ or less. In particular, the tagged job's waiting time does not depend on its own size, so we denote its waiting time by simply $T^{\mathsf{wait}}_\pi(z)$. Specifically, letting \begin{equation*} u_\pi(z) = \E[\bigg]{\gp[\bigg]{\begin{tabular}{@{}l@{}}\text{amount of service time during which} \\ \text{a job has rank $z$ or less under policy~$\pi$}\end{tabular}}^2}, \end{equation*} it turns out that comparing $\E{T^{\mathsf{wait}}_\mathrm{SRPT\mathhyphen B}(z)}$ to $\E{T^{\mathsf{wait}}_\mathrm{SRPT\mathhyphen SE}(z)}$ boils down to comparing $u_\mathrm{SRPT\mathhyphen B}(z)$ to $u_\mathrm{SRPT\mathhyphen SE}(z)$ (see \cref{thm:soap:waiting}). One can use simple geometry to show that under SRPT-B, the amount of service time a job spends with rank $z$ or less is at most than twice the amount it would be under SRPT-SE, implying $u_\mathrm{SRPT\mathhyphen B}(z) \leq 4 u_\mathrm{SRPT\mathhyphen SE}(z)$. This is strong enough to show graceful degradation of SRPT-B, but it does not imply consistency. But the rank functions of SRPT-B and SRPT-SE do become closer and closer together as $\alpha$ and $\beta$ approach~1, so one would expect consistency of SRPT-B to hold, too. The main technical challenge in comparing waiting times is obtaining a bound tight enough to show consistency. In particular, it does not suffice to simply bound $u_\mathrm{SRPT\mathhyphen B}(z) - u_\mathrm{SRPT\mathhyphen SE}(z)$ with a quantity that vanishes as $\alpha$ and $\beta$ approach~1. While this is a necessary first step, it shows only that as $\alpha$ and $\beta$ approach~1, the difference $\E{T^{\mathsf{wait}}_\mathrm{SRPT\mathhyphen B}(z)} - \E{T^{\mathsf{wait}}_\mathrm{SRPT\mathhyphen SE}(z)}$ vanishes for all~$z$. We seek bounds on mean response time, so we need to integrate over~$z$ to show that $\E{T^{\mathsf{wait}}_\mathrm{SRPT\mathhyphen B}} - \E{T^{\mathsf{wait}}_\mathrm{SRPT\mathhyphen SE}}$ also vanishes. This second step is purely computational but requires some care: there are several choices one must make when bounding the integral, and many choices lead to either intractable expressions or bounds that are too weak to show consistency. \begin{remark} \label{rmk:srpt-e_idea} The reason for SRPT-E's poor performance is that under SRPT-E, a job can spend up to a $1 - \beta$ fraction of its service time below rank~$0$. This means one can have $u_\mathrm{SRPT\mathhyphen E}(z) \geq (1 - \beta)\E{S^2}$, from which \cref{thm:srpt-e_result} easily follows. SRPT-B avoids this problem thanks to the bounce in its rank function. \end{remark} \subsubsection{Comparing Residence Times} \label{sec:proof_overview:soap:residence} Consider a tagged job of true size~$s$ and estimated size~$z$. When the tagged job starts its residence time, its rank~$z$ is less than the rank of every other job in the system. Moreover, under both SRPT-B and SRPT-SE, a job's rank never exceeds this initial rank of~$z$ (see \cref{fig:rank:srpt-b, fig:rank:srpt-se}). Therefore, the only reason that the tagged job might be preempted is if new jobs arrive. Suppose a new job of estimated size~$z'$ arrives while the tagged job has age~$a$. What determines whether the new arrival delays the tagged job? \begin{itemize} \item If the new job's initial rank~$z'$ is less than the tagged job's rank at age~$a$, then the new job has priority over the tagged job. \item If $z'$ is at least the tagged job's rank at age~$a$, then the tagged job has priority over the new job, initially. But if later the tagged job will have rank greater than~$z'$ at some \emph{future} age $a' > a$, then when the tagged job reaches age~$a'$, the new job will have priority over the tagged job. \end{itemize} The conclusion of this discussion is what \citet{scully_soap_2018} call the ``Pessimism Principle'', the upshot of which is the following: \begin{quote} When determining whether a new arrival will delay the tagged job, what matters is not the tagged job's current rank but rather its \emph{worst future rank}. \end{quote} Therefore, bounding the tagged job's residence time of SRPT-B boils down to bounding the tagged job's worst future rank under SRPT-B. One simple bound on the tagged job's worst future rank is its initial rank~$z$, because under SRPT-B, a job's rank never exceeds its initial rank (see \cref{fig:rank:srpt-b}). As it happens, under PSJF-E, the tagged job's worst future rank would always be~$z$. This means that SRPT-B's mean residence time is at most that of PSJF-E, which turns out to be simple to bound (see \cref{thm:psjf-e_residence, thm:srpt_log}). This is strong enough to show graceful degradation of SRPT-B, but it does not imply consistency. \begin{figure} \centering \begin{subfigure}[b]{0.5\linewidth} \centering \input{figures/residence_informal_z_gt_s} \caption{Overestimated Size} \end{subfigure}\hfill\begin{subfigure}[b]{0.5\linewidth} \centering \input{figures/residence_informal_z_lt_s} \caption{Underestimated Size} \end{subfigure} \caption{Bounding Residence Time of SRPT-B} \label{fig:residence_informal} \end{figure} The main technical challenge in comparing residence times is obtaining a bound tight enough to show consistency. To show consistency of SRPT-B, we would like to bound SRPT-B's residence time in terms of that of SRPT-SE, not PSJF-E. However, the tagged job's worst future rank at a given age can be greater under SRPT-B than under SRPT-SE. Our solution is, roughly speaking, to bound the worst future rank under SRPT-B to a ``shifted'' version of worst future rank under SRPT-SE, as illustrated in \cref{fig:residence_informal}. The result is a bound of the form \begin{equation*} \E{T^{\mathsf{res}}_\mathrm{SRPT\mathhyphen B}(s, z)} \leq \E{T^{\mathsf{res}}_\mathrm{SRPT\mathhyphen SE}(s, z)} + c \E{T^{\mathsf{res}}_\mathrm{PSJF\mathhyphen E}(s, z)}, \end{equation*} where $c$ approaches~0 as $\alpha$ and $\beta$ approach~1. This immediately implies an analogous bound on mean residence times. \begin{remark} \label{rmk:bounce_limit} The Pessimism Principle, namely the fact that a job's residence time is governed by its worst future rank instead of its current rank, is the reason we limit the bounce in SRPT-B's rank function (see \cref{fig:rank:srpt-b}) to no more than the job's initial rank. \end{remark} \section{Background on M/G/1 Scheduling Theory} \label{sec:background} In this section, we review definitions and results from M/G/1 scheduling theory that we use in our proofs. Specifically, we review two recently developed methods for computing a policy's mean response time. \begin{itemize} \item \Cref{sec:background:work_integral} reviews the ``work integral'' method, which we use to compare SRPT-SE to SRPT. \item \Cref{sec:background:tagged_job} reviews the ``tagged job'' method, which we use to compare SRPT-B to SRPT-SE. \end{itemize} Having given in \cref{sec:proof_overview} an intuitive overview of each method, the main purpose of this section is to present them more formally. \subsection{Mean Response Time via the Work Integral Method} \label{sec:background:work_integral} We saw in \cref{sec:proof_overview:work_integral} that one can compute a policy's mean response time by looking at the amount of different types of work in the system. Specifically, the key definition is $(\mathsf{remsize} \leq r)$-work, the amount of work contributed by jobs which have remaining size $r$ or less. Below, we give a formal definition of a general kind of work, which includes $(\mathsf{remsize} \leq r)$-work as a special case. Recall from \cref{def:policy} that a job's state is a tuple $x = (s, z, a)$ consisting of its true size~$s$, estimated size~$z$, and age~$a$. \begin{definition} \label{def:phi-work} Let $\phi : \R_+^3 \to \{\mathsf{false}, \mathsf{true}\}$ be a predicate on job states. \begin{enumerate:definition} \item The \emph{$\phi$-work of a job in state~$x$}, denoted $w(x, \phi)$, is the amount of service a job in state~$x$ requires to either complete or reach a state that does not satisfy~$\phi$. That is, a job's $\phi$-work, roughly speaking, its remaining processing time while satisfying~$\phi$. Formally, \begin{equation*} w((s, z, a), \phi) = \sup\curlgp{w \in [0, s - a) \given \phi(s, z, a + w)}. \end{equation*} \item The \emph{(system) $\phi$-work} is the total $\phi$-work of all jobs in the system. We denote by $W_\pi(\phi)$ the steady-state distribution of the system $\phi$-work under policy~$\pi$. \end{enumerate:definition} \end{definition} When discussing $\phi$-work, it is helpful to have a shorthand notation for describing predicates. The following definition describes such a shorthand. \begin{definition} \label{def:shorthand} \leavevmode \begin{enumerate:definition}[beginpenalty=10000] \item \label{def:shorthand:predicate} Let $\mathsf{func} : \R_+^3 \to \R$ be a real function on job states and $r \in \R$ be a constant. The predicate $(\mathsf{func} \leq r)$ is true for those states~$x$ such that $\mathsf{func}(x) \leq r$. We define other inequality predicates similarly, e.g. $\mathsf{func}_1 \leq r < \mathsf{func}_2$, and we omit the parentheses when they would be redundant, e.g. $W_\pi(\mathsf{func} \leq r)$. To disambiguate between functions and constants, we use $\mathsf{sans\mathhyphen serif}$ font for functions. \item \label{def:shorthand:function} We frequently use the following functions on job states in the above shorthand: {\setlength{\jot}{0em} \begin{alignat*}{3} & \text{\emph{(true) size}} \qquad & & \mathsf{size}(s, z, a) & &= s, \\ & \text{\emph{(true) remaining size}} \qquad & & \mathsf{remsize}(s, z, a) & &= s - a, \\ & \text{\emph{estimated size}} \qquad & & \mathsf{size\mathhyphen e}(s, z, a) & &= z, \\ & \text{\emph{scaled estimated remaining size}} \qquad & & \mathsf{remsize \mathhyphen e}(s, z, a) & &= z/s \cdot (s - a). \end{alignat*}} \end{enumerate:definition} \end{definition} All of the functions in \cref{def:shorthand:function} happen to also be rank functions of one of the policies we study (see \cref{def:policy}). For example, $\mathsf{remsize} = \rank{\mathrm{SRPT}}$. We introduce the names in \cref{def:shorthand:function} to emphasize that, for instance, we can consider $(\mathsf{remsize} \leq r)$-work under policies other than SRPT. This last example is especially important, because a policy's mean response time is connected to its steady-state $(\mathsf{remsize} \leq r)$-work. \begin{proposition}[\textnormal{% special case of \citep[Theorem~6.3]{scully_gittins_2020}}] \label{thm:response_time_work_integral} In the M/G/1, the mean response time of any policy~$\pi$ is \begin{equation*} \E{T_\pi} = \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\pi(\mathsf{remsize} \leq r)}}{r^2} \d{r}. \end{equation*} \end{proposition} The above result is a recently derived, powerful identity for the mean response time. We use it in our analyses of SRPT-SE (see \cref{sec:srpt-se}) and PSJF-E (see \cref{sec:psjf-e}). \subsection{Mean Response Time via the Tagged Job Method} \label{sec:background:tagged_job} We describe the main ideas behind the tagged job method in \cref{sec:proof_overview:soap}. As a reminder, the approach is to focus on a single ``tagged'' job; split its response time into two parts, \emph{waiting time} and \emph{residence time} (see \cref{fig:waiting_residence}); and analyze each part separately. The purpose of this section is to define the concepts and notation that we need in order to write down formulas for the tagged job's expected waiting and residence times. Consider a tagged job of of true size~$s$ and estimated size~$z$ arriving to a steady-state system under some scheduling policy~$\pi$. An important quantity when computing the tagged job's waiting and residence times is the rate at which jobs with rank less than the tagged job arrive to the system. We can interpret the system load $\rho = \lambda \E{S}$ as the overall rate at which work arrives. Analogously, define\footnote{% Recall that a random job's true size~$S$ and estimated size~$Z$ are \emph{not} independent, which is important in the definition of $\rho_Z(z)$.} \begin{align} \label{eq:rho} \rho_S(s) &= \lambda \E{S \1(S \leq s)}, & \rho_Z(z) &= \lambda \E{S \1(Z \leq z)}. \end{align} These are the average rates at which work arrives when one only counts work from jobs whose true size or estimated size, respectively, is at most some threshold. Specifically, $\rho_S(s)$ is important for analyzing policies that use a job's true size (SRPT and PSJF), while $\rho_Z(z)$ is important for analyzing policies that use a job's estimated size (SRPT-E, PSJF-E, SRPT-B, and SRPT-SE). Having defined \cref{eq:rho}, there are two more quantities we need to define before stating formulas for the tagged job's waiting and residence times. We give formal and informal expressions for each. \begin{itemize} \item In the waiting time formula, we use the quantity\footnote{% In the formal expression, $\vert{\cdot}$ denotes interval length. The definition we give is simplified by the fact that for the scheduling policies we consider, a job's rank is below a threshold~$r$ for at most one contiguous interval of ages. A more complicated definition is needed for policies with general rank functions \citep{scully_soap_2018}.} \begin{equation*} u_\pi(r) = \E[\big]{\vert[\big]{\curlgp{a \in [0, S) \given \rank{\pi}(S, Z, a) \leq r}}^2} = \E[\bigg]{\gp[\bigg]{\begin{tabular}{@{}l@{}}\text{amount of service time during which} \\ \text{a job has rank $r$ or less under policy~$\pi$}\end{tabular}}^2}. \end{equation*} \item In the residence time formula, we use the \emph{worst future rank} of a job, which we define as \begin{equation*} \worst{\pi}(s, z, a) = \sup_{b \in [a, s)} \rank{\pi}(s, z, b) = \gp[\bigg]{\begin{tabular}{@{}l@{}}\text{maximum rank a job currently in state $(s, z, a)$ has} \\ \text{under policy~$\pi$ between now and its completion}\end{tabular}}. \end{equation*} \end{itemize} We are now ready to state the waiting and residence time formulas for the policies we consider. \begin{proposition}[\textnormal{% special case of \citep[Theorem~5.5]{scully_soap_2018}}] \label{thm:soap} Consider an M/G/1 under policy $\pi \in \{\srpte,\allowbreak \psjfe,\allowbreak \srptb,\allowbreak \srptse\}$. \begin{enumerate:theorem} \item \label{thm:soap:waiting} The expected waiting time of a (tagged) job of estimated size~$z$ is \begin{equation*} \E{T^{\mathsf{wait}}_\pi(z)} = \frac{\lambda}{2} \frac{u_\pi(z)}{(1 - \rho_Z(z))^2}. \end{equation*} \item \label{thm:soap:residence} The expected residence time of a (tagged) job of true size~$s$ and estimated size~$z$ is \begin{equation*} \E{T^{\mathsf{res}}_\pi(s, z)} = \int_0^s \frac{1}{1 - \rho_Z(\worst{\pi}(s, z, a))} \d{a}. \end{equation*} \end{enumerate:theorem} \end{proposition} Some intuition for the formulas above is warranted. We explain one simple case below, referring the reader to \citet[Section~4]{scully_soap_2018} for more discussion. \begin{remark} \label{rmk:residence_busy_period} Consider how \cref{thm:soap:residence} applies to PSJF-E. We have $\worst{\mathrm{PSJF\mathhyphen E}}(s, z, a) = z$, so \begin{equation} \label{eq:psjf-e_residence_s_z} \E{T^{\mathsf{res}}_\mathrm{PSJF\mathhyphen E}(s, z)} = \frac{s}{1 - \rho_Z(z)}. \end{equation} The intuitive interpretation of \cref{eq:psjf-e_residence_s_z} is as follows. During the tagged job's residence time, new jobs may arrive at any time, preempting the job in service if they have rank below~$z$. On average, the server spends a $\rho_Z(z)$ fraction of its time serving these new jobs of rank below~$z$, leaving a $1 - \rho_Z(z)$ fraction for serving the tagged job. This means that the tagged job's age increases at average rate $1/(1 - \rho_Z(z))$, so it takes $s/(1 - \rho_Z(z))$ time to go from age~$0$ to age~$s$. \end{remark} Formulas very similar to those in \cref{thm:soap} hold for SRPT and PSJF. In fact, such formulas are classic results \citep{schrage_queue_1966, harchol-balter_performance_2013}. The differences is that expected waiting and residence times both depend only on a job's size~$s$, so we replace $u_\pi(z)$ with $u_\pi(s)$, and we replace $\rho_Z(z)$ with $\rho_S(s)$. Alternatively, one may view the SRPT and PSJF formulas as special cases of the SRPT-SE and PSJF-E formulas in a system where $S = Z$ for all jobs. We omit the exact statements because in our proofs, we end up analyzing SRPT and PSJF with the work integral method. \subsection{Useful Lemmas} The following simple lemmas will be useful in our later analyses. \begin{lemma} \label{thm:rho_derivative} \begin{align*} \dd{s} \rho_S(s) &= \lambda s f_S(s), & \dd{z} \rho_Z(z) &= \lambda \E{S \given Z = z} f_Z(z). \end{align*} \end{lemma} \begin{proof} These follow from \cref{eq:rho} and the fact that we can write \begin{align*} \E{S \1(S \leq s)} &= \int_0^s s' f_S(s') \d{s'} & \E{S \1(Z \leq z)} &= \int_0^z \E{S \given Z = z'} f_Z(z') \d{z'}. \qedhere \end{align*} \end{proof} \begin{lemma} \label{thm:psjf-e_residence} The mean residence time of PSJF-E is \begin{equation*} \E{T^{\mathsf{res}}_\mathrm{PSJF\mathhyphen E}} = \gp*{\frac{1}{\rho} \ln\frac{1}{1 - \rho}}\E{S}. \end{equation*} \end{lemma} \begin{proof} Combining \cref{eq:psjf-e_residence_s_z, thm:rho_derivative} yields \begin{align*} \E{T^{\mathsf{res}}_\mathrm{PSJF\mathhyphen E}} &= \int_0^\infty \mkern-6mu\int_0^\infty \E{T^{\mathsf{res}}_\mathrm{PSJF\mathhyphen E}(s, z)} f_{S, Z}(s, z) \d{z} \by{conditioning on $s$ and~$z$} \\ &= \int_0^\infty \mkern-6mu\int_0^\infty \frac{s}{1 - \rho_Z(z)} f_{S, Z}(s, z) \d{z} \by{\cref{eq:psjf-e_residence_s_z}} \\ &= \int_0^\infty \frac{\E{S \given Z = z}}{1 - \rho_Z(z)} f_Z(z) \d{z} \\ &= \frac{1}{\lambda} \ln\frac{1}{1 - \rho}. \by{\cref{thm:rho_derivative}} \end{align*} The lemma follows from $\rho = \lambda \E{S}$. \end{proof} The main reason that \cref{thm:psjf-e_residence} is useful is the following result of \citet{wierman_nearly_2005}, which shows that the mean residence time of PSJF-E is a \emph{lower bound} on the mean response time of SRPT. \begin{proposition}[\textnormal{\citep[Theorem~5.8]{wierman_nearly_2005}}] \label{thm:srpt_log} The mean response time of SRPT is bounded below by \begin{equation*} \E{T_\mathrm{SRPT}} \geq \gp*{\frac{1}{\rho} \ln\frac{1}{1 - \rho}} \E{S}. \end{equation*} \end{proposition} \section{SRPT with Estimates (SRPT-E)} \label{sec:srpt-e} Our first result shows that, for $(\beta,\alpha)$-bounded size estimates with $\beta < 1$, the performance of SRPT-E can lead to arbitrarily large approximation ratios. This formalizes previous empirical results (see e.g. \cite{mitzenmacher_scheduling_2020}), where it was noted that underestimates of large jobs, particularly when job sizes are highly variable, can lead to poor performance for SRPT-E, as a large underestimated job being served can obtain a negative estimated remaining time and block service for all other jobs, even when the actual remaining time is large. This formalization motivates our seeking a variation of SRPT that avoids this problem, and our examination of PSJF-E, which we show in contrast has bounded approximation ratio for $(\beta,\alpha)$-bounded size estimates. \restate{thm:srpt-e_result} \begin{proof} For a given job distribution $S$, let $Z = \beta S$. From \cref{thm:soap:waiting}, we know that the expected waiting time of SRPT-E is \begin{align*} \E{T^{\mathsf{wait}}_\mathrm{SRPT\mathhyphen E}(z)} &= \frac{\lambda}{2} \frac{\E[\Big]{\gp[\Big]{{\footnotesize \begin{tabular}{@{}l@{}} \text{amount of service time during which} \\[-0.05em] \text{a job has rank~$z$ or less under SRPT-E} \end{tabular}}}^2}}{(1 - \rho_Z(z))^2}\\ &\ge \frac{\lambda}{2} \E[\Big]{\gp[\Big]{{\footnotesize \begin{tabular}{@{}l@{}} \text{amount of service time during which} \\[-0.05em] \text{a job has rank~0 or less under SRPT-E} \end{tabular}}}^2}. \end{align*} Note that this lower bound applies regardless of $z$. Because $Z = \beta S$, a job of size $s$ starts at rank $\beta s$, and reaches rank 0 at age $\beta s$. Therefore, it receives $(1-\beta)s$ service with rank $\le 0$. Therefore, we can lower bound waiting time explicitly: \begin{align*} \E{T^{\mathsf{wait}}_\mathrm{SRPT\mathhyphen E}} \ge \frac{\lambda}{2} \E[\big]{\gp[\big]{(1-\beta)S}^2}. \end{align*} From this result, we see that SRPT-E's response time grows with $\E{S^2}$, which can be arbitrarily large or infinite. In contrast, the response time of SRPT is finite even for job size distributions with infinite $\E{S^2}$, such as a Pareto distribution with exponent $1.5$. \end{proof} \section{SRPT with Scaling Estimates (SRPT-SE)} \label{sec:srpt-se} SRPT-SE is a policy that uses a job's true size and estimated size to assign its rank. SRPT-SE is thus not a practical policy, as one would prefer SRPT if true sizes were known. However, analyzing it is helpful for a few reasons. First, it is a useful warmup for the analysis of PSJF-E, which follows the same outline but is somewhat more complicated (see \cref{sec:psjf-e}). Second, it is the first step of analyzing SRPT-B, whose performance we bound relative to SRPT-SE (see \cref{sec:srpt-b}). Third, there are settings in which a policy similar to SRPT-SE, which enjoys similarly good performance, could be implemented in practice (see \cref{sec:continuous-estimate}). Our main tool for analyzing SRPT-SE is \cref{thm:response_time_work_integral}, which expresses mean response time in terms of mean $(\mathsf{remsize} \leq r)$-work, with less $(\mathsf{remsize} \leq r)$-work corresponding to lower response time. Before analyzing SRPT-SE, it is helpful to consider how one might use \cref{thm:response_time_work_integral} to show that SRPT minimizes mean response time. The key is that for every value of~$r$, SRPT minimizes mean $(\mathsf{remsize} \leq r)$-work, or equivalently mean $(\rank{\mathrm{SRPT}} \leq r)$-work. The intuition is that whenever the system has nonzero $(\rank{\mathrm{SRPT}} \leq r)$-work, SRPT serves a job of rank $r$ or less, thus reducing the amount of $(\rank{\mathrm{SRPT}} \leq r)$-work. It turns out that an analogous property holds for any policy that can be defined using a rank function \citep{scully_soap_2018}, including those in \cref{def:policy}. \begin{proposition}[\textnormal{% very similar to \citep[Theorem~VII.7]{scully_gittins_2021}\protect\footnotemark}] \label{thm:soap_match_minimizes_work} Consider a policy $\pi \in \{\srpt,\allowbreak \psjf,\allowbreak \srpte,\allowbreak \psjfe,\allowbreak \srptb,\allowbreak \srptse\}$ and any rank~$r$. In the M/G/1, the policy that minimizes the mean amount of steady-state $(\rank{\pi} \leq r)$-work is $\pi$ itself. That is, for any policy~${\pi'}$, \begin{equation*} \E{W_{\pi}(\rank{\pi} \leq r)} \leq \E{W_{{\pi'}}(\rank{\pi} \leq r)}. \end{equation*} \end{proposition} \footnotetext{% While \citet[Theorem~VII.7]{scully_gittins_2021} consider a specific policy, namely a generalization of SRPT, the same proof applies virtually verbatim to any policy that can be defined by a rank function \citep{scully_soap_2018}.} Because $\mathsf{remsize \mathhyphen e} = \rank{\mathrm{SRPT\mathhyphen SE}}$, we have from \cref{thm:soap_match_minimizes_work} that SRPT-SE minimizes mean $(\mathsf{remsize \mathhyphen e} \leq r)$-work. Of course, \cref{thm:response_time_work_integral} uses $(\mathsf{remsize} \leq r)$-work, not $(\mathsf{remsize \mathhyphen e} \leq r)$-work. Fortunately, we can leverage the fact that we have $(\beta, \alpha)$-bounded size estimates to relate $(\mathsf{remsize} \leq r)$-work to $(\mathsf{remsize \mathhyphen e} \leq r)$-work, yielding the following result. \begin{theorem}[Performance of SRPT-SE] \label{thm:srpt-se_result} Consider the M/G/1 with $(\beta, \alpha)$-bounded size estimates. \begin{enumerate:theorem} \item \label{thm:srpt-se_result:bound} The mean response time of SRPT-SE is bounded above by \begin{equation*} \E{T_\mathrm{SRPT\mathhyphen SE}} \leq \frac{\alpha}{\beta} \E{T_\mathrm{SRPT}}, \end{equation*} \item The approximation ratio of SRPT-SE is at most~$\alpha/\beta$. \item As $\alpha$ and~$\beta$ converge to~$1$, the approximation ratio of SRPT-SE converges to~$1$. This convergence is uniform in the arrival rate and the joint distribution of true and estimated sizes. \end{enumerate:theorem} \end{theorem} \begin{proof} It clearly suffices to prove~(a). Recall the following facts about job states~$x$: \begin{itemize} \item $\rank{\mathrm{SRPT}}(x) = \mathsf{remsize}(x)$, \item $\rank{\mathrm{SRPT\mathhyphen SE}}(x) = \mathsf{remsize \mathhyphen e}(x)$, and \item $\mathsf{remsize \mathhyphen e}(x)/\mathsf{remsize}(x) = \mathsf{size\mathhyphen e}(x)/\mathsf{size}(x) \in [\beta, \alpha]$. \end{itemize} Using the above facts together with \cref{thm:response_time_work_integral, thm:soap_match_minimizes_work}, we compute \begin{align*} \E{T_\mathrm{SRPT\mathhyphen SE}} &= \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{SRPT\mathhyphen SE}(\mathsf{remsize} \leq r)}}{r^2} \d{r} \by{\cref{thm:response_time_work_integral}} \\ &\leq \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{SRPT\mathhyphen SE}(\mathsf{remsize \mathhyphen e} \leq \alpha r)}}{r^2} \d{r} \by{using $\mathsf{remsize \mathhyphen e}(x)/\mathsf{remsize}(x) \leq \alpha$} \\ &\leq \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{SRPT}(\mathsf{remsize \mathhyphen e} \leq \alpha r)}}{r^2} \d{r} \by{\cref{thm:soap_match_minimizes_work}} \\ &\leq \frac{1}{\lambda} \int_0^\infty \frac{\E[\big]{W_\mathrm{SRPT}\gp[\big]{\mathsf{remsize} \leq \frac{\alpha}{\beta} r}}}{r^2} \d{r} \by{using $\mathsf{remsize \mathhyphen e}(x)/\mathsf{remsize}(x) \geq \beta$}\\ &= \frac{\alpha}{\beta} \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{SRPT}(\mathsf{remsize} \leq r')}}{(r')^2} \d{r'} \by{setting $r' = \alpha / \beta \cdot r$} \\ &= \frac{\alpha}{\beta} \E{T_\mathrm{SRPT}}. \by{\cref{thm:response_time_work_integral}} \qedhere \end{align*} \end{proof} \Cref{thm:srpt-se_result} completes our analysis of SRPT-SE. We describe a related result for a similar scheme that does not use the job's true size in \cref{sec:continuous-estimate}. \section{SRPT with Bounce (SRPT-B)} \label{sec:srpt-b} As we have mentioned, previous works have noted that when using SRPT-E, large jobs that are underestimated will have estimated remaining sizes that become negative while the true remaining time is still relatively large, leading to long waiting times for jobs stuck behind them. An open question has been to modify SRPT with estimated sizes in a way that avoids this issue in a robust manner, without assumptions on job size distributions. Our suggested solution, SRPT with Bounce (SRPT-B), handles this by modifying the rank function from $z-a$ to $\min\{|z-a|,z\}$.\footnote{We note that it is an interesting open question to consider the effects of other possible forms for the bounce, which we do not investigate here.} We prove the following results for SRPT-B. \restate{thm:srpt-b_result} Our overall approach to analyzing SRPT-B is to compare it to SRPT-SE. We separately compare the waiting times and residence times of the two policies (see \cref{sec:proof_overview:soap}). Both comparisons boil down to comparing the amount of time a job spends above or below a given rank under each policy. We begin with the residence time comparison (see \cref{sec:srpt-b:residence}) before moving on to the more complicated waiting time comparison (see \cref{sec:srpt-b:waiting}). Combining the two comparisons and some additional computation (see \cref{sec:srpt-b:response}) yields \cref{thm:srpt-b_result}. \subsection{Residence Time Difference between SRPT-B and SRPT-SE} \label{sec:srpt-b:residence} By \cref{thm:soap:residence}, the expected residence time of the job under SRPT-B, SRPT-SE, or PSJF-E is an integral of $1/(1 - \rho_Z(\cdot))$ terms over the job's ages, where the value plugged is the worst future rank of the job. Consider a job of true size~$s$ and estimated size~$z$. In order to bound $\E{T^{\mathsf{res}}_\mathrm{SRPT}(s, z)}$, we will find functions $g_{s, z}(\cdot), h_{s, z}(\cdot)$, and values $c_{s, z}, t_{s, z} > 0$ such that \begin{align} \label{eq:g_integral} \int_0^{t_{s, z}} \frac{1}{1 - \rho_Z(g_{s, z}(a))} \d{a} &= \E{T^{\mathsf{res}}_\mathrm{SRPT\mathhyphen B}(s, z)} + c_{s, z}s, \\ \label{eq:h_integral} \int_0^{t_{s, z}} \frac{1}{1 - \rho_Z(h_{s, z}(a))} \d{a} &= \E{T^{\mathsf{res}}_\mathrm{SRPT\mathhyphen SE}(s, z)} + c_{s, z}\E{T^{\mathsf{res}}_\mathrm{PSJF\mathhyphen E}(s, z)}, \\ \label{eq:g_leq_h} g_{s, z}(a) &\leq h_{s, z}(a) \quad \text{for all~$a \in (0, t_{s, z})$.} \end{align} Because $1/(1 - \rho_Z(\cdot))$ is nondecreasing, this implies \begin{equation*} \E{T^{\mathsf{res}}_\mathrm{SRPT\mathhyphen B}(s, z)} \leq \E{T^{\mathsf{res}}_\mathrm{SRPT\mathhyphen SE}(s, z)} + c_{s, z}(\E{T^{\mathsf{res}}_\mathrm{PSJF\mathhyphen E}(s, z)} - s). \end{equation*} Finally, we will bound $c_{s, z}$ by a value~$c$ which is independent of $s$ and~$z$, obtaining \begin{equation} \label{eq:srpt-b_residence_goal} \E{T^{\mathsf{res}}_\mathrm{SRPT\mathhyphen B}} \leq \E{T^{\mathsf{res}}_\mathrm{SRPT\mathhyphen SE}} + c(\E{T^{\mathsf{res}}_\mathrm{PSJF\mathhyphen E}} - \E{S}). \end{equation} We begin by computing the worst future ranks of each policy. \begin{lemma} \label{thm:worst_future_rank} The worst future ranks of a job of true size~$s$, estimated size~$z$, and age~$a$ under SRPT-B, SRPT-SE, and PSJF-E are \begin{align*} \worst{\mathrm{SRPT\mathhyphen B}}(s, z, a) &= \max\{z - a, \min\{s - z, z\}\}, \\ \worst{\mathrm{SRPT\mathhyphen SE}}(s, z, a) &= \mathrm{SRPT\mathhyphen SE}(s, z, a) = \frac{z}{s}(s - a), \\ \worst{\mathrm{PSJF\mathhyphen E}}(s, z, a) &= \mathrm{PSJF\mathhyphen E}(s, z, a) = z. \end{align*} \end{lemma} \begin{proof} SRPT-SE and PSJF-E have nondecreasing rank as a function of age~$a$, so the job's worst future rank is its current rank. If $s \leq z$, then the same is true for SRPT-B. If instead $z < s \leq 2z$, then under SRPT-B, the job's worst future rank is its current rank~$z - a$ until age $a = s - 2(s - z)$, after which the worst future rank is its final rank, namely $s - z$. Finally, if $s > 2z$, then the job's worst future rank is always its final rank, namely~$z$. \end{proof} \begin{lemma} \label{thm:g_h_exist} The following definitions satisfy \cref{eq:g_integral, eq:h_integral, eq:g_leq_h}: \begin{align*} c_{s, z} &= \min\curlgp[\Big]{\vert[\Big]{1 - \frac{s}{z}}, 1}, \\ t_{s, z} &= (1 + c_{s, z})s, \\ g_{s, z}(a) &= \begin{cases} \max\{z - a, \min\{s - z, z\}\} & \text{if } a \leq s \\ 0 & \text{if } a > s, \end{cases} \\ h_{s, z}(a) &= \begin{cases} z & \text{if } a \leq c_{s, z}s \\ \frac{z}{s}(s - (a - c_{s, z}s)) & \text{if } a > c_{s, z}s. \end{cases} \end{align*} \end{lemma} \begin{figure} \centering \begin{subfigure}[b]{0.5\linewidth} \centering \input{figures/residence_z_gt_s} \caption{Estimated Size~$z \geq {}$True Size~$s$} \end{subfigure}\hfill\begin{subfigure}[b]{0.5\linewidth} \centering \input{figures/residence_z_lt_s} \caption{Estimated Size~$z < {}$True Size~$s \leq 2z$} \end{subfigure} \caption{Relating Residence Times of SRPT-B, SRPT-SE, and PSJF-E} \label{fig:residence} \end{figure} \begin{proof} Combining \cref{thm:soap:residence, thm:worst_future_rank} yields \cref{eq:g_integral, eq:h_integral}. A simple case analysis, illustrated in \cref{fig:residence}, yields \cref{eq:g_leq_h}. The illustration shows the $z \geq s$ and $z < s \leq 2z$ cases, and the $s > 2z$ case is essentially the same as the $s = 2z$ case. \end{proof} \begin{proposition} \label{thm:srpt-b_residence} The mean residence time of SRPT-B is bounded above by \begin{equation*} \E{T^{\mathsf{res}}_\mathrm{SRPT\mathhyphen B}} \leq \E{T^{\mathsf{res}}_\mathrm{SRPT\mathhyphen SE}} + \min\curlgp[\bigg]{1, \max\curlgp[\Big]{1 - \frac{1}{\alpha}, \frac{1}{\beta} - 1}} \gp*{\frac{1}{\rho} \ln\frac{1}{1 - \rho} - 1} \E{S}. \end{equation*} \end{proposition} \begin{proof} Let $c_{s, z} = \min\{1, |1 - s/z|\}$, as in \cref{thm:g_h_exist}. Because we have $(\beta, \alpha)$-bounded size estimates, $c_{s, z} \leq \min\{1, \max\{1 - 1/\alpha, 1/\beta - 1\}\}$ for all feasible pairs of true size~$s$ and estimated size~$z$. This bound on $c_{s, z}$ is independent of $s$ and~$z$, so by \cref{thm:g_h_exist} and the discussion at the start of this section, \cref{eq:srpt-b_residence_goal} holds with $c = \min\{1, \max\{1 - 1/\alpha, 1/\beta - 1\}\}$. The result then follows from \cref{thm:psjf-e_residence}, which gives the value of~$\E{T^{\mathsf{res}}_\mathrm{PSJF\mathhyphen E}}$. \end{proof} \subsection{Waiting Time Difference between SRPT-B and SRPT-SE} \label{sec:srpt-b:waiting} By \cref{thm:soap:waiting}, computing the waiting time of SRPT-B and SRPT-SE boils down to computing how much of a job's service happens below a given rank. That is, letting \begin{equation} \label{eq:u_def} u_\pi(z) = \E[\bigg]{\gp[\bigg]{\begin{tabular}{@{}l@{}}\text{amount of service time during which} \\ \text{a job has rank $z$ or less under policy~$\pi$}\end{tabular}}^2}, \end{equation} our goal is to compare $u_\mathrm{SRPT\mathhyphen B}(z)$ and~$u_\mathrm{SRPT\mathhyphen SE}(z)$. We begin by computing both quantities. \begin{lemma} \label{thm:u_exact} \begin{align*} u_\mathrm{SRPT\mathhyphen B}(z) &= \E[\big]{S^2 \1(Z \leq z) + \gp[\big]{\max\{0, \min\{S - (Z - z), 2z\}\}}^2 \1(Z > z)}, \\ u_\mathrm{SRPT\mathhyphen SE}(z) &= \E[\bigg]{S^2 \1(Z \leq z) + \gp[\bigg]{\frac{S}{Z}z}^2 \1(Z > z)}. \end{align*} \end{lemma} \begin{proof} Consider a job with true size~$S$ and estimated size~$Z$ drawn from the joint distribution of true and estimated sizes. Under both policies, if $Z \leq z$, then the job's rank remains $z$ or less for its entire service time, which explains the $\1(Z \leq z)$ terms. If instead $Z > z$, then the following reasoning explains the $\1(Z > z)$ terms. \begin{itemize} \item Under SRPT-B, the job has rank $z$ or less when its age is in the interval $[0, S) \cap [Z - z, Z + z]$. \item Under SRPT-SE, the job spends a $z/Z$ fraction of its service time with rank~$z$ or less. \qedhere \end{itemize} \end{proof} \begin{lemma} \label{thm:u_bound} \begin{equation*} u_\mathrm{SRPT\mathhyphen B}(z) - u_\mathrm{SRPT\mathhyphen SE}(z) \leq 3z \max\{1 - \beta, 0\} \E{S \1(Z > z)}. \end{equation*} \end{lemma} \begin{proof} We begin by applying \cref{thm:u_exact}: \begin{equation*} u_\mathrm{SRPT\mathhyphen B}(z) - u_\mathrm{SRPT\mathhyphen SE}(z) = \E[\bigg]{\gp[\bigg]{\gp[\big]{\max\{0, \min\{S - (Z - z), 2z\}\}}^2 - \gp[\bigg]{\frac{S}{Z}z}^2} \1(Z > z)}. \end{equation*} If $S \leq Z$, then because $z/Z < 1$ whenever the indicator is nonzero, the following computation shows that the expression inside the expectation is nonpositive: \begin{equation*} \begin{aligned} \frac{z}{Z} &< 1 & &{\Rightarrow} & \frac{z}{Z}(Z - S) &\leq Z - S & &{\Rightarrow} & S - (Z - z) &\leq \frac{S}{Z}z. \end{aligned} \end{equation*} This means adding an $S > Z$ to the indicator gives an upper bound, from which we compute \begin{align*} \MoveEqLeft u_\mathrm{SRPT\mathhyphen B}(z) - u_\mathrm{SRPT\mathhyphen SE}(z) \\ &\leq \E[\Bigg]{\gp[\Bigg]{\gp[\big]{\max\{0, \min\{S - (Z - z), 2z\}\}}^2 - \gp[\bigg]{\frac{S}{Z}z}^2} \1(S > Z > z)} \by{nonpositive when $S \leq Z$} \\ &\leq \E[\big]{\gp[\big]{(z + \min\{S - Z, z\})^2 - z^2}\1(S > Z > z)} \\ &\leq \E{3z(S - Z) \1(S > Z > z)} \\ &\leq 3z \max\{1 - \beta, 0\} \E{S \1(Z > z)}. \by{using $Z \geq \beta S$} \qedhere \end{align*} \end{proof} \begin{proposition} \label{thm:srpt-b_waiting} The mean waiting time of SRPT-B is bounded above by \begin{equation*} \E{T^{\mathsf{wait}}_\mathrm{SRPT\mathhyphen B}} \leq \E{T^{\mathsf{wait}}_\mathrm{SRPT\mathhyphen SE}} + \frac{3}{2} \alpha \max\{1 - \beta, 0\} \gp*{\frac{1}{\rho} \ln\frac{1}{1 - \rho} - 1} \E{S}. \end{equation*} \end{proposition} \begin{proof} The high-level steps of the proof are the following: \begin{itemize} \item We use \cref{thm:soap:waiting} to express $\E{T^{\mathsf{wait}}_\mathrm{SRPT\mathhyphen B}} - \E{T^{\mathsf{wait}}_\mathrm{SRPT\mathhyphen SE}}$ in terms of $u_\mathrm{SRPT\mathhyphen B}(z) - u_\mathrm{SRPT\mathhyphen SE}(z)$. \item We bound $u_\mathrm{SRPT\mathhyphen B}(z) - u_\mathrm{SRPT\mathhyphen SE}(z)$ using \cref{thm:u_bound}. \item We use integration by parts, obtaining an expression that is similar to one that appears in the proof of \cref{thm:psjf-e_residence}. \item Mirroring the remainder of the proof of \cref{thm:psjf-e_residence}, which involves applying \cref{thm:rho_derivative}, yields the desired result. \end{itemize} We begin by computing \begin{align*} \MoveEqLeft \E{T^{\mathsf{wait}}_\mathrm{SRPT\mathhyphen B}} - \E{T^{\mathsf{wait}}_\mathrm{SRPT\mathhyphen SE}} \\ &= \int_0^\infty (\E{T^{\mathsf{wait}}_\mathrm{SRPT\mathhyphen B}(z)} - \E{T^{\mathsf{wait}}_\mathrm{SRPT\mathhyphen SE}(z)}) f_Z(z) \d{z} \by{conditioning on $Z$} \\ &= \frac{\lambda}{2} \int_0^\infty \frac{u_\mathrm{SRPT\mathhyphen B}(z) - u_\mathrm{SRPT\mathhyphen SE}(z)}{(1 - \rho_Z(z))^2} f_Z(z) \d{z} \by{\cref{thm:soap:waiting, eq:u_def}} \\ &\leq \frac{3}{2} \max\{1 - \beta, 0\} \int_0^\infty \frac{\lambda z \E{S \1(Z > z)}}{(1 - \rho_Z(z))^2} f_Z(z) \d{z} \by{\cref{thm:u_bound}} \\ &\leq \frac{3}{2} \alpha \max\{1 - \beta, 0\} \int_0^\infty \frac{\lambda \E{S \given Z = z} \E{S \1(Z > z)}}{(1 - \rho_Z(z))^2} f_Z(z) \d{z}. \by{using $Z \leq \alpha S$} \end{align*} It remains only to bound the last integral. By \cref{thm:rho_derivative}, we have \begin{equation} \label{eq:waiting_integration_by_parts_1} \frac{\lambda \E{S \given Z = z} f_Z(z)}{(1 - \rho_Z(z))^2} = \dd{z}\frac{1}{1 - \rho}, \end{equation} and conditioning on~$Z$ yields \begin{equation} \label{eq:waiting_integration_by_parts_2} \E{S \1(Z > z)} = \int_z^\infty \E{S \given Z = z'} \d{z'}. \end{equation} Combining these equations and integrating by parts, we obtain \begin{align*} \MoveEqLeft \int_0^\infty \frac{\lambda \E{S \given Z = z} \E{S \1(Z > z)}}{(1 - \rho_Z(z))^2} f_Z(z) \d{z} \\ &= \int_0^\infty \gp[\bigg]{\dd{z}\frac{1}{1 - \rho_Z(z)}} \gp[\bigg]{\int_z^\infty \E{S \given Z = z'} f_Z(z') \d{z'}} \d{z} \by{\cref{eq:waiting_integration_by_parts_1, eq:waiting_integration_by_parts_2}} \\ &= 0 - \E{S} + \int_0^\infty \frac{\E{S \given Z = z} f_Z(z)}{1 - \rho_Z(z)} \d{z} \by{integrating by parts} \\ &= \gp*{\frac{1}{\rho} \ln\frac{1}{1 - \rho} - 1} \E{S}. \by{\cref{thm:rho_derivative}} \qedhere \end{align*} \end{proof} \subsection{Combining Waiting Time and Residence Time Bounds} \label{sec:srpt-b:response} \begin{proof}[Proof of \cref{thm:srpt-b_result}] By \cref{thm:srpt_log}, it suffices to prove~(a), which follows by combining \cref{thm:srpt-b_residence, thm:srpt-b_waiting}, applying \cref{thm:srpt-se_result:bound}, and observing \begin{equation*} \max\{1 - \beta, 0\} \leq \1(\beta < 1) \min\curlgp[\bigg]{1, \max\curlgp[\Big]{1 - \frac{1}{\alpha}, \frac{1}{\beta} - 1}}. \qedhere \end{equation*} \end{proof} \section{PSJF with Estimates (PSJF-E)} \label{sec:psjf-e} \restate{thm:psjf-e_result} We prove \cref{thm:psjf-e_result} using an argument similar to the proof of \cref{thm:srpt-se_result}. However, because PSJF prioritizes jobs by original size instead of remaining size, combining \cref{thm:response_time_work_integral, thm:soap_match_minimizes_work} to compare PSJF with PSJF-E is not as straightforward as comparing SRPT with SRPT-SE. We begin by working out how \cref{thm:response_time_work_integral} applies to PSJF and PSJF-E. \begin{lemma} \label{thm:psjf_work_integral} The mean response time of PSJF is \begin{equation*} \E{T_\mathrm{PSJF}} = \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{PSJF}(\mathsf{size} \leq r)}}{r^2} \d{r} + \frac{1}{2\lambda} \ln\frac{1}{1-\rho}. \end{equation*} \end{lemma} \begin{proof} Applying \cref{thm:response_time_work_integral} yields \begin{align*} \E{T_\mathrm{PSJF}} &= \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{PSJF}(\mathsf{remsize} \leq r)}}{r^2} \d{r} \\ \yestag \label{eq:T_psjf_first_step} &= \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{PSJF}(\mathsf{size} \leq r)}}{r^2} \d{r} + \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{PSJF}(\mathsf{remsize} \leq r < \mathsf{size})}}{r^2} \d{r}. \end{align*} It remains only to compute $\E{W_\mathrm{PSJF}(\mathsf{remsize} \leq r < \mathsf{size})}$. Let $\phi_r(s, z, a) = (s - a \leq r < s)$. That is, $\phi_r$ is true for states with remaining size less than $r$ but original size greater than~$r$. Our goal is to compute $\E{W(\phi)}$. Recall from \cref{def:phi-work} that $W(\phi_r)$ is the sum of each individual job's $\phi_r$-work. We can therefore use a generalization of Little's law \citep{brumelle_relation_1971, heyman_relation_1980} to express the average total amount of $\phi_r$-work, namely $\E{W(\phi_r)}$, as the arrival rate~$\lambda$ times the average cumulative amount of $\phi_r$-work a job contributes over the course of its time in the system. Specifically, consider a random job with true size~$S$, estimated size~$Z$, response time~$T$, and age~$A(t)$ after being in the system for time $t \in [0, T)$.\footnote{% The random variables $S$, $Z$, $T$, and $A(t)$ refer to the same job, so they are not independent. In addition, the response time~$T$ and age~$A(t)$ depend on PSJF scheduling. The same applies to $T^{\mathsf{wait}}$ and~$T^{\mathsf{res}}$, which we introduce shortly.} Then by the generalization of Little's law, we can write the mean $\phi_r$-work as \begin{align} \label{eq:little_w_phi_r} \E{W_\mathrm{PSJF}(\phi_r)} = \lambda \E[\bigg]{\int_0^T w(\phi_r, (S, Z, A(t))) \d{t}}, \end{align} We now compute the expectation of the right-hand side of \cref{eq:little_w_phi_r}, which concerns a single job's time in the system. Because $\phi_r(s, z, a)$ holds only if $a > 0$ and a job's age is~$0$ during its waiting time, we can restrict attention to residence time. Letting $T^{\mathsf{wait}}$ and $T^{\mathsf{res}}$ denote the random job's waiting and residence times, respectively, we have \begin{align*} \E[\bigg]{\int_0^T w(\phi_r, (S, Z, A(t))) \d{t}} &= \E[\bigg]{\int_0^{T^{\mathsf{wait}}} w(\phi_r, (S, Z, 0)) \d{t} + \int_{T^{\mathsf{wait}}}^{T^{\mathsf{wait}} + T^{\mathsf{res}}} w(\phi_r, (S, Z, A(t))) \d{t}} \\ \yestag \label{eq:response_integral_to_residence_integral} &= \E[\bigg]{\int_{T^{\mathsf{wait}}}^{T^{\mathsf{wait}} + T^{\mathsf{res}}} w(\phi_r, (S, Z, A(t))) \d{t}}. \end{align*} Under PSJF, a job's rank is always its size, and the load of jobs with rank better than~$s$ is~$\rho_S(s)$. This means that during the residence time of a job of size~$s$, it takes $\Delta/(1 - \rho_S(s))$ time for a job's age to increase by~$\Delta$.\footnote{% This $1/(1 - \rho_S(s))$ factor under PSJF is similar to the $1/(1 - \rho_Z(z))$ factor that appears under PSJF-E, as discussed in \cref{rmk:residence_busy_period}. One can use the concept of \emph{busy periods} from M/G/1 scheduling theory to formalize this \citep{harchol-balter_performance_2013, scully_soap_2018}.} This means that for any function~$g$ and any size~$s$, \begin{equation} \label{eq:residence_integral_to_age_integral} \E[\bigg]{\int_{T^{\mathsf{wait}}}^{T^{\mathsf{wait}} + T^{\mathsf{res}}} g(A(t)) \d{t} \given S = s} = \frac{1}{1 - \rho_S(s)} \int_0^s g(a) \d{a}. \end{equation} From this, we compute \begin{align*} \MoveEqLeft \E[\bigg]{\int_0^T w(\phi_r, (S, Z, A(t))) \d{t}} \\ &= \E[\bigg]{\int_{T^{\mathsf{wait}}}^{T^{\mathsf{wait}} + T^{\mathsf{res}}} w(\phi_r, (S, Z, A(t))) \d{t}} \by{\cref{eq:response_integral_to_residence_integral}} \\ &= \int_0^\infty \E[\bigg]{\int_{T^{\mathsf{wait}}}^{T^{\mathsf{wait}} + T^{\mathsf{res}}} w(\phi_r, (s, Z, A(t))) \d{t} \given S = s} f_S(s) \d{s} \by{conditioning on $S$} \\ &= \int_0^\infty \E[\bigg]{\int_{T^{\mathsf{wait}}}^{T^{\mathsf{wait}} + T^{\mathsf{res}}} (s - A(t))\1(s - A(t) \leq r < s) \d{t} \given S = s} f_S(s) \d{s} \by{expanding $\phi_r$} \\ &= \int_0^\infty \mkern-6mu\int_0^s (s - a) \1(s - a \leq r < s) \d{a} \, \frac{f_S(s)}{1 - \rho_S(s)} \d{s} \by{\cref{eq:residence_integral_to_age_integral}} \\ \yestag \label{eq:cumulative_job_rrs-work} &= \frac{r^2}{2} \int_r^\infty \frac{f_S(s)}{1 - \rho_S(s)} \d{s}. \end{align*} Finally, we use \cref{eq:little_w_phi_r} to plug this back into \cref{eq:T_psjf_first_step}, obtaining \begin{align*} \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{PSJF}(\mathsf{remsize} \leq r < \mathsf{size})}}{r^2} \d{r} &= \frac{1}{2} \int_0^\infty \mkern-6mu\int_r^\infty \frac{f_S(s)}{1 - \rho_S(s)} \d{s} \d{r} \by{\cref{eq:little_w_phi_r, eq:cumulative_job_rrs-work}} \\ &= \frac{1}{2} \int_0^\infty \frac{s f_S(s)}{1 - \rho_S(s)} \d{s} \by{swapping integrals} \\ &= \frac{1}{2\lambda} \ln\frac{1}{1 - \rho}. \by{\cref{thm:rho_derivative}} \qedhere \end{align*} \end{proof} \begin{lemma} \label{thm:psjf-e_work_integral} The mean response time of PSJF-E is bounded by \begin{equation*} \E{T_\mathrm{PSJF\mathhyphen E}} \leq \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{PSJF\mathhyphen E}(\mathsf{size\mathhyphen e} \leq \alpha r)}}{r^2} \d{r} + \frac{\alpha}{\beta} \frac{1}{2\lambda} \ln\frac{1}{1-\rho}. \end{equation*} \end{lemma} \begin{proof} Applying \cref{thm:response_time_work_integral} and using the fact that $\mathsf{remsize \mathhyphen e}(x)/\mathsf{remsize}(x) \leq \alpha$ yields \begin{align*} \E{T_\mathrm{PSJF\mathhyphen E}} &= \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{PSJF\mathhyphen E}(\mathsf{remsize} \leq r)}}{r^2} \d{r} \\ &\leq \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{PSJF\mathhyphen E}(\mathsf{remsize \mathhyphen e} \leq \alpha r)}}{r^2} \d{r} \\ \yestag \label{eq:T_psjf-e_first_step} &= \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{PSJF\mathhyphen E}(\mathsf{size\mathhyphen e} \leq \alpha r)}}{r^2} \d{r} + \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{PSJF\mathhyphen E}(\mathsf{remsize \mathhyphen e} \leq r < \mathsf{size\mathhyphen e})}}{r^2} \d{r}. \end{align*} It remains only to bound $\E{W_\mathrm{PSJF\mathhyphen E}(\mathsf{remsize \mathhyphen e} \leq \alpha r < \mathsf{size\mathhyphen e})}$. The first part of this computation is similar to part of the proof of \cref{thm:psjf_work_integral}. Specifically, under PSJF-E, a job's rank is always its estimated size, so analogues of \cref{eq:response_integral_to_residence_integral, eq:residence_integral_to_age_integral, eq:cumulative_job_rrs-work} hold for PSJF-E. The main difference is that in \cref{eq:residence_integral_to_age_integral}, we condition on a job having both size~$s$ and estimated size~$z$, and we use $\rho_Z(z)$ instead of~$\rho_S(s)$. The end result is \begin{align*} \MoveEqLeft \frac{1}{\lambda}\E{W_\mathrm{PSJF\mathhyphen E}(\mathsf{remsize \mathhyphen e} \leq \alpha r < \mathsf{size\mathhyphen e})} \\ &= \int_0^\infty \mkern-6mu\int_0^\infty \mkern-6mu\int_0^s (s - a) \1\gp*{\frac{z}{s}(s - a) \leq \alpha r < z} \d{a} \, \frac{f_{S, Z}(s, z)}{1 - \rho_Z(z)} \d{s} \d{z}. \end{align*} Simplifying the right-hand side yields \begin{align*} \MoveEqLeft \frac{1}{\lambda}\E{W_\mathrm{PSJF\mathhyphen E}(\mathsf{remsize \mathhyphen e} \leq \alpha r < \mathsf{size\mathhyphen e})} \\ &= \int_0^\infty \mkern-6mu\int_0^\infty \mkern-6mu\int_0^s q \1\gp*{\frac{z}{s} q \leq \alpha r < z} \d{q} \, \frac{f_{S, Z}(s, z)}{1 - \rho_Z(z)} \d{s} \d{z} \by{setting $q = s - a$} \\ &= \int_{\alpha r}^\infty \mkern-6mu\int_0^\infty \frac{\frac{1}{2} \gp[\big]{\frac{\alpha r s}{z}}^2}{1 - \rho_Z(z)} \d{q} \, f_{S, Z}(s, z) \d{s} \d{z} \\ &= \int_{\alpha r}^\infty \frac{\frac{1}{2} \E[\big]{\gp[\big]{\frac{\alpha r S}{z}}^2 \given Z = z} f_Z(z)}{1 - \rho_Z(z)} \d{z} \\ \yestag \label{eq:cumulative_job_yrz-work} &= \alpha \frac{r^2}{2} \int_{\alpha r}^\infty \frac{\frac{\alpha}{z} \E[\big]{\gp[\big]{\frac{S}{z}} S \given Z = z} f_Z(z)}{1 - \rho_Z(z)} \d{z}. \end{align*} Finally, we plug this back into \cref{eq:T_psjf-e_first_step}, obtaining \begin{align*} \MoveEqLeft \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{PSJF\mathhyphen E}(\mathsf{remsize \mathhyphen e} \leq \alpha r < \mathsf{size\mathhyphen e})}}{r^2} \d{r} \\ &= \alpha \frac{1}{2} \int_0^\infty \mkern-6mu\int_{\alpha r}^\infty \frac{\frac{\alpha}{z} \E[\big]{\gp[\big]{\frac{S}{z}} S \given Z = z} f_Z(z)}{1 - \rho_Z(z)} \d{z} \d{r} \by{\cref{eq:cumulative_job_yrz-work}} \\ &= \alpha \frac{1}{2} \int_0^\infty \frac{\E[\big]{\gp[\big]{\frac{S}{z}} S \given Z = z} f_Z(z)}{1 - \rho_Z(z)} \d{z} \by{swapping integrals} \\ &\leq \frac{\alpha}{\beta} \frac{1}{2} \int_0^\infty \frac{\E{S \given Z = z} f_Z(z)}{1 - \rho_Z(z)} \d{z} \by{using $Z/S \geq \beta$} \\ &= \frac{\alpha}{\beta} \frac{1}{2\lambda} \ln\frac{1}{1 - \rho}. \by{\cref{thm:rho_derivative}} \qedhere \end{align*} \end{proof} \begin{proof}[Proof of \cref{thm:psjf-e_result}] A result of \citet[Theorem~5.1]{wierman_nearly_2005} states \begin{equation*} \E{T_\mathrm{PSJF}} \leq \frac{3}{2} \E{T_\mathrm{SRPT}}, \end{equation*} so it suffices to prove~(a). \Cref{thm:psjf_work_integral} expresses $\E{T_\mathrm{PSJF}}$ as a sum of two terms, and \cref{thm:psjf-e_work_integral} bounds $\E{T_\mathrm{PSJF\mathhyphen E}}$ by a sum of two similar terms. The ratio of the second terms is~$\alpha/\beta$. To bound the ratio of the first terms by~$\alpha/\beta$, we proceed similarly to the proof of \cref{thm:srpt-se_result}: \begin{align*} \MoveEqLeft \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{PSJF\mathhyphen E}(\mathsf{size\mathhyphen e} \leq \alpha r)}}{r^2} \d{r} \\ &\leq \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{PSJF}(\mathsf{size\mathhyphen e} \leq \alpha r)}}{r^2} \d{r} \by{\cref{thm:soap_match_minimizes_work}} \\ &\leq \frac{1}{\lambda} \int_0^\infty \frac{\E[\big]{W_\mathrm{PSJF}\gp[\big]{\mathsf{size} \leq \frac{\alpha}{\beta} r}}}{r^2} \d{r} \by{using $\mathsf{size\mathhyphen e}(x)/\mathsf{size}(x) \geq \beta$} \\ &= \frac{\alpha}{\beta} \frac{1}{\lambda} \int_0^\infty \frac{\E{W_\mathrm{PSJF}(\mathsf{size} \leq r')}}{(r')^2} \d{r'}. \by{setting $r' = \alpha/\beta \cdot r$} \qedhere \end{align*} \end{proof} \section{Conclusion} We have examined scheduling policies in the context of estimated sizes. Our main result is to resolve an issue previously seen empirically, namely that the performance of SRPT-E can degrade significantly due to long jobs being underestimated, by developing and analyzing a novel policy, SRPT-B, which combines the best aspects of SRPT-E and PSJF-E. In analyzing SRPT-B, we have demonstrated that is has three key properties for $(\beta,\alpha)$-bounded estimates: (a) an approximation ratio near 1 when $\alpha$ and $\beta$ are near~1, (b) an approximation ratio bounded by some function of $\alpha$ and~$\beta$, and (c) implementation without knowledge of $\alpha$ and~$\beta$. We have also shown that PSJF-E also has properties (b) and (c), and has an approximation ratio near 1 relative to PSJF when $\alpha$ and $\beta$ are near~1. We have also shown that the empirical observation of the poor performance of SRPT-E can be characterized through a lower bound. For practical settings, our results provide theoretical backing for previous empirical findings that PSJF-E performs very well with estimated job sizes. While SRPT-B provides an additional promising alternative that will sometimes perform better in practice, we recommend PSJF-E as a simple, natural scheduling algorithm that seems to generally perform the best or near the best among standard alternatives. Our work leaves several open directions, including considering other estimation models, optimizing the behavior of the bounce in SRPT-B, and improving the bounds. For instance, another important estimation model is a model where estimates are typically good, but not guaranteed to be good, such as Gaussian errors. One might try to adapt our results to that setting by bounding the worst expected error over a given interval of time. We also note it may be possible to tighten the bound on the ratio between PSJF and SRPT, which may correspondingly tighten the bound between PSJF-E and SRPT. \bibliographystyle{ACM-Reference-Format}
\section{The Cognitive Science of Ideology} To study the general features of ideology---online or off, extremist or normative---requires clarity about the underlying concept. This is complicated by the fact that the word itself is often used in a pejorative sense: for Marx and Engels, for example, an ideology is an illusion, a falsification of political reality, and those who believe it are fundamentally deceived~\citep{marx, thompson}. By the 1970s, however, sociologists had developed more rhetorically neutral, descriptive meanings; in this second sense, ideologies are simply systems of belief that have to do with political action. While there are a number of different ways this can be fleshed out, a usefully generic definition is that provided by \cite{seliger2019ideology}: ideologies are ``sets of ideas by which [people] posit, explain, and justify the ends and means of organized social action with the aim to preserve, amend, uproot, or rebuild a given reality''. Implicit in this definition is the idea that there are two principal dimensions of ideology; \cite{seliger1970fundamental} calls these the ``fundamental'', and the ``operative''. We take the two in turn. On the fundamental dimension, an ideology is a cognitive artifact, a connected set of ideas that people use to make sense of the world. Ideologies serve as frameworks that knit statements of fact together with metaphysical, aesthetic, and moral claims, to make a more-or-less coherent and rationally-justified whole. Any particular claim that an ideology makes is meaningful only when understood as part of that larger system. An ideology is not a list of disconnected grievances, but a ``programmatic congerie of ideas''~\citep{friedrich1965ideology} that forms a compelling whole, an abstraction ``less abstract than the abstractions contained within it''~\citep{seliger1979inseparability}. Along this dimension, the study of ideology is the psychology of explanation. We value explanations not just for how their component ideas account for the facts at hand (how well they describe the world, or ``descriptiveness''), but also for the ways in which those ideas link the facts together (``co-explanation''), and the ways in which the ideas themselves are linked together (``unification'' and other forms of simplicity; \citealp{WOJTOWICZ2020981}). In a similar fashion, an appealing ideology is, in part, an appealing explanation, one that simplifies the world and helps satisfy the basic psychological drive for sense-making~\citep{CHATER2016137}. For this reason, we refer to the first dimension as \emph{explanatory}. On the operative, or behavioral, dimension, an ideology is a political artifact, directed towards the goal of either preserving or transforming a social order. In this sense, ideologies are interpersonal objects, something that we hold in common with other members of a group and that gives us the ability to organize and act together. Laws and social practices may be part of the operative side of an ideology: a racist ideology, for example, may include both laws that discriminate against minorities, as well as oppressive patterns of behavior by members of the majority group in everyday life. These aspects of the operative dimension then accompany the fundamental dimension's explanations for why those behaviors are justified. \cite{seliger1970fundamental}'s account emphases the conscious adoption of behaviors, and in as much as the operative dimension of an ideology is strategic, members may wish to seek common knowledge that others share it~\citep{chwe2013rational}. However, as the example of racist ideology suggests, much of what is operative may be part of a group's \emph{habitus}~\citep{bourdieu1990logic}---patterns of action that individuals produce ``without thinking'', and judgements that individuals would say ``go without saying''. The behaviors may be unreflective, but this does not mean they are incoherent, or any less aligned with the ideology's fundamental, explanatory dimension. As pointed out by \cite{converse}, the ordinary citizen has very little conscious awareness of the explanatory frameworks of the political elites, and often relies on simple habits and heuristics, such as identity and judgements of relative power and benefit, to guide the practical behaviors those explanations imply. Indeed, a habitual logic in the behavioral dimension may stabilize before the explanatory dimension does, as happens in \cite{elias2000civilizing}'s account of how the emergence of the modern ideas of the state's monopoly on violence was preceded by shifts in habits of interpersonal etiquette. The explanatory and behavioral dimension of an ideology are intimately related. The behavioral dimension is often highly structured by the explanatory dimension, and even when an agent experiences his actions as instinctive or ``natural'', they can still be playing out a complex explanatory logic. As pointed out by~\cite{manne2017down}, for example, a man who subscribes to a sexist ideology may not generically ``hate'' women; he may, in fact, display sincere affection to them so long as they fulfill expectations set by the underlying explanations he holds about their proper role in society; laboratory studies can tease apart different kinds of sexist ideology in part by the valence of these responses \citep{glick1997two,fiske}. In a similar fashion, a woman who subscribes to a sexist ideology may gain self-esteem by fulfilling the ideology's criteria for what it means to be a ``good'' woman~\citep{self_esteem}. As suggested by these examples, the behavioral dimension of an ideology is often interpersonal. Ideologies may occasionally involve private actions (\emph{e.g.}, secret acts of ``mortification of the flesh''), but with rare exceptions they center around behaviors towards others, and usually include public acts and political behaviors such as voting. Once we see ideologies in this way, two basic questions arise. First, what makes an ideology satisfying or appealing? What aspects of the explanatory and behavioral features of an ideology draw people in, and what aspects are ``sticky'', \emph{i.e.}, act to keep them there once they arrive? A simple answer is that people adopt ideologies that make them feel good, but as \cite{CHATER2016137} point out, there are constraints on our thoughts that limit the ways in which we can adopt beliefs for purely hedonic reasons~\citep{epley2016mechanics}. Ideologies might be more appealing if they make a person feel important, but they also have to make sense---if only to the person and his fellow ideologues. Another answer is that people adopt ideologies for purely instrumental reasons. This answer suggests, for example, that a neoliberal ideology~\citep{slobodian2018globalists} will attract wealthy capitalists seeking lower taxes. Ideologies are not ``single issue'' positions, however, and it is it not clear if a person can forecast whether or not adopting an ideology will lead to the desired outcome. Nor are ideologies necessarily easy to abandon, and the capitalist who becomes a neoliberal because of taxes may later find himself arguing against government subsidies that would be in his own self-interest. \cite{fanon2008black} provides a particularly affecting account of how ideologies can turn upon those who adopt them. Second, how are ideologies learned? Does one dimension, explanatory or behavioral, tend to precede the other? \cite{althusser2014reproduction} cites Blaise Pascal as saying ``kneel down, move your lips in prayer, and you will believe''---\emph{i.e.}, in our framing, that the behavioral precedes the explanatory---but it is also somewhat hard to see how something as sophisticated as as world-view could be transmitted solely through imitation. Humans spend a great deal of time providing reasons to each other~\citep{mercier2017enigma}, and it seems equally plausible that a person comes to adopt an ideology by first being shown how it explains things that matter to them. Our work aims to provide new answers to both questions, using the Red Pill's extremist ideology as a case study. As we will show, automated methods allow us to extract the explanatory and behavioral components of the Red Pill ideology in discussions online; we can then study the ways in which people engage with different components over time. This enables us to study what is attractive to a user at first, where such an initially intrigued user goes next, and what happens to those users if they choose to engage with the ideology over timescales of months and years. One of our innovations is the use of Hidden Markov Modeling to study the ideological formation of a user over time, which allows us to infer an underlying ``position'' in ideological space on the basis of the user's engagement with the surface content. \section{Methods} Forums associated with the Red Pill ideology are a core component of a larger ``manosphere''. Prior work has studied these groups as a source of extremism~\citep{jane2018systemic,van2018digesting}, antifeminism and misogyny~\citep{lin2017,mountford2018topic,farrell2019exploring,bhgt}, as a companion to in-person ``pickup culture''~\cite{o2018seduction}, and as virtual spaces that provide new affordances for articulating an aggrieved manhood~\citep{Masculinities2016Schmitz,ging2019alphas}. Researchers interested in the extreme views in these spaces focus on how such views are propagated through anonymity, accompanied by aggressive use of trolling and doxxing, and how rhetorical tactics, such as the strategic use of irony, help normalize extremist material under the guise of ambiguity and exacerbates group polarization~\citep{poe}. Our primary data source here are the archives of the main ``subreddit'' group, r/TheRedPill (``r/TRP''). As with all of Reddit's content, r/TRP follows the familiar pattern of an online bulletin board. An r/TRP user is presented with a scrolling list of ``submissions'', which range from extended 10,000 word user-authored essays, to laconic, one-sentence commentaries on a link to a news article hosted elsewhere. Users are able to comment on submissions, and to reply to the comments of others; they are also able to create new submissions (despite the name, these appear automatically). Both comments and submissions can be up-voted and down-voted by other users, and these votes influence placement and prominence. For simplicity, below, we use the word ``post'' to refer to both submissions and comments. Users are free to delete anything they contribute, as are privileged users (``moderators'', or ``mods'') who intervene to remove posts they consider inappropriate. They are also able to edit the ``sidebar'', on the right-hand of the screen, that all users are presented with; the sidebar contains links to the site's norms and rules, and a curated list of submissions intended to serve as an introduction to the group. We used the pushshift.io website, which continually scrapes and archives content from Reddit, to gather both comments and submissions for further analysis. Our full download collected 3,091,290 comments and 115,527 submissions from 26 October 2012, r/TRP's founding date, to 25 January 2021. Our sample is nearly complete; due to what appears to be a database error in the scraped archive, we are missing some posts from the first three months of 2019. \subsection{Topic Modelling} In order to determine the semantic content of the site, we build a topic model~\citep{tm} from the user comments and submissions. A topic model is an unsupervised clustering method that takes a collection of documents (in this case, all of the individual comments and submissions), and decomposes them into sparse combinations of ``topics'', or co-occurring word patterns. Topic models are a well-tested and long-standing tool that provides a window into the semantics of the content; a vast array of studies in different domains has used them to show how texts combine together different ideas. Each topic that the topic model discovers corresponds to a pattern of word usage, and the output of the model includes both a description of the word patterns, and a decomposition of each comment and submission into a weighted combination of these patterns. A key advantage of topic modeling is that it is unsupervised: the method infers both the word patterns and the decompositions simultaneously. In order to build the topic model, we pre-process the raw text by filtering stop-words and finding common 2-grams, and then use the MALLET software package~\citep{McCallumMALLET} for the inference itself. Because our goal is to study the full spectrum of user generated content, we model both comments and submissions together. For our final analysis, we use a 100-topic model. We inspect the output of this model by hand, and drop a total of seventeen ``non-semantic'' topics associated with automatically-posted material, complaints about the site or users, idiosyncratic slang, and meta discussion (thanking other users, asking for links, and so forth); our analysis focuses on the remaining 83. The Online Appendix lists each of these topics individually, showing the top fifty words in the topic, and providing twenty examples of texts heavily loaded on the topic. Following \cite{gabe}, we then compute the \emph{linkage} between topics. Linkage measures the extent to which two topics tend to co-appear; two topics (say, $i$ and $j$) have high linkage when, if you encounter topic $i$, you are more likely to also encounter topic $j$. In the simplest case, we measure ``text-level'' linkage, \emph{i.e.}, the extent to which the appearance of topic $i$ in a particular text predicts the appears of topic $j$. We first compute the joint probability, $p_{ij}$ of seeing topic $i$ and topic $j$ in texts drawn from a particular era; if $p_i(k)$ is the fraction of topic $i$ found in text $k$, we have \begin{equation} p_{ij} = \frac{1}{N} \sum_{k=1}^N p_i(k) p_j(k), \label{joint} \end{equation} and then linkage is defined as \begin{equation} R_{ij} = \log_2{\frac{p_{ij}}{p_i p_j}}. \label{linkage} \end{equation} Linkage is connected to the information-theoretic concept of mutual information; indeed, mutual information is simply the system's overall average linkage, weighted by the joint probability distribution $p_{ij}$. Text-level linkage provides a fine-grained map of how ideas are connected together in any particular post or comment. We can also measure linkage at the level of users; in Eq.~\ref{joint}, we can set $p_i(k)$ to the probability that user $k$ uses topic $i$ over all their posts, and sum is over all users, rather than all texts. User-level linkage tells us the extent to which, if a user tends to write about topic $i$, they become more likely to write about topic $j$; in our analysis, we find that both networks are broadly similar, meaning that individual users tend to associate topics in the same fashion as the group as a whole, and so, for simplicity, we present only the text-level results below. Linkage enables us to do two things. First, it is a measure of the cognitive structure of the ideas in play; if two topics have high linkage, this is a signal that there is something that repeatedly draws people to associate the underlying ideas. Second, it provides a powerful tool for coarse-graining the topics found by a topic model. When the topics are represented as a nodes in a network, with the edge weights given by the linkage strength, network clustering algorithms such as Louvain clustering~\citep{blondel2008fast} can reveal large collections of co-associated topics that correspond to distinct conceptual units. A topic model requires that we specify, ahead of time, the number of topics to find. This corresponds to choosing an effective ``resolution''---\emph{i.e.}, with more topics one can resolve, or split, word patterns that would be merged in a model with fewer topics. Ideally, one would like to choose that number on the basis of a statistical model-selection criterion. Somewhat surprisingly, however, the standard criteria are difficult to estimate well~\citep{eval} and can provide sub-optimal answers~\citep{tea}, and best practice in NLP places a premium on manual analysis and interpretation to validate parameter settings~\citep{183611}. In our analysis we followed work such as~\cite{allen2017topic} and experimented with a range of different choices for the number of topics, between 20 and 100. We found that even at the highest-resolution setting of 100, the topic groupings were both stable on re-running the fits, and interpretable, meaning that (after filtering) any particular topic could be associated with a semantic theme, on the basis of both the top words in the topic, and an examination of strongly-loaded posts. These are shown in the Online Appendix. Because our linkage clustering method ends up grouping large numbers of topics into the same cluster, our results are largely insensitive to the detailed parameter choices of the topic model. We find that the results of our linkage model (discussed below; the grouping into clusters and the overall themes of each cluster) not only match manual inspection, but do not require fine tuning of parameters. If a lower-resolution model would merge two topics, these are expected to have high linkage already; similarly, if a higher-resolution model would split a topic into two, the resulting pair is expected to have high linkage. In either case, the merge or the split occurs within a cluster, and the overall cluster structure does not change very much. \subsection{Longitudinal Sample Construction} A goal of our analysis is to study users in a longitudinal fashion as they engage with, and potentially learn, the group's ideas. The simplest approach to this requires a list of ``clean'' users who have no previous interactions with groups in the manosphere. Using the list of manosphere groups provided by~\cite{ribeiro2020evolution}, we construct a list of users who, (1) have not previously interacted with any manosphere groups on that list; but also, (2) have at least one post to a non-manosphere group, at the time they first appear in our data. Criterion (1) means that we are not including users who have already learned the ideology from interaction with other groups in the manosphere; this provides the cleanest possible set of ``newcomers''. Criterion (2) is useful because it enables us to filter out ``special purpose'' accounts---\emph{i.e.}, accounts created by a Reddit user with the express purpose of interacting with manosphere content, and nothing else. Special purpose accounts (sometimes called ``throwaways'') are occasionally used on Reddit by individuals who want to make sure that their regular accounts---whose posting histories may include personally identifying information---are not tied to potentially inflammatory content, and may be a sign that the user is not as unfamiliar with r/TRP as one might otherwise assume. Producing a ``clean'' user subset is a critical step in the analysis because it helps eliminate users who may have already accumulated significant experience with the ideology elsewhere. This gives us a clearer insight into what happens immediately after first contact. Such as list is not perfect---in particular, it doesn't account for the ways in which a user might interact with these ideas in other fora, or the extent to which they only read the material before deciding to join the discussion---but it provides a first step for selecting on the initially less aware and less committed. Our clean user set contains 39,838 users, all of whom have their first post on r/TRP somewhere between the beginning of 2016 and the end of 2019. By comparison, the set of special purpose accounts is much smaller, 6741; and the total number of users in this time period is 61,404---\emph{i.e.}, roughly a quarter of the participants on r/TRP during that period began posting on the Red Pill only after having had some interaction with other parts of the manosphere, a finding consistent with that of \cite{ribeiro2020evolution}'s study of cross-posting. \subsection{Modeling Individual-Level Behavior using Hidden Markov Modeling} Each user in our clean sample is associated with a list of posts they have made. A particular user with no prior record of engagement with the manosphere might have entered r/TRP at (say) January 1st, 2016, and made five different posts over the course of six months, with the last recorded post on June 1st. Our topic model will have allocated those five posts to different weighted combinations of the 100 topics in the data. This provides a trace of the user's interests over the course of their engagement with the site, and, in particular, with the kind of material they are generating for others on the site. A Hidden Markov Model (HMM) provides a way to model the dynamics of such a user, in terms of a shifting, unobserved ``hidden'' state. At any particular point in time, the user's hidden state corresponds to a preference for different topics in the system, and the dominant topic of the user's next post is draw from a distribution over those topics. Once the user makes the post, the hidden state then updates; the user might transition to a different hidden state, corresponding to a different set of preferences, or remain in the same one. A HMM provides a model of an underlying set of user interests, with their own temporal logic, that express themselves in observed posting behaviors. A crucial feature of an HMM is that observed behavior of the user at any isolated point in time does not completely dictate what he will do next; there may be more than one hidden state consistent with the kind of post they made. Intuitively, this captures how different underlying ideological preferences can express themselves, at times, in the same fashion. The inference of that hidden state is key to correctly modeling a user's ideology. Consider (to take a general example) two users on a politics forum, both of whom express an opposition to racism. User A's expression of an opposition to racism comes from an attachment to a free-market and libertarian ideology, while User B's expression comes from an attachment to a socialist ideology. These users will have, generically, both different pasts, and different futures, and if we want to understand their distinct ideological trajectories, we will need to attempt to infer---on the basis of their other remarks---that their expressed opposition comes from very different conceptual frameworks. This is precisely what the HMM does, in the context of a particularly simple, robust framework that can be expressed as a generative Bayesian model. The inference itself is done using SFIHMM~\citep{dedeo2016conflict}, which implements the standard expectation-maximization algorithm \citep{baum1966statistical}, along with a model-selection method (Akaike Information Criterion, AIC) that automatically selects the optimal number of states in a Bayesian fashion. \section{Results} We first present the results of our topic modeling, which allows us to characterize semantics the Red Pill ideology. We then present the results on population structure and ideological formation, based on our individual-level modeling of the ``clean'' user subsample. \subsection{Topic Modelling and Linkage Network Construction} The results of our topic modelling most easily visualized using the linkage network in Fig.~\ref{text_level}. This provides a graphical representation of how users create connections between different ideas; a high linkage (strong edge) between two topics means that the presence of one topic in a comment or submission is predictive of the other. For example, when a post includes talk about lifting weights as a form of self-improvement (Topic 87), it often also includes discussion of nutrition and testosterone (Topic 7), or martial arts and physical violence (Topic 50); see Appendix~\ref{topics_list} for a complete account of each topic. \begin{figure} \includegraphics[width=0.95\linewidth]{topic_cropped.pdf} \caption{The semantic structure of posts on r/TRP. Each node in the network corresponds to a topic (persistent word pattern) found in posts, with node size proportional to the fraction of attention devoted to the topic overall. An edge between two nodes indicates that the two corresponding topics are often found together in the same post. For example, Topic 17 (pseudo-evolutionary psychology; the orange node roughly in the center of the diagram) is often found in posts with Topic 70 (``decline of civilization''), Topic 83 (``hypergamy'' and evolutionary drivers behind male status experiences), and Topic 55 (parental rights). Nodes are arranged so that high-linkage topics are drawn closer together visually; we then use the Louvain clustering algorithm to detect groups of highly interlinked nodes, which are colored by group. Table~\ref{cluster_table} provides details on each of the clusters. \label{text_level}} \end{figure} Having represented the topics in this fashion, we can use the Louvain clustering algorithm to reveal the large-scale structure. It finds five principal clusters, listed in Table~\ref{cluster_table}. The two clusters, ``self-help'' and ``pickup-artist culture'' are primarily behavioral and concern the ways in which one ought to behave. Two clusters, ``hierarchy and status'', and ``neoreactionary politics'' are explanatory: they are focused in providing users with unifying accounts of the way the world works. A fifth cluster, ``men's rights activism'', is a mixture of the two dimensions. \begin{table} \begin{tabularx}{\textwidth}{l|X} Cluster & Selections from Comments \\ \hline Self-help & ``Prior to my morning meditation I have a cold shower and drink a coffee whilst filling out The Daily Stoic and making my today's plan.'' (Topic 84) \\ & ``Also stop watching porn for fucks sake. You can't improve if you're watching another man fuck the girl that you want. It's as simple as that. Sex is natural, porn is artificial.'' (Topic 48) \\ & ``I guess from my perspective, if the depression and loss of interest is so bad, then there is a root cause or more that need to be identified and dealt with. ... This is all from personal experience. Last summer I hit a very low point in my life.'' (Topic 14) \\ \hline PUA & ``Only approach women who give you a bunch of IOI's [indicators of interest]. Bonus points if she floats around in your vicinity to make your approach easier. At this point its all about having the balls to talk to her.'' (Topic 28) \\ & ``For instance in night game if a girl I meet in a public space (a club or pub) doesn't want to kiss me the night I meet her, unless there's a very specific logistics reason for her not to (like unable to isolate), I don't even bother getting her number.'' (Topic 38) \\ & ``Was plating this girl for about 5 months. Everything was fine as is, all of sudden I sense that she is losing interest; no longer initiated communication, told me twice in one month that she was on her period, long replies to text...'' (Topic 8) \\ \hline \hline MRA & ``Women shouldn't have careers. They shouldn't get ``compensation'' for being a ``stay at home mother'' AKA mother. Career mothers practice child abuse.'' (Topic 55) \\ & ``Western spousal support laws are thinly veiled ``give women money'' laws, as any man who tries to use them rapidly finds out.'' (Topic 60) \\ & ``You can't deduct contributions to an IRA if you make over a certain amount so, most high income earners opt for the Roth which isn't tax deductible but grows tax free'' (Topic 74) \\ \hline \hline Status & ``Harsh climate's prioritize alphas, the men who were able to hunt. An extreme example would be the tribes living in polar regions, where meat is the only food source and women cannot forage for berries and small game, thus making it advantageous for them to ally with the best alpha, the best hunter.'' (Topic 17) \\ & ``Alpha men embrace their malehood, the sexual strategies that maximize their genetic potential. Beta males play the provider game and resist their polygynous nature in an attempt to lure a female with his provision only.'' (Topic 83) \\ & ``So even if you are a short guy who builds a ton of muscle you will still be low status if when people look at you they know you are a bitch mentally. You can see it in their eyes \& mannerisms.'' (Topic 11) \\ \hline NRx & ``In every example, these cultures began to rise when women were required to be virgins at marriage and to be monogamous for life. All of these cultures began to decline when women were given rights, were not required to be virgins at marriage, when divorce was common, and marriage was in decline.'' (Topic 70) \\ & ``You know: destroy the family unit by injecting Marxist class warfare into sexual dynamics (e.g. women are the stand-in proletariat fighting for equal wages with the supposedly bourgeois men). Gender Studies is Socialism of the Sexes, and its just as full of corrupt bureaucrats carefully toeing the party line.'' (Topic 16) \\ & ``I personally think that white people had their reasons for their prejudice. Fact: Black people didn't build a sustainable culture long before the white man set foot on their land. Look at Detroit, which is mostly black.'' (Topic 3) \\ \end{tabularx} \vspace{0.3cm} \caption{Examples of topics drawn from the five major clusters of the linkage network. The Self-help and PUA clusters are primarily behavioral, and focus on the ways in which men ought to live their lives and how they ought to relate to others. Meanwhile, the Status and NRx clusters are more explanatory, focusing on argument-making and providing general and unifying accounts of many different phenomena. The MRA cluster is a mixture of behavioral and explanatory. \label{cluster_table}} \end{table} The {\bf self-help} cluster includes themes such as emotional self-control and stoicism (Topic 6), breaking addictions, including to pornography (Topic 48), and mental health (Topic 14), along with themes related to exercise and nutrition. The {\bf pickup-artist culture} (PUA) cluster includes discussion of ``game'' and how to approach women in bars and social contexts (Topic 28), on communicating in early stages of dating (Topic 38), and advice on body language and non-verbal communication (Topic 80). Broadly speaking, both of these clusters lie along the behavioral dimension of the Red Pill ideology. They are concerned with the details of how participants behave towards others and how they discipline their own bodies and minds to as to achieve right action. Taken together, they are about 28\% of all posts on the site. While the PUA cluster is strongly focused on the social contexts of young men, the third cluster is associated with an earlier, predecessor ideology, {\bf Men's Rights Activism} (MRA). It includes discussion of divorce law and alimony (Topic 60), single mothers and paternity (Topic 55), as well as subjects commonly associated with the MGTOW movement such as achieving financial freedom (Topics 74). The MRA cluster is the smallest in our data, consisting of only 7\% of all posts. The fourth cluster, ``{\bf hierarchy and status}'', is the largest in the system by total posts. It contains abstract and (pseudo) scientific discussion of evolutionary psychology (``pseudo-evo-psych''; Topic 17), the social hierarchy of ``alpha'' and ``beta'' males (Topic 78), and discussion of the sexual ``strategies'' that women use to attain high-status partners (Topic 83). It also contains more specific discussion of how to rate oneself, other men, and potential female sexual partners on the basis of (for example), height and body shape (Topic 11), visual appearance (Topic 41), or social status and wealth (Topic 40). Roughly 47\% of all posts are dominated by patterns from the status cluster. Finally, the fifth cluster contains ideas associated with {\bf neoreactionary politics} (NRx), a recently-identified political ideology connected to the contemporary alt-right movement~\citep{jones2019neoreactionary,lyons,sandifer2018neoreaction}. Dominant themes in the NRx cluster include the idea that women, as a group, are responsible for the decline of civilization (Topic 70), and that feminism is a collectivist ideology spread by a conspiracy of elites (Topic 16), as well as discussion of contemporary U.S. politics, including racial politics (Topic 3) and comparisons between different countries (Topic 62). NRx accounts for roughly 19\% of all posts. The Status and NRx clusters lie along the explanatory, sense-making dimension of the Red Pill ideology. Posts weighted on these word patterns tend to provide synthetic and systematic explanations for the way things are. They may make scientific arguments, or political arguments, that show how a number of distinct pieces of evidence connect together. NRx topics include explanations in terms of conspiracy theories (\emph{i.e.}, that attempt to explain major world events and features of society in terms of the secret actions of a malevolent group), while Status topics tend to focus on explanations in terms of a pseudo-scientific version of evolutionary psychology. The MRA cluster appears to be a mixture of the two. Some of the content is behavioral, and provides explicit instruction on how to manage finances, divorce, and parenting. Other content is explanatory, and tries to explain (for example) how the different ways that men feel oppression is driven by anti-male prejudice in society and the law. \subsection{Population Structure} \begin{figure} \includegraphics[width=0.95\linewidth]{hmm_final.pdf} \caption{Ideological formation online: the HMM for users from our longitudinal ``clean'' sample. A user starts at the ``enter/exit'' state, and then proceeds, with different probabilities, to one of seven different content patterns with different dwell times. Two patterns, labelled ``tourist'', are associated with very quick exits from the system; for example, 54\% of users who enter the system post content in the ``tourist 1'' pattern, and leave after, on average, just one post. Five styles, however, are associated with much longer-term residence. The ``NRx'' content pattern, for example, is far stickier; users will remain in the NRx posting style for an average of 13 posts before either exiting, or going on to (for example) post content associated with Men's Rights Activism, or Status. States are labelled according to the results of Table~\ref{types}, \emph{e.g.}, the user state associated with (significantly) above average posts from the self-help cluster is labelled ``self-help''. For visual clarity in this diagram, very weak transition probabilities are not shown. \label{hmm}} \end{figure} \begin{table} \begin{tabular}{l|l|l|l|l|l} & Self-Help & PUA & Status & MRA & NRx \\ \hline Self-Help State & {\bf +190\%} & -29\% & -33\% & -47\% & -36\% \\ PUA State & -10\% & {\bf +107\%} & +11\% & -8\% & -35\% \\ Status State & -24\% & -4\% & {\bf +48\%} & -15\% & -7\% \\ MRA State & -30\% & -25\% & -25\% & {\bf+179\%} & -17\% \\ NRx State & -49\% & -49\% & -37\% & -33\% & {\bf +62\%} \\ \end{tabular} \vspace{0.3cm} \caption{The relationship between resident type and posting content. For each state of the HMM (\emph{e.g.}, ``Self-Help State''), we show the probability of a post dominated by the semantics of the five clusters, relative to baseline. Broadly speaking, at any point in time, a resident user is predisposed towards one of the five semantic clusters shown in Fig.~\ref{text_level}; \emph{e.g.}, a user in what we call the ``self-help state'' is 190\% more likely to post content related to self-help, and 47\% less likely to post content related to Men's Rights Activism. \label{types}} \end{table} A visualization of the recovered Hidden Markov Model for user evolution is shown in Fig.~\ref{hmm}. The analysis reveals the existence of two distinct types of users, which we refer to as ``tourists'' and ``residents''. Tourists have low overall engagement with the system; they make only a few posts before leaving, in one of two possible posting patterns that matches the overall distribution of semantics on the system. The residents fall into five user types with distinct patterns of engagement; as shown in Table~\ref{types}, these roughly align with different parts of the linkage network. \begin{figure} \includegraphics[width=0.8\linewidth]{number_clean_cropped.pdf} \caption{Distribution of total numbers of posts for the tourist (blue) and resident (red) user types. Users who take the right-hand branch on Fig.~\ref{hmm} remain nearly twenty times longer (by median number of posts) compared to the ``tourists''. \label{num}} \end{figure} The HMM reveals a ``tourist--resident' structure, where most visitors (87\%) are ``tourists'' who have only casual interactions with the group; their posting patterns are consistent with sampling the content on the site at random and choosing one particular aspect of the content to imitate. Meanwhile, the remaining 13\% are ``residents'', who generate the majority of the content (62\% of all posts, and 65\% of all words). This can be seen in both the numbers of posts the different user types make; Fig.~\ref{num}. The vast majority of posters who stay longer than a few posts entered the system on the right-hand branch of Fig.~\ref{hmm}. \subsection{Ideological Formation} The HMM of Fig.~\ref{hmm} allows us to distinguish different modes of engagement with Red Pill ideology. It also allows us to determine which aspects of that ideology are ``appealing'' (\emph{i.e.}, characteristic of the initial engagement of a long-term resident) and which are ``sticky'' (\emph{i.e.}, characteristic of later behavior); as shown in Table~\ref{trans}, the most obvious pattern is a shift from the ``appealing'', behavioral content associated with self-help talk, and towards the ``sticky'' explanatory content of the status pattern. \begin{table}[h!] \begin{tabular}{l|l|l|l|l|l} State & Fraction & Fraction & Dwell Time & Residence & Next State \\ & (First) & (Overall) & (Posts) & (Months) & \\ \hline Self-Help & 30\% & 14\% & 8 & 7.9 & Exit (38\%), NRx (23\%), PUA (18\%) \\ PUA & 18\% & 18\% & 19 & 11 & Exit (36\%), Self-Help (36\%), MRA (17\%) \\ MRA & 13\% & 12\% & 10 & 7.8 & NRx (37\%), Exit (21\%), Status (16\%) \\ Status & 12\% & 32\% & 29 & 14 & NRx (34\%), Exit (26\%), MRA (19\%) \\ NRx & 27\% & 24\% & 13 & 8.1 & Exit (39\%), MRA (21\%), Status (20\%) \\ \end{tabular} \vspace{0.3cm} \caption{Relationships between the different resident patterns. For example, 30\% of residents are expected to begin in the self-help state; those in that state spend roughly eight posts there before, say, shifting over to NRx (23\% of the time), PUA (18\% of the time), or leaving the system entirely (38\% of the time). While the plurality of residents join the group as self-help users in the behavioral mode, those who stay either began with, or shift over to, more explanatory content, most notably ``Status'' and ``NRx''. ``Residence'' here is defined as the (median) observed total amount of time spent in the system by a user primarily associated with that state; for example, a user that posts primarily in the ``self-help'' pattern has a median residence time on the site of 7.9 months. \label{trans}} \end{table} The HMM also allows us to understand ideological formation, \emph{i.e.}, how users learn. Consider, for example, a user who begins in the self-help pattern. A user who remains in this pattern will (38\% of the time) leave the system, after roughly eight posts; however, 23\% of the time, the user will ``advance'' from the self-help pattern to the NRx pattern, where they will remain for roughly ten posts. At this point, they might exit (39\% of the time), or continue on to either the MRA pattern (21\% of the time), or the Status pattern (20\% of the time). In practice, these shifts have major impacts on user trajectories. For example, the median residence time of a user that begins in the ``self-help'' state is 7.9 months. However, if a user that begins in the self-help state shifts over to the explanatory NRx state, their median residence time nearly doubles, to 11.4 months. Adopting the Status pattern has the largest effect size of all; those who switch to the Status state increase their median residence time from 7.9 months to 18.5 months. We do not see a strong effect in the other direction; for example, a user that begins in the Status state has a median residence time of 14.0 months; if they switch to the self-help state, the median residence time rises, by a much smaller amount, to 14.8 months. The fact that ``self-help, then status'' has a longer residence time than ``status, then self-help'' points to a more complex psychological process where behavioral shifts can make the individual more susceptible to later explanatory indoctrination. \section{Discussion} Seen from the outside, the posts on an extremist forum can look like a confusing mix of in-group language and deliberately offensive, politically motivated trolls~\citep{nagle2017kill}. The first outcome of our work is to show how simple tools can bring order to this apparent chaos. Given a topic model where word patterns serve as a proxy for the semantics of the underlying ideas, the information theoretic concept of linkage can then reveal how different pieces of an ideology connect together into larger conceptual units. These results, in turn, provide support for a general ``two-dimensional'' account of ideology as a combination of distinct explanatory and behavioral modules. In the case of the Red Pill ideology, for example, some clusters we uncover are concerned with how members of the group are supposed act in the world, including (in the self-help cluster) their relationship to pornography use, eating, emotional regulation, and physical exercise, and (in the PUA cluster) how they ought to judge women as potential partners, and how to treat them when seeking romantic relationships. Other parts of the ideology are concerned with providing explanations for the way things are. These include the ideas about genetic differences between the races, theories about the role of women in the history of civilizations, and the existence of elite conspiracies that censor and conceal unpleasant truths (in the NRx cluster), the existences of biological imperatives, hardcoded into evolution, that force women to act in certain ways, and that make some men more worthy than others (in the Status cluster). The second outcome of our work concerns how newcomers interact with these groups. A simple model of individual-level behavior provides a rough division of newcomers into two populations, tourists and residents, with the first group sampling randomly and leaving quickly, and the second group showing more sustained and systematic engagement, with distinct preferences for different features of the ideology. This two-population model has important implications for the experience of the group itself: nine times out of ten, content is produced by a user who has had little interaction with the group, and will almost certainly leave soon after. Many of the same features that make online communities sources of concern for those tracking radicalization---low barriers to entry, the use of pseudonyms rather than real names, proximity to more ``ordinary'' content---also appear to flood these systems with the disengaged. The third outcome concerns how the newcomers who do persist navigate these ideas. Table~\ref{trans} provides the clearest insight into what attracts individuals in the short term, versus what leads them to persist and integrate further into the community. Our major result here is a contrast between, on the one hand, the wider appeal of the ideology's behavioral dimension, and, on the other, the power of explanatory content to draw users more deeply in. We suggest that a key feature of an ideology, and, at least in this first case study, the aspect that induces long-term and in-depth engagement, is what appeals to the ``sense-making'' drive~\citep{CHATER2016137,motiv}. In addition to helping us understand the relationship between behavioral and explanatory aspects of ideology, these results also help us understand the particular nature of extremist ideologies surrounding sex and gender. The central role played by the ``Status'' cluster, both in the overall semantics of the system and in how it serves to attract and retain users, confirms a key insight of work such as \cite{ging2019alphas}: that Red Pill ideology is concerned not just with the superiority of men over women, but also with explaining, and defining, the gradations in status and power between men. Similar points have also been made by \cite{manne} in her analysis of a prominent self-help book associated with the movement, and \cite{o2018seduction}'s fieldwork in (offline) ``seduction'' groups has noted the particular role that pseudo-evo-psych plays in justification and explanation. Status may not just be what keeps individuals within the ideology. It may also be what draws them towards violence. Status concerns are often, as both \cite{manne} and \cite{masc} note, significant motivating factors for young men who go on to shooting rampages; they also appear to be a basic preoccupation of men who engage in domestic violence~\citep{jukes2020men}. As \cite{quest} argue, the violence associated with extremist ideology is motivated by a ``quest for personal significance''; it may well be that social status serves this role in violence associated with sexist ideology. In this case, the status cluster seen in Fig.~\ref{text_level} connects the ideology to a theory of personal significance that could then serve as a motivation for violence~\citep{more_quest}. The linkage network of Fig.~\ref{text_level} also points to an intimate connection between sexist ideology and political theories associated with white supremacy and anti-Semitism, which confirms recent work by non-profit organizations on the intersection between these emergent sexist ideologies and older, more familiar traditions~\citep{adl,icct}. Indeed, misogyny itself---as an outcome of a ``particular'' sexist ideology such as that found on the Red Pill, or as a consequence of more ordinary forms of sexism---may be one of the links that connects extremist ideologies to political violence \citep{nyt}. A key question, for both scientists and policy makers, is the ways in which people are drawn in to extremist groups, and this work provides at least a partial answer. It also suggests that the same individuals may leave these groups when they become disenchanted by the explanations. This may be driven in part by engagement with individuals explicitly adopt a critical stance against the ideology; large-scale studies of these kinds of ``counter-speech'' may help us understand the underlying psychology of explanatory disenchantment and the different forms of argument-making that lead to it~\citep{garland2020impact}. There are many reasons why individuals will become disillusioned with an extremist ideology, and the process is a complex one particularly when it includes relationships in the offline world (see, \emph{e.g.}, \citealp{leaving}). In a world of online interactions, at least, explanatory disenchantment may play a central role in disillusionment and exit. \section*{Acknowledgements} We thank Hahrie Hahn, Henry Farrell, Kathleen Blee, Suresh Naidu, Joshua Garland, and others for helpful conversations. \clearpage
\section{Introduction} \subsection{Backgrounds} In the theory of unipotent dynamics on homogeneous spaces, a fundamental result is Ratner's theorems \cite{Rat91a, Rat91b} on measure rigidity, topological rigidity, and orbit equidistribution. They have numerous and diverse applications ranging from number theory to mathematical physics, see e.g. \cite{EMS98, EM04, EO06, Sha09, Sha10, Mrk10, MS10}. We refer the reader to \cite{Mor05} for expositions and references. A limitation of Ratner's results is that they do not tell us an explicit rate of density or equidistribution for unipotent orbits. As pointed out in \cite[Problem 7]{Mrg00}, establishing \textit{effective} versions of Ratner's results has been a central topic in homogeneous dynamics. We say that a subgroup $H\subset G$ is (unstable) horospherical if there exists an element $a\in G$ such that \eqlabel{horo1}{H=\set{g\in G: a^kga^{-k}\rightarrow e \quad\textrm{as}\quad k\to -\infty}.} For horospherical subgroups, effective equidistribution results have been established with a \textit{polynomially} strong error term \cite{KM96, KM12, Ven10, DKL16, KSW17, Shi19} using the mixing property of $a$ on $G/\Gamma$ and the so called ``thickening" method, originates in Margulis' thesis \cite{Mrg04}. We also refer the reader to the effective equidistribution results for horocycle orbits in $\operatorname{SL}_2(\mathbb{R})/\Gamma$ \cite{Sar81,Bur90,FF03,Str04,Str13} via direct representation-theoretic approaches. Here we state an effective equidistribution result of the horospherical orbits in a concrete setting as Theorem \ref{equX} below; it is closely related to the main results of the present paper. Let $G=\operatorname{SL}_d(\mathbb{R})$, $\Gamma=\operatorname{SL}_d(\mathbb{Z})$, and $X=G/\Gamma$ for fixed $d\ge 2$. Let $\{a_t\}< G$ be a 1-parameter diagonal subgroup $\mathrm{diag}{e^{nt}\operatorname{Id}_m,e^{-mt}\operatorname{Id}_n}$, where $\operatorname{Id}_m$ and $\operatorname{Id}_n$ are $m\times m$ and $n\times n$ identity matrices, respectively, and $m+n=d$. Then the horospherical subgroup for $a:=a_1$ in $G$ is indeed expressed as \eqlabel{horo2}{H=\set{\left(\begin{matrix} \operatorname{Id}_m& A\\ 0& \operatorname{Id}_n \end{matrix}\right)\in G: A\in \operatorname{Mat}_{m,n}(\mathbb{R})}.} We denote by $m_H$ the Haar measure of $H$ and $m_X$ the $G$-invariant probability measure on $X$. In \cite{KM96}, an effective equidistribution theorem of expanding horospherical translates in $X$ was established as follows. \begin{thm}\label{equX}\cite[Proposition 2.4.8]{KM96} Let $V\subset H$ be a fixed neighborhood of the identity in $H$ with smooth boundary and compact closure. Then there exists a constant $\delta_0>0$ only depending on $m$ and $n$ so that the following holds. For any compact set $K\subset X$, there exists a constant $T(K)\ge 0$ such that \begin{equation}\label{eeqx} \frac{1}{m_H(V)}\int_{V}f(a_tux)dm_H(u)=\int_X fdm_X+O(\mathcal{S}(f)e^{-\delta_0 t}) \end{equation} for any $t\ge T(K)$, $f\in C_c^{\infty}(X)$, and $x\in K$. Here, $\mathcal{S}$ is a suitable Sobolev norm of $C_c^{\infty}(X)$ and the implied constant depends only on $m$,$n$, and $V$. \end{thm} For non-horospherical subgroups, several effective equidistribution results have been proved in the last decade. When the ambient group $G$ is semisimple, an effective equidistribution theorem was established for closed orbits of semisimple group in general homogeneous spaces \cite{EMV09} (See also \cite{AELM20}), and was recently extended to the adelic setting \cite{EMMV20}. Also, effective results for non-horospherical unipotent subgroups are known in some concrete settings \cite{Mo12,LM14,SU15,Ubi16,CY19}. When $G$ is unipotent, \cite{GT12} settled effective equidistribution of polynomial orbits in nilmanifolds. In general, let $\hat{G}=G\ltimes W$ be the ambient group where $G$ is a semisimple group and $W$ is the unipotent radical of $\hat{G}$. If $\hat{G}$ is neither semisimple nor unipotent, the methods of the aforementioned results do not seem directly applicable for general homogeneous spaces. However, in special settings effective equidistribution results have been obtained e.g. \cite{Str15,BV16} for $\hat{G}=\operatorname{SL}_2(\mathbb{R})\ltimes\mathbb{R}^2$, \cite{SV20} for $\hat{G}=\operatorname{SL}_2(\mathbb{R})\ltimes(\mathbb{R}^2)^{\oplus k}$, and \cite{Pri18} for $\hat{G}=\operatorname{SL}_3(\mathbb{R})\ltimes\mathbb{R}^3$. The purpose of the present paper is to establish an effective equidistribution result for $\hat{G}=\operatorname{SL}_d(\mathbb{R})\ltimes\mathbb{R}^d$. \subsection{Main results} For fixed $d\ge 2$, denote \begin{align*} G&=\operatorname{SL}_d(\mathbb{R}),\quad \hat{G}=\operatorname{SL}_d(\mathbb{R})\ltimes \mathbb{R}^d,\\ \Gamma&=\operatorname{SL}_d(\mathbb{Z}),\quad \hat{\Gamma}=\operatorname{SL}_d(\mathbb{Z})\ltimes \mathbb{Z}^d=Stab_{\hat{G}}(\mathbb{Z}^d). \end{align*} We define $X=G/\Gamma$ and $Y=\hat{G}/\hat{\Gamma}$. It is sometimes convenient to view $\hat{G}$ as a subgroup of $\operatorname{SL}_{d+1}(\mathbb{R})$ by $\hat{G}=\set{\left(\begin{matrix} g& b\\ 0& 1 \end{matrix}\right): g\in \operatorname{SL}_d(\mathbb{R}), b\in \mathbb{R}^d}$. Then there exists a natural projection $\pi: Y\rightarrow X$ sending $\left(\begin{matrix} g& b\\ 0& 1 \end{matrix}\right)\hat{\Gamma}\in Y$ to $\left(\begin{matrix} g& 0\\ 0& 1 \end{matrix}\right)\Gamma\in X$. We denote by $W\simeq\mathbb{R}^d$ the unipotent radical of $\hat{G}$, which consists of all translations on $\mathbb{R}^d$. Since $W=\set{w(b):= \left(\begin{matrix} \operatorname{Id}_d& b\\ 0& 1 \end{matrix}\right): b\in\mathbb{R}^d}$ acts simply transitively on $\mathbb{R}^d$, we can identify $\hat{G}/W\simeq G$. We take a lift of the element $g\in G$ to $\hat{G}\subset \operatorname{SL}_{d+1}(\mathbb{R})$ given by $\left(\begin{matrix} g& 0\\ 0& 1 \end{matrix}\right)$ and by abuse of notation we denote it again by $g$. Following this notation, we have a relation $gw(b)=w(gb)g$ for $g\in G$ and $b\in\mathbb{R}^d$. For $g\Gamma\in X$ and $b\in\mathbb{R}^d$, $gw(b)\hat{\Gamma}$ is invariant under the integer translations of $b$. Thus, the fiber $\pi^{-1}(g\Gamma)$ can be seen as $\set{gw(b)\hat{\Gamma}\in Y: b\in\mathbb{T}^d}$. Let $\{a_t\}$ be a $1$-parameter diagonal subgroup of $G$ defined by $a_t=\mathrm{diag}{e^{nt}\operatorname{Id}_m,e^{-mt}\operatorname{Id}_n}$, $H$ be the unstable horospherical subgroup in $G$ for $a=a_1$, and $m_H$ be the Haar measure of $H$ as before. We remark that $H$ is a full horospherical subgroup in $G$, \emph{but not in} $\hat{G}$. We denote by $m_X$ the $G$-invariant probability measure on $X$ and $m_Y$ the $\hat{G}$-invariant probability measure on $Y$. Let $V\subset H$ be a fixed neighborhood of the identity in $H$ with smooth boundary and compact closure. For $y\in Y$ and $t\ge 0$, $a_tVy\subset Y$ is a lift of a piece of a full horospherical orbit $a_tVx\subset X$, where $x=\pi(y)\in X$. In this paper, we study the equidistibution of the expanding translates $\set{a_tVy}_{t\ge 0}$ in $Y$ as $t\to\infty$. For any positive integer $q$, set \eq{X_q:=\set{gw(b)\hat{\Gamma}\in Y: g\in G, b\in\mathbb{Q}^d, \mathbf{q}(b)=q},} where for any $b\in\mathbb{Q}^d$, $\mathbf{q}(b)$ denote its common denominator, i.e. the smallest $q\in\mathbb{N}$ such that $b\in q^{-1}\mathbb{Z}^d$. Clearly $X_q$ is a closed $G$-invariant subset of $Y$ for any $q$. We denote by $m_{X_q}$ the $G$-invariant probability measure on $X_q$. We start by discussing the \textit{ineffective} equidistribution of $\set{a_tVy}_{t\ge 0}$ in $Y$. For $y\in Y$ and $t\ge 0$, we denote by $\mu_{y,t}\in\crly{P}(Y)$ the normalized probability measure on the orbit $a_tVy$, i.e. $\mu_{y,t}(f):=\frac{1}{m_H(V)}\int_V f(a_tuy)dm_H(u)$ for any $f\in C_b(Y)$. The following equidistribution result is a special case of \cite[Thm. 1.4]{Sha96}: \eqlabel{irreq}{\mu_{y,t}\overset{\on{w}^*}{\longrightarrow} m_Y \quad \mbox{for all } y\notin\bigcup_{q\in\mathbb{N}}X_q,} \eqlabel{rateq}{\mu_{y,t}\overset{\on{w}^*}{\longrightarrow} m_{X_q}\quad \mbox{for all } y\in X_q,} as $t\to\infty$. We refer to \cite[proof of Thm. 5.2]{MS10} and \cite[§1.1]{Str15} for the proof and more detailed discussions. Here we just make a remark that the proof of \cite[Thm. 1.4]{Sha96} crucially relies on Ratner's measure classification theorem. The main result of the present paper is Theorem \ref{mainthm} below, which is an \textit{effective} refinement of \eqref{irreq}. Observe that the weak$^*$ limit of $\set{\mu_{y,t}}_{t\ge 0}$ is determined by the Diophantine properties of the initial point $y$. Also, the condition $y\notin\bigcup_{q\in\mathbb{N}}X_q$ in \eqref{irreq} is equivalent to $b\in\mathbb{T}^d\setminus\mathbb{Q}^d$, where $y=gw(b)\hat{\Gamma}$. Based on these observations, we can expect that the rate of convergence in \eqref{irreq} might also depend on the Diophantine properties of $y$, or equivalently that of $b$. We say that a vector $b\in\mathbb{T}^d$ is \textit{of (Diophantine) type} $M\ge 1$ if there exists $c>0$ such that $|b-\frac{\mathbf{p}}{q}|>cq^{-M}$ for all $q\in\mathbb{N}$ and $\mathbf{p}\in\mathbb{Z}^d$. We first state a simplified version of the main result. \begin{thm}\label{DioCor} Let $V\subset H$ be a fixed neighborhood of the identity in $H$ with smooth boundary and compact closure. Then there exists a constant $\delta>0$ only depending on $m$ and $n$ such that \begin{equation}\label{eeqDio} \frac{1}{m_H(V)}\int_{V}f(a_tuy)dm_H(u)=\int_Y fdm_Y+O\left(\mathcal{S}(f)e^{-\frac{\delta t}{M+1}}\right) \end{equation} for any $t\ge 0$, $f\in C_c^{\infty}(Y)$, and $y=gw(b)\hat{\Gamma}$, where $b\in\mathbb{T}^d$ is of Diophantine type $M$. Here, $\mathcal{S}$ is a suitable Sobolev norm of $C_c^{\infty}(Y)$ and the implied constant depends only on $m$,$n$,$V$, and $y$. \end{thm} More generally, in order to express the Diophantine properties of $b$ in a quantitative sense, let us define a function $\zeta:(\mathbb{T}^d\setminus\mathbb{Q}^d)\times\mathbb{R}^+\to\mathbb{N}$ by $$\zeta(b,T):=\min\set{N\in\mathbb{N}: \displaystyle\min_{1\leq q\leq N}\|qb\|_\mathbb{Z}\leq \frac{N^2}{T}},$$ where $\|\cdot\|_{\mathbb{Z}}$ denotes the supremum distance from $0\in\mathbb{T}^d$. We note that $\zeta$ is non-decreasing and has the following properties: \eqlabel{rescaling}{\zeta(b,cT)\leq \lceil c^{\frac{1}{2}}\zeta(b,T)\rceil,} \eqlabel{gammab}{\zeta(b,\|\gamma^{-1}\|_{\textrm{op}}^{-1}T)\leq\zeta(\gamma b,T)\leq\zeta(b,\|\gamma\|_{\textrm{op}}T),} \eqlabel{Dirichlet}{\zeta(b,T)\leq \lceil T^{\frac{d}{3d+1}}\rceil.} for any $\gamma\in\Gamma$ and $c>1$. Here $\|\cdot\|_{op}$ denotes the operator norm of $G$ w.r.t. the supremum norm on $\mathbb{R}^d$. The inequality \eqref{Dirichlet} is equivalent to Dirichlet's approximation theorem. \begin{thm}\label{mainthm} Let $V$ and $\mathcal{S}$ be as in Corollary \ref{DioCor}. Then there exists a constant $\delta'>0$ only depending on $m$ and $n$ such that \begin{equation}\label{eeqy} \frac{1}{m_H(V)}\int_{V}f(a_tuy)dm_H(u)=\int_Y fdm_Y+O\left(\mathcal{S}(f)\zeta(b,e^{\frac{nt}{2}})^{-\delta'}\right) \end{equation} for any $t\ge 0$, $f\in C_c^{\infty}(Y)$, and $y=gw(b)\hat{\Gamma}$ with $\|g\|\leq \zeta(b,e^{\frac{nt}{2}})^{\delta'}$ and $b\in\mathbb{T}^d$. Here, the implied constant depends only on $m$,$n$ and $V$. \end{thm} By definition of $\zeta$, we have \eqlabel{MDio}{\zeta(b,T)\gg T^{\frac{1}{M+1}}} for any $T>0$ and $b$ of Diophantine type $M$. Hence, Theorem \ref{mainthm} directly implies Theorem \ref{DioCor} with $\delta=\frac{n\delta'}{2}$. Str\"ombergsson \cite{Str15} proved Theorem \ref{mainthm} for $\operatorname{SL}_2(\mathbb{R})\ltimes\mathbb{R}^2/\operatorname{SL}_2(\mathbb{Z})\ltimes\mathbb{Z}^2$ using Fourier analysis and methods of from analytic number theory, and later Prinyasart \cite{Pri18} obtained an effective equidistribution result in $\operatorname{SL}_3(\mathbb{R})\ltimes\mathbb{R}^3/\operatorname{SL}_3(\mathbb{Z})\ltimes\mathbb{Z}^3$ building on similar methods. In particular, their proofs rely on delicate analysis on the explicit expressions of unitary representations of $\operatorname{SL}_2(\mathbb{R})$ or $\operatorname{SL}_3(\mathbb{R})$ and cancellations from Kloosterman sums. In order to prove Theorem \ref{mainthm} for arbitrary dimension $d\ge 2$, we will use a different approach from the previous works. The method in the present paper is \textit{geometric} in a sense that we do not rely on representation theoretic properties of the semisimple component $G=\operatorname{SL}_d(\mathbb{R})$. It proceeds via a geometric decomposition of $X=G/\Gamma$ and analysis on the Fourier coefficients of probability measures on $\mathbb{T}^d$. We will use the effective equidistribution result in $X$ (Theorem \ref{equX} above), and a strategy which is similar in spirit to the idea given in \cite{BFLM11}. \subsection{Sketch of the proof of Theorem \ref{mainthm}} We fix an initial point $y_0=g_0w(b_0)\hat{\Gamma}$ and let $\mu_t\in\crly{P}(Y)$ be the normalized probability measure on the orbit $a_tVy_0$, for any $t\ge 0$. Then Theorem \ref{mainthm} is equivalent to obtaining an upper bound of $|\mu_t(f)-m_Y(f)|$ for $f\in C_c^\infty(Y)$. For any $x\in X$, $\pi^{-1}(x)\subset Y$ can be identified with $\mathbb{T}^d$, so $Y$ is a torus bundle of $X$. Moreover, if we fix a fundamental domain $\mathcal{F}\subset G$ of $X$, any $y\in Y$ can be uniquely parametrized as $y=gw(b)\Gamma$, where $g\in\mathcal{F}$ and $b\in\mathbb{T}^d$. Hence, we have a bijective measurable map $y\mapsto(g\Gamma,b)$ between $Y$ and $X\times \mathbb{T}^d$. The projection to $X$ of this map is the canonical projection $\pi: Y\to X$. We denote by $\sigma:Y\to\mathbb{T}^d$ the projection to $\mathbb{T}^d$ of this map, which depends on the choice of $\mathcal{F}$. We first decompose the orbit $a_tVy_0\subset Y$ to small pieces so that each piece of orbit is approximately on the same fiber torus. To simplify notations assume that $b_0\in\mathbb{T}^d$ is of Diophantine type $M$. Let $\set{\omega_i}_{i\in I}$ be a partition of unity of $X$ such that each $\omega_i$ is supported on a ball $B^X(z_i,r)$, where $z_i\in X$, $r\asymp e^{-\frac{\kappa t}{M+1}}$, and $\kappa>0$ will be an appropriately chosen small constant. Then the measure $\mu_t$ is decomposed by $\sum_i \pi_*\mu_t(\omega_i)\mu_{t,\omega_i}$, where $\mu_{t,\omega_i}(f)=\pi_*\mu_t(\omega_i)^{-1}\int f\omega_i\circ\pi d\mu_t$. Considering $\mu_{t,\omega_i}$ as a measure on $B^X(z_i,r)\times \mathbb{T}^d$, we may also look at $\nu_{t,\omega_i}:=\sigma_*\mu_{t,\omega_i}$ which is a probability measure on $\mathbb{T}^d$ (approximating $\mu_{t,\omega_i}$ up to error $\ll r$). Hence to prove the effective equidistribution in $Y$, it is enough to show that for each $\omega$, the measure $\nu_{t,\omega}$ effectively equidistribute toward to the Lebesgue measure on the torus. In other words, it suffices to prove that any nontrivial Fourier coefficient $\widehat{\nu_{t,\omega}}(\mathbf{m}_0)$ is small for $\mathbf{m}_0\in\mathbb{Z}^d\setminus\set{0}$. Most of this paper will be devoted to prove the decay of nontrivial Fourier coefficients, Proposition \ref{Fourdecay}. Our basic approach to prove Proposition \ref{Fourdecay} is viewing the horospherical action in $Y$ as the combination of the horospherical action in $X$ and a discrete $\Gamma=\operatorname{SL}_d(\mathbb{Z})$-action on $\mathbb{T}^d$. For example, for $s\ge 0$, $u\in V$, and $x=g\Gamma\in X$ such that $g\in\mathcal{F}$, there uniquely exist $\xi_s(x,u)\in\mathcal{F}$ and $\gamma_s(x,u)\in\Gamma$ such that $a_sug=\xi_s(x,u)\gamma_s(x,u)$. Then for $y=gw(b)\hat{\Gamma}$, a point on the horospherical orbit $a_sVy$ is described by $a_suy=\xi_s(x,u)w(\gamma_s(x,u)b)\hat{\Gamma}$. Observe that the dynamics on the torus part is given by $\operatorname{SL}_d(\mathbb{Z})$-action. We already have an effective equidistribution result in $X$ thanks to \cite{KM96}: expanding horospherical translates in $X$ are polynomially effectively equidistributed by Theorem \ref{equX}. Our main argument to deal with the dynamics on the torus is inspired by \cite{BFLM11}, which proved a quantitative equidistribution result for $\operatorname{SL}_d(\mathbb{Z})$-random walk on the torus. Following the strategy of \cite{BFLM11} (see also \cite{HdS19,HLL20}), we will prove: \begin{enumerate} \item (Proposition \ref{mainprop}) If $|\widehat{\nu_{t,\omega}}(\mathbf{m}_0)|$ is large for $\mathbf{m}_0\in\mathbb{Z}^d\setminus\set{0}$, then for appropriately chosen $s<t$, we can find a measure $\nu\in\crly{P}(\mathbb{T}^d)$ such that $\nu\ll\nu_{t-s}$ and $\nu$ has a rich set of Fourier coefficients which are larger than a polynomial in $|\widehat{\nu_{t,\omega}}(\mathbf{m}_0)|$. \item (Proposition \ref{lowcon}) If the torus-coordinate $b_0\in\mathbb{T}^d$ of the initial point $y_0\in Y$ is not well-approximated by rationals of low denominator, then $\nu_{t-s}$ cannot be highly concentrated on a $\rho$-radius ball, i.e. $\nu_{t-s}(B^{\mathbb{T}^d}(p,\rho))\ll \rho^{2\kappa'}$ for any $p\in\mathbb{T}^d$, where $\rho\asymp e^{-\frac{\kappa''(t-s)}{M+1}}$ for an appropriately chosen constant $\kappa', \kappa''>0$. \end{enumerate} Then Proposition \ref{Fourdecay} is obtained from (1) and (2) as follows. Making use of \cite[Proposition 7.5.]{BFLM11} which is a quantitative analogue of Wiener's lemma, we deduce from Proposition \ref{mainprop} that if $|\widehat{\nu_{t,\omega}}(\mathbf{m}_0)|$ is large, then $\nu_{t-s}$ is highly concentrated, namely $\nu_{t-s}(B^{\mathbb{T}^d}(p,\rho))\gg \rho^{\kappa'}$ for some $p\in\mathbb{T}^d$ (Proposition \ref{highcon}). Combining this with Proposition \ref{lowcon}, we conclude that $|\widehat{\nu_{t,\omega}}(\mathbf{m}_0)|$ must be small if $b_0$ is not well-approximated by rationals of low denominator, i.e. Proposition \ref{Fourdecay}. We now briefly explain how to prove (1) and (2) above. In the setting of random walks as \cite{BFLM11}, the dynamics on $\mathbb{T}^d$ is determined by the law of the random walk. In the case of horospherical translates, the function $\gamma_s(x,u)$ defined above plays a similar role as the law of the random walk. Proposition \ref{key} describes the dynamics on $\mathbb{Z}^d$ induced by $\gamma_s(x,u)$, and is a crucial ingredient to prove both (1) and (2). It asserts that for any $\mathbf{m}\in\mathbb{Z}^d\setminus\set{0}$ and $x\in X$, the orbit $\gamma_s(x,u)^{tr}\mathbf{m}$ with respect to $u\in V$ is well-separated on $\mathbb{Z}^d$. For (1), the Fourier coefficient $\widehat{\nu_{t,\omega}}(\mathbf{m}_0)$ can be expressed as the average of Fourier coefficients at this $\Gamma^{tr}$-orbit, so well-separateness of such $\Gamma^{tr}$-orbit implies a rich set of large Fourier coefficients. Unlike \cite{BFLM11} which studied the random walk on a fixed torus, a technical difficulty in our setting is that the function $\gamma_s(x,u)$ and the fiber tori $\pi^{-1}(x)$ varies with the base point $x\in X$. For this reason we decompose the measure $\mu_{t-s}$ again with $r'\asymp re^{-3ds}$-radius balls in $X$ so that $\gamma_s(x,u)$ is stable with respect to $x$ in each balls. For (2), we have the well-separateness of the orbit $\gamma_{t-s}(x,u)^{tr}e_1$ from Proposition \ref{key}, and it deduces the well-separateness of the first coordinate of the orbit $\gamma_{t-s}(x,u)b_0$ under some Diophantine condition of $b_0$. It implies that the measure $\nu_{t-s}$ cannot be highly concentrated, so we obtain (2). An effective version of well-known Weyl's equidistribution criterion for an irrational rotation on the one-dimensional torus will be needed, and here is the place where we use the Diophantine properties of $b_0$. \vspace{5mm} \tb{Acknowledgments}. I would like to thank Manfred Einsiedler for numerous helpful suggestions and for pointing out mistakes in earlier drafts of this paper. I am also grateful to Taehyeong Kim and Seonhee Lim for many valuable conversations and their illuminative comments. \section{Preliminaries} Throughout this paper, we fix the dimension $d=m+n$, the diagonal group $a_t=\mathrm{diag}{e^{nt}Id_m,e^{-mt}Id_n}$, and the neighborhood $V\subset H$. We use the notation $\kappa_1,\kappa_2,\cdots$ to denote positive exponents that depend only on the dimensions $m,n$. We shall use the standard notation $A\ll B$ or $A=O(B)$ to mean that $A\leq CB$ for some constant $C>0$ that depends only on $m,n$ and $V\subset H$. We shall also write $A\asymp B$ to mean both $A\ll B$ and $B\ll A$. The notation $C_1,C_2,\cdots$ will denote positive constants that depend only on $m,n$ and $V$. \subsection{Metrics and norms} Let $\mathbf{d}^{\hat{G}}(\cdot,\cdot)$ be a right invariant Riemannian metric on $\hat{G}$. Then this metric induces metrics on $G$, $Y$, and $X$. We denote by $B^{\hat{G}}(\hat{g},r)$, $B^{G}(g,r)$, $B^{Y}(y,r)$, and $B^{X}(x,r)$ the ball with radius $r$ and the center $\hat{g}\in \hat{G}$, $g\in G$, $y\in Y$, and $x\in X$ with respect to the metric on $\hat{G}$, $G$, $Y$, $X$, respectively. Also, we set $\|g\|:=\displaystyle\max_{1\leq i,j\leq d}(|g_{ij}|,|(g^{-1})_{ij}|)$ for $g\in G$. Then for some constants $C_1,C_2>0$, we have (See \cite[§3.3]{EMV09}): \eqlabel{norm}{\|g^{-1}\|=\|g\|=\|g^{tr}\|,\quad\|g_1g_2\|\leq C_1\|g_1\|\|g_2\|,} \eqlabel{leftmetric}{\mathbf{d}^X(gx_1,gx_2)\leq C_2\|g\|^2\mathbf{d}^X(x_1,x_2),\quad \mathbf{d}^Y(gy_1,gy_2)\leq C_2\|g\|^2\mathbf{d}^Y(y_1,y_2)} for any $g\in G$, $x_1,x_2\in X$, $y_1,y_2\in Y$. For $v=(v_1,\cdots,v_d)\in\mathbb{R}^d$, we use the supremum norm $\|v\|=\displaystyle\max_{1\leq i\leq d}|v_i|$. We denote by $\|g\|_{\textrm{op}}$ the operator norm of $g\in G$ with respect to the supremum norm of $\mathbb{R}^d$. Then for some $C_3>1$, \eqlabel{opnorm}{\|gv\|\leq \|g\|_{\textrm{op}}\|v\|, \quad \|g\|_{\textrm{op}}\leq C_3\displaystyle\max_{1\leq i,j\leq d}(|g_{ij}|)\leq C_3\|g\|} for any $g\in G$ and $v\in\mathbb{R}^d$. \subsection{Compactness, height, and injectivity} For $x\in X$ we set: \begin{align*} \textrm{ht}(x)&\overset{\on{def}}{=}\sup\set{\|gv\|^{-1}: x=g\Gamma, v\in\mathbb{Z}^d\setminus\set{0}}\\ K(\epsilon)&\overset{\on{def}}{=}\set{x\in X: \textrm{ht}(x)\leq\epsilon^{-1}}. \end{align*} Note that $\textrm{ht}(x)\ge 1$ for all $x\in X$. By Mahler's compact criterion, $K(\epsilon)$ is a compact set of $X$ for all $\epsilon>0$. Moreover, one can show that \eqlabel{cspmsr}{m_X(X\setminus K(\epsilon))\asymp \epsilon^d} for $\epsilon>0$ by using the following Siegel's integral formula \cite{Sie45}: $$\int_X \tilde{f}dm_X=\int_{\mathbb{R}^d}fdm_{\mathbb{R}^d}$$ for any bounded any compactly supported function $f:\mathbb{R}^d\to\mathbb{R}_{\ge 0}$, where $\tilde{f}: X\to\mathbb{R}_{\ge 0}$ is the $\textit{Siegel transform}$ of $f$ defined by $\tilde{f}(g\Gamma)=\displaystyle\sum_{v\in g\mathbb{Z}^d\setminus\set{0}}f(gv)$. Applying the Siegel's integral formula with the characteristic function of $\epsilon$-radius ball centered at $0\in\mathbb{R}^d$, \eqref{cspmsr} follows. We also have the following estimate of the injectivity radius of $K(\epsilon)$ from \cite[Proposition 3.5]{KM12}. There exists a constant $C_4>0$ such that for any $0<r<\frac{1}{2}$ and $x\in K(C_4r^{\frac{1}{d}})$, the map $g\mapsto gx$ is injective on the ball $B^G(\operatorname{id},r)$ . In other words, there exist a bijective isometry between $B^G(\operatorname{id},r)x$ and $B^X(x,r)$. \subsection{Sobolev norms} Fix a basis $\mathcal{B}$ for the Lie algebra $\mathfrak{g}$ of $G$, and a basis $\hat{\mathcal{B}}$ for the Lie algebra $\hat{\mathfrak{g}}$ of $\hat{G}$ extended from $\mathcal{B}$. The basis $\mathcal{B}$ defines differentiation action of $\mathfrak{g}$ on $C_c^\infty(X)$ by $Zf(x)=\frac{d}{dt}f(\textrm{exp}(tZ)x)|_{t=0}$ for $f\in C_c^\infty(X)$ and $Z\in \mathcal{B}$. The differentiation action of $\hat{\mathfrak{g}}$ on $C_c^\infty(Y)$ is defined similarly. We denote by $\triangledown f$ the gradient vector field on $G$ with respect to the basis $\mathcal{B}$. Following \cite[§3.7]{EMV09}, we define $L^2$-Sobolev norms on $C_c^\infty(X)$ and $C_c^\infty(Y)$ for $k\in\mathbb{N}$ as $$\mathcal{S}^X_k(f)^2:=\displaystyle\sum_{\mathcal{D}}\|\textrm{ht}(x)^k\mathcal{D} f\|^2_{L^2},$$ $$\mathcal{S}^Y_k(f)^2:=\displaystyle\sum_{\mathcal{D}}\|\textrm{ht}(y)^k\mathcal{D} f\|^2_{L^2},$$ where $\mathcal{D}$ ranges over all monomials in $\mathcal{B}$, $\hat{\mathcal{B}}$ of degree $\leq k$, respectively. Let $l_0$ be an integer such that Theorem $\ref{equX}$ holds with the Sobolev norm $\mathcal{S}^X=\mathcal{S}^X_{l_0}$. Throughout this paper, we fix a sufficiently large integer $l\in\mathbb{N}$ and the corresponding $l$-th degree Sobolev norm $\mathcal{S}=\mathcal{S}^Y_l$ on $C^{\infty}_c(Y)$ with the following properties: for $f\in C^{\infty}_c(Y)$, \eqlabel{Sobol}{\mathcal{S}^X(\overline{f})\leq\mathcal{S}(f), \quad\|\mathcal{D} f\|_{L^{\infty}(Y)}\leq\mathcal{S}(f)} for $\mathcal{D}$ of degree $\leq d+2$. The function $\overline{f}\in C_c^{\infty}(X)$ is the average function over a fiber defined by $\overline{f}(x)=\int_{\pi^{-1}(x)}f(y)dm_{\pi^{-1}(x)}(y)$ for $x\in X$, where $m_{\pi^{-1}(x)}$ is the normalized Haar measure of $\pi^{-1}(x)$. Note that one can view $\pi^{-1}(x)$ and $m_{\pi^{-1}(x)}$ as the torus $\mathbb{T}^d$ and the Lebesgue measure on the torus. \subsection{Effective equidistribution in $X$ and measure estimates} Considering the dependence on the initial point $x_0\in X$, Theorem \ref{equX} indeed can be formulated as follows: there exists a constant $\kappa_1>0$ such that \eqlabel{equX'}{|\frac{1}{m_H(V)}\int_V f(a_tux_0)dm_H(u)-\int_X fdm_X|\ll \textrm{ht}(x_0)^{\kappa_1}\mathcal{S}^X(f)e^{-\delta_0 t}} for any $t>0$, $x_0\in X$ and $f\in C_c^{\infty}(X)$. Keeping track of the dependence on $x_0\in X$ in the proof of \cite{KM96}, one can check that the error bound polynomially depends on the injectivity radius of $x_0$, which also polynomially depends on $\textrm{ht}(x_0)$. Recall that $\mu_{y,t}$ denote the normalized orbit measure on $a_tVy\subset Y$, and $\pi_*\mu_{y,t}$ is the normalized horospherical orbit measure on $a_tVx\subset X$, where $x=\pi(y)$. Thus, \eqref{equX'} enables us to estimate the measure of a small ball in $X$ with respect to $\pi_*\mu_{y,t}$: there exist $0<\kappa_2\leq\frac{1}{2}$ such that for any $e^{-\kappa_2 t}<r<\frac{1}{2}$ and $x\in X(C_4r^{\frac{1}{d}})$, \eqlabel{ballest}{\pi_*\mu_{y,t}(B^X(x,r))\asymp r^{d^2-1}} if $\textrm{ht}(\pi(y))<e^{\kappa_2 t}$. This estimate is from the fact $m_X(B^X(x,r))\asymp r^{d^2-1}$ for $x\in X(C_4r^{\frac{1}{d}})$ and the use of \eqref{equX'} with an approximating function of $B^X(x,r)$. Also, we can estimate how much measure appears near the cusp with respect to $\pi_*\mu_{y,t}$. We may assume that $\kappa_2>0$ was taken sufficiently small so that for any $e^{-\kappa_2 t}<\epsilon<\frac{1}{2}$, \eqlabel{cuspest}{\pi_*\mu_{y,t}(X\setminus K(\epsilon))\asymp m_X(X\setminus K(\epsilon))\asymp \epsilon^d} if $\textrm{ht}(\pi(y))<e^{\kappa_2 t}$. For this estimate, we used \eqref{cspmsr} and \eqref{equX'} with an approximating function of $K(\epsilon)$. \subsection{The Horospherical subgroup} For the unstable horospherical subgruop $H<G$ and the fixed neighborhood of identity $V\subset H$, $a_tVa_{-t}$ can be considered as the $e^{(m+n)t}$-dilated set of $V$. Thus, we have $m_H(a_tVa_{-t})=e^{(m+n)mnt}m_H(V)$ for any $t\in \mathbb{R}$, since $\dim H=mn$. Also, this expanding property provides us an inductive structure of the measures of expanding translates $\set{\mu_{y,t}}_{t\ge 0}$ as follows, where $y$ is fixed. \begin{prop}\label{inductive} For any $0\leq s<t$, $u_0\in V$, $y\in Y$ and $f\in L^{\infty}(Y)$, we have $$\mu_{y,t}(f)=(a_su_0)_*\mu_{y,t-s}(f)+O(\|f\|_{L^\infty} e^{-(m+n)(t-s)}).$$ \end{prop} \begin{proof} First, we have \begin{align*} (a_su_0)_*\mu_{y,t-s}(f)&=\frac{1}{m_H(V)}\int_V f(a_su_0a_{t-s}uy)dm_H(u)\\ &=\frac{1}{m_H(V)}\int_V f(a_t(a_{-(t-s)}u_0a_{(t-s)})uy)dm_H(u). \end{align*} Denote by $\triangle$ the symmetric difference $A\triangle B=(A\setminus B)\cup (B\setminus A)$. Let $u'=a_{-(t-s)}u_0a_{(t-s)}$. Note that $a_{-(t-s)}Va_{(t-s)}$ is the $e^{(m+n)(t-s)}$-contracted set of $V$ and $u'\in a_{-(t-s)}Va_{(t-s)}$. Since $V$ has a smooth boundary, it follows that $m_H(u'V\triangle V)\ll e^{-(m+n)(t-s)}$. By a change of variable, we get \begin{align*} (a_su_0)_*\mu_{y,t-s}(f)&=\frac{1}{m_H(V)}\int_{u'V} f(a_tuy)dm_H(u)\\ &=\frac{1}{m_H(V)}\left(\int_{V} f(a_tuy)dm_H(u)+O(\|f\|_{L^\infty} m_H(u'V\triangle V))\right)\\ &=\mu_{y,t}(f)+O(\|f\|_{L^\infty} e^{-(m+n)(t-s)}). \end{align*} \end{proof} \subsection{A fundamental domain of $X=\operatorname{SL}_d(\mathbb{R})/\operatorname{SL}_d(\mathbb{Z})$}\label{subfund} We will fix a fundamental domain of $X$ in order to parametrize elements in $Y$. The standard Siegel domain has been commonly used as a fundamental domain of $\operatorname{SL}_d(\mathbb{R})/\operatorname{SL}_d(\mathbb{Z})$. For $d\ge 3$, the standard Siegel domains are a weak fundamental domain which allows finite numbers of $g$ satisfying $x=g\Gamma$ for fixed $x\in X$, but it is not sufficient for our purpose. To avoid technical complexity, we construct a strong fundamental domain $\mathcal{F}$ as follows in order to allow unique $g\in\mathcal{F}$ satisfying $x=g\Gamma$. We define a continuous function $F:G\to\mathbb{R}_{>0}$ by $$F(g)^2=\frac{(\sum_{i,j}|g_{ij}|^2)(\sum_{i,j}|(g^{-1})_{ij}|^2)}{\sum_{i,j}|g_{ij}|^2+\sum_{i,j}|(g^{-1})_{ij}|^2},$$ where $g_{ij}$'s are matrix components of $g\in \operatorname{SL}_d(\mathbb{R})$. Hereafter, we fix a connected fundamental domain $\mathcal{F}\subset G$ of $X$ which consists of every elements in $\set{g\in G: F(g)< F(g\gamma) \mbox{ for all } \gamma\in\Gamma}$ and properly chosen elements from its boundary. Denote by $\phi: G\to X$ the canonical projection. Then $\mathcal{F}$ satisfies the following properties. See Appendix for the concrete construction and the proofs. \begin{enumerate} \item For any $x\in X$, there uniquely exists $g\in \mathcal{F}$ such that $x=g\Gamma$. Moreover, we can define a measure-preserving map $\iota: X\to \mathcal{F}$ such that $\phi\circ \iota=\operatorname{id}_{X\to X}$ and $\iota|_{\phi(\mathcal{F}^\circ)}$ is continuous, where $\mathcal{F}^\circ$ denotes the interior of $\mathcal{F}$. We also have $m_G(\mathcal{F})=m_G(\mathcal{F}^\circ)=m_X(\phi(\mathcal{F}^\circ))=m_X(X)=1$. \item There exists $C_5>0$ such that for any $x\in X$, \eqlabel{iotaht}{\|\iota(x)\|\leq C_5\textrm{ht}(x)^{d-1}.} Hence, for any $\epsilon>0$, \eqlabel{fundest}{m_G(\set{g\in \mathcal{F}: \|g\|> \epsilon^{-1}})\leq m_X(\set{x\in X: \textrm{ht}(x)> C_5^{-\frac{1}{d-1}}\epsilon^{-\frac{1}{d-1}}})\leq C_6\epsilon^{\frac{d}{d-1}}} for some constant $C_6>0$ by \eqref{cspmsr}. \item For $r>0$ and $\epsilon>0$, let $\mathcal{F}(r,\epsilon):=\set{g\in\mathcal{F}: \textrm{ht}(g\Gamma)\leq \epsilon^{-1}, \textrm{dist}(g,\partial\mathcal{F})\ge r}$, where $\partial\mathcal{F}$ denotes the boundary of $\mathcal{F}$. Then there exist constants $0<\kappa_3\leq 1$ and $C_7>0$ satisfying \eqlabel{Fest}{m_G(\mathcal{F}\setminus \mathcal{F}(r,\epsilon))\leq C_7\max(r^{\kappa_3},\epsilon^d)} for any $r>0$ and $\epsilon>0$. \end{enumerate} \subsection{Parametrization of $Y$} For a point $y\in Y$, it is often convenient to view $y$ as a point on the fiber $\pi^{-1}(x)$, where $x=\pi(y)$. The fiber $\pi^{-1}(x)$ can be identified with the torus $\mathbb{T}^d$ by a map $b\mapsto gw(b)\hat{\Gamma}$, where $b\in\mathbb{T}^d$ and $g\in G$ with $x=g\Gamma$, but this mapping is depending on the choice of $g\in G$. For example, $gw(b)\hat{\Gamma}=(g\gamma^{-1})w(\gamma b)\hat{\Gamma}$ for any $\gamma\in \Gamma$. However, if we fix a fundamental domain, then we have a well-defined parametrization of $Y$. Throughout this paper, we fix $\mathcal{F}\subset G$ and $\iota$ as in §\ref{subfund}. For any $y\in Y$, there exists unique $b\in\mathbb{T}^d$ such that $y=\iota(\pi(y))w(b)\hat{\Gamma}$. Denote this map $y\mapsto b$ by $\sigma: Y\to \mathbb{T}^d$. Then we have a parametrization $y=\iota(\pi(y))w(\sigma(y))\hat{\Gamma}$. We remark that the map $\sigma$ is not defined canoncially unlike $\pi: Y\to X$ and depends on the choice of the fundamental domain $\mathcal{F}$. \subsection{A partition of unity of $X$} In this subsection, we will partition $X$ to small boxes, and construct a partition of unity of $X$ for given pameter of radius $0<r<\frac{1}{2}$. \begin{prop}\label{partition} Given $0<r<\frac{1}{2}$, there exists a set $\set{x_1,\cdots,x_{N_r}}\subset K(C_8 r^{\frac{1}{d}})$ with $N_r\asymp r^{-(d^2-1)}$ and a partition of unity $\set{\psi_{r,i}}_{i\in\mathcal{I}_r}$ of $X$ with $\mathcal{I}_r:=\set{1,\cdots,N_r}\cup\set{\infty}$ satisfying the following properties: \begin{itemize} \item $0\leq \psi_{r,i}\leq 1$ $\mbox{ for all } i\in\mathcal{I}_r$, \item $\mathds{1}_{B^X(x_i,r)}\leq\psi_{r,i}\leq\mathds{1}_{B^X(x_i,5r)}$ $\mbox{ for all } i\in\mathcal{I}_r\setminus\{\infty\}$, \item $\on{Supp}\psi_{r,\infty}\subseteq X\setminus K(C_8r^{\frac{1}{d}})$, \item $\displaystyle\sum_{i\in\mathcal{I}_r}\psi_{r,i}=\mathds{1}_X$, \item $\|\triangledown\psi_{r,i}\|_{L^\infty(X)}\leq C_9r^{-d^2}$ $\mbox{ for all } i\in\mathcal{I}_r\setminus\{\infty\}$ \end{itemize} for some constants $C_8, C_9>0$ which are not depending on $r$. \end{prop} \begin{proof} Take $\set{x_1,\cdots,x_{N_r}}$ to be a maximal $4r$-separated subset of $K(C_8r^{\frac{1}{d}})$, where $C_8:=5^{\frac{1}{d}}C_4$. Then for any $1\leq i\leq N_r$, the map $g\mapsto gx_i$ is injective on the ball $B^G(\operatorname{id},5r)$. We get a partition $\mathcal{P}_r=\set{P_i}_{i\in\mathcal{I}_r}$ of $X$ by letting $$P_i=B^X(x_i,4r)\setminus(\displaystyle\bigcup_{j=1}^{i-1}P_j\cup\displaystyle\bigcup_{j=i+1}^{N_r}B^X(x_j,2r))$$ for $1\leq i\leq N_r$ and $P_\infty=X\setminus\displaystyle\bigcup_{j=1}^{N_r}P_j$ inductively. Then for $1\leq i\leq N_r$, $B^X(x_i,2r)\subseteq P_i\subseteq B^X(x_i,4r)$ by the construction. Since $m_X(P_i)\asymp r^{d^2-1}$ for each $1\leq i\leq N_r$, we have $N_r\asymp r^{-(d^2-1)}$. To construct a partition of unity, choose a nonnegative smooth approximating function $\psi_r\in C_c^{\infty}(G)$ supported on $B^G(\operatorname{id},r)$ and satisfying $\int_G \psi_r(g) m_G(g)=1$. Moreover, it is also possible to take such $\psi_r$ to satisfy $\|\triangledown\psi_r\|_{L^\infty(X)}\leq C_9r^{-d^2}$ for some constant $C_9>0$ which is not depending on $r$. Then $\psi_{r,i}:=\psi_r*\mathds{1}_{P_i}$'s satisfy the desired properties. \end{proof} \section{Inductive structures of the measures of expanding translates} \subsection{Well-separateness of $\Gamma^{tr}$-orbit in $\mathbb{Z}^d$} For fixed $s>0$, we define two maps $\xi=\xi_s: X\times V\to\mathcal{F}$ and $\gamma=\gamma_s: X\times V\to\Gamma$ as follows: For any $x\in X$ and $u\in V$, there uniquely exist $\xi(x,u)\in\mathcal{F}$ and $\gamma(x,u)\in\Gamma$ such that \eqlabel{defgam}{a_su\iota(x)=\xi(x,u)\gamma(x,u)} by the definition of the fundamental domain $\mathcal{F}$. The map $\xi(x,u)$ encodes the projected orbit of $a_su$-action onto $X$ as $a_sux=\xi(x,u)\Gamma$. Also, the map $\gamma(x,u)$ describes the orbit of $a_su$-action on the fiber tori as in the following lemma. \begin{lem}\label{siggam} For any $y\in Y$ and $u\in V$, we have $\sigma(a_suy)=\gamma(x,u)\sigma(y)$, where $x=\pi(y)$. \end{lem} \begin{proof} It is a direct consequence from the definitions of $\sigma$ and $\gamma$: \begin{align*} \sigma(a_suy)&=\sigma(a_su\iota(x)w(\sigma(y))\hat{\Gamma})\\ &=\sigma(\xi(x,u)\gamma(x,u)w(\sigma(y))\hat{\Gamma})\\ &=\sigma(\xi(x,u)w(\gamma(x,u)\sigma(y))\hat{\Gamma})=\gamma(x,u)\sigma(y). \end{align*} \end{proof} For fixed $\mathbf{m}_0\in\mathbb{Z}^d\setminus\set{0}$, we define two maps $\mathbf{x}:X\times V\to\mathbb{R}^m$ and $\mathbf{y}:X\times V\to\mathbb{R}^n$ satisfying the following: \eqlabel{defxy}{(\xi(x,u)^{tr})^{-1}\mathbf{m}_0=\left(\begin{matrix} \mathbf{x}(x,u)\\ \mathbf{y}(x,u) \end{matrix}\right)\in\mathbb{R}^m\times\mathbb{R}^n.} \begin{lem}\label{Vxe} For $0<\epsilon\leq\frac{1}{2}$ and $x\in X$ denote by $V_{x,\epsilon}$ the set of elements $u\in V$ satisfying: \begin{enumerate} \item $\|\xi(x,u)\|<\epsilon^{-1},$ \item $\|\mathbf{x}(x,u)\|> \epsilon^2\|\mathbf{m}_0\|.$ \end{enumerate} If $\epsilon>e^{-\kappa_2 s}$ and $\textrm{ht}(x)<e^{\kappa_2 s}$, then $m_H(V\setminus V_{x,\epsilon})\leq C_{11}\epsilon^{\frac{\kappa_3}{2}}$ for some constants $C_{11}>0$. \end{lem} \begin{proof} We first estimate the measure of the subset violating (1). If $\|\xi(x,u)\|\ge\epsilon^{-1}$, then $\textrm{ht}(a_sux)=\textrm{ht}(\xi(x,u)\Gamma)\ge C_5^{-\frac{1}{d-1}}\epsilon^{-\frac{1}{d-1}}$ by \eqref{iotaht}, hence $a_sux\notin K(C_5^{\frac{1}{d-1}}\epsilon^{\frac{1}{d-1}})$. As we obtained the estimate \eqref{cuspest}, we have \eqlabel{cuspest'}{m_H\left(\set{u\in V: a_sux\notin K(C_5^{\frac{1}{d-1}}\epsilon^{\frac{1}{d-1}})}\right)\asymp \epsilon^{\frac{d}{d-1}}} if $\epsilon>e^{-\kappa_2 s}$, $\textrm{ht}(x)<e^{\kappa_2 s}$. Thus, $m_H(\set{u\in V: \|\xi(x,u)\|\ge\epsilon^{-1}})\ll \epsilon^{\frac{d}{d-1}}$. Now we estimate the measure of the subset satisfying (1) but violating (2). If $u\in V$ satisfies (1), then $\|(\xi(x,u)^{tr})^{-1}\mathbf{m}_0\|>C_3^{-1}\epsilon\|\mathbf{m}_0\|$. Assume from now on $\|\mathbf{x}(x,u)\|\leq \epsilon^2\|\mathbf{m}_0\|$. Therefore $\|\mathbf{y}(x,u)\|\gg\epsilon\|\mathbf{m}_0\|$. Moreover we can find some $h\in B^G(\operatorname{id},C_{10}\epsilon)$ so that $h(\xi(x,u)^{tr})^{-1}\mathbf{m}_0=h\left(\begin{matrix} \mathbf{x}(x,u)\\ \mathbf{y}(x,u) \end{matrix}\right)\in \set{\mb{0}_m}\times\mathbb{R}^{n}$, for some constant $C_{10}>1$. Let $\mathcal{M}:=\set{g\in G: (g^{tr})^{-1}\mathbf{m}_0\in\set{\mb{0}_m}\times\mathbb{R}^n}$, then $\xi(x,u)$ is in the $C_{10}\epsilon$-neighborhood of $\mathcal{M}$. Denote by $\mathcal{C}(\epsilon)\subset\mathcal{F}$ the intersection of this neighborhood and $\mathcal{F}$. It follows that $\xi(x,u)\Gamma\in\mathcal{C}(\epsilon)\Gamma$. We now need to get an upper bound of $m_X(\mathcal{C}(\epsilon)\Gamma)$. Note that $\epsilon^{\frac{1}{2}}$-neighborhood of $\mathcal{F}(\epsilon^{\frac{1}{2}}, C_4\epsilon^{\frac{1}{2d}})$ is still contained in $\mathcal{F}$. Since $\mathcal{M}$ is a $(d^2-m-1)$-dimensional analytic closed submanifold of $G$, we have $$m_G(\mathcal{C}(\epsilon)\cap \mathcal{F}(\epsilon^{\frac{1}{2}}, C_4\epsilon^{\frac{1}{2d}}))\ll (\epsilon^{\frac{1}{2}})^m m_G(\mathcal{C}(\epsilon^{\frac{1}{2}})\cap \mathcal{F}(\epsilon^{\frac{1}{2}}, C_4\epsilon^{\frac{1}{2d}}))\ll \epsilon^{\frac{m}{2}}.$$ On the other hand, by \eqref{Fest} we have $m_G(\mathcal{F}\setminus \mathcal{F}(\epsilon^{\frac{1}{2}}, C_4\epsilon^{\frac{1}{2d}})))\ll \epsilon^{\frac{\kappa_3}{2}}$. Therefore, we obtain $m_X(\mathcal{C}(\epsilon)\Gamma)=m_G(\mathcal{C}(\epsilon))\ll \epsilon^{\frac{m}{2}}+\epsilon^{\frac{\kappa_3}{2}}\ll \epsilon^{\frac{\kappa_3}{2}}$. We remark that the implied constant is uniform on the choice of $\mathbf{m}_0\in\mathbb{Z}^d\setminus\set{0}$ since $\mathcal{M}$ is determined by $\frac{\mathbf{m}_0}{|\mathbf{m}_0|}\in\mathbb{S}^{d-1}$ and $\mathbb{S}^{d-1}$ is compact. On the other hand, if $u\in V$ satisfies (1) and violates (2), then $a_sux=\xi(x,u)\Gamma\in \mathcal{C}(\epsilon)\Gamma\cap K(C_5^{\frac{1}{d-1}}\epsilon^{\frac{1}{d-1}})$. Let $f\in L^\infty(X)$ be the characteristic function on the set $\mathcal{C}(\epsilon)\Gamma\cap K(C_5^{\frac{1}{d-1}}\epsilon^{\frac{1}{d-1}})$ and $\psi_{\frac{\epsilon}{10}}\in C^\infty_c(X)$ be a nonnegative smooth approximating function on $B^G(\operatorname{id},\frac{\epsilon}{10})$ as defined in the proof of \ref{partition}. Applying \eqref{equX'} with $f*\psi_{\frac{\epsilon}{10}}$ as we obtained \eqref{ballest}, we have \begin{align*} &m_H\left(\set{u\in V: a_sux\in \mathcal{C}(\epsilon)\Gamma\cap K(C_5^{\frac{1}{d-1}}\epsilon^{\frac{1}{d-1}})}\right)\\&\qquad\qquad\qquad \asymp m_X\left(\mathcal{C}(\epsilon)\Gamma\cap K(C_5^{\frac{1}{d-1}}\epsilon^{\frac{1}{d-1}})\right)\ll\epsilon^{\frac{\kappa_3}{2}} \end{align*} if $\epsilon>e^{-\kappa_2 s}$ and $\textrm{ht}(x)<e^{\kappa_2 s}$. \end{proof} The following density property of $\gamma(x,u)^{tr}$-orbit of $\mathbf{m}_0\in\mathbb{Z}^d$, where $x$ and $\mathbf{m}_0$ are fixed, is a key ingredient to obtain an effective equidistribution on fiber tori. \begin{prop}\label{key} Let $s>0$ and $\mathbf{m}_0\in\mathbb{Z}^d\setminus\set{0}$. For any $e^{-\kappa_2 s}\leq\epsilon\leq\frac{1}{2}$ and $x\in X$ with $\textrm{ht}(x)<e^{\kappa_2 s}$, let $V_{x,\epsilon}$ be the set as in Lemma \ref{Vxe}. Then \begin{enumerate} \item $\set{\gamma(x,u)^{tr}\mathbf{m}_0\in \mathbb{Z}^d: u\in V_{x,\epsilon}}\subseteq B^{\mathbb{Z}^d}(0,R)$,\\ where $R=C_{13}\epsilon^{-1}\textrm{ht}(x)^{d-1}\|\mathbf{m}_0\|e^{ns}$, \item For any $\mathbf{m}\in\mathbb{Z}^d$, $$m_H(\set{u\in V_{x,\epsilon}: \gamma(x,u)^{tr}\mathbf{m}_0=\mathbf{m}})\leq C_{14}\epsilon^{-3n}e^{-dns}$$ \end{enumerate} for some constants $C_{13}, C_{14}>1$. \end{prop} We remark that the estimate in this proposition is \textit{tight} in the following sense: If we consider $\epsilon$ and $\textrm{ht}(x)$ as constants, as the points $\gamma(x,u)^{tr}\mathbf{m}_0$ belongs to $B^{\mathbb{Z}^d}(0,R)$ and the latter contains $\asymp R^d$ points, the estimate in (2) is compatible with each $\mathbf{m}\in B^{\mathbb{Z}^d}(0,R)$ obtaining the same weight $R^{-d}\asymp e^{-dns}$. In other words, roughly speaking, Proposition \ref{key} asserts that the orbit $\gamma(x,u)^{tr}\mathbf{m}_0$ is well-distributed on $B^{\mathbb{Z}^d}(0,R)$ if $e^{ns}$ is much bigger than $\epsilon^{-1}$ and $\textrm{ht}(x)$. \begin{proof} Recall that there is the canonical measure-preserving bijection $\varphi$ between $M_{m,n}(\mathbb{R})$ and $H$ defined by $\varphi(A)=\left(\begin{matrix} \operatorname{Id}_m & A\\ 0 & \operatorname{Id}_n\end{matrix}\right)$. Since $V$ is a neighborhood of identity with compact closure, there exists a constant $C_{12}>1$ such that $\varphi(B^{\mathbb{R}^{mn}}(0,C_{12}^{-1}))\subseteq V\subseteq \varphi(B^{\mathbb{R}^{mn}}(0,C_{12}))$. Note also that $\|u\|\leq C_{12}$ for any $u\in V$. (1) Recall that we have $\|\iota(x)\|\leq C_5\textrm{ht}(x)^{d-1}$, $\|\xi(x,u)\|\leq \epsilon^{-1}$, $\|u\|\leq C_{12}$, and $\|a_s\|_{\textrm{op}}=e^{ns}$. By the definition of $\xi$ and $\gamma$ we have a relation $\xi(x,u)^{-1}a_su\iota(x)=\gamma(x,u)$. Hence, \begin{align*} \|\gamma(x,u)^{tr}\mathbf{m}_0\|&=\|\iota(x)^{tr}u^{tr}a_s^{tr}(\xi(x,u)^{tr})^{-1}\mathbf{m}_0\| \\ &=\|\iota(x)^{tr}\|_{\textrm{op}}\|u^{tr}\|_{\textrm{op}}\|a_s^{tr}\|_{\textrm{op}}\|(\xi(x,u)^{tr})^{-1}\|_{\textrm{op}}\|\mathbf{m}_0\|\\ &\leq C_3^3\|\iota(x)\|\|u\|\|a_s\|_{\textrm{op}}\|\xi(x,u)\|\|\mathbf{m}_0\|\\ &\leq C_3^3C_5C_{12}\epsilon^{-1}\textrm{ht}(x)^{d-1}\|\mathbf{m}_0\|e^{ns}. \end{align*} (2) The equation $\gamma(x,u)^{tr}\mathbf{m}_0=\mathbf{m}$ can be written \eqlabel{meqn}{a_s^{tr}(\xi(x,u)^{tr})^{-1}\mathbf{m}_0=(u^{tr})^{-1}(\iota(x)^{tr})^{-1}\mathbf{m}.} Let $v_{+}\in\mathbb{R}^m$ and $v_{-}\in\mathbb{R}^n$ be the vectors such that $\left(\begin{matrix} v_{+}\\ v_{-}\end{matrix}\right)=(\iota(x)^{tr})^{-1}\mathbf{m}$. Here, $v_{+}$ and $v_{-}$ are only depending on $\mathbf{m}$, not on $u$. For any $A\in \varphi^{-1}(V)$, by a straightforward computation we have \eqlabel{Aeqn}{ \begin{aligned} (u^{tr})^{-1}(\iota(x)^{tr})^{-1}\mathbf{m}&=\left(\begin{matrix} v_{+}\\ -A^{tr}v_{+}+v_{-}\end{matrix}\right), \end{aligned}} where $u=\varphi(A)$. On the other hand, the left hand side of \eqref{meqn} is equal to $\left(\begin{matrix} e^{ns}\mathbf{x}(x,u)\\ e^{-ms}\mathbf{y}(x,u)\end{matrix}\right)$. Combining this with \eqref{Aeqn}, if $u=\varphi(A)$ is a solution of \eqref{meqn}, then \eqlabel{strip}{ \begin{aligned} \|A^{tr}v_{+}-v_{-}\|\leq e^{-ms}\|\mathbf{y}(x,u)\|. \end{aligned} } If $u\in V_{x,\epsilon}$, we have $\|\mathbf{x}(x,u)\|> \epsilon^{2}\|\mathbf{m}_0\|$ and $$\|\mathbf{y}(x,u)\|\leq \|(\xi(x,u)^{tr})^{-1}\mathbf{m}_0\|\leq C_3\|\xi(x,u)\|\|\mathbf{m}_0\|\leq C_3\epsilon^{-1}\|\mathbf{m}_0\|$$ by \eqref{defxy} and the definition of $V_{x,\epsilon}$ in Lemma \ref{Vxe}. Moreover, $\|v_{+}\|>\epsilon^{2}\|\mathbf{m}_0\|e^{ns}$ since $v_{+}=e^{ns}\mathbf{x}(x,u)$. To sum up, a solution $u=\varphi(A)$ must be in a thin tube $\set{A\in M_{m,n}(\mathbb{R}): \|A^{tr}v_{+}-v_{-}\|\leq C_3\epsilon^{-1}\|\mathbf{m}_0\|e^{-ms}}$, where $\|v_{+}\|>\epsilon^{2}\|\mathbf{m}_0\|e^{ns}$. We can consider $A$ as in the Euclidean space $\mathbb{R}^{mn}$, then the volume of the intersection of this tube and the ball $B^{\mathbb{R}^{mn}}(0,C_{12})$ is \\$\ll \left(C_{12}^{-1}\|v_{+}\|^{-1}(C_3\epsilon^{-1}\|\mathbf{m}_0\|e^{-ms})\right)^n\ll \epsilon^{-3n}e^{-dns}$. Therefore, for any $\mathbf{m}\in\mathbb{Z}^{d}$, the $m_H$-measure of the set of $u\in V_{x,\epsilon}$ satisfying $\gamma_x(u)^{tr}\mathbf{m}_0=\mathbf{m}$ is less than $C_{14}\epsilon^{-3n}e^{-dns}$ for some constant $C_{14}>1$. \end{proof} \subsection{A relation between Fourier coefficients of measures} In this subsection, we explore a relation between $\mu_{y_0,t}$ and $\mu_{y_0,t-s}$, which are two probability measure of expanding translates of $y_0$, and their Fourier coefficients via Proposition \ref{inductive}, where $y_0\in Y$ and $0<s<t$. We start with the following lemma. \begin{lem}\label{stab} Let $s>C_{15}$, $0<r\leq\frac{1}{2}$ and $r':=re^{-3ds}$ for some constant $C_{15}>0$. For $x\in X$ and $u\in V$, suppose that $\iota(x)\in\mathcal{F}(6r',6r')$ and $\xi(x,u)\in\mathcal{F}(r,r^{\frac{1}{d-1}})$. If $\mathbf{d}^X(x,x')<5r'$, then $\mathbf{d}^X(a_sux,a_sux')\leq C_{16}re^{-ds}$ and $\gamma(x,u)=\gamma(x',u)$ for some constant $C_{16}>0$. \end{lem} \begin{proof} Recall that \begin{align*} &a_su\iota(x)=\xi(x,u)\gamma(x,u),\\ &a_su\iota(x')=\xi(x',u)\gamma(x',u). \end{align*} Since $\iota(x)$ is in $\mathcal{F}(6r',6r')$, $\iota$ is an isometry on $B^X(x,5r')$, so $\mathbf{d}^G(\iota(x),\iota(x'))=\mathbf{d}^X(x,x')<5r'$. Using $\|a_s\|=\max(e^{ms},e^{ns})\leq e^{ds}$ and $\|u\|\leq C_{12}$, we have \eqlabel{xidist'}{\mathbf{d}^G(a_su\iota(x),a_su\iota(x'))\leq C_1C_2C_{12}\|a_s\|^2\mathbf{d}^G(\iota(x),\iota(x'))\leq C_{16}re^{-ds},} where $C_{16}:=5C_1C_2C_{12}$. Since $a_su\iota(x)=\xi(x,u)$ is in $\mathcal{F}(r,r^{\frac{1}{d-1}})$, \eqlabel{xidist''}{\mathbf{d}^G(a_su\iota(x),a_su\iota(x'))\ge \mathbf{d}^X(\xi(x,u)\Gamma, \xi(x',u)\Gamma)=\mathbf{d}^G(\xi(x,u),\xi(x',u)).} Combining \eqref{xidist'} and \eqref{xidist''}, we get \eqlabel{xidist'''}{\mathbf{d}^G(\xi(x,u),\xi(x',u))\leq C_{16}re^{-ds}.} Moreover, $\mathbf{d}^X(a_sux,a_sux')\leq C_{16}re^{-ds}$ from \eqref{xidist'}, and \eqlabel{xidist4}{ \begin{aligned} \mathbf{d}^G(\gamma(x,u),\gamma(x',u))&=\mathbf{d}^G(\xi(x,u)^{-1}a_su\iota(x),\xi(x',u)^{-1}a_su\iota(x'))\\ \leq \mathbf{d}^G(\xi(x,u&)^{-1}a_su\iota(x),\xi(x,u)^{-1}a_su\iota(x'))\\ &+\mathbf{d}^G(\xi(x,u)^{-1}a_su\iota(x'),\xi(x',u)^{-1}a_su\iota(x'))\\ \leq C_2\|\xi(x,u&)\|\mathbf{d}^G(a_su\iota(x),a_su\iota(x'))+\mathbf{d}^G(\xi(x,u)^{-1},\xi(x',u)^{-1}), \end{aligned}} using the right-invariance of $\mathbf{d}^G$ in the last inequality. From \eqref{iotaht} and $\xi(x,u)\in\mathcal{F}(r,r^{\frac{1}{d-1}})$ we have $\|\xi(x,u)\|\leq C_5r^{-1}$. By \eqref{xidist'} and \eqref{xidist'''}, the last line of \eqref{xidist4} is bounded by $C_2C_5C_{16}e^{-ds}+C_{16}re^{-ds}<\frac{1}{100}$ if $s$ is bigger than some constant $C_{15}>0$. We deduce $\gamma(x,u)=\gamma(x',u)$ from this since $\Gamma$ is a discret subgroup of $G$. \end{proof} For $t>0$, let $0<s<\frac{\kappa_2}{10d}t$ and $e^{-\kappa_2 s}<r<\frac{1}{2}$ so that $r'=re^{-3ds}>e^{-\frac{\kappa_2}{2}t}$. In the rest of this paper, we fix $y_0\in Y$ with $\textrm{ht}(\pi(y_0))<e^{\frac{\kappa_2}{2}t}$ and denote $\mu_t:=\mu_{y_0,t}$ and $\mu_{t-s}:=\mu_{y_0,t-s}$ for simplicity. In this section, we also fix a partition of unity $\set{\psi_j}_{j\in\mathcal{J}}$ using Proposition \ref{partition} with a radius $r'$, where $\mathcal{J}=\set{1,\cdots,N_{r'}}\cup\set{\infty}$ and $N_{r'}\asymp (r')^{-(d^2-1)}$. Let $\set{x_1,\cdots,x_{N_{r'}}}$ be the corresponding $4r'$-separated set as in Proposition \ref{partition}. For $z\in X$ with $\textrm{ht}(z)<e^{\frac{\kappa_2}{2} t}$ and $\omega\in C_c^{\infty}(X)$ such that $\mathds{1}_{B^{X}(z,r)}\leq\omega\leq\mathds{1}_{B^{X}(z,5r)}$ and $\|\triangledown\omega\|_{L^{\infty}(X)}\leq C_9r^{-d^2}$, let $\mu_{t,\omega}$ be the probability measure on $Y$ defined by \eqlabel{omdef}{\mu_{t,\omega}(f):=\pi_*\mu_t(\omega)^{-1}\int_Y \omega\circ\pi(y)f(y)d\mu_t(y).} Note that $\pi_*\mu_t(B^X(z,r))\leq\pi_*\mu_t(\omega)\leq\pi_*\mu_t(B^X(z,5r))$ and $\kappa_2>0$ was taken to be sufficiently small so that we can apply \eqref{ballest}, hence we have \eqlabel{ommsr}{C_{17}^{-1}r^{d^2-1}\leq\pi_*\mu_t(\omega)\leq C_{17}r^{d^2-1}} for some $C_{17}>1$. For $1\leq j\leq N_{r'}$, let $\mu_{t-s,j}$ be the probability measure on $Y$ defined by \eqlabel{jdef}{\mu_{t-s,j}(f):=\alpha_j^{-1}\int_Y \psi_j\circ\pi(y)f(y)d\mu_{t-s}(y),} where $\alpha_j:=\mu_{t-s}(\psi_j\circ\pi)$. We can apply \eqref{ballest} again since $r'>e^{-\frac{\kappa_2}{2}t}>e^{-\kappa_2(t-s)}$. Hence, we have \eqlabel{jmsr}{C_{18}^{-1}(r')^{d^2-1}\leq\alpha_j\leq C_{18}(r')^{d^2-1},\quad \forall 1\leq j\leq N_{r'}} for some $C_{18}>1$. Taking push-forward of these measures under $\sigma: Y\to\mathbb{T}^d$, we define probability measures on the torus as follows: \eqlabel{nudef}{ \begin{aligned} &\nu_t:=\sigma_*\mu_t, \quad \nu_{t,\omega}:=\sigma_*\mu_{t,\omega}\\ &\nu_{t-s}:=\sigma_*\mu_{t-s}, \quad \nu_{t-s,j}:=\sigma_*\mu_{t-s,j}, \quad 1\leq j\leq N_{r'}. \end{aligned}} We now observe the relation between $\widehat{\nu_{t,\omega}}$ and $\widehat{\nu_{t-s,j}}$'s. The following proposition is the main purpose of this section. \begin{prop}\label{mainprop} Let $t>0$, $C_{15}<s\leq\kappa_4 t$, $e^{-\kappa_4 s}\leq r\leq \frac{1}{2} $, $r'=re^{-3ds}$, $e^{-\kappa_4 s}\leq\epsilon\leq\frac{1}{2} $ and $\mathbf{m}_0\in\mathbb{Z}^d\setminus\set{0}$, where $\kappa_4:=\min(\frac{\kappa_2}{10d},2\kappa_3)$. For $\iota(z)\in \mathcal{F}(10r,C_8r^{\frac{1}{d}})$, let $\omega\in C^\infty_c(X)$ be a function satisfying $\mathds{1}_{B^{X}(z,r)}\leq\omega\leq\mathds{1}_{B^{X}(z,5r)}$ and $\|\triangledown\omega\|_{L^{\infty}(X)}\leq C_9r^{-d^2}$ as above. For some constants $C_{19}, C_{22}>0$, if $|\widehat{\nu_{t,\omega}}(\mathbf{m}_0)|\ge C_{19}r^{-(d^2-1)}\epsilon^{\frac{\kappa_3}{2}}$, then there exists $\mathcal{J}'\subseteq\mathcal{J}\setminus\set{\infty}$ with $|\mathcal{J}'|\ge\frac{|\mathcal{J}|}{3}$ and $$\left|\set{\mathbf{m}\in B^{\mathbb{Z}^d}(R): |\widehat{\nu}(\mathbf{m})|\ge\eta}\right|>\eta^3|B^{\mathbb{Z}^d}(0,R)|,$$ where $\nu:=\frac{1}{|\mathcal{J}'|}\displaystyle\sum_{j\in\mathcal{J}'}\nu_{t-s,j}\in\crly{P}(\mathbb{T}^d)$, $\eta:=C_{22}\epsilon^{d^2+3n+\frac{\kappa_3}{2}}\|\mathbf{m}_0\|^{-d}$, and $R=C_{13}\epsilon^{-d}\|\mathbf{m}_0\|e^{ns}$. \end{prop} \begin{remark}\label{rmk} Note that $\nu\leq C_{23}\nu_{t-s}$ for some $C_{23}>0$. Since $|\mathcal{J}'|\asymp|\mathcal{J}|\asymp (r')^{-(d^2-1)}$ and $\alpha_j\asymp (r')^{d^2-1}$ for all $1\leq j\leq N_{r'}$, we have $$\nu=\frac{1}{|\mathcal{J}'|}\displaystyle\sum_{j\in\mathcal{J}'}\nu_{t-s,j}\ll\displaystyle\sum_{j\in\mathcal{J}'}\alpha_j\nu_{t-s,j}\leq \displaystyle\sum_{j\in\mathcal{J}}\alpha_j\nu_{t-s}=\nu_{t-s}.$$ \end{remark} \begin{proof} From the definitions \eqref{omdef} and \eqref{nudef}, \eqlabel{est1}{\begin{aligned} \widehat{\nu_{t,\omega}}(\mathbf{m}_0)&=\int_{\mathbb{T}^d}e^{-2\pi i\mathbf{m}_0\cdot b}d\nu_{t,\omega}(b)\\ &=\int_Y e^{-2\pi i \mathbf{m}_0\cdot \sigma(y)}d\mu_{t,\omega}(y)\\ &=\pi_*\mu_t(\omega)^{-1}\int_Y \omega\circ\pi(y)e^{-2\pi i\mathbf{m}_0\cdot\sigma(y)}d\mu_t(y). \end{aligned}} Recall that for any $f\in L^{\infty}(Y)$, $$\mu_t(f)=\frac{1}{m_H(V)}\int_V (a_su)_*\mu_{t-s}(f)dm_H(u)+O(\|f\|_{L^\infty(Y)}e^{-(m+n)(t-s)})$$ from Proposition \ref{inductive}. Applying this to \eqref{est1} and integrating over $V$, \eqlabel{est2}{\begin{aligned} &\widehat{\nu_{t,\omega}}(\mathbf{m}_0)=\frac{\pi_*\mu_t(\omega)^{-1}}{m_H(V)}\int_V\int_Y \omega(a_su\pi(y))e^{-2\pi i\mathbf{m}_0\cdot \sigma(a_suy)}d\mu_{t-s}(y)dm_H(u)\\&\qquad\qquad+O(\pi_*\mu_t(\omega)^{-1}e^{-(m+n)(t-s)})\\ &=\frac{\pi_*\mu_t(\omega)^{-1}}{m_H(V)}\displaystyle\sum_{j\in\mathcal{J}}\int_V\int_Y \omega(a_su\pi(y))\psi_j(\pi(y))e^{-2\pi i\mathbf{m}_0\cdot \sigma(a_suy)}d\mu_{t-s}(y)dm_H(u)\\&\qquad\qquad+O(\pi_*\mu_t(\omega)^{-1}e^{-(m+n)(t-s)}). \end{aligned}} Let $\mathcal{J}_{int}\subset\mathcal{J}$ be the set of $j\in\mathcal{J}$ such that $\iota(x_j)\in \mathcal{F}(6r',\epsilon)$. Here, $\epsilon^d\gg (r')^{\kappa_3}$ since we are assuming $\epsilon\ge e^{-\kappa_4 s}\ge e^{-2\kappa_3 s}$. Then we have $m_G(\mathcal{F}\setminus\mathcal{F}(7r',\frac{\epsilon}{2}))\ll \epsilon^d$ from $\eqref{Fest}$. For any $j\in\mathcal{J}\setminus \mathcal{J}_{int}$, each $\iota(B^X(x_j,r'))$ is in $\mathcal{F}\setminus\mathcal{F}(7r',\frac{\epsilon}{2})$ and has $m_G$-measure $\asymp (r')^{d^2-1}$. Thus, $|\mathcal{J}\setminus\mathcal{J}_{int}|\ll \epsilon^d(r')^{-(d^2-1)}$ since $\iota(B^X(x_j,r'))$'s are disjoint. It follows that \eqlabel{est3}{\begin{aligned} &\frac{\pi_*\mu_t(\omega)^{-1}}{m_H(V)}\left|\displaystyle\sum_{j\in\mathcal{J}\setminus\mathcal{J}_{int}}\int_V\int_Y \omega(a_su\pi(y))\psi_j(\pi(y))e^{-2\pi i\mathbf{m}_0\cdot \sigma(a_suy)}d\mu_{t-s}(y)dm_H(u)\right|\\ &\leq\frac{\pi_*\mu_t(\omega)^{-1}}{m_H(V)}\displaystyle\sum_{j\in\mathcal{J}\setminus\mathcal{J}_{int}}\int_V\int_Y \omega(a_su\pi(y))\psi_j(\pi(y))d\mu_{t-s}(y)dm_H(u)\\ &\leq \pi_*\mu_t(\omega)^{-1}\displaystyle\sum_{j\in\mathcal{J}\setminus\mathcal{J}_{int}}\pi_*\mu_{t-s}(\psi_j)\\ &\asymp \pi_*\mu_t(\omega)^{-1}|\mathcal{J}\setminus\mathcal{J}_{int}|(r')^{d^2-1}=O( \pi_*\mu_t(\omega)^{-1}\epsilon^d). \end{aligned}} We now estimate the summation of \eqref{est2} over $j\in\mathcal{J}_{int}$. For each $j\in\mathcal{J}_{int}$ and $y$ as in the integral with respect to $\mu_{t-s}$, we may assume $a_su\pi(y)\in\on{Supp}\omega$ and $\pi(y)\in \on{Supp}\psi_j$. It implies that $\xi(\pi(y),u)\in\on{Supp}\omega\subseteq\mathcal{F}(r,r^{\frac{1}{d-1}})$ and $\mathbf{d}^X(x_j,\pi(y))<5r'$, so the assumptions in Lemma \ref{stab} are satisfied for $x_j$ and $\pi(y)\in\on{Supp}\psi_j$. By Lemma \ref{stab}, we have \eqlabel{xidist}{\mathbf{d}^X(a_sux_j,a_su\pi(y))\leq C_{16}re^{-ds},} \eqlabel{gammastab}{\gamma(x_j,u)=\gamma(\pi(y),u))} for any $u\in V$, $j\in\mathcal{J}_{int}$, and $y\in\on{Supp}(\psi_j\circ\pi)$. Since we are assuming $\|\triangledown\omega\|_{L^{\infty}}\leq C_9r^{-d^2}$, by \eqref{xidist} we have \eqlabel{omapprox}{|\omega(a_sux_j)-\omega(a_su\pi(y))|\leq C_9C_{16}r^{-(d^2-1)}e^{-ds}.} By Lemma \ref{siggam} and \eqref{gammastab}, we also have \eqlabel{sigma}{\sigma(a_suy)=\gamma(\pi(y),u)\sigma(y)=\gamma(x_j,u)\sigma(y).} It follows from \eqref{omapprox} and \eqref{sigma} that \eqlabel{est4}{\begin{aligned} &\frac{\pi_*\mu_t(\omega)^{-1}}{m_H(V)}\displaystyle\sum_{j\in\mathcal{J}_{int}}\int_V\int_Y \omega(a_su\pi(y))\psi_j(\pi(y))e^{-2\pi i\mathbf{m}_0\cdot \sigma(a_suy)}d\mu_{t-s}(y)dm_H(u)\\ &=\frac{\pi_*\mu_t(\omega)^{-1}}{m_H(V)}\displaystyle\sum_{j\in\mathcal{J}_{int}}\int_V\int_Y \omega(a_sux_j)\psi_j(\pi(y))e^{-2\pi i\gamma(x_j,u)^{tr}\mathbf{m}_0\cdot\sigma(y)}d\mu_{t-s}(y)dm_H(u)\\ &\qquad\qquad+O(\pi_*\mu_t(\omega)^{-1}r^{-(d^2-1)}e^{-ds}). \end{aligned}} For $j\in\mathcal{J}_{int}$ and $\mathbf{m}\in\mathbb{Z}^d$, let $V_{x_j,\epsilon}$ be the set as in Lemma \ref{Vxe} and $E_{j,\mathbf{m}}\subseteq V$ be the set $\set{u\in V_{x_j,\epsilon}: \gamma(x_j,u)^{tr}\mathbf{m}_0=\mathbf{m}}$ which was the set of (2) in Proposition \ref{key}. For each $j\in\mathcal{J}_{int}$, $\textrm{ht}(x_j)\leq\epsilon^{-1}$ by the definition of $\mathcal{J}_{int}$, so we have a disjoint partition $V_{x_j,\epsilon}=\displaystyle\bigcup_{\mathbf{m}\in B^{\mathbb{Z}^d}(0,R)}E_{j,\mathbf{m}}$ by Proposition \ref{key}, where $R=C_{13}\epsilon^{-d}\|\mathbf{m}_0\|e^{ns}$. By Lemma \ref{Vxe} and Proposition \ref{key}, we have the following measure estimates: \eqlabel{Vepsest}{m_H(V\setminus V_{x_j,\epsilon})\leq C_{11}\epsilon^{\frac{\kappa_3}{2}},} \eqlabel{Eest}{m_H(E_{j,\mathbf{m}})\leq C_{14}\epsilon^{-3n}e^{-dns}} for any $j\in\mathcal{J}_{int}$ and $\mathbf{m}\in\mathbb{Z}^d$. Denoting \eqlabel{betadef}{\beta_{j,\mathbf{m}}:=\frac{1}{m_H(V)}\int_{E_{j,\mathbf{m}}}\omega(a_sux_j)dm_H(u),} each summand of the last line in \eqref{est4} can be expressed by \eqlabel{est5}{\begin{aligned} &\int_V\int_Y \omega(a_sux_j)\psi_j(\pi(y))e^{-2\pi i\gamma(x_j,u)^{tr}\mathbf{m}_0\cdot\sigma(y)}d\mu_{t-s}(y)dm_H(u)\\ &=\displaystyle\sum_{\mathbf{m}\in B^{\mathbb{Z}^d}(0,R)}\int_{E_{j,\mathbf{m}}}\int_Y\omega(a_sux_j)\psi_j(\pi(y))e^{-2\pi i\gamma(x_j,u)^{tr}\mathbf{m}_0\cdot\sigma(y)}d\mu_{t-s}(y)dm_H(u)\\ &\qquad\qquad +O\left(\int_{V\setminus V_{x_j,\epsilon}}m_X(\psi_j)dm_H(u)\right)\\ &=\displaystyle\sum_{\mathbf{m}\in B^{\mathbb{Z}^d}(0,R)}\left(\int_{E_{j,\mathbf{m}}}\omega(a_sux_j)dm_H(u)\right)\left(\int_Y\psi_j(\pi(y))e^{-2\pi i\mathbf{m}\cdot\sigma(y)}d\mu_{t-s}(y)\right)\\ &\qquad\qquad +O(\epsilon^{\frac{\kappa_3}{2}} m_X(\psi_j))\\ &=m_H(V)\left(\displaystyle\sum_{\mathbf{m}\in B^{\mathbb{Z}^d}(0,R)}\alpha_j\beta_{j,\mathbf{m}}\widehat{\nu_{t-s,j}}(\mathbf{m})+O(\epsilon^{\frac{\kappa_3}{2}} m_X(\psi_j))\right) \end{aligned}} for any $j\in\mathcal{J}_{int}$. Combining \eqref{est2},\eqref{est3}, \eqref{est4} and \eqref{est5} all together, \eqlabel{est6}{\begin{aligned} \pi_*\mu_t(\omega)\widehat{\nu_{t,\omega}}(\mathbf{m}_0)&=\displaystyle\sum_{j\in\mathcal{J}_{int}}\displaystyle\sum_{\mathbf{m}\in B^{\mathbb{Z}^d}(0,R)}\alpha_j\beta_{j,\mathbf{m}}\widehat{\nu_{t-s,j}}(\mathbf{m})\\ &\qquad+O(\max(\epsilon^{\frac{\kappa_3}{2}},r^{-(d^2-1)}e^{-ds},e^{-(m+n)(t-s))}))\\ &=\displaystyle\sum_{j\in\mathcal{J}_{int}}\displaystyle\sum_{\mathbf{m}\in B^{\mathbb{Z}^d}(0,R)}\alpha_j\beta_{j,\mathbf{m}}\widehat{\nu_{t-s,j}}(\mathbf{m})+O(\epsilon^{\frac{\kappa_3}{2}}) \end{aligned}} if $\epsilon\ge e^{-\kappa_4 s}$, $r\ge e^{-\kappa_4 s}$, and $s\leq\kappa_4 t$. Recall that $\pi_*\mu_t(\omega)\asymp r^{d^2-1}$ from \eqref{ommsr}, hence we can find constants $C_{19}, C_{20}>0$ so that if $|\widehat{\nu_{t,\omega}}(\mathbf{m}_0)|\ge C_{19}r^{-(d^2-1)}\epsilon^{\frac{\kappa_3}{2}}$, then \eqlabel{est7}{\left|\displaystyle\sum_{j\in\mathcal{J}_{int}}\displaystyle\sum_{\mathbf{m}\in B^{\mathbb{Z}^d}(0,R)}\alpha_j\beta_{j,\mathbf{m}}\widehat{\nu_{t-s,j}}(\mathbf{m})\right|>C_{20}r^{(d^2-1)}|\widehat{\nu_{t,\omega}}(\mathbf{m}_0)|\ge C_{19}C_{20}\epsilon^{\frac{\kappa_3}{2}}.} It means that a weighted average of $\widehat{\nu_{t-s,j}}(\mathbf{m})$'s is large. To deduce the desired conclusion from this, we need to ``flatten" the weights $\alpha_j\beta_{j,\mathbf{m}}$'s using the following technical lemma. \begin{lem}\label{flat} Let $I$ and $J$ be finite sets. For each $(i,j)\in I\times J$, $a_{ij}\ge 0$ and $b_{ij}\in\mathbb{C}$ with $|b_{ij}|\leq 1$ are given. If $a_{ij}$ and $b_{ij}$ satisfy \begin{itemize} \item $0\leq a_{ij}\leq \frac{\lambda}{|I\times J|}$, \item $\left|\displaystyle\sum_{(i,j)\in I\times J}a_{ij}b_{ij}\right|\ge\tau$ \end{itemize} for some $\lambda, \tau>0$, then there exists $J'\subseteq J$ such that $|J'|\ge\frac{|J|}{2}$ and $$\left|\set{i\in I: \frac{1}{|J|}\left|\displaystyle\sum_{j\in J'}b_{ij}\right|\ge\frac{\tau}{2^6\lambda}}\right|\ge\frac{\tau^3}{2^{17}\lambda^3}|I|.$$ \end{lem} Apply Lemma \ref{flat} for $I=B^{\mathbb{Z}^d}(0,R)$ and $J=\mathcal{J}_{int}$ so that $\alpha_j\beta_{j,\mathbf{m}}\ge 0$ and $\widehat{\nu_{t-s,j}}(\mathbf{m})\in \mathbb{C}$ be the corresponding $a_{ij}$ and $b_{ij}$ in the lemma. By \eqref{jmsr}, \eqref{Eest} and \eqref{betadef}, we have \eqlabel{acond}{\alpha_j\beta_{j,\mathbf{m}}\leq \alpha_j(C_{14}\epsilon^{-3n}e^{-dns})\leq \frac{C_{21}\epsilon^{-(d^2+3n)}\|\mathbf{m}_0\|^{d}}{|B^{\mathbb{Z}^d}(0,R)||\mathcal{J}_{int}|}} for some constant $C_{21}>0$ since $|B^{\mathbb{Z}^d}(0,R)|\asymp R^d$ and $|\mathcal{J}_{int}|\asymp (r')^{-(d^2-1)}$. In \eqref{est7} and \eqref{acond}, we showed that $\alpha_j\beta_{j,\mathbf{m}}$ and $\widehat{\nu_{t-s,j}}(\mathbf{m})$ satisfy the conditions in Lemma \ref{flat} for $\lambda=C_{21}\epsilon^{-(d^2+3n)}\|\mathbf{m}_0\|^d$ and $\tau=C_{19}C_{20}\epsilon^{\frac{\kappa_3}{2}}$. Therefore, there exists $\mathcal{J}'$ such that $|\mathcal{J}'|\ge\frac{|\mathcal{J}_{int}|}{2}\ge\frac{|\mathcal{J}|}{3}$ and $$\left|\set{\mathbf{m}\in B^{\mathbb{Z}^d}(R): \frac{1}{|\mathcal{J}_{int}|}\left|\displaystyle\sum_{j\in \mathcal{J}'}\widehat{\nu_{t-s,j}}(\mathbf{m})\right|\ge\frac{\tau}{2^6\lambda}}\right|>\frac{\tau^3}{2^{17}\lambda^3}|B^{\mathbb{Z}^d}(R)|.$$ Let $C_{22}:=\frac{C_{19}C_{20}}{2^6C_{21}}$ and $\eta=\frac{\tau}{2^6\lambda}=C_{22}\epsilon^{d^2+3n+\frac{\kappa_3}{2}}\|\mathbf{m}_0\|^{-d}$. For $\nu=\frac{1}{|\mathcal{J}'|}\displaystyle\sum_{j\in\mathcal{J}'}\nu_{t-s,j}$ we have $$\left|\set{\mathbf{m}\in B^{\mathbb{Z}^d}(R): |\widehat{\nu}(\mathbf{m})|\ge\eta}\right|>\eta^3|B^{\mathbb{Z}^d}(R)|$$ as claimed. \end{proof} We now give the proof of Lemma \ref{flat} we postponed. \begin{proof}[Proof of Lemma \ref{flat}] Let $\mathcal{E}\subset I\times J$ be the set of $(i,j)$ such that $a_{ij}\ge\frac{\tau}{2|I\times J|}$ and $|b_{ij}|\ge\frac{\tau}{2\lambda}$. Then for any $(i,j)\notin \mathcal{E}$, $|a_{ij}b_{ij}|\leq\frac{\tau}{2|I\times J|}$. It follows that \eq{\left|\displaystyle\sum_{(i,j)\notin\mathcal{E}}a_{ij}b_{ij}\right|\leq|I\times J|\frac{\tau}{2|I\times J|}=\frac{\tau}{2},} hence $\left|\displaystyle\sum_{(i,j)\in\mathcal{E}}a_{ij}b_{ij}\right|\ge\frac{\tau}{2}$. For $0\leq\theta<2\pi$, denote by $\mathcal{E}_{\theta}\subseteq\mathcal{E}$ the set of $(i,j)$ such that $\theta-\frac{\pi}{4}\leq\textrm{arg}\; b_{ij}\leq \theta+\frac{\theta}{4}$ modulo $2\pi$. By the pigeonhole principle, there exists $0\leq\theta<2\pi$ satisfying $\left|\displaystyle\sum_{(i,j)\in\mathcal{E}_\theta}a_{ij}b_{ij}\right|\ge\frac{\tau}{8}$. Note that the argument of $\displaystyle\sum_{(i,j)\in\mathcal{E}_\theta}a_{ij}b_{ij}$ is still between $\theta-\frac{\pi}{4}$ and $\theta+\frac{\pi}{4}$. Taking the real part, we get $\displaystyle\sum_{(i,j)\in\mathcal{E}_\theta}a_{ij}\operatorname{Re}(b_{ij}e^{-i\theta})\ge\frac{\tau}{16}$. It follows from the assumptions $0\leq a_{ij}\leq\frac{\lambda}{|I\times J|}$ and $|b_{ij}|\leq 1$ that \eqlabel{Etcount}{|\mathcal{E}_\theta|\ge\displaystyle\sum_{(i,j)\in\mathcal{E}_\theta}\operatorname{Re}(b_{ij}e^{-i\theta})\ge\frac{\tau}{16\lambda}|I\times J|.} For $i\in I$, let $\mathcal{E}_{\theta,i}:=\set{j\in J: (i,j)\in\mathcal{E}_\theta}$ and $I':=\set{i\in I: |\mathcal{E}_{\theta,i}|\ge\frac{\tau}{32\lambda}|J|}$, then $|\mathcal{E}_\theta|=\displaystyle\sum_{i\in I}|\mathcal{E}_{\theta,i}|\leq |I'||J|+|I\setminus I'|(\frac{\tau}{32\lambda}|J|)$, hence we have \eqlabel{Ibdd}{|I'|\ge\frac{\tau}{32\lambda}|I|} from \eqref{Etcount}. Also, for any $i\in I'$, \eq{\displaystyle\sum_{(i,j)\in\mathcal{E}_{\theta,i}}\operatorname{Re}(b_{ij}e^{-i\theta})\ge\frac{\tau}{4\lambda}|\mathcal{E}_{\theta,i}|\ge\frac{\tau^2}{2^7\lambda^2}|J|} since $\operatorname{Re}(b_{ij}e^{-i\theta})\ge\frac{\tau}{4\lambda}$ for any $(i,j)\in\mathcal{E}_\theta$. Passing over subsets $J_0\subset J$ such that $\frac{|J|}{4}\leq |J_0|\leq\frac{|J|}{2}$, we may choose a subset $J_0\subset J$ so that $|J_0|\leq\frac{|J|}{2}$ and \eqlabel{J0def}{\displaystyle\sum_{i\in I'}|\mathcal{E}_{\theta,i}\cap J_0|\ge \frac{1}{4}\displaystyle\sum_{i\in I'}|\mathcal{E}_{\theta,i}|.} Define independent random variable $\set{Z_j}_{j\in J}$ so that $Z_j$ is identically distributed to the Bernoulli random variables which takes values $1$ and $0$ with $p=\frac{1}{2}$ if $j\in J_0$, and the constant random variable with $P(Z_j=1)=1$ if $j\in J\setminus J_0$. For any $i\in I'$, \eq{\begin{aligned} &\mathbb{E}\left(\left\{\frac{1}{|J|}\displaystyle\sum_{j\in J}\operatorname{Re}(b_{ij}e^{-i\theta})Z_j\right\}^2\right)\\ &=\mathbb{E}\left(\left\{\frac{1}{|J|}\displaystyle\sum_{j\in J_0\cap\mathcal{E}_{\theta,i}}\operatorname{Re}(b_{ij}e^{-i\theta})Z_j+\frac{1}{|J|}\displaystyle\sum_{j\notin J_0\cap\mathcal{E}_{\theta,i}}\operatorname{Re}(b_{ij}e^{-i\theta})\right\}^2\right)\\ &\ge\mathbb{E}\left(\left\{\frac{1}{|J|}\displaystyle\sum_{j\in J_0\cap\mathcal{E}_{\theta,i}}\operatorname{Re}(b_{ij}e^{-i\theta})Z_j-\mathbb{E}\left(\frac{1}{|J|}\displaystyle\sum_{j\in J_0\cap\mathcal{E}_{\theta,i}}\operatorname{Re}(b_{ij}e^{-i\theta})Z_j\right)\right\}^2\right). \end{aligned}} For the inequality we are using the independence of $\set{Z_j}_{j\in J}$ and the fact that $\mathbb{E}(|Z-c|^2)\ge\mathbb{E}(|Z-\mathbb{E}(Z)|^2)$ holds for any random variable $Z$ and $c\in\mathbb{R}$. Note that the last line is the variance of $\frac{1}{|J|}\displaystyle\sum_{j\in J_0\cap\mathcal{E}_{\theta,i}}\operatorname{Re}(b_{ij}e^{-i\theta})Z_j$. It follows that \eq{\begin{aligned} \mathbb{E}\left(\left\{\frac{1}{|J|}\displaystyle\sum_{j\in J}\operatorname{Re}(b_{ij}e^{-i\theta})Z_j\right\}^2\right) &\geq Var\left(\frac{1}{|J|}\displaystyle\sum_{j\in J_0\cap\mathcal{E}_{\theta,i}}\operatorname{Re}(b_{ij}e^{-i\theta})Z_j\right)\\ &=\frac{1}{|J|}\displaystyle\sum_{j\in J_0\cap\mathcal{E}_{\theta,i}}\operatorname{Re}(b_{ij}e^{-i\theta})Var(Z_j)\\ &\ge \frac{\tau}{16\lambda}\frac{|\mathcal{E}_{\theta,i}\cap J_0|}{|J|} \end{aligned}} since $\operatorname{Re}(b_{ij}e^{-i\theta})\ge\frac{\tau}{4\lambda}$ for any $j\in\mathcal{E}_{\theta,i}$. Summing over $i\in I'$, by \eqref{J0def} and the definition of $I'$, we obtain \eq{\begin{aligned} \mathbb{E}\left(\frac{1}{|I'|}\displaystyle\sum_{i\in I'}\left\{\frac{1}{|J|}\displaystyle\sum_{j\in J}\operatorname{Re}(b_{ij}e^{-i\theta})Z_j\right\}^2\right)&\ge \frac{\tau}{16\lambda|I'||J|}\displaystyle\sum_{i\in I'}|\mathcal{E}_{\theta,i}\cap J_0|\\ &\ge\frac{\tau}{64\lambda|I'||J|}\displaystyle\sum_{i\in I'}|\mathcal{E}_{\theta,i}|\\ &\ge\frac{\tau}{64\lambda|I'||J|}|I'|\frac{\tau}{32\lambda}|J|=\frac{\tau^2}{2^{11}\lambda^2}. \end{aligned}} Hence, the event $\frac{1}{|I'|}\displaystyle\sum_{i\in I'}\left\{\frac{1}{|J|}\displaystyle\sum_{j\in J}\operatorname{Re}(b_{ij}e^{-i\theta})Z_j\right\}^2\leq\frac{\tau^2}{2^{11}\lambda^2}$ happens, i.e. there exists $J_0\subseteq J'\subseteq J$ such that \eq{\frac{1}{|I'|}\displaystyle\sum_{i\in I'}\left\{\frac{1}{|J|}\displaystyle\sum_{j\in J'}\operatorname{Re}(b_{ij}e^{-i\theta})\right\}^2\ge\frac{\tau^2}{2^{11}\lambda^2}.} Let $I''$ be the set of $i\in I'$ such that $\frac{1}{|J|}\displaystyle\sum_{j\in J'}\operatorname{Re}(b_{ij}e^{-i\theta})\ge\frac{\tau}{2^6\lambda}$. Then \eq{\frac{\tau^2}{2^{11}\lambda^2}\leq\frac{1}{|I'|}\displaystyle\sum_{i\in I''}1+\frac{1}{|I'|}\displaystyle\sum_{i\in I'\setminus I''}\frac{\tau^2}{2^{12}\lambda^2}\leq\frac{|I''|}{|I'|}+\frac{\tau^2}{2^{12}\lambda^2},} hence $|I''|\ge\frac{\tau^2}{2^{12}\lambda^2}|I'|$. Combining with \eqref{Ibdd}, we have $|I''|\ge\frac{\tau^3}{2^{17}\lambda^3}|I|$. On the other hand, the condition $\frac{1}{|J|}\displaystyle\sum_{j\in J'}\operatorname{Re}(b_{ij}e^{-i\theta})\ge\frac{\tau}{2^6\lambda}$ implies \eq{\frac{1}{|J|}|\displaystyle\sum_{j\in J'}b_{ij}|=\displaystyle\max_{0\leq\theta'<2\pi}\frac{1}{|J|}\displaystyle\sum_{j\in J'}\operatorname{Re}(b_{ij}e^{-i\theta'})\ge\frac{\tau}{2^6\lambda}.} This concludes the proof. \end{proof} \section{Proof of Theorem \ref{mainthm}} \subsection{High concentration of $\nu_{t-s}$ from a large Fourier coefficient} The aim of this subsection is to show that a large nontrival Fourier coefficient $\widehat{\nu_{t,\omega}}(\mathbf{m}_0)$ implies the existence of a highly concentrated ball in $\mathbb{T}^d$ with respect to $\nu_{t-s}$. We make use of the following purely harmonic analytic lemma proved in \cite{BFLM11}, which is a quantitative analogue of Wiener's lemma. \begin{prop}\cite[Proposition 7.5.]{BFLM11}\label{BFLM} Let $\mathcal{N}(E;S)$ denotes the covering number of $E\subset\mathbb{Z}^d$ by $S$-balls. There exists $c>0$ so that if a probability measure $\nu$ on $\mathbb{T}^d$ satisfies \eqlabel{BFLMcond}{\mathcal{N}\left(\set{\mathbf{m}\in B^{\mathbb{Z}^d}(0,R): |\widehat{\nu}(\mathbf{m})|>\tau}; S\right)>\lambda\left(\frac{R}{S}\right)^d} with $S<const_d\cdot R$, then there exists an $S^{-1}$-separated set $A\subset \mathbb{T}^d$ with $$\nu\left(\displaystyle\bigcup_{p\in A}B^{\mathbb{T}^d}(p,R^{-1})\right)>c(\tau\lambda)^3.$$ In particular, there exists $p_0\in\mathbb{T}^d$ with $\nu(B^{\mathbb{T}^d}(p_0,R^{-1}))>c(\tau\lambda)^3S^{-d}.$ \end{prop} Combining Proposition \ref{mainprop} and \ref{BFLM}, we deduce the following proposition about the concentration of $\nu_{t-s}$. \begin{prop}\label{highcon} Let $t>0$, $C_{15}<s\leq\kappa_5 t$, and $r=e^{-\kappa_{5} s}$, where $\kappa_{5}:=\min(\frac{\kappa_3\kappa_4}{2d^2},\frac{n\kappa^2_3}{960d^3(d^2+3n+1)})$. Let $z$ and $\omega$ be as in Proposition \ref{mainprop}. If $|\widehat{\nu_{t,\omega}}(\mathbf{m}_0)|\ge C_{19}e^{-\kappa_{5} s}$ for some $0<\|\mathbf{m}_0\|<e^{\frac{\kappa_3}{480d^2}ns}$, then there exists $p\in\mathbb{T}^d$ with $$\nu_{t-s}(B^{\mathbb{T}^d}(p,e^{-ns}))> C_{24}e^{-\frac{\kappa_3}{20d}ns}$$ for some $C_{24}>0$. \end{prop} \begin{proof} Let $\epsilon=r^{\frac{2d^2}{\kappa_3}}$. The constant $\kappa_{5}$ was taken to satisfy $r\ge e^{-\kappa_4 s}$, $\epsilon\ge e^{-\kappa_4 s}$, and $$|\widehat{\nu_{t,\omega}}(\mathbf{m}_0)|\ge C_{19}e^{-\kappa_{5} s}=C_{19}r^{-(d^2-1)}\epsilon^{\frac{\kappa_3}{2}},$$ so the conditions of Proposition \ref{mainprop} is satisfied. Applying Proposition \ref{mainprop}, we have $$\left|\set{\mathbf{m}\in B^{\mathbb{Z}^d}(R): |\widehat{\nu}(\mathbf{m})|\ge\eta}\right|>\eta^3|B^{\mathbb{Z}^d}(R)|,$$ where $\nu$, $\eta$, $R$ are as in Proposition \ref{mainprop}. We apply Proposition \ref{BFLM} for the same $\nu$ and $R$. We take $S=1$, $\tau=\eta$, and $\lambda\asymp\eta^3$ so that the condition \eqref{BFLMcond} is satisfied by a trivial bound $$\mathcal{N}(\set{\mathbf{m}\in B^{\mathbb{Z}^d}(0,R): |\widehat{\nu}(\mathbf{m})|>\tau};S)\ge|\set{\mathbf{m}\in B^{\mathbb{Z}^d}(0,R): |\widehat{\nu}(\mathbf{m})|>\tau}|.$$ Thus, there exists $p\in\mathbb{T}^d$ with $\nu(B^{\mathbb{T}^d}(p,R^{-1}))>c\eta^{12}$. Recall from Remark \ref{rmk} that $\nu\leq C_{23}\nu_{t-s}$. By the assumptions we also have $$\eta=C_{22}\epsilon^{d^2+3n+\frac{\kappa_3}{2}}\|\mathbf{m}_0\|^{-d}>C_{22}e^{-\frac{2d^2}{\kappa_3}(d^2+3n+1)\kappa_{5} s}\|\mathbf{m}_0\|^{-d}>C_{22}e^{-\frac{\kappa_3}{240d}ns}$$ and $R^{-1}=C_{13}^{-1}\epsilon^d\|\mathbf{m}_0\|^{-1}e^{-ns}\leq e^{-ns}$. Therefore, we get \eq{\begin{aligned} \nu_{t-s}(B^{\mathbb{T}^d}(p,e^{-ns}))&\ge \nu_{t-s}(B^{\mathbb{T}^d}(p,R^{-1}))\\&\ge C_{23}^{-1}\nu(B^{\mathbb{T}^d}(p,R^{-1}))>cC_{23}^{-1}C_{22}^{12}e^{-\frac{\kappa_3}{20d}ns}. \end{aligned}} \end{proof} \subsection{Low concentration of $\nu_{t-s}$ from a Diophantine condition} The aim of this subsection is to show that if $b_0\in\mathbb{T}^d$ is not approximated by a rational number with a small denominator, then the concentration of any ball in $\mathbb{T}^d$ is low with respect to $\nu_{t-s}=\nu_{y_0,t-s}$, where $y_0=g_0w(b_0)\hat{\Gamma}$. Recall the definition $$\zeta(b,T):=\min\set{N\in\mathbb{N}: \displaystyle\min_{1\leq q\leq N}\|qb\|_\mathbb{Z}\leq \frac{N^2}{T}}$$ for $b\in\mathbb{R}^d$ and $T>0$. \begin{lem}\label{count} Let $\Xi$ be an interval in $\mathbb{T}$ of length $2\rho$. For $b\in\mathbb{T}^d$, if $\zeta(b,R)\ge \rho^{-2d}$, then $$\left|\set{\mathbf{m}\in B^{\mathbb{Z}^d}(0,R): b\cdot\mathbf{m}\in \Xi}\right|\leq C_{25}\rho|B^{\mathbb{Z}^d}(0,R)|$$ for some $C_{25}>1$. \end{lem} \begin{proof} Let $b=(b_1,\cdots,b_d)$ and write $$\zeta(b_i,R):=\min\set{N\in\mathbb{N}: \displaystyle\min_{1\leq q\leq N}\|qb_i\|_\mathbb{Z}\leq \frac{N^2}{T}}$$ for each $1\leq i\leq d$. We first claim $\zeta(b,R)\leq \displaystyle\prod_{j=1}^d\zeta(b_j,R)$. By definition, for each $i$ there exists $1\leq q_i\leq \zeta(b_i,R)$ such that $\|q_ib_i\|_\mathbb{Z}\leq\frac{\zeta(b_i,R)^2}{R}$. It folows that for any $1\leq i\leq d$, we have $$\|q_1\cdots q_db_i\|_\mathbb{Z}\leq \|q_ib_i\|_\mathbb{Z}\displaystyle\prod_{j\neq i}q_j\leq\frac{\zeta(b_i,R)^2}{R}\displaystyle\prod_{j\neq i}\zeta(b_j,R)\leq\frac{1}{R}\displaystyle\prod_{j=1}^d\zeta(b_j,R)^2,$$ hence $\|q_1\cdots q_db\|_\mathbb{Z}\leq \frac{1}{R}\displaystyle\prod_{j=1}^d\zeta(b_j,R)^2$. Since $1\leq q_1\cdots q_d\leq \displaystyle\prod_{j=1}^d\zeta(b_j,R)$, the claim follows. By the claim and the assumption $\zeta(b,R)\geq \rho^{-2d}$, there exists $1\leq i\leq d$ such that $\zeta(b_i,R)\geq \rho^{-2}$. For the convenience of notations, assume that such $i$ is $1$ without loss of generality. Note that $b_1$ is an irrational number. Write $b=(b_1,b')\in\mathbb{T}\times\mathbb{T}^{d-1}$ and $\mathbf{m}=(k,\mathbf{m}')\in\mathbb{Z}\times\mathbb{Z}^{d-1}$. The condition $b\cdot\mathbf{m}\in\Xi$ is equivalent to $kb_1\in\Xi'$, where $\Xi'=\Xi-b'\cdot\mathbf{m}'$. Thus, it suffices to prove the following statement: for any interval $\Xi'\subset\mathbb{T}$ of length $2\rho$ and $\zeta(b_1,R)\ge\rho^{-2}$, \eqlabel{circrot}{|k\in B^{\mathbb{Z}}(0,R): kb_1\in\Xi'|\ll\rho R.} One can modify famous Weyl's equidistribution criterion to be an effective version, and obtain the following upper bound of the density of the irrational rotational orbit on $\mathbb{T}$ (See Lemma \ref{Weyl''} for a detailed computation): \eqlabel{Weyl}{\frac{1}{2R}\left|\left\{k\in B^{\mathbb{Z}}(0,R): kb_1\in\Xi'\right\}\right|\ll |\Xi'|+|\Xi'|^{-1}\zeta(b_1,R)^{-1}.} Under the assumptions $|\Xi'|=|\Xi|=2\rho$ and $\zeta(b_1,R)\ge\rho^{-2}$ it yields \eqref{circrot}, so concludes the proof. \end{proof} In the rest of this subsection, the maps $\xi=\xi_{t-s}:X\times V\to\mathcal{F}$ and $\gamma=\gamma_{t-s}:X\times V\to\Gamma$ denote the same maps as in the Section 3, but for the parameter $t-s$ instead of $s$, i.e. $$a_{t-s}u\iota(x)=\xi(x,u)\gamma(x,u).$$ The following proposition relates the concentration of the measure $\nu_{t-s}=\nu_{y_0,t-s}$ and the Diophantine condition of $y_0$. \begin{prop}\label{lowcon} Let $0<s<\frac{t}{2}$ and $\rho\ge e^{-\kappa_5 t}$. For $g_0\in G$ and $b_0\in\mathbb{T}^d$, let $y_0=g_0w(b_0)\hat{\Gamma}\in Y$. Let $x_0=\pi(y_0)\in X$ and assume $\textrm{ht}(x_0)\leq \rho^{-\frac{1}{10d^2(d-1)}}$. For some constants $C_{26},C_{27}>0$, if $\zeta(b_0,\|g_0\|^{-1}e^{n(t-s)})\ge C_{26}\rho^{-2d}$, then $$\nu_{t-s}(B^{\mathbb{T}^d}(p,\rho))\leq C_{27}\rho^{\frac{\kappa_3}{10d}}$$ for any $p\in\mathbb{T}^d$. \end{prop} \begin{proof} Let $\gamma_0$ be the element of $\Gamma$ such that $g_0=\iota(x_0)\gamma_0$. Then $y_0$ can be expressed by $y_0=g_0w(b_0)\hat{\Gamma}=\iota(x_0)w(\gamma_0b_0)\hat{\Gamma}$. Let $b=\gamma_0b_0$, then $\sigma(y_0)=\gamma_0b_0=b$. Denote by $\Theta:\mathbb{T}^d\to\mathbb{T}$ the projection onto the first coordinate. Let $\Xi=\Theta(B^{\mathbb{T}^d}(p,\rho))$, then $\Xi\subseteq\mathbb{T}$ is an interval of length $2\rho$. By the definitions of $\nu_{t-s}$ and $\mu_{t-s}$, we have \eqlabel{xiset}{\nu_{t-s}(\Theta^{-1}(\Xi))=\frac{1}{m_H(V)}m_H(\set{u\in V: \sigma(a_{t-s}uy_0)\in\Theta^{-1}(\Xi)}).} By Lemma \ref{siggam} with $\xi=\xi_{t-s}$ and $\gamma=\gamma_{t-s}$, $$\sigma(a_{t-s}uy_0)=\gamma(x_0,u)\sigma(y_0)=\gamma(x_0,u)b$$ holds. Hence, the set in \eqref{xiset} can be expressed as \eqlabel{xiset2}{\begin{aligned} \set{u\in V: \sigma(a_{t-s}uy_0)\in\Theta^{-1}(\Xi)} &=\set{u\in V: e_1\cdot\sigma(a_{t-s}uy_0)\in\Xi}\\ &=\set{u\in V: \gamma(x_0,u)^{tr}e_1\cdot b\in\Xi}. \end{aligned}} Let $\epsilon=\rho^{\frac{1}{5d}}$ and $V_{x_0,\epsilon}$ be the set as in Lemma \ref{Vxe}. Note that the conditions $\epsilon=\rho^{\frac{1}{5d}}>e^{-\kappa_2(t-s)}$ and $\textrm{ht}(x_0)<e^{\kappa_2(t-s)}$ of Lemma \ref{Vxe} and Proposition \ref{count} for $\xi_{t-s}$ and $\gamma_{t-s}$ are satisfied since $\kappa_5\leq\frac{\kappa_2}{10d^3}$. Then we have \eqlabel{estVxe}{m_H(V\setminus V_{x_0,\epsilon})\leq C_{11}\epsilon m_H(V)} by Lemma \ref{Vxe}. We now apply Proposition \ref{key} for $t-s$ and $\mathbf{m}_0=e_1$. Let $R=C_{13}\epsilon^{-1}\textrm{ht}(x_0)^{d-1}e^{n(t-s)}$ as in Proposition \ref{key} and $Q=B^{\mathbb{Z}^d}(0,R)$. Denoting $\Omega:=\set{\mathbf{m}\in Q: b\cdot\mathbf{m}\in\Xi}$ and applying Proposition \ref{key}, we have \eqlabel{xiset3}{\set{u\in V: \gamma(x_0,u)^{tr}e_1\cdot b\in\Xi}\subseteq (V\setminus V_{x,\epsilon})\cup\displaystyle\bigcup_{\mathbf{m}\in\Omega}\set{u\in V_{x_0,\epsilon}:\gamma(x_0,u)e_1=\mathbf{m}},} \eqlabel{xiest}{m_H(\set{u\in V_{x_0,\epsilon}:\gamma(x_0,u)e_1=\mathbf{m}})\leq C_{14}\epsilon^{-3n}e^{-dn(t-s)}m_H(V)} for any $\mathbf{m}\in\mathbb{Z}^d$. We also have \eqlabel{Omega}{|\Omega|\leq C_{25}\rho|Q|\ll \rho\epsilon^{-d}\textrm{ht}(x_0)^{d(d-1)}e^{dn(t-s)}} by Lemma \ref{count}. Let $C_{26}:=\max(C_1^{\frac{1}{2}}C_5^{\frac{1}{2}}C_{13}^{-\frac{1}{2}},1)$. Using \eqref{rescaling},\eqref{gammab},\eqref{norm}, and \eqref{opnorm}, the assumption $\zeta(b_0,\|g_0\|^{-1}e^{n(t-s)})\ge C_{26}\rho^{-2d}$ implies \eqlabel{zetacond}{\begin{aligned} \zeta(b,R)&\ge\zeta(b_0,\|\gamma_0\|^{-1}R)\ge\zeta(b_0,C_1^{-1}\|g_0\|^{-1}\|\iota(x_0)\|^{-1}R)\\ &\ge\zeta(b_0, C_1^{-1}C_5^{-1}\|g_0\|^{-1}\textrm{ht}(x_0)^{-(d-1)}R)\\ &\ge \min(C_1^{-\frac{1}{2}}C_5^{-\frac{1}{2}}C_{13}^{\frac{1}{2}},1)\zeta(b_0, \|g_0\|^{-1}e^{n(t-s)})\ge \rho^{-2d}, \end{aligned}} so the condition of Lemma \ref{count} is satisfied. Combining \eqref{xiset}-\eqref{Omega}, \eqlabel{xiset4}{ \begin{aligned} \nu_{t-s}(\Theta^{-1}(\Xi))&=\frac{1}{m_H(V)}m_H(\set{u\in V: \gamma(x_0,u)^{tr}e_1\cdot b\in\Xi})\\ &\leq\frac{m_H(V\setminus V_{x,\epsilon})}{m_H(V)}+\displaystyle\sum_{\mathbf{m}\in\Omega}\frac{m_H(\set{u\in V_{x_0,\epsilon}:\gamma(x_0,u)e_1=\mathbf{m}})}{m_H(V)}\\ &\leq C_{11}\epsilon+C_{14}|\Omega|\epsilon^{-3n}e^{-dn(t-s)}\\ &\ll \epsilon+\rho\epsilon^{-(d+3n)}\textrm{ht}(x_0)^{d(d-1)}\ll \rho^{\frac{\kappa_3}{10d}}. \end{aligned}} It completes the proof since $B^{\mathbb{T}^d}(p,\rho)\subseteq \Theta^{-1}(\Xi)$. \end{proof} \subsection{Proof of Theorem \ref{mainthm}} Combining Proposition \ref{highcon} and \ref{lowcon}, we deduce the following Fourier decay estimate. \begin{prop}\label{Fourdecay} Let $t>0$, $\|g_0\|\leq e^{\frac{nt}{4}}$, $b\in\mathbb{T}^d$, and $y_0=g_0w(b_0)\hat{\Gamma}$. Let $\rho=\max\left(e^{-\kappa_{5} t},C_{26}^{-\frac{1}{2d}}\zeta(b_0,e^{\frac{nt}{2}})^{-\frac{1}{2d}}\right)$ and $r=\rho^{\frac{\kappa_{5}}{n}}$. Assume $\rho>C_{28}$ and $\textrm{ht}(\pi(y_0))\leq\rho^{-\frac{1}{10d^2(d-1)}}$, where $C_{28}:=\max(C_{15}, C_{24}^{10}C_{27}^{-10})$. Let $z$ and $\omega$ be as in Proposition \ref{mainprop}. Then $$|\widehat{\nu_{t,\omega}}(\mathbf{m}_0)|<C_{19}\rho^{\frac{\kappa_{5}}{n}}$$ for any $0<\|\mathbf{m}_0\|<\rho^{-\frac{\kappa_3}{480d^2}}$. \end{prop} \begin{proof} This is a direct consequence of Proposition \ref{highcon} and \ref{lowcon}, so it suffices to check the conditions in the propositions. Set $s=-\frac{1}{n}\log\rho$ so that $\rho=e^{-ns}$, then $\rho\ge e^{-\kappa_5 t}$ and $s\leq \kappa_5 t$. Since $\|g_0\|\leq e^{\frac{nt}{4}}$, $\|g_0\|^{-1}e^{n(t-s)}\ge e^{\frac{nt}{2}}$, hence the condition $\zeta(b_0,\|g_0\|^{-1}e^{n(t-s)})\ge C_{26}\rho^{-2d}$ is satisfied. It follows from Proposition \ref{lowcon} that \eqlabel{high}{\nu_{t-s}(B^{\mathbb{T}^d}(p,\rho))\leq C_{27}\rho^{\frac{\kappa_3}{10d}}} for any $p\in\mathbb{T}^d$. Suppose that there exists some $0<\|\mathbf{m}_0\|<\rho^{-\frac{\kappa_3}{480d^2}}=e^{\frac{\kappa_3}{480d^2}ns}$ with $|\widehat{\nu_{t,\omega}}(\mathbf{m}_0)|\ge C_{19}\rho^{\frac{\kappa_{5}}{n}}=C_{19}e^{-\kappa_{5} s}$ for contradiction. For sufficiently large $\rho$, it follows from Proposition \ref{highcon} that \eqlabel{low}{\nu_{t-s}(B^{\mathbb{T}^d}(p,\rho))> C_{24}\rho^{\frac{\kappa_3}{20d}}\ge C_{27}\rho^{\frac{\kappa_3}{10d}},} which contradicts to \eqref{high}. \end{proof} We now prove Theorem \ref{mainthm}. \begin{proof}[Proof of Theorem \ref{mainthm}] We fix $y_0=g_0w(b_0)\hat{\Gamma}\in Y$ with $b_0\in\mathbb{T}^d\setminus\mathbb{Q}^d$ and denote $\mu_t=\mu_{y_0,t}$ the same as we did. To prove Theorem \ref{mainthm}, it suffices to find a constant $\delta'>0$ such that if $\|g\|\leq\zeta(b_0,e^{\frac{nt}{2}})^{-\delta}$, then $$\mu_t(f)=m_Y(f)+O(\mathcal{S}(f)\zeta(b_0,e^{\frac{nt}{2}})^{-\delta})$$ for any $t\ge 0$, $f\in C^\infty_c(Y)$. Recall the notations that $l$ is the degree of the Sobolev norm $\mathcal{S}$, $\delta_0$ is the constant of Theorem \ref{equX}, and $\kappa_1,\cdots,\kappa_5$ are the constants we have chosen throughout the present paper. Given $t>0$, let $$\rho=\min\left(e^{-\kappa_{5} t},C_{26}^{-\frac{1}{2d}}\zeta(b_0,e^{\frac{nt}{2}})^{-\frac{1}{2d}}\right)$$ as in Proposition \ref{Fourdecay}, $\kappa_{6}:=\min(\frac{1}{480d^2},\frac{\kappa_3\kappa_{5}}{3dn})$ and $\epsilon=\rho^{\frac{\kappa_6}{2l(d-1)}}$. We can also take $\delta_1>0$ to satisfy $ \zeta(b_0,e^{\frac{nt}{2}})^{\delta_1}\leq\min(\rho^{-\frac{1}{10d^2(d-1)}},e^{\frac{\delta_0}{2\kappa_1}t})$. The desired constant $\delta'$ will be taken to be $0<\delta'<\delta_1$ so that $\|g_0\|\leq\zeta(b_0,e^{\frac{nt}{2}})^{\delta'}$ implies $\textrm{ht}(x_0)\leq \rho^{-\frac{1}{10d^2(d-1)}}$ and $\|g_0\|\leq e^{\frac{nt}{4}}$, which are the conditions in Proposition \ref{Fourdecay}. We fix a partition of unity $\set{\omega_i}_{i\in\mathcal{I}}$ using Proposition \ref{partition} with a radius $r=\rho^{\frac{\kappa_{5}}{n}}$, where $\mathcal{I}=\set{1,\cdots,N_r}\cup\set{\infty}$. Let $\set{z_1,\cdots,z_{N_r}}\subset K(C_8r^{\frac{1}{d}})$ be the corresponding set as in Proposition \ref{partition}. Let $\mathcal{I}_{int}\subset\mathcal{I}$ be the set of $i\in\mathcal{I}$ such that $\iota(z_i)\in\mathcal{F}(10r,\epsilon)$. For any $i\in\mathcal{I}\setminus\mathcal{I}_{int}$, each $\iota(B^X(z_i,r))$ is in $\mathcal{F}\setminus\mathcal{F}(11r,\frac{\epsilon}{2})$ and has $m_G$-measure $\asymp r^{-(d^2-1)}$. Thus, $|\mathcal{I}\setminus\mathcal{I}_{int}|\ll \epsilon^dr^{-(d^2-1)}$ since $\iota(B^X(z_i,r))$'s are disjoint. For any $i\in\mathcal{I}_{int}$, $z_i$ and $\omega_i$ satisfy the conditions $\iota(z_i)\in\mathcal{F}(10r,C_8r^{\frac{1}{d}})$, $\mathds{1}_{B^X(z_i,r)}\leq\omega_i\leq\mathds{1}_{B^X(z_i,5r)}$, and $\|\triangledown\omega_i\|_{L^\infty(X)}\leq C_9r^{-d^2}$, which we have assumed in the previous propositions. Write $\mu_{t,i}:=\mu_{t,\omega_i}$ and $\nu_{t,i}:=\nu_{t,\omega_i}$ for simplicity, where $\mu_{t,\omega_i}$ and $\nu_{t,\omega_i}$ is defined as \eqref{omdef} and \eqref{nudef}. Since $r^{\kappa_3}\leq \rho^{\frac{\kappa_3\kappa_5}{n}}\leq\epsilon^d$, $m_G(\mathcal{F}\setminus\mathcal{F}(11r,\frac{\epsilon}{2}))\ll \epsilon^d$ by \eqref{Fest}. Recall that we defined $\overline{f}\in C^\infty_c(X)$ by $\overline{f}(x)=\int_{\pi^{-1}(x)}f(y)dm_{\pi^{-1}(x)}(y)$ for $x\in X$, $f\in C^\infty_c(Y)$. Let us define $h\in C^\infty_{c}(Y)$ by $h(y)=f(y)-\overline{f}(\pi(y))$ for $y\in Y$. Note that $$\mathcal{S}(h)\ll\mathcal{S}(f),\quad\|h\|_{L^{\infty}(Y)}\ll\|f\|_{L^{\infty}(Y)},\quad|h(gy)-h(y)|\ll r\mathcal{S}(f)$$ by definition. We also have \eqlabel{intzero}{\int_{\pi^{-1}(x)}h(y)dm_{\pi^{-1}(x)}(y)=0} for any $x\in X$. We first decompose $\mu_t(f)$ as \eqlabel{decom1}{\mu_t(f)=\mu_t(\overline{f}\circ\pi)+\mu_t(h)=\pi_*\mu_t(\overline{f})+\mu_t(h).} By \eqref{equX'} and $\textrm{ht}(x_0)\ll\|g_0\|\leq\zeta(b_0,e^{\frac{nt}{2}})^{\delta'}\leq e^{\frac{\delta_0}{2\kappa_1}t}$, we have \eqlabel{equX''}{ \begin{aligned} \pi_*\mu_t(\overline{f})&=m_X(\overline{f})+O(\textrm{ht}(x_0)^{\kappa_1}\mathcal{S}^X(\overline{f})e^{-\delta_0t})\\ &=m_Y(f)+O(\textrm{ht}(x_0)^{\kappa_1}\mathcal{S}(f)e^{-\delta_0t})\\ &=m_Y(f)+O(\mathcal{S}(f)e^{-\frac{\delta_0t}{2}}), \end{aligned}} Split the second term of \eqref{decom1} by \eqlabel{decom2}{ \begin{aligned} \mu_t(h)&=\displaystyle\sum_{i\in\mathcal{I}}\pi_*\mu_t(\omega_i)\mu_{t,i}(h)\\ &=\displaystyle\sum_{i\in\mathcal{I}\setminus\mathcal{I}_{int}}\pi_*\mu_t(\omega_i)\mu_{t,i}(h)+\displaystyle\sum_{i\in\mathcal{I}_{int}}\pi_*\mu_t(\omega_i)\mu_{t,i}(h). \end{aligned}} By \eqref{ommsr} and a trivial bound $\mu_{t,i}(h)\leq\|h\|_{L^{\infty}(Y)}\ll\mathcal{S}(f)$, \eqlabel{bdd1}{\displaystyle\sum_{i\in\mathcal{I}\setminus\mathcal{I}_{int}}\pi_*\mu_t(\omega_i)\mu_{t,i}(h)\ll |\mathcal{I}\setminus\mathcal{I}_{int}|\mathcal{S}(f)r^{(d^2-1)}\ll \mathcal{S}(f)\epsilon^d=\mathcal{S}(f)\rho^{\frac{d\kappa_6}{2l(d-1)}}.} For each $i\in\mathcal{I}_{int}$, denote by $\vartheta_i:\mathbb{T}^d\to \pi^{-1}(z_i)$ the bijective Lipschitz function defined by $\vartheta_i(b):=\iota(z_i)w(b)\hat{\Gamma}$. Note that $\vartheta_i\circ\sigma=\operatorname{id}_{\pi^{-1}(z_i)}$ and the Lipschitz constant of $\vartheta_i$ is bounded above by $\|\iota(z_i)\|\leq C_5\textrm{ht}(z_i)^{d-1}$ and below by $\|\iota(z_i)\|^{-1}\ge C_5^{-1}\textrm{ht}(z_i)^{-(d-1)}$. Let $h_i:=h\circ\vartheta_i\in C^\infty_c(\mathbb{T}^d)$. For any $i\in\mathcal{I}_{int}$, $\on{Supp} \mu_{t,i}\subseteq \pi^{-1}(B^X(z_i,5r))$ and $\iota(B^X(z_i,5r))\subseteq \mathcal{F}$. It follows that $\mathbf{d}^G(g,\iota(z_i))<5r$ for any $g\in \on{Supp} \omega_i\circ\phi$, so \eqlabel{distance}{|h(gw(b)\hat{\Gamma})-h(\iota(z_i)w(b)\hat{\Gamma})|\ll r\mathcal{S}(f),} i.e. $|h(y)-h_i(\sigma(y))|\ll r\mathcal{S}(f)$ for any $y\in\on{Supp}\mu_{t,i}$. Hence, \eqlabel{happrox}{\mu_{t,i}(h)=\mu_{t,i}(h_i\circ\sigma)+O(r\mathcal{S}(f))=\nu_{t,i}(h_i)+O(r\mathcal{S}(f)).} For each $h_i\in C^\infty_c(\mathbb{T}^d)$ and $b\in\mathbb{T}^d$, we consider the Fourier expansion \eqlabel{Fourierex}{h_i(b)=\displaystyle\sum_{\mathbf{m}\in\mathbb{Z}^d}\widehat{h_i}(\mathbf{m})e^{-2\pi i\mathbf{m}\cdot b}.} By \eqref{intzero}, the Fourier coefficient at zero vanishes as \eqlabel{Fzero}{\widehat{h_i}(0)=\int_{\mathbb{T}^d}h(\iota(z_i)w(b)\hat{\Gamma})dm_{\mathbb{T}^d}(b)=0.} The smoothness of $h$ provides us a decay of nonzero Fourier coefficients. Let $\mathcal{S}^{\mathbb{T}^d}$ be a $l$-th degree Sobolev norm on $\mathbb{T}^d$ as $\mathcal{S}^Y$. Then $\mathcal{S}^{\mathbb{T}^d}(h_i)$ is bounded above by $\mathcal{S}^{\mathbb{T}^d}(h\circ\vartheta_i)\ll \textrm{ht}(z_i)^{l(d-1)}\mathcal{S}(h)$. Hence, for any $\mathbf{m}\in\mathbb{Z}^d\setminus\set{0}$, \eqlabel{Fnonzero}{|\widehat{h_i}(\mathbf{m})|\leq \mathcal{S}^{\mathbb{T}^d}(h_i)\|\mathbf{m}\|^{-(d+2)}\ll \textrm{ht}(z_i)^{l(d-1)}\mathcal{S}(f)\|\mathbf{m}\|^{-(d+2)}} since $\mathcal{S}$ is a $l$-th degree Sobolev norm and it controls the $L^\infty$ norm of $(d+2)$-th derivatives. On the other hand, we obtained a upper bound of $|\widehat{\nu_{t,i}}(\mathbf{m})|$ in Proposition \ref{Fourdecay}. Recall $\kappa_{6}=\min(\frac{\kappa_3}{960d^2},\frac{\kappa_3\kappa_{5}}{3dn})$. By Proposition \ref{Fourdecay}, we have \eqlabel{Fourdecay'}{|\widehat{\nu_{t,i}}(\mathbf{m})|<C_{19}\rho^{3d\kappa_{6}}} for any $0<\|\mathbf{m}\|<\rho^{-2\kappa_6}$. Expand $\nu_{t,i}(h)$ as \eqlabel{decomp3}{ \begin{aligned} |\nu_{t,i}(h)|&=|\displaystyle\sum_{\mathbf{m}\in\mathbb{Z}^d\setminus\set{0}}\widehat{h_i}(\mathbf{m})\widehat{\nu_{t,i}}(\mathbf{m})|\\ &\leq\displaystyle\sum_{0<\|\mathbf{m}\|<\rho^{-2\kappa_6}}|\widehat{h_i}(\mathbf{m})||\widehat{\nu_{t,i}}(\mathbf{m})|+\displaystyle\sum_{\|\mathbf{m}\|\ge\rho^{-2\kappa_6}}|\widehat{h_i}(\mathbf{m})||\widehat{\nu_{t,i}}(\mathbf{m})|. \end{aligned}} Then the first term in the last line is $\ll (\rho^{-2\kappa_6})^d\mathcal{S}(f)\rho^{3d\kappa_{6}}=\rho^{d\kappa_6}\mathcal{S}(f)$, using \eqref{Fourdecay'} and a trivial bound $|\widehat{h_i}(\mathbf{m})|\leq\|h\|_{L^{\infty}(Y)}\ll\mathcal{S}(f)$. Using \eqref{Fnonzero} and a trivial bound $|\widehat{\nu_{t,k}}(\mathbf{m})|\leq 1$, the second term in the last line is bounded by $\textrm{ht}(z_i)^{l(d-1)}\mathcal{S}(f)\displaystyle\sum_{\|\mathbf{m}\|\ge\rho^{-2\kappa_6}}\|\mathbf{m}\|^{-(d+2)}\ll\textrm{ht}(z_i)^{l(d-1)}\mathcal{S}(f)\rho^{2\kappa_6}$. Hence, we have \eqlabel{bound1}{|\nu_{t,i}(h)|\ll \textrm{ht}(z_i)^{l(d-1)}\mathcal{S}(f)\rho^{2\kappa_6}\leq \mathcal{S}(f)\rho^{\kappa_6}.} since $\textrm{ht}(z_i)\leq\epsilon^{-1}=\rho^{-\frac{\kappa_{6}}{2l(d-1)}}$. Taking summation over $i\in\mathcal{I}_{int}$ and using \eqref{happrox} and \eqref{bound1}, \eqlabel{bdd2}{ \begin{aligned} |\displaystyle\sum_{i\in\mathcal{I}_{int}}\pi_*\mu_t(\omega_i)\mu_{t,i}(h)|&= |\displaystyle\sum_{i\in\mathcal{I}_{int}}\pi_*\mu_t(\omega_i)\nu_{t,i}(h_i)|+O(r\mathcal{S}(f))\\ &\leq\displaystyle\sum_{i\in\mathcal{I}_{int}}\pi_*\mu_t(\omega_i)\mathcal{S}(f)\rho^{\kappa_6}+O(r\mathcal{S}(f))\\ &=O((\rho^{\kappa_6}+\rho^{\frac{\kappa_5}{n}})\mathcal{S}(f)). \end{aligned} } Combining \eqref{decom1}-\eqref{bdd1} and \eqref{bdd2}, we obtain the estimate $$\mu_t(f)=m_Y(f)+O(\mathcal{S}(f)(e^{-\frac{\delta_0t}{2}}+\rho^{\frac{d\kappa_6}{2l(d-1)}})).$$ We note that $\zeta(b_0,e^{\frac{nt}{2}})\leq (e^{\frac{nt}{2}})^{\frac{d}{2d+1}}$ by \eqref{Dirichlet} and $\zeta(b_0,e^{\frac{nt}{2}})\ll \rho^2$. Hence we can find $\delta'>0$ such that $e^{-\frac{\delta_0t}{2}}+\rho^{\frac{d\kappa_6}{2l(d-1)}}\ll\zeta(b_0,e^{\frac{nt}{2}})^{-\delta'}$ and $\delta'<\delta_1$. This completes the proof of the main theorem. \end{proof}
\section{Introduction} \label{sec:intro} \input{txt/intro} \section{The Programmable Data Plane} \label{sec:anatomy} \input{txt/anatomy} \section{Architectures} \label{sec:architectures} \input{txt/architectures} \section{Abstractions} \label{sec:abstractions} \input{txt/abstractions} \section{Algorithms and Hardware Realizations} \label{sec:algorithms} \input{txt/algorithms} \section{Applications} \label{sec:apps} \input{txt/applications} \section{Taxonomies for Programmable Switches} \label{sec:taxonomies} \input{txt/taxonomies} \section{Research Challenges} \label{sec:open-issues} \input{txt/issues-conclusion} \section{Conclusion} \label{sec:conclusion} \input{txt/conclusion} \section*{Acknowledgments} The research leading to these results has received funding from the \grantsponsor{EUH2020}{European Union's H2020 Framework Programme (H2020-EU.2.1.1)}{} under grant agreement n.~\grantnum{H2020}{101017171} (Project ``Marsal'') and from the \grantsponsor{WWTF}{Vienna Science and Technology Fund (WWTF)}{} under project~\grantnum{WWTF}{ICT19-045}, WHATIF, 2020-2024. G\'{a}bor R\'{e}tv\'{a}ri was funded by the \grantsponsor{NKFIH}{NKFIH/OTKA}{} Project~\#\grantnum{NKFIH}{135606}. He is also with the MTA-BME Information Systems Research Group, the MTA-BME Network Softwarization Research Group, and Ericsson Research, Budapest. \bibliographystyle{acm} \citestyle{acmnumeric} \subsection{System Level\slash Layer-based View} \subsection{Monitoring, Telemetry, and Measurement} \label{sec:monit-telem-meas} Perhaps the most interesting applications for data plane offloading are related to network measurement, telemetry, monitoring, and diagnosis. This is mostly because these applications share traits that make them particularly suitable for data plane-based implementations: they operate at massive traffic scale, underly stringent performance requirements, and have, monitoring network traffic, an inherent, direct relationship with the data plane itself. For decades, the state-of-the-art involves mirroring monitored traffic to dedicated middleboxes, involving costly traffic duplication and software processing; consequently, the efficiency gains with in-network data plane implementation can be enormous. We therefore see programmable data planes as a game changer in this context, providing deep insights into the network, even to end hosts, as we discuss in the following. At the heart of many approaches lies the goal to improve the visibility into network behavior. Jeyakumar et al.~\cite{minions} present a solution which not only provides improved visibility to end hosts but also allows to quickly introduce new data plane functionality, via a new Tiny Packet Program (TTP) interface. Rooted in the work on Smart Packets~\cite{smart-packets} originally proposed for on-switch network management and monitoring based on the Active Network paradigm~\cite{roadtosdn}, TTPs are embedded into packets by end hosts and can actively query and manipulate internal network state. The approach is based on the ``division of labor'' principle: switches forward and execute TTPs in-band at line rate, and end hosts perform flexible computation on the network state exposed by the TTPs. The authors also present a number of use case descriptions motivating in‐band network telemetry. The general framework for in-band network telemetry (INT) was later presented by Kim et al. in \cite{kim2015band}. As a step toward generalized measurement, one direction of work has looked at sketches as a new data plane structure for network analytics. Sketches, which leverage probabilistic, sub-linear data structures, are an efficient way to maintain summarizing statistics and metrics over large input datasets~\cite{alon:space-complexity-moments}. OpenSketch~\cite{yu:opensketch} provides a library of such sketches while UnivMon \cite{liu:univmon} introduces a universal streaming scheme, where a generic sketch in hardware preprocesses packet records at high rates and software applications compute application-specific metrics. Recently, SketchVisor~\cite{Huang:2017:SRN:3098822.3098831} presented a comprehensive network measurement framework which augments sketch-based measurement in the data plane with a fast path that is activated under high traffic load to provide high-performance local measurement with slight degradation in accuracy. To make network monitoring systems more flexible, researchers have sought ways to allow network operators to write network measurement queries directly and in a more expressive way, instead of relying on a particular sketch. These queries can then be compiled to run on modern programmable switches at line rate. Marple~\cite{narayana:marple} identified a set of fixed operators that can be compiled to programmable hardware and used to compose a wide range of network monitoring queries. This approach offers great performance for any analytics tasks that can fit entirely in a programmable switch, but it also requires software offload once the device's SRAM and ALU resources are full. Sonata~\cite{gupta:sonata} improved on this hardware-restrictive model by more intelligently dividing a query into parts that are executed on the switch and parts that are executed on a general-purpose software stream processor. Motivated by the limited processing capabilities of software stream processing systems, Sonata introduced a method of iterative refinement, which can reduce the amount of traffic sent to software. This iterative refinement, however, comes at the cost of using significant SRAM and ALU resources on the switch and also requires relaxing the temporal and logical constraints of a query. Further applications of in-network measurement are related to heavy hitter detection~\cite{Sivaraman:2017:HDE:3050220.3063772, Popescu:2017:EFH:3050220.3060606}, traffic matrix estimation~\cite{Gong:2015:TAO:2774993.2775068}, and TCP performance measurements~\cite{dapper}. First, HashPipe~\cite{Sivaraman:2017:HDE:3050220.3063772} realizes heavy-hitter detection entirely in the data plane. HashPipe implements a pipeline of hash tables, which retain counters for heavy flows while evicting lighter flows over time. Second, Gong et al.~\cite{Gong:2015:TAO:2774993.2775068} show that by designing feasible traffic measurement rules (installed in TCAM entries of SDN switches) and collecting the statistics of these rules, fine-grained estimates of the traffic matrix are also possible. Finally, Dapper~\cite{dapper} allows to analyze TCP performance problems in real time right near the end-hosts, i.e., at the hypervisor, NIC, or top-of-rack switch. This makes it possible for the operator to determine whether a particular connection is limited by the sender, the network, or the receiver, and to intervene accordingly in a timely manner. Finally, an orthogonal line of work identified that programmable switches, while not suitable for practical and ubiquitous offload of analytics tasks due to resource constraints, are useful for accelerating and enhancing telemetry systems. Instead of compiling entire queries to a programmable switch, *Flow~\cite{sonchack:starflow} places parts of the select and grouping logic that is common to all queries into a hardware match-action pipeline. In *Flow, programmable line rate switches export a stream of \textit{grouped packet vectors} (GPVs) to software processors. A GPV contains a flow key, e.g., IP 5-tuple, and a variable-length list of packet feature tuples, e.g., timestamps and sizes, from a sequence of packets in that flow. GPVs are generated through a novel in-network key-value cache that can be implemented as a sequence of match-action tables for programmable switches. The authors expanded on the telemetry system with a customized, high-performance network analytics platform~\cite{michel:packet-level-analytics}. Sketches and entirely switch-based approaches to monitoring and telemetry provide unprecedented performance for simple counters and basic queries. Besides requiring significant amounts of scarce switch resources and imposing operational inflexibilities, these approaches lack the packet-level granularity that modern fine-grained network analytics solutions require. We therefore see large potential in hybrid approaches leveraging both high-performance switch-based telemetry together with flexible software-based analytics as proposed in Sonata~\cite{gupta:sonata} and *Flow~\cite{sonchack:starflow}. Finding the right balance between in-network and host processing, taking into account novel processing platforms such as FPGAs, will remain a hot topic for the years to come. \subsection{Virtual Switching} \label{sec:virtual-switching} Virtual networking is heavily used in data centers and cloud computing infrastructure. At the heart of cloud computing lies the idea of resource sharing and \emph{multi-tenancy}: independent instances (e.g., applications or tenants) can concurrently utilize the physical infrastructure including their compute, storage, and management resources~\cite{netvirt-mtd}. While physically integrated, network virtualization enables logical isolation of resources for each tenant. \textit{Virtual switches} are a core network component in this architecture located in the virtualization layer of servers connecting tenants' host-based compute and storage resources among each other and to the rest of the network~\cite{netvirt-mtd, jain2013network, pettit:ovn}. Using \emph{flow table-level isolation}, the flow tables in the virtual switch are divided into per-tenant logical data paths that are populated with sufficient flow table entries to link the tenants' resources into a common interconnected workspace~\cite{netvirt-mtd, jain2013network, pettit:ovn}. This workspace practically is an overlay network realized through a tunneling protocol, such as VXLAN. Despite the widespread deployment of virtual networking~\cite{dalton:andromeda,firestone:accelnet,baba-sriov}, providing sufficient (logical and performance) isolation remains a key challenge. Serious isolation problems with the Open vSwitch~\cite{pfaff:ovs} (OVS) have been reported in~\cite{thimmaraju:taking-control}: an adversary could not only break out of the VM and attack all applications on the host, but could also manifest as a worm compromising an entire data center. Other severe isolation vulnerabilities, also in OVS, enable cross-tenant denial-of-service attacks~\cite{sigcomm18policy, 10.1145/3359989.3365431}. Such attacks may exacerbate concerns over the security and adoption of public clouds~\cite{csa-survey}. Jin et al.~\cite{181358} were the first to point out security weaknesses of co-locating virtual switches with the hypervisor, proposing stronger isolation mechanisms. In response, MTS~\cite{thimmaraju:mts} proposes placing per-tenant virtual switches in VMs for increased security isolation. As an alternative to the host-based virtual switch model, implementing virtual networking can also be offloaded to the NIC. While commodity NICs have basic support for switching among virtual machines through SR-IOV and offloads of standard tunneling protocols used in this context, such as VXLAN and NVGRE~\cite{smartnic-broadcom}, programmability at the network edge is invaluable for implementing custom virtualization solutions. While this is already possible in software on platforms like OVS, having a similar level of programmability on NICs can significantly enhance scalability and lower cost of virtualization in data centers. AccelNet~\cite{firestone:accelnet} is an early example of employing such an architecture, which we expect to become standard practice going forward. \subsection{In-network Computation} \label{sec:network-computation} In-network computation is a promising way to address performance bottlenecks and scalability limits of massive network-bound data processing in data centers as often performed in machine learning and big data processing frameworks~\cite{45381, dean2012large}. Such analytics, graph processing, and learning applications, to name a few, exhibit a few charactersistic communication patterns making them suitable for (partial) implementations in the data plane. First, they usually substantially reduce and aggregate the data during processing (e.g., take the sum of the inputs, or find the minimum). It is therefore beneficial to apply these functions as early as possible to decrease the amount of network traffic and reduce congestion. Second, they are usually characterized by simple arithmetic/logic operations which make them suitable for massive parallelization and execution on programmable hardware. Third, in many algorithms these operations are also commutative and associative implying that they can be applied separately and in arbitrary order on different portions of the input data without affecting the correctness of the end result. Correspondingly, most big data applications follow the \textit{map-reduce} pattern to achieve massive horizontal scaling: large-scale computation instances are first partitioned across many edge servers that do partial processing on smaller chunks before the results are again aggregated to obtain the final result. Such many-to-few communication patterns (often referred to as \textit{incast}) are, however, poorly supported in data center deployments incurring significant performance issues. The first attempt at departing from performing data aggregation at edge servers was Camdoop~\cite{camdoop} which supports on-path aggregation for map-reduce applications on top of a direct-connect data center fabric where all traffic is forwarded between servers without switches. While this significantly reduces network traffic and provides a performance increase, it requires a custom network topology and is incompatible with common data center infrastructure. Netagg~\cite{netagg} was a proposal to avoid the limitations of Camdoop by implementing on-path aggregation inside the network layer at dedicated middleboxes. Netagg improves job completion times significantly across a wide range of big data workloads and frameworks including Apache Hadoop. Later, SHArP~\cite{graham2016scalable} removed dedicated ``network accelerator'' middleboxes from the in-network computation stack and presented a generic programmable data plane hardware architecture for efficient data reduction, relying on scalable in-network trees and pipelining to reduce latency for big data processing. Toward the generalization of these approaches, Liu et al. lay the foundations of a in-network computation framework by presenting a minimal set of abstractions they call IncBricks~\cite{liu:incbricks}: an in-network caching fabric with basic computing primitives based on programmable network devices. The authors in~\cite{201474} furthermore ask the related general question of how to overcome the limitations imposed by the usually scarce resources provided on programmable switches, like limited state storage and limited types of operations, for in-network computation tasks. They identify general building blocks that can be used to mask these limitations of programmable switches using approximation techniques and then implement several approximate variants of congestion control and load balancing protocols, such as XCP, RCP, and CONGA~\cite{Alizadeh:2014:CDC:2619239.2626316} that require explicit support from the network. Going even further, the most recent innovations in in-network computation are based on the observation that the network itself may also be used as an accelerator for workloads that are (at first sight) unrelated to networking or packet processing. In particular, machine learning and artificial intelligence workloads have emerged as promising candidates to be (partially) implemented within the network~\cite{net-ai}. More specifically, programmable network devices may be a suitable engine for implementing a CPU’s Artificial Neural Networks co-processor. N2Net~\cite{DBLP:journals/corr/abs-1801-05731} is an example of an in-network neural network, based on commodity switching chips deployed in network switches and routers. Another interesting application that can be implemented in the network is string matching for accelerating information retrieval and language processing use cases. PPS~\cite{Jepsen:2019:FSS:3314148.3314356} is an in-network string matching implementation for programmable switches. The PPS compiler translates a set of keywords to Deterministic Finite Automata (DFA) that can then be realized in hardware as a sequence of match-action tables yielding significantly higher matching throughput than comparable software implementations. These and other advances in leveraging the network itself as a compute platform for a wide variety of workloads demonstrates the versatility and potential of programmable data planes. It is too early to tell which (not directly networking-related) workloads we will see being offloaded to the network ubiquitously and which applications will remain more illustrative and experimental. Nevertheless, given scalability limitations of general-purpose compute resources, we anticipate architectures leveraging in-network computation to be transformative for many workloads. \subsection{Distributed Consensus} \label{sec:distr-cons} Perhaps viewable as a special case of in-network computation, distributed consensus deserves special discourse not only because of the substantial research treatment that it received over the past years but also because it exhibits a special network requirement profile: while general in-network computation is mostly throughput-bound, distributed consensus is much more latency-oriented, often posing delay requirements on the order of a single server-to-server round-trip time (or even less, see \cite{211261}). Distributed consensus describes the coordination among controllers or switches in order to perform a computation jointly and reliably, even in the presence of network failures, arbitrary communication delays, or Byzantine participants. Applications include leader selection, clock synchronization, state replication, and general multi-write key-value stores. NetPaxos~\cite{Dang:2015:NCN:2774993.2774999} demonstrates the feasibility of implementing the venerable Paxos distributed consensus protocol~\cite{Lamport:1978:TCO:359545.359563, DBLP:journals/dc/Lamport06} in network devices, either using certain OpenFlow extensions or by making some assumptions about how the network orders messages. Although neither of these protocols can be fully implemented without changes to the underlying switch firmware, the authors argue that such changes are feasible in existing hardware. Dang et al.~\cite{dang2016paxos} also show the performance benefits achievable by offloading Paxos into the data plane and describe an implementation in P4. In-band mechanisms in the data plane can also be used for synchronization and coordination of other distributed systems components, such as SDN controllers. Schiff et al.~\cite{inbandsync} propose a synchronization framework based on atomic transactions implemented on switches and show that this approach allows realizing fundamental consensus primitives in the presence of failures. In the context of data centers, NetChain~\cite{211261} provides scale-free coordination within a single server-to-server round trip time (RTT), or even less (half of an RTT!). This is achieved by allowing programmable switches to store data and process queries entirely in the data plane, which eliminates the query processing at coordination servers and cuts the end-to-end latency perceived by clients to as little as the processing delay from their own software stack plus network delay. NetChain relies on new protocols and algorithms guaranteeing strong consistency and switch failure handling. Extending these principles to key-value stores, NetCache~\cite{jin:netcache} implements a small key-value store cache in a programmable hardware switch. The switch works as a cache at the data center's rack-level, handling requests directed to the rack's servers. The implementation deals with consistency problems and shows how to overcome the constraints of hardware to provide throughput and latency improvements. SwitchKV~\cite{194904} generalizes this idea by implementing a generic data plane-based key-value query accelerator, with significant improvements in throughput and latency. Programmable network switches act as fast key-value caches by keeping track of cached keys and routing requests at line speed based on the query keys encoded in packet headers, so that the data plane cache nodes absorb the hottest queries and therefore no individual key-value store backend server is overloaded. Furthermore, specialized in-switch key-value stores for network measurement collection and aggregation appear in *Flow~\cite{sonchack:starflow}, Marple~\cite{narayana:marple}, and IncBricks~\cite{liu:incbricks}. Perhaps, an unlikely place to find distributed consensus protocols is in the programmable devices themselves. Deep inside a typical programmable switch lies a rather complex distributed appliance, with multiple match-action tables, parsers, queues, etc., closely cooperating to perform consistent and fast packet processing. It turns out that consistently applying modifications to this pipeline is a rather complex task, in sore need for strong consistency guarantees. Lately, BlueSwitch~\cite{han2015blueswitch} has presented a programmable network hardware design that supports a transactional packet-consistent configuration mechanism: all packets traversing the data path will encounter either the old or the new configuration, and never an inconsistent mix of the two. This will help avoiding network transients like blackholes and micro-loops that often plague today's networks~\cite{goyal2012improving}. \subsection{Resilient, Robust, and Efficient Forwarding} \label{sec:resil-robust-effic} Data planes operate at much faster pace than the typical control plane usually implemented in software. This motivates to move functionality for maintaining connectivity under failures into the switches. At the same time, offloading control planes is non-trivial. The authors in~\cite{curtis:devoflow} make the observation that typical SDN workloads impose significant communication overheads due to frequent interaction between the control and data plane. Some of the control plane functionality, however, can be efficiently offloaded from the controller to the switch itself. In order to meet the needs of high-performance networks, the authors propose and evaluate DevoFlow, a modification of the OpenFlow model which breaks the tight coupling between the SDN control plane and the data plane in a way that maintains a useful amount of visibility for the former without imposing unnecessary communication costs. For common SDN applications, DevoFlow requires notably fewer flow table entries and results in reduced controller-switch communication compared to a traditional OpenFlow realization. Molero et al.~\cite{molero:hw-accel-control-planes} take this idea further and make a general case for offloading control plane protocols entirely to the data plane. Motivated by long convergence times of traditional routing protocols, the authors show that modern programmable switches are powerful enough to run many control plane tasks directly in hardware. As a proof of concept, the authors implement a path vector protocol for programmable data planes in P4 which rapidly converges in the case of link failure while fully respecting BGP-like routing policies. The design of resilient data planes has been studied intensively in the literature. In order to provide high availability, connectivity, and robustness, dependable networks must implement functionality for in-band network traversals, e.g., to find failover paths in the presence link failures~\cite{dp-conn-sdn}. Here, mechanisms based on dynamic state at the switches provide interesting advantages compared to simple stateless mechanisms or mechanisms based on packet tagging. Liu et al.~\cite{dp-conn} propose to move responsibility for maintaining basic network connectivity entirely into the data plane, which operates much faster than the control plane. Their approach to ensure connectivity via data plane mechanisms relies on link reversal routing, adapted to handle operational concerns like message loss or arbitrary delay from the original algorithm by Gafni and Bertsekas~\cite{gafni} (see also~\cite{gafniplus}). Holterbach et.al.~\cite{holterbach:blink} provide an implementation for automatic data-driven fast reroute entirely in the dataplane. Their system, Blink, runs on programmable line-rate switches and detects remote outages by analyzing TCP behavior directly within the switch. In case of failure, Blink quickly restores connectivity and reroutes traffic via backup paths without control plane involvement. While offloading control plane functionality contradicts one of the core concepts of SDN, i.e., reducing the complexity of the data plane by having simple forwarding functions, data plane programmability enables flexibility to the operator in what functions are performed in the network directly. This is opposed to and much more cost-effective than the traditional approach of making network devices generally \textit{smarter} by embedding complex functionality into the data plane by default, which in turn increases overall complexity. We believe that finding the right balance between control plane and data plane responsibilities will remain a hot topic for the years to come. \subsection{Load Balancing} \label{sec:load-balancing} Related to resilient routing, programmable data planes provide unprecedented flexibilities and performance in how traffic can be dynamically load balanced across multiple forwarding paths, workers, or backend servers. For instance, Hedera~\cite{Al-Fares:2010:HDF:1855711.1855730} can also be viewed as a load balancer. The aim is to implement the ``resource pooling'' principle using horizontal scaling \cite{Wischik:2008:RPP:1452335.1452342}, making a collection of independent resources behave like a single pooled resource in order to exploit statistical multiplexing, load distribution, and improved failure resilience. A well-known example is HULA~\cite{hula}, a scalable load balancing solution using programmable data planes. HULA is motivated by the shortcomings of ECMP routing as well as of existing congestion-aware load balancing techniques such as CONGA~\cite{Alizadeh:2014:CDC:2619239.2626316}. Due to limited switch memory, these approaches can only maintain a subset of congestion-tracking state at the edge switches and hence do not scale. HULA is flexible and scalable as each switch tracks congestion only for the best path to a destination through a neighboring switch. Another example of a load balancing application is SilkRoad~\cite{Miao:2017:SMS:3098822.3098824}, which leverages programmable ASICs to build faster load balancers. Beyond multipath load balancers, MBalancer~\cite{lb-mem} addresses the load balancing problem in the context of key-value stores. In particular, distributed key-value stores often have to deal with highly skewed key-popularity distributions, making it difficult to balance load across multiple backends. MBalancer is a switch-based L7 load balancing scheme, which offloads requests from bottleneck Memcached servers by identifying hot keys in the data plane, duplicating these hot keys to multiple Memcached servers, and then adjusting the switches' forwarding tables accordingly. \vspace{0.2cm} \noindent Throughout this chapter we have explored a multitude of applications leveraging programmable data plane technology. We can observe, that use cases that have been around for a while, such as network monitoring or virtual switching, are becoming hot research topics again. Data plane programmability opens avenues to realize these applications at scale and granularity that was previously either impossible or prohibitively expensive. While so far the greatest benefits appear for applications that mainly revolve around networking tasks, we see an increasing number of applications from other (albeit network-related) domains to benefit from data plane programmability. More generalized in-network computation is still in its infancy and we expect to see more research in the direction of offloading applications from various domains to programmable data plane devices. Many of those applications mostly reside at the edge of the network and in the end hosts. This is aligned with a general trend in the research community where programmable data plane technology is increasingly employed at the host-network boundary~\cite{p4-roundtable-2020}. In particular, accelerators placed at end hosts, such as SmartNICs, are a promising platform for this direction. \subsection{Programmable Parsers} \subsection{Reconfigurable Match-Action Tables} \label{sec:prog-rmt} Traditional OpenFlow hardware switch implementations allow packet processing on a fixed set of fields only. Reconfigurable match tables such as RMT~\cite{bosshart:rmt} allow the programmer to match on and modify all header fields (or arbitrary bit ranges) making the devices significantly more flexible and capable. RMT for example is a RISC-inspired pipelined architecture for switching chips which provides a minimal set of action primitives to specify how headers are processed in hardware. This makes it possible to change the forwarding plane without requiring new hardware designs. \subsubsection{Exact matching tables} \label{sec:hash} Large networks (such as data centers running millions of VMs) require efficient algorithms and data structures for their forwarding information bases (FIB) to that scale to millions of entries on commodity switching chips. An attractive approach to realize such memory-efficient and fast exact match FIB operations in software switches is to employ highly concurrent \emph{hash tables}. For example, solutions based on cuckoo hashing such as CuckooSwitch~\cite{dong:cuckoo} have been shown to be able to process high packet rates across the PCI bus of the underlying hardware while maintaining a forwarding table of one billion forwarding entries \subsubsection{Prefix matching tables} \label{sec:lpm} Programmable switches implementing match-action tables in hardware generally need to support different types of operations and tables. Besides exact matches, especially IP address lookups and prefix matching are frequent operations and have thus received much attention in the research community. Given the heavily constrained resources on devices, besides optimizing lookup time, it is important to improve memory efficiency of match-action table representations in hardware. A natural solution to improve the memory efficiency of IP forwarding tables is to employ \emph{FIB aggregation}, by replacing the existing set of rules by an equivalent but smaller representation. Such aggregations can either be performed statically (such as ORTC~\cite{ortc}) or dynamically (such as FIFA~\cite{fifa}, SMALTA~\cite{smalta}, or SAIL \cite{8424420}). R\'etv\'ari et al.~\cite{Retvari:2013:CIF:2486001.2486009} explored the application of compressed data structures to reduce FIB table sizes to an information-theoretical optimum without sacrificing the efficiency of standard operations such as longest prefix match and FIB update. An implementation of their approach in the Linux kernel (using a re-design of the IP prefix tree) shows the feasibility and benefit of this approach. Inspired by Zipf’s law, i.e., the empirical fact that certain rules are used much more frequently than others, caching represents another optimization opportunity. For instance, it may be sufficient to cache only a small fraction of the rules on the fast expensive hardware fast path; less frequently used rules can be then moved to less expensive storage; e.g., to the DRAM of the route processor or software-defined controller. Different FIB caching schemes use different algorithms that minimize the number of updates needed to the cache \cite{bienkowski:online-fib-aggregation,bienkowski:online-tree-caching}. In the context of virtual routers used for flexible network services such as customer-specific and policy-based routing, further challenges related to resource constraints arise. In particular, supporting separate FIBs for each virtual router can lead to significant memory scaling problems. Fu et al.~\cite{Fu:2008:EIL:1544012.1544033} proposed to use a shared data structure and a fast lookup algorithm that capitalizes on the commonality of IP prefixes between virtual FIB instances. \subsubsection{Wildcard packet classification} \label{sec:packet-class} Packet classification, the core mechanism that enables networking services such as firewall packet filtering and traffic accounting, is typically either implemented using ternary TCAMs or software. Both TCAM and software-based approaches usually entail trade-offs between (memory) space and (lookup) time. Content-addressable memory (CAM) and Ternary CAM (TCAM) chips are the most important component in programmable switch ASICs to perform packet classification on configurable header fields. Using dedicated circuitry, rules can be matched in priority order and in only a single clock cycle. In particular, TCAMs classify packets in constant time by comparing a packet with all classification rules of ternary encoding in parallel. A major design challenge of large-capacity CAMs is to reduce power consumption associated with the vast amount of parallel active circuitry, without sacrificing speed or memory density, and while supporting (typically required) multidimensional packet classification~\cite{TCAM3}. Despite their high speed, TCAMs can also suffer from a range expansion problem: When packet classification rules have fields specified as ranges, converting such rules to TCAM-compatible rules may result in an explosion of the number of rules. One approach to reduce TCAM power consumption for high-dimensional classification is to employ pre-classifiers, e.g., considering just two fields such as the source and destination IP addresses. The high dimensional problem can thereby use only a small portion of a TCAM for a given packet. Ma et~al.~\cite{Ma:2012:SPR:2377677.2377749} showed how to design a pre-classifier such that a given packet matches at most one entry in the pre-classifier, avoiding rule replication. SAX-PAC in turns exploits the observation that many practical classifiers include lots of independent rules, allowing the corresponding matches to be made in arbitrary order and usually considering only a small subset of dimensions \cite{Kogan:2014:SAX:2619239.2626294}. TCAM Razor~\cite{Liu:2010:TRS:1816262.1816274}, furthermore, strives to generate a semantically equivalent packet classifier that requires the least number of TCAM entries. It is also known that the negative space-time tradeoff which seems inherent in the design of classifiers, can sometimes be overcome allowing for, e.g., range constraints~\cite{Kogan:2014:SAX:2619239.2626294}. Perhaps the most prominent application of generic wildcard packet classifiers, the Open vSwitch fast-path packet classifier \cite{pfaff:ovs} uses a combination of extensive multi-level hierarchical flow-caching and the venerable Tuple Space Search scheme (TSS) \cite{Srinivasan:1999:PCU:316188.316216}. TSS exploits the observation that real rule databases typically use only a small number of distinct field lengths, therefore, by mapping rules to tuples, even a simple linear search of the tuple space can provide significant speedup over a naive linear search over the filters. In TSS, each tuple is maintained as a hash table that can be searched in constant time. While TSS is used extensively in practice, recently it has been shown that the linear search phase can be exploited in a malicious algorithmic complexity attack to exhaust data plane resources and launch a denial of service attack \cite{sigcomm18policy, 10.1145/3359989.3365431}. \subsection{Fast Table Updates} \label{sec:update} Match-action tables should not only support a fast lookup but also fast updates for inserting, modifying, or deleting rules. Such updates can be accelerated by partitioning and optimizing the TCAM. For example, Hermes~\cite{Chen:2017:HPT:3143361.3143391} trades a nominal amount of TCAM space for assuring improved performance. Also a hybrid software-hardware switch such as ShadowSwitch~\cite{shadowswitch} can help lower the flow table entry installation time. In particular, since software tables can be updated very fast, table updates should happen in software first before being propagated to TCAM to offload software forwarding and to achieve higher overall throughput. Lookups in software should be performed only in case there are no entries matching a packet in hardware. Solutions such as ShadowSwitch further exploit the fact that deleting TCAM entries is much faster than adding them, proposing translating adding entries to a mix of adding in software tables and deleting from hardware tables. \vspace{0.2cm} In general, as the network data plane becomes increasingly programmable and includes more and more embedded algorithms and data structures, research on efficient and dependable approaches will remain active in the coming years. Especially the network data plane within cloud environments is immensely complex already today and maintains substantial embedded state; ubiquitous virtualization may increase complexity even further in the future. Since cloud resources also allow shared access and configuration from tenants, future research on reliable and available algorithms and data structures for cloud data planes is crucial. We believe that the emergence of new types of attacks, such as algorithmic complexity attacks, demand data plane algorithms to provide hard real-time constraints on the amount of resources used for a specific task; the latter is especially important for resource-constrained devices. In addition to complexity, also scalability of data plane algorithms remains an important open problem, also due to quickly growing traffic rates. \subsection{Packet Processing} Packet processing entails five logic steps: \textit{parsing}, \textit{classification}, \textit{modification}, \textit{deparsing}, \textit{forwarding}. \textit{Parsing} is the process of locating the packet header in the data, and extracting its fields' values. Such values are then used during \textit{classification}, i.e., the process that matches a given packet with the corresponding forwarding policy, in order to identify the right forwarding decision for the packet, e.g., which output port to use, as well as the required packet modification actions, e.g., rewriting a header's filed. The \textit{modification} step applies the actions retrieved during classification, and may include also the collection of statistics related to the packet processing, e.g., to increase flow's counters. Once all the modifications are applied, the \textit{deparsing} step assembles a new packet, which includes the modified packet headers, as well as the original packet body. Finally, \textit{forwarding} is the step of sending the assembled packet to an output port for trasmission. This step may include the implementation of scheduling policies, e.g., for the implementation of Quality of Service (QoS) guarantees. \subsection{Switching ASICs} A switching ASIC is specialized in performing packet processing, focusing on implementing just the set of operations required for such task. In fact, network devices built using ASICs generally include a second general purpose sub-system, e.g., based on CPUs, in order to implement the device's monitoring and control functions, as well as more complex (and uncommon) packet processing functions that the ASIC does not support. The processing in ASIC is usually called the \textit{fast path}, by contrast, the \textit{slow path} is the processing done by the general purpose sub-system. A typical ASIC design is organized as a fixed pipeline of stages that performs sequentially the packet processing steps, as outlined earlier. When a packet is received, the packet parser extracts the values of the packet header's fields, and stores them in a so-called \textit{metadata} bus, which can be accessed throughout the processing pipeline. In many cases, the metadata bus is limited to a size of few hundreds bytes~\cite{bosshart:rmt}, which also limits the number and size of values that can be parsed. The packet body is instead stored in a separated packet buffer, which is accessed only after a packet forwarding decision has been taken, in order to copy the data to the destination output port. The values stored in the metadata bus are used for the classification step, which is implemented using lookup tables. Such tables can be both organized as a sequential pipeline, or sometime they may operate also in parallel, to reduce processing latency. Each table is specialized (or programmed) to match on a subset of the extracted header fields. The tables may further have different matching capabilities depending on the way they are implemented by the hardware. For instance, exact matching tables could be implemented as hashtables in an SRAM, while wildcard matching tables are generally implemented using more expensive TCAM. The outcome of the classification step provides the packet modification instructions that are applied in the last processing step. Fast arrays of Arithmetic Logic Units (ALUs) are employed to implement such instructions in parallel on the data contained in the metadata bus. Since such bus also contains the information about the destination output port of the packet, potentially including information relevant for priority and scheduling decisions, modifying such values actually corresponds to the definition of the packet's forwarding action. The data in the metadata bus are finally used by the deparser to reassemble the packet, before passing it to the forwarding step, along with the priority and scheduling information. Finally, the packet is generally handled by a scheduler block that transmits it to the designed output port. The above structure may be repeated, more than once in a switching ASIC. For instance, it is common to have multiple classification and modification stages between the parsing and deparsing steps. Furthermore, in many switches it is common to have at least two such pipelines, generally named the ingress and egress pipeline. \subsection{Network Processors} SmartNICs have an architecture that comprises several different hardware blocks. Some blocks are dedicated to network-specific operations that have to do with e.g., load balancing, encryption, etc. Some other hardware resources are instead dedicated to programmable components that are generally used to implement new network protocols and/or packet operations. The Netronome NFP programmable architecture is shown in Fig.~\ref{fig:netronome} and described next. Since network traffic is a mainly parallel workload, with packets belonging to independent network flows, these devices are optimized to perform parallel computations, with several processing cores. In Netronome terminology, a programmable processing core is named micro-engine (ME). The programming of MEs happens, among other means, using a C dialect called \textit{micro-C}. The language is essentially a version of C extended with constructs and functions that are specific to the NFP chip. Each ME has 8 threads, which share local registries that amount for a total of 4KB. MEs are further organized in islands, and each island has two shared SRAM memory areas of 64KB and 256KB, called CLS and CTM, respectively. Generally, these memory areas are used to host data required for the processing of each network packet. Finally, the chip provides a memory area shared by all islands, the IMEM, of 4MB SRAM, and a memory subsystem that combines two 3MB SRAMs, used as cache, with larger DRAMs, called EMEMs. These larger memories generally host the forwarding tables and access control lists used by the networking subsystem to decide how to forward (or drop) a network packet. MEs can communicate and synchronize with any other ME, irrespective of the location (i.e., same or different islands). Of course, communications across islands take longer and may impact the performance of a running program. \begin{figure}[t!] \centering \includegraphics[width=1.0\columnwidth]{imgs/nfp.png} \vskip -10pt \setlength{\belowcaptionskip}{-15pt} \caption{The architecture of a Netronome NFP4000's programmable blocks. Other hardware blocks specialized for network packet processing are not shown.} \label{fig:netronome} \vspace{-1.5em} \end{figure} \subsection{Switch-level abstractions} The differences among data plane technologies are often reflected in the packet processing primitives exposed to the control plane and programming language constructs that can be used to combine these primitives to implement the required pipeline. Given this inherent architectural coupling, we next discuss common abstractions used and exposed in programmable data plane systems. We start by discussing programmable packet processing pipelines before diving deeper into abstractions for packet parsing and scheduling. Finally, we review programming languages and compilers for programmable data planes. \subsection{Programmable Packet Processing Pipelines} \label{sec:pipeline-abstractions} Flexible packet processing is the core capability of programmable data planes. Today's programmable packet processing pipelines are generally built on top of three fundamental abstractions: the data flow graph abstraction, the match-action pipeline abstraction, and state machine abstractions that allow implementing stateful processing. \subsubsection{Data flow graphs} \label{sec:graph} Early designs for packet processing systems borrowed heavily from generic systems design~\cite{DataFlowDiagram} and machine learning~\cite{45381}, adopting the data flow graph abstraction to architect programmable switches~\cite{morris:click}. This model is also heavily used in stream processing frameworks such as Apache Flink or Spark. A data flow graph describes processing logic as a graph, with the nodes representing elemental computation stages and edges representing the way data moves from one computation stage to another. A nice property of this abstraction is its simplicity, allowing the programmer to assemble a well-defined set of processing nodes into meaningful programs using a familiar graph-oriented mental model. This way, computational primitives (nodes) are developed only once and can then be freely reused as many times as needed to generate new modular functionality, creating a rapid development platform with a smooth learning curve. Perhaps the earliest programmable switch framework adopting the data flow graph abstraction was the Click modular software router~\cite{morris:click}. The unit of data moving through the Click graph is a network packet on which nodes can perform simple packet processing operations, such as header parsing, checksum computation and verification, field rewriting, or checking against ACLs. Some nodes provide network protocol-specific functions, such as handling ARP requests and responses, while others offer more general data flow control functions, such as load balancing, queueing, or branching (selecting the next processing stage out of several alternatives). ClickOS~\cite{clickOS}, FastClick \cite{barbette:fast-click}, Vector Packet Processing (VPP) from the FD.io project~\cite{fd:io}, the Berkeley Extensible Software Switch (BESS,~\cite{han:softnic}), and NetBricks~\cite{Panda:NetBricks} adopt a similar design, with the difference that the fundamental data unit moving along the data flow graph is now a vector of packets instead of a single packet. This development stems from the observation that batch-processing amortizes I/O costs over multiple packets and that using built-in vector instruction sets of modern CPUs results in more efficient software implementations~\cite{Han:2010:PGS:1851182.1851207, intel:dpdk, barbette:fast-click}. NetBricks, in addition, introduces a new framework for the isolation of potentially untrusted packet processing nodes, using novel language-level constructs and zero-cost compile-time abstractions~\cite{Panda:NetBricks}. The presence of user-defined functionality abstracted as data flow graph nodes gives a great flexibility and extendibility~\cite{clickOS, climb}. At the same time, this flexibility tends to make the resulting designs piecemeal, and heterogeneity complicates high-level network-wide abstractions and encumbers performance optimization~\cite{li:clicknp, 246322}. \subsubsection{Match-action processing} \label{sec:match-action} The match-action abstraction describes data plane programs using a sequence of lookup tables (flow tables) organized into a hierarchical structure~\cite{mckeown:openflow, bosshart:p4, pfaff:ovs, Shahbaz:2016:PPP:2934872.2934886, Molnar:2016:DSH:2934872.2934887}. A subset of the packet header fields is used to perform a table lookup to identify the corresponding packet processing actions, which can then instruct the switch to rewrite packet contents, encapsulate\slash decapsulate tunnel headers, drop or forward the packet, or defer packet processing to subsequent flow tables. The programmer configures the packet processing behavior through dynamically setting the content of the flow tables, by adding, removing, or modifying individual entries with the associated matching rules and processing actions via a standardized API \cite{pfaff2016converging}. This has the benefit of exposing reconfigurable data plane functionality to operators using the familiar notion of \emph{flows} described by matching \emph{rules} defined over header fields, an abstraction extensively used in firewalls and ACLs. Hierarchies of lookup tables, as also used by conventional fixed-function router ASICs, are used to synthesize more complex L2\slash L3\slash L4 pipelines. The match-action abstraction was popularized for programming switches by the OpenFlow protocol~\cite{mckeown:openflow}, which in turn borrowed greatly from Ethane~\cite{Casado:2007:ETC:1282380.1282382}. OpenFlow in its first version allowed the definition of only a single flow table using a rather limited set of header fields; the abstraction was later extended to a pipeline of multiple flow tables defined over a large array of predefined header fields. With the introduction of multi-table match-action pipelines in the OpenFlow v1.1 specification, the distinction between the data flow graph and the match-action abstractions has become increasingly blurry~\cite{mckeown:openflow}. As illustrated using an example in Figure~\ref{fig:ma-df}, a hierarchical match-action pipeline can easily be conceptualized as a special data flow graph with lookup tables as processing nodes and ``goto-table'' instructions as the edges. \begin{figure}[t!] \centering \includegraphics[width=0.85\columnwidth]{imgs/ma-df} \caption{Simplified match-action table dependency graph for a basic router (inspired by Fig. 3 in~\cite{bosshart:p4}).} \label{fig:ma-df} \end{figure} Currently Open vSwitch~\cite{pfaff:ovs} remains the most popular OpenFlow software switch, using a universal flow-caching based datapath for implementing the match-action pipeline. This design was improved upon by ESwitch~\cite{Molnar:2016:DSH:2934872.2934887}, introducing data plane specialization and on-the-fly template-based datapath compilation to achieve line-rate OpenFlow software switching. Despite being widely adopted, OpenFlow is limited in matching arbitrary header fields. This sparked research in flexible lookup tables with rich semantics, configurable control flow, and platform-specific extensions. Driven by the advances in switching ASIC technology, the Reconfigurable Match Tables (RMT) abstraction~\cite{bosshart:rmt} overcomes the main limitations in OpenFlow ASICs in two ways, by letting match-action tables to be defined on arbitrary header fields and extending the previously rather limited set of packet processing actions available. While RMT allows for matching on arbitrary bit ranges within a packet header and applying modifications to the packet headers in a programmable manner, applications for this architecture are still constrained by the rigid sequential design of the architecture. dRMT~\cite{dRMT} relaxes some of these sequential processing constraints and provides a more flexible architecture by separating memory banks for matching packets from processing stages. This design allows using hardware resources more efficiently and, compared to RMT, increases the set of programs mappable to line-rate hardware architectures. Lately, P4~\cite{bosshart:p4} and the accompanying hardware and software switch projects~\cite{flexpipe, barefootTofino, Shahbaz:2016:PPP:2934872.2934886} have been met with increasing enthusiasm from the side of device vendors, operators, and service providers~\cite{juniperp4, stratum}. \subsection{Stateful Packet Processing} \label{sec:state} In the early days of the Internet, most stateful packet processing has taken place at the end hosts (e.g., to terminate a TCP connection) while most packet forwarding and processing within the network operated in a stateless manner (i.e., devices do not need to keep track of any state between packets). Today, stateful network functions are commonplace and include firewalls, network address translators, intrusion detection systems, load balancers, and network monitoring appliances~\cite{verdu:characterization-stateful-net-apps}. With the emergence of high-performance packet processing capabilities in software, network functions are routinely implemented in commodity servers, an approach referred to as network function virtualization (NFV). More recently, programmable line rate switches allow for comprehensive programmability. As a result, these devices are commonly used for tasks other than switching and routing. We will discuss examples of new use cases and applications in Section~\ref{sec:apps}. \subsubsection{Programming abstractions for stateful packet processing} Providing flexible and platform-independent programming abstractions for stateful packet processing on programmable data plane devices remains a major challenge today. Due to the complexities and constraints associated with most platforms, stateful packet processing is often still implemented in SDN controllers, significantly reducing overall network performance. Toward this problem, several works propose abstractions around finite state machines (FSM) for simplified programming of stateful packet processing pipelines. Data plane programs defined using the FSM abstraction can then be compiled for and offloaded to line rate hardware devices~\cite{bianchi:opp, moshref:fast, pontarelli:flow-blaze, bianchi:openstate}. Other more language-focused approaches include Domino~\cite{sivaraman:domino}, which introduces the abstraction of \textit{packet transactions} that allows expressing stateful data plane algorithms in a C-like language without having to define match-action tables or other architecture-related details. Hardware designers can specify their instruction sets through small processing units called atoms that the Domino compiler configures based on the application code. The work on Domino also provides a machine model for programmable line-rate switches, called Banzai machine, that can be used as a target for Domino programs and is available to the community. While Domino programs target a single switch, SNAP~\cite{arashloo:snap} allows programmers to develop stateful networking programs on top of a ``single switch'' network-wide abstraction. The SNAP compiler handles how to distribute, place, and optimize access to state arrays across multiple hardware targets. Finally, SwingState~\cite{luo:swingstate} is a state management framework that enables consistent state migration among programmable data planes by piggybacking state updates to regular network packets. A static analyzer for the P4 language detects which state needs to be migrated and augments the code for in-band state transfer accordingly. While FSMs provide a naturally suited abstraction for stateful packet processing, realizing scalable stateful packet processing systems based on programmable data plane systems is still challenging and appears to be one factor hindering the adoption of programmable data plane technology. In particular, realizing low-latency stateful applications in programmable ASICs is cumbersome due to target-specific requirements and constrained memory and stateful ALU resources. \subsubsection{State management in virtualized network functions} NFV promises simplifying middlebox deployment, improving elasticity and fault tolerance while reducing costs. In practice, however, it remains challenging to deliver on these promises due to the tight coupling of state and processing in NFV environments. State either needs to be shared among NF instances or is kept local for a certain subset of network flows. In either way, keeping network-wide state consistent and thus the NF's behavior correct in the face of dynamic scaling or failures is non-trivial. There are several lines of work aiming at alleviating this problem. Generally, they can be classified in approaches that (a) keep all state local to a NF and transfer state when required~\cite{palkar:e2, qazi:simple, sekar:comb}, (b) mix local and remote state~\cite{gember:opennf, rajagopalan:split-merge}, and (c) use centralized or distributed remote state~\cite{kablan:stateless, woo:s6}. Relatable to SwingState~\cite{luo:swingstate} in this context is StateAlyzr~\cite{khalid:statealyzr}, a static analysis framework for data plane programs. Given network function code, it identifies state that would need to be migrated and cloned to ensure state consistency in the face of traffic redistribution or failure. The authors find that for many network functions, their system can reduce the amount of state that needs to be migrated significantly compared to naive solutions. Instead of continuously migrating state, we believe that the conceptually simple approaches around state centralization enabled through novel extremely low-latency interconnects, advanced caching and failover strategies are a promising direction forward. StatelessNF~\cite{kablan:stateless} is a prominent example of this strategy leveraging the RAMCloud key-value store and InfiniBand networking. \subsection{Programmable Parsers} \label{sec:parsing} Perhaps the most fundamental operation of every network device is to parse packet headers to decide how packets should be processed. For example, a router uses the IP destination address to decide where to send a packet next and a firewall compares several fields against an access control list to decide whether to drop a packet. Packet parsing can be one of the main bottlenecks in high speed networks because of the complexity of packet headers~\cite{gibb:programmable_parsers}. Packets have different lengths and consist of several levels of headers prepended to the packet payload. At each step of encapsulation, an identifier indicates the type of the next header or, eventually, the type of data subsequent to the header leading to long sequential dependencies in the parsing process. Moreover, headers often only provide partial information (e.g., MPLS) and do not fully specify the subsequent header type, requiring further table lookups or speculative execution. Implementing low-latency parsers for high-speed networks is particularly challenging. In order to minimize overheads, switches often employ a \emph{unified packet parser}. Such parsers use an algorithm that parses all supported packet header fields in a single pass. While this can improve performance, it also increases complexity and may become a security issue, especially for virtual switches~\cite{vamp}. Programmability is another key requirement as header formats may change over time, e.g., due to new standards or due to the desire to support custom headers. Examples of more recent header structures include PBB, VxLAN, NVGRE, STT, or OTV, among many more. In order to support new or evolving protocols, a programmable parser can use a parse graph that is specified at runtime, e.g., leveraging state tables implemented in RAM and/or TCAM~\cite{gibb:programmable_parsers}. \subsection{Programmable Schedulers} \label{sec:prog-sched} Exposing programmable interfaces for scheduling and queuing strategies is another core functionality in the context of programmable networks. Sivaraman et al.~\cite{sivaraman:prog-packet-scheduling} present a solution which allows known and future scheduling algorithms to be programmed into a switch without requiring hardware redesign. The proposed design uses the property that scheduling algorithms make two decisions: in what order to schedule packets and when to schedule them. Additionally, the authors exploit the fact that in many scheduling algorithms a definitive decision on these two questions can be made at an early stage of processing, when a packet is enqueued. The resulting design uses a single abstraction: the push-in first-out queue (PIFO), a priority queue that maintains the scheduling order or time. Another design for a programmable packet scheduler was presented by Mittal et al.~\cite{194964}. The authors show that while it is impossible to design a universal packet scheduling algorithm, the classic Least Slack Time First (LSTF) scheduling algorithm provides a good approximation and can meet various network-wide objectives. Implementing fair queuing mechanisms in high-speed switches is generally expensive since complex flow classification, buffer allocation, and scheduling are required on a per-packet basis. Motivated by the question of how to achieve fair bandwidth allocation across all flows traversing a link, Sharma et al.~\cite{sharma:approx-fair-queueing} present a dequeuing scheduler, called Rotating Strict Priority, which simulates an ideal round-robin scheme where each active flow transmits a single bit of data in every round. This allows to transmit packets from multiple queues in approximately sorted order. The trend toward increasing link speeds and slowdown in the scaling of CPU speeds, leads to a situation where packet scheduling in software results in lower precision and higher CPU utilization. While this drawback can be overcome by offloading packet scheduling to hardware (e.g., NICs), doing so compromises on the flexibility benefits of software packet schedulers. Ideally, packet scheduling in hardware should hence be programmable. Motivated by the insight that ''in the era of hardware-accelerated computing, one should identify and offload common abstractions and primitives, rather than individual algorithms and protocols'', Shrivastav in~\cite{shrivastav:packet-scheduler-hardware} proposes a generalization of the Push-In-First-Out (PIFO) primitive used by state-of-the-art hardware packet schedulers: Push-In-Extract-Out (PIEO) maintains an ordered list of elements, but allows dequeueing from arbitrary positions in the list by supporting programmable predicate-based filtering when dequeuing. PIEO supports most scheduling (work-conserving and non-work conserving) algorithms which can be abstracted as the following scheduling policy: Assign each element (packet/flow) an eligibility predicate and a rank. Whenever the link is idle, among all elements whose predicates are true, schedule the one with the smallest rank. The predicate determines when an element becomes eligible for scheduling, while rank decides in what order to schedule amongst the eligible elements. With the hardware design of the PIEO scheduler, also presented in~\cite{shrivastav:packet-scheduler-hardware}, the scalability of this approach is demonstrated. \subsection{Programming Languages and Compilers} \label{sec:lang-comp} An important dimension of programmable data planes regards the programming languages and compilers used to realize the data plane functionality. Over the last years, we have witnessed several promising efforts that go beyond low-level SDN protocols, such as OpenFlow, ForCES, or NETCONF. New high-level data plane programming languages allow to specify packet processing policies within a specific switch architecture in terms of abstract, generic, and modular language constructs. These efforts are largely driven by the needs of operators toward more complex SDN applications. Furthermore, the capabilities of modern, more flexible and programmable line rate networking hardware has motivated language approaches to specify the switch processing architecture (i.e., the layout of match-action tables and protocols supported in the parsing stage). The conceptual differences between these two classes of language abstractions found in programmable data plane systems today are depicted in Figure~\ref{fig:languages}. \begin{figure}[t] \centering \includegraphics[width=0.85\columnwidth]{imgs/languages} \caption{Comparison of Languages and Protocols used in Programmable Data Planes} \label{fig:languages} \end{figure} \subsubsection{SDN policy definition} Languages for SDN programming generally differ in the amount of visibility that should be provided in SDNs (see \cite{curtis:devoflow} for a discussion on this). A well known language is Frenetic, a programming language for writing composable SDN applications using a set of high level topology and packet-processing abstractions. Pyretic~\cite{foster:languagesForSDN} improves on Frenetic by adding support for sequential composition, more advanced topology abstractions, and an abstract packet model that introduces virtual fields into packets. Modular applications can be written using the static policy language NetCore~\cite{monsanto:netcore, monsanto:composing-sdn}, which provides primitive actions, matching predicates, query policies, and policies. Maple~\cite{voellmy:maple} simplifies SDN programming (1) by allowing a programmer to use a standard programming language to design an arbitrary, centralized algorithm, controlling the behavior of the entire network, and (2) by providing an abstraction where the programmer-defined, centralized policy is applied to every packet entering a network. Providing solid mathematical foundations to networking is one of the basic desires of SDNs. NetKAT~\cite{Anderson:2014:NSF:2535838.2535862} is one of the major efforts towards this objective. NetKAT proposes primitives for filtering, modifying, and transmitting packets, operators for combining programs in parallel and in sequence, and a Kleene star operator for iteration. NetKAT comes with provable guarantees that the language is sound and complete. In general, functional languages have become popular to provide such higher levels of abstractions, also including languages such as PFQ-Lang~\cite{bonelli:pfq}, which allows to exploit multi-queue NICs and multi-core architectures. \subsubsection{Low-level data plane definition} At the heart of today's programmable data planes lies the question of how to specify and reconfigure the low-level architecture and configuration of programmable switching chips (i.e., the layout and sequence of match-action tables, the protocols understood by the protocol parser, and the actions supported) in an expressive and flexible manner. An early and the most prominent language abstraction and compiler for specifying low-level packet processing functionality within programmable data planes is P4~\cite{bosshart:p4}. Motivated by the limitations of existing SDN control protocols, such as OpenFlow, which only allow for a fixed set of header fields and actions, P4 makes it possible to define packet processing pipelines together with parsers and deparsers, and match-action tables, and low-level operations that are applied to each packet. This language abstraction allows for protocol-independent packet processing by matching on arbitrary bit ranges and applying user-defined actions. Such abstract P4 programs are compiled for the specific underlying data plane target. The origins of P4 go back to work by Lavanya et al.~\cite{lavanya:compiling-packet-programs} who study how to map logical lookup tables to physical ones while meeting data and control dependencies in the program. The authors also present algorithms to generate programs optimized for latency, pipeline occupancy, or power consumption. The compiled data plane program is then used to configure the underlying hardware or software target, and the P4-defined match-action tables are populated at runtime via a control interface, such as P4Runtime~\cite{p4-runtime}. P4 rapidly gained immense popularity in the research community and is used in countless projects. Particularly, the wide range of supported targets from software switches to full reconfigurable ASICs as well as strong industry adoption make P4 a key enabling technology for comprehensive and flexible data plane programmability. For example, P4FPGA~\cite{wang:p4fpga} is a open source compiler and runtime for P4 programs on FPGAs. By combining high-level programming abstractions offered by P4 with a flexible and powerful hardware target, P4FPGA allows developers to rapidly prototype and deploy new data plane applications. A second work in this direction is P4->NetFPGA~\cite{ibanez:p4netfpga}, which integrates the function described with P4 in the NetFPGA processing pipeline. Other compilers exist for different software switching architectures, SmartNICs, and reconfigurable ASICs. Extended programmability in the data plane also opens avenues for introducing bugs or writing insecure code. Ensuring correctness of programs is therefore also of high importance for data plane programs. Network verification and program analysis approaches aim at alleviating these issues. While widely in use in traditional network paradigms, network verification for fully programmable data plane systems is still an area of ongoing research. To this end, Dumitrescu et.al.~\cite{dumitrescu:netdiff} propose a new tool and algorithm, called netdiff, to check the equivalence of related P4 programs and FIB updates in order to detect inconsistent behavior and bugs in data plane implementations. Also with the goal of simplifying P4 development, better testing programs, and identifying bugs early, Bai~et~al. propose NS-4~\cite{bai:ns4} a comprehensive simulation framework for P4-defined data planes. NS-4 integrates with the popular network simulator ns-3 and can efficiently simulate large multi-node networks running data planes written in P4. While P4-like language abstractions dominate the programmable packet processing landscape, parts of the abstraction, in particular as required for statfule processing or scheduling, have not yet found a definitive winner. It appears that not a single abstraction can in fact cover all of these aspects and more pointed and specialized abstractions will emerge. While these subdomains are still being actively researched, we see the composition of the different abstractions as a major challenge for future research; the protocol-independent switch architecture (PISA) is a starting point in this space. Similarly, it remains unanswered how different, independent data plane programs should run alongside on the same hardware. This is required to enable modular composition of network programs, and may eventually also enable multi-tenant virtualization scenarios. \subsection{Improved Abstractions} \noindent \textit{Which abstractions provide an optimal tradeoff between functionality, performance, and API simplicity?} A first major research challenge revolves around novel \emph{abstractions}. As we have seen, the art and science of programmable switch architectures revolve around abstractions. Ideally, an abstraction should be simple enough to capture just the right amount of configurable data plane functionality to admit efficient hardware and software implementations, but profound enough to allow higher layers to synthesize complex packet processing behavior on top of. Moreover, such an abstraction should be easily exposable to the control plane through a secure and efficient data plane API~\cite{p4runtime, mckeown:openflow}. It should adequately handle global state embedded in the data plane and provide a well-defined consistency model~\cite{woo:s6}. It should admit analytic performance models~\cite{188972, Molnar:2016:DSH:2934872.2934887} and automatic program transformations for performance optimization~\cite{Molnar:2016:DSH:2934872.2934887}. It should separate static semantics from dynamic behavior~\cite{retvari:dynamic}. And last but not least, it should embrace a convenient mental model that is familiar to network operators and programmers. Not surprisingly, many of the open problems in the field are related to finding the right abstraction for the data plane functionality. \subsection{Efficient Reconfigurability} \noindent \textit{How to support more efficient yet consistent reconfigurability in the data plane?} A related issue regards the support for reconfigurability. Alongside the move from the rigid programming model of OpenFlow to the more flexible P4 world, comes the desire to expose every aspect of processing functionality a switch may perform to be reconfigured for different and changing use cases in a flexible and efficient manner. This is not limited to the way packet processing policies are represented in the data plane, including the method by which packets are associated with the respective processing actions to be executed on them, but extends to further critical packet processing operations, and the reconfigurability thereof, ranging from programmable packet parsing~\cite{gibb:programmable_parsers} to universal scheduling and queuing schemes~\cite{194964, sivaraman:prog-packet-scheduling}. In particular, changing data plane behavior at runtime without disrupting packet processing~\cite{sonchack:starflow} remains an open problem. \subsection{Scalability} \noindent \textit{How to realize high performance implementations of data planes, especially stateful ones?} The need to scale systems to handle massive workloads increasingly pushes designers to explore more complex solutions that handle some state already in the data plane~\cite{Miao:2017:SMS:3098822.3098824, jin:netcache, 201474}. While stateless packet processing approaches are rather solid at this point in time, stateful approaches are still in their infancy and no clear winner has emerged yet. The complexity of a stateful abstraction lays in the need to address state management problems (e.g., consistency) in a programmer-friendly way while guaranteeing high performance. This is especially challenging as frequently reading from and writing to memory, as it is continuously required in packet processing workloads, is still one of the main sources of performance issues in modern computing systems~\cite{bosshart:rmt, memory}. \subsection{Network Automation} \noindent \textit{How to design more automated and self-adjusting networks that map high-level policies to the underlying physical infrastructure and autonomously adapt to changing demands or failures?} A major current trend in networking concerns \emph{automation}. Over the last years, the vision of ``self-driving'' communication networks which adapt and optimize themselves towards their current workload has emerged. Related to this trend is also the notion of ``intent-based networking'' which describes the vision of designing and operating networks in terms of higher-level business policies, and letting the network deal with low-level concerns in an automated, data-driven, agile, secure, and verifiable way~\cite{intent}. Recent progress in high-level network programming languages has delivered important insights to realize the vision of intent-based networking in the form of efficient language constructs and modular composition frameworks~\cite{monsanto:composing-sdn, voellmy:maple, Kim:2015:KVD:2789770.2789775, NetEgg, foster:languagesForSDN, lavanya:compiling-packet-programs}. Yet, it is still not clear how to best expose data plane functionality to the operator offering the maximum programming freedom while masking the underlying complexities efficiently. Ideally, an ``intent-based data plane compiler'' should actively attempt to find the data plane representation that would yield the highest performance~\cite{Molnar:2016:DSH:2934872.2934887} with the minimal data plane footprint~\cite{Retvari:2013:CIF:2486001.2486009, Liu:2010:TRS:1816262.1816274}, built on a firm theoretical foundation for optimizing data plane programs and reasoning about performance~\cite{188972, Molnar:2016:DSH:2934872.2934887}. \subsection{Verification, Monitoring, and Security} \noindent \textit{How to design efficient verification, monitoring, and security frameworks which allow the operator to reliably reason about the correctness, performance, and security of the data plane?} Data plane compilation, that is, downward mapping from the intent layer to the data plane is just one side of the coin. In fact, highly related to the challenges associated with automatically adapting the network to changing environments is the need to verify the correctness and sufficiency of a configuration change. To close the control loop, an upwards mapping is also necessary, which would permit the control plane to monitor and verify the operations of the data plane. Indeed, recent results indicate that the network should be architected from the ground up with verifiability in mind~\cite{Kim:2015:KVD:2789770.2789775}, which may require the definition of new abstractions. Related to verifying correctness, as programmability also opens up more ways to introduce vulnerabilities and new attack surfaces, it is important to ensure that the data plane operates in a secure manner. While significant work has been done on the security of SDNs in general, we believe that new extensively programmable data plane systems will require new security models and verification objectives. For example, many such attack vectors are related to compilers; fuzzing is a promising direction for uncovering such bugs~\cite{agape:p4fuzz, ruffy:gauntlet}. In general, given the mission-critical role the data plane plays, the success of novel data plane technologies will depend on the reliability and security guarantees they can provide. \subsection{General-purpose Hardware} \label{ssec:general-purpose-hardware} General-purpose hardware architectures and CPUs (like x86 or ARM), commonly used in commodity servers and deployed in data centers at massive scales, support a wide range of packet processing tasks. For example, efforts of telecom operators towards advancing the 5G cellular network standards and network function virtualization \cite{7926921, sdn-nfv-5g-tut, 8468219} rely on the capability to perform high-performance packet processing with general-purpose servers~\cite{Panda:NetBricks, khalid:statealyzr}. Modern virtualized data centers usually have servers running the network access layer~\cite{pettit:ovn, netvirt-mtd}, using a software switch that connects virtual machines to the physical network \cite{pfaff:ovs, Molnar:2016:DSH:2934872.2934887, Barach:VPP, thimmaraju:mts}. Driven by these requirements, over the past years, software-based packet processing has made significant inroads in the traditionally hardware-dominated network appliance market \cite{Pongracz:2013:CSM:2491185.2491204, Egi:2008:THP:1544012.1544032, Greenhalgh:2009:FPR:1517480.1517484} with several established programmable software switch platforms for efficient network virtualization (VPP \cite{Barach:VPP}, BESS \cite{han:softnic}, FastClick \cite{barbette:fast-click}, NetBricks \cite{Panda:NetBricks}, PacketShader \cite{Han:2010:PGS:1851182.1851207}, and ESwitch \cite{Molnar:2016:DSH:2934872.2934887}), user space I/O libraries (PacketShader \cite{packetshader}, NetMap~\cite{rizzo:netmap}, Intel DPDK~\cite{intel:dpdk}, RDMA \cite{Kalia:2014:URE:2619239.2626299}, FD.io \cite{fd:io}, and Linux XDP with eBPF \cite{bertin2017xdp}), and NFV platforms \cite{zheng2018grus, kulkarni_nfvnice:_2017, 211263, Sun:2017:NEN:3098822.3098826, 211291}. At a high level, packet processing in a server is a simple process that includes copying the packet's data from a NIC buffer to the CPU, processing it for parsing and modification/update steps before copying or moving the data again to another NIC buffer or to some virtual interface~\cite{info3-article-2019-1}. In practice, this process is significantly more cumbersome due to the complex architecture of modern server hardware, whereby achieving high performance for networked applications requires accounting for the architecture and characteristics of the underlying hardware \cite{10.1145/3286062.3286073}. For example, modern multi-processor systems implement Non-uniform Memory Access (NUMA) architectures, which make the relative location of NICs, processors, and memory relevant for the delay and performance of data movements~\cite{barbette:fast-click, Neugebauer:PCIeBench}. Optimizing for the system's memory hierarchy can result in performance gains or penalties of several orders of magnitude~\cite{Barach:VPP}. To accelerate network packet input and output, several shortcuts in the path a packet takes from the wire to the CPU both in software and at the hardware-level exist. In software, kernel-bypass networking can be used to map the memory area used by NICs to write packets to or read packets from directly into user space. This eliminates costly context switches and packet copies vastly improving networking performance compared to standard sockets. Applications using kernel-bypass frameworks, such as NetMap~\cite{rizzo:netmap} or Intel DPDK~\cite{intel:dpdk}, however, cannot use any kernel networking interfaces and need to implement all packet processing functionality they may need (e.g., a TCP stack or routing tables). The Express Data Path in the Linux kernel (XDP)~\cite{hoiland-jorgensen:xdp} alleviates this problem by allowing packet processing applications to be implemented in a constrained execution environment in the kernel while using some of the OS host networking stack. At the hardware-level, modern NICs implement Data Direct I/O (DDIO)~\cite{intel:ddio, 254372} in order to copy a received packet descriptor directly into the CPU L3 cache bypassing the comparatively slow main memory. Finally, as servers have evolved into multi-processors and multi-core architectures, carefully planning for resources contention cases is important to provide high performance \cite{211291}. Given the above hardware properties and constraints, software implementations apply a number of techniques to efficiently use the available resources \cite{info3-article-2019-1, pfaff:ovs, 10.1145/3286062.3286073}. Packets are usually processed in batches to amortize the cost of locks on contended resources across the processing pipeline and to improve data locality. Here, locality is important especially for the data required to process a packet, e.g., a lookup table needed for packet classification. Furthermore, it may reduce the amount of misses in the CPU's instruction cache, which may be beneficial for some more complex programs with many instructions~\cite{Barach:VPP}. Other typical techniques include adopting data structures that minimize memory usage to better fit in caches \cite{Retvari:2013:CIF:2486001.2486009}, aligning data to cache lines to avoid loading multiple cache lines for few additional bytes \cite{Molnar:2016:DSH:2934872.2934887}, and distributing packets across different processors keeping flow affinity to avoid cache synchronization issues \cite{211263, Sun:2017:NEN:3098822.3098826}. Apart from these general optimization techniques, a software implementation can use several further optimization strategies to accelerate packet processing \cite{info3-article-2019-1}. For instance, ClickOS~\cite{clickOS}, FastClick \cite{barbette:fast-click} and BESS \cite{han:softnic} implement a run-to-completion model, in which each packet is entirely processed before processing a second packet on the same core, whereas NFVnice~\cite{kulkarni_nfvnice:_2017} uses standard Linux kernel schedulers and backpressure to control the execution of packet processing functions. Differently, VPP~\cite{Barach:VPP} performs pipelined processing, performing each single processing step on the entire batch of packets, before starting the next processing step. Likewise, parsing, classification and modification/update steps can be intertwined as needed and desired by the programmer \cite{han:softnic, barbette:fast-click}. Lazy parsing can be employed to avoid unnecessary and costly parsing operations, e.g., for packets that are to be dropped early \cite{bertin2017xdp}. All these different approaches are of course possible due to the flexibility of general-purpose CPUs which do not mandate any specific processing model. With the emergence of specialized accelerators for offloading packet processing and the resulting hybrid designs, we might see fewer pure software implementations of network functions, especially for switching and virtualization use cases. Yet, we believe that efficient software-based packet I/O and processing will remain crucial for almost all network and cloud applications, and even become more important for applications such as high-performance web servers, container frameworks, or analytics engines. Finally, the flexibility and cost benefits of NFV approaches highlight the continued importance of software packet processing. \subsection{Network Processors} \label{ssec:network-processors} Network processors, sometimes referred to as Network Processing Units (NPUs), are specialized accelerators, usually employed both in switches and NICs. Unlike general-purpose hardware, NPU architectures are specifically targeting network packet processing. Devices usually contain several different functional hardware blocks. Some of these blocks are dedicated to network-specific operations, such as packet load balancing, encryption, or table lookups. Some other hardware resources are instead dedicated to programmable components that are generally used to implement new network protocols and/or packet operations. Given its availability for research and the support for recent data plane programming abstractions, we will describe the architecture of a Netronome Network Function Processor (NFP) programmable NIC (cf. Fig.~\ref{fig:netronome}) as an example of a NPU~\cite{netronome:nfp}. Since network traffic is a mainly parallel workload, with packets belonging to independent network flows, network processors are generally optimized to perform parallel computations, with several processing cores. While the number of these cores could be in the order of tens or hundreds, the per-core computing power is usually limited, thus most of the performance benefits come from the ability to process many packets in parallel. In Netronome terminology, a programmable processing core is named micro-engine (ME). Each ME has 8 threads which share local registers that amount for a few KBs of memory. MEs are further organized in islands. Each island has limited shared Static Random Memory Access (SRAM) memory areas of a few hundred KBs used to host frequently accessed data required for the processing of each network packet. Finally, the network processors provide a memory area shared by all islands, the IMEM, of 4MB SRAM, and a memory subsystem that combines two 3MB SRAMs, used as cache, with larger DRAMs, called EMEMs. These larger memories generally host the forwarding tables and access control lists used by the networking subsystem to decide how to forward (or drop) a network packet. All building blocks are interconnected via a high-speed switching fabric, such that MEs can communicate and synchronize with any other ME irrespective of their location. Of course, communications across islands take longer and may impact the performance of a running program. Packets enter and exit the system through arrays of packet processing cores (PPC) that perform packet parsing, classification, and load balancing to the MEs. Media Access Control (MAC) units write and read the packets to and from the network. The Netronome NFP supports different interfaces up to $2\times40$~Gbit/s Ethernet. A PCIe interface enables communication to the system's CPU via direct memory access (DMA). \begin{figure}[t!] \centering \includegraphics[width=0.8\columnwidth]{imgs/nfp.pdf} \caption{The architecture of a Netronome NFP's programmable blocks. Some specialized hardware blocks (e.g., for cryptography tasks) are not shown.} \label{fig:netronome} \end{figure} Similar to general-purpose servers, network processors support a flexible programming model, and do not mandate any particular order for the processing steps of a packet. Additionally, the entire packet is generally available for processing as data can be stored at the different levels of the processor's memory hierarchy enabling advanced applications operating on packet payloads, including, for example, deep packet inspection (DPI) for intrusion detection. \subsection{Field-programmable Gate Arrays} \label{ssec:field-programmable-gate-arrays} Field-programmable Gate Arrays (FPGA) are semiconductor devices based on a matrix of interconnected configurable logic blocks. Contrary to ASICs, FPGAs can be programmed and reconfigured after manufacturing to implement custom logic and tasks. While custom ASIC designs generally offer the best performance, modern FPGAs narrow this gap for many use cases due to increased clock speeds and memory bandwidth~\cite{leong:fpga-trends}. High-level synthesis or specialized compilers allow programming FPGAs using languages like C or P4 as opposed to more complex and cumbersome hardware description languages, such as Verilog~\cite{wang:p4fpga, xilinx:hls}. The balance of high performance together with programmability make FPGAs not only interesting for prototyping but also a powerful alternative to costly and rigid ASIC designs for production environments~\cite{lavasani:compiling-network-processors, arista:network-fpga, brebner:px}. In the context of networking, FPGAs are primarily used on NICs to offload packet processing from servers with the goal of saving precious CPU cycles \cite{firestone:accelnet}. The availability and comparatively low cost compared to programmable ASICs make FPGAs particularly interesting for academia to prototype high-performance network data planes. NetFPGA, for example, is a widely available open-source FPGA-accellerated network interface card. The most recent version (FPGA SUME) couples a Xilinx Virtex 7 FPGA with four 10Gb Ethernet ports~\cite{zilberman:netfpga-sume}. A more recent effort in this direction is Corundum~\cite{forencich2020fccm}, which provides an open source platform for implementing a 100Gbps NIC on FPGA. Corundum is a collection of the basic NIC modules and building blocks, which are ready to be implemented on several commercial FPGA cards. FPGAs have also entered the public cloud market with Amazon Web Services offering FPGA-equipped virtual machine instances making the technology even more accessible. \subsection{Application-specific Integrated Circuits} \label{ssec:application-specific-integrated-circuits} \begin{figure*}[t] \centering \includegraphics[width=0.9\textwidth]{imgs/rmt.pdf} \caption{The architecture of an RMT-like switching ASIC} \label{fig:rmt} \end{figure*} While in the early days of the ARPANET and the Internet, routing and packet processing was performed in software~\cite{heart:imp-arpanet}, the rapid adoption and increasing scale of the Internet required more efficient hardware-based designs to keep up with increasing packet rates. An ASIC is a chip specialized and optimized for (in this case) high-performance packet processing, focusing on implementing just the minimal set of operations required for this task. In fact, network devices built using ASICs generally include a second general-purpose sub-system, e.g., based on CPUs, to implement the device's monitoring and control functions, as well as more complex (and uncommon) packet processing functions that the ASIC does not support. Processing in ASICs is usually called the \textit{fast path} and, by contrast, the \textit{slow path} is the processing done by the general-purpose sub-system. A typical ASIC is implemented as a fixed pipeline of different processing steps that are performed sequentially, e.g., L2 processing before L3 processing or MPLS lookup. Fast SRAM or TCAM banks alongside the pipeline store forwarding rules (such as routing entries) accessed in the individual lookup stages. A prominent example of an early ASIC-based networking device is the Juniper M40 router~\cite{juniper-m40} that provided unprecedented 40~Gbit/s routing performance through logically separated control and data plane components within a single chassis together with a highly customized switching chip. Most high-performance switches and routers such as the Cisco ASR or Juniper MX series devices still leverage fixed-function ASICs. While extremely efficient, these devices suffer from long and costly development cycles hindering flexibility and innovation. As a result, recently, more flexible and programmable switching chip architectures, such as Reconfigurable Match-action Tables (RMT)~\cite{bosshart:rmt}, the Protocol-independent Switch Architecture (PISA)~\cite{p4-architectures}, and implementations, such as Intel Flexpipe~\cite{flexpipe}, Barefoot Tofino~\cite{barefootTofino}, or Cavium Xpliant~\cite{cavium}, have been proposed. Programmable data plane devices allow network operators to programmatically change the low-level data plane functionality in order to support novel or custom protocols, to implement custom forwarding or scheduling logic, or to enable new applications that are then entirely executed in hardware. These RISC-inspired programmable ASICs are organized as a pipeline of programmable match-action stages. Before a packet enters the pipeline, a programmable parser dissects the packet buffer into individual protocol headers. The match-action stages then consist of memory banks implementing tables for matching extracted packet headers and Arithmetic Logical Units (ALUs) for actions such as modifying packet headers, performing simple calculations, or updating internal state. The tables may further have different matching capabilities depending on the way they are implemented in hardware. For instance, exact matching tables can be implemented as hash tables in SRAM, while wildcard matching tables are generally implemented using more expensive TCAM. At the end of the pipeline a deparser again serializes the individual (possibly altered) headers before sending the packet out on an interface or passing it to a subsequent pipeline. In many switches it is common to have at least two such pipelines, an ingress and an egress pipeline~\cite{p4-architectures}. Figure~\ref{fig:rmt} depicts the RMT reference design for programmable switches. We will further elaborate on the match-action table abstraction used in this design in Section~\ref{sec:match-action}. \subsection{Hybrid Architectures} \label{ssec:hybrid-architectures} In addition to the platforms discussed above, interesting hybrid hardware-software designs mixing existing concepts with fresh ideas from distributed systems and multi-processor design have been proposed lately. While it is often believed that the performance of programmable network processors is lower than integrated circuits, there exists literature questioning this assumption and exploring these overheads empirically. In particular, Pongrácz et al.~\cite{Pongracz:2013:CSM:2491185.2491204} showed that the overhead of programmability can be relatively low. In benchmarks, the authors find throughput of NPUs either similar or only 30-35\% lower at comparable power consumption compared to their non-programmable NIC counterparts. Furthermore, the performance gap between programmable and hard-wired chips is not primarily due to programmability itself but rather because programmable network processors are commonly tuned for more complex use cases. Past work on hybrid architectures also explored the opportunity to use Graphics Processing Unit (GPU) acceleration. For many applications, such as network address translation or analytics, packet processing workloads can be partitioned using a packet's flow key (e.g., IP 5-tuple). This makes packet processing a massively parallelizable workload, which could be in principle suitable to be implemented in multi-threaded hardware like GPUs~\cite{Han:2010:PGS:1851182.1851207}. However, the advantages and disadvantages of this strategy are being actively debated in the systems community~\cite{Kalia:2015:RBU:2789770.2789799, Younghwan:APUNET}. Kalia et al.~\cite{Kalia:2015:RBU:2789770.2789799} argue that for many applications the benefits arise less from the GPU hardware itself than from the expression of the problem in a language such as CUDA or OpenCL that facilitates memory latency hiding and vectorization through massive concurrency. The authors demonstrate that when applying a similar style of optimizations to different algorithm implementations, a CPU-only implementation is more resource-efficient than the version running on the GPU. An answer to the issues raised by Kalia et al. was given by Go et al.~\cite{Younghwan:APUNET}. Their work finds that with eight popular algorithms widely used in network applications, \emph{(i)} there are many compute-bound algorithms that do benefit from the parallel computation capacity of GPUs, and \emph{(ii)} the main performance disadvantage of GPUs comes from the need to traverse the PCIe bus to move data from the main memory to the GPU. Nonetheless, it should be noted that in \cite{Younghwan:APUNET} there are several use cases that require some encryption algorithm to be run on the packet data. Today, these workloads are better handled with dedicated hardware provided both by CPUs and NICs, thereby reducing the potential areas of applicability of GPU-based acceleration for packet processing. Various applications are particularly suitable for hybrid hardware-software co-designs. One of them is in the context of forwarding table optimization. In~\cite{cacheflow,bienkowski:online-tree-caching} architectures are studied which allow high-speed forwarding even with large rule tables and fast updates, by combining the best of hardware and software processing. In particular, the CacheFlow system~\cite{cacheflow} caches the most popular rules in a small TCAM and relies on software to handle the small amount of cache-miss traffic. The authors observe that one cannot blindly apply existing cache-replacement algorithms because of the dependencies between rules with overlapping patterns. Rather long dependency chains must be broken to cache smaller groups of rules while preserving the semantics of the policy. Another example for applications that commonly leverage hybrid hardware-software designs are network telemetry and analytics systems. These systems must make difficult trade-offs between performance and flexibility. While it is possible to run some basic analytics queries (e.g., using sketches) entirely in the data plane at high packet rates, systems generally follow a hybrid approach where analytics tasks are partitioned between hardware and software to benefit from high performance in hardware, as well as from programmability, concurrent measurement capabilities, and runtime-configurable queries in software. Systems employing such a design are *Flow~\cite{sonchack:starflow}, Sonata~\cite{gupta:sonata}, and Marple~\cite{narayana:marple}. We further elaborate on these systems in Section~\ref{sec:monit-telem-meas}. In conclusion, we can witness a trend towards more specialization and, as a result, more hybrid architectures. While we elaborated on two areas where researchers have proposed hybrid designs in the past, given the vast spectrum of flexibility and performance across the different platforms, we believe there will be more hybrid approaches across almost all network systems in the future. Depending on the constraints imposed by the workload, carefully partitioning a system between various architectures has the potential to provide the best of several worlds. \subsection{Programmable NICs} \label{ssec:programmable-nics} Orthogonal to the previously presented architectures, programmable Network Interface Cards, a new platform for programmable data planes, have attracted significant attention in the networking community over the past years. These devices (often referred to as SmartNICs) are commonly built around NPUs and FPGAs. The design and operation of programmable NICs involve a range of interesting aspects related to the host-network communication interface and operating system integration they provide. SmartNICs are consequently well-suited for offloading end-to-end mechanisms (e.g., congestion control) and applications, such as key-value stores and virtualization. Modern non-programmable NICs already implement various comparatively advanced features in hardware, such as protocol offloading, multicore support, traffic control, and self-virtualization. Programmable NICs go a step further by enabling custom packet processing and are programmable in subsets of general-purpose languages~\cite{netronome:nfp} or specialized data plane programming abstractions, such as P4~\cite{bosshart:p4} or eBPF. In the following, we only focus on the architectural aspects of such SmartNICs and defer applications leveraging these devices to Section~\ref{sec:apps}. Despite its promising characteristics, SmartNICs are still trailing in adoption due to various challenges related to the development process of applications as well as ensuring efficiency of those applications on this novel platform. The development abstractions are in particular a concern for server applications that offload computation and data to a NIC accelerator. Floem~\cite{222623} is a set of programming abstractions for NIC-accelerated applications which simplify data placement and caching, partitioning of code for parallelism, and communication strategies between program components across devices. It also provides abstractions for logical and physical queues, global per-packet state, remote caching, and interfacing with external application code. Related to the development challenges, it remains unclear, particularly in distributed applications, how functionality should be offloaded in order to maximize efficiency and benefits for the overall application. Toward answering this question, Liu et al. propose iPipe~\cite{liu:ipipe}, a generic actor-based offloading framework to run distributed applications on commodity SmartNICs. iPipe is built around a hybrid scheduler that combines different scheduling policies with the goal of maximizing device utilization. An interesting such distributed application and use case for SmartNICs is to run microservices on SmartNIC-accelerated servers. By offloading suitable microservices to the SmartNIC’s low-power processors, one can improve server energy-efficiency without latency loss. A system leveraging this approach is E3~\cite{liu:e3}, which follows the design philosophies of the Azure Service Fabric microservice platform, and extends key system components to a SmartNIC. E3 addresses challenges associated with this architecture related to load balancing workloads, placing microservices on heterogeneous hardware, and managing contention on shared SmartNIC resources. Going forward, we believe SmartNICs will have a great impact across a wide range of traditionally software-based applications and mechanism, such as programmable congestion control, TCP/TLS connection termination, or network virtualization. Offload to SmartNICs can introduce significant cost savings in such scenarios by freeing up precious CPU cycles. We expect to see more host-based services, such as firewalls, L7 gateways, or hypervisor-based load balancing being offloaded to SmartNICs. Technologies enabling efficient host-based data plane programming and in particular eBPF and XDP together with the capability of offloading such applications transparently to SmartNICs will further accelerate this trend~\cite{brunella:hxdp}. \subsection{Control Plane -- Data Plane Separation} \label{sec:control-plane-data} Conventional network equipment, regardless of the implementation (e.g., pure software or specialized hardware) and function (e.g., a switch, an edge router, or a gateway), has its functionality logically split into a \emph{device control plane} and a \emph{device data plane}. The device control plane is in charge of establishing packet processing policies, such as where to forward a packet or how to rewrite its headers, and managing the device, including checking its health and performing maintenance operations. The device data plane in turn is responsible solely for executing the packet processing policy set by the device control plane, usually at very high performance requirements. The control planes of the individual devices within a given network scope, such as an organizational domain or the entire Internet, interact through a distributed routing protocol. Through this interaction they create the illusion of a single \emph{network-level control plane} to the rest of the world, executing a virtual global packet forwarding policy in a distributed fashion. Figure~\ref{fig:cp-dp-difference} shows the network-level and device-level control plane and data plane architecture. \begin{figure} \centering \begin{subfigure}[b]{0.42\textwidth} \centering \includegraphics[width=\textwidth]{imgs/cp-dp-1} \caption{Conceptual visualization of the difference between network data plane and device data plane in traditional network architectures} \label{fig:cp-dp-difference} \end{subfigure} \hspace{0.8cm} \begin{subfigure}[b]{0.42\textwidth} \centering \includegraphics[width=\textwidth]{imgs/cp-dp-2} \caption{Separation of network control plane and data plane in software-defined networking} \label{fig:cp-dp-sdn} \end{subfigure} \caption{Traditional vs. SDN-based network architectures} \label{fig:net-arch} \end{figure} With the introduction of the Software-defined Networking (SDN) paradigm \cite{zilberman:reconfig-network-systems-sdn, roadtosdn}, the network control plane has emerged as a separate entity, a logically centralized \emph{controller}, with some of the device control plane functions separated out and moved to this network-level functionality. The network control plane is in charge of \emph{(i)} maintaining an inventory of the devices in the data plane, \emph{(ii)} accepting high-level network-wide policies (or \emph{intents}) through a northbound controller interface, \emph{(iii)} compiling these high-level intents to per-device packet processing policies, and finally \emph{(iv)} programming these policies into the individual devices through a southbound controller interface. In this architecture, the individual switches (or \emph{forwarding elements} \cite{rfc3746}) do not need to implement all the logic required to maintain packet forwarding policies locally, e.g., they do not run routing protocols to build routing tables; rather, they get these policies prefabricated from the network control plane. Here, the controller-switch communication occurs through a standardized southbound API and protocol, like OpenFlow \cite{mckeown:openflow}, ForCES \cite{rfc3746}, P4Runtime \cite{p4runtime}, or the Open vSwitch Database Management Protocol~\cite{rfc7047}. This architecture is depicted in Figure~\ref{fig:cp-dp-sdn}. Note, however, that the device control plane does not fully disappear in the SDN framework; rather, it remains in charge of terminating control channel towards the remote network control plane and managing the device data plane. \subsection{Data Plane Functions} \label{sec:our-focus-device} A device's data plane processes network packets by performing a series of operations, including the parsing of (a subset of) the packet, determining the sequence of processing operations that need to be applied, and forwarding it based on the results of such operations. Packet processing entails the following basic functional steps: \emph{parsing}, \emph{classification}, \emph{modification}, \emph{deparsing}, and \emph{forwarding}. On top of the basic functionality, most packet processing systems can provide additional services, such as \emph{scheduling}, \emph{filtering}, \emph{metering}, or \emph{traffic shaping}. \emph{Parsing} is the process of locating protocol headers in the packet buffer and extracting the relevant header fields into packet descriptors (metadata). These values are then used during \emph{classification} in order to match the packet with the corresponding forwarding policy, which describes the forwarding or processing actions to be applied to the packet (e.g., which output port to use, whether to drop the packet) and the required packet modification actions (e.g., rewriting a header field). The \emph{modification} step applies the actions retrieved during classification, and may also include the update of some internal state, for instance to increase a flow counter. Once all the modifications are applied, packet headers may be re-generated from packet descriptors (\emph{deparsing}), and finally in the \emph{forwarding} step the packet is sent to an output port for transmission. This step may include the application of \emph{scheduling policies}, e.g., to enforce network-level QoS policies, and \emph{traffic shaping} to limit the amount of network resources a flow/user may consume. The combination of classification and subsequent processing based on matched rules is commonly referred to as \textit{match-action processing}. We will elaborate on this key abstraction in more detail in Section~\ref{sec:match-action}. Generally, these steps can be expected to happen in the reported order; depending on the implementation and underlying device and the desired functionality, however, processing steps may be repeated either by sequencing multiple match-action cycles after each other or by recirculating a packet to the beginning of the pipeline. \subsection{Data Plane Programmability} \label{sec:progr-data-plane} With the emergence and adoption of the SDN paradigm, device functionality has become much more flexible and dynamic. As previously explained, in conventional network equipment the data plane functionality is deeply ingrained into the device hardware and software, and hence generally cannot be changed during the lifetime of the device. For software-based packet processing systems, major vendor software updates are required to change data plane functionality. This fixed functionality affects virtually all data plane operations: The format and semantics of the entries that can be loaded into match-action tables are fixed; devices only understand a finite set of protocol headers and fields. For example, an Ethernet switch does not process layer 3 fields and an antiquated router will not support IPv6 or QuiC. The types of processing actions that can be applied and the order in which these are enforced are set by the device vendor; typically, MAC processing is followed by an IP lookup phase, before enforcing ACLs and performing group processing. This makes it impossible to, e.g., apply IP routing lookup to packets decapsulated from VXLAN tunnels. Finally, queuing disciplines (e.g., FIFO or priority queuing only, without support for, e.g., BBR~\cite{cardwell:bbr}) and the type of monitoring information available from the data plane are predetermined. Through SDN and the emergence of increasingly more general hardware designs, today's data plane devices can be reconfigured from the network control plane, either partially or in full. This development has motivated the introduction of the term \emph{programmable data plane}, referring to the new breadth of network devices that allow the basic packet processing functionality to be dynamically and programmatically changed. In the context of this survey, we use the following definition for the programmable data plane. \begin{leftbar}\noindent Data plane programmability refers to the capability of a network device to expose the low-level packet processing logic to the control plane through a standardized API, to be systematically, rapidly, and comprehensively reconfigured. \end{leftbar} \noindent We wish to stress that data plane programmability here is not a binary property. Up to some degree, configuring a conventional ``fixed-function'' device can be viewed as data plane programming. As the exact boundaries between data plane configuration and programmability are still actively debated in the community~\cite{McCauley:2019:TLD:3314212.3314216, antichi_et_al:DR:2019:11295}, in the following discussion we embrace an inclusive interpretation of the term and lay the emphasis on the comprehensiveness of the types of modifications a device allows on the packet processing functionality. Correspondingly, we focus on the following aspects: \begin{itemize} \item \emph{new data plane architectures, abstractions, and algorithms} that permit the data plane functionality to be fully and comprehensively reconfigured, including the parsing of new packet header fields, matching on dynamically defined header fields, and exposing new packet processing primitives to the control plane, which together facilitate to deploy even completely new network protocols in operation; and \item \emph{new applications that can be realized entirely in the data plane leveraging programmability}, including monitoring and telemetry, massive-scale data processing and machine learning, or even complete key-value stores implemented fully inside the network devices, with zero or minimal intervention from the control plane. \end{itemize}
\section{Introduction} {\bf \emph{Introduction -}} In recent years, interest in nonequilibrium phenomena of small systems escalated \cite{RevModPhys.93.035008,Seifert2012,Campisi2011,Bustamante2005,Esposito2009}. The areas of stochastic and quantum thermodynamics took a new turn with the advent of the Fluctuation Theorem (FT) and its variants \cite{Jarzynskia2008,Jarzynski1997,Jarzynski2000,Crooks1998,Gallavotti1995,Evans1993,Hanggi2015,Saito2008,PhysRevX.11.031064}. In several situations, when probing small systems, the object of interest is the entropy production, $\Sigma$, now modelled as a random variable with relevant fluctuations in nonequilibrium setups. In this case, the FT gives additional information regarding the fluctuation of the entropy production. Particularly, the strong Detailed Fluctuation Theorem (DFT) is a relation about the asymmetry of the probability density function of the entropy production, \begin{equation} \label{DFT} \frac{p(\Sigma)}{p(-\Sigma)}=e^{\Sigma}, \end{equation} indicating that positive values of entropy production are more likely to be observed than the negative counterparts. It arises, for instance, in time symmetric protocols in the exchange fluctuation framework \cite{Hasegawa2019,Timpanaro2019B,Evans2002,Merhav2010,Garcia2010,Cleuren2006,Seifert2005,Jarzynski2004a,Andrieux2009,Campisi2015}. The most known consequence of (\ref{DFT}) is the integral fluctuation theorem (IFT), $\langle e^{-\Sigma}\rangle=1$, which results in the second law of thermodynamics, $\langle \Sigma \rangle \geq 0$, from Jensen's inequality. Actually, the second law is not the only statement about the statistics of $\Sigma$. As the DFT (\ref{DFT}) is stronger than the second law (DFT$\rightarrow\langle \Sigma \rangle \geq 0$), it also imposes other general consequences for the statistics of $\Sigma$ as well \cite{Merhav2010,Timpanaro2019B,Hasegawa2019,Neri2017,Pigolotti2017}. Within this framework, a new class of bounds relating the signal to noise ratio of currents to the average entropy production was discovered and named Thermodynamic Uncertainty Relations (TURs) \cite{Barato2015,Gingrich2016,MacIeszczak2018,Polettini2017,Pietzonka2017,Hasegawa2019,Timpanaro2019B}. When written solely in terms of the statistics of $\Sigma$, they read $var(\Sigma)/\langle \Sigma \rangle^2 \geq t(\langle \Sigma \rangle)$, for some known function $t(x)$. Note that this is a second order statistics about the entropy production. Other results derived from the FT followed the same idea of the TUR. For instance, a tight bound for the mean entropy production $\langle \Sigma \rangle$ using the asymmetry of the marginal statistics of currents \cite{Campisi2021}. Another example is the information bound for $p(\Sigma)$ for a given $\langle \Sigma \rangle$ given in terms of a maximal distribution \cite{Salazar2021}. In this context, the so called apparent violation of the second law is a rather simple statement about the statistics of $\Sigma$. Namely, it is given by the magnitude of $P(\Sigma < 0)$ \cite{Jarzynskia2008a,Merhav2010}. Of course, it is called apparent because the second law is a statement about the average $\langle \Sigma \rangle\geq0$, so negative values in $\Sigma$ do not constitute an actual violation. There have been advances in placing a bound for the apparent violation using a variety of constraints. For instance, for the constrained domain, $\Sigma\leq\Sigma_{max}$, a bound for the apparent violation has been established using the IFT \cite{Cavina2016,Kantz2019} and implemented experimentally \cite{Maillet2019}, originally written in terms of the irreversible work. For situations where the DFT is suitable, it is easy to check that (\ref{DFT}) immediately bounds the apparent violation, $0\leq P(\Sigma<0) \leq 1/2$. Actually, the authors in \cite{Merhav2010} used the DFT and obtained a lower bound for the apparent violation in terms of the conditional average, $\langle \Sigma \rangle_+=\int_0^\infty \Sigma P(\Sigma)d\Sigma$. However, in the same spirit of the TUR \cite{Timpanaro2019B}, using only the average as constraint $\langle \Sigma \rangle$, the existing lower bounds \cite{Jarzynskia2008a,Kantz2019,Merhav2010} for the apparent violation from the DFT (\ref{DFT}) are currently loose to our knowledge. In other words, for a given $\langle \Sigma \rangle$, is there a way to use the DFT (\ref{DFT}) and find a lower bound for such apparent violation? This is the question addressed in this paper. We show that, for a given $\langle \Sigma \rangle$, a system satisfying the DFT (\ref{DFT}) has the following tight and saturable lower bound for the apparent violation of the second law, \begin{equation} \label{introB} P(\Sigma<0)+\frac{P_0}{2}\geq\frac{1}{2}\Big(1-\frac{\langle \Sigma \rangle}{g(\langle \Sigma \rangle)}\Big), \end{equation} for $g(x)$ the inverse function of $h(x):=x\tanh(x/2)$ and $P(\Sigma<0)=\int_{-\infty}^{0}p(\Sigma)d\Sigma$ is the cumulative distribution. $P_0$ is the point mass function at $\Sigma=0$, $P_0=\lim_{\varepsilon \rightarrow 0}\int_{-\varepsilon}^\varepsilon p(\Sigma)d\Sigma$, usually zero for continuous $p(\Sigma)$, but it might be nonzero in some discrete cases (for instance, see the bosonic mode and qubit swap engine in the applications). Note that the rhs in (\ref{introB}) is given solely in terms of the mean $\langle \Sigma \rangle$. We show that the distribution that saturates (\ref{introB}) is the same minimal distribution that saturates the TUR \cite{Timpanaro2019B}. For completeness, we also prove that the intuitive upper bound, $P(\Sigma<0)+P_0/2 \leq 1/2$, is actually the best possible bound in this setup ($\langle \Sigma \rangle$ as the single constraint) by explicitly constructing a family of distributions $p'(\Sigma)$ that saturate this bound in the appropriate limit. As applications, we show that the bounds are satisfied for the heat exchanged between two reservoirs mediated by three different systems: a bosonic mode in weak coupling, a classic levitated nanoparticle and a classic particle in a box. We also include the qubit swap engine and gaussian cases for comparison. {\bf \emph{Formalism -}} We define the total variation (TV) distance between two probability density functions, $p(\Sigma)$ and $q(\Sigma)$, as $\Delta(p,q):=Sup_{A\subset\mathbb{R}} |P(A)-Q(A)|$, where $P(A):=\int_A p(\Sigma)d\Sigma$. Now we apply $\Delta$ to the pair $p(\Sigma)$ and $\hat{p}=p(-\Sigma)$. It can be written as \begin{equation} \label{TV1} \Delta(p,\hat{p})=\frac{1}{2}\int_{-\infty}^\infty |p(\Sigma)-p(-\Sigma)|d\Sigma. \end{equation} Using the DFT (\ref{DFT}), we have $p(\Sigma)>p(-\Sigma)$ iff $\Sigma>0$, which simplifies (\ref{TV1}) to the expression \begin{equation} \label{TV2} \Delta(p,\hat{p})=\int_{-\infty}^\infty \sign(\Sigma)p(\Sigma)d\Sigma=\langle \sign(\Sigma)\rangle, \end{equation} where $\sign(\Sigma)=\Sigma/|\Sigma|$, for $\Sigma \neq 0$ and $\sign(0)=0$. Unless stated otherwise, the averages $\langle . \rangle$ are taken over $p(\Sigma)$, $\langle . \rangle = \langle . \rangle_p$. Now we are going to obtain bounds for the total variation (\ref{TV3}) and connect it with the violation of the second law, here quantified as $P(\Sigma < 0)+P_0/2$. \textit{Lower bound--} For the lower bound, we consider the useful property of the average of odd functions under the DFT \cite{Hasegawa2019}. Let $u(\Sigma)=-u(-\Sigma)$ be an odd function, then \begin{equation} \label{oddproperty} \langle u(\Sigma) \rangle = \langle u(\Sigma) \tanh(\Sigma/2)\rangle, \end{equation} following directly from (\ref{DFT}). Using (\ref{oddproperty}) for the odd function $u(\Sigma):=\sign(\Sigma)$, we get from (\ref{TV2}): \begin{equation} \label{TV3} \Delta(p,\hat{p})=\langle \sign(\Sigma)\rangle = \langle \tanh(|\Sigma|/2)\rangle=\langle f(\Sigma)\rangle, \end{equation} where we used $\sign(\Sigma)\tanh(\Sigma/2)=\tanh(|\Sigma|/2):=f(\Sigma)$. Also from (\ref{oddproperty}), we have \begin{equation} \label{haverage} \langle \Sigma \rangle=\langle \Sigma \tanh(\Sigma/2)\rangle = \langle h(\Sigma)\rangle, \end{equation} for $h(\Sigma):=\Sigma \tanh(\Sigma/2)$. Then, we define the inverse function, $g:=h^{-1}$, $g(h(\Sigma))=\Sigma$. We now use the standard procedure \cite{Y.Zhang2019,Campisi2021} based on Jensen's inequality from (\ref{TV3}): \begin{equation} \label{Jensens} \langle f(\Sigma)\rangle=\langle f(g(h)) \rangle \leq f(g(\langle h(\Sigma) \rangle))=f(g(\langle \Sigma \rangle)), \end{equation} since $w(h):=f(g(h))$ results in $w'(h)>0$ and $w''(h)<0$, for $h>0$. Comparing (\ref{Jensens}) and (\ref{TV3}), we obtain \begin{equation} \label{TV4} \Delta(p,\hat{p})\leq \tanh(g(\langle \Sigma \rangle)/2)=\langle \Sigma \rangle/g(\langle \Sigma \rangle), \end{equation} where we used $|g(x)|=g(x)$, for $x\geq0$ and $g(x)\tanh(g(x)/2)=h(g(x))=x$. Finally, note that from (\ref{TV2}) we get $\Delta(p,\hat{p})=P(\Sigma>0)-P(\Sigma<0)$. And from the normalization, $P(\Sigma >0)=1-P_0-P(\Sigma<0)$, it results in the lower bound for the apparent violation of the second law from (\ref{TV4}), \begin{equation} \label{lowerbound} P(\Sigma<0)+\frac{P_0}{2}=\frac{1}{2}\big(1-\Delta(p,\hat{p})\big)\geq\frac{1}{2}\big(1-\frac{\langle \Sigma \rangle}{g(\langle \Sigma \rangle)}\big). \end{equation} Note by inspection that the bound (\ref{lowerbound}) is achieved by the minimal distribution $p_a(\Sigma):=[e^{a/2}\delta(\Sigma-a)+e^{-a/2}\delta(\Sigma+a)]/(2\cosh(a/2))$, for $a=g(\langle \Sigma \rangle)$, the same distribution that appears in the context of the TUR \cite{Timpanaro2019B,Van_Vu_2020}. Also note that, for equilibrium, $\langle \Sigma \rangle = 0$, the rhs (\ref{lowerbound}) approaches $1/2$ and the DFT gives $P(\Sigma < 0) = P(\Sigma>0) \rightarrow P(\Sigma<0)=0$ and $P_0=1$ from the DFT. A final remark is that Pinsker's inequality, $\Delta(p,\hat{p})\leq \sqrt{D_{KL}(p|\hat{p})/2}=\sqrt{\langle \Sigma \rangle /2}$, gives a looser bound than (\ref{TV3}), where $D_{KL}(p|q)=\sum_i p_i \log (p_i/q_i)$ is the Kullback-Leibler divergence and $D_{KL}(p|\hat{p})=\langle \Sigma \rangle/2$ follows directly from (\ref{DFT}). One can easily show that $\langle \Sigma \rangle / g(\langle \Sigma \rangle) \leq \sqrt{\langle \Sigma \rangle/2}$ (where $g(x) \geq \sqrt{2x}$ for $x>0$ follows from $\kappa(x):=g(x)-\sqrt{2x}$ and $\kappa(x)'>0$, $\kappa(0)=0$). Actually, we have $g(x)\approx \sqrt{2x}$ for $x \approx 0$, which makes both bounds equivalent, $\langle \Sigma \rangle / g(\langle \Sigma \rangle) \approx \sqrt{\langle \Sigma \rangle/2}$, in the limit $\langle \Sigma \rangle\approx 0$. \textit{Upper bound--} It is immediate from the DFT that \begin{equation} \label{upperbound} P(\Sigma<0) + \frac{P_0}{2}\leq 1/2. \end{equation} For a fixed $\langle \Sigma \rangle$ and assuming (\ref{DFT}), can the bound (\ref{upperbound}) be improved? For this setup, the answer is no. One needs additional constraints to improve (\ref{upperbound}). We show that, for any given $\epsilon$, the inequality $P(\Sigma<0)+P_0/2\leq 1/2(1-\epsilon)$ is not satisfied for some $p'(\Sigma)$ with the same $\langle \Sigma \rangle$, which makes (\ref{upperbound}) the best upper bound in this setup. The proof goes as follows. Suppose we have a $\epsilon=\epsilon(\langle\Sigma\rangle)<\Delta^*$, where we used the upper bound (\ref{TV4}), $\Delta^*:=\tanh(g(\langle \Sigma \rangle)/2)$, such that \begin{equation} \label{ineq} P(\Sigma<0)+\frac{P_0}{2}=\frac{1}{2}(1-\Delta)\leq\frac{1}{2}(1-\epsilon)\rightarrow \Delta \geq \epsilon, \end{equation} holds for all $p(\Sigma)$, where $\Delta=\Delta(p,\hat{p})$. It means the total variation (\ref{TV1}) would have a lower bound $\epsilon>0$. In order to show that (\ref{ineq}) is not true, our goal is to create a distribution $p'(\Sigma)$ such that DFT (\ref{DFT}) holds, it has a fixed average $\langle \Sigma \rangle$ and a total variation $\Delta'<\epsilon$. For that purpose, consider the ansatz: \begin{equation} \label{maxdist} p'(\Sigma)=\eta p_{a'}(\Sigma) + (1-\eta)\delta(\Sigma), \end{equation} for $p_{a'}$ minimal distribution with parameter $a'$, and $0\leq \eta \leq 1$, and $\delta(\Sigma)$ is a Dirac's delta function. Notice that (\ref{maxdist}) is normalized and satisfies the DFT (\ref{DFT}). The average and total variation of (\ref{maxdist}) read \begin{eqnarray} \label{maxdist2} \langle \Sigma \rangle' = \eta a' \tanh(a'/2), \\ \label{maxdist3} \Delta' = \eta \tanh(a'/2). \end{eqnarray} Using the average and total variation of the minimal distribution $p_a(\Sigma)$, we get $\langle \Sigma \rangle = a \tanh(a/2)$ and $\Delta^*=\tanh(a/2)$, which results in $\Delta^*=\tanh(g(\langle \Sigma \rangle)/2)=\langle \Sigma \rangle/a$. Finally, define $k:=2\Delta^*/\epsilon>2$ and take $a':=ka$ and $\eta=h(a)/h(ka)$ in (\ref{maxdist}). Note that $0<\eta<1$, because $h(ka)>h(a)$, since $h'>0$ and $ka>a$. For this specific choice of $\eta$ and $a'$, we have $\langle \Sigma \rangle'= a \tanh(a/2)=\langle \Sigma \rangle$ from (\ref{maxdist2}), and from (\ref{maxdist3}) we obtain \begin{eqnarray} \label{maxdist4} \Delta' = \frac{\langle \Sigma \rangle'}{a'} = \frac{\langle \Sigma \rangle}{a'}=\frac{a\Delta^*}{a'}=\frac{\Delta^*}{k}= \frac{\epsilon}{2}< \epsilon. \end{eqnarray} Therefore $\Delta'<\epsilon$ and there is a distribution $p'(\Sigma)$ such that $P(\Sigma<0)+P_0/2\geq \frac{1}{2}(1-\epsilon)$, which contradicts inequality (\ref{ineq}) and proves that (\ref{upperbound}) is the best possible bound in this setup. \begin{figure}[htp] \includegraphics[width=3.3 in]{ViolationFig1d.png} \caption{(Color online) Apparent violation of the second law $P(\Sigma<0)+P_0/2$ as a function of the mean $\langle \Sigma \rangle$ for the nonequilibrium heat exchange problem mediated by different systems: a levitated nanoparticle (red), a particle in a box (green), a bosonic mode weakly coupled to the reservoirs (blue). For comparison, the apparent violation for a gaussian distribution (grey) and a qubit swap engine (yellow) are also depicted. All cases satisfy the DFT and present apparent violation above the lower bound (dashed), as expected. The classic examples (levitated, in a box and Gaussian) have $P_0=0$ for $\langle \Sigma \rangle >0$ and the quantum cases (bosonic mode and qubit swap engine) have some $P_0>0$. All examples (and the bound) collapse to $P(\Sigma<0)+P_0/2=P_0/2=1/2$ for $\langle \Sigma \rangle=0$ (equilibrium).} \label{fig1} \end{figure} {\bf \emph{Application to a bosonic mode -}} We consider a free bosonic mode with Hamiltonian $H=\hbar\omega (a^\dagger a+1/2)$ weakly coupled to a thermal bath such that the density matrix satisfies a Lindblad's equation \cite{Santos2017a,Salazar2019,Denzler2019}, \begin{equation} \label{Lind} \partial_t \rho = \frac{-i}{\hbar}[H,\rho] + D_i(\rho), \end{equation} for the dissipator given by \begin{equation} D_i(\rho)=\gamma(\overline{n}_i+1)[a\rho a^\dagger - \frac{1}{2}\{a^\dagger a, \rho\}]+\gamma \overline{n}_i[a^\dagger \rho a -\frac{1}{2}\{a a^\dagger , \rho\}], \end{equation} where $\gamma$ is the dissipation constant and $\overline{n}_i=[\exp(\hbar \omega/k_BT_i)-1]^{-1}$ is the bosonic thermal occupation number and $\beta_i=1/(k_b T_i)$. At $t=0$, the system starts in thermal equilibrium (with temperature $T_1$) and it is placed in contact with the second reservoir (temperature $T_2$). The dynamics is then modeled by (\ref{Lind}) with $D_2$ as the dissipator for $t>0$. Let $\rho_t:=\Phi_t(\rho_0)$ define the dynamical map that solves (\ref{Lind}) with $D_2$. In a two point measurement scheme (TPM) at $t=0$ and $t>0$, it yields energy values $E_1$ and $E_2$, with energy variation $\Delta E = E_2-E_1$. Upon repeating the experiment several times, the energy variation distribution is given by $p(\Delta E=\hbar \omega m)=\sum_{n=0}^{\infty}\langle n+m | \Phi_t \big(|n\rangle \langle n |\big)|n+m\rangle p_n$, where $p_n={e^{-\beta_1 E_n}}/Z(\beta_1)$ and $Z(\beta_1)=\text{tr} (e^{-\beta_1 H})$. It was showed that $p(\Delta E)$ has a closed form \cite{Salazar2019,Denzler2019}, so that the entropy production is given in terms of the energy variation \cite{Campisi2015,Timpanaro2019B,Sinitsyn2011} as $\Sigma = -(\beta_2-\beta_1)\Delta E$. In this case, the distribution $P(\Sigma)$ follows \cite{Salazar2019} directly: \begin{equation} \label{PsigmaHO} p(\Sigma)=\frac{1}{A(\alpha)} \exp(\frac{\Sigma}{2}-\alpha \frac{|\Sigma|}{2}), \end{equation} with support $s=\{\pm \Delta \beta \hbar \omega m\}=\{\pm\varepsilon m\}$, $m=0,1,2,..$, and constant $A=A(\alpha)$, for some constant $\alpha$. Note that (\ref{PsigmaHO}) satisfies (\ref{DFT}). Using the geometric series, the expression (\ref{lowerbound}) is computed exactly from (\ref{PsigmaHO}): \begin{equation} \label{QHOviolation} P(\Sigma < 0 )+\frac{P_0}{2} = \frac{1}{2A(\alpha)}\frac{1+e^{-\gamma_{-}}}{1-e^{-\gamma_{-}}}, \end{equation} where $\gamma_{\mp}=\varepsilon(\alpha\pm 1)/2$, with $\alpha$ and $\varepsilon$ defining $A$ and $\langle \Sigma \rangle$ uniquely from \begin{eqnarray} \label{QHOA} A(\alpha)=\frac{1+e^{-\gamma_{+}}}{2(1-e^{-\gamma_{+}})}+\frac{1+e^{-\gamma_{-}}}{2(1-e^{-\gamma_{-}})}, \\ \label{QHOMean} \langle \Sigma \rangle = \frac{\varepsilon}{A} \big[\frac{e^{\gamma_{+}}}{(e^{\gamma_{+}}-1)^2}-\frac{e^{\gamma_{-}}}{(e^{\gamma_{-}}-1)^2}\big]. \end{eqnarray} In order to test the bounds (\ref{lowerbound}) and (\ref{upperbound}), we select several $\alpha>0$ incrementally, with $\varepsilon=1$, then compute $A(\alpha)$ from (\ref{QHOA}) and use it to find and plot (\ref{QHOviolation}) vs. $\langle \Sigma \rangle$ from (\ref{QHOMean}) for each $\alpha$. The resulting curve is compared to the lower bound (\ref{lowerbound}) computed with the same $\langle \Sigma \rangle$, showed in Fig.1. {\bf \emph{Application to a levitated nanoparticle -}} In the highly underdamped limit, the generalized Langevin equation represents the dynamics of a levitated nanoparticle \cite{Gieseler2012,Gieseler2018,Aspelmeyer2014,Salazar2019a} as well as a particle in a box \cite{Salazar2020,PhysRevLett.117.180603}. We start with the Langevin dynamics with a general single well potential $\mathcal{U}(x)=m k x^{2n}/2$. The particle's dynamics is given by \begin{equation} \label{Langevin} \ddot{x} + \Gamma \dot{x} +\Omega_0^2 L \big(\frac{x}{L}\big)^{2n-1} = \frac{1}{m}F_{fluc}(t), \end{equation} for position $x(t)$, with Gaussian noise $\langle F_{fluc}(t)F_{fluc}(t')\rangle = 2m\Gamma T \delta(t-t')$, where $\Gamma$ is a friction coefficient, $m=1$ is the particle mass, $T$ is the reservoir temperature and $k=\Omega_0^2$ is a constant (not driven by a protocol). Defining the energy $E= p^2/2+\mathcal{U}(x)$ ($p=\dot{x}$), the following stochastic differential equation (SDE) was obtained for the total energy in the highly underdamped limit \cite{Gieseler2012,Salazar2019a}, $\Omega_0\gg\Gamma$: \begin{equation} \label{LangevinforE2} dE=-\Gamma_n (E- \frac{f_n}{2}T)dt+\sqrt{2\Gamma_n TE}d\textrm{W}_t, \end{equation} with effective degrees of freedom $f_n=(n+1)/n$, friction coefficient $\Gamma_n=\Gamma [2n/(n+1)]$, $d\textrm{W}_t$ is a Wiener increment. The particle is prepared with temperature $T_1$ and placed in contact with the reservoir $T_2$ for $t>0$, which is the same setup used with the bosonic mode. Again, one defines the entropy production as $\Sigma = -\Delta \beta \Delta E$, where $p(\Delta E)=\int P(E_1)\Pi_t(E_1\rightarrow E_2)\delta (\Delta E - (E_2-E_1))dE_1 dE_2$. The propagator $\Pi_t$ is known \cite{Gieseler2018,Salazar2016} for the SDE (\ref{LangevinforE2}), which yields the following distribution: \begin{equation} \label{nanopdf} p(\Sigma)=\frac{1}{B(\alpha)} \exp\big(\frac{\Sigma}{2}\big)|\Sigma|^{(f_n+1)/2}K_{(f_n+1)/2}(\alpha |\Sigma|), \end{equation} defined for the real line for constant $\alpha$ defined in terms of parameters ($T_1,T_2,\Gamma_n t$), $B(\alpha)$ is a normalization constant, and $K$ is the modified Bessel function of the second kind. In order to test the bounds (\ref{lowerbound}) and (\ref{upperbound}), we select some $\alpha>0$, then compute $P(\Sigma<0)$ and $\langle \Sigma \rangle$ numerically from (\ref{nanopdf}). In this continuous case, $P_0=0$. Finally, the resulting curve is compared with the lower bound (\ref{lowerbound}) computed with the same $\langle \Sigma \rangle$, showed in Fig.1 for the levitated case (harmonic, $n=1$) and particle in a box ($n\rightarrow \infty$). {\bf \emph{Swap engine -}} As another example of entropy production pdf, take a pair of qubits with energy gaps $\epsilon_A$ and $\epsilon_B$. They are prepared in thermal equilibrium, $p(\pm)=\exp(\pm\beta \epsilon)/(\exp(-\beta\epsilon)+\exp(+\beta\epsilon))$, for $\beta\in\{\beta_1,\beta_2\}$ and $\epsilon\in\{\epsilon_A,\epsilon_B\}$, with reservoirs at temperature $T_1$ and $T_2$. A TPM is performed before and after a swap operation \cite{Campisi2015}, here defined as $|xy\rangle \rightarrow |yx\rangle$, for $x,y \in \{-,+\}$. The entropy production in the process is given \cite{Campisi2015,Timpanaro2019B} by $\Sigma = \beta_1 \Delta E_A + \beta_2 \Delta E_B$, where $\Delta E_A = E_A^f-E_A^i$, $\Delta E_B=E_B^f-E_B^i$ are the variations of energy measurements before and after the swap. In this TPM, the three possible outcomes are $\Sigma \in s=\{0,\pm 2a\}$ for $2a=2(\beta_2\epsilon_B-\beta_1\epsilon_A)$. The distribution of $\Sigma$ is given by $p(\Sigma)=(1/Z_0)\exp(\Sigma/2)$, for $\Sigma \in s$, which satisfies the DFT (\ref{DFT}), and the apparent violation of the second law reads $P(\Sigma<0)+P_0/2=(\exp(-a)+1/2)/(1+\exp(a)+\exp(-a))$, where $\langle \Sigma \rangle=2a(\exp(a)-\exp(-a))/(\exp(a)+\exp(-a)+1)$ defines $a$ in terms of $\langle \Sigma \rangle$, also depicted in Fig.~1. {\bf \emph{Gaussian case-}} For completeness, we also compare the apparent violation of the second law with respect to a Gaussian distribution \cite{Pigolotti2017,Chun2019}. \begin{equation} \label{gaussian} p(\Sigma)=\frac{1}{2\sqrt{\pi \langle \Sigma \rangle}}\exp\Big(\frac{-(\Sigma-\langle \Sigma\rangle)^2}{4\langle \Sigma \rangle}\Big), \end{equation} In this continuous case, we have $P_0=0$ and $P(\Sigma < 0)$ is given in terms of the error function, also included in Fig.~1. {\bf \emph{Discussion and Conclusions -}} We have used the strong Detailed Fluctuation Theorem and a single constraint, $\langle \Sigma \rangle$, to find a lower bound for the apparent violation of the second law, $P(\Sigma < 0) + 1/2$, given by (\ref{introB}). The factor $P_0/2$ appears quantifying the apparent violation so it takes into account discrete domains of $\Sigma$. It is not the case for the minimal distribution and classical cases (as $P_0=0$), but it is relevant discrete situations ($P_0>0$, as showed in the quantum applications). Intuitively, the bound is also given in terms of the minimal distribution, the same distribution that saturates the TUR (using the same constraint in $\langle \Sigma \rangle$). In the applications, we showed the entropy production of different systems satisfying the lower bound as a function of $\langle \Sigma \rangle$. The behavior of the lower bound in Fig.~1 (dashed line) shows that it falls rapidly to zero for $\langle \Sigma \rangle\gg0$, indicating that the family of systems operating very far from equilibrium have enough room to prevent the second law to be violated. However, in situations close to equilibrium $\langle\Sigma\rangle \approx 0$, the lower bound imposes a high magnitude for the apparent violation of the second law, as observed in the systems considered here. In situations where the DFT is valid, the area under the dashed curve in Fig.~1 is forbidden: meaning that one cannot devise a system that operates arbitrarily close to equilibrium ($\langle \Sigma \rangle\approx0$) without often ``violating'' the second law by at least the amount given by the lower bound. The limitations of our result lie in the applicability of the strong DFT. For that reason, the results are relevant, for instance, in the context of exchange fluctuation theorems.
\section{Non convex overparameterized neural classifiers}\label{sec::1} {\em Related work.} The effects of overparameterization and the interpolation threshold have been recently studied in convex neural classifiers in which the input data are projected in a arbitrarily high dimensional space. These models are variants of the Random Features Model (RFM) which was first introduced as a tool to accelerate the training of Kernel machines~\cite{rahimi2007random,NealBook,lee2017neural}. More recently, the observation~\cite{jacot2018neural} that infinitely wide neural networks operate in the so-called ``lazy regime'', where the weights do not change much from their initial values during the gradient descent training dynamics, suggested that the behavior of neural networks can be approximated to some extent by random feature models, where the randomness in the features comes from the random initialization of the network weights. In the absence of specific regularization controls and for a given training set, as the size of the model increases the training and testing errors tend, initially, to decrease jointly. When the training error is about to reach perfect interpolation of the data, the test error begins to increase, giving rise to the famous U-shaped curve that describes the so called bias-variance trade-off in classical statistics. Not without surprise, if we keep adding parameters to the model, the test error behaves in a non-monotonic way: when the model exceeds the interpolation threshold, the training error remains zero and the test error starts to fall again, and tends to an absolute minimum in the regime of extreme overparameterization where the number of parameters is much larger than the number of samples. This phenomenon, called ``double-descent''~\cite{Belkin2019}, has been studied and reproduced in a number of different frameworks, ranging from rigorous computations~\cite{Mei2019} to statistical physics computations~\cite{Goldt2020, gerace2020generalisation,rocks2020memorizing}. {\em Overparameterized non convex tractable models.} Here we consider mainly two cases of non-convex RFM for binary classification, one with two layers and one with three. The two-layer neural network has random weights in the first layer (the ``random features'') and a second layer with $N$ binary weights $\boldsymbol{w} \in \left\{ -1, 1 \right\}^N$ that are learned. Indeed, using binary weights suffices to make the overall learning problem highly non-convex. The three-layer network also has a first random layer, followed by a second layer of continuous weights that are learned, and a final layer that performs majority voting. For simplicity, we will provide all the details for the binary two-layer model here, leaving the details of the continuous models to the Supplementary Information (SI). Numerical results on deep architectures which corroborate the analytical findings will also be given in the section~\ref{sec::3}. Given a $D-$dimensional pattern $\boldsymbol{\xi}$ as input, we define its projection into the $N$-dimensional random features space as: \begin{equation} \label{eq:projected_xi} \tilde{\xi}_i = \sigma \left( \frac{1}{\sqrt{D}} \sum_{k=1}^{D} F_{ki} \xi_k \right) \end{equation} where $F$ is a $D\times N$ feature matrix and $\sigma\!\left( \cdot \right)$ is a non-linear activation function. In the following we will consider for definiteness $\sigma(x) = \text{sign}(x)$ and a feature matrix of the Gaussian Orthogonal Ensemble (GOE) type, i.e. every element of $F$ is a standard normal Gaussian; however our analytical results are valid for any $\sigma(\cdot)$ and every matrix having independent random entries with matching first and second moments, and that satisfy the hypothesis of the Gaussian Equivalence theorem~\cite{Mei2019,Goldt2020,gerace2020generalisation} (details in the SI). The corresponding output of the network is: \begin{equation} \label{eq:perceptron} y_{\text{out}} \equiv \text{sign} \left( \frac{1}{\sqrt{N}} \sum_{i=1}^{N} w_i \, \tilde{\xi}_i \right) \end{equation} We consider a training set composed by $P = \alpha N$ random patterns extracted from a standard normal distribution; the label $y^\mu$ corresponding to a given pattern $\boldsymbol{\xi}^\mu$ is assigned by a ``teacher'' network having random binary weights $\boldsymbol{w}^T \in \left\{-1, 1\right\}^D$ as $y^\mu = \text{sign} \left( \frac{1}{\sqrt{D}} \sum_{k=1}^{D} w_k^T \xi_k^\mu \right)$. The learning task consists in finding the weights $\boldsymbol{w}$ that fit all the data in the training set and that generalize well on the whole generative model. \section{Geometry of minima vs overparameterization: threshold phenomena} \label{sec::2} In the following we consider the primitive loss function that counts the number of misclassified patterns in the training set whose stability is greater than a given margin of $\kappa \geq 0$. For each pattern, the stability $\Delta^\mu$ is defined as the product of the pre-activation of the output unit $\lambda^\mu(\boldsymbol{w}) $ and the binary label of pattern $y^\mu = \pm 1$: \begin{equation} \Delta^\mu(\boldsymbol{w}) \equiv y^\mu \lambda^\mu(\boldsymbol{w}) \end{equation} where \begin{equation} \lambda^\mu(\boldsymbol{w}) \equiv \frac{1}{\sqrt{N}} \sum_{i=1}^{N} w_i \, \sigma \left( \frac{1}{\sqrt{D}} \sum_{k=1}^{D} F_{ki} \xi_k^\mu \right) \end{equation} The loss function per pattern is defined as \begin{equation} \ell_{NE}\left(-\Delta^\mu(\boldsymbol{w}); \kappa\right) = \Theta\left(-\Delta^\mu(\boldsymbol{w}) + \kappa \right) \end{equation} where $\Theta(\cdot)$ is the Heaviside step function: $\Theta\left(x\right) = 1$ if $x>0$ and zero otherwise. For $\kappa = 0$ this loss reduces to the one that counts the number of training errors; with a slight abuse of language we call it ``number-of-errors loss'' even if the margin is non-zero. For the analytical study, we will be interested in the large-size limit, where our calculations can be performed by asymptotic methods: $N, \, D, \, P \to \infty$ while keeping finite the ratios \begin{equation} \label{eq::thermodynamic_limit} \alpha \equiv \frac{P}{N} \; \; , \; \alpha_T \equiv \frac{P}{D} \; \; , \; {\alpha_D} \equiv \frac{D}{N} \,, \end{equation} with $\alpha = \alpha_T \alpha_D$. In order to compute the typical properties of the solution space, the key quantity of interest is the averaged free entropy of the model, i.e. \begin{equation} \label{eq::free_entropy} \phi = \lim\limits_{N, P, D \to \infty}\frac{1}{N} \langle \ln Z \rangle_{\xi, F} \end{equation} where we denoted with $\langle \bullet \rangle_{\xi, F}$ the average over both the patterns (including the desired outputs and thus the teacher) and the features. Here $Z$ denotes the partition function of the model which reads \begin{equation} Z(\beta) = \sum_{\boldsymbol{w}} \, e^{-\beta \sum_{\mu=1}^{P} \ell_{NE}\left( - \Delta^\mu(\boldsymbol{w}); \kappa \right)} \end{equation} For generic $\beta$, $Z(\beta)$ is the generating function in the variable $e^{-\beta}$ of the number of errors. In the analytical computations however we have only considered the large $\beta$ limit, where the partition function reduces to the number of zero-error configurations (solutions): \begin{equation} Z =\sum_{\boldsymbol{w}} \, \prod_{\mu=1}^P \Theta\left( \Delta^\mu(\boldsymbol{w}) - \kappa \right) \equiv \sum_{\boldsymbol{w}} \, \mathbb{X}_{\xi,F}(\boldsymbol{w}; \kappa) \end{equation} where $\mathbb{X}_{\xi,F}$ is the indicator function on $\boldsymbol{w}$ that all patterns are being correctly classified with the required robustness. We also define the maximum margin $\kappa_\text{max}(\alpha)$ for a fixed value of $\alpha$ as the value of $\kappa$ for which $\phi = 0$ in the $\beta \to \infty$ limit. The solutions with maximum margin play a central role in our analysis, since they lie in the middle of dense regions whose breakup signals the $\mathrm{LE}$ phase transition. It is useful to notice that even if the entropy of solutions vanishes at $\kappa_\mathrm{max}$, their typical overlap is still strictly smaller than $1$. The ``interpolation threshold'' $\alpha_c$ is instead defined as the value of $\alpha$ for which zero-margin solutions disappear, i.e. with high probability solutions cease to exist for $\alpha > \alpha_c$. \begin{figure} \begin{centering} \includegraphics[width=\columnwidth]{Figures/phase_diagram.pdf} \end{centering} \caption{SAT/UNSAT interpolation threshold and Local Entropy transition versus $\alpha_T$ for the binary non-convex model of random features. For $\alpha_T \to 0$ we recover the critical capacity~\cite{krauth1989storage} and the local entropy transition~\cite{baldassi2021unveiling} of the standard binary perceptron. In the inset we show the training error of SA, BP and SBPI versus the degree of overparameterization $1/\alpha$ for $D=201$ and $\alpha_T = 3$. Points are averages over $20$ independent samples (except for fBP where we used $10$ samples) and $5$ independent runs per samples ($3$ for BP). None of those algorithms is able to find solutions for $\alpha > \alpha_{\text{LE}}$. } \label{Fig::phase_diagram} \end{figure} The averages of the logarithm in eq.~\eqref{eq::free_entropy}, give access to the most probable number of solutions for a randomly chosen training set, and can be computed by asymptotic methods developed in the theory of disordered systems, either the so called replica method or the cavity method~\cite{mezard1987spin}. {\em Phase diagram}. Before diving into analytical details, we anticipate how the geometry of the space of solutions changes as we increase the degree of overparameterization. The phase diagram of the model is reported in Fig.~\ref{Fig::phase_diagram}. The plane $(\alpha_T, \alpha)$ is divided into three distinct regions: (1) an UNSAT region when the value of the density of constraints exceeds the interpolation threshold: $\alpha > \alpha_c(\alpha_T)$. In this region there exists no configuration of weights that is able to fit all the training set. This threshold is independent of the learning algorithm, but it depends only on the properties of training data and of the architecture. On the other hand for $\alpha < \alpha_c(\alpha_T)$ we have a SAT region, so in principle the complexity of the model is sufficient to learn the data. (2) for $\alpha_{\text{LE}}(\alpha_T) < \alpha < \alpha_{c}(\alpha_T)$, despite the existence of configurations of weights that fit all the training set, they are either isolated or belong to minima that have a small characteristic size. These solution turn out to be not easily accessible by learning algorithms. (3) for $\alpha \le \alpha_{\text{LE}}(\alpha_T)$ highly entropic wide minima start to appear. These flat minima, though exponentially rare compared to the isolated solutions, are easily accessible by algorithms. We call the threshold $\alpha_{\text{LE}}(\alpha_T)$ the \emph{Local Entropy transition}. $\alpha_{\text{LE}}$ can therefore be interpreted as an upper bound for the effectiveness of learning algorithms. As a confirmation of that we show in the inset of Fig.~\ref{Fig::phase_diagram} the train error of the four algorithms that are representative of a spectrum of sampling strategies. On one extreme of the spectrum, we used Simulated Annealing (SA)~\cite{KirkpatrickSA}, which samples from the equilibrium Gibbs distribution. On the opposite end, we used focusing Belief Propagation (fBP)~\cite{unreasoanable}, which is a modified version of the message-passing Belief Propagation (BP) algorithm~\cite{yedidia2003understanding} and it is designed to target high local entropy regions (if present). The original BP algorithm is designed for statistical inference, and at convergence its messages allow to derive the marginal probabilities for each variable, computed for a uniform distribution over the solutions of the training task. The modification introduced by fBP consists in forcing the messages to progressively focus on the most dense regions, until they become peaked on a single configuration, thereby resulting in an efficient solver. The focusing process is controlled by fixing an overall ``strength'' $y>1$ and by scheduling a parameter $\gamma$ from $0$ to $\infty$. Two more heuristic algorithms are especially designed to work efficiently on binary architectures. One is the Stochastic BP-inspired (SBPI) algorithm~\cite{baldassi2007efficient}, which can be regarded as a simple and fast approximate version of fBP. The other is BinaryNet (BNet)~\cite{hubara2016binarized}, which is a modified version of Stochastic Gradient Descent (SGD)~\cite{lecun1998gradient}. As we can observe in the figure, none of these algorithms can find solutions below $\alpha_{\mathrm{LE}}$. {\em Typical solutions}. \begin{figure*} \begin{centering} \includegraphics[width=0.49\textwidth]{Figures/gen_error.pdf} \includegraphics[width=0.49\textwidth]{Figures/gen_err_VS_alphaT.pdf} \end{centering} \caption{(Left panel) Generalization error as a function of the degree of overparameterization $1/\alpha$, for $\alpha_T = P/D = 3$. Vertical dashed lines denote the SAT-UNSAT transition $\alpha_c^{-1}$, the local entropy transition $\alpha_{\text{LE}}^{-1}$, and the $\kappa_{\mathrm{opt}}$ transition $\left(\alpha^*\right)^{-1}$. We show the behavior of the generalization error of typical solutions having a fixed margin $\kappa = 0$, $0.107$, $1$ and the ones obtained by maximizing the margin (for each value of $\alpha$). The dashed turquoise curve is the error of the barycenter of typical solutions having zero margin, whereas the black line represents the generalization error of the ``best'' barycenter which was found by optimizing the margin. In the inset we show that this optimal margin $\kappa_{\mathrm{opt}}$ undergoes a transition when crossing $\alpha^{*}$. We have also plotted numerical results obtained at $D=201$ by using two representative algorithms: the Simulated Annealing (SA) algorithm (violet points) and the focusing Belief-Propagation (fBP) algorithm (blue points). When SA is able to find solutions, the corresponding generalization error is compatible to the one obtained by typical zero margin configurations. In the large overparameterization regime fBP behaves similarly to the generalization error of the barycenter of zero margin solutions. Yellow points (whose error bars are not shown for clarity) represent the barycenter of zero margin solutions as computed by using the BP estimation of the posterior distribution. (Right panel) Generalization error versus $\alpha_T$ in the large overparameterization regime ($\alpha=0.05$, $D=201$). While SA gives the same generalization error of typical solutions having zero margin, other algorithms, that do not target or sample from the Gibbs measure, are able to perform much better. These algorithms are SBPI, fBP and BNet with cross-entropy loss function. All the points are the averages over $5$ independent samples and $2$ independent runs per sample. } \label{Fig::gen_error} \end{figure*} Using the replica method in its replica symmetric (RS) version (see SI), the averaged free entropy in eq.~\eqref{eq::free_entropy} turns out to depend on the ``order parameters'' $q$, $p$, $p_d$, $r$ and their conjugate Lagrange multipliers $\hat q$, $\hat p$, $\hat p_d$, $\hat r$. Geometrically $q$ represent the typical overlap between a pair of solutions; $p$ is the typical overlap between a pair of solutions projected in the teacher space (which has dimension $D$), the projection being performed simply by using the feature matrix $F_{ki}$; $p_d$ is the typical squared norm of a projected solution and finally $r$ denotes the typical overlap between a projected solution and the teacher. Eventually, $\phi$ can be found by optimizing over eight order parameters \begin{equation} \label{eq::RS_entropy} \begin{split} \phi &= \underset{q,\hat q, p, \hat p, p_d, \hat p_d, r, \hat r}{\max} \phi_{RS}\left( q,\hat q, p, \hat p, p_d, \hat p_d, r, \hat r \right) \end{split} \end{equation} where $\phi_{RS}$ is the RS expression for $\phi$ (see SI). Knowing the order parameters for which the function $\phi_{RS}$ is maximal allows to compute not only the entropy but also other quantities of interest, such as the generalization error $\epsilon_g$, defined as the probability of wrongly classifying a new (unseen) pattern. We find \begin{equation} \epsilon_g = \frac{1}{\pi} \arccos\left( \frac{M}{\sqrt{Q_d}} \right) \end{equation} where $M \equiv \mu_1 r$, $Q_d \equiv \mu_\star^2 + \mu_1^2 p_d$, and $\mu_1$, $\mu_\star$ are constants that depend only on the nonlinear function $\sigma$ (see SI for their expressions). From the solutions of the saddle point equations we can also compute the probability that the average of the outputs of students sampled from the posterior on a random new pattern has different sign than that given by the teacher; this is equivalent to compute the barycenter of typical solutions. All the details of the computation are reported in the SI; here we report the final result \begin{equation} \epsilon_g^B = \frac{1}{\pi} \arccos\left( \frac{M}{\sqrt{Q}} \right)\,, \end{equation} where $Q \equiv \mu_\star^2 q + \mu_1^2 p$. We report in Fig.~\ref{Fig::gen_error} the plot of the generalization error of typical solutions with zero, non-zero and maximum possible margin versus the degree of overparameterization $1/\alpha$ together with the generalization error of the barycenter of typical solutions having zero margin. All those curves are monotonically decreasing. Moreover we show that the margin $\kappa_{\text{opt}}$ that should be imposed in order to minimize the generalization error of the barycenter undergoes a transition from zero (for $\alpha>\alpha^{*}$) to non-zero values (for $\alpha<\alpha^*$) whenever we increase the degree of overparameterization. The value of the optimal margin $\kappa_{\text{opt}}$ is plotted in the inset of Fig.~\ref{Fig::gen_error}. {\em Numerical Checks}. In order to corroborate the analytical findings with numerical results, we have performed some numerical experiments (see Fig.~\ref{Fig::gen_error}) using the four algorithms mentioned above: SA, fBP, SBPI and BNet. Similarly to what happens in spin glass models, we found that for sufficiently low $\alpha$ (i.e. for relatively small system sizes) SA is able to escape from local minima and find solutions that have generalization error which matches the one obtained by replica theory. We also found a perfect agreement between the theoretical results and the numerical experiments when we computed the distribution of the stabilities of typical configurations (see SI). We remark that the ability of SA to find solutions for low values of $\alpha$ is due to finite-size effects: indeed we show in the SI that increasing $D$, $P$ and $N$ maintaining the ratios $\alpha=P/N$ and $\alpha_T = P/D$ fixed, at a certain point SA is not able anymore in finding solutions. We find that fBP, SBPI and BNet, even though they are also mildly affected by finite-size effects, converge to entropic states that have a much better generalization error, as also predicted by the theory. {\em The entropy landscape around a typical solution}. Having established that algorithms find solutions with different generalization properties, it remains to understand in which regions of the landscape those solutions end up and how they arise in terms of the degree of overparameterization. A way to answer those questions is by studying the \emph{local entropy} landscape by the computation of the so-called \emph{Franz-Parisi} potential~\cite{franz1995recipes}. This technique has been introduced as a tool to study the role of metastable states in spin glasses~\cite{franz1995recipes} and recently~\cite{huang2014origin,relu_locent} it was used to show that, in one and two-layer binary neural networks, typical solutions with zero margin are organized as clusters with vanishing internal entropy, a scenario that has been called \emph{frozen}-1RSB. \begin{figure} \begin{centering} \includegraphics[width=0.98\columnwidth]{Figures/FP_RFM.pdf} \end{centering} \caption{Local entropy of solutions with zero margin $\kappa = 0$ as a function of the distance $d$, evaluated for typical references having different values of the margin $\tilde{\kappa}$. Here the value of the constrained density is $\alpha = 0.5$, whereas $\alpha_T = 8$. The dotted gray line represents the total number of configurations at that given distance, which is a geometrical upper bound for the local entropy. The maximum margin that can be imposed is $\kappa_{\text{max}} \simeq 0.847$ and corresponds to the curve with the largest local entropy.} \label{Fig::FP_RFM} \end{figure} Given a configuration $\tilde{\boldsymbol{w}}$ with margin $\tilde \kappa$ that we call the ``reference'', the local entropy is the log of the number of configurations $\mathcal{N}(\tilde{\boldsymbol{w}}, d; \kappa)$ that are solutions with margin $\kappa$ and that are constrained to be at a given distance $d$ from $\tilde{\boldsymbol{w}}$: \begin{equation} \mathcal{N}(\tilde{\boldsymbol{w}}, d; \kappa) = \sum_{\boldsymbol{w}} \mathbb{X}_{\xi,F}(\boldsymbol{w}; \kappa) \delta\left( N(1-2d) - \sum_i w_i \tilde w_i \right) \,. \end{equation} The properties of the landscape around typical references can then be investigated by studying their average local entropy, which is called~\emph{Franz-Parisi} free entropy~\cite{franz1995recipes,huang2014origin} \begin{equation} \phi_{\text{FP}}(d; \tilde \kappa, \kappa) = \left\langle\frac{1}{Z} \sum_{\tilde{\boldsymbol{w}}} \mathbb{X}_{\xi, F}(\tilde{\boldsymbol{w}}; \tilde{\kappa}) \ln \mathcal{N}(\tilde{\boldsymbol{w}}, d; \kappa) \right\rangle_{\xi, F} \,. \end{equation} This quantity can be again computed by the replica method with a double analytic continuation (details in the SI). Here, following ref.~\cite{baldassi2021unveiling}, we are chiefly interested in the behavior of this quantity when $\kappa = 0$. For a given value of $\alpha < \alpha_c$, the local entropy curves of the references exhibit different characteristics as $\tilde \kappa$ varies. This is shown in Fig.~\ref{Fig::FP_RFM}. The overall picture closely resembles that of simpler models~\cite{baldassi2021unveiling}, and we point out some noteworthy results: (1) Zero-margin references are isolated: $\phi_{\text{FP}}(d; \tilde \kappa=0, \kappa=0)$ is always negative in a neighborhood of $d=0$. This explains the poor performance, both in terms of efficiency in finding a solution and in terms of the generalization properties of the solution it finds, of the SA algorithm, which directly targets the Gibbs measure. Even for small non-zero values of $\tilde \kappa$ the local entropy is negative for some distances $d$, or it is non-monotonic, denoting the existence of small isolated clusters of solutions. (2) At low enough values of $\alpha$, there is a value $\tilde \kappa_u(\alpha)$ above which the local entropy is monotonic. This means that those references are located inside a dense region of solutions that extends to very large scales. This region extends up to $\tilde \kappa_\text{max}(\alpha)$. As shown in Fig.~\ref{Fig::FP_RFM}, the highest curve in terms of local entropy is found by the typical configurations having maximum margin $\kappa_\text{max}(\alpha)$. These large-scale regions are targeted by efficient solvers, which also have lower generalization errors than SA. {\em Local Entropy transition}. A fundamental question that remains to be answered is how those (atypical) dense regions change when increasing $\alpha$. In previously studied convex models those regions tend to shrink continuously and they reduce to a point at the SAT/UNSAT transition. We want to show that this is not the case here. Similarly to what happens in previously studied teacher-student non-convex models, those regions shrink when increasing $\alpha$, until a critical value $\alpha_{\text{LE}} < \alpha_c$ is reached, beyond which those regions fracture in multiple pieces. We call this transition \emph{Local Entropy transition}. For $\alpha>\alpha_{\text{LE}}$ no algorithm is seemingly able to find a solution efficiently, whereas below it efficient algorithms with good scaling properties only find solutions in non-isolated regions. Thus, $\alpha_{\text{LE}}$ can be regarded as a fairly good upper bound to the algorithmic capacity for the most efficient algorithms. Different approaches have been devised in order to estimate analytically $\alpha_{\text{LE}}$. The first one is based on the use of a large deviations analysis~\cite{baldassi2015subdominant,unreasoanable} which however leads to a quite heavy formalism for the models under study. We have thus adopted a recently introduced simpler method~\cite{baldassi2021unveiling} which gives similar results to the large deviations approach. It is based on the observation that, by definition of $\alpha_{\text{LE}}$, references located in the large-scale dense region should not exist anymore when $\alpha > \alpha_{\text{LE}}$. We can therefore estimate $\alpha_{\text{LE}}$ by the condition \begin{equation} \tilde \kappa_{u}(\alpha_{\text{LE}}) = \tilde{\kappa}_{\text{max}}(\alpha_{\text{LE}}) \end{equation} meaning that $\alpha_{\text{LE}}$ is the value of $\alpha$ for which the local entropy profile of the maximum margin solutions starts becoming non-monotonic. This is a stricter condition than the one obtained from the large deviation analysis, that uses the criterion that \emph{all} solutions start to become non-monotonic; thus, it likely slightly under-estimates the true $\alpha_{\text{LE}}$, but this difference is smaller than the resolution that can be detected by our numerical experiments. \begin{figure} \begin{centering} \includegraphics[width=\columnwidth]{Figures/FP_RFM_alphaU_inset.pdf} \end{centering} \caption{Estimating the Local Entropy transition $\alpha_{\text{LE}}$ by looking to the local entropy profiles of maximum margin references and its derivative with respect to distance (inset). Here $\alpha_T = 2$ and the critical capacity is $\alpha_c \simeq 1.045$. For low values of $\alpha$, e.g. $0.8$, $0.85$ and $0.9$ typical references with maximum margin are located inside a dense region extending to a very long scale, since the local entropy is monotonic. Near $\alpha = \alpha_{\text{LE}} \simeq 0.906$ the derivative of the local entropy develops a new zero for small distances. This signals a transition in the geometrical structure of the dense regions. For $\alpha > \alpha_{\text{LE}}$, the local entropy is not monotonic anymore, meaning that typical maximum margin references (as well as all other typical solutions with smaller margin) are located in isolated balls in configuration space.} \label{Fig::FP_RFM_alphaLE} \end{figure} \section{Numerical experiments}\label{sec::3} In order to assess the relevance of the analysis presented above to more realistic cases, we have performed a series of numerical studies that consider progressively less idealized scenarios. First, we investigated the simplest non-convex continuous overparameterized model, namely a tree-like committee machine trained on randomly generated and randomly projected data, again with labels provided by a random teacher. This architecture can be investigated semi-analytically with the Belief Propagation algorithm, with good approximation. Second, we moved to deeper networks: we studied a fully-connected multi-layer network with a fixed number of variable-width layers, trained with gradient descent using the popular ADAM optimizer, and a deep convolutional networks trained with both SGD and the ADAM optimizer. These deep models have been trained respectively on the first 10 principal components of a reduced version of the MNIST dataset and on images of CIFAR-10. Across these tests, we looked for common characteristics, that corroborate the analytical findings. In order to find a solution, the networks require a minimum number of parameters that is larger than the size of the input. When that degree of overparameterization is achieved, we observe that indeed we have already passed the ``interpolation'' point, since many solutions exist (even after having accounted for the permutation and rescaling symmetries in the networks) and they are located far apart from each other and belong to a flat region. As we increase the amount of overparameterization, the solutions that we found grow further apart in distance, their local landscapes become even flatter, and their generalization properties improve. We also observe that within such flat regions, different algorithms sample solutions of different types, more or less barycentric. In the case of deep networks, we also display the local energy estimate of the flatness of the solutions. {\em Overparameterized tree committee machine:} We studied an overparameterized tree-committee architecture with $K$ hidden units, trained on random patterns. The teacher and the patterns are generated in the same way as for the perceptron of eq.~\ref{eq:perceptron}, and in particular the device receives binary inputs $\boldsymbol{\tilde{\xi}}$ of length $N$ obtained by projecting randomly-generated $D$-dimensional inputs $\boldsymbol{\xi}$ through a random matrix $F$ and a non-linearity $\sigma$, as in eq.~(\ref{eq:projected_xi}). Again, we choose $\sigma=\mathrm{sign}$. We now consider only values of $N$ divisible by $K$, and divide the inputs into groups of $N/K$, each of which is fed to one of the $K$ hidden units; the final output is then decided by majority voting, as: \begin{equation} \label{eq:committee} y_{\text{out}} \equiv \mathrm{sign}\left(\sum_{h=1}^K \text{sign} \left( \frac{1}{\sqrt{N/K}} \sum_{i=\left(h-1\right)\frac{N}{K}+1}^{h \frac{N}{K}} w_i\tilde{\xi}_i \right)\right) \end{equation} Beside the architecture, one major difference with the perceptron case is that here the weights $\boldsymbol{w}$ are assumed to be continuous. Due to the $\mathrm{sign}$ activation function, each unit is invariant to scaling, and thus we normalize the weights of the units by fixing their norms to $1$. We consider two learning algorithms for this architecture. The first one is a version of focusing-BP (fBP) that operates with continuous weights~\cite{baldassi2020shaping}. The implementation exploits the central limit theorem and thus it only works well for relatively large values of $N/K$; furthermore, even in the large $N$ limit, it is only approximately correct on the tree-committee machine architecture. Despite this, in practice it produces excellent results. The second algorithm is Stochastic Gradient Descent with cross-entropy loss. Following ref.~\cite{baldassi2020shaping}, we substituted the (non-differentiable) units' activation function in eq.~\ref{eq:committee}, $\mathrm{sign}\left(\Delta\right)$, with $\tanh\left(\beta \Delta\right)$. The new parameter $\beta$ can be regarded as taking the role of the norm of the unit's weights, since we keep the weights normalized at each step. We explicitly schedule this parameter, letting it start from a small value and making it diverge during the training, thereby recovering the original $\mathrm{sign}$ activation at the end~\footnote{Note that the divergence of the norms would occur naturally anyway in standard SGD with the cross-entropy loss.}. Analogously, we also schedule a parameter $\gamma$ that has the role of the norm of the (fixed) weights in the second layer, and that we can simply plug in the cross-entropy (see the Materials and Methods). \begin{figure} \begin{centering} \includegraphics[width=\columnwidth]{Figures/treecommittee_overlaps_error_localen.pdf} \end{centering} \caption{Results for the overparameterized continuous tree-like committee machine. Tests performed with $D=2001$, $\alpha_T=5$, $K=9$. All points are averages over 5 samples, with 5 independent runs per sample for SGD. Dashed red line: mean overlap between two SGD solutions on the same sample, as a function of the number of parameters $N$. Solid lines: test error for BP and SGD. The vertical dashed grey line at $N=3600$ ($\alpha^{-1} \approx 0.36$) denotes the algorithmic threshold below which the algorithms solve fewer than 50\% of the samples. The overlaps are still far from $1$ at this point. Inset: Local energy profiles, i.e. average train error as a function of the Euclidean distance from a solution. The dashed lines are measured at $N=3996$ ($\alpha^{-1}\approx 0.4$), the solid lines at $N\approx 13500$ ($\alpha^{-1}\approx 1.35$).} \label{Fig:committee} \end{figure} Here, we report the result of tests performed on a committee machine with $K=9$ hidden units, trained on $P=10005$ patterns produced in $D=2001$ dimensions, thus at a fairly large $\alpha_T=P/D=5$, while varying the degree of overparameterization $N=P \alpha^{-1}$ (see the Materials and Methods for the details of the settings used for the training). Our results are reported in Fig.~\ref{Fig:committee}. We found that both fBP and SGD fail to find a solution below $\alpha^{-1} \approx 0.36$, which we thus take to be a plausible estimate for the algorithmic threshold $\alpha_{\mathrm{LE}}^{-1}$ where the phase of the robust solutions presumably changes. This is corroborated by the study of the overlaps: for any given training set, the SGD algorithm finds different solutions when started from different random initial conditions (this is not true for fBP due to its deterministic nature). We measured the average overlap between the solutions and found that when reducing $\alpha^{-1}$ the overlap grows, but it does not tend to $1$ as $\alpha$ tends to $\alpha_{\mathrm{LE}}$, which one would expect if the solutions shrank to a single interpolation point like in convex models. The generalization error behaves as expected, decreasing monotonically with $N$; SGD is slightly worse than of fBP in this regard. We also measured the flatness of the minima found by the algorithm by plotting the "average local energy", i.e. the average training error profile of the landscape surrounding each solution, as a function of the distance. This can be estimated straightforwardly and robustly by randomly perturbing the weights, with a varying degree of multiplicative noise (the weights are still renormalized after the perturbation). In Fig.~\ref{Fig:committee}, we show two sets of curves, one at $\alpha^{-1} \approx 0.4$, close to $\alpha_{\mathrm{LE}}^{-1}$, and one at $\alpha^{-1} \approx 1.35$, at the opposite end. As expected, close to the threshold the minima are generally sharper, but in all cases both SGD and fBP have flat profiles for small distances, reflecting the fact that both algorithms are inherently biased towards wide flat minima \cite{baldassi2020shaping}. The bias is stronger for the fBP algorithm, which was explicitly designed for this purpose, and its profiles are indeed flatter. Overall, the tests show that this model, despite the more complex architecture and the continuous weights, exhibits the phenomenological features described in the theoretical analysis of the previous section on the binary perceptron, and confirm their relevance for gradient-based learning. {\em Comparing solutions in Deep architectures: removing symmetries} When discussing the space of configurations of standard multi-layer architectures, we need to be more careful compared to the simple models discussed so far, due to the presence of additional symmetries. First, the ReLU activation function that is commonly used in deep learning models has the property that $\mathrm{ReLU}\left(a x\right) = a\ \mathrm{ReLU}\left(x\right)$, which implies that if we scale all the input weights of a hidden unit by a factor $a^{-1}$ and all its output weights by a factor $a$ the network's output will be unaffected. By setting the factor $a$ to the norm of the input weights, one can normalize a hidden unit by simply "pushing up" its norm to the next layer. Furthermore, when a network is used for classification tasks, the output label is determined by an $\mathrm{argmax}$ operation, which is invariant to scaling. Thus, normalizing the last layer too is possible without affecting the classification properties of the network. In the full configuration space, each neural network has infinitely many parameter representations, and the error rate landscape has some trivially null directions. This issue can be avoided by normalization, which can be performed simply by starting from the first layer and moving up, as described above. There is also a second, discrete symmetry, since networks are invariant to permutations of the units inside any hidden layer. If we failed to take into account this, we could measure a non-zero distance between networks which are just permuted versions of each other and thus functionally equivalent. One natural way to break this symmetry is to normalize and align the networks before comparing their weights. In our tests, we adopted again a sequential approach for aligning two given networks. Starting from the first hidden layer, we find the permutation of the second networks' units that minimizes the distance between the weights of the two networks for that layer, apply it, and proceed to the following layer. In the following paragraphs, we present experiments on deep architectures that have both these symmetries. We use standard techniques to train them, and thus do not explicitly keep the norms and permutations under control. We do however normalize and align them when we compare two solutions, either to compare their error rates or to measure their distance. {\em Multi-layer neural network} \begin{figure} \begin{centering} \includegraphics[width=1\columnwidth]{Figures/fully_connected.pdf} \end{centering} \caption{Train (full points) and test (empty points) error as a function of the network parameters $N$ for a fully-connected network with $5$ hidden layers. All points are averages over $10$ independent runs. The network is trained using full batch gradient descent with ADAM optimization, with random orthogonal initialization (red curves) and adversarial initialization (blue curves). When the algorithms start finding zero errors solutions, the mean overlap between solutions is far below $1$ (dashed lines). Inset: local energy profiles for both algorithms at two different values of the overparameterization ($N \simeq 9 \cdot 10^{3}$ (full lines) and $N \simeq 2 \cdot 10^{4}$ (dashed lines)).} \label{Fig:fully_connected} \end{figure} We studied a simple fully-connected multi-layer perceptron inspired by ref.~\cite{geiger2020scaling}. The network has a fixed number $H$ of hidden layers ($H=5$ in the numerical experiments) whose width is varied in order to increase the number of model parameters. The model is required to perform a binary classification task on the parity of digits of $10000$ MNIST images, using as inputs only the first $10$ principal components of each image. We trained the model using full batch gradient descent with ADAM optimization, both with random orthogonal initialization~\cite{saxe2013exact} and with adversarial initialization~\cite{liu2020bad}. The results are reported in Fig.~\ref{Fig:fully_connected} where it can be seen that in general different optimization schemes lead to different generalization error plateaus and different algorithmic thresholds. When the model starts to fit the train set, the solution is not unique and as a consequence the mean overlap among independent replicas is lower than $1$. The inset shows that the solutions are indeed robust to noise perturbations even in the proximity of the algorithmic threshold, and they become flatter as the overpameterization increases. {\em Convolutional networks} As a second representative case of deep architectures we analyze a 5-layer NN, with 4 convolutional layers followed by a fully connected one, as in ref.~\cite{nakkiran2019deep}. After each 2d convolution, a batch normalization is performed before applying a ReLU nonlinearity. The overparameterization in this model is adjusted via a parameter $C$: in layer $l$ there are $2^l \cdot C$ 3x3 convolutional filters. This CNN is trained on Cifar10 for 200 epochs, using two different learning algorithms: ADAM with momentum and SGD with a learning rate $\eta = 10^{-2}$. For real datasets like the one we considered, while it is relatively easy to achieve a very low training error, getting to precisely 0 error requires a disproportionate amount of additional computation. For this reason, we consider as solutions all configurations that misclassify at most 1 pattern (<$0.0017\%$ training error), and estimate the algorithmic LE threshold according to this criterion. In Fig.~\ref{Fig:cnn}, train (dashed line) and test (solid line) errors are shown for both optimizers. SGD and ADAM begin to fit the training set data at $C = 50$ and $C = 60$ respectively, while the generalization error is monotonically decreasing with the number of network parameters. It is worth noticing that these architectures work in a relatively lazy training regime: the first layer is less affected by the training, while the following layers change progressively more (see details in the SI). Consistently with the analytical results, and similarly to other networks we have studied, we find that the learning algorithms, namely SGD and ADAM, find different solutions depending on initial conditions. In particular, even when we get close to the algorithmic threshold, we observe that the overlaps, in contrast to what happens at the interpolation threshold in convex networks, do not tend to their maximum value of one (red curve in Fig.~\ref{Fig:cnn}). The solutions found by SGD and ADAM show similar geometric properties, i.e., they belong to flat regions of the training error landscape. This can be seen in the inset of Fig.~\ref{Fig:cnn}, where we display the results of the numerical analysis of the average (local energy) landscape around a given solution. Like for the other models, this was measured by random sampling, perturbing the solutions with multiplicative noise (see the SI for details). The first derivative at short distances is essentially zero. \begin{figure} \begin{centering} \includegraphics[width=\columnwidth]{Figures/CNN.pdf} \end{centering} \caption{Train (dashed) and test (solid) errors of solutions obtained with SGD and ADAM (gray and blue lines respectively) as a function of $C$. Each point is the average on 5 independent samples. \textit{Red dotted line} - average overlap between 3 different pairs of solutions (ADAM). \textit{Inset} - local energy as a function of the distance from solutions (gray - SGD with $C = 54$, blue - ADAM with $C = 64$). } \label{Fig:cnn} \end{figure} \section{Concluding remarks} Our results characterize the interplay between hyperparameterization and nonconvexity in neural networks learning data generated by structurally different networks randomly chosen from a natural distribution. In particular, we identify a new phenomenon, namely the existence of a phase transition driven by the appearance of solution sets that are statistically atypical but strongly attractive to learning algorithms. For the same systems we are able to derive the generalization error of different types of solutions and predict how to optimize the Bayesian error. The analytical techniques also suggest a number of numerical verifications that can be done on deep networks and for different learning algorithms. The consistency of the results is very good, suggesting that the scenario identified in the analytically tractable models, i.e., the essential role played by highly entropic atypical solutions, may in fact be general. There are several natural future directions. On the one hand, in-depth numerical studies of large deep networks should be conducted, and algorithms should be further optimized building on the information derived from the structure of solutions. Most algorithm already do this as a result of the optimization process that has been put in practice during the last decade. Still further progress appear to be possibile, and some steps in this direction have already been taken. On the other hand, it would be important to corroborate our results with rigorous bounds, for more general data distributions, in order to reach a more complete mathematical theory for learning in non-convex hyperparameterized systems. From a physics and modeling perspective, it seems to us that having identified that atypical states play a key role in learning processes opens the way toward a fertile connection between out-of-equilibrium physics and modeling of learning systems. Indeed, such states are inherently atypical respect to algorithmic dynamics that tend to sample energy with a Gibbs measure and the basic energy function, or loss function, defined directly on the data as the number of errors. \section*{Acknowledgements} We gratefully thank Fabrizio Pittorino for sharing with us his code implementing matching of CNN. \noindent \bibliographystyle{unsrturl}
\section{Method: A Novel \textsc{WiGraph}\xspace Layer} \label{sec:method} \input{031notation} \input{032interaction} \input{033gnn} \input{034layer} \input{035IBLoss} \input{036-Variation} \input{040connect} \input{table_prediction} \input{041connect-more} \input{table_aopc} \input{051expSetup} \input{051predictionResults} \input{table_ablation} \input{053interpretabilityResults} \input{052interaction} \input{054ablation} \input{055qualitativeResults} \input{060cnn} \input{06conclusion} \FloatBarrier \clearpage \section{Introduction} Deep neural networks (DNNs) have achieved remarkable results in the field of natural language processing (NLP) \cite{zhang2015character,miwa2016end,wu2016google,wolf2020transformers}. Trustworthy real-world deployment of NLP models requires models to be not only accurate but also interpretable~\cite{xie2020explainable}. Literature has included a growing focus on providing posthoc explanations or rationales for NLP models' predictions \cite{ribeiro2016should,lundberg2017unified, murdoch2018beyond, singh2018hierarchical,chen2020generating}. However, explaining DNNs using a posthoc manner cannot improve a model's intrinsic interpretability. As shown in \cite{chen2020learning}, two NLP models may have the same prediction behavior but different interpretation ability. This concept of "intrinsic interpretability" motivates a compelling research direction to improve the interpretability of NLP models. A few recent studies used user-specified priors as domain knowledge to guide model training \cite{camburu2018snli,du2019attribution,chen2019improving,erion2019learning,molnar2019quantifying}, hence improving model interpretability. Such information priors, however, may not be available in many tasks. Several other studies proposed to develop inherently interpretable models \cite{alvarez2018towards,rudin2019stop}, but these require intensive engineering efforts. More recently, \citet{chen2020learning} proposed to add a variational word mask, VMASK, to improve the interpretability of NLP neural classifiers. The aforementioned literature on improving NLP models' intrinsic interpretability have mostly focused on highlighting important words. Strategies like VMASK just select important words unilaterally, without accounting for how one word influences other words regarding interpretability. Studies have shown that word interactions are critical in explaining how NLP models make decisions~\cite{halford2010relational}. For instance, for a sentiment classification task, when without a context, it is hard to conclude if the word {\it `different'} by itself is vital for sentiment? However, if we find `different' highly relates to the word `refreshingly', it will likely contribute substantially to the model's sentiment prediction (see Table~\ref{tab:intro_examples} \footnote{These attribution interpretations were generated by LIME \citep{ribeiro2016should} and use BERT-base model on SST-2 dataset to explain two models' predictions.}). \input{030motivation-figure} Along this direction, we propose a novel neural network layer, we call \textsc{WiGraph}\xspace, to improve NLP models' intrinsic interpretability. \textsc{WiGraph}\xspace is a plug-and-play layer and uses a graph-oriented neural network design: (1) It includes a stochastic edge discovery module that can discover significant interaction relations between words for a target prediction task; (2) It then uses a neural message passing module to update word representations by using information from their interacting words; and (3) It designs a variational information bottleneck based loss objective to suppress irrelevant word interactions (regarding target predictions). We call such a loss: VIB-WI loss\xspace. To improve a target text classifier's intrinsic interpretability, we propose to add the proposed \textsc{WiGraph}\xspace layer right after the word embedding layer and fine-tune such an augmented model using a combination of the original objective and VIB-WI loss\xspace objective. In summary, this paper makes the following contributions: \begin{itemize}% \item We design \textsc{WiGraph}\xspace to augment neural text classifiers to improve these models' intrinsic interpretability. \textsc{WiGraph}\xspace does not require external user priors or domain knowledge. \textsc{WiGraph}\xspace can plug-and-play into any neural NLP models' architectures, right after the word embedding layer. \item We provide extensive empirical results showing that adding \textsc{WiGraph}\xspace layer into SOTA neural text classifiers results in better explanations (locally, globally as well as regarding interactions) and better model predictions at the same time. \end{itemize} \subsection{To Discover Word Interaction Graph: $A$} \label{sec:A} Now we explain the first component of the proposed \textsc{WiGraph}\xspace layer. This module aims to discover how words globally interact for a predictive task. Our primary strategy to describe how words relate is to treat words as nodes and their interaction as edges in an interaction graph. We follow such an idea and choose to learn an undirected word interaction graph using a stochastic neural network module. We represent this unknown graph as $\mathbf{A} = \{ \mathbf{A}_{ij} \}_{V \times V}$. $\mathbf{A}$ includes the edges representing word interactions. We assume each $\mathbf{A}_{ij} \in \{0,1\}$ is one binary random variable. $\mathbf{A}$ is stochastic whose $\mathbf{A}_{ij}$ specifies the presence or absence of an interaction between word $i$ and word $j$ in vocabulary $\mathbb{V}$. $\mathbf{A}_{ij} \in \{0,1\} $ is sampled from $ \mathit{Sigmoid}(\mathbf{\gamma}_{ij})$, following Bernoulli distribution with parameter $\mathit{Sigmoid}(\mathbf{\gamma}_{ij})$. In Section~\ref{sec:gcn}, we show how $\mathbf{A}$ can help us understand how certain words are more important than others owing to the learned word interactions. Learning the word interaction graph $\mathbf{A}$ means to learn the parameter matrix $\mathbf{\gamma}=\{ \mathbf{\gamma}_{ij} \}_{V \times V}$. In Section~\ref{subsec:ibloss}, we show how $\mathbf{\gamma}$ (and therefore $\mathbf{A}$) is learned through the variational information bottleneck framework\cite{alemi2016deep}. \subsection{Message Passing on Word Interaction Graph using Graph Convolution: $\mathbf{E}'$} \label{sec:gcn} In our second module, we represent the $i$-th word $\x_i$ of an input text $\x$ as a node on the $\A$ graph. We use a modified version of graph convolutional operation \cite{kipf2016semi} to update each $\mathbf{x}_i$ with its neighboring words $\mathbf{x}_j$. Here $j \in \mathcal{N}(i)$, and $\mathcal{N}(i)$ denotes those neighbor nodes of $\x_i$ on the graph $\mathbf{A}$ and in $\x$. Specifically, we denote the resulting word representation vector as $\e'_i$. Each $\mathbf{x}_i$ is revised using a graph based summation from its neighbors' embedding $\mathbf{x}_j, j \in \mathcal{N}(i)$: \begin{equation} \e_i' = \x_i + \sigma\Bigg( \tfrac{1}{|\mathcal{N}(i)|}\sum_{j \in \mathcal{N}(i)} \x_j \Bigg), \label{eq:GCN_vec} \end{equation} Eq.~(\ref{eq:GCN_vec}) is motivated by the design of Graph convolutional networks (GCNs) that were recently introduced to learn useful node representations that encode both node-level features and relationships between connected nodes \cite{kipf2016semi}. Different from the ReLU activation function used in vanilla GCNs, we use GeLU as the $\sigma(\cdot)$ , the non-linear activation function proposed in \cite{hendrycks2016gaussian}. We want to point out that Eq.~(\ref{eq:GCN_vec}) is different from a typical GCN operation from \cite{kipf2016semi}. First, we only conduct one hop of neighbor aggregation in Eq.~(\ref{eq:GCN_vec}). A typical GCN module does multi-hops. Second, we drop $\mathbf{W}^t \in \mathbb{R}^{d \times d}$ used for $t$-th hop of GCN update in \cite{kipf2016semi}. This is because we assume that the \textsc{BASE}\xspace text classifier model $f$ has taken into account this prior and our \textsc{WiGraph}\xspace layer will not bias to prefer short range interactions. The third difference is the most important distinction that differentiates ours apart from \cite{kipf2016semi}. The graph has been given apriori to typical GCNs. However, in our work, we need to learn the graph $\A$ (see Section~\ref{subsec:ibloss} on how to learn $\A$). We can compute the simultaneous update of all words in input text $\x$ together by concatenating all $\e'_i$. This gives us one matrix $\E' \in \mathbb{R}^{L \times d}$, where $L$ is the length of input and $d$ is the embedding dimension of each $\x_i$. The simultaneous update can be written as: \begin{equation} \label{eq:roull_gcn} \E' = \sigma(\mathbf{A}'\mathbf{X}). \end{equation} where $\mathbf{A'} = \mathbf{\hat{D}}^{-\frac{1}{2}}(\mathbf{A}_{\x} + \mathbf{I})\mathbf{\hat{D}}^{-\frac{1}{2}}$, that is the normalized adjacency matrix and $\mathbf{\hat{D}}$ is the diagonal degree matrix of $(\mathbf{A}_{\x}+ \mathbf{I})$. Note: $\mathbf{A}_{\x}$ denotes those edges from $\mathbf{A}$ that are local for the current sample text $\x$. In summary, our second module computes: $$\mathbf{E'}=g_{GC}(\mathbf{X},\mathbf{A})$$ \fix{justify why harder to deal with multiple different A, compare with ElMo} \subsection{To Build and Use \textsc{WiGraph}\xspace Layer: $\mathbf{X} \rightarrow \mathbf{Z}$ } Our design of \textsc{WiGraph}\xspace layer is that it can take the embedding matrix of a text example as input ($\X \in \mathbb{R}^{L \times d}$), and output a revised matrix representing each word with revised embedding ($\bZ \in \mathbb{R}^{L \times d}$). \textsc{WiGraph}\xspace layer aids the selection of more informative words based on their interactions for current predictive task. The proposed layer does not need significant efforts on engineering network architectures and does not require pre-collected importance attributions or explanations. Our main goal is to improve the intrinsic interpretability of neural text classifiers with a simple model augmentation. Therefore, for a given neural text classifier, we propose to simply insert a \textsc{WiGraph}\xspace layer right after the word embedding input layer and before the subsequent network layers of that target model. There exist many possible ways to build \textsc{WiGraph}\xspace layer from our first two modules (\sref{sec:A} and \sref{sec:gcn}). The simplest way is that we can just pass $\E'$ as $\mathbf{Z}$. \begin{equation} \bZ = \E' \end{equation} Figure~\ref{fig:imask_model} visualizes how this vanilla version of \textsc{WiGraph}\xspace layer updates word representations with the $\mathbf{X} \rightarrow \E' \rightarrow \mathbf{Z}$ data flow during inference. During training, it needs to learn the graph $\A$. \subsection{Model Training with VIB-WI loss\xspace} \label{subsec:ibloss} Now we propose to train \textsc{WiGraph}\xspace jointly with other layers using a new objective that we name as variational information bottleneck loss for word interaction (VIB-WI loss\xspace). VIB-WI loss\xspace aims to restrict the information of globally irrelevant word interactions flowing to subsequent network layers, hence forcing the model to focus on important interactions to make predictions. Following the Information Bottleneck framework \cite{alemi2016deep}, we aim to learn $\A$ and all subsequent layers' weights $\{\W\}$, to make $\mathbf{Z}$ maximally informative of the prediction label ${\Y}$, while being maximally compressive of $\mathbf{X}$ (see Figure~\ref{fig:imask_model}). That is \begin{equation} max_{\A, \{\W\}} \{ I(\mathbf{Z};\mathbf{Y}) - \beta I(\mathbf{Z}; \mathbf{X}) \} \label{eq:ib_main_objective} \end{equation} Here $I(\cdot;\cdot)$ denotes the mutual information, and $\beta\in\mathbb{R}_{+}$ is a coefficient balancing the two mutual information terms. Given a specific example $(\x^{m},\y^{m})$, we can further simplify the lower bound of first term $I(\mathbf{Z};\mathbf{Y})$ in \eref{eq:ib_main_objective} as: \begin{equation} \label{eq:mvib-1} I(\z;\y^{m}) \geq \mathbb{E}_{q(\z|\x^{m})} log (p(\y^m| \x^m; \A, \{\W\})) \end{equation} Similarly for the second term $I(\mathbf{Z}; \mathbf{X})$ in \eref{eq:ib_main_objective} and for a given example $(\x^{m},\y^{m})$, we can simplify its upper bound as: \begin{eqnarray} \label{eq:mvib-2} I(\z;\x^m)\leq KL(q(\mathbf{A} | \x^m) || p_{a0}(\mathbf{A})) \end{eqnarray} Due to the difficulty in calculating two mutual information terms in \eref{eq:ib_main_objective}, we follow~\cite{schulz2020restricting,alemi2016deep} to use a variational approximation $q(\X,\Y,\bZ)$ to approximate the true distribution $p(\X,\Y,\bZ)$. Details on how to derive \eref{eq:mvib-1} and \eref{eq:mvib-2} are in \sref{sec:moreIBloss}. Now combining \eref{eq:mvib-1} and \eref{eq:mvib-2} into \eref{eq:ib_main_objective}, we get the revised objective as: \begin{equation} \label{eq:mlossa} \begin{aligned} max_{\A, \R, \{\W\}} \{ \mathbb{E}_{q(\mathbf{Z}|\x^m)} log (p(\mathbf{y}^m| \x^m; \A, \R, \{\W\})) \\ - \beta_g KL(q(\mathbf{A} | \x^m) || p_{a0}(\mathbf{A})) \} \end{aligned} \end{equation} \eref{eq:mlossa} is the proposed VIB objective for a given observation $(\x^{m},\y^{m})$. \paragraph{Detailed Model Specification: } During training, for the stochastic interaction graph $\A$, we learn its trainable parameter matrix $\gamma \in \mathbb{R}^{|V| \times |V|}$, that is also optimized along with the model parameters during training. Further, we use the mean field approximation \cite{blei2017variational}, that is, $q(\mathbf{A}_{\x}|\x) = \prod_{i=1}^L \prod_{j=1}^L q(A_{x_i, x_j}|\x_i,\x_j)$. Equation~\ref{eq:mlossa} requires prespecified prior distributions $p_{a0}$. We use a Bernoulli distribution prior (a non-informative prior) for each word-pair interaction $q_{\phi}[\mathbf{A}_{x_i, x_j}|\x_i,\x_j ]$. $p_{a0}(\mathbf{A}_{x})=\prod_{i=1}^L\prod_{j=1}^L p_{a0}(\mathbf{A}_{\x_i, \x_j})$ and $p_{a0}(\mathbf{A}_{x_i, x_j})= Bernoulli(0.5)$. This leads to: \begin{equation} KL(q(\mathbf{A}_{\x} | \x^m) || p_{a0}(\mathbf{A})) = -H_{\mathbf{q}} (\mathbf{A}_{\x}| \x^m) \end{equation} Here, $H_q$ denotes the entropy of the term $\mathbf{A}_{\x}| \x^m$ under the $q$ distribution. Besides, we add a sparsity regularization on $\mathbf{A}_{\x}$ to encourage learning of sparse interactions. Now, we have the following loss function for $(\x^{m},\y^{m})$: \begin{equation} \begin{split} - (\mathbb{E}_{\x} p(\y|\x^m; \mathbf{A}, \{\W\}) + \beta_{g} H_{\mathbf{q}}(\mathbf{A}_{\x}| \x^m)) \\ + \beta_{sparse} ||\mathbf{A}_{\x}||_1 \end{split} \vspace{-5mm} \end{equation} During training, $\A$ is discrete and is drawn from Bernoulli distributions that are parametrized with matrix $\gamma \in \mathbb{R}^{|V| \times |V|}$. We, therefore, use the Gumbel-Softmax\cite{jang2016categorical} trick to differentiate through the sampling step and propagate the gradients to the respective parameters $\gamma$. \subsection{Detailed Derivation} \label{sec:moreIBloss} We follow the markov factorization : $p(\X,\Y,\bZ) = p(\bZ|\X,\Y) P(\X,\Y) = P(\bZ|\X,\Y) P(\Y|\X) P(\X) = P(\bZ|\X) P(\Y|\X) P(\X)$, motivated from the Markov assumption : $\Y \xleftrightarrow{} \X \xleftrightarrow{} \bZ$, i.e. $\Y$ and $\bZ$ are independent of each other given $\X$. We assume the data are generated using the above assumption where $\bZ$ is not observed, i.e. a latent variable. Our derivation is based on \cite{chen2018learning,schulz2020restricting,alemi2016deep}, where we start from an approximation $q(\X,\Y,\bZ)$ instead of the true distribution $p(\X,\Y,\bZ)$. \paragraph{The lower bound for $I(\bZ;\Y)$.} \begin{eqnarray} I(\bZ,\Y) &=& \sum_{\y, \z} q(\y,\z)\log \frac{q(\y,\z)}{q(\y)q(\z)}\nonumber\\ &=& \sum_{\y, \z} q(\y,\z)\log \frac{q(\y|\z)}{q(\y)}\nonumber\\ &=& \sum_{\y, \z} q(\y,\z) \log q(\y|\z)\nonumber\\ & & + H_q(\Y), \end{eqnarray} where $H_q(\cdot)$ represents entropy, and can be ignored for the purpose of training the model. \begin{equation} \begin{aligned} \label{eq:L_bound} & \sum_{\y, \z} q(\y,\z)\log q(\y|\z) \\ &= \sum_{\y, \z} q(\y,\z)\log \dfrac{q(\y|\z)p(\y|\z)}{p(\y|\z)} \\ &=\sum_{\y, \z} q(\y,\z)\log p(\y|\z) + KL[q(\y|\z)||p(\y|\z)] \\ &\geq \sum_{\y, \z} q(\y,\z)\log p(\y|\z), \end{aligned} \end{equation} where $KL[\cdot||\cdot]$ denotes Kullback-Leibler divergence. This gives us the following lower bound: \begin{equation} \begin{aligned} \label{eq:izy-lower} I(\bZ,\Y) &\geq \sum_{\y, \z}q(\y,\z) \log p(\y|\z) + H_q(\y)\\ &=\sum_{\y, \z, \x}q(\x,\y,\z)\log p(\y|\z)+ H_q(\y)\\ &\!\!\!=\!\!\!\sum_{\y, \z, \x}\!\!q(\x, \y)q(\z|\x) \log p(\y|\z)\!+\!H_q(\y), \end{aligned} \end{equation} where the last step uses $q(\x,\y,\z) = q(\x)q(\y|\x) q(\z|\x)$, which is a factorization based on the conditional dependency: $\y \leftrightarrow \x \leftrightarrow \z$: $\y$ and $\z$ are independent given $\x$. Given a sample, $(\x^{(m)},\y^{(m)})$, we can assume the empirical distribution $q(\x^{(m)},\y^{(m)})$ simply defined as a multiplication of two Delta functions \begin{equation} q(\x=\x^{(m)},\y=\y^{(m)}) = \delta_{\x^{(m)}}(\x)\cdot\delta_{\y^{(m)}}(\y). \end{equation} So we simplifying further of the first term: \begin{equation} \begin{aligned} \label{eq:vib-1} I(\z;\y^{(m)}) &\geq \sum_{\z}q(\z|\x^{(m)}) \log p(\y^{(m)}|\z)\\ &=\mathbb{E}_{q(\z|\x^{(m)})} \log(p(\mathbf{y}^{(m)}| \z)) \end{aligned} \end{equation} Since $\mathbf{Z} = \diag{\R_{\x}} \mathbf{E'}$, and $\mathbf{E'}$ is a deterministic function of $\mathbf{A}$, we have: \begin{equation} \begin{aligned} \label{eq:vib-1_1} I(\z;\y^{(m)}) \geq \mathbb{E}_{q(\mathbf{z}|\x^{(m)})} log (p(\mathbf{y}^{(m)}| \mathbf{R}, \mathbf{A}, \x^{(m)})) \end{aligned} \end{equation} \paragraph{The upper bound for $I(\bZ;\X)$.} \begin{equation} \begin{aligned} I(\bZ,\X) &=& \sum_{\x, \z} q(\x,\z)\log \frac{q(\x,\z)}{q(\x) q(\z)}\nonumber\\ &=& \sum_{\x, \z} q(\x,\z)\log \frac{q(\z|\x)}{q(\z)}\nonumber \end{aligned} \end{equation} \begin{equation} \begin{aligned} &=& \sum_{\x, \z} q(\x,\z)\log q(\z|\x)\nonumber\\ & & - \sum_{\x, \z} q(\x,\z)\log q(\z) \end{aligned} \end{equation} By replacing $q(\z)$ with a prior distribution of $\z$, $p_0(\z)$, we have \begin{equation} \sum_{\x, \z} q(\x,\z)\log q(\z) \geq \sum_{\x, \z} q(\x,\z)\log p_0(\z). \end{equation} Then we can obtain an upper bound of the mutual information \begin{eqnarray} \label{eq:vib-2} I(\bZ;\X) &\leq& \sum_{\x, \z} q(\x,\z)\log q(\z|\x)\nonumber\\ & & - \sum_{\x, \z}q(\x,\z)\log p_0(\z)\nonumber\\ &=& \sum_{\x} q(\x)KL[q(\z|\x)||p_0(\z)]\nonumber\\ &=& \mathbb{E}_{q(x)}{KL[q(\z|\x)||p_0(\z)}]. \end{eqnarray} For a given sample $(\x^m,\y^m)$, \begin{equation} I(\z;\x^{(m)}) = KL[q(\z|\x^{(m)})||p_0(\z)] \end{equation} Given $\mathbf{X}$, we assume $\mathbf{R}$ and $\mathbf{A}$ are independent. We also assume a factorable prior $p_0( \z) = p_{r0}(\mathbf{R})p_{a0}(\mathbf{A})$. This gives us: \begin{eqnarray} \label{eq:vib-2_1} I(\z,\x^{(m)})\leq KL(q(\mathbf{R} | \x^{(m)}) || p_{r0}(\mathbf{R}))\nonumber \\ + KL(q(\mathbf{A} | \x^{(m)}) || p_{a0}(\mathbf{A})) \end{eqnarray} \subsection{Variation: \textsc{WiGraph}\xspace-A-R} We also try another possible design of \textsc{WiGraph}\xspace that includes one more separate module that learns an attribution word mask $\R$ on top of $\E'$. Aiming for better word selection, $\R$ is designed as a stochastic layer we need to learn and $\R \in \{0,1\}^{V}$. Each entry in $\R$ (e.g., $\R_j \in\{0,1\}$) follows a Bernoulli distribution with parameter $\phi$ (to be learned). During inference, for an input text $\x$, we get a binary vector $\R_{\x}$ from $\R$ that is of size $L$. Its $i$-th entry $\R_{\x_i}\in\{0,1\}$ is a binary random variable associated with the word token at the $i$-th position. % We use the following operation (a masking operation!) to generate the final representation of the $i$-th word from a \textsc{WiGraph}\xspace layer: \begin{equation} \z_i = \R_{\x_i} \e'_i \end{equation} We can compute the simultaneous update of all words in input text $\x$ together by concatenating all $\z_i$ denoted as matrix $\bZ \in \mathbb{R}^{L \times d}$. The simultaneous update can then be written as: \begin{equation} \label{eq:wmask} \bZ = \diag {\R_{\x}}_{L \times L} \E'_{L \times d} \end{equation} During training, we need to learn both $\A$ and $\R$. Now the loss function VIB-WI loss\xspace turns to: \begin{equation*} \begin{split} - (\mathbb{E}_{\x} p(\y|\x^m; \mathbf{A}, \mathbf{R}, \{\W\}) + \beta_i H_q(\mathbf{R}_{\x}|\x^m) + \\ \beta_{g} H_{\mathbf{q}}(\mathbf{A}_{\x}| \x^m)) + \beta_{sparse} ||\mathbf{A}_{\x}||_1 \end{split} \end{equation*} Due to page limit, we put detailed derivations of above and specification of $\R$ in \sref{subsec:moreibloss}. % We call the vanilla version of \textsc{WiGraph}\xspace as \textbf{\textsc{WiGraph}\xspace-A} and the version with the word mask R as \textsc{WiGraph}\xspace-A-R. \subsection{Model Training for \textsc{WiGraph}\xspace-A-R} \label{subsec:moreibloss} We propose to train \textsc{WiGraph}\xspace jointly with other layers using a new objective that we name as variational information bottleneck loss for word interaction (VIB-WI loss\xspace). VIB-WI loss\xspace aims to restrict the information of globally irrelevant word interactions flowing to subsequent network layers, hence forcing the model to focus on important interactions to make predictions. Following the Information Bottleneck framework \cite{alemi2016deep}, we aim to learn $\A$, $\R$ and all subsequent layers' weights $\{\W\}$, to make $\mathbf{Z}$ maximally informative of ${\Y}$, while being maximally compressive of $\mathbf{X}$ (see Figure~\ref{fig:imask_model}). That is \begin{equation} max_{\A, \R, \{\W\}} \{ I(\mathbf{Z};\mathbf{Y}) - \beta I(\mathbf{Z}; \mathbf{X}) \} \label{eq:ib_main_objective_a} \end{equation} Here $I(\cdot;\cdot)$ denotes the mutual information, and $\beta\in\mathbb{R}_{+}$ is a coefficient balancing the two mutual information terms. Given a specific example $(\x^{m},\y^{m})$, we can further simplify the lower bound of first term $I(\mathbf{Z};\mathbf{Y})$ in \eref{eq:ib_main_objective_a} as: \begin{equation} \label{eq:mvib-1-a} I(\z;\y^{m}) \geq \mathbb{E}_{q(\z|\x^{m})} log (p(\y^m| \x^m; \A, \R, \{\W\})) \end{equation} Similarly for the second term $I(\mathbf{Z}; \mathbf{X})$ in \eref{eq:ib_main_objective_a} and for a given example $(\x^{m},\y^{m})$, we can simplify its upper bound as: \begin{eqnarray} \label{eq:mvib-2-a} I(\z;\x^m)\leq KL(q(\mathbf{R} | \x^m) || p_{r0}(\mathbf{R}))\nonumber \\ + KL(q(\mathbf{A} | \x^m) || p_{a0}(\mathbf{A})) \end{eqnarray} Due to the difficulty in calculating two mutual information terms in \eref{eq:ib_main_objective_a}, we follow~\cite{schulz2020restricting,alemi2016deep} to use a variational approximation $q(\X,\Y,\bZ)$ to approximate the true distribution $p(\X,\Y,\bZ)$. Details on how to derive \eref{eq:mvib-1-a} and \eref{eq:mvib-2-a} are in \sref{sec:moreIBloss}. Now combining \eref{eq:mvib-1-a} and \eref{eq:mvib-2-a} in \eref{eq:ib_main_objective_a}, we get the revised objective as: \begin{equation} \label{eq:mlossa-a} \begin{aligned} max_{\A, \R, \{\W\}} \{ \mathbb{E}_{q(\mathbf{Z}|\x^m)} log (p(\mathbf{y}^m| \x^m; \A, \R, \{\W\})) \\ - \beta_i KL(q(\mathbf{R} | \x^m) || p_{r0}(\mathbf{R})) \\ - \beta_g KL(q(\mathbf{A} | \x^m) || p_{a0}(\mathbf{A})) \} \end{aligned} \end{equation} \eref{eq:mlossa-a} is the proposed VIB objective for a given observation $(\x^{m},\y^{m})$. To increase the flexibility, we associate two different coefficients from $\mathbb{R}_{+}$ with the two KL-terms. In practice we treat them as hyper-parameters. % \paragraph{Detailed Model Specification: } In this section, we describe in detail how to learn discrete $\A$ and $\R$ along with the model parameters during training. To learn the word mask $\R$, we use amortized variational inference\cite{rezende2015variational}. That is, we use a single-layer feedforward neural network as the inference network $q_{\phi}(R_{x_t}| x_t)$, associated parameters $\phi$ are optimized with the model parameters during training. For the interaction mask (graph) $\A$, we use a trainable parameter matrix $\gamma \in \mathbb{R}^{|V| \times |V|}$, that is also optimized along with the model parameters during training. Further, we use the mean field approximation \cite{blei2017variational} for both the word mask and the variational interaction mask, that is, $q(\mathbf{R}|\x) = \prod_{i=1}^L q(R_{x_t}|\x_t)$ and $q(\mathbf{A}_{\x}|\x) = \prod_{i=1}^L \prod_{j=1}^L q(A_{x_i, x_j}|\x_i,\x_j)$. Equation~\ref{eq:mlossa-a} requires prespecified prior distributions $p_{r0}$ and $p_{a0}$. We use the Bernoulli distribution prior (a non-informative prior) for each word-pair interaction $q_{\phi}[\mathbf{A}_{x_i, x_j}|\x_i,\x_j ]$. $p_{a0}(\mathbf{A}_{x})=\prod_{i=1}^L\prod_{j=1}^L p_{a0}(\mathbf{A}_{\x_i, \x_j})$ and $p_{a0}(\mathbf{A}_{x_i, x_j})= Bernoulli(0.5)$. This leads to: \begin{equation} KL(q(\mathbf{A}_{\x} | \x^m) || p_{a0}(\mathbf{A})) = -H_{\mathbf{q}} (\mathbf{A}_{\x}| \x^m) \end{equation} Here, $H_q$ denotes the entropy of the term $\mathbf{A}_{\x}| \x^m$ under the $q$ distribution. Similarly, for the word mask, $p_{r0}(\mathbf{R}) = \prod_{i=1}^L p_{r0}(\mathbf{R}_{\x_i})$, and $p_{r0}(\mathbf{R}_{\x_i})=Bernoulli(0.5)$. Therefore, \begin{equation} KL(q(\mathbf{R}_{\x} | \x^m) || p_{a0}(\mathbf{R})) = - H_{\mathbf{q}} (\mathbf{R}_{\x}| \x^m) \end{equation} Finally, we have the following loss function for $(\x^{m},\y^{m})$: \begin{equation} \begin{split} - (\mathbb{E}_{\x} p(\y|\x^m; \mathbf{A}, \mathbf{R}, \{\W\}) + \beta_i H_q(\mathbf{R}_{\x}|\x^m) + \\ \beta_{g} H_{\mathbf{q}}(\mathbf{A}_{\x}| \x^m)) + \beta_{sparse} ||\mathbf{A}_{\x}||_1 \end{split} \vspace{-5mm} \end{equation} We use stochastic gradient descent to optimize the above loss using all training samples. During training, both $\A$ and $\R$ are discrete samples drawn from Bernoulli distributions in ~\eref{eq:roull_gcn} and ~\eref{eq:wmask}. We, therefore, use the Gumbel-Softmax\cite{jang2016categorical} trick to differentiate through the sampling step and propagate the gradients to their respective parameters $\gamma$ and $\phi$. \subsection{Using co-occurrence matrix} We define a co-occurrence matrix, a matrix of size $V\times V$ that counts the number of times each word $i$ co-occurs with another word $j$ in a sentence over the entire training dataset. Concretely, for each word $w_i$ in a sentence, and each word in the sentence, we $C[i,j]+=1$ if the two words occur together in the sentence. We further convert this into an initial probability using: Say each training sample is represented by $v_i$ is a one-hot vector indicating the presence or absence of a word in a vocabulary in a training sample $i$. and $n_i = \sum_{j=1}^V v_{ij}$. We investigate two types of co occurrence statistics: (1) \begin{equation} \mathbf{C} = \dfrac{Count(w_i, w_j) }{\sum_{i=1}^{|V|} \sum_{j=1}^{|V|}Count(w_i, w_j) } \end{equation} We use the co-occurrence as a prior instead of a Bernoulli parameter for the KL term between $\mathbf{A}$. \subsection{More Details about Method} \label{sec:moremethod} \section{Connecting to Related Work} Our design orients from one basic notion that we treat interpretability as an intrinsic property of neural network models. We expect a neural text classifier will be more interpretable, when focusing on important word interactions to make predictions. Our work connects to multiple related topics: \paragraph{Self-Explaining Models} Recent literature has seen growing interests in treating interpretability as an {\it inherent property} of NLP deep models. \cite{alvarezmelis2018robust,rudin2019stop} proposed to design self-interpretable models by requiring human annotations in model engineering. \cite{chen2020learning} proposed VMASK layer for improving NLP models' interpretability. This layer automatically learns task-specific word importance and guides a model to make predictions based on important words. However, this method does not consider interactions between words. \paragraph{Explanations as Feedback} Anoter category of work uses explanations as feedback for improving model prediction performance as well as to encourage explanation faithfulness. \cite{camburu2018snli,chen2019improving,erion2019learning,molnar2019quantifying} focuses on aligning human judgments with generated explanations and further incorporating it into the training of the model. These methods require human annotations that are expensive to obtain and also have the risk of not aligning well with the separately trained model's decision making process. \cite{ross2017right,ross2017improving,rieger2020interpretations} use explanations as feedback into the model to improve prediction performance. However, these heavily rely on ground-truth explanations and domain knowledge. Differently, our proposed method augments a model with a special layer that improves both prediction performance and interpretability (see \sref{sec:exp}). \paragraph{Graph Neural Networks} Graph Neural Networks (GNNs) generalize neural networks from regular grids, like images to irregular structures like graphs. There exists a wide variety of GNN architectures like \cite{kipf2016semi,scarselli2008graph,velivckovic2017graph,santoro2017simple}. They share the same underlying concept of message passing between connected nodes in the graph. However, little attention has been paid to address cases when the underlying graph is unknown. In contrast, in \textsc{WiGraph}\xspace, we do not know the global interaction graph {\it apriori}. It is learnt along with the prediction model as part of the training. \paragraph{Post-Hoc Explanation} NLP literature includes a number of methods that focus on disentangling the rationales of a trained NLP model's decision by finding which words contributed most to a prediction, including the popularly used LIME\cite{ribeiro2016should} and SampleShapley \cite{kononenko2010efficient} methods. Recent studies have proposed to generate post-hoc explanations beyond word-level features by detecting feature interactions, including for instance, contextual decomposition by \cite{murdoch2018beyond}. Other work adopted Shapley interaction index to compute feature interactions \cite{lundberg2018consistent}. In contrast to these post-hoc interpretation systems, our method focuses on designing a strategy to improve the inherent interpretability of NLP models. \section{Experiments} \label{sec:exp} \vspace{-1mm} We design experiments to answer the following: \begin{enumerate} \item Are NLP models augmented with \textsc{WiGraph}\xspace layer more interpretable models? \item Do NLP models augmented with \textsc{WiGraph}\xspace layer predict well? \end{enumerate} Besides, we extend \textsc{WiGraph}\xspace to one concept based vision task in Section~\ref{sec:concept}. \subsection{Setup: Datasets, Models and Metrics} \paragraph{Datasets} Our empirical analysis covers six popular text classification datasets as detailed by Table~\ref{tab:dataset_stats}. These six datasets are "sst1", "sst2"\cite{socher2013recursive}, "imdb"\cite{maas2011learning}, "AG news"\cite{Zhang2015CharacterlevelCN}, "TREC"\cite{li2002learning} and "Subj"\cite{pang2005seeing}. Three of the datasets are for binary classification, and the rest are for multi-class text classification tasks. \paragraph{\textsc{BASE}\xspace Models} We use four commonly used neural text classifiers to evaluate \textsc{WiGraph}\xspace: LSTM, and transformer based SOTA models including BERT, RoBERTa and distilBERT. As Section~\ref{subsec:ibloss} described, we plug our \textsc{WiGraph}\xspace layer right after the word embedding input layer. For the LSTM models\cite{hochreiter_long_1997}, we initialize word embeddings from \cite{mikolov2013distributed} with dimension $d=300$. For BERT, RoBERTa and distilBERT models, we use fine-tuned base models from \cite{wolf2020transformers} on each dataset (Table~\ref{tab:dataset_stats}). \paragraph{Hyperparameter Tuning} We perform fine-tuning on each model (batch size=64). We fix the word embedding layer and train \textsc{WiGraph}\xspace layer along with the rest of a \textsc{BASE}\xspace model. For the LSTM models, we vary the hidden size $\in \{100,300,500\}$, and dropout in $\{0.0,0.2, 0.3\}$. We set $\beta_{sparse} \in \{1e-02,1e-03, 1e-04\}$, $ \beta_g \in \{1.0, 1e-02,1e-03, 1e-04\}$ and $ \beta_i \in \{1.0, 1e-02,1e-03, 1e-04\}$. The learning rate is tuned from the set $\{0.0001, 0.0005, 0.005, 0.001\}$. For transformer based models, we vary dropout in range $\{0.2, 0.3, 0.5\}$, hidden dimension to compute $\mathbf{R} \in \{128, 256, 512\}$. We set $\beta_{sparse}, \beta_g, \beta_i=1.0$ and anneal it by a factor of 0.1 every epoch. For the larger vocabulary cases (IMDB, AG-News datasets and transformer-base models), we filter words for learning our interaction matrix $\mathbf{A}$, i.e., we learn interactions for the top frequent $10,000$ words. % \paragraph{Baselines:} To our best knowledge, \textsc{WiGraph}\xspace is the only plug-and-play layer to improve a target neural text classifier's interpretability using explicit pairwise word interactions. In our experiments, we compare \textsc{WiGraph}\xspace to a \textsc{BASE}\xspace model without \textsc{WiGraph}\xspace layer and to a \textsc{BASE}\xspace model augmented by the \textsc{VMASK}\xspace layer. \cite{chen2020learning} proposed \textsc{VMASK}\xspace layer for improving NLP models' intrinsic interpretability, though this layer does not consider word interactions. \paragraph{Evaluation Metrics:} We use three types of evaluations to compare \textsc{WiGraph}\xspace with baselines. (a) Prediction accuracy: this is to measure if NLP models augmented with \textsc{WiGraph}\xspace layer predict well. (b) To compare different models' interpretability, we will apply two post-hoc attribution techniques: LIME\cite{ribeiro2016should} and SampleShapley \cite{kononenko2010efficient} on model predictions. The resulting feature attribution outputs will be evaluated using explanation faithfulness scores like AOPCs (details in \sref{sec:aopc}). (3) We further design interaction interpretability measures to compare different models in \sref{sec:ios}. \subsection{Prediction Performance Comparison} In Table~\ref{tab:prediction_acc}, we compare prediction performance using four different SOTA models across six different datasets. This makes 24 different (\textsc{BASE}\xspace, data) combinations , and on each case, we compare \textsc{BASE}\xspace model, \textsc{VMASK}\xspace augmented base model versus our \textsc{WiGraph}\xspace augmented model regarding the prediction accuracy. Here we refer to \textsc{WiGraph}\xspace as the best performing model between \textsc{WIGRAPH-A}\xspace and \textsc{WIGRAPH-A-R}\xspace. Table~\ref{tab:prediction_acc} shows that adding \textsc{WiGraph}\xspace layer into SOTA neural text classifier models makes the models predict better! Empirically, the performance gains on LSTM models appear more than on Transformer models. \subsection{Interaction Analysis and Ablation} \label{sec:ios} In this experiment, % we introduce a new metric: {\it Interaction Occlusion Score} (IoS). The IoS score measures the interaction interpretability faithfulness of a target model on its learnt interactions. \textsc{WiGraph}\xspace discovers globally informative interactions with the importance score $\mathbb{E}_q[\mathbf{A}_{x_{i,j}}| \x_{i,j}]$ (see $q$ in \sref{subsec:ibloss}). We sort entries of $\mathbf{A}$ and filter out the top $K$ global interaction scores, denoted by $\mathbf{A}_{ij}^k$. We then calculate the accuracy of the model after only using these top $k$ interactions via: \begin{equation} \text{IOS}(k) = \dfrac{1}{M} \sum_{m=1}^M {1}_{{y}_m = y_m^k} \end{equation} Here, we represent the label of the model on the $m^{th}$ test sample as ${y}_m$. Table~\ref{tab:ios} in ~\sref{sec:moreab} shows using the top interactions outperforms the setting when no pairwise interactions are used during inference. \subsection{More results on ablations and Global Interaction Analysis results} \label{sec:moreab} We present our results on the IoS score proposed in Section~\ref{sec:ios} in Table~\ref{tab:ios}. We show using the top interactions outperforms the setting when no pairwise interactions are used during inference. We perform further ablations to calculate the different proposed interpretability scores in Table ~\ref{tab:ablations_aopc}. We use LIME as the post-hoc explanation method for AOPC. \textsc{WIGRAPH-A}\xspace achieves higher interpretability scores, both global and local, than its variations. \subsection{Attribution Interpretability Comparison: Area Under Perturbation Curve (AOPC)} \label{sec:aopc} Here we empirically check our hypothesis that training a model augmented with \textsc{WiGraph}\xspace layer leads to improvements of model explanation faithfulness during downstream post-hoc interpretation analyses. We use Area Over Perturbation Curve (AOPC)~\cite{nguyen2018comparing,samek2016evaluating} as the evaluation metric. AOPC is defined as the {\it average change of prediction probability on the predicted class over a test dataset by deleting top $K$ words in explanations.} Higher AOPC scores reflect better interpretation faithfulness. \begin{equation} AOPC = \dfrac{1}{K+1} \sum_{k=1}^K <f(\x) - f(\x_{\backslash 1, \dots, k})>_{p(\x)} \end{equation} We generate word-level attribution explanations using two popular post-hoc explanation methods: LIME\cite{ribeiro2016should} and SampleShapley \cite{kononenko2010efficient}. Across all datasets, we use $500$ test samples and $k \in \{1, \dots, 10\}$. % Table~\ref{tab:aopc} shows that \textsc{WiGraph}\xspace-A outperforms the original \textsc{BASE}\xspace model and the \textsc{BASE}\xspace with \textsc{VMASK}\xspace. When LIME is used to post-hoc explain models, across all 24 cases of (model, dataset) combinations, \textsc{WiGraph}\xspace outperforms the original \textsc{BASE}\xspace model and the \textsc{BASE}\xspace with \textsc{VMASK}\xspace layer regarding AOPC score in 21 cases. The only three exception include the IMDB/BERT, TREC/BERT and IMDB/RoBERTa setups. When SampleShapley is used, \textsc{WiGraph}\xspace outperforms the original \textsc{BASE}\xspace model and the \textsc{BASE}\xspace with \textsc{VMASK}\xspace layer in 22 cases out of 24 (model, dataset) combinations. \subsection{More Qualitative Results} \label{sec:qual} We show in Figure~\ref{fig:inter_freq_corr} that our learnt interaction matrix does not merely mirror the co-occurrence statistics, instead learns more general informative global interactions. Figure~\ref{fig:inter_cloud} use word clouds to visualize interacted word pairs obtained from TREC, SST1 and SST2 datasets. The interactions are ranked based on $\mathbb{E}_q[\mathbf{A}_{x_{i,j}}| \x_{i,j}]$. The selected word pairs are consistent with the corresponding tasks. Figure~\ref{fig:viz_not} visualizes exemplar words' interactions that an improved model considers during inference. In Table~\ref{tab:freq_corr}, we observe that the correlation between \textsc{WiGraph}\xspace's word importance score $\mathbb{E}_q[\mathbf{R}_{x_t}| \x_{t}]$ and word frequency is lower than \textsc{VMASK}\xspace. This indicates \textsc{WiGraph}\xspace can discover some important words that \textsc{VMASK}\xspace can not. % Table ~\ref{tab:freq_corr} also show a weak negative correlation between the interaction importance score$\mathbb{E}_q[\mathbf{A}_{x_{i,j}}| \x_{i,j}]$ and word co-occurrence frequency. \begin{table}[th] \begin{minipage}[]{0.5\textwidth} \centering \scalebox{.81}{ \begin{tabular}{|c|c|c|c|}\hline Dataset & \textsc{WiGraph}\xspace-A-$R$ & \textsc{WiGraph}\xspace-$\A$ & \textsc{VMASK}\xspace \\\hline SST2 & {\bf -0.0095} & -0.1182 & -0.0064\\\hline SST1 & {\bf -0.0101}& -0.1059 & -0.0054 \\\hline SUBJ & {\bf -0.0137} & -0.0912 & -0.0077\\\hline TREC & {\bf -0.0139} & -0.1016 &-0.0118 \\\hline \end{tabular}} \end{minipage} \caption{{\bf Correlation with co occurrence statistics}: We summarize these observations using correlation statistics: \textsc{WiGraph}\xspace has a lower correlation of the global word importance score $\mathbb{E}_q[x_t| \x_t]$ with word frequency(Column \textsc{WiGraph}\xspace-$R$) than when it does not account for interactions (Column \textsc{VMASK}\xspace). We also show the correlation of the interaction importance scores $\mathbb{E}_q[A_{x_i,x_j}| \x_i,\x_j]$ with the co-occurrence frequency, which shows a weak negative correlation for all datasets(Column-\textsc{WiGraph}\xspace-$\A$). \label{tab:freq_corr} } \vspace{3mm} \end{table} \begin{figure}[!ht] \centering \begin{minipage}[]{0.47\textwidth} \centering \includegraphics[width=1\columnwidth,height=40mm]{interaction_freq_corr_v2.pdf} \end{minipage} \caption{SST2 dataset with LSTM model. Interaction Importance Score vs word co-occurrence. \label{fig:inter_freq_corr}} \vspace{2mm} \end{figure} \begin{figure*}[htbp] \centering \begin{minipage}[t]{.31\textwidth} \centering \includegraphics[width=\linewidth]{TREC_inter_word_cloud.pdf} \end{minipage} \hspace{1mm} \begin{minipage}[t]{0.31\textwidth} \centering \includegraphics[width=1\linewidth]{inter_imask_cloud.pdf} \end{minipage} \begin{minipage}[t]{0.31\textwidth} \centering \includegraphics[width=1\linewidth]{sst1_lstm_inter_cloud.pdf} \end{minipage} \caption{\label{fig:inter_cloud}Pairwise Word Interactions Cloud on LSTM model for (left) TREC, (middle) SST-2, and (right) SST-1.} \end{figure*} \subsection{Modeling Concept Interaction in Vision } \label{sec:concept} \citet{koh2020concept} introduced the notion of high-level concepts as an intermediate interpretable interface in the input-model-predictions pipeline. These concepts describe high level attributes of an image. This enables users to directly interact with a model by intervening on human-interpretable concepts. The interactions between these concepts can affect prediction, however these interactions are unknown. In this section, we investigate the utility of learning these interactions for aiding prediction using our \textsc{WiGraph}\xspace layer. We train a concept bottleneck~\cite{koh2020concept} model on the CUB dataset~\cite{wah2011caltech} which is jointly trained with a \textsc{WiGraph}\xspace layer. In Section~\ref{sec:conceptMore}, we show that the \textsc{WiGraph}\xspace layer is able to learn concept embeddings, model interactions between concepts, and can also be used with test time concept intervention to improve prediction accuracy on the final task. In order to extend \textsc{WiGraph}\xspace for this setup, we introduce a dynamic interaction graph with concepts and the image as nodes. Intuitively, the image is considered to be a composition of concept embeddings. The interaction between the concepts are learned variables whereas the interactions between an image and its concepts are computed using the cosine similarity. The details of our model architecture are in Section~\ref{sec:conceptMethod}. \paragraph{Results:} As a baseline, we fine-tune an Inception V3-based joint concept bottleneck model~\cite{koh2020concept} that achieve a prediction accuracy of $80.04\%$ on the CUB dataset~\cite{wah2011caltech}. Together with this model, we jointly train our \textsc{WiGraph}\xspace and the concept embedding layer to learn the interactions between the concepts. As described in~\cite{koh2020concept}, test time intervention (TTI) helps improve prediction accuracy to $89.41\%(+9.37\%)$. Interestingly, we observe that TTI achieves more improvements of prediction accuracy when using \textsc{WiGraph}\xspace augmented concept vision model to $95.74\%(+15.70\%)$. \section{Extending \textsc{WiGraph}\xspace for Capturing Concept Interactions in Vision Tasks} \label{sec:conceptMore} In this section, we demonstrate the application of the \textsc{WiGraph}\xspace layer in the context of image modeling with convolutional neural networks. \subsection{Dataset and Concept Pre-processing} We train a joint concept bottleneck~\cite{koh2020concept} model on the CUB dataset~\cite{wah2011caltech} which comprises of 11,788 photographs of birds from 200 species, where each image has additional annotations of 312 binary concepts corresponding to bird attributes like wing color, beak shape, etc. The concept annotations in the CUB dataset are noisy, hence we adopt the method described in concept bottleneck models~\cite{koh2020concept} to pre-process the concept level annotations and remove noisy labels. Each concept annotation was provided by a single crowdworker who is not an avian expert, and the concepts can be quite similar to each other, e.g., some annotators might say a bird has a red belly, while other annotators might say that the belly is rufous (reddish-brown) instead. In order to deal with such issues, we aggregate instance-level concept annotations into class-level concepts via majority voting, i.e if more than 50\% of crows have black wings in the data, then the class crow is considered to always have black wings. As a result, images with the same class have the same concept annotations. While this approximation is mostly true for this dataset, there are some exceptions due to visual occlusion, as well as sexual and age dimorphism. After majority voting, we further filter out concepts that are too sparse, keeping only concepts (binary attributes) that are present after majority voting in at least 10 classes. After this filtering, we are left with 112 concepts. \subsection{Method} \label{sec:conceptMethod} Given an image $x \in \mathbb{R}^d$, its class label $y$, and concept labels $c$, which is a vector of $k$ concepts; we train a concept bottleneck model with a \textsc{WiGraph}\xspace layer in order to model the interactions between the $k$ concepts. Additionally, we encode concepts as learned high-dimensional representations in a shared image-concept latent space, such that a dynamic interaction graph $\mathbf{A}'$ can be defined with concepts and the image as neighboring nodes. Next we use the graph convolutional operation step to update the representation of each node with its neighbors. The resulting node representations are max-pooled and the final image-concept representation is used for task classification. Overall, we learn a global interaction matrix $\mathbf{A} = \{\mathbf{A}\}_{k \times k}$ between concepts, we use the learnt graph and concept representations to train a task prediction head for the final task. Consider an image encoder model, $f: \mathbb{R}^d \to \mathbb{R}^k$, that encodes the image into a d-dimensional representation, $f(x)$. This representation is then transformed through a shallow MLP, $g: \mathbb{R}^d \to \mathbb{R}^k$ which maps the image from the representation space to the concept space to give $g(f(x))$. This is then passed through a concept prediction head layer and treated as a mutli-label classification problem for predicting concepts. We also define a MLP $h: \mathbb{R}^k \to \mathbb{R}$ which finally maps the representation from the concept to the task prediction space which is modeled as a multi-class classification problem. Now, in order to adapt the \textsc{WiGraph}\xspace layer for learning concept interactions, we need to formulate these concepts as high-dimensional representations in the image embedding space, such that the \textsc{WiGraph}\xspace layer can used to treat the concept embeddings as nodes and their interactions as the edges in an interaction graph. As such we define a randomly initialized embedding layer that helps us query concept representations given concept labels $c$. We make the assumption that the latent space for the concept representation is aligned with that of image representations. Intuitively, we are assuming that the image itself can be represented as a composition of different concept representations and hence can be embedded in the same space. This allows us to use the image representation $f(x)$ as another node in the $\mathbf{A}$ graph during the subsequent graph convolution update step. Therefore during training, we dynamically compute the interaction between the image and the concept representations as their cosine similarity scaled between $0$ and $1$. These interactions are then used to expand the graph to give $\mathbf{A'} = \{\mathbf{A'}\}_{(k+1) \times (k+1)}$ where each $\mathbf{A'}_{ij} \in \{0,1\}$ with image as the added node and the image-concept scaled similarities as the corresponding interactions in the original graph $A$. The dynamic interaction graph $\mathbf{A'}$, image representation $f(x)$, and concept embeddings $X_c$ are transformed using the graph convolution update described in section \ref{sec:gcn} as, $\mathbf{E'}=g_{GC}(\mathbf{X'},\mathbf{A'})$, where $\mathbf{X'} = [f(x), X_c]$ is a concatenation of the image and concept representations corresponding to the interaction graph $A'$. Output representations $E'$ are max-pooled and passed to the prediction head $p: \mathbb{R}^d \to \mathbb{R}$. The classification loss at the prediction head is used to train the \textsc{WiGraph}\xspace layer. Overall, for each data point $\{x, y, c\}$, we get the image representation $f(x)$ from the CNN encoder, and corresponding concept representations for each $c_i$ from the embedding layer. The interactions are computed between $f(x)$ and each concept representation and the image itself is added to the interaction graph as the neighbor of the observed concepts, $c$. Similar to previous formulations, we intend to learn the unknown graph $\mathbf{A} = \{\mathbf{A}\}_{V \times V}$ where each $\mathbf{A}_{ij} \in \{0,1\}$ specifies the strength of the interaction. Through this task we also learn concept embeddings in the same latent space as the image embeddings from the CNN encoder. \subsection{Results} We use a concept bottleneck models~\cite{koh2020concept} as a baseline to demonstrate the applicability of \textsc{WiGraph}\xspace for image modeling scenarios. Specifically, we train an Inception-V3 model with a concept bottleneck for the bird identification task on the Caltech-UCSD Birds-200-2011 (CUB) dataset~\cite{wah2011caltech}. With the model, we jointly train a \textsc{WiGraph}\xspace layer to learn the interactions between the concepts. \textsc{WiGraph}\xspace also learns concept embeddings in a joint image-concept space. In order to demonstrate this, we use the image representation to find most similar concepts using the cosine metric. In Figure~\ref{fig:imask_vis}, we show that the model is able to encode the image very close to the ground-truth concept embeddings. Additionally, as demonstrated in~\citet{koh2020concept}, the model is able to predict concepts very accurately at the bottleneck while maintaining a final bird classification task accuracy of $80.04\%$. Note that this allows us to reasonably intervene on the concepts. With test-time intervention, the model is able to improve its performance by $+9.37\%$ to $89.41\%$. Similar to this, \textsc{WiGraph}\xspace when used with the CNN's image representation and intervened concepts is able to achieve a prediction accuracy of $95.74\%(+15.70\%)$ at its prediction head. \section{Conclusions} In this paper, we try to answer the question: \emph{Does adding a special layer in the form of discovering word-word interactions lead to improvements in a neural text classifier's interpretability?} Our paper gives a firm "Yes" to the question and provides a neural-network based design for making such a layer. The second component of \textsc{WiGraph}\xspace layer uses the message passing framework and it can be expanded to allow for learning and accounting for higher-order interactions (not only pairwise) in a scalable way. We will explore this in our future works. Furthermore, \textsc{WiGraph}\xspace can easily extend to cross sentence tasks like Natural Language Inference, and we will leave it to future. % \subsection{Additional Experimentation: Ablation Analysis for Interpretation Scores} \begin{table}[h] \centering \begin{minipage}[]{\hsize} \centering \scalebox{0.89}{ \begin{tabular}{cccc} \toprule Metric & Models & TREC & SST-2 \\ \midrule \multirow{4}{*}{AOPC} & \textsc{BASE}\xspace & 67.63 & 42.25 \\ & \textsc{VMASK}\xspace & 63.14 & 39.77 \\ & \textsc{WIGRAPH-A-R}\xspace & 61.52 & 36.22 \\ & \rowcolor{gray!20} \textsc{WIGRAPH-A}\xspace & {\bf 68.74} & {\bf 44.33}\\ \bottomrule \end{tabular}} \caption{Ablations analysis for TREC and SST-2 datasets on distilbert model regarding AOPC from LIME post-hoc explanation model for ablations \textsc{WIGRAPH-A}\xspace and \textsc{WIGRAPH-A-R}\xspace. } \label{tab:ablations_aopc} \end{minipage} \end{table}
\section{Introduction} \label{sec:Intro} Event (Neuromorphic) cameras are novel biologically inspired sensors that record data based on the change in light intensity at each pixel asynchronously \cite{Gallego_survey}. If the change in light intensity at a given pixel is greater than a preset threshold then an event is recorded at that pixel. For this reason if there is no change to the scene, be that movement or brightening/dimming of a light source, no events will be recorded. In contrast if a scene is dynamic from camera movement or from the movement of an object in the scene then each pixel of the event camera will record intensity changes with a temporal resolution on the order of microseconds \cite{Gallego_survey}. This logging of events results in a non-redundant stream of events through the time dimension for each pixel \cite{DBLP:journals/corr/abs-1811-00386}. The stream of data is exceptionally useful for scenes with fast moving objects that can cause motion blur in traditional cameras, which record the average light intensity over an exposure time for each pixel synchronously \cite{pan2019bringing}. Figure \ref{f:nucamera} gives an illustration of the differences between traditional and event cameras. % \begin{figure}[htb] \centering \includegraphics[width=.5\textwidth]{standardvevent.png} \caption{Comparison of the output of a standard frame-based camera and an event camera when facing a black dot on a rotating disk. The standard camera outputs frames at a fixed rate, thus sending redundant information when there is no motion in the scene \cite{Gehrig_2018}.} \label{f:nucamera} \end{figure} The prior work, \cite{pan2019bringing}, proposed the Event-based Double Integral (EDI) and multiple Event-based Double integral (mEDI) algorithms to address motion blur for the underlying inverse problem. The EDI model utilizes a single blurry standard camera image, along with associated event data, to generate one or more clear images through the process of energy minimization. The mEDI model, an extension of the EDI model, utilizes multiple images in conjunction with event data to produce unblurred images. The EDI and mEDI models were an extension of the work from \cite{DBLP:journals/corr/abs-1811-00386} where a continuous-time model was initially introduced. While these algorithms represent a leap forward over earlier work, questions remain about the validity of the models in various scenarios (see below), regarding what situations solutions exist and what optimization procedures are appropriate in order to find such solutions. In this paper we provide a mathematical foundation and further extensions to the previous methods by extending the model and providing a bilevel inverse problem framework. Indeed, as shown below, the EDI and mEDI models correspond to inverse problems in image deblurring \cite{arridge2019solving,bertero2021introduction}. In particular, \begin{enumerate} \item We introduce a bilevel optimization problem that allows for the simultaneous optimization over a desired number of frames. We also illustrate that this optimization problem is indeed an inverse problem. Therefore, we use the terms `optimization' and `inverse', interchangeably. \item We establish existence of solution to this problem. Under certain conditions, we derive the second order sufficient conditions and provide local uniqueness of solution to these nonconvex problems. \item A fully implementable framework based on second order methods has been developed. The benefits of the proposed approach are illustrated using multiple numerical examples. \end{enumerate} For completeness, we emphasize that the bilevel approaches to search for the hyperparameters in traditional imaging is not new, see for instance \cite{HAntil_ZDi_RKhatri_2020a,MR3592840}. However, the problem considered in this paper is naturally bilevel without having to search for the hyperparameters. \medskip \noindent {\bf Outline:} The remainder of the paper is organized as follows. Section~\ref{s:not} focuses on some notation and preliminary results. In Section~\ref{s:ebc}, we discuss the basics of event based cameras. Section~\ref{s:existing} focuses on existing models from \cite{pan2019bringing} which serves as a foundation for the proposed bilevel optimization based variational model in Section~\ref{s:Opt} . Existence of solution to the proposed optimization problem is shown in Theorem~\ref{thm:exist}. Moreover, local convexity of our reduced functional is shown in Theorem~\ref{thm:interval}. Section~\ref{s:numres} first focuses on how to prepare the data for the algorithm. It then discuss implementation details. The problem itself is solved using a second order Newton based method. Subsequently, several illustrative numerical examples are provided in Section~\ref{s:nex} . \section{Notation and Preliminaries} \label{s:not} Let $n_t$ represent the number of images and $n_x \times n_y$ denotes the number of pixels per image. We use $\bm{U}\in \mathbb{R}^{n_t \times n_x \times n_y}$ to denote a tensor. We use the vector \[ \bm{u}_{xy} \in \mathbb{R}^{n_t}, \] to represent the $(x,y)$ pixel value of $\bm{U}$ for all times. Moreover, we use the matrix \[ \bm{u}^{i} \in \mathbb{R}^{n_x \times n_y} . \] to represent an image of size $\mathbb{R}^{n_x \times n_y}$ at a fixed time instance $i \in \{1,\dots, n_t\}$. % We use the scalar \[ \bm{u}^i_{xy} \in \mathbb{R} \] to denote the value of $\bm{U}$ at a pixel location $(x,y)$ and time $i \in \{ 1, \dots, n_t \} $. Graphical representations are given in Figure \ref{f:ntn} . Finally, given quantities $\bm{u}_{xy}$ and $\bm{M} \in\mathbb{R}^{{n_t}\times{\eta}}$ for some $\eta \in \mathbb{N}$, we define the operation $\langle \cdot , \cdot \rangle$ as: \[ \langle \bm{u}_{xy},\bm{M} \rangle := (\bm{u}_{xy})^\top \bm{M} \in \mathbb{R}^{\eta}.\] \begin{figure}[htb] \centering \includegraphics[width=0.6\textwidth]{notation3} \caption{ \label{f:ntn} The panel describes multiple images one of those images for instance is $\bm{u}^i \in \mathbb{R}^{n_x \times n_y}$ and it is marked in red color. The circles represent the vector $\bm u_{xy} \in \mathbb{R}^{n_t}$ and are marked in blue color. Green circle indicates an overlap between $\bm{u}^i$ and $\bm u_{xy}$. } \end{figure} The remainder of the section is organized as follows. First in Section~\ref{s:ebc}, we discuss the basic working principle behind the neuromorphic cameras. The main ideas behind the algorithms presented in \cite{pan2019bringing} are described in Section~\ref{s:existing}. We briefly discuss some potential limitations of this approach which motivates our algorithm in Section~\ref{s:Opt}. \subsection{Neuromorphic (Event Based) Cameras}\label{s:ebc} \subsubsection{Neuromorphic Camera Basics}\label{sec:Basics} Neuromorphic cameras are composed of independent pixels that detect light intensity changes in the environment as they occur. Light intensity is sampled $\mathcal{O}(\mu s)$ and events are logged if the intensity of the light is beyond a preset hardware defined threshold, $c$. We denote the instantaneous light intensity at pixel location $(x,y)$ at time $s$ by $\bm{q}^{s}_{xy} \in \mathbb{R}$. When the light intensity detected by the camera exceeds the threshold for a given pixel located at $(x,y)$, at a given time $s$, an event is logged. Then the reference intensity, $\bm{q}^{s_{ref}}_{xy}$, for the pixel located at $(x,y)$ is updated. Due to the high rate of sampling, and independent nature of the camera's pixels neuromorphic cameras are less susceptible to exposure issues, as well as image blurring. Figure~\ref{f:nucamera} illustrates the difference in the data recorded between traditional and event based cameras. \subsubsection{Data representation} The output of an event based camera over some time interval, $\mathcal{I}$, is of the form $(s,x,y,p)$, with the following definitions: \begin{enumerate}[$\bullet$] \item $s \in \mathcal{I} = \{s_1,s_2, \dots, s_n \, : \, s_1 < s_2 < \dots < s_n \}$, where $\mathcal{I}$ represents the exposure interval, each $s_j$ represents a discrete time at which an event occurred and $n$ represents the total number of events recorded during the interval, $\mathcal{I}$. When discussing methods that involve multiple images, we will denote the exposure interval for the $i$-$th$ image as $\mathcal{I}_i$. We will also denote the set of events associated to each image $i$ as $\{ s^i_j\}_{j=1}^{n_i}$. With this notation we have $i = 1, \dots, n_t$ and $j = 1, \dots, n_i$ with $n_i$ representing the total number of events associated to image $i$. \item $x,y$ represent pixel coordinates. \item $p_{x,y}^{s_j} := \begin{cases} +1, & \log \left( \frac{\bm{q}^{s_j}_{xy}}{\bm{q}^{s_{ref}}_{xy}}\right) \geq c\\ -1, & \log \left( \frac{\bm{q}^{s_j}_{xy}}{\bm{q}^{s_{ref}}_{xy}}\right) \leq -c \, \end{cases}$ is the polarity of the event. An increase in light intensity above a threshold, $c>0$, we regard as a polarity 1 and a decrease of intensity as a polarity shift of $-1$. No event is logged if $p_{x,y}^{s_j} \in (-c,c)$. \end{enumerate} % We can reformulate these events into a datacube with the following definition: \begin{equation}\label{eq:cube} {\bm{EC} }_{xy}^{s_j} = p_{x,y}^{s_j}, \quad j = 1, \dots, n , \end{equation} which results in a sparse 3-dimensional matrix with entries of $0,1,-1$. We refer to Figure \ref{f:ex1} for 2D and 3D examples of the datacube. Representing the data in this way allows us to track intensity changes over time on a per pixel basis. \subsection{Inverse problems in Image Deblurring} \label{s:inv} Image deblurring is a classic example of an inverse problem, where the goal is to reconstruct the unknown original image from a degraded, blurred observation. In image deblurring, the degradation process can be modeled as a interaction between the original image and a blur kernel which represents the blur caused by various factors such as movement \cite{DBLP:journals/corr/abs-2201-10522,zhang2022new}. In the context of image deblurring, the field can be divided into two categories, blind and non-blind, based on the amount of information known about the blur kernel \cite{almeida2009blind,satish2020comprehensive,tang2014non,xie2019non,DBLP:journals/corr/abs-2201-10522}. In the non-blind case, the blur kernel is known which leads to a simpler ableit ill-posed inverse problem \cite{tang2014non,xie2019non}. In the blind case, no information about the blur kernel is available, making the deblurring problem more challenging as the blur kernel must be estimated from the degraded image in addition to the original image \cite{satish2020comprehensive,DBLP:journals/corr/abs-2201-10522}. The semi-blind case is a particular instance of a blind image deblurring problem in that some but not all information about the blur kernel is available \cite{buccini2018semiblind,morin2013semi,park2012semi}. The problems under consideration in this project are of semi-blind type. \subsection{Existing Model, Algorithm, and Limitations}\label{s:existing} The approach discussed in this paper is motivated by \cite{pan2019bringing}. The article \cite{pan2019bringing} seeks to find latent un-blurred images using the Event Based Double Integral (EDI) and multi-Event Based Double Integral (mEDI) models. We briefly discuss this next. This will be followed by our new proposed models. \subsubsection{EDI Model} In \cite{pan2019bringing}, the discrete events outlined in Section \ref{sec:Basics} are used to generate a continuous function, $\bm{e}_{xy}$, for each $(x,y)$ pixel location. This is done by generating a series of continuous unit bump functions centered at each $s_j$: $\phi_{s_j}(t)$. Then we can define $\bm{e}_{xy} : \mathbb{R} \rightarrow \mathbb{R}$ as: \begin{equation}\label{eq:exy} \bm{e}_{xy}(t) := \sum_{s_j \in \; \mathcal{I}} {\bm{EC}}_{xy}^{s_j} \cdot \phi_{s_j}(t) \in \mathbb{R} . \end{equation} We graphically illustrate building this function for a single pixel below with the following string of events: \[ [1,0,1, -1, 1]. \] In Figure \ref{f:stemplot} we see the function $\bm{e}_{xy}$ overlayed onto a stem plot of events. \begin{figure}[!htb] \centering \includegraphics[width=0.6\textwidth]{stem} \caption{In this figure the solid line represents the function $\bm{e}_{xy}$ overlayed onto the a stem plot (dashed line)that represents a series of recorded events. The red dots are used to highlight the events.} \label{f:stemplot} \end{figure} From \ref{eq:exy}, we define the `\emph{sum of events}' from time of interest $t_i$ to arbitrary time $t$ as: \begin{equation}\label{eq:Exy} \bm{E}^i_{xy}(t,t_i) = \int_{t_i}^{t}\bm{e}_{xy}(r) \; dr , \end{equation} where $\bm{E}^i_{xy}(t,t_i) \in \mathbb{R}$ corresponds to one pixel and $\bm{E}^i(t,t_i) = \{ \bm{E}^i_{xy}(t,t_i) \}_{xy} \in \mathbb{R}^{{n_x} \times {n_y}}$ consists of all the pixels. We note that $t_i$, $i=1, \dots, n_t$ are manually chosen and represent the time at which we wish to generate an image. In practice we will set each $t_i$ to correspond to the timestamps of the standard camera images we are using in the model. For convenience we will omit $t_i$ from $\bm{E}^i_{xy}(t,t_i)$ unless needed for clarity. Introducing a scalar variable $z$ gives us the EDI Model: % \begin{equation}\label{eq:B} \bm{B}^i_{xy} = \frac{1}{|\mathcal{I}_i|} \int_{t_i-|\mathcal{I}_i|/2}^{t_i+|\mathcal{I}_i|/2} \bm{L}^i_{xy} \cdot \exp \big(z \cdot \bm{E}^i_{xy}(t)\big)dt \, . \end{equation} % Where $\bm B^i_{xy} \in \mathbb{R}$ and $\bm B^i =\{ \bm B^i_{xy}\}_{xy} \in \mathbb{R}^{n_x\times n_y}$ is a standard camera image. Furthermore, $\bm L^i_{xy} \in \mathbb{R}$ is the pixel value of the unblurred image at location $(x,y)$, and $|\mathcal{I}_i|$ is the exposure time for the $i^{th}$ image. We note that the superscript $i$ in $\bm{B}^i_{xy}$ and $\bm{L}^i_{xy}$ are simply placeholders for notation since the EDI model only considers a single image at a time. % Taking the log and re-arranging terms of \eqref{eq:B} leads to: % \begin{equation}\label{eq:EDI} \bm{v}_{xy}^i = \bm{d}_{xy}^i - \bm{g}_{xy}^i(z) , \end{equation} % where % \begin{align}\label{eq:vxy} \begin{aligned} \bm{v}_{xy}^i &= \log(\bm{L}_{xy}^i), \quad \bm{d}_{xy}^i = \log \bm{B}_{xy}^i,\\ \bm g^i_{xy}(z) &= \log\bigg(\frac{1}{|\mathcal{I}_i|} \int_{t_i-|\mathcal{I}_i|/2}^{t_i+|\mathcal{I}_i|/2} \exp \big(z \cdot \bm{E}_{xy}^i(t)\big)dt\bigg). \end{aligned} \end{align} % The formulation in \eqref{eq:EDI} gives us the correlation between the EDI model and other semi-blind inverse problems in image deblurring. Here $\bm{B^i}$ is our blurry image, $\bm{L^i}$ is our latent unblurred image, and $\bm{g^i}$ is our kernel function. As shown in \cite{almeida2009blind,arridge2019solving, bertero2021introduction,bungert2020robust,chung2011designing} this formulation is common for many inverse problems. We note the EDI/mEDI models would fall into the category of semi-blind inverse problems mentioned in Section~\ref{s:inv} since the kernel, $\bm{g^i}$, is known up to the parameter $z$. \subsubsection{mEDI Model} If we consider two latent images $\bm{v}^i$ and $\bm{v}^{i+1}$ we know that event data will give us the per pixel changes that have occurred between the two images. We can mathematically describe this change as $\int_{t_i}^{t_{i+1}} \bm{e}_{xy}(s) ds$ where $\bm{e}_{xy}$ is as given in \eqref{eq:exy} and $t_i$ are user chosen times of interest. Incorporating the threshold variable $z$ allows us to formulate the following equations % \begin{equation}\label{eq:vi} \bm{v}^{i+1}_{xy} - \bm{v}^i_{xy} = z \int_{t_i}^{t_{i+1}} \bm{e}_{xy}(s) ds =: \bm{b}_{xy}^i(z). \end{equation} Combining \eqref{eq:EDI} and \eqref{eq:vi} gives us the following system of equations: \begin{equation}\label{eq:system} \left( \begin{array}{rrrrrrrr} -1 & 1 & & & & & & \\ & -1 & 1 & & & & & \\ & & & \ddots & \ddots & & & \\ & & & & & -1 & 1 & \\ & & & & & & -1 & 1 \\ \hline 1 & & & & & & & \\ & 1 & & & & & & \\ & & 1 & & & & & \\ & & &\ddots & & & & \\ & & & & 1 & & & \\ & & & & & 1 & & \\ & & & & & & 1 & \end{array} \right){\bm{v}}_{xy} = \left(\begin{array}{rrr} \bm{b}_{xy}\\ \bm{d}_{xy} - \bm{g}_{xy} \end{array} \right) \end{equation} Notice that, \eqref{eq:system} gives us the mEDI model described by \cite{pan2019bringing}. The size the upper half of the submatrix in \eqref{eq:system} is $\mathbb{R}^{(n_t-1) \times n_t}$ and the lower half matrix is $\mathbb{R}^{{n_t} \times {n_t}}$. \subsubsection{mEDI Model - Optimizing for z} The variable $z$ is found by solving the following minimization problem for each pixel $(x,y)$ of an image of interest $i$: % \begin{equation}\label{eq:medi_opt} \min_z \frac12 \|{\bm{v}}^i_{xy}({z}) + {\bm{g}}^i_{xy}(z) - {\bm{d}}^i_{xy}\|^2_2. \end{equation} Here $\bm{v}_{xy}$, ${\bm{d}}^i_{xy}$, and ${\bm{g}}^i_{xy}(z)$ are as given in \eqref{eq:vxy}. We refer to \cite{pan2019bringing} for their solution approach. Notice that \eqref{eq:vi} is not used as constraint to the minimization problem \eqref{eq:medi_opt}, but \eqref{eq:medi_opt} is used to generate the image reconstructions. \subsubsection{Limitations of the mEDI and EDI Models} While the mEDI model uses multiple frames in order to accurately represent de-blurred images some limitations for the model remain. \begin{enumerate}[(a)] \item Performance of the model can degrade for images that contain large variations of light intensity within a single scene. Some examples of this are having very dark objects in a bright room with a highly dynamic scene. In these instances we can see ``shadowing" effects where shadows appear across multiple frames. We refer to Section \ref{s:shadow} for specific examples. \item The optimization problem introduced \eqref{eq:medi_opt} to identify $z$ only seeks to optimize the pixels of one image at a time and neglects the constraints \eqref{eq:vi}. Then uses \eqref{eq:vi} to reconstruct multiple images with the same $z$ value. \item Recall from \ref{eq:vi} that $\bm{b}^i_{xy} := z \int_{t_i}^{t_{i+1}} \bm{e}_{xy}(s) \; ds$. This definition does not include any information from the standard images $\bm{B}^i$. Due to this the mEDI model is not well suited for generating image reconstructions across time-spans that include multiple standard images. \end{enumerate} \section{Proposed Model and Algorithm}\label{s:Opt} \subsection{Model} For each pixel $(x,y)$, we consider the following bilevel inverse problem % \begin{subequations}\label{eq:orig} \begin{equation}\label{eq:out} \min_{\bm z_{xy}} J(\bm u_{xy},\bm{z}_{xy}) := \frac{1}{2} \| \bm u_{xy}(\bm{z}_{xy}) + \bm g_{xy}(\bm{z}_{xy}) - \bm d_{xy} \|_2^2 + \frac{\lambda_1}{2}\|\bm{z}_{xy} \|_2^2 \end{equation} subject to constraints \begin{equation}\label{eq:in} \min_{\bm u_{xy}} \frac{1}{2} \| {\bm A} \bm u_{xy} - \bm b_{xy}(\bm{z}_{xy}) \|_2^2 + \frac{\lambda_2}{2} \| \bm u_{xy}\|_2^2 . \end{equation} \end{subequations} % Notice, that this is an optimization problem for one pixel across all images. By $0 < \lambda_1,\lambda_2$, we denote the regularization parameters. Moreover, \[ \bm A = \left( \begin{array}{rrrrrrrr} -1 & 1 & & & & & & \\ & -1 & 1 & & & & & \\ & & & \ddots & \ddots & & & \\ & & & & & -1 & 1 & \\ & & & & & & -1 & 1 \\ \end{array} \right) \in \mathbb{R}^{(n_t-1) \times n_t} \] is a submatrix of the matrix given in \eqref{eq:system}. Recall in Equation \eqref{eq:medi_opt} that $z$ is taken as a scalar and the optimization is done over a single image at a time. We consider $\bm{z}_{xy}$ as size $n_t \times 1$ so that we can optimize over the same pixel $(x,y)$ for all images simultaneously. Also, in contrast to \cite{pan2019bringing} since we have defined $\bm{z}_{xy}$ as a vector over all images, we also modify the variable $\bm{b}$ with the following definition: \begin{equation}\label{eq:b} \bm{b}^i_{xy}(\bm{z}_{xy}) := (\bm{d}_{xy}^{i+1} - \bm{g}_{xy}^{i+1}(\bm{z}_{xy})) - (\bm{d}_{xy}^{i} - \bm{g}_{xy}^{i}(\bm{z}_{xy})) \in \mathbb{R}^{n_t -1}. \end{equation} Where $\bm{z}^i_{xy} \in \mathbb{R}$ and is the $i$-$th$ component of the vector $\bm{z}_{xy} \in \mathbb{R}^{n_t}$. This is done so the events associated to the $i$-$th$ image are being optimized by the $i$-$th$ $\bm{z}_{xy}$ component. Notice that, $\bm A$ above is not a square matrix. For every $\lambda_2 > 0$, the lower level problem is uniquely solvable and the solution is given by % \begin{equation} \bm{u}_{xy}(\bm{z}_{xy}) = (\bm A^\top \bm A + \lambda_2 \bm I)^{-1} \bm A^\top \bm b_{xy}(\bm{z}_{xy}) = \bm K^{-1} \bm{A^\top}\bm b_{xy}(\bm{z}_{xy})\label{eq:u} \end{equation} % with % \[ \bm K := (\bm A^\top \bm A + \lambda_2 \bm I) \in \mathbb{R}^{n_t \times n_t}. \] % Substituting, this in the upper level problem, we obtain the following reduced problem % \begin{equation}\label{eq:rp} \min_{\bm{z}_{xy} \in Z_{ad}} \mathcal{J}(\bm{z}_{xy}) := J(\bm K^{-1} \bm A^\top \bm b_{xy}(\bm{z}_{xy}),\bm{z}_{xy}) \end{equation} % which is now just a problem in $\bm{z}_{xy}$. Notice, that the reduced problem \eqref{eq:rp} is equivalent to the full space formulation % \begin{subequations}\label{eq:fs_1} \begin{equation}\label{eq:out_1} \min_{\bm{z}_{xy}} J(\bm u_{xy}, \bm{z}_{xy}) \end{equation} subject to constraints \begin{equation}\label{eq:in_1} \bm K \bm u_{xy} = \bm A^\top \bm b_{xy} (\bm{z}_{xy}) . \end{equation} \end{subequations} The next result establishes existence of solution to the reduced problem \eqref{eq:rp} and equivalently to \eqref{eq:fs_1}. % \begin{theorem}\label{thm:exist} There exists a solution to the reduced problem \eqref{eq:rp}. \end{theorem} \begin{proof} The proof follows from the standard Direct method of calculus of variations. We will omit the subscript $xy$ for notation simplicity. We begin by noticing that $\mathcal{J}(\cdot)$ is bounded below by 0. Therefore, there exists a minimizing sequence $\{\bm z_n\}_{n \in \mathbb{N}}$ such that $$ \lim_{n\rightarrow \infty} \mathcal{J}(\bm z_n) = \inf_{\bm z} \mathcal{J}(\bm z) . $$ It then follows that \[ \frac{\lambda_1}{2} \lim_{n\rightarrow \infty} \| \bm z_n\|^2 \le \lim_{n\rightarrow \infty} \mathcal{J}(\bm z_n) = \inf_{\bm z} \mathcal{J}(\bm z) \le \mathcal{J}(\bm 0) = C < \infty , \] where the constant $C$ is independent of $n \in \mathbb{N}$. Thus, $\{\bm z_n\}_{n \in \mathbb{N}}$ is a bounded sequence. Therefore, it has a convergent subsequence, still denoted by $\{\bm z_n\}_{n \in \mathbb{N}}$, such that $\bm z_n \rightarrow \bar{\bm z}$. It them remains to show that $\bar{\bm z}$ is the minimizer. Since, $\bm u_n := {\bm u}(\bm z_n)$ solves \eqref{eq:u}, therefore, we have that $\bm u_n \rightarrow {\bm u}(\bar{\bm z})$ and $\bm g(\bm z_n) \rightarrow \bm g(\bm {\bar z})$ as $n \rightarrow \infty$. Subsequently, from the definition of infimum and these convergence estimates, we readily obtain that \[ \lim_{n\rightarrow \infty} \mathcal{J}(\bm z) \ge \liminf_{n\rightarrow \infty} \frac12 \| \bm u(\bm z_n) + \bm{g}(\bm z_n) - \bm d \|_2^2 + \liminf_{n\rightarrow \infty} \frac{\lambda_1}{2} \| \bm z_n \|_2^2 = \mathcal{J}(\bar {\bm z}) . \] Thus $\bar {\bm z}$ is the minimizer and the proof is complete. \end{proof} In order to develop a gradient based solver for \eqref{eq:rp}, we next write down the expression of gradient of $\mathcal{J}$. \begin{lemma}\label{lem:grads} The reduced objective $\mathcal{J}$ is continuously differentiable and the derivative is given by \begin{align*} \nabla \mathcal{J}(\bm{z}) = \left\langle \bm K^{-1} \bm A^\top \bm b(\bm{z}_{xy}) + \bm g(\bm{z}_{xy}) - \bm d_{xy} \, , \, \bm K^{-1} \bm A^\top \bm b_{xy}'(\bm{z}_{xy}) + \bm g_{xy}'(\bm{z_{xy}}) \right\rangle + \lambda \bm{z}_{xy}, \end{align*} where $\bm K^{-1} \bm A^\top \in \mathbb{R}^{n_t \times (n_t-1)}$, \begin{align*} \bm b_{xy}'(\bm{z}_{xy}) = \begin{pmatrix} (\bm{g}_{xy}^1)' & - (\bm{g}_{xy}^2)' & 0 & \cdots & 0 & 0 & 0 \\ 0 & (\bm{g}_{xy}^2)' & - (\bm{g}_{xy}^3)' & 0 & \cdots & 0 & 0 \\ 0 & 0 & (\bm{g}_{xy}^3)' & - (\bm{g}_{xy}^4)' & 0 & \cdots &0 \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots\\ 0 & 0 & 0 & 0 & 0 & (\bm{g}_{xy}^{n_t -1})' & - (\bm{g}_{xy}^{n_t})' \end{pmatrix} \in \mathbb{R}^{(n_t-1) \times n_t}, \end{align*} and $\bm g_{xy}'(\bm{z_{xy}})$ is a diagonal matrix given by \begin{align} &\bm g_{xy}'(\bm{z_{xy}}) = \\ &\begin{pmatrix} \frac{\int_{ \mathcal{I}_1 } \bm{E}^1_{xy}(t) \exp(\bm{z}^1_{xy} \cdot \bm{E}^1_{xy}(t)) dt}{\int_{ \mathcal{I}_1 }\exp(\bm{z}^1_{xy} \cdot \bm{E}^1_{xy}(t)) dt} & 0 & 0 & 0 & 0\\ 0 & \frac{\int_{ \mathcal{I}_2} \bm{E}_{xy}^2(t) \exp(\bm{z}^2_{xy} \cdot \bm{E}_{xy}^2(t)) dt}{\int_{ \mathcal{I}_2}\exp(\bm{z}^2_{xy} \cdot \bm{E}_{xy}^2(t)) dt} & 0 & 0 & 0 \\ 0 & 0 & 0 &\ddots & 0 \\ 0 & 0 & 0 & 0 & \frac{\int_{ \mathcal{I}_{n_t}} \bm{E}_{xy}^{n_t}(t) \exp(\bm{z}^{n_t}_{xy} \cdot \bm{E}_{xy}^{n_t}(t)) dt}{\int_{ \mathcal{I}_{n_t}}\exp(\bm{z}^{n_t}_{xy} \cdot \bm{E}_{xy}^{n_t}(t)) dt} \end{pmatrix}. \label{eq:c_exp} \end{align} \end{lemma} \begin{proof} The proof follows by simple calculations. \end{proof} The next result establishes that $(\bm{g}^i_{xy}(\bm{z}_{xy}))''$ is bounded and strictly positive for each $i$, with $\mathcal{I}_i$ denoting the $i$-$th$ exposure time interval. % \begin{theorem}\label{thm:gconvex} Let $\mathcal{I}_i$ denote the $i$-$th$ exposure time interval with $i = 1,\dots, n_t$. If there exists $t \in \mathcal{I}_i$, for all $i$, with ${\bm E}^i_{xy}(t)$ being nonzero then $(\bm{g}^i_{xy}(\bm{z}_{xy}))'' \in \mathbb{R}$ is bounded and strictly positive for all $i$. \end{theorem} \begin{proof} First we will calculate $(\bm{g}^i_{xy}(\bm{z}_{xy}))''$. Recall: \begin{align*} \bm{g}^i_{xy}(\bm{z}_{xy}) = \log\bigg(\frac{1}{| \mathcal{I}_i |}\int_{ \mathcal{I}_i }\exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(t))dt\bigg) \implies (\bm{g}^i_{xy}(\bm{z}_{xy}))' = \frac{\int_{ \mathcal{I}_i } \bm{E}^i_{xy}(t) \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(t)) dt}{\int_{ \mathcal{I}_i }\exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(t)) dt} , \end{align*} yielding % \begin{align} \begin{aligned} (\bm{g}^i_{xy}(\bm{z}_{xy}))'' =\frac{ \boxed{\textrm{I}} - \bigg( \int_{ \mathcal{I}_i } \bm{E}^i_{xy}(t) \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(t)) dt\bigg)^2 } {\big[\int_{ \mathcal{I}_i } \exp(\bm{z}^i_{xy}\cdot \bm{E}^i_{xy}(t))dt\big]^2} , \label{eq:int} \end{aligned} \end{align} where $\boxed{\textrm{I}} = \bigg(\int_{ \mathcal{I}_i } \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(t)) dt\bigg)\bigg(\int_{ \mathcal{I}_i } \big[\bm{E}^i_{xy}(t)\big]^2 \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(t)) dt\bigg)$. % \linebreak Let $\bigg(\int_{ \mathcal{I}_i } \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(t)) dt\bigg) =: \alpha$. Then we have the following: % \begin{align*} \boxed{\textrm{I}} &= \bigg(\int_{ \mathcal{I}_i } \big[\bm{E}^i_{xy}(t)\big]^2 \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(t))\cdot\alpha\; dt\bigg)\\ &= \bigg(\int_{ \mathcal{I}_i } \big[\bm{E}^i_{xy}(t)\big]^2 \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(t))\cdot \bigg(\int_{ \mathcal{I}_i } \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(s)) ds\bigg) \; dt\bigg)\\ &= \bigg(\int_{ \mathcal{I}_i }\int_{ \mathcal{I}_i } \big[\bm{E}^i_{xy}(t)\big]^2 \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(t))\cdot \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(s)) ds \; dt\bigg) . \end{align*} % Using Fubini's Theorem and following the procedure above for the two integral products in the numerator of \eqref{eq:int} we get the following equalities: \begin{align*} \eqref{eq:int} &=\frac{ \boxed{\textrm{I}} - \bigg(\iint\limits_{ \mathcal{I}_i \times \mathcal{I}_i } \bm{E}^i_{xy}(t) \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(t)) \cdot\; \bm{E}^i_{xy}(s) \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(s))\;ds\; dt\bigg)}{\big[\int_{ \mathcal{I}_i } \exp(\bm{z}^i_{xy}\cdot \bm{E}^i_{xy}(t))dt\big]^2}\\ &=\frac{\bigg(\iint\limits_{ \mathcal{I}_i \times \mathcal{I}_i } \big[\exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(t)) \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(s))\big]\bigg(\big[\bm{E}^i_{xy}(t)\big]^2 - \bm{E}^i_{xy}(s)\bm{E}^i_{xy}(t)\bigg) \;ds \; dt\bigg)}{\big[\int_{ \mathcal{I}_i } \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(t))dt\big]^2}\\ &= \frac{\bigg(\iint\limits_{ \mathcal{I}_i \times \mathcal{I}_i } \big[\exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(t)) \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(s))\big]\bigg(\frac{1}{2}\big[\bm{E}^i_{xy}(t) - \bm{E}^i_{xy}(s)\big]^2\bigg) \;ds \; dt\bigg)}{\big[\int_{ \mathcal{I}_1 } \exp(\bm{z}^i_{xy}\cdot \bm{E}^i_{xy}(t))dt\big]^2}.\stepcounter{equation}\tag{\theequation}\label{eq:pos} \end{align*} We notice that Equation \eqref{eq:pos} is positive for $\bm{E}^i_{xy}(t) \neq \bm{E}^i_{xy}(s)$ (since all terms are positive) and the expression is $0$ for $t =s$. By assumption there exists some $t \in \mathcal{I}_i$ such that $\bm{E}^i_{xy}(t) \neq 0$ which implies that an event has occurred at the pixel ${xy}$ during the interval $\mathcal{I}_i.$ Without loss of generality suppose a single event occurred at time $\bar{t}$. Recall from \eqref{eq:Exy} that $\bm{E}^i_{xy}(t,t_i) = \int_{t_i}^{t}\bm{e}_{xy}(r) \; dr$. Then $0 = \bm{E}^i_{xy}(t_i,t_i) \neq \bm{E}^i_{xy}(\bar{t},t_i)$ which implies $\bm{E}^i_{xy}(t_i) \neq \bm{E}^i_{xy}(\bar{t})$. Which further impiles that $\eqref{eq:pos} > 0$. Thus we conclude $(\bm{g}^i_{xy}(\bm{z}_{xy}))'' > 0$. Next, using \eqref{eq:pos}, we obtain the following upper bound: % \begin{align*} (\bm{g}^i_{xy}(\bm{z}_{xy}))'' &\leq \frac{\bigg(\iint\limits_{ \mathcal{I}_i \times \mathcal{I}_i} \big[\exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(t)) \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(s))\big]\max\limits_{t,s\in \mathcal{I}_i}\bigg\{\frac{1}{2}\big[\bm{E}^i_{xy}(t) - \bm{E}^i_{xy}(s)\big]^2\bigg\} \;ds \; dt\bigg)}{\big[\int_{ \mathcal{I}_i} \exp(\bm{z}^i_{xy}\cdot \bm{E}_{xy}(t))dt\big]^2}\\ &= \max\limits_{t,s\in \mathcal{I}_i}\bigg\{\frac{1}{2}\big[\bm{E}^i_{xy}(t) - \bm{E}^i_{xy}(s)\big]^2\bigg\}\frac{\bigg(\iint\limits_{ \mathcal{I}_i \times \mathcal{I}_i} \big[\exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(t)) \exp(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(s))\big] \;ds \; dt\bigg)}{\big[\int_{ \mathcal{I}_i} \exp(\bm{z}^i_{xy}\cdot \bm{E}^i_{xy}(t))dt\big]^2}\\ &= \max\limits_{t,s\in \mathcal{I}_i}\bigg\{\frac{1}{2}\big[\bm{E}^i_{xy}(t) - \bm{E}^i_{xy}(s)\big]^2\bigg\} . \end{align*} Hence \[ 0 < (\bm{g}^i_{xy}(\bm{z}_{xy}))'' \leq \max\limits_{t,s\in \mathcal{I}_i}\bigg\{\frac{1}{2}\big[\bm{E}^i_{xy}(t) - \bm{E}^i_{xy}(s)\big]^2\bigg\} . \] We now conclude that $(\bm{g}^i_{xy}(\bm{z}_{xy}))''$ is bounded and strictly positive. \end{proof} In order to show the local convexity of $\mathcal{J}$, we study the structure of the Hessian of the first term in the definition of $\mathcal{J}$. % \begin{lemma}\label{lem:diag} The matrix $\big\langle \text{\bfseries{Hess}}(\bm K^{-1} \bm A^\top\bm{b}_{xy}(\bm{z}_{xy})) + \text{\bfseries{Hess}}(\bm{g}_{xy}(\bm{z}_{xy})), \bm{u}_{xy}(\bm{z}_{xy}) + \bm{g}_{xy}(\bm{z}_{xy}) - \bm{d}_{xy} \big\rangle$ is a diagonal matrix. \end{lemma} \begin{proof} Without loss of generality, suppose that $n_t = 3$. Recall by our definition: \begin{align*} \bm{g}_{xy}(\bm{z}_{xy}) &= \begin{pmatrix} \log(\frac{1}{| \mathcal{I}_1 |}\int_{ \mathcal{I}_1 }\exp(\bm{z}^1_{xy} \cdot \bm{E}^1_{xy}(t))dt)\\ \log(\frac{1}{| \mathcal{I}_2|}\int_{ \mathcal{I}_2}\exp(\bm{z}^2_{xy} \cdot \bm{E}^2_{xy}(t))dt)\\ \log(\frac{1}{| \mathcal{I}_3|}\int_{ \mathcal{I}_3}\exp(\bm{z}^3_{xy} \cdot \bm{E}^3_{xy}(t))dt)\\ \end{pmatrix}. \end{align*} Then, recall the expression of $\bm g'_{xy}(\bm z_{xy})$ from \eqref{eq:c_exp}. Now to calculate the Hessian of $\bm{g}$, we need to take the derivative with respect to each variable once again. This will result in $\text{\bfseries{Hess}}(\bm{g}_{xy}(\bm{z}_{xy})) \in \mathbb{R}^{n_t \times n_t \times n_t}$ and will be of the form: \begin{align*} \text{\bfseries{Hess}}(\bm{g}_{xy}(\bm{z}_{xy})) = \begin{Bmatrix} \begin{pmatrix} (\bm{g}^1_{xy}(\bm{z}_{xy}))'' & 0 & 0\\ 0 & 0 & 0\\ 0 & 0 & 0 \end{pmatrix}, \; \begin{pmatrix} 0 & 0 & 0\\ 0 & (\bm{g}^2_{xy}(\bm{z}_{xy}))'' & 0\\ 0 & 0 & 0 \end{pmatrix}, \; \begin{pmatrix} 0 & 0 & 0\\ 0 & 0 & 0\\ 0 & 0 & (\bm{g}_{xy}^3(\bm{z}_{xy}))'' \end{pmatrix} \end{Bmatrix}, \end{align*} where $(\bm{g}^i(\bm{z}_{xy}))''$ is defined in Theorem \ref{thm:gconvex} . Next we consider $\text{\bfseries{Hess}}(\bm{K}^{-1} \bm{A}^\top\bm{b}_{xy}(\bm{z}_{xy}))$. Observe: \begin{align*} \text{\bfseries{Hess}}(\bm{K}^{-1} \bm{A}^\top\bm{b}_{xy}(\bm{z}_{xy})) &= \bm{K}^{-1} \bm{A}^\top \cdot \text{\bfseries{Hess}}(\bm{b}_{xy}(\bm{z}_{xy})) \end{align*} where \begin{align*} \text{\bfseries{Hess}}(\bm{b}_{xy}(\bm{z}_{xy})) = \begin{Bmatrix} \begin{pmatrix}(\bm{g}^1_{xy}(\bm{z}_{xy}))'' & 0 & 0\\ 0 & 0 & 0 \end{pmatrix} , \begin{pmatrix} 0 & -(\bm{g}^2_{xy}(\bm{z}_{xy}))'' & 0 \\ 0 & (\bm{g}^2_{xy}(\bm{z}_{xy}))'' & 0 \end{pmatrix}, \begin{pmatrix} (0 & 0 & 0\\ 0 & 0 & \bm{g}^3_{xy}(\bm{z}_{xy}))'' \end{pmatrix}\end{Bmatrix}, \end{align*} \begin{align*} \text{\bfseries{Hess}}(\bm{b}_{xy}(\bm{z}_{xy})) \in \mathbb{R}^{{n_t -1} \times n_t \times n_t}, \end{align*} and \begin{align*} \bm{K}^{-1}\bm A^\top := \begin{pmatrix} | & | \\ \bm \kappa_1 & \bm \kappa_2\\ | & | \end{pmatrix} \in \mathbb{R}^{n_t \times (n_t -1)} . \end{align*} Here $\bm\kappa_i$, $i=1...n_t$ represent the columns of $\bm{K}^{-1}\bm A^\top$. Then we have the following:\begin{align*} &\text{\bfseries{Hess}}(\bm{K}^{-1} \bm{A}^\top\bm{b}_{xy}(\bm{z}_{xy}))\\ &= \begin{Bmatrix} (\bm{g}^1_{xy}(\bm{z}_{xy}))'' \cdot\begin{pmatrix} | & 0 & 0\\ \bm \kappa_1 & 0 & 0\\ | & 0 & 0 \end{pmatrix}, (\bm{g}^2_{xy}(\bm{z}_{xy}))'' \cdot \begin{pmatrix} 0 & | & 0\\ 0 & \bm \kappa_2 - \bm \kappa_1 & 0\\ 0 & | & 0 \end{pmatrix}, (\bm{g}^3_{xy}(\bm{z}_{xy}))'' \cdot\begin{pmatrix} 0 & 0 &| \\ 0 & 0 & \bm \kappa_3\\ 0 & 0 & | \end{pmatrix} \end{Bmatrix}, \end{align*} with $\text{\bfseries{Hess}}(\bm{K}^{-1} \bm{A}^\top\bm{b}_{xy}(\bm{z}_{xy}) \in \mathbb{R}^{n_t \times n_t \times n_t}$. Next we can add $\text{\bfseries{Hess}}(\bm{g}_{xy}(\bm{z}_{xy}))$ and \linebreak $\text{\bfseries{Hess}}(\bm{K}^{-1} \bm{A}^\top\bm{b}_{xy}(\bm{z}_{xy}))$ to get: \begin{align*} &\text{\bfseries{Hess}}(\bm{g}_{xy}(\bm{z}_{xy})) + \text{\bfseries{Hess}}(\bm{K}^{-1} \bm{A}^\top\bm{b}_{xy}(\bm{z}_{xy}))\\ &= \begin{Bmatrix} (\bm{g}^1_{xy}(\bm{z}_{xy}))'' \cdot\begin{pmatrix} | & 0 & 0 \\ \bm\gamma_1 & 0 & 0 \\ | & 0 & 0 \end{pmatrix}, (\bm{g}^2_{xy}(\bm{z}_{xy}))'' \cdot\begin{pmatrix} 0 & | & 0 \\ 0 & \bm\gamma_2 & 0 \\ 0 & | & 0 \end{pmatrix}, (\bm{g}^3_{xy}(\bm{z}_{xy}))'' \cdot\begin{pmatrix} 0 & 0 & | \\ 0 & 0 & \bm\gamma_3 \\ 0 & 0 & | \end{pmatrix} \end{Bmatrix}, \end{align*} where $ \bm\gamma_i \in \mathbb{R}^{n_t}, i=1, \dots, n_t$. Lastly let $\bm{u}_{xy}(\bm{z}_{xy}) + \bm{g}_{xy}(\bm{z}_{xy})-\bm{d}_{xy} = \bm\alpha_{xy} \in \mathbb{R}^{n_t}$. Then \begin{align*} &\big\langle\text{\bfseries{Hess}}(\bm{K}^{-1} \bm{A}^\top\bm{b}_{xy}(\bm{z}_{xy})) + \text{\bfseries{Hess}}(\bm{g}_{xy}(\bm{z}_{xy})), \bm{u}_{xy}(\bm{z}_{xy}) + \bm{g}_{xy}(\bm{z}_{xy}) - \bm{d}_{xy} \big\rangle\\ &= \begin{Bmatrix} (\bm{g}^1_{xy}(\bm{z}_{xy}))'' \cdot\begin{pmatrix} \bm\gamma_1^\top \bm\alpha_{xy} \\ 0\\ 0 \end{pmatrix}, (\bm{g}^2_{xy}(\bm{z}_{xy}))'' \cdot\begin{pmatrix} 0\\ \bm\gamma_2^\top \bm\alpha_{xy} \\ 0 \end{pmatrix}, (\bm{g}^3_{xy}(\bm{z}_{xy}))'' \cdot\begin{pmatrix} 0\\ 0\\ \bm\gamma_3^\top \bm\alpha_{xy} \end{pmatrix} \end{Bmatrix}\\ &\cong \begin{pmatrix} (\bm{g}^1_{xy}(\bm{z}_{xy}))'' \cdot\bm\gamma_1^\top \bm\alpha_{xy} & 0 & 0\\ 0 & (\bm{g}^2_{xy}(\bm{z}_{xy}))'' \cdot\bm \gamma_2^\top \bm\alpha_{xy} & 0 \\ 0 & 0 & (\bm{g}^3_{xy}(\bm{z}_{xy}))'' \cdot\bm \gamma_3^\top \bm\alpha_{xy} \end{pmatrix}.\tag{\theequation}\label{eq:mat} \end{align*} Here $\cong$ denotes the mode 1 unfolding of the $\big\langle\text{\bfseries{Hess}}(\bm{K}^{-1} \bm{A}^\top\bm{b}_{xy}(\bm{z}_{xy})) + \text{\bfseries{Hess}}(\bm{g}_{xy}(\bm{z}_{xy})), \bm{u}_{xy}(\bm{z}_{xy}) + \bm{g}_{xy}(\bm{z}_{xy}) - \bm{d}_{xy} \big\rangle$ tensor. Further details of tensor matrix multiplication can be found in \cite{doi:10.1137/07070111X}. The proof is complete. \end{proof} Next, we establish that $\mathcal{J}$ is strictly locally convex on any finite interval when $\lambda_1$ is chosen appropriately. \begin{theorem}\label{thm:interval} Let $\mathcal{I}_i$ denotes the $i$-$th$ exposure time interval with $i = 1,\dots, n_t$. If there exists $t \in \mathcal{I}_i$, for all $i$, with ${\bm E}^i_{xy}(t)$ being nonzero then for any closed ball $\Omega = \overline{\mathcal{B}_\delta(0)}$ centered at 0 and radius $\delta$, there exists $\lambda_1 > 0$ such that for $\bm{z}_{xy} \in \Omega$, $\mathcal{J}$ is strictly convex. \end{theorem} \begin{proof} First we calculate \textbf{Hess}($\mathcal{J}$) as: \begin{align*} \text{\bfseries Hess}(\mathcal{J}) &= \big\langle \; \bm{u}_{xy}'(\bm{z}_{xy}) + \bm{g}_{xy}'(\bm{z}_{xy})), \bm{u}_{xy}'(\bm{z}_{xy}) + \bm{g}_{xy}'(\bm{z}_{xy})) \; \big\rangle \\ &\quad+ \big\langle \text{\bfseries{Hess}}(\bm{K}^{-1} \bm{A}^\top\bm{b}_{xy}(\bm{z}_{xy})) + \textbf{Hess}(\bm{g}_{xy}(\bm{z}_{xy})), \bm{u}_{xy}(\bm{z}_{xy}) + \bm{g}_{xy}(\bm{z}_{xy}) - \bm{d}_{xy} \big\rangle + \lambda_1 \bm{I}. \end{align*} We notice that the term $\big\langle \; \bm{u}_{xy}'(\bm{z}_{xy}) + \bm{g}_{xy}'(\bm{z}_{xy})), \bm{u}_{xy}'(\bm{z}_{xy}) + \bm{g}_{xy}'(\bm{z}_{xy})) \; \big\rangle$ is of them form $\bm{M}^\top\bm{M}$, which implies that it is symmetric positive semi-definite. Next, from Lemma~\ref{lem:diag} we recall that the term $\big\langle \text{\bfseries{Hess}}(\bm{K}^{-1} \bm{A}^\top\bm{b}_{xy}(\bm{z}_{xy})) +\textbf{Hess}(\bm{g}_{xy}(\bm{z}_{xy})), \bm{u}_{xy}(\bm{z}_{xy}) + \bm{g}_{xy}(\bm{z}_{xy}) - \bm{d}_{xy} \big\rangle$ is a diagonal matrix. In the case where the diagonal entries (eigenvalues) are greater than 0, then we are done. Suppose some eigenvalue is less than 0 and let $ \bm{z}_{xy}\in \Omega := \overline{\mathcal{B}_\delta(0)} $ which implies $ \|\bm{z}_{xy}\|_\infty \leq \delta$. Given $\delta > 0$, choose $\lambda_1 > 0$ such that \[ 0 < \delta < \frac{\lambda_1 - (\|\bm\gamma\|_\infty \cdot M_1 \cdot \| \bm d_{xy}\|_\infty)(2\|\bm{K}^{-1}\bm{A}^\top\|_\infty + 1)}{(\|\bm\gamma\|_\infty \cdot M_1 \cdot M_2)(2\|\bm{K}^{-1}\bm{A}^\top\|_\infty ) + 1)} . \] Where $M_2 = \max\limits_i \bigg\{\big|\min\limits_{t \in \mathcal{I}_i} \{\bm{E}^i_{xy}(t)\}\big|, \max\limits_{t \in \mathcal{I}_i}\big\{\bm{E}^i_{xy}(t) \big\} \bigg\}$ and $M_1 = \max\limits_i \biggl\{\max\limits_{t,s\in \mathcal{I}_i}\bigg\{\frac{1}{2}\big[\bm{E}^i_{xy}(t) - \bm{E}^i_{xy}(s)\big]^2\bigg\}\biggr\} .$ Recall from Theorem \ref{thm:gconvex} that $0 < (\bm{g}^i_{xy}(\bm{z}_{xy}))'' \leq \max\limits_{t,s\in \mathcal{I}_i}\bigg\{\frac{1}{2}\big[\bm{E}^i_{xy}(t) - \bm{E}^i_{xy}(s)\big]^2\bigg\}$, which implies $(\bm{g}^i_{xy}(\bm{z}_{xy}))'' \leq M_1$ for any $i$. Then using \ref{eq:mat} we have the following: \begin{align*} &\|\big\langle \text{\bfseries{Hess}}(\bm{K}^{-1} \bm{A}^\top\bm{b}_{xy}(\bm{z}_{xy})) + \textbf{Hess}(\bm{g}_{xy}(\bm{z}_{xy})), \bm{u}_{xy}(\bm{z}_{xy}) + \bm{g}_{xy}(\bm{z}_{xy}) - \bm{d}_{xy} \big\rangle \|_\infty \\ &\leq \begin{Vmatrix} \begin{pmatrix} (\bm{g}^1_{xy}(\bm{z}_{xy}))'' \cdot\bm\gamma_1^\top \bm\alpha_{xy} & 0 & 0 & 0\\ 0 & (\bm{g}^2_{xy}(\bm{z}_{xy}))'' \cdot\bm \gamma_2^\top \bm\alpha_{xy} & 0 & 0 \\ \vdots & \vdots & \ddots & \vdots\\ 0 & 0 & \dots & (\bm{g}^{n_t}_{xy}(\bm{z}_{xy}))'' \cdot \bm{\gamma}_{n_t}^\top \bm\alpha_{xy} \end{pmatrix}\\ \end{Vmatrix}_\infty \\ &\leq M_1 \cdot \|\bm\gamma\|_\infty \bigg(\|\bm{u}_{xy}(\bm{z}_{xy})\|_\infty + \|\bm{g}_{xy}(\bm{z}_{xy})\|_\infty + \|\bm{d}_{xy}\|_\infty\bigg)\\ & \leq M_1 \cdot \|\bm\gamma\|_\infty \bigg(\|\bm{K}^{-1}\bm{A}^\top\bm{b}_{xy}\|_\infty + M_2 \|\bm{z}_{xy}\|_\infty + \|\bm{d}_{xy}\|_\infty \bigg)\\ & \leq M_1 \cdot \|\bm\gamma\|_\infty \bigg(\|\bm{K}^{-1}\bm{A}^\top\|_\infty \|\bm{b}_{xy}\|_\infty + M_2 \|\bm{z}_{xy}\|_\infty + \|\bm{d}_{xy}\|_\infty \bigg)\\ & \leq M_1 \cdot \|\bm\gamma\|_\infty \bigg(\|\bm{K}^{-1}\bm{A}^\top \|_{\infty} \; (2\|\bm d_{xy}\|_\infty +2M_2 \|\bm{z}_{xy}\|_\infty) + M_2 \|\bm{z}_{xy}\|_\infty + \|\bm{d}_{xy}\|_\infty \bigg)\\ &< \lambda_1. \end{align*} Here \[\bm{\gamma} := \begin{pmatrix} | & | & \dots& |\\ \bm\gamma_1 & \bm\gamma_2 & \dots& \bm\gamma_{n_t}\\ | & | & \dots & | \end{pmatrix}^\top,\] $\bm{\gamma}_i$ and $\bm{\alpha}_{xy}$ are defined in Equation \ref{eq:mat} . Notice that $M_2$ is derived from bounds on $\bm{g}_{xy}(\bm{z}_{xy})$ as follows: \begin{align*} \bm{g}^i_{xy}(\bm{z}_{xy}) = \log\bigg(\frac{1}{| \mathcal{I}_i|}\int_{ \mathcal{I}_i}\exp (\bm{z}^i_{xy}\cdot \bm{E}^i_{xy}(t))dt\bigg) \leq \bm{z}^i_{xy}\cdot \max\big\{\bm{E}^i_{xy}(t)\big\}, \text{ where } \bm{z}^i_{xy}\cdot \bm{E}^i_{xy}(t) \geq 0 \end{align*} and \begin{align*} \bm{g}^i_{xy}(\bm{z}_{xy}) &= \log\bigg(\frac{1}{| \mathcal{I}_i|}\int_{ \mathcal{I}_i}\exp(\bm{z}^i_{xy}\cdot \bm{E}^i_{xy}(t))dt\bigg) \geq \bm{z}^i_{xy}\cdot \min\big\{\bm{E}^i_{xy}(t)\big\}, \text{ where } \bm{z}^i_{xy}\cdot \bm{E}^i_{xy}(t) \leq 0\\ &\implies |\bm{g}^i_{xy}(\bm{z}_{xy})| \leq | \bm{z}^i_{xy}\cdot M_2 |. \end{align*} Recall $\big\langle \text{\bfseries{Hess}}(\bm{K}^{-1} \bm{A}^\top\bm{b}_{xy}(\bm{z}_{xy})) + \textbf{Hess}(\bm{g}_{xy}(\bm{z}_{xy})), \bm{u}_{xy}(\bm{z}_{xy}) + \bm{g}_{xy}(\bm{z}_{xy}) - \bm{d}_{xy} \big\rangle$ is diagonal from \ref{eq:mat} . Denote the diagonal entries as $\sigma_i$, $i=1, \dots, n_t$. Without loss of generality let $|\sigma_1| \geq |\sigma_i|$, $i=2, \dots, n_t$. Then we have the following: \[ |\sigma_i| \leq |{\sigma_1}|= \|\big\langle \text{\bfseries{Hess}}(\bm{K}^{-1} \bm{A}^\top\bm{b}_{xy}(\bm{z}_{xy})) + \textbf{Hess}(\bm{g}_{xy}(\bm{z}_{xy})), \bm{u}_{xy}(\bm{z}_{xy}) + \bm{g}_{xy}(\bm{z}_{xy}) - \bm{d}_{xy} \big\rangle \|_\infty < \lambda_1. \] Thus $\sigma_i < \lambda_1$ for all $i$. Furthermore $\sigma_i + \lambda_1 > 0$ for all $i$. We notice \[ \big\langle \text{\bfseries{Hess}}(\bm{K}^{-1} \bm{A}^\top\bm{b}_{xy}(\bm{z}_{xy})) + \textbf{Hess}(\bm{g}_{xy}(\bm{z}_{xy})), \bm{u}_{xy}(\bm{z}_{xy}) + \bm{g}_{xy}(\bm{z}_{xy}) - \bm{d}_{xy} \big\rangle + \lambda_1 \bm{I} \] is symmetric positive definite since it is a diagonal matrix with entries: $\sigma_i + \lambda_1 > 0$. Hence \textbf{Hess}($\mathcal{J}$) is symmetric positive definite due to it being the summation of a symmetric positive definite matrix and a symmetric positive semi-definite matrix. We conclude that for any convex set $\Omega$ there exists $\lambda_1$ such that $\mathcal{J}$ is strictly convex over $\Omega$. \end{proof} We further note that from Theorem \ref{thm:interval} once an interval is chosen a lower bound for $\lambda_1$ can be calculated by: \[ \lambda_1 > \|\bm\gamma\|_\infty \cdot M_1 \bigg(\|\bm{K}^{-1}\bm{A}^\top \|_{\infty} \; (2\|\bm d_{xy}\|_\infty +2M_2 \|\bm{z}_{xy}\|_\infty) + M_2 \|\bm{z}_{xy}\|_\infty + \|\bm{d}_{xy}\|_\infty \bigg) . \] \section{Experimental Setup}\label{s:numres} This section focuses on how to prepare the dataset to be used in our computations. \subsubsection{Standardizing $\bm{B^i}$} Depending on the event camera used, the entries of the matrix $\bm{B^i}$ from \eqref{eq:B}, where $i$ identifies a unique standard camera image in the sequence being considered, may take on various ranges to include $[0,255]$ or $[-255,255]$. We standardize $\bm{B^i}$ using MATLAB function mat2gray. This function will map the values of $\bm{B^i}$ to the range $[0,1]$ on a log scale. That being said since we define the matrix $\bm{d}^i = \log(\bm{B^i})$ we have to be careful not to allow $\bm{B^i}$ to have any zero values. We can easily protect against this by inserting a manual range into the mat2gray function of $[\min{\bm{B^i}} -\epsilon, \max{\bm{B^i}}+\epsilon]$, for a sufficiently small $\epsilon$. In our computations we set $\epsilon = 1e-3$. We note $\min \bm B^i$ and $\max \bm{B}^i$ are the minimum and maximum values over all values in the matrix $\bm{B}^i$, respectively. \subsubsection{Building the data cube} \label{s:cube} In order to view the problem in three dimensions, we create a data cube as shown in Figure $\eqref{f:ex1}$. As stated in \eqref{eq:cube} we define this cube by: \begin{equation*} {\bm{EC}}_{xy}^{s_j} = p_{x,y}^{s_j}. \end{equation*} Since the event data is generated on a nearly continuous basis, the data cube will be of size $\mathbb{R}^{\nu \times {n_x} \times {n_y}}$ where $\nu := \sum\limits_i n_i$ is the total number of events used in the reconstruction over all images. Note that $n_i$ is explained in further detail in \ref{eq:cube} . On average our image reconstructions use approximately $\nu \approx25,000$ events. It is impractical numerically to use this data cube due to its size. This issue is resolved by reducing the size of the data cube via time compression. Choose some $r,k \in \mathbb{N}$ such that $\nu \approx r\cdot k $ and define a new data cube as follows: \begin{align*} \bm{dc}^{\pi} = \sum_{\omega = 1 + (\pi-1)\cdot k}^{\pi \cdot k} \bm{EC}^{\omega} \end{align*} Then we have $\bm{dc} \in \mathbb{R}^{r \times {n_x} \times {n_y}}$ where $r \approx \frac{\nu}{k}$, and $\pi = 1, \dots, r$. For our examples we have chosen $k \approx 200$. \subsubsection{Calculate $\bm{g}(\bm{z})$} Once we have built the data cube then we can calculate the function $\bm{g}(\bm{z})$ which is defined componentwise as: \[ \bm{g}_{xy}^i(\bm{z}_{xy}) = \log \bigg( \frac{1}{| \mathcal{I}_i | }\int_{ \mathcal{I}_i} \exp \big(\bm{z}^i_{xy} \cdot \bm{E}^i_{xy}(\tau, t_i)\big)dt \bigg), \quad i=1, \dots, n_t. \] Numerically we approximate this using the trapezoid rule as: \[ \bm{g}_{xy}^i(\bm{z}_{xy}) \approx \log \bigg( \frac{1}{| \mathcal{I}_i | } \sum_{l=2}^{r}\big(\frac{\triangle \tau_{l-1}}{2}\big)\big(\exp \big(\bm{z}^i_{xy} \cdot \bm{E}^i(\tau_{l-1}, t_i)\big) + \exp \big(\bm{z}^i_{xy} \cdot \bm{E}^it_{xy}(\tau_{l}, t_i)\big)\big) \bigg) , \] where $t_i$ is defined in \eqref{eq:Exy} and $\Delta \tau_{l-1} = \tau_l - \tau_{l-1}$ is the step length. We evaluate the function $\bm{b}(\bm{z})$ as well as the derivatives of $\bm{b}(\bm{z})$ and $\bm{g}(\bm{z})$ in a similar way. \subsubsection{Omitting unnecessary calculations for $\bm{z}$} We recall that $\bm{z}$ must be calculated on a per pixel basis. To decrease computation time we only perform an optimization for $\bm{z}_{xy}$ over the pixels for which event data has been captured. \subsubsection{Image Reconstruction} \label{s:IR} As shown in Figure~\ref{f:ex1} our method is capable of generating two image representations. Given some value ${\bm{z}}$ the $\bm{u}$ representation is given as: $\bm{u}({\bm{z}})$ defined in $\eqref{eq:u}$. The $\bm{u}$ representation reconstructs only the dynamical part of the image. This is due to our definition of $\bm{b}$ in \eqref{eq:b}. In order to reconstruct the full image including the portion of the image with no dynamics, we use \[\bm{v}_{xy}^i = \bm{d}_{xy}^i - \bm{g}_{xy}^i({\bm{z}}),\] a variation of the definition given in \eqref{eq:EDI}. In general we will refer to the latter formulation as the reconstruction, and will specifically denote the $\bm{u}$ representation when presented. \section{Numerical Examples} \label{s:nex} Next, we present a series of examples which establishes that the proposed approach could be beneficial in practice. \subsection{Benchmark Problem: Unit Bump} The first example is a synthetic case where we consider a blurred unit bump, see Figure~\ref{f:ex4} . In order to perform this analysis, we require a baseline image for comparison, a series of consecutive images as input for the ESIM generator \cite{Gehrig_2018} and our proposed method, a blurry image, and the corresponding event data. To begin, we will construct a series of consecutive images by first creating a white circle on a black background (not shown). Using this initial image, we move the white circle two pixels to the right and two pixels down eight times. This set of nine images completes our series of images. We now generate a tenth image, the blurry image (middle in Figure~\ref{f:ex4}), by averaging the sequence of nine images. The fifth image of the set is designated as our baseline image (left in Figure~\ref{f:ex4}). Lastly, to generate the associated event data, we use the ESIM generator from \cite{Gehrig_2018}. The ESIM generator takes a series of images as input, and will output event data. Recall that our model requires a series of images as well as event data in order to generate a reconstructed image. We set $\bm{B}^1$ to be the fourth image of the nine image set, $\bm{B}^2$ to be the blurry image, and $\bm{B}^3$ to be the sixth image. The result of our method (right in Figure~\ref{f:ex4}) is compared to the baseline image. As shown, we obtain a high quality reconstruction with SSIM of 0.96 and PSNR of 27.3. This example serves a benchmark for us to apply our approach on the event based dataset. \begin{figure}[!htb] \centering \includegraphics[width=.2\textwidth]{baseline_circle_orig} \qquad \includegraphics[width=.2\textwidth]{baseline_circle_blurry} \qquad \includegraphics[width=.2\textwidth]{baseline_circle_recon} \caption{From left to right we have our baseline image, a simulated blurry image, and finally our reconstruction. Events for this reconstruction were produced using the ESIM generator from \cite{Gehrig_2018}. Using parameters $\lambda_1 = 1$ and $\lambda_2 = 1e-3$, we achieve an SSIM value of 0.96 and a PSNR value of 27.3. } \label{f:ex4} \end{figure} \subsection{Multiple Event Based Dataset Examples} Figures~\ref{f:ex1}-\ref{f:ex3} show the application of our method to various examples. In each of these examples three standard camera images are used to define the $\bm{B}$ variable, while the $\bm{g}$ and $\bm{b}$ variables are calculated using the associated event data. In each of these examples the $\bm{B}^2$ image was chosen to be a blurry image. We will refer to the $\bm{B}^2$ image as the blurry image for the remainder of this section. In Figure \ref{f:ex1} for the chosen three image sequence $\approx 39,000$ events were recorded. The blurry image is shown (left) while our reconstruction is shown (right). Our reconstruction deblurs the fence-line as well as captures the grass and tree texture that is not apparent in the blurred image. The blurred image (left) in Figure \ref{f:ex2} shows a person swinging a pillow. Approximately 26,000 events were captured for this example. Our model has successfully reconstructed the boundary of the pillow as well as the persons hand and thumb. Figure \ref{f:ex3} is an example of a person jumping and the three image sequence used has $\approx$ 16000 associated events. Notice in the blurred image (left) the persons arm is barely visible. In contrast our model is able to reconstruct the persons arm (right). \begin{figure}[!htb] \centering \includegraphics[width=.24\textwidth]{drive11} \includegraphics[width=.24\textwidth]{drive12} \includegraphics[width=.24\textwidth]{drive13} \includegraphics[width=.24\textwidth]{night_drive_deblur} \caption{Example of our method with a night drive data set. From left to right we have a standard camera image that contains motion blur, a 2D representation of the event data color coded red for positive events and blue for negative events, a 3D representation of the events over time, and finally the reconstructed image using our bilevel optimization method. Here, we have used $\lambda_1 =1$ and $\lambda_2 = 1e-3$. } \label{f:ex1} \end{figure} \begin{figure}[!htb] \centering \includegraphics[width=.32\textwidth]{drop_blur} \includegraphics[width=.32\textwidth]{drop_u} \includegraphics[width=.32\textwidth]{drop_deblur} \caption{From left to right we have the original blurred image from a standard camera, the $\bm{u}$ representation, and the reconstruction using our bilevel method. This reconstruction was generated with $\lambda_1 = 0.5$ and $\lambda_2 = 1e-3$. } \label{f:ex2} \end{figure} \begin{figure}[!htb] \centering \includegraphics[width=.31\textwidth]{jump_blur} \includegraphics[width=.31\textwidth]{jump_events} \includegraphics[width=.31\textwidth]{jump_deblur} \caption{From left to right we have a standard blurry camera image, the recorded events, and finally our reconstructed image. This reconstruction was generated with $\lambda_1 = 1.5$ and $\lambda_2 = 1e-3$.} \label{f:ex3} \end{figure} \subsection{Event Based Problem: Shadowing Effects}\label{s:shadow} As noted in Section \ref{s:existing} one of the limitations to the mEDI model is the appearance of shadows in a high contrasting environment. Examples of this shadowing effect can be seen in \cite{pan2019bringing} and Figures \ref{f:nrun} and \ref{f:nrun2}. As shown in Figures \ref{f:nrun} and \ref{f:nrun2} our model is able to substantially reduce the shadowing effects of the EDI and mEDI models.\begin{figure}[!htb] \centering \includegraphics[width=.25\textwidth]{n_run_original} \qquad \includegraphics[width=.25\textwidth]{n_run5} \qquad \includegraphics[width=.25\textwidth]{n_run_no_shadow} \caption{In this figure we see the shadowing effects that can occur due a high contrast environment. From left to right we have the standard camera image, the image produced by the mEDI method, and finally the image produced via our bilevel optimization method with $\lambda_1 = 1$ and $\lambda_2 = 1e-3$. Clearly, our method helps overcome the shadowing effect.} \label{f:nrun} \end{figure} \begin{figure}[!htb] \centering \includegraphics[width=.25\textwidth]{n_run_orig2} \qquad \includegraphics[width=.25\textwidth]{n_run_no_shadow2} \caption{The panels show a second example of our method (right) used to deblur the a standard camera image(left) resulting in a reduced amount of shadowing compared to the existing approaches.} \label{f:nrun2} \end{figure}Figure~\ref{f:plot1} shows the behavior of five randomly chosen pixels. We observe the typical convergence behavior of a Newton's method. \begin{figure}[!htb] \centering \includegraphics[width=.5\textwidth]{convergence} \caption{This figure shows the value $\|\nabla \mathcal{J}(\bm{z})\|$ for each Newton iteration over a sample of pixels. The Newton iterations shown are from the optimization of pixels sampled from the image reconstruction that is shown in Figure \ref{f:nrun}.} \label{f:plot1} \end{figure} \section*{Conclusion, Limitation, and Future Work} In this study, we introduce a novel approach to image deblurring by combining event data and multiple standard camera images within a variational framework. Our method demonstrates the existence of solutions for a locally convex problem and we apply a second order Newton solver to several examples, showcasing the effectiveness of our approach. Though our method does offer a systematic way to construct de-blurred images across time there are limitations that still exist in the model. \begin{enumerate} \item Our method requires a pixel by pixel optimization and depending on the camera resolution can run into scalability issues. This issue would be most evident with images where dynamics occur at a majority of pixels. \item Manual tuning may be required of certain parameters as described in Section \ref{s:cube} . \end{enumerate} To mitigate the scalability risk, we propose to filter out pixels that have significantly lower event counts compared to other pixels. In future work, we also plan to test the model's robustness in a domain shift scenario, such as a camera moving in and out of water. Moreover, we aim to develop a parameter learning framework to optimize the regularization parameters for better performance. \section*{Acknowledgement} The authors are grateful to Dr. Patrick O'Neil and Dr. Diego Torrejon (BlackSky) and Dr. Noor Qadri (US Naval Research Lab, Washington DC), for bringing the neuromorphic imaging topic to their attention and for several fruitful discussions. \bibliographystyle{plain}
\section{Introduction} \IEEEPARstart{I}{ntegrating} physical control processes, computing, and communication through Internet of Things technology (IoT) improves industrial control systems (ICSs) production efficiency, flexibility, and reliability. Unfortunately, the prevalence of Internet of Things technology and networked sensors in many ICSs opens up opportunities for cybercriminals to leverage ICS vulnerabilities towards initiating cyber-attacks \cite{sakhnini2021security, haddadpajouh2021survey}. There has been an increase in cyber-attack awareness of critical infrastructure \cite{kello2019virtual, yaacoub2020cyber, thakur2016impact, pleta2020cyber}. Programmable Logic Controllers (PLCs) are industrial computers that play a significant role in ICS. PLCs are a family of embedded devices critical to ICS network operation. PLCs collect input data from field devices such as sensors and send output commands to actuating devices to control ICS operations \cite{wardak2016plc, abbasi2017ecfi}. ICS plays a vital role in monitoring and controlling critical infrastructures such as electricity supply, nuclear plants, petrochemical industries, and water management. PLCs, which serve as the heart of ICS, are vulnerable to attacks like other embedded devices. Because PLCs are broadly used to control the physical processes of critical infrastructure in societies, PLC malfunctions or attacks can cause physical and economic damages as well as compromise the safety of ICS service personnel \cite{abbasi2016ghost}. Traditionally, PLCs use proprietary hardware and software in physically secure locations with no external connection to the internet \cite{yau2015plc, langmann2019plc}. As a result, attacks on PLCs were limited to insider intrusion, physical damage, and tampering with PLC devices \cite{tsiknas2021cyber}. In recent times, PLCs have adopted corporate networks and common information technologies with integrated smart sensors and wireless networks for performance enhancement, and efficiency improvement \cite{spyridopoulos2013incident, hwang2021sfd}. Applying traditional techniques and contemporary tools for detecting PLC anomalous behavior is difficult due to their unique architecture and proprietary operating systems. Therefore, it is crucial to protect PLCs against any forms of attack or anomalies such as hardware malfunction, accidental actions by insiders, and malicious intruders \cite{boeckl2019considerations}. Machine learning techniques have been applied for anomaly detection in embedded devices and for identifying anomalies in several computing applications \cite{chen2017application, welborn2021one, hiranai2021detection, shitharth2017enhanced, yin2017deep, aboah_access}. Recently, work has been done that utilizes ICS data to develop unsupervised anomaly detection models which exhibit the ICS system's normal behavior and identify all different behaviors as anomalies \cite{aboah2022plc, elnour2020hybrid, boateng2021anomaly}. These algorithms learn a single hypothesis from training dataset in order to make generalizations about unseen events. Moreover, different anomaly detection algorithms make different assumptions about the dataset, which may not be accurate. As a result, different anomaly detection algorithms perform well on some subsets of a dataset and perform poorly on other subsets \cite{aggarwal2017introduction}. Anomaly detection algorithms' unique assumptions about datasets make it challenging to generalize their performance to an arbitrary dataset. Ensemble methods refer to the approach by which multiple models are strategically developed and combined for improved performance. In supervised machine learning classification domain, ensemble methods broadly include bagging, boosting, stacking \cite{aggarwal2014algorithms, aggarwal2015data}. However, in unsupervised outlier analysis domain, there are two primary types of ensembles, namely sequential ensembles and independent ensembles \cite{aggarwal2017introduction}. In sequential ensembles, a given algorithm or set of algorithms are applied sequentially such that previous applications influence future applications of the algorithm. In contrast, different anomaly detection algorithms are applied to either the complete dataset or portions of the dataset in independent ensembles. In \cite{aggarwal2017introduction}, Aggarwal claims that ensemble combinations of multiple anomaly detection algorithms are often able to perform more robustly on arbitrary datasets due to their ability to combine the strengths of multiple detection algorithms. The work in \cite{aboah2022plc} suggests that ensemble learning techniques may improve anomaly detection in ICS based on the performances of several anomaly detection algorithms. Several studies have focused on improving supervised classification performance using homogeneous classifiers \cite{cabrera2008ensemble, folino2016distributed}, heterogeneous classifiers \cite{zhao2015ensemble}, or a combination of both \cite{amozegar2016ensemble, aburomman2016novel}. However, there is not sufficient study concerning unsupervised ensemble machine learning techniques for anomaly detection in PLCs and ICSs. This work proposes five generalized unsupervised ensemble techniques for ICS anomaly detection: majority voting, maximum-score, soft voting, weighted voting, and stacking-based anomaly detection approaches. The weighted voting ensemble method introduces a new approach for assigning weights to base detectors based on their coefficient of determination. The stacking-based approach is a new ensemble approach based on IF meta-learner. The proposed methods broadly fall under independent ensembles in outlier analysis. For each ensemble method, this work adopts the same base detectors, namely; OCSVM, OCNN, and IF, that learn new representations from the training dataset. Then, output representations from the base detectors are concatenated and passed to a voting strategy algorithm to detect attacks from the newly merged representations. The trained models are intended to run on a dedicated or separate computer to monitor operations at the PLC memory addresses through real-time HMI historian logs. Experimental results show that the proposed ensemble techniques in this work outperform existing approaches with acceptable statistical significance. In summary, the main contributions of this work are listed as follows: \begin{enumerate} \item Propose first known ensemble anomaly detection methods using OCSVM, OCNN, and IF base detectors; \item Introduce a weighted voting ensemble technique with a learning algorithm for assigning weights to base detectors based on their coefficient of determination; and \item Introduce a stacking-based anomaly detection framework with isolation forest meta-detector for robust performance. \end{enumerate} The remainder of the paper is organized as follows. Section 2 reviews related works. Section 3 presents details of the experiment setup and data collection approach. Section 4 presents the proposed methods, followed by section 5, which presents results and analysis. Section 6 presents the conclusions and recommendations for future work. \section{Related Work} \subsection{Unsupervised Ensemble Methods} Sun et al. \cite{sun2016detecting} employed an unsupervised ensemble outliers detection framework based on IF algorithms to detect insider threats in an industry. They modified the isolation trees in the IF to support categorical data. Although they achieved significant detection recall values, a drawback of the approach in \cite{sun2016detecting} is that the ensemble method consisted only of isolation trees. As a result, the isolation trees made the same assumptions about the dataset. Haider et al. \cite{haidar2018adaptive} proposed an ensemble method based on OCSVM and IF on data clusters. They employed human domain experts to identify false-positive results, which were used to update the ensemble algorithm progressively. They executed a k-means algorithm for class decomposition on top of the base detectors. Finally, they tuned the ensemble algorithm by oversampling the false-positive results to create an accurate decision boundary. Although this algorithm presents an interesting idea for unsupervised anomaly detection, it requires human intervention to achieve optimal performance. In \cite{parveen2013evolving}, the authors proposed an ensemble learning framework that combines an unsupervised learning method with a graph-based anomaly detection technique. The base detectors consisted of OCSVM and minimum description length (MDL)\cite{diop2019design}. They also proposed a detection model solely based on multiple OCSVM and a streaming data mining approach to account for concept drift. Reported performance was was, suggesting that choice and number of base detectors in an ensemble algorithm are crucial to obtain the best results. Yuan et al. \cite{yuan2018insider} proposed an ensemble of deep learning algorithms consisting of long short-term memory and a convolutional neural network to identify anomalies in multiple scenarios. They achieved an area under the curve of $94\%$. Although their method worked well, their approach requires significant computational resources like graphical processing units during training and testing. \subsection{Base Detectors for Ensemble Methods} Inoue et al. utilized unsupervised ML algorithms for anomaly detection in water treatment systems \cite{inoue2017anomaly}. They compared a deep neural network consisting of feedforward layers with multiple inputs and outputs with a One-class Support Vector Machine (OCSVM). The authors claimed that the deep neural network model produced fewer false positives than the OCSVM, although the OCSVM could detect more anomalies. The authors achieved recall values of less than 0.7 for both deep neural network and OCSVM. In \cite{muna2018identification}, the authors employed a fully connected neural network and an autoencoder to detect anomalies in IoT computer network traffic. Their results showed a higher detection rate and lowered false positive rate when compared with eight other modern anomaly detection techniques. Potluri et al. \cite{potluri2017identifying} proposed using artificial neural networks for identifying false data injection attacks in ICS. The classification report obtained in \cite{potluri2017identifying} shows a promising detection accuracy with artificial neural networks. Ahmed et al. \cite{ahmed2019unsupervised} presented an unsupervised learning IF approach to detect hidden data integrity assault on a smart grid communication network. They reported an average accuracy of 93\%,using simulated experimental data. While the simulated data may not depict ICS accurately, The work in \cite{ahmed2019unsupervised} suggests that IF has the potential for high performance in anomaly detection. Although both supervised and unsupervised ML techniques have been applied in PLC anomaly detection \cite{aboah2022plc, boateng2021anomaly, ahmad2020machine}, it is usually difficult to rely on a supervised learning approach as real-world ICS contain numerous sensor data that are tedious to label. An unsupervised ML technique called OCSVM was employed to detect anomalies in PLCs successfully \cite{aboah2022plc}. In \cite{aboah2022plc}, the authors employed OCSVM, OCNN, and IF for PLC anomaly detection. Their experiment simulated a traffic light control system using a PLC. They captured relevant PLC memory addresses into a log file for real-time data recording of system operations. The captured data was normalized and used to train and evaluate their models. Aboah et al. concluded that IF outperforms OCNN and OCSVM on the TLIGHT system dataset. While OCSVM, OCNN, and IF have been used as effective unsupervised techniques for anomaly detection, OCSVM performance is unsatisfactory on complex, high-dimensional datasets \cite{chalapathy2018anomaly, bengio2007scaling, fawcett2003proceedings}. Although OCNN has been used for anomaly detection in a complex dataset \cite{chalapathy2018anomaly, aboah2022plc}, the work in \cite{aboah2022plc} shows that OCNN performs at par with OCSVM on several test cases of their TLIGHT dataset because OCNN and OCSVM are formulated from a similar optimization problem. The work in \cite{aboah2022plc} also shows that some anomalous data points are detected by either OCSVM or OCNN, but IF fails to detect them. Therefore, this work hypothesizes that some base anomaly detectors will perform well on a particular subset of a dataset, whereas other base detectors will perform better on other subsets. This work proposes five unsupervised ensemble techniques based on OCSVM, OCNN, and IF to improve anomaly detection performance. \section{Experiment Setup} This section provides the details of the experimental setup for simulating the behavior of the traffic light (TLIGHT) system in \cite{aboah2022plc, siemens1996s7} for the purposes of data collection. The details of the experimental setup is provided in \cite{aboah2022plc}. The experimental setup is based on Siemen's open-source TLIGHT program described in \cite{aboah2022plc, siemens1996s7}. OpenPLC is an open-source PLC simulation platform for home and industrial automation systems development \cite{alves2014openplc}. OpenPLC editor was used to simulate and test the TLIGHT system logic to ensure that the program was error-free and accurately depicted the TLIGHT system description in \cite{aboah2022plc, siemens1996s7}. The ladder logic was converted to a structured text format and uploaded to OpenPLC runtime for execution. ScadaBR \cite{mazurkiewicz2016open}, an open-source Supervisory Control and Data Acquisition (SCADA) system, was employed as the HMI to monitor and control the PLC runtime. HMI application runs independently of the PLC. The PLC input and output memory addresses were mapped to corresponding Modbus input and output addresses in the HMI. At the end of every HMI cycle time (100 ms), ScadaBR logs available data at the input and output Modbus addresses to a log file. Finally, TLIGHT system operations are exported from the HMI as comma-separated-values files for preprocessing and machine learning model training. \section{Proposed Method} The proposed unsupervised ensemble methods use the normal process data from the TLIGHT system's input and output signals. This section presents the details about the data collection, anomalies, and theoretical background of the algorithms used in the proposed methods. Figure~\ref{fig1} shows the general anomaly detection framework of the proposed methods. The anomaly detection framework in Figure~\ref{fig1} represents a real-world scenario whereby the trained ensemble models in this work are serialized onto a separate personal computer (PC) for real-time PLC monitoring and anomaly detection. The trained ensemble models receive the process control's real-time data through the HMI and the OpenPLC memory addresses in order to determine whether the received signals violate the process control's normal operations. In order to evaluate and compare the proposed unsupervised ensemble methods performance in this work, five different test sets are generated. Each test set contains normal and anomalous TLIGHT system events. Anomalous system events for the five test sets are derived from seven scenarios. The attack scenarios considered in the experiment could represent real-world anomalies resulting from malfunctioning sensors and actuators, such as physical obstruction, natural disaster, or malicious attacks by cyber threat actors. The five test cases were considered based on combinations of the anomalous scenarios. The total training dataset samples and test sets 1--5 are identical with the setup used in \cite{aboah2022plc}. Test sets 4 and 5 consist mainly of timing bits anomalies. Table~\ref{tab1} summarizes the number of records and proportion of anomalies in the training and test sets. \begin{figure}[!t] \centering \includegraphics[width=9 cm]{images/fig1.png} \caption{Anomaly detection framework} \label{fig1} \end{figure} \begin{table} \begin{center} \caption{Number of records and proportion of anomalies in training and test data sets} \label{tab1} \begin{tabular}{| c | c | c |} \hline \textbf{Dataset} & \textbf{No. of Records} & \textbf{$\textbf{\%}$ Anomalies}\\ \hline Training set & 41580 & n/a\\ \hline Test Set 1 & 5000 & 10\\ \hline Test Set 2 & 7000 & 10\\ \hline Test Set 3 & 13130 & 20\\ \hline Test Set 4 & 15000 & 30\\ \hline Test Set 5 & 18270 & 50\\ \hline \end{tabular} \end{center} \end{table} \subsection{Base Detectors} Base detectors refer to the individual components of an ensemble technique. The base detectors are strategically combined to make ensemble techniques' output robust. The base detectors could consist of different kinds of learning algorithms of any number depending on the problem and adopted strategy \cite{le2021anomaly, ganaie2021ensemble}. The base detectors adopted for all ensemble methods in this work are OCSVM, OCNN, and IF. OCSVM is an unsupervised anomaly detection technique that learns a decision function for separating the normal class from anomalies in a dataset. OCSVM has been employed for ICS anomaly detection in \cite{raghuraman2021detecting, zhang2019anomaly, aboah2022plc}. OCNN is an unsupervised machine learning algorithm for anomaly detection formulated on the foundation of OCSVM \cite{aboah2022plc}. OCNN has been employed for anomaly detection in \cite{chalapathy2018anomaly}, although its application in ICS is very limited \cite{boateng2021anomaly, aboah2022plc}. IF is also an unsupervised machine learning technique that builds an ensemble of binary trees for a given dataset for anomaly detection \cite{liu2008isolation, hariri2019extended}. IF has been utilized to successfully detect anomalies in ICS \cite{elnour2020hybrid, togbe2020anomaly, aboah2022plc}. The ensemble methods proposed in this work use different voting strategies for combining OCSVM, OCNN, and IF outputs. \subsection{Ensemble-Based Detection Approach} Ensemble learning is a technique for combining the outputs of multiple algorithms to create an improved output. The three different anomaly detection techniques mentioned in the subsection above make independent assumptions about the nature of the dataset, which may not be the case for every dataset. Ensemble learning techniques have been successfully employed in various data mining and supervised machine learning applications such as classification and recommender systems \cite{sayadi2018ensemble, dong2020survey, forouzandeh2021presentation}. However, unsupervised ensemble analysis is a recent field in anomaly detection, especially in ICS, with little work on combining anomaly detection algorithms \cite{aggarwal2017introduction}. This work seeks to extend the knowledge of ensemble-based detection approaches for anomaly detection in ICS. This section discusses five proposed ensemble-based anomaly detection techniques that combine the outputs of the three base detectors, namely, OCSVM, OCNN, and IF. Ensemble learning is generally challenging in the context of anomaly detection because of the unsupervised nature or labeled data unavailability \cite{aggarwal2017introduction}. Another challenge is the coherent combination of base detectors' decision scores, as base detectors may have different objective and scoring functions. Figure~\ref{fig2} shows a general representation of the proposed ensemble approach. Algorithm \ref{alg:one} and Algorithm \ref{alg:two} summarize the general approach to training and testing the proposed ensemble methods in this work. The major changes in each method relate to combining the scores of the base detectors and making final predictions, as described in the following subsections. \begin{figure}[!t] \centering \includegraphics[width=9 cm]{images/fig2.png} \caption{General Representation of Ensemble Approach} \label{fig2} \end{figure} \begin{algorithm} \caption{Anomaly detection ensemble algorithm training} \label{alg:one} \begin{algorithmic}[1] \renewcommand{\algorithmicrequire}{\textbf{Input:}} \renewcommand{\algorithmicensure}{\textbf{Output:}} \REQUIRE Input dataset $\{X_i|i=1,2,3...,n\}$ \ENSURE Decision score $S_i$ \\ \textit{Training Phase} : \FOR {($k$ algorithm in base detectors)} \STATE Let $L_k$ be empty list of base detector decision scores \FOR{(data point $X_i$ in training dataset $X$)} \STATE Make prediction (anomaly score $S_{k}(i)$) \STATE Append decision score to the list: $L_k \gets S_{k}(i)$ \ENDFOR \STATE {Normalize both positive and negative scores: \\ $S_{k}^{'}(i)$ = $\frac{L_{k_i} - \min{(L_{k})}}{\max{(L_k)} - \min{(L_k)}}$} \STATE {Store normalization feature range: \\ $F_{k_{norm}} = \min{(L_{k})}, \max{(L_k)}$} \ENDFOR \STATE Concatenate normalized scores $S_{k}^{'}(i)$ of base detectors as new multidimensional dataset, $D$ with $d_k(i) \in D$ \STATE Let $S_i$ be the final ensemble prediction of data point $i$ \FOR {$i$-th data point $d_k(i)$ in $D$} \STATE Make final prediction \\ \small{\texttt{/* Voting function is method specific */}} \ENDFOR \IF{$(S_i \geq 0)$} \STATE $X_i$ is normal instance \ELSE \STATE $X_i$ is anomalous instance \ENDIF \end{algorithmic} \end{algorithm} \begin{algorithm} \caption{Anomaly detection ensemble algorithm testing} \label{alg:two} \begin{algorithmic}[1] \renewcommand{\algorithmicrequire}{\textbf{Input:}} \renewcommand{\algorithmicensure}{\textbf{Output:}} \REQUIRE New data point $X$ \ENSURE Decision score $S_t$ \\ \textit{Testing Phase} : prediction on new data points \FOR {($k$ algorithm in base detectors)} \STATE Make prediction (anomaly score $S_{k}(T)$) for $T$ \STATE Normalize $S_{k}(T)$ using $F_{k_{norm}}$ \STATE $S_{k}^{'}(T) \gets$ norm($S_{k}(T)$) \ENDFOR \STATE Concatenate normalized scores of base detectors \STATE Make final test prediction \\ \small{\texttt{/* Voting function is method specific */}} \IF{$(S_t \geq 0)$} \STATE $T$ is normal instance \ELSE \STATE $T$ is anomalous instance \ENDIF \end{algorithmic} \end{algorithm} \subsubsection{Majority-Vote Ensemble Method} This hard voting strategy is a majority-vote ensemble that selects the mode of the base detectors' predictions. The majority vote ensemble techniques for supervised machine learning classifiers have been widely studied in the literature \cite{aggarwal2017introduction, brown2010good, geron2017hands}. The approach in this work adopts a similar strategy in \cite{aggarwal2017introduction} with an additional normalization mechanism for purposes of unsupervised anomaly detection. The base detectors provide decision scores for each data point in the training set during training. The decision scores are converted into binary predictions of either normal or anomaly based on the scoring function in \eqref{eq1}. Ultimately, the majority prediction by the base detectors becomes the final output of the observations in the training set. Similarly, during testing, each trained base detector predicts the new observation. The mode of the predictions becomes the new observation's final class (either normal or anomaly). This method follows Algorithm \ref{alg:one} and Algorithm \ref{alg:two} for training and testing by using the following voting function for $S_i$, where $S_i$ is the final ensemble prediction and $S_{k}^{'}(i)$ is the normalized positive and negative decision scores \begin{equation} \label{eq1} S_i \gets \textrm{mode}(S_{k}^{'}(i)). \end{equation} The majority vote ensemble detection method often achieves a higher anomaly detection rate than the best base detector in the ensemble \cite{aggarwal2017introduction}. In situations where the base detectors are weak detectors, this ensemble technique can still provide good performance \cite{aggarwal2017introduction}. The majority vote ensemble method is a naive approach with several challenges. In some cases where the majority of the base detectors have related objective functions, there is a high likelihood that this ensemble technique will make biased decisions. This ensemble technique's high bias in prediction is evident in results achieved in this work, as discussed in section 5. In order to minimize the majority vote ensemble's bias effect, the next subsection introduces an ensemble anomaly detection technique based on the maximum score over all base detectors. \subsubsection{Maximum-score Ensemble Method} In the case of the maximum-score ensemble method, the final anomaly score of a data point is its maximum decision score over all base detectors. Lal et al. \cite{lal2019orfdetector} employed a maximum-score based ensemble method for online fraud detection. However, in this work, the maximum decision score over all base detectors is \begin{equation} \label{eq2} \textrm{Maximum}(i) = \max_{k=1}^{n}S_{k}(i) \end{equation} where $S_k$ is the anomaly score of a base detector $k$. During training, the scores of each base detector are normalized between the range of $[0, 1]$ and the normalization parameters (feature range) are saved. The base detector with the highest normalized score gets to decide the final anomaly score of the ensemble based on \eqref{eq2}. During testing phase, the base detectors predictions on new data points are normalized based on the training data normalization feature range. Subsequently, the base detector with the highest normalized score becomes the ensemble detector's final anomaly score. Maximum-score ensemble approach follows Algorithm \ref{alg:one} and Algorithm \ref{alg:two} for training and testing by using a voting function of \eqref{eq2}. The effect of maximum-score ensemble learning is more complex because it can often improve bias but increase variance. This challenge makes the overall effect unpredictable \cite{aggarwal2017introduction}. In order to combat the high variance effect of this technique, the next section introduces a soft voting ensemble technique for anomaly detection. \subsubsection{Soft Voting Ensemble Anomaly Detection Technique} The soft voting ensemble anomaly detection technique reports the average decision scores of all base detectors as data points final scores. Soft voting ensemble methods based on scores averaging have been widely studied in the literature \cite{aggarwal2017introduction, geron2017hands, fathi2019improving}. The approach adopted in this work follows a similar technique in \cite{aggarwal2017introduction}, in order to compare its performance to other novel unsupervised methods proposed in this work. In this work, positive and negative decision scores of the base detectors are normalized during training, and the anomaly score of the $ith$ data point is computed as \begin{equation} \label{eq3} \textrm{Average}(i) = \frac{\displaystyle\sum_{k=1}^{n}S_k(i)}{n} \end{equation} During testing phase, base detectors' decision scores are normalized using the maximum and minimum normalization feature values of the training dataset, and the average is computed as the final score. If the average score is negative, the data point is an anomaly; otherwise, the data point is a normal instant. The soft voting ensemble approach follows Algorithm \ref{alg:one} and Algorithm \ref{alg:two} for training and testing by using a voting function of \eqref{eq3}. The intent of averaging the normalized scores is to reduce the variance of the scores and thereby improve accuracy. \subsubsection{Weighted Voting Ensemble Technique} The proposed weighted voting technique is an ensemble technique that produces a combined output prediction based on weights applied to the scores of the base detectors. The challenge of the soft voting technique for combining base detectors outputs is the appropriate weight assignment to each base detector. The work in \cite{aggarwal2017introduction,paulheim2015decomposition} show that uncorrelated features with all other features in a dataset are less relevant. Hence, uncorrelated scores violate the model of normal data dependencies. This work introduces a new generalized method of assigning weights to the base detectors based on statistical coefficient of determination (R-squared). Each base detector is trained on the training set to produce an anomaly score for each data point in the training set. The decision scores for each base detector are normalized according to Algorithm \ref{alg:one}, and concatenated to form features of a new training set. In this approach, the voting function in Algorithm \ref{alg:one} is replaced by a linear regression model. The linear regression model is used to predict each of the features from the other features and computes the root-mean-squared error $RMSE_{f_i}$ of predicting the $f_i$ feature from the other features. The weighted voting ensemble method can take an arbitrary learning model other than linear regression model such as decision tree regressor \cite{rokach2005decision}, K-nearest neighbor \cite{peterson2009k} and ridge regression \cite{mcdonald2009ridge}. Irrelevant features will produce larger $RMSE_{f_i}$ \cite{aggarwal2017introduction, paulheim2015decomposition}, and hence larger $RMSE_{f_i}$ leads to lower associated feature weight. Next, each feature weight $f_i$ of the new training set is given by $ W_{f_i} = \max{(0, 1-RMSE_{f_i})}$. The weights $W_{f_i}$ of each feature are multiplied by the respective feature set $f_i$ to produce a weighted score for each feature. Finally, the maximum of the weighted features becomes the final anomaly score. Similarly, during prediction on a new data point after training, outputs of the base detectors are normalized and multiplied by the weights, $W_{f_i}$ obtained during training before the maximum score is selected as the new instance's final decision score. The challenge with using $RMSE_{f_i}$ is that it works on the assumption that predicted scores of each base detector are normalized, making it difficult to scale or generalize to any arbitrary base detector. This work further proposes the use of R-squared (coefficient of determination) value $R^2$, as the weight of each feature $f_i$ instead of $\max{(0, 1-RMSE_{f_i})}$. The $R^2$-value measures the level of explainability of predicting each feature from other features. It is easy and intuitive to calculate the $R^2$-value, and most importantly, it produces result in the range between 0 and 1 regardless of the input data scale. Higher $R^2$-value is better. $R^2$-value has a direct relationship with $MSE_{f_i}$ as \begin{equation*} \label{eq4} R^{2}_{f_k} = 1 - \frac{MSE_{f_k}}{Var(y)} \end{equation*} where \begin{equation*} MSE_{f_k} = \frac{1}{N} \displaystyle\sum_{n=1}^{N} (y_i - f(x_i))^2 \end{equation*} and \begin{equation*} \textrm{var}{(y)} = \displaystyle\frac{1}{N} \sum_{n=1}^{N} (y_i - E[y])^2 \end{equation*} where $\textrm{var}(y)$ represents the total sum of squares (outcome response variance), $y_i$ is the target (ground truth scores), $x_i$ represents the dependent variables which are the features in this case, and $E[y]$ is average of $y$. The proposed approach for assigning weights to the output scores of the base detectors is summarized in Algorithm \ref{alg:three}. Substituting the voting function in Algorithm \ref{alg:one} with Algorithm \ref{alg:three} provides a complete Algorithm for the proposed weighted voting ensemble technique. The proposed weighted voting ensemble technique is a flexible algorithm because, instead of using the maximum of the weighted features as the final anomaly score in this work, the average of the weighted features could be used as the final anomaly score. \begin{algorithm} \caption{WV ensemble technique voting function} \label{alg:three} \begin{algorithmic}[1] \renewcommand{\algorithmicrequire}{\textbf{Input:}} \renewcommand{\algorithmicensure}{\textbf{Output:}} \REQUIRE Dataset $D$, with $d_k(i) \in D$ \ENSURE Decision score $S_i$ \\ \textit{Testing Phase} : prediction on new data points \FOR {(each feature $L_k$ in $D$)} \STATE predict $L_{k_i}$ from other features using linear regression \STATE $W_{L_k} \gets R^{2}_{L_k}$ \ENDFOR \STATE $S_i \gets \max(W_{L_1} \times L_{1}, W_{L_2} \times L_{2}, \cdots, W_{L_k} \times L_{k})$ \end{algorithmic} \end{algorithm} \subsubsection{Stacking-based Anomaly Detection Approach} This work proposes a new stacking-based anomaly detection architecture to identify ICS anomalies. The approach adopted here uses a meta-detector, often called blender, to best learn how to combine the output scores of the base detectors to produce robust, stable, and accurate results. First, each base detector is trained independently on the training dataset. The base detectors have different scoring functions; hence their outputs are normalized as described in Algorithm \ref{alg:one}. The normalized outputs of the base detectors are used as input (training data) to the meta-detector to learn the best way to combine the normalized scores to produce a robust anomaly detection model. \begin{figure}[!t] \centering \includegraphics[width=8 cm]{images/fig3.png} \caption{Stacking-based anomaly detection architecture} \label{fig3} \end{figure} IF is used as the meta-detector for learning the new training set because the detection problem is still unsupervised, so labeled classes of the training data are assumed to be unavailable. Again, IF is a robust and fast anomaly detection algorithm that builds a homogeneous binary tree ensemble for a given dataset \cite{aboah2022plc}. Figure~\ref{fig3} shows the architecture of the proposed stacking-based anomaly detection approach. Replacing the voting function in Algorithm \ref{alg:one} with a layer of IF meta-detector described in this section results in the complete algorithm for this proposed technique. Each base detector provides an independent normalized score for the new data point during model prediction after training, which serves as input to the meta-detector. Finally, the meta-detector provides a combined score for the new data point to determine whether it is a normal data point or an anomaly. Table~\ref{tab2} shows optimal hyperparameters used to develop the IF meta-detector. \begin{table} \begin{center} \caption{Model hyperparameters for IF meta-detector in Figure~\ref{fig3}} \label{tab2} \begin{tabular}{| c | p{4.5cm} | c |} \hline \textbf{Parameter} & \textbf{Description} & \textbf{value} \\ \hline $n_{estimators}$ & Number of base estimators in the forest ensemble & 100\\ \hline $n_{max}$ & Number of training samples to draw to train each estimator & 256\\ \hline contamination & Proportion of outliers in the data set & 0.007\\ \hline \end{tabular} \end{center} \end{table} \section{Results and Discussions} The evaluation is based on performance metrics, results from predictions on the test data, and comparison with prior work trained on a similar dataset. Google's Tensorflow \cite{tensorflow2015-whitepaper}, an open-source deep learning library, is used for training and performing inference on the base detectors. Evaluation results and performance metrics calculations are performed by using the Scikit-learn library \cite{scikit-learn}. The dataset used to develop the proposed methods in this work is the HMI historian log of operations at PLC memory addresses. The data is obtained through Modbus communication protocol between the PLC and HMI. The performance metrics for evaluating the proposed anomaly detection models are derived from the confusion matrix. Four evaluation outcomes are derived from the confusion matrix: true positive (TN), true negative (TN), false positive (FP), and false negative (FN). These outcomes are used for calculating the accuracy, precision, recall, and F1-score of anomaly detection models as described in \cite{aboah2022plc}. The results presented in this section use the visualization approach proposed in \cite{aboah2022plc, boateng2022new} to better understand ensemble algorithms' performance. The histogram-based visualization approach normalizes the histogram frequency (y-axis) to a range between $0\%$ and $100\%$, whereas the x-axis represents the normalized decision scores indicating the prediction confidence. After investigating various hyperparameter ranges, the three base detectors, OSCVM, OCNN, and IF, are trained with optimal hyperparameters. The optimal hyperparameters for the base detectors are presented in \cite{aboah2022plc}. \subsection{Performance of Majority-Vote Ensemble Method} The majority-vote ensemble method performed well on test set 1 by having precision, recall, and F1-score of $90\%$, $91\%$, and $90\%$ respectively. The algorithm achieved a recall and F1-score of $88\%$ and $84\%$ respectively on test set 2, which are similar to the recall and F1-score values of test set 3. However, the algorithm's high recall and F1-score rate on test set 2 resulted from its high anomaly detection rate on the normal data points at the expense of high false positive rate. The algorithm finds it challenging to detect anomalies involving anomalous scenarios 1 and 3. Performance of the algorithm decreases on test sets 4 and 5 as the recall values decreased to $82\%$ and $71\%$ respectively. Figure~\ref{fig4} shows the majority-vote ensemble method results of the normalized TP, TN, FP, and FN values on test sets 1 and 3. Because of the algorithm's binary prediction outcome, it is impossible to visualize and assess prediction confidence levels, unlike other ensemble approaches proposed in this work. Figure~\ref{fig4} shows that although the algorithm's TN predictions are less than $50\%$, the levels of FN predictions are low at values below $10\%$. However, the algorithm has high levels of FP in the range above $50\%$ for test sets 1 and 2. The visualization of the algorithm performance on test sets 3-5 is similar to Figure~\ref{fig4}. \begin{figure}[!t] \centering \includegraphics[width=9 cm]{images/fig4.png} \caption{Majority-vote ensemble method results of the normalized TP, TN, FP, and FN values on test sets 1 and 3} \label{fig4} \end{figure} \subsection{Performance of Maximum-score Ensemble Method} Maximum-score ensemble method performance on test sets 1 and 2 are high with F1-scores of $90\%$ and $95\%$ respectively. This method has the same precision, and recall values as the majority-vote method on test set 1. However, this method significantly performs well on test set 2 as compared to the majority-vote method by having precision and recall values of $96\%$ and $94\%$ respectively. The algorithm's performance on test sets 3 and 5 is similar to majority-vote method. F1-scores for test sets 3 and 5 are $85\%$ and $71\%$, respectively. This method has its worst performance on test set 4, with recall and F1-scores of $66\%$ and $58\%$ respectively. In effect, the maximum-score ensemble method has low detection performance on TLIGHT system anomalies involving timing bits manipulation. Figure~\ref{fig5} shows the maximum-score ensemble method results of the normalized TP, TN, FP, and FN values on test sets 1-4. \begin{figure}[!t] \centering \includegraphics[width=9 cm]{images/fig5.png} \caption{Maximum-score ensemble method results of the normalized TP, TN, FP, and FN values on test sets 1-4} \label{fig5} \end{figure} Maximum-score ensemble method has TP values above $60\%$ in test sets 1-4 and high TP scores confidence in test sets 1-3. The method detected all anomalies in test set 2 by having a TN value of $100\%$, which explains its high performance on test set 2. Figure~\ref{fig5} shows that the method misclassified over $95\%$ of test set 4 anomalies as normal instances, which resulted in high FP and low TN values. The visualization of the algorithm performance on test set 5 is similar to test set 4, and therefore it is not shown here. \subsection{Performance of Soft Voting Ensemble Method} Soft voting ensemble method achieved high performance on test set 1 with a precision, recall, and F1-score of $89\%$, $90\%$, and $89\%$ respectively. The method's performance on test sets 1 and 2 are similar, with F1-scores of $83\%$ and $84\%$ respectively. However, the method has low performance on test sets 4 and 5, with F1-scores in both cases below $60\%$. The method's low performance on test sets 4 and 5 signifies its inability to detect timing bits anomalies. Figure~\ref{fig6} shows the soft voting ensemble method results of the normalized TP, TN, FP, and FN values on test sets 1, 2, 3, and 5. \begin{figure}[!t] \centering \includegraphics[width=9 cm]{images/fig6.png} \caption{Soft voting ensemble method results of the normalized TP, TN, FP, and FN values on test sets 1, 2, 3, and 5} \label{fig6} \end{figure} Soft voting ensemble method has a TP prediction confidence over $50\%$ on test sets 1 and 2. Again, the method correctly predicted the TLIGHT system's normal behavior in all test cases by having TP predictions over $60\%$. However, the method misclassified all anomalies in test set 2 as normal instances leading to a high FP rate of $100\%$, which explains the low performance of the algorithm on test set 2. The method's confidence levels of TP and FP predictions on test set 5 are below $50\%$. Also, over $80\%$ of anomalies in test set 5 are misclassified as normal instances leading to high FP rate. The visualization of the algorithm performance on test set 4 is similar to test set 5, and therefore it is not shown here. \subsection{Performance of Weighted Voting Ensemble Method} The weighted voting ensemble method uses an ordinary least squares regression model for assigning weights to the base detectors. The weighted voting with ordinary least squares regression model WV-OLS has a similar performance to soft voting ensemble method on all datasets. The method achieved its highest performance on test set 1 with precision, recall, and F1-score of $89\%$. The method's performance on test set 2 and 3 are similar, with F1-scores of $83\%$ and $84\%$ respectively. This method has its lowest performance on test sets 4 and 5, with F1-scores below $60\%$. The method's low performance on test sets 4 and 5 signifies its inability to detect anomalies in timing bits. Figure~\ref{fig7} shows the WV-OLS ensemble method results of the normalized TP, TN, FP, and FN values on test sets 3 and 4. \begin{figure}[!t] \centering \includegraphics[width=9 cm]{images/fig7.png} \caption{WV-OLS ensemble method results of the normalized TP, TN, FP, and FN values on test sets 3 and 4} \label{fig7} \end{figure} The WV-OLS method correctly predicted the TLIGHT system's normal behavior in all test sets with a TP score over 60\%. The method's confidence of TP and FP predictions on test set 3 is over $50\%$, whereas the confidence of the TP and FP predictions on test set 4 is below $50\%$. The visualization of the algorithm performance on test sets 1 and 2 are similar to test set 3, whereas the visualization of the algorithm performance on test sets 5 is similar to test set 4, and therefore they are not shown here. The method misclassified over $80\%$ of anomalies as normal in test set 4 leading to high FP. The method's high FP value on test set 4 explains its low performance on test set 4. WV-OLS ensemble method performance is lower than maximum score ensemble method. The WV-OLS ensemble method's low performance results from the similarities between OCSVM and OCNN objective functions which makes their errors correlated. OCNN is formulated based on the foundation of OCSVM optimization problem \cite{aboah2022plc}; hence WV-OLS method's assigned weights are biased towards OCSVM and OCNN. Figure~\ref{fig8} shows the decision scores of WV-OLS base dectectors on 20 anomalous samples of test set 4. In each of the 20 anomalous samples, a negative score is desired to signify correct prediction. However, the OCSVM base detector misclassifies the anomalous test samples by producing positive scores for all 20 anomalous test samples. The OCNN base detector misclassifies more than 50\% of the anomalous test samples. On the contrary, the IF base detector correctly detects more than 60\% of the anomalous test samples. Similar misclassifications of anomalous test samples by the OCSVM and OCNN base detectors were observed across all test sets, explaining the low performance of the WV-OLS approach to weighted voting. \begin{figure}[!t] \centering \includegraphics[width=9 cm]{images/fig8.png} \caption{WV-OLS base detectors predictions on 20 anomalous samples of test set 4} \label{fig8} \end{figure} In an attempt to control the WV-OLS method's high bias, the ordinary least squares linear regression model for assigning weights in Algorithm \ref{alg:three} can be replaced by a ridge regression model \cite{rokach2005decision} or K-nearest neighbor model \cite{peterson2009k}. The resulting weighted voting approaches using these learning models are denoted WV-Ridge and WV-KNN, respectively. The proposed weighted voting method using different linear regression models are compared with the weighted voting approach found in \cite{aggarwal2017introduction}. WV-\cite{aggarwal2017introduction} uses RMSE for assigning weights to the base detectors. Table~\ref{tab3} shows accuracy, precision, recall, and F1-score for the four weighted voting approaches. The WV-OLS approach shows no significant improvement over WV-Ridge and weighted voting method in previous work \cite{aggarwal2017introduction}. WV-OLS, WV-Ridge, and WV-\cite{aggarwal2017introduction} all use linear models for assigning weights to base detectors' output; therefore, the same fundamental limitation associated with the bias of OCSVM and OCNN base detectors holds. However, WV-KNN outperforms WV-\cite{aggarwal2017introduction}, WV-OLS, and WV-Ridge on test sets 1, 2, and 5 across all performance metrics. WV-KNN achieved over 7\% improvement in accuracy, precision, recall, and F1-score on test set 2 as compared to WV-\cite{aggarwal2017introduction}, WV-OLS, and WV-Ridge. WV-KNN achieved high performance because it relies on distance in the feature space instead of making a linear assumption about the dataset. \begin{table} \begin{center} \caption{Performance comparison of weighted voting ensemble methods} \label{tab3} \begin{tabular}{| p{0.8cm} | p{1.3cm} | p{1.0cm} | p{1.0cm} | p{0.9cm} | p{1.1cm} |} \hline \textbf{Dataset} & \textbf{WV Method} & \textbf{Accuracy} & \textbf{Precision} & \textbf{Recall} & \textbf{F1-Score}\\ \hline Test & WV-\cite{aggarwal2017introduction} & 0.89 &0.88 &0.89 & 0.89\\ Set & WV-OLS & 0.89 &0.89 &0.89 & 0.89\\ 1 & WV-Ridge & 0.89 &0.89 &0.89 & 0.89\\ & WV-KNN & \textbf{0.90} & \textbf{0.91} & \textbf{0.90} & \textbf{0.90}\\ \hline Test & WV-\cite{aggarwal2017introduction} & 0.85 &0.81 &0.85 & 0.83\\ Set & WV-OLS & 0.86 & 0.81 & 0.86 & 0.83\\ 2 & WV-Ridge & 0.86 &0.81 &0.86 & 0.83\\ & WV-KNN & \textbf{0.94} & \textbf{0.96} & \textbf{0.94} & \textbf{0.95}\\ \hline Test & WV-\cite{aggarwal2017introduction} & 0.85 &0.83 &0.85 & 0.84\\ Set & WV-OLS & 0.85 &0.84 &0.85 & 0.84\\ 3 & WV-Ridge & 0.85 &0.84 &0.85 & 0.84\\ & WV-KNN & 0.85 &0.85 &0.85 & \textbf{0.85}\\ \hline Test & WV-\cite{aggarwal2017introduction} & 0.67 &0.56 &0.67 & 0.58\\ Set & WV-OLS & \textbf{0.67} & \textbf{0.56} & \textbf{0.67} & 0.58\\ 4 & WV-Ridge & 0.67 &0.56 &0.67 & 0.58\\ & WV-KNN & 0.66 &0.55 &0.66 & 0.58\\ \hline Test & WV-\cite{aggarwal2017introduction} & 0.58 &0.67 &0.58 & 0.51\\ Set & WV-OLS & 0.57 &0.67 &0.57 & 0.50\\ 5 & WV-Ridge & 0.57 &0.67 &0.57 & 0.50\\ & WV-KNN & \textbf{0.73} & \textbf{0.77} & \textbf{0.73} & \textbf{0.71}\\ \hline \end{tabular} \end{center} \end{table} Figure~\ref{fig9} shows WV-KNN ensemble method results of the normalized TP, TN, FP, and FN values on test sets 2 and 5. WV-KNN correctly detects all anomalies in test set set with over 25\% prediction confidence. Also, WV-KNN correctly detects over 70\% of normal data points with 100\% prediction confidence leading to high TP value in test set 2. WV-KNN's high anomaly detection on test set 2 explains why it achieves over 90\% accuracy, precision, recall, and F1-score. WV-\cite{aggarwal2017introduction}, WV-OLS, and WV-Ridge are unable to detect more than 20\% of anomalies in test set 5. However, WV-KNN detects over 50\% of anomalies in test set 5 which explains why WV-KNN has over 10\% improved accuracy, precison, recall, and F1-score as compared to WV-\cite{aggarwal2017introduction}, WV-OLS, and WV-Ridge. The visualization of WV-KNN performance on test 1 and 3 are similar to WV-OLS visualization on test set 3 in Figure~\ref{fig7}. The visualization of WV-KNN performance on test set 4 is similar to the WV-OLS visualization on test set 4 in Figure~\ref{fig7}, and therefore it is not shown here. Lastly, WV-\cite{aggarwal2017introduction} and WV-Ridge performance visualizations across all test sets are similar to those of WV-OLS in Figure~\ref{fig7}, and therefore they are not shown here. \begin{figure}[!t] \centering \includegraphics[width=9 cm]{images/fig9.png} \caption{WV-KNN ensemble method results of the normalized TP, TN, FP, and FN values on test sets 2 and 5} \label{fig9} \end{figure} \subsection{Performance of Stacking-based Ensemble Method} Stacking based ensemble method uses an IF meta-detector to consider the results of the base detectors. This method has excellent performance on all test sets. It achieved its highest performance on test sets 2 and 4 by having the same precision, recall, and F1-score of $97\%$, $96\%$, and $96\%$, respectively. Unlike other ensemble methods described in previous sections, the stacking-based ensemble has high performance on test sets 4 and 5 with recall values of $96\%$ and $92\%$ respectively. The method's performance shows its ability to detect TLIGHT signals anomalies and its robustness in detecting timing bits anomalies. The method had its worst performance on test set 3 with a recall and F1-score of $87\%$ and $86\%$ respectively. The high performance of the stacking-based ensemble method is due to the IF meta-detector's ability to extract significant information from the base detectors in an unsupervised learning manner. Figure~\ref{fig10} shows the stacking-based ensemble method results of the normalized TP, TN, FP, and FN values on test sets 1, 2, 4, and 5. \begin{figure}[!t] \centering \includegraphics[width=9 cm]{images/fig10.png} \caption{Stacking-based ensemble method results of the normalized TP, TN, FP, and FN values on test sets 1, 2, 4, and 5} \label{fig10} \end{figure} This method correctly predicted all anomalies in test 2 with high prediction confidence and TN value of $100\%$, which explains why it attained an F1-score of $96\%$. This method correctly predicted TLIGHT system normal behavior with TP value over $70\%$ at $100\%$ prediction confidence in all test sets. Again, in all test sets, over $70\%$ of TN predictions have prediction confidence over $50\%$. A closer assessment of Figure~\ref{fig10} confirms that not only is the stacking-based method excellent at detecting anomalies, but in all test cases, the method is confident about its decisions. The visualization of the algorithm performance on test sets 3 is similar to test set 1, and therefore it is not shown here. Figure~\ref{fig11} shows the average performance of the ensemble methods with their respective standard deviations on the five test sets. Stacking-based ensemble and IF \cite{aboah2022plc} have the least standard deviations $<$ 0.07 on all performance metrics across all test sets. WV \cite{aggarwal2014algorithms}, WV-OLS, WV-Ridge, and soft-voting methods have the high standard deviations $>$ 0.1 as a result of their poor performance on test sets 4 and 5. Table~\ref{tab4} provides a performance summary of all ensemble methods explored in this work. It is evident from Table~\ref{tab4} that stacking-based ensemble method has superior performance over all test sets. \begin{figure}[!t] \centering \includegraphics[width=9 cm]{images/fig11.png} \caption{Average performance of ensemble methods with their respective standard deviations} \label{fig11} \end{figure} \begin{table*} \begin{center} \caption{Average performance summary of ensemble methods} \label{tab4} \begin{tabular}{| p{2.3cm} | p{0.8cm} p{0.8cm} | p{0.8cm} p{1cm} | p{0.8cm} p{0.8cm} | p{1.2cm} p{0.8cm} |} \hline & \textbf{Accuracy} & & \textbf{Precision} & & \textbf{Recall} & & \textbf{F1-score} &\\ \textbf{Technique} & Mean & std & Mean & std & Mean & std & Mean & std \\ \hline IF \cite{aboah2022plc} & 0.880 & 0.062 & 0.886 & 0.054 & 0.880 & 0.062 & 0.874 & 0.066\\ \hline Majority-vote & 0.838 & 0.070 & 0.840 & 0.040 & 0.838 & 0.070 & 0.814 & 0.076 \\ \hline Maximum-score & 0.816 & 0.105 & 0.808 & 0.144 & 0.816 & 0.105 & 0.798 & 0.135 \\ \hline Soft-voting & 0.772 & 0.124 & 0.752 & 0.125 & 0.772 & 0.124 & 0.730 & 0.154 \\ \hline WV-\cite{aggarwal2017introduction} & 0.768& 0.121& 0.750& 0.118& 0.768& 0.121& 0.730 & 0.154\\ \hline WV-OLS & 0.768 & 0.126 & 0.754 & 0.121 & 0.768 & 0.126 & 0.728 & 0.157 \\ \hline WV-Ridge & 0.768 & 0.126 & 0.754 & 0.121 & 0.768 & 0.126 & 0.728 & 0.157 \\ \hline WV-KNN & 0.816 & 0.105 & 0.808 & 0.144 & 0.816 & 0.105 & 0.798 & 0.135 \\ \hline Stacking & \textbf{0.926} & 0.033 & \textbf{0.926} & 0.039 & \textbf{0.926} & 0.033 & \textbf{0.924} & 0.037 \\ \hline \end{tabular} \end{center} \end{table*} \subsection{Comparison with Previous Work} An anomaly detection performance comparison between individual unsupervised machine learning detectors using the same dataset is presented in \cite{aboah2022plc}. The unsupervised ensemble methods proposed here strategically aggregates the decision scores of the three methods examined in \cite{aboah2022plc}. This section compares the average performance of the proposed unsupervised ensemble techniques with the reported results of the highest performing algorithm in \cite{aboah2022plc} across all test sets. First, the comparison is performed across test sets 1-3, which consisted of TLIGHT system signal anomalies, excluding timing bits anomalies. Figure~\ref{fig12} shows the average test sets 1--3 performance proposed ensemble methods in this work and the reported results of IF in \cite{aboah2022plc}. Soft-voting, WV-OLS, WV-Ridge and WV-\cite{aggarwal2017introduction} methods have similar average accuracy, precision, recall, and F1-score. Majority vote and WV-KNN have similar average accuracy, precision, recall, and F1-score. The stacking ensemble method and IF \cite{aboah2022plc} algorithm achieve the same average accuracy, precision, recall, and F1-score of $92\%$. Therefore, the stacking approach and IF \cite{aboah2022plc} have similar detection performance on TLIGHT system anomalies, excluding timing bit anomalies. Stacking ensemble and IF \cite{aboah2022plc} have superior performance to all other ensemble techniques. \begin{figure}[!t] \centering \includegraphics[width=9 cm]{images/fig12.png} \caption{Average test sets 1--3 performance of the proposed ensemble methods in this work and the reported results of IF in \cite{aboah2022plc}} \label{fig12} \end{figure} Test sets 4--5 consist of timing bits anomalies unique to \cite{aboah2022plc} and this work. Figure~\ref{fig13} shows the average performance comparison between the ensemble methods presented in this work and the reported results of IF algorithm in \cite{aboah2022plc} on test sets 4--5. Soft-voting maximum-score, WV-\cite{aggarwal2017introduction}, WV-OLS, and WV-Ridge methods have relatively similar average accuracy, and precision on test sets 4--5 which were inferior to WV-KNN and maximum vote ensemble methods. Stacking-based ensemble achieves the same average accuracy, precision, recall, and F1-score of $92\%$, whereas IF \cite{aboah2022plc} achieves the same average accuracy, precision, recall, and F1-score of $82\%$. Overall, stacking-based ensemble method achieves outstanding performance on all evaluation metrics on test sets 4--5. The stacking-based ensemble method's high performance on all test sets compared to previous work \cite{aboah2022plc} upholds the motivation of this work: effective unsupervised ensembling of anomaly detection algorithms could result in a robust detection model capable of identifying anomalies in arbitrary datasets. \begin{figure}[!t] \centering \includegraphics[width=9 cm]{images/fig13.png} \caption{Average test sets 4--5 performance of the proposed ensemble methods in this work and the reported results of IF in \cite{aboah2022plc}} \label{fig13} \end{figure} Stacking-based ensemble methods for classification purposes using supervised machine learning meta-detectors were examined in \cite{xia2018novel, el2018using, akhtar2019diagnosis, javan2019intelligent, ahmed2020exploring, williams2019variable}. However, a direct comparison between the proposed stacking-based ensemble method in this work and the works in \cite{xia2018novel, el2018using, akhtar2019diagnosis, javan2019intelligent, ahmed2020exploring, williams2019variable} is unrealistic because of the unsupervised ensemble approach adopted in this work for anomaly detection purposes. In order to validate the results for the best performing algorithm, stacking-based ensemble method is compared with previous work trained and evaluated on the same TLIGHT system dataset by using statistical hypothesis test. Statistical hypothesis testing is employed to validate and ensure fair comparison between the stacking ensemble method and previous work. Table~\ref{tab3} compares the average performance of the best algorithm in \cite{aboah2022plc} with the proposed stacking algorithm in this work. Statistical evidence about the best-performing technique is conducted using one-way analysis of variance (ANOVA) in order to determine if there is any significant difference between the average performance of the method in this work and that of previous work \cite{aboah2022plc}. F1-score is selected as an evaluation metric in the hypothesis test because it measures the balance between precision and recall. The following assumptions are made about the ICS dataset \begin{itemize} \item data points in each test sample identically distributed and independent; and \item data points in each test sample are normally distributed. \end{itemize} Additionally, the hypotheses for the statistical test are \begin{itemize} \item null hypothesis $(H_0)$: The mean F1-scores of all anomaly detection models are equal; and \item alternate hypothesis $(H_a)$: One or more of the mean F1-score of the anomaly detection models are unequal. \end{itemize} Anomaly detection performance of the stacking-based ensemble in this work and the IF in \cite{aboah2022plc} are evaluated on twenty different test samples of the exact sizes as test sets 1-5. Furthermore, each model's F1-score is computed on the twenty different samples of each test set. Results from one-way ANOVA test shows an $F\ value$ of 42.54, and a p-value $<$ 0.001. Since the p-value is below 0.05, one-way ANOVA provides significant evidence to reject the null hypothesis. Rejecting the null hypothesis means there is a significant difference between IF \cite{aboah2022plc} and stacking-based ensemble with $95\%$ confidence level. Because performance comparison is between two algorithms, one-way ANOVA results are sufficient to conclude that the stacking-based ensemble method outperforms IF \cite{aboah2022plc}. \subsection{Practical Considerations and Limitations} The unsupervised ensemble methods presented in this work can be implemented in real-world PLC-based ICS infrastructure. One way is to adapt the experimental approach in this work, or the approach in \cite{aboah2022plc} by serializing the trained ensemble models onto a separate computer with a data pipeline to the HMI historian and PLC memory addresses to receive data and perform real-time anomaly detection. Alternatively, the proposed methods can be implemented on both legacy and embedded PLCs by adapting a similar process outlined in \cite{aboah2022plc}. That is, the trained ensemble models can be compiled to C code using open-source compilers \cite{unlu2020efficient, OliverUrbann}. The resulting C code should be readily portable to dedicated embedded or general-purpose processors \cite{urbann2020ac} for real-time anomaly detection. Although this work proposes robust unsupervised ensemble techniques for anomaly detection in ICS, some limitations are associated with the proposed methods. First, ensembling OCSVM, OCNN, and IF base detectors make the proposed methods in this work expensive in terms of time and storage. That large amount of memory is required to store outputs of the base detectors and their ensemble output during training and testing. Moreover, the high time complexities of the proposed methods result from the effective summation of the base models' time complexities and the time required for the voting function in each method to compute the final anomaly score. Despite the stacking-based method's superior performance in all test cases, its IF meta-detector still requires hyperparameter tuning to achieve such robust performance. Lastly, the proposed WV-OLS has a fundamental limitation of high bias in situations where two or more base detectors have similar objective functions. The high bias effect is reduced by using a KNN learning algorithm for assigning the weights. In practice, a learning algorithm for the weighted voting method should be selected based on its ability to handle non-linear features and has low bias. \section{Conclusion} This work proposes five unsupervised ensemble anomaly detection techniques: majority-vote, maximum-score, soft voting, weighted voting, and stacking-based ensemble methods, specifically for anomaly detection in ICS. The proposed techniques incorporate OCSVM, OCNN, and IF base detectors for learning representations from the input dataset and voting strategy algorithms for combining the representations into final prediction scores. Dataset from a previously studied TLIGHT ICS system is used to train and evaluate the proposed algorithms. Majority-vote and maximum-score ensembles outperform soft-voting and WV-OLS with $5\%$ higher average accuracy, precision, and recall on all test datasets. The WV-OLS ensemble method's lower performance relative to majority vote and maximum score methods is because of OCSVM and OCNN's similar objective functions. As a result, the WV-OLS method's assigned weights are biased towards OCSVM and OCNN, leading to a biased outcome. Changing the weighted-voting learning algorithm to KNN results in an improved performance which was at par with majority-vote ensemble method. Stacking-based ensemble outperform all other ensemble methods with $10\%$ higher average accuracy, precision, recall, and F1-score on all test datasets. Unlike other ensemble methods, which struggle to detect timing bits anomalies, stacking-based ensemble has excellent detection performance on timing bits anomalies. Not only does stacking-based ensemble produce high anomaly detection performance, but the approach is confident about all predictions. A hypothesis test involving analysis of variance is used to compare stacking-based ensemble method with previous work. The hypothesis test indicates that stacking-based ensemble outperforms previous work trained on the same dataset. The high performance of the stacking-based ensemble method on all evaluation metrics compared to previous work justifies the motivation of this work: effective unsupervised ensembling of anomaly detection algorithms could result in a robust detection model capable of identifying anomalies in arbitrary ICS datasets. Future work would be as follows: \begin{itemize} \item optimizing the weighted voting ensemble learning algorithm to mitigate its fundamental limitation of high bias in situations where two or more base detectors have similar objective functions and have correlated errors; and \item extending the proposed ensemble methods to detecting anomalies in ICS network layer. \end{itemize} \bibliographystyle{IEEEtran}
\subsection{Working Model Estimation} The estimations in the conditional outcome mean model and the propensity model are vital for estimating optimal DTRs. Researchers can construct parametric models with subject-relevant knowledge or just use some nonparametric models like random forest, generalized additive model. Specifically, Bayesian additive regression trees (BART) values as a great candidate because it requires minimal specification of the model and can approximate complex functions well with a tree ensemble \citep{BART}. Nonparametric Kernel Smoothing Methods are also frequently used to fit propensity model \citep{np}. \subsection{Doubly Robust Estimator of the Individualized Effect Curve} We simplify the notation of $\theta_i(a)$ to $\theta(a)$ when it causes no confusions, as we estimate effect curves $\theta_i(a), i=1,2,...,N$ for all samples. To derive doubly robust estimators for $\theta(a)$, we adapt semiparametric theory in a novel way similar to the approach of \citealp{Rubin2005} and \citealp{Kennedy_2016}. Our goal is to find a function $\xi(\bm{Z}{;}\pi,\mu,\kappa)$ of the observed data $\bm{Z}$ and nuisance functions $(\pi,\mu)$ with doubly robustness, which means $\mathbb{E}\{ \xi(\bm{Z}{;}\pi^*,\mu^*,\kappa) \lvert A=a\} = \theta(a)$ if either $\pi^* = \pi$ or $\mu^* = \mu$ (no necessarily both). Here $\kappa = \mathbb{E} K(\bm{X})$ is a constant when the kernel function $K$ is fixed. According to the semiparametric theory, a doubly robust mapping is related to the efficient influence function for a certain parameter. If $\mathbb{E}\{ \xi(\bm{Z}{;}\pi^*,\mu^*,\kappa) \lvert A=a\} = \theta(a)$, then it follows $\mathbb{E}\{ \xi(\bm{Z}{;}\pi^*,\mu^*,\kappa)\} = \psi$ for $\psi = \mathbb{E} \theta(a) = \int_{\mathscr{A}} \theta(a)w(a) da$, where $w(a)$ is the marginal probability density function of treatment $A$. This indicates that a component of the efficient influence function for the parameter $\psi$ can be a candidate for the doubly robust mapping $\xi(\bm{Z}{;}\pi,\mu,\kappa)$\citep{robins2001, vanderlaan2003}. We derive the efficient influence function for $\psi$ as follows: \begin{theorem}[Efficient Influence Function] Under a semiparametric model, $\xi - \psi + (\mathbb{E} K_i(\bm{X}))^{-1} \int_{\mathscr{A}}[\mu(\bm{X},a)K_i(\bm{X}) - m(a)]w(a)da$ is the efficient influence function for $\psi = \int_{\mathscr{A}} \theta_i(a)w(a) da$, where $w(a) = \int_{\mathcal{X}}\pi(a\lvert x)dP(x), m(a) = \int_{\mathcal{X}}\mu(x,a ) K_i(\bm{x}) dP(x)$ and $$\xi(\bm{Z}{;}\pi,\mu) = (\mathbb{E} K_i(\bm{X}))^{-1} [\frac{Y-\mu(\bm{X},A)}{\pi(A\mid \bm{X})}w(A)K_i(\bm{X}) + m(A)].$$ \end{theorem} Based on this, we propose a new estimator $\xi$, which is a component of the efficient influence function of $\psi$, and further prove its doubly robustness. \begin{theorem}[Doubly Robustness] The proposed estimator $\xi$ has the doubly robust property: if $\pi^{*}=\pi$ or $\mu^{*} = \mu$, then we have $$\mathbb{E} \{\xi(\bm{Z}{;}\pi^{*},\mu^{*},\kappa)\lvert A=a\} = \theta(a).$$ \end{theorem} So as long as one of conditional outcome mean model $\mu$ or propensity model $\pi$ is correctly specified (not necessarily both), our estimator $\xi$ will be unbiased for $\theta(a)$. \subsection{Individual Level Effect Curve Estimation} With the doubly robust mapping $\xi(\bm{Z}{;}\pi,\mu,\kappa)$ derived in the previous subsection, for which $\theta_i(a) = \mathbb{E}\{ \xi(\bm{Z}{;}\pi^{*},\mu^{*},\kappa) \lvert A=a\}$ as long as $\pi^* = \pi$ or $\mu^* = \mu$, we can construct doubly robust estimate $\hat{\xi}(\bm{Z}{;}\hat{\pi},\hat{\mu},\hat{\kappa})$ and regress on treatment variable $A$. The local linear kernel version of the estimator is $\hat{\theta}_b(a) = \gamma_{ba}(a)\hat{\beta}_b(a)$, where $$\hat{\beta}_b(a) = \operatorname*{arg\,max}_{\beta\in\mathbb{R}^2} \mathbb{P}_n [K_{ba}(A)\{\hat{\xi}(\bm{Z}{;}\hat{\pi},\hat{\mu},\hat{\kappa}) - \gamma_{ba}(a)^T\beta \}^2], \gamma_{ba}(A) = (1,(A-a)/b)^T,$$ for $K_{ba}(t) = b^{-1} K\{ (t-a)/b \}$, with K a standard kernel function and $b$ a scalar bandwidth parameter. Then we have the close form for estimation of $\theta_i(a)$: $$\hat{\theta}_i(a) = \gamma_{ba}(a)^T \hat{\bm{D}}^{-1}_{ba} \mathbb{P}_n\{ \gamma_{ba}(A) K_{ba}(A) \hat{\xi}(\bm{Z}{;}\hat{\pi},\hat{\mu},\hat{\kappa}) \}, $$ where $\hat{\bm{D}}^{-1}_{ba} = \mathbb{P}_n\{ \gamma_{ba}(a) K_{ba}(A) \gamma_{ba}(a)^T\}$. We will show the asymptotic bias and normality of the proposed individual level effect curve $\hat{\theta}(a)$: \begin{theorem}[Asymptotic Bias Analysis] Let $\pi^{*}$ and $\mu^{*}$ denote fixed functions to which $\hat{\pi}$ and $\hat{\mu}$ converge in the sense that $\sup\lvert\hat{\pi}- \pi^{*}\rvert = o_p(1) $ and $\sup\lvert\hat{\mu}- \mu^{*}\rvert = o_p(1)$, and let $a \in \mathcal{A}$ denote a point in the interior of the compact support $\mathcal{A}$ of treatment $A$. Assume $[ \mu(\bm{X},t) - \hat{\mu}(\bm{X},t)][ \pi(t\lvert\bm{X}) - \hat{\pi}(t\lvert\bm{X}) ] = O_p(r_n)$, along with several regularity assumptions (see Appendix), we have: (a) Either $\pi^{*}=\pi$ or $\mu^{*}=\mu$, where $\mu$ and $\pi$ are the true conditional outcome model and propensity model respectively. (b) The bandwidth $b=b_n$ satisfies $b\to0$ and $nb^3 \to \infty$ as $n\to \infty$. (c) $K$ is a continuous symmetric probability density. (d) $\theta(a)$ is twice continuously differentiable, and both $\pi(a)$ and the conditional density of $\xi(Z{;} \pi, \mu)$ given $A = a$ are continuous as functions of $a$. (e) The estimators $(\hat{\pi}, \hat{\mu},\hat{\kappa})$ and their limits $(\pi, \mu,\kappa)$ are contained in uniformly bounded function classes with finite uniform entropy integrals (as defined in Section 4 of the Appendix), with $1/\hat{\pi}$, $1/\pi$, $1/\hat{\kappa}$ and $1/\kappa$ also uniformly bounded. $$\hat{\theta}_b(a) - \theta(a) = O_p(\frac{1}{\sqrt{nb}} + b^2 + r_n).$$ \end{theorem} Here $O_p(r_n)$ denotes the convergence rate of conditional outcome model and propensity model. Since our first assumption is one of two models are correctly specified, without loss of generality, let us assume the conditional outcome mean model is correctly specified while propensity model not, i.e., $\pi^{*} \not =\pi$ and $\mu^{*}=\mu$. Then $\hat{\mu}-\mu = \hat{\mu}-\mu^* = O_p(r_n)$ and $\hat{\pi}-\pi = O_p(1)$, because the latter one is biased but still bounded. Thus $( \mu - \hat{\mu})( \pi - \hat{\pi} ) = O_p(r_n)$ represent the convergence rate of the correctly specified model, when one of them might be biased. In the next theorem we show that when one or both of $\hat{\pi}$ and $\hat{\mu}$ are estimated with fast enough convergence, then the proposed estimator is asymptotically normal after scaling. \begin{theorem}[Asymptotic Normality] Along with the same assumptions in theorem 2.3, also assume the convergence rate $r_n$ satisfies $r_n = o_p(1/\sqrt{nb})$, then we have $$ \sqrt{nb} \{\hat{\theta}_b(a) - \theta(a) + bias(a) \} \overset{d}{\to} N(0,\frac{\sigma^2(a) \int K^2(u)du}{w(a)}), $$ where $bias(a) = \theta''(a)(b^2/2)\int u^2K(u)du + o(b^2)$, and $$ \begin{aligned} \sigma^2(a) &= \mathbb{E} \{ [\xi(\bm{Z}{;}\pi^{*},\mu^{*},\kappa)- \theta(a)]^2 \mid A=a \} \\ &= \kappa^{-2} \mathbb{E}\left[ \frac{var \{ Y \lvert \bm{X},A=a\} + \{ \mu(\bm{X},a) - \mu^{*}(\bm{X},a) \}^2}{\{ \pi^{*}(a\lvert\bm{X}) / w^{*}(a) \}^2 / \{ \pi(a\lvert\bm{X}) / w(a) \} } \right] - \{\theta(a) - \kappa^{-1}m^{*}(a)\}^2. \end{aligned} $$ \end{theorem} With all assumptions satisfied, we can see that the mean square error of $\hat{\theta}$ is $O(1/nb + b^4)$ and the variance-bias trade-off determines the theoretical optimal bandwidth $b \sim n^{-1/5}$. As for data-driven bandwidth selection, we treated $\hat{\xi}$ as known and used leave-one-out cross-validation bandwidth selection \citep{bandwidth}: $$\hat{b}_{opt} = \argmax_{b} \sum_{i=1}^n \left\{ \frac{\hat{\xi}(\bm{Z}_i{;}\hat{\pi},\hat{\mu}) - \hat{\theta}_b(A_i) }{1-\hat{W}_b(A_i)} \right\}^2,$$ where $\hat{W}_b(a_i) = (1,0)\mathbb{P}_n\{\bm{\gamma}_{ba_i}(A)K_{ba_i}(A)\bm{\gamma}^T_{ba_i}(A) \}^{-1}(1,0)^Tb^{-1}K(0)$ is the $i^{th}$ diagonal element of the hat matrix. \subsection{Notation} Suppose the data $\{(\bold{X}_t,A_t,R_t)_{t=1}^T\}$ is independent and identically distributed with sample size $n$ and comes from either a randomized trial or an observational study, where $t \in \{ 1,2,\dots ,T\}$ denotes the $t^{th}$ stage, $\bold{X_t}$ denotes the patient characteristics during $t^{th}$ stage, $A_t \in \mathscr{A}_T$ denotes a bounded continuous treatment variable and $R_t$ denotes the reward of current stage following $A_t$. Let $\bold{H}_t$ denote patient history before treatment assignment $A_t$, i.e., $\bold{H}_t = \{(\bold{X}_v,A_v,R_v)_{v=1}^{t-1},\bold{X_t} \}$. We consider the long term outcome of interest as $Y = \psi(R_1,\dots, R_T)$, where $\psi$ is a prespecified function (e.g., sum of $R_i$ or last value $R_T$). We denote a DTR, a sequence of individualized treatment decisions, as $g = (g_1,\dots,g_T)$, where $g_t$ maps from patient history $\bold{H}_t$ to a continuous treatment $A_t$. To define an optimal DTR, we use the counterfactual outcome framework of causal inference in a backward way. At the final stage $T$, let $Y^*(A_1,\dots, A_{T-1}, a_T )$, or $Y^*(a_T)$ for brevity, denotes the counterfactual outcome had a patient been treated with $A_T=a_T$ conditional on previous treatments $(A_1,...,A_{T-1})$, and define $Y^*(g_T):=Y^*(g_T(\bold{H}_T))$ as the counterfactual outcome under the regime $g_T$. The performance of $g_T$ can be evaluated by the value function $V(g_T)$ \citep{QianMurphy}, which is defined as the mean counterfactual outcome had all patients followed $g_T$, i.e., $V(g_T):= E{Y^*(g_T )}$. Therefore, the optimal rule $g_{opt}$ should satisfy $V(g_{opt}) \geq V(g_T)$ for all $g_T \in \mathscr{G}_T$, where $\mathscr{G}_T$ denotes the set of all possible rules of interest. To identify the optimal DTRs, we make the standard assumptions to link the distribution law of counterfactual data with that of observational data \citep{murphy2001}. First, we assume the consistency, i.e., the observed outcome is the same as the counterfactual outcome under the assigned treatment, i.e., $Y = Y^*(A_T)$. Secondly, we assume no unmeasured confounding assumption (NUCA), i.e., $A_T \perp \!\!\! \perp \mathscr{Y}_T \mid \bold{H}_T$, where $\mathscr{Y}_T = \{Y^*(a_T): a_T \in \mathscr{A}_T \}$ and $\perp \!\!\! \perp$ denotes statistical independence. We also assume positivity of the probability density function $f_{A_T}$, i.e., $f_{A_T}(a) > \epsilon >0$, $\forall a \in \mathscr{A}_T$. Finally, we assume the continuity of the counterfactual outcome mean, i.e., $\mathbb{E}Y^*(a_T)$ is continuous about $a_T \in \mathscr{A}_T$. Under these assumptions, the optimal rule at stage T can be written as \begin{equation*} g_{T}^{opt} = \argmax_{g_T \in \mathscr{G}_T } E_{\bold{H}_{T}} \Big [ E[Y\mid A_T = g_T(\bold{H}_{T}),\bold{H}_{T}] \Big]. \end{equation*} At an intermediate stage $t$ ($1\leq t \leq T-1$), we consider $Y^*(A_1,A_2,\dots,g_t,g_{t+1}^{opt},\dots,g_{T}^{opt} )$, the counterfactual outcome under optimal rules for all future stages, had a patient following $g_t$ at stage $t$, given $A_1,\dots,A_{t-1}$ \citep{Moodie2012}. Similarly, under the four assumptions above, the optimal rule $g^{opt}$ at stage t can be defined as \begin{align*} g_t^{opt} =& \argmax_{g_t \in \mathscr{G}_t } E_{\bold{H}_{t}} [Y^*(A_1,A_2,\dots,g_t,g_{t+1}^{opt},\dots,g_{T}^{opt} )]\\ =& \argmax_{g_t \in \mathscr{G}_t } E_{\bold{H}_{t}} \Big [ E[\Tilde{Y}_t\mid A_t = g_t(\bold{H}_{t}),\bold{H}_{t}] \Big], \end{align*} where $\mathscr{G}_t$ is the set of all potential rules at stage $t$, $\Tilde{Y}_T = Y$ at stage $T$, and can be defined recursively using Bellman's optimality at an earlier stage $t$: \begin{equation*} \Tilde{Y}_t = E\Big[ \Tilde{Y}_{t+1}\mid A_{t+1} = g_{t+1}^{opt}(\bold{H}_{t+1}), \bold{H}_{t+1} \Big]. \end{equation*} A dynamic treatment regime $g$ consists of treatment rules at all treatment stages $t\in \{1,2,\dots,T\}$. The aim is to find the optimal treatment decision rules $g^{opt} = (g_1^{opt},\dots,g_T^{opt})$, such that when followed by the targeted patient population, the average response outcome $Y$ conditional on individual history is optimized. In the above sections we have already introduced treatment regime optimization with single stage. When it is extended to multistage scenario, for each stage t, we just need to replace the outcome $Y$ with $\Tilde{PO}_{t}(a_t) := \hat{E}(\Tilde{Y}_t\mid A_t = a_t, \bold{H}_{t})$ and replace the covariates $\bold{X}$ with patient history $\bold{H}_{t}$. \subsection{Notation} We use non-greedy tree-based learning to search for a global optimal decision tree. Following last section's algorithm, the individual level outcome $\theta_i(a)$, $i \in \{1,2,...,N\}$, $a \in \mathscr{A}$, is estimated with $\hat{\theta}_i(a)$ as the input of supervised learning. In this section, we will simplify $\hat{\theta}_i(a)$ to $\theta_i(a)$ for brevity, because it is treated as the known ground truth. Then the question can be formalized to fit an optimal and interpretable continuous treatment decision tree $g: \bm{X} \to A$, to maximize the objective function: $L(g) = \sum_{i=1}^{N} \theta_i(g(\bm{X}))$. Regular tree regression algorithms such as CART are developed in a greedy manner. They grow from top-down without backtracking, determining all input variables and split rules locally to optimize the current purity function. However, greedy algorithms have potential limitations such as failing to update parent nodes once they have a child node and the fact that the cumulative local optimal rules do not necessarily lead to a global optimal rule. Greedy algorithms are likely to miss stronger splits if they are hidden behind weaker ones, resulting in sub-optimal or overly complicated trees \citep{greedy1}. To overcome these limitations, we use a non-greedy algorithm called Tree Alternating Optimization \citep{TAO} to search for the global optimum with iterative optimization. Given a decision tree, we can optimize any node and keep the rest of the tree structure unchanged. By alternating optimization over the depth levels of the tree, the decision tree can optimize its structure, escape from local optima, and is more likely to converge to the global optimum than if it were to keep optimizing based on sub-optimal prior nodes. Figure 1 shows a comparison between greedy trees and non-greedy trees. \paragraph{Optimization at internal node} Consider an internal node (non-leaf) and the corresponding subset of samples $\mathscr{S}$, our target is to find the optimal partition rule $\eta$ which divides $\mathscr{S}$ into two parts $\omega$ and $\mathscr{S} \backslash \omega$. It is important to note that each element in $\mathscr{S}$ will eventually be assigned to one of the children, and both children and their descendants are fixed decision trees denoted as $g^{left}$ and $g^{right}$. If $\bm{X}$ is classified to the left child, it will be assigned to treatment $g^{left}(\bm{X})$, otherwise, it will be assigned to treatment $g^{right}(\bm{X})$. The optimization of $\eta$ can be reduced to a supervised classification problem where we seek the optimal rule $\eta$ that maximizes the surrogate objective function and partitions the current sample subset $\mathscr{S}$ into two parts $\omega$ and $\mathscr{S} \backslash \omega$: \begin{equation*} \max_{\eta} W(\eta) = \max_{\eta} \sum_{\substack{ \bm{X}_i \in \omega }} \theta_i\{g^{left}(\bm{X}_i)\} + \sum_{\substack{ \bm{X}_i \in \mathscr{S} \backslash \omega}} \theta_i\{g^{right}(\bm{X}_i)\}. \end{equation*} The node update rule in GoDoTree is based on the idea of simulated annealing, which allows us to avoid getting trapped at a local optimum by introducing a probabilistic element into the decision-making process. Specifically, let $\eta_j, j=1,2,\dots,p$, denote the optimal splitting rule if the $j$ th variable is fixed as the classifier to maximize $W(\eta)$ for the current node, then the node update rule is $P(\eta = \eta_j) = exp\{ \alpha_t W(\eta_j)\} /\sum_{k=1}^p exp\{ \alpha_t W(\eta_k)\}$, where $\alpha_t$ is a increasing sequence about the iteration number $t$. \begin{figure}[H] \caption{Comparison between greedy tree and non-greedy tree algorithms. Greedy tree optimizes the current objective function and cannot update nodes once they are constructed, while the proposed approach, Tree Alternating Optimization (TAO), is a non-greedy tree search that can update any node in the tree at any time, with other nodes fixed. TAO can alternate optimization over depth levels of the tree and escape from local optima. The classifier used for partitioning is denoted as $\delta$.} \centering \includegraphics[scale=0.5]{Figure/TAO_CART.pdf} \end{figure} \paragraph{Optimization at leaf node} As for the prediction part, our target is to optimize the parameter $\eta = a \in \mathscr{A}$ so as to maximize the surrogate objective function $W(\eta) = \sum_{ \bm{X}_i \in \mathscr{S}} \theta_i(\eta)$. Samples classified to the same leaf node will be assigned to the same dose $\eta$. \paragraph{TAO algorithm framework} After updating the rule for each node, global optimization of the tree can be achieved through alternating optimization over the depth levels of the tree. The depth levels are cycled in the order root-leaf-root until convergence, with the criteria for convergence being either a numerically converging objective function or a fixed tree topology for several iterations. Pruning is not performed until convergence, and when the decision tree converges, any leaf node with a size smaller than a pre-specified number $n_0$ will be collapsed with its sibling nodes. \begin{algorithm}[tbh] \caption{Tree alternating optimization} \begin{algorithmic}[1] \State Initialize a decision tree with height h, set t=0. \While{not converge} \For{\texttt{i in 1 to h}} \Comment{root to leave} \For{\texttt{every node in height i}} \State Find the optimal splitting rule $\eta_k$ when k th variable is used as predictor. \State Find current loss function W($\eta_k$). \State Update node parameter $\eta$ with probability $P(\eta = \eta_j) = \frac{ exp( \alpha_t W(\eta_j)) }{\sum_{k=1}^p exp( \alpha_t W(\eta_k))}$. \EndFor \EndFor \For{\texttt{every leaf node}} \State Find the optimal treatment. \EndFor \For{\texttt{i in h to 1}} \Comment{leave to root} \State Do the same as row 4-7. \EndFor \State t = t+1 \EndWhile\label{euclidendwhile} \end{algorithmic} \end{algorithm} \section{Introduction} \label{sec:intro} A dynamic treatment regime (DTR) is a sequence of decision rules that determine the optimal treatment for individual patients at multiple stages. Treatment decisions are based on each patient's unique characteristics and medical history to optimize their long-term clinical outcomes. With the emergence of precision health care, DTRs with continuous dosage treatment have become increasingly important, allowing for personalized optimal dosage intervention. Examples include optimal dose finding in radiation oncology therapy and drug trials with multiple stages. Although black box learning methods like random forest and deep learning can produce accurate predictions of the optimal treatments, their lack of interpretability makes them difficult for medical experts to understand and implement. Conventional tree learning methods such as CART are easy to interpret and predict, but they often use greedy algorithms that can fail to converge to the global optimum or achieve high performance under certain circumstances. Additionally, while most research on dynamic treatment regimes has focused on selecting the optimal treatment type, there is limited knowledge on DTRs with continuous dose finding. Another challenge is how to maintain desirable properties like doubly robustness and asymptotic normality for continuous dose finding in DTR settings. The literature on evaluating dynamic treatment regimes is extensive and can be divided into two categories for finding the optimal tree-based DTR. One approach is to use supervised learning methods, which involve estimating the optimal treatment first and then transforming it into tree versions (known as the treatment-tree algorithm). Several algorithms are commonly used for optimal treatment estimation, including Q-learning (e.g. \citealp{Qlearning}), Marginal Structural Models (e.g. \citealp{MSM}), and Outcome Weighted Learning (e.g. \citealp{OWL}). However, most of these methods require a correct specification of working models for the propensity model or the conditional outcome mean model, which can be challenging to validate with limited knowledge. Therefore, a method with doubly robustness, which can ensure consistent estimation as long as one of two models is correctly specified, is desirable. The other tree-based learning approach is searching for trees with the best performance, also known as creating a new tree and evaluating its performance under the optimal treatment (denoted as the tree-treatment algorithm). However, this approach often relies on either random/stochastic search, which lacks efficiency (e.g. \citealp{STRL}), or greedy search, which may converge to a local optimum and fail to find the global optimum as it only maximizes the current purity measure (e.g. \citealp{TRL}). In other words, both approaches have limitations, with the treatment-tree algorithm relying on stochastic or greedy search and most treatment-tree algorithms not being doubly robust. Therefore, we aim to propose a treatment-tree algorithm with doubly robustness that avoids stochastic/greedy tree learning and applies a non-greedy algorithm. The second challenge arises when developing an individualized causal inference algorithm for continuous treatment dosage with doubly robustness. The majority of published papers about DTRs deal with categorical treatment assignment. While there are some algorithms that can estimate doubly robust causal effects and find optimal continuous treatment at the population level, these methods require the use of a tree-treatment algorithm, which necessitates the decision of the study population before the algorithms can be applied. As a result, stochastic or greedy searching cannot be avoided. Alternatively, some methods can estimate the optimal continuous treatment at the individual level by optimizing a well-designed objective function. However, these methods are not robust as some depend on the correct specification of the conditional outcome model, while others rely on the correct specification of the propensity model \citep{LZ,CZK}. Therefore, we aim to propose a new method for causal inference that can achieve individualized optimal dose with doubly robustness. To overcome the aforementioned challenges, we introduce a new method called Global Optimal Dosage Tree-based learning (GoDoTree), which is a non-greedy tree-based optimization technique that estimates optimal DTRs in a multi-stage continuous-treatment environment, using data from randomized trials or observational studies to provide personalized intervention with patient-specific medicine dosage. At each stage, GoDoTree constructs a decision tree by first modeling an individual-level counterfactual treatment effect curve via semiparametric regression models, and then performing a non-greedy tree-based search to optimize the counterfactual treatment effect. The two main components of GoDoTree, namely individual-level counterfactual outcome estimation and tree learning, are implemented in a backward manner at every stage to optimize the long-term objective function. The proposed GoDoTree has several advantages, including great interpretability, doubly robustness, and the ability to achieve global optimal DTRs. It also contributes to the existing literature on the development of DTRs with continuous treatment. To demonstrate the performance of GoDoTree, we conduct simulation studies to show its global optimization ability and apply it to warfarin dosing data collected from \citealp{warfarin}. This paper is structured as follows. Section 2 introduces the proposed method for individualized counterfactual outcome estimation. In Section 3, we describe non-greedy tree-based supervised learning, which allows for a global optimal tree search with known counterfactual outcome for every sample. The details of finding the optimal kernel function are presented in Section 4. Section 5 formalizes the problem of estimating optimal DTRs with continuous treatment and outlines the framework of our algorithm. In Sections 6 and 7, we present the results of numerical studies and an application example, respectively. Finally, we provide a concluding discussion in Section 8. \section{Individualized Counterfactual Outcome Estimation With Continuous Dosage}\input{Counterfactual_Outcome} \label{chapter2} \section{Global Optimal Tree Search Algorithm} \input{Tree_search} \section{Implementation: Search For Optimal Kernel} \input{Implement} \section{Optimal Dose Finding in Dynamic Treatment Regimes} \input{DTR_setting} \section{Simulations}\input{Simulation} \section{Real Application for Optimal Warfain Dose Finding } \input{Real_application} \section{Discussion}\input{Discussion} \bibliographystyle{apalike}
\section{Introduction} Spiking Neural Networks (SNNs), known as the third generation of artificial neural networks~\cite{Wolfgang1997}, have shown distinctive properties and remarkable advantages of temporal information processing capability and high biological plausibility~\cite{roy2019towards}. As each neuron delivers binary spikes only when the membrane potential reaches the threshold, the calculation in SNNs has the property of high-sparsity and multiplication-free, which brings unique advantages of low power consumption on neuromorphic chips~\cite{schemmel2010wafer,furber2012overview,merolla2014million,davies2018loihi,pei2019towards,debole2019truenorth}. Despite these, it remains challenging to train high-performance and low-latency SNNs. Generally, two main approaches are proposed to train deep SNNs: (1) backpropagation with surrogate gradient~\cite{neftci2019surrogate,kim2020unifying}, (2) ANN-SNN conversion~\cite{cao2015spiking,rueckauer2016theory}. Unlike the surrogate gradient-based learning method that requires more GPU computing than ANN training, ANN-SNN conversion directly trains a source ANN and then converts it to an SNN by replacing the ReLU activation with IF neurons, which is regarded as the most effective way to train deep SNNs. Although ANN-SNN conversion can achieve comparable performance as ANNs on large-scale datasets, it often requires large time-steps to match the firing rates of SNNs to the activation value of ANNs. There is still a performance gap between ANNs and SNNs under the condition of low latency. Many researchers have made great efforts to eliminate these errors to achieve high-performance converted SNNs with low latency~\cite{han2020rmp,ding2021optimal,ho2021tcl,deng2020optimal,li2021free,li2022quantization}. However, unevenness error~\cite{bu2022optimal}, which refers to the deviation caused by different temporal sequences of spike arrival on activation layers, has not been effectively resolved and seriously suffers the performance of converted SNNs. In this paper, by analyzing and deducing the distribution of unevenness error, we propose an optimization strategy based on residual membrane potential (SRP), which can decrease unevenness error and improve network performance effectively under low latency. Our main contributions are summarized as follows: \begin{itemize} \item[1] We divide unevenness error into four cases according to the outputs of ANNs and SNNs. We systematically analyze the distribution of unevenness error under these four cases and point out that the case of the ANN output being zero while the SNN output being larger than zero accounts for the largest percentage. \item[2] We theoretically establish the mathematical relationship between residual membrane potential and the specific case of unevenness error, and propose an optimization strategy based on residual membrane potential to reduce unevenness error. \item[3] We demonstrate the effectiveness of the proposed method on CIFAR-10/100, and ImageNet. Our method outperforms previous state-of-the-art and shows remarkable advantages on all tested datasets and network structures. \item[4] We show that our method is compatible with other ANN-SNN conversion methods and remarkably improves the performance when the time-steps are small. \end{itemize} \section{Related Work} Due to the non-differentiable property of the spike firing mechanism, the training of SNNs is not as easy as ANNs. In recent years, two mainstream training methods have been proposed and widely used in obtaining deep SNNs.\\ \textbf{Supervised learning of SNNs}. To overcome the non-differentiable problem, smoothing and surrogate gradient methods \cite{huh2017gradient,jin2018hybrid,wu2018STBP,shrestha2018slayer,zenke2018superspike,bellec2018long,neftci2019surrogate} have been proposed. These models maintain the network architecture unchanged in forward propagation and replace the Heaviside function of membrane potential with a differentiable function in back-propagation. On this basis, many researchers began to improve the performance of SNNs by analyzing the surrogate gradients~\cite{Zenke2020.06.29.176925,li2021differentiable}, designing appropriate network structures~\cite{zheng2021going,fang2020incorporating} and loss functions~\cite{deng2022temporal,guo2022recdis}, and using trainable membrane time constant~\cite{fang2020incorporating}. Event-driven learning is another type of learning method, which makes better use of the temporal information in SNNs based on the differentiation of spike firing time. SpikeProp~\cite{bohte2002error} was the first event-driven supervised learning algorithm for SNNs, which aimed to use linear smoothing approximation to overcome the non-differentiable problem of the relative membrane potential in spike firing time. Kheradpisheh et al.~\shortcite{kheradpisheh2020temporal} set the gradient as $-1$ to train shallow networks. To improve temporal learning precision, Zhang et al.~\shortcite{zhang2020temporal} attempted to retain inter-neuron and intra-neuron dependencies. By calculating the presynaptic and postsynaptic spike firing time, Mostafa et al.~\shortcite{mostafa2017supervised} and Zhou et al.~\shortcite{zhou2021temporal} constructed new continuous activation function, which directly avoids non-differentiable problem. Kim et al.~\shortcite{kim2020unifying} combined rate-coding and temporal-coding together in the back-propagation of SNNs. Despite these, the activation-based methods consume a lot of memory and computation, while the event-driven methods are limited to shallow networks.\\ \textbf{ANN-SNN Conversion}. ANN-SNN Conversion aims to map the parameters of the pretrained ANNs to SNNs and reduce the performance loss as much as possible. Cao et al.~\shortcite{cao2015spiking} firstly trained ANNs with the ReLU activation function and then replaced the activation layers with spiking neurons. As the firing rate is not precise enough to match the output of respective activation layers in ANNs, researchers have proposed many optimization methods to reduce conversion error. Diehl et al.~\shortcite{diehl2015fast} attempted to narrow the gap between ANNs and SNNs by scaling and normalizing weights. Rueckauer et al.~\shortcite{Bodo2017Conversion} proposed the ``reset-by-subtraction" mechanism to retain the temporal information, which was also adopted in the following work~\cite{han2020rmp,deng2020optimal,bu2022optimal}. Besides, many works focused on improving the performance by adopting various mechanism to dynamically adjust the threshold \cite{Bodo2017Conversion,sengupta2019going,han2020rmp,ding2021optimal,stockl2021optimized,ho2021tcl,wu2021tandem}. Kim et al.~\shortcite{kim2020spiking} pointed out that lossless conversion can be realized when the time-step is sufficiently long. Therefore, recent works focused on improving performance under the condition of short time-steps by optimizing the weights, biases~\cite{deng2020optimal,li2021free} and initial membrane potential~\cite{Bu2022OPI}, utilizing burst spikes~\cite{li2022efficient} and memory function~\cite{wang2022signed}, and designing quantization clip-floor-shift activation function for ANNs~\cite{bu2022optimal}. Although these methods can achieve high performance with few ($4-8$) time-steps on the CIFAR-10/100 datasets, they usually take large number of time-steps (usually $>16$) to achieve comparable performance as ANNs on complex dataset like ImageNet, due to the effects of unevenness error. This paper aims to reduce unevenness error and obtain high-accuracy and ultra-low-latency SNNs on complex dataset. \section{Preliminary} \subsection{Neuron Model} \textbf{ANN neurons.} For ANNs, the output $\boldsymbol{a}^l$ of neurons in layer $l$ is realized by a linear weighting and a nonlinear mapping: \begin{align} \boldsymbol{a}^l=f(\boldsymbol{W}^{l}\boldsymbol{a}^{l-1}). \label{ann} \end{align} where $\boldsymbol{W}^{l}$ refers to the weights between layer $l$ and layer $l-1$. $f(\cdot)$ is the nonlinear activation function, which is often set as ReLU function.\\ \textbf{SNN neurons.} For SNNs, we consider the commonly used Integrate-and-Fire (IF) model~\cite{diehl2015fast,sengupta2019going,han2020rmp,deng2020optimal,bu2022optimal}, the dynamics of which can be described by: \begin{align} \boldsymbol{v}^{l}(t) &= \boldsymbol{v}^{l}(t-1) + \boldsymbol{W}^{l}{\theta}^{l-1} \boldsymbol{s}^{l-1}(t)-{\theta}^{l} \boldsymbol{s}^{l}(t). \label{equ02} \end{align} where $\boldsymbol{v}^{l}(t)$ denotes the membrane potential of neurons in layer $l$ at time-step $t$, $\boldsymbol{W}^{l}$ refers to the weights between layer $l$ and layer $l-1$, and ${\theta}^l$ is the firing threshold of neurons in layer $l$. $\boldsymbol{s}^{l}(t)$ denotes the binary output spikes of neurons in layer $l$ at time-step $t$, which is defined as: \begin{align} \boldsymbol{s}^{l}(t) &= H(\boldsymbol{u}^{l}(t) - {\theta}^{l}). \label{equ03} \end{align} where $\boldsymbol{u}^{l}(t)=\boldsymbol{v}^{l}(t-1) + \boldsymbol{W}^{l} {\theta}^{l-1} \boldsymbol{s}^{l-1}(t)$ denotes the membrane potential of neurons before the trigger of a spike at time-step $t$, $H(\cdot)$ is the Heaviside step function. The output spike $\boldsymbol{s}^{l}(t)$ equals 1 if the membrane potential $\boldsymbol{u}^{l}(t)$ is larger than the threshold ${\theta}^l$ and otherwise 0. Note that in Eq.~\eqref{equ02}, we use the “reset-by-subtraction” mechanism~\cite{Bodo2017Conversion} to reduce information loss, which means the membrane potential $\boldsymbol{v}^l(t)$ is subtracted by the threshold value ${\theta}^l$ if the neuron fires. \subsection{ANN-SNN Conversion} \textbf{Relate ANN to SNN.} The idea of ANN-SNN conversion is to relate the ReLU activation of analog neurons in ANNs to the firing rate (or postsynaptic potential) of spiking neurons in SNNs. Specifically, by summing Eq.~\eqref{equ02} from time-step 1 to $T$ and dividing $T$ on both sides, we have: \begin{figure} [t]\centering \subfigure[] { \label{fig0101} \includegraphics[width=0.75\columnwidth,trim=300 150 300 180,clip]{clipping_and_quantization_error_1a.pdf} } \subfigure[] { \label{fig0102} \includegraphics[width=0.30\columnwidth,trim=240 60 240 60,clip]{uneveness_error_1a.pdf} } \subfigure[] { \label{fig0103} \includegraphics[width=0.30\columnwidth,trim=240 60 240 60,clip]{uneveness_error_1b.pdf} } \subfigure[] { \label{fig0104} \includegraphics[width=0.30\columnwidth,trim=240 60 240 60,clip]{uneveness_error_1c.pdf} } \caption{ANN-SNN conversion error includes: (a) Clipping error and Quantization error, (b)-(d) Unevenness error.} \label{fig01} \end{figure} \begin{align} \frac{\boldsymbol{v}^{l}(T) - \boldsymbol{v}^{l}(0)}{T} &= \frac{\sum\limits_{t=1}^T\boldsymbol{W}^{l}{\theta}^{l-1}\boldsymbol{s}^{l-1}(t)}{T} - \frac{\sum\limits_{t=1}^T{\theta}^{l} \boldsymbol{s}^{l}(t)}{T}. \label{equ06} \end{align} By using $\boldsymbol{\phi}^l(T) = \frac{\sum\limits_{t=1}^T{\theta}^{l} \boldsymbol{s}^{l}(t)}{T}$ to denote the average postsynaptic potential, we will find the linear relationship between $\boldsymbol{\phi}^l(T)$ and $\boldsymbol{\phi}^{l-1}(T)$: \begin{align} \boldsymbol{\phi}^l(T) &= \boldsymbol{W}^{l}\boldsymbol{\phi}^{l-1}(T) - \frac{\boldsymbol{v}^{l}(T) - \boldsymbol{v}^{l}(0)}{T}. \label{equ07} \end{align} From Eqs.~\eqref{ann} and~\eqref{equ07}, we note that if we can map the activation value $\boldsymbol{a}^l$ of analog neurons in ANNs to $\boldsymbol{\phi}^l(T)$ of IF neurons in SNNs, then we will be able to train a source ANN with back-propagation (BP) and convert it to an SNN by replacing the ReLU activation with IF neurons, which is the core idea of ANN-SNN conversion. As Eqs.~\eqref{ann} and~\eqref{equ07} are not exactly equal, there exists conversion error in general.\\ \noindent \textbf{ANN-SNN conversion error.} There are three main errors in ANN-SNN conversion~\cite{bu2022optimal}, including clipping error, quantization error, and unevenness error, which cause the performance gap between ANNs and SNNs. Specifically, \begin{itemize} \item[$\bullet$] \textbf{Clipping error} denotes the error caused by different value ranges of ANNs and SNNs. For ANNs, the output $\boldsymbol{a}^l$ belongs to a real number interval $[0,a_{max}^{l}]$ with $a_{max}^{l}$ denoting the maximum value of $\boldsymbol{a}^l$. For SNNs, the output $\boldsymbol{\phi}^l(T)$ belongs to a finite discrete set $S_T = \{ \frac{{\theta}^l i}{T} | i\in [0,T] \wedge i\in \mathbb{N} \}$ due to $\boldsymbol{\phi}^l(T) = \sum\limits_{t=1}^T{\theta}^{l} \boldsymbol{s}^{l}(t) /T$. As illustrated in Fig.~\ref{fig01}(a), if we set $\lambda^l$ as an actual threshold in ANNs to map the maximum value ${\theta}^l$ in $S_T$ of SNNs, $\boldsymbol{a}^l$ can be mapped to $\boldsymbol{\phi}^l(T)$ by $\bm{\phi}^l(T)=\text{clip} \left( \frac{ \theta^l}{T} \left \lfloor \frac{\bm{a}^{l} T}{\lambda^l} \right \rfloor, 0, \theta^l \right)$ with $\lfloor \cdot \rfloor$ denoting the floor function. Then the output $\boldsymbol{a}^l\in [\lambda^l, {a}_{max}^l]$ of the ANNs will be mapped to the same value ${\theta}^l$, which will cause the so-called clipping error. \item[$\bullet$] \textbf{Quantization error} is generated when mapping the continuous value of $\boldsymbol{a}^l$ in ANNs to the discrete value of $\boldsymbol{\phi}^l(T)$ in SNNs. As shown in Fig.~\ref{fig01}(a), when $\boldsymbol{a}^l\in[\frac{k\lambda^l}{T},\frac{(k+1)\lambda^l}{T})(k=0,1,...,T-1)$, the corresponding value of $\boldsymbol{\phi}^l(T)$ will always be $\frac{k{\theta}^l}{T}$. \item[$\bullet$] \textbf{Unevenness error} refers to the deviation between $\boldsymbol{a}^l$ and $\boldsymbol{\phi}^l(T)$ due to different temporal sequences of spike arrival on activation layers. Ideally, we expect the timing of receive spikes from the previous layer to be even. However, in reality, the spiking timing will be uneven when the spikes deliver to the deep layer, which will cause more spikes or fewer spikes than expected. An example is illustrated in Fig.~\ref{fig01}(b)-(d), in which two presynaptic neurons in layer $l-1$ are connected to a postsynaptic neuron in layer $l$. We assume $\boldsymbol{W}^l=\left[2\ -1\right], \boldsymbol{a}^{l-1} = \boldsymbol{\phi}^{l-1}(T) = \left[0.5\ 0.5\right]^T, {\theta}^l = \lambda^l = 1, T=6$, then we can get that the output $\boldsymbol{a}^{l}$ in ANN is $\boldsymbol{a}^{l}=\text{ReLU}(\boldsymbol{W}^l\boldsymbol{a}^{l-1})=0.5$. Under the ideal situation (Fig.~\ref{fig01}(b)), $\boldsymbol{\phi}^l(T) = \sum\limits_{t=1}^T{\theta}^{l} \boldsymbol{s}^{l}(t)/{T}=\frac{3}{6}=0.5$, which is exactly the same as ANN output. However, when the input spike timing changes (Fig.~\ref{fig01}(c)-(d)), $\phi^l(T)$ may become larger or smaller than $\boldsymbol{a}^l$ in fact. \end{itemize} \textbf{Eliminating conversion error.} The clipping and quantization errors can be eliminated by modifying the activation function of source ANNs. Specifically, the trainable clipping layer technique has been used to directly map the trainable upper bound of ANNs to the threshold of SNNs, so that the clipping error is zero~\cite{ho2021tcl}. Besides, the quantization clip-floor activation function was proposed to replace the ReLU activation function in source ANNs~\cite{bu2022optimal}, which can better approximate the activation function of SNNs and eliminate quantization error. Despite this, it is still challenging to reduce unevenness error, which seriously hampers the performance of SNNs under the condition of low time latency. Therefore, this paper aims to address unevenness error and explore high-performance ANN-SNN conversion with ultra-low latency. \section{Methods} In this section, we make a detailed analysis of unevenness error and divide it into four situations, then we count out the distribution of unevenness error and point out that the first case plays a more important role among the four kinds of errors. Based on this, we show the residual membrane potential is essential to ANN-SNN conversion and propose the optimization strategy to reduce unevenness error. \subsection{Dividing Unevenness Error into Four Situations} Here we divide unevenness error into different cases to analyze. We suppose that the ANN and SNN receive the same input to layer $l$, that is, $\boldsymbol{a}^{l-1}=\boldsymbol{\phi}^{l-1}(T)$, and then analyze the error between the ANN and SNN in layer $l$. For simplicity, we use $\boldsymbol{y}^{l-1} = \boldsymbol{W}^{l} \boldsymbol{a}^{l-1}= \boldsymbol{W}^{l}\boldsymbol{\phi}^{l-1}(T)$ to substitute the weighted input to layer $l$ for both ANN and SNN. The conversion error is defined as the output of converted SNN subtracting the output of source ANN, which can be simplified according to Eqs.~\eqref{ann} and ~\eqref{equ07}: \begin{align} \textbf{Error}^l&=\boldsymbol{\phi}^{l}(T)-\boldsymbol{a}^{l} \\ &=\boldsymbol{y}^{l-1} - \frac{\boldsymbol{v}^{l}(T) - \boldsymbol{v}^{l}(0)}{T}-f(\boldsymbol{y}^{l-1}). \nonumber \end{align} In order to facilitate the analysis of unevenness error, we consider using the quantization clip-floor-shift (QCFS) function proposed in~\cite{bu2022optimal} to replace the ReLU activation function in source ANNs, that is: \begin{align} f(\boldsymbol{y}^{l-1}) &= \lambda^l {\rm clip} \left(\frac{1}{L}\left\lfloor\frac{\boldsymbol{y}^{l-1} L}{\lambda^l}+\frac{1}{2}\right\rfloor,0,1 \right). \label{equ08} \end{align} where $L$ is the quantization step of ANNs, $\lambda^l$ represents the trainable threshold in $l$-th layer of ANNs and is generally mapped to the threshold of SNN, that is, ${\theta}^l=\lambda^l$. The QCFS activation function better approximates the activation function of SNNs, and therefore could eliminate clipping and quantization errors (see Appendix for the detailed proof). Thus, the error ($\textbf{Error}^l$) here is caused by unevenness error. \begin{figure} [t]\centering \includegraphics[width=0.75\columnwidth,trim=300 150 300 165,clip]{uneveness_error_2a.pdf} \caption{Four cases of unevenness error.} \label{fig02} \end{figure} For further analysis, we compare the output $\boldsymbol{a}^{l}$ of ANN and $\boldsymbol{\phi}^{l}(T)$ of SNN in layer $l$ when receiving the same input $\boldsymbol{y}^{l-1}$. As shown in Fig.~\ref{fig02}, according to the weighted input $\boldsymbol{y}^{l-1}$ to layer $l$ and the sign (positive and negative) of $\textbf{Error}^l$, unevenness error can be divided into the following four categories: \begin{itemize} \item[$\bullet$] \textbf{Case 1}: ${a}^l=0, \phi^l(T)>{a}^l$, which means that the input ${y}^{l-1}< \lambda^l/2L$, the output of ANN equals 0 but the output of SNN is larger than 0 (fires more spikes as expected). \item[$\bullet$] \textbf{Case 2}: $0<{a}^l<\lambda^l,\phi^l(T)>{a}^l$, which means that the input $\lambda^l/2L \leqslant {y}^{l-1}<\lambda^l-\lambda^l/2L$, the output of SNN is larger than that of ANN (fires more spikes as expected). \item[$\bullet$] \textbf{Case 3}: $0<{a}^l<\lambda^l,\phi^l(T)<{a}^l$, which means that the input $\lambda^l/2L \leqslant {y}^{l-1}<\lambda^l-\lambda^l/2L$, the output of SNN is smaller than that of ANN (fires fewer spikes as expected). \item[$\bullet$] \textbf{Case 4}: ${a}^l=\lambda^l,\phi^l(T)<{a}^l$, which means that input ${y}^{l-1}\geqslant \lambda^l-\lambda^l/2L$, the output of ANN equals $\lambda^l$ but the output of SNN is smaller than $\lambda^l$ (fires fewer spikes as expected). \end{itemize} Note that here we use the scalars $a^l$ and $\phi^l(T)$ to represent the outputs of two corresponding neurons in ANN and SNN, respectively. \subsection{Analyze the Distribution of Unevenness Error} The discussion above of unevenness error ($\textbf{Error}^l$) in layer $l$ is based on the assumption that $\boldsymbol{a}^{l-1}=\boldsymbol{\phi}^{l-1}(T)$. However, in actual situations, $\boldsymbol{a}^{l-1}$ is not always equal to $\boldsymbol{\phi}^{l-1}(T)$, as unevenness error existed before the $l$-th layer has already caused the deviation between the respective output of ANNs and SNNs. Therefore, we attempt to give a more detailed discussion about unevenness error here. \begin{definition} \rm{Unevenness Error \uppercase\expandafter{\romannumeral1}}: $\boldsymbol{a}^{l-1}=\boldsymbol{\phi}^{l-1}(T)~\wedge~\boldsymbol{a}^{l} \neq \boldsymbol{\phi}^{l}(T)$, this condition is consistent with the original definition of unevenness error and represents the error completely generated by the $l$-th layer. \end{definition} \begin{definition} \rm{Unevenness Error \uppercase\expandafter{\romannumeral2}}: $\boldsymbol{a}^{l} \neq \boldsymbol{\phi}^{l}(T)$ whether $\boldsymbol{a}^{l-1}$ equals $\boldsymbol{\phi}^{l-1}(T)$ or not. This condition reflects the cumulative effect of unevenness error. \end{definition} \begin{figure} [t]\centering \subfigure[Un. Error \uppercase\expandafter{\romannumeral1} (CIFAR-10)] { \label{fig0301} \includegraphics[width=0.47\columnwidth]{uneveness_error_3e.pdf} } \subfigure[Un. Error \uppercase\expandafter{\romannumeral1} (CIFAR-100)] { \label{fig0302} \includegraphics[width=0.47\columnwidth]{uneveness_error_3f.pdf} } \subfigure[Un. Error \uppercase\expandafter{\romannumeral2} (CIFAR-10)] { \label{fig0303} \includegraphics[width=0.47\columnwidth]{uneveness_error_3b.pdf} } \subfigure[Un. Error \uppercase\expandafter{\romannumeral2} (CIFAR-100)] { \label{fig0304} \includegraphics[width=0.47\columnwidth]{uneveness_error_3c.pdf} } \caption{The distribution of Unevenness Error \uppercase\expandafter{\romannumeral1}/\uppercase\expandafter{\romannumeral2} in each layer of VGG-16. (a)-(b): Unevenness Error \uppercase\expandafter{\romannumeral1}, (c)-(d) Unevenness Error \uppercase\expandafter{\romannumeral2}.} \label{fig03} \end{figure} For Unevenness Error \uppercase\expandafter{\romannumeral2} of the $l$-th layer, it can be considered as the joint effect of Unevenness Error \uppercase\expandafter{\romannumeral1} in the $l$-th layer (when $\boldsymbol{a}^{l-1}=\boldsymbol{\phi}^{l-1}(T)$) and Unevenness Error \uppercase\expandafter{\romannumeral2} in the $l-1$-th layer (when $\boldsymbol{a}^{l-1} \neq \boldsymbol{\phi}^{l-1}(T)$). Therefore, Unevenness Error \uppercase\expandafter{\romannumeral1} is the essential reason that affects the performance of SNNs, which desires to be eliminated. We further analyze the distribution of Unevenness Error \uppercase\expandafter{\romannumeral1}/\uppercase\expandafter{\romannumeral2} in four situations, and mine the main part of unevenness Error. Here, we train the source ANNs with QCFS activation function (Eq.~\eqref{equ08}) and VGG-16 structure on CIFAR-10/100 datasets and then convert them to SNNs. For unevenness Error \uppercase\expandafter{\romannumeral1} in layer $l$, we force the input $\boldsymbol{a}^{l-1}$ to ANN to be equal to the input $\boldsymbol{\phi}^{l-1}(T)$ to SNN, that is, $\boldsymbol{a}^{l-1}=\boldsymbol{\phi}^{l-1}(T)$, and recalculate the output $\boldsymbol{a}^{l}$ of ANN. Then we can compute the distribution of four kinds of Unevenness Error \uppercase\expandafter{\romannumeral1} by analyzing the values of $\boldsymbol{a}^{l}$ and $\boldsymbol{\phi}^{l}(T)$ of all neurons. For Unevenness Error \uppercase\expandafter{\romannumeral2} in layer $l$, we directly compute the distribution of four kinds of unevenness error by analyzing the values of $\boldsymbol{a}^{l}$ and $\boldsymbol{\phi}^{l}(T)$ of all neurons. The results are illustrated in Fig.~\ref{fig03}, we have the following observation.\\ \textbf{Observation 1.} From Fig.~\ref{fig0303}-\ref{fig0304}, we note that all the four cases mentioned above have a remarkable effect on Unevenness Error \uppercase\expandafter{\romannumeral2}. However, for Unevenness Error \uppercase\expandafter{\romannumeral1} that determines Unevenness Error \uppercase\expandafter{\romannumeral2}, we can find that \textbf{Case 1} (${a}^l=0, \phi^l(T)> {a}^l$) plays a more important role among four kinds of errors, which has a significant impact in almost every layer (Fig.~\ref{fig0301}-\ref{fig0302}). Therefore, our main goal is to optimize this case to alleviate the situation of firing additional spikes. \begin{figure} [t]\centering \includegraphics[width=0.8\columnwidth,trim=220 90 220 30,clip]{residual_membrane_potential.pdf} \caption{Illustration of all cases of $\textbf{Error}^l$. The small concentric circle denotes that there is no error ($\textbf{Error}^l=0$), while the circular ring denotes the four cases of unevenness error. The semicircle (blue) represents all the cases covered by $\boldsymbol{v}^l(T)<0$.} \label{residual_membrane_potential} \end{figure} \subsection{Optimization Strategy Based on Residual Membrane Potential (SRP)} Here we propose an optimization strategy to reduce unevenness error based on residual membrane potential. Our goal is to reduce Unevenness Error \uppercase\expandafter{\romannumeral1} of \textbf{Case 1} (${a}^l=0, \phi^l(T)> {a}^l$). However, in the practical application of SNNs, we cannot directly obtain the specific value of $\boldsymbol{a}^l$, which becomes an obstacle to further determining the category of unevenness Error \uppercase\expandafter{\romannumeral1}. Fortunately, we find that we can compare $\boldsymbol{a}^l$ with $\boldsymbol{\phi}^l(T)$ according to the value of residual membrane potential $\boldsymbol{v}^l(T)$, and we have the following theorem: \begin{theorem} Supposing that an ANN with QCFS activation (Eq.~\eqref{equ08}) is converted to an SNN with $L=T$ and $\lambda^l={\theta}^l$, and the ANN and SNN receive the same weighted input $\boldsymbol{y}^{l-1} = \boldsymbol{W}^{l} \boldsymbol{a}^{l-1}= \boldsymbol{W}^{l}\boldsymbol{\phi}^{l-1}(T)$, then we will have the following conclusions:\\ (\romannumeral1) If ${a}^l=0$, ${v}^l(T)<0$ is the sufficient condition of $\phi^l(T) \geqslant{a}^l$. In addition, ${v}^l(T)<0$ is also the necessary condition of $\phi^l(T)>{a}^l$.\\ (\romannumeral2) If ${a}^l>0$, ${v}^l(T)<0$ is the sufficient and necessary condition of $\phi^l(T)>{a}^l$. \label{thm06} \end{theorem} The proof is provided in the appendix. Theorem 1 implies that if ${v}^l(T)<0$, we can infer that there is no error (${a}^l={\phi}^l(T)$) or there exist Unevenness Error \uppercase\expandafter{\romannumeral1} of \textbf{Case 1} and \textbf{Case 2} ($\phi^l(T)>{a}^l$), which is illustrated in the blue semicircle of Fig.~\ref{residual_membrane_potential}. However, we are unable to determine whether it belongs to \textbf{Case 1} (${a}^l=0, \phi^l(T)>{a}^l$) or \textbf{Case 2} ($0<{a}^l<\lambda^l,\phi^l(T)>{a}^l$). In fact, we have shown in Fig.~\ref{fig0301}-\ref{fig0302} that \textbf{Case 1} accounts for the largest percentage and \textbf{Case 2} can be approximately neglected. Thus we can conclude that when ${v}^l(T)< 0$, there exist mainly Unevenness Error \uppercase\expandafter{\romannumeral1} of \textbf{Case 1} or there is not any error. \begin{algorithm}[t] \caption{The optimization strategy based on residual membrane potential (SRP)} \begin{algorithmic}[1] \REQUIRE Time-step to calculate residual membrane potential $\tau$; Time-step to test dataset $T$; Pretrained QCFS ANN model $f_\text{ANN}(\boldsymbol{W},\lambda)$; Dataset $D$. \ENSURE SNN model $f_\text{SNN}(\boldsymbol{W},\boldsymbol{v},\theta)$. \FOR{$l=1$ to $f_\text{ANN}.$layers} \STATE $f_\text{SNN}.{\theta}^l\gets f_\text{ANN}.\lambda^l$ \STATE $f_\text{SNN}.\boldsymbol{v}^l(0)\gets\frac{1}{2}f_\text{SNN}.{\theta}^l$ \STATE $f_\text{SNN}.\boldsymbol{W}^l\gets f_\text{ANN}.\boldsymbol{W}^l$ \ENDFOR \FOR{length of Dataset $D$} \STATE Sample minibatch (data,label) from $D$ \FOR{$t=1$ to $\tau$} \STATE $f_\text{SNN}($data$)$ \ENDFOR \FOR{$l=1$ to $f_\text{SNN}.$layers} \STATE $f_\text{SNN}.{mask}^l \gets(f_\text{SNN}.\boldsymbol{v}^l(\tau)\geqslant 0)$ \STATE $f_\text{SNN}.\boldsymbol{v}^l(\tau)\gets\frac{1}{2}f_\text{SNN}.{\theta}^l$ \ENDFOR \FOR{$t=1$ to $T$} \FOR{$l=1$ to $f_\text{SNN}.$layers} \STATE data $\gets f_\text{SNN}^l($data$)\cdot f_\text{SNN}.{mask}^l$ \ENDFOR \ENDFOR \ENDFOR \RETURN $f_\text{SNN}(\boldsymbol{W},\boldsymbol{v},\theta)$ \end{algorithmic} \label{algorithm01} \end{algorithm} Based on the above analysis, we can use the residual membrane potential to reduce unevenness error. If the residual membrane potential ${v}^l(T)$ is smaller than zero, we should set the corresponding output $\phi^l(T)$ to zero, so as to make $\phi^l(T)={a}^l=0$. In practice, we first train an ANN with QCFS activation and then convert it to an SNN. In the inference stage, we use a two-stage strategy. For the first stage, we readout residual membrane potential $\boldsymbol{v}^l(\tau)$ with $\tau$ denoting the actual time-step we choose. If $\boldsymbol{v}^l(\tau)<0$ for a neuron, we set it to the dead neuron, which will not work in the next stage. For the second stage, we run the SNN and report the result for a given time-step $T$. We name our optimization strategy as SRP in the following content. The specific algorithm flow about SRP is shown in Algorithm \ref{algorithm01}. \begin{table*}[] \caption{Comparison between the proposed method and previous works on CIFAR-10 dataset} \renewcommand\arraystretch{1.15} \centering \begin{threeparttable} \begin{tabular}{cccccccccc}\hline Method & Arch & ANN & T=1 & T=2 & T=4 & T=8 & T=16 & T=32 & T=64\\ \hline RMP & VGG-16 & 93.63\% & - & - & - & - & - & 60.30\% & 90.35\% \\\hline RTS & VGG-16 & 95.72\% & - & - & - & - & - & 76.24\% & 90.64\% \\\hline TCL\tnote{*} & VGG-16 & 94.57\% & - & - & - & - & - & 93.64\% & 94.26\% \\\hline SNNC-AP & VGG-16 & 95.72\% & - & - & - & - & - & 93.71\% & 95.14\% \\\hline OPI & VGG-16 & 94.57\% & - & - & - & 90.96\% & 93.38\% & 94.20\% & 94.45\% \\\hline QCFS & VGG-16 & 95.52\% & 88.41\% & 91.18\% & 93.96\% & 94.95\% & 95.40\% & 95.54\% & 95.55\% \\\hline \textbf{SRP($\tau=4$)} & VGG-16 & 95.52\% & 93.80\% & 94.47\% & 95.32\% & 95.52\% & 95.44\% & 95.42\% & 95.40\% \\ \hline RTS & ResNet-18 & 95.46\% & - & - & - & - & - & 84.06\% & 92.48\% \\\hline SNNC-AP & ResNet-18 & 95.46\% & - & - & - & - & - & 94.78\% & 95.30\% \\\hline OPI & ResNet-18 & 96.04\% & - & - & - & 75.44\% & 90.43\% & 94.82\% & 95.92\% \\\hline QCFS & ResNet-18 & 95.64\% & 88.84\% & 91.75\% & 93.83\% & 95.04\% & 95.56\% & 95.67\% & 95.63\% \\\hline \textbf{SRP($\tau=4$)} & ResNet-18 & 95.64\% & 94.59\% & 95.06\% & 95.25\% & 95.60\% & 95.55\% & 95.55\% & 95.58\% \\ \hline TSC & ResNet-20 & 91.47\% & - & - & - & - & - & - & 69.38\% \\\hline OPI & ResNet-20 & 92.74\% & - & - & - & 66.24\% & 87.22\% & 91.88\% & 92.57\% \\\hline QCFS & ResNet-20 & 91.77\% & 62.43\% & 73.20\% & 83.75\% & 89.55\% & 91.62\% & 92.24\% & 92.35\% \\\hline \textbf{SRP($\tau=4$)} & ResNet-20 & 91.77\% & 86.37\% & 88.73\% & 90.51\% & 91.37\% & 91.64\% & 91.72\% & 91.80\% \\ \hline \end{tabular} \begin{tablenotes} \footnotesize \item[*] Self-implementation results. \end{tablenotes} \end{threeparttable} \label{table07} \end{table*} \begin{table*}[t] \caption{Comparison between the proposed method and previous works on CIFAR-100 dataset} \renewcommand\arraystretch{1.12} \centering \begin{threeparttable} \begin{tabular}{cccccccccc}\hline Method & Arch & ANN & T=1 & T=2 & T=4 & T=8 & T=16 & T=32 & T=64\\ \hline RTS & VGG-16 & 77.89\% & - & - & - & - & - & 7.64\% & 21.84\% \\\hline SNNC-AP & VGG-16 & 77.89\% & - & - & - & - & - & 73.55\% & 76.64\% \\\hline TCL\tnote{*} & VGG-16 & 76.32\% & - & - & - & - & - & 52.30\% & 71.17\% \\\hline SNM & VGG-16 & 74.13\% & - & - & - & - & - & 71.80\% & 73.69\% \\\hline OPI & VGG-16 & 76.31\% & - & - & - & 60.49\% & 70.72\% & 74.82\% & 75.97\% \\\hline QCFS & VGG-16 & 76.28\% & - & 63.79\% & 69.62\% & 73.96\% & 76.24\% & 77.01\% & 77.10\% \\\hline \textbf{SRP($\tau=4$)} & VGG-16 & 76.28\% & 71.52\% & 74.31\% & 75.42\% & 76.25\% & 76.42\% & 76.45\% & 76.37\% \\ \hline RMP & ResNet-20 & 68.72\% & - & - & - & - & - & 27.64\% & 46.91\% \\ \hline OPI & ResNet-20 & 70.43\% & - & - & - & 23.09\% & 52.34\% & 67.18\% & 69.96\% \\\hline QCFS & ResNet-20 & 69.94\% & - & 19.96\% & 34.14\% & 55.37\% & 67.33\% & 69.82\% & 70.49\% \\\hline \textbf{SRP($\tau=4$)} & ResNet-20 & 69.94\% & 46.48\% & 53.96\% & 59.34\% & 62.94\% & 64.71\% & 65.50\% & 65.82\% \\ \hline \end{tabular} \begin{tablenotes} \footnotesize \item[*] Self-implementation results. \end{tablenotes} \end{threeparttable} \label{table02} \end{table*} \begin{table*}[t] \caption{Comparison between the proposed method and previous works on ImageNet dataset} \renewcommand\arraystretch{1.15} \centering \begin{tabular}{cccccccccc}\hline Method & Arch & ANN & T=1 & T=2 & T=4 & T=8 & T=16 & T=32 & T=64 \\ \hline SNNC-AP & VGG-16 & 75.36\% & - & - & - & - & - & 63.64\% & 70.69\% \\\hline SNM & VGG-16 & 73.18\% & - & - & - & - & - & 64.78\% & 71.50\% \\\hline OPI & VGG-16 & 74.85\% & - & - & - & 6.25\% & 36.02\% & 64.70\% & 72.47\% \\\hline QCFS & VGG-16 & 74.29\% & - & - & - & 19.12\% & 50.97\% & 68.47\% & 72.85\% \\\hline \textbf{SRP($\tau=14$)} & VGG-16 & 74.29\% & 50.37\% & 61.37\% & 66.47\% & 68.37\% & 69.13\% & 69.35\% & 69.43\% \\ \hline SNNC-AP & ResNet-34 & 75.66\% & - & - & - & - & - & 64.54\% & 71.12\% \\\hline QCFS & ResNet-34 & 74.32\% & - & - & - & 35.06\% & 59.35\% & 69.37\% & 72.35\% \\\hline \textbf{SRP($\tau=8$)} & ResNet-34 & 74.32\% & 57.78\% & 64.32\% & 66.71\% & 67.62\% & 68.02\% & 68.40\% & 68.61\% \\ \hline \end{tabular} \label{table03} \end{table*} \section{Experiments} In this section, we evaluate the performance of our methods for image classification tasks on CIFAR-10~\cite{LeCun1998CIFAR10}, CIFAR-100~\cite{Krizhevsky2009CIFAR100} and ImageNet~\cite{Deng2009ImageNet} datasets under the network architecture of ResNet-18, ResNet-20, ResNet-34~\cite{he2016deep} and VGG-16~\cite{Simonyan2014VGG16}. We compare our method with previous state-of-the-art ANN-SNN conversion methods, including RMP~\cite{han2020rmp}, TSC~\cite{Han&Roy2020}, RTS~\cite{deng2020optimal}, OPI~\cite{Bu2022OPI}, SNNC-AP~\cite{li2021free}, TCL~\cite{ho2021tcl}, QCFS~\cite{bu2022optimal} and SNM~\cite{wang2022signed}. \subsection{SRP Can Reduce Unevenness Error} We first test whether the proposed SRP can reduce unevenness error. We train VGG-16 on the CIFAR-10/100 datasets and then convert it to SNNs with/without SRP. As Unevenness Error \uppercase\expandafter{\romannumeral2} can evaluate the overall performance of SNNs, we compare the distribution of Unevenness Error \uppercase\expandafter{\romannumeral2} before and after using SRP in each layer and show the results in Fig.~\ref{fig11}. One can find that our proposed method can reduce the percentage of unevenness Error \uppercase\expandafter{\romannumeral2} that existed in each layer significantly. For VGG-16 on CIFAR-10, SRP can reduce the percentage of unevenness Error \uppercase\expandafter{\romannumeral2} that existed in last-5 layers by 9.44\%, 8.60\%, 7.55\%, 5.06\%, and 5.47\%. For CIFAR-100, the corresponding decreased percentage is 9.21\%, 10.96\%, 13.77\%, 8.34\%, and 7.48\%. \iffalse \begin{figure}[t] \centering \subfigure[VGG-16 on CIFAR-100] { \label{fig0901} \includegraphics[width=0.45\columnwidth,trim=220 95 200 95,clip]{uneveness_error_6a.pdf} } \subfigure[ResNet-20 on CIFAR-100] { \label{fig0902} \includegraphics[width=0.45\columnwidth,trim=220 95 200 95,clip]{uneveness_error_6b.pdf} } \caption{The variance of Unevenness Error \uppercase\expandafter{\romannumeral2}} \label{fig09} \end{figure} \fi \begin{figure}[t] \centering \subfigure[VGG-16, CIFAR-10] { \label{fig1101} \includegraphics[width=0.9\columnwidth]{uneveness_error_after1.pdf} } \subfigure[VGG-16, CIFAR-100] { \label{fig1103} \includegraphics[width=0.9\columnwidth]{uneveness_error_after2.pdf} } \caption{Comparison of the distributions of Unevenness Error \uppercase\expandafter{\romannumeral2} before and after using SRP in each layer.} \label{fig11} \end{figure} \begin{table*}[] \caption{Comparison about different $\tau$ of SRP on CIFAR-100 dataset} \renewcommand\arraystretch{1.15} \centering \begin{tabular}{cccccccccc}\hline Method & Arch & ANN & T=1 & T=2 & T=4 & T=8 & T=16 & T=32 & T=64\\ \hline Baseline & VGG-16 & 76.28\% & 57.50\% & 63.79\% & 69.62\% & 73.96\% & 76.24\% & 77.01\% & 77.10\% \\\hline \textbf{SRP($\tau=2$)} & VGG-16 & 76.28\% & 68.55\% & 71.24\% & 73.21\% & 74.16\% & 74.91\% & 75.13\% & 75.26\% \\ \hline \textbf{SRP($\tau=4$)} & VGG-16 & 76.28\% & 71.52\% & 74.31\% & 75.42\% & 76.25\% & 76.42\% & 76.45\% & 76.37\% \\ \hline \textbf{SRP($\tau=8$)} & VGG-16 & 76.28\% & 72.15\% & 75.20\% & 76.25\% & 76.66\% & 77.03\% & 77.14\% & 77.15\% \\ \hline \textbf{SRP($\tau=16$)} & VGG-16 & 76.28\% & 72.97\% & 75.66\% & 76.55\% & 77.03\% & 77.08\% & 77.08\% & 77.07\% \\ \hline Baseline & ResNet-20 & 69.94\% & 13.19\% & 19.96\% & 34.14\% & 55.37\% & 67.33\% & 69.82\% & 70.49\% \\\hline \textbf{SRP($\tau=2$)} & ResNet-20 & 69.94\% & 30.99\% & 39.55\% & 47.72\% & 55.13\% & 59.41\% & 60.76\% & 61.80\% \\ \hline \textbf{SRP($\tau=4$)} & ResNet-20 & 69.94\% & 46.48\% & 53.96\% & 59.34\% & 62.94\% & 64.71\% & 65.50\% & 65.82\% \\ \hline \textbf{SRP($\tau=8$)} & ResNet-20 & 69.94\% & 55.29\% & 63.07\% & 66.44\% & 68.22\% & 68.93\% & 68.95\% & 68.96\% \\ \hline \textbf{SRP($\tau=16$)} & ResNet-20 & 69.94\% & 58.32\% & 65.16\% & 68.07\% & 69.50\% & 69.27\% & 69.47\% & 69.49\% \\ \hline \end{tabular} \label{table06} \end{table*} \subsection{Comparison with the State-of-the-art} We compare our method with the state-of-the-art ANN-SNN conversion methods to validate the effectiveness of our method. For fair comparison, we use the performance of SRP on $T=t$ to compare with the performance of other state-of-the-arts on $T=t+\tau$. Tab.~\ref{table07} shows the performance of our proposed method on the CIFAR-10 dataset. As CIFAR-10 is a relatively easy dataset, the advantages of SRP are not as remarkable as those on CIFAR-100 and ImageNet dataset. For VGG-16 architecture, we achieve 95.32\% with 4 time-steps ($\tau=4$), which is 4.36\% higher than OPI and 0.37\% higher than QCFS on $T=8$. The accuracy of our method ($\tau=4$) on $T=4$ has outperformed the performance of other previous works on $T=64$, which include RMP, TCL, RTS, SNM and SNNC-AP. For ResNet-18, we obtain 95.25\% after using 4 time-steps ($\tau=4$), which is 19.81\% higher than OPI and 0.21\% higher than QCFS on $T=8$ respectively. For ResNet-20, the performance of SRP ($\tau=4$) on $T=4$ can outperform OPI and QCFS on $T=8$ with 24.27\% and 0.96\%. Tab.~\ref{table02} reports the results on the CIFAR-100 dataset. For low latency inference ($T<16$), our model outperforms all the other methods with the same time-step setting. For VGG-16, we achieve 75.42\% top-1 accuracy with 4 time-steps ($\tau=4$), whereas the methods of OPI and QCFS reach 60.49\% and 73.96\% accuracy at the end of 8 time-steps. Moreover, we achieve an accuracy of 71.52\% using only 1 time-step. For ResNet-20, the proposed method achieve 59.34\% top-1 accuracy with 4 time-steps ($\tau=4$), which is 36.25\% higher than OPI and 3.97\% higher than QCFS, respectively. We further evaluate whether our method can be generalized to the large-scale dataset. Here we test the performance of our method on the ImageNet dataset and report the results in Tab.~\ref{table03}. One can find that our method shows its superiority more obviously in the large-scale dataset. For VGG-16, SRP achieves the accuracy of 61.37\% with 2 time-steps ($\tau=14$), whereas the methods of OPI and QCFS reach 36.02\% and 50.97\% accuracy at the end of 16 time-steps. For ResNet-34, we obtain 67.62\% accuracy with 8 time-steps ($\tau=8$), which outperforms QCFS (59.35\% when $T=16$) by 8.27\% accuracy. All these results demonstrate that our method outperforms the previous conversion methods. \subsection{The Effect of Parameter $\tau$} Here we test the effects of parameter $\tau$ in our SRP. There is a trade-off between performance and latency. Larger $\tau$ can make a more accurate estimation of the residual membrane potential, thereby increasing the performance of SNNs. However, these advantages come with the price of long latency. If $\tau$ is set much smaller than the quantization step $L$ in the QCFS activation function of ANN, the precondition $\boldsymbol{y}^{l-1} = \boldsymbol{W}^{l} \boldsymbol{a}^{l-1}= \boldsymbol{W}^{l}\boldsymbol{\phi}^{l-1}(T)$ in Theorem 1 will be violated, which will decrease the performance of SRP. \begin{figure}[t] \centering \subfigure[VGG-16 on CIFAR-100] { \label{fig0601} \includegraphics[width=0.45\columnwidth,trim=220 100 220 100,clip]{cifar100_vgg16.pdf} } \subfigure[ResNet-20 on CIFAR-100] { \label{fig0602} \includegraphics[width=0.45\columnwidth,trim=220 100 220 100,clip]{cifar100_resnet20.pdf} } \subfigure[VGG-16 on ImageNet] { \label{fig0603} \includegraphics[width=0.45\columnwidth,trim=220 100 220 100,clip]{imagenet_vgg16.pdf} } \subfigure[ResNet-34 on ImageNet] { \label{fig0604} \includegraphics[width=0.45\columnwidth,trim=220 100 220 100,clip]{imagenet_resnet34.pdf} } \caption{The effect of parameter $\tau$} \label{fig06} \end{figure} For a more detailed analysis, we train a source ANN on CIFAR-100/ImageNet dataset and then convert it to SNNs with different $\tau$. The performance of converted SNNs is shown in Fig.~\ref{fig06} and Tab.~\ref{table06}. For CIFAR-100, the quantization step $L$ is set to 4 on VGG-16 and 8 on ResNet 20. For ImageNet, the quantization step $L$ is set to 16 on VGG-16 and 8 on ResNet-34. One can find that as $\tau$ increases, the accuracy of SNNs generally improves. When $\tau$ is nearly equal to $L$, the performance of SNNs stabilizes gradually, which implies that a too large $\tau$ will increase latency but cannot improve the accuracy remarkably. Besides, the results demonstrate that despite a significant change in $\tau$, our SRP method still maintains good generalization capabilities. In addition, for the tasks with different allowable time-steps, we can set different $\tau$ to improve the performance of SNNs. Specifically, we consider using relatively small $\tau$ under low time latency and use larger $\tau$ for a longer time-step. \subsection{Apply SRP to Other ANN-SNN Models} In this section, we experimentally prove that SRP can be generalized to other conversion methods. To verify this, we consider TCL~\cite{ho2021tcl} and OPI~\cite{Bu2022OPI} as the basic conversion method and then add SRP to those methods. As shown in Fig.~\ref{fig10}, we can find that the performance of both TCL and OPI increases after using SRP. Specifically, for TCL model, we achieve 63.03\% with 8 time-steps ($\tau=24$), which outperforms baseline (52.30\% when $T=32$) with 10.73\% accuracy. For OPI model, we obtain 67.24\% with 4 time-steps ($\tau=4$), which is 6.79\% higher than baseline (60.45\% when $T=8$). These results show that SRP can apply to other conversion models and remarkably improve classification accuracy. \begin{figure} \centering \subfigure[TCL on CIFAR-100] { \label{fig1001} \includegraphics[width=0.47\columnwidth,trim=200 100 200 100,clip]{parameter_3a.pdf} } \subfigure[OPI on CIFAR-100] { \label{fig1005} \includegraphics[width=0.47\columnwidth,trim=200 100 200 100,clip]{parameter_3b.pdf} } \caption{Effect of SRP on other models} \label{fig10} \end{figure} \subsection{Training Procedure and Hyperparameter Configuration} The training procedure of ANNs is consistent with~\cite{bu2022optimal}. We replace ReLU activation layers with QCFS and select average-pooling as the pooling layers. We set $\lambda^l$ in each activation layer as trainable threshold and $\boldsymbol{v}^l(0)=\frac{1}{2}\theta^l$ in IF Neuron. For CIFAR-10, we set $L=4$ on all network architectures. For CIFAR-100, we set $L=4$ for VGG-16 and $L=8$ for ResNet-20. For ImageNet, we set $L=16$ for VGG-16 and $L=8$ for ResNet-34. We use Stochastic Gradient Descent \cite{bottou2012stochastic} as our training optimizer and cosine decay scheduler \cite{loshchilov2016sgdr} to adjust the learning rate. We set the momentum parameter as $0.9$. The initial learning rate is set as $0.1$ (CIFAR-10/ImageNet) or $0.02$ (CIFAR-100) and weight decay is set as $5\times10^{-4}$ (CIFAR-10/100) or $1\times10^{-4}$ (ImageNet). In addition, we also use common data normalization and data enhancement techniques \cite{devries2017improved,Ekin2019,li2021free} for all datasets. During the procedure of adopting SRP, for CIFAR-10/100, we recommend $\tau=4$ for all network architecture. For ImageNet, we recommend $\tau=14$ for VGG-16 and $\tau=8$ for ResNet-34. \section{Conclusion} In this paper, we systematically analyze the cases and distribution of unevenness error and propose an optimization strategy based on residual membrane potential to reduce unevenness error. By introducing the temporal information of SNNs, our method achieves state-of-the-art accuracy on CIFAR-10, CIFAR-100, and ImageNet datasets, with fewer time-steps. Our method can alleviate the performance gap between ANNS and SNN, and promote the practical application of SNNs on neuromorphic chips.
\section{Summary} \label{sec:summary} Mixture models are a common choice when data stems from different sub-populations, but only the pooled data with unknown membership is observed. Models are typically estimated using the EM algorithm. As the log-likelihood of mixture models is, in general, not convex \cite{Murphy.2012}, existing optimization techniques are vulnerable to ending up in local optima \cite{Chaganty.2013}. In contrast, mixture density networks \cite[MDN;][]{Bishop.1994} that can also be considered as a type of mixture regression models, are successfully optimized with first-order (gradient descent) methods. \cite{nmdr} therefore proposed the mixture of experts distributional regression, a combination of interpretable mixtures of distributional regression models and MDNs to facilitate robust estimation and extend mixtures of regression models to the distribution regression case. The framework in \cite{nmdr} is based on a neural network formulation implemented in \texttt{mixdistreg} (\url{https://github.com/neural-structured-additive-learning/mixdistreg}), which is presented in this paper. \section{Statement of need} \label{sec:need} Common EM optimization routines are limited in their flexibility to specify mixtures of (many) potentially different distributions, cannot cope with large amounts of data and, in particular, are not robust in high dimensions. First-order methods used in deep learning are applied on mini-batches of data allowing large data set applications and can be used in a generic fashion for all model classes. In order to obtain a scalable framework, we implement the proposed framework by \cite{nmdr} in R \cite{R} using the software template \texttt{deepregression} \cite{rugamer2021deepregression} which relies on TensorFlow \cite{TensorFlow}. The template described in \cite{rugamer2021deepregression} provides the basis for many other neural network-based modeling approaches referred to as \emph{neural structured additive learning (NSAL)}. Examples include neural-based and autoregressive transformation models \cite{Baumann.2020, deeptrafo2021, kook2020ordinal, dats2021}, survival regression in neural networks \cite{bender2020, kopper2020, kopper2021}, distributional regression \cite{rugamer2020unifying} or scalable factor models and factorizations \cite{fdtf2021, AFM}. The NSAL principle is also followed by \texttt{mixdistreg} which allows combining it with other neural-based approaches straightforwardly. The software further comprises many different other approaches as a special case, including neural density networks \cite{Magdon.1998}, MDNs, and various mixture regression approaches (with penalized smooth effects) as proposed in \cite{Leisch.2004, Gruen.2007, Stasinopoulos.2007}. \section{Implementation Details} \label{sec:details} In the following, we briefly describe the main function \texttt{mixdistreg} of the eponymous package. Given a realization $y$ of the outcome of interest $Y$ and features $\bm{x} \in \mathbb{R}^p$, the package models the following density: \begin{equation} \label{eq:model} f_{Y\mid\bm{x}}(y \mid \bm{x}) = \sum_{m=1}^M \pi_m (\bm{x}) f_m(y\mid\bm{\theta}_m(\bm{x})), \end{equation} where $f_m$ are density functions of (potentially different) distributions $\mathcal{F}_m, m=1,\ldots,M$ with parameters $\bm{\theta}_m = (\theta_{m,1},\ldots,\theta_{m,k_m})^\top$, and $\pi_m \in [0,1]$ are mixture weights that sum to 1. \paragraph{Key Features:} \texttt{mixdistreg} allows, among other things, for \begin{itemize} \item mixtures of the same parametric distributions ($\mathcal{F}_m \equiv \mathcal{F}^\ast \,\,\forall m\in\{1,\ldots,M\}$); \item mixtures of different parametric distributions with the same domain ($\mathcal{F}_m \neq \mathcal{F}_n$ for some $m,n\in\{1,\ldots,M\}, m\neq n$); \item mixture components ($f_m$) to be chosen from a variety of distributions \cite[see][]{rugamer2021deepregression}; \item defining distribution parameters via an additive predictor $\eta$ and a link function $g$ (i.e., $g^{-1}(\theta(\bm{x})) = \eta(\bm{x})$ and additive structure $\eta(\bm{x}) = \sum_{j=1}^J \eta_j(\bm{x})$) \item individual additive predictors for different mixture components $m$ (i.e., $g^{-1}(\theta_{m}(\bm{x})) = \eta_{m}(\bm{x})$); \item individual additive predictors and link functions for different distribution parameters $k$ within one mixture component $m$ (i.e., $g^{-1}_{m,k}(\theta_{m,k}(\bm{x})) = \eta_{m,k}(\bm{x})$); \item a separate model definition that relates the categorical distribution to features of all sorts (i.e., $g^{-1}_\pi(\pi_{m}(\bm{x})) = \sum_{j=1}^{J_\pi} \eta_{m,j}(\bm{x})$); \item mixtures with one-point degenerate distributions (i.e., ($f_m(y) = 1_{y=a}, a\in\mathbb{R}$) as, e.g., used in zero-inflated models \cite[see, e.g.,][]{fritz2021combining}. \end{itemize} A formula interface for the different (or same) mixture components follows the intuitive \texttt{S}-like formula interface to define the additive predictor functions $\eta$. These can be defined flexibly, including linear effects (e.g., $\eta_j(\bm{x}) = \bm{x}^\top \bm{\beta}$), smooth terms, $L_1$-penalized sparse effects, (deep) neural network components or a combination thereof \cite[for details see][]{rugamer2021deepregression}. \paragraph{Convenience Functions:} Several convenience functions exist, wrapping this main function: \begin{itemize} \item \texttt{sammer}: a simpler interface for \textbf{sam}e \textbf{m}ixtur\textbf{e} (distributional) regression \item \texttt{inflareg}: a simpler interface for \textbf{infl}ated \textbf{reg}ression models forming a mixture of one or more degenerate distribution(s) and another parametric distribution; \item \texttt{zinreg, oinreg, zoinreg}: convenience functions, in turn, wrapping \texttt{inflareg} to allow for a simple model definition of zero-inflated, one-inflated and zero-and-one-inflated regression models. \end{itemize} Next to these modeling functions, the package provides a function \texttt{gen\_mix\_dist\_maker} to allow for more complex user-defined mixtures (e.g, mixtures of various parametric distributions and one-point mass distributions), and methods for plotting (\texttt{plot}), obtaining model coefficients (\texttt{coef}), calculating posterior probabilities for all clusters (\texttt{get\_pis}) and extracting statistics of the mixture components (\texttt{get\_stats\_mixcomps}). \section{Examples} The following examples demonstrate the interface of \texttt{mixdistreg}. \subsection{Mixture of Linear Regressions} We start with a simple special case, the mixture of linear regressions, and compare the results with \texttt{flexmix} \citep{Leisch.2004}, a well-established package for mixtures of regression models in R. \begin{knitrout} \definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969} \color{fgcolor} \begin{kframe} \begin{alltt} \hlkwd{library}\hlstd{(flexmix)} \hlkwd{library}\hlstd{(dplyr)} \hlkwd{library}\hlstd{(mixdistreg)} \end{alltt} \begin{alltt} \hlcom{# Load the data} \hlkwd{set.seed}\hlstd{(}\hlnum{42}\hlstd{)} \hlstd{NPreg} \hlkwb{<-} \hlkwd{ExNPreg}\hlstd{(}\hlkwc{n} \hlstd{=} \hlnum{1000}\hlstd{)} \hlstd{nr_comps} \hlkwb{<-} \hlnum{2} \hlstd{NPreg}\hlopt{$}\hlstd{xsq} \hlkwb{<-} \hlstd{NPreg}\hlopt{$}\hlstd{x}\hlopt{^}\hlnum{2} \end{alltt} \begin{alltt} \hlcom{# Fit a mixture of regression models with mixtools} \hlkwd{set.seed}\hlstd{(}\hlnum{42}\hlstd{)} \hlstd{fm_mod} \hlkwb{<-} \hlkwd{flexmix}\hlstd{(yn} \hlopt{~} \hlstd{x} \hlopt{+} \hlstd{xsq,} \hlkwc{data} \hlstd{= NPreg,} \hlkwc{k} \hlstd{= nr_comps)} \end{alltt} \begin{alltt} \hlcom{# Fitted values} \hlstd{pred_fm} \hlkwb{<-} \hlstd{fm_mod} \hlopt \end{alltt} \begin{alltt} \hlcom{# Fit a mixture of normal regression with mixdistreg} \hlstd{dr_mod} \hlkwb{<-} \hlkwd{sammer}\hlstd{(}\hlkwc{y} \hlstd{= NPreg}\hlopt{$}\hlstd{yn,} \hlkwc{family} \hlstd{=} \hlstr{"normal"}\hlstd{,} \hlkwc{nr_comps} \hlstd{= nr_comps,} \hlkwc{list_of_formulas} \hlstd{=} \hlkwd{list}\hlstd{(}\hlkwc{mean} \hlstd{=} \hlopt{~} \hlnum{1} \hlopt{+} \hlstd{x} \hlopt{+} \hlstd{xsq,} \hlkwc{scale} \hlstd{=} \hlopt{~}\hlnum{1}\hlstd{),} \hlkwc{data} \hlstd{= NPreg,} \hlkwc{optimizer} \hlstd{=} \hlkwd{optimizer_rmsprop}\hlstd{(}\hlkwc{learning_rate} \hlstd{=} \hlnum{0.01}\hlstd{),} \hlkwc{tf_seed} \hlstd{=} \hlnum{42} \hlstd{)} \end{alltt} \begin{alltt} \hlcom{# Train network} \hlstd{dr_mod} \hlopt \hlkwc{validation_split} \hlstd{=} \hlnum{0.1}\hlstd{,} \hlkwc{patience} \hlstd{=} \hlnum{100L}\hlstd{,} \hlkwc{early_stopping} \hlstd{=} \hlnum{TRUE}\hlstd{,} \hlkwc{verbose} \hlstd{=} \hlnum{FALSE}\hlstd{)} \end{alltt} \begin{alltt} \hlcom{# Fitted means of normal distributions} \hlstd{pred_dr} \hlkwb{<-} \hlstd{dr_mod} \hlopt \hlcom{# Compare} \hlkwd{plot}\hlstd{(NPreg}\hlopt{$}\hlstd{yn} \hlopt{~} \hlstd{NPreg}\hlopt{$}\hlstd{x)} \hlkwa{for}\hlstd{(i} \hlkwa{in} \hlnum{1}\hlopt{:}\hlstd{nr_comps)\{} \hlkwd{points}\hlstd{(pred_fm[[i]]} \hlopt{~} \hlstd{NPreg}\hlopt{$}\hlstd{x,} \hlkwc{col}\hlstd{=}\hlstr{"blue"}\hlstd{,} \hlkwc{pch}\hlstd{=}\hlstr{"x"}\hlstd{)} \hlkwd{points}\hlstd{(pred_dr[,i]} \hlopt{~} \hlstd{NPreg}\hlopt{$}\hlstd{x,} \hlkwc{col}\hlstd{=}\hlstr{"red"}\hlstd{,} \hlkwc{pch}\hlstd{=}\hlstr{"x"}\hlstd{)} \hlstd{\}} \hlkwd{legend}\hlstd{(}\hlstr{"bottomright"}\hlstd{,} \hlkwc{pch}\hlstd{=}\hlstr{"x"}\hlstd{,} \hlkwc{col}\hlstd{=}\hlkwd{c}\hlstd{(}\hlstr{"blue"}\hlstd{,} \hlstr{"red"}\hlstd{),} \hlkwc{legend} \hlstd{=} \hlkwd{c}\hlstd{(}\hlstr{"flexmix"}\hlstd{,} \hlstr{"mixdistreg"}\hlstd{))} \end{alltt} \end{kframe} \end{knitrout} \noindent The results of the above code are shown in Figure~\ref{fig:1}. \begin{figure}[!h] \centering \includegraphics[width=0.8\maxwidth]{figure/unnamed-chunk-2-1.pdf} \caption{Comparison of \texttt{flexmix} (blue) and \texttt{mixdistreg} (red) results on the \texttt{NPreg} data showing a mixture of two trends in the variable \texttt{x}, which are found by both methods.} \label{fig:1} \end{figure} \subsection{Mixture of Different Regressions} The previous data could alternatively also be fitted with a mixture of different distributions. We here choose the normal and Laplace distribution. \begin{knitrout} \definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe} \begin{alltt} \hlcom{# Define a different distribution} \hlstd{dr_mod2} \hlkwb{<-} \hlkwd{mixdistreg}\hlstd{(}\hlkwc{y} \hlstd{= NPreg}\hlopt{$}\hlstd{yn} \hlopt{+} \hlnum{1}\hlstd{,} \hlkwc{families} \hlstd{=} \hlkwd{c}\hlstd{(}\hlstr{"normal"}\hlstd{,} \hlstr{"laplace"}\hlstd{),} \hlkwc{nr_comps} \hlstd{= nr_comps,} \hlkwc{list_of_formulas} \hlstd{=} \hlkwd{list}\hlstd{(} \hlcom{# parameters for normal} \hlkwc{mean} \hlstd{=} \hlopt{~} \hlnum{1} \hlopt{+} \hlstd{x} \hlopt{+} \hlstd{xsq,} \hlkwc{scale} \hlstd{=} \hlopt{~}\hlnum{1}\hlstd{,} \hlcom{# parameters for laplace} \hlkwc{location} \hlstd{=} \hlopt{~} \hlnum{1} \hlopt{+} \hlstd{x} \hlopt{+} \hlstd{xsq,} \hlkwc{scale} \hlstd{=} \hlopt{~}\hlnum{1} \hlstd{),} \hlkwc{data} \hlstd{= NPreg,} \hlkwc{optimizer} \hlstd{=} \hlkwd{optimizer_rmsprop}\hlstd{(} \hlkwc{learning_rate} \hlstd{=} \hlnum{0.01}\hlstd{),} \hlkwc{tf_seed} \hlstd{=} \hlnum{42} \hlstd{)} \hlcom{# Train network} \hlstd{dr_mod2} \hlopt \hlkwc{validation_split} \hlstd{=} \hlnum{0.1}\hlstd{,} \hlkwc{patience} \hlstd{=} \hlnum{100L}\hlstd{,} \hlkwc{early_stopping} \hlstd{=} \hlnum{TRUE}\hlstd{,} \hlkwc{verbose} \hlstd{=} \hlnum{FALSE}\hlstd{)} \hlcom{# Get estimated means distributions} \hlstd{pred_dr2} \hlkwb{<-} \hlstd{dr_mod2} \hlopt \hlkwd{plot}\hlstd{(NPreg}\hlopt{$}\hlstd{yn} \hlopt{~} \hlstd{NPreg}\hlopt{$}\hlstd{x)} \hlkwa{for}\hlstd{(i} \hlkwa{in} \hlnum{1}\hlopt{:}\hlstd{nr_comps)\{} \hlkwd{points}\hlstd{(pred_dr2[,i]} \hlopt{~} \hlstd{NPreg}\hlopt{$}\hlstd{x,} \hlkwc{col}\hlstd{=}\hlkwd{c}\hlstd{(}\hlstr{"blue"}\hlstd{,}\hlstr{"red"}\hlstd{)[i],} \hlkwc{pch}\hlstd{=}\hlstr{"x"}\hlstd{)} \hlstd{\}} \hlkwd{legend}\hlstd{(}\hlstr{"bottomright"}\hlstd{,} \hlkwc{pch}\hlstd{=}\hlstr{"x"}\hlstd{,} \hlkwc{col}\hlstd{=}\hlkwd{c}\hlstd{(}\hlstr{"blue"}\hlstd{,} \hlstr{"red"}\hlstd{),} \hlkwc{legend} \hlstd{=} \hlkwd{c}\hlstd{(}\hlstr{"normal"}\hlstd{,} \hlstr{"laplace"}\hlstd{))} \end{alltt} \end{kframe} \end{knitrout} \noindent The results of the above code are shown in Figure~\ref{fig:2}. \begin{figure}[!h] \centering \includegraphics[width=0.8\maxwidth]{figure/unnamed-chunk-3-1.pdf} \caption{The estimated means of the two different mixture components (normal and laplace distribution).} \label{fig:2} \end{figure} \subsection{Mixture of Experts Distributional Regression} Next, we change the above data-generation process to include a heterogeneous variance different in both clusters. We then adapt the model to a mixture of experts distributional regression. \begin{knitrout} \definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe} \begin{alltt} \hlcom{# Generate response differently} \hlkwd{set.seed}\hlstd{(}\hlnum{32}\hlstd{)} \hlstd{n} \hlkwb{<-} \hlnum{1000} \hlstd{NPreg}\hlopt{$}\hlstd{yn} \hlkwb{<-} \hlkwd{c}\hlstd{(}\hlnum{5} \hlopt{*} \hlstd{NPreg}\hlopt{$}\hlstd{x[}\hlnum{1}\hlopt{:}\hlstd{n]} \hlopt{+} \hlnum{3} \hlopt{*} \hlkwd{rnorm}\hlstd{(n,} \hlnum{0}\hlstd{,} \hlkwd{exp}\hlstd{(}\hlopt{-}\hlnum{1}\hlopt{+}\hlstd{NPreg}\hlopt{$}\hlstd{x}\hlopt{/}\hlnum{5}\hlstd{)),} \hlnum{40} \hlopt{-} \hlstd{(NPreg}\hlopt{$}\hlstd{x[(n} \hlopt{+} \hlnum{1}\hlstd{)}\hlopt{:}\hlstd{(}\hlnum{2} \hlopt{*} \hlstd{n)]} \hlopt{-} \hlnum{5}\hlstd{)}\hlopt{^}\hlnum{2} \hlopt{+} \hlnum{3} \hlopt{*} \hlkwd{rnorm}\hlstd{(n))} \hlcom{# Define a mixture of distributional regressions} \hlstd{dr_mod3} \hlkwb{<-} \hlkwd{sammer}\hlstd{(}\hlkwc{y} \hlstd{= NPreg}\hlopt{$}\hlstd{yn,} \hlkwc{family} \hlstd{=} \hlstr{"normal"}\hlstd{,} \hlkwc{nr_comps} \hlstd{= nr_comps,} \hlkwc{list_of_formulas} \hlstd{=} \hlkwd{list}\hlstd{(}\hlkwc{mean} \hlstd{=} \hlopt{~} \hlnum{1} \hlopt{+} \hlstd{x} \hlopt{+} \hlstd{xsq,} \hlkwc{scale} \hlstd{=} \hlopt{~}\hlnum{1} \hlopt{+} \hlstd{x),} \hlkwc{data} \hlstd{= NPreg,} \hlkwc{optimizer} \hlstd{=} \hlkwd{optimizer_rmsprop}\hlstd{(}\hlkwc{learning_rate} \hlstd{=} \hlnum{0.01}\hlstd{),} \hlkwc{tf_seed} \hlstd{=} \hlnum{42} \hlstd{)} \hlcom{# Train network} \hlstd{dr_mod3} \hlopt \hlkwc{validation_split} \hlstd{=} \hlnum{0.1}\hlstd{,} \hlkwc{patience} \hlstd{=} \hlnum{100L}\hlstd{,} \hlkwc{early_stopping} \hlstd{=} \hlnum{TRUE}\hlstd{,} \hlkwc{verbose} \hlstd{=} \hlnum{FALSE}\hlstd{)} \hlcom{# Get estimated mean and standard deviations} \hlstd{pred_dr3} \hlkwb{<-} \hlstd{dr_mod3} \hlopt \hlstd{stddev_dr3} \hlkwb{<-} \hlstd{dr_mod3} \hlopt \hlkwd{plot}\hlstd{(NPreg}\hlopt{$}\hlstd{yn} \hlopt{~} \hlstd{NPreg}\hlopt{$}\hlstd{x)} \hlkwa{for}\hlstd{(i} \hlkwa{in} \hlnum{1}\hlopt{:}\hlstd{nr_comps)\{} \hlkwd{points}\hlstd{(pred_dr3[,i]}\hlopt{~}\hlstd{NPreg}\hlopt{$}\hlstd{x,} \hlkwc{col}\hlstd{=}\hlkwd{c}\hlstd{(}\hlstr{"blue"}\hlstd{,}\hlstr{"red"}\hlstd{)[i],} \hlkwc{pch}\hlstd{=}\hlstr{"x"}\hlstd{)} \hlkwd{points}\hlstd{(pred_dr3[,i]}\hlopt{+}\hlnum{2}\hlopt{*}\hlstd{stddev_dr3[,i]}\hlopt{~}\hlstd{NPreg}\hlopt{$}\hlstd{x,} \hlkwc{col}\hlstd{=}\hlkwd{c}\hlstd{(}\hlstr{"blue"}\hlstd{,}\hlstr{"red"}\hlstd{)[i],} \hlkwc{pch}\hlstd{=}\hlstr{"-"}\hlstd{)} \hlkwd{points}\hlstd{(pred_dr3[,i]}\hlopt{-}\hlnum{2}\hlopt{*}\hlstd{stddev_dr3[,i]}\hlopt{~}\hlstd{NPreg}\hlopt{$}\hlstd{x,} \hlkwc{col}\hlstd{=}\hlkwd{c}\hlstd{(}\hlstr{"blue"}\hlstd{,}\hlstr{"red"}\hlstd{)[i],} \hlkwc{pch}\hlstd{=}\hlstr{"-"}\hlstd{)} \hlstd{\}} \hlkwd{legend}\hlstd{(}\hlstr{"bottomright"}\hlstd{,} \hlkwc{pch}\hlstd{=}\hlstr{"x"}\hlstd{,} \hlkwc{col}\hlstd{=}\hlkwd{c}\hlstd{(}\hlstr{"blue"}\hlstd{,} \hlstr{"red"}\hlstd{),} \hlkwc{legend} \hlstd{=} \hlkwd{c}\hlstd{(}\hlstr{"Comp. 1"}\hlstd{,} \hlstr{"Comp. 2"}\hlstd{))} \end{alltt} \end{kframe} \end{knitrout} \noindent The results of the above code are shown in Figure~\ref{fig:3}. \begin{figure}[!h] \centering \includegraphics[width=0.8\maxwidth]{figure/unnamed-chunk-4-1.pdf} \caption{The estimated means and $\pm$ two times the estimated standard deviations of the two normal distributions fitted on a heterogeneous version of the \texttt{NPreg} data where one component has an increased variance for larger \texttt{x} values.} \label{fig:3} \end{figure} \subsection{Semi-structured Mixture Density Networks} In contrast to the previous examples, we now construct a mixture model that learns one of the mixtures using an (unstructured) deep neural network in the style of a mixture density network. The second distribution is again learned with a structured predictor. We use the data from the previous subsection to demonstrate this. \begin{knitrout} \definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe} \begin{alltt} \hlcom{# Deep network} \hlstd{deep_net} \hlkwb{<-} \hlkwd{keras_model_sequential}\hlstd{()} \hlopt \hlkwd{layer_dense}\hlstd{(}\hlkwc{units} \hlstd{=} \hlnum{64}\hlstd{,} \hlkwc{activation} \hlstd{=} \hlstr{"relu"}\hlstd{,} \hlkwc{use_bias} \hlstd{=} \hlnum{FALSE}\hlstd{)} \hlopt \hlkwd{layer_dense}\hlstd{(}\hlkwc{units} \hlstd{=} \hlnum{64}\hlstd{,} \hlkwc{activation} \hlstd{=} \hlstr{"relu"}\hlstd{,} \hlkwc{use_bias} \hlstd{=} \hlnum{FALSE}\hlstd{)} \hlopt \hlkwd{layer_dense}\hlstd{(}\hlkwc{units} \hlstd{=} \hlnum{32}\hlstd{,} \hlkwc{activation} \hlstd{=} \hlstr{"relu"}\hlstd{,} \hlkwc{use_bias} \hlstd{=} \hlnum{FALSE}\hlstd{)} \end{alltt} \begin{alltt} \hlcom{# Deep network head for the mean} \hlstd{deep_mean} \hlkwb{<-} \hlkwa{function}\hlstd{(}\hlkwc{x}\hlstd{) x} \hlopt \hlstd{deep_net} \hlopt \hlkwd{layer_dense}\hlstd{(}\hlkwc{units} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{# Deep network head for the standard deviation} \hlstd{deep_std} \hlkwb{<-} \hlkwa{function}\hlstd{(}\hlkwc{x}\hlstd{) x} \hlopt \hlstd{deep_net} \hlopt \hlkwd{layer_dense}\hlstd{(}\hlkwc{units} \hlstd{=} \hlnum{1}\hlstd{,} \hlkwc{activation} \hlstd{=} \hlstr{"softplus"}\hlstd{)} \hlcom{# Semi-structured mixture density network} \hlstd{dr_mod4} \hlkwb{<-} \hlkwd{mixdistreg}\hlstd{(}\hlkwc{y} \hlstd{= NPreg}\hlopt{$}\hlstd{yn,} \hlkwc{families} \hlstd{=} \hlkwd{c}\hlstd{(}\hlstr{"normal"}\hlstd{,} \hlstr{"normal"}\hlstd{),} \hlkwc{nr_comps} \hlstd{= nr_comps,} \hlkwc{list_of_formulas} \hlstd{=} \hlkwd{list}\hlstd{(} \hlcom{# structured model part} \hlkwc{mean1} \hlstd{=} \hlopt{~} \hlnum{1} \hlopt{+} \hlstd{x} \hlopt{+} \hlstd{xsq,} \hlkwc{scale1} \hlstd{=} \hlopt{~}\hlnum{1} \hlopt{+} \hlstd{x,} \hlcom{# unstructured deep network} \hlkwc{mean1} \hlstd{=} \hlopt{~} \hlnum{1} \hlopt{+} \hlkwd{dm}\hlstd{(x),} \hlkwc{scale1} \hlstd{=} \hlopt{~}\hlnum{1} \hlopt{+} \hlkwd{ds}\hlstd{(x)} \hlstd{),} \hlkwc{list_of_deep_models} \hlstd{=} \hlkwd{list}\hlstd{(}\hlkwc{dm} \hlstd{= deep_mean,} \hlkwc{ds} \hlstd{= deep_std),} \hlkwc{data} \hlstd{= NPreg,} \hlkwc{optimizer} \hlstd{=} \hlkwd{optimizer_adam}\hlstd{(}\hlkwc{learning_rate} \hlstd{=} \hlnum{0.001}\hlstd{),} \hlkwc{tf_seed} \hlstd{=} \hlnum{42} \hlstd{)} \hlcom{# Train network} \hlstd{dr_mod4} \hlopt \hlkwc{validation_split} \hlstd{=} \hlnum{0.1}\hlstd{,} \hlkwc{patience} \hlstd{=} \hlnum{500L}\hlstd{,} \hlkwc{early_stopping} \hlstd{=} \hlnum{TRUE}\hlstd{,} \hlkwc{verbose} \hlstd{=} \hlnum{FALSE}\hlstd{)} \hlcom{# Extract means and standard deviations} \hlstd{pred_dr4} \hlkwb{<-} \hlstd{dr_mod4} \hlopt \hlstd{stddev_dr4} \hlkwb{<-} \hlstd{dr_mod4} \hlopt \hlkwd{plot}\hlstd{(NPreg}\hlopt{$}\hlstd{yn} \hlopt{~} \hlstd{NPreg}\hlopt{$}\hlstd{x)} \hlkwa{for}\hlstd{(i} \hlkwa{in} \hlnum{1}\hlopt{:}\hlstd{nr_comps)\{} \hlkwd{points}\hlstd{(pred_dr4[,i]}\hlopt{~}\hlstd{NPreg}\hlopt{$}\hlstd{x,} \hlkwc{col}\hlstd{=}\hlkwd{c}\hlstd{(}\hlstr{"blue"}\hlstd{,}\hlstr{"red"}\hlstd{)[i],} \hlkwc{pch}\hlstd{=}\hlstr{"x"}\hlstd{)} \hlkwd{points}\hlstd{(pred_dr4[,i]}\hlopt{+}\hlnum{2}\hlopt{*}\hlstd{stddev_dr4[,i]}\hlopt{~}\hlstd{NPreg}\hlopt{$}\hlstd{x,} \hlkwc{col}\hlstd{=}\hlkwd{c}\hlstd{(}\hlstr{"blue"}\hlstd{,}\hlstr{"red"}\hlstd{)[i],} \hlkwc{pch}\hlstd{=}\hlstr{"-"}\hlstd{)} \hlkwd{points}\hlstd{(pred_dr4[,i]}\hlopt{-}\hlnum{2}\hlopt{*}\hlstd{stddev_dr4[,i]}\hlopt{~}\hlstd{NPreg}\hlopt{$}\hlstd{x,} \hlkwc{col}\hlstd{=}\hlkwd{c}\hlstd{(}\hlstr{"blue"}\hlstd{,}\hlstr{"red"}\hlstd{)[i],} \hlkwc{pch}\hlstd{=}\hlstr{"-"}\hlstd{)} \hlstd{\}} \hlkwd{legend}\hlstd{(}\hlstr{"bottomright"}\hlstd{,} \hlkwc{pch}\hlstd{=}\hlstr{"x"}\hlstd{,} \hlkwc{col}\hlstd{=}\hlkwd{c}\hlstd{(}\hlstr{"blue"}\hlstd{,} \hlstr{"red"}\hlstd{),} \hlkwc{legend} \hlstd{=} \hlkwd{c}\hlstd{(}\hlstr{"Comp. 1"}\hlstd{,} \hlstr{"Comp. 2"}\hlstd{))} \end{alltt} \end{kframe} \end{knitrout} \noindent The results of the above code are shown in Figure~\ref{fig:4}. \begin{figure}[!h] \centering \includegraphics[width=0.8\maxwidth]{figure/unnamed-chunk-5-1.pdf} \caption{The estimated means and $\pm$ two times the estimated standard deviations of the two normal distributions fitted on a heterogeneous version of the \texttt{NPreg} data where one component is learned using a deep neural network.} \label{fig:4} \end{figure} \subsection{Zero-and-one Inflated Regression} As a last example, we generate zero-inflated data and show how to use the package's wrapper function \texttt{zinreg} to estimate a mixture of a point distribution at zero and a normal distribution. \begin{knitrout} \definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe} \begin{alltt} \hlcom{# zero-inflated} \hlkwd{set.seed}\hlstd{(}\hlnum{32}\hlstd{)} \hlstd{n} \hlkwb{<-} \hlnum{1000} \hlstd{NPreg}\hlopt{$}\hlstd{yn} \hlkwb{<-} \hlkwd{c}\hlstd{(}\hlnum{5} \hlopt{*} \hlstd{NPreg}\hlopt{$}\hlstd{x[}\hlnum{1}\hlopt{:}\hlstd{n]} \hlopt{+} \hlnum{3} \hlopt{*} \hlkwd{rnorm}\hlstd{(n,} \hlnum{0}\hlstd{,} \hlkwd{exp}\hlstd{(}\hlopt{-}\hlnum{1}\hlopt{+}\hlstd{NPreg}\hlopt{$}\hlstd{x}\hlopt{/}\hlnum{5}\hlstd{)),} \hlkwd{rep}\hlstd{(}\hlnum{0}\hlstd{, n))} \hlcom{# Zero-inflated regression with normal distribution} \hlstd{dr_mod4} \hlkwb{<-} \hlkwd{zinreg}\hlstd{(}\hlkwc{y} \hlstd{= NPreg}\hlopt{$}\hlstd{yn,} \hlkwc{family} \hlstd{=} \hlstr{"normal"}\hlstd{,} \hlkwc{list_of_formulas} \hlstd{=} \hlkwd{list}\hlstd{(}\hlkwc{mean} \hlstd{=} \hlopt{~} \hlnum{1} \hlopt{+} \hlstd{x} \hlopt{+} \hlstd{xsq,} \hlkwc{scale} \hlstd{=} \hlopt{~}\hlnum{1} \hlopt{+} \hlstd{x),} \hlkwc{data} \hlstd{= NPreg,} \hlkwc{optimizer} \hlstd{=} \hlkwd{optimizer_rmsprop}\hlstd{(}\hlkwc{learning_rate} \hlstd{=} \hlnum{0.01}\hlstd{),} \hlkwc{tf_seed} \hlstd{=} \hlnum{42} \hlstd{)} \hlcom{# Train network} \hlstd{dr_mod4} \hlopt \hlkwc{validation_split} \hlstd{=} \hlnum{0.1}\hlstd{,} \hlkwc{patience} \hlstd{=} \hlnum{100L}\hlstd{,} \hlkwc{early_stopping} \hlstd{=} \hlnum{TRUE}\hlstd{,} \hlkwc{verbose} \hlstd{=} \hlnum{FALSE}\hlstd{)} \hlcom{# Check estimated probabilities} \hlstd{(dr_mod4} \hlopt \end{alltt} \begin{verbatim} ## [1] 0.5379843 0.4620157 \end{verbatim} \end{kframe} \end{knitrout} \noindent Results show that the probability for zero-inflation is learned almost correctly. Using the function $\texttt{inflareg}$, the previous code could be adapted to arbitrary value-inflated distributions, also for more than one value (e.g., for zero-one-inflation). \bibliographystyle{splncs04} \setlength{\bibsep}{0pt plus 0.3ex} \begin{footnotesize}
\section{Introduction}\label{secIntro} The classical object of toric topology are the actions of compact tori $T$ on smooth manifolds $X$ which have topological orbit space $X/T$ isomorphic to simple polytopes. The examples include smooth projective toric varieties and their topological generalizations: quasitoric manifolds and torus manifolds, and moment-angle manifolds. All these manifolds are examples of torus actions of complexity zero. In general, it is known that orbit spaces of actions of complexity zero are manifolds with corners. Buchstaber and Terzi\'{c}~\cite{BT} initiated the study of orbit spaces of torus actions of positive complexity. In particular, they proved that the canonical torus action on a Grassmann manifold $\Gr_{4,2}$ of $2$-planes in $\mathbb{C}^4$ has orbit space homeomorphic to a sphere and a similar result for the canonical torus action of the variety of full flags in $\mathbb{C}^3$. In~\cite{AyzCompl}, the first author proved a local statement that, under certain assumption, the orbit space of a complexity one action in general position is a closed topological manifold. This result was later extended by Cherepanov in~\cite{Cher}: the orbit spaces of complexity one actions in non-general position are manifolds with corners. A natural question arises: describe torus actions on manifolds which have orbit spaces either manifolds or manifolds with boundary. This question stays in parallel to the seminal work of Vinberg~\cite{Vin}, and the later works of Mikhailova and Lange~\cite{Mikh,Lange16,Lange,LangMikh} who classified all finite group actions whose orbit spaces are closed manifolds. Using the slice theorem, the questions of this sort reduce to linear representations of the corresponding group. We prove the following results about linear representations. \begin{thm}\label{thmIntroOpen} Assume that the orbit space of a representation of a compact torus $T$ on a real vector space $V$ is homeomorphic to $\mathbb{R}^m$ for some $m$. Then the representation is weakly equivalent to a product of complexity one representations in general position and, probably, a trivial representation. \end{thm} \begin{thm}\label{thmIntroBoundary} Assume that the orbit space of a representation of a compact torus $T$ on a real vector space $V$ is homeomorphic to a half-space $\mathbb{R}_{\geqslant 0}\times\mathbb{R}^{m-1}$. Then the representation is weakly equivalent to a complexity zero representation, probably multiplied by a product of complexity one representations in general position and a trivial representation. \end{thm} After we obtained these results, we found that Theorem~\ref{thmIntroOpen} was already proved by Styrt~\cite{Styrt} in a greater generality. The arguments of his proof are essentially similar to ours. However, in our case one essential step of the proof is simplified since we refer to a known result of Provan and Billera~\cite{BilProv} from matroid theory. The same result is applied in the proof of Theorem~\ref{thmIntroBoundary}. The cited result about matroids (see Proposition~\ref{propBillProv}) was originally motivated by the combinatorial study of Leontief substitution systems. For this reason we call the products of representations of complexities zero and one, which appear in the statements of the theorems, \emph{Leontief representations}, see Definition~\ref{definLeontRepres}. The paper has the following structure. Section~\ref{secDefinitions} contains all basic definitions, examples, and a rigorous statement of the result. Theorems~\ref{thmIntroOpen} and~\ref{thmIntroBoundary} are proved in Section~\ref{secProofs}. In Sections~\ref{secTorusActions} and~\ref{secLowerFaces} we recall basic notions related to torus actions on smooth manifolds, and introduce Leontief torus actions, which are basically the actions whose orbit space is a manifold (with or without boundary). We study the combinatorial structure of Leontief torus actions and relate these results to the works~\cite{AyzCompl,Cher} on torus actions of complexity one. There are two appendix sections with a general exposition of two topics related to our work. Appendix~\ref{secLeontief} contains a brief overview of Leontief substitution systems and explains the (somewhat equivocal) choice of the term Leontief representation. Appendix~\ref{secMonopoles} is devoted to the topological aspects of Kaluza--Klein model with Dirac's magnetic monopoles. Essentially, this model is a very particular example of a torus action of complexity one in general position. The important property of this model is that the orbit space of an action is an open manifold. Keeping this in mind, one can consider Leontief torus actions as the most general higher-dimensional analogues of the topological Kaluza--Klein theory. This observation may become a good motivation for the further study of such torus actions. \section{Definitions and results}\label{secDefinitions} In the paper $T^k$ denotes the compact $k$-dimensional torus considered as a Lie group. The lattice $N=\Hom(T^k,S^1)\cong \mathbb{Z}^k$ is called \emph{the weight lattice}, and its dual lattice $N^*=\Hom(S^1,T^k)$ is called \emph{the lattice of 1-dimensional subgroups}. Consider a representation of $T=T^k$ on $V=\mathbb{R}^{m}$. It decomposes into a direct sum of irreducible representations. An irreducible representation of the abelian group $T$ has real dimension 1 or 2. One-dimensional representations are trivial (no-actions). A 2-dimensional real representation $V(\alpha)$ is determined by a nonzero weight $\alpha\in N$, so that \[ V(\alpha)\cong \mathbb{C}\cong\mathbb{R}^2,\quad tz=\alpha(t)\cdot z. \] Since neither a complex structure nor an orientation is fixed on $\mathbb{R}^2$, the weight $\alpha$ is determined uniquely up to sign. Therefore, an arbitrary representation $V$ of a torus decomposes into the sum \begin{equation}\label{eqDecomposition} V\cong V(\alpha_1)\oplus\ldots\oplus V(\alpha_r)\oplus \mathbb{R}^{m-2r}, \end{equation} where the torus action is trivial on $\mathbb{R}^{m-2r}$, and $\alpha_1,\ldots,\alpha_r\in N$ is a collection of nonzero vectors of the weight lattice $N$, defined up to sign. In the following we consider weights as rational vectors in the vector space $N_\Qo=N\otimes\mathbb{Q}\cong\mathbb{Q}^k$. Moreover, since weights are defined up to sign, we can treat them as rational lines (one-dimensional vector subspaces). Although a rational line contains infinitely many nonzero integral vectors, the choice of a representative is nonessential for our arguments. It follows that any torus representation is completely characterized by a multiset $\alpha=\{\alpha_1,\ldots,\alpha_r\}$ of vectors (or lines) in $N_\Qo$. Notice that the summand $\mathbb{R}^{m-2r}$ in~\eqref{eqDecomposition} is the fixed point subspace of the representation. So far, the representation has isolated fixed point if and only if $m=2r$. In the following it is assumed that torus representations are effective, which means their weights span the vector space $N_\Qo$. \begin{defin}\label{definComplexity} Consider a representation of $T=T^k$ on $V=\mathbb{R}^m$ with the weight system $\alpha=\{\alpha_1,\ldots,\alpha_r\}$. The number $r-k=|\alpha|-\rk\alpha$ is called \emph{the complexity of the representation}. \end{defin} Notice that complexity is always a nonnegative number and does not depend on the dimension of the trivial summand of the representation. If a representation $V$ has isolated fixed point, its complexity equals $\frac{1}{2}\dim V-\dim T$. Change of coordinates in a torus motivates the definition of weakly equivalent representations. \begin{defin} Two representations $V$ and $W$ of $T$ are called weakly equivalent, if there is an automorphism $\psi\colon T\to T$ and an isomorphism $g\colon V\to W$ such that $g(tv)=\psi(t)g(v)$. \end{defin} \begin{ex}\label{exCompl0} A representation of complexity 0 takes the form \[ V(\alpha_1)\oplus\cdots\oplus V(\alpha_n)\oplus \mathbb{R}^{m-2n}, \] where $\alpha=\{\alpha_1,\ldots,\alpha_n\}\subset N=\Hom(T^n,T^1)$ is a rational basis of $N_\Qo\cong\mathbb{Q}^n$. Using Smith normal form over $\mathbb{Z}$, we can change coordinates in $T^n$ (or equivalently in $N$). Therefore, up to weak equivalence, we have $\alpha_i=d_ie_i$, where $\{e_1,\ldots,e_n\}$ is the basis of the lattice $N$, and $d_i$'s are nonzero integers satisfying $d_1\mid d_2\mid\cdots\mid d_n$. Assuming there is no trivial component, a complexity zero action takes the form \[ (t_1,\ldots,t_n)(z_1,\ldots,z_n)=(t_1^{d_1}z_1,\ldots,t_n^{d_n}z_n), \] for $z_i\in\mathbb{C}$. If $d_i=1$ for any $i$, the representation is called \emph{standard}. This class of representations is well studied and widely used in toric topology. However, even for general $d_i$'s, the orbit space of the complexity zero representation (without trivial component) is a nonnegative cone $\mathbb{R}_{\geqslant 0}^n$. As a topological space it is homeomorphic to the halfspace $\mathbb{R}_{\geqslant 0}\times\mathbb{R}^{n-1}$. \end{ex} \begin{defin}\label{definComplOneGenPos} A representation of $T=T^{n-1}$ on $V\cong\mathbb{R}^{2n}$ is called \emph{a complexity one representation in general position} if its trivial part vanishes, and any $n-1$ of the weights $\alpha=\{\alpha_1,\ldots,\alpha_n\}\subsetN_\Qo\cong\mathbb{Q}^{n-1}$ are linearly independent over $\mathbb{Q}$. \end{defin} For a complexity one representation in general position, the collection $\alpha=\{\alpha_1,\ldots,\alpha_n\}\subset N$ determines a group homomorphism \[ A=\prod_{i=1}^n\alpha_i\colon T^{n-1}\to T^n. \] Since $\alpha$ spans $N_\mathbb{Q}$, the kernel $\Ker A$ is a finite abelian group. The image of $A$ is a codimension 1 toric subgroup $\{(t_1,\ldots,t_n)\in T^n\mid \prod_{i=1}^{n}t_i^{c_i}=1\}$ where $c_1\alpha_1+\cdots+c_n\alpha_n=0$ is a unique (up to multiplier) linear relation on $n$ vectors $\alpha_i$ in $N_\Qo\cong\mathbb{Q}^{n-1}$, and $c_i$'s don't have a nontrivial common divisor. The condition that any $n-1$ of $\alpha_i$'s are independent is equivalent to $c_i\neq 0$ for any $i$. Since $\alpha_i$ are only defined up to sign, we can assume that $c_i$'s are natural numbers. The orbit space for the original representation naturally coincides with that of the image of $A$, which implies the following observation. \begin{lem}\label{lemTechnical} The orbit space of a complexity one representation of $T^{n-1}$ in general position on $V\cong\mathbb{R}^{2n}$ is homeomorphic to the orbit space of the action of the subgroup $H=\left\{(t_1,\ldots,t_n)\in T^n\mid \prod_{i=1}^nt_i^{c_i}=1\right\}$, where $c_i>0$, induced by the standard action of $T^n$ on $\mathbb{C}^n\cong \mathbb{R}^{2n}$. \end{lem} Notice that the stabilizer subgroups of the original action and those of $H$ do not necessarily coincide: these depend on the finite group $\Ker A$ described above. For the orbit space, however, one can use the particular model action of $H$ to prove the following result. \begin{prop}[{\cite[Lm.2.11]{AyzCompl} or~\cite[Thm.3.6]{Styrt}}]\label{propLocalQuotient} For a representation of $T^{n-1}$ on $\mathbb{C}^n$ of complexity one in general position we have a homeomorphism $\mathbb{C}^n/T^{n-1}\cong \mathbb{R}^{n+1}$. \end{prop} \begin{defin}\label{definLeontRepres} Consider a collection of complexity one representations in general position $T^{n_i-1}\to\GL(\mathbb{C}^{n_i})$, for $i\in\{1,\ldots,s\}$, a complexity zero representation $T^d\to\GL(\mathbb{C}^d)$, and a trivial representation on $\mathbb{R}^l$. Then the product representation of $T^d\times\prod_{i=1}^{s}T^{n_i-1}$ on $V=\mathbb{R}^l\times\mathbb{C}^d\times\prod_{i=1}^{s}\mathbb{C}^{n_i}$ is called \emph{a Leontief representation}. It is called \emph{totally Leontief} if $d=0$. \end{defin} The reason for the chosen name of the term is explained in Appendix~\ref{secLeontief}. For a totally Leontief representation we have \[ V/T=\mathbb{R}^l\times\prod_{i=1}^{s}\mathbb{C}^{n_i}/T^{n_i-1}=\mathbb{R}^l\times\prod_{i=1}^{s}\mathbb{R}^{n_i+1}, \] so the orbit space is a topological manifold. Similarly, the orbit space of any non-totally Leontief representation is a half-space, that is a manifold with boundary. Theorems~\ref{thmIntroOpen} and~\ref{thmIntroBoundary} stated in the introduction assert that Leontief representations provide an exhaustive list of representations whose orbit spaces are manifolds (either open or bounded). The following is a reformulation of these theorems. \begin{thm}\label{thmAll}\mbox{} \begin{enumerate} \item Assume that the orbit space $V/T$ of a representation $T\to\GL(V)$ is homeomorphic to $\mathbb{R}^l$. Then the representation is weakly equivalent to a totally Leontief representation. \item Assume that the orbit space $V/T$ of a representation $T\to\GL(V)$ is homeomorphic to a half-space $\mathbb{R}_{\geqslant 0}\times\mathbb{R}^{l-1}$. Then the representation is weakly equivalent to a non-totally Leontief representation. \end{enumerate} \end{thm} The first result was proved in~\cite[Thm.1.3]{Styrt} in a much bigger generality: Styrt characterized all representations of $G\subset \GL(V)$ with orbit spaces homeomorphic to $\mathbb{R}^d$, under the assumption that the connected component of $G$ is a compact torus. Our proof of the first part of Theorem~\ref{thmAll} essentially follows the lines of the proof in~\cite{Styrt} for the particular case of $G=T$, however we simplify the argument by referring to some known results about matroids. A similar technique is applied to prove item 2 of Theorem~\ref{thmAll}. \section{Proofs}\label{secProofs} Recall that \emph{a(n abstract) simplicial complex} on a vertex set $A$ is a collection $K\subseteq 2^A$ of subsets of $A$, such that (1) $\varnothing\in K$; (2) if $I\in K$ and $J\subset I$, then $J\in K$. The elements of $A$ are called \emph{vertices}, the elements of $K$ are called \emph{simplices}. The value $\dim I = |I|-1$ is called the dimension of a simplex $I$. The maximal dimension of simplices is called the dimension of $K$. A simplex $I$ is called \emph{maximal} (or \emph{a facet}), if there is no $J\in K$ which strictly contains $I$. A simplicial complex is called \emph{pure} if all facets have the same dimension. In a pure simplicial complex, a simplex $J$ is called \emph{a ridge}, if $\dim J=\dim K-1$. An element $i\in A$ is called a ghost vertex of $K$ if $\{i\}\notin K$. If $K_1,K_2$ are simplicial complexes on the vertex sets $A_1,A_2$ respectively, then the join $K_1\ast K_2$ is a simplicial complex $\{I_1\sqcup I_2\subset A_1\sqcup A_2\mid I_1\in K_1, I_2\in K_2\}$. The full simplex on a set $A$ is the simplicial complex $\Delta_A=2^A$ of all subsets of $A$. The boundary of a simplex on a set $A$ is the simplicial complex $\partial\Delta_A=2^{[A]}\setminus\{A\}$ of all proper subsets of $A$. The ghost complex on a set $A$ is the simplicial complex $o_A=\{\varnothing\}$, in which all vertices are ghost. \begin{con}\label{conIndepComplex} For a multiset $\alpha=\{\alpha_1,\ldots,\alpha_r\}$ of vectors in a rational vector space $N_\Qo$ consider a simplicial complex $K(\alpha)$ on the vertex set $[r]=\{1,\ldots,r\}$ whose simplices are the linearly independent subsets of vectors: \[ \{i_1,\ldots,i_l\}\in K(\alpha)\Leftrightarrow \alpha_{i_1},\ldots,\alpha_{i_l} \text{ are linearly independent}. \] By definition, $K(\alpha)$ is the independence complex of the linear matroid determined by the collection $\alpha$. Since $\alpha$ spans $N_\Qo\cong\mathbb{Q}^k$, the complex $K(\alpha)$ is pure of dimension $k-1$. \end{con} \begin{rem}\label{remWedges} As proved by Bj\"{o}rner~\cite{Bjorner}, the independence complex of any matroid is shellable, hence homotopically Cohen--Macaulay. This implies that the geometrical realization $|K(\alpha)|$ is homotopy equivalent to a wedge of $(k-1)$-dimensional spheres. \end{rem} Recall the classical notion of combinatorial topology. \begin{defin}\label{definPseudomfd} A pure simplicial complex $K$ is called \emph{a (closed) pseudomanifold} if any ridge is contained in exactly two facets. A pure simplicial complex $K$ is called \emph{a pseudomanifold with boundary} if any ridge is contained in one or two facets. \end{defin} \begin{rem} If a ridge is contained in one facet, it is called \emph{a boundary ridge}. When we use the term pseudomanifold with boundary we assume that there exists at least one boundary ridge. So a pseudomanifold without boundary is not considered a pseudomanifold with boundary. \end{rem} Our proof of Theorem~\ref{thmAll} is essentially based on the next lemma. For convenience we call the assumption of item 1 in Theorem~\ref{thmAll} \emph{the manifold case}, and the assumption of item 2 \emph{the boundary case}. Corresponding representations are called respectively \emph{representations of manifold type}, and \emph{representations of boundary type}. \begin{prop}\label{propMfdPseudomfd} Consider a representation of a torus $T=T^k\to\GL(V)$, and let $\alpha=\{\alpha_1,\ldots,\alpha_r\}\inN_\Qo$ be the defining multiset of weights. Then the following hold true. \begin{enumerate} \item In the manifold case, the simplicial complex $K(\alpha)$ is a pseudomanifold. \item In the boundary case, the simplicial complex $K(\alpha)$ is a pseudomanifold with boundary. \end{enumerate} \end{prop} It will be more convenient for us to work with homology manifolds instead of topological manifolds. For a space $Q$, the relative homology modules $H_*(Q,Q\setminus\{x\};R)$ are called \emph{the local homology modules} at a point $x\in Q$ with coefficients in an abelian group $R$. Recall that a locally compact space $Q$ is called \emph{a (closed) $d$-dimensional homology manifold} (over $R$) if, for any $x\in Q$, the local homology modules are isomorphic to those of $\mathbb{R}^d$: \begin{equation}\label{eqHomologyModel} H_s(Q,Q\setminus\{x\};R)\cong H_s(\mathbb{R}^d,\mathbb{R}^d\setminus\{0\};R)\begin{cases} \cong R, & \mbox{if } s=d; \\ =0, & \mbox{otherwise}. \end{cases} \end{equation} A space $Q$ is called \emph{a $d$-dimensional homology manifold with boundary}, if its local homology modules are isomorphic to those of $\mathbb{R}_{\geqslant 0}\times\mathbb{R}^{d-1}$: either vanish (for boundary points) or satisfy~\eqref{eqHomologyModel} (for interior points). The next statement is a direct consequence of K\"{u}nneth formula for relative homology groups. \begin{lem}\label{lemHomMfd} Let us fix a ring $R$ of coefficients. \begin{enumerate} \item If $Q$ is a closed homology manifold, then so is $Q\times\mathbb{R}^s$. \item If $Q$ is a homology manifold with boundary, then so is $Q\times\mathbb{R}^s$. \item If $Q$ is not a homology manifold (with or without boundary), then neither is $Q\times\mathbb{R}^s$. \end{enumerate} \end{lem} The next technical lemma is needed for the proof of Proposition~\ref{propMfdPseudomfd}. \begin{lem}\label{lemCircle} Consider a $T^1$-representation on $V\cong\mathbb{R}^{2n}$, $n\geqslant 1$, with no trivial component. Then we have an alternative. \begin{enumerate} \item $n=1$, $\mathbb{C}^1/T^1$ is homeomorphic to $\mathbb{R}_{\geqslant 0}$. \item $n=2$, $\mathbb{C}^2/T^1$ is homeomorphic to $\mathbb{R}^3$. \item $n\geqslant 3$, $\mathbb{C}^n/T^1$ is not a homology manifold (neither closed nor a homology manifold with boundary) over any $R$. \end{enumerate} \end{lem} \begin{proof} Item (1) is straightforward, see Example~\ref{exCompl0}). Item (2) follows from Proposition~\ref{propLocalQuotient}. The additional details concerning item (2) are provided in Section~\ref{secMonopoles}. We concentrate on item (3). Since there is no trivial component, we have $V\cong V(\alpha_1)\oplus\cdots\oplus V(\alpha_n)$, where $\alpha_1,\ldots,\alpha_n\in\Hom(T^1,T^1)$ is a collection of nonzero integers. In the complex coordinates associated with the irreducible summands $V(\alpha_i)$, the representation takes the form \[ t(z_1,\ldots,z_n)=(t^{\alpha_1}z_1,\ldots,t^{\alpha_n}z_n). \] Restricting this action to the unit sphere $S^{2n-1}=\{\sum_{i=1}^{n}|z_i|^2=1\}$ we get the weighted projective space $\mathbb{C}P^{n-1}(\alpha)=\mathbb{C}P^{n-1}(\alpha_1,\ldots,\alpha_n)$ as the orbit space. Therefore $\mathbb{C}^n/T^1$ is an open cone $\Cone\mathbb{C}P^{n-1}(\alpha)$ with an apex denoted by $0$. We have \[ H_j(\Cone\mathbb{C}P^{n-1}(\alpha),\Cone\mathbb{C}P^{n-1}(\alpha)\setminus\{0\};R)\cong H_{j-1}(\mathbb{C}P^{n-1}(\alpha);R). \] The weighted projective space $\mathbb{C}P^{n-1}(\alpha)$ has the same homology as an ordinary projective space $\mathbb{C}P^{n-1}$, over any $R$~\cite{Kawa}. Therefore we have a nonvanishing local homology module $H_3(\mathbb{C}^n/T,(\mathbb{C}^n/T)\setminus\{0\};R)\cong H_2(\mathbb{C}P^{n-1})\cong R$ which is an obstruction for the $(2n-1)$-dimensional space $\mathbb{C}^n/T$ to be a homology manifold when $n\geqslant 3$. \end{proof} Now we can prove Proposition~\ref{propMfdPseudomfd} by reducing it to the circle case. \begin{proof} Since the trivial component of the action does not affect the statement we assume for simplicity that there is no trivial component. Consider any ridge $J=\{j_1,\ldots,j_{k-1}\}\in K(\alpha)$. Recall that the multiset $\alpha=\{\alpha_1,\ldots,\alpha_r\}$ linearly spans $N_\Qo\cong\mathbb{Q}^k$. Let $\Pi_J\subsetN_\Qo$ be the rational hyperplane spanned by $\alpha_{j_1},\ldots,\alpha_{j_{k-1}}$. We partition all weights' indices into two disjoint classes: $[r]=A_J\sqcup B_J$, one for the weights lying in $\Pi_J$, and another for the weights transversal to $\Pi_J$: \[ A_J=\{j\in[r]\mid \alpha_j\in \Pi_J\},\qquad B_J=[r]\setminus A_J. \] Notice that the set $B_J$ consists of all indices $i$ such that $\{\alpha_j\mid j\in \{i\}\sqcup J\}$ is linearly independent and has rank $k$. Therefore $B_J$ parameterizes the ways to complement the ridge $J$ to the facet in $K(\alpha)$. Hence \begin{equation}\label{eqClaimBj} |B_J| \text{ equals the number of facets containing } J. \end{equation} Consider the decomposition of $V=V_A\oplus V_B$ into two summands corresponding to the partition of the weights: \[ V_A=\bigoplus_{i\in A}V(\alpha_i)\cong \mathbb{C}^{|A_J|}, \qquad V_B=\bigoplus_{i\in B}V(\alpha_i)\cong \mathbb{C}^{|B_J|} \] Notice that $V_A$ is the fixed point set of the 1-dimensional toric subgroup \[ G=\Ker\prod_{j\in J}\alpha_j\colon T^k\to T^{k-1}=\Ker\prod_{j\in A_J}\alpha_j\colon T^k\to T^{|A_J|} \] (more precisely, we take the connected component of $1$ in these kernels to avoid disconnected groups). A general fact is described in Section~\ref{secLowerFaces}: the flats of the linear matroid $\alpha$ are in bijective correspondence with the fixed point sets of toric subgroups acting on $V$. Here we apply this correspondence to the flat $A_J$ of the matroid of weights. Now we can summarize the idea of proof as follows. If we take a generic point $x$ in $V_A$, its tangent space decomposes as the sum of the tangent and normal components (parallel to $V_A$ and $V_B$ respectively). Then, informally, the $T^k$-action in vicinity of $x$ splits into ``the product'' of the $T^k/G$-action on the tangent component and the $G$-action on the normal component. Since $x$ is generic in $V_A$, the action of $T^k/G$ is free on the tangent component, so the orbit space of the tangent space is a manifold, and does not affect the local topology of the orbit space by Lemma~\ref{lemHomMfd}. The $G$-action on the normal component is a circle representation on $\mathbb{C}^{|B_J|}$. We are in position to apply Lemma~\ref{lemCircle}. In the manifold case, this lemma implies $|B_J|=2$, and in the boundary case it implies $|B_J|=1$ which proves the required statement according to~\eqref{eqClaimBj}. In order to justify this argument, the Slice Theorem should be applied. Let $x$ be a point in $V_A\subset V$ such that all its coordinates in this subspace are nonzero. For example, one can take \[ x=(\underbrace{1,\ldots,1}_{A_J},\underbrace{0,\ldots,0}_{B_J}). \] Let $\tau_xV$, $\tau_xV_A$, and $\nu_x$ be respectively the tangent space to $V$, the tangent space to $V_A$, and the normal space of the embedding $V_A\subset V$ taken at the point $x$. Obviously, $\tau_xV=\tau_xV_A\oplus \nu_x$, $\tau_xV_A\cong \mathbb{C}^{A_J}$ and $\nu_x\cong\mathbb{C}^{B_J}$. The stabilizer $T_x$ of the point $x$ is the circle $G$ introduced above, so the orbit $T^kx$ is $(k-1)$-dimensional. The Slice Theorem states that the orbit $T^kx$ has a $T^k$-invariant neighborhood $U$ equivariantly diffeomorphic to \[ T^k\times_G(\tau_xV/\tau_xT^kx) \] Let $[x]\in V/T^k$ denote the class of the point $x$ in the orbit space. Then $[x]$ has an open neighborhood in $V/T^k$ equal to \begin{equation}\label{eqLocalPatch} U/T^k\cong (T^k\times_G(\tau_xV/\tau_xT^kx))/T^k=(\tau_xV/\tau_xT^kx)/G. \end{equation} Notice that the whole orbit $T^kx$ lies inside $V_A$, so $\tau_xT^kx\subset\tau_xV_A$. Moreover, since $G$ is the stabilizer of $V_A$, the $G$-action on the whole subspace $\tau_xV_A$ is trivial. Therefore the $G$-action on $\tau_xV/\tau_xT^kx$ has the same weights as the $G$-action on $\tau_xV/\tau_xV_A=\nu_x$. On the other hand, the $G$-action on $\nu_x\cong \mathbb{C}^{|B_J|}$ is nontrivial (its weights are the projections of $\{\alpha_j\mid j\in B\}$ under the induced map $N=\Hom(T^k,T^1)\to \Hom(G,T^1)\cong \mathbb{Z}$, and these projections are nonzero by the construction of $B$). Therefore, applying Lemma~\ref{lemCircle} to the representation in~\eqref{eqLocalPatch} we see that the manifold case implies $|B_J|=2$ and the boundary case implies $|B_J|=1$ as desired. \end{proof} By Remark~\ref{remWedges}, any independence complex $K(\alpha)$ is homotopically equivalent to a wedge of spheres. If, moreover, it is a pseudomanifold, there is a fundamental class in the top homology group, so we necessarily have one sphere in the wedge. If $K(\alpha)$ is a pseudomanifold with boundary, then the wedge consists of zero spheres, hence in this case $|K(\alpha)|$ should be contractible. It happens that the condition of being both a matroid and a pseudomanifold puts even a stronger restriction on the combinatorics of a complex as proved by Provan and Billera in~\cite{BilProv}. \begin{prop}[\cite{BilProv}]\label{propBillProv}\mbox{} \begin{enumerate} \item If $K$ is an independence complex of a matroid and, at the same time, a closed pseudomanifold, then $K$ is isomorphic to a join of boundaries of simplices, and, probably, a ghost complex. \item If $K$ is an independence complex of a matroid and, at the same time, a pseudomanifold with boundary, then $K$ is isomorphic to a join of a simplex, boundaries of simplices, and, probably, a ghost complex. \end{enumerate} \end{prop} \begin{rem}\label{remGhostIsComplexityOne} Note that the ghost complex on one vertex can be formally considered as the boundary of 0-dimensional simplex. So it will not be a mistake to remove the mention of ghost simplex from the formulation of Proposition~\ref{propBillProv}. \end{rem} To finalize the proof of Theorem~\ref{thmAll} it remains to make a simple terminological observation. \begin{rem}\label{remCorrespondence} Recall that any collection of vectors (weights) $\alpha$ gives rise to the independence complex $K(\alpha)$. Properties of simplicial complexes translate to weight systems as follows. \begin{enumerate} \item There is an operation of direct sum of matroids. If $\alpha\subset\mathbb{Q}^k$, and $\beta\subset\mathbb{Q}^l$, then the direct sum is defined $\alpha\sqcup\beta\subset\mathbb{Q}^k\times\mathbb{Q}^l\cong\mathbb{Q}^{k+l}$, where $\alpha$ sits in the first summand, and $\beta$ sits in the second. Then $K(\alpha\sqcup\beta)=K(\alpha)\ast K(\beta)$. Vice versa, if $K(\alpha)$ splits as the join of two independence complexes, then the weights of $\alpha$ split in two groups lying in transversal vector subspaces, corresponding to the join factors. Recalling that the ambient vector spaces in our considerations are $N_\Qo=\Hom(T,T^1)\otimes\mathbb{Q}$, it is seen that the join operation on the simplicial complexes corresponds to the direct product of torus representations. \item A simplex $\Delta_A$ is an independence complex of a linearly independent set in $N_\Qo$. This situation corresponds to representations of complexity zero, see Example~\ref{exCompl0}. \item A boundary of simplex $\partial\Delta_A$ is an independence complex of a weight system $\alpha_1,\ldots,\alpha_{|A|}$ where every $|A|-1$ vectors are independent, but the whole system is not. These are the weights of complexity one representations in general position by Definition~\ref{definComplOneGenPos}. \item Ghost vertices resemble loops in a matroid. They correspond to zero weights, in other words, the trivial component of the action. In accordance with Remark~\ref{remGhostIsComplexityOne}, a trivial torus action on $\mathbb{C}$ (or $\mathbb{R}$) can be considered as a degenerate case of complexity one torus action in general position. \end{enumerate} \end{rem} Theorem~\ref{thmAll} now follows from Propositions~\ref{propMfdPseudomfd} and~\ref{propBillProv} and Remark~\ref{remCorrespondence}. \section{Torus actions}\label{secTorusActions} \begin{con}\label{conFaceSubmanifolds} Consider a smooth action of a torus $T$ on a connected smooth manifold $X$. If $H\subset T$ is a connected subgroup, any connected component $Y$ of the fixed point submanifold $X^H$ is called \emph{an invariant submanifold} of the action. Since $T$ is commutative, invariant submanifolds are stable under $T$-action. The dimension of the generic toric orbit on $Y$ is called \emph{the rank} of an invariant submanifold $Y$. If $Y\cap X^T\neq\varnothing$ (i.e. $Y$ contains a $T$-fixed point), then $Y$ is called \emph{a face submanifold} of the torus action. The collection of all face submanifolds in $X$ is a poset (graded by the ranks) which we denote by $S(X)$. The poset $S(X)$ has the greatest element, the manifold $X$ itself. All minimal elements have rank $0$, these are the connected components of the fixed point set~$X^T$. The orbit space $Y/T$ of a face submanifold $Y$ is called \emph{a face} of the action. Faces are subspaces of the orbit space $X/T$. Obviously, they are partially ordered by inclusion, and the poset of faces is naturally identified with $S(X)$. The poset $S(X)$ of faces carries a lot of useful information about the torus action as evidenced by the next examples. \end{con} \begin{ex} If $X$ is a smooth complete toric variety, $S(X)$ is isomorphic to the poset of cones of its fan ordered by reversed inclusion. In particular, the Betti numbers of $X$ are determined by the combinatorics of $S(X)$ since they coincide with the $h$-numbers of the corresponding simplicial sphere. Similar statement holds for topological generalizations of toric varieties: quasitoric manifolds~\cite{DJ} and equivariantly formal torus manifolds~\cite{MasPan}. \end{ex} \begin{ex} In~\cite{AyzCompl,AyzMasEquiv} the combinatorics and topology of the poset $S(X)$ was described for torus actions of complexity one in general position with isolated fixed points. In particular, it was proved in~\cite{AyzMasEquiv}, that the Betti numbers of equivariantly formal manifolds with the listed properties are determined by the poset $S(X)$. \end{ex} \begin{rem} If a torus action on $X$ is equivariantly formal and has isolated fixed points, we do not know if the poset $S(X)$ determines the Betti numbers of $X$ in general. \end{rem} \begin{rem} The study of general properties of the face posets of torus actions with isolated fixed points was initiated by the first author in~\cite{AyzCherep,AyzMasSolo}. Nontrivial examples of such posets related to regular semisimple Hessenberg varieties appeared in~\cite{AyzBuchGraph}. \end{rem} The assumption that a face submanifold should intersect the fixed point set allows to localize consideration of orbit spaces to the vicinity of fixed points. In the vicinity of fixed points the action can be linearized and reduced to the study of torus representations. Under appropriate assumptions about fixed points, we can prove a smooth version of Theorem~\ref{thmAll}. For convenience we introduce the following notion. \begin{defin}\label{definLeontActn} A $T$-action on a smooth manifold $X$ is called \emph{a Leontief (totally Leontief) action}, if, for any fixed point $x\in X^T$, the tangent representation $\tau_xT$ is a Leontief (resp. totally Leontief) representation. \end{defin} The action is called non-totally Leontief if it Leontief but not totally Leontief. Equivalently, all fixed points have Leontief tangent representations but at least one of these tangent representations is not totally Leontief. \begin{prop}\label{propOrbitsLeontief} Let a torus $T$ act smoothly on a connected closed smooth manifold $X$. Assume that each invariant submanifold of $X$ is a face submanifold, in other words, each invariant submanifold contains a fixed point. The the following statements hold. \begin{enumerate} \item The action is totally Leontief if and only if $X/T$ is a closed topological manifold. \item The action is non-totally Leontief if and only if $X/T$ is a topological manifold with boundary. \item The action is non-Leontief if and only if $X/T$ is not a topological manifold. \end{enumerate} \end{prop} \begin{proof} The proof repeats~\cite[Thm.2.10]{AyzCompl} so we only sketch a general idea. In the vicinity of a fixed point $x$, the orbit space is homeomorphic to $\tau_xX/T$ so the statement follows from Theorem~\ref{thmAll}. If $x'$ is any other point, then $x'$ lies in a principal orbit of some invariant submanifold $Y$. Since $Y$ contains some fixed point $x$, we can continuously move $x'$ until we get in the vicinity of $x$. Since $[x]$ has a neighborhood in $X/T$ homeomorphic to an open disc (or a halfspace), the same holds for the orbit class $[x']$. \end{proof} \begin{rem} The assumption that each invariant submanifold is a face submanifold may seem complicated and hard to check in practice. However, most actions automatically satisfy this property. All actions with $H^{\odd}(X)=0$ have this property as follows from~\cite[Lm.2.2]{MasPan}. In particular, equivariantly formal torus actions with isolated fixed points have the property. Algebraic torus actions on smooth projective varieties satisfy this assumption according to Bialynicki-Birula theory, see details in~\cite{AyzCompl}. \end{rem} \section{Faces of Leontief representations}\label{secLowerFaces} If a torus representation $T\to\GL(V)$ is given, all invariant submanifolds of $V$, in the sense of Construction~\ref{conFaceSubmanifolds}, are $T$-invariant vector subspaces of $V$. All of them are face submanifolds, since they necessarily contain the fixed point $0\in V$. It is not very difficult to describe the combinatorial condition for a $T$-invariant vector subspace of $V$ to be a face submanifold. Let us recall the notion of flats of a linear matroid. \begin{con} Let $\alpha=\{\alpha_1,\ldots,\alpha_m\}$ be a linear matroid, that is a multiset of vectors in some vector space $W$. A subset $\{i_1,\ldots,i_s\}\subseteq[m]$, or the corresponding submultiset $A=\{\alpha_{i_1},\ldots,\alpha_{i_s}\}$, is called \emph{a flat} of the linear matroid if $A$ is an intersection of $\alpha$ with some vector subspace $\Pi\subset W$. The dimension of the linear span of $A$ is called the rank of a flat $A$. The flats of the matroid $\alpha$ are partially ordered by inclusion, they form a graded poset, which is called \emph{the geometric lattice} of the matroid $\alpha$ and is denoted $\Flats(\alpha)$. \end{con} In~\cite{AyzCherep} we observed the following \begin{prop} Let $V=\bigoplus_{i=1}^rV(\alpha_i)\oplus\mathbb{R}^{m-2r}$ be a representation of the torus with the weights $\alpha$. Then all face submanifolds of $V$ have the form \[ \bigoplus_{\alpha_i\in A}V(\alpha_i)\oplus\mathbb{R}^{m-2r} \] where $A$ is a flat of the rational matroid of weights $\alpha\subsetN_\Qo$. Therefore, in particular, the poset $S(V)$ is isomorphic to the geometric lattice $\Flats(\alpha)$. \end{prop} This statement was proved in the work~\cite{AyzCherep} under the assumption that the trivial component $\mathbb{R}^{m-2r}$ vanishes, however, the proof follows the same lines in the general case. \begin{ex}\label{exCompl0Lattice} If the representation of $T^n$ on $V\cong\mathbb{C}^n$ is a representation of complexity zero, then $\alpha=\{\alpha_1,\ldots,\alpha_n\}$ is a basis of $N_\Qo\cong\mathbb{Q}^n$. In this case every subset of $\alpha$ is a flat, so the poset $S(V)\cong\Flats(\alpha)$ is the boolean lattice $\mathbf{B}_n$. \end{ex} \begin{ex}\label{exCompl1Lattice} If the representation of $T^{n-1}$ on $V=\mathbb{C}^n$ is a representation of complexity zero, then we have a collection of $n$ weights $\alpha=\{\alpha_1,\ldots,\alpha_n\}$ in $N_\Qo\cong\mathbb{Q}^{n-1}$. Every subset $A\subseteq\alpha$ is a flat unless $|A|= n-1$. Let us denote the resulting poset by $\mathbf{Sp}_{n-1}$: \[ \mathbf{Sp}_{n-1}=\{A\subseteq[n]\mid |A|\neq n-1\}. \] This poset is isomorphic to the boolean lattice $\mathbf{B}_n$ with all coatoms removed. \end{ex} Recall from Definition~\ref{definLeontRepres} that the product representation of $T^d\times\prod_{i=1}^{s}T^{n_i-1}$ on $V=\mathbb{R}^l\times\mathbb{C}^d\times\prod_{i=1}^{s}\mathbb{C}^{n_i}$ is called a Leontief representation. We call it a Leontief representation of type $(d,\underline{n},l)=(d,\{n_1,\ldots,n_s\},l)$. Since the product of matroids induces the product of the corresponding geometric lattices, we get the following consequence of Examples~\ref{exCompl0Lattice} and~\ref{exCompl1Lattice}. \begin{prop}\label{propFacePosetLeontief} For a Leontief representation $V$ of type $(d,\underline{n},l)$, the face poset $S(V)$ is isomorphic to \[ \mathbf{B}_d\times\prod_{i=1}^s\mathbf{Sp}_{n_i-1}. \] Let $D, N_1,\ldots,N_s$ be disjoint sets of cardinalities $d,n_1,\ldots,n_s$ respectively. Then each face submanifold of $V$ is encoded by a string $(A_0,A_1,\ldots,A_s)$, where \[ A_0\subseteq D, \text{ and for all } i\in[s]=\{1,\ldots,s\} \text{ we have } A_i\subseteq N_i, |A_i|\neq n_i-1. \] \end{prop} In toric topology, the structure of the induced torus action on the face submanifolds sometimes plays an important role. If an effective action of $T$ on $X$ has rank $k$, and $Y\subset X$ is a face submanifold of rank $l$, then the induced action of $T$ on $Y$ has noneffective kernel of dimension $k-l$. We may quotient out this noneffective kernel. It should be noted that the class of Leontief representations is closed under taking faces. \begin{lem}\label{lemFaceIsLeontief} Consider a Leontief representation $V$ of type $(d,\{n_1,\ldots,n_s\},l)$, and let $U$ be a face submanifold of $V$ corresponding to the string $(A_0,A_1,\ldots,A_s)$ as in Proposition~\ref{propFacePosetLeontief}. Let $\ca{M}=\{i\in[s]\mid |A_i|=n_i\}$. Then $U$ is a Leontief representation of type $(d',\underline{n'},l)$ where \[ \underline{n'}=\{n_i\mid i\in \ca{M}\},\text{ and } d'=|A_0|+\sum_{i\in[s]\setminus \ca{M}}|A_i|. \] \end{lem} In other words, the complexity one component $A_i$, $i=1,\ldots,s$, of the string either contributes to a complexity one component (if $|A_i|=n_i$), or contributes to the complexity zero component (if $|A_i|\leqslant n_i-2$). The lemma is proved by a straightforward examination of flats in the weight matroid of a Leontief representation. Lemma~\ref{lemFaceIsLeontief} immediately implies \begin{cor}\label{corFaceIsLeontief} The induced action on a face submanifold of a Leontief action is Leontief. \end{cor} Recall that a face of an action is the orbit space of a face submanifold. Corollary~\ref{corFaceIsLeontief}, Theorem~\ref{thmAll}, and Proposition~\ref{propOrbitsLeontief} imply the following result. \begin{prop}\label{propMfdFaceMfd} Let a torus $T$ act smoothly on a closed smooth manifold $X$. Assume that each invariant submanifold of $X$ is a face submanifold. If the orbit space $X/T$ is a topological manifold (either closed or with boundary) then each face of the action is also a topological manifold (either closed or with boundary). \end{prop} \begin{ex} For actions of complexity zero (which are particular cases of Leontief actions), the orbit space is a manifold with boundary. All its faces are also manifolds with boundary except for the minimal elements of $S(X)$. These minimal elements are the connected components of $X^T$: these are closed manifolds\footnote{Abusing notation we identify $X^T$ with $X^T/T$}. Note that an isolated point is considered a closed manifold not a manifold with boundary. \end{ex} \begin{ex} For actions of complexity one in general position, all proper face submanifolds (all except $X$ itself) have complexity $0$. The local structure of faces in the vicinity of a fixed point was described in~\cite{AyzCompl} and axiomatized in the notion of \emph{a sponge}. \end{ex} Finally, we make a simple observation which relates Leontief actions to the work of Cherepanov~\cite{Cher} on complexity one actions in non-general position. \begin{lem} Every representation of complexity one is a Leontief representation. \end{lem} \begin{proof} A representation of complexity one is characterized by $n$ weights $\alpha_1,\ldots,\alpha_n$ in the $(n-1)$-dimensional vector space $N_\Qo\cong\mathbb{Q}^{n-1}$. Hence there is a unique (up to multiplier) linear relation $c_1\alpha_1+\cdots+c_n\alpha_n=0$. The weights' subset $\{\alpha_i\mid c_i\neq0\}$ corresponds to a complexity one action in general position, while the remaining weights correspond to an action of complexity $0$. \end{proof} \begin{cor} For an action of complexity one in non-general position, the orbit space is a topological manifold with boundary. All its faces are topological manifolds, either closed or with boundary. \end{cor}
\section{\label{sec:calg}{Classical approach}} In both of the above use cases (and, also in similar other application domains) the primary challenge is the scalability of the traditional methodologies. These networks are dynamic complex systems with non-linear interactions and often need to be analyzed at a system level. However, the networks can comprise of tens of thousand of nodes and that is where many traditional methods run into computational challenges. One potential solution is to find appropriate clusters, or communities in these networks and thereby reduce the dimensionality of the problem by partitioning the large graph into smaller sub-graphs. \subsection{Community Detection} Large networks exhibit lack of homogeneity both globally and locally. The local inhomogeneities give rise to a dense concentration of edges within groups of vertices and very sparse connections between groups. This feature of a network is called its community structure or clustering. Communities reveal the hierarchical organization of the network and mark groups of nodes which share common properties, exchange more transactions or information or have similar functions \cite{lu2018, santo2010}. Community detection is therefore a very important task in network analysis. The presence of communities in real world networks is quite intuitive. However, the task of detecting these communities is often very challenging. One problem is that the definitions of a community and a partition are not rigorous. Classical techniques for data clustering, like hierarchical, partitional and spectral clustering have been adopted for graph clustering. Other methods include neural network clustering and multi dimensional scaling techniques, such as singular value decomposition and principal component analysis. Many of these clustering techniques are NP-hard. Spectral clustering uses the graph Lapalacian. Normal graph Lapalacian is defined as follows: \begin{equation} L(G) = D(G) - A(G) \end{equation} where, $A$ is the adjacency matrix of the graph $G$ and $D$ is the degree matrix. The Laplacian is positive semidefinite, that is, all eigenvalues are non-negative. Eigenvector decomposition of the Laplacian is closely related to the clustering problem. The number of zero eigenvalues correspond to the number of connected components in the graph. Eigenvalues close to zero denote that there is almost a separation into two components. Hence, if there are $N_c$ clusters in a network, in spectral clustering it is required to find the eigenvectors of the Laplacian corresponding to the smallest $N_c$ eigenvalues. The second smallest eigenvalue of the Lapalacian is called the Fiedler eigenvalue and the corresponding eigenvector is called the Fiedler vector. Fiedler value indicates how well connected the graph is and Fiedler vector can be used to bisect the graph based on the sign of the corresponding element in the vector. For large graphs with $N$ vertices it is however impossible to have exact diagonalization solutions as the time complexity is $O(N^3)$. In such cases approximate algorithms are used \cite{santo2010}. As outlined in \cite{santo2010}, approximate algorithms, including those for sparse graphs cannot scale faster than $O(N)$ or $O(M)$ (where $M$ is the number of edges in the graph). Of even more serious concern may be the memory requirements for diagonalization which also scale as $O(N)$. Hence, for large graphs, even approximate algorithms on classical computers may be insufficient to diagonalize the graph Laplacian as they will scale at least linearly in the number of vertices and edges of the graph. In these cases, the rapidly developing technology of quantum computing may provide an edge over classical methods. \section{\label{sec:intro}{Introduction}} Complex networks are ubiquitous. Systems like power grids, the World Wide Web, social interactions, locomotive and airline networks, cellular networks, food webs, and sensor networks can all be modeled as complex networks. Additionally, in this current era of Industrial Internet of Things, more and more assets are continuously getting connected to each other resulting in large, complex and dynamic networks. The heightened connectivity leads to increased efficiency but often comes at the cost of increased vulnerability. Therefore, it is, important to closely monitor these networks, anticipate and prepare for disruptions and quickly identify efficient mitigation strategies. However, given the size and dynamic nature of these networks, traditional approaches based on discrete optimizations and statistical predictions often face significant limitations. To circumvent some of the limitations in the current modeling techniques, it turns out one can leverage the community structure of the networks. In addition, these network communities also provide a low dimensional graph embedding which can be used in many machine learning applications. A traditional method used for community detection is network partitioning. There are existing classical algorithms for network partitioning but the computational and time complexity of such algorithms can grow significantly for large graphs. In this work, we briefly discuss how the rapidly developing technology of quantum computing may provide an edge over classical methods. \section{\label{sec:qalg}{Quantum approach}} Quantum computers work with quantum bits, or `qubits', which differ from classical bits in that they can be in a superposition of 0 and 1 at the same time. Further, qubits can be entangled, so that a system of $n$ qubits can be in a superposition of $2^n$ classical states (bit strings) $k$ described by the quantum state $|\phi\rangle=\sum_k a_k |k\rangle$. Here $a_k$ are complex numbers which satisfy the rule $\sum_k |a_k|^2=1$. On quantum computers, the problem of finding eigenvalues of a Hermitian matrix can be tackled using the quantum phase estimation algorithm, which proceeds as follows: given a unitary matrix $U$ and a quantum state $|\psi\rangle$ defined on $n=\log_2(N)$ qubits such that $U|\psi\rangle=e^{i2\pi\theta}|\psi\rangle$, phase estimation allows one to determine $\theta$ with precision $\delta$ using $O(\log(1/\delta)+\log(N))$ qubits with $O(1/\delta)$ controlled applications of the unitary matrix $U$. $U$ can be expressed as the `time-evolution' under the Hermitian matrix. In the problem of (undirected) graph partitioning, the Laplacian $L$ being real and symmetric is Hermitian, so we can write $U=e^{iLt}$. Let's assume that $L$ is normalized such that its maximum eigenvalue is 1 and we set $t=2\pi$. Then $\delta$ is chosen such that it is the smaller of the distance between the eigenvalues of interest and the precision to which an eigenvalue needs to be known. For quantum phase estimation to be effectively applied, one must then find an efficient implementation of $U$, as well as an efficient way to prepare the quantum state $\psi$. We first outline the task of implementing $U=e^{iLt}$. A technique for this is given in Ref. \cite{low2019}. According to this method, given a $d$-sparse Hermitian matrix $L$ (which is normalized such that $\frac{||L||}{d||L||_{max}}=1$), one can implement the operator $e^{iLt}$ (up to an error $\epsilon$) with $O(t+\log(1/\epsilon))$ calls to an oracle that returns the matrix element given the row and column, and an oracle that returns a sequence of column indices in a particular row. These oracles will typically be implemented in time $O(\log(N))$. If $L$ is sparse, as is typical for practical cases of interest, the application of $L$ with sparsity $d$ will have time complexity to leading order of $O(d\log(N))$, giving an overall runtime that scales as $O(d\log(N)/\delta)$. Thus, the quantum algorithm provides exponential speed-up in the size of the matrix for both time and memory. More speculatively, the time complexity may be further reduced if as a preprocessing step, a variational quantum algorithm is used to learn a quantum circuit which encodes time-evolution under the graph Laplacian. While this is a heuristic procedure for which time-complexity scaling is not guaranteed, it can presumably lead to finding a more efficient implementation of the time-evolution operator. This should form an area of research for risk management on near-term quantum computers. Next, we turn to the task of preparing the initial state $|\psi_0\rangle$ on which $U$ will act. Since we don't know the eigenvectors in advance, it is not possible to prepare an exact version of $|\psi\rangle$ even if we knew how to do it efficiently. Therefore, our goal is to prepare $|\psi_0\rangle$ as close to $|\psi\rangle$ as possible. On repeating the phase estimation procedure several times, a distribution over the eigenvalues will be obtained, where the probability of obtaining a particular value is equal to $|\langle\psi_j|\psi_0\rangle|^2$. In principle, starting with a random input state will give some non-zero overlap with the desired largest eigenvectors, but these may be too small to be practically useful. Hence a few different strategies can be adopted: 1. Using matrix product states which scale as $\log(n)$ to prepare a bounded-entanglement approximation of the largest eigenvalue state, and converting this to a quantum circuit. 2. Adiabatic approach: This involves starting in a quantum state that is a product state of the qubits, or one that can be prepared with a low-depth circuit. This starting state is the ground state of a known Hamiltonian whose time-evolution is easily implementable. Then a discretized adiabatic evolution which slowly changes the time-evolution from the starting Hamiltonian to that under $L$ can be used to prepare an approximation of the ground states of $L$. The time for this approach scales as $1/\delta$. 3. Variational approach: A heuristic approach which uses a variational quantum circuit whose parameters are tuned according to a cost function based on $L$ In addition to the eigenvalues, eigenvectors can also be determined by sampling the output eigenstate. The probability of measuring a particular basis state $k$ is $|a_k|^2$, where $a_k$ is the eigenvector element. Therefore, the largest elements of the eigenvector can be determined efficiently. More precisely, the eigenvector elements can be determined to a precision $1/\sqrt{N_{\text{samples}}}$, where $N_{\text{samples}}$ is the number of times the procedure is repeated. The number of 0 eigenvalues can be determined by preparing multiple copies of $|\psi_0\rangle$ starting from orthogonal initializations of the qubits and then projecting them into a state which gives 0 eigenvalue after phase estimation. The number of unique states that can be so prepared then gives the degeneracy of the eigenvalue. \section{\label{sec:real_network}{Networks in the real world}} Networks in the real world, such as power grids, supply delivery networks and social networks exhibit a high level of order and organization. The degree distribution in such networks often follows a power law in the tail, denoting the fact that many vertices with low degrees coexist with a few vertices with large degrees. These networks exhibit many interesting structural properties, especially when they are large scale and grow in a decentralized and independent fashion, thus not the result of a global, but rather of many local autonomous designs. We briefly describe here two examples of such critical infrastructures, where network analysis can provide significant benefits: supply chain and power grid. \subsection{\label{sec:scr}{Supply Chain Risk and Resilience}} Suppliers in a supply chain are divided according to the distance to the final product. Tier 1 suppliers provide product to the manufacturer directly. Tier 3 suppliers are two steps down in the chain. Traditional supply chain risk management focuses on Tier 1 suppliers of “critical” goods; however, risk can lie in any tier or echelon of a supply chain \cite{yan2015}. Suppose a lesser-known supplier, several tiers deep in the supply chain, goes out of business due to a lack of working capital availability (red nodes in Fig.~\ref{fig:scn}). This bankruptcy then leads to a cascading disruption in the supply chain due to this company’s structural position in the extended network, ultimately disrupting or shutting down the manufacturing facility of a major OEM (Original Equipment Manufacturer). \begin{figure}[b] \includegraphics[width=0.75\columnwidth]{scn.png \caption{\label{fig:scn} A multi-echelon supply chain} \end{figure} One such example is Evonik Industries, a little-known raw materials supplier, whose plant explosion in 2012 caused major disruptions in the production of automobiles throughout the global automotive industry~\cite{evonik}. Identifying and mitigating these types of disruption risks is difficult since many such critical suppliers can be several tiers deep in the supply chain and hence not visible to risk managers until the disruption is already occurring. In recent years, techniques from the domains of graph theory and complex network analysis (CN) have been adapted to address such problems and quantify systemic risks and resilience of the supply network in a scalable fashion. This approach may enable risk managers to understand the indirect effects that interventions in one part of the supply chain can have on another part \cite{ritter2004}. Graph analytics exploit network topology to define properties such as centrality measures, clusters, critical nodes, tipping points and resilience. Risk managers can use these features to gain insights into the nature of the network and be proactive in taking early mitigation steps to address risks at their nascent stages. For instance, this framework can rank suppliers who are more central to the network and should be monitored more closely. These well-connected suppliers play a major role in the network by controlling the overall performance of the network and ensuring a system wide coordination to drive greater efficiency. Due to their high connectivity, these hub firms have an outsized influence over the network, which leads to better self-coordination, less duplications and lower transaction costs. One can measure the impact that a supplier has on the efficiency of a network by calculating the supplier’s contribution to the characteristic path of the network. A network with short characteristic path length will ensure quick diffusion of new information enabling more efficient material and financial flows throughout the network. If suppliers default and are removed from a network, the characteristic path lengths will increase, and ultimately vertex pairs will become disconnected and communication between them through the network will become impossible. One can develop metrics of rapid change to signal that the supply network is approaching a tipping point. In many networks tipping points exist at which dynamics of the network abruptly changes. War, riots, pandemic, natural disaster, or economic downturn are obvious triggers of such tipping points. Yet, not all networks succumb to such exogenous shocks. One can investigate how stronger financial health of the suppliers can make the network more resilient to external risks. \subsection{\label{sec:grid}{Power Grid}} Power grid is a highly complex cyber-physical system with lots of interconnected components. Physical measurement data are delivered from remote technical units (RTUs) to supervisory control and data acquisition (SCADA) systems and then to Advanced Energy Management System (AEMS) applications responsible for controlling and monitoring the power system. This gives rise to a significant challenge in maintaining and operating the grid while ensuring high level of resiliency against normal disruptions and cyber attacks. Graph theory provides a mathematical object that naturally encodes relationships and hence provides a robust framework to build such applications ~\cite{PhysRevResearch.3.023161,doi:10.1063/1.5092629,Szoplik2010a, Szoplik2010b}. For instance, with the data cast as a graph, the problem often boils down to identifying a small subset of nodes with much higher volume of network traffic, than is typical for those nodes, indicating the onset of some malicious activity. Essentially the goal it to identify network interactions which do not fit the model of typical, normal behavior and thereby detect and counter malicious activity. But identifying graph patterns from within the vast and complex network is a classic subgraph isomorphism problem and is known to be computationally expensive and NP-complete ~\cite{Cook_1971, Cormen_1990}. Additional complexity is the requirement to detect the pattern before it is fully instantiated. This introduces new algorithmic challenges because one cannot afford to index a dynamic graph frequently enough for applications with real-time constraints. \section{\label{sec:conc}{Conclusions and Proposed Future Work}} Large scale complex networks are key for today’s world, with multiple national security implications. However, the large sizes of these networks often limit the use of standard algorithms and approaches to analyze them. Community structure of the networks provides a powerful feature to circumvent some of these challenges. Since there is an expected low level of interdependence between the communities, the ensuing analysis more naturally renders to parallel computation thereby making it scalable and more efficient. For instance, identifying clusters of suppliers based on industrial sectors or regions enables a supply chain risk manager to better understand the risk dynamics and their inter-dependencies while simultaneously reducing the computational burden of analysing the full supply delivery network. Network partitioning is a popular technique in community detection and can be done by diagonalizing the graph Laplacian. However, this approach is constrained by time and memory on classical computers. Quantum computing can identify eigenvalues and eigenvectors for sparse matrices exponentially faster in the size of the matrix compared to classical computers and thus has applications in risk management of networks. While quantum computing is a nascent technology, the quality and robustness of quantum computers is improving rapidly. We propose the following research strategy for pursuing this approach:\\ - Identify examples of networks that are relevant for critical infrastructure\\ - Develop concrete quantum algorithms customized for these networks and implement them in a quantum software framework\\ - Carry out resource estimates for the number of qubits and fidelity required to analyze real-life networks\\ - Test the algorithms on simulators to verify correctness and robustness to noise\\ - Test simplified versions of these algorithms on available quantum hardware At the conclusion of the vision detailed above, one would be able to quantify the impact of quantum computing on network partitioning, a computing problem with dramatic civilian and national security implications. In addition, the effort will lay out the hardware timeline for practical implementation of quantum solutions to this problem. \section{\label{sec:poc}{Realization on Quantum Hardware}} Quantum hardware, while still in a nascent stage, is rapidly advancing to be powerful enough to demonstrate algorithms like the ones described above. Leading quantum hardware platforms include trapped ions, superconducting qubits, neutral atoms, and photonic qubits. With the rapid development of quantum computing hardware, proposals for benchmarking performance in an application-oriented manner have been put forth \cite{qedc}. One such example is Algorithmic Qubits (AQ) \footnote{{https}://ionq.com/posts/february-23-2022-algorithmic-qubits}. Under this definition, quantum hardware from IonQ has advanced from AQ 6 to AQ 23 in 2 years, and is projected to reach AQ 64 by 2025, at which point it will be beyond the simulation capabilities of classical computers. Small scale demonstrations of quantum phase estimation algorithms discussed in this white paper include one on a silicon photonic chip \cite{photonic} and using machine learning to enhance the measurement of eigenvalues \cite{ml}.
\section{\label{sec:mc}Monte Carlo Approach} For cascades with more than two steps we have not worked out the analytical distributions as we have in Sec.~\ref{sec:twostep}. For these many step cascades we use a Monte Carlo approach that allows us to include arbitrarily many steps in the sequence. The main limitation is that we compute one thermal neutron capture realization at a time so that it might be prohibitive to produce a PDF with sufficient smoothness (high statistics) for cascades with small overall likelihood. On the other hand, those cascades represent only a small change to an experimental spectrum~\cite{PhysRevD.105.083014}. Using the information from Table~\ref{tab:acc_prob}, these steps are followed to generate one Monte Carlo capture event: \begin{enumerate} \item select a cascade with a probability based on the prevelance of that specific de-exication path. \item randomly select a decay time for the first intermediate state based on an exponential distribution with the appropriate lifetime. This variable is $t$ from the two-step calculation. \item calculate the first energy deposit $D_1$ based on the decay time and the stopping acceleration. This is the slowing-down energy deposited in time $t$. \item Adjust the kinetic energy of the recoil based on the kinematics of in-flight decay. This adjustment is based on the center-of-mass angle of the emitted gamma, $\beta_{\mathrm{cm}}$ from the two-step calculation. \item repeat steps 2--4 for each intermediate level. \end{enumerate} The result of this procedure is a set of energy deposits $\{D_i\}$ with the same number of elements as gamma rays emitted. The $D_i$s are saved and may be summed to obtain the total deposited energy. The emitted gamma ray energies for each step are saved alongside the $D_i$s. These steps are implemented in our public code~\cite{Villano2022}. Figure~\ref{fig:twostepcompare} shows how the analytical calculation for the deposited energy of a two-step cascade compares to our Monte Carlo procedure. The two are an excellent match and the reduced $\chi^2$ statistic is 0.084. \begin{figure}[!htb] \includegraphics[width=\columnwidth]{Comparison_1stState.pdf} \caption{\label{fig:twostepcompare}(Color online) A comparison of the analytical PDF for the two-step cascade (see Sec.~\ref{sec:twostep}) with that of the Monte Carlo procedure. The histogram is the PDF derived from many events generated by the Monte Carlo procedure. } \end{figure} The full spectrum from all the cascades in Table~\ref{tab:acc_prob} is shown in Fig.~\ref{fig:fullcapspec-resolution} with a 10\,eV nominal resolution applied. The sharpest peaks come from the direct-to-ground transitions of $^{29}$Si and $^{30}$Si and the 6.8\% two-step transition. In the two-step transition there is a sizeable probability of having the first NR stop before the subsequent decay--it is a quasi-monoenergetic transition for this reason. \begin{figure}[!htb] \includegraphics[width=\columnwidth]{PeaksAndGaussians.pdf} \caption{\label{fig:fullcapspec-resolution}(Color online) The complete silicon capture spectrum using the data from Table~\ref{tab:acc_prob}. 95.63\% of all cascades are taken into account here. A nominal 10\,eV resolution has been applied. } \end{figure} When we use these spectra we account for the events that will be distorted by energy deposits from the exiting gammas~\cite{PhysRevD.105.083014}. This is sometimes done by estimating what fraction of cascades have gammas that escape (around 90\% for a cylindrical silicon detector of diameter 100\,mm and thickness 30\,mm). Other times we use a particle transport code like \texttt{Geant4} to find exactly which cascade realizations have exiting gamma interactions. When using materials that are more electron-dense than silicon the fraction of interactions from exiting gammas increases. It is typically true that those events that have interactions from exiting (high-energy) gammas will be removed from the low energy range completely--they produce little contamination of the capture-induced NR ``signal.'' The \texttt{Geant4} particle transport code gets different results for the resulting NR spectra from the capture process with silicon, germanium, and neon~\cite{Villano2022}. The results for silicon are the closest but still have significant differences that may be experimentally relevant to dark matter and \ensuremath{\text{CE\textnu{}NS}}\ studies. The most recent version of \texttt{Geant4} that was compared to our spectral results is \texttt{v10.7.3} and comparisons are stored with our open-source code~\cite{Villano2022}. \section{\label{sec:calib_bknd}Uses for Dark Matter and \ensuremath{\text{CE\textnu{}NS}}} Our major goals in understanding the neutron capture induced nuclear recoil spectra are: a) to use these nuclear recoil events to enhance our understanding of low-energy nuclear recoils in solids--to provide excellent low-energy calibrations; and b) to compute the experimental backgrounds for dark matter and \ensuremath{\text{CE\textnu{}NS}}\ searches. In silicon and other materials there has not been consensus on how much ionization nuclear recoils produce at low recoil energies. Typically, our theoretical guidance in the field comes from the early Lindhard paper~\cite{osti_4701226} and associated work. On the other hand, measurements down to the 100\,eV range seem like they may deviate from those predictions \emph{and} be marginally consisitent or inconsistent with each other~\cite{Izraelevitch_2017,PhysRevD.94.082007,PhysRevD.105.083014}. Exploring the detector response to NRs at low energies is therefore prudent and thermal neutron induced captures provide an excellent venue for this--as pointed out by the CRAB collaboration~\cite{Thulliez_2021} and others working with xenon for dark matter~\cite{PhysRevD.106.032007}. The key features for thermal neutron induced captures are shown in Fig.~\ref{fig:fullcapspec-Eee}. In that figure a nominal Lindhard ionization yield~\cite{osti_4701226} is applied to the result shown in Fig.~\ref{fig:fullcapspec-resolution}. \begin{figure}[!htb] \includegraphics[width=\columnwidth]{PeaksAndGaussians-Ionization.pdf} \caption{ \label{fig:fullcapspec-Eee}(Color online) The NR capture spectrum corresponding to events that are resulting from neutron-capture. The three Gaussian peaks shown outline the particular cascades that have sharp signatures. The horizontal scale is in electron-equivalent energy (eV$_{\mathrm{ee}}$) which quantifies the amount of charge produced rather than the true recoil energy of the NR (which is higher). 95.63\% of all cascades are modeled using the data from Table~\ref{tab:acc_prob}. A nominal 10\,eV$_{\mathrm{ee}}$ resolution has been applied. } \end{figure} Calibrations using thermal neutron induced captures are superior to other styles of calibrations that have been used: direct elastic neutron scattering~\cite{PhysRevD.42.3211}, photoneutron sources~\cite{PhysRevD.105.122002,PhysRevD.94.122003}, and $^{252}$Cf sources~\cite{AGNESE201871}. Figure~\ref{fig:fullcapspec-Eee} shows that the spectrum has sharp mono-energetic features that are lacking in wide-band photoneutron or $^{252}$Cf sources. The spectrum extends down well below 100\,eV which is probably near the limit of elastic scattering sources. Using this technique is also feasible \emph{in situ} because any neutron source will elevate the thermal neutron flux during its deployment. Finally, if there is a case where exiting gammas can be measured in coincidence, the direct-to-ground transitions provide \emph{directionally tagged} nuclear recoils. This would lead to a heretofore unavailable NR directionality calibration. A large enough thermal neutron flux could lead to meaningful backgrounds for low-mass dark matter searches or \ensuremath{\text{CE\textnu{}NS}}\ measurements. The thermal neutron flux is typically not measured directly in many experiments because of the difficulty in doing so. One measurement that does exist for \ensuremath{\text{CE\textnu{}NS}}\ is from the MINER collaboration~\cite{AGNOLET201753} and is several orders of magnitude higher than the accepted sea level environmental value, 4~cm$^{-2}$\,hr$^{-1}$~\cite{1263842}. We have previously shown the effect of thermal neutrons on \ensuremath{\text{CE\textnu{}NS}}\ measurements in detail~\cite{https://doi.org/10.48550/arxiv.2212.14148}. The SuperCDMS Soudan thermal neutron flux can be estimated from the germanium activation lines~\cite{PhysRevD.99.062001} and is 7.2$\times$10$^{-2}$~cm$^{-2}$\,hr$^{-1}$\footnote{This value was estimated by examining the published 10.37\,keV line rate over a period of a month starting at least three half-lives after a three-day (maximum) Cf activation, see Fig.~1 of the reference. At that point the rate appears to be close to consistent with flat.} \begin{figure}[!htb] \includegraphics[width=\columnwidth]{bknds.pdf} \caption{\label{fig:bkndcompare}(Color online) Comparison of the thermal neutron capture induced NR spectrum in silicon with expected dark matter and \ensuremath{\text{CE\textnu{}NS}}\ signals in line with currently available data. } \end{figure} Figure~\ref{fig:bkndcompare} shows the comparison of the thermal neutron induced NR spectra at the estimated flux levels with the dark matter and \ensuremath{\text{CE\textnu{}NS}}\ spectra. For a \ensuremath{\text{CE\textnu{}NS}}\ experiment with a 1\,MW reactor at a distance of 8\,m we arbitrarily compared a thermal neutron flux of 0.1\% of the sea level value. We have used the Mueller spectrum for the reactor anti-neutrinos~\cite{PhysRevC.83.054615}. The detector resolution function is assumed to have a 10\,eV baseline that rises to 30\,eV at a recoil energy of 25\,eV. We use this form for the energy-varying resolution: $\sqrt{\sigma_0 + AE_r}$; $E_r$ is the recoil energy and $\sigma_0$ and $A$ are constants. For the dark matter comparisons in Fig.~\ref{fig:bkndcompare} we used a 5\,GeV mass dark matter particle with a cross section just below the limit produced in recent SuperCDMS work~\cite{PhysRevD.99.062001,PhysRevD.97.022002}. Figure~\ref{fig:bkndcompare} shows that both for dark matter searches and \ensuremath{\text{CE\textnu{}NS}}\ the spectral overlap of thermal neutron capture induced NRs can interfere with measurements especially in cases where the detector baseline resolutions are larger than 10\,eV--true for all but the best modern detectors. \section{\label{sec:cascades}Post-Capture Cascades} For thermal neutron captures, each nuclear de-excitation releases approximately the neutron separation energy, $S_n$, for the capturing isotope. For intermediate and heavy nuclei, the sequence of states that the residual nucleus passes through can be complex and have several emitted gamma rays. This is the subject of long-standing data collection and modeling efforts~\cite{Firestone}. The classification of individual de-excitations coming from the cascade has become standard and is useful for relating the properties of the cascade to the nuclear structure. In addition, this classification aides in Monte Carlo codes to generate specific cascade realizations. Generally, a critical energy $E_c$ is chosen below the neutron separation energy such that nuclear levels below are treated individually with their appropriate properties and levels between this energy and the neutron separation energy are treated statistically. This breaks all released gamma rays into several categories: (1) continuum to continuum; (2) continuum to discrete; (3) discrete to discrete; and (4) primary. \begin{figure}[!htb] \includegraphics[width=\columnwidth]{captureCascade.pdf} \caption{\label{fig:cascade}(Color online) The typical classification for capture cascade gamma rays. Horizontal lines are various energy demarcations with $S_n$ representing the neutron separation energy, $E_g$ representing the ground-state energy, and $E_c$ representing the (arbitrary) cut off between discrete and continuum states. Transitions are denoted by arrows and belong to one of five categories: (a) primary gammas with a final state in the continuum; (b) secondary gammas within the continuum; (c) secondary gammas from a continuum state to a discrete state; (d) primary gammas with a discrete final state; and (e) secondary gammas between two discrete states. } \end{figure} In our treatment of silicon here we will take $E_c \simeq S_n$, that is, we will treat all cascades as dicrete. This treatment may be difficult to implement for heavy nuclei. In PGAA measurements, it is easy to extract the prevelance of a specific gamma ray in the final state per 100 captures. We prefer the slightly different organization of giving the probability of a given \emph{cascade path}. The key publication we use to sort out the cascade probabilities is the paper of Raman~\cite{PhysRevC.46.972}. Figure~\ref{fig:cascade-diagram} shows the cascade paths of the six most probable cascades for a natural silicon composition. The cascades shown there account for approximately 90\% of the total cascades. Some of the gamma rays appear in multiple cascades so it is clear that the probability to find a specific gamma ray after capture--as is often measured--is not quite the same information as the cascade probabilities that we have compiled. \begin{figure}[!htb] \includegraphics[width=\columnwidth]{Si_cascades.pdf} \caption{\label{fig:cascade-diagram}(Color online) A diagram of the six most prevelant cascades of natural silicon. All of the cascades start with the capture of approximately thermal neutrons on the nucleus $^{28}$Si at the neutron separation energy of the final nuclear state, $^{29}$Si. } \end{figure} In our re-organization of this typical capture information, we have extracted the specific cascades which account for 95.63\% of the total captures. This information is shown in Table~\ref{tab:acc_prob} and is enough to construct an accurate model of the NRs left behind by capturing thermal neutrons. We have also gathered in the table the half-lives of each intermediate level where data are available and have otherwise used the Weisskopf estimates~\cite{PhysRev.83.1073}. Level lifetimes are important for our modeling because even in a dense (crystalline) matrix the intermediate-state half-lives are typically short enough to allow for a ``decay in flight.'' In other words, it is \emph{not} a good approximation to assume that the excited nucleus in each intermediate level stops before the subsequent decay. This has important implications for our kinematics calculations later. We select a specific cascade path to model so we should technically be using a level lifetime corrected for other branchings. The differences are small--probably well below 10\%--because most of our highly-probable cascades involve the dominant decay branch. \begin{table}[!hbt] \begin{tabular}{c c c c} \hline \hline Isotope & Prob. (\%) & Energy Levels (keV) & Half-Lives (fs) \\ \hline $^{28}$Si& 62.6& 4934.39 & 0.84 \\ $^{28}$Si& 10.7& 6380.58, 4840.34& 0.36, 3.5 \\ $^{28}$Si& 6.8 & 1273.37 & 291.0 \\ $^{28}$Si& 4.0 & 6380.58 & 0.36 \\ $^{28}$Si& 3.9 & 4934.39, 1273.37& 0.84, 291.0\\ $^{28}$Si& 2.1 & - & - \\ $^{29}$Si& 1.5 & 6744.1.0 & 14 \\ $^{30}$Si& 1.4 & 3532.9, 752.2.0 & 6.9, 530 \\ $^{29}$Si& 1.2 & 7507.8, 2235.3.0& 24, 215 \\ $^{29}$Si& 0.4 & 8163.2.0 & w(E1) \\ $^{30}$Si& 0.4 & 5281.4, 752.2.0 & w(E1), 530 \\ $^{29}$Si& 0.3 & - & - \\ $^{30}$Si& 0.3 & 4382.4, 752.2.0 & w(E1), 530 \\ $^{30}$Si& 0.03 & - & - \\ \hline \hline \end{tabular} \caption{\label{tab:acc_prob} A table displaying the probability of each cascade. This table includes only the cascades used for our model. The isotope listed is the isotope on which the neutron captures; the energy levels and half-lives are therefore for an isotope of silicon with one more neutron. A half-life entry of w(E1) specifies that the half-life is unknown and the Weisskopf estimate for an electric dipole transition was used~\cite{PhysRev.83.1073}. } \end{table} The possibility of ``decay in flight'' also makes a calculation of the slowing-down of recoiling atoms germane to our modeling. Here, we use a constant acceleration to model this slowing down, consistent with the average stopping power derived by Lindhard~\cite{osti_4701226}. Lindhard used a generic Thomas-Fermi potential for all ions, and the result was a stopping power (acceleration) that depended on energy for slow nuclei between about 400\,eV and 164\,keV. We use the average of that curve between those energies. \section{\label{sec:conclusion}Conclusion} We have carefully derived and simulated the spectrum of NRs following thermal neutron captures in silicon. The spectra do not match the contemporary \texttt{Geant4} particle transport code--indicating the details of decay-in-flight and atomic slowing-down are poorly modeled. The level of thermal neutron fluxes that may be present in underground laboratories (mostly from radiogenic sources in deep labs) is comparable to the contemporary rate limits on dark matter scattering. Furthermore, in the \ensuremath{\text{CE\textnu{}NS}}\ venue the thermal neutron capture background could also play an important role due to the proximity of some experiments to neutron-generating reactors~\cite{PhysRevLett.129.211802,ANG2021165342}. In both of these situations the authors recommend studies of the thermal neutron flux levels and taking the thermal neutron capture background into account during data analysis. \section{\label{sec:intro}Introduction} The residual nuclear recoils left after neutron capture have been used before to probe the details of the slowing down of atoms in material~\cite{PhysRevA.11.1347}. However, the complications of the post-capture cascades and possible in-flight decays make the expected energy of the residual nuclear recoils (NRs) non-trival to calculate. The energy of residual NRs depends on the details of the capture cascade like the levels visited and the lifetimes of levels. The work of Firestone~\cite{Firestone} in cataloging this information from experiments in prompt neutron activation analysis (PGAA) is a key to being able to make the detailed NR energy deposition models for silicon. Slowing-down models for the capture nuclei in their matrix are also a key component of correctly doing the modeling. We use the approximation that nuclei that are slowing down do so with a constant acceleration and we choose the acceleration to be in line with the Lindhard model~\cite{osti_4701226}. Direct dark matter search experiments are often searching for low-energy NRs very near their detector thresholds. The community has recently turned to neutron capture~\cite{PhysRevD.106.032007,PhysRevD.103.122003,PhysRevD.105.083014} as a means to provide very low-energy NRs near today's best detector thresholds--below around 100\,eV in recoil energy. Similar efforts exist in the \ensuremath{\text{CE\textnu{}NS}}\ community~\cite{Thulliez_2021}. In both communities, thermal neutron capture also exists as a potential background to the signal events~\cite{https://doi.org/10.48550/arxiv.2212.14148}. These studies show that a detailed understanding of the recoil spectrum resulting from neutron capture is needed, and we provide that here for silicon detectors. \section{\label{sec:twostep}Two-Step Cascades} For cascades which emit either one or two gamma rays (one- or two-step cascades), we were able to analytically construct the distribution of total NR energies. This distribution will be what is observed in a detector that experiences a neutron capture when all the gamma rays leave without energy deposit. For one-step cascades, a single gamma is emitted back-to-back with the NR. The gamma energy in this case is approximately the neutron separation energy, $E_{\gamma} \simeq S_n$. The NR energy, $T$, is given approximately by: \begin{equation} T \simeq \frac{S_n^2}{2M_A}, \end{equation} where $M_A$ is the mass of the recoiling nucleus. The two-step cascades are considerably more complex because of the possibility of decay in flight. We work with a separation of the nuclear energy deposits into the first and second steps like: $D_t = D_1 + D_2$. $D_t$ is the total deposited energy by the NRs. $D_1$ and $D_2$ are the energies deposited before the intermediate decay and after the intermediate decay respectively. The two other key variables we will use are the decay time, $t$, and the center of mass angle for the decay, $\beta_{\mathrm{cm}}$. The energy deposits are deterministic functions of the decay times and angles, both of which are in turn probabilistic random variables. The decay time represents how long it takes for the (instantaneously generated) intermediate state to decay to the ground state and is exponentially distributed with the probability density function (PDF) in Eq.~\ref{eq:tdist}. The cosine of $\beta_{\mathrm{cm}}$ is assumed to be uniformly distributed over $(-1,1)$ in the center of mass frame for the decay. \begin{equation}\label{eq:tdist} f(t) = \frac{\ln{2}}{t_{1/2}} \exp{\left [-t\frac{\ln{2}}{t_{1/2}}\right ]} \end{equation} The quantity $D_1$ can be expressed as a simple function of $t$, given that the recoiling nucleus slows down with a constant (negative) acceleration, $a$: \begin{equation}\label{eq:d1} D_1(t) = T_1 - \frac{M_A^{\ast}(v_0-at)^2}{2}, \end{equation} where $T_1$ is the total kinetic energy the intermediate state recieves from the first gamma recoil, $M_A^{\ast}$ is the mass of the intermediate state, and $v_0 = (2T_1/M_A^{\ast})^{1/2}$ is the initial velocity. Modeling the process with a fixed acceleration gives a unique stopping time, $t_s$. The distribution of $D_1$ has a singular value of $T_1$ if $t > t_s$, but the PDF for $t < t_s$ depends on Eq.~\ref{eq:tdist} with a change of variables to the $D_1$ of Eq.~\ref{eq:d1}. The result is: \begin{widetext} \begin{equation} \centering \begin{aligned} \label{eq:gd1} g(D_1)&= \begin{cases} g^0(D_1)+\exp{\left[ - \ln{2}\frac{t_s}{t_{1/2}}\right]} \delta(D_1-T_1) & ; D_1 \leq T_1\\ 0 & ; D_1 > T_1 \end{cases} \\ g^0(D_1) &= \frac{\ln{2}}{|a|t_{1/2}\sqrt{2M_A^{\ast}(T_1-D_1)}}\exp{\left [-\ln{2} \frac{v_0-\sqrt{2(T_1-D_1)/M_A^{\ast}}}{|a|t_{1/2}} \right ]}, \end{aligned} \end{equation} \end{widetext} where $\delta$ is the Dirac delta function. The PDF of $D_2$ is clearly dependent on $D_1$ because the value of $D_2$ depends on $t$ which is deterministically related to $D_1$. We deal with this by using the joint PDF of $D_1$ and $D_2$, $g(D_1,D_2)$. The PDF for $D_2$ can then be obtained by integrating the joint PDF over all $D_1$. To obtain the joint distribution $g(D_1,D_2)$ we use a basic relationship from conditional probability: \begin{equation} \label{eq:condprob} g(D_1,D_2) = h(D_2|D_1)g(D_1). \end{equation} The PDF $h(D_2|D_1)$ is the PDF of $D_2$ given a specific value of $D_1$. The function $h$ is not challenging to obtain because the only relevant random variable is $\beta_{\mathrm{cm}}$-- $t$ is fixed because $D_1$ is fixed. We can then think of $D_2$ as a deterministic function of $D_1$ and $\beta{\mathrm{cm}}$ like: $D_2(t(D_1),\beta_{\mathrm{cm}})$. To obtain the function $h$ we note that whatever kinetic energy the final nucleus has after the intermediate decay will be the deposited energy~\footnote{we are not accounting for the possibility that the recoiling nuclei escape the medium because their ranges are very small}. We calculated bounds on this kinetic energy, $T_2$, given the value of $\beta_{\mathrm{cm}}$: \begin{equation}\label{eq:d2minmax} \begin{split} T_2 = \frac{\Delta}{2M_A} &\left [ \frac{2M_A(T_1-D_1)}{\Delta^2} \right. \\ & \left. + 2 \sqrt{\frac{2M_A(T_1-D_1)}{\Delta^2}}\cos{\beta_{\mathrm{cm}}} + 1 \right ], \end{split} \end{equation} where $\Delta$ is the difference between the intermediate state energy and the ground state. The value of $\cos{\beta_{\mathrm{cm}}}$ is between -1 and 1, so this gives a clear minimum and maximum for this kinetic energy. The minimum of the kinetic energy can reach zero when $\Delta$ is exactly halfway between the ground state and the neutron separation energy $S_n$. The function $h$ is then: \begin{equation} \label{eq:h} h(D_2|D_1)= \\ \begin{cases} \frac{1}{2\Delta}\sqrt{\frac{M_A}{2}}\frac{1}{T_1-D_1}& ; T_{2,\mathrm{min}} \leq D_2 \leq T_{2,\mathrm{max}}\\ 0 & ; \mathrm{otherwise} \end{cases} \\ \end{equation} Using Eq.~\ref{eq:h} we constructed the joint distribution from Eq.~\ref{eq:condprob}. The joint distribution is plotted in Fig.~\ref{fig:twostepjoint} for two cascades--one (orange) with a very fast intermediate decay and another (blue) with a slower intermediate decay. The spike shown in the slow distribution is a 2-dimensional Dirac delta function that corresponds to the situation when the intermediate recoil stops before the subsequent decay. In that case the values of $D_1$ and $D_2$ are fixed and are the values you would expect from at-rest one-gamma decay of each excited nuclear state. The fast intermediate decay produces a behavior where $D_1$ tends to be lower and increases toward zero. \begin{figure}[!htb] \includegraphics[width=\columnwidth]{3DPDF.pdf} \caption{\label{fig:twostepjoint}(Color online) The 2-dimensional joint PDF from Eq.~\ref{eq:condprob}. $D_1$ and $D_2$ are the energies deposited from the first and second cascade step respectively. The darker (blue) surface is for a two-step cascade stopping at the first excited state; the lighter (orange) surface is for a two-step cascade stopping at the most likely (tenth) excited state. } \end{figure} With the joint distribution specified, the distribution of the total energy deposit, $D_t$ is obtained by the following integral: \begin{equation}\label{eq:dtdist} p(D_t) = \int_{D_1} g(D_1,D_t - D_1) dD_1. \end{equation} The total distribution for $D_t$ is plotted in Fig.~\ref{fig:dtotpdf} for both example cascades. Once again the ``spike'' in the slow cascade corresponds to the case where the intermediate recoil stops before the subsequent decay--that results in a fixed total energy deposited. This spike is proportional to the Dirac delta function, and so cannot be shown on the correct scale. However, it is easy to see the $D_t$ value for the spike and it must account for the remaining probability after removing the integral of the plotted distribution. In the fast cascade most remnants of the monoenergetic ``spike'' are gone and the total energy is nearly uniform between two fixed bounds. \begin{figure}[!htb] \includegraphics[width=\columnwidth]{2DPDF.pdf} \caption{\label{fig:dtotpdf}(Color online) The PDF of the total deposited energy from nuclear recoils, $D_t$, for this two-step cascade. E1 indicates the first excited state; E10 indicates the most likely (tenth) excited state. } \end{figure}
\section{Introduction} This paper relates two seemingly different ways to define enumerative invariants given a quiver with potential: the quiver Donaldson--Thomas (DT) invariants, defined using moduli spaces of quiver representations, and log Gromov--Witten invariants of toric varieties, defined as counts of rational log curves satisfying constraints specified by the combinatorics of the quiver. To relate quiver DT invariants to log Gromov--Witten invariants, we use the combinatorial calculation of quiver DT invariants in terms of attractor flow trees following our previous work \cite{ABflow}. We explain how to interpret such trees as tropical curves, and then prove a new correspondence theorem between counts of tropical curves and log Gromov--Witten invariants of toric varieties. We show this log-tropical correspondence in a situation where one considers non-rigid tropical curves moving in non-trivial families. After a brief description of DT quiver invariants in \S\ref{sec_dt_intro} and of log Gromov--Witten invariants in \S\ref{sec_gw_intro}, we provide a more detailed overview of the log-tropical correspondence in \S \ref{sec_log_tropical_intro}, and the quiver DT-log Gromov--Witten correspondence in \S \ref{sec_main_intro}. \subsection{DT quiver invariants} \label{sec_dt_intro} A quiver with potential $(Q,W)$ is given by a finite oriented graph $Q$, and a finite formal linear combination $W$ of oriented cycles in $Q$. We denote by $Q_0$ the set of vertices of $Q$. For every dimension vector $\gamma \in N \coloneqq \mathbb{Z}^{Q_0}$ and stability parameter \begin{equation} \theta \in (\gamma^{\perp})_\RR \subset M_\RR \coloneqq \Hom(N,\RR)\,,\end{equation} where $(\gamma^{\perp})_\RR \coloneqq \{\theta\in M_\RR|\,\theta(\gamma)=0\}$, the theory of King's stability for quiver representations \cite{MR1315461} defines a quasiprojective variety $M_\gamma^{\theta}$ over $\mathbb{C}$, parametrizing S-equivalence classes of $\theta$-semistable representations of $Q$ of dimension $\gamma$. Moreover, the trace of the potential naturally defines a regular function $\Tr (W)_\gamma^\theta \colon M_\gamma^\theta \longrightarrow \mathbb{C}$. For a generic stability parameter $\theta$, the \emph{DT invariant} $\Omega_\gamma^{+,\theta}$ is an integer which is a virtual count of the critical points of $\Tr (W)_\gamma^\theta$. We have $\Omega_\gamma^{+,\theta}=0$ if the $\theta$-stable locus in $M_\gamma^\theta$ is empty, and else, $\Omega_\gamma^{+,\theta}$ is the Euler characteristic of $M_\gamma^\theta$ valued in the perverse sheaf obtained by applying the vanishing-cycle functor for $\Tr (W)_\gamma^\theta$ to the intersection cohomology sheaf \cite{davison2015donaldson, MR4132957, MR4000572}: \begin{equation} \label{eq_dt_intro}\Omega_\gamma^{+,\theta} :=e(M_\gamma^\theta, \phi_{\Tr (W)_\gamma^\theta}(IC[-\dim M_\gamma^\theta])) \in \mathbb{Z}\,.\end{equation} For example, if $\gamma$ is primitive and $W=0$, then $\Omega_\gamma^{+,\theta}$ is simply the topological Euler characteristic\footnote{In this paper, we are considering the ``unsigned" DT invariants $\Omega_\gamma^{+,\theta}$, and not the signed DT invariants $\Omega_\gamma^{\theta}$, which are equal to $(-1)^{\dim M_\gamma^\theta}e(M_\gamma^\theta)$ when $\gamma$ is primitive and $W=0$.} of $M_\gamma^\theta$. It is often convenient to repackage the DT invariants $\Omega_\gamma^{+,\theta}$ into the \emph{rational DT invariants} \begin{equation} \overline{\Omega}_\gamma^{+,\theta} \coloneqq \sum_{\substack{\gamma' \in N\\ \gamma=k \gamma',\, k\in \mathbb{Z}_{\geq 1}}} \frac{(-1)^{k-1}}{k^2} \Omega_{\gamma'}^{+,\theta} \,, \end{equation} which can also be defined using the motivic Hall algebra \cite{JoyceSong, kontsevich2008stability, MR2650811,MR2801406}. The DT invariants $\Omega_\gamma^{+,\theta}$ are locally constant functions of the $\gamma$-generic stability parameter $\theta \in \gamma^{\perp}$ and their jumps across the loci of non-$\gamma$-generic stability parameters are controlled by the wall-crossing formula of Joyce-Song and Kontsevich-Soibelman \cite{JoyceSong,kontsevich2008stability}. Using the wall-crossing formula, the DT invariants can be computed in terms of the simpler \emph{attractor DT invariants}, which are DT invariants at specific values of the stability parameter. Let $\omega \colon N \times N \rightarrow \mathbb{Z}$ be the skew-symmetric form on $N$ given by \begin{equation} \label{Eq: Euler form} \omega(\gamma, \gamma'):= \sum_{i,j\in Q_0}(a_{ij}-a_{ji})\gamma_i\gamma_j'\,, \end{equation} where $a_{ij}$ is the number of arrows in $Q$ from the vertex $i$ to the vertex $j$. The specific point $\iota_\gamma \omega:= \omega(\gamma,-) \in \gamma^{\perp} \subset M_{\RR}$ is called the \emph{attractor point} for $\gamma$ \cite{AlexandrovPioline, mozgovoy2020attractor}. In general, the attractor point $\iota_\gamma \omega$ is not $\gamma$-generic and we define the attractor DT invariants $\Omega_\gamma^{+,*}$ by \begin{equation} \Omega_\gamma^{+,*} \coloneqq \Omega_\gamma^{+, \theta_\gamma}\,,\end{equation} where $\theta_\gamma$ is a small $\gamma$-generic perturbation of $\iota_\gamma \omega$ in $\gamma^{\perp}$ \cite{AlexandrovPioline, mozgovoy2020attractor}. One can check that $\Omega_\gamma^{+,*}$ is independent of the choice of the small perturbation \cite{AlexandrovPioline, mozgovoy2020attractor}. Iteratively using the wall-crossing formula, the rational DT invariants $\overline{\Omega}_\gamma^{+,\theta}$ for general $\gamma$-generic stability parameters $\theta \in \gamma^{\perp}$ are expressed in terms of the rational attractor DT invariants $\overline{\Omega}_\gamma^{+,*}$ by a formula of the form \begin{equation} \label{eq_reconstruction_intro} \overline{\Omega}_\gamma^{+,\theta} = \sum_{r\geq 1} \sum_{\substack{\{\gamma_i\}_{1\leq i\leq r}\\ \sum_{i=1}^r \gamma_i = \gamma}} \frac{1}{|{\rm Aut}(\{\gamma_i\}_i)|} F_r^{\theta}(\gamma_1,\dots,\gamma_r) \prod_{i=1}^r \overline{\Omega}_{\gamma_i}^{+,*}\,, \end{equation} where the second sum is over the multisets $\{\gamma_i\}_{1\leq i\leq r}$ with $\gamma_i \in N$ and $\sum_{i=1}^r \gamma_i=\gamma$ \cite{AlexandrovPioline, KS}. Here, the denominator $|{\rm Aut}(\{\gamma_i\}_i)|$ is the order of the symmetry group of $\{\gamma_i\}$: if $m_{\gamma'}$ is the number of times that $\gamma' \in N$ appears in $\{\gamma_i\}_i$, then $|{\rm Aut}(\{\gamma_i\}_i)|=\prod_{\gamma'\in N}m_{\gamma'}!$. The coefficients $F_r^{\theta}(\gamma_1,\dots,\gamma_r)$ are integers and are universal in the sense that they depend on $(Q,W)$ only through the skew-symmetric form $\omega$ on $N$. The dependence on the potential $W$ is entirely contained in the attractor DT invariants $\overline{\Omega}_{\gamma_i}^{+,*}$. Moreover \cite[\S 3.2]{KS}, the coefficients $F_r^\theta(\gamma_1,\dots,\gamma_r)$ have a natural decomposition \begin{equation}\label{eq_trees_intro} F_r^\theta(\gamma_1,\dots,\gamma_r) = \sum_h F_{r,h}^\theta(\gamma_1,\dots,\gamma_r)\end{equation} indexed by \emph{attractor flow trees} $h : T \rightarrow M_\RR$, which are rooted balanced trees in $M_\RR$ with root at $\theta$ and with $r$ leaves decorated by $\gamma_1, \dots,\gamma_r$ -- see Definition \ref{def_attractor_tree} for details. The contribution $F_{r,h}^\theta(\gamma_1,\dots,\gamma_r)$ of $h : T \rightarrow M_\RR$ is obtained by applying the wall-crossing formula at each vertex of $T$. In our previous paper \cite{ABflow}, we proved an explicit formula, called the \emph{flow tree formula} and conjectured by Alexandrov-Pioline \cite{AlexandrovPioline}, which computes the coefficients $F_{r,h}^{\theta}(\gamma_1,\dots,\gamma_r)$ in \eqref{eq_trees_intro} in terms of a sum over trivalent perturbed attractor flow trees obtained as small perturbations of $h:T \rightarrow M_\RR$. A different combinatorial formula for $F_r^{\theta}(\gamma_1,\dots,\gamma_r)$ was proved by Mozgovoy in \cite{mozgovoy2022operadic}. The main goal of the present paper is to give a geometric interpretation of these coefficients $F_{r,h}^{\theta}(\gamma_1,\dots,\gamma_r)$ in terms of genus $0$ log Gromov--Witten invariants of toric varieties. \subsection{Log Gromov--Witten invariants} \label{sec_gw_intro} Log Gromov--Witten theory, developed by Abramovich--Chen and Gross--Siebert \cite{logGWbyAC,logGW}, provides a framework to enumerate algebraic curves in an algebraic variety $X$ having prescribed tangency conditions along a divisor $D \subset X$ which is allowed to have particular types of singularities -- typically we consider normal crossing divisors. Generalizing the notion of a stable map $f: C\to X$ to the log setting amounts to endowing all spaces with (fine, saturated) log structures and lift all morphisms to morphisms of log spaces -- see \S \ref{sec_log_trop_review} for a brief review of log schemes and stable log maps. The additional data of a log structure on a variety $X$ encodes combinatorial information which is used to define a cone complex associated to $X$, referred to as the \emph{tropicalization} of $X$. This makes it feasible to count log curves in terms of their tropical counterparts. In \cite{NS}, Nishinou-Siebert used toric degenerations and log deformation theory to prove a correspondence theorem between counts of genus $0$ complex curves in $d$-dimensional toric varieties and counts of tropical curves in $\RR^d$. More precisely, the main result of \cite{NS} provides a correspondence between counts of stable log maps to counts of rigid tropical trees. To obtain such a correspondence, one considers log curves generically contained in the big torus orbit of the toric variety and with generically trivial log structure. In the present paper, given a quiver with $d$ vertices, we prove a correspondence theorem between counts of log curves in $d$-dimensional toric varieties and tropical counts associated to $(d-2)$-dimensional families of tropical curves in $\RR^d$ obtained as universal deformations of the attractor flow trees. The main difference with the set-up of \cite{NS} is that for $d \geq 3$, the relevant log curves are entirely contained in the toric boundary divisor, have generically non-trivial log structures, and correspond to non-rigid tropical curves moving in non-trivial $(d-2)$-dimensional families. \begin{figure} \resizebox{.4\linewidth}{!}{\input{fig1.pspdftex}} \caption{A stable log map in $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{H}}^\mathrm{log}(X_\Sigma)$ for $d=2$ and $r=3$.\label{fig1}} \end{figure} We now describe more precisely our log-tropical correspondence theorem. As in \S\ref{sec_dt_intro}, we fix a quiver $Q$, with set of vertices $Q_0$ of cardinality $d$, and let $\omega$ be the skew-symmetric form on $N$ as in \eqref{Eq: Euler form}. We denote \[N=\mathbb{Z}^{Q_0}\simeq \mathbb{Z}^d \,\ \mathrm{and} \,\ M_\RR=\Hom(N,\RR)\simeq \RR^d \,.\] We also fix a tuple $\boldsymbol{\gamma}=(\gamma_1,\dots,\gamma_r)$ of elements $\gamma_i \in N$ such that $\iota_{\gamma_i}\omega\neq 0$ for all $1\leq i\leq r$, and $\iota_\gamma \omega \neq 0$, where $\gamma=\sum_{i=1}^r \gamma_i$. We count curves in a $d$-dimensional projective toric variety $X_\Sigma$ defined by a fan in $M_\RR$ containing the rays $\RR_{\geq 0}\iota_{\gamma_i}\omega$, and such that the hyperplanes $(\gamma_i^\perp)_\RR$ in $M_\RR$ are unions of cones of $\Sigma$. We refer to such a fan as a $\boldsymbol{\gamma}$-fan (see Definition \ref{def_gamma_fan}). In particular, for every $1\leq i \leq r$, we have a toric divisor $D_i$ of $X_\Sigma$ corresponding to the ray $\RR_{\geq 0}\iota_{\gamma_i}\omega$. The toric variety $X_\Sigma$ has a natural divisorial log structure defined by its toric boundary $D_\Sigma$, and elements of $N$ naturally define tangency conditions along $D_\Sigma$ at marked point for stable log maps to $X_\Sigma$ -- see \S\ref{sec_log_trop_review} for details. Consider hypersurfaces $H_i$ in $D_i$, given by equation of the form $z^{\frac{\gamma_i}{|\gamma_i|}}=c_i$ for some constant $c_i$, where $|\gamma_i|$ is the divisibility of $\gamma_i$ in $N$, and let $\mathbf{H}=(H_1,\dots,H_r)$. We denote by \[\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{H}}^\mathrm{log}(X_\Sigma)\] the moduli space of genus $0$ stable log maps $f :C \rightarrow X_\Sigma$ having $r+1$ marked points $x_1,\dots,x_r,x_{\mathrm{out}}$, with tangency condition along $D_\Sigma$ given by $\iota_{\gamma_i} \omega$ at $x_i$, $-\iota_\gamma \omega$ at $x_{\mathrm{out}}$, and such that $f(x_i) \in H_i$ for all $1\leq i \leq r$, see Figure \ref{fig1}. The moduli space $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{H}}^\mathrm{log}(X_\Sigma)$ is naturally stratified by the combinatorics of the log structure, and is log smooth of dimension $d-2$ for general $H_i$'s -- see Theorem \ref{thm_enum}. If $f :C \rightarrow X_\Sigma$ is a general point in a codimension $k$-stratum of $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{H}}^\mathrm{log}(X_\Sigma)$, then the tropicalization of $f :C \rightarrow X_\Sigma$ is naturally a $k$-dimensional face of the moduli space $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}^\mathrm{trop}(\Sigma)$ of genus $0$ tropical curves $h : \Gamma \rightarrow M_\RR$ in $M_\RR$ with $r+1$ legs $L_1,\dots,L_r, L_{\mathrm{out}}$, of weighted directions $\iota_{\gamma_i}\omega$ and $-\iota_\gamma \omega$ and such that $h(L_i) \subset A_i^0:=(\gamma_i^\perp)_\RR$, see Figure \ref{fig2}. In particular, given a $(d-2)$-dimensional face $\rho$ of $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}^\mathrm{trop}(\Sigma)$, one obtains a log Gromov--Witten \begin{equation}\label{eq_N_log_intro} N_\rho^{\mathrm{toric}}(X_\Sigma)\end{equation} by counting the $0$-dimensional strata of $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{H}}^\mathrm{log}(X_\Sigma)$ with tropicalization $\rho$. \begin{figure}[ht!] \resizebox{.4\linewidth}{!}{\input{fig2.pspdftex}} \caption{A tropical curve in $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}^\mathrm{trop}(\Sigma)$ for $d=2$ and $r=3$.\label{fig2}} \end{figure} \subsection{Log-tropical correspondence} \label{sec_log_tropical_intro} To compute the log Gromov--Witten invariant $N_\rho^{\mathrm{toric}}(X_\Sigma)$ tropically, one considers general affine perturbations $A_i$ of the linear hyperplanes $A_i^0=(\gamma_i^\perp)_\RR$, and the corresponding moduli space \[\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}\] of tropical curves in $M_\RR$ with $h(L_i) \subset A_i$ for all $1\leq i\leq r$. There is a finite $S_\rho$ of $(d-2)$-dimensional faces $\sigma$ of $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$ which in the limit $\mathbf{A} \rightarrow \mathbf{A}^0$ recovers $\rho$. While a general tropical curve in the face $\rho$ might have vertices of arbitrary valency, general tropical curves in the faces $\sigma$ are trivalent -- see Lemma \ref{lem_dimension} and Figure \ref{fig3}. \begin{figure} \resizebox{.4\linewidth}{!}{\input{fig3.pspdftex}} \caption{A tropical curve in $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}^\mathrm{trop}(\Sigma)$ for $d=2$ and $r=3$.\label{fig3}} \end{figure} In particular, one can define the tropical multiplicity $N_\sigma^\mathrm{trop}$ of $\sigma$ either has a lattice index -- see Definition \ref{def_trop_mult}, or as a product over the vertices of local multiplicities determined by the skew-symmetric form $\omega$ -- see Lemma \ref{lem: product2 for Ntrop}. Moreover, if $\dim \fod_{L_{\mathrm{out}}}^\rho=d-1$, where $\fod_{L_{\mathrm{out}}}^\rho \subset M_\RR$ is the union of the loci $h(L_{\mathrm{out}})$ for $h \in \rho$, we define a tropical coefficient $k_\rho \in \mathbb{Z}_{\geq 1}$ as an explicit lattice index -- see \eqref{eq_coeff}. We also define a similar coefficient $k_\sigma$ for $\sigma \in S_\rho$. We can now state the log-tropical correspondence theorem for the log Gromov--Witten invariants $N_\rho^{\mathrm{toric}}(X_\Sigma)$. \begin{citedthm} \label{thm_log_trop_intro} Fix a skew-symmetric form $\omega$ on $N$, and a tuple $\boldsymbol{\gamma}=(\gamma_1,\dots,\gamma_r)$ of elements $\gamma_i \in N$ such that $\iota_{\gamma_i}\omega\neq 0$, and $\iota_\gamma \omega \neq 0$, where $\gamma=\sum_{i=1}^r \gamma_i$. Fix also a $\boldsymbol{\gamma}$-fan $\Sigma$. Then, for every general tuple $\mathbf{A}=(A_1,\dots,A_r)$ of affine hyperplane in $M_\RR$ parallel to the linear hyperplanes $(\gamma_i^\perp)_\RR$, and for every $(d-2)$-dimensional face $\rho$ of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}(\Sigma)$ such that $\dim \fod_{L_{\mathrm{out}}}^{\rho}=d-1$, the log Gromov--Witten invariant $N_\rho^{\mathrm{toric}}(X_\Sigma)$ of the toric variety $X_\Sigma$ satisfies \begin{equation} \label{eq_log_trop_intro} k_\rho N_\rho^{\mathrm{toric}}(X_\Sigma)=\sum_{\sigma \in S_\rho} k_\sigma N_\sigma^\mathrm{trop} \,.\end{equation} \end{citedthm} When $d=2$, the moduli space of tropical curves ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}(\Sigma)$ is a single point and Theorem \ref{thm_log_trop_intro} is a special case of the log-tropical correspondence theorem of \cite{NS} for rigid tropical curves (more precisely, of the version of \cite{NS} with constraints at infinity, as in \cite[Appendix]{GPS}). However, for $d>2$, our tropical curves move in non-trivial $(d-2)$-dimensional families and so Theorem \ref{thm_log_trop_intro} is genuinely new. We prove Theorem \ref{thm_log_trop_intro} using a toric degeneration of $X_\Sigma$ and the recent theory of punctured log maps of Abramovich--Chen--Gross--Siebert \cite{ACGSII} to construct stable log maps to the special fiber by gluing. \subsection{Quiver DT-log Gromov--Witten correspondence} \label{sec_main_intro} Combining the flow tree formula of \cite{ABflow} with the log-tropical correspondence given by Theorem \ref{thm_log_trop_intro}, we obtain a geometric interpretation of the coefficients $F_{r,h}^\theta(\gamma_1,\dots,\gamma_r)$ in terms of genus $0$ log Gromov--Witten invariants of toric varieties. Let $(Q,W)$ be a quiver with potential with $d$ vertices as in \S \ref{sec_dt_intro} and $\omega$ be the corresponding skew-symmetric form on $N=\mathbb{Z}^{Q_0}$. We fix a dimension vector $\gamma \in N$ such that $\iota_\gamma \omega\neq 0$ and a decomposition $\gamma=\sum_{i=1}^r \gamma_i$ such that $\iota_{\gamma_i}\omega \neq 0$ for all $1\leq i\leq r$. We denote $\boldsymbol{\gamma}=(\gamma_1,\dots,\gamma_r)$ and we fix a $\boldsymbol{\gamma}$-fan $\Sigma$. Then, every attractor flow tree $(h: T \rightarrow M_\RR)$ naturally defines a $(d-2)$-dimensional face $\Tilde{\rho}_h$ of the moduli space of tropical curves $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}^\mathrm{trop}$. One first turns $h$ into a tropical curve $\overline{h}: \overline{T} \rightarrow M_\RR$ by extending its root to infinity in the direction $-\iota_\gamma \omega$. Then, $\Tilde{\rho}_h$ is the smallest face of $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}^\mathrm{trop}$ containing $\overline{h}$, that is, the universal family of deformations of $\overline{h}$ preserving its combinatorial type -- see Lemma \ref{lem_tree_dim}. In particular, one can consider as in \S\ref{sec_gw_intro} the genus $0$ log Gromov--Witten invariant $N_{\widetilde{\rho}_h}^{\mathrm{toric}}(X_\Sigma)$ of the $d$-dimensional toric variety $X_\Sigma$ of fan $\Sigma$, and the tropical coefficient $k_{\widetilde{\rho}_h}$. \begin{citedthm} \label{thm_dt_gw_intro} Let $(Q,W)$ be a quiver with potential. Fix a dimension vector $\gamma \in N=\mathbb{Z}^{Q_0}$ such that $\iota_\gamma \omega \neq 0$, a decomposition $\gamma=\sum_{i=1}^r \gamma_i$ such that $\iota_{\gamma_i}\omega \neq 0$ for all $1\leq i\leq r$, a $\gamma$-generic stability parameter $\theta \in \gamma^\perp$, and an attractor flow tree $h: T \rightarrow M_\RR$ with root at $\theta$ and $r$ leaves decorated by $\gamma_1,\dots,\gamma_r$. Then, for every $\boldsymbol{\gamma}$-fan $\Sigma$, the coefficient $F_r^\theta(\gamma_1,\dots,\gamma_r)$ in \eqref{eq_reconstruction_intro}-\eqref{eq_trees_intro} satisfies \begin{equation} \label{eq_dt_log_intro} F_{r,h}^\theta(\gamma_1,\dots,\gamma_r) = \frac{\prod_{i=1}^r |\gamma_i|}{|\gamma|} k_{\widetilde{\rho}_h} N_{\widetilde{\rho}_h}^{\mathrm{toric}}(X_\Sigma)\,.\end{equation} \end{citedthm} If $\iota_\gamma \omega =0$, then $\overline{\Omega}_\gamma^{+,\theta}$ does not experience any non-trivial wall-crossing and so $\overline{\Omega}_\gamma^{+,\theta}=\overline{\Omega}_\gamma^{+,\star}$ for every $\theta \in \gamma^\perp$. Moreover, $F_{r,h}^\theta(\gamma_1,\dots,\gamma_r)=0$ if $r\geq 2$ and if $\iota_{\gamma_i}\omega = 0$ for some $i$. In particular, Theorem \ref{thm_dt_gw_intro} applies to compute $F_{r,h}^\theta(\gamma_1,\dots,\gamma_r)$ in every non-trivial situation. By the flow tree formula of \cite{ABflow}, one can compute $F_{r,h}^\theta(\gamma_1,\dots,\gamma_r)$ using generic trivalent perturbations of $h$. To prove Theorem \ref{thm_dt_gw_intro}, we show that the universal deformations of these perturbed attractor trees are exactly the $(d-2)$-dimensional families of tropical curves $\sigma$ appearing in the right-hand side of \eqref{eq_log_trop_intro}, and then we use the log-tropical correspondence of Theorem \ref{thm_log_trop_intro} to rewrite the corresponding tropical counts as the log Gromov--Witten invariant $N_{\widetilde{\rho}_h}^{\mathrm{toric}}(X_\Sigma)$. \subsection{Related works} Another way to construct a geometrical object out of a quiver is based on the theory of cluster algebras \cite{FZ} and cluster varieties \cite{FG}. From a quiver $Q$ with $d$ vertices, one can construct the corresponding $d$-dimensional cluster variety using cluster transformations in a way prescribed by the combinatorics of $Q$. A key result of Gross--Hacking--Keel--Kontsevich \cite{GHKK} shows that the algebra of regular functions of a cluster variety admits a canonical basis, which can be constructed using a combinatorial gadget, known as the cluster scattering diagram. A version of such a cluster scattering diagram is shown to capture quiver DT invariants in the work of Bridgeland \cite{BridgelandCluster}. On the other hand, Gross--Siebert in \cite{gross2021canonical} show how to construct a mirror to a given log Calabi--Yau variety from a canonical scattering diagram, defined using counts of log curves. In our previous paper \cite{ABclustermirror} we showed how the canonical scattering diagram for cluster varieties relates to the cluster scattering. In a paper in preparation, we provide a correspondence between quiver DT invariants, in the situation when attractor DT invariants are trivial, and counts of log curves in cluster varieties, using the comparison between cluster and canonical scattering diagrams. This will generalize the Kronecker-Gromov--Witten correspondence which was shown earlier in the case when the cluster variety is of dimension two \cite{bousseau2020quantum, GP, GPS,MR3033514, MR3004575}. For variants of the Kronecker-Gromov--Witten correspondence in dimension two see also \cite{bousseau2018example,reineke2021moduli}. We will also show that such a correspondence between quiver DT invariants and log curve counts in cluster varieties is compatible with the results of the present paper, using that cluster varieties can be obtained by non-toric blow-ups of toric varieties as explained in \cite{GHKbirational}, and so admit degenerations into a toric variety and other simpler varieties, as studied in \cite{HDTV,GPS}. In particular, log curve counts in cluster varieties are naturally related to log curve counts in toric varieties considered in this paper. \subsection{Acknowledgments} Some of the material in this paper was originally written with the intention of appearing as part of \cite{HDTV} in an earlier form. We thank Mark Gross for his generosity to let us use this material. \section{The tropical enumerative problem} \label{sec:tropical_enum} Throughout this paper we work over an algebraically closed field $\kk$ of characteristic $0$. We denote by $M \simeq \mathbb{Z}^d$ a free abelian group of finite rank $d$, and by $M_\RR:=M \otimes_\mathbb{Z} \RR \simeq \RR^d$ the associated $d$-dimensional real vector space. We let $N:=\Hom(M,\mathbb{Z})$ denote the dual abelian group. \subsection{Tropical curves} \label{sec_trop_curves} We mainly follow the convention and notation of \cite{NS}. In this paper, a \emph{graph} $\Gamma$ is finite and connected, consisting of vertices, edges connecting pairs of vertices, and legs adjacent to single vertices. Moreover, we assume that legs are marked by distinct labels. We denote by \begin{align*} V(\Gamma) & \coloneqq \text{the set of vertices of\,\,} \Gamma \\ E(\Gamma) & \coloneqq \text{the set of edges of\,\,} \Gamma \\ L(\Gamma) & \coloneqq \text{the set of legs of\,\,} \Gamma\,. \end{align*} We denote the set of the two vertices adjacent to an edge $E$ by $\partial E$, and similarly the vertex adjacent to a leg $L$ by $\partial L$. \begin{definition} A \emph{weighted graph} is a graph $\Gamma$ together with a weight function $w\colon E(\Gamma)\cup L(\Gamma) \rightarrow \mathbb{Z}_{\geq 1}$ assigning a weight $w(E) \in \mathbb{Z}_{\geq 1}$ to every edge or leg $E$ of $\Gamma$. \end{definition} \begin{definition} \label{def_tropical_curve} A \emph{parametrized tropical curve in $M_\RR$} is a weighted graph $\Gamma$ without divalent vertices, together with a proper continuous map $h: \Gamma \rightarrow M_\RR$ satisfying the following conditions: \begin{itemize} \item[(i)] for every edge or leg $E$, the restriction $h|_E$ is an embedding with image contained in an affine line with rational slope, \item[(ii)] for every vertex $v\in V(\Gamma)$, the following \emph{balancing condition} holds: Let $E_1,\dots,E_m \in E(\Gamma)\cup L(\Gamma)$ be the edges or legs adjacent to $v$, and let $\bar{u}_i \in M$ be the primitive integral vector emanating from $h(v)$ in the direction of $h(E_i)$, then \[\sum_{i=1}^m w(E_i)\bar{u}_i=0\,.\] \end{itemize} \end{definition} An isomorphism of parameterized tropical curves $h:\Gamma \to M_\RR$ and $h_0 :\Gamma_0 \to M_\RR$ is a homeomorphism $\Psi:\Gamma\to\Gamma_0$ respecting the marking of the legs, the weights of the edges and legs, and such that $h=h_0\circ \Psi$. A \emph{tropical curve} is an isomorphism class of parameterized tropical curves. The genus of a tropical curve $h:\Gamma \to M_\RR$ is the first Betti number of its domain $\Gamma$. A rational tropical curve is a tropical curve of genus zero. In what follows we focus attention to rational tropical curves. \begin{definition}\label{def_tropical_type} A \emph{tropical type} for $M_\RR$ is the data $(\Gamma,\bar{u})$ of a weighted graph $\Gamma$ and of a map \begin{align*} \bar{u} : F(\Gamma) & \longrightarrow M \\ (v,E) & \longmapsto \bar{u}_{v,E} \end{align*} where $F(\Gamma)$ is the set of flags of $\Gamma$, that is, of pairs $(v,E)$ where $v \in V(\Gamma)$ is a vertex and $e\in E(\Gamma)\subset L(\Gamma)$ is an edge or leg adjacent to $v$. \end{definition} \begin{definition}\label{def_type} The type of a tropical curve $h \colon \Gamma \rightarrow M_\RR$ is the tropical type $(\Gamma, \bar{u})$ where for every $(v,E)\in F(\Gamma)$, $\bar{u}_{v,E}$ is the primitive integral in $M$ emanating from $h(v)$ in the direction of $h(E)$. \end{definition} The moduli space of tropical curves of a given type $\tau=(\Gamma, \bar{u})$ is naturally the interior of a polyhedral cone. For example, when $\Gamma$ is of genus $0$, this moduli space is isomorphic to $M_\RR \times \RR_{>0}^{|E(\Gamma)|}$, where $M_\RR$ parametrizes the position of a chosen vertex of $\Gamma$, and $\RR_{>0}^{|E(\Gamma)|}$ parametrizes the affine lengths of the images $h(E)$ of the edges $E\in E(\Gamma)$. \begin{definition} The \emph{degree} of a tropical type $(\Gamma,\bar{u})$ is the tuple \[\Delta=(w(L)\bar{u}_{v,L})_{L\in L(\Gamma)} \in M^{L(\Gamma)}\] of weighted directions of the legs, where $v$ is the unique vertex of $\Gamma$ adjacent to the leg $L$. The degree of a tropical curve is the degree of its type. \end{definition} By \cite[Proposition 2.1]{NS}, there are finitely many tropical types of given genus and degree which are realized by tropical curves. In particular, the moduli space ${\mathcal{M}}^\mathrm{trop}(\Delta)$ of rational tropical curves of given degree $\Delta$ is naturally a finite cone complex, obtained by gluing together the cones obtained as the closure of the spaces of tropical curves of given types (when the length of an edge goes to $0$, a vertex of higher valency is produced). \subsection{$(\omega,\boldsymbol{\gamma})$-marked tropical curves} \label{sec_marked_tropical_curves} Let $\omega \in \bigwedge^2 M$ be a skew-symmetric form on $N$. For every $n \in N$, we denote by $\iota_n \omega \in M$ the contraction of $\omega$ by $n$, that is, the linear form $\omega(n,-)$ on $N$. Let $\boldsymbol{\gamma}=(\gamma_1,\dots,\gamma_r)$ be a $r$-tuple of elements $\gamma_i \in N$ such that $\iota_{\gamma_i} \omega \neq 0$ for all $1\leq i \leq r$ and $\iota_\gamma \omega \neq 0$, where $\gamma:=\sum_{i=1}^r \gamma_i$. \begin{definition} \label{def_marked} An $(\omega,\boldsymbol{\gamma})$-marked tropical curve in $M_\RR$ is a rational tropical curve $h\colon \Gamma \rightarrow M_{\RR}$ of degree \[\Delta_{\omega,\boldsymbol{\gamma}}:=(\iota_{\gamma_1}\omega, \dots,\iota_{\gamma_r}\omega, -\iota_\gamma \omega)\,.\] In other words, $\Gamma$ is a genus $0$ graph, with $r+1$ legs $L_1,\dots, L_r$, $L_{\mathrm{out}}$, such that $w(L_i)\bar{u}_{v_i,L_i}=-\iota_{\gamma_i} \omega$ for all $1\leq i \leq r$, and $w(L_{\mathrm{out}})\bar{u}_{v_{\mathrm{out}},L_{\mathrm{out}}}=-\iota_\gamma \omega$, where $v_i$ (resp.\ $v_{\mathrm{out}}$) is the unique vertex of $\Gamma$ adjacent to $L_i$ (resp.\ $L_{\mathrm{out}}$). \end{definition} Given an $(\omega,\boldsymbol{\gamma})$-marked tropical curve $h\colon \Gamma \rightarrow M_\RR$, we usually view $\Gamma$ as a tree with root leg $L_{\mathrm{out}}$ and leaves $L_i$ for $1\leq i\leq r$. Correspondingly, we say that an edge $E$ is a child (resp.\ a parent) of a vertex $v$ if $E$ is adjacent to $v$ and is not (resp.\ is) contained in the unique path in $\Gamma$ between $v$ and the root. We similarly define descendants and ancestors. For every edge or leg $E$ of $\Gamma$, we denote \begin{equation}\label{eq_u_E}u_E:=w(E)\bar{u}_{v,E}\,,\end{equation} where $v$ is the unique vertex such that $E$ is a parent of $v$. In other words, $u_E$ is the weighted direction of $E$ following the flow on $\Gamma$ starting at the leaves and ending at the root. \begin{definition} \label{def_class} Let $h \colon \Gamma \rightarrow M_\RR$ be an $(\omega,\boldsymbol{\gamma})$-marked tropical curve in $M_\RR$. Then for every edge or leg $E$ of $\Gamma$, the \emph{class of $E$} is the element $\gamma_E \in N$ defined by \[ \gamma_E=\sum_{i} \gamma_i \] where the sum is over the indices $1\leq i \leq r$ such that the leg $L_i$ is a descendant of $E$. \end{definition} \begin{lemma} \label{lem_class} Let $h \colon \Gamma \rightarrow M_\RR$ be an $(\omega,\boldsymbol{\gamma})$-marked tropical curve in $M_\RR$. Then for every edge or leg $E$ of $\Gamma$, we have $u_E= -\iota_{\gamma_E}\omega$. In particular, the class $\gamma_E$ is non-zero. \end{lemma} \begin{proof} The equality $u_E= -\iota_{\gamma_E}\omega$ is true for leaves by Definition \ref{def_marked} of a $\boldsymbol{\gamma}$-marked tropical curve and then follows for the other edges and the root leg by the balancing condition in Definition \ref{def_tropical_curve}(ii). This implies that $\gamma_E \neq 0$ because $u_E \neq 0$ by definition of a tropical curve in $M_\RR$ (see \eqref{eq_u_E} and Definition \ref{def_tropical_curve}(i)). \end{proof} To simplify the notation, instead of ${\mathcal{M}}^{\mathrm{trop}}(\Delta_{\omega,\boldsymbol{\gamma}})$, in what follows we use ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^{\mathrm{trop}}$ for the moduli space of $(\omega,\boldsymbol{\gamma})$-marked tropical curves in $M_\RR$. It follows from the discussion after Definition \ref{def_type} that ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^{\mathrm{trop}}$ is naturally a finite polyhedral cone. For every cone $\sigma$ of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^\mathrm{trop}$, the relative interior $\Int(\sigma)$ of $\sigma$ parametrizes tropical curves of a given type $(\Gamma_\sigma, \bar{u}_\sigma)$. Moreover, the dimension of $\sigma$ is given by \[ \dim \sigma=d+|E(\Gamma_\sigma)|\,,\] which can also be written using that $\Gamma_\sigma$ has genus $0$ as \[ \dim \sigma=d-2+r-\mathrm{ov}(\Gamma_\sigma)\,,\] where $\mathrm{ov}(\Gamma_\sigma)$ is the overvalence of $\Gamma$, which is the non-negative integer defined by \begin{equation} \label{eq_overvalence} \mathrm{ov}(\Gamma):=\sum_{v\in V(\Gamma)}\mathrm{ov}(v)\,, \end{equation} where $\mathrm{ov}(v):=k-3$ if $v$ is a $k$-valent vertex. In particular, $\sigma$ is of dimension at most $d-2+r$, and is of dimension equal to $d-2+r$ if and only if $\Gamma_\sigma$ is trivalent. \subsection{Tropical constraints} \label{sec_tropical_constraints} \begin{definition} \label{Def affine constraint} A \emph{$\boldsymbol{\gamma}$-constraint} is a $r$-tuple $\mathbf{A}=(A_1,\dots, A_r)$ of affine hyperplanes $A_i$ in $M_\RR$ whose associated linear hyperplanes are given by $(\gamma_i^{\perp})_\RR \subset M_\RR$. \end{definition} Choices of $\boldsymbol{\gamma}$-constraints $\mathbf{A}$ are in one-to-one correspondence with choices of points $[\mathbf{A}]=([A_i])_i \in \prod_{i=1}^r M_\RR/(\gamma_i^{\perp})_\RR\simeq \RR^r$. \begin{definition} \label{def_matching} An $(\omega,\boldsymbol{\gamma})$-marked tropical curve $h: \Gamma \rightarrow M_\RR$ \emph{matches} a $\boldsymbol{\gamma}$-constraint $\mathbf{A}$ if $h(L_i) \subset A_i$ for all $1\leq i \leq r$. \end{definition} We denote by ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}, \mathbf{A}}^\mathrm{trop}$ the moduli space of $(\omega,\boldsymbol{\gamma})$-marked tropical curves matching the $\boldsymbol{\gamma}$-constraint $\mathbf{A}$. In other words, ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}, \mathbf{A}}^\mathrm{trop}\coloneqq (\mathrm {ev}^\mathrm{trop})^{-1}([\mathbf{A}])$, where $\mathrm {ev}^\mathrm{trop}$ is the evaluation map at the legs $L_i$, defined by \begin{align}\label{eq_ev_trop} \mathrm {ev}^\mathrm{trop} \colon {\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^\mathrm{trop} &\longrightarrow \prod_{i=1}^r M_\RR/(\gamma_i^{\perp})_\RR \simeq \RR^r \\ \nonumber h &\longmapsto ([h(L_i)])_i\,, \end{align} which is well-defined because $\omega(\gamma_i,\gamma_i)=0$ implies that $u_{L_i}=\iota_{\gamma_i}\omega \in \gamma_i^{\perp}$. As the evaluation map is affine in restriction to each cone of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^\mathrm{trop}$, the moduli space ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}, \mathbf{A}}^\mathrm{trop}$ is naturally a finite polyhedral complex. For every face $\sigma$ of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}, \mathbf{A}}^\mathrm{trop}$, the relative interior $\Int(\sigma)$ of $\sigma$ parametrizes tropical curves of a given type $(\Gamma_\sigma, \bar{u}_\sigma)$ and matching $\mathbf{A}$. For every subset $I \subset \{1,\dots,r\}$, we denote $\boldsymbol{\gamma}_I:=(\gamma_i)_{i \in I}$ and we consider the $\boldsymbol{\gamma}_I$-constraint $\mathbf{A}_I:=(A_i)_{i\in I}$. \begin{definition} \label{def_general_constraints} A $\boldsymbol{\gamma}$-constraint $\mathbf{A}=(A_1,\dots,A_r)$ is \emph{general} if the following conditions are satisfied: \begin{itemize} \item[(i)] $A_i \neq A_j$ for $i \neq j$, \item[(ii)] for every $I\subset \{1,\dots,r\}$, $\dim {\mathcal{M}}_{\omega,\boldsymbol{\gamma}_I, \mathbf{A}_I}^\mathrm{trop} \leq d-2$, \item[(iii)] for every $I \subset \{1,\dots,r\}$, if $\sigma$ is a face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}_I, \mathbf{A}_I}^\mathrm{trop}$, then $\dim \sigma=d-2$ if and only if $\Gamma_\sigma$ is trivalent. \end{itemize} \end{definition} \begin{lemma} \label{lem_dimension} The set of general $\boldsymbol{\gamma}$-constraints is an open dense subset in the space $\prod_{i=1}^r M_\RR/(\gamma_i^\perp)_\RR \simeq \RR^r$ of $\boldsymbol{\gamma}$-constraints. \end{lemma} \begin{proof} As there are only finitely many subsets $I \subset \{1,\dots,r\}$, it is enough to prove that the set of $\mathbf{A}$ satisfying Definition \ref{def_general_constraints}(ii)-(iii) for a given $I$ is open and dense. Let $\tau=(\Gamma,\bar{u})$ be the type of an $(\omega,\boldsymbol{\gamma}_I)$-marked tropical curve. As $\Gamma$ is of genus $0$, $h$ is not superabundant by \cite[Proposition 2.5]{MR}. In this case, \cite[Proposition 2.10]{MR} implies that, for $\mathbf{A}$ in an open dense subset of the space of constraints, the space of $(\omega,\boldsymbol{\gamma})$-marked tropical curves of type $\tau$ matching $\mathbf{A}$ is a non-empty open convex polyhedron in a vector space of dimension \[ d+\overline{e}-\sum_{i\in I} \codim (A_i)=d+\overline{e}-|I|\,,\] where by \cite[\S 2, Eq.\! (2)]{MR}, using that $\Gamma$ has $|I|+1$ legs, \[ \overline{e}=(|I|+1)-3-\mathrm{ov}(\Gamma)\,,\] where the overvalence $\mathrm{ov}(\Gamma)$ is given by \eqref{eq_overvalence} and is a non-negative integer. Therefore, the space of $(\omega,\boldsymbol{\gamma}_I)$-marked tropical curves of type $\tau$ matching $\mathbf{A}$ is of dimension at most \[ d+(|I|+1)-3-\mathrm{ov}(\Gamma)-|I|=d-2-\mathrm{ov}(\Gamma)\,,\] and of dimension equal to $d-2$ if and only if $\mathrm{ov}(\Gamma)=0$, that is, if $\Gamma$ is trivalent. \end{proof} \subsection{Properties of $(\omega,\boldsymbol{\gamma})$-marked tropical curves} Let $\mathbf{A}$ be a $\boldsymbol{\gamma}$-constraint and let $\sigma$ be a face of the moduli space ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$ of $(\omega,\boldsymbol{\gamma})$-marked tropical curves in $M_\RR$ matching $\mathbf{A}$. For each vertex $v$ of $\Gamma_\sigma$, we obtain a polyhedron $\foj_v^\sigma$ in $M_\RR$ defined by \begin{equation} \label{Eq:jv} \foj_v^\sigma \coloneqq \{h(v)\,|\, h\in \Int(\sigma)\}^{\cl}\subseteq M_{\RR} \,, \end{equation} and for each edge or leg $E$ of $\Gamma_\sigma$, a polyhedron $\fod_E^\sigma$ in $M_\RR$ defined by \begin{equation} \label{Eq:Ev} \fod_E^\sigma \coloneqq \left(\bigcup_{h\in \Int(\sigma)} h(E)\right)^{\cl} \subseteq M_{\RR}\,, \end{equation} see Figure \ref{fig4}. For every polyhedron $\fod$ in $M_\RR$, we denote by $\Lambda_{\fod} \subset M$ the subspace of integral tangent vectors to $\fod$. \begin{figure}[ht!] \resizebox{.4\linewidth}{!}{\input{fig4.pspdftex}} \caption{Polyhedra $\foj_v^\sigma$ and $\fod_E^\sigma$ for $d=3$.} \label{fig4} \end{figure} By Definition \ref{Def affine constraint}, the affine hyperplanes $A_i$ of $\mathbf{A}$ have equations of the form $\gamma_i=\epsilon_i$ for some $\epsilon_i \in \RR$. For every edge or leg $E$ of $\Gamma_\sigma$, we denote by $A_E$ the affine hyperplane in $M_\RR$ with equation \begin{equation}\label{eq_AE} \gamma_E= \sum_i \epsilon_i\end{equation} where the sum is over the indices $1\leq i \leq r$ such that the leg $L_i$ is a descendant of $E$. We have $\dim A_E= d-1$ because $\gamma_E\neq 0$ by Lemma \ref{lem_class}. \begin{lemma} \label{lem_prep} Let $\mathbf{A}$ be a $\boldsymbol{\gamma}$-constraint and let $\sigma$ be a face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$. Then, \begin{itemize} \item[(i)] for every edge or leg $E$ of $\Gamma_\sigma$, we have $\fod_E^\sigma \subset A_E$, $\Lambda_{\fod_E^\sigma} \subset \gamma_E^{\perp}$, and in particular $\dim \fod_E^{\sigma} \leq d-1$, \item[(ii)] for every vertex $v$ of $\Gamma_\sigma$, we have $\foj_v^\sigma \subset \bigcap_{i=1}^k A_{E_i}$, and $\Lambda_{\foj_v^\sigma} \subset \bigcap_{i=1}^k \gamma_{E_i}^{\perp}$ where $E_1,\dots,E_k$ are the children edges of $v$. \end{itemize} \end{lemma} \begin{proof} We prove the result by induction following the flow on $\Gamma_\sigma$ starting at the leaves and ending at the root. For the initial step of the induction, we consider a leg $E=L_i$ of $\Gamma_\sigma$. Every tropical curve $h \in \Int(\sigma)$ matches the $\boldsymbol{\gamma}$-constraint $\mathbf{A}$, and so $h(L_i) \subset A_i$. It follows that $\fod_{L_i}^\sigma \subset A_i$ and so $\Lambda_{\fod_{L_i}^\sigma}\subset \gamma_i^{\perp}$ because $\Lambda_{A_i}=\gamma_i^{\perp}$. For the induction step, let $v$ be a vertex of $\Gamma_\sigma$, $E$ the parent edge of $v$ and $E_1, \dots, E_k$ the children edges of $v$. We assume that Lemma \ref{lem_prep} holds for $E_1, \dots, E_k$, and we have to show that Lemma \ref{lem_prep} holds for $v$ and $E$. For every tropical curve $h \in \Int(\sigma)$, we have $h(v)\subset \cap_{i=1}^k h(E_i)$, and so $\fod_v^\sigma \subset \cap_{i=1}^k \fod_{E_1}^{\sigma}$. By the induction hypothesis, we have $\fod_{E_i}^\sigma \subset A_{E_i}$ and $\Lambda_{\fod_{E_i}^\sigma} =\gamma_{E_i}^{\perp}$ for all $1\leq i\leq k$, and so we conclude that $\foj_v^\sigma \subset \cap_{i=1}^k A_{E_i}$ and $\Lambda_{\foj_v^\sigma} \subset \cap_{i=1}^k \gamma_{E_i}^\perp$. Similarly, we have $h(E) \subset h(v)+\RR_{\geq 0} u_E$. Using Lemma \ref{lem_class}, this implies that $\fod_E^\sigma \subset \foj_{v}^\sigma - \RR_{\geq 0} \iota_{\gamma_E} \omega$. As we have already showed that $\Lambda_{\foj_v^\sigma} \subset \cap_{i=1}^k \gamma_{E_i}^{\perp}$, we conclude that $\fod_E^\sigma \subset \cap_{i=1}^k A_{E_i}- \RR_{\geq 0} \iota_{\gamma_E} \omega \subset A_E$ and $\Lambda_{\fod_E^\sigma} \subset \cap_{i=1}^k \gamma_{E_i}^{\perp}- \RR_{\geq 0} \iota_{\gamma_E} \omega \subset \gamma_E^{\perp}$. Indeed, we have $\cap_{i=1}^k \gamma_{E_i}^{\perp}\subset \gamma_E^{\perp}$ because $\gamma_E=\sum_{i=1}^k \gamma_{E_i}$, and we have $\iota_{\gamma_E}\omega \in \gamma_E^{\perp}$ because $\omega(\gamma_E,\gamma_E)=0$. \end{proof} Let $(\Gamma,\bar{u})$ be a tropical type and let $v \in V(\Gamma)$ be a vertex. We denote by $T_v \Gamma$ the $\RR$-span in $M_\RR$ of all the weighted directions $u_E$ of the edges or legs of $\Gamma$ adjacent to $v$. By the balancing condition in Definition \ref{def_tropical_curve}(ii), it is also the span of the weighted directions $u_{E_i}$ of the children edges or legs $E_i$ of $v$. \begin{lemma} \label{lem_locally_planar} Let $\mathbf{A}$ be a $\boldsymbol{\gamma}$-constraint and let $\sigma$ be a face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$. Let $v \in V(\Gamma_\sigma)$ be a vertex such that $\dim \fod^\sigma_{E} =d-1$, where $E$ is the unique parent edge of $v$. Then, $\dim T_v \Gamma_\sigma \leq 2$. \end{lemma} \begin{proof} Let $E_1,\dots, E_k$ be the children edges of $v$. If $\dim T_v\Gamma_\sigma >2$, then, as $u_{E_k}=-\iota_{\gamma_{E_k}}\omega$ by Lemma \ref{lem_class}, the $\RR$-span in $N_\RR$ of the vectors $\gamma_{E_k}$ is also $>2$, and so $\dim \cap_{i=1}^k \gamma_{E_k}^{\perp}<d-2$. By Lemma \ref{lem_prep}, we have $\foj_v^\sigma \subset \cap_{i=1}^k \gamma_{E_i}^{\perp}$, and so $\dim \foj_v^\sigma <d-1$. Finally, as $\fod_E^\sigma \subset \foj_v^\sigma +\RR_{\geq 0}u_E$, this implies that $\dim \fod_E^\sigma <d-1$, contradiction. \end{proof} The following Lemma is similar to \cite[Lemma 3.2.4]{KS} and \cite[Lemma C.2]{GHKK}. \begin{lemma}\label{lem_key} Let $\mathbf{A}$ be a $\boldsymbol{\gamma}$-constraint and let $\sigma$ be a face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$. Let $v \in V(\Gamma_\sigma)$ be a vertex such that $\dim T_v \Gamma_\sigma >1$ and $\dim \fod^\sigma_{E} =d-1$, where $E$ is the unique parent edge of $v$. Then, we have $\dim \fod_{E_1}^\sigma=d-1$, for any child edge $E_1$ of $v$. \end{lemma} \begin{proof} By Lemma \ref{lem_prep}(i), it is enough to prove that $\dim \fod_{E_1}^\sigma \geq d-1$ in order to show that $\dim \fod_{E}^\sigma = d-1$. Assume by contradiction that $\dim \fod_{E_1}^\sigma \leq d-2$ for a child edge or leg $E_1$ of $v$. Denote by $E_2,\dots, E_k$ the other child edges or legs of $v$. For every tropical curve $h \in \Int(\sigma)$, we have $h(v)\subset \cap_{i=1}^k h(E_i)$, and so $\fod_v^\sigma \subset \cap_{i=1}^k \fod_{E_i}^{\sigma}$. By assumption, we have $\dim \fod_{E_1}^\sigma \leq d-2$. On the other hand, by Lemma \ref{lem_prep}(i), we also have $\dim \fod_{E_i}^\sigma \leq d-1$ for all $2 \leq i\leq k$. If $\Lambda_{\fod_{E_1}^\sigma}$ is not included in $\Lambda_{\fod_{E_i}^\sigma}$ for some $2\leq i \leq k$, it follows that $\dim \foj_v^{\sigma} \leq d-3$, and so, as $\fod_E^\sigma \subset \foj_v^\sigma +\RR_{\geq 0}u_E$, we conclude that $\dim \fod_{E}^\sigma \leq d-2$, contradiction. Therefore, to end the proof, it is enough to consider the case where $\Lambda_{\fod_{E_1}^\sigma} \subset \cap_{i=2}^k \Lambda_{\fod_{E_i}^\sigma}$ . In this case, the direction $u_{E_1}$ is contained in $\cap_{i=2}^k \Lambda_{\fod_{E_2}^\sigma}$, and so in $\cap_{i=2}^k \gamma_{E_2}^{\perp}$ by Lemma \ref{lem_prep}(i). By Lemma \ref{lem_class}, we have $u_{E_1}=-\iota_{\gamma_{E_1}}\omega$, and so $u_{E_1}\in \cap_{i=2}^k \gamma_{E_i}^{\perp}$ implies $\omega(\gamma_{E_1},\gamma_{E_i})=0$ for all $2 \leq i \leq k$. As we are assuming that $\dim T_v \Gamma_\sigma >1$ and $\dim \fod_E^\sigma=d-1$, we actually have $\dim T_v \Gamma_\sigma =2$ by Lemma \ref{lem_locally_planar}. Hence, there exists $2 \leq i \leq k$ such that $u_{E_1}$ and $u_{E_i}$ generate $T_v \Gamma_\sigma$. Hence, $\omega(\gamma_{E_1},\gamma_{E_i})=0$ implies that $T_v \Gamma_\sigma \subset \gamma_{E_1}^{\perp} \cap \gamma_{E_i}^{\perp}$. In particular, we obtain that $u_E \in \gamma_{E_1}^{\perp}\cap \gamma_{E_i}^{\perp}$. On the other hand, by Lemma \ref{lem_prep}(ii), we also have $\Lambda_{\foj_v^\sigma} \subset \gamma_{E_1}^{\perp} \cap \gamma_{E_i}^{\perp}$. We conclude that $\fod_E^\sigma \subset \foj_v^\sigma +\RR_{\geq 0}u_{E} \subset \gamma_{E_1}^{\perp} \cap \gamma_{E_i}^{\perp}$. On the other hand, as we are assuming that $u_{E_1}$ and $u_{E_i}$ span the 2-dimensional space $T_v \Gamma_\sigma$, $u_{E_1}$ and $u_{E_i}$ are not proportional, and so the charges $\gamma_{E_1}$ and $\gamma_{E_i}$ are also not proportional. Hence, the hyperplanes $\gamma_{E_1}^\perp$ and $\gamma_{E_i}^{\perp}$ are distinct, and so $\dim \fod_E^\sigma \leq d-2$, contradiction. \end{proof} \begin{lemma} \label{lem_prep1} Let $\mathbf{A}$ be a $\boldsymbol{\gamma}$-constraint and let $\sigma$ be a face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$ such that $\dim \sigma=d-2$ and $\dim \fod_{L_{\mathrm{out}}}^\sigma =d-1$. Then, we have $\dim T_v \Gamma_\sigma=2$ for all vertices $v \in V(\Gamma_\sigma)$, and $\dim \fod_{E}^\sigma=d-1$ for all edges or legs $E \in E(\Gamma_\sigma) \cup L(\Gamma_\sigma)$. \end{lemma} \begin{proof} We first show that $\dim T_v \Gamma_\sigma >1$ for all $v \in V(\Gamma_\sigma)$. Assume by contradiction that there exists $v \in V(\Gamma_\sigma)$ such that $\dim T_v \Gamma_\sigma =1$. Then, there exists at least one vertex $v' \in \Gamma_\sigma$ such that $\dim T_{v'} \Gamma_\sigma =1$ and such that $\dim T_{v''}\Gamma_\sigma >1$ for all vertices $v'' \neq v'$ on the unique path in $\Gamma_\sigma$ from $v'$ to the root. If $v'$ is the unique vertex adjacent to $L_{\mathrm{out}}$, then, as $\dim T_{v'}\Gamma_\sigma=1$, one can move $h(v')$ is the direction of $h(L_{\mathrm{out}})$, and so $\foj_{v'}^\sigma = \fod_{L_{\mathrm{out}}}^\sigma$, so $\dim \foj_{v'}^\sigma=d-1$. This contradicts the assumption that $\dim \sigma=d-2$ because $\foj_{v'}^\sigma$ is the image of $\sigma$ by the evaluation map $h \mapsto h(v')$. If $v'$ is not adjacent at $L_{\mathrm{out}}$, then $v'$ admits a unique parent vertex $v$. Denote by $E_1$ the edge connecting $v'$ and $v$. As $\dim T_{v''}\Gamma_\sigma >1$ for every vertex $v''$ on the path from $v$ to the root, applying Lemma \ref{lem_key} iteratively from the root down to $v$ shows that the assumption $\dim \fod_{L_{\mathrm{out}}}^\sigma=d-1$ implies $\dim \fod_{E_1}^\sigma =d-1$, and so $\dim \foj_v^{\sigma}\geq d-2$. On the other hand, as $\dim T_{v'}\Gamma_\sigma=1$, one can move $h(v')$ is the direction of $h(E_1)$ without moving $h(v)$, and so $\dim \sigma \geq 1+\dim \foj_v^{\sigma} \geq d-1$, contradiction with the assumption that $\dim \sigma=d-2$. Once one knows that $\dim T_v \Gamma_\sigma >1$ for all $v \in V(\Gamma_\sigma)$, applying Lemma \ref{lem_key} iteratively starting from the root shows that the assumption $\dim \fod_{L_{\mathrm{out}}}^\sigma=d-1$ implies $\dim \fod_{E}^\sigma =d-1$ for all edges or legs $E$. We conclude that $\dim T_v \Gamma_\sigma=2$ for all $v \in V(\Gamma_\sigma)$ by Lemma \ref{lem_locally_planar}. \end{proof} \begin{theorem} \label{thm_trop} Let $\mathbf{A}$ be a $\boldsymbol{\gamma}$-constraint and let $\sigma$ be a $(d-2)$-dimensional face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$ such that $\dim \fod_{L_{\mathrm{out}}}^\sigma =d-1$. Then, \begin{itemize} \item[(i)]for every edge or leg $E$ of $\Gamma_\sigma$, we have $\dim \fod_{E}^\sigma=d-1$ and $\Lambda_{\fod_{E}^\sigma} =\gamma_E^{\perp}$, \item[(ii)] for every vertex $v\in V(\Gamma_\sigma)$, we have $\dim T_v \Gamma_\sigma=2$, $\dim \foj_v^\sigma=d-2$ and $\Lambda_{\foj_v^\sigma}=\cap_{i=1}^k \gamma_{E_i}^\perp$ where $E_1,\dots, E_k$ are the children edges of $v$, \item[(iii)] for every edge or leg $E$ of $\Gamma_\sigma$ with parent vertex $v$, we have $u_E \notin \Lambda_{\foj_v^\sigma}$. \end{itemize} \end{theorem} \begin{proof} (i) follows from Lemma \ref{lem_prep1} and Lemma \ref{lem_prep}(i). The first part of (ii) also follows from Lemma \ref{lem_prep1}. Moreover, denoting by $E$ the parent edge of $v$, we have $\fod_{E}^\sigma=\foj_v^\sigma +\RR_{\geq 0} u_E$, and so the last part of (ii) follows from (i) and Lemma \ref{lem_prep}(ii). Finally, for (iii), if one had $u_E \in \Lambda_{\foj_v^\sigma}$, one would have $\Lambda_{\fod_E^\sigma}=\Lambda_{\foj_v^\sigma}$, in contradiction with (i) and (ii). \end{proof} \subsection{Tropical multiplicities and coefficients} \subsubsection{Tropical multiplicities} Let $\mathbf{A}$ be a $\boldsymbol{\gamma}$-constraint and let $\sigma$ be a face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$. For every leg $L\in L(\Gamma_\sigma)$, there exists a unique vertex $\partial^- L$ adjacent to $L$. For every edge $E \in E(\Gamma_\sigma)$, we denote by $\partial^+ E$ the parent vertex of $E$ and by $\partial^-E$ the child vertex of $E$. \begin{definition} \label{def_gluing_map} Let $\mathbf{A}$ be a $\boldsymbol{\gamma}$-constraint. For every face $\sigma$ of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$, the \emph{gluing map} $\mathrm{gl}_\sigma$ is the map \begin{align}\label{eq_gl} \mathrm{gl}_\sigma: \prod_{v \in V(\Gamma_\sigma)} M &\longrightarrow \prod_{e \in E(\Gamma_\sigma)} M/\mathbb{Z} u_E \times \prod_{i=1}^r M/\gamma_i^\perp \\ \nonumber (m_v)_{v \in V(\Gamma_\sigma)} &\longmapsto ((m_{\partial^+ E}-m_{\partial^- E})_{E\in E(\Gamma_\sigma)}, m_{\partial^- E}) \,. \end{align} \end{definition} By construction, the kernel $T_\sigma:=\ker\, \mathrm{gl}_\sigma$ is the integral tangent space to $\sigma$ (see \cite[Proposition 2.10]{MR}): an element $(m_v)_{v\in V(\Gamma_\sigma)} \in \prod_{v\in V(\Gamma_\sigma)} M$ contained in the kernel of $\mathrm{gl}_\sigma$ defines an integral way to move the vertices of $\Gamma_\sigma$ in $M_\RR$ while preserving the directions of the edges and the matching of the constraint $\mathbf{A}$. \begin{lemma} \label{lem_finite} Let $\mathbf{A}$ be a general $\boldsymbol{\gamma}$-constraint as in Definition \ref{def_general_constraints}. For every $(d-2)$-dimensional face $\sigma$ of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$, the cokernel $\coker \mathrm{gl}_\sigma$ of the gluing map $\mathrm{gl}_\sigma$ is finite. \end{lemma} \begin{proof} It is enough to show that $\mathrm{gl}_\sigma$ is surjective after tensoring with $\QQ$. This follows from a dimension count: the domain of $\mathrm{gl}_\sigma \otimes \QQ$ is of dimension $d |V(\Gamma_\sigma)|$, its codomain is of dimension $(d-1)|E(\Gamma_\sigma)|+r$, and its kernel is of dimension $d-2$. Hence, \[ \dim \coker\,\mathrm{gl}_\sigma \otimes \QQ=(d-1)|E(\Gamma_\sigma)|+l-d|V(\Gamma_\sigma)|+d-2\] \[=d(|E(\Gamma_\sigma)|-|V(\Gamma_\sigma)|+1)-|E(\Gamma_\sigma)|+r-2\,.\] As $\Gamma_\sigma$ is of genus $0$, we have $|E(\Gamma_\sigma)|-|V(\Gamma_\sigma)|+1=0$, and so \begin{equation} \label{eq_coker} \dim \coker\,\mathrm{gl}_\sigma \otimes \QQ =|E(\Gamma_\sigma)|+r-2\,.\end{equation} Moreover, as $\mathbf{A}$ is general and $\dim \sigma=d-2$, the graph $\Gamma_\sigma$ is trivalent by Definition \ref{def_general_constraints}(iii), with $r+1$ legs, and so we have $3|V(\Gamma_\sigma)|=2|E(\Gamma_\sigma)|+r+1$. Combining these two relations, we obtain \[ 3(|E(\Gamma_\sigma)+1|)=2|E(\Gamma_\sigma)|+r+1\] and so $|E(\Gamma_\sigma)|=r-2$, which implies that $\dim \coker\,\mathrm{gl}_\sigma \otimes \QQ=0$ by \eqref{eq_coker}. \end{proof} \begin{definition}\label{def_trop_mult} Let $\mathbf{A}$ be a general $\boldsymbol{\gamma}$-constraint. For every $(d-2)$-dimensional face $\sigma$ of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$, the \emph{tropical multiplicity} $N_\sigma^\mathrm{trop}$ is the cardinality of the cokernel of the gluing map $\mathrm{gl}_\sigma$, which is finite by Lemma \ref{lem_finite}: \begin{equation} \label{eq_N_trop} N_\sigma^\mathrm{trop}:=|\coker\, \mathrm{gl}_\sigma|\,. \end{equation} \end{definition} \subsubsection{Tropical coefficients} \label{sec_trop_coeff} Let $\mathbf{A}$ be a $\boldsymbol{\gamma}$-constraint and $\sigma$ be a $(d-2)$-dimensional face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$ such that $\dim \fod_{L_{\mathrm{out}}}^\sigma=d-1$. Let $p : T_\sigma \longrightarrow M$ be the composition of the inclusion $T_\sigma=\ker\, \mathrm{gl}_\sigma \subset \prod_{v \in V(\Gamma_\sigma)} M$ with the projection $\prod_{v \in V(\Gamma_\sigma)} M \rightarrow M$ on the factor corresponding to the vertex $v_{\mathrm{out}} \in V(\Gamma_\sigma)$ adjacent to $L_{\mathrm{out}}$. In other words, $p$ is the integral derivative of the evaluation map \begin{align*} \sigma &\longrightarrow \foj_{v_{\mathrm{out}}}^\sigma \\ h &\longmapsto h(v_{\mathrm{out}})\,. \end{align*} This evaluation map is an affine map which is surjective by definition. By Theorem \ref{thm_trop}(ii), we have $\dim \foj_{v_{\mathrm{out}}}^\sigma =d-2$, and so, as we also have $\dim \sigma=d-2$, this evaluation map is in fact bijective, and we have an inclusion $p(T_\sigma) \subset \Lambda_{\foj_{v_{\mathrm{out}}}^\sigma }$ of finite index. By Theorem \ref{thm_trop}(iii), we have $u_{L_{\mathrm{out}}} \notin \Lambda_{\foj_{v_{\mathrm{out}}}^\sigma}$, and so the lattice \[ {\mathcal{L}}:= p(T_\sigma)+\mathbb{Z} u_{L_{\mathrm{out}}} \] is of rank $d-1$ and the natural inclusion ${\mathcal{L}} \subset \Lambda_{\fod_{L_{\mathrm{out}}}^\sigma}$ is of finite index. \begin{definition} Let $\mathbf{A}$ be a $\boldsymbol{\gamma}$-constraint and $\sigma$ be a $(d-2)$-dimensional face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$ such that $\dim \fod_{L_{\mathrm{out}}}^\sigma=d-1$. The \emph{tropical coefficient} $k_\sigma$ is the index of the inclusion ${\mathcal{L}} \subset \Lambda_{\fod_{L_{\mathrm{out}}}^\sigma}$, that is, \begin{equation} \label{eq_coeff} k_{\sigma}:=|\Lambda_{\fod_{L_{\mathrm{out}}}^\sigma}/{\mathcal{L}}|\,.\end{equation} \end{definition} Note that $\Lambda_{\fod_{L_{\mathrm{out}}}^\sigma}$ is also equal to the saturation ${\mathcal{L}}^{\sat}$ of ${\mathcal{L}}$ in $M$, and so one also have $k_\sigma=|{\mathcal{L}}^\sat/{\mathcal{L}}|$. \subsection{Product formula for the tropical multiplicities} \label{subsec: product formula} In this section, we prove in Lemma \ref{lem: product for Ntrop} and Lemma \ref{lem: product2 for Ntrop} two product formulas for the tropical multiplicity $N_\sigma^\mathrm{trop}$ introduced in Definition \ref{def_trop_mult}. Let $\mathbf{A}$ be a general $\boldsymbol{\gamma}$-constraint and $\sigma$ a $(d-2)$-dimensional face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$ such that $\dim \fod_{L_{\mathrm{out}}}^\sigma =d-1$. By Definition \ref{def_general_constraints}(iii) of a general $\boldsymbol{\gamma}$-constraint, the graph $\Gamma_\sigma$ is trivalent. In particular, every vertex $v \in \Gamma_\sigma$ has two children edges or legs, that we denote by $E_{1,v}$ and $E_{2,v}$, and one parent edge $E_{\mathrm{out},v}$. We denote by $I_{k,v}$ (resp.\ $I_{\mathrm{out},v}$) the subset of $\{1,\dots,r\}$ consisting of indices $1\leq i \leq r$ such that $L_i$ is a descendant leg of $E_{k,v}$ (resp.\ $E_{\mathrm{out},v}$). For $k=1, 2$, if $E_{k,v}$ is an edge, we denote by $\tau_{k,v}$ the type of tropical curves obtained from tropical curves $h \in \Int(\sigma)$ by removing the vertex $v$ and extending the connected component containing $E_{k,v}$ to infinity. We denote by $\sigma_{k,v}$ the face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma}_{I_{k,v}}, \mathbf{A}_{I_{k,v}}}$ whose relative interior parametrizes tropical curves of type $\tau_{k,v}$ matching $\mathbf{A}_{I_{k,v}}$. Similarly, we denote by $\tau_{\mathrm{out},v}$ the type of tropical curves obtained from tropical curves $h \in \Int(\sigma)$ by cutting the edge (or leg ) $E_{\mathrm{out},v}$ and extending the connected component containing $E_{\mathrm{out},v}$ to infinity. We denote by $\sigma_{\mathrm{out},v}$ the face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma}_{I_{\mathrm{out},v}}, \mathbf{A}_{I_{\mathrm{out},v}}}$ whose relative interior parametrizes tropical curves of type $\tau_{\mathrm{out},v}$ matching $\mathbf{A}_{I_{\mathrm{out},v}}$. By a small abuse of notation, we still denote by $E_{k,v}$ and $E_{\mathrm{out},v}$ the new legs of $\Gamma_{\sigma_{k,v}}$ and $\Gamma_{\sigma_{\mathrm{out},v}}$ obtained by cutting and extending the edges $E_{k,v}$ and $E_{\mathrm{out},v}$ of $\Gamma_\sigma$. \begin{lemma} \label{lem_dim_new} Let $\mathbf{A}$ be a general $\boldsymbol{\gamma}$-constraint and $\sigma$ a $(d-2)$-dimensional face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$ such that $\dim \fod_{L_{\mathrm{out}}}^\sigma =d-1$. Then, for every vertex $v \in V(\Gamma)$, we have \begin{itemize} \item[(i)] for $k=1,2$, if $E_{k,v}$ is an edge, then $\dim \sigma_{k,v}=d-2$ and $\dim \fod_{E_{k,v}}^{\sigma_{k,v}}=d-1$. \item[(ii)] $\dim \sigma_{\mathrm{out},v}=d-2$ and $\dim \fod_{E_{\mathrm{out},v}}^{\sigma_{\mathrm{out},v}}=d-1$. \end{itemize} \end{lemma} \begin{proof} As the graph $\Gamma_{\sigma_{k,v}}$ is cut out form the trivalent graph $\Gamma_\sigma$, it is also trivalent, and so $\dim \sigma_{k,v}=d-2$ by Definition \ref{def_general_constraints}(iii) of a general $\boldsymbol{\gamma}$-constraint. In particular, $\dim \fod_{E_{k,v}}^{\sigma_{k,v}}\leq d-1$. But we also have $\fod_{E_{k,v}}^{\sigma} \subset \fod_{E_{k,v}}^{\sigma_{k,v}}$ and $\dim \fod_{E_{k,v}}^{\sigma}=d-1$ by Theorem \ref{thm_trop}(i), and so we conclude that $\dim \fod_{E_{k,v}}^{\sigma_{k,v}}= d-1$. This proves the case (i) of Lemma \ref{lem_dim_new}. The proof of case (ii) is identical. \end{proof} If $E_{k,v}$ is an edge, then by Lemma \ref{lem_dim_new}(i), $\sigma_{k,v}$ satisfies the assumptions of \S \ref{sec_trop_coeff}. In particular, following \S \ref{sec_trop_coeff}, we obtain a map $p_{k,v}\colon T_{\sigma_{k,v}} \rightarrow M$, a rank $(d-1)$-lattice \[ {\mathcal{L}}_{k,v}:= p_{k,v}(T_{\sigma_{k,v}})+\mathbb{Z} u_{E_{k,v}} \subset M\,,\] of finite index in $\Lambda_{\fod^{\sigma_{k,v}}_{E_{k,v}}}$, and a coefficient \begin{equation} \label{eq_coeff_1} k_{\sigma_{k,v}}=|\Lambda_{\fod^{\sigma_{k,v}}_{E_{k,v}}}/{\mathcal{L}}_{k,v}|=|{\mathcal{L}}_{k,v}^{\sat}/{\mathcal{L}}_{k,v}|\,.\end{equation} If $E_{k,v}$ is a leg $L_i$ of $\Gamma_\sigma$ for some $1\leq i\leq r$, then we define \[ {\mathcal{L}}_{k,v}:=\gamma_i^\perp \subset M\,.\] By Theorem \ref{thm_trop}(ii), we have $\dim T_v \Gamma_\sigma=2$. In particular, the lattice ${\mathcal{L}}_{1,v}+{\mathcal{L}}_{2,v}$ is of rank $d$, and so of finite index in $M$. Similarly by Lemma \ref{lem_dim_new}(ii), $\sigma_{\mathrm{out},v}$ satisfies the assumptions of \S \ref{sec_trop_coeff}. In particular, we obtain a map $p_{\mathrm{out},v}\colon T_{\sigma_{\mathrm{out},v}} \rightarrow M$, a rank $(d-1)$-lattice \[ {\mathcal{L}}_{\mathrm{out},v}:= p_{\mathrm{out},v}(T_{\sigma_{\mathrm{out},v}})+\mathbb{Z} u_{E_{\mathrm{out},v}} \subset M\,,\] of finite index in $\Lambda_{\fod^{\sigma_{\mathrm{out},v}}_{E_{\mathrm{out},v}}}$, and a coefficient \begin{equation} \label{eq_coeff_2} k_{\sigma_{\mathrm{out},v}}=|\Lambda_{\fod^{\sigma_{\mathrm{out},v}}_{E_{\mathrm{out},v}}}/{\mathcal{L}}_{\mathrm{out},v}|=|{\mathcal{L}}_{\mathrm{out},v}^{\sat}/{\mathcal{L}}_{\mathrm{out},v}|\,.\end{equation} As a tropical curve in $\sigma_{\mathrm{out},v}$ is obtained by gluing at $v$ a tropical curve in $\sigma_{1,v}$ with a tropical curve in $\sigma_{2,v}$, we have $p_{\mathrm{out},v}(T_{\sigma_{\mathrm{out},v}})={\mathcal{L}}_{1,v}\cap {\mathcal{L}}_{2,v}$, and so \begin{equation}\label{eq_cL_out} {\mathcal{L}}_{\mathrm{out},v}:= {\mathcal{L}}_{1,v}\cap {\mathcal{L}}_{2,v}+\mathbb{Z} u_{E_{\mathrm{out},v}} \subset M\,.\end{equation} \begin{lemma} \label{lem: product for Ntrop} Let $\mathbf{A}$ be a general $\boldsymbol{\gamma}$-constraint and $\sigma$ a $(d-2)$-dimensional face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$ such that $\dim \fod_{L_{\mathrm{out}}}^\sigma =d-1$. Then, we have \[ N_\sigma^\mathrm{trop}=\prod_{v \in V(\Gamma_\sigma)}|M/({\mathcal{L}}_{1,v}+{\mathcal{L}}_{2,v})|\,.\] \end{lemma} \begin{proof} We prove by induction, following the flow on $\Gamma_\sigma$ starting at the leaves and ending at the root, that, for every vertex $v \in V(\Gamma_\sigma)$, we have \[ N_{\sigma_{\mathrm{out},v}}^\mathrm{trop}=\prod_{v \in V(\Gamma_{\sigma_{\mathrm{out},v})}}|M/({\mathcal{L}}_{1,v}+{\mathcal{L}}_{2,v})|\,.\] To shorten the notation, denote $\Gamma_{\sigma_k}, E_{k}, \sigma_k, \sigma_{\mathrm{out}}, p_k, {\mathcal{L}}_k$ for $\Gamma_{\sigma_{k,v}}, E_{k,v}, \sigma_{k,v}, \sigma_{\mathrm{out},v}$, $p_{k,v}$, ${\mathcal{L}}_{k,v}$ respectively. If $E_{1}$ and $E_{2}$ are both edges, we have to show that \begin{equation}\label{eq_1} N_{\sigma_{\mathrm{out}}}^\mathrm{trop}=|M/({\mathcal{L}}_{1}+{\mathcal{L}}_{2})| N_{\sigma_1}^{\mathrm{trop}} N_{\sigma_2}^\mathrm{trop} \,. \end{equation} Denote the domains of the gluing maps $\mathrm{gl}_{\sigma_{\sigma_{\mathrm{out}}}}$, $\mathrm{gl}_{\sigma_1}$, $\mathrm{gl}_{\sigma_2}$ of Definition \ref{def_gluing_map} by ${\mathcal{M}}$, ${\mathcal{M}}_1$, ${\mathcal{M}}_2$ and the codomains by ${\mathcal{K}}$, ${\mathcal{K}}_1$, ${\mathcal{K}}_2$. We have ${\mathcal{M}}={\mathcal{M}}_1 \oplus {\mathcal{M}}_2 \oplus M_v$, where $M_v$ is the factor $M$ in ${\mathcal{M}}$ corresponding to the vertex $v$, and ${\mathcal{K}}={\mathcal{K}}_1 \oplus {\mathcal{K}}_2 \oplus M/\mathbb{Z} u_{E_1}\oplus M/\mathbb{Z} u_{E_2}$. With respect to these decompositions, one can write \[ \mathrm{gl}_{\sigma_{\mathrm{out}}} (m_1,m_2,m_v) =(\mathrm{gl}_{\sigma_1} (m_1), \mathrm{gl}_{\sigma_2} (m_2), m_{v_1}-m_v, m_{v_2}-m_v)\,,\] where $v_1$ (resp.\ $v_2$) is the vertex of $\Gamma_{\sigma_1}$ (resp.\ $\Gamma_{\sigma_2}$) adjacent to $E_1$ (resp.\ $E_2$). In other words, we have a commutative diagram \[\begin{tikzcd} 0 \arrow[r] & M_v \arrow[r] \arrow[d,"\psi"] & {\mathcal{M}} \arrow[r]\arrow[d,"\mathrm{gl}_{\sigma_{\mathrm{out}}}"] & {\mathcal{M}}_1\oplus {\mathcal{M}}_2 \arrow[r] \arrow[d,"\mathrm{gl}_{\sigma_1} \oplus \mathrm{gl}_{\sigma_2}"] & 0\\ 0 \arrow[r]& M/\mathbb{Z} u_{E_1} \oplus M/\mathbb{Z} u_{E_2} \arrow[r] & {\mathcal{K}} \arrow[r]& {\mathcal{K}}_1 \oplus {\mathcal{K}}_2 \arrow[r]& 0\,, \end{tikzcd}\] where the rows are short exact sequences of abelian groups, and where $\psi$ is given by $\psi(m)=(-m,-m)$. By Theorem \ref{thm_trop}(ii), we have $\dim T_v \Gamma_\sigma=2$, and so the vectors $u_{E_1}$ and $u_{E_2}$ are linearly independent. This implies that the map $\psi$ is injective. Hence, by the snake lemma, we obtain a long exact sequence \[ 0 \rightarrow T_{\sigma_{\mathrm{out}}} \rightarrow T_{\sigma_1}\oplus T_{\sigma_2} \xrightarrow{\xi} \coker\, \psi \rightarrow \coker\, \mathrm{gl}_{\sigma_{\mathrm{out}}} \rightarrow \coker\, \mathrm{gl}_{\sigma_1} \oplus \coker\, \mathrm{gl}_{\sigma_2} \rightarrow 0\,, \] and so, using \eqref{eq_N_trop}, \begin{equation} \label{eq_2} N_{\sigma_{\mathrm{out}}}^\mathrm{trop}=|\coker\, \xi| N_{\sigma_1}^{\mathrm{trop}} N_{\sigma_2}^\mathrm{trop} \,.\end{equation} Moreover, the connecting homomorphism $\xi$ is given by $\xi(m_1,p_2)=(\bar{p}_1(m_1),\bar{p}_2(m_2) )$, where $\bar{p}_k(m_k)$ is the image of $p_k(m_k)$ in $M/\mathbb{Z} u_{E_k}$. As $\coker\, \psi = M/(\mathbb{Z} u_{E_1}+ \mathbb{Z} u_{E_2})$, we deduce that $\coker\, \xi=M/({\mathcal{L}}_{1}+{\mathcal{L}}_{2})$, and so \eqref{eq_2} implies \eqref{eq_1}. Consider now the case when one of $E_1$ or $E_2$ is an edge and the other is a leg. By symmetry, one can assume that $E_1$ is an edge, with adjacent vertex $v_1$ in $\Gamma_{\sigma_1}$, and $E_2$ is a leg $L_i$ for some $1\leq i\leq r$. In this case, we have to show that \begin{equation}\label{eq_11} N_{\sigma_{\mathrm{out}}}^\mathrm{trop}=|M/({\mathcal{L}}_{1}+{\mathcal{L}}_{2})| N_{\sigma_1}^{\mathrm{trop}}\,. \end{equation} We have ${\mathcal{M}}={\mathcal{M}}_1\oplus M_v$, and ${\mathcal{K}}={\mathcal{K}}_1 \oplus M/\mathbb{Z} u_{E_1} \oplus M/\gamma_i^\perp$, and so a commutative diagram \[\begin{tikzcd} 0 \arrow[r] & M_v \arrow[r] \arrow[d,"\psi"] & {\mathcal{M}} \arrow[r]\arrow[d,"\mathrm{gl}_\sigma"] & {\mathcal{M}}_1\arrow[r] \arrow[d,"\mathrm{gl}_{\sigma_1}"] & 0\\ 0 \arrow[r]& M/\mathbb{Z} u_{E_1} \oplus M/\gamma_i^\perp \arrow[r] & {\mathcal{K}} \arrow[r]& {\mathcal{K}}_1 \arrow[r]& 0\,, \end{tikzcd}\] where $\psi$ is given by $\psi(m)=(-m,m)$. By Theorem \ref{thm_trop}(ii), we have $\dim T_v \Gamma_\sigma=2$, and so $u_{E_1} \notin \gamma_i^\perp$. Hence, $\psi$ is injective, and so by the snake lemma, we obtain a long exact sequence \[ 0 \rightarrow T_{\sigma_{\mathrm{out}}} \rightarrow T_{\sigma_1} \xrightarrow{\xi} \coker\, \psi \rightarrow \coker\, \mathrm{gl}_{\sigma_{\mathrm{out}}} \rightarrow \coker\, \mathrm{gl}_{\sigma_1} \rightarrow 0\,, \] and so, using \eqref{eq_N_trop}, \begin{equation} \label{eq_3} N_\sigma^\mathrm{trop}=|\coker\, \xi| N_{\sigma_1}^{\mathrm{trop}} \,.\end{equation} Moreover, we have $\coker\, \psi = M/(\mathbb{Z} u_{E_1}+\gamma_i^\perp)$ and the connecting homomorphism $\xi$ is given by $\xi(m_1)=\bar{p}_1(m_1)$. As ${\mathcal{L}}_{1}=p_1(T_{\sigma_1})+\mathbb{Z} u_{E_1}$ and ${\mathcal{L}}_{2} =\gamma_i^\perp$, we deduce that $\coker\, \xi=M/({\mathcal{L}}_{1}+{\mathcal{L}}_{2})$, and so \eqref{eq_3} implies \eqref{eq_11}. Finally, we consider the case where both $E_1$ and $E_2$ are legs $L_i$ and $L_j$ of $\Gamma$ for some $1 \leq i,j \leq r$. In this case, we have to show that \[N_\sigma^\mathrm{trop}=|M/({\mathcal{L}}_{1}+{\mathcal{L}}_{2})|\,.\] This follows because in this case the gluing map $\mathrm{gl}_{\sigma_{\mathrm{out}}}$ is simply given by the projection map \[ M \rightarrow M/\gamma_i^\perp \oplus M/\gamma_j^\perp\,,\] and ${\mathcal{L}}_{1}=\gamma_i^\perp$ and ${\mathcal{L}}_{2}=\gamma_j^\perp$. \end{proof} For every non-zero $n\in N$, we denote by $|n|$ the divisibility of $n$ in $N$. \begin{lemma}\label{lem: product2 for Ntrop} Let $\mathbf{A}$ be a general $\boldsymbol{\gamma}$-constraint. Then, for every $(d-2)$-dimensional face $\sigma$ of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$ such that $\dim \fod_{L_{\mathrm{out}}}^\sigma =d-1$, we have \begin{equation} \label{eq_product} k_\sigma N_\sigma^{\mathrm{trop}} = \frac{|\gamma|}{\prod_{i=1}^r |\gamma_i|} \prod_{v \in V(\Gamma_\sigma)} |\omega (\gamma_{E_{1,v}},\gamma_{E_{2,v}})|\,,\end{equation} where for every vertex $v$ we denote by $E_{1,v}$ and $E_{2,v}$ the two children edges of $v$. \end{lemma} \begin{proof} We prove by induction, following the flow on $\Gamma_\sigma$ starting at the leaves and ending at the root, that, for every vertex $v \in V(\Gamma_\sigma)$, we have \[ k_{\sigma_{\mathrm{out},v}} N_{\sigma_{\mathrm{out},v}}^\mathrm{trop}=\frac{|\gamma_{E_{\mathrm{out},v}}|}{\prod_{i \in I_v}|\gamma_i|}\prod_{v' \in V(\Gamma_{\sigma_{\mathrm{out},v}})}|\omega (\gamma_{E_{1,v'}},\gamma_{E_{2,v'}})|\,.\] Given a vertex $v \in V(\Gamma_\sigma)$, we use the same simplified notations $\mathrm{E}_1$, $E_2$, $E_{\mathrm{out}}$ and so on, as in the proof of Lemma \ref{lem: product for Ntrop}. If $E_1$ and $E_2$ are both edges, we have to show that \begin{equation} \label{eq_proof_1}k_{\sigma_{\mathrm{out}}} N_{\sigma_{\mathrm{out}}}^\mathrm{trop} = \frac{|\gamma_{E_{\mathrm{out}}}|}{|\gamma_{E_1}||\gamma_{E_2}|} |\omega(\gamma_{E_1},\gamma_{E_2})|k_{\sigma_1} N_{\sigma_1}^\mathrm{trop} k_{\sigma_2} N_{\sigma_2}^\mathrm{trop} \,. \end{equation} By Lemma \ref{lem: product for Ntrop}, we have \[ N_{\sigma_{\mathrm{out}}}^\mathrm{trop} = |M/({\mathcal{L}}_1+{\mathcal{L}}_2)| N_{\sigma_1}^\mathrm{trop} N_{\sigma_2}^\mathrm{trop} \,,\] and so we have to show that \begin{equation}\label{eq_proof_2} |M/({\mathcal{L}}_1+{\mathcal{L}}_2)|= \frac{k_{\sigma_1}k_{\sigma_2}}{k_{\sigma_{\mathrm{out}}}} \frac{|\gamma_{E_{\mathrm{out}}}|}{|\gamma_{E_1}||\gamma_{E_2}|} |\omega(\gamma_{E_1},\gamma_{E_2})|\,. \end{equation} First of all, we have \begin{equation}\label{eq_proof_3} |M/({\mathcal{L}}_1+{\mathcal{L}}_2)|=|M/({\mathcal{L}}_{1}^\sat+{\mathcal{L}}_2^\sat)|\,. |({\mathcal{L}}_{1}^\sat+{\mathcal{L}}_2^\sat)/({\mathcal{L}}_{1}+{\mathcal{L}}_2)|\,. \end{equation} Then, the exact sequence \begin{equation}\label{eq_sat} 0 \rightarrow \frac{{\mathcal{L}}_1^\sat \cap {\mathcal{L}}_2^\sat}{{\mathcal{L}}_1\cap {\mathcal{L}}_2} \rightarrow {\mathcal{L}}_1^\sat/{\mathcal{L}}_1 \oplus {\mathcal{L}}_2^\sat/{\mathcal{L}}_2 \rightarrow \frac{{\mathcal{L}}_1^\sat +{\mathcal{L}}_2^\sat}{{\mathcal{L}}_1+{\mathcal{L}}_2} \rightarrow 0\,,\end{equation} and \eqref{eq_coeff_1} imply that \begin{equation}\label{eq_proof_4} |({\mathcal{L}}_1^\sat+{\mathcal{L}}_2^\sat)/({\mathcal{L}}_1+{\mathcal{L}}_2)| =\frac{k_{\sigma_1}k_{\sigma_2}}{|({\mathcal{L}}_1^\sat \cap {\mathcal{L}}_2^\sat)/({\mathcal{L}}_1\cap {\mathcal{L}}_2)|} \,.\end{equation} On the other hand, we have ${\mathcal{L}}_{\mathrm{out}} ={\mathcal{L}}_1 \cap {\mathcal{L}}_2 + \mathbb{Z} u_{E_{\mathrm{out}}}$ by \eqref{eq_cL_out}, and so \begin{equation}\label{eq_proof_5} k_{\sigma_{\mathrm{out}}}=|{\mathcal{L}}_{\mathrm{out}}^\sat/{\mathcal{L}}_{\mathrm{out}}| =|({\mathcal{L}}_1^\sat \cap {\mathcal{L}}_2^\sat)/({\mathcal{L}}_1\cap {\mathcal{L}}_2)| |\overline{u}_{E_{\mathrm{out}}}|\,, \end{equation} where for every $u \in M$, $\overline{u}$ is the image of $u$ in the rank two lattice \[\overline{M}:=M/({\mathcal{L}}_1^\sat \cap {\mathcal{L}}_2^\sat)\,.\] Similarly, we also have \begin{equation} \label{eq_proof_6} |M/({\mathcal{L}}_1^\sat +{\mathcal{L}}_2^\sat)|=\frac{|\overline{u}_{E_1} \wedge \overline{u}_{E_2}|}{|\overline{u}_{E_1} ||\overline{u}_{E_2}| }\,. \end{equation} Combining \eqref{eq_proof_3}-\eqref{eq_proof_4}-\eqref{eq_proof_5}, we obtain \[ |M/({\mathcal{L}}_1+{\mathcal{L}}_2)|=\frac{k_{\sigma_1}k_{\sigma_2}}{k_{\sigma_{\mathrm{out}}}} \frac{|\overline{u}_{E_{\mathrm{out}}}|}{|\overline{u}_{E_1}| |\overline{u}_{E_2}|} |\overline{u}_{E_1} \wedge \overline{u}_{E_2}|\,.\] Hence, comparing with \eqref{eq_proof_2}, it remains to show that \begin{equation}\label{eq_proof_7} \frac{|\overline{u}_{E_{\mathrm{out}}}|}{|\overline{u}_{E_1}| |\overline{u}_{E_2}|} |\overline{u}_{E_1} \wedge \overline{u}_{E_2}| = \frac{|\gamma_{E_{\mathrm{out}}}|}{|\gamma_{E_1}||\gamma_{E_2}|} |\omega(\gamma_{E_1},\gamma_{E_2})|\,. \end{equation} Denote $\overline{N}:=(\mathbb{Z} \gamma_{E_1}+\mathbb{Z} \gamma_{E_2})^{\sat}$, it is a rank two saturated sublattice of $N$. As ${\mathcal{L}}_1=\gamma_{E_1}^\perp$ and ${\mathcal{L}}_2^\perp=\gamma_{E_2}^{\perp}$, the duality between $N$ and $M$ implies that $\overline{N}$ and $\overline{M}$ are naturally dual to each other. Let $(e_1, e_2)$ be a basis of $\overline{N}$ and $(e_1^\star, e_2^\star)$ the corresponding dual basis of $\overline{M}$. Then, we have $\iota_{e_1} \omega= \omega(e_1,e_2) e_2^\star$, $\iota_{e_2} \omega = -\omega(e_1,e_2)e_1^\star$. In particular, for every $n=\alpha e_1+\beta e_2 \in \overline{N}$, we have $\overline{\iota_n \omega}=\omega(e_1,e_2)(\alpha e_2^{\star}-b e_1^\star)$, and so $|\iota_n \omega|=|\omega(e_1,e_2))| \gcd(\alpha,\beta)=|\omega(e_1,e_2))| |n|$. As $\overline{u}_{E_1}=\iota_{\gamma_{E_1}}\omega$, $\overline{u}_{E_2}=\iota_{\gamma_{E_2}}\omega$, and $\overline{u}_{E_{\mathrm{out}}}=\iota_{\gamma_{E_{\mathrm{out}}}}\omega$, we obtain \begin{equation}\label{eq_proof_8} |\overline{u}_{E_1}|=\omega(e_1,e_2)|\gamma_{E_1}|\,, |\overline{u}_{E_2}|=\omega(e_1,e_2)|\gamma_{E_2}|\,, \text{and}\, |\overline{u}_{E_{\mathrm{out}}}| =\omega(e_1,e_2)|\gamma_{E_{\mathrm{out}}}|\,.\end{equation} On the other hand, writing $\gamma_{E_1}=ae_1+be_2$ and $\gamma_{E_2}=ce_1+de_2$, we have $|\overline{u}_{E_1} \wedge \overline{u}_{E_2}|= \omega(e_1,e_2)^2 |ad-bc|$, whereas $|\omega(\gamma_{E_1},\gamma_{E_2})|=|\omega(e_1,e_2)||ad-bc|$, and so \begin{equation}\label{eq_proof_9} |\overline{u}_{E_1} \wedge \overline{u}_{E_2}| =\omega(e_1,e_2)|\omega(\gamma_{E_1},\gamma_{E_2})|\,. \end{equation} Combining \eqref{eq_proof_8} and \eqref{eq_proof_9}, we obtain \eqref{eq_proof_7}, and this concludes the proof of \eqref{eq_proof_1}. If $E_1$ is an edge and $E_2$ is a leg $L_i$ for some $1\leq i \leq r$, then we similarly show that \[ k_{\sigma_{\mathrm{out}}} N_{\sigma_{\mathrm{out}}}^\mathrm{trop} = \frac{|\gamma_{E_{\mathrm{out}}}|}{|\gamma_{E_1}||\gamma_{E_2}|} |\omega(\gamma_{E_1},\gamma_{E_2})|k_{\sigma_1} N_{\sigma_1}^\mathrm{trop} \,.\] The only difference is that in this case, we have ${\mathcal{L}}_2=\gamma_{i}^{\perp}$, and so $|{\mathcal{L}}_2^\sat/{\mathcal{L}}_2|=1$. Finally, if $E_1$ and $E_2$ are both legs $L_i$ and $L_j$ respectively for some $1\leq i,j \leq r$, then we similarly show that \[ k_{\sigma_{\mathrm{out}}} N_{\sigma_{\mathrm{out}}}^\mathrm{trop} = \frac{|\gamma_{E_{\mathrm{out}}}|}{|\gamma_{E_1}||\gamma_{E_2}|} |\omega(\gamma_{E_1},\gamma_{E_2})| \] using that ${\mathcal{L}}_1=\gamma_{i}^{\perp}$, ${\mathcal{L}}_2=\gamma_j^{\perp}$, and so $|{\mathcal{L}}_1^\sat/{\mathcal{L}}_1|=1$ and $|{\mathcal{L}}_2^\sat/{\mathcal{L}}_2|=1$. \end{proof} \begin{remark} The tropical problem, the coefficient $k_\sigma$, and the tropical multiplicity $N_\sigma^\mathrm{trop}$ only depend on the vectors $\iota_{\gamma_i}\omega$ and on the hyperplanes $\gamma_i^\perp$. In particular, they are invariant under a common rescaling of $\gamma_i$ and $\omega$ of the form $\gamma_i \mapsto t \gamma_i$ and $\omega \mapsto t^{-1} \omega$. As a consistency check, one can verify directly that the right-hand side of \eqref{eq_product} in Lemma \ref{lem: product2 for Ntrop} is invariant under such rescaling: a trivalent tree with $r+1$ legs has $r-1$ vertices, and so the right-hand side of \eqref{eq_product} scales as $\frac{t(t^{-1} t^2)^{r-1}}{t^r}=1$. \end{remark} \subsection{Polyhedral decompositions and tropical multiplicities} \label{sec_polyh} Until now, we considered tropical curves in $M_\RR$. In this section, we introduce tropical curves in $M_\RR$ endowed with a polyhedral decomposition. The following definition can be found in \cite[Def 3.1]{NS}. \begin{definition} \label{polyhedral decomposition} A \emph{polyhedral decomposition} of $M_{\RR}$ is a covering $\mathsf{P}=\{\Xi\}$ of $M_{\RR}$ by a finite number of strongly convex polyhedra satisfying the following properties: \begin{enumerate} \item[(i)] If $\Xi \in \mathsf{P}$ and $\Xi' \subset \Xi$ is a face, then $\Xi' \in \mathsf{P}$. \item[(ii)] If $\Xi, \Xi' \in \mathsf{P}$, then $\Xi \cap \Xi'$ is a common face of $\Xi$ and $\Xi'$. \end{enumerate} \end{definition} For the remaining of this section, we fix a polyhedral decomposition $\scrP$ of $M_\RR$. \begin{definition} \label{def_tropical_curve_polyh} A \emph{parametrized tropical curve in $(M_\RR, \scrP)$} is a weighted graph $\Gamma$ together with a proper continuous map $h: \Gamma \rightarrow M_\RR$ satisfying the following conditions: \begin{itemize} \item[(i)] for every edge or leg $E$, the restriction $h|_E$ is an embedding with image contained in an affine line with rational slope, \item[(ii)] for every vertex $v\in V(\Gamma)$, the following \emph{balancing condition} holds: Let $E_1,\dots,E_m \in E(\Gamma)\cup L(\Gamma)$ be the edges or legs adjacent to $v$, and let $\bar{u}_i \in M$ be the primitive integral vector emanating from $h(v)$ in the direction of $h(E_i)$, then $\sum_{i=1}^m w(E_i)\bar{u}_i=0$. \item[(iii)] for every edge or leg $E$, there exists a cell of $\scrP$ containing $h(E)$, \item[(iv)] for every divalent vertex $v\in V(\Gamma)$, denoting by $\boldsymbol{\sigma}(v)$ the smallest cell of $\scrP$ containing $h(v)$, there exists an open subset of $\Gamma$ containing $v$ such that $h(U) \cap \boldsymbol{\sigma}(v)=\{h(v)\}$. \end{itemize} \end{definition} We define as in \S 1.1 a tropical curve in $(M_\RR,\scrP)$ as an isomorphism class of parametrized tropical curves in $(M_\RR,\scrP)$. Compared with tropical curves in $M_ \RR$ of Definition \ref{def_tropical_curve}, tropical curves in $(M_\RR,\scrP)$ are required to be compatible with the polyhedral decomposition $\scrP$ in the sense of Definition \ref{def_tropical_curve_polyh}(iii), and can have divalent vertices, which are required to satisfy Definition \ref{def_tropical_curve_polyh}(iv). \begin{definition} A \emph{tropical type} for $(M_\RR,\scrP)$ is the data $(\Gamma,\bar{u}, \boldsymbol{\sigma})$ of a weighted graph $\Gamma$, a map $\bar{u} : F(\Gamma) \longrightarrow M$ as in Definition \ref{def_tropical_type}, and a map $\boldsymbol{\sigma} \rightarrow \scrP$ assigning a cell of $\scrP$ to every vertex, edge or leg of $\Gamma$. \end{definition} \begin{definition}\label{def_type_polyh} The type of a tropical curve $h \colon \Gamma \rightarrow M_\RR$ in $(M_\RR,\scrP)$ is the tropical type $(\Gamma, \bar{u},\boldsymbol{\sigma})$ where for every $(v,E)\in F(\Gamma)$, $\bar{u}_{v,E}$ is the primitive integral in $M$ emanating from $h(v)$ in the direction of $h(E)$, and for every vertex, edge or leg $x$ of $\Gamma$, $\boldsymbol{\sigma}(x)$ is the smallest cell of $\scrP$ containing $x$. \end{definition} One defines as in \S\ref{sec_marked_tropical_curves}-\ref{sec_tropical_constraints} the notion of $(\omega,\boldsymbol{\gamma})$-tropical curves in $(M_\RR,\scrP)$, the notion of $(\omega,\boldsymbol{\gamma})$-tropical curves in $(M_\RR,\scrP)$ matching a $\boldsymbol{\gamma}$-constraint $\mathbf{A}$, and the moduli space ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}(\scrP)$ the moduli space of $(\omega,\boldsymbol{\gamma})$-tropical curves in $(M_\RR,\scrP)$ matching $\mathbf{A}$. As the moduli space ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}$ of tropical curves in $M_\RR$, the moduli space ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$ is a polyhedral complex: the relative interior $\Int(\sigma)$ of a face $\sigma \in {\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$ parametrizes $(\omega,\boldsymbol{\gamma})$-tropical curves $h \colon \Gamma_\sigma \rightarrow M_\RR$ in $(M_\RR,\scrP)$ matching $\mathbf{A}$ and of a given type for $(M_\RR,\scrP)$. In fact, there is a natural homeomorphism ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP) \simeq {\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}$ realizing ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$ as a polyhedral refinement of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}$: every face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}$ is a union of faces ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$. Indeed, given a tropical curve in $(M_\RR,\scrP)$, we obtain a tropical curve in $M_\RR$ by ``erasing" the divalent vertices, and conversely, given a tropical curve in $M_\RR$ there is a unique minimal way to add divalent vertices so that Definition \ref{def_tropical_curve_polyh}(iii) is satisfied and we obtain a tropical curve in $(M_\RR,\scrP)$. However, the identification ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP) \simeq {\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}$ does not preserve the integral structures in general: if $\tilde{\sigma}$ is a face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$ contained in a face $\sigma$ of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}$ of the same dimension, then there is a natural lattice embedding of integral tangent spaces $T_{\tilde{\sigma}} \subset T_\sigma$ which can have a non-trivial finite cokernel. The issue is that when adding a divalent vertex on a edge in a family of tropical curves, the lengths of the newly created edges are affine functions on the base of the family which might not be integral with respect to the original integral structure on the base: one needs in general to coarsen the integral structure on the base to make all length functions integral affine. In the general context of tropicalizations of stable log maps, this phenomenon is discussed in \cite[\S 4]{johnston2022birational}. When $\mathbf{A}$ is a general $\boldsymbol{\gamma}$-constraint, $\sigma$ is a $(d-2)$-dimensional face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$ such that $\dim \fod_{L_{\mathrm{out}}}^\sigma =d-1$, and $\tilde\sigma$ is a $(d-2)$-dimensional face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}(\scrP)$ contained in $\sigma$, we give below an explicit description of the difference between $T_{\Tilde{\sigma}}$ and $T_\sigma$. Recall from \eqref{Eq:jv}-\eqref{Eq:Ev} that we defined for every vertex $v \in V(\Gamma_\sigma)$ the locus $\foj_v^\sigma$ as the closure in $M_\RR$ of the locus of $h(v)$ for $h\in \Int(\sigma)$, and for every edge or leg $E$ of $\Gamma_\sigma$ the locus $\fod_E^\sigma$ as the closure in $M_\RR$ of the locus of $h(v)$ for $h\in \Int(\sigma)$. We define similarly $\foj_v^{\tilde{\sigma}}$ and $\fod_E^{\tilde{\sigma}}$ for every vertex $v$ and edge or leg $E$ of $\Gamma_{\tilde{\sigma}}$. To simplify the notations, we set $T_v$ for the integral tangent space to $\foj_v^\sigma$ or $\foj_v^{\tilde{\sigma}}$ depending if $v \in V(\Gamma_\sigma)$ or $v\in V(\Gamma_{\tilde{\sigma}})$, and $T_E$ for the integral tangent space to $\fod_E^{\sigma}$ or $\fod_E^{\tilde{\sigma}}$ depending if $E \in E(\Gamma_\sigma)\cup L(\Gamma_\sigma)$ or $E\in E(\Gamma_{\tilde{\sigma}})\cup V(\Gamma_{\tilde{\sigma}})$. To compare $T_{\Tilde{\sigma}}$ and $T_\sigma$, we first give an alternative description of $T_\sigma$. Consider the map \begin{equation} \label{Eq:Psi} \Psi_{\sigma}:\prod_{v\in V(\Gamma_\sigma)} T_v\times \prod_{E\in E(\Gamma_\sigma)} \mathbb{Z} \rightarrow \prod_{E\in E(\Gamma_\sigma)} T_E, \end{equation} given by \[ \Psi_\sigma \big((m_v)_v,(\ell_E)_E\big)=(m_{\partial^+ E}-m_{\partial^- E}+\ell_E u_E)_E \] Then $T_{\sigma}=\ker\Psi_\sigma$. Recall that we also had $T_\sigma=\ker \mathrm{gl}_\sigma$, with the gluing map $\mathrm{gl}_\sigma$ defined by \eqref{eq_gl}, and that we defined the tropical multiplicity $N_\sigma^\mathrm{trop}=|\coker \mathrm{gl}_\sigma|$ in Definition \ref{def_trop_mult}. However, $N_\sigma^\mathrm{trop}$ is in general distinct from $|\coker\Psi_\sigma|$. Rather, using the notations introduced in \S\ref{subsec: product formula}, we have the following lemma: \begin{lemma} \label{lem:coker psi} Let $\mathbf{A}$ be a general $\boldsymbol{\gamma}$-constraint, and $\sigma$ a $(d-2)$-dimensional face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$ such that $\dim \fod_{L_{\mathrm{out}}}^\sigma =d-1$. Then, we have \[|\coker\Psi_\sigma|=\prod_{v\in V(\Gamma_\sigma)} |({\mathcal{L}}_{1,v}^{\sat}+{\mathcal{L}}_{2,v}^{\sat})/ ({\mathcal{L}}_{1,v}+{\mathcal{L}}_{2,v})|\,.\] \end{lemma} \begin{proof} We prove by induction, following the flow on $\Gamma_\sigma$ starting at the leaves and ending at the root, that for every vertex $v \in V(\Gamma_\sigma)$, we have \[ |\coker \Psi_{\sigma_{\mathrm{out},v}}| =\prod_{v' \in V(\Gamma_{\sigma_{\mathrm{out}},v})} |({\mathcal{L}}_{1,v'}^{\sat}+{\mathcal{L}}_{2,v'}^{\sat})/ ({\mathcal{L}}_{1,v'}+{\mathcal{L}}_{2,v'})| \,.\] Given a vertex $v \in V(\Gamma_\sigma)$, we use the same simplified notations $\mathrm{E}_1$, $E_2$, $E_{\mathrm{out}}$, ${\mathcal{L}}_1$, ${\mathcal{L}}_2$, ${\mathcal{L}}_{\mathrm{out}}$, and so on, as in the proof of Lemmas \ref{lem: product for Ntrop} and \ref{lem: product2 for Ntrop}. If $E_1$ and $E_2$ are both edges, we have to show that \begin{equation} \label{eq_coker_1} |\coker \Psi_{\sigma_{\mathrm{out}}}| = |({\mathcal{L}}_{1}^{\sat}+{\mathcal{L}}_{2}^{\sat})/ ({\mathcal{L}}_{1}+{\mathcal{L}}_{2})| |\coker \Psi_{\sigma_1}||\coker \Psi_{\sigma_2}|\,. \end{equation} For $k=1$ and $k=2$, denote \[ M_k=\prod_{v \in V(\Gamma_{\sigma_k})}T_v \times \prod_{E\in E(\Gamma_{\sigma_k})} \mathbb{Z},\quad\quad K_k=\prod_{E\in E(\Gamma_{\sigma_k})} T_E, \] and consider the commutative diagram of exact sequences \[ \xymatrix@C=30pt { 0\ar[r]&T_v\times\mathbb{Z}^2\ar[d]_{\theta}\ar[r]& M_1\times M_2\times T_v\times \mathbb{Z}^2\ar[r]\ar[d]_{{\Psi}_{\sigma_{\mathrm{out}}}}&M_1\times M_2\ar[d]_{\Psi_{\sigma_1} \times \Psi_{\sigma_2}}\ar[r]&0\\ 0\ar[r]&T_{E_1}\times T_{E_2}\ar[r]& K_1\times K_2\times T_{E_1}\times T_{E_2}\ar[r]& K_1\times K_2\ar[r]&0\,, } \] where the map $\theta$ is given by \[ \theta(m,\ell_1,\ell_2)=(\ell_1 u_{E_1}-m,\ell_2 u_{E_2}-m). \] As $\ker \Psi_{\sigma_{\mathrm{out}}}= T_{\sigma_{\mathrm{out}}}$ and $\ker \Psi_{\sigma_k}=T_{\sigma_k}$, we obtain by the snake lemma a long exact sequence \[ T_{\sigma_{\mathrm{out}}} \rightarrow T_{\sigma_1}\times T_{\sigma_2}\xrightarrow{\xi} \coker\theta\rightarrow \coker{\Psi}_{\sigma_{\mathrm{out}}}\rightarrow \coker{\Psi}_{\sigma_1}\times \coker{\Psi}_{\sigma_2}\rightarrow 0. \] As $T_v=T_{E_1}\cap T_{E_2}$, the cokernel of the map $T_v\rightarrow T_{E_1}\times T_{E_2}$ given by $m\mapsto (-m,-m)$ can be identified with $T_{E_1}+T_{E_2}\subseteq M$, and so \[ \coker\theta=(T_{E_1}+T_{E_2})/(\mathbb{Z} u_{E_1}+\mathbb{Z} u_{E_2}) =({\mathcal{L}}_1^{\sat}+{\mathcal{L}}_2^{\sat})/(\mathbb{Z} u_{E_1}+\mathbb{Z} u_{E_2})\,. \] On the other hand, the connecting map $\xi:T_{\sigma_1}\times T_{\sigma_2}\rightarrow \coker\theta$ is given by $\xi(t_1,t_2)=(p_1(t_1), p_2(t_2))$, and so \[ \coker\xi= ({\mathcal{L}}_1^{\sat}+{\mathcal{L}}_2^{\sat})/({\mathcal{L}}_1+{\mathcal{L}}_2)\,, \] because ${\mathcal{L}}_k=p_k(T_{\sigma_k})+\mathbb{Z} u_{E_k}$ by definition. This conclude the proof of \eqref{eq_coker_1}. Consider now the case when one of $E_1$ or $E_2$ is an edge and the other is a leg. By symmetry, one can assume that $E_1$ is an edge, with adjacent vertex $v_1$ in $\Gamma_{\sigma_1}$, and $E_2$ is a leg $L_i$ for some $1\leq i\leq r$. We have to show that \begin{equation} \label{eq_coker_2} |\coker \Psi_{\sigma_{\mathrm{out}}}| = |({\mathcal{L}}_{1}^{\sat}+{\mathcal{L}}_{2}^{\sat})/ ({\mathcal{L}}_{1}+{\mathcal{L}}_{2})| |\coker \Psi_{\sigma_1}|\,. \end{equation} In this case, we consider the commutative diagram of exact sequences \[ \xymatrix@C=30pt { 0\ar[r]&T_v\times\mathbb{Z}\ar[d]_{\theta}\ar[r]& M_1\times T_v\times \mathbb{Z}\ar[r]\ar[d]_{{\Psi}_{\sigma_{\mathrm{out}}}}&M_1\ar[d]_{\Psi_{\sigma_1}}\ar[r]&0\\ 0\ar[r]&T_{E_1}\ar[r]& K_1\times T_{E_1} \ar[r]& K_1\ar[r]&0\,, } \] where the map $\theta$ is given by \[ \theta(m,\ell)=(\ell u_{E_1}-m). \] As $\ker \Psi_{\sigma_{\mathrm{out}}}= T_{\sigma_{\mathrm{out}}}$ and $\ker \Psi_{\sigma_1}=T_{\sigma_1}$, we obtain by the snake lemma a long exact sequence \[ T_{\sigma_{\mathrm{out}}} \rightarrow T_{\sigma_1}\xrightarrow{\xi} \coker\theta\rightarrow \coker{\Psi}_{\sigma_{\mathrm{out}}}\rightarrow \coker{\Psi}_{\sigma_1}\rightarrow 0. \] As $T_v=T_{E_1} \cap \gamma_i^{\perp}$ and ${\mathcal{L}}_2={\mathcal{L}}_2^{\sat}=\gamma_i^{\perp}$, we have $\coker\theta=T_{E_1}/(T_v+\mathbb{Z} u_{E_1}) ={\mathcal{L}}_1^\sat/({\mathcal{L}}_1^\sat \cap {\mathcal{L}}_2^\sat +\mathbb{Z} u_{E_1})$. On the other hand, the connecting map $\xi:T_{\sigma_1}\rightarrow \coker\theta$ is given by $\xi(t)=p_1$, and so \[ \coker\xi= {\mathcal{L}}_1^{\sat}/({\mathcal{L}}_1+{\mathcal{L}}_1^\sat \cap {\mathcal{L}}_2^\sat)\,, \] which is equal to $({\mathcal{L}}_1^\sat +{\mathcal{L}}_2^\sat)/({\mathcal{L}}_1+{\mathcal{L}}_2)$ because ${\mathcal{L}}_2={\mathcal{L}}_2^\sat$. This concludes the proof of \eqref{eq_coker_2}. Finally, if both $E_1$ and $E_2$ are legs $L_i$ and $L_j$, then $\Psi_{\sigma_{\mathrm{out}}}$ is the zero map $T_v \rightarrow 0$, so $\coker \Psi_{\sigma_{\mathrm{out}}}=0$. Moreover, ${\mathcal{L}}_1={\mathcal{L}}_1^\sat=\gamma_i^\perp$ and ${\mathcal{L}}_2={\mathcal{L}}_2^\perp=\gamma_j^\perp$, and so $({\mathcal{L}}_1^\sat +{\mathcal{L}}_2^\sat)/({\mathcal{L}}_1+{\mathcal{L}}_2)=0$. In particular, we have $\coker \Psi_{\sigma_{\mathrm{out}}}=({\mathcal{L}}_1^\sat +{\mathcal{L}}_2^\sat)/({\mathcal{L}}_1+{\mathcal{L}}_2)$ and this ends the proof of Lemma \ref{lem:coker psi}. \end{proof} Similarly, the integral tangent space $T_{\tilde\sigma}$ can be viewed as the kernel of the map \begin{equation} \label{Eq: WidetildePsi} \Psi_{\tilde\sigma}: \prod_{v\in V(\Gamma_{\tilde\sigma})} T_v\times \prod_{E\in E(\Gamma_{\tilde\sigma})} \mathbb{Z}\rightarrow \prod_{E\in E(\Gamma_{\tilde\sigma})} T_E \end{equation} with $\Psi_{\tilde\sigma}$ defined analogously as $\Psi_\sigma$ in \eqref{Eq:Psi}. The comparison we need between $T_\sigma$ and $T_{\tilde\sigma}$ is provided by the following lemma. We denote by $B$ the set of divalent vertices of $\Gamma_{\tilde\sigma}$ and for every $v \in B$, we denote $w_v := |\overline{u}_E|$, where $E$ is an edge adjacent to $v$ and $\overline{u}_E$ is the image of $u_E$ in the rank two lattice $M/T_v$. The definition of $w_v$ is independent of the choice of $E$ by the balancing condition at $v$. \begin{lemma} \label{lem:two gammas compare} Let $\mathbf{A}$ be a general $\boldsymbol{\gamma}$-constraint, $\sigma$ a $(d-2)$-dimensional face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$ such that $\dim \fod_{L_{\mathrm{out}}}^\sigma =d-1$, and $\tilde\sigma$ a $(d-2)$-dimensional face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}(\scrP)$ contained in $\sigma$, Then, there is a long exact sequence \begin{equation}\label{eq_les} 0\rightarrow T_{\tilde\sigma}\rightarrow T_{\sigma} \rightarrow \prod_{v\in B} \mathbb{Z}/w_v\mathbb{Z}\rightarrow \coker\Psi_{\tilde\sigma} \rightarrow \coker\Psi_\sigma\rightarrow 0 \,. \end{equation} \end{lemma} \begin{proof} We first introduce some notation. For every divalent vertex $v\in V(\Gamma_{\tilde\sigma})$, we denote by $E_1(v)$ and $E_2(v)$ the two edges of $\Gamma_{\tilde\sigma}$ with vertex $v$, with $E_1(v)$ oriented towards $v$ and $E_2(v)$ oriented away from $v$. We consider the map \[ \delta: \prod_{v\in B} T_v\times\prod_{v\in B}\mathbb{Z} \longrightarrow \prod_{v\in V(\Gamma_{\tilde\sigma})}T_v\times\prod_{E\in E(\Gamma_{\tilde\sigma})} \mathbb{Z}\] which is the obvious inclusion on $\prod_{v\in B}T_v\rightarrow \prod_{v\in V(\Gamma_{\tilde\sigma})} T_v$, and such that $\delta\big((m_v),(\ell_v)\big)$ has component indexed by $E_1(v)$ given by $\ell_v$ and component indexed by $E_2(v)$ given by $-\ell_v$. We also define a map \[ \delta': \prod_{v\in B} T_{E_1(v)} \longrightarrow \prod_{E\in E(\Gamma_{\tilde\sigma})} T_E \] by $\delta'((m_v)_{v\in B})=(n_E)_{E\in V(\Gamma_{\tilde\sigma})}$ with \[ n_E:=\begin{cases} m_v&E=E_1(v)\\ -m_v& E= E_2(v)\\ 0 & \text{else}\,. \end{cases} \] Finally, we define \begin{align} \pi : \prod_{v\in V(\Gamma_{\tilde\sigma})}T_v\times\prod_{E\in E(\Gamma_{\tilde\sigma})} \mathbb{Z} &\longrightarrow \prod_{v\in V(\Gamma_{\sigma})}T_v\times\prod_{E\in E(\Gamma_{\sigma})}\mathbb{Z} \\ \big((n_v)_{v\in V(\Gamma_{\tilde\sigma})},(\ell_E)_{E\in E(\Gamma_{\tilde\sigma})}\big) & \longmapsto \big((n_v)_{v\in V(\Gamma_\sigma)},(\sum_{\substack{E'\subset E\\ E'\in E(\Gamma_{\tilde\sigma})}} \ell_{E'})_{E \in E(\Gamma_\sigma)}\big). \end{align} and \begin{align} \pi' : \prod_{E\in E(\Gamma_{\tilde\sigma})}T_E &\longrightarrow \prod_{E\in E(\Gamma_{\sigma})}T_E \\ (n_E)_{E\in E(\Gamma_{\tilde\sigma})} & \longmapsto (\sum_{\substack{E'\subset E\\ E'\in E(\Gamma_{\tilde\sigma})}} n_{E'})_{E \in E(\Gamma_\sigma)}\,, \end{align} where we view $\Gamma_{\tilde\sigma}$ as a refinement of $\Gamma_\sigma$, so each edge of $\Gamma_{\tilde\sigma}$ is contained in some edge of $\Gamma_{\sigma}$. These maps fit into a commutative diagram of exact sequences \[ \xymatrix@C=20pt { 0\ar[r]&\prod_{v\in B} T_v\times\prod_{v\in B}\mathbb{Z} \ar[r]^{\delta}\ar[d]_{\Psi'}& \prod_{v\in V(\Gamma_{\tilde\sigma})}T_v\times\prod_{E\in E(\Gamma_{\tilde\sigma})} \mathbb{Z} \ar[r]^{\pi}\ar[d]_{\Psi_{\tilde\sigma}}& \prod_{v\in V(\Gamma_{\sigma})}T_v\times\prod_{E\in E(\Gamma_\sigma)}\mathbb{Z}\ar[d]^{\Psi_\sigma}\ar[r]&0\\ 0\ar[r]&\prod_{v\in B} T_{E_1(v)}\ar[r]_{\delta'}& \prod_{E\in E(\Gamma_{\tilde\sigma})} T_E\ar[r]_{\pi'}& \prod_{E\in E(\Gamma_{\sigma})}T_E\ar[r]&0 } \] where $\Psi'$ is defined by $\Psi'\big((m_v),(\ell_v)\big)=(\ell_v u_{E_1(v)}-m_v)$. The map $\Psi'$ is injective and the cokernel of $T_v\times\mathbb{Z}\rightarrow T_{E_1(v)}$, $(m,\ell)\mapsto -m+\ell u_{E_1(v)}$, is just $\mathbb{Z}/w_v\mathbb{Z}$, so the snake lemma gives the desired long exact sequence \eqref{eq_les}. \end{proof} \section{Counts of $(\omega,\boldsymbol{\gamma})$-marked stable log maps in toric varieties} \label{sec_log_gw} In this section, after briefly reviewing in \S\ref{sec_log_trop_review}-\ref{subsubsec:stable punctured} the theory of stable log maps, we define in \S\ref{subsec: The moduli space of mw log maps}-\ref{sec_log_gw_invts} a particular class of genus $0$ log Gromov--Witten invariants of toric varieties. \subsection{Log schemes and their tropicalizations} \label{sec_log_trop_review} We assume basic familiarity with log geometry throughout this section \cite{Kk, Ogus}. We nonetheless roughly review definitions to establish notation. A \emph{log structure} on a scheme $X$ is a sheaf of commutative monoids $\shM_X$ together with a homomorphism of sheaves of multiplicative monoids $\alpha_X : \shM_X \to \O_X$ inducing an isomorphism $\alpha_X^{-1}(\O_X^{\times})\rightarrow \O_X^{\times}$, allowing us to identify $\O_X^{\times}$ as a subsheaf of $\shM_X$. The standard notation we use for a log scheme is $X:=(\ul{X},\shM_X,\alpha_X)$, where by $\ul X$ we denote the underlying scheme. By abuse of notation we also denote the underlying scheme just by $X$ when it is clear from the context. Throughout this paper, we assume that all log schemes are fine and saturated (fs) \cite[I,\S1.3]{Ogus}. A \emph{morphism of log schemes} $f:X \rightarrow Y$ consists of an ordinary morphism $\ul{f}:\ul{X}\rightarrow \ul{Y}$ of schemes along with a map $f^{\flat}:f^{-1}\shM_Y\rightarrow \shM_X$ which is compatible with $f^\#:f^{-1}\O_Y\rightarrow \O_X$ via the structure homomorphisms $\alpha_X$ and $\alpha_Y$. The \emph{ghost sheaf}, defined by $\overline{\shM}_{X}:=\shM_X/\O_X^{\times}$, captures the key combinatorial information about the log structure. In particular, it leads to the description of the \emph{tropicalization} $\Sigma(X)$ of a log scheme $X$, as an abstract polyhedral cone complex, see \cite[\S2.1]{ACGSI} for details. Briefly, $\Sigma(X)$ is a collection of cones along with face maps between them. There is one cone $\sigma_{\bar x}:= \Hom(\overline{\shM}_{X,\bar x},\RR_{\ge 0})$ for every geometric point $\bar x\rightarrow X$, and if $\bar x$ specializes to $\bar y$, there is a generization map $\overline\shM_{X,\bar y}\rightarrow \overline\shM_{X,\bar x}$ which leads dually to a map $\sigma_{\bar x}\rightarrow\sigma_{\bar y}$. The condition of being fine and saturated implies this is an inclusion of faces. Note that each cone $\sigma_{\bar x}\in \Sigma(X)$ comes with a tangent space of integral tangent vectors $$\Lambda_{\sigma_{\bar x}}:=\Hom(\overline\shM_{X,\bar x},\mathbb{Z})$$ and a set of integral points \[ \sigma_{\bar x,\mathbb{Z}}:=\Hom(\overline\shM_{X,\bar x},\NN). \] Tropicalization is functorial, with $f:X\rightarrow Y$ inducing $f_{\mathrm{trop}}:\Sigma(X)\rightarrow\Sigma(Y)$, with a map of cones $\sigma_{\bar x}\rightarrow\sigma_{f(\bar x)}$ induced by $\bar f^{\flat}:\overline\shM_{Y,f(\bar x)}\rightarrow \overline\shM_{X,x}$. In cases we consider in this paper, after identifying $\sigma_{\bar x}$ and $\sigma_{\bar y}$ whenever $\sigma_{\bar x}\rightarrow\sigma_{\bar y}$ is an isomorphism, we obtain an ordinary polyhedral cone complex. \begin{example} \label{Ex: divisorial} Let $X$ be a toric variety associated to a fan $\Sigma$ in $M_\RR$. There is a canonical \emph{divisorial log structure} $\M_X=\M_{(X,D)}$, where $D\subset X$ is the toric boundary divisor \cite[ex. 3.8]{Mark}. Furthermore, the tropicalization $\Sigma(X_\Sigma)$ is naturally identified with $M_\RR$ endowed with the fan $\Sigma$. \end{example} \begin{example} \label{Ex: log point} Let $X$ be a log point, that is, a log scheme whose underlying scheme is a point $\underline{X}=\Spec \kk$ for some field $\kk$. Then, there exists a monoid $Q$ with $Q^\times=\{0\}$, such that $\mathcal{M}_X=Q \oplus \kk^\star$ and $\alpha_X$ is the map \[ Q\oplus\kk^\times\lra \kk,\quad (q,a)\longmapsto \begin{cases} a,&q=0\\ 0,&q\neq0\,.\end{cases} \] One recovers $Q$ as the ghost sheaf of $X$, that is, $\overline{\mathcal{M}}_X=Q$, and the tropicalization $\Sigma(X)$ of $X$ is the cone $Q^\vee_\RR:=\Hom(Q,\RR_{\geq 0})$. \end{example} \subsection{Stable log maps} \label{subsubsec:stable punctured} Following \cite{logGW,logGWbyAC}, a \emph{prestable log map} with target $(X,\mathcal{M}_X) \rightarrow (S,\mathcal{M}_S)$ is a commutative diagram in the category of log schemes \begin{equation} \label{eq__log_map} \xymatrix@C=30pt { C\ar[r]^f\ar[d]_{\pi} & X\ar[d]\\ W\ar[r]&S } \end{equation} where $W=(W,\mathcal{M}_W)$ is a log point\footnote{For families of stable log maps, $W$ can be an arbitrary scheme.}, $\pi$ is a log smooth family of curves, which is required to be an integral morphism all of whose geometric fibers are reduced curves. In this situation, one can describe locally the log structure on the log curve $C$ \cite{katoF}. In particular, $C/W$ comes with a set of disjoint sections $p_1,\ldots,p_n:\ul{W}\rightarrow \ul{C}$, referred to as the \emph{marked points}, disjoint from the nodal locus of $C$, and such that way from the nodal locus, \[\overline{\shM}_C=\pi^*\overline{\shM}_W \oplus\bigoplus_{i=1}^n p_{i*}\ul{\NN}\,.\] A \emph{stable log map} is a prestable log map whose underlying prestable marked map is a stable map. If $p\in C$ is a marked point, we have \[ \bar f^{\flat}:P_p:=\overline{\shM}_{X,f(p)}\longrightarrow \overline{\shM}_{C,p}=\overline{\shM}_{W,\pi(p)}\oplus\NN \stackrel{\pr_2}{\longrightarrow}\NN, \] which can be viewed as an element $u_p\in P_p^{\vee}:=\Hom(P_p,\NN) \subseteq \sigma_{f(p)}$, called the \emph{contact order at $p$}. Similarly, if $x=q$ is a node, there exists a homomorphism \begin{equation} \label{eq:node contact order} u_q:P_q :=\overline{\shM}_{X,f(q)} \lra \mathbb{Z}, \end{equation} called \emph{contact order at $q$}, see \cite[(1.8)]{logGW} or \cite[\S2.3.4]{ACGSI}. In the case the target space is $(X,D)$, the contact order records tangency information with the irreducible components of $D$. A key point in log Gromov-Witten theory is the tropical interpretation of stable log maps. Let $f:C \to X$ be a stable log map as in \eqref{eq__log_map}, where $W$ is the log point $(\Spec \kk, \kk^\star \oplus Q)$, as in Example \ref{Ex: log point}. Then by functoriality of tropicalization, we obtain a diagram \begin{equation} \label{eq:tropical diagram} \xymatrix@C=45pt { \Gamma:=\Sigma(C)\ar[r]^>>>>>>{h=f_{\mathrm{trop}}}\ar[d]_{\pi_{\mathrm{trop}}} & \Sigma(X)\ar[d]\\ \Sigma(W)\ar[r]& \Sigma(S) } \end{equation} Here $\Sigma(W)=\Hom(Q,\RR_{\ge 0})=Q^{\vee}_{\RR}$ is a rational polyhedral cone, and for $q\in \Int(Q^{\vee}_{\RR})$, $\pi_{\mathrm{trop}}^{-1}(q)$ can be identified with the dual graph $G$ of the curve $C$, which is the graph with vertices corresponding to an irreducible components of $C$, edges corresponding to nodes of $C$, and legs corresponding to marked points. The map $h: \Sigma(C) \to \Sigma(X)$ defines a family of tropical maps to $\Sigma(X)$ as defined in \cite[Def.\ 2.21]{ACGSI}. For $s\in \Int(Q^{\vee}_{\RR})$, write \[ h_s:G\rightarrow\Sigma(X) \] for the restriction of $h$ to $G=\pi_{\mathrm{trop}}^{-1}(s)$. Associated to any family of tropical maps to $\Sigma(X)$ is the type, recording which cones of $\Sigma(X)$ vertices, edges and legs of $G$ are mapped to, and tangent vectors to the images of edges and legs: \begin{definition} \label{Def: type of the tropical curve} A \emph{type} of tropical map to $\Sigma(X)$ is data of a triple $\tau=(G,\boldsymbol{\sigma}, \mathbf{u})$ where $G$ is a graph, $\boldsymbol{\sigma}$ is a map \[ \boldsymbol{\sigma}:V(G)\cup E(G)\cup L(G)\rightarrow\Sigma(X) \] with the property that if $v$ is a vertex of an edge or leg $E$, then $\boldsymbol{\sigma}(v)\subseteq \boldsymbol{\sigma}(E)$. Next, $\mathbf{u}$ associates to each oriented edge $E\in E(G)$ a tangent vector $\mathbf{u}(E)\in \Lambda_{\boldsymbol{\sigma}(E)}$ and to each leg $L\in L(G)$ a tangent vector $\mathbf{u}(L)\in \Lambda_{\boldsymbol{\sigma}(L)}$. \end{definition} Associated to a type is a moduli space of tropical maps of the given type, and this dually defines a monoid called the \emph{basic monoid}: \begin{definition} \label{def:basic monoid} Given a type $\tau=(G,\boldsymbol{\sigma}, \mathbf{u})$, we define the \emph{basic monoid} $Q_{\tau}=\Hom(Q_{\tau}^{\vee},\NN)$ of $\tau$ by defining its dual: \begin{equation} \label{eq:basic dual} Q^{\vee}_{\tau}:=\big\{\big((p_v)_{v\in V(G)},(\ell_E)_{E\in E(G)}\big)\,|\, \hbox{$p_{v'}-p_{v}=\ell_E \mathbf{u}(E)$ for all $E\in E(G)$}\big\}, \end{equation} a submonoid of \[ \prod_{v\in V(G)} \boldsymbol{\sigma}(v)_\mathbb{Z} \times \prod_{E\in E(G)}\NN. \] Here $\boldsymbol{\sigma}(v)_{\mathbb{Z}}$ denotes the set of integral points of the cone $\boldsymbol{\sigma}(v)$, and $v'$, $v$ are taken to be the endpoints of $E$ consistent with the chosen orientation of the edge. \end{definition} Given a stable log map $f \colon C/W \rightarrow X/S$, there is a canonical map $Q_\tau \rightarrow \overline{M}_W$, where $Q_\tau$ is the basic monoid defined by the combinatorial type of $f$ \cite{logGW,logGWbyAC}. A stable log map $f \colon C/W \rightarrow X/S$ is said to be \emph{basic} if the natural map of monoids $Q_\tau \rightarrow \overline{\mathcal{M}}_W$ is an isomorphism. When $X \rightarrow S$ is log smooth and proper, \cite{logGWbyAC,logGW} shows that the moduli space of basic stable log maps with given genus, number of marked points, and degree, is a Deligne-Mumford stack, proper over $S$, and carrying a natural virtual fundamental class which can be used to define log Gromov--Witten invariants. From now on, we use stable log maps to mean basic stable log maps. \subsection{Moduli spaces of $(\omega,\boldsymbol{\gamma})$-marked stable log maps} \label{subsec: The moduli space of mw log maps} Let $(\omega, \boldsymbol\gamma)$ be as in \S\ref{sec_marked_tropical_curves}: $\omega \in \bigwedge^2 M$ is a skew-symmetric form on $N$, and $\boldsymbol{\gamma}=(\gamma_1,\dots,\gamma_r)$ is a $r$-tuple of elements $\gamma_i \in N$ such that $\iota_{\gamma_i} \omega \neq 0$ for all $1\leq i \leq r$ and $\iota_\gamma \omega \neq 0$, where $\gamma:=\sum_{i=1}^r \gamma_i$. \begin{definition}\label{def_gamma_fan} A \emph{$\boldsymbol{\gamma}$-fan} is a fan $\Sigma$ in $M_\RR$ of a $d$-dimensional smooth projective variety $X_\Sigma$ over $\mathbb{C}$ such that: \begin{itemize} \item[(i)] for every $1\leq i\leq r$, $\RR_{\geq 0}\iota_{\gamma_i}\omega$ is a ray of $\Sigma$, \item[(ii)] for every $1 \leq i \leq r$, the hyperplane $(\gamma_i^{\perp})_\RR$ is a union of $(d-1)$-dimensional cones of $\Sigma$. \end{itemize} Given a $\boldsymbol{\gamma}$-fan $\Sigma$, for every $1\leq i\leq r$, we denote by $D_i$ the toric divisor of $X_\Sigma$ corresponding to the ray $\RR_{\geq 0}\iota_{\gamma_i}\omega$. \end{definition} In what follows we focus attention on particular stable log maps, referred to as $(\omega,\boldsymbol{\gamma})$-marked stable log maps, defined as follows. \begin{definition} \label{def_stable_log} Let $\Sigma$ be a $\boldsymbol{\gamma}$-fan. An $(\omega,\boldsymbol{\gamma})$-marked stable log map to $X_\Sigma$ is a genus $0$ stable log map $f \colon C \rightarrow X_\Sigma$ endowed with a bijection between its set of marked points and \[ \{ x_i\,|\, 1\leq i\leq r \} \cup \{ x_{\mathrm{out}}\}\,,\] and such that $u_{x_{i}}=\iota_{\gamma_i}\omega$ for all $1\leq i \leq r$, and $u_{x_{\mathrm{out}}}=-\iota_{\gamma}\omega$. \end{definition} Let $\Sigma$ be a $\boldsymbol{\gamma}$-fan. We denote by ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^{\mathrm{log}}(X_\Sigma)$ the moduli space of $(\omega,\boldsymbol{\gamma})$-marked stable log maps to $X_\Sigma$. This moduli space is a proper Deligne-Mumford log stack \cite{logGW}. By \cite[Proposition 3.3.1]{ran2017toric}, ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^{\mathrm{log}}(X_\Sigma)$ is log smooth of the expected dimension $d-3+(l+1)=d-2+l$. Moreover, ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^{\mathrm{log}}(X_\Sigma)$ is also irreducible by \cite[Proposition 3.3.5]{ran2017toric}. It follows from Definition \ref{def_gamma_fan} that, for every $1\leq i\leq r$, the projection \[M_\RR/\RR \iota_{\gamma_i}\omega \longrightarrow M_\RR/(\gamma_i^{\perp})_\RR \simeq \RR \] is a morphism of fans from the fan $\Sigma(D_i)$ of $D_i$ in $M_\RR/\RR \iota_{\gamma_i} \omega$ to the fan $\Sigma(\mathbb{P}^1)$ of $\mathbb{P}^1$ in $M_\RR/(\gamma_i^{\perp})_\RR \simeq \RR$ (consisting of the cones $\RR_{\leq 0}$, $\{0\}$, $\RR_{\geq 0}$). Hence, there exists a corresponding toric morphism \[ \pi_i : D_i \rightarrow \mathbb{P}^1\,,\] which in restriction to the dense torus orbit of $D_i$ is simply the monomial $z^{\frac{\gamma_i}{|\gamma_i|}}$. For every point $[\mathbf{H}]=([H_1],\dots,[H_r]) \in (\mathbb{P}^1)^r$, we denote $\mathbf{H}:=(H_1,\dots, H_r)$, where, for every $1\leq i \leq r$, $H_i$ is the hypersurface in $D_i$ given by the fiber of $\pi_i$ over $[H_i]\in \mathbb{P}^1$, that is, $H_i:=\pi_i^{-1}([H_i])$. For $[H_i]=c_i \in \kk^{\star} \subset \mathbb{P}^1$, $H_i$ is the closure in $D_i$ of the hypersurface $-c_i+z^{\frac{\gamma_i}{|\gamma_i|}}=0$ in $(\kk^{\star})^{d-1} \subset D_i$. For every $1 \leq i \leq r$, we have a (scheme) evaluation morphism at the marked point $x_i$: \begin{align*}\underline{\mathrm {ev}}_{i} \colon {\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^{\mathrm{log}}(X_\Sigma) &\longrightarrow D_i \\ f &\longmapsto f(x_{i})\,, \end{align*} Composing with $\pi_i: D_i \rightarrow \mathbb{P}^1$, we obtain a (scheme) morphism \begin{align} \label{eq_nu_underline} \underline{\nu} \colon {\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^{\mathrm{log}}(X_\Sigma) &\longrightarrow (\mathbb{P}^1)^r \\ \nonumber f &\longmapsto (\pi_i(f(x_i)))_i \,. \end{align} For every $[\mathbf{H}]\in (\mathbb{P}^1)^r$, the moduli space ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{H}}^\mathrm{log}(X_\Sigma)$ of $(\omega,\boldsymbol{\gamma})$-stable log maps matching $\mathbf{H}$ is defined by the fiber diagram (in the category of schemes) \begin{equation} \label{eq_diag} \begin{tikzcd} {\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{H}}^\mathrm{log}(X_\Sigma) \arrow[r] \arrow[d] & {\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^{\mathrm{log}}(X_\Sigma) \arrow[d,"(\underline{\mathrm {ev}}_{i})_{i}"] \\ \prod_{i=1}^r H_i \arrow[r,"\iota_H"] & \prod_{i=1}^r D_i\,, \end{tikzcd} \end{equation} where the bottom horizontal arrow $\iota$ is defined by the inclusion morphisms $H_{i}\subset D_i$, or equivalently by the fiber diagram \begin{equation}\label{eq_diag1} \begin{tikzcd} {\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{H}}^\mathrm{log} (X_\Sigma) \arrow[r] \arrow[d] & {\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^{\mathrm{log}}(X_\Sigma) \arrow[d,"\underline{\nu}"] \\ \,[\mathbf{H}]\, \arrow[r,"\iota_{[\mathbf{H}]}"] & (\mathbb{P}^1)^r\,, \end{tikzcd}\end{equation} where $\iota_{[\mathbf{H}]}$ is the inclusion of the point $[\mathbf{H}]$ in $(\mathbb{P}^1)^r$. \begin{lemma} \label{lem_log_lift} For every $1\leq i\leq r$, the evaluation scheme morphism $\underline{\mathrm {ev}}_{i}$ lifts naturally to a log morphism \[ \mathrm {ev}_{i}: {\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^{\mathrm{log}}(X_\Sigma) \longrightarrow D_i\,,\] where $D_i$ is given its toric log structure (as opposed to the log structure restricted from $X_\Sigma$). \end{lemma} \begin{proof} Let $(\pi: C \rightarrow T, f:C \rightarrow X_\Sigma)$ be an $(\omega,\boldsymbol{\gamma})$-marked stable log map. Evaluation at the marked point $x_i$ defines a scheme evaluation map $\underline{\mathrm {ev}}_i : T \rightarrow D_i$, and we want to show that $\underline{\mathrm {ev}}_i$ naturally lifts to a log morphism $\mathrm {ev}_i : T \rightarrow D_i$, where $D_i$ is given its toric log structure. Let $T_i$ be the log scheme with underlying scheme $\underline{T}$ and with log structure $x_i^\star {\mathcal{M}}_C$, where the marked point $x_i$ is viewed as a section $\underline{T} \rightarrow \underline{C}$. Then $x_i$ lifts as a log morphism $T_i \rightarrow C$, and composing with $f: C \rightarrow X_\Sigma$, we obtain a log lift of $\underline{\mathrm {ev}}_i$ as a log morphism $\mathrm {ev}_i: T_i \rightarrow D_i'$, where $D_i'$ is the log scheme with underlying scheme $\underline{D}_i$ and log structure restricted from $X_\Sigma$. We have ${\mathcal{M}}_T \subset {\mathcal{M}}_{T_i}$ and ${\mathcal{M}}_{D_i} \subset {\mathcal{M}}_{D_i'}$, so it is sufficient to show that $\mathrm {ev}_i^\flat: \mathrm {ev}_i^{*} {\mathcal{M}}_{D_i'} \rightarrow {\mathcal{M}}_{T_i}$ takes $\mathrm {ev}_i^{*} {\mathcal{M}}_{D_i}$ into ${\mathcal{M}}_T$. To do this, it is sufficient to show this at the level of stalks of ghost sheaves. For any $p \in C$ in the image of the section $x_i$, we obtain an induced map \[ \overline{\mathrm {ev}}^\flat_i: P_p :=\overline{{\mathcal{M}}}_{X_\Sigma,f(p)}=\overline{{\mathcal{M}}}_{D_i' ,f(p)} \longrightarrow \overline{{\mathcal{M}}}_{C,p}=Q \oplus \NN \,,\] where $Q=\overline{{\mathcal{M}}}_{T,\pi(p)}$, and where the composition with the second projection is given by the contact order $u_{x_{i}}=\iota_{\gamma_i}\omega \in P_p^\vee$. Necessarily $\Spec \kk [P_p]$ is an affine toric chart of $X_\Sigma$ containing $f(p)$, while $\Spec \kk [P_p \cap u_{x_i}^\perp]$ is the intersection of this toric affine chart with $D_i$. In particular, $\overline{{\mathcal{M}}}_{D_i,f(p)}=P_p \cap u_{x_i}^\perp$ and so $\overline{\mathrm {ev}}^\flat_i$ induces a homomorphism between submonoids \[ \overline{{\mathcal{M}}}_{D_i,f(p)} \longrightarrow Q\,, \] as desired. \end{proof} The toric morphisms $\pi_i: D_i \rightarrow \mathbb{P}^1$ naturally lifts to log morphisms when $D_i$ and $\mathbb{P}^1$ are endowed with their toric log structures, and so by composition with the log lifts $\mathrm {ev}_{i}$ of the evaluation morphisms $\underline{\mathrm {ev}}_i$ given by Lemma \ref{lem_log_lift}, we obtain a log lift of the scheme morphism $\underline{\nu}$ introduced in \eqref{eq_nu}, \begin{equation}\label{eq_nu} \nu \colon {\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^{\mathrm{log}}(X_\Sigma) \longrightarrow (\mathbb{P}^1)^r\,,\end{equation} where $(\mathbb{P}^1)^r$ is endowed with its toric log structure. For every point $[\mathbf{H}] \in (\mathbb{P}^1)^r$, we endow $[\mathbf{H}]$ with the log structure restricted from the toric log structure on $(\mathbb{P}^1)^r$. In particular, this log structure is trivial if $[\mathbf{H}] \in (\kk^\star)^r \subset (\mathbb{P}^1)^r$. Similarly, we endow $H_i$ with the log structure restricted from the toric log structure on $D_i$. Then, the inclusions $\iota_H$ and $\iota_{[\mathbf{H}]}$ become a strict morphism of log schemes, and so the fiber diagrams of schemes \eqref{eq_diag} and \eqref{eq_diag1} lift to fiber diagrams of fs log schemes. For $[\mathbf{H}] \in (\kk^{\star})^r \subset (\mathbb{P}^1)^r$, the tropicalization of $[\mathbf{H}]$ is the origin $0$ in the tropicalization $\Sigma((\mathbb{P}^1)^r) \simeq \RR^r$ of $(\mathbb{P}^1)^r$. Hence, taking the tropicalization of \eqref{eq_diag1} viewed as a fiber diagram of fs log schemes, we obtain the fiber diagram of cone complexes \begin{equation}\label{eq_diag_trop} \begin{tikzcd} \Sigma({\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{H}}^\mathrm{log}(X_\Sigma)) \arrow[r] \arrow[d] & \Sigma({\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^\mathrm{log}(X_\Sigma)) \arrow[d,"\Sigma(\nu)"] \\ 0 \arrow[r] & \RR^r\,, \end{tikzcd}\end{equation} where $\Sigma({\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{H}}(X_\Sigma))$ and $\Sigma({\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^\mathrm{log}(X_\Sigma))$ are the tropicalizations of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{H}}(X_\Sigma)$ and $\Sigma({\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^\mathrm{log}(X_\Sigma)$ respectively. As discussed in \S\ref{subsubsec:stable punctured}, the tropicalization of an $(\omega,\boldsymbol{\gamma})$-marked stable log map to $X_\Sigma$ is a family of $(\omega,\boldsymbol{\gamma})$-marked tropical curve in $(M_\RR,\Sigma)$ as in Definition \ref{def_tropical_curve_polyh}, where one views the fan $\Sigma$ as a particular polyhedral decomposition of $M_\RR$. This induces a map of cone complexes \begin{equation} \label{eq_cone1} T:\Sigma({\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^{\mathrm{log}}(X_\Sigma)) \longrightarrow {\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^\mathrm{trop}(\Sigma)\,.\end{equation} Moreover, the map $\Sigma(\nu)$ in \eqref{eq_diag_trop} is the composition of $T$ with the tropical evaluation map at the legs $\mathrm {ev}^\mathrm{trop}: {\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^\mathrm{trop} \rightarrow \prod_{i=1}^r M_\RR/(\gamma_i^\perp)_\RR \simeq \RR^r$ given in \eqref{eq_ev_trop}: \[ \Sigma(\nu) = T \circ \mathrm {ev}^\mathrm{trop} \,.\] Recall from Definition \ref{Def affine constraint} that $\prod_{i=1}^r M_\RR/(\gamma_i^\perp)_\RR \simeq \RR^r$ is naturally the space of $\boldsymbol{\gamma}$-constraint. In particular, the origin $0 \in \RR^r$ corresponds to the $\boldsymbol{\gamma}$-constraint \begin{equation} \label{Eq: A0} \mathbf{A}^0:=(A^0_1,\cdots,A^0_r) \, \end{equation} where $A_i^0$ is the linear hyperplane $(\gamma_i^\perp)_\RR$ in $M_\RR$. Therefore, it follows from the diagram \eqref{eq_diag_trop} that the restriction of $T$ to $\Sigma({\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{H}}^\mathrm{log}(X_\Sigma))$ defines a map \begin{equation} T_H : \Sigma({\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{H}}^\mathrm{log}(X_\Sigma)) \longrightarrow {\mathcal{M}}_{\omega,\boldsymbol{\gamma}, \mathbf{A}^0}^\mathrm{trop} (\Sigma)\,, \end{equation} where ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}, \mathbf{A}^0}^\mathrm{trop} (\Sigma)$ is the moduli space of $(\omega,\boldsymbol{\gamma})$-marked tropical curves to $(M_\RR,\Sigma)$ matching $\mathbf{A}^0$. In other words, the tropicalization of a stable log map matching $\mathbf{H}$ is a tropical curve matching $\mathbf{A}^0$. \subsection{Log Gromov--Witten invariants} \label{sec_log_gw_invts} Let $\rho$ be a $(d-2)$-dimensional face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma}, \mathbf{A}^0}(\Sigma)$. As ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma}, \mathbf{A}^0}(\Sigma)$ is a sub-cone complex of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma}}(\Sigma)$, $\rho$ is also a face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma}}(\Sigma)$. The relative interior $\Int(\rho)$ parametrizes $(\omega,\boldsymbol{\gamma})$-marked tropical curves in $(M_\RR,\Sigma)$ of a given type $\tau_\rho$. Let ${\mathcal{M}}^\mathrm{log}_{\rho}(X_\Sigma)$ be the closure in ${\mathcal{M}}^\mathrm{log}_{\omega,\boldsymbol{\gamma}}(X_\Sigma)$ of the locus of $(\omega,\boldsymbol{\gamma})$-marked stable log maps of type $\tau_\rho$. As reviewed in \S\ref{subsec: The moduli space of mw log maps}, ${\mathcal{M}}^\mathrm{log}_{\omega,\boldsymbol{\gamma}}(X_\Sigma)$ is log smooth of dimension $d-2+r$. By definition, ${\mathcal{M}}^\mathrm{log}_{\rho}(X_\Sigma)$ is a union of log strata of ${\mathcal{M}}^\mathrm{log}_{\omega,\boldsymbol{\gamma}}(X_\Sigma)$ where the ghost monoid is generically give by the basic monoid $Q_{\tau_\rho}$. As $\rk Q_{\tau_\rho}^\gp =d-2$, it follows that ${\mathcal{M}}^\mathrm{log}_{\rho}(X_\Sigma)$ is of pure dimension $r$. In particular, the virtual fundamental class on ${\mathcal{M}}^\mathrm{log}_{\rho}(X_\Sigma)$ constructed by log Gromov--Witten theory \cite{logGW} coincides with the usual fundamental class $[{\mathcal{M}}^\mathrm{log}_{\rho}(X_\Sigma)]$. For every $[\mathbf{H}] \in (\mathbb{P}^1)^r$, let ${\mathcal{M}}_{\rho,\mathbf{H}}^\mathrm{log}(X_\Sigma)$ be the closure in ${\mathcal{M}}^\mathrm{log}_{\omega,\boldsymbol{\gamma},\mathbf{H}}(X_\Sigma)$ of the locus of $(\omega,\boldsymbol{\gamma})$-marked stable log maps of type $\tau_\rho$. Restricting the morphism $\nu$ of \eqref{eq_nu} to ${\mathcal{M}}_{\rho}^\mathrm{log}(X_\Sigma)$, we obtain a fiber diagram \begin{equation}\label{eq_diag3} \begin{tikzcd} {\mathcal{M}}_{\rho,\mathbf{H}}^\mathrm{log}(X_\Sigma) \arrow[r] \arrow[d] & {\mathcal{M}}_{\rho}^\mathrm{log}(X_\Sigma) \arrow[d,"\nu"] \\ \,[\mathbf{H}]\, \arrow[r,"\iota_{[\mathbf{H}]}"] & (\mathbb{P}^1)^r\,, \end{tikzcd}\end{equation} and we define a 0-dimensional virtual fundamental class on ${\mathcal{M}}^\mathrm{log}_{\rho,\mathbf{H}}(X_\Sigma)$ by \begin{equation}\label{eq_vclass1} [{\mathcal{M}}^\mathrm{log}_{\rho,\mathbf{H}}(X_\Sigma)]^\mathrm{vir}:=\iota_{[\mathbf{H}]}^! [{\mathcal{M}}^\mathrm{log}_\rho(X_\Sigma)]\,, \end{equation} where $\iota_{[\mathbf{H}]}^!$ is the Gysin pullback \cite[Chapter 6]{Fult} defined by the regular embedding $\iota_{[\mathbf{H}]}$ of codimension $r$. As the moduli space ${\mathcal{M}}_{\rho,\mathbf{H}}^\mathrm{log} (X_\Sigma)$ is proper, one can define a log Gromov--Witten invariant $N_\rho^{\mathrm{toric}}$ as the degree of this class: \begin{equation}\label{eq_N_toric} N_\rho^{\mathrm{toric}}(X_\Sigma)=\mathrm{deg}[{\mathcal{M}}_{\rho,\mathbf{H}}^\mathrm{log} (X_\Sigma)]^\mathrm{vir} \,. \end{equation} By deformation invariance of the Gysin pullback $\iota_{[\mathbf{H}]}^!$, the log Gromov--Witten invariant $N_\rho^{\mathrm{toric}}$ is independent of the choice of $[\mathbf{H}] \in (\mathbb{P}^1)^r$. \begin{theorem} \label{thm_enum} For general $[\mathbf{H}]\in (\mathbb{P}^1)^l$, the moduli stack $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{H}}^\mathrm{log}(X_\Sigma)$ is log smooth of dimension $d-2$, and, for every $(d-2)$-dimensional face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma}, \mathbf{A}^0}(\Sigma)$, the moduli stack ${\mathcal{M}}_{\rho, \mathbf{H}}^\mathrm{log}(X_\Sigma)$ is reduced and of pure dimension $0$. In particular, the virtual fundamental class is in this case given by the usual fundamental class, \begin{equation}\label{eq_N_toric_enum} N_\rho^{\mathrm{toric}}(X_\Sigma)=\mathrm{deg}[{\mathcal{M}}_{\rho,\mathbf{H}}^\mathrm{log}(X_\Sigma)]\,,\end{equation} and $N_\rho^{\mathrm{toric}}(X_\Sigma)$ is an enumerative count with automorphisms. \end{theorem} \begin{proof} As $\mathcal{M}_{\omega,\boldsymbol{\gamma}}^\mathrm{log}(X_\Sigma)$ is log smooth of dimension $d-2+r$ over the trivial log point, it follows from the generic log smoothness result in Theorem \ref{thm_appendix} that $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{H}}^\mathrm{log}(X_\Sigma)$ is also log smooth of dimension $d-2$ over the trivial log point for general $[\mathbf{H}] \in (\mathbb{P}^1)^l$. In particular, as ${\mathcal{M}}^\mathrm{log}_{\rho,\mathbf{H}}(X_\Sigma)$ is a union of log strata of ${\mathcal{M}}^\mathrm{log}_{\omega,\boldsymbol{\gamma},\mathbf{H}}(X_\Sigma)$ where the ghost monoid is generically given by the basic monoid $Q_{\tau_\rho}$ with $\rk Q_{\tau_\rho}^\gp =d-2$, this implies that ${\mathcal{M}}^\mathrm{log}_{\rho}(X_\Sigma)$ is a union of $0$-dimensional strata of $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{H}}^\mathrm{log}(X_\Sigma)$, which are necessarily reduced. \end{proof} \section{The log-tropical correspondence} In this section, we establish our main correspondence result between the tropical multiplicities $N_\sigma^\mathrm{trop}$ introduced in \S \ref{sec:tropical_enum} and the log Gromov--Witten invariants $N_\rho^{\mathrm{toric}}(X_\Sigma)$ defined in \S \ref{sec_log_gw}. \subsection{Good polyhedral decompositions and toric degenerations} \label{sec_good_polyh} As in the work of Nishinou-Siebert \cite{NS}, we obtain our log-tropical correspondence theorem by the study of a toric degeneration defined by an appropriately chosen polyhedral decomposition of $M_\RR$. In this section, we define the notion of a ``good" polyhedral decomposition and we prove that good polyhedral decompositions exist. The main difference with the set up of \cite{NS} is that we are considering families of tropical curves and not rigid tropical curves in general. We fix be a skew-symmetric form $\omega \in \bigwedge^2 M$ on $N$, and $\boldsymbol{\gamma}=(\gamma_1,\dots,\gamma_r)$ be a $r$-tuple of elements $\gamma_i \in N$ such that $\iota_{\gamma_i} \omega \neq 0$ for all $1\leq i \leq r$ and $\iota_\gamma \omega \neq 0$, where $\gamma:=\sum_{i=1}^r \gamma_i$ as in \S\ref{sec_marked_tropical_curves}. We also fix a general $\boldsymbol{\gamma}$-constraint $\mathbf{A}$ defined as in Definitions \ref{Def affine constraint}-\ref{def_general_constraints}. In what follows, the tuple \begin{equation} \label{Eq:tropical data} (\omega,\boldsymbol{\gamma},\mathbf{A}) \end{equation} is referred to as the \emph{tropical data}. Moreover, we say that $\mathbf{A}$ is \emph{rational} if the affine hyperplanes $A_i$ are defined over $\mathbb{Q}$, that is, $[\mathbf{A}] \in \mathbb{Q}^r \subset \RR^r$. Recall that we reviewed the notion of polyhedral decomposition in Definition \ref{polyhedral decomposition}. Then, a good polyhedral decomposition for a given tropical data is defined as follows. \begin{definition} \label{def:good polyhedral} Let $(\omega,\boldsymbol{\gamma},\mathbf{A})$ be a tropical data with rational $\mathbf{A}$. A \emph{good polyhedral decomposition} $\scrP$ of $M_{\RR}$ for $(\omega,\boldsymbol{\gamma},\mathbf{A})$ is a rational polyhedral decomposition of $M_{\RR}$ which satisfies the following conditions: \begin{enumerate} \item For each $d-2$-dimensional face $\sigma$ of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}, \mathbf{A}}^{\mathrm{trop}}$, each $\foj_v^\sigma$ defined as in \eqref{Eq:jv} is a union of $d-2$-dimensional faces of $\scrP$ and each $\fod_E^\sigma$ defined as in \eqref{Eq:Ev} is a union of $d-1$-dimensional faces of $\scrP$. \item For every $1\leq i \leq r$, the constraint affine hyperplane $A_i$ is a union of $d-1$ dimensional faces of $\scrP$ \end{enumerate} \end{definition} To show that a good polyhedral decomposition exists, we first need the following lemma. \begin{lemma} \label{lem_polyh} Let $P$ be a $k$-dimensional polyhedron in $\RR^n$. Then, there exists a polyhedral decomposition $\scrP$ of $\RR^n$ such that $P$ is a union of $k$-dimensional cell of $\scrP$. \end{lemma} \begin{proof} We first remark that is enough to prove the result for $n=k$: indeed, if $\scrP'$ is a polyhedral decomposition of the $k$-dimensional hull of $P$ such that $P$ is a union of $k$-dimensional cells of $\scrP'$, then, choosing a $(n-k)$-dimensional linear subspace $V$ transverse to the affine hull of $P$, $\scrP=\scrP'+ \Sigma_{\mathbb{P}^{n-k}}$ is a polyhedral decomposition of $\RR^n$ with the same property, where $\Sigma_{\mathbb{P}^{n-k}}$ is the fan of $\mathbb{P}^{n-k}$ viewed as a fan in $V$. We prove the result for $k$-dimensional polytopes in $\RR^k$ by induction on $k$. For $k=0$, there is nothing to prove. We now treat the induction step. By the induction hypothesis, for every codimension 1 face $F$ of $P$, there exists a polyhedral decomposition $\scrP_F$ of the $(k-1)$-dimensional affine hull of $F$ such that $F$ is a union of $(k-1)$-dimensional cells of $\scrP_F$. For every such $F$, choose $n_F \in \mathbb{Z}^k$ not tangent to $F$, and define the polyhedral decomposition $\widetilde{\scrP}_F$ of $\RR^k$ with cells $\sigma+\RR_{\geq 0}n_F$ and $\sigma+\RR_{\leq 0}n_F$ for all cells $\sigma$ of $\scrP_F$. Then, $P$ is a union of $k$-dimensional cells of the polyhedral decomposition $\scrP:=\cap_F \widetilde{\scrP}_F$ of $\RR^k$, where the intersection is taken over the codimension 1 faces $F$ of $P$. \end{proof} \begin{remark} We gave an elementary proof of Lemma \ref{lem_polyh} for completeness. Much stronger results exist: for example, one could assume that $P$ is actually a $k$-cell of $\scrP$ by considering the cone over $P\times \{1\}$ in $\RR^n\times \RR$ and then using the rather difficult result that a cone can always be completed in a complete fan, see \cite{fans} and reference there. We will not use these non-trivial results. \end{remark} \begin{lemma} \label{lem_good_poly} For every tropical data $(\omega,\boldsymbol{\gamma},\mathbf{A})$ with rational $\mathbf{A}$, a good polyhedral decomposition exists. \end{lemma} \begin{proof} By Theorem \ref{thm_trop}, we have $\dim \foj_v^{\sigma}=d-2$ and $\dim \fod_E^\sigma=d-1$ for every $\foj_v^\sigma$ and $\fod_E^\sigma$ as in Definition \ref{def:good polyhedral}. Moreover, by Lemma \ref{lem_polyh}, for every $\foj_v^\sigma$, $\fod_E^\sigma$ or $A_i$ as in Definition \ref{def:good polyhedral}, there exists polyhedral decompositions of $M_{\RR}$ containing respectively $\foj_v^\sigma$, $\fod_E^\sigma$ or $A_i$ as a face. Taking the intersection of all these polyhedral decompositions for every $\foj_v^\sigma$, $\fod_E^\sigma$ and $A_i$, we obtain a good polyhedral decomposition. \end{proof} Let $(\omega,\boldsymbol{\gamma},\mathbf{A})$ be a tropical data with rational $\mathbf{A}$. Given a good polyhedral decomposition $\scrP$ for $(\omega,\boldsymbol{\gamma},\mathbf{A})$, whose existence is guaranteed by Lemma \ref{lem_good_poly}, one constructs a toric degeneration as in \cite[\S 3]{NS}. Let $\overline{M}:=M \oplus \mathbb{Z}$, and let $\overline{\Sigma}_\scrP$ be the fan in $\overline{M}_\RR$, whose faces are the cones over the cells of $\scrP$ viewed in $M_\RR \times \{1\} \subset \overline{M}_\RR$. We denote by $X_{\scrP}$ the corresponding $(d+1)$-dimensional toric variety. The projection on the $\RR$-factor of $\overline{M}_\RR$ defines a map of fans $\overline{\Sigma}_\scrP \rightarrow \RR_{\geq 0}=\Sigma(\AA^1)$, and so a toric morphism \begin{equation} \label{Eq: total space} \pi_{\scrP}: \shX_{\scrP} \longrightarrow \AA^1 \end{equation} whose fiber $\pi_{\scrP}^{-1}(z)$ for $z \in \GG_m=\AA^1 \setminus \{0\}$ is the toric variety $X_{\Sigma_{\scrP}}$ associated to the \emph{asymptotic fan} $\Sigma_{\scrP}$ of $\scrP$, defined by \begin{equation} \label{Eq: Asymptotic fan} \Sigma_\mathsf{P}:=\big\{\lim_{a\to0} a\Xi\subset M_\RR\,\big|\, \Xi\in\mathsf{P}\big\}\,. \end{equation} Irreducible components of the central fiber $\pi_{\scrP}^{-1}(0)$ are in one-to-one correspondence with the vertices of $\scrP$. By rescaling $M_{\RR}$ if necessary, we can assume all vertices of $\scrP$ lie in $M$ and then the central fiber $\pi_{\scrP}^{-1}(0)$ is reduced. We also obtain a degeneration of the constraints $\mathbf{H}=(H_1,\dots,H_r)$ determined by the choice of the tropical constraints $\mathbf{A}=(A_1, \dots,A_r)$. Up to rescaling $\scrP$ if necessary, one can assume that $M \cap A_i \neq \emptyset$ for every $1\leq i \leq r$. For every $1\leq i \leq r$, choose a point $P_i \in M \cap A_i$. The point $P_i \in M$ determines a point $(P_i,1)\in \overline{M}$ and hence a one-parameter subgroup $\GG_m(P_i,1)\subseteq \overline{M}\otimes \GG_m$. Note this can be viewed as a section $\sigma_i$ of the projection $\overline{M}\otimes\GG_m\rightarrow \GG_m$ onto the last coordinate, and thus for $z\in \GG_m$, $\sigma_i(z)$ acts on the fiber of $\shX_{\scrP}\rightarrow \AA^1$ over $z\in\GG_m \subset \AA^1$. Recall that the inverse image of $\GG_m$ in $\shX_{\scrP}$ is $X_{\Sigma_{\scrP}}\times\GG_m$. We then define $\overline{H_i}$ to be the closure of the subset \[ \bigcup_{z\in\GG_m} (\sigma_i(z)H_i,z) \subseteq X_{\Sigma_{\scrP}}\times\GG_m \] in $\shX_{\scrP}$. By construction, $\overline{H}_i$ is an hypersurface in the divisor $\overline{D_i}$ of $\shX_\scrP$ corresponding to the ray $\RR_{\geq 0}(\iota_{\gamma_i}\omega, 1)$ in $\overline{\Sigma}$. We denote the tuple $\overline{\mathbf{H}}:=(\overline{H}_1,\dots,\overline{H}_r)$. \subsection{Decomposition formula} \label{sec_decomp} We fix a good polyhedral decomposition $\scrP$ for a tropical data $(\omega, \boldsymbol{\gamma},\mathbf{A})$ with rational $\mathbf{A}$ as in \S\ref{sec_good_polyh}. In this section, we express the log Gromov--Witten invariants $N_\rho^{\mathrm{toric}}(X_{\Sigma_\scrP})$ of the general fiber of the toric degeneration $\pi_{\scrP}: \shX_{\scrP} \longrightarrow \AA^1$ in terms of log Gromov--Witten invariants of the special fiber. We define as in Definition \ref{def_stable_log} the notion of $(\omega,\boldsymbol{\gamma})$-marked stable maps to $\shX_\scrP$, the only difference being that the contact orders at the marked points are now $(\iota_{\gamma_i}\omega,0)$ and $(\iota_\gamma \omega, 0)$ in $\overline{M}=M \oplus \mathbb{Z}$. We denote by ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^\mathrm{log}(\shX_\scrP/\AA^1)$ the moduli space of $(\omega,\boldsymbol{\gamma})$-marked stable maps to $\pi_{\scrP}:\shX_\scrP \rightarrow \AA^1$. We have a natural morphism ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^\mathrm{log}(\shX_\scrP/\AA^1) \rightarrow \AA^1$ whose fiber over $z\in\GG_m$ is ${\mathcal{M}}^\mathrm{log}_{\omega,\boldsymbol{\gamma}}(X_{\Sigma_{\scrP}})$. \begin{lemma} \label{lem_log_smooth} The moduli space ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^\mathrm{log}(\shX_\scrP/\AA^1)$ is log smooth over $\AA^1$ and is of pure dimension $d-2+r+1$. \end{lemma} \begin{proof} The relative log tangent bundle to $\shX_\scrP/\AA^1$ is trivial, given by $T^\mathrm{log}_{\shX_\scrP/\AA^1}=M \otimes \mathcal{O}_{\shX_\scrP}$, and so we have $H^1(C,f^{\star}T^\mathrm{log}_{\shX_\scrP/\AA^1})=0$ for every genus $0$ stable log maps $f: C \rightarrow \shX_\scrP/\AA^1$. Then, it follows from \cite{logGW}, relative deformations of genus $0$ stable log maps to $\shX_\scrP/\AA^1$ with fixed domain are unobstructed. Hence, it is enough to show that the moduli stack $\mathfrak{M}^{\mathrm{log}}(\AA^1)$ of non-necessarily basic prestable log maps to $\AA^1$ is log smooth over $\AA^1$. We have $\mathfrak{M}^{\mathrm{log}}(\AA^1)=\mathrm{Log}_{\mathfrak{M} \times \AA^1}$, where $\mathfrak{M}$ is the moduli stack of prestable curves and $\mathrm{Log}_{\mathfrak{M} \times \AA^1}$ is Olsson's stack \cite{Olsson03} of log schemes over $\mathfrak{M} \times \AA^1$. As $\mathfrak{M}$ is log smooth over the trivial log point, $\mathfrak{M} \times \AA^1$ is log smooth over $\AA^1$, and so the result follows because $\mathrm{Log}_{\mathfrak{M} \times \AA^1} \rightarrow \AA^1$ factors into $\mathrm{Log}_{\mathfrak{M} \times \AA^1} \rightarrow \mathfrak{M} \times \AA^1 \rightarrow \AA^1$, and for any log stack $S$ the natural morphism $\mathrm{Log}_S \rightarrow S$ is log \'etale by \cite[Theorem 4.6(iii)]{Olsson03} (the corresponding morphism of schemes $\mathrm{Log}_S \rightarrow \mathrm{Log}_S$ is the identity and so is in particular \'etale). \end{proof} We also define as in \eqref{eq_diag} the moduli space ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\overline{\mathbf{H}}}^\mathrm{log} (\shX_\scrP/\AA^1)$ of $(\omega,\boldsymbol{\gamma})$-marked stable maps to $\shX_\scrP \rightarrow \AA^1$ matching the constraint $\overline{\mathbf{H}}$ by the fiber diagram (both in the schemes and fs log schemes categories) \begin{equation} \label{eq_diag_deg} \begin{tikzcd} {\mathcal{M}}_{\omega,\boldsymbol{\gamma},\overline{\mathbf{H}}}^\mathrm{log}(\shX_\scrP/\AA^1) \arrow[r] \arrow[d] & {\mathcal{M}}_{\omega,\boldsymbol{\gamma}}^{\mathrm{log}}(\shX_\scrP/\AA^1) \arrow[d] \\ \prod_{i=1}^r \overline{H}_i \arrow[r,"\iota_{\overline{H}}"] & \prod_{i=1}^r \overline{D}_i\,, \end{tikzcd} \end{equation} We have a natural morphism ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\overline{\mathbf{H}}}^\mathrm{log}(\shX_\scrP/\AA^1) \rightarrow \AA^1$ whose fiber over $z\in\GG_m$ is ${\mathcal{M}}^\mathrm{log}_{\omega,\boldsymbol{\gamma},\{\sigma_i(z)\cdot H_i\}_i}(X_{\Sigma_{\scrP}})$. For every $1 \leq i\leq r$, denote by $\overline{A}_i$ the half-hyperplane in $\overline{M}_\RR$ obtained as the closure in $\overline{M}_\RR$ of $\RR_{\geq 0} (A_i,1)$. By construction, one has a natural projection $\overline{A}_i \rightarrow \RR_{\geq 0}$ whose fiber over $1$ is $A_i$, and whose fiber over $0$ is $A_i^0=(\gamma_i^\perp)_\RR$. As in \S \ref{sec_tropical_constraints}, we define the moduli space ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\overline{\mathbf{A}}}^\mathrm{trop}(\overline{\Sigma}_\scrP) $ of $(\omega,\boldsymbol{\gamma})$-marked tropical curves in $(\overline{M}_\RR, \overline{\Sigma}_\scrP)$ matching the constraint $\overline{\mathbf{A}}:=(\overline{A}_1,\dots,\overline{A}_r)$. There is a natural map ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\overline{\mathbf{A}}}^\mathrm{trop}(\overline{\Sigma}_\scrP) \rightarrow \RR_{\geq 0}$ whose fiber over $1$ is ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}(\scrP)$ and whose fiber over $0$ is ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}^\mathrm{trop}(\Sigma_\scrP)$. Using this, we obtain a natural map \begin{equation} \label{Eq: phi} \tilde{\Phi} \colon \{\mathrm{Faces~of~} {\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP) \} \longrightarrow \{\mathrm{Faces~of~} {\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}(\Sigma_\scrP) \}\,, \end{equation} defined as follows. Given a face $\tilde{\sigma}$ of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$, $\tilde{\Phi}(\tilde{\sigma})$ is the intersection of the fiber ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}^\mathrm{trop}(\Sigma_\scrP)$ over $0$ with the face $\overline{\RR_{\geq 0}(\tilde{\sigma},1)}$ of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\overline{\mathbf{A}}}^\mathrm{trop}(\overline{\Sigma}_\scrP)$ obtained as the closure of the cone over $\tilde{\sigma}$. \begin{definition} \label{def_very_good} A good polyhedral decomposition $\scrP$ of $M_\RR$ is \emph{very good} if: \begin{itemize} \item[(i)] every vertex of $\scrP$ lies in $M$, \item[(ii)] for every $(d-2)$-dimensional face $\tilde{\sigma}$ of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$, the natural projection $T_{\overline{\RR_{\geq 0}(\tilde{\sigma},1)}} \rightarrow \mathbb{Z}$ is surjective, where $T_{\overline{\RR_{\geq 0}(\tilde{\sigma},1)}}$ is the integral tangent space to the face $\overline{\RR_{\geq 0}(\tilde{\sigma},1)}$ of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\overline{\mathbf{A}}}^\mathrm{trop}(\overline{\Sigma}_\scrP)$ \end{itemize} \end{definition} \begin{lemma} \label{lem_very_good} For every tropical data $(\omega,\boldsymbol{\gamma},\mathbf{A})$ with rational $\mathbf{A}$, there exists a very good polyhedral decomposition for $(\omega,\boldsymbol{\gamma},\mathbf{A})$. \end{lemma} \begin{proof} By Lemma \ref{lem_good_poly}, good polyhedral decompositions exist. The result follows because a good polyhedral decomposition can always be rescaled into a very good one. \end{proof} From now on, we assume that $\scrP$ is a very good polyhedral decomposition. Let $\tilde{\sigma}$ be a $(d-2)$-dimensional face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$. The relative interior of the face $\overline{\RR_{\geq 0}(\tilde{\sigma},1)}$ of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma},\overline{\mathbf{A}}}^\mathrm{trop}(\overline{\Sigma}_\scrP)$ parametrizes $(\omega,\boldsymbol{\gamma})$-marked tropical curves in $(\overline{M}_\RR,\overline{\Sigma}_\scrP)$ of a given type $\tau_{\tilde{\sigma}}$. Let ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma}}(\shX_\scrP/\AA^1)$ (resp.\, ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$) be the closure in ${\mathcal{M}}^\mathrm{log}_{\omega,\boldsymbol{\gamma}}(\shX_\scrP/\AA^1)$ (resp.\ ${\mathcal{M}}^\mathrm{log}_{\omega,\boldsymbol{\gamma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$) of the locus of stable log maps of type $\tau_{\tilde{\sigma}}$. These moduli spaces fit in a fiber diagram (both in the schemes and fs log schemes categories) \begin{equation} \label{eq_diag_deg1} \begin{tikzcd} {\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1) \arrow[r] \arrow[d] & {\mathcal{M}}^\mathrm{log}_{\tilde{\sigma}}(\shX_\scrP/\AA^1) \arrow[d] \\ \prod_{i=1}^r \overline{H}_i \arrow[r,"\iota_{\overline{H}}"] & \prod_{i=1}^r \overline{D}_i\,, \end{tikzcd} \end{equation} Similarly, given a $(d-2)$-dimensional face $\rho$ of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}(\Sigma_\scrP)$, we denote by ${\mathcal{M}}^\mathrm{log}_{\rho}(\shX_\scrP/\AA^1)$ (resp.\ ${\mathcal{M}}^\mathrm{log}_{\rho,\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$) the closure in ${\mathcal{M}}^\mathrm{log}_{\omega,\boldsymbol{\gamma}}(\shX_\scrP/\AA^1)$ (resp.\ ${\mathcal{M}}^\mathrm{log}_{\omega,\boldsymbol{\gamma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$) of the locus of stable log maps of type determined by the interior of the face $\rho$. There is a natural map \[{\mathcal{M}}^\mathrm{log}_{\rho,\overline{\mathbf{H}}}(\shX_\scrP/\AA^1) \rightarrow \AA^1\] whose fiber over $1$ is the moduli space ${\mathcal{M}}^\mathrm{log}_{\rho,\mathbf{H}}(X_{\Sigma_\scrP})$ defined in \S \ref{sec_log_gw_invts}. Moreover, the fiber over $0$ is the union of the moduli spaces ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$ where $\tilde{\sigma}$ are the faces of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$ such that $\tilde{\Phi}(\tilde{\sigma})=\rho$. \begin{lemma} \label{lem_log_smooth1} The moduli spaces ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma}}(\shX_\scrP/\AA^1)$ and ${\mathcal{M}}^\mathrm{log}_{\rho}(\shX_\scrP/\AA^1)$ are log smooth over $\AA^1$. Moreover, ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma}}(\shX_\scrP/\AA^1)$ is of pure dimension $r$ and ${\mathcal{M}}^\mathrm{log}_{\rho}(\shX_\scrP/\AA^1)$ is of pure dimension $r+1$. \end{lemma} \begin{proof} By Lemma \ref{lem_log_smooth}, the moduli space ${\mathcal{M}}^\mathrm{log}_{\omega,\boldsymbol{\gamma}}(\shX_\scrP/\AA^1)$ is log smooth over $\AA^1$, of dimension $d-2+r$. The result follows from the fact that ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma}}(\shX_\scrP/\AA^1)$ and ${\mathcal{M}}^\mathrm{log}_{\rho}(\shX_\scrP/\AA^1)$ are log strata of ${\mathcal{M}}^\mathrm{log}_{\omega,\boldsymbol{\gamma}}(\shX_\scrP/\AA^1)$. \end{proof} By Lemma \ref{lem_log_smooth1}, one can consider the $r$-dimensional fundamental class $[{\mathcal{M}}^\mathrm{log}_{\tilde{\sigma}}(\shX_\scrP/\AA^1)]$. We define a $0$-dimensional virtual fundamental class on ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$ by \begin{equation} \label{eq_vclass2}[{\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)]^\mathrm{vir} := \iota_{\overline{H}}^! [{\mathcal{M}}^\mathrm{log}_{\tilde{\sigma}}(\shX_\scrP/\AA^1)]\end{equation} and the corresponding log Gromov--Witten invariant \begin{equation} \label{eq_N_tilde_sigma} N_{\tilde{\sigma}}^{\mathrm{toric}} (\shX_\scrP/\AA^1) := \deg [{\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)]^\mathrm{vir}\,.\end{equation} In the following theorem, we express the invariants $N_\rho^{\mathrm{toric}}(X_{\Sigma_\scrP})$ defined in \eqref{eq_N_toric} in terms of the invariants $N_{\tilde{\sigma}}^{\mathrm{toric}} (\shX_\scrP/\AA^1)$ defined in \eqref{eq_N_tilde_sigma}. For every $(d-2)$-dimensional face $\rho$ of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}(\Sigma)$, denote by $\tilde{S}_{\rho}$ the set of $(d-2)$-dimensional faces $\tilde{\sigma}$ of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$ such that $\Tilde{\Phi}(\Tilde{\sigma})=\rho$. \begin{theorem} \label{thm_decomp} Let $\scrP$ be a very good polyhedral decomposition for $(\omega, \boldsymbol{\gamma},\mathbf{A})$, and let $\rho$ be a $(d-2)$-dimensional face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}(\Sigma)$. Then, we have \begin{equation} \label{eq_decomp} N_\rho^{\mathrm{toric}}(X_{\Sigma_{\scrP}}) = \sum_{\Tilde{\sigma}\in \Tilde{S}_\rho} N_{\tilde{\sigma}}^{\mathrm{toric}} (\shX_\scrP/\AA^1) \,.\end{equation} \end{theorem} \begin{proof} By Lemma \ref{lem_log_smooth1}, the moduli space ${\mathcal{M}}^\mathrm{log}_{\rho}(\shX_\scrP/\AA^1)$ is log smooth over $\AA^1$ and of dimension $r+1$. The general fiber of ${\mathcal{M}}^\mathrm{log}_{\rho}(\shX_\scrP/\AA^1)$ is the $r$-dimensional moduli space ${\mathcal{M}}^\mathrm{log}_\rho(X_{\Sigma_\scrP})$, whereas the irreducible components of the central fiber over $0 \in \AA^1$ are exactly the $r$-dimensional moduli spaces ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma}}(\shX_\scrP/\AA^1)$ for $\Tilde{\sigma} \in \Tilde{S}_\rho$. Hence, it follows from the decomposition result of \cite[Corollary 3.2]{ACGSI} for the fibers of log smooth morphisms that \begin{equation} \label{eq_decomp_classes}[{\mathcal{M}}^\mathrm{log}_\rho(X_{\Sigma_\scrP})]=\sum_{\Tilde{\sigma}\in \Tilde{S}_\rho}[{\mathcal{M}}^\mathrm{log}_{\tilde{\sigma}}(\shX_\scrP/\AA^1)]\,.\end{equation} The multiplicities present in the general formula of \cite[Corollary 3.2]{ACGSI} are all equal to $1$ in our situation because we are assuming that $\scrP$ is a very good polyhedral decomposition and so Definition \ref{def_very_good}(ii) is satisfied (geometrically, the central fiber of ${\mathcal{M}}^\mathrm{log}_{\rho}(\shX_\scrP/\AA^1) \rightarrow \AA^1$ is reduced). Now, applying $\iota_{\overline{H}}^{!}$ to both sides of \eqref{eq_decomp_classes}, we obtain by \eqref{eq_vclass1}-\eqref{eq_vclass2} that \begin{equation} [{\mathcal{M}}^\mathrm{log}_{\rho,\mathbf{H}}(X_{\Sigma_\scrP})]^\mathrm{vir}=\sum_{\Tilde{\sigma}\in \Tilde{S}_\rho}[{\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)]^\mathrm{vir}\,.\end{equation} Taking the degree on both sides gives \eqref{eq_decomp} by \eqref{eq_N_toric}-\eqref{eq_N_tilde_sigma}. \end{proof} \subsection{The log-tropical correspondence for a fixed tropical type} In this section, we relate the log Gromov--Witten invariants $N_{\Tilde{\sigma}}^{\mathrm{toric}}(\shX_\scrP/\AA^1)$ defined in \eqref{eq_N_tilde_sigma} with the tropical multiplicities $N_\sigma^\mathrm{trop}$ defined in \eqref{eq_N_trop}. Let $\tilde{\sigma}$ be a $(d-2)$-dimensional face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$ such that $\dim \fod_{L_{\mathrm{out}}}^{\Tilde{\sigma}}=d-1$ and $\dim \Tilde{\Phi}(\Tilde{\sigma})=d-2$. Tropical curves in the relative interior of $\Tilde{\sigma}$ are of type $\tau_{\tilde{\sigma}}$, and we defined in \S \ref{sec_decomp} the moduli spaces ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma}}(\shX_\scrP/\AA^1)$ and ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$ as closures of loci stable log maps of type $\tau_{\tilde{\sigma}}$. The following Lemma \ref{lem_closed} shows that stable log maps in ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$ are automatically of type $\tau_{\tilde{\sigma}}$, and so taking the closure was actually unnecessary in this case. Denote by ${\mathcal{M}}^{\mathrm{log},0}_{\tilde{\sigma}}(\shX_\scrP/\AA^1)$ the open dense locus in ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma}}(\shX_\scrP/\AA^1)$ consisting of stable log maps of type $\tau_{\tilde{\sigma}}$. \begin{lemma} \label{lem_closed} Stable log maps in ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$ are of type $\tau_{\tilde{\sigma}}$, that is, we have \[ {\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1) \subset {\mathcal{M}}^{\mathrm{log},0}_{\tilde{\sigma}}(\shX_\scrP/\AA^1) \,. \] \end{lemma} \begin{proof} If there were a stable log map in ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$ of type $\tau \neq \tau_{\Tilde{\sigma}}$, then the closure of the tropical curves of type $\tau$ would be a face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$ containing strictly $\tau_{\Tilde{\sigma}}$, and so in particular of dimension $> d-2$. But as the $\boldsymbol\gamma$-constraint $\mathbf{A}$ is general, every face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}$ is of dimension $\leq d-2$ by Definition \ref{def_general_constraints}(ii) and the same is true for ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$ because ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$ is a polyhedral refinement of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}$ by \S\ref{sec_polyh}. Hence, we obtained a contradiction. \end{proof} By Lemma \ref{lem_closed}, it will be enough to study stable log maps of type $\tau_{\Tilde{\sigma}}$. We give below an explicit description of stable log maps of type $\tau_{\Tilde{\sigma}}$. By Definition \ref{def:good polyhedral} of a good polyhedral decomposition, for each vertex $v$ of $\Gamma_{\Tilde{\sigma}}$, $\foj_v^{\Tilde{\sigma}}$ lies in the interior of an $n-2$-dimensional cell $\mathcal{P}_v$ of $\scrP$, and for each edge or leg $E$, $\fod_E^{\Tilde{\sigma}}$ lies in the interior of an $n-1$-dimensional cell $\mathcal{P}_E$ of $\scrP$. Let $Z_v, Z_{E}\subseteq \shX_{\scrP}$ be the closed toric strata corresponding to $\mathcal{P}_v, \mathcal{P}_E$ respectively. The strata $Z_v$ and $Z_E$ are toric subvarieties of $\mathcal{X}_\scrP$ with $\dim Z_v=2$ and $\dim Z_E=1$. Denote by $T_v$ and $T_E$ the integral tangent spaces to $\mathcal{P}_v$ and $\mathcal{P}_E$ respectively. Then, $Z_v$ is a toric surface given by a fan in the lattice \[ M_v:=M/T_v\,, \] and we have $Z_E \simeq \mathbb{P}^1$ with fan naturally in $M_E:=M/T_E$. If $f: C/W \rightarrow \shX_{\scrP}/\AA^1$ is a stable log map of type $\tau_{\Tilde{\sigma}}$, then the dual graph of $C$ is given by the graph $\Gamma_{\Tilde{\sigma}}$. We denote by $\underline{C}_v \simeq \mathbb{P}^1$ the irreducible component corresponding to $v \in V(\Gamma_{\Tilde{\sigma}})$. Moreover, for every edge or leg $E$ of $\Gamma_{\Tilde{\sigma}}$, we denote by $x_E$ the corresponding special point (node or marked point) on $C$. For every $v \in V(\Gamma_{\Tilde{\sigma}})$, we have $f(C_v) \subset Z_v$ and the only points of $C_v$ mapped by $f$ in the toric boundary of $Z_v$ are the points $x_E$ for $E$ an edge or leg adjacent to $v$. In addition, the point $f(x_E)$ is contained in the interior of the big torus orbit $\GG_m$ of $Z_E \simeq \mathbb{P}^1$, and the contact order of $f(C_v)$ to $Z_E$ at $f(x_E)$ is specified by the image $\bar{u}_{v,E}$ in $M_v=M/T_v$ of the weighted direction $u_{v,E}\in M$. In particular, the morphism of schemes $\underline{f}_v \colon \underline{C}_v \rightarrow Z_v$ obtained by restricting $f$ to $\underline{C}_v$ is torically transverse as in \cite[Definition 4.1]{NS}. In fact, as the vertices of $\Gamma_{\Tilde{\sigma}}$ are either divalent or trivalent, $\underline{f}_v \colon \underline{C}_v \rightarrow Z_v$ is a line in the sense of \cite[Definition 5.1]{NS}. Moreover, if $E$ is the leg $L_i$ of $\Gamma_{\Tilde{\sigma}}$ for some $1\leq i \leq r$, then the intersection $Z_{L_i} \cap \overline{H_i}$ consists of a single point, because the defining equation of $\overline{H}_i$ is $z^{\frac{\gamma_i}{|\gamma_i|}}=c_i$ and $\frac{\gamma_i}{|\gamma_i|}$ is primitive. The stable log map $f: C/W \rightarrow \shX_{\scrP}/\AA^1$ matches $\overline{\mathbf{H}}$ if and only if $\{f(x_{L_i})\}=Z_{L_i} \cap \overline{H}_i$ for all $1 \leq i \leq r$. \begin{lemma} \label{lem_reduced} The moduli stack ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$ is reduced and $0$-dimensional. \end{lemma} \begin{proof} The deformation theory of stable log maps to $\shX_\scrP/\AA^1$ is controlled by the log tangent bundle $T_{\shX_\scrP/\AA^1}^{\mathrm{log}}=M \otimes \mathcal{O}_{\shX_\scrP}$. Let $f: C/W \rightarrow \shX_{\scrP}/\AA^1$ be a stable log map in ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$. The map $f$ is of type $\tau_{\Tilde{\sigma}}$ by Lemma \ref{lem_closed}. As $C$ is of genus $0$, we have $H^1(C, f^\star T_{\shX_\scrP/\AA^1}^{\mathrm{log}})=0$, and so the tangent space to $f$ in ${\mathcal{M}}^{\mathrm{log}}_{\omega,\boldsymbol{\gamma},\mathbf{H}}(\shX_\scrP/\AA^1)$ is $T_f := H^0(C,N_f)$, where $N_f:= f^\star T_{\shX_\scrP/\AA^1}^{\mathrm{log}}/T_{C/W}^\mathrm{log}$. As $f$ is a union of lines $\underline{f}_v: \underline{C}_v \rightarrow Z_v$, one checks as in the proof of \cite[Theorem 7.3]{NS} that $T_f=\ker \mathrm{gl}_{\Tilde{\sigma}} \otimes \kk$, where $\mathrm{gl}_{\Tilde{\sigma}}$ is the gluing map \[\mathrm{gl}_{\Tilde{\sigma}}: \prod_{v \in V(\Gamma_{\Tilde{\sigma}})} M \longrightarrow \prod_{E\in E(\Gamma_{\Tilde{\sigma}})} M/\mathbb{Z} u_E \times \prod_{i=1}^r M/\gamma_i^{\perp} \] as in \eqref{eq_gl}. On the other hand, the tangent space $\overline{T}_f$ to $f$ in ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$ is obtained by restricting the infinitesimal deformations to those tangent to the strata $Z_v$ and $Z_E$, and so is the kernel of the restricted map $\overline{\mathrm{gl}}_{\Tilde{\sigma}}\otimes \kk$, where \[ \overline{\mathrm{gl}}_{\Tilde{\sigma}}: \prod_{v \in V(\Gamma_{\Tilde{\sigma}})} M_v \longrightarrow \prod_{E\in E(\Gamma_{\Tilde{\sigma}})} M_E \times \prod_{i=1}^r M/\gamma_i^{\perp}\,. \] As $\dim \Tilde{\sigma}=d-2$, the map $\mathrm{gl}_{\Tilde{\sigma}} \otimes \kk$ is surjective by Lemma \ref{lem_finite}. The natural projections $M \rightarrow M_v$ and $M \rightarrow M_E$ induce a commutative diagram \[\begin{tikzcd} \prod_{v \in V(\Gamma_{\Tilde{\sigma}})} M \arrow[r,"\mathrm{gl}_{\Tilde{\sigma}}"] \arrow[d] & \prod_{E\in E(\Gamma_{\Tilde{\sigma}})} M \times \prod_{i=1}^r M/\gamma_i^{\perp} \arrow[d] \\ \prod_{v \in V(\Gamma_{\Tilde{\sigma}})} M_v \arrow[r,"\overline{\mathrm{gl}}_{\Tilde{\sigma}}"] & \prod_{E\in E(\Gamma_{\Tilde{\sigma}})} M_E \times \prod_{i=1}^r M/\gamma_i^{\perp}\,, \end{tikzcd}\] As the right vertical arrow of this diagram is surjective, the surjectivity of $\mathrm{gl}_{\Tilde{\sigma}} \otimes \kk$ implies the surjectivity of $\overline{\mathrm{gl}}_{\Tilde{\sigma}} \otimes \kk$. Finally, because the trivalent graph obtained from $\Gamma_{\Tilde{\sigma}}$ by erasing the divalent vertices has $r+1$ legs, $r-1$ vertices, and $r-2$ edges, the difference between the dimensions of the domain and the codomain of $\overline{\mathrm{gl}}_{\Tilde{\sigma}} \otimes \kk$ is $2(r-1)-(r-2+r)=0$, and so $\overline{\mathrm{gl}}_{\Tilde{\sigma}} \otimes \kk$ is actually an isomorphism. In particular, $\overline{T}_f=0$ and so ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$ is reduced of dimension $0$ at the point $f$. \end{proof} \begin{lemma}\label{lem_enum} The log Gromov--Witten invariant $N_{\Tilde{\sigma}}^\mathrm{toric}$ is equal to the count with automorphisms of the $(\omega,\boldsymbol{\gamma})$-marked stable log maps to $\shX_\scrP/\AA^1$ of type $\tau_{\tilde{\sigma}}$ and matching $\overline{\mathbf{H}}$. \end{lemma} \begin{proof} By Lemma \ref{lem_finite}, ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$ is a $0$-dimensional scheme and so \eqref{eq_vclass2} implies that $[{\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)]^\mathrm{vir}=[{\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)]$, and so $N_{\Tilde{\sigma}}^\mathrm{trop}=\deg [{\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)]$ by \eqref{eq_N_tilde_sigma}. By Lemma \ref{lem_finite}, ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$ is also reduced, and so $N_{\Tilde{\sigma}}^\mathrm{trop}$ is equal to the count with automorphisms of points in ${\mathcal{M}}^\mathrm{log}_{\tilde{\sigma},\overline{\mathbf{H}}}(\shX_\scrP/\AA^1)$. \end{proof} Recall from \S\ref{sec_polyh} that $\Tilde{\sigma}$ is contained in a $(d-2)$-dimensional face $\sigma$ of ${\mathcal{M}}_{\omega, \boldsymbol{\gamma},\mathbf{A}}$, that we denote by $T_\sigma$ and $T_{\Tilde{\sigma}}$ the integral tangent spaces to $\sigma$ and $\Tilde{\sigma}$ respectively, and that the natural inclusion $T_{\Tilde{\sigma}} \subset T_\sigma$ is of finite index by Lemma \ref{lem:two gammas compare}. We can now state the log-tropical correspondence theorem for a fixed face $\Tilde{\sigma}$. \begin{theorem} \label{thm_count} Fix a tropical data $(\omega,\boldsymbol{\gamma},\mathbf{A})$ with rational $\mathbf{A}$ as in \eqref{Eq:tropical data}, and let $\scrP$ be a very good polyhedral decomposition for $(\omega,\boldsymbol{\gamma},\mathbf{A})$. Let $\tilde{\sigma}$ be a $(d-2)$-dimensional face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$ such that $\dim \fod_{L_{\mathrm{out}}}^{\Tilde{\sigma}}=d-1$ and $\dim \Tilde{\Phi}(\Tilde{\sigma})=d-2$, and let $\sigma$ be the $(d-2)$-dimensional face of ${\mathcal{M}}_{\omega, \boldsymbol{\gamma},\mathbf{A}}$ containing $\Tilde{\sigma}$. Then, we have \begin{equation} N_{\tilde{\sigma}}^{\mathrm{toric}} (\shX_\scrP/\AA^1)= \frac{N_\sigma^\mathrm{trop}}{|T_\sigma/T_{\Tilde{\sigma}}|}\,, \end{equation} where $N_{\Tilde{\sigma}}^{\mathrm{toric}}(\shX_\scrP/\AA^1)$ is the log Gromov--Witten invariant defined in \eqref{eq_N_tilde_sigma} and $N_\sigma^\mathrm{trop}$ is the tropical multiplicity defined in \eqref{eq_N_trop}. \end{theorem} \begin{proof} By Lemma \ref{lem_enum}, $N_{\Tilde{\sigma}}^\mathrm{toric}$ is equal to the count with automorphisms of the $(\omega,\boldsymbol{\gamma})$-marked stable log maps to $\shX_\scrP/\AA^1$ of type $\tau_{\tilde{\sigma}}$ and matching $\overline{\mathbf{H}}$. Let $\underline{C}$ be the scheme-theoretic domain curve of stable log maps of type $\tau_{\Tilde{\sigma}}$, with irreducible components $\underline{C}_v \simeq \mathbb{P}^1$ for $v \in V(\Gamma_{\Tilde{\sigma} })$ and special points (nodes and marked points) $x_E$ for $E \in E(\Gamma_{\Tilde{\sigma}})\cup L(\Gamma_{\Tilde{\sigma}})$. Imitating the terminology of \cite[Definition 4.3]{NS}, we will first count the number of pre-log curves to $\shX_\scrP/\AA^1$ of type $\tau_{\Tilde{\sigma}}$ and matching $\overline{\mathbf{H}}$, that is, the number of scheme morphisms $\underline{f}\colon \underline{C} \rightarrow \shX_\scrP$, such that: \begin{itemize} \item[(i)] $\underline{f}(\underline{C}_v)\subset Z_v$ for every $v \in V(\Gamma_{\Tilde{\sigma}})$, \item[(ii)] the only points of $\underline{C}_v$ mapped by $\underline{f}$ in the toric boundary of $Z_v$ are the points $x_E$ for $E$ an edge or leg adjacent to $v$, \item[(iii)] the contact order of $f(C_v)$ to $Z_E$ at $f(x_E)$ is specified by the image $\bar{u}_{v,E}$ in $M_v=M/T_v$ of the weighted direction $u_{v,E}\in M$, \item[(iv)] the point $f(x_E)$ is contained in the interior of the big torus orbit $\GG_m$ of $Z_E \simeq \mathbb{P}^1$ for every $E \in E(\Gamma_{\Tilde{\sigma}})\cap L(\Gamma_{\Tilde{\sigma}})$, \item[(v)] $\{\underline{f}(x_{L_i})\}=Z_{L_i} \cap \overline{H}_i$ for every $1\leq i \leq r$. \end{itemize} We will then count the number of ways to lift a pre-log curve $\underline{f}:\underline{C}\rightarrow \shX_{\scrP}$ to a stable log curve $f: C/W \rightarrow \shX_{\scrP}/\AA^1$. To count the number of pre-log curves of type $\tau_{\Tilde{\sigma}}$ and matching $\mathbf{H}$, we proceed by induction following the flow on $\Gamma_{\Tilde{\sigma}}$ starting at the leaves and ending at the root. We use the notations introduced in the proofs of Lemmas \ref{lem: product for Ntrop}-\ref{lem: product2 for Ntrop}-\ref{lem:coker psi}, but also applied to $\Gamma_{\Tilde{\sigma}}$, so that a vertex $v$ may be divalent also, so in particular there may be only a $\Gamma_{\tilde{\sigma}_1}$ and not both a $\Gamma_{\tilde{\sigma}_1}$, $\Gamma_{\tilde{\sigma}_2}$ attached to a vertex $v$. Let $v$ be a vertex of $\Gamma_{\Tilde{\sigma}}$. If $v$ is divalent, we are in a situation similar to \cite[Proposition 5.5]{NS}: we have a $\mathbb{P}^1$-fibration structure $Z_v\rightarrow \mathbb{P}^1$ induced by the map of fans given by \[ M/T_v\rightarrow M/\mathcal{L}_{1,v}^{\sat}\simeq \mathbb{Z}\,. \] Recall from \S\ref{sec_polyh} that we denote $w_v := |\overline{u}_E|$, where $E$ is an edge adjacent to $v$ and $\overline{u}_E$ is the image of $u_E$ in the rank two lattice $M/T_v$. Then the vertex $v$ corresponds to a component $\underline{C}_v$ of the pre-log curve which maps $w_v:1$ to a fiber of $Z_v\rightarrow \mathbb{P}^1$, totally ramified over the two one-dimensional toric strata of $Z_v$ this fiber intersects. Because this stable map has an automorphism group $\mathbb{Z}/w_v \mathbb{Z}$, its count with automorphism is $w_v^{-1}$. If the child edge of $v$ is not a leg, we deduce that $N_{\Tilde{\sigma}_{\mathfrak{out}}}=w_v^{-1}N_{\Tilde{\sigma}_1}$. If the child edge of $v$ is a leg $L_i$, then $f(x_{L_i})$ is constrained to equal the point $Z_{L_i} \cap \overline{H}_i$, and so $N_{\Tilde{\sigma}_{\mathfrak{out}}}=w_v^{-1}$. Next consider the case with $v$ trivalent. Assume first that $E_1$ and $E_2$ are not legs. Then $Z_v$ is a toric surface, and the edges or legs $E_{1}$, $E_{2}$ and $E_{\out}$ determine three divisors $Z_{1}=Z_{E_{1}}, Z_2=Z_{E_{2}}$ and $Z_{\out}=Z_{E_{\out}}$ of $Z_v$. We then need to count lines in the sense of \cite[Definition 5.1]{NS} which intersect the boundary of $Z_v$ in three points, with maximal tangency order, and meeting $Z_j$ at one of the $N_{\Tilde{\sigma}_j}$ points where the pre-log curves of type $\tau_{\Tilde{\sigma}_j}$ meet $Z_v$. Given fixed input locations, the number of such curves is \[ N_v:=|\frac{u_{E_1}}{|u_{E_1}|}\times \frac{u_{E_2}}{|u_{E_2}|}| \,, \] by \cite[Proposition 5.7]{NS}. This can be rewritten as \begin{equation} \label{eq:Nv} N_v:=\big|M/(\mathcal{L}_{1,v}^{\sat}+\mathcal{L}_{2,v}^{\sat})\big|. \end{equation} Then we obtain $N_{\Tilde{\sigma}_{\mathfrak{out}}}=N_v N_{\Tilde{\sigma}_1} N_{\Tilde{\sigma}_2}$. If $E_1$ is an edge and $E_2$ is a leg, we similarly obtain $N_{\Tilde{\sigma}_{\mathfrak{out}}}=N_v N_{\Tilde{\sigma}_1}$, and if both $E_1$ and $E_2$ are legs, we have $N_{\Tilde{\sigma}_{\mathfrak{out}}}=N_v$. Putting this all together, the count with automorphisms of pre-log curves of type $\tau_{\Tilde{\sigma}}$ and matching $\mathbf{H}$ is \begin{equation} \label{eq:prelog number} \left(\prod_{\hbox{$v$ divalent}} w_v^{-1}\right) \left(\prod_{\hbox{$v$ trivalent}} N_v\right). \end{equation} We may now calculate the number of logarithmic enhancements of each pre-log curve, that is the number of lifts of each pre-log curve to a stable log curve. We use the theory of \emph{punctured log curves}, introduced in \cite{ACGSII}. Examples of punctured log curves are obtained by restricting the log structure of a log curve to one of its irreducible components. Conversely, punctured log curves can be glued together to produce log curves. First note that the cones corresponding to $Z_v$ and $Z_E$ in the fan of $\mathcal{X}_\scrP$ are the cones $\mathbf{C}\scrP_v$ and $\mathbf{C}\scrP_E$ over $\scrP_v$ and $\scrP_E$ respectively. We will denote by $P_v$ and $P_E$ the monoids of integral points in the cones $\Hom(\mathbf{C}\scrP_v,\mathbb{Z})$ and $\Hom(\mathbf{C}\scrP_E,\mathbb{Z})$, dual to $\mathbf{C}\scrP_v$ and $\mathbf{C}\scrP_E$, respectively. Then, the monoids $P_v$ and $P_E$ are stalks of the ghost sheaf $\overline{\mathcal{M}}_{\mathcal{X}_\scrP}$ at generic points of $Z_v$ and $Z_E$ respectively. Now, consider one of the pre-log curves $\ul{f}:\ul{C}\rightarrow \shX_{\scrP}$ constructed above. For every vertex $v \in V(\Gamma_{\Tilde{\sigma}})$, we write $\ul{f}_v:\ul{C}_v\rightarrow \ul{\shX_{\scrP}}$ for the restriction of $\ul{f}$ to the irreducible component $\ul{C}_v \simeq \mathbb{P}^1$ of $\ul{C}$ corresponding to $v$. We first note that we can enhance the stable map $\ul{f}_v$ to a basic punctured log map $f_v:C_v^\circ/W_v\rightarrow\shX_{\scrP}$ in a unique way so that the punctured points have contact orders given by the weighted tangent vectors to the edges adjacent to $v$ (and pointing away from $v$). The base $W_v$ needs to be the log point $W_v := \Spec(Q_v \rightarrow \kk)$ with ghost sheaf $Q_v$ given by the basic monoid. By definition the basic monoid is the dual of the moduli space of tropical maps with domain the dual graph of $ \underline{C}_v$: here the only moduli is the location of the vertex, which is constrained to lie in ${\bf C}\mathcal{P}_v$, and trace out a $(d-2)+1$-dimensional subcone $\mathcal{C}_v$ of that cone. The basic monoid $Q_v$ is the monoid of integral points of this cone $\mathcal{C}_v$. Note that, the inclusion $\mathcal{C}_v \subset {\bf C}\mathcal{P}_v$ induces a projection \begin{equation} \label{Eq:phiv} \phi_v \colon P_v \longrightarrow Q_v \,. \end{equation} Consider the curve $\ul C_v$, and recall that we denote by $x_E$ the marked point corresponding to an edge or leg $E$ adjacent to $v$. As in \cite{katoF}, the curve $\ul C_v$ lifts uniquely to a log curve, which is log smooth over $W_v$ with marked points $x_E$. We use the notation $(C_v,\mathcal{M}_{C_v})$ to denote this log curve. On the complements of the marked points on $C_v$, the map $\ul{f}_v$ admits a unique lift to a log map $f_v$. Indeed, for $p$ in $\ul C_v$, which is not a marked point, $\ul{f}_v(p)$ lies in the interior of $Z_v$, so we have $\overline{{\mathcal{M}}}_{X_\scrP, \ul{f}_v(p)} = P_v$. Then, locally $f_v$ is given by the map: \begin{align*} \mathcal{M}_{X_\scrP,\ul f_v(p)} = \mathcal{O}^*_{\ul X_\scrP,f(p)} \oplus P_v & \longrightarrow \mathcal{M}_{C_v,p} = \mathcal{O}^*_{\ul C_v,p} \oplus Q_v \\ (s,r) & \longmapsto (\ul{f}_v^{\star}(s),\phi_v(r)) \end{align*} For a marked point $x_E$, we will show in a moment that locally near $x_E$, there exists a unique puncturing $C_v^\circ$ of $C_v$ and the map $\ul{f}_v$ admits a unique lift to a punctured log map $f_v : C_v^\circ \to X_\scrP$. First note that the inclusion $\mathbf{C}\mathcal{P}_v \subset \mathbf{C}\mathcal{P}_E$ induces a projection $P_E \to P_v$ whose composition with $\phi_v$ in \eqref{Eq:phiv} gives a map \begin{equation} \label{eq_phi_vE} \phi_{v,E} \colon P_E \longrightarrow Q_v \end{equation} Moreover, the weighted direction $u_E$ of the edge $E$ is an integral tangent vector to $\mathbf{C}\mathcal{P}_E$, hence can be viewed as an element in $P_E^* \coloneqq \Hom(P_E,\mathbb{Z})$. Denote by $\mathcal{M}_{(\ul C_v, x_E)}$ the divisorial log structure on $\ul C_v$, defined by the marked point $x_E$ viewed as a divisor. Then, for the stalk of the ghost sheaf, we have $\overline{\mathcal{M}}_{(\ul C_v, x_E),x_E} = \NN$. So, from \cite{katoF} we have \[ \mathcal{M}_{C_v,x_E} = ( \mathcal{O}^*_{\ul C_v,x_E} \oplus Q_v ) \oplus_{\mathcal{O}^*_{\ul C_v},x_E} \mathcal{M}_{(C_v,x_E),x_E} \,.\] Let $x=0$ be a local equation of $x_E$ in $\ul C_v$. One can naturally view $x$ as an element $x\in \mathcal{M}_{(C_v,x_E),x_E}$. Denote by $\mathcal{M}_{C_v^\circ,x_E} $ the submonoid of $ ( \mathcal{O}^*_{\ul C_v,x_E} \oplus Q_v ) \oplus_{\mathcal{O}^*_{\ul C_v},x_E} \mathcal{M}^{\gp}_{(C_v,x_E),x_E} $ generated by $ \mathcal{O}^*_{\ul C_v,x_E} \oplus Q_v $ and elements of the form $(s,\phi_{v,E}(r),x^{u_E(r)})$, for $s \in \mathcal{O}^*_{\ul C_v,x_E}$ and $r\in P_E$. Then, $\mathcal{M}_{C_v^\circ,x_E} $ is the unique puncturing of $C_v$ at $x_E$ such that locally $\ul f_v$ lifts to a punctured log map $f_v: C_v^0 \to \mathcal{X}_\scrP$. This map is given by \begin{align*} \mathcal{M}_{X_\scrP,\ul f_v(x_E)} = \mathcal{O}^*_{\ul X_\scrP,\ul{f}_v(x_E)} \oplus P_E & \longrightarrow \mathcal{M}_{C_v^\circ,x_E} \subset ( \mathcal{O}^*_{\ul C_v,x_E} \oplus Q_v ) \oplus_{\mathcal{O}^*_{\ul C_v},x_E} \mathcal{M}^{\gp}_{(C_v,x_E),x_E} \\ (s,r) & \longmapsto (\ul{f}_v^{\star}(s),\phi_{v,E}(r), x^{u_E(r)})\,, \end{align*} Here we use that $\ul{f}(x_E)$ is contained in the interior of $Z_E$, and so $\bar{\mathcal{M}}_{X_\scrP,\ul{f}_v(x_E)} = P_E$. This shows that the restriction of $\ul{f} \colon \ul C \to \ul{\mathcal{X}}_\scrP$, to any irreducible component $\ul C_v$ lifts uniquely to a punctured log map. In the remaining part of the proof, we will count the number of ways to glue these punctured maps to a stable log map $f \colon C \to \mathcal{X}_\scrP$. For this we will follow \cite{MarksNotes}. We consider punctured log maps $f_v \colon C_v^\circ/W_v \rightarrow X_{\scrP}$ over the log points $W_v=\Spec (Q_v \rightarrow \kk)$, which we want to glue at marked points $x_E$ such that $\overline{\mathcal{M}}_{X_\scrP,\ul{f}_v(x_E)} = P_E$. Let $Q_v^*=\Hom(Q_v,\mathbb{Z})$ and $P_E^*=\Hom(P_E,\mathbb{Z})$. As in \cite[Defn.4.2]{MarksNotes}, there is a gluing map \[ \overline\Psi:\prod_{v\in V(\Gamma_{\Tilde{\sigma}})} Q_v^*\times \prod_{E\in E(\Gamma_{\Tilde{\sigma}})} \mathbb{Z}\rightarrow \prod_{E\in E(\Gamma_{\Tilde{\sigma}})} P_E^* \,, \] and $\overline\Psi$ is given by \[ \overline\Psi\left((q_v),(\ell_E)\right)=(\phi_{v_E,E}^{\star}(q_{v_E})+\ell_E u_E -\phi_{v'_E, E}^{\star}(q_{v'_E}))_{E\in E(\tilde\Gamma)} \] where for every vertex $v$ adjacent to an edge $E$, $\phi_{v,E}^{\star} : Q_v^\star \rightarrow P_E^{\star}$ is the dual of the map $\phi_{v,E}$ in \eqref{eq_phi_vE}, where each edge $E$ is oriented from endpoints $v_E$ to $v'_E$ and $u_E$ is the weighted tangent vector to the edge $E$ pointing from $v_E$ to $v'_E$. We explain how to compare the map $\overline\Psi$ with the map $\Psi_{\Tilde{\sigma}}$ in \eqref{Eq: WidetildePsi}, following \cite[\S 5.1]{MarksNotes}. Note that the morphism $\shX_{\scrP}\rightarrow \AA^1$ induces maps $Q_v^*\rightarrow\mathbb{Z}$, $P_E^*\rightarrow\mathbb{Z}$ with kernels isomorphic to $T_v$, $T_E$. We then obtain a diagram \[ \xymatrix@C=30pt { 0\ar[r]&\prod_v T_v\times \prod_E \mathbb{Z}\ar[r]\ar[d]_{\widetilde{\Psi}}& \prod_v Q_v^*\times \prod_E\mathbb{Z}\ar[r]\ar[d]_{\overline\Psi}& \prod_v \mathbb{Z}\ar[d]_{\partial}\ar[r]& 0\\ 0\ar[r]&\prod_E T_E\ar[r]&\prod_E P_E^*\ar[r]&\prod_E\mathbb{Z}\ar[r]&0 } \] Here the maps to $\prod\mathbb{Z}$ are induced by the above maps $Q_v^*, P_E^*\rightarrow\mathbb{Z}$, $\Psi_{\Tilde{\sigma}}$ is the restriction of $\overline\Psi$ to the kernels, hence the $\Psi_{\Tilde{\sigma}}$ previously defined, and $\partial$ can be viewed as the coboundary map for calculating simplicial cohomology of $\Gamma_{\Tilde{\sigma}}$, so that $\ker\partial=\mathbb{Z}$ and $\coker\partial=0$. Thus by snakes lemma we obtain a long exact sequence \[ 0\rightarrow\ker \Psi_{\Tilde{\sigma}}\rightarrow \ker\overline\Psi\rightarrow \mathbb{Z}\rightarrow \coker \Psi_{\Tilde{\sigma}} \rightarrow \coker\overline{\Psi} \rightarrow 0. \] Note that $\ker\partial$ is generated by $(1,\cdots, 1)$. As the kernel $\ker\overline\Psi$ is precisely the integral tangent space $T_{\overline{\RR_{\geq 0}(\Tilde{\sigma},1)}}$ to $\overline{\RR_{\geq 0}(\Tilde{\sigma},1)}$, the map $\ker\overline\Psi\rightarrow\ker\partial$ is actually surjective by Definition \ref{def_very_good}(ii) because we are assuming that $\scrP$ is a very good polyhedral decomposition. Thus $\coker \Psi_{\Tilde{\sigma}} \simeq \coker\overline\Psi$. By Lemmas \ref{lem:coker psi} and \ref{lem:two gammas compare}, the cokernel $\coker \Psi_{\Tilde{\sigma}} \simeq \coker\overline\Psi$ is finite and so we are in a tropically transverse gluing situation in the sense of Definition 4.7 of \cite{MarksNotes}. Hence, by Theorem 4.8 of \cite{MarksNotes}, the moduli space $W$ of glued stable log maps is non-empty. Therefore, one can apply Theorem 4.4 of \cite{MarksNotes} and obtain that $W$ has $|\coker \Psi_{\Tilde{\sigma}} |$ connected components. Lemma \ref{lem_reduced} implies that $W$ is reduced of dimension $0$, and hence there are $|\coker \Psi_{\Tilde{\sigma}} |$ choices of log gluings. Now by Lemmas \ref{lem:two gammas compare} and \ref{lem:coker psi}, we have \begin{align*} |\coker \Psi_{\Tilde{\sigma}}|= {} & |\coker \Psi_\sigma| \frac{\prod_v w_v}{|T_{\sigma}/ T_{\tilde\sigma}|}\\ = {} &\frac{\prod_{v\in\Gamma}|({\mathcal{L}}_{1,v}^{\sat}+{\mathcal{L}}_{2,v}^{\sat})/ ({\mathcal{L}}_{1,v}+{\mathcal{L}}_{2,v})| \prod_v w_v}{|T_{\sigma}/ T_{\tilde\sigma}|}. \end{align*} Combining with \eqref{eq:prelog number} and \eqref{eq:Nv} and Lemma \ref{lem: product for Ntrop}, the total count with automorphisms of the $(\omega,\boldsymbol{\gamma})$-marked stable log maps to $\shX_\scrP/\AA^1$ of type $\tau_{\tilde{\sigma}}$ and matching $\overline{\mathbf{H}}$ is \begin{align*} &\frac{ \prod_{v\in\Gamma}|M/({\mathcal{L}}_{1,v}^{\sat}+{\mathcal{L}}_{2,v}^{\sat})|\cdot |({\mathcal{L}}_{1,v}^{\sat}+{\mathcal{L}}_{2,v}^{\sat})/ ({\mathcal{L}}_{1,v}+{\mathcal{L}}_{2,v})|}{ |T_{\sigma}/T_{\tilde\sigma}|}\\ = {} &\frac{ \prod_{v\in\Gamma}|M/(L_{1,v}+L_{2,v}|}{ |T_{\sigma}/T_{\tilde\sigma}|}\\ = {} & \frac{N_{\sigma}^\mathrm{trop}}{|T_{\sigma}/T_{\tilde\sigma}|} \,. \end{align*} This concludes the proof of Theorem \ref{thm_count}. \end{proof} In the purely toric set-up, a general gluing formula for log Gromov--Witten invariants is also proven in \cite{wu2021splitting}. However, in the proof Theorem \ref{thm_count}, we used rather an explicit toric degeneration and then the gluing formula of \cite{MarksNotes}. The main motivation for this choice is that we expect the explicit description of the log curves in the special fiber of the toric degeneration to be useful to define and study the higher dimensional version of the higher genus log Gromov--Witten invariants considered in \cite{MR3904449}, and which should be related to refined DT invariants. \subsection{The proof of the log-tropical correspondence} In this section, we prove our main log-tropical correspondence result comparing the log Gromov--Witten invariants $N_\rho^{\mathrm{toric}}(X_\Sigma)$ with the tropical multiplicities $N_\sigma^\mathrm{trop}$. Recall that choosing a $\boldsymbol{\gamma}$-constraint $\mathbf{A}$ as in Definition \ref{Def affine constraint} amounts to choosing a point in $[\mathbf{A}]=([A_i])_i \in \prod_{i=1}^r M_\RR/(\gamma_i^{\perp})_\RR\simeq \RR^r$. The constraint $\mathbf{A}^0$ defined in \eqref{Eq: A0} corresponds to the origin $0 \in \RR^r$. We have a natural map \begin{equation} \label{Eq: Phi} \Phi \colon \{\mathrm{Faces~of~} {\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}} \} \longrightarrow \{\mathrm{Faces~of~} {\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0} \} \end{equation} defined as follows. Given a face $\sigma$ of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}$, the relative interior $\Int(\sigma)$ of $\sigma$ parametrize $(\omega,\boldsymbol{\gamma})$-tropical curves in $M_\RR$ of a given type $\tau_\sigma$ matching the constraint $\mathbf{A}$. Let $\sigma'$ be the face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma}}$ such that $\Int(\sigma')$ parametrize $(\omega,\boldsymbol{\gamma})$-tropical curves of type $\tau_\sigma$. As in \eqref{eq_ev_trop}, we have an evaluation map at the legs \[ \mathrm {ev} \colon \sigma' \longrightarrow \prod_{i=1}^r M_\RR/(\gamma_i^{\perp})_\RR\simeq \RR^r\] such that $\sigma=\mathrm {ev}^{-1}([\mathbf{A}])$, and we set $\Phi(\sigma):= \mathrm {ev}^{-1}(0)$, which is naturally a face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}$. Intuitively, $\Phi(\sigma)$ is obtained from $\sigma$ by rescaling the point $[\mathbf{A}] \in \RR^r$ in the space of $\boldsymbol{\gamma}$-constraints by a parameter $t$ and then taking the limit $t \rightarrow 0$. As a face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}$ is necessarily a cone, we say that $\sigma$ is \emph{asymptotically equivalent} to the cone $\Phi(\sigma)$. If $\Sigma$ is a $\boldsymbol{\gamma}$-fan and $\rho$ is a $(d-2)$-dimensional face of ${\mathcal{M}}^\mathrm{trop}_{\omega, \boldsymbol{\gamma},\mathbf{A}^0}(\Sigma)$, we denote by $S_\rho$ the set of faces $\sigma$ of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}$ such that $\rho \subset \Phi(\sigma)$. As $\dim \rho =d-2$ and $\mathbf{A}$ is a general $\boldsymbol{\gamma}$-constraint as in Definition \ref{def_general_constraints}, the condition $\sigma \in S_d$ automatically implies $\dim \sigma =d-2$. If in addition $\dim \fod_{L_{\mathrm{out}}}^\rho=d-1$, then $\dim \fod_{L_{\mathrm{out}}}^\sigma=d-1$, and so one can consider the tropical multiplicity $N_\sigma^\mathrm{trop}$ as in \eqref{eq_N_trop} and the tropical coefficient $k_\sigma$ as in \eqref{eq_coeff}. \begin{theorem}[\textbf{Theorem \ref{thm_log_trop_intro}}] \label{Thm:log_trop_thm} Fix a tropical data $(\omega,\boldsymbol{\gamma},\mathbf{A})$ as in \eqref{Eq:tropical data}, and $\Sigma$ a $\boldsymbol{\gamma}$-fan as in Definition \ref{def_gamma_fan}. For every $(d-2)$-dimensional face $\rho$ of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}(\Sigma)$ such that $\dim \fod_{L_{\mathrm{out}}}^{\rho}=d-1$, we have \begin{equation} \label{eq_main} k_\rho N_\rho^{\mathrm{toric}}(X_\Sigma)=\sum_{\sigma \in S_\rho} k_\sigma N_\sigma^\mathrm{trop} \,,\end{equation} where $N_\rho^{\mathrm{toric}}(X_\Sigma)$ be the log Gromov--Witten invariants of the toric variety $X_{\Sigma}$ as in \eqref{eq_N_toric}, $N_\sigma^\mathrm{trop}$ are the tropical multiplicities as in \eqref{eq_N_trop}, and the tropical coefficients $k_\rho$ and $k_\sigma$ are defined as in \eqref{eq_coeff}. \end{theorem} \begin{proof} If $\Sigma'$ is a refinement of $\Sigma$, then, as in \S\ref{sec_polyh}, ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}(\Sigma')$ is a polyhedral refinement of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}(\Sigma)$. If $\rho'$ is a $(d-2)$-dimensional face of ${\mathcal{M}}_{\omega,\boldsymbol{\gamma}}(\Sigma')$ contained in $\rho$, then, by \cite[Theorem 1.4]{johnston2022birational} on the behavior of log Gromov--Witten invariants under log-\'etale transformations, we have $N_{\rho'}=\frac{1}{|T_{\rho}/T_{\rho'}|} N_\rho$, and so, using \eqref{eq_coeff}, $k_{\rho'} N_{\rho'}=k_\rho N_\rho$. Hence, it is enough to prove \eqref{eq_main} for a particular $\boldsymbol{\gamma}$-fan to have the result for all $\boldsymbol{\gamma}$-fans. As $\QQ$ is dense in $\RR$, we can assume without loss of generality that $\mathbf{A}$ is rational. Let $\scrP$ be a very good polyhedral decomposition of $M_\RR$ for $(\omega,\boldsymbol{\gamma},\mathbf{A})$. Such $\scrP$ exists by Lemma \ref{lem_very_good}. We will prove \eqref{eq_main} for the $\boldsymbol{\gamma}$-fan $\Sigma_\scrP$ asymptotic to $\scrP$. By Theorem \ref{thm_decomp}, we have \[N_\rho^{\mathrm{toric}}(X_{\Sigma_{\scrP}}) = \sum_{\Tilde{\sigma}\in \Tilde{S}_\rho} N_{\tilde{\sigma}}^{\mathrm{toric}} (\shX_\scrP/\AA^1)\,, \] where $\tilde{S}_{\rho}$ is the set of $(d-2)$-dimensional faces $\tilde{\sigma}$ of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$ such that $\Tilde{\Phi}(\Tilde{\sigma})=\rho$, where $\Tilde{\Phi}$ is given by \eqref{Eq: phi}. Every $(d-2)$-dimensional face $\tilde{\sigma}$ of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$ is contained in a unique $(d-2)$-dimensional face $\sigma$ of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}$, and we have \[N_{\tilde{\sigma}}^{\mathrm{toric}} (\shX_\scrP/\AA^1) =\frac{N_\sigma^\mathrm{trop}}{|T_\sigma/T_{\tilde{\sigma}}|}\] by Theorem \ref{thm_count}. The maps $\tilde{\Phi}$ in \eqref{Eq: phi} and $\Phi$ in \eqref{Eq: Phi} are compatible with the polyhedral refinements of the moduli spaces induced by $\scrP$ and $\Sigma_\scrP$, and so the conditions $\tilde{\Phi}(\tilde{\sigma})=\rho$ and $\tilde{\sigma}\subset \sigma$ imply $\rho \subset \Phi(\sigma)$. Conversely, if $\sigma$ is a $(d-2)$-dimensional face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$ such that $\rho \subset \Phi(\sigma)$, there exists a unique $(d-2)$-dimensional face $\tilde{\sigma}$ of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}(\scrP)$ such that $\Phi(\tilde{\sigma})=\rho$. Hence, we obtain \[N_\rho^{\mathrm{toric}}(X_{\Sigma_{\scrP}}) = \sum_{\sigma\in S_\rho} \frac{N_{\sigma}^\mathrm{trop}}{|T_\sigma/T_{\tilde{\sigma}}|}\,. \] Finally, we have $|T_{\sigma}/T_{\tilde{\sigma}}| = \frac{k_{\tilde \sigma}}{k_\sigma}$ by \eqref{eq_coeff}, and $k_\rho = k_{\tilde{\sigma}}$ by Definition \ref{def_very_good}(ii) of a very good polyhedral decomposition. \end{proof} \section{Quiver DT invariants, flow trees and log curves} In this section, after shortly reviewing in \S\ref{sec_aft}-\ref{sec_flow_trees} how to calculate quiver DT invariants tropically using attractor flow trees as in \cite{ABflow}, we prove our quiver DT-log Gromov--Witten correspondence in \S\ref{sec_dt_gw}. \subsection{Attractor flow trees and tropical curves} \label{sec_aft} Let $\omega$ be a skew-symmetric form on $N$. We fix a $r$-tuple $\boldsymbol{\gamma}=(\gamma_1,\dots,\gamma_r)$ of elements $\gamma_i \in N$ such that $\iota_{\gamma_i} \omega \neq 0$ for every $1\leq i\leq r$, and $\iota_\gamma \omega \neq 0$, where $\gamma:=\sum_{i=1}^r \gamma_i$. \begin{definition} A \emph{rooted tree} is a genus $0$ graph, without divalent vertices, and with a single univalent vertex, referred to as the \emph{root} and denoted by $R_T$. \end{definition} Given a rooted tree $T$ with $r$ legs $L_1,\dots, L_r$ decorated by $\gamma_1,\dots,\gamma_r$, we define for every edge or leg $E$ of $T$, the class $\gamma_E$ of $E$ by $\gamma_E =\sum_i \gamma_i$, where the sum is over the indices $1\leq i \leq r$ such that the leg $L_i$ is a descendant of $E$, that is such that $E$ is in the path from the root to $L_i$. \begin{definition} \label{def_attractor_tree} Fix a point $\theta \in \gamma^{\perp}$ and a $\boldsymbol{\gamma}$-constraint $\mathbf{A}$. A parametrized $(\omega,\boldsymbol{\gamma})$-marked \emph{attractor flow tree} with root $\theta$ and matching $\mathbf{A}$ is a pair $(T,h)$, where \begin{itemize} \item[(i)] $T$ is a rooted tree with $r$ legs decorated by $\gamma_1,\dots,\gamma_r$, such that, for every edge of leg $E$, we have $\iota_{\gamma_E} \omega \neq 0$, and for every vertex $v \in V(E)$ distinct from the root $R_T$, there exist edges or legs $E_1$ and $E_2$ adjacent to $v$ such that \[\omega(\gamma_{E_1},\gamma_{E_2}) \neq 0\,.\] \item[(ii)] $h \colon T \rightarrow M_\RR$ is a proper continuous map such that $h(R_T)=\theta$, $h(L_i) \subset A_i$ for every $1 \leq i \leq r$, and for every edge or leg $E$, the restriction $h|_E$ is an embedding with image contained in an affine line of oriented direction $\iota_{\gamma_E}\omega$, where the orientation is defined following the flow starting at the root of $T$ and ending at the leaves. \end{itemize} \end{definition} An isomorphism of parameterized attractor flow tree $h:T \to M_\RR$ and $h_0 :T_0 \to M_\RR$ is a homeomorphism $\Psi:T\to T_0$ respecting the marking of the legs, the weights of the edges and legs, and such that $h=h_0\circ \Psi$. An \emph{attractor flow tree} is an isomorphism class of parameterized attractor flow trees. We denote by $\mathcal{T}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\theta$ the set of $(\omega,\boldsymbol{\gamma})$-marked attractor flow trees with root $\theta$ and matching $\mathbf{A}$. Let $h: T\rightarrow M_\RR$ be an $(\omega,\boldsymbol{\gamma})$-marked attractor flow tree with root $\theta$ and matching $\mathbf{A}$. We denote by $\overline{T}$ be the graph obtained from $T$ by removing the root and viewing the edge $E_{\mathrm{out}}$ of $T$ adjacent to the root as a leg $L_{\mathrm{out}}$ of $\overline{T}$. We extend the map $h \colon T\rightarrow M_\RR$ to a map $\overline{h}:\overline{T} \rightarrow M_\RR$ by extending the segment $h(E_{\mathrm{out}})$ to a half-line in the direction of $-\iota_\gamma \omega$. By construction, $\overline{h}:\overline{T} \rightarrow M_\RR$ is an $(\omega,\boldsymbol{\gamma})$-marked tropical curve in $M_\RR$ matching $\mathbf{A}$, and such that $\theta \in \Int(\overline{h}(L_{\mathrm{out}}))$. \begin{definition} \label{def_family} Fix a point $\theta \in \gamma^{\perp}$ and a $\boldsymbol{\gamma}$-constraint $\mathbf{A}$. Let $(h:T \rightarrow M_\RR) \in \mathcal{T}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\theta$ be an $(\omega,\boldsymbol{\gamma})$-marked attractor flow tree with root $\theta$ and matching $\mathbf{A}$. The \emph{family of tropical curves corresponding to $h$} is the face $\rho_h$ of $\mathcal{M}^\mathrm{trop}_{\omega,\boldsymbol{\gamma}, \mathbf{A}}$ whose relative interior parametrize tropical curves with the same type as the tropical curve $\overline{h}: \overline{T} \rightarrow M_\RR$. \end{definition} \begin{lemma}\label{lem_flow_trees_nice} Fix a $\mathbf{\gamma}$-constraint $\mathbf{A}$ and a general point $\theta \in (\gamma^\perp)_\RR$ Then, for every $(\omega,\boldsymbol{\gamma})$-marked attractor flow tree $(h:T \rightarrow M_\RR) \in \mathcal{T}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\theta$, the family $\rho_h$ of tropical curves corresponding to $h$ satisfy the following conditions: \begin{itemize} \item[(i)] For every edge or leg $E$ of $\Gamma_{\rho_h}$, $\dim \fod_E^{\rho_h}=d-1$. \item[(ii)] For every vertex $v$ of $\Gamma_{\rho_h}$, $\dim T_v \Gamma_{\rho_h} =2$, and $\dim \foj_v^{\rho_h}=d-2$. \end{itemize} \end{lemma} \begin{proof} We prove the result by induction following the flow on $\Gamma_{\rho_h}$ starting at the root leg and ending at the leaves. For the initial step of the induction, note that $\dim \fod_{L_{\mathrm{out}}}^{\rho_h}=d-1$. Indeed, we have $\dim \fod_{L_{\mathrm{out}}}^{\rho_h}\leq d-1$ by Lemma \ref{lem_prep}(i), and if we had $\dim \fod_{L_{\mathrm{out}}}^{\rho_h}\leq d-2$, then $\theta$ would be constrained to lie in a strict hyperplane of $(\gamma^\perp)_\RR$, in contradiction with the assumption that $\theta$ is a general point of $(\gamma^\perp)_\RR$. For the induction step, let $E$ be a leg or vertex of $\Gamma_{\rho_h}$ such that $\dim \fod_E^{\rho_h}=d-1$. Denote by $v$ the child vertex of $E$ and $E_1,\dots,E_k$ the children edges of $v$. By Lemma \ref{lem_locally_planar}, the assumption that $\dim \fod_E^{\rho_h}=d-1$ implies that $\dim T_v \Gamma_{\rho_h}\leq 2$. On the other hand, by Definition \ref{def_attractor_tree}(i) of an attractor flow tree, there exists edges or legs $E'$ and $E''$ adjacent to $v$ such that $\omega(\gamma_{E'},\gamma_{E''})\neq 0$, and so in particular $\dim T_v \Gamma_{\rho_h} \geq 2$. We conclude that $\dim T_v \Gamma_{\rho_h}=2$ and so $\dim \foj_v^{\rho_h}=d-2$. Finally, $\dim T_v \Gamma_{\rho_h}=2$ and $\dim \fod_E^{\rho_h}=d-1$ imply that $\dim \fod_{E_i}^{\rho_h}=d-1$ for every child edge $E_i$ of $v$ by Lemma \ref{lem_key}. \end{proof} \begin{lemma} \label{lem_flow_tree} Fix a $\mathbf{\gamma}$-constraint $\mathbf{A}$ and a general point $\theta \in (\gamma^\perp)_\RR$ Let $(h:T \rightarrow M_\RR) \in \mathcal{T}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\theta$ be an $(\omega,\boldsymbol{\gamma})$-marked attractor flow tree with root $\theta$ and matching $\mathbf{A}$. Then for every edge $E$ of $T$, with parent vertex $v$ and child vertex $v'$, the point $h(v')$ in $M_\RR$ is the unique intersection point of the half-line $h(v)+\RR_{\geq 0}\iota_{\gamma_E}\omega$ with the affine codimension two plane $\cap_{i=1}^k A_{E_j}$, where $E_1,\dots, E_k$ are the children edges of $v'$, and the affine hyperplanes $A_{E_j}$ are defined as in \eqref{eq_AE}. \end{lemma} \begin{proof} By Definition \ref{def_attractor_tree}(ii), we have $h(v') \in h(v)+\RR_{\geq 0}\iota_{\gamma_E} \omega$. On the other hand, we have $h(v') \in \cap_{i=1}^k A_{E_i}$ by Lemma \ref{lem_prep}(ii). As $\iota_{\gamma_E} \omega \neq 0$, $h(v)+\RR_{\geq 0}\iota_{\gamma_E} \omega$ is a half-line line in $A_E$. As $\dim T_v \Gamma_{\rho_h}=2$ by Lemma \ref{lem_flow_trees_nice}, $\cap_{i=1}^k A_{E_i}$ is an affine hyperplane in $A_E$. Finally, as $\dim \fod_E^{\rho_h}=d-1$ by Lemma \ref{lem_flow_trees_nice}, $h(v)+\RR_{\geq 0}\iota_{\gamma_E} \omega$ is not contained in $\cap_{i=1}^k A_{E_i}$, and so the intersection $(h(v)+\RR_{\geq 0}\iota_{\gamma_E} \omega)\cap (\cap_{i=1}^k A_{E_i})$ consists of at most one point. One concludes that $(h(v)+\RR_{\geq 0}\iota_{\gamma_E} \omega)\cap (\cap_{i=1}^k A_{E_i})=\{h(v')\}$. \end{proof} \begin{lemma}\label{lem_tree_dim} Fix a $\mathbf{\gamma}$-constraint $\mathbf{A}$ and a general point $\theta \in (\gamma^\perp)_\RR$. Let $(h:T \rightarrow M_\RR) \in \mathcal{T}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\theta$ be an $(\omega,\boldsymbol{\gamma})$-marked attractor flow tree with root $\theta$ and matching $\mathbf{A}$. Let $v_{\mathrm{out}}$ be the unique vertex of $\Gamma_{\rho_h}$ adjacent to the root leg $L_{\mathrm{out}}$. Then, the evaluation map \begin{align*} \rho_h &\longrightarrow \foj_{v_{\mathrm{out}}}^{\rho_h}\\ \overline{h} &\longmapsto \overline{h}(v_{\mathrm{out}}) \end{align*} is a bijection. In particular, the dimension of the family $\rho_h$ of tropical curves corresponding to $h$ is $\dim \rho_h=d-2$. \end{lemma} \begin{proof} Following the flow on $\Gamma_{\rho_h}$ starting at the root leg and ending at the leaves, $\overline{h}$ is inductively uniquely determined by $\overline{h}(v_{\mathrm{out}})$ as in Lemma \ref{lem_flow_tree}. Moreover, we have $\dim \foj_{v_{\mathrm{out}}}^{\rho_h}=d-2$ by Lemma \ref{lem_flow_trees_nice}(ii). \end{proof} \subsection{The flow tree formula} \label{sec_flow_trees} Let $(Q,W)$ be a quiver with potential as in \S \ref{sec_dt_intro}. Let $\omega$ be the corresponding skew-symmetric form on $N=\mathbb{Z}^{Q_0}$ as in \eqref{Eq: Euler form}. We fix a dimension vector $\gamma \in N$ and a general stability parameter $\theta \in (\gamma^\perp)_\RR$. As reviewed in \eqref{eq_reconstruction_intro}, the DT invariant $\Omega_\gamma^\theta$ can be expressed in terms of the simpler attractor DT invariants in terms of universal coefficients $F_r^\theta(\gamma_1,\dots,\gamma_r)$ indexed by decompositions $\gamma=\sum_{i=1}^r \gamma_i$. These coefficients further decompose as \begin{equation}\label{eq_trees} F_r^\theta(\gamma_1,\dots,\gamma_r) =\sum_{h \in \mathcal{T}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}} F_{r,h}^\theta(\gamma_1,\dots,\gamma_r) \,,\end{equation} where $\boldsymbol{\gamma}=(\gamma_1,\dots,\gamma_r)$, $\mathbf{A}^0$ is the $\boldsymbol{\gamma}$-constraint defined by the linear hyperplanes $(\gamma_i^\perp)_\RR$, and the sum is over the $(\omega,\boldsymbol{\gamma})$-marked attractor flow trees with root $\theta$ and matching $\mathbf{A}^0$ as in Definition \ref{def_attractor_tree}. The decomposition \eqref{eq_trees} is obtained by iterative use of the wall-crossing formula. In general, the attractor flow trees $h \in \mathcal{T}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}$ may contain vertices of arbitrary high valency, as in \cite[\S3]{KS}. In this section, following \cite{ABflow}, we reformulate the flow tree formula of \cite{ABflow} expressing the coefficients $F_{r,h}^\theta(\gamma_1,\dots,\gamma_r)$ in terms of simpler trivalent tropical curves matching constraints $\mathbf{A}$ which are generic small perturbations of $\mathbf{A}^0$. For a $\boldsymbol{\gamma}$-constraint $\mathbf{A}$, recall from \eqref{Eq: Phi} that we have a map \begin{equation} \Phi \colon \{\mathrm{Faces~of~} {\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}} \} \longrightarrow \{\mathrm{Faces~of~} {\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0} \}\,. \end{equation} For every face $\sigma$ of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}$, $\Phi(\sigma)$ is the face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}$ obtained from $\sigma$ by rescaling $\mathbf{A}$ to $\mathbf{A}^0$ in the space $\prod_{i=1}^r M_\RR/(\gamma_i^\perp)_\RR \simeq \RR^r$ of $\boldsymbol{\gamma}$-constraints. Finally, recall that for every attractor tree $h \in \mathcal{T}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\theta$, we defined in Definition \ref{def_family} the corresponding family of tropical curves $\rho_h$, which is a face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}$. By Lemma \ref{lem_tree_dim}, we have $\dim \rho_h=d-2$. Hence, if $\mathbf{A}$ is a general $\boldsymbol{\gamma}$-constraint as in Definition \ref{def_general_constraints}, and $\sigma$ is a face of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}$ such that $\Phi(\sigma)=\rho_h$, then $\dim \sigma=d-2$ and $\Gamma_\sigma$ is trivalent. \begin{theorem} \label{thm_F_trop} Fix a general point $\theta \in (\gamma^\perp)_\RR$ and an attractor flow tree $(h\colon T\rightarrow M_\RR) \in \mathcal{T}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}^\theta$. Then, for every general $\boldsymbol{\gamma}$-constraint $\mathbf{A}$, we have \begin{equation} \label{eq:flow_to_trop} F_{r,h}^\theta(\gamma_1,\dots,\gamma_r) = \sum_{\sigma\in \Phi^{-1}(\rho_h)} \prod_{v \in V(\Gamma_\sigma)} |\omega(\gamma_{E_{1,v}},\gamma_{E_{2,v}}) | \, , \end{equation} where for every vertex $v \in V(\Gamma_\sigma)$, $E_{1,v}$ and $E_{2,v}$ are the two children edges of $v$. \end{theorem} \begin{proof} We explain below how Theorem \ref{thm_F_trop} follows from the flow tree formula given in \cite[Theorem 5.6]{ABflow}. In \cite{ABflow}, we introduce a bigger lattice $\mathcal{N}:=\bigoplus_{i=1}^r \mathbb{Z} e_i$ and we consider the map $p \colon \mathcal{N} \rightarrow N$ defined by $e_i \mapsto \gamma_i$. We also define the pullback skew-symmetric form $\eta$ on $\mathcal{N}$ by $\eta(e_i,e_j) := \omega(\gamma_i, \gamma_j)$. By duality, we have a map $q : M_\RR \rightarrow \mathcal{M}_\RR=\Hom(\mathcal{N},\RR)$. Let $\tilde{\theta}$ be a small generic perturbation of $ q(\theta)$ in $(\sum_{i=1}^r e_i)^{\perp}$. Then, \cite[Thm.$5.6$]{ABflow} states that \begin{equation}\label{eq_ftf}[F_r^\theta(\gamma_1,\dots,\gamma_r):=\sum_{T_r} \prod_{v\in V_{T_r}^\circ} -\epsilon_{{T_r},v}^{\tilde{\theta},\omega} \eta(e_{v'},e_{v''}) \,,\end{equation} where the sum is over rooted binary trees ${T_r}$ with $r$ leaves decorated by $\{e_1,\dots,e_r\}$, $V_{T_r}^\circ$ denotes the set of vertices of $T_r$ distinct from the root, for any $v \in V_{T_r}^\circ$, $e_v \in \mathcal{N}$ is the sum of $e_i$'s attached to leaves descendant from $v$, and $\epsilon_{T_r,v}^{\tilde{\theta},\omega} \in \{ -1,0,1 \}$ is defined in \cite[Eq.\! (1.11)]{ABflow} in terms of the discrete attractor flow \cite[Eq.\! (1.10)]{ABflow} embedding the trees $T_r$ in $\mathcal{M}_\RR$. Note that \cite[Theorem 5.6]{ABflow} is actually stated for the refined DT invariants, in which case $F_r^\theta(\gamma_1,\dots,\gamma_r)$ is a function of an additional variable $y$, and we obtained \eqref{eq_ftf} by taking the limit $y \rightarrow -1$ to recover the case of numerical DT invariants $\Omega_\gamma^{+,\theta}$ defined in \eqref{eq_dt_intro} (the limit $y \rightarrow 1$ corresponding to the signed DT invariants $\Omega_\gamma^\theta$). As explained in \cite[Remark 4.25]{ABflow}, the trees embedded in $\mathcal{M}_\RR$ by the discrete attractor flow are contained in a copy of $M_\RR$ in $\mathcal{M}_\RR$. Moreover, it follows from the proof of \cite[Eq.\! (4.57)]{ABflow} and from Lemma \ref{lem_flow_tree} that these embedded trees are exactly attractor flow trees as in Definition \ref{def_attractor_tree}, with root at a general point $\tilde{\theta}$ of $A_{L_{\mathrm{out}}}$ close enough to $\theta$, and matching a small generic perturbation $\mathbf{A}$ of the constraint $\mathbf{A}^0$, if and only if $\epsilon_{T_r,v}^{\tilde{\theta},\omega} \neq 0$, and that in this case, $-\epsilon_{{T_r},v}^{\tilde{\theta},\omega}$ has the same sign as $ \eta(e_{v'},e_{v''})$ (see the paragraph above \cite[Eq.\! (4.52)]{ABflow}). In particular, a tree $T_r$ with a non-zero contribution to \eqref{eq_ftf} contributes $\prod_{v\in V_{T_r}^\circ}| \eta(e_{v'},e_{v''})|$, and so \eqref{eq:flow_to_trop} follows from \eqref{eq_ftf}. \end{proof} \begin{remark} Theorem \ref{thm_F_trop} could also be deduced from \cite[Theorem 4.4]{mandel2020disks} expressing the functions attached to the walls of a scattering diagram in terms of tropical disks. The proof of \cite[Theorem 5.6]{ABflow} is also based on the study of a scattering diagram in $\mathcal{M}_\RR$ which can be viewed as a universal family for the perturbed scattering diagrams in $M_\RR$ considered in \cite[Theorem 4.4]{mandel2020disks} (see \cite[Remark 4.25]{ABflow}). \end{remark} \subsection{The quiver DT-log Gromov--Witten correspondence} \label{sec_dt_gw} Let $(Q,W)$ be a quiver with potential as in \S \ref{sec_dt_intro}. Let $\omega$ be the corresponding skew-symmetric form on $N=\mathbb{Z}^{Q_0}$. We fix a dimension vector $\gamma \in N$ such that $\iota_\gamma \omega \neq 0$ and a decomposition $\gamma=\sum_{i=1}^r \gamma_i$ such that $\iota_{\gamma_i}\omega \neq 0$ for all $1\leq i\leq r$. We denote $\boldsymbol{\gamma}=(\gamma_1,\dots,\gamma_r)$. We also fix a general stability parameter $\theta \in (\gamma^\perp)_\RR$. In this section, we prove our main result relating the coefficients $F_r^\theta(\gamma_1,\dots,\gamma_r)$ in \eqref{eq_reconstruction_intro}-\eqref{eq_trees_intro}, expressing DT invariants in terms of attractor DT invariants, and log Gromov--Witten invariants of toric varieties. Recall that given an attractor flow tree $(h: T \rightarrow M_\RR)\in \mathcal{T}_{\omega,\boldsymbol{\gamma}, \mathbf{A}^0}^\theta$, we defined in Definition \ref{def_family} the corresponding family of tropical curves $\rho_h$: it is a face of $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}^\mathrm{trop}$ such that $\dim \rho=d-2$ by Lemma \ref{lem_tree_dim} and $\dim \fod_{L_{\mathrm{out}}}^{\rho_h}=d-1$ by Lemma \ref{lem_flow_trees_nice}. Given a $\boldsymbol{\gamma}$-fan $\Sigma$ as in Definition \ref{def_gamma_fan}, we denote by $\widetilde{\rho}_h$ the $(d-2)$-dimensional face of $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}^\mathrm{trop}(\Sigma)$ contained in $\rho_h$ and containing $\theta$. In particular, one can consider as in \eqref{eq_N_toric} the genus $0$ log Gromov--Witten invariant $N_{\widetilde{\rho}_h}^{\mathrm{toric}}(X_\Sigma)$ of the toric variety $X_\Sigma$ of fan $\Sigma$, and the tropical coefficient $k_{\widetilde{\rho}_h}$ defined as in \eqref{eq_coeff}. Note that $N_{\widetilde{\rho}_h}^{\mathrm{toric}}(X_\Sigma)$ is actually an enumerative count of log curves by Theorem \ref{thm_enum}. \begin{theorem}[\textbf{Theorem \ref{thm_dt_gw_intro}}] \label{thm_dt_gw} Fix a general stability parameter $\theta \in (\gamma^\perp)_\RR$ and an attractor flow tree $(h: T \rightarrow M_\RR)\in \mathcal{T}_{\omega,\boldsymbol{\gamma}, \mathbf{A}^0}^\theta$. Then, for every $\boldsymbol{\gamma}$-fan $\Sigma$, the coefficient $F_r^\theta(\gamma_1,\dots,\gamma_r)$ in \eqref{eq_reconstruction_intro}-\eqref{eq_trees_intro}, satisfies \begin{equation} \label{eq_dt_log} F_{r,h}^\theta(\gamma_1,\dots,\gamma_r) = \frac{\prod_{i=1}^r |\gamma_i|}{|\gamma|} k_{\widetilde{\rho}_h} N_{\widetilde{\rho}_h}^{\mathrm{toric}}(X_\Sigma)\,.\end{equation} \end{theorem} \begin{proof} Fix a general $\boldsymbol{\gamma}$-constraint $\mathbf{A}$, which exists by Lemma \ref{lem_dimension}. Then, Theorem \ref{thm_F_trop} expresses the coefficient $F_{r,h}^\theta(\gamma_1,\dots,\gamma_r)$ in terms of the $(d-2)$-dimensional faces $\sigma$ of the moduli space $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{A}}^\mathrm{trop}$ of $(\omega,\boldsymbol{\gamma})$-marked tropical curves matching $\mathbf{A}$ as \begin{equation} \label{eq_proof_11} F_{r,h}^\theta(\gamma_1,\dots,\gamma_r) = \sum_{\sigma\in \Phi^{-1}(\rho_h)} \prod_{v \in V(\Gamma_\sigma)} |\omega(\gamma_{E_{1,v}},\gamma_{E_{2,v}}) | \,. \end{equation} Using the product formula for tropical multiplicities in Lemma \ref{lem: product2 for Ntrop}, this can be rewritten in terms of the tropical multiplicities $N_\sigma^\mathrm{trop}$ defined in \eqref{eq_N_trop}, and of the tropical coefficients $k_\sigma$ are defined in \eqref{eq_coeff}, as \begin{equation} \label{eq_proof_12} F_{r,h}^\theta(\gamma_1,\dots,\gamma_r) = \frac{\prod_{i=1}^r |\gamma_i|}{|\gamma|}\sum_{\sigma\in \Phi^{-1}(\rho_h)} k_\sigma N_\sigma^\mathrm{trop} \, . \end{equation} On the other hand, by the log-tropical correspondence of Theorem \ref{Thm:log_trop_thm}, we have \begin{equation}\label{eq_proof_13} k_{\widetilde{\rho}_h} N_{\widetilde{\rho}_h}^{\mathrm{toric}}(X_\Sigma)=\sum_{\sigma\in S_{\widetilde{\rho}_h}} k_\sigma N_\sigma^{\mathrm{trop}} \,, \end{equation} where $S_{\widetilde{\rho}_h}$ is the set of faces $\sigma$ of ${\mathcal{M}}^\mathrm{trop}_{\omega,\boldsymbol{\gamma},\mathbf{A}}$ such that $\widetilde{\rho}_h \subset \Phi(\sigma)$. As $\rho_{h}$ is the $(d-2)$-dimensional face of $\mathcal{M}_{\omega,\boldsymbol{\gamma},\mathbf{A}^0}$ containing $\widetilde{\rho}_h$, the set $\Phi^{-1}(\rho_h)$ of $\sigma$'s such that $\Phi(\sigma)=\rho_h$ coincides with the set $S_{\tilde{\rho}_h}$ of $\sigma$'s such that $\tilde{\rho}_h \subset \Phi(\sigma)$, and so \eqref{eq_dt_log} follows by combining \eqref{eq_proof_12} and \eqref{eq_proof_13}. \end{proof}
\section{Introduction} \label{sec:intro} Nuclear Star Clusters (NSCs) and Supermassive Black Holes (SMBHs) are found to coexist within the central parsec (pc) of many different types of galaxies \citep{Graham_2009}. Furthermore, there are clear indications that NSCs, SMBHs, and their host galaxies evolve together. For example, \citet{Ferrarese_2006} found that the $M - \sigma$ relationship, the empirical correlation between the mass of the SMBH, $M$, and the stellar velocity dispersion $\sigma$ of the galaxy's bulge, applies both for SMBHs and NSCs with similar slopes, although at a certain $\sigma$, NSCs are 10 times more massive than SMBHs. Additionally, \citet{Kormendy_2013} showed that the combined mass of the SMBH and NSC scales with a galaxy's bulge mass with much less scatter than either the SMBH or the NSC separately, which suggests a strong dependency between their mutual formation and growth. The formation mechanism for NSCs is still widely debated as the strong tidal force at the Galactic Center will disrupt normal star formation. Our own Galactic Center provides a unique test bed for understanding star formation around SMBHs since it harbors a population of around 200 young massive stars within 0.5 pc of the central SMBH, SgrA$^\ast$ \citep{Genzel_2000}, including OB main-sequence stars, Wolf-Rayet (WR) stars, giants, and supergiants \citep{Paumard_2006, Bartko_2010}. Because the age of this population \citep[3 - 8 Myr][]{Lu_2013} is much less than the relaxation timescale in the Galactic Center ($\gtrsim$ 1Gyr, \citet{Hopman_2006}), the origin of these stars can be constrained through studies of their dynamical structures. Only in the Galactic Center can we resolve individual stars and measure their motion, photometry, and spectroscopy with sufficient precision to constrain their dynamics and therefore constrain theories of star formation around SMBHs. Observations of young stars at the Galactic Center currently favor \textit{in situ} formation models, meaning that young stars are formed roughly where we see them today, within 0.5 pc of the SMBH \citep{Paumard_2006, Lu_2009, Meyer_2015}. $\textit{In situ}$ formation is theoretically possible in an accretion disk around the SMBH, if it is massive enough to collapse vertically under its own self-gravity \citep{Kolykhalov_1980,Morris_1996,Sanders_1998,Goodman_2003,Levin_2003,Nayakshin_2005}. When a disk reaches a surface density that is just large enough to initiate star formation, the first protostars form. Feedback from those stars will then heat the disk up to a point where it stabilizes against collapse and shuts off further disk fragmentation. In the meantime, those stars remain embedded in the disk and continue gaining mass at very high rates. As a result, an average star created in such a disk may become very massive. This process happens throughout the disk, from $\sim$0.01 pc to a few parsecs, with a peak effect at R $\sim$ 0.1 pc \citep{Morris_1996, Vollmer_2001, Nayakshin_2005, Nayakshin_2006_massivestar}. This scenario can explain the existence of the disk of stars and the top-heavy Initial Mass Function (IMF) in our Galactic Center \citep{Lu_2013}, although it may not be the only explanation. However, if the disk is formed through steady accretion of gas, stars with circular orbits are more likely to form, which may contradict the observed eccentricity distribution that peaks at e=0.27 \citep{Yelda_2014}. Furthermore, only 20\% of the young stars are estimated to be in the disk and it is not clear whether 80\% of the stars could be scattered from the disk in only 4 - 8 Myr. Modified \textit{in situ} formation scenarios have been proposed, including: (a) the initial gas is not uniformly distributed, (b) stars form in repeated episodes, (c) after the gas disk collapses, the stars that form in it dynamically evolve off the disk. These formation scenarios can be disentangled by comparing the dynamical structures among different dynamical sub-groups. For example, if the initial gas is not uniformly distributed, we should see asymmetric sub-structures in their stellar systems. Previous studies show that the young stars at the Galactic Center can be divided into three dynamical groups: (1) $\thicksim 12\%$ of the young stars (within 0.03 pc) are in the innermost region with high eccentricities $\bar{e} = 0.8$ and randomly oriented orbits. (2) $\thicksim 20\%$ of the young stars are on a well-defined clockwise (CW) rotating disk (0.03 - 0.5 pc) with moderate eccentricities $\bar{e} = 0.3$. (3) $\thicksim 68\%$ of them are off-disk stars that extend over the same radius but have a more random distribution and eccentricity distribution with higher $\bar{e} = 0.6$ \citep{Lu_2013, Yelda_2014}. At smaller radii, dynamical effects will randomize the stellar orbits within 4-6 Myr, which is the case for the first group. The existence of the CW disk has already been verified to be significant ($\sim 20 \sigma$) \citep{Paumard_2006,Bartko_2010,Lu_2009,Yelda_2014}. More recently, as many as 5 distinct sub-structures, including the CW disk, have been proposed by \citet{von_Fellenberg_2022}. \edit1{A detailed comparison between our result and previous work is presented in \S\ref{sec:discuss_previous} and Appendix \ref{app:comp}.} In this paper, we present improved dynamical measurements of the young stars at the Galactic Center derived from adaptive optics observations from the 10m Keck telescopes. We conduct novel simulations and comparative analyses of the properties of the different dynamical sub-groups of young stars within the central 0.5 pc of our Galaxy. The observational setup and data reduction are presented in Section \ref{sec:obs}. Orbital parameters are derived in \S\ref{sec:orbitfit} and the disk membership analysis is shown in \S\ref{sec:disk}. Results of stellar disk properties and cluster simulations are presented in \S\ref{sec:result}. We discuss our findings in \S\ref{sec:discussion} and summarize in \S\ref{sec:summary}. \section{Observations and Data Reduction} \label{sec:obs} The kinematic analysis of the young stars at the Galactic Center requires both proper motion and radial velocity (RV) measurements in order to determine their orbital planes and disk membership probability. Details of the observations, data reduction, and image analysis are presented in \citet{Jia_2019} and \citet{Do_2009}. Here, we briefly summarize the analysis methods most relevant to this work. The photometry for those young stars is extracted from a deep, wide mosaic image \citep{Lu_2013}. We applied the \edit1{full} extinction map from \cite{Schodel:2010} to correct extinction \edit1{with an average value of} $A_{ks}=2.7$. \subsection{Sample Selection} \label{sec:sample} In this work, we included all spectroscopically identified young (early-type) stars with well measured radial velocities (RV) and proper motions. To get a young star list \edit1{with well-understood completeness}, we combined new Galactic Center OSIRIS Wide-field Survey (GCOWS) observations (\S\ref{sec:obs_rv}) with previous GCOWS observations \citep{Do_2013} and with other spectral types from the literature. The GCOWS survey consists of observations with the Keck OSIRIS spectrograph behind the laser-guide-star adaptive optics system on the W. M. Keck Observatory \citep{Larkin:2006}. We obtained diffraction-limited, medium spectral-resolution (R $\sim$ 4000) spectra with the Kn3 filter (2.121-2.220 $\micron$). We used two different plate scales: 35 mas in the central fields where the stellar densities are highest and 50 mas for the outer fields having relatively lower stellar density. Details on the GCOWS survey are presented by \citet{Do_2009} and \citet{Do_2013}, who investigated young stars located in the central region and eastern field in the GC (green boxes in Figure \ref{fig:sample}). In this work, we have added new observations in the South and North (magenta boxes in Figure \ref{fig:sample}). The new spectroscopic observations are reported in Table \ref{tab:newobs}. Data were reduced using the latest version of the OSIRIS data reduction pipeline \citep{2017ascl.soft10021L, Lockhart_2019}. This resulted in 7 more young stars with good quality RVs: S10-261, S10-48, S11-176, S11-21, S11-246, S12-76, S5- 106 (see \S\ref{sec:obs_rv} for reduction details). The sample of GCOWS stars used in this work includes those that are spectroscopically identified as early-type and that have sufficient Signal-to-Noise ratio (SNR) to measure a radial velocity (RV). \input{OSIRIS_Obs_table} Then, we combined our list of young stars with those identified by Paumard, Bartko, and Feldmeier \citep{Paumard_2006, Bartko_2009, Feldmeier_2015}. S2-66 was claimed to be young by \citet{Paumard_2006}, but later proven to be old by \citet{Do_2009}, so this star was excluded. From all the sources combined, the sample consisted of RVs for 149 young stars. Unfortunately, \citet{Paumard_2006} and \citet{Bartko_2009} did not report their spectral completeness curve, so we cannot use stars that are found only in their paper. \edit1{This is because we require spectroscopic completeness information for each star, which is crucial in \S\ref{sec:disk_simulation} when comparing observed and simulated stellar distributions.} However, we can still use their RV for stars that are identified in GCOWS or \citet{Feldmeier_2015}, which leaves us 91 stars with both RV and completeness correction curves. Among those stars, we are able to extract proper motion for 88 stars from a combination of Keck AO observations in the inner region and HST observations in the outer region (see \S\ref{sec:obs_pm} for details). The spatial distribution of our young star sample is plotted in Figure \ref{fig:sample}. Although seven new young stars were identified from the new GCOWS observations, S10-261 does not have a measured proper motion, so only six new stars are included in our sample, as shown in Figure \ref{fig:sample}. In summary, we have 88 young stars in our sample, extending out to 14\arcsec\ ($\thicksim 0.5$ pc), down to a 90\% limiting magnitude of K$_\mathrm{lim}$= 15.3. \begin{figure}[htp] \centering \includegraphics[width=0.5\textwidth]{sample_spatial_distribution.png} \caption{The spatial distribution of our final sample of 88 stars. Red circles are the 50 stars from our GCOWS observations and blue squares are the 38 stars from \citet{Feldmeier_2015}. The dashed lines show our GCOWS sky coverage, where the green boxes are fields previously published by \citet{Do_2013} and magenta boxes are new areas first published in this paper.} \label{fig:sample} \end{figure} \subsection{Radial Velocities} \label{sec:obs_rv} As mentioned in \S\ref{sec:sample}, RVs used in this work come from two sources: (1) Our GCOWS survey from Keck observations \citep{Do_2009, Do_2013}, and (2) other published RV data for Galactic Center, including \citet{Paumard_2006}, \citet{Bartko_2009}, \citet{Feldmeier_2015} and \citet{Zhu_2020}. We derive radial velocities for all Keck OSIRIS data (both previously reported and new) using full spectral fitting with a synthetic spectral grid. We use the spectral fitting code StarKit \citep{Kerzendorf_2015} to fit the radial velocity along with physical properties such as effective temperature, surface gravity, metallicity, and rotational velocity. By fitting the physical parameters simultaneously, we can capture the effect of correlations between the parameters. We use the BOSZ spectral grid \citep{Bohlin_2017} to generate the spectra for our Bayesian inference model. Additional discussion of this method is given by \citet{Do_2018,Do_2019}. In general, the statistical uncertainties dominate the radial velocity measurement, but for the brightest sources, the systematic uncertainties dominate at the level of about 11 km s$^{-1}$ mainly due to residuals from the OH line subtraction. See \citet{Do_2019} for a complete discussion of radial velocity systematic uncertainties. Both \citet{Paumard_2006} and \citet{Bartko_2009} used the AO-assisted, near-infrared integral field spectrometer SPIFFI/SINFONI on ESO VLT. Since \citet{Bartko_2009} is claimed to have improved measurements relative to \citet{Paumard_2006}, we will always adopt the RV from \citet{Bartko_2009} if the reported RVs \footnote{We assume stars are not in binary systems.} are different between the two papers. \citet{Feldmeier_2015} used the integral-field spectrograph, KMOS, on VLT. For IRS 13E2, IRS 13E3 and IRS 13E4, \citet{Zhu_2020} report the latest RVs with smaller uncertainties, so we adopt their measurements for those three stars. We match the catalogs from the literature with star-lists from our high-resolution images based on stars' magnitudes and positions. However, due to different spatial resolutions between our observations and other published observations, not all stars can be matched. For example, star 3308 from \citet{Feldmeier_2015} is matched to a clump of 3 stars in our image, and it is difficult to determine which one produces the RV signal they report. All RVs that are successfully matched to our catalogs are reported in Table \ref{tab:rv}. For stars detected in GCOWS, we always use the GCOWS RV measurements. Most stars have only one detection, which is adopted as their final RV measurement. Some stars in the central region have multiple detections, which are marked with asterisks in Table \ref{tab:rv}. For those multiple-detection stars, we will use the weighted mean RV if they are detected less than 5 times or show no significant physical acceleration. However if stars show significant acceleration in either proper motion or RV (S0-1, S0-2, S0-3, S0-4, S0-5, S0-8, S0-16, S0-19, S0-20, see details in Chu et al. in prep), they will be fit with a full Keplerian orbit in \S\ref{sec:efit}. For stars not detected in our GCOWS database, we use their literature RVs. For stars reported multiple times in the literature, we use the weighted mean RV, where the weight, $w$, is: \begin{equation} w = \frac{1}{\sigma_\mathrm{RV}^{2}} \end{equation} All stars with RVs from the literature agree with each other within 2 sigma, except S7-236, for which we adopt the most recent RV from \cite{Feldmeier_2015}. \subsection{Spectroscopic Completeness} \label{sec:completeness} \begin{figure}[htp] \centering \includegraphics[width=0.5\textwidth]{completeness.png} \caption{Completeness curve as a function of magnitude $K_p$ for data from \cite{Feldmeier_2015} (top) and for our data (bottom). Completeness for \citet{Feldmeier_2015} is a linear interpolation from the 80\% completeness and 50\% completeness point they reported in their paper. Completeness also depends on radius; inner regions are less complete because of crowding. Completeness from our observations (red line) is a product of imaging completeness and spectral completeness, but is mostly determined by spectral completeness. The dip in $K_p$ = 13 is probably a result of the fact that stars are transitioning to main sequence at that stage, so most spectra we get in that magnitude bin are featureless and are without usable RV. } \label{fig:completeness} \end{figure} In order to properly correct for incompleteness in our selection sample, we utilize results from star-planting simulations. The sample was selected from two sources: \citet{Feldmeier_2015} and GCOWS, and we describe the completeness for each below. For stars in the GCOWS observations, the completeness $C$ is a product of imaging completeness, $C_{img}$, and spectral completeness, $C_{spec}$. Imaging completeness is estimated using star-planting simulations (see details in Appendix C.1 of \citet{Do_2013}), and is 90\% complete down to Kp=16, as shown in Figure \ref{fig:completeness}. \edit1{Uncertainties in the completeness are shown in the lower panel of Figure \ref{fig:completeness} and are derived from the number of observed stars at given magnitude (see details also in \citet{Do_2013}).} For spectral completeness $C_{spec}$, we follow a process similar to that in \citet{Do_2013}, where each star from the GCOWS survey is assigned a probability of being young $P_E$. So for young stars, $P_E$ = 1; for old stars, $P_E$ = 0; for unknown type stars, $P_E$ is simulated based on the Bayesian evidence for the early-type and late-type hypotheses using the known type stars as a training sample. However, not all young stars have spectra with good enough quality to measure RV. Therefore, the completeness used in this work is defined as "completeness for young stars with measured RV". Stars are divided into 8 magnitude bins based on extinction-corrected magnitudes, Kp$_\mathrm{ext}$, from 9 to 17 with 1 magnitude interval, and the spectral completeness curve is a linear interpolation. In each magnitude bin, the completeness $C_{spec}$ is calculated using the following equation: \begin{equation} C_{spec} = \frac{N_{yngRV} + N_{yngWR}}{N_{yng} + \sum_{unk}P_{E}} \end{equation} where $N_{yngRV}$ is the number of young stars with well-measured RV, $N_{yngWR}$ is the number of WR young stars, $N_{yng}$ is the total number of young stars (including all spectrally identified young stars, no matter whether they have well-measured RV or not) and $\sum_{unk}P_{E}$ is the sum of the probability of being young for all unknown type stars. WR stars are all very bright and have high SNR spectra, but currently we cannot fit their emission lines due to lack of a good model. So we decided to include WR stars in the numerator, since the missing RVs from them are not because of incompleteness. The total completeness for young stars with RV is shown with the red line in Figure \ref{fig:completeness}. Usually completeness will decrease towards fainter magnitudes, but a dip in the completeness curve appears at $Kp$ = 13. This is because young stars are at the pre-main sequence turn-off point at this magnitude, so they are partially obscured by dust, making them harder to study. For stars from \citet{Feldmeier_2015}, those authors reported 80\% and 50\% completeness in different radial bins. A linear interpolation is derived based on those two data points. Notice that their completeness is based on extinction-corrected magnitudes, $Kp_\mathrm{ext}$, but we assume it is a reasonable approximation to the completeness curve in the observed magnitude system. The completeness curve for \citet{Feldmeier_2015} stars is shown in Figure \ref{fig:completeness}. \begin{figure}[htp] \centering \includegraphics[width=0.45\textwidth]{completeness_example} \caption{An example of completeness map at $k_p$=15 with color showing the completeness. For stars at this magnitude, completeness is higher in our curve, so GCOWS completeness is adopted for observed GCOWS regions (darker polygons) while completeness from \citet{Feldmeier_2015} is adopted elsewhere (two concentric circles separating regions with radial distances $r < 5''$, $5'' \leq r < 10''$, and $10'' \leq r$).} \label{fig:completeness_example} \end{figure} When determining which completeness to use for each star, we first need to determine whether this star is within our GCOWS field. If a star is within our GCOWS field, we will use the higher completeness fraction between GCOWS and \citet{Feldmeier_2015}. Otherwise, completeness from \citet{Feldmeier_2015} will be applied. An example of our completeness map at $K_p$ = 15 is shown in Figure \ref{fig:completeness_example}. \subsection{Position, Proper motion and Acceleration} \label{sec:obs_pm} Projected positions and proper motions on the sky are derived from high-resolution, infrared (IR) images obtained over a 10$-$25 yr time-baseline. Depending on the distance from Sgr A*, we either use observations from the 10 m telescopes at the W. M. Keck Observatory (WMKO) or the Hubble Space Telescope (HST), as described below. (1) The central 10\arcsec $\times$ 10\arcsec\; region of the GC (approximately centered on Sgr A*) has been monitored with diffraction-limited, near-infrared imaging cameras at WMKO since 1995. For stars in this region, we have the longest time baseline and the highest spatial resolution, which gives precise proper motions and even significant accelerations on the sky plane. The complete catalog of measured positions, proper motions, and accelerations and analysis details is presented in \citet{Jia_2019}. (2) To measure the proper motions of the young stars at larger radii, we use a widely dithered mosaic of shallow Keck IR images covering a 22\arcsec $\times$ 22\arcsec\ FOV as described in \citet{Sakai_2019}. The astrometric uncertainties in this mosaicked dataset are typically larger than in the central 10\arcsec\ data, because of the shorter time baseline and lower SNR. (3) For stars at even larger radii (R $>$ 7\farcs5), we use proper motions measured from the HST WFC3-IR instrument. This dataset consists of 10 epochs of observations centered on Sgr A* that were obtained between 2010 -- 2020 in the F153M filter (2010.5: GO 11671/PI Ghez, 2011.6: GO 11671/PI Ghez, 2012.6: GO 12318/PI Ghez, 2014.1: GO 13049/PI Do, 2018.1: GO 15199, PI Do, 2019.2: GO 15498/PI Do, 2019.6: GO 16004/PI Do, 2019.7: GO 16004/PI Do 2019.8: GO 16004/PI Do, 2020.2: GO 15894/PI Do). While the HST spatial resolution is $\sim$2.5 times lower than that achieved with the Keck observations (FWHM $\sim$ 0.17" versus FWHM $\sim$ 0.06"), HST's FOV of 120" $\times$ 120" is much larger than can be realistically achieved with current AO systems. The astrometry from each HST epoch is first transformed into the \emph{Gaia} absolute reference frame \citep{Mignard_2018} and then further transformed into the AO reference frame via 2nd-order bivariate polynomial transformations. The resulting HST catalog achieves an average precision of 0.33 mas and 0.07 mas/yr for the positions and proper motions of the stars in the sample. A detailed description of the HST catalog will be provided in a future paper (Hosek et al., in prep). In summary, among 91 young stars from our sample described in \S\ref{sec:sample}, we are able to cross-match and measure proper motions for 88 stars. The proper motions for the final sample include 54 stars from data set 1, 20 from data set 2, and 14 from data set 3, as shown in Table \ref{tab:pm}. \subsection{Photometry and Extinction} To ensure that our final sample shares a common photometric system, we adopt the Kp magnitude for each star from the deep wide mosaic image analysis reported in \citet{Lu_2013} which covers all 88 stars in our sample. The Kp magnitude for each star is reported in the Kp column in Table \ref{tab:pm}. Then we applied the latest extinction map from \citet{Lara_2018} to differentially de-redden all stars to a common $A_{Ks} = 2.7$, and the extinction corrected magnitude is reported as $Kp_\mathrm{ext}$ in Table \ref{tab:pm}. \section{ORBIT ANALYSIS} \label{sec:orbitfit} For stars with measured ($x_0$, $y_0$, $v_x$, $v_y$, $v_z$, $a_R$), the six Keplerian orbit parameters (inclination $i$, angle to the ascending node $\Omega$, time of periapse passage $T_0$, longitude of periapse $\omega$, period $P$, and eccentricity $e$) can be analytically determined if the central potential is known \citep{Lu_2009}. \S\ref{sec:mc} describes the Monte Carlo process used to estimate stars' orbital parameters given prior estimates on the central potential. For stars that show significant acceleration (S0-1, S0-2, S0-3, S0-4, S0-5, S0-8, S0-16, S0-19, S0-20), their orbits are best constrained by simultaneously fitting the astrometry and RV measurements as a function of time \citep{Do_2019}. \S\ref{sec:efit} describes the computationally expensive orbit fitting procedure used for these 9 stars. \subsection{MC analysis for stars with ($x_0$, $y_0$, $v_x$, $v_y$, $v_z$, $a_R$) } \label{sec:mc} \begin{figure*}[htp] \centering \includegraphics[width=\textwidth]{mc_example} \caption{Examples of MC analysis for S1-3 (top), S3-190 (middle) and S7-10 (bottom). The left three columns show the density map for orbital parameters: $e$, $i$, $\Omega$. The right two columns show the MC simulation input prior for $z$ and $a_R$ in orange histograms. For S1-3 and S3-190, their measured $a_R$ and $\sigma_{a_R}$ (red dashed line) are within the upper and lower limits (vertical red dashed lines), so the simulated $a_R$ are drawn from Gaussian distribution N $\sim$ ($a_R$, $\sigma_{a_R}$). For S7-10, no $a_R$ is measured, so it is drawn from a uniform distribution between ${a_R}_{min}$ and ${a_R}_{max}$. Simulated $z$ is then derived from simulated $a_R$ using Equation \ref{eqn:z}. } \label{fig:mc} \end{figure*} Orbital parameters are determined for the 79 stars without significant acceleration measurements using a Monte Carlo (MC) analysis as described in detail in \citet{Lu_2009} and \citet{Yelda_2014}. Each star has measurements of the line-of-sight velocity ($v_z$) as described in \S\ref{sec:obs_rv} and proper motion parameters ($x_0$, $y_0$, $v_x$, $v_y$) as described in \S\ref{sec:obs_pm}. The absolute value of the line-of-site distance |$z$| between the star and Sgr A$^*$ can be calculated from the following equation if $a_R$ is known. \begin{equation} \label{eqn:z} a_R = - \frac{G M_{tot}(r) R}{r^3}, r = \sqrt{R^2 + z^2} \end{equation} Here, $r$ is the 3D distance and $R$ is the 2D projected sky-plane distance from Sgr A*, where $r^2 = R^2 + z^2$. We note that there is a sign ambiguity in the line-of-sight distance. We sample the 6 measured position, velocity, and acceleration quantities $10^5$ times assuming a Gaussian distribution for each measurement and its uncertainty. For each sample, the 6 Keplerian orbital parameters are analytically determined assuming an enclosed mass and distance to the Galactic Center as described below. The MC simulations produce a joint probability density function (PDFs) for the 6 orbital parameters. The mass distribution giving rise to the central potential, $M_{tot}$, is a combination of the SMBH mass and an extended mass profile: \begin{equation} M_{tot}(r) = M_{BH} + M_{ext}(r) \end{equation} The adopted SMBH properties include a mass of $M_{BH}$ = (3.975 $\pm$ 0.058) $\times$ $10^6$ $M_{\odot}$ and a distance of $R_0$ = (7.959 $\pm$ 0.059) kpc, based on the analysis of S0-2's orbit \citep{Do_2019}. We used the extended mass profiles from \citet{Trippe_2008} and found that adding extended mass has limited impact on the orbit analysis. We nonetheless adopt an extended mass profile with \begin{equation} M_{ext}(r) = \int_0^r 4\pi \frac{\rho_0}{1+(r/R_b)^2} r^2 dr \end{equation} where $\rho_0 \simeq 2.1 \times 10^6 M_{\odot}$ and the break radius is $R_b$ = 8.9\arcsec. We have also tried other extended mass profiles, like that of \cite{Schodel_2009}, and the results are similar. \begin{figure*}[htp] \centering \includegraphics[width=\textwidth]{efit_S0-2.png} \caption{Examples of a full Keplerian orbit analysis for S0-2. The top row shows the line-of-sight velocity $v_z$ and projected position from SgrA*: $x$, $y$ as a function of time, and our model (blue line) fits both very well. The bottom row shows the offset between data and model as a function of time.} \label{fig:efit_S0-2} \end{figure*} Among the 79 stars, 45 have precise and accurate astrometry from \citet{Jia_2019} with well-measured proper motions and constraints on the projected acceleration, $a_R$, as shown in Table \ref{tab:pm}. However, not all measured $a_R$ values are physically allowed for a single star on a bound orbit around the supermassive black hole and enclosed extended mass. The maximum allowed $a_R$ is set by the gravitational acceleration when $z$ = 0 pc and we constrain the minimum allowed $a_R$ to be the acceleration at a distance of $z$ = 0.8 pc: \begin{equation} \begin{split} {a_R}_{max} (R) & = - \frac{G M_{tot}(R)}{R^3} \\ {a_R}_{min} (R) & = - \frac{G M_{tot}(r)R}{r^3}, r = \sqrt{R^2 + z^2}, z=0.8pc \\ \end{split} \end{equation} The maximum $z$ is chosen to be 0.8 pc because very few young stars are detected outside 0.4 pc and the most distant young star detected in our sample is at 0.6 pc. If the distribution of young stars is approximately spherically symmetric about the black hole, then the maximum line-of-sight distance should not exceed 0.8 pc. If a stars' measured $a_R$ ($\pm$ 2$\sigma_{a_R}$) overlaps with the allowed range, we draw its $z$ in each MC trial from a Gaussian distribution with the mean set to the measured $a_R$, the standard deviation set to the measured $\sigma_{a_R}$, and truncated to the allowed $a_R$ range. This is the case for 35 stars. For the rest of the stars without a significant or physical $a_R$, we use a uniform distribution in the range of allowed $a_R$. In Figure \ref{fig:mc}, we use three stars as an example to show how $a_R$ is simulated in the MC analysis. The last column in that plot shows the distribution of $a_R$ and its limits (${a_R}_{max}$ and ${a_R}_{min}$) in red dashed lines, while the orange histogram is the probability density function for simulated $a_R$. \edit1{The uniform acceleration prior, in the absence of other constraints, may lead to biased results in angular momentum measurements as shown in \citet{Yelda_2014}. It produces a deficit of stars close to z=0 as shown in Figure \ref{fig:mc} and \citet{von_Fellenberg_2022}, Fig. 12. However, as discussed above, we only apply this prior for roughly half of the stars that do not have a physically allowed or significant $a_R$, most of which are located at larger radii where the bias is less apparent. Thus the choice of a uniform acceleration prior does not strongly bias the results.} Even for those 35 stars with measured $a_R$ within the allowed range, the significance of their accelerations varies. This is due to many factors, including the location of the star, the brightness of the star, the number of epochs in which the star is detected, etc. A more precise acceleration will result in more precise orbital parameters. In Figure \ref{fig:mc}, both S1-3 and S3-190 have a measurement-based $a_R$ prior, while S7-10's prior is uniform $a_R$ over the allowed range. S1-3 has a $\sim$40$\sigma$ significant acceleration, but S3-190 only has 1$\sigma$ significant acceleration. As a result, S1-3 has much more constrained orbital parameters compared to S3-190. For S7-10 with a uniform $a_R$ prior, its orbital parameters are even less constrained. The $z$ distribution for S7-10 decreases with increasing radius even when $a_R$ is evenly distributed, which agrees with observation and validates the uniform $a_R$ prior. \subsection{Full Keplerain orbit fit for central stars} \label{sec:efit} For stars with time-variable RV, we inferred their orbital parameters by simultaneously fitting spectroscopic and astrometric measurements. We utilized the same orbit-fitting procedure as was used by \citet{Do_2019} to test General Relativity using the orbit of S0-2. From the orbit-fit posterior distributions, we drew 10$^\mathrm{5}$ samples in order to match the posterior sample size for stars with a single RV from \S\ref{sec:mc}. S0-1, S0-2, S0-3, S0-4, S0-5, S0-8, S0-16, S0-19, S0-20 in our sample are fitted this way. We adopted the observable-based prior paradigm from \citet{ONeil_2019} that is based on uniformity in observables to improve orbital solutions for low-phase-coverage orbits. A full Keplerian orbit fit for S0-2 is shown in Fig \ref{fig:efit_S0-2}. All 9 stars' fitted results are attached in appendix \ref{app:efit}. \section{Disk Membership Analysis} \label{sec:disk} \subsection{Detecting Stellar Disks} \label{sec:disk_detect} Each star's orbital plane can be uniquely described by a unit normal vector $\textbf{\textit{L}}$ that is perpendicular to the orbital plane. This normal vector $\textbf{\textit{L}}$ can be expressed in terms of the inclination ($i$) and the angle to the ascending node ($\Omega$) (see Equation 8 in \citet{Lu_2009}). Stars moving in a common plane share a common normal vector. In order to detect a stellar disk or stream, we adopt a nearest-neighbor method similar to that used by \citet{Lu_2009} and \citet{Yelda_2014}. In this method, the sky is divided into 49152 pixels with equal solid angle area and for a given MC simulation the density at each ($i$, $\Omega$) position is calculated using the following equation: \begin{equation} \Sigma = \frac{k}{2\pi (1 - \textrm{cos} \;\theta_k)} \; \textrm{stars} \; \textrm{sr}^{-1} \end{equation} where $\theta_k$ is the angle to the $k$th nearest star and we use $k$ = 6. The resulting average density is nearly the same for other choices of $k$ = 4, 5, or 7. Then the combined density map is an average over all 10$^5$ MC trials from \S\ref{sec:orbitfit}. The resulting density maps are presented in \S\ref{sec:result}. \begin{figure}[htp] \centering \includegraphics[width=0.5\textwidth]{disk.png} \caption{Density of normal vectors ($i$, $\Omega$) (in stars deg$^{-2}$) of all 88 stars in our sample. Two significant over-dense region are marked as Disk1 and Plane2. Disk1 has a density of 0.014 stars deg$^{−2}$ located at ($i$, $\Omega$) = (124\degree, 94\degree). Plane2 has a density of 0.007 stars deg$^{-2}$ located at ($i$, $\Omega$) = (90\degree, 245\degree). The 1 sigma region is defined as the area inside the contour at which the density drops to half of its peak, and is circled by a black dashed line.} \label{fig:disk} \end{figure} \subsection{Disk/Plane Membership Probabilities} \label{sec:membership} With the disk or plane normal-vectors and uncertainties determined from \S\ref{sec:disk_detect}, the membership probability, $L_{\text{disk}}$, can be estimated for each star following \citet{Lu_2009}. \begin{equation} \begin{split} \label{equ:disk_membership} L_{\text{non-disk}} &= 1 - L_{\text{disk}} \\ &= 1 - \left(\frac{\int_{\text{disk}} PDF(i, \Omega) \;d \text{SA}}{\int_{\text{peak}} PDF(i, \Omega) \;d \text{SA}} \right) \\ \end{split} \end{equation} \begin{equation} \begin{split} \int_{\text{disk}} d \text{SA} = \int_{\text{peak}} d \text{SA} \end{split} \end{equation} Here SA is the solid angle measured at the contour where the disk density drops to half of the peak value; $\int_{disk} PDF(i, \Omega) \;d \text{SA}$ is the integration of each star's density map over the stellar disk region, and $\int_{peak} PDF(i, \Omega) \;d \text{SA}$ is the integration over its own peak region with the same SA. In summary, each star's $PDF(i, \Omega)$ is integrated inside the disk or plane area and normalized by the star's peak probability over a similar area. Thus, stars with large uncertainties in $i$ and $\Omega$ will only have high plane membership if they are centered on the plane. The final disk or plane memberships are presented in \S\ref{sec:result}. \section{Results} \label{sec:result} \subsection{Two Stellar Disks} \label{sec:two_disk} \begin{figure}[htp] \centering \includegraphics[width=0.5\textwidth]{disk_membership.png} \caption{The proper motion direction for each star, where red arrows are Disk1 candidates and blue arrows are Plane2 candidates. The Non-disk stars are shown in black arrows, and the inner region stars are plotted with low opacity due to their large velocity. } \label{fig:disk_membership} \end{figure} The density map of normal vectors, $\textbf{\textit{L}}$, shows two over-dense regions, indicating the presence of at least two distinct populations, each of which consists of stars that share a common orbital plane (Figure \ref{fig:disk}). We label the two peaks as Disk1 and Plane2. The well-known clockwise (CW) disk is the upper right Disk1 located at ($i_\mathrm{Disk1}$, $\Omega_{i, \mathrm{Disk1}}$) = (124\degree, 94\degree), consistent with the past measurements of the disk location \citep{Levin_2003, Genzel_2003, Paumard_2006, Lu_2009, Bartko_2009, Yelda_2014, von_Fellenberg_2022}. We found another almost edge-on plane which we call Plane2, located at ($i_\mathrm{Plane2}$, $\Omega_{i, \mathrm{Plane2}}$) = (90\degree, 245\degree). This may be the same structure identified as F3 in \citet{von_Fellenberg_2022}; \edit1{Plane2 and F3 have similar eccentricity and semi-major axis distributions, along with $\sim 35\%$ of common members. However, the two features are $>$30$\degree$ apart in terms of $\Omega$: \citet{von_Fellenberg_2022} found F3 has ($i$, $\Omega$) = (102\degree, 211\degree) after conversion to our reference frame. A more} detailed comparison is presented in Appendix \ref{app:comp}. The uncertainty in the location of each of the planar features is defined to be where the density drops to 50\% of its peak value and it is marked with a black dashed line in Figure \ref{fig:disk}. The uncertainties for Disk1 and Plane2 are ($\sigma_{i,\mathrm{Disk1}}$, $\sigma_{\Omega, \mathrm{Disk1}}$) = (15\degree, 17\degree), ($\sigma_{i, \mathrm{Plane2}}$, $\sigma_{\Omega,\mathrm{Plane2}}$) = (20\degree, 19\degree). \edit2{We also estimate the fraction of young stars belonging to each structure by calculating the sum of the membership probabilities over the total 88 young stars and found that $\sim 8.4\%$ of our sample belongs to Disk1 while $\sim 6\%$ belongs to Plane2.} To quantify the significance of both disks, we simulated an isotropic population with synthetic ($x_0$, $y_0$, $v_x$, $v_y$, $v_z$) and extracted orbits in the same way as on the real data. Each simulated star was first assigned a 2D radius on the sky, $R$, and a 3D velocity, $v_{tot}$, drawn from the observed young stars. Then the orientation of the position and velocity vectors were randomly generated \citep{Yelda_2014}. Any measurements of $a_R$ were kept fixed in amplitude and uncertainty. For the 9 stars from \S\ref{sec:efit} with well-measured orbits, we drew 10$^5$ samples from randomized $i$ and $\Omega$ with their posterior distribution uncertainty. The significance of Disk1 and Plane2 is defined by: \begin{equation} \label{eq:sig} S = \frac{\rho_{disk} - \rho_{iso}}{\sigma_{iso}} \end{equation} where $\rho_{disk}$ is the density of the stellar disk at its peak, $\rho_{iso}$ is the density of the isotropic simulation at the same position, and $\sigma_{iso}$ is the dispersion of the density at the peak among all the isotropic simulations at the same position. A summary of the peak density, significance, and the simulated isotropic density and its dispersion is presented in Table \ref{tab:disk}. The significance for Disk1 is 12.4 and Plane2 has a significance of 6.4. The reason we have a slightly lower significance for Disk1 compared to \citet{Yelda_2014} is because we have a smaller sample size due to our requirement that only stars from surveys with published completeness curves can be included. As a result, our uncertainty in the isotropic density is slightly larger. The significance of Plane2 is only slightly higher than previously claimed planar structures and disks that were later shown to be statistically insignificant \citep{Paumard_2006,Bartko_2009,Lu_2009}. Thus, we must be cautious in claiming a new dynamical structure. Unlike previous claimed structures, the Plane2 structure is the result of both numerous stars with moderate membership probabilities and at least 5 stars with $P_{plane} > 0.5$. \input{tab_disk} The probability of each star belonging to Disk1 or Plane2 is given in Table \ref{tab:disk_membership}. To view stars in Disk1 and Plane2 in a more direct way, we make a quiver plot showing the proper motion of each star in Figure \ref{fig:disk_membership}. For illustrative purposes, we identify high-probability disk members as those with $P_{disk} > 0.2$; and Disk1 and Plane2 stars are shown as red and blue arrows, respectively. We note that all disk membership probabilities are calculated assuming the existence of only that disk. We choose not to determine disk membership using a more complex mixture model based on two simulated disks plus an isotropic population as it would require a prior knowledge of the disk properties such as the eccentricity and semi-major axis distributions. \input{tab_disk_membership} \subsection{Disk Properties} \label{sec:disk_property} In this section, we compare the distribution of eccentricities ($e$), radial distances on the disk plane $R_{plane}$ (derived in \S\ref{sec:radial_profile}) and disk thickness for the different dynamical subgroups. We then use this distribution as the input prior for disk simulations in \S\ref{sec:disk_simulation}. \subsubsection{Eccentricity Distribution} \label{sec:ecc_dist} Stars are divided into Disk1, Plane2 and Non-disk stars using membership probabilities as weights rather than through a hard probability cut. We assign a weight to each MC trial among the $10^5$ trials for every star (\S\ref{sec:orbitfit}). For a particular MC trial with a set of Keplerian orbital parameters ($i$, $\Omega$, $e$, $a$), the weight of being on Disk1 (W$_\mathrm{Disk1}$), Plane2 (W$_\mathrm{Plane2}$) and Non-disk (W$_\mathrm{Non-disk}$) structures are calculated as: \begin{equation} \begin{split} W_\mathrm{Disk1}(i,\Omega,e,a) = & N(i|\mu=i_\mathrm{Disk1},\sigma=\sigma_{i,\mathrm{Disk1}}) \times \\ & N(\Omega|\mu=\Omega_\mathrm{disk1},\sigma=\sigma_{\Omega,\mathrm{Disk1}}) \\ W_\mathrm{Plane2}(i,\Omega,e,a) = & N(i|\mu=i_\mathrm{Plane2},\sigma=\sigma_{i, \mathrm{Plane2}}) \times \\ & N(\Omega|\mu=\Omega_\mathrm{Plane2},\sigma=\sigma_{\Omega, \mathrm{Plane2}})\\ W_\mathrm{Non-disk}(i,\Omega,e,a) = & 1 - W_\mathrm{Disk1}(i,\Omega,e,a) \\ & - W_\mathrm{Plane2}(i,\Omega,e,a) \\ \end{split} \end{equation} where N($\mu$, $\sigma$) is normal distribution with mean of $\mu$ and standard deviation of $\sigma$. \begin{figure*}[htp] \centering \includegraphics[width=0.3\textwidth]{dnest_ecc_dist_d1.png} \includegraphics[width=0.3\textwidth]{dnest_ecc_dist_d2.png} \includegraphics[width=0.3\textwidth]{dnest_ecc_dist_nd.png} \caption{ The best-fit (thick line) eccentricity distribution for Disk1 (left), Plane2 (middle), and Non-disk (right) young stars. Fit uncertainties are drawn as thin lines in top plots. We randomly draw 1000 parameters from the posterior probability distributions and plot corresponding Beta distributions. Bottom plots show individual eccentricity posterior distributions of stars belonging to each structure. Disk1 stars peak at lower eccentricities while Plane2 and Non-disk young stars have higher eccentricities. Plane2 has large uncertainties and the drawn 1000 parameters result in distributions that have two prominent peaks. This may imply a bi-modal distribution for Plane2; however, given the small sample size, the bi-modality is not significant. } \label{fig:ecc_dist} \end{figure*} \begin{figure} \centering \includegraphics[width=0.4\textwidth]{fig_ecc_corner.png} \caption{ Posterior probability density for the eccentricity distribution parameters, $\alpha$ and $\beta$, for all three groups of young stars. Contours show the {0.5, 1, 1.5, and 2 sigma regions}. } \label{fig:ecc_posteriors} \end{figure} \begin{figure}[htb] \centering \includegraphics[width=0.48\textwidth]{dnest_r_dist_all.png} \caption{ Radial distributions for the three dynamical subgroups and the best-fit model. The top plot is for Disk1 (red), the middle plot is for Plane2 (blue), and the bottom plot is for the Non-disk population (grey). The colored envelope in each plot defines region of uncertainty for the model. We draw 200 samples from the posterior distribution of model parameter and calculate corresponding uncertainty region (plotted as shaded areas). } \label{fig:r_dist} \end{figure} We modeled the underlying eccentricity distribution for Disk1, Plane2, and the Non-disk populations separately. \edit1{We used a hierarchical Bayesian inference (HBI) method similar to \citet{Hogg:2010} and \citet{Bowler:2020} to infer the population-level eccentricity distribution of each sub-structure.} \edit1{This method was proposed first in constraining the population-level eccentricity distribution of exoplanets, where a standard maximum-likelihood estimator of eccentricity is biased to a high value. HBI is especially useful when, as shown in \citet{Bowler:2020}, the measured eccentricity posteriors for individual stars vary significantly with some well constrained, others poorly determined, and most with asymmetric or non-Gaussian probability distributions \citep[see also][]{Wolfgang_2016, Eylen_2019}. } \edit1{To apply this framework to our case, we first} adopted a Beta distribution for the eccentricity distribution for each population, \begin{eqnarray} P(e|\alpha,\beta) = \frac{\Gamma(\alpha + \beta)}{\Gamma(\alpha)\Gamma(\beta)} e^{\alpha - 1} (1 - e)^{\beta - 1}. \end{eqnarray} where $\Gamma$ is the usual Gamma function defined as $\Gamma(z) = \int_{0}^{\infty} x^{z-1} e^{x} dx$. Recall that a Beta function can reproduce distributions that are uniform ($\alpha=1, \beta=1$), peaked at low $e$ (small $\alpha$), peaked at high $e$ (small $\beta$), and anything in between, \edit1{which makes the distribution very flexible.} We then used \edit1{HBI} to find the most probable $\alpha$ and $\beta$ parameters for each population's eccentricity distribution, solving for \begin{eqnarray} P(\{\theta_s\}, \mathcal{E} | \{d_s\}) = \frac{P(\{d_s\} | \{\theta_s\}) P(\{\theta_s\} | \mathcal{E}) P(\mathcal{E})}{P(\{d_s\})} \end{eqnarray} where $\mathcal{E} = (\alpha, \beta)$ describes the population's eccentricity distribution, $\{\theta_s\}$ is the set of orbital parameters for each star, $s$, and $\{d_s\}$ is the data for each star. This enables us to use posterior samples from an individual star's eccentricity distribution to estimate the population's distribution. As we already have posterior samples for the individual stars' orbital parameters, $\theta_s$, similar to \citet{Bowler:2020}, we can write the posterior distribution of hyper-parameters $\mathcal{E}$ as: \begin{equation} P(\mathcal{E} | \{d_s\}) \, \propto \, \mathcal{L}(\{d_s\} | \mathcal{E}) \, \pi (\mathcal{E}) \end{equation} where $\pi (\mathcal{E})$ is the prior on the hyper-parameters. Then we can approximate the likelihood $\mathcal{L}(\{d_s\} | \mathcal{E})$ for the population parameters by importance sampling the existing posteriors with \begin{eqnarray} \mathcal{L}(\{d_s\} | \mathcal{E}) \approx \prod_{s=1}^{N_{stars}} \frac{c_s}{K} \sum_{k=1}^K \frac{P(e_{sk} | \mathcal{E})}{\pi (e_{sk})} \end{eqnarray} where $e_{sk}$ is the eccentricity of the $k$-th draw for star $s$ as described in \citet{Hogg:2010} and $c_s$ is the membership probability for each star. The orbital parameter posteriors for most stars were generated using a Monte-Carlo sampling method and an explicit eccentricity prior was not utilized. However, the uniform $a_R$ prior produces a fairly uniform eccentricity distribution; thus we assume that $\pi (e_{sk})$ is uniform. Priors on $\alpha$ and $\beta$ were uniform from [0, 50] and [0, 30], respectively. The final posterior probability distribution on $\mathcal{E}$ was inferred using the nested sampling package, {\em Dynesty} \citep{Speagle:2020,Skilling:2004,Skilling:2006,Feroz:2009,Higson:2019}. The best-fit eccentricity distributions are plotted in Figure \ref{fig:ecc_dist}. For the Disk1 population, we see a peak at $e$ = 0.36, which is consistent with the previous determination by \citet{Yelda_2014}, but with a larger spread, implying more high eccentric orbits in Disk1. For the Plane2 population, the eccentricity distribution is shifted to higher eccentricities, although the uncertainties are large, given the small number of stars. We adopt the maximum-likelihood solution for all three populations, including Plane2, even though the intrinsic eccentricity distribution is uncertain and may have a different functional form. For the Non-disk stars, the distribution is fairly flat, with a slight preference for higher eccentricities. Both the Plane2 and Non-disk populations are consistent, within uncertainties, with a relaxed population, which should scale as $P(e) \propto e$; however, a non-relaxed, but high, eccentricity distribution is preferred (Figure \ref{fig:ecc_posteriors}). To summarize, we find that the eccentricity distributions are described by: \begin{equation} \label{equ:e_dist} \begin{split} P_\mathrm{Disk1}(e) =& \ \mathrm{Beta}(\alpha = 3.2 \pm 1.4, \beta = 5.0 \pm 2.4) \\ P_\mathrm{Plane2}(e) =& \ \mathrm{Beta}(\alpha = 31.9 \pm 11.9, \beta = 15.2 \pm 6.8) \\ P_\mathrm{Non-disk}(e) =& \ \mathrm{Beta}(\alpha = 2.6 \pm 0.6, \beta = 1.7 \pm 0.4). \end{split} \end{equation} \subsubsection{Radial Profile} \label{sec:radial_profile} In order to calculate a star's radial position on the disk, we first need to find its \edit1{projected position vector on} the disk plane. We have the $x_{sky}$ and $y_{sky}$ positions for each star and thus we \edit1{need to calculate} $z_{plane}$ on the disk plane. To do this, we begin by finding the normal vector to the disk, $\textbf{\textit{L}}$, from its $i$ and $\Omega$: \begin{equation} \label{equ:Lnormal} \textbf{\textit{L}} = \begin{pmatrix} $$L_{x}$$ \\ $$L_{y}$$ \\ $$L_{z}$$ \end{pmatrix} = \begin{pmatrix} $$\sin i \cos \Omega$$ \\ $$-\sin i \cos \Omega$$\\ $$-\cos i$$ \end{pmatrix} \end{equation} After calculating the normal vector $\hat{L}$, combined with known $x_{sky}$ and $y_{sky}$ positions of stars, we find $z_{plane}$ by projecting stars onto the disk plane: \begin{equation} \label{equ:z_plane} z_{plane} = \frac{-(L_{x} \, x_{sky} + L_{y} \, y_{sky})}{L_{z}} \end{equation} then the radial distances $R_{plane}$ are calculated by Pythagorean Theorem. To create the PDFs of the $R_{plane}$ distributions for both Disk1 and Plane2, we sample both stars and structures \edit1{simultaneously}. First, a sample of $i_{star}$ and $\Omega_{star}$ is drawn for each star from its MC result $5 \cdot 10^4$ times. Second, another sample of each structure's $i_{disk}$ and $\Omega_{disk}$ is created by drawing $5 \cdot 10^4$ times from a Gaussian distribution defined by the means and uncertainties \edit1{of $i$ and $\Omega$ shown in Table \ref{tab:disk}}. We randomly match elements of these two samples to create a new data set, where each \edit1{data set contains one combination of} a star's $i_{star}$ and $\Omega_{star}$ and a disk's $i_{disk}$ and $\Omega_{disk}$. From \edit1{this new data set}, we calculate $R_{plane}$ values for each combination using Eqs. \ref{equ:Lnormal} and \ref{equ:z_plane}. Additionally, we imposed a cut of 20 parsecs on our values of $R_{plane}$ \edit1{because these dynamical sub-structures, especially Plane2, are close to edge-on.}. Without this cut, we would obtain values of $R_{plane}$ approaching infinity. We also calculate a weight associated with each data in the following way, assuming no change in uncertainty of disk parameters and a normal distribution. \begin{equation} \begin{split} W(i_{star}, \Omega_{star} | i_{disk}, \Omega_{disk}, \sigma_{i, disk}, \sigma_{\Omega, disk}) = \\ N(i_{star}|\mu=i_{disk},\sigma=\sigma_{i,disk}) \times \\ N(\Omega_{star}|\mu=\Omega_{disk},\sigma=\sigma_{\Omega,disk}) \end{split} \end{equation} This is the probability of each sampled star being located on the sampled disk. We do not use membership probability because it is an integrated result and could not reflect details of sampled data. Then a \edit1{weighted} histogram of 88 stars is created for each sampled disk's $i_{disk}$ and $\Omega_{disk}$. Each histogram is normalized by 2D bin widths (i.e. annular area between each bin) to account for the 2D geometry of disk structure. The final PDF of $R_{plane}$ for each structure is obtained by taking the mean across these histograms and the uncertainties are estimated by the standard deviation. For the off-disk population, there is no disk to project the stars onto, so the stars' radial positions on the plane of the sky are considered. An $R_{sky}$ distribution is then created \edit1{through} a normalized distribution of the data. The uncertainties of these data points are estimated by the Poisson error on each data point. The data were fit using Bayesian inference with multi-nested sampling by the Dynesty python package. From inspection, we decided to fit the $R_{plane}$ distribution by a truncated single power-law for all three structures. Thus we only need to fit for the slope parameter $\alpha$. To estimate the uncertainty of the model, we sampled the posterior distributions of the model parameters 200 times, each time recalculating the model. We estimate the uncertainty by taking the standard deviation of all these calculated models. The radial distributions and best-fit models for the three subgroups are shown in Figure \ref{fig:r_dist}. We find that that the radial position distribution in the disk and the sky are described by: \begin{equation} \label{equ:r_dist} \begin{split} P_\mathrm{Disk1}(R_{plane}) =& \ \mathrm{Plaw}(\alpha = -1.80 \pm 0.17) \\ P_\mathrm{Plane2}(R_{plane}) =& \ \mathrm{Plaw}(\alpha = -1.43 \pm 0.47) \\ P_\mathrm{Non-disk}(R_{sky}) =& \ \mathrm{Plaw}(\alpha = -1.71 \pm 0.10). \end{split} \end{equation} We initially fit the $R_{plane}$ distribution of Disk1 by the truncated broken power law with model parameters $\alpha_{1}$, $\alpha_{2}$, and $r_{break}$. However, this results in huge uncertainties on model parameters. To justify our choice of a single power law, we compare values of both the Bayesian Information Criterion (BIC) and Akaike Information Criterion with small sample modification (AICc) for these two models. The results are shown in Table \ref{tab:criterion}. From this table, the difference between BIC values of Disk1 for different models is $\sim$ 2, which suggests moderate evidence against single power law. However, the AICc strongly prefers a single power law with difference of about 10. Thus we conclude that there is no preference between these two models for Disk1 and we choose to present the single power-law result because it has well constrained parameters. Similar reasoning applies to the off-disk population. For the Plane2 population, we prefer a single power law due to its few data points compared to the number of parameters. \input{criterion} The thickness of the disk can be estimated using the velocity dispersion perpendicular to the disk plane. Here we follow the process described by \citet{Lu_2009}. First, each potential disk candidate's three-dimensional velocity, $\vec{v}$, is projected into the direction of $\hat{L}$. The uncertainty of both $\vec{v}$ and $\hat{L}$ are taken into consideration when calculating intrinsic velocity dispersion $\sigma_{v_n}$, where $v_n$ = $\vec{v}$ $\cdot$ $\hat{L}$. Then the disk's scale height ($h/r$) can be derived from the ratio of $\sigma_{v_n}$ and <$\vec{v}$> , where $\sigma_{v_n}$ is the intrinsic velocity dispersion, and <$\vec{v}$> is the average magnitude of the 3D velocity of disk candidates, weighted their by disk membership probability. Finally, this scale height can be related to disk thickness described in terms of disk-opening angle $h/r \propto \sqrt{1/2} \Delta{\theta}$. For Disk1, we find $\sigma_{v_n}$ = 33 km s$^\mathrm{-1}$, giving a scale height of 0.09 $\pm$ 0.01 and a disk-opening angle of 7.0\degree $\pm$ 0.9\degree, consistent with previous results \citep{Lu_2009, Yelda_2014}. For Plane2, we find $\sigma_{v_n}$ = 58 km s$^\mathrm{-1}$, giving a scale height of 0.23 $\pm$ 0.07 and a disk-opening angle of 18.6\degree $\pm$ 6.2\degree. \subsection{Simulations} \label{sec:disk_simulation} \begin{table*}[h!] \caption{Characteristics of the Simulated Cluster Subgroups} \label{tab:simulation} \begin{threeparttable} \resizebox{\textwidth}{!}{ \begin{tabular}{cccc} \toprule \textbf{Parameters} & \textbf{Disk1} & \textbf{Plane2} & \textbf{Non-disk} \\ \midrule $i$ & N $\propto$ ($i_\mathrm{Disk1} = 124\degree$, $\sigma_\mathrm{i, Disk1} = 15\degree$) & N $\propto$ ($i_\mathrm{Plane2} = 90\degree$, $\sigma_\mathrm{i, Plane2} = 20\degree$) & P($i$) $\propto$ cos($i$) \\ $\Omega$ & N $\propto$ ($\Omega_\mathrm{Disk1} = 94\degree$, $\sigma_\mathrm{\Omega, Disk1} = 17\degree$) & N $\propto$ ($\Omega_\mathrm{Plane2} = 245\degree$, $\sigma_\mathrm{\Omega, Plane2} = 19\degree$) & Uniform(0\degree,360\degree)\\ $\omega$ & Uniform(0\degree,360\degree) & Uniform(0\degree,360\degree) & Uniform(0\degree,360\degree) \\ $e$ & $\mathrm{Beta}(\alpha=3.2 \pm 1.4, \beta=5.0 \pm 2.4)$ \tablenotemark{b} & $\mathrm{Beta}(\alpha=31.9 \pm 11.9, \beta=15.2 \pm 6.8)$ & $\mathrm{Beta}(\alpha=2.6 \pm 0.6, \beta=1.7 \pm 0.4)$ \\ $a$ \tablenotemark{c} & $\mathrm{Plaw}(\alpha = -1.80 \pm 0.17)$ \tablenotemark{b} & $\mathrm{Plaw}(\alpha = -1.43 \pm 0.47)$ & $\mathrm{Plaw}(\alpha = -1.71 \pm 0.10)$ \\ $t_0$ & Uniform(1995, 1995+period) & Uniform(1995, 1995+period) & Uniform(1995, 1995+period) \\ $M_{min}$ & 1$M_{\odot}$ & 1$M_{\odot}$ & 1$M_{\odot}$ \\ $M_{max}$ & 150$M_{\odot}$ & 150$M_{\odot}$ & 150$M_{\odot}$ \\ $M_{cluster}$ & 10$^\mathrm{5}$ $M_{\odot}$ & 10$^\mathrm{5}$ $M_{\odot}$ & 10$^\mathrm{5}$ $M_{\odot}$ \\ Age & 6Myr & 6Myr & 6Myr \\ IMF & $\xi(m) \propto m ^\mathrm{-2.35}$ & $\xi(m) \propto m ^\mathrm{-2.35}$ & $\xi(m) \propto m ^\mathrm{-2.35}$ \\ distance & 8kpc & 8kpc & 8kpc \\ \bottomrule \end{tabular}} \tablenotetext{a}{Equ \ref{equ:e_dist}.} \tablenotetext{b}{For simulated cluster, we choose to only use peak parameters corresponding to max likelihood.} \tablenotetext{c}{Equ \ref{equ:r_dist}. Here we use $a$ to represent the radial distance $r_{\mathrm{plane}}$. For each broken power law, we choose $a_{\mathrm{min}} = 0.01$pc and $a_{\mathrm{max}} = 1.0$pc.} \end{threeparttable} \end{table*} From Figure \ref{fig:disk_membership}, we can see the spatial distribution within each disk plane does not appear symmetric, especially for Plane2 stars. \edit1{Intrinsic asymmetry is important in understanding and constraining the subgroup's dynamical history. However, there are many reasons that can lead to this observed asymmetry: extinction, incomplete observation, and intrinsic asymmetry. In order to characterize this asymmetry, we simulate the whole cluster and each dynamical sub-structure using properties determined in \S\ref{sec:disk_property}. We also take inverse-completeness (see \S\ref{sec:completeness}) and the full extinction map from \citep{Schodel:2010} into account when doing the simulation in order to diminish the effects from these two factors. Then we compare the simulated stellar distribution to the observed one to explore whether the structure is intrinsically asymmetric or not.} Table \ref{tab:simulation} summarizes the input simulation parameters. First, we use an open-source python package \textit{SPISEA} \citep{Hosek:2020lz} to generate a single age (6 Myr) star cluster with solar metallicity, located 8 kpc away. The total mass of the simulated cluster is 10$^5 M_{\odot}$, with minimum mass of 1 M$_{\odot}$, maximum mass of 100 M$_{\odot}$, and a power-law IMF with a slope of -2.35 \citep{Salpeter_1955}. While the IMF for the YNC has been shown to be top-heavy \citep{Bartko_2009,Lu_2013}, the analysis of the kinematic and spatial sub-structure is relatively insensitive to the choice of IMF and total cluster mass as we re-scale the simulated clusters to match observed stellar densities. We generate the synthetic photometry for each star in the NIRC2 Kp filter, assuming a fixed extinction value of A$_{Ks}$ = 2.7 mag, for easy comparison to the observed Kp$_\mathrm{ext}$ shown in Table \ref{tab:pm}. In this step, we assume the three dynamical subgroups have the same age, IMF, and extinction. The cluster generated by \textit{SPISEA} gives mass and Kp$_\mathrm{ext}$ for every star in the system. However, our analysis excludes all WR stars because the generated values of mass and Kp$_\mathrm{ext}$ are less trustworthy compared to non-WR stars. The next step is to assign a position for each star based on their dynamical subgroup. We use the disk properties from \S\ref{sec:disk_property} to simulate positions for Disk1, Plane2 and Non-disk stars. To account for differential extinction over the field of view, which introduces asymmetric features in the observed distributions, we redden the Kp$_{ext}$ back to observed Kp using the \edit1{full} extinction map from \citet{Schodel:2010} and then apply an inverse completeness map from \S\ref{sec:completeness} to account for stars that would not be observable. This approximates how the simulated cluster would appear in observations. The comparison of the observed stellar density profile with the simulated density profile is shown in Figure \ref{fig:simulation}. We present the density profile in polar coordinates, where North is at 90\degree and West is at 0\degree, so that it is easier to see the azimuthal structure in each dynamical subgroup. These plots have the same orientation as they appear on the sky. For the Non-disk group, the sub-structure is mainly caused by the differential extinction, and our simulation reproduces the observation well within uncertainties. This indicates that the Non-disk group is nearly isotropic. For Disk1 and Plane2, we expect an over-density in their disk plane, which can be seen in both the observed and simulated maps. However, for Plane2, the observed density on the Southwest side is significantly more dense than the observed density on the Northeast side \edit1{(left plot of (c) in Figure \ref{fig:simulation})}, which \edit1{is less significant in the simulated stellar distribution (right plot of (c) in Figure \ref{fig:simulation}). Because we have taken both completeness and extinction into account when doing the simulation, this difference between observed and simulated stellar distribution should be explained by reasons other than these two factors. Thus, we think this difference implies that Plane2 is intrinsically asymmetric and may be a stream rather than a plane.} \begin{figure*} \hspace*{-1in} \subfloat[]{ \includegraphics[width=0.8\textwidth]{disk1_hist_polar.png} } \hspace*{-0.1in} \subfloat[]{ \includegraphics[width=0.3\textwidth]{d1_azi.png} } \\ \hspace*{-1in} \subfloat[]{ \includegraphics[width=0.8\textwidth]{disk2_hist_polar.png} } \hspace*{-0.1in} \subfloat[]{ \includegraphics[width=0.3\textwidth]{d2_azi.png} } \\ \hspace*{-1in} \subfloat[]{ \includegraphics[width=0.8\textwidth]{nondisk_hist_polar.png} } \hspace*{-0.1in} \subfloat[]{ \includegraphics[width=0.3\textwidth]{nd_azi.png} } \\ \caption{Stellar density map comparison between observation and simulation for Disk1 (top), Plane2 (middle) and Non-disk (bottom) subgroups. The first two columns are the stellar density map in polar system for observation (left) and simulation (middle), in which North is at 90\degree and West is 0\degree. We choose this coordinate system to be consistent with how $\Omega$ is defined. The right column is the 1D histogram of azimuth. For the Disk1 and Plane2 groups, the over-dense regions are mostly attributable to the orientation of the disk, while for the Non-disk group, the asymmetry is less significant, resulting from the differential reddening map. Within uncertainties, the 1D azimuthal distribution is consistent between the observation and simulation for Disk1 and Non-disk group. However for Plane2, the paucity of stars in the northeast sector of the observed map cannot be explained by the simulation itself. } \label{fig:simulation} \end{figure*} \section{Discussion} \label{sec:discussion} \edit1{The presence of multiple sub-structures in the young nuclear cluster implies that star formation occurred in dynamically complex gas structures around the SMBH. We can infer that the structures that are observed today are related, but not identical, to the initial gas structure since the two-body relaxation timescale is longer ($\geq$ 30 Myr $-$ 1 Gyr \citet{Kocsis_2011}) than the age of the YNC (3 $-$ 8 Myr \citet{Lu_2013}). However, some dynamical evolution is expected due to vector resonant relaxation at radii $< 1''$ (0.04 pc) and resonant friction at larger radii. In particular, \citet{Levin_2022} notes that resonant friction can take a single disk and smear it into transient streams with different orientations in only a few Myrs. Note, the asymmetric gravitational potential due to the surrounding circum-nuclear disk at a few pc may dampen these resonant dynamical processes. More precise theoretical simulations are needed to run back the clock from the sub-structures observed today to the initial configuration at the time of star formation. More detailed discussion is presented below.} \subsection{Comparisons to Previous Work} \label{sec:discuss_previous} While the CW disk has been verified many times in previous work \citep{Levin_2003, Genzel_2003, Paumard_2006, Lu_2009, Yelda_2014, von_Fellenberg_2022}, other kinematic structures in the young nuclear cluster have been controversial. A counter-clockwise (CCW) disk was originally reported in \citet{Genzel_2003} and confirmed in \citet{Paumard_2006}. Later work \citep{Bartko_2009, von_Fellenberg_2022} found that the CCW disk was highly extended, anisotropic, and showed evidence for a warped disk on large scales. However, this CCW disk was not detected by \citet{Lu_2009} and \citet{Yelda_2014} in an independent analysis with different observations for RVs and proper motions. In the work presented here, we confirm the existence of the CW disk, with properties consistent with previous analyses, and we also do not detect the CCW disk. Instead, we detect a second edge-on disk called Plane2 (c.f., \S\ref{sec:discuss_disk2}), which might be the same as the F3 structure reported in \cite{von_Fellenberg_2022} (c.f., \S\ref{sec:two_disk}, Appendix \ref{subsec:sig_comp}). A comparison of the locations of the CW disk, CCW disk and Plane2 on the density map is presented in Figure \ref{fig:disk_old}, from which we conclude that the position of Plane2 is clearly very different from that of the previously claimed CCW disk. \begin{figure} \centering \includegraphics[width=0.5\textwidth]{disk_old.png} \caption{Proposed stellar disk from previous work and our work. Here we plot the CW disk and CCW disk from \citet{Bartko_2009} (shortened as B09) in blue and the CW disk from \citet{Yelda_2014} in green. The stellar disk reported in our work in shown in black. The CW disk, on the other hand, is very consistent between different analyses.} \label{fig:disk_old} \end{figure} \edit1{There are small discrepancies between our work and that of vF22 for the significance and locations of Disk1 and Plane2. These are likely due to significant differences in proper motions at small radii and large, but not statistically significant, differences in radial velocities. In addition, our requirement of spectroscopic completeness information for stars to be included in our sample yields an overall smaller number of young stars. Lastly, our use of a uniform acceleration prior (c.f., \S\ref{sec:mc}) on $\sim 50$\% of the stars at large radii may also influence structure detection.} The stars within 0.8\arcsec are more randomized by dynamical effects like vector resonant relaxation \citep{Rauch_1996, Hopman_2006, Alexander_2007}, so the inner edge of the CW disk is roughly at 0.8\arcsec as reported in \citep{Schodel_2003, Ghez_2005, Gillessen_2009_stars}. This agrees with our analysis. In our sample, we have 14 young stars within 0.8\arcsec and all of them have zero probability of being on Disk1. \subsection{CW Disk1 Properties} \label{sec:discuss_disk1} The stars in Disk1 are found to have non-circular orbits. \citet{Bartko_2009} combined their results with those of \citet{Gillessen_2009_stars} and reported an eccentricity distribution with <$e$> = 0.36 $\pm$ 0.06. \citet{Yelda_2014} divided stars into accelerating sources and non-accelerating \footnote{These stars also have accelerations but are insignificant that we cannot detect.} sources, having <$e$> = 0.27 $\pm$ 0.09 and <$e$> = 0.43 $\pm$ 0.24, respectively. Our eccentricity distribution for Disk1 is shown in Figure \ref{fig:ecc_dist} and has a peak at $e=0.36$ and <$e$> = 0.39 $\pm$ 0.16. Our result has a much larger uncertainty due to our requirement of only using data with completeness information, which results in a smaller overall sample. We performed an analysis similar to that of \citet{Yelda_2014}, dividing stars into accelerating and non-accelerating moving stars. The accelerating sources are defined in \citet{Jia_2019}, including 4 stars in our sample: S1-2, S1-3, S2-6 and S4-169. The comparison of $e$ distribution between accelerating and non-accelerating sources in Disk1 are plotted in Figure \ref{fig:disk1_ecc}, which agrees with the conclusion from \citet{Yelda_2014} - accelerating sources have a well constrained $e$ peaking at 0.2, while the $e$ distribution of non-accelerating sources has a much larger dispersion. Specifically, accelerating sources have <$e$> = 0.25 $\pm$ 0.12 while non-accelerating sources have <$e$> = 0.45 $\pm$ 0.24. The difference is likely due to accelerating sources having better constraints on their orbital parameters (see Figure \ref{fig:mc}). \begin{figure} \centering \includegraphics[width=0.4\textwidth]{acceleration_dist.png} \caption{The eccentricity distribution for accelerating sources and non-accelerating sources on Disk1.} \label{fig:disk1_ecc} \end{figure} Disk1 has a significant intrinsic thickness as was shown by \citet{Paumard_2006, Lu_2009} and \citet{Yelda_2014}. For example, \cite{Paumard_2006} reported a disk opening angle of $\Delta_\theta$ = 14\degree $\pm$ 4\degree\ and \citet{Lu_2009} reported a disk thickness of $\Delta_\theta$ = 7\degree $\pm$ 2\degree. Our intrinsic disk thickness of $\Delta_\theta$ = 7\degree $\pm$ 1\degree\ is consistent with that found in previous work, only with smaller uncertainty. The surface density profile in the plane of Disk1 is predicted to be $\Sigma$(r) $\propto$ r$^{-2}$ for \textit{in-situ} formation scenarios \citep{Lin_1987, Levin_2007} and has been verified in many observations \citep{Paumard_2006, Bartko_2009, Lu_2009, Yelda_2014}. In our paper, the semi-major axis $a$ distribution was initially fit with methods similar to the eccentricity distribution as discussed in \S\ref{sec:ecc_dist}. However, the fit results were extremely uncertainty and no significant constraint could be placed on the $a$ distribution in the disk plane. We instead explore the distributions of projected radial distances on the disk plane. The slope of the radial profile ($-1.80 \pm 0.17$ from Eq.\ref{equ:r_dist}) is in agreement with the predicted $-2$. \subsection{Plane2 Properties} \label{subsec:discuss_plane2} \edit2{In addition to the CW Disk1, we found a new CCW structure Plane2, which has 10 stars out of the total 88 young stars in our sample. We estimated that Plane2 has $(i, \Omega) = (90 \pm 20\degree, 245 \pm 19\degree)$, which is similar to the F3 structure reported in \citet{von_Fellenberg_2022}. A more detailed comparison between these two structures is discussed in Appendix \ref{subsec:sig_comp} and \ref{subsec:disk_comp}. As presented in \S\ref{sec:ecc_dist}, stars in Plane2 have relatively high eccentricities, with $<e> = 0.68$. We also estimated the intrinsic disk thickness of Plane2 to be $\Delta_{\theta} = 18.6\degree \pm 6.2\degree$. The radial profile of Plane2 has a power law index of $-1.43 \pm 0.47$ from Eq.\ref{equ:r_dist}, which is inconsistent with the predicted -2. This might be caused by the complex dynamical evolution experienced by Plane2 stars such that they have high eccentricities with less steep radial profile. One of the most prominent feature of Plane2 is its spatial asymmetry. As discussed in \S\ref{sec:disk_simulation}, this asymmetric feature cannot be explained by differential extinction or incompleteness and is likely intrinsic to the structure.} \subsection{Is Plane2 Related to the IRS 13 Group or G sources?} \label{sec:discuss_disk2} IRS 13 is a group of nearly co-moving massive young stars, clustered together at 3.5\arcsec to the West of the SMBH \citep{Maillard_2004, Paumard_2006, Martins_2007}. It has been proposed to lie within the previously claimed CCW disk \citep{Maillard_2004, Schodel_2005}, but later works did not detect the CCW disk \citep{Lu_2009, Yelda_2014}, nor do we detect it in this work. Interestingly, one of IRS 13 group stars, IRS 13E1, is a potential Plane2 star, with a 50\% probability being on Plane2. The remaining IRS 13 sources E2, E3, and E4, are currently not in our sample as they were excluded either due to their Wolf-Rayet star nature or the lack of published completeness information. Here we relax our requirement for a complete sample in order to identify other candidate Plane2 members; although we note that we cannot infer structural properties of Plane2 from this analysis. Since all the IRS 13 stars are moving in approximately the similar direction, we run the same orbital and disk membership analysis for three other IRS 13 stars in addition to IRS 13E1. They are IRS 13E2, IRS 13E3, IRS 13E4. We use the most up-to-date radial velocities reported in \citet{Zhu_2020}. Note that using RV measurements from \citet{Paumard_2006} and \citet{Bartko_2009} generates similar results. The proper motions for IRS 13 stars are plotted in Figure \ref{fig:irs13_quiver} and the ($i$, $\Omega$) density map is shown in Figure \ref{fig:irs13}. Note that the nature of IRS 13E3 is not entirely clear -- it may be a dusty star or a gas clump at the intersection of colliding winds \citep{Zhu_2020, Wang_2019, Fritz_2010} and the proper motion is quite uncertain \citep{Tsuboi_2022, Fritz_2010}. Nevertheless, we find that IRS 13E3 is a potential Plane2 star, with a disk membership probability P$_\mathrm{Plane2}$ = 0.34, but IRS 13E2 and IRS 13E4 are not on Plane2 with P$_\mathrm{Plane2}$ < $10^{-2}$. \edit1{Based on the posterior contours of IRS 13E2 and IRS13 E4 in the ($i$, $\Omega$) plane, we think they are close to F1/CCW feature reported in \citet{von_Fellenberg_2022}; however, they did not classify these two IRS13 stars as belonging to F1/CCW feature.} Even though all four IRS 13 stars are approximately moving in a similar direction on the sky, the dispersion in the proper motions of the stars is significant. Recent studies of E1's proper motion propose that this star may not be bound to the IRS13 group, while E2 and E4 are most likely bound to the group \citep{Wang_2019, Mu_i__2008}. Additionally, studies of the spectrum of IRS 13E1 and E2 do not show signs of binarity \citep{Fritz_2010}. The two different pairs (E1 \& E3 and E2 \& E4) are discrepant enough that they may not be associated with each other. Thus it is unclear whether Plane2 is related to the potentially bound IRS13 group given the low Plane2 membership probability for E2 \& E4. Further study, including higher-resolution images and continued astrometric and RV monitoring will be needed to resolve the relationship between the apparently bound IRS 13 group and Plane2. In order to include as many Plane2 stars as possible, we report all potential Plane2 stars based on our analysis of all 146 stars with reported RVs and proper motions, listed in Table \ref{tab:rv}. The potential Plane2 stars and their disk membership is reported in Table \ref{tab:disk2}. A quiver plot showing the proper motion and RV for those potential Plane2 stars (P$_\mathrm{Plane2}$ > 0.2) is shown in Figure \ref{fig:disk2}. \input{tab_disk2.tex} \begin{figure} \centering \includegraphics[width=0.5\textwidth]{irs13_quiver.png} \caption{The proper motion for IRS 13 sources, where IRS 13E1 and IRS 13E3 are likely to be on Plane2 while IRS 13E2 and IRS 13E4 are not.} \label{fig:irs13_quiver} \end{figure} \begin{figure} \centering \includegraphics[width=0.45\textwidth]{irs13_group.png} \caption{The ($i$, $\Omega$) density map for IRS 13E1, IRS 13E2, IRS 13E3, IRS 13E4.} \label{fig:irs13} \end{figure} \begin{figure} \centering \includegraphics[width=0.5\textwidth]{disk2.png} \caption{The quiver plot of all potential Plane2 stars, with color showing the RV.} \label{fig:disk2} \end{figure} A population of dust enshrouded objects are found to orbit around the SMBH: the so-called G sources. The most famous G source is G2, which first looked like a pure gas cloud \citep{Gillessen_2013_G2, Eckart_2013,Phifer_2013}, yet survived through closest approach to SgrA$^\ast$ in early 2014 \citep{Gillessen_2013_G2, Abarca_2014, Shcherbakov_2014, Witzel_2014, Valencia_2015}. This implies that G2 must contain a stellar-like object and is perhaps a binary merge product. However, there is still no broad consensus as to the origin and nature of the G sources. Using the near-infrared (NIR) spectro-imaging data obtained over 13 years at the W. M. Keck Observatory with the OSIRIS integral field spectrometer, \citet{Ciurlo_2020} reported four more additional G sources, making the total number of G sources to six. \citet{Ciurlo_2020} found the six G sources (G1, G2, G3, G4, G5 and G6) have widely varying orbits, suggesting G sources are formed separately. We compare the orbital plane direction for G sources with stellar disk plane and the individual G source ($i$, $\Omega$) density map is plotted in Figure \ref{fig:Gsource}. The conclusion is that none of the G sources are likely to be on either Disk1 or Plane2. However G5 is also edge-on, and has almost exactly 180\degree difference in $\Omega$ compared to Plane2. In fact, there is a small probability of P$_\mathrm{Plane2}$ = 0.08 for G5 for its degenerate solution. In other words, G5 lies in the edge-on Plane2; but is counter-rotating in the plane. \begin{figure} \centering \includegraphics[width=0.45\textwidth]{G_sources.png} \caption{The ($i$, $\Omega$) density map for G1, G2, G3, G4, G5, and G6. We don not have full posterior samples for G1 and G2 so we use their $i$, $\Omega$, and associated uncertainty from \citep{Witzel_2017, Gillessen_2019} to generate the 2D Gaussian distribution.} \label{fig:Gsource} \end{figure} \subsection{The Star Formation Process} Besides the widely accepted \textit{in-situ} formation theory, it has been suggested that an inspiraling star cluster to explain the formation of young stars in our GC, where a massive young cluster migrate towards the center of the galaxy under dynamical friction \citep{Gerhard_2001}. However, this scenario will deposit stars with a profile of r$^{-0.75}$, which is inconsistent with the observed density profile. So the fact that radial profile from \S\ref{sec:disk_property} follows P(r) $\propto$ r$^{-1.80}$ supports \textit{in-situ} formation scenario. Although we did not detect the counter-clockwise disk claimed in \citep{Genzel_2003, Paumard_2006, Bartko_2009}, we found another almost edge-on disk (Plane2 in this paper) with highly asymmetric stellar distribution. This edge-on disk is mostly determined by stars on the southwest side and very few stars on the northeast side are found in this disk. While the uneven distribution of stars on Plane2 is not fully understood, possible explanations include: (1) The young stellar population is not uniformly distributed within Plane2, with more stars in the southwest region compared to northeast region (see \S\ref{sec:disk_simulation}). \edit1{One possible situation that could explain this asymmetry is the non-uniform initial gas distribution, leading to uneven star formation.} (2) If Plane2 is indeed related to the IRS13 group, the possible explanations for the formation of IRS13 group can also be used to explain Plane2. For example, Plane2 might be a remnant stream from the disruption of an IRS 13 cluster that may or may not contain an intermediate-mass black hole (IMBH) \citep{Maillard_2004}. \subsection{Biases Induced by Binaries} In our analysis of disk membership and disk properties, we assume that stars are not in binary systems. However, this may lead to biases in our results as presented by \citet{Naoz_2018}: if we ignore binaries, the disk memberships and disk fractions are likely to be biased to lower values; observed eccentricity and dispersion angle are likely to be biased to higher values. Here we present an analysis of the influence of ignoring binaries on disk membership on each sub-structure, Disk1 and Plane2. We simulate a sample of stars drawn from each structure and generate 3D positions and velocities for each star based on the radial profile and eccentricity distribution presented in \S\ref{sec:ecc_dist} and \S\ref{sec:radial_profile}. Then we randomly assign each star as a binary or not based on the binary fraction of $70\%$ as is appropriate for massive stars \citep{Raghavan_2010, Stephan_2016}. If a star is assigned to be in a binary system, we assign its binary properties, such as binary eccentricity, mass ratio, and inclination, drawn from distributions of massive star binary properties described in \citet{Sana_2012}. The primary stellar masses are sampled based on the IMF described in \citet{Lu_2013}. These binary properties, combined with position and velocity data of stars, are used to calculate a proxy parameter $\beta$ defined by \citet{Naoz_2018}, Eq 5. $\beta$ is the apparent deflection angle from the true orbital plane around the SMBH if the binary RV is ignored. We follow a similar criterion used in \citet{Naoz_2018} \S3, where a star with $\beta > 11.2\degree$ is considered as an on-disk star misidentified as an off-disk star. We simulate each structure 1000 times and calculate the mean fraction for $\beta > 11.2\degree$, as shown in Figure \ref{fig:beta_dist}. \begin{figure}[htp] \centering \includegraphics[width=0.4\textwidth]{disk1_beta_dist.png} \includegraphics[width=0.4\textwidth]{plane2_beta_dist.png} \caption{The fraction of misidentified off-disk stars when binaries are neglected. The histogram shows the fraction of stars with an angular difference in the input vs. output orbital plane ($\beta$) exceeding expected measurement errors, averaged over 1000 simulations, for Disk1 (top) and Plane2 (bottom). 10-20\% of stars are likely misclassified as off-disk due to their binary nature.} \label{fig:beta_dist} \end{figure} We find that for Disk1, the misclassified disk fraction is $0.13 \pm 0.08$ and for Plane2 is $0.14 \pm 0.1$. This implies that the presence of binaries should make $\sim 14\%$ of the on-disk stars appear as off-disk stars. Because we are ignoring binaries in our analysis, taking them into account would increase the Disk1 sample size from 18 stars to $\sim$ 21 stars and Plane2 sample size from 10 stars to $\sim$ 11 stars. Given this relatively small change in sample size, we think the bias induced by ignoring binaries is not significant if the binary fraction is 70\%. However, binary RV surveys are needed to fully quantify the true binary fraction and the size of the bias. In this section, we only calculate the bias on disk membership. Further analysis could be done to quantifying biases on eccentricity and disk dispersion angle, which can provide a more realistic set of disk properties. \section{Summary} \label{sec:summary} We analysed the dynamical structure of 88 young stars at the Galactic Center with projected radii from $0\arcsec$ to $15\arcsec$ with well measured proper motions, radial velocities and spectroscopic completeness information. This is the largest sample of GC young stars published with proper motion, radial velocity and completeness correction. We also simulate star clusters with different dynamical sub-structure to directly compare with what is actually observed on sky. We detect the well known clockwise disk (Disk1 in this paper), consistent with what has been previously published. We also find a second, almost edge-on, counter-clockwise disk (Plane2 in this paper). Plane2 is asymmetric with stars concentrated in the southwest direction, and two IRS 13 stars are found to potentially reside in this plane. \edit1{By applying a hierarchical Bayesian inference framework, we calculate that} Disk1 has an eccentricity peaking at 0.2 \edit1{for sources with well-measured accelerations}, consistent with previous analysis, but Plane2 is even more eccentric than Disk1, with P(e) $\propto$ e. By simulating Disk1, Plane2 and Non-disk stars using the observed disk properties, we are able to reproduce observed density maps for Disk1 and the Non-disk stars, but the highly asymmetric structure in Plane2 can not be explained with a uniform disk and extinction alone. In the future, we will use this sample with known completeness correction to constrain the IMF for different dynamical subgroups, which will greatly help us understand their formation history. \section{Acknowledgements} \edit1{We thank the referee for a very quick, yet thorough report which helped to improve the paper.} We also thank the staff of the W.M.~Keck Observatory for all their help in obtaining observations. We acknowledge support from the W. M. Keck Foundation, the Heising Simons Foundation, and the National Science Foundation (AST-1412615, AST-1518273). M. W. Hosek Jr. also acknowledges support by Brinson Prize Fellowship. The W.M. Keck Observatory is operated as a scientific partnership among the California Institute of Technology, the University of California and the National Aeronautics and Space Administration. The Observatory was made possible by the generous financial support of the W. M. Keck Foundation. The authors wish to recognize and acknowledge the very significant cultural role and reverence that the summit of Maunakea has always had within the indigenous Hawaiian community. We are most fortunate to have the opportunity to conduct observations from this mountain. \vspace{5mm} \facilities{Keck Observatory} \software{ AstroPy \citep{astropy_2013}, Matplotlib \citep{matplotlib_2007}, SciPy \citep{scipy_2001} } \clearpage
\section{Introduction} This report presents the thought processes, selected methodology, and expected results of the Amazon Last-Mile Routing Research Challenge by Team Permission Denied. In summary, the team went through four phases before arriving at the final submission. \textbf{Descriptive Analysis:} Upon receiving the challenge, a thorough descriptive analysis is done. The first important finding is that, in most circumstances, the drivers finish all deliveries in one zone before moving on to the stops in another zone. This rule is only broken when backtracking exists. A further look at the scores confirms this intuition: assuming the zone sequence and intra-zonal stop sequence are correct, the loss on the score due to certain zones being revisited is only 0.009. If the zone sequence is correct and the stops in each zone are shuffled, the average score is around 0.02. Therefore, getting the zone sequence correct is the most important, and the team decides to adopt a hierarchical approach: solving for the zone sequence, and then the intra-zonal stop sequence. This greatly reduces the scale of the problem since the majority of the routes have around 150 stops (up to 250), but the number of zones is between 6 and 47. Second, the zonal transitional probabilities are investigated. As most of the zones only appear in the training set once, an attempt at a frequency tabulation is not successful. On the other hand, 74\% of the zonal transitions select the zone that is closest by travel time, making the step-by-step prediction algorithm potentially successful. Next, the correlation between package dimensions, package counts, delivery time windows, and sequence order is investigated but no apparent relationship is found. \textbf{Benchmarking:} A benchmark model is created to establish an idea of the solution quality and expected performance. Since most drivers follow the navigation given by Amazon, a shortest-distance tour becomes a natural benchmark. The team solves a tour-based (where the start and end stations are both INIT) to generate zone sequences and a path-based (where the distance from the last zone to INIT is not counted) Travelling Salesman Problem (TSP) to generate intra-zonal stop sequences as benchmarks. Inside each zone, a path-based TSP is generated from the stop closest to the last zone to the stop closest to the next zone. \textbf{Model Attempts:} Both naive TSP solutions achieve scores reasonable scores (around 0.06). To improve the performance, machine learning models are attempted. First, it is noticed that correctly predicting the first zone would significantly improve the TSP performance, therefore a neural network is constructed to predict the first zone based on the travel time, distance, package count and size, etc. Second, pure machine learning models to generate sequences are investigated, including myopic approaches that predict the next element based on previously predicted stops, as well as sequence-to-sequence (seq2seq) approaches that encode and decode the entire sequence. Third, different training methods are considered, including the traditional cross-entropy loss, customized weighted loss, as well as reinforcement learning using policy gradients. Lastly, some improvements are made to the benchmark TSP models by adding penalty costs to non-consecutive zone-ids. Due to the small sample size (6k), machine learning techniques cannot outperform the benchmark models. After experimenting with various modeling techniques, the team decides to use the TSP solution as the final submission. \textbf{Hyperparameter Searching and Post-Processing:} The customized cost matrix involves hyperparameters that the team searched for over the given training set. Lastly, some post-processing patterns are identified to further improve the quality of our solution. The highlights of the final submitted model are: \begin{itemize} \item Hierarchical modeling - To reduce the size of each optimization problem, the problem is broken down into zone routing and intra-zonal stop routing. \item Customized TSP cost matrix - To account for considerations in addition to shortest distance, the cost matrix is modified and the TSP performance improved by almost 0.01. \item Post-processing to match behavioral patterns - Some TSP sequences are reversed to accommodate delivery patterns such as stops with more packages are visited first instead of last, all else being equal. \item Stable hyperparameters - The cost hyperparameters have good generalizability and do not require re-training. \end{itemize} The rest of the technical report reviews the relevant literature and its compatibility with the research question; describes the selected model in detail, and discusses the expected results. \section{Literature Review} This problem is essentially a vehicle routing problem, except that the traditional setup for vehicle routing problems aims for the shortest distance traveled, but the problem of interest looks for the most similarity with the observed sequence. Two research communities have extensively studied the vehicle routing problem: machine learning and operations research. Literature in both communities is reviewed, with the pros and cons of the algorithms discussed for the problem of interest. \subsection{Operations Research} Given a set of locations one would like to visit, a Traveling Salesman Problem (TSP) can be solved to find the route with the minimum cost or distance. The overview and history of the TSP can be found in \citet{TSP_overview}. Although TSP is a well-known NP-hard problem in combinatorial optimization, off-the-shelf integer optimization solvers (e.g., Gurobi and GLPK) are able to solve it efficiently for real-world instances. One key approach we utilized when solving the TSP is the cutting-plane method~\citep{Marchand_Martin_Weismantel_Wolsey_2002}, which is initially applied to TSP by \citet{10.2307/166695}. \subsection{Machine Learning} Two types of architectures can be used to re-order the input sequence: step-by-step or sequence-to-sequence (seq2seq). Step-by-step prediction involves predicting the stops one by one, given the information from previous stops, as well as candidate stops. Since the information from candidate stops are crucial, feed-forward neural networks are not a good candidate since it does not attribute features to candidates. Instead, a feed-forward neural network with alternative-specific utility is adopted \citep{WANG2020234}. This architecture draws the connection between discrete choice models with neural networks and uses neural networks to generate the utility for each candidate, and the candidate with the highest 'utility' is chosen. A sequence is then formed by repeatedly feeding the selected stop into the algorithm to get the next stop until the end of the sequence is reached. The advantage of this algorithm is that it is at the stop level instead of the sequence level. Therefore, the sample size, which is critical for the success of machine learning algorithms, is significantly larger than the seq2seq models. The disadvantage of this algorithm is that it is myopic and only sees the next step candidates while making a selection. In recent years, a lot of seq2seq prediction algorithms have been developed, mainly for natural language processing (NLP) tasks. Compared to step-by-step prediction, seq2seq models comprise an encoder and a decoder. All elements in the sequence are encoded before decoding starts, therefore a global view is attained. The architecture of encoder and decoder often involves variants of the recurrent neural networks (ex. long-short term memory networks) \citep{Sutskever2014}, or attention \citep{Vaswani2017}. Most seq2seq problems are considered with mapping one sequence to another, whereas the problem of interest is concerned with re-ordering the input sequence. Pointer network is proposed to solve this type of problem, where the decoder uses self-attention to point to one of the input elements \citep{Vinyals2015}. The authors used a pointer network to solve TSP and achieved similar performance to TSP solvers. One drawback of the original pointer network is that it is sensitive to the order of inputs. The authors, therefore, added another encoding module to eliminate this influence \citep{Vinyals2016}. However, in our experiments, this dependency can be leveraged by arranging the input set in a meaningful sequence to improve performance. For example, ordering the input stops according to the TSP sequence would accelerate model convergence and improve the score. However, in the papers presented above, 1M training samples were fed into the network. Given that the training set only contains 6000 routes, score improvements on TSP solutions are unsuccessful. The original pointer network uses cross-entropy loss (supervised learning). In this problem, the cross-entropy loss is very inefficient due to the way the score is calculated, since the loss only considers the probability of the correct position, and the loss for predicting all other positions is the same. But the scoring function considers similarity in addition to correctness. The scoring function is not differentiable and cannot be directly used as the loss function and use gradient descent. An alternative training method is reinforcement learning based on policy gradients \citep{Ma2019, Bello2019}. Using the well-known REINFORCE algorithm, we can directly optimize the non-differentiable score function. Researchers have found that this method has the same sample efficiency and better generalizability for TSP problems compared to supervised learning \citep{Joshi2019}. However, training with reinforcement learning in this particular problem with the sample size and given information also does not outperform TSP solutions. \subsection{Proposed Method} Our proposed method is built upon the traditional TSP with a customized distance matrix that implicitly contains drivers' routing behaviors for the Amazon last-mile delivery. Compared to the existing TSP framework, which minimizes the total vehicle travel distance, we modified the distance matrix and generated optimal routes which minimized the total adjusted travel distance. \section{Methodology} \subsection{Data}\label{sec_data} We observe that most of the drivers tend to visit all stops in a zone before going to the next zone. Hence, we divide the problem into two sub-problems. The first is to identify the zone sequence, and the second is to recognize the intra-zonal stop sequence. The actual zone sequence is generated based on the order of each zone's first appearance. An example is shown in Figure \ref{fig_zone_seq}. For stops without zone id (due to missing data), we fill them with the zone ID of its (travel time-based) nearest stop. Three important properties are noticed while observing the zone sequences: \begin{itemize} \item Most likely, the driver would finish a ``major zone'' first, then move to the next ``major zone''. A major zone is defined as the zone ID before the dot. For example, the major zone for ``A-2.2A'' is ``A-2''. For example, in Figure \ref{fig_zone_seq}, the driver first finishes major zone ``A-2'', then ``A-1'', finally ``P-13''. \item Within a specific major zone, two adjacent ``inner zone'' ids are most likely have a ``difference of one''. The ``inner zone'' is defined as the zone ID after the dot. For example, the inner zone for ``A-2.2A'' is ``2A''. The ``difference of one'' is defined as follows. Given two inner zone IDs ``XY'' and ``AB'', where X and A are numbers and Y and B are characters, we have \begin{align} |X - A| + |\texttt{ord}(Y) - \texttt{ord}(B)| = 1 \end{align} where $\texttt{ord}(\cdot)$ function returns an integer representing the Unicode character. For example, ``1A'' and ``1B'' has a difference of one, so as ``1A'' and ``2A''. But ``1A'' and ``2B'' has a difference of two. \item When a driver finishes a ``major zone'' and move to another, the two adjacent major zone IDs are most likely to have a ``difference of one''. For example, in Figure \ref{fig_zone_seq}, the driver first finishes major zone ``A-2'', then ``A-1''. Those two major zone IDs have a difference of one. \end{itemize} \begin{figure}[htb] \centering \includegraphics[width=1\linewidth]{Figures/zone_seq.png} \caption{Example of zone sequence. ``INIT'' indicates the delivery station} \label{fig_zone_seq} \end{figure} To validate these three properties, we calculate the frequency that these rules hold in the data set. For all adjacent zone ID pairs, 87.67\% of them have the same major zone ID (Property 1). For all adjacent zone ID pairs within a specific major zone, 82.49\% of them have a ``difference of one'' (Property 2). For all adjacent zone ID pairs with major zone ID changes, 96.17\% of these changes lead to a ``difference of one'' between two major zone IDs (Property 3). These statistics support the three properties, which implies that \textbf{the zone ID includes a lot of information for the sequence estimation}. Another information we use is the planned service time and package volumes. Details on how these are utilized are shown in Section \ref{sec_post_process}. We also collected outside data sources from OpenStreetMap. Specifically, we extract the number of traffic signals and highway ramps around every stop. Unfortunately, this does not help to improve our model, thus is dropped from our final submission. For the model's validation, we randomly separate the 6,112 routes into a training data set (4,889 routes) and a testing data set (1,223 routes), though our proposed solution does not require a training process. \subsection{Travelling Salesman Problem Formulation} With the observation that drivers visit all stops within the same zone first and then move to the next zone, we solve a standard TSP with a modified travel time matrix to generate zone sequence first and then solve multiple path-TSP to identify intra-zonal stop sequence. First, we provide the formulation of the standard TSP solved for generating zone sequences. For a route instance with $n$ zones, the set of zones is indexed by $[n] = \{1,...,n\}$ and the initial station location is indicated by index $0$. Let $V$ represent the set of all locations that need to be visited including the initial station, i.e., $V = \{0, 1, ..., n\}$. $t_{ij}$ denotes the travel time between any two locations, i.e., $\forall i \neq j \in V$. The travel time between any two zones is calculated as the average travel time between all possible pairs of stops between two zones. The decision variable for this problem is $x_{ij} \in \{0, 1\}, \; \forall i,j \in V$. $x_{ij} = 1$ indicates that the driver will visit to the location $j$ after visiting $i$. Then, the TSP problem can be formulated as: \begin{subequations} \label{eq:Tour_TSP} \begin{align} \min \quad & \sum_{i=0}^n \sum_{j=0}^n t_{ij} x_{ij} \\ \text{s.t.} \quad & \sum_{i=0}^n x_{ij} = 1 \quad \forall j \in V \\ & \sum_{j=0}^n x_{ij} = 1 \quad \forall i \in V \\ & \sum_{i \in S} \sum_{j \notin S} x_{ij} \geq 1 \quad \forall S \subset V, S \neq \emptyset, V \\ & \sum_{i \notin S} \sum_{j \in S} x_{ij} \geq 1 \quad \forall S \subset V, S \neq \emptyset, V \\ & x_{ii} = 0 \quad \forall i \in V \\ & x_{ij} \in \{0, 1\} \quad \forall i,j \in V \end{align} \end{subequations} Where the objective (\ref{eq:Tour_TSP}a) minimizes the total travel time for the tour. Constraints (\ref{eq:Tour_TSP}b) and (\ref{eq:Tour_TSP}c) make sure that each visited location has exactly one predecessor and one successor in the optimal tour. Constraints (\ref{eq:Tour_TSP}d) and (\ref{eq:Tour_TSP}e) are proposed to eliminate subtours in the optimal tour. Constraints (\ref{eq:Tour_TSP}f) avoid self loops and constraints (\ref{eq:Tour_TSP}g) guarantee decision variables are binary. The problem $(\ref{eq:Tour_TSP})$ is an Integer Linear Programming (ILP) with exponential number of constraints due to constraints (\ref{eq:Tour_TSP}d) and (\ref{eq:Tour_TSP}e). To solve this problem efficiently, we implemented both constraints (\ref{eq:Tour_TSP}d) and (\ref{eq:Tour_TSP}e) as lazy constraints, indicating they are only added to the problem if subtours are identified in the current optimal solution. To account for the observations made in the zone sequence (Section \ref{sec_data}), we propose three heuristics to modify the travel time matrix, which is the input for generating the optimal zone sequence. \begin{enumerate} \item For travel time from the initial station to a zone $i$, if the zone is not within either i) $h$ closest zones from the initial station regarding travel times or ii) $h$ closest zones from the initial station regarding Euclidean distances, we modify the travel time to $t_{0i} * \alpha$, where $\alpha$ and $h$ are both parameters for the first proposed heuristic approach. \item For travel time between any two zones $i$ and $j$, if zone $i$ and zone $j$ are not from the same "major zone", we modify the travel time to $t_{ij} * \beta$, where $\beta$ is the parameter for the second proposed heuristic approach. \item For travel time between any two zones $i$ and $j$, if they are from the identical "major zone" and the difference between their zone ID after the dot does not equal to 1, we modify the travel time to $t_{ij} * \gamma$, where $\gamma$ is the parameter for the third proposed heuristic approach. \end{enumerate} In the final submitted algorithm, we used the grid search approach to finalize values for all four heuristic parameters: $h = 9$, $\alpha = 1.04$, $\beta = 3.8$, $\gamma = 2.5$. Solving the problem (\ref{eq:Tour_TSP}) with the modified travel time matrix leads to the optimal zone sequence\footnote{Without loss of generality, we can assume the sequence starts from the initial station indexed by $0$.} $S^* = (0, s_1,...,s_n)$, where $s_i$ indicates the $i$-th zone visited in the optimal sequence after departing from the initial station. Then we solve the intra-zonal stop sequence using path-based TSP. Given a set of locations $V$ need to be visited and the starting location $v_o$ and the ending location $v_d$, we can formulate the path-TSP problem as follows: \begin{subequations} \label{eq:Path_TSP} \begin{align} \min \quad & \sum_{i=0}^n \sum_{j=0}^n t_{ij} x_{ij} \\ \text{s.t.} \quad & \sum_{i=0}^n x_{ij} = 1 \quad \forall j \in V \setminus \{v_o, v_d\} \\ & \sum_{j=0}^n x_{ij} = 1 \quad \forall i \in V \setminus \{v_o, v_d\}\\ & \sum_{j \in V} x_{v_o j} = \sum_{i \in V} x_{i v_d} = 1 \\ & \sum_{j \in V} x_{v_d j} = \sum_{i \in V} x_{i v_o} = 0 \\ & \sum_{i \in S} \sum_{j \notin S} x_{ij} \geq 1 \quad \forall S \subset V, S \neq \emptyset, V \\ & \sum_{i \notin S} \sum_{j \in S} x_{ij} \geq 1 \quad \forall S \subset V, S \neq \emptyset, V \\ & x_{ii} = 0 \quad \forall i \in V \\ & x_{ij} \in \{0, 1\} \quad \forall i,j \in V \end{align} \end{subequations} The path-TSP problem (\ref{eq:Path_TSP}) is similar to the standard TSP problem (\ref{eq:Tour_TSP}) except that there will be no predecessors for the starting location $v_o$ and no successors for the ending location $v_d$, indicating by constraints (\ref{eq:Path_TSP}d) and (\ref{eq:Path_TSP}e). The complete sequence is generated according to Algorithm \ref{alg1} based on generated zone sequence, where a heuristic parameter $k = 3$ is utilized in the final implementation. \begin{algorithm}[!h] \caption{Complete sequence generation based on the generated zone sequence. \\ Input: optimal zone sequence $S^* = (0, s_1,...,s_n)$, heuristic parameter $k$.} \label{alg1} \begin{algorithmic}[1] \Function{CompletePathGeneration}{$S^*$} \State $S^*_{complete} \gets \{0\}$ \Comment{Initialize the complete sequence with the initial station} \For {$s_i = s_1,...,s_n$} \State Find the previous visited zone $s_{i-1}$ and the next visited zone $s_{i+1}$ \State Calculate the average travel time between any stop $v \in s_i$ to all stops in zone $s_{i-1}$ and zone $s_{i+1}$ \State Find $k$ nearest stops in zone $s_i$ regarding to zone $s_{i-1}$ as the set $M$ \State Find $k$ nearest stops in zone $s_i$ regarding to zone $s_{i+1}$ as the set $N$ \State Solve $k^2$ path-TSP (\ref{eq:Path_TSP}) between any pair of stops in $M \times N$. \State Let the path $S^*_{i}$ with the minimum travel time as the optimal sequence of zone $i$ \State Append the sequence $S^*_{i}$ to the complete sequence $S^*_{complete}$ \EndFor \State \textbf{return} $S^*_{complete}$ \EndFunction \end{algorithmic} \end{algorithm} It is worth mentioning that all TSP instances are solved with the open-source ILP solver GLPK implemented with programming language Julia \citep{Bezanson2017} and optimization package JuMP \citep{DunningHuchetteLubin2017}. After generating the complete stop sequence $S^*_{complete}$, we enter the post-processing stage to further improve sequence performances. \subsection{Post-Processing}\label{sec_post_process} After solving the stop sequence by TSP, we observe that most of the high-score (i.e., low performance) routes are due to partially or fully reverse of the sequence (i.e., a sequence A-B-C-D is erroneously estimated as D-C-B-A). Hence, we propose a post-processing method to correct the erroneous estimation due to reversal. We observe two properties from the data set: \begin{itemize} \item Most of the drivers tend to serve the business areas first. The potential reason may be that it also takes a longer time to deliver packages in a business building. Serving them first can make the total service time more controllable at the end of the journey. Hence, we expect that the planned service time at the first several stops is larger than that of the last several stops. \item Most of the drivers tend to deliver large-size packages first. This may be because carrying large-size packages in the vehicle is not fuel-efficient. \end{itemize} Based on these properties, for every generated stop sequence by TSP, we check whether we need to reverse it. Given a generated route $i$, let $p^+_i$ (resp. $p^-_i$) be the average planned service time of the first (resp. last) $p\%$ stops in route $i$. We will reverse route $i$ if \begin{align} \frac{p^-_i}{p^+_i} \geq \theta, \label{eq_planned_time} \end{align} where $p$ and $\theta$ are hyperparameters representing the proportion of stops and a threshold. We set $p=15$ and $\theta=1.22$ based on cross-validation on the test set. Eq. \ref{eq_planned_time} means that in a generated sequence if the planned service time for the last several stops is too large, we may have the reversal error and need to correct it by reverse the whole sequence. After process by Eq. \ref{eq_planned_time}, we fixed all sequences that are already reversed. For the remaining sequences, we further check whether they need to be reversed based on package volumes. Specifically, given a generated route $i$, let $v^+_i$ (resp. $v^-_i$) be the total package columns (depth$\times$width$\times$height) of the first (resp. last) 15\% stops in route $i$. We will reverse route $i$ if \begin{align} \frac{v^-_i}{v^+_i} \geq \eta, \label{eq_planned_time} \end{align} where $\eta = 3$ is used. After post-processing, a sequence validity check is performed. Specifically, we check whether the first stop of the estimated sequence is the delivery station, and whether the estimated sequence has the same stop IDs as the actual one. If either of these two criteria does not hold, we return a sequence by simply sort the stops using zone IDs, which ensures that stops with the same zone IDs are close to each other. \section{Results and Conclusions} \subsection{Performance} Although the submitted formulation does not require model training, we have separated the given training set into the training (4889) and test set (1223) for self-evaluation of the machine learning models. Therefore, all self-evaluation is done over the test set. To reduce the evaluation time, we implemented the scoring function using Cython. Compared to the evaluation code in Python provided by the challenge host team, our implementation evaluates the same set of routes by using only one-third of the computation time. Figure \ref{fig:route_score_performance} shows the score distribution generated by our final algorithm. The route performance score follows an exponential distribution and most routes have a score below 0.1. The average route score is $0.0381$ for these 1223 testing routes. On the 13 routes in the given model apply set, the score was $0.0375$. \begin{figure}[H] \centering \includegraphics[width=.6\linewidth]{Figures/score_distribution.png} \caption{Route score performances.} \label{fig:route_score_performance} \end{figure} \subsection{Discussion} \textbf{Zone sequence dominates score}. We observe that, if the zone sequence is perfectly predicted, even if the stop IDs within a zone are shuffled, the average route score can reach $0.0206$. Hence, most of our jobs focus on predicting the zone sequence, instead of the stop sequence. \textbf{The three properties of zone IDs (see Section \ref{sec_data}) may imply that drivers most likely follow the planned route and seldom deviate}. As the zone ID is used to ``help simplify the route planning process'' (quoted from Slack Q\&A), we believe that Amazon plans the route in a way that the zone IDs exhibit clear patterns. So the major challenge of this problem is to recover how Amazon plans the routes. This explains why TSP works better than machine learning methods under the given current information and sample size. \textbf{The reversal problem remains}. Figure \ref{fig_example_route} shows an example of reverse prediction. Since we are not able to increase the first-zone prediction accuracy beyond 35\%, after post-processing, the reverse issues still exist. The post-processing reduces our score on our test set from 0.391 to 0.381. However, if we can have a 100\% correction rate for the reversal problems (i.e., always use the one with a smaller score), the score can reduce to 0.280, indicating that some further correction methods are needed. Note that we have tried to use the number of surrounding highway ramps as a new indicator, as well as using machine learning to predict the first zone, but it does not increase the model performance. \begin{figure}[H] \captionsetup[subfigure]{justification=centering} \centering \subfloat[Actual route]{\includegraphics[width=0.5\linewidth]{Figures/actual_route.png}\label{sub_1}} \subfloat[Predicted route by TSP]{\includegraphics[width=0.5\linewidth]{Figures/pred_route.png}\label{sub_2}} \caption{Examples of reverse prediction} \label{fig_example_route} \end{figure} \clearpage
\section{Introduction} \input{subtexes/Introduction.tex} \section{Related Works} \input{subtexes/Literature_Review.tex} \section{Problem Formulation} \input{subtexes/Problem_Formulation.tex} \section{Methodology} \input{subtexes/Methodology.tex} \section{Experiment} \input{subtexes/Experiment.tex} \section{Conclusion} \input{subtexes/Conclusion.tex} \subsection{Datasets} In this study, five real-world benchmark datasets are used for the evaluation of time series anomaly detection methods: SWaT~\cite{mathur2016swat}. WADI~\cite{ahmed2017wadi}, SMD~\cite{su2019robust}, SMAP and MSL~\cite{hundman2018detecting}. SWaT and WADI are released by iTrust Center~\footnote{\url{https://itrust.sutd.edu.sg/itrust-labs_datasets/dataset_info/}} to support research in cybersecurity. SMD is a server machine dataset collected from a large internet company. It contains 28 entities, with each being trained separately. SMAP and MSL datasets are collected from a spacecraft of NASA. Every dataset has a training set containing only normal data samples, and a separate test set containing a mixture of normal and abnormal samples. Similar to \cite{deng2021graph}, we down-sample the original data of SWaT and WADI to 1 measurement every 10 seconds by taking the median value. Additionally, datasets are normalized by min-max scaler before the training. \subsection{Baseline Methods and Evaluation Metrics} The baseline methods used in our experiments are Deep SVDD~\cite{ruff2018deep}, DAGMM~\cite{zong2018deep}, LSTM-VAE~\cite{park2018multimodal}, MAD-GAN~\cite{li2019mad}, USAD~\cite{audibert2020usad}, OMNI-ANOMALY~\cite{su2019robust}, MSCRED~\cite{zhang2019deep}, MTAD-GAT~\cite{zhao2020multivariate} and GDN~\cite{deng2021graph}. Certain methods, especially forecasting-based approaches, can achieve relatively better performance when their anomaly scores are normalized. Therefore, we apply the same scaling function in~\cite{deng2021graph}, which standardizes the anomaly scores using the median and interquartile range (IQR) of the training set, on all the baseline methods. We report the best result between the non-scaled and the scaled version. However, our model does not require any scaling on the anomaly scores, as the performance based on non-scaled scores is similar to the one based on scaled scores. F1-score is used as a performance metric to evaluate the performance of anomaly detection, which is defined as \begin{align} & F1 = 2\cdot \frac{P\cdot R}{P+R} \\ & P = \frac{TP}{TP+FP} \\ & R = \frac{TP}{TP+FN} \end{align} where P is the precision, R is the recall, and TP, FP, TN, FN stand for true positive, false positive, true negative, and false negative respectively. The threshold for all models is chosen as the one which achieves the best F1 over the test sets. In addition, we follow the point-adjusting strategy suggested in \cite{su2019robust}, which labels a whole anomaly segment as 1 as long as one of the points within the segment is detected as an anomaly. \subsection{Experimental Setup} Our model is trained with an Adam optimizer~\cite{kingma2014adam} at a learning rate of 0.001 for 10 epochs. $20\%$ of the training set is selected as a validation set where the best epoch is stored based on the validation loss. The hidden dimension is set to $d=64$, and the number of transformer blocks is set to $L=2$. The temperature $\tau$ used to construct the dynamic graphs for SWaT, SMAP, WADI, MSL, SMD are 1, 1, 5, 5, 0.5, respectively (we restrict the choices of this parameter to a limited set, $\{0.1, 0.5, 1, 5, 10\}$). The step size and the window size are set to $m=6$ and $w=5$ for all of the datasets. \subsection{Comparison Study} Table~\ref{tab:comparison_result} shows the results of comparison of all models: DyGraphAD has a better balance between precision and recall, which can be verified from the high F1 values compared to the baseline methods among all datasets (The precision and recall of DyGraphAD are on average among the top 3). In comparison, the other graph-based approaches, such as GDN and MTAD-GAT, also achieve relatively better detection performance than the majority of baseline methods. These methods leverage the inter-series relationship to assist a time series forecasting task, while anomalies are detected via one-step ahead forecasting accuracy. However, DyGraphAD still outperforms both of them in terms of F1, demonstrating a distinct advantage of explicitly utilizing dynamically evolving inter-series relationships for anomaly detection. In addition, most methods perform badly in WADI dataset due to a low recall rate. Specifically, WADI has a much lower anomaly rate compared to other datasets, making the anomaly events difficult to be captured. However, our model achieves a significant improvement in WADI compared to all baseline methods. One reason is that WADI consists of a large number of sensors, making the inter-series relationship more complex and vital to anomaly detection. We also provide the performance of the time series task and the graph forecasting task that is trained separately in the last two rows. While each task is able to achieve a reasonably well performance, combining both further improves the detection accuracy. Meanwhile, optimizing both tasks together is more computationally efficient compared to training each of them separately and then combining the scores (the training time for joint optimization is almost equivalent to training each of the tasks separately). Meanwhile, the optimization goal of one task can be beneficial to the other, i.e., both of them focus on learning a better feature representation of the inter-series relationship, which is helpful in predicting both the latest graph and next-step ahead time series value. \subsection{Ablation Study} To evaluate the effects of each sub-modules on our framework, we perform an ablation study on SWaT, WADI, and SMAP by excluding components in the default model. The results are summarized in Table~\ref{tab:ablation_result}. For the graph forecasting task, we test three scenarios: (1) removing the state update process, i.e., by only using the most recent graph to predict the current graph. (2) removing the recent graph. (3) removing the static graph (from the graph encoder) and the recent graph. The results agree with our assumptions that the forecasting performance depends on the short-term evolving dynamics of the historical graphs as well as the long-term relationship, and combining the recent graph directly can further improve the performance. For the time series forecasting module, two settings are explored: (1) removing the static graph. (2) removing the static graph and dynamic graph, i.e., by removing the graph convolution entirely. All the settings achieve relatively lower F1 than the default setting, implying both the short-term and long-term inter-series relationships are beneficial for the forecasting task. \begin{table}[h!] \small \setlength{\abovecaptionskip}{0cm} \centering \caption{Performance comparison (F1 (\%)) when core components of our model are removed.} \begin{tabular}{ccccc}\\ \toprule \textbf{Settings} & \textbf{SWaT} & \textbf{WADI} & \textbf{SMAP} \\ \midrule DyGraphAD &\textbf{92.31} &\textbf{85.38} & \textbf{94.94} \\ \midrule DyGraphAD(Graph) & 89.57 & 83.80 & 87.49 \\ (Graph) recent graph only & 87.31 & 69.49 & 85.10 \\ (Graph) wo. recent graph & 88.58 & 78.19 & 87.04 \\ (Graph) wo. recent\&static graph & 86.90 & 71.82 & 86.59 \\ \midrule DyGraphAD(TS) &87.18 & 77.05 & 91.33 \\ (TS) wo. static graph & 85.53 & 74.50 & 89.69 \\ (TS) wo. static\&dynamic graph & 84.43 & 65.01 & 89.05 \\ \bottomrule \end{tabular} \label{tab:ablation_result} \end{table} \begin{figure*}[t!] \centering \begin{subfigure}[t]{0.49\textwidth} \centering \includegraphics[height=4.2cm]{figures/swat_ts_unidentified_event1.eps} \caption{} \label{fig: swat_ts_unidentified} \end{subfigure} \hspace{\fill} \centering \begin{subfigure}[t]{0.49\textwidth} \centering \includegraphics[height=4.2cm]{figures/smd_machine-1-3_graph_unidentified_event2.eps} \caption{} \label{fig: smd_graph_unidentified} \end{subfigure} \centering \begin{subfigure}[t]{0.49\textwidth} \centering \includegraphics[height=4.2cm]{figures/swat_event-1_case_study.eps} \caption{} \label{fig: swat_event-1_case_study} \end{subfigure}\hspace{\fill} \centering \begin{subfigure}[t]{0.49\textwidth} \centering \includegraphics[height=4.2cm, width=8.3cm]{figures/swat_event-1_adjs_ours_mscred.eps} \caption{} \label{fig: swat_event-1_adjs_mscred} \end{subfigure} \caption{(a) \& (b) are time series segments from the SWaT and SMD datasets; anomaly scores and corresponding thresholds from the graph forecasting task (Graph score), the time series forecasting task (TS score), and the combination of them (Combined score) are shown in the bottom three rows, respectively. Regions highlighted in yellow are anomalies that are only captured by either the graph forecasting task or the time series forecasting task. (c) is the anomaly scores from the graph-based models corresponding to the time series segment in (a). (d) is the dynamic correlation graphs constructed around the highlighted anomaly in (a). The top two rows in (d) are the ground truth and predicted graphs of DyGraphAD, while the bottom two rows are the ground truth and reconstructed graphs of MSCRED. DyGraphAD generates large error scores for graphs during the abnormal period, while MSCRED misses the anomaly by reconstructing the graphs well in both the normal and abnormal regions.} \end{figure*} \subsection{Case Study} \subsubsection{Capturing Anomalous Graph Evolution Patterns} The basic assumption for our framework is that the graph evolution pattern in the normal state differs from that of the abnormal state. We demonstrate this idea by plotting the deviation of the node weight (sum of edge weights per node) between adjacent graphs in Figure~\ref{fig: graph deviation}: For both the SWaT and WADI datasets, the weight deviation per node of the dynamic correlation graphs at normal states is much higher compared to the case during a transition from a normal state to an abnormal state. This agrees with our assumption that the inter-series relationship at an abnormal state tends to be different from the past history, and our model is able to leverage this information in order to improve detection performance. In fact, even using the recent graph alone to predict current graph can produce reasonably well performance (as shown in Table~\ref{tab:ablation_result}). \begin{figure}[H] \centering \begin{subfigure}[t]{0.9\linewidth} \centering \includegraphics[height=2.9cm]{figures/swat_graph_deviation.eps} \caption{SWaT (51 features/nodes)} \label{fig: swat graph deviation} \end{subfigure} \newline \centering \begin{subfigure}[t]{0.9\linewidth} \centering \includegraphics[height=2.9cm]{figures/wadi_graph_deviation.eps} \caption{WADI (123 features/nodes)} \label{fig: wadi graph deviation} \end{subfigure} \caption{Deviation of node weight (sum of edge weights per node) versus feature/node id for SWaT and WADI datasets in normal states (normal), or during a transition from a normal state to an abnormal state (abnormal). On average, the node weight during a transition into an abnormal state varies more drastically than into a normal state.} \label{fig: graph deviation} \end{figure} \subsubsection{Combined Effects of Time Series and Graph Forecasting} We examine the combined effects of the time series and graph forecasting tasks through visual inspections in Figure~\ref{fig: swat_ts_unidentified}\ \&~\ref{fig: smd_graph_unidentified}. First, the graph forecasting task is more sensitive to the feature-wise information, we demonstrate this idea through an example from the SWaT dataset: The highlighted anomaly shown in Figure~\ref{fig: swat_ts_unidentified}) is caused by a cyber-attack. Specifically, when the water treatment process operates normally, water can only be pumped into the tank when the tank level is not full. Therefore, the water flow, which is measured by the sensor ``FIT101'', can be high only after the tank level, measured by ``LIT101'', goes down. However, the motorized valve ``MV101'', which controls the water flow into the tank, is forced open during a cyber-attack in the yellow region. Consequently, the attack causes tank overflow, resulting in a high value for both ``LIT101'' and ``FIT101''. As shown in the bottom part of Figure~\ref{fig: swat_ts_unidentified}, the graph forecasting task is able to identify this anomaly via an abnormal feature-wise relationship. Although this anomalous event can be possibly identified through an abnormal seasonal pattern, the time series forecasting error score around this anomaly is much smaller compared to the other anomalies (the trapezoid shape highlighted in yellow is similar to the historical patterns, resulting in a smaller forecasting error). In fact, there are many similar anomalies in SWaT and WADI datasets, where the temporal patterns around these anomalies do not deviate much from the historical sequences. Therefore, the time series forecasting task generally performs worse than the graph forecasting task in these datasets (as shown in Table~\ref{tab:comparison_result}). On the other hand, the short anomaly from SMD dataset in Figure~\ref{fig: smd_graph_unidentified} is easily identified by the time series forecasting task, but fails to be captured by the graph forecasting task alone. This is because the temporal dynamics within the graphs are in a coarser granularity than the actual time series, resulting out of ignorance of certain anomalies with very short spans. There are many other similar anomalies in the SMD, MSL and SMAP datasets, which can be detected via temporal patterns in a finer granularity. As a result, the time series forecasting task has a better performance than the graph forecasting task in those datasets (as shown in Table~\ref{tab:comparison_result}). In essence, although both tasks are able to learn temporal patterns and feature-wise relationships to some extent, each of them has a better focus on a different data dimension. Thus, combining them can eventually improve the anomaly detection performance (the global score is able to capture those anomalies as shown in the bottom section of Figure~\ref{fig: swat_ts_unidentified} and Figure~\ref{fig: smd_graph_unidentified}). \subsubsection{Comparing against Other Graph-Based Methods} \label{section: comparison study for swat data} To further explore the differences between different graph-based methods, we plot their anomaly scores corresponding to the time series segment in Figure~\ref{fig: swat_ts_unidentified}. Figure~\ref{fig: swat_event-1_case_study} shows that all of the models, except DyGraphAD, fail to capture the highlighted anomaly since their error scores are below the red threshold line. In contrast, DyGraphAD is able to identify this anomaly based on a large deviation between the predicted graph evolving pattern and the ground truth pattern (shown in Figure~\ref{fig: swat_event-1_adjs_mscred}). On the other hand, MSCRED, an approach that also identifies anomalies based on graph deviations, has generated a score substantially lower than its threshold. The bottom two rows of Figure~\ref{fig: swat_event-1_adjs_mscred} provide an explanation: Specifically, MSCRED accurately reconstructs its similarity matrices in both the normal and abnormal phases. This phenomenon traces back to the issue associated with the autoencoder, which tends to learn an identity mapping function if its underlying model architecture does not have the right degree of compression to extract the salient features from the normal samples. In addition, MSCRED adopts a graph reconstruction process based on convLSTM layers as encoder and deconvolution layers as decoder, which has limitations in modeling the graph-structured data where adjacent points are not necessarily related. In contrast, our model circumvents the aforementioned issues by adopting a forecasting framework with a graph encoder that is more suitable for graph-structured data. \subsection{Time Series Anomaly Detection} Time series anomaly detection is the process of identifying the data point or short temporal sequence that rarely occurred in the past. In general, the training scheme of a time series anomaly detection method can be classified into supervised, unsupervised, or semi-supervised learning~\cite{chandola2009anomaly}. A supervised setting requires the existence of both abnormal and normal data instances, which is often an impractical approach due to the difficulties in collecting large-scale labeled data (especially for rare abnormal cases in real-world applications). As a result, researches in the past literature have focused on unsupervised learning approaches, which do not require any labeled data instances in the training set. One limitation of this line of approaches is that they often impose strong assumptions on the distribution of normal and abnormal instances, and any deviation from such assumption will cause the model to misbehave. The semi-supervised setting is a compromise between supervised and unsupervised approaches, which assumes that the training set consists of only normal instances. Many recent studies are dedicated to this line of approaches as it is often easy to collect clean data containing only normal cases. The research of this paper falls under the semi-supervised learning setting. Given rapid advances in deep learning approaches in anomaly detection, we mainly focus on reviewing deep learning-related methods in this section. \subsection{Deep Learning based Approaches} Deep learning methods for time series anomaly detection can be generally classified into forecasting-based and reconstruction-based methods. Forecasting-based models make predictions on the current data point given the previous points, and the anomaly is identified if the predicted value of the current data point deviates substantially from its ground truth value. All regression-based models for sequential tasks belong to this branch, while the individual difference between these models lies in their underlying model architectures that encode inherent patterns within the temporal sequences. RNN-based architectures (e.g., Long Short-Term Memory (LSTM)~\cite{graves2012long} and Gated Recurrent Unit (GRU)~\cite{chung2014empirical}) and CNN-based architectures (e.g., Temporal Convolution Neural Networks (TCNs)~\cite{oord2016wavenet}) are widely used to model data with sequential patterns. Despite their capabilities to capture temporal dependencies, these models are not designed to explicitly capture the inter-series relationship. For instance, LSTM or GRU projects the input features at a specific time step into a dense vector, while the pairwise relationship among time series is not explicitly learned. Whereas TCNs captures the temporal patterns for each time series separately and aggregate them through simple average or sum pooling. Reconstruction-based models aim to learn the distribution of the normal data samples, by encoding them in a limited feature space through a reconstruction process, and a sample is identified as an anomaly if its reconstruction error is substantially larger than that of the normal samples. Representative works in this line of research are methods based on deep autoencoders (AEs)~\cite{su2019robust}~\cite{malhotra2016lstm}~\cite{park2018multimodal}, and Generative Adversarial Networks (GANs)~\cite{audibert2020usad}~\cite{li2019mad}. However, most reconstruction methods still adopt RNN-based or CNN-based neural network architecture to encode the temporal sequences, which limited their capability to model the relationship within multivariate time series. \subsection{Capture Inter-dependencies through Graphs} Recent developments of Graph Neural Networks (GNNs) has increased its adoption in time series anomaly detection to model the inter-series relationship. GDN~\cite{deng2021graph} treats each time series as a node with one-hot embedding as node features to construct a graph, which is encoded through GNNs to assist a downstream forecasting task. MTAD-GAT~\cite{zhao2020multivariate} learns a feature representation of each time series by aggregating information from similar time series or historical observations through an inter-series graph and an intra-series graph, which are constructed based on raw time series within a context window. The learned representation is used as input to both a reconstruction task and a forecasting task. Instead of using raw features or one-hot vectors as node features which may have a limited power to capture temporal patterns, FuSAGNet~\cite{han2022learning} constructs an inter-series adjacency matrix based on the latent feature representations generated from a sparse auto-encoder. Another recent work, GRELEN~\cite{zhang2022grelen} aims at reconstructing the time series through an VAE, where the latent variable is enforced to capture the inter-series relationship learned through graph structure learning. The aforementioned approaches generally assume a static feature-wise relationship globally or within the context window of a given sample, thus they cannot be used explicitly to detect deviation of inter-series relationship between normal and abnormal states. Apart from the above methods, some works construct inter-series graphs dynamically across time and perform a graph forecasting or reconstruction task. For instance, EvoNet~\cite{hu2021time} extracts representative multivariate time series segments as nodes and learns a transition probability among them during training. However, this model is designed to capture the temporal pattern shifts, not the inter-series relationship changes, between the segments at different periods. MSCRED~\cite{zhang2019deep}, a method similar to our design, aims at reconstructing a series of similarity matrices at different scales, which are encoded through an attention-based convLSTM~\cite{shi2015convolutional} network and decoded through CNN layers. However, convLSTM assumes the value of nearby pixels (of an adjacency matrix) are more related, which is actually not the case for graph-structured data. Meanwhile, the signature matrices are similarity matrices with the entry calculated based on point-wise cosine distance, which has limitations in measuring the un-synced sequences (e.g., lags exist between pairwise time series). Moreover, the training process is slow due to the reconstruction process of signature matrices at multiple scales. \subsection{Overview} In this section, we give a brief overview of the proposed framework: At the beginning, a series of inter-series graphs are constructed for each input sample in the pre-processing stage. Next, these graphs are encoded into hidden representations through a graph encoder module. The feature representations of graphs then serve as the input to a graph forecasting module and a time series forecasting module. The goal of the former is to predict the latest graph based on historical graphs, while the latter forecasts the time series value at this time step based on past values. The two tasks are optimized jointly during training, and generate a hybrid score at test time to detect anomalies. The overall pipeline is shown in Figure~\ref{fig:framework}. \begin{figure*}[t!] \centering \includegraphics[width=1\linewidth]{figures/Framework.eps} \caption{The pipeline of DyGraphAD: A list of dynamic correlation graphs are constructed based on DTW at the beginning (take step size $m=3$, and a multivariate time series with $N=5$ (5 nodes) as an example). Next, the graph encoder takes the graphs as inputs and transforms them into a list of latent representations. Finally, the feature representations of the graphs are fed into the time series (TS) forecasting module and the graph forecasting module to obtain the one-step ahead predicted multivariate time series value and the predicted latest dynamic correlation graph.} \label{fig:framework} \end{figure*} \subsection{Construction of Dynamic Correlation Graph} \label{section: similarity matrix} Before training, each input sequence is broken into a list of disjoint segments in order to construct a series of similarity matrices. The purpose of building these matrices is to facilitate the graph forecasting task, i.e., given a set of historical similarity matrices, the goal is to predict the one-step ahead future matrix, which should be readily available during training. Previous works usually construct the similarity matrix based on inner product or Euclidean distance for pairwise time series~\cite{choi2021deep}. However, those approaches are not suitable for pairwise time series that are out of sync, which is common in real-world scenarios. For instance, in industrial systems, one process may have cascading effects on the other processes, resulting in lags among multiple temporal sequences. Dynamic time warping distance (DTW)~\cite{sakoe1978dynamic} is a robust distance metric which is invariant to time shifts compared to the regular Euclidean distance metric. We adopt the fast C implementation of DTW from \cite{yurtman2021wannesm} which solves the optimal alignment match problem using a dynamic programming technique. Formally, given each sample $S^t=\{X_{\cdot i}\}_{i=t-c+1}^t$, where $c=m \cdot w$, $m$ sequential adjacency matrices $\{A^{t,s}\}_{s=1}^{m}$ are constructed, where $A^{t, s}\in R^{N\times N}$ is calculated based on the time series segment $S^{t,s} = \{X_{\cdot t-c+w(s-1)+1}, ..., X_{\cdot t-c+ws}\}$ with a window size of $w$ (see Figure~\ref{fig:framework} for a visual example). $w$ and $m$ are two hyper-parameters tuned for each specific dataset. In our implementation, $w$ and $m$ together determine the length $c$ of $S^t$. An entry in one adjacency matrix represents the normalized similarity (i.e., between 0 and 1) between pairwise time series. Since DTW calculates an unbounded distance between two temporal sequences, we convert the entry of adjacency matrix $A^{t,s}$ within the range of 0 and 1 by \begin{equation} A_{i,j}^{t,s}=\exp\left(-\frac{DTW^2(S_{i\cdot}^{t,s}, S_{j\cdot}^{t,s})}{\tau}\right) \end{equation} where $\tau$ is a hyper-parameter. $\{A^{t,s}\}_{s=1}^m$ is referred to as dynamic correlation graphs throughout this paper. \subsection{Graph Encoder Module} \label{section: graph feature extraction} The graph encoder module encodes the dynamic correlation graphs into low-dimensional feature representations, with the purpose of capturing the temporal dynamics between graphs and the inherent structure within each graph. Specifically, an input sample is first broken into segments within a time window aligned with each dynamic correlation graph. Then, a graph convolution layer is applied on top of each graph with a latent representation of its corresponding segment as node features to obtain the hidden representations for each graph. Formally, given a multivariate time series sample $S^t \in R^{N \times c}$, we first feed it into a 2D convolution layer, with a kernel size $(1, 1)$ and a channel size of $d$, to obtain an initial representation $C^t \in R^{d \times N \times c}$. Then a dilated inception layer (DIL)~\cite{wu2020connecting}, with a kernel combination of $\{2, 3, 5, 7\}$ and a channel size of $d$, is applied to obtain a feature representation $Z^t \in R^{d \times N \times c}$. The justification of the DIL layer is that aggregating nearby points through different kernel sizes can help the model to learn the similarity between pairwise time series up to a certain time shift, thereby mimicking the operation of DTW distance. Moreover, the DIL layer can later be stacked multiple times, with its dilation factor growing exponentially to capture long-range temporal patterns. Next, the feature representation $Z^{t}$ is broken into $m$ segments $\{Z^{t, s}\}_{s=1}^m$ along the time dimension coinciding with the same time window for each of the dynamic correlation graphs. Each of the time series segment $Z^{t,s} \in R^{d \times N \times w}$, together with an adjacency matrix capturing the inter-series relationship at step $s$, will be later used as the inputs to a graph convolution module to obtain a final feature representation of each graph. Instead of directly using the dynamic correlation graph $ A^{t,s}$, we use a new matrix $\Tilde{A}^{t,s}$ as the adjacency matrix for the graph convolution module, which is calculated as a weighted combination of $A^{t,s}$ and a global static adjacency matrix $Q \in R^{N \times N}$ \begin{align} \label{eq. generate weighted graphs} & \Tilde{A}^{t,s} = \sigma(W_1) \odot Q + (1-\sigma(W_1)) \odot A^{t,s} \\ & Q_{ij} = f_a (\xi_{i}\mathbin\Vert \xi_{j} \end{align} where $\xi_i\in R^{d}$ is a learnable embedding representing time series $i$, $W_1 \in R^{N \times N}$ is a learnable weight matrix and $\sigma$ is a sigmoid function. $f_a$ is a graph generator function, i.e., a two-layer fully connected neural network with an output dimension $1$. $\odot$ is the element-wise multiplication and $\mathbin\Vert$ is the concatenation operation. Intuitively, the dynamic correlation graphs capture the short-term evolution patterns for the inter-series correlations at different steps, whereas the static correlation graph captures the long-term correlations, and impose constraints such that the learned node features are close to each other through the series of the graphs. Thus combining them enables us to capture both effects. Furthermore, the weighted matrix $\Tilde{A}^{t,s}$ improves the performance for both graph and time series forecasting tasks compared to using the DTW similarity matrix alone, which is validated in our experiments. Upon obtaining $\Tilde{A}^{t,s}$, we feed it together with $Z^{t,s}$ into a MixHop graph convolution~\cite{wu2020connecting} module in sequence to obtain a list of hidden states $\{H^{t,s}\}_{s=1}^m$, where $H^{t,s} \in R^{d \times N \times w}$ contains the node feature representations of each graph $\Tilde{A}^{t,s}$. \subsection{Graph Forecasting Module} \label{section: graph forecasting} Graph forecasting module, which consists of an encoder for a sequence of graphs, a decoder, and a recent graph update component, takes the list of graph hidden states $\{H^{t,s}\}_{s=1}^{m-1}$ from the graph encoder module as inputs and produces a single graph $\hat{A}^{t,m} \in R^{N \times N}$ as the output. The encoder consists of $L$ Transformer blocks on top of a learnable positional encoding layer. Specifically, we take the mean pooling along the time axis for each of the graph hidden states, and then concatenate the outputs into $P^t \in R^{N \times m \times d}$, i.e., $m$ hidden states with dimension $d$ for each of the time series. Then, the positional embedding and the Transformer blocks are applied along the second dimension, in order to preserve the positional information within the sequence of graphs, and learn the temporal dynamics among them. We adopt a causal attention mask for the multi-head attention mechanism of Transformer blocks to avoid information being leaked from future graphs to past graphs. Next, the aggregated hidden representation $O^t \in R^{N \times d}$ for the list of graphs is obtained by applying mean pooling along the segment (second) dimension of the outputs from the Transformer. Finally, the graph decoder converts the hidden state $O^t$ into an $N \times N$ adjacency matrix $E^t \in R^{N \times N}$ \begin{align} \label{eq. graph forecast: output pooling} & J^t = f_d(O^t) \\ \label{eq. graph forecast: output decode} & E^t = (J^t){(J^t)}^T \end{align} where $f_d$ is a two-layer fully connected neural network with an output dimension $d$, followed by a $l_2$ normalization on the last dimension. Instead of directly adopting $E^t$, we combine the most recent graph with it to obtain a predicted graph $\hat{A}^{t, m}$ at the $m^{th}$ step: \begin{align} \label{eq. graph forecast: recent graph update} \hat{A}^{t, m} = \sigma(W_2)\odot E^t+(1-\sigma(W_2))\odot A^{t,m-1} \end{align} where $W_2 \in R^{N \times N}$ is a learnable weight matrix. The intuition is that the graph structure often varies smoothly over time rather than drastically under a relatively smaller time period, which makes the recent graph a good predictor for the future graph. Meanwhile, it compensates for the drawback of the graph encoder, which compresses the list of dynamic graphs into a sequence of low-dimensional states for efficient computation, but suffers from information loss under the data compression. \subsection{Time Series Forecasting Module} \label{section: time series forecasting} One limitation of the graph forecasting task is its relatively low power to capture the temporal pattern within each time series, due to the discrete nature of the graphs by design: graphs are set apart from each other by a certain distance, resulting in a longer time span and better computational efficiency but a coarser version of the original time series. The time series forecasting module is designed to mitigate the drawbacks of the graph forecasting task. The module couples the graph encoder with the temporal convolution layers to make prediction about the next-step ahead time series values. As demonstrated in other graph-based frameworks (e.g., GDN and MTAD-GAT), aggregating information from similar time series through graph neural networks improves the performance of time series forecasting. Formally, the graph hidden states $\{H^{t,s}\}_{s=1}^{m}$ are concatenated along the time axis, followed by a batch normalization~\cite{ioffe2015batch}, to obtain $M^t \in R^{d \times N \times c}$. Unlike the raw sample $S^t$, each time series in $M^t$ contains the information propagated from other time series based on the inter-series relationship through the MixHop graph convolution. Finally, we obtain the predicted time series value vector $\hat{y}^{t+1}$ at time $(t+1)$ as \begin{align} & \hat{y}^{t+1} = f_o(\text{pooling}( f_1(C^t) \mathbin\Vert f_2(Z^t)) \mathbin\Vert f_3(M^t)) \end{align} where $f_1$, $f_2$, and $f_3$ are 2D convolution layers having a kernel size of $(1, c)$ and a channel size of $d$, and $f_o:R^{d\times N}\rightarrow R^N$ is an output layer, i.e., a two-layer fully connected neural network. $C^t$ and $Z^t$ are the initial feature representation and DIL output obtained from the graph encoder. The concatenation and the sum pooling are both applied on the time (third) dimension. Note that here we adopt a simple sequence encoder in our experiments which produces reasonably well performance. However, our framework can be easily extended to other advanced architectures, for instance, by applying multiple stacked DIL layers on top of $M^t$. \subsection{Objective Function} The training objective is to minimize the forecasting loss of both the next-step ahead time series values and the latest dynamic correlation graph at each time tick. The loss function is \begin{align} L = \sum_{t\in T_{\text{train}}}{\frac{1}{N}\|y^{t+1}-\hat{y}^{t+1}\|_2^2 + \frac{1}{N^2} \| A^{t,m} - \hat{A}^{t,m} \|_F^2} \label{eq.loss function} \end{align} where $y^{t+1}$ and $A^{t,m}$ are the multivariate time series value at time step $(t+1)$ and the $m^{th}$ dynamic correlation graph, given the input multivariate time series sample $S^t$. \subsection{Anomaly Score} The anomaly score at $t$ for each time series $i$ is calculated as \begin{align} & \text{Err}^t_i = \frac{1}{\frac{1}{\text{Err}^t_{i, \text{ts}}} +\frac{1}{\text{Err}^t_{i, \text{graph}}}} \end{align} where $\text{Err}^t_{i, \text{ts}}$ is a squared error of the $i^{th}$ predicted time series value at $t$ and $\text{Err}^t_{i, \text{graph}}$ is a mean squared error at the $i^{th}$ row of the predicted dynamic correlation graph at t. We adopt a harmonic mean of both errors as the final score for each time series since the two scores have different scales. Finally, the anomaly score at $t$ is obtained as the average score of $N$ time series.
\section{Introduction}\label{sec:introduction} While the NLP field has seen tremendous progress over the last decade, building models capable of identifying abstract concepts remain a highly challenging problem. This difficulty stems from two key reasons. First, these concepts can manifest in very different ways in text. For example, the concept of \textit{fairness}, that we discuss at length in this paper, can be discussed in the context of the abortion debate (e.g., \textit{``right to privacy''}) or in the context of Covid-19 vaccination (e.g., \textit{``everyone should have access to the vaccine''}). Learning to identify instances of this concept in previously unseen contexts remains a challenge. Second, building NLP models using the supervised learning paradigm requires humans to annotate data, which for such tasks is a cognitively demanding process. In this paper, we investigate whether the recently introduced paradigm of zero/few shot learning using Large Language Models~\cite{brown2020language} is better equipped to deal with these challenges. We focus on a recently introduced framework for analyzing moral sentiment, called \textit{morality frames}~\cite{roy2021identifying}. This framework builds on, and extends, moral foundation theory~\cite{haidt2007morality}, which identifies five moral values (i.e., foundations, each with a positive and a negative polarity) central to human moral sentiment which include Care/Harm, Fairness/Cheating, Loyalty/Betrayal, Authority/Subversion, and Purity/Degradation. Morality frames is a relational framework that identifies expressions of the moral foundations in text and associates moral roles with entities mentioned in it (see Section~\ref{sec:dataset} for details). Unlike previous approaches to this task~\cite{roy2021identifying,pacheco-etal-2022-holistic} which use annotated data to train a relational classifier using DRaiL~\cite{pacheo-etal-DRAIL}, we define the task as a zero/few shot problem. We rely on in-context learning using Large Language Models for the identification of morality frames. In in-context learning, a desired NLP task is framed as a text generation problem where the Large Language Models are provided with zero/few shot input-output pairs and prompted to generate label for the test data point without updating parameters of the LLMs \cite{min2021recent}. In this paper, we introduce several prompting techniques for LLMs for the identification of morality frames in tweets that rely on only few-shot examples. We compare our models' performance with few-shot RoBERTa-based \cite{liu2019roberta} classifiers. We found that prompting-based techniques underperform RoBERTa in identification of subtle concepts like moral foundations, but in case of moral role identification, the prompting-based techniques outperforms RoBERTa by a large margin. Note that moral roles are directed towards entities and are more evident than subtle moral foundations. Our promising findings in this paper suggest that in-context learning approaches can be useful in many Computational Social Science related tasks and we propose a few potential future directions of this work. \section{Related Works}\label{sec:related-works} There has been a lot of work towards exploiting existing knowledge in pretrained Large Language Models (LLMs) and improving its few-shot abilities on various downstream tasks in NLP. Some of these works have been influenced from areas related to instruction-based NLP~\cite{goldwasser2014learning}. ~\citeauthor{mishra2021cross}, \citeyear{mishra2021cross} fine-tuned a 140M parameter BART~\cite{lewis2019bart} model using instructions and few-shot examples for various NLP tasks such as text classification, question answering, and text modification. This work suggests that augmenting instructions in the fine-tuning process improves model performance on unseen tasks. On similar lines, through a large scale experiment with over 60 different datasets, ~\citeauthor{wei2021finetuned},~\citeyear{wei2021finetuned} showed that instruction tuning on a LLM ($\approx$137B parameters) improves zero and few-shot capabilities of these models. Other notable works~\cite{min2021metaicl,sanh2021multitask} show that even a relatively smaller language model can achieve substantial improvement in a similar setting. Furthermore, ~\citeauthor{schick2020exploiting},~\citeyear{schick2020exploiting} use cloze-style phrases in a semi-supervised manner to help LM assign a sentiment label for the text classification task. Another line of work focuses on improving LM on downstream tasks with no parameter updates.~\citeauthor{brown2020language}, \citeyear{brown2020language} proposed to improve LLM few-shot performance by conditioning on concatenation of training examples without any gradient updates. Other works~\cite{min2021noisy,zhao2021calibrate} have further improved this work and have shown consistent gains in various NLP tasks. In addition,~\citeauthor{wei2022chain}, \citeyear{wei2022chain} shows that sufficiently large LM can exploit its innate reasoning abilities to solve complex tasks when provided with a series of intermediate steps during prompting. However, having a generalized LLM may have poor performance when the downstream task needs nuanced understanding of the text or is very different from language modeling in nature. While ~\citeauthor{schick2020exploiting}, \citeyear{schick2020exploiting} and ~\citeauthor{gao2020making}, \citeyear{gao2020making} have studied sentiment classification task in few-shot settings, not many works are available towards utilizing LLM without finetuning it to understand more nuanced concepts like political framing \cite{boydstun2014tracking}, moral foundations \cite{haidt2004intuitive, haidt2007morality}, among others. Previous work \cite{royweakly} has performed nuanced analysis of political framing by breaking the policy frames proposed by \citeauthor{boydstun2014tracking}, \citeyear{boydstun2014tracking}, into fine-grained sub-frames. It was observed that the sub-frames better captured political polarization by providing a structural breakdown of policy frames. A later work \cite{roy2021analysis} studied the Moral Foundation Theory \cite{haidt2004intuitive, haidt2007morality} at entity level and proposed a knowledge representation framework for organizing moral attitudes directed at different entities. The structured framework is named morality frames \cite{roy2021identifying}. These nuanced structural frameworks, such as, frames, sub-frames, entity-centric moral sentiments (morality frames), are expensive to annotate as they largely depend on human knowledge. A few-shot automatic identification of such concepts is required to save manual human-effort and for performing these studies at scale. In this paper, we take the first step towards the analysis on how well LLMs can understand these psycho-linguistic concepts in few-shot settings. As our first study, we explore in-context learning of morality frames in this paper and leave the study of framing and sub-frames as a future work. \section{Dataset}\label{sec:dataset} We conduct our study on the dataset proposed by \citet{roy2021identifying}. In this dataset, there are $1599$ political tweets from US politicians that are annotated for moral foundations by \citet{johnson2018classification}. \citet{roy2021identifying} proposed Morality Frames and broke down the sentence level moral foundations into nuanced moral role dimensions that capture sentiment towards entities expressed in the text. The moral foundations and corresponding moral roles can be found in Table \ref{tab:moral-foundation-roles}. \citet{roy2021identifying} annotated the dataset proposed by \citet{johnson2018classification} for these moral sentiments towards entities. \begin{table}[ht!] \begin{center} \scalebox{0.70}{\begin{tabular}{>{\arraybackslash}m{5.5cm}|>{\arraybackslash}m{4.5cm}} \hline \textbf{Moral Foundations} & \textbf{Moral Roles}\\ [0.5ex] \hline \textbf{Care/Harm:} Care for others, generosity, compassion, ability to feel pain of others, sensitivity to suffering of others, prohibiting actions that harm others. & \makecell[l]{Target of care/harm\\Entity causing harm\\Entity providing care}\\ \hline \textbf{Fairness/Cheating:} Fairness, justice, reciprocity, reciprocal altruism, rights, autonomy, equality, proportionality, prohibiting cheating. & \makecell[l]{Target of fairness/cheating\\Entity ensuring fairness\\Entity doing cheating}\\ \hline \textbf{Loyalty/Betrayal:} Group affiliation and solidarity, virtues of patriotism, self-sacrifice for the group, prohibiting betrayal of one’s group. & \makecell[l]{Target of loyalty/betrayal\\Entity being loyal\\Entity doing betrayal}\\ \hline \textbf{Authority/Subversion:} Fulfilling social roles, submitting to authority, respect for social hierarchy/traditions, leadership, prohibiting rebellion against authority. & \makecell[l]{Justified authority\\Justified authority over\\Failing authority\\Failing authority over}\\ \hline \textbf{Purity/Degradation:} Associations with the sacred and holy, disgust, contamination, religious notions which guide how to live, prohibiting violating the sacred. & \makecell[l]{Target of purity/degradation\\Entity preserving purity\\Entity causing degradation}\\ \hline \end{tabular}} \caption{Morality Frames: Moral foundations and their associated roles. (Adopted from \cite{roy2021identifying}).} \label{tab:moral-foundation-roles} \end{center} \end{table} In this paper, our goal is to study the identification of morality frames when only few-shot training examples are available. To build this setup, we randomly sampled $10$ tweets from each of the $5$ moral foundations, and used it as training set. We use Large Language Models (LLMs) for in-context learning that are expensive and resource heavy even for inference only. So, we benchmark our approaches using a smaller test set containing randomly sampled $20$ tweets per moral foundation. It resulted in $103$ and $207$ tweet-entity pairs in the training and the test set, respectively. \section{Task Definition}\label{sec:task-definition} The identification of morality frame in a tweet involves the following two steps.\\ \noindent\textbf{Identification of Moral Foundation:} Given a tweet text $t$, the task is to identify the moral foundation expressed in the tweet.\\ \noindent\textbf{Identification of Moral Roles of Entities:} After identification of moral foundation, the second step is to identify the moral roles of entities in the tweet. We study this step in the following two settings. \begin{itemize} \item \textbf{Entities are pre-identified:} In this setting, the assumption is that the entities are already identified in the tweet text. The task is to assign moral roles to them. So, given a tweet $t$, an entity $e$ mentioned in the tweet, and the moral foundation label of the tweet $m$, the task is to identify the moral role of $e$ in $t$. \item \textbf{Entities are not pre-identified:} In this setting, a tweet $t$, and its corresponding moral foundation label $m$ is known in prior. The task is to identify the entities mentioned in the tweet, and their corresponding moral roles. \end{itemize} Examples of the tasks can be found in Figure \ref{fig:settings}. \begin{figure}[h!] \includegraphics[width=0.5\textwidth]{figures/tasks.pdf} \caption{Morality frames identification task. Input for each step is colored in blue and expected outputs are colored in red.} \label{fig:settings} \end{figure} \section{Few-Shot Identification of Morality Frames using Large Language Models}\label{sec:model} \subsection{In-Context Learning} In-context learning using pretrained LLMs has been shown effective in few-shot scenarios in previous studies for different NLP tasks \citep{brown2020language,wei2022chain,reif2021recipe}. LLMs are pretrained on huge amount of web-crawl, books and Wikipedia text. Hence, they are expected to carry world-knowledge. As a result, they are able to perform many NLP tasks using only few-shot training examples without any further fine-tuning or gradient updates. In the in-context learning paradigm, the downstream task is framed as a text generation problem and the model is prompted to generate the next tokens \cite{min2021recent}. These tokens are mapped to desired output labels in classification tasks. In this work, we assume that only few-shot examples are given for the morality frames identification task. So, we apply in-context learning approach for this purpose to perform different steps of the task defined in Section \ref{sec:task-definition}. Note that we do not update LLM parameters in this process. The proposed in-context learning approaches are described in the subsequent sections. \subsection{Moral Foundation (MF) Identification} Following the previous works, we frame the task of moral foundation identification as a text generation problem where the model is prompted to generate the moral foundation label of a tweet. To this end, we experiment with two different types of prompting techniques.\\ \noindent\textbf{MF identification in one pass:} In this method, we provide the moral foundation definitions (from Table \ref{tab:moral-foundation-roles}) in the beginning of the prompt as a guideline for the language model. Then, few-shot training examples and their associated labels are provided in the prompt. Finally, the test tweet is provided as the last example in the prompt and the model is expected to generate the moral foundation label of this tweet. The prompt template for this approach can be seen in Figure \ref{fig:mf-direct-template}.\\ \begin{figure}[h!] \centering \includegraphics[width=0.45\textwidth]{figures/mf-classification-direct-template.pdf} \caption{Prompt template for identification of moral foundation in one pass. The blue colored segment is input prompt and the red colored segment is the generated output by the LLMs. Example of this prompt template can be seen in Appendix \ref{appx:prompt-examples}: Figure \ref{fig:mf-direct-example}.} \label{fig:mf-direct-template} \end{figure} \noindent\textbf{MF identification in one-vs-all manner:} Identification of moral foundations in one-pass might be difficult for the language models. So, we propose one-vs-all prompting approach where the language model is prompted to predict if a certain moral foundation is present in the tweet. This step is repeated for each of the five moral foundations. The moral foundation predicted with the highest confidence is consolidated as the predicted label. To obtain the confidence score, we prompt the language model multiple times with different random seeds to generate multiple predictions for a single tweet. The final confidence score is the percentage of times a specific moral foundation is generated by the LLM. In case there is a tie between two moral foundation labels, we perform a second prompting step, where few-shot prompting enables to break the tie between moral foundations.\footnote{In case of tie among more than two moral foundations, we break that by randomly selecting one.} Prompt templates for these two steps can be seen in Figure \ref{fig:mf-one-vs-all}. \begin{figure}[t!] \begin{center} \begin{subfigure}[t]{0.45\textwidth} \centering \includegraphics[width=1\textwidth]{figures/mf-classification-two-steps-step1-template.pdf} \caption{Prompt template for one-vs-all MF identification in case of `Care/Harm'.} \label{fig:step-1} \end{subfigure} \\ \begin{subfigure}[t]{0.45\textwidth} \centering \includegraphics[width=1\textwidth]{figures/mf-classification-two-steps-step2-template.pdf} \caption{Prompt for tie-breaking between two MFs. For example, between `Care/Harm' and `Purity/Degradation'.} \label{fig:step-2} \end{subfigure} \caption{Prompt templates for moral foundation identification technique in one-vs-all manner. The blue colored segments are input prompts and the red colored segments are the generated output by the LLMs. Corresponding prompt example can be seen in Appendix \ref{appx:prompt-examples}: Figure \ref{fig:mf-one-vs-all-example}.} \label{fig:mf-one-vs-all} \end{center} \end{figure} \subsection{Moral Role Identification of a Pre-identified Entity} Post prediction of the moral foundation label, the next step is to identify moral roles of entities as described in the Section \ref{sec:task-definition}. Given a test tweet, and a predicted moral foundation label for it, we prompt the LLMs to generate moral role of an entity in a tweet only from the associated moral roles to the predicted moral foundation. For example, if a tweet is identified to be having the moral foundation `Care/Harm', we prompt the language model to predict the the moral role of an entity mentioned in the tweet from only three moral roles that are associated to `Care/Harm', namely, `Entity target of care/harm', `Entity causing harm', `Entity providing care'. We propose two prompting approaches for this task.\\ \noindent\textbf{Moral role identification in one pass:} We prompt the LLMs to directly identify moral role of a given entity from the corresponding moral roles in one pass using the prompt shown in Figure \ref{fig:mf-role-direct-template}. Following the moral foundation classification prompt template, we provide the description of the moral roles in the template as guideline. We come up with the definitions based on intuition.\\ \begin{figure}[h!] \centering \includegraphics[width=0.45\textwidth]{figures/mf-role-classification-direct-template.pdf} \caption{Prompt template for identification of moral role in one pass in case of `Care/Harm'. The blue colored segment is input prompt and the red colored segment is the generated output by the LLMs. Corresponding prompt example can be seen in Appendix \ref{appx:prompt-examples}: Figure \ref{fig:mf-role-direct-example}.} \label{fig:mf-role-direct-template} \end{figure} \noindent\textbf{Moral role identification in two steps:} In the morality frames, different moral foundation roles intuitively carry either positive or negative sentiment towards them. For example, "entity causing harm", "entity violating fairness", "entity doing cheating", "failing authority" and "entity doing degradation" are the roles carrying negative sentiment towards them. The rest of the entity roles carry positive sentiment towards them. With this intuition, we break down the task of moral role identification in two steps. In the first step, we prompt the LLMs to identify the sentiment towards entities in "positive" and "negative" dimensions only by using the prompt structure in Figure \ref{fig:mf-role-step-1}. Now the entities discovered as having negative sentiment towards them directly maps to one of the five negative sentiments, each associated with only one of the moral foundations. Given the moral foundation is discovered in the previous step, we can readily map the entities with negative sentiments to one of the negative moral roles. Now, each moral foundation has two or more positive moral roles associated to them. To differentiate among them, we perform another prompting step where the LLMs are prompted to generate one of the positive moral roles for an entity in a tweet. The prompt template is shown in Figure \ref{fig:mf-role-step-2}. \begin{figure}[t!] \begin{center} \begin{subfigure}[t]{0.45\textwidth} \centering \includegraphics[width=1\textwidth]{figures/mf-role-classification-two-steps-step1-template.pdf} \caption{Step-1: Prompt template for identification of positive/negative sentiment towards entities.} \label{fig:mf-role-step-1} \end{subfigure} \\ \begin{subfigure}[t]{0.45\textwidth} \centering \includegraphics[width=1\textwidth]{figures/mf-role-classification-two-steps-step2-template.pdf} \caption{Step-2: Prompt template for differentiating among multiple positive moral roles in case of `Care/Harm'.} \label{fig:mf-role-step-2} \end{subfigure} \caption{Prompt templates for moral role identification by breaking the task in 2 steps. The blue colored segments are input prompts and the red colored segments are the generated output by the LLMs. Corresponding prompt examples can be seen in Appendix \ref{appx:prompt-examples}: Fig. \ref{fig:mf-role-two-steps-example}.} \label{fig:mf-role-two-steps} \end{center} \end{figure} \subsection{Identification of entities and corresponding moral roles jointly} In this approach, we propose a prompting method for the setting where the the entities are not pre-identified as described in Section \ref{sec:task-definition}. In this setting, the moral foundation is known for a tweet and the target entities in the tweets are not explicitly given. We create a prompt similar to a slot filling task where the LLMs have to fill the slots of moral roles with entities mentioned in the tweet. The prompt template is shown in Figure \ref{fig:mf-role-entity-direct-template}. \begin{figure}[h!] \centering \includegraphics[width=0.45\textwidth]{figures/mf-role-classification-predict-entity-and-label-template.pdf} \caption{Prompt template for identification of entity and corresponding moral roles jointly in case of `Care/Harm'. The blue colored segment is input prompt and the red colored segment is the generated output by the LLMs. Corresponding prompt example can be seen in Appendix \ref{appx:prompt-examples}: Figure \ref{fig:mf-role-entity-direct-example}.} \label{fig:mf-role-entity-direct-template} \end{figure} \section{Experimental Evaluation}\label{sec:experimental-eval} In this section first we discuss our experimental setting. Secondly, we discuss our proposed models' performance in morality frame identification. \subsection{Experimental Settings} \noindent\textbf{Large Language Model:} We use an open-source Large Language Model named GPT-J-6B \cite{gpt-j}. This is 6B parameters decoder only language model. We use top-k (k=5) sampling with temperature (=0.5) \cite{holtzman2019curious} as a decoding method for the language model. Note that, we do not update the parameters of the model in the in-context learning steps. For each of the test data point, we run the model with $5$ random seeds each generating $2$ outputs, hence, yielding 10 predictions for each data point. We take the majority voting among these predictions to get the predicted label.\\ \noindent\textbf{Ablation study:} We experiment with various numbers of training examples in the prompts. In this paper, we define number of shots or training examples $k$, as the number of examples used for training from each class related to a classification task. For moral foundation identification and moral roles identification of the pre-identified entities, we experiment with 0 to 5 shots. In the moral role identification method where entities are not pre-identified, we experiment with 0, 1, 3, 5, 7, 10 shots. Because of the limit in the number of tokens in the prompt we cannot experiment with more number of shots. In all of our prompting methods we provide the description of the expected labels as task instruction in the prompt. As a result, a zero-shot learning is feasible in our setting. We run all of the studies using the train and test set described in Section \ref{sec:dataset}. \begin{table*}[ht!] \centering \resizebox{2\columnwidth}{!}{% \begin{tabular} {>{\arraybackslash}m{5cm}>{\centering\arraybackslash}m{1.5cm}>{\centering\arraybackslash}m{1.7cm}>{\centering\arraybackslash}m{1.7cm}>{\centering\arraybackslash}m{1.9cm}>{\centering\arraybackslash}m{1.7cm}>{\centering\arraybackslash}m{1.7cm}} \toprule \multicolumn{1}{c}{} & \multicolumn{6}{c}{\textbf{Macro F1 score for various number of shots per class}}\\ \cmidrule(lr){2-7} \textbf{Models} & \textbf{0-shot} & \textbf{1-shot} & \textbf{2-shots} & \textbf{3-shots} & \textbf{4-shots} & \textbf{5-shots}\\ \cmidrule(lr){1-1}\cmidrule(lr){2-7} One-Pass prompting for 5 classes & 6.24 & 24.19 & 29.80 & 30.63 & 39.49 & 43.56\\ One-vs-all prompting & 13.23 & 20.46 & 24.34 & 20.51 & 27.76 & 15.70\\ \cmidrule(lr){1-7} RoBERTa (Parameters frozen) & N/A & 7.61 (1.9) & 7.84 (2.3) & 8.1 (2.9) & 8.21 (3.1) & 8.0 (2.6)\\ RoBERTa (Finetuned) & N/A & 19.68 (7.3) & 33.22 (9.6) & 37.05 (5.8) & 38.78 (5.9) & 45.42 (6.6)\\ \bottomrule \end{tabular}} \caption{Few-shot moral foundation identification results. Between the prompting-based methods, the one-pass prompting method is the best performing one. The one-pass prompting method outperforms parameters-frozen RoBERTa, but underperforms finetuned RoBERTa in few-shot training setup.}\label{tab:mf-identification} \end{table*} \begin{table}[ht!] \begin{center} \scalebox{0.7}{ \begin{tabular}{>{\arraybackslash}m{4cm}>{\centering\arraybackslash}m{1cm}>{\centering\arraybackslash}m{1cm}>{\centering\arraybackslash}m{1cm}>{\centering\arraybackslash}m{1.3cm}} \hline \textbf{Morals} & \textbf{Prec.} & \textbf{Rec.} & \textbf{F1} & \textbf{Support}\\ \hline \textbf{Care/Harm} & 31.82 & 70.00 & 43.75 & 20\\ \textbf{Fairness/Cheating} & 66.67 & 10.00 & 17.39 & 20\\ \textbf{Loyalty/Betrayal} & 31.43 & 55.00 & 40.00 & 20\\ \textbf{Auth./Subversion} & 87.50 & 35.00 & 50.00 & 20\\ \textbf{Purity/Degradation} & 100.0 & 50.00 & 66.67 & 20\\ \hline \textbf{Accuracy} & & & 44.00 & 100\\ \textbf{Macro Average} & 63.48 & 44.00 & 43.56 & 100\\ \textbf{Weighted Average} & 63.48 & 44.00 & 43.56 & 100\\ \hline \end{tabular} } \caption{Per class moral foundation classification results for one-pass prompting (using 5-shots per class).} \label{tab:per-class-classification-results-moral-foundation} \end{center} \end{table} \noindent\textbf{Baseline:} We compare our models' performance with a few-shot RoBERTa-based \cite{liu2019roberta} text classifier. For the identification of moral foundation in a tweet, we encode the tweet using RoBERTa where the embedding of the [CLS] token of the last layer is used as a representation of the text. This representation is used for moral foundation classification. For moral role identification of an entity in the tweet, we encode the tweet and the entity using two RoBERTa instances, and concatenate their representations to get a final representation. This concatenated representation is used for moral roles classification. Note that, the RoBERTa-based classifiers are trained with few-shot examples only as the prompting based methods. We run the RoBERTa-based classifiers 5 times using 5 random seeds and report the average result. \noindent\textbf{Implementation Infrastructure} We ran all of the experiments on a 4 core Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz machine with 64GB RAM and two NVIDIA GeForce GTX 1080 Ti 11GB GDDR5X GPUs. GPT-J-6B was mounted using two GPUs. We used PyTorch library for all of the implementations. \subsection{Results} \noindent\textbf{Moral Foundation Identification:} In Table \ref{tab:mf-identification}, we show the results for moral foundation identification using our two proposed methods and few-shot RoBERTa. It can be seen that as the number of shots increases the performance improves in almost all of the cases. We also found that performance with RoBERTa is pretty bad with no gradient updates. But fine-tuning RoBERTa with few-shot examples provide reasonable performance. We found that the one-vs-all prompting technique underperforms the one-pass prompting technique, except in the zero-shot setting. Our intuition is that the language model is able to learn better when more contrastive examples are given which is the case in the one-pass method. Per class classification results for one-pass prompting using 5-shot examples per class are shown in Table \ref{tab:per-class-classification-results-moral-foundation}. However, the one-pass prompting technique outperforms the one-vs-all technique but underperforms few-shot RoBERTa with finetuning. It seems that without fine-tuning the subtle moral foundation identification is a difficult task for the LLMs.\\ \begin{table*}[ht!] \centering \resizebox{2.1\columnwidth}{!}{% \begin{tabular} {>{\arraybackslash}m{3.5cm}>{\arraybackslash}m{3.5cm}>{\centering\arraybackslash}m{2cm}>{\centering\arraybackslash}m{2cm}>{\centering\arraybackslash}m{2cm}>{\centering\arraybackslash}m{2cm}>{\centering\arraybackslash}m{2cm}} \toprule \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{5}{c}{\textbf{Macro F1 score for various number of shots per class}} \\ \cmidrule(lr){3-7} \textbf{Moral Foundations} & \textbf{Models} & \textbf{1-shot} & \textbf{2-shots} & \textbf{3-shots} & \textbf{4-shots} & \textbf{5-shots}\\ \cmidrule(lr){1-1}\cmidrule(lr){2-2}\cmidrule(lr){3-7} \multirow{3}{*}{\textbf{\makecell[l]{Care/Harm}}} & One-Pass Prompting & 48.21 & 58.61 & 74.37 & 70.98 & 68.41\\ & 2-Steps Prompting & 37.77 & 42.04 & 58.29 & 68.97 & 63.76\\ & RoBERTa (Finetuned) & 31.67 (13.4) & 35.79 (13.2) & 35.35 (14.0) & 30.64 (14.0) & 43.83 (26.0)\\ \cmidrule(lr){1-7} \multirow{3}{*}{\textbf{\makecell[l]{Fairness/Cheating}}} & One-Pass Prompting & 42.92 & 71.86 & 75.95 & 82.26 & 74.65\\ & 2-Steps Prompting & 40.91 & 71.28 & 72.64 & 74.92 & 68.70\\ & RoBERTa (Finetuned) & 26.89 (11.9) & 46.16 (6.0) & 43.06 (3.6) & 35.61 (15.2) & 42.95 (12.9)\\ \cmidrule(lr){1-7} \multirow{3}{*}{\textbf{\makecell[l]{Loyalty/Betrayal}}} & One-Pass Prompting & 35.56 & 36.40 & 35.24 & 45.10 & 41.27\\ & 2-Steps Prompting & 30.39 & 38.69 & 32.32 & 38.82 & 25.83\\ & RoBERTa (Finetuned) & 21.29 (3.0) & 28.39 (7.1) & 24.14 (11.5) & 37.73 (1.7) & 36.57 (8.2)\\ \cmidrule(lr){1-7} \multirow{3}{*}{\textbf{\makecell[l]{Authority/Subversion}}} & One-Pass Prompting & 19.17 & 31.69 & 29.35 & 34.76 & 36.12\\ & 2-Steps Prompting & 21.85 & 31.69 & 30.67 & 31.47 & 29.56\\ & RoBERTa (Finetuned) & 11.77 (0) & 28.02 (11.6) & 23.31 (11.3) & 20.08 (10.5) & 24.64 (6.0)\\ \cmidrule(lr){1-7} \multirow{3}{*}{\textbf{\makecell[l]{Purity/Degradation}}} & One-Pass Prompting & 41.28 & 46.91 & 66.67 & 69.04 & 61.84\\ & 2-Steps Prompting & 40.51 & 41.66 & 43.08 & 47.65 & 45.89\\ & RoBERTa (Finetuned) & 31.59 (7.9) & 40.15 (5.7) & 30.80 (9.9) & 42.25 (10.8) & 56.57 (20.4)\\ \bottomrule \end{tabular}} \caption{Few shot moral role identification performance comparison among models. The one-pass prompting method outperforms both 2-steps prompting method and finetuned RoBERTa in few-shot training setup.}\label{tab:moral-role} \end{table*} \noindent\textbf{Moral Role Identification for pre-identified entities:} In moral role identification, the assumption is that the moral foundation for each tweet is pre-identified. But the performance of all the models for the moral foundation identification task are not up to the mark as shown in Table \ref{tab:mf-identification}. So, in identification of moral roles we use the gold moral foundation labels instead of the predicted ones. In Table \ref{tab:moral-role}, we present the results for moral role identification using our proposed two methods along with the RoBERTa-based baseline. We omitted the results using zero-shot prompting as we found out that in moral role generation, zero-shot prompting of the LLM generates a lot of open-ended labels rather than the fixed moral role labels. It becomes difficult to parse these generations and map them to a moral role label using an automatic method. So we leave zero-shot prompting for moral role identification as a future work. It can be seen in Table \ref{tab:moral-role} that both one-pass prompting and the two steps prompting methods outperform the RoBERTa baseline in moral role identification. It suggests that moral role identification is easier than moral foundation identification for LLMs. Note that, moral roles are micro structures of the morality frames and they are more focused towards entities and evident in text compared to subtle moral foundations. As a result it is easier for the LLMs to identify them. The two-steps prompting technique for moral roles identification underperforms the one-pass prompting approach although the task is broken down in two easier tasks. We found that in the first step of the task the model identifies polarity of sentiment towards entities with more than 70\% F1 score in the 4 shots and 5 shots settings. But it struggles in the second step where the model has to differentiate between two positive sentiments (e.g. `Entity target of care/harm' vs `Entity providing care') which is more difficult as the difference among positive sentiments is subtle. This finding is consistent with prior studies. For example, in previous work \citep{roy2021identifying} it was found that deep relational learning based model also struggles to differentiate among multiple positive sentiments. In the one-pass prompting technique, contrastive positive and negative examples are given in the prompt. As a result it might be easier for the LLMs to resonate. In moral role identification also the performance improves with the increase of number of shots for all of the models as shown in Table \ref{tab:moral-role}.\\ \noindent\textbf{Identification of entities and corresponding moral roles jointly:} In this setting, the model is expected to identify entities having the moral roles in a tweet. To evaluate the model's performance we measure in what percentage of time the predicted entity is matched with the actual entity\footnote{Entity matching procedure can be found in Appendix \ref{appx:entity-matching}} annotated by \citet{roy2021identifying} and in how many cases they are assigned to the correct entity role. We found out that the LLM hallucinates a lot when identifying entities and filling the entity role slots. Hallucination in LLMs is a common phenomena. When open ended text generation is expected but the language model generates some response that is not a part of the input text or not related to the input text, it is called hallucination \cite{ji2022survey}. Note that we don't encounter the problem of hallucination when generating labels for moral foundation and moral roles as the labels were well-defined in the prompt. But in entity identification task the model has to identify entities from a given text span which is open ended. Hence, it resulted in a higher rate of hallucination. However, The results for this task are shown in Table \ref{tab:entity-mf-joint-identification}. We can see in the table that as we increase the number of training examples (shots) the \% of correct entity and entity role identification improve although the performance is not up to the mark even with the highest number of shots (10). We also found out that \% of hallucination decreases as the number of shots increases. This findings imply that joint identification of entity and entity role is a much difficult task for the LLMs but as we increase the number of shots the LLMs are able to understand the task better. \begin{table}[t!] \centering \resizebox{1\columnwidth}{!}{% \begin{tabular} {>{\centering\arraybackslash}m{1cm}>{\centering\arraybackslash}m{2.8cm}>{\centering\arraybackslash}m{2.3cm}>{\centering\arraybackslash}m{2.6cm}} \toprule \textbf{No. of Shots} & \textbf{\% Correct Entity Identification} & \textbf{\% Hallucination} & \textbf{\% Correct Role Identification}\\ \cmidrule(lr){1-1}\cmidrule(lr){2-4} 1 & 43.80 & 21.69 & 33.97\\ 3 & 48.28 & 11.54 & 41.09\\ 5 & 48.68 & 9.58 & 43.71\\ 7 & 49.91 & 7.68 & 45.27\\ 10 & 51.39 & 5.95 & 46.88\\ \bottomrule \end{tabular}} \caption{Correctness of joint identification of entity and corresponding moral roles using in-context learning. The LLM hallucinates from previous training examples in open-ended entity identification. The percentage of hallucination decreases and the percentage of correct entity and correct role identification increase with the increase of the number of shots in prompt.}\label{tab:entity-mf-joint-identification} \end{table} \section{Summary and Future Works}\label{sec:summary-future-works} In this paper, we apply few-shot in-context learning for identification of one of the psycho-linguistic knowledge representation framework named Morality Frames. We proposed different prompting methods to perform the task. We found that in-context learning using a comparatively smaller language model (GPT-J-6B) does not perform well in identification of moral foundations that are very subtle. But it excels in moral roles identification of entities that are more evident in text. We believe there is a lot of scope for improvement, and this study will encourage the application of in-context learning in more Computational Social Science related tasks. Below we list a few future directions of this work. \begin{itemize} \item \textbf{Prompt selection:} Appropriate prompt selection based on the test data point has been successfully applied in in-context learning in different NLP tasks \citep{han2022meet}. Implementation of a dynamic prompt selection technique in morality frame identification task may boost the performance. \item \textbf{Incorporation of context in prompt:} In complex concepts such as moral foundation \citep{haidt2004intuitive,haidt2007morality} and framing \citep{boydstun2014tracking}, to name a few, the social context and the speaker's demographics play an important role. Incorporating these information in prompts for LLMs can be an effective direction towards solving these problems. \item \textbf{Experiment with larger language models:} Larger language models such as GPT-3 \cite{brown2020language} use more parameters and are trained on diverse data. As a result, they could be more successful in capturing nuanced social concepts, and result in better performance. \item \textbf{Experiment with long text:} Identification of complex concepts like framing and moral foundation have been studied in longer text (e.g. news articles) in previous works \citep{card.2015,fulgoni-etal-2016-empirical,field2018framing,royweakly}. How successful the pre-trained language models can be on these tasks in longer text such as, news articles, can be an interesting future work. \end{itemize} \section{Prompt Examples}\label{appx:prompt-examples} The example of prompts for various in-context learning steps of our approach are shown in Figures \ref{fig:mf-direct-example}, \ref{fig:mf-one-vs-all-example}, \ref{fig:mf-role-direct-example}, \ref{fig:mf-role-two-steps-example}, \ref{fig:mf-role-entity-direct-example}. \begin{figure*}[h] \centering \includegraphics[width=0.9\textwidth]{figures/mf-classification-direct-example.pdf} \caption{Prompt example for identification of moral foundation in one pass. The blue colored segment is input prompt and the red colored segment is the generated output by the LLMs.} \label{fig:mf-direct-example} \end{figure*} \begin{figure*}[h] \begin{center} \begin{subfigure}[t]{0.9\textwidth} \centering \includegraphics[width=1\textwidth]{figures/mf-classification-two-steps-step1-example.pdf} \caption{Prompt example for one-vs-all MF identification in case of `Care/Harm'.} \label{fig:step-1-example} \end{subfigure} \\ \begin{subfigure}[t]{0.9\textwidth} \centering \includegraphics[width=1\textwidth]{figures/mf-classification-two-steps-step2-example.pdf} \caption{Prompt example for tie-breaking between two MFs. For example, between `Care/Harm' and `Purity/Degradation'.} \label{fig:step-2-example} \end{subfigure} \caption{Prompt examples for moral foundation identification technique in one-vs-all manner. The blue colored segments are input prompts and the red colored segments are the generated output by the LLMs.} \label{fig:mf-one-vs-all-example} \end{center} \end{figure*} \begin{figure*}[h] \centering \includegraphics[width=0.9\textwidth]{figures/mf-role-classification-direct-example.pdf} \caption{Prompt example for identification of moral role in one pass in case of `Care/Harm'. The blue colored segment is input prompt and the red colored segment is the generated output by the LLMs.} \label{fig:mf-role-direct-example} \end{figure*} \begin{figure*}[h] \begin{center} \begin{subfigure}[t]{0.9\textwidth} \centering \includegraphics[width=1\textwidth]{figures/mf-role-classification-two-steps-step1-example.pdf} \caption{Step-1: Prompt example for identification of positive/negative sentiment towards entities.} \label{fig:mf-role-step-1-example} \end{subfigure} \\ \begin{subfigure}[t]{0.9\textwidth} \centering \includegraphics[width=1\textwidth]{figures/mf-role-classification-two-steps-step2-example.pdf} \caption{Step-2: Prompt example for differentiating among multiple positive moral roles in case of `Care/Harm'.} \label{fig:mf-role-step-2-example} \end{subfigure} \caption{Prompt examples for moral role identification by breaking it in two steps. The blue colored segments are input prompts and the red colored segments are the generated output by the LLMs.} \label{fig:mf-role-two-steps-example} \end{center} \end{figure*} \begin{figure*}[h] \centering \includegraphics[width=0.9\textwidth]{figures/mf-role-classification-predict-entity-and-label-example.pdf} \caption{Prompt example for identification of entity and corresponding moral roles jointly in case of `Care/Harm'. The blue colored segment is input prompt and the red colored segment is the generated output by the LLMs.} \label{fig:mf-role-entity-direct-example} \end{figure*} \section{Entity Matching Procedure}\label{appx:entity-matching} After obtaining the predicted entity labels from LLM, we first discard the entity labels that are not contained in the tweet text as these are irrelevant. Then, we check if any of the predicted entities are exactly matching the gold labels. In cases where it is not an exact match, we obtain a string-match score between the predicted entity and each of the gold label. If this score is beyond a certain threshold (set to 0.6) for a particular gold label, we map the predicted entity to that gold label. If the predicted entity is not exactly matching the gold label, and the score is lower than the threshold, then we assign 'N/A' label to that predicted entity. \section*{Acknowledgements} We are thankful to the anonymous reviewers for their insightful comments. This project was partially funded by NSF CAREER award IIS-2048001. \section*{Limitations} The limitations of this paper are as follows. \begin{itemize} \item Previous study \cite{johnson2018classification} has shown that a single tweet may contain multiple moral foundations. Multiple labels were not considered in this work. It may be the case that language models are successful on identifying only one of the moral foundations in such multi-label data points. \item Usage of large language models are expensive as they are resource-heavy. Due to that we could not run the prompt-based methods multiple times to perform a statistical significance test on the results. This is a limitation of our work. \item Due to resource-constraint and no availability of an open-source version we could not run our proposed prompt-based models with state-of-the-art larger language models, such as GPT-3. The insights and results reported in this paper may have been different if a larger language model was used. \item LLMs are pretrained on a huge amount of human generated text. As a result, they may inherently contain many human biases \citep{brown2020language,blodgett2020language}. We did not consider any bias that can be incorporated by the LLMs in the morality frames identification task. \end{itemize} \section*{Ethics Statement} In this paper, we do not propose any new dataset rather we only experiment with existing datasets which are, to the best of our knowledge, adequately cited. We provided all experimental details of our approaches and we believe the results reported in this paper are reproducible. Any result or tweet text presented in this paper are either results of a machine learning model or taken from an existing dataset. They don't represent the authors' or the funding agencies' views on this topic. As described in the limitations sections, inherent bias in the large language models are not taken into account in this paper while experimenting. So, we suggest not to deploy the proposed algorithms in a real life system without further investigation on bias and fairness. \section{Tables}\label{sec:tables} \begin{table*}[t!] \centering \resizebox{2\columnwidth}{!}{% \begin{tabular} {>{\arraybackslash}m{5cm}>{\centering\arraybackslash}m{1.5cm}>{\centering\arraybackslash}m{1.7cm}>{\centering\arraybackslash}m{1.7cm}>{\centering\arraybackslash}m{1.9cm}>{\centering\arraybackslash}m{1.7cm}>{\centering\arraybackslash}m{1.7cm}} \toprule \multicolumn{1}{c}{} & \multicolumn{6}{c}{\textbf{Macro F1 score for various number of shots per class}}\\ \cmidrule(lr){2-7} \textbf{Models} & \textbf{0-shot} & \textbf{1-shot} & \textbf{2-shots} & \textbf{3-shots} & \textbf{4-shots} & \textbf{5-shots}\\ \cmidrule(lr){1-1}\cmidrule(lr){2-7} One-Pass prompting for 5 classes & 6.24 & 24.19 & 29.80 & 30.63 & 39.49 & 43.56\\ One-vs-all prompting & 13.23 & 20.46 & 24.34 & 20.51 & 27.76 & 15.70\\ \cmidrule(lr){1-7} RoBERTa (Parameters frozen) & N/A & 7.61 (1.9) & 7.84 (2.3) & 8.1 (2.9) & 8.21 (3.1) & 8.0 (2.6)\\ RoBERTa (Finetuned) & N/A & 19.68 (7.3) & 33.22 (9.6) & 37.05 (5.8) & 38.78 (5.9) & 45.42 (6.6)\\ \bottomrule \end{tabular}} \caption{Few-shot moral Foundation Identification.}\label{tab:mf-identification} \end{table*} \begin{table*}[ht!] \centering \resizebox{2.1\columnwidth}{!}{% \begin{tabular} {>{\arraybackslash}m{3.5cm}>{\arraybackslash}m{3.5cm}>{\centering\arraybackslash}m{2cm}>{\centering\arraybackslash}m{2cm}>{\centering\arraybackslash}m{2cm}>{\centering\arraybackslash}m{2cm}>{\centering\arraybackslash}m{2cm}} \toprule \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{5}{c}{\textbf{Macro F1 score for various number of shots per class}} \\ \cmidrule(lr){3-7} \textbf{Moral Foundations} & \textbf{Models} & \textbf{1-shot} & \textbf{2-shots} & \textbf{3-shots} & \textbf{4-shots} & \textbf{5-shots}\\ \cmidrule(lr){1-1}\cmidrule(lr){2-2}\cmidrule(lr){3-7} \multirow{3}{*}{\textbf{\makecell[l]{Care/Harm}}} & Direct Prompting & 48.21 & 58.61 & 74.37 & 70.98 & 68.41\\ & 2-Steps Prompting & 37.77 & 42.04 & 58.29 & 68.97 & 63.76\\ & RoBERTa (Finetuned) & 31.67 (13.4) & 35.79 (13.2) & 35.35 (14.0) & 30.64 (14.0) & 43.83 (26.0)\\ \cmidrule(lr){1-7} \multirow{3}{*}{\textbf{\makecell[l]{Fairness/Cheating}}} & Direct Prompting & 42.92 & 71.86 & 75.95 & 82.26 & 74.65\\ & 2-Steps Prompting & 40.91 & 71.28 & 72.64 & 74.92 & 68.70\\ & RoBERTa (Finetuned) & 26.89 (11.9) & 46.16 (6.0) & 43.06 (3.6) & 35.61 (15.2) & 42.95 (12.9)\\ \cmidrule(lr){1-7} \multirow{3}{*}{\textbf{\makecell[l]{Loyalty/Betrayal}}} & Direct Prompting & 35.56 & 36.40 & 35.24 & 45.10 & 41.27\\ & 2-Steps Prompting & 30.39 & 38.69 & 32.32 & 38.82 & 25.83\\ & RoBERTa (Finetuned) & 21.29 (3.0) & 28.39 (7.1) & 24.14 (11.5) & 37.73 (1.7) & 36.57 (8.2)\\ \cmidrule(lr){1-7} \multirow{3}{*}{\textbf{\makecell[l]{Authority/Subversion}}} & Direct Prompting & 19.17 & 31.69 & 29.35 & 34.76 & 36.12\\ & 2-Steps Prompting & 21.85 & 31.69 & 30.67 & 31.47 & 29.56\\ & RoBERTa (Finetuned) & 11.77 (0) & 28.02 (11.6) & 23.31 (11.3) & 20.08 (10.5) & 24.64 (6.0)\\ \cmidrule(lr){1-7} \multirow{3}{*}{\textbf{\makecell[l]{Purity/Degradation}}} & Direct Prompting & 41.28 & 46.91 & 66.67 & 69.04 & 61.84\\ & 2-Steps Prompting & 40.51 & 41.66 & 43.08 & 47.65 & 45.89\\ & RoBERTa (Finetuned) & 31.59 (7.9) & 40.15 (5.7) & 30.80 (9.9) & 42.25 (10.8) & 56.57 (20.4)\\ \bottomrule \end{tabular}} \caption{Few shot moral role identification.}\label{tab:moral-role} \end{table*} \begin{table}[t!] \centering \resizebox{1\columnwidth}{!}{% \begin{tabular} {>{\centering\arraybackslash}m{1cm}>{\centering\arraybackslash}m{3cm}>{\centering\arraybackslash}m{2.8cm}>{\centering\arraybackslash}m{3cm}} \toprule \textbf{No. of Shots} & \textbf{\% Correct Entity Identification} & \textbf{\% Hallucination} & \textbf{\% Correct Role Identification}\\ \cmidrule(lr){1-1}\cmidrule(lr){2-4} 1 & 43.80 & 21.69 & 33.97\\ 3 & 48.28 & 11.54 & 41.09\\ 5 & 48.68 & 9.58 & 43.71\\ 7 & 49.91 & 7.68 & 45.27\\ 10 & 51.39 & 5.95 & 46.88\\ \bottomrule \end{tabular}} \caption{Correctness of joint identification of entity and corresponding moral roles using in-context learning.}\label{tab:entity-mf-joint-identification} \end{table}
\section{Introduction} \label{sect:intro} \emph{Federated Learning} (FL) \cite{federated_machine_learning,FLSurvey} is a new machine learning paradigm, where multiple devices with local data samples work together to train a global machine learning model. FL differs significantly from classic centralized machine learning scenarios in that it does not need all local data to be uploaded to a central server. It also stands in contrast to traditional distributed methods which often assume that local data samples are identically distributed. \emph{Knowledge Graph} (KG) is a structured knowledge base that describes real-world entities and their relations in the form of triplets. Recent advances in representation learning techniques hasten the advent of \emph{KG embedding} \cite{KGSurvey,KGESurvey}, which projects entities and relations into a unified semantic space to mitigate the symbolic heterogeneity and support various knowledge-driven applications. \emph{Federated KG embedding learning} \cite{FedE,FedEC,FKE,FKGE,FedR} is an emerging field that leverages FL and multi-source KGs for collaborative KG embedding. \begin{figure} \centering \includegraphics[width=.94\linewidth]{figs/motivation.pdf} \caption{A motivating example, where different KGs (e.g., DBpedia, MusicBrainz and IMDb) provide complementary knowledge about the NBA all-star \textit{Damian Lillard}.} \label{fig:motivation} \end{figure} \smallskip \noindent\textsc{Example 1.} Let us see the example in Figure~\ref{fig:motivation}. The NBA all-star, \textit{Damian Lillard}, has made great achievements in basketball, sport business, film and music, documented in distributed KGs like DBpedia, IMDb and MusicBrainz. Based on FL, we can learn the above knowledge jointly and securely to better model the overall image of \textit{Damian Lillard}. However, federated KG representation learning needs to address realistic challenges like data heterogeneity and knowledge forgetting. \smallskip \noindent\textsc{Challenge 1:} \textbf{Data heterogeneity.} A major difference between FL and traditional distributed learning is that the data feature and distribution in FL are unknown and uncontrollable, while traditional distributed learning assumes that local data samples are identically distributed. KGs combine the characteristics of relational databases and graph data, so their heterogeneity is particularly significant. On one hand, the schemata of different KGs describe various domains with uneven abstraction levels. As illustrated in Figure~\ref{fig:motivation}, the entities and relations instantiating these KGs also do not fully overlap. On the other hand, the graph features of different KGs such as degree distribution and clustering coefficient are inconsistent. Local data with strong heterogeneity make local KG embedding models difficult to be aggregated, leading to the drift between local optimization and global convergence, and therefore reduce the overall accuracy of federated KG embedding learning. For example, as a basketball player, \textit{Damian Lillard}'s status may make him more likely to be associated with the sport drama ``The Way Back'', while suppress the prediction that he is a voice actor in the comedy animation ``We Bare Bears''. \smallskip \noindent\textsc{Challenge 2:} \textbf{Knowledge forgetting.} As the symbolic abstraction of real-world domains, local KGs on clients can be outdated or erroneous, leading to the global model change over time. For example, \textit{Damian Lillard} and \textit{CJ McCollum} are no longer teammates in the Portland Trail Blazers, as \textit{CJ McCollum} was traded to the New Orleans Pelicans. Another need for knowledge forgetting is privacy protection in healthcare, finance, insurance, etc. For instance, the EU General Data Protection Regulation (GDPR) guarantees users' right to be forgotten,\footnote{\url{https://gdpr-info.eu/art-17-gdpr/}} i.e., the data subject shall have the right to obtain from the controller the erasure of personal data concerning him or her without undue delay and the controller shall have the obligation to erase personal data without undue delay. It is easy to remove triplets in a KG, but hard to eliminate their impact on the trained embedding model. Moreover, re-training the model again on the remaining data is time-consuming and computationally expensive. The difficulty of making the KG embedding model forget specific triplets lies in that it is hard to quantify and recover the influence of a triplet on the model due to the correlation with other triplets and the randomness of training. Given that local data are not visible to the global view, how to propagate the unlearning results to the global model is quite challenging. \smallskip \noindent\textbf{Current approaches.} Existing work mainly focuses on the migration and customization from FL to KG embedding, which can be divided into client-server \cite{FedE,FedR,FKE,FedEC} and peer-to-peer \cite{FKGE} based on the communication architecture of nodes in the whole system. The client-server architecture typically consists of one server and multiple clients with their own local KGs. The server initializes the embeddings of entities and relations, distributes the embeddings to clients for training, and aggregates the clients' locally-trained embedding models after each round of local training. In contrast, the peer-to-peer architecture allows clients to exchange embeddings and learn from each other in a generative adversarial manner. As far as FL is concerned, the client-server architecture has higher communication efficiency and can eventually produce a common and effective global model for general use. However, it is difficult for existing federated KG embedding learning methods to deal with non-IID data with strong heterogeneity. See Section~\ref{subsect:dataset} for an analysis of the datasets used in existing work. Furthermore, to our best knowledge, we have not seen any exploration in KG embedding unlearning, let alone making the global model forget specific triplets from clients under the FL setting. \smallskip \noindent\textbf{Our framework.} In this paper, we consider the realistic challenges in federated KG embedding, and propose a novel FL framework for heterogeneous KG embedding learning and unlearning, dubbed \textbf{FedLU\xspace}. To address the data heterogeneity of multi-source KGs, we propose mutual knowledge distillation to transfer local knowledge to global, and absorb global knowledge back. Furthermore, to achieve knowledge forgetting, we present an unlearning method to erase specific knowledge from local embeddings and propagate to the global embedding by reusing knowledge distillation. To validate the effectiveness of the proposed framework, we construct three new datasets based on FB15k-237 and carry out extensive experiments with varied number of clients. The main contributions of this paper are summarized as follows: \begin{itemize} \item We propose a FL framework for KG embedding learning. In particular, we design a mutual knowledge distillation method to cope with the drift between local optimization and global convergence caused by data heterogeneity. (See Section~\ref{subsect:learn}) \item Based on cognitive neuroscience, we present a novel KG embedding unlearning method, which combines retroactive interference and passive decay to achieve knowledge forgetting. (See Section~\ref{subsect:unlearn}) \item We conduct extensive experiments on newly-constructed datasets with varied number clients. Experimental results show that FedLU\xspace outperforms the state-of-the-arts in both link prediction and knowledge forgetting. (See Section~\ref{sect:exp}) \end{itemize} \section{Preliminaries} \label{sect:prelim} \noindent\textbf{Federated learning.} FL is a computing paradigm where disperse clients collaboratively train models using multi-party datasets without data leakage. Instead of centrally collecting data into a machine learning server or sharing training data across parties, FL only involves an exchange of model parameters or gradients. FedAvg~\cite{FedAvg} is a very popular FL algorithm due to its simplicity and effectiveness, where each client trains its local model with private data, and the server aggregates the uploaded local models by a weighted sum. The procedure can be denoted by $\mathbf{w}_{t+1} = \sum_{k\in K} \frac{n_k}{n}\mathbf{w}^k_t$, where $\mathbf{w}_t$ denotes the aggregated global model at the $t$-th iteration, and $\mathbf{w}_t^k$ denotes the optimized local model for client $k$. $\frac{n_k}{n}$ is the aggregation weight considering the proportion of the dataset size for each client. It is proved that FedAvg can converge on non-IID data under necessary conditions \cite{convergence_of_FedAvg}. In the real world, the system and statistical heterogeneity widely exists, such as device failures and data biases. In order to alleviate such heterogeneity, FedProx \cite{FedProx} introduces a proximal term to the local training process as a minor modification to FedAvg. The local update can be denoted by $\mathbf{w}^k_{t+1} = \argmin_\mathbf{w} F_k(\mathbf{w}) + \frac{\mu}{2}||\,\mathbf{w}-\mathbf{w}_t\,||^2$, where $F_k(\cdot)$ is the original local objective function, and $\mu$ is a weight to balance the two terms. MOON \cite{MOON} presents a model-level contrastive learning to solve the heterogeneity in images with deep learning models. It adds a model-contrastive loss into local optimization to decrease the distance between the local and global models. In addition, researches increasingly turn to knowledge distillation~\cite{FedMD,FD,FedKD} instead of direct model substitution. We refer readers to a recent survey \cite{FLSurvey} for more progress. \smallskip \noindent\textbf{KG embedding.} KG embedding models embed entities and relations into a continuous vector space while expecting to reveal the inherent semantics of KGs. Existing work can be categorized into three groups: (i) Translational distance models \cite{TransE,RotatE,HAKE} view a relation as a translation operation from the head entity to the tail entity, and exploit a distance-based scoring function to measure the plausibility of a triplet. TransE \cite{TransE} adopts vector translation to model such an operation. Its scoring function is defined as $\mathcal{S}_{\text{TransE}}(h,r,t)=-||\,\mathbf{h}+\mathbf{r}-\mathbf{t}\,||$, while RotatE \cite{RotatE} interprets a relation as a vector rotation. (ii) Semantic matching models \cite{DistMult,ComplEx,TuckER} match latent semantics of entities and relations in their scoring functions. ComplEx \cite{ComplEx} captures pairwise interactions between entities and relations along the same dimension in a complex vector space. The scoring function is defined as $\mathcal{S}_{\text{ComplEx}}(h,r,t)=\text{Re}\big(\langle\mathbf{h} ,\mathbf{r},\mathbf{\bar{t}}\rangle\big)$, where $\text{Re}(\cdot)$ denotes the real vector component. $\langle\cdot\rangle$ denotes a generalized dot product. $\bar{\cdot}$ is the conjugate of a complex vector. (iii) Deep models leverage deep neural networks to dig into the underlying structures of KGs, such as convolutional neural networks \cite{ConvE,ConvKB} and graph neural networks \cite{RGCN,CompGCN}. \smallskip \noindent\textbf{Machine unlearning.} Different from machine learning, machine unlearning aims to make models forget specific samples. The work in \cite{forget_machine_unlearning} transforms the original machine learning algorithm into a statistical query learning form. Therefore, unlearning can be realized by updating the summations for queries instead of re-training from scratch. The work in \cite{make_AI_forget_you} further leverages k-means clustering to make the unlearning algorithm in \cite{forget_machine_unlearning} more deletion-efficient. Inspired by ensemble learning and incremental learning, SISA \cite{machine_unlearning} first splits the whole dataset into shards to train different submodels, and then splits each shard into slices to feed into the individual submodels sequentially while storing checkpoints. To the best of our knowledge, there is no prior work exploring KG embedding unlearning. \section{Related Work} \label{sect:related} There is only a few studies on federated KG embedding learning. To protect data privacy and sensitivity, FedE \cite{FedE} simply adapts FedAvg to KG embedding by sharing entity embeddings. The adaptation of delivery and aggregation is defined as follows: \begin{align} \mathbf{E}_t^k = \mathbf{P}^{k}\mathbf{E}_t,\quad \mathbf{E}_{t+1} = \Big(\mathbb{1}\oslash \sum_{k=1}^{K}\mathbf{v}^k\Big)\otimes \sum_{k=1}^{K}{\mathbf{P}^k}^\top\mathbf{E}_{t}^{k}, \end{align} where $\mathbf{E}_t$ is the global embedding at the $t$-th communication round, $\mathbf{P}^k$ is the permutation matrix from the global embedding to the local embedding in client $k$ and ${\mathbf{P}^k}^\top$ is its transpose, $\mathbf{E}^k_t$ is the local embedding of client $k$ at this communication round, $\mathbf{v}^k$ is an existence vector indicating which entities exist in client $k$, $\mathbb{1}$ refers to an all-one vector, and $\oslash,\otimes$ are respectively element-wise division for vectors and element-wise multiplication with broadcasting. $\mathbf{P}^k$ and $\mathbf{v}^k$ can be calculated by the server without sharing raw data through techniques such as private data matching~\cite{PrivateSchemaMatching}. FedE empirically validates that the locally-computed embeddings can achieve better performance by aggregating with the global embedding. FedR \cite{FedR} pays attention to the scenario where clients have high overlapping not only in entities but also in relations. The clients in its framework share relation embeddings globally and represent entity embeddings based on relations locally. In this paper, we do not assume relation overlapping. FKGE \cite{FKGE} proposes a peer-to-peer federated embedding learning framework for KGs in various domains, based on a differentially-privacy generative adversarial model. Borrowing the idea of MUSE \cite{MUSE} to align two manifolds with a translational mapping matrix, FKGE is able to generate refined embeddings after generative adversarial training. For communication efficiency, we do not adopt the peer-to-peer architecture. Inspired by MOON~\cite{MOON}, FedEC~\cite{FedEC} uses embedding-contrastive learning to guide the embedding optimization for addressing data heterogeneity. It increases the similarity between local and global embeddings by incorporating a contrastive loss into the local loss. \section{The Proposed Framework} \label{sect:framework} \begin{figure*}[!t] \centering \includegraphics[width=.86\linewidth]{figs/framework.pdf} \caption{FedLU\xspace follows the client-server architecture, and each client contains a learning module and an unlearning module.} \label{fig:framework} \end{figure*} We aim to train a KG embedding model based on the FL architecture composed of a central server and a set of clients $K$. Each client $k\in K$ has a local KG $G^k=\{(h,r,t)\,|\,h,t\in E^k, r\in R^k\}$, where $E^k,R^k$ denote the entity and relation sets, respectively. Local KGs have overlapping entities (i.e., $\forall i, \exists j\neq i, E^i\cap E^j\neq\emptyset$), and the whole dataset is denoted by $G=\bigcup_{k\in K}G^k$. Furthermore, we do not assume the overlap of relations. At each communication round $t$, the server first samples $K_t\subseteq K$ to collaborate, and then distributes the corresponding local avatar $\mathbf{P}^{k}\mathbf{E}_t$ of global embedding $\mathbf{E}_t$ to each sampled client $k\in K_t$. Next, the selected client $k$ updates its local embedding $\mathbf{E}^k_{t}$ assisted by $\mathbf{P}^{k}\mathbf{E}_t$ which is received from the server. At the end of communication round $t$, the server receives the uploaded local avatars of the global embedding and aggregates them into $\mathbf{E}_{t+1}$. The objective of federated KG embedding learning is to generate a global embedding which minimizes the average local loss: \begin{align} \label{eq:fedkgeglobalobjective} \mathbf{E}=\argmin_{\mathbf{E}}\sum_{k\in K}\frac{|G^k|}{|G|}\mathcal{L}(\mathbf{P}^{k}\mathbf{E};G^k), \end{align} where $\mathcal{L}(\cdot)$ is the self-adversarial negative sampling loss of the embedding $\mathbf{P}^{k}\mathbf{E}$ on the local KG $G^k$. After rounds of communication and training, the framework of FedLU\xspace gets the best global embedding $\mathbf{E}$ and local embeddings $\mathbf{E}^k,k\in K$. Later, the local KG $G^k$ of client $k$ may have a forgetting triplet set $G^k_{u}$ and its complementary triplet set $G^k_{c}$. To define the goal of unlearning, the local objective is to optimize \begin{align} \label{eq:unlearnlocalobjective} \mathbf{E}^{k-} = \argmin_{\mathbf{E}^k}\Big(-\frac{|G^k_{u}|}{|G^k|}\mathcal{L}(\mathbf{E}^k;G^k_{u})+\frac{|G^k_{c}|}{|G^k|}\mathcal{L}(\mathbf{E}^k;G^k_{c})\Big). \end{align} Under the FL setting, a subset of clients $K_{u}\subseteq K$ have their own forgetting sets $\big\{G^{k}_{u}\big\}_{k\in K_{u}}$ and the complementary sets $\big\{G^{k}_{c}\big\}_{k\in K_{u}}$. The global objective of federated unlearning is to obtain a global embedding minimizing the average local loss with unlearning: \begin{align} \label{eq:unlearnglobal} \resizebox{.92\columnwidth}{!}{$ \mathbf{E}^{-}=\argmin\limits_{\mathbf{E}}\sum\limits_{k\in K_{u}}\frac{|G^k|}{|G|}\Big(-\frac{|G^k_{u}|}{|G^k|}\mathcal{L}(\mathbf{P}^{k}\mathbf{E};G^k_{u})+\frac{|G^k_{c}|}{|G^k|}\mathcal{L}(\mathbf{P}^{k}\mathbf{E};G^k_{c})\Big). $} \end{align} As shown in Figure~\ref{fig:framework}, FedLU\xspace serves as a general federated KG embedding learning and unlearning framework for various KG embedding models. In the learning module of FedLU\xspace, we transfer knowledge by mutual knowledge distillation instead of model replacement. In the unlearning module, we design a two-step method combining retroactive interference and passive decay, which ensures exact forgetting and performance maintenance. \subsection{Learning in FedLU\xspace} \label{subsect:learn} For FL algorithms such as FedAvg, clients accept the global model as the initial states of local models for each round of local training, and upload the updated model directly for global aggregation. The global model is expected to aggregate the knowledge on each client and obtain a balanced performance. However, FedNTD~\cite{FedNTD} observes that the global convergence and local optimization in FL may interfere with each other, which we call \emph{drift}. The global model may easily lose optimization details of local training after aggregation. Furthermore, the local model tends to forget external knowledge contained in the initial states during training. Existing work~\cite{MixtureGlobalLocal,ThinkLocallyActGlobally} suggests that there should be a trade-off and separation between global and local models, endowing the FL framework the compatibility of local optimization and global generalization. Inspired by this, in FedLU\xspace we maintain local and global embeddings in parallel that mutually reinforce each other but are not identical. Besides, identical global and local embeddings may be used to infer knowledge in a private client~\cite{FedR}, resulting in data leakage. This problem is avoided by separation and communication through mutual distillation in FedLU\xspace. Algorithm~\ref{alg:fedkgedistill} shows the federated KG embedding learning via knowledge distillation of FedLU\xspace. In Line 1, the server first initializes the global embedding model, and then the communication rounds of federated KG embedding learning start. During each round $t$ (Lines 2--9), a subset of clients $K_t\subseteq K$ are sampled. The server calculates and distributes corresponding part of the global embedding to each client $k\in K_t$ in Line 5. Each client refines its local embedding with the global embedding and improves the global embedding with its local embedding through mutual knowledge distillation in parallel in Lines 6--7. In Line 9, the server aggregates global embeddings without forcing changes to local embeddings, which maintains the coherence of local training and avoids the drift of local optimization. \begin{algorithm}[!t] \caption{Federated learning via knowledge distillation} \label{alg:fedkgedistill} \KwIn{communication rounds $T$, server, client set $K$, mapping matrix $\mathbf{P}$, existence vector $\mathbf{v}$} \KwOut{global embedding $\mathbf{E}_T$, local embeddings $\{\mathbf{E}_T^k\}_{k\in K}$} Server initializes $\mathbf{E}_0$\; \For{$t = 0,\dots,T-1$}{ Sample a client subset $K_t\subseteq K$\; \ForAll(\tcp*[f]{run in parallel}){$k\in K_t$}{ Server sends $\mathbf{E}^k_t=\mathbf{P}^k\mathbf{E}_t$ to client $k$\; $\mathbf{E}^{k,\text{local}}_t=\argmin_{\mathbf{E}^k}\mathcal{L}^{\text{local}}(\mathbf{E}^k;\mathbf{E}^k_t,G^k)$\; $\mathbf{E}^{k,\text{global}}_t=\argmin_{\mathbf{E}^k}\mathcal{L}^{\text{global}}(\mathbf{E}^k;\mathbf{E}^{k,\text{local}}_t,G^k)$\; Client $k$ sends $\mathbf{E}^{k,\text{global}}_t$ to server\; } $\mathbf{E}_{t+1}=\big(\mathbb{1}\oslash \sum_{k=1}^{K_t}\mathbf{v}^k\big) \otimes\sum_{k\in K_t}{\mathbf{P}^k}^\top\mathbf{E}^{k,\text{global}}_t$\; } \end{algorithm} Let us first dive into how to refine local embeddings with the global embedding by knowledge distillation in FedLU\xspace. Given a triplet $(h,r,t)$, we compute its local score and global score by Eqs. (\ref{eq:localscore}) and (\ref{eq:globalscore}), respectively: \begin{align} \label{eq:localscore} \mathcal{S}^\text{local}_{(h,r,t)}&=\mathcal{S}(h,r,t;\mathbf{E}^\text{local},\mathbf{R}^\text{local}),\\ \label{eq:globalscore} \mathcal{S}^\text{global}_{(h,r,t)}&=\mathcal{S}(h,r,t;\mathbf{E}^\text{global},\mathbf{R}^\text{local}), \end{align} where $\mathcal{S}(\cdot)$ is the scoring function referred in Section~\ref{sect:prelim}. $\mathbf{E}^\text{local}$ and $\mathbf{E}^\text{global}$ are entity embeddings in the local and global models, respectively, and $\mathbf{R}^\text{local}$ is the relation embedding in the local model. To train each triplet $(h_i,r_i,t_i)\in G^k$, we generate its negative sample set $N(h_i,r_i,t_i)=\{(h_i,r_i,t_{i,j})\,|\,j=1,\dots,n\}$ with size $n$, s.t. $N(h_i,r_i,t_i)\cap G^k=\emptyset$. We calculate the contrastive prediction loss of $(h_i,r_i,t_i)$ as follows: \begin{align} \label{eq:localpredictloss} \resizebox{.92\columnwidth}{!}{$ \mathcal{L}^\text{predict}_{(h_i,r_i,t_i)}= -\log\Big(\sigma\big(\mathcal{S}^\text{local}_{(h_i,r_i,t_i)}\big)\Big) -\quad\smashoperator{\sum_{(h,r,t)\in N(h_i,r_i,t_i)}}\ \frac{1}{n}\log\Big(\sigma\big(-\mathcal{S}^\text{local}_{(h,r,t)}\big)\Big), $} \end{align} where $\sigma(\cdot)$ is the sigmoid activation function. To avoid the inconsistency in the optimization direction of local and global embeddings, knowledge distillation is conducted along with sample prediction. The score of a KG embedding model on a triplet characterizes the probability of being predicted as positive. So, we transfer knowledge by distilling the distribution of local and global scores on samples and their negative sets. For a triplet $(h_i,r_i,t_i)$, we compute its distillation loss for the local embedding: \begin{align} \label{eq:localdistillloss} \mathcal{L}^\text{distill}_{(h_i,r_i,t_i)}=\text{KL}\Big(\mathcal{P}^\text{local}_{(h_i,r_i,\cdot)},\mathcal{P}^\text{global}_{(h_i,r_i,\cdot)}\Big), \end{align} where $\text{KL}(\cdot)$ is the Kullback-Leiber distillation function. $\mathcal{P}^\text{local}_{(h_i,r_i,\cdot)}$ is the local score distribution of sample $(h_i,r_i,t_i)$ generated by combining $\mathcal{P}^\text{local}_{(h_i,r_i,t_i)}$ and $\mathcal{P}^\text{local}_{(h_i,r_i,t_{i,j})}$, which are computed as follows: \begin{align} \label{eq:localposprob} \mathcal{P}^\text{local}_{(h_i,r_i,t_i)}=\frac{\exp\big(s^\text{local}_{(h_i,r_i,t_i)}\big)}{\sum_{(h,r,t)\in N(h_i,r_i,t_i)\cup\{(h_i,r_i,t_i)\}}\exp\big(s^\text{local}_{(h,r,t)}\big)},\\ \label{eq:localnegprob} \mathcal{P}^\text{local}_{(h_i,r_i,t_{i,j})}=\frac{\exp\big(s^\text{local}_{(h_i,r_i,t_{i,j})}\big)}{\sum_{(h,r,t)\in N(h_i,r_i,t_i)\cup\{(h_i,r_i,t_i)\}}\exp\big(s^\text{local}_{(h,r,t)}\big)}, \end{align} and $\mathcal{P}^\text{global}_{(h_i,r_i,\cdot)}$ is the global score distribution of $(h_i,r_i,t_i)$ generated by combining $\mathcal{P}^\text{global}_{(h_i,r_i,t_i)}$ and $\mathcal{P}^\text{global}_{(h_i,r_i,t_{i,j})}$, which can be calculated in a similar way. Finally, the local model of client $k$ is equipped with the two jointly optimized losses as follows: \begin{align} \label{eq:localloss} \mathcal{L}^\text{local} = \sum_{(h_i,r_i,t_i)\in G^k}\Big(\mathcal{L}^\text{predict}_{(h_i,r_i,t_i)}+\mu_\text{distill}\,\mathcal{L}^\text{distill}_{(h_i,r_i,t_i)}\Big), \end{align} where $\mu_\text{distill}$ is the parameter to adjust the degree of distillation. The joint loss $\mathcal{L}^\text{global}$ to optimize global embedding $\mathbf{E}^\text{global}$ can be computed similarly. \smallskip \noindent\textbf{Complexity analysis.} Given total communication round $T$, client number $K$, average entity number $N'$, total entity number $N$, total relation number $M$, triple number $P$ and hidden dimension $H$, FedLU\xspace's parameter complexity is $(KN'+N+M)H$, computation complexity is $\mathcal{O}(PHT)$, and total communication cost is $2KN'HT$. \subsection{Unlearning in FedLU\xspace} \label{subsect:unlearn} To solve the difficulty in federated KG embedding unlearning, we resort to the forgetting theories in cognitive neuroscience. There are two major theories explaining for forgetting of cognition, namely interference and decay. The interference theory~\cite{retroactiveinterference} posits that forgetting occurs when memories compete and interfere with others. The decay theory~\cite{decay} believes that memory traces fade and disappear, and eventually lost if not retrieved and rehearsed. We propose a two-step unlearning method for federated KG embedding. Inspired by the interference theory, FedLU\xspace first conducts a retroactive interference step with hard and soft confusions. Then, according to the decay theory, FedLU\xspace performs a passive decay step, which can recover the performance loss caused by interference while suppressing the activation of the forgotten knowledge. For client $k$ to perform unlearning with its local KG $G^k$, $G^k$ is split into the forgetting set $G^k_u$ and the retaining set $G^k_c$. We first introduce the retroactive interference step conducted to the local embedding. To unlearn each triplet $(h_i,r_i,t_i)\in G^k_u$, we have its negative sample set $N(h_i,r_i,t_i)=\{(h_i,r_i,t_{i,j})\,|\,j=1,\dots,n\}$ with size $n$, s.t. $N(h_i,r_i,t_i)\cap G^k=\emptyset$. We first compute the hard confusion loss to optimize the local embedding by treating $(h_i,r_i,t_i)$ as negative: \begin{align} \label{eq:unlearnhard} \resizebox{.9\columnwidth}{!}{$ \mathcal{L}^\text{hard}_{(h_i,r_i,t_i)}=-\log\Big(\sigma\big(-\mathcal{S}^\text{local}_{(h_i,r_i,t_i)}\big)\Big) -\quad\smashoperator{\sum_{(h,r,t)\in N(h_i,r_i,t_i)}}\ \frac{1}{n}\log\Big(\sigma\big(-\mathcal{S}^\text{local}_{(h,r,t)}\big)\Big). $} \end{align} Unfortunately, if we blindly optimize the forgetting sets as negative, the embeddings are likely to be polluted. In fact, unlearning may leave trace of the forgetting set and thus results in privacy risks such as membership inference attacks~\cite{unlearn_jeopardize_privacy}. So, we design soft confusion, which reflects the distance between scores of the triplet in the forgetting set and its negative samples. By minimizing the soft confusion, the scores of the triplet and negatives are forced closer, which can help not only forgetting the triplet, but also preventing the overfitting of unlearning. The soft confusion loss for the triplet $(h_i,r_i,t_i)$ is calculated as follows: \begin{align} \label{eq:unlearnsoft} \mathcal{L}^\text{soft}_{(h_i,r_i,t_i)}=\sum_{(h,r,t)\in N(h_i,r_i,t_i)}\frac{1}{n}\,\Big|\Big|\,\mathcal{S}^\text{local}_{(h,r,t)}-\mathcal{S}^\text{local}_{(h_i,r_i,t_i)}\,\Big|\Big|_{L2}. \end{align} To perform the retroactive interference while keeping the relevance between local and global embeddings, we calculate the total interference loss combining the KL divergence loss in Eq.~(\ref{eq:localdistillloss}) as \begin{align} \label{eq:localunlearn} \resizebox{.9\columnwidth}{!}{$ \mathcal{L}^\text{interference}_{(h_i,r_i,t_i)}=\mathcal{L}^\text{hard}_{(h_i,r_i,t_i)}+\mu_\text{soft}\,\mathcal{L}^\text{soft}_{(h_i,r_i,t_i)}+\mu_\text{distill}\,\mathcal{L}^\text{distill}_{(h_i,r_i,t_i)}. $} \end{align} The interference loss of the global embedding is calculated similarly, by changing the local scores to the global scores and reversing the distillation. After the retroactive interference step, memories of the global and local embeddings on the forgetting set are erased. However, a significant decrease in model performance can happen. On one hand, the model optimization in the retroactive interference is limited to specific triplets to forget, which slightly destroys the generalization of the embedding model. On the other hand, the unlearning of a specific triplet would affect its associated triplets. So, we perform a passive decay step afterwards by mutual knowledge distillation with $G^k_c$ as input. $\mathbf{E}^{k,global}$ and $\mathbf{E}^{k,local}$ are optimized alternately in batches as the teacher model to each other. Learning on the retaining set can recover the generalization of the model. Mutual distillation suppresses the activation of the forgetting triplets. \section{Experiments and Results} \label{sect:exp} We implemented our framework, FedLU\xspace, on a server with four Intel Xeon Gold 6326 CPUs, 512GB memory and four NVIDIA RTX A6000 GPUs. In this section, we first introduce our newly-constructed datasets for federated KG embedding. Then, we carry out experiments to evaluate FedLU\xspace on federated KG embedding learning and unlearning. The datasets and source code are online.\footnote{\url{https://doi.org/10.5281/zenodo.7601676}} \subsection{Clustering-based Dataset Construction} \label{subsect:dataset} To evaluate the effectiveness of FedLU\xspace, we select the benchmark KG embedding dataset FB15k-237 as the original dataset. Following the experiment setting of FedE~\cite{FedE}, we averagely partition relations and distribute triplets into three, five or ten clients accordingly, forming three datasets called FB15k-237-R3, R5 and R10. These datasets satisfy the non-IID condition with no overlapping relations. However, they do not conform to the entity distribution and graph structure in real-world federation, because relations and entities on each client may be unrelated. In this paper, we propose a new dataset construction algorithm, which first partitions relations by clustering and then distributes triplets into clients. This generates more realistic datasets for federated KG embedding. Due to the space limitation, we present the algorithm in Appendix~\ref{app:algo}. In line with random partitioning, we name the new heterogeneous datasets FB15k-237-C3, C5 and C10. \begin{figure} \centering \includegraphics[width=\linewidth]{figs/degree1.pdf} \caption{Comparison of degree distributions and clustering coefficients between FB15k-237-C3 and FB15k-237-R3.} \label{fig:degree1} \end{figure} We compare the two types of datasets constructed with random partition and clustering-based partition. Figure~\ref{fig:degree1} shows the comparison results of FB15k-237-C3 and FB15k-237-R3, and those between FB15k-237-C5/C10 and FB15k-237-R5/R10 are supplemented in Appendix~\ref{app:dataset}. We can see that FB15k-237-C3 exhibits more differences in the relation, entity and triplet numbers. The average degrees and clustering coefficients of local datasets in FB15k-237-C3 are larger and more varying than those in FB15k-237-R3. Furthermore, the numbers of overlapping entities of FB15k-237-C3 and R3 are 1,447 and 11,067, respectively. This shows two key properties of our clustering-based datasets: (i) the local data distribution of each client is smooth, and the agglomeration is strong; and (ii) the data among clients are highly heterogeneous. \subsection{Experiments on Federated Learning} \begin{table*}[!t] \centering \caption{Average link prediction results on FB15k-237-C3/C5/C10} {\small \begin{tabular}{ll|cccc|cccc|cccc} \toprule \multicolumn{2}{c|}{\multirow{2}{*}{Methods}} & \multicolumn{4}{c|}{FB15k-237-C3} & \multicolumn{4}{c|}{FB15k-237-C5} & \multicolumn{4}{c}{FB15k-237-C10} \\ \cmidrule(lr){3-6} \cmidrule(lr){7-10} \cmidrule(lr){11-14} & & Hits@1 & Hits@3 & Hits@10 & MRR & Hits@1 & Hits@3 & Hits@10 & MRR & Hits@1 & Hits@3 & Hits@10 & MRR \\ \midrule \parbox[t]{3mm}{\multirow{7}{*}{\rotatebox[origin=c]{90}{TransE}}} & Independent & 19.48 & 37.57 & 53.91 & 31.44 & 19.77 & 39.77 & 56.28 & 32.60 & 18.68 & 38.56 & 55.66 & 31.52 \\ & Centralized & 20.40 & 38.79 & 56.14 & 32.65 & 20.53 & 38.98 & 56.53 & 32.86 & 20.17 & 38.57 & 56.29 & 32.49 \\ & FedE & 20.25 & 39.19 & 56.18 & 32.66 & 20.66 & 39.78 & 57.12 & 33.23 & 19.86 & 38.15 & 55.82 & 32.10 \\ & FedProx & 20.20 & 38.76 & 55.91 & 32.50 & 21.02 & \underline{39.99} & 57.36 & 33.57 & 20.04 & 38.62 & 56.17 & 32.43 \\ & FedEC & 20.65 & 39.36 & 56.44 & 32.99 & 21.11 & 39.90 & 57.42 & 33.54 & 20.05 & 38.67 & 56.27 & 32.42 \\ & FedLU\xspace (local) & \textbf{21.27} & \textbf{40.21} & \textbf{57.53} & \textbf{33.71} & \textbf{21.89} & \textbf{40.58} & \textbf{58.19} & \textbf{34.32} & \textbf{21.05} & \textbf{39.66} & \textbf{57.44} & \textbf{33.44} \\ & FedLU\xspace (global) & \underline{20.94} & \underline{39.71} & \underline{56.89} & \underline{33.30} & \underline{21.38} & \textbf{40.58} & \underline{57.96} & \underline{33.98} & \underline{20.53} & \underline{39.21} & \underline{56.82} & \underline{32.95} \\ \midrule \parbox[t]{3mm}{\multirow{7}{*}{\rotatebox[origin=c]{90}{ComplEx}}} & Independent & 23.85 & 39.10 & 54.40 & 34.21 & 22.90 & 37.47 & 52.21 & 32.87 & 23.52 & 39.20 & 54.46 & 34.05 \\ & Centralized & \underline{23.95} & 40.51 & 56.45 & 35.02 & \textbf{24.47} & \underline{40.96} & \underline{57.22} & \underline{35.57} & \underline{24.73} & \underline{40.70} & \underline{56.69} & \underline{35.52} \\ & FedE & 20.88 & 36.22 & 52.31 & 31.45 & 19.82 & 35.32 & 51.65 & 30.49 & 19.52 & 34.79 & 50.61 & 30.02 \\ & FedProx & 22.67 & 41.04 & 57.82 & 34.71 & 22.75 & 38.54 & 54.88 & 33.57 & 20.73 & 38.72 & 55.70 & 32.66 \\ & FedEC & 22.44 & 40.97 & 57.91 & 34.58 & 19.63 & 37.06 & 54.09 & 31.30 & 20.59 & 38.36 & 55.65 & 32.53 \\ & FedLU\xspace (local) & \textbf{25.38} & \textbf{43.37} & \textbf{59.46} & \textbf{37.10} & \underline{24.05} & \textbf{41.74} & \textbf{58.11} & \textbf{35.66} & \textbf{25.14} & \textbf{42.01} & \textbf{57.92} & \textbf{36.33} \\ & FedLU\xspace (global) & 23.58 & \underline{41.50} & \underline{57.94} & \underline{35.37} & 22.33 & 39.95 & 56.81 & 34.07 & 22.12 & 38.92 & 55.40 & 33.45 \\ \midrule \parbox[t]{3mm}{\multirow{7}{*}{\rotatebox[origin=c]{90}{RotatE}}} & Independent & 24.31 & 43.13 & 59.55 & 36.47 & 26.43 & 43.36 & 59.45 & 37.64 & 23.94 & 41.80 & 57.95 & 35.67 \\ & Centralized & 25.68 & 44.55 & 61.55 & 37.94 & 26.23 & 45.05 & 62.05 & 38.48 & 25.29 & 44.39 & \textbf{61.64} & 37.76 \\ & FedE & 21.23 & 39.81 & 56.71 & 33.46 & 21.94 & 40.70 & 57.62 & 34.24 & 20.54 & 38.96 & 56.41 & 32.82 \\ & FedProx & 26.07 & 45.01 & 61.71 & 38.33 & 26.92 & \textbf{45.75} & \textbf{62.49} & \underline{39.14} & \underline{25.75} & \underline{44.52} & 61.53 & 37.99 \\ & FedEC & 26.13 & 45.20 & 61.76 & 38.38 & 26.50 & 45.12 & 61.82 & 38.67 & 25.53 & 44.49 & 61.33 & 37.86 \\ & FedLU\xspace (local) & \underline{26.80} & \underline{45.50} & \textbf{62.13} & \textbf{38.92} & \textbf{27.52} & 45.56 & 62.21 & \textbf{39.34} & \textbf{26.01} & \textbf{44.83} & \underline{61.63} & \textbf{38.22} \\ & FedLU\xspace (global) & \textbf{26.81} & \textbf{45.56} & \underline{61.93} & \underline{38.90} & \underline{27.08} & \underline{45.57} & \underline{62.24} & 39.13 & 25.71 & \textbf{44.83} & 61.32 & \underline{38.00} \\ \bottomrule \multicolumn{14}{l}{The best and second best scores are marked in \textbf{bold} and with \underline{underline}, respectively.} \end{tabular}} \label{tab:lp_fb237c} \end{table*} \begin{table*}[!t] \centering \caption{Average unlearning results on different sets of FB15K-237-C3 with the local and global models} {\small \begin{tabular}{l|cccccc|cccccc} \toprule \multirow{2}{*}{Hits@1} & \multicolumn{2}{c}{Raw local} & \multicolumn{2}{c}{Re-trained local} & \multicolumn{2}{c|}{Unlearned local} & \multicolumn{2}{c}{Raw global} & \multicolumn{2}{c}{Re-trained global} & \multicolumn{2}{c}{Unlearned global}\\ \cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} \cmidrule(lr){8-9} \cmidrule(lr){10-11} \cmidrule(lr){12-13} & Forget$\downarrow$ & Test$\uparrow$ & Forget$\downarrow$ & Test$\uparrow$ & Forget$\downarrow$ & Test$\uparrow$ & Forget$\downarrow$ & Test$\uparrow$ & Forget$\downarrow$ & Test$\uparrow$ & Forget$\downarrow$ & Test$\uparrow$ \\ \midrule TransE & 38.86 & 21.27 & 21.10 & 20.86 & 13.23 & 21.04 & 36.83 & 20.88 & 20.22 & 19.94 & 15.02 & 20.95 \\ ComplEx & 59.16 & 25.38 & 17.60 & 16.70 & \ \ 6.26 & 23.49 & 54.05 & 24.13 & 25.63 & 23.98 & \ \ 5.72 & 23.03 \\ RotatE & 64.54 & 26.80 & 25.17 & 25.87 & 19.65 & 26.66 & 62.99 & 26.86 & 26.46 & 25.78 & 22.73 & 26.24 \\ \bottomrule \toprule \multirow{2}{*}{MRR} & \multicolumn{2}{c}{Raw local} & \multicolumn{2}{c}{Re-trained local} & \multicolumn{2}{c|}{Unlearned local} & \multicolumn{2}{c}{Raw global} & \multicolumn{2}{c}{Re-trained global} & \multicolumn{2}{c}{Unlearned global}\\ \cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} \cmidrule(lr){8-9} \cmidrule(lr){10-11} \cmidrule(lr){12-13} & Forget$\downarrow$ & Test$\uparrow$ & Forget$\downarrow$ & Test$\uparrow$ & Forget$\downarrow$ & Test$\uparrow$ & Forget$\downarrow$ & Test$\uparrow$ & Forget$\downarrow$ & Test$\uparrow$ & Forget$\downarrow$ & Test$\uparrow$ \\ \midrule TransE & 52.54 & 33.71 & 33.23 & 33.03 & 24.56 & 33.43 & 50.71 & 33.32 & 32.33 & 32.18 & 27.09 & 33.33\\ ComplEx & 70.44 & 37.10 & 27.32 & 26.53 & 13.83 & 35.14 & 65.57 & 35.67 & 37.48 & 36.13 & 12.70 & 34.76 \\ RotatE & 74.87 & 38.92 & 37.57 & 37.82 & 32.47 & 38.73 & 73.71 & 38.98 & 38.42 & 37.79 & 36.40 & 38.36 \\ \bottomrule \end{tabular} } \label{tab:unlearn_fb237c3} \end{table*} \noindent\textbf{Baselines.} To validate the effectiveness of learning in FedLU\xspace, we compare FedLU\xspace with various federated KG embedding methods, including FedE~\cite{FedE}, FedProx~\cite{FedProx}\footnote{Our implementation of FedProx is FedE with a regularization term, which keeps local embeddings close to global embeddings by minimizing their distance $||\mathbf{E}^k-\mathbf{E}^k_t||_{L2}$.}, FedEC~\cite{FedEC}, and two baseline settings, namely independent and centralized. The independent setting means training separate embeddings for each client with its local dataset, and the centralized setting means training a global embedding by aggregating the local datasets from all clients. All these methods and settings are realized with three representative KG embedding models, i.e., TransE~\cite{TransE}, ComplEx~\cite{ComplEx} and RotatE~\cite{RotatE}. \smallskip \noindent\textbf{Evaluation setup.} Following the convention, we use average Hits@$N$ ($N=1,3,10$) and mean reciprocal rank (MRR) of all clients under the filtered setting to evaluate the entity link prediction performance of each method. The local triplets in each client are randomly divided with the ratio 8:1:1 for training, validation and test. We report the results of local and global embeddings of FedLU\xspace. \smallskip \noindent\textbf{Implementation details.} We employ the Adam~\cite{Adam} optimizer with a learning rate of 1e-4. For the independent and centralized settings, we evaluate the validation set every 5 epochs. We further use early stop based on MRR on the validation sets with a patience of 3. For FedLU\xspace and other competitors, we train the local model for 3 epochs in each communication round. We also evaluate the validation sets every 5 communication rounds. Moreover, we set the patience to 3 for early stop based on the average MRR of all clients. The sampling fraction to select involved clients in each round of federated KG embedding learning is set to 100\% following FedE and FedEC. Note that FedLU\xspace has the ability to deal with varying sampling fractions. For the KG embedding models, we set the batch size to 1,024, the negative sampling size to 256, and the dimension of entity and relation embeddings to 256. For FedProx, we set $\mu$ for the proximal term to 0.1. For FedEC, we set $\tau$ to 0.2 and $\mu_\text{con}$ to 0.3. For FedLU\xspace, we set $\mu_{\text{distill}}$ to 2. \smallskip \noindent\textbf{Results.} The results on FB15k-237-C3, C5 and C10 are presented in Table~\ref{tab:lp_fb237c}, and those on FB15k-237-R3, R5 and R10 are shown in Appendix~\ref{app:lp_fb237_R}. We can find that (i) our proposed FedLU\xspace can generally achieve better performance in link prediction than others. (ii) For different client numbers, FedLU\xspace achieves consistent performance after convergence. As shown in Figure~\ref{fig:conv} shortly, the convergence round becomes larger with the number of clients increases. (iii) Compared to the independent setting, FedProx, FedEC and FedLU\xspace all gain improvement, while the results of FedE do not significantly increase or even decline sometimes. This indicates that FedE can hardly handle such heterogeneous datasets. (iv) We also see that, in several cases, FedLU\xspace even outperforms the centralized setting, suggesting that for the datasets with strong heterogeneity, smoothly exchanging knowledge through mutual distillation is more appropriate than directly sharing data. (v) In most cases, FedLU\xspace (global) achieves the second-best performance, which is only behind FedLU\xspace (local). This shows that FedLU\xspace obtains a global entity embedding which is compatible with local embeddings in clients. \subsection{Experiments on Federated Unlearning} \noindent\textbf{Baselines.} To assess the federated unlearning in FedLU\xspace, we compare the performance of raw, re-trained and unlearned embeddings. The raw embeddings are derived from federated learning of FedLU\xspace. The re-trained embeddings are re-trained from scratch using the retaining triplets. The unlearned embeddings are generated from raw embeddings through unlearning in FedLU\xspace. \smallskip \noindent\textbf{Evaluation setup.} We randomly sample a forgetting set from the original training set of each client with a proportion of 1\%. We feed the forgetting sets into re-trained/unlearned embeddings, and compare the prediction results with those obtained by the raw embeddings, to measure the ability of FedLU\xspace in forgetting specific knowledge. Smaller Hits@1 and MRR on the forgetting sets indicate that the model forgets more thoroughly. In addition, we use the original test sets to quantify how much performance reduction that we have to pay as the cost of unlearning. We compare the local and global embeddings to see if the unlearned knowledge can be propagated to the global embedding smoothly in FedLU\xspace. The re-trained local embeddings are obtained with a single embedding model for each client with their local retaining sets. The re-trained global embedding is generated by aggregating the retaining sets of all clients. We report the average Hits@1 and MRR scores on the forgetting and test sets of all clients. \smallskip \noindent\textbf{Implementation details.} For the re-trained embeddings, we follow the previous hyperparameter settings. For the retroactive interference in unlearning, we set $\mu_{\text{soft}}$ to 0.1. Moreover, we set the training epoch of unlearning to 10, which is much smaller than re-training. \smallskip \noindent\textbf{Results.} The unlearning results on the FB15k-237-C3 dataset are shown in Table~\ref{tab:unlearn_fb237c3}, and other results are given in Appendix \ref{app:unlearn_fb237_C5C10}. We have three findings: (i) The Hits@1 and MRR scores of the re-trained models on the forgetting sets are close to those on the test sets. This indicates that the re-trained models are still able to predict missing links, i.e., completely forgetting cannot be achieved through re-training from scratch. (ii) The scores of the unlearned embeddings drop to a lower level on the forgetting sets than the raw embeddings and the re-trained embeddings, suggesting that FedLU\xspace is able to erase the knowledge thoroughly and suppress the activation of the memory to the forgetting sets during unlearning. (iii) The unlearned embeddings achieve comparable performance on the test sets with the raw models, which is higher than the re-trained models. This indicates that unlearning in FedLU\xspace can maintain the global knowledge absorbed in FL. \subsection{Further Analysis} \noindent\textbf{Ablation study.} Regarding the learning in FedLU\xspace, if we abrogate the mutual knowledge distillation between the global and local embeddings, the global embedding degrades to the entity embedding in FedE and the local embeddings degrade to the entity embeddings in the independent setting. The performance of the global and local embeddings in FedLU\xspace is much better than FedE and the independent setting, which validates the smooth knowledge exchange realized by mutual knowledge distillation. To evaluate the effectiveness of the hard and soft confusions in the retroactive interference step of FedLU\xspace, we modify two variants in federated unlearning, namely FedLU\xspace without hard confusion and FedLU\xspace without soft confusion. From Table~\ref{tab:unlearn_fb237c3_ablation}, we find that: (i) The Hits@1 scores of FedLU\xspace without hard or soft confusion on the forgetting sets are much lower than those of the raw models in Table~\ref{tab:unlearn_fb237c3}, suggesting that both of them are effective. (ii) FedLU\xspace without hard confusion shows higher Hits@1 on the forgetting sets, indicating that the hard confusion plays a key role in unlearning. (iii) The Hits@1 scores of FedLU\xspace without soft confusion is slightly higher than the original FedLU\xspace. This shows that the soft confusion acts as a fine-tuning factor in retroactive inference. \begin{table}[!t] \centering \caption{Ablation studies on FB15K-237-C3} {\small \begin{tabular}{l|cc|cc} \toprule \multirow{2}{*}{Hits@1} & \multicolumn{2}{c|}{Unlearned local} & \multicolumn{2}{c}{Unlearned global} \\ \cmidrule(lr){2-3} \cmidrule(lr){4-5} & Forget$\downarrow$ & Test$\uparrow$ & Forget$\downarrow$ & Test$\uparrow$ \\ \midrule TransE & 13.23 & 21.04 & 15.02 & 20.95 \\ \quad w/o hard confusion & 17.32 & 21.18 & 18.06 & 20.99 \\ \quad w/o soft confusion & 15.87 & 20.73 & 15.28 & 20.59 \\ \midrule ComplEx & \ \ 6.26 & 23.49 & \ \ 5.72 & 23.03 \\ \quad w/o hard confusion & 19.94 & 23.31 & 18.36 & 22.82 \\ \quad w/o soft confusion & \ \ 7.71 & 23.36 & \ \ 6.48 & 23.00 \\ \midrule RotatE & 19.65 & 26.66 & 22.73 & 26.24 \\ \quad w/o hard confusion & 34.23 & 26.06 & 32.60 & 25.84 \\ \quad w/o soft confusion & 21.59 & 26.23 & 24.69 & 26.24 \\ \bottomrule \end{tabular} } \label{tab:unlearn_fb237c3_ablation} \end{table} \begin{figure}[!t] \centering \includegraphics[width=\linewidth]{figs/ConvergenceC3TransE.pdf} \caption{Hits@1 results of TransE on the validation sets w.r.t. communication rounds.} \label{fig:conv} \end{figure} \smallskip \noindent\textbf{Convergence speed.} Figure~\ref{fig:conv} shows the average Hits@1 of FedLU\xspace (TransE) on the validation sets w.r.t. communication rounds, compared with other competitors. In addition to the higher average Hits@1, we can also see that the mutual distillation of the local and global embeddings makes FedLU\xspace converge faster, while other competitors converge slower due to directly using the aggregated global embedding for initializing local training. \smallskip \noindent\textbf{Entity embedding visualization.} To find out the reason that FedLU\xspace shows advantage against other federated KG embedding methods, we plot the t-SNE \cite{t-SNE} visualization of the entity embeddings on FB15k-237-C3 for each client using TransE in Figure~\ref{fig:tsne_TransE_c3}. Appendix~\ref{app:entity_embedding_fb237_C5} shows the visualization on FB15k-237-C5. The triplet proportions in the three clients are approximately 18:5:80. We observe that FedE, FedProx and FedEC exhibit commonalities in their embeddings: entities on Client 2 (with less triplets) are isolated, while entities on Client 1 and Client 3 are highly overlapping. This indicates that, for better performance in KG embedding, FedE, FedProx and FedEC tend to aggregate knowledge of the clients with more triplets while ignoring clients with less triplets. However, FedLU\xspace shows a quite different manner. The entity embeddings between each client intersect with each other, but only have small overlap. Also, the entity embeddings within each client are more clustered. This indicates that the entity embeddings generated by FedLU\xspace can not only relate and aggregate the knowledge of all clients, but also give consideration to the local optimization. FedLU\xspace achieves better performance than others as the learned embeddings describe different but related sides of corresponding entities. \begin{figure}[!t] \centering \subfigure[FedE]{ \label{fig:tsne_TransE_c3_FedE} % \includegraphics[height = 30 mm]{figs/C3FedETransE_embed_font.jpg}} \subfigure[FedProx]{ \label{fig:tsne_TransE_c3_FedProx} % \includegraphics[height = 30 mm]{figs/C3FedProxTransE_embed_font.jpg}} \subfigure[FedEC]{ \label{fig:tsne_TransE_c3_FedEC} % \includegraphics[height = 30 mm]{figs/C3FedECTransE_embed_font.jpg}} \subfigure[FedLU\xspace]{ \label{fig:tsne_TransE_c3_FedLU} % \includegraphics[height = 30 mm]{figs/C3FedLUTransE_embed_font.jpg}} \caption{t-SNE plot of entity embeddings on FB15k-237-C3 from each client using TransE, where blue, red and green dots are from Clients 1, 2 and 3, respectively.} \label{fig:tsne_TransE_c3} \end{figure} \section{Conclusion} We propose FedLU\xspace, a novel federated KG embedding learning and unlearning framework. In federated learning, we design mutual knowledge distillation to smoothly exchange knowledge among clients, achieving global convergence and local optimization. In federated unlearning, we combine retroactive interference and passive decay to enable triplet unlearning and propagation. We conduct extensive experiments on three newly-constructed datasets of heterogeneity. The experimental results show that FedLU\xspace achieves better accuracy in link prediction. It can also forget specific knowledge without significantly hurting the overall performance. In future work, we plan to study the continual learning and unlearning of federated KG embedding along the life cycle of KGs. \smallskip\noindent\textbf{Acknowledgments.} This work is supported by National Natural Science Foundation of China (No. 62272219). \bibliographystyle{ACM-Reference-Format}